From 4d1a0957e125350fd15c6a017d8004ff5b6a7356 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Fri, 19 Mar 2021 23:36:52 +0000 Subject: [PATCH 1/3] Added discover and connect device in example --- examples/JS-Example/blue-falcon.js | 2 + examples/JS-Example/index.html | 28 +++++++++ library/build.gradle.kts | 9 ++- .../dev/bluefalcon/BlueFalconDelegate.kt | 12 ++++ .../kotlin/dev/bluefalcon/BlueFalcon.kt | 61 +++++++++++++++++-- .../jsMain/kotlin/dev/bluefalcon/Bluetooth.kt | 13 ++++ .../kotlin/dev/bluefalcon/BluetoothDevice.kt | 34 +++++++++++ .../dev/bluefalcon/BluetoothPeripheral.kt | 6 +- 8 files changed, 151 insertions(+), 14 deletions(-) create mode 100644 examples/JS-Example/blue-falcon.js create mode 100644 examples/JS-Example/index.html create mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/Bluetooth.kt create mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/BluetoothDevice.kt diff --git a/examples/JS-Example/blue-falcon.js b/examples/JS-Example/blue-falcon.js new file mode 100644 index 0000000..c785ac1 --- /dev/null +++ b/examples/JS-Example/blue-falcon.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["blue-falcon"]=e():t["blue-falcon"]=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){var r,o,i;o=[e,n(2)],void 0===(i="function"==typeof(r=function(t,e){"use strict";e.Kind.INTERFACE;var n=e.Kind.CLASS,r=(e.kotlin.Exception,e.throwCCE),o=e.toString,i=e.kotlin.Unit,s=e.kotlin.collections.LinkedHashSet_init_287e2$,a=e.kotlin.NotImplementedError,u=e.kotlin.io.println_s8jyv4$;function p(){}function c(t,e){this.delegates=s(),this.isScanning=!1}function l(t){var e;for(e=t.iterator();e.hasNext();)y("Service: "+e.next().uuid);return i}function h(t){this.acceptAllDevices=t}function f(t){this.device=t}function y(t){u(t)}p.$metadata$={kind:n,simpleName:"ApplicationContext",interfaces:[]},c.prototype.get_bluetooth_0=function(t){var n;return e.isType(n=t.bluetooth,Bluetooth)?n:r()},c.prototype.addDelegate=function(t){this.delegates.add_11rb$(t)},c.prototype.removeDelegate=function(t){this.delegates.remove_11rb$(t)},c.prototype.connect=function(t,e){var n,r,s,a,u,p,c;if(void 0===e&&(e=!1),y("connect -> "+t.device+":"+o(t.device.gatt)+" gatt connected? "+o(null!=(n=t.device.gatt)?n.connected:null)),!0===(null!=(r=t.device.gatt)?r.connected:null))for(u=this.delegates.iterator();u.hasNext();)u.next().didConnect(t);else null!=(a=null!=(s=t.device.gatt)?s.connect():null)&&a.then((p=t,c=this,function(t){return c.connect(p),i}))},c.prototype.disconnect=function(t){var e;null!=(e=t.device.gatt)&&e.disconnect()},c.prototype.stopScanning=function(){},c.prototype.scan=function(){var t,n;(e.isType(t=window.navigator.bluetooth,Bluetooth)?t:r()).requestDevice(new h(!0)).then((n=this,function(t){var e,r=new f(t);for(e=n.delegates.iterator();e.hasNext();)e.next().didDiscoverDevice(r);return i}))},c.prototype.readService=function(t,e){var n,r;null!=(r=null!=(n=t.device.gatt)?n.getPrimaryServices(e):null)&&r.then(l)},c.prototype.readCharacteristic=function(t,e){throw new a("An operation is not implemented: not implemented")},c.prototype.writeCharacteristic=function(t,e,n,r){throw new a("An operation is not implemented: not implemented")},c.prototype.writeCharacteristic_5wdhue$=function(t,e,n,r){throw new a("An operation is not implemented: not implemented")},c.prototype.notifyCharacteristic=function(t,e,n){throw new a("An operation is not implemented: not implemented")},c.prototype.indicateCharacteristic=function(t,e,n){throw new a("An operation is not implemented: not implemented")},c.prototype.notifyAndIndicateCharacteristic=function(t,e,n){throw new a("An operation is not implemented: not implemented")},c.prototype.readDescriptor=function(t,e,n){throw new a("An operation is not implemented: not implemented")},c.prototype.changeMTU=function(t,e){throw new a("An operation is not implemented: not implemented")},c.$metadata$={kind:n,simpleName:"BlueFalcon",interfaces:[]},h.$metadata$={kind:n,simpleName:"BluetoothOptions",interfaces:[]},h.prototype.component1=function(){return this.acceptAllDevices},h.prototype.copy_6taknv$=function(t){return new h(void 0===t?this.acceptAllDevices:t)},h.prototype.toString=function(){return"BluetoothOptions(acceptAllDevices="+e.toString(this.acceptAllDevices)+")"},h.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.acceptAllDevices)|0},h.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.acceptAllDevices,t.acceptAllDevices)},Object.defineProperty(f.prototype,"name",{configurable:!0,get:function(){return this.device.name}}),Object.defineProperty(f.prototype,"services",{configurable:!0,get:function(){throw new a("An operation is not implemented: not implemented")}}),Object.defineProperty(f.prototype,"uuid",{configurable:!0,get:function(){return this.device.id}}),Object.defineProperty(f.prototype,"rssi",{configurable:!0,get:function(){throw new a("An operation is not implemented: not implemented")},set:function(t){}}),f.$metadata$={kind:n,simpleName:"BluetoothPeripheral",interfaces:[]};var _=t.dev||(t.dev={}),d=_.bluefalcon||(_.bluefalcon={});return d.ApplicationContext=p,d.BlueFalcon=c,d.BluetoothOptions=h,d.BluetoothPeripheral=f,d.log_61zpoe$=y,new c(new p,null),t})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){(function(n){var r,o,i;o=[e],void 0===(i="function"==typeof(r=function(t){var e,r,o,i,s,a,u,p=t;function c(t){if(!("kotlinHashCodeValue$"in t)){var e=4294967296*Math.random()|0;Object.defineProperty(t,"kotlinHashCodeValue$",{value:e,enumerable:!1})}return t.kotlinHashCodeValue$}function l(){throw new Error("This marker function should never been called. Looks like compiler did not eliminate it properly. Please, report an issue if you caught this exception.")}function h(t,e){return(4294901760&t)*(65535&e)+(65535&t)*(0|e)|0}t.isArray=function(t){return Array.isArray(t)&&!t.$type$},t.isArrayish=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)},t.toByte=function(t){return(255&t)<<24>>24},t.toChar=function(t){return 65535&t},t.toBoxedChar=function(e){return null==e||e instanceof t.BoxedChar?e:new t.BoxedChar(e)},t.unboxChar=function(e){return null==e?e:t.toChar(e)},t.equals=function(t,e){return null==t?null==e:null!=e&&(t!=t?e!=e:"object"==typeof t&&"function"==typeof t.equals?t.equals(e):"number"==typeof t&&"number"==typeof e?t===e&&(0!==t||1/t==1/e):t===e)},t.hashCode=function(e){if(null==e)return 0;var n=typeof e;return"object"===n?"function"==typeof e.hashCode?e.hashCode():c(e):"function"===n?c(e):"number"===n?t.numberHashCode(e):"boolean"===n?Number(e):function(t){for(var e=0,n=0;n=t.Long.TWO_PWR_63_DBL_?t.Long.MAX_VALUE:e<0?t.Long.fromNumber(-e).negate():new t.Long(e%t.Long.TWO_PWR_32_DBL_|0,e/t.Long.TWO_PWR_32_DBL_|0)},t.Long.fromBits=function(e,n){return new t.Long(e,n)},t.Long.fromString=function(e,n){if(0==e.length)throw Error("number format error: empty string");var r=n||10;if(r<2||36=0)throw Error('number format error: interior "-" character: '+e);for(var o=t.Long.fromNumber(Math.pow(r,8)),i=t.Long.ZERO,s=0;s=0?this.low_:t.Long.TWO_PWR_32_DBL_+this.low_},t.Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equalsLong(t.Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=0!=this.high_?this.high_:this.low_,n=31;n>0&&0==(e&1<0},t.Long.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},t.Long.prototype.compare=function(t){if(this.equalsLong(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.subtract(t).isNegative()?-1:1},t.Long.prototype.negate=function(){return this.equalsLong(t.Long.MIN_VALUE)?t.Long.MIN_VALUE:this.not().add(t.Long.ONE)},t.Long.prototype.add=function(e){var n=this.high_>>>16,r=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,u=e.low_>>>16,p=0,c=0,l=0,h=0;return l+=(h+=i+(65535&e.low_))>>>16,h&=65535,c+=(l+=o+u)>>>16,l&=65535,p+=(c+=r+a)>>>16,c&=65535,p+=n+s,p&=65535,t.Long.fromBits(l<<16|h,p<<16|c)},t.Long.prototype.subtract=function(t){return this.add(t.negate())},t.Long.prototype.multiply=function(e){if(this.isZero())return t.Long.ZERO;if(e.isZero())return t.Long.ZERO;if(this.equalsLong(t.Long.MIN_VALUE))return e.isOdd()?t.Long.MIN_VALUE:t.Long.ZERO;if(e.equalsLong(t.Long.MIN_VALUE))return this.isOdd()?t.Long.MIN_VALUE:t.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(t.Long.TWO_PWR_24_)&&e.lessThan(t.Long.TWO_PWR_24_))return t.Long.fromNumber(this.toNumber()*e.toNumber());var n=this.high_>>>16,r=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,u=e.low_>>>16,p=65535&e.low_,c=0,l=0,h=0,f=0;return h+=(f+=i*p)>>>16,f&=65535,l+=(h+=o*p)>>>16,h&=65535,l+=(h+=i*u)>>>16,h&=65535,c+=(l+=r*p)>>>16,l&=65535,c+=(l+=o*u)>>>16,l&=65535,c+=(l+=i*a)>>>16,l&=65535,c+=n*p+r*u+o*a+i*s,c&=65535,t.Long.fromBits(h<<16|f,c<<16|l)},t.Long.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return t.Long.ZERO;if(this.equalsLong(t.Long.MIN_VALUE)){if(e.equalsLong(t.Long.ONE)||e.equalsLong(t.Long.NEG_ONE))return t.Long.MIN_VALUE;if(e.equalsLong(t.Long.MIN_VALUE))return t.Long.ONE;if((o=this.shiftRight(1).div(e).shiftLeft(1)).equalsLong(t.Long.ZERO))return e.isNegative()?t.Long.ONE:t.Long.NEG_ONE;var n=this.subtract(e.multiply(o));return o.add(n.div(e))}if(e.equalsLong(t.Long.MIN_VALUE))return t.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().div(e.negate()):this.negate().div(e).negate();if(e.isNegative())return this.div(e.negate()).negate();var r=t.Long.ZERO;for(n=this;n.greaterThanOrEqual(e);){for(var o=Math.max(1,Math.floor(n.toNumber()/e.toNumber())),i=Math.ceil(Math.log(o)/Math.LN2),s=i<=48?1:Math.pow(2,i-48),a=t.Long.fromNumber(o),u=a.multiply(e);u.isNegative()||u.greaterThan(n);)o-=s,u=(a=t.Long.fromNumber(o)).multiply(e);a.isZero()&&(a=t.Long.ONE),r=r.add(a),n=n.subtract(u)}return r},t.Long.prototype.modulo=function(t){return this.subtract(this.div(t).multiply(t))},t.Long.prototype.not=function(){return t.Long.fromBits(~this.low_,~this.high_)},t.Long.prototype.and=function(e){return t.Long.fromBits(this.low_&e.low_,this.high_&e.high_)},t.Long.prototype.or=function(e){return t.Long.fromBits(this.low_|e.low_,this.high_|e.high_)},t.Long.prototype.xor=function(e){return t.Long.fromBits(this.low_^e.low_,this.high_^e.high_)},t.Long.prototype.shiftLeft=function(e){if(0==(e&=63))return this;var n=this.low_;if(e<32){var r=this.high_;return t.Long.fromBits(n<>>32-e)}return t.Long.fromBits(0,n<>>e|n<<32-e,n>>e)}return t.Long.fromBits(n>>e-32,n>=0?0:-1)},t.Long.prototype.shiftRightUnsigned=function(e){if(0==(e&=63))return this;var n=this.high_;if(e<32){var r=this.low_;return t.Long.fromBits(r>>>e|n<<32-e,n>>>e)}return 32==e?t.Long.fromBits(n,0):t.Long.fromBits(n>>>e-32,0)},t.Long.prototype.equals=function(e){return e instanceof t.Long&&this.equalsLong(e)},t.Long.prototype.compareTo_11rb$=t.Long.prototype.compare,t.Long.prototype.inc=function(){return this.add(t.Long.ONE)},t.Long.prototype.dec=function(){return this.add(t.Long.NEG_ONE)},t.Long.prototype.valueOf=function(){return this.toNumber()},t.Long.prototype.unaryPlus=function(){return this},t.Long.prototype.unaryMinus=t.Long.prototype.negate,t.Long.prototype.inv=t.Long.prototype.not,t.Long.prototype.rangeTo=function(e){return new t.kotlin.ranges.LongRange(this,e)},t.defineInlineFunction=function(t,e){return e},t.wrapFunction=function(t){var e=function(){return(e=t()).apply(this,arguments)};return function(){return e.apply(this,arguments)}},t.suspendCall=function(t){return t},t.coroutineResult=function(t){l()},t.coroutineReceiver=function(t){l()},t.compareTo=function(e,n){var r=typeof e;return"number"===r?"number"==typeof n?t.doubleCompareTo(e,n):t.primitiveCompareTo(e,n):"string"===r||"boolean"===r?t.primitiveCompareTo(e,n):e.compareTo_11rb$(n)},t.primitiveCompareTo=function(t,e){return te?1:0},t.doubleCompareTo=function(t,e){if(te)return 1;if(t===e){if(0!==t)return 0;var n=1/t;return n===1/e?0:n<0?-1:1}return t!=t?e!=e?0:1:-1},t.imul=Math.imul||h,t.imulEmulated=h,e=new ArrayBuffer(8),r=new Float64Array(e),new Float32Array(e),o=new Int32Array(e),i=0,s=1,r[0]=-1,0!==o[i]&&(i=1,s=0),t.numberHashCode=function(t){return(0|t)===t?0|t:(r[0]=t,(31*o[s]|0)+o[i]|0)},t.ensureNotNull=function(e){return null!=e?e:t.throwNPE()},void 0===String.prototype.startsWith&&Object.defineProperty(String.prototype,"startsWith",{value:function(t,e){return e=e||0,this.lastIndexOf(t,e)===e}}),void 0===String.prototype.endsWith&&Object.defineProperty(String.prototype,"endsWith",{value:function(t,e){var n=this.toString();(void 0===e||e>n.length)&&(e=n.length),e-=t.length;var r=n.indexOf(t,e);return-1!==r&&r===e}}),void 0===Math.sign&&(Math.sign=function(t){return 0==(t=+t)||isNaN(t)?Number(t):t>0?1:-1}),void 0===Math.trunc&&(Math.trunc=function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)}),function(){var t=Math.sqrt(2220446049250313e-31),e=Math.sqrt(t),n=1/t,r=1/e;if(void 0===Math.sinh&&(Math.sinh=function(n){if(Math.abs(n)t&&(r+=n*n*n/6),r}var o=Math.exp(n),i=1/o;return isFinite(o)?isFinite(i)?(o-i)/2:-Math.exp(-n-Math.LN2):Math.exp(n-Math.LN2)}),void 0===Math.cosh&&(Math.cosh=function(t){var e=Math.exp(t),n=1/e;return isFinite(e)&&isFinite(n)?(e+n)/2:Math.exp(Math.abs(t)-Math.LN2)}),void 0===Math.tanh&&(Math.tanh=function(n){if(Math.abs(n)t&&(r-=n*n*n/3),r}var o=Math.exp(+n),i=Math.exp(-n);return o===1/0?1:i===1/0?-1:(o-i)/(o+i)}),void 0===Math.asinh){var o=function(i){if(i>=+e)return i>r?i>n?Math.log(i)+Math.LN2:Math.log(2*i+1/(2*i)):Math.log(i+Math.sqrt(i*i+1));if(i<=-e)return-o(-i);var s=i;return Math.abs(i)>=t&&(s-=i*i*i/6),s};Math.asinh=o}void 0===Math.acosh&&(Math.acosh=function(r){if(r<1)return NaN;if(r-1>=e)return r>n?Math.log(r)+Math.LN2:Math.log(r+Math.sqrt(r*r-1));var o=Math.sqrt(r-1),i=o;return o>=t&&(i-=o*o*o/12),Math.sqrt(2)*i}),void 0===Math.atanh&&(Math.atanh=function(n){if(Math.abs(n)t&&(r+=n*n*n/3),r}return Math.log((1+n)/(1-n))/2}),void 0===Math.log1p&&(Math.log1p=function(t){if(Math.abs(t)>>0;return 0===e?32:31-(a(e)/u|0)|0})),void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(t){return null!=t&&null!=t.__proto__&&t.__proto__.__proto__===Int8Array.prototype.__proto__}),void 0===Array.prototype.fill&&Object.defineProperty(Array.prototype,"fill",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),n=e.length>>>0,r=arguments[1],o=r>>0,i=o<0?Math.max(n+o,0):Math.min(o,n),s=arguments[2],a=void 0===s?n:s>>0,u=a<0?Math.max(n+a,0):Math.min(a,n);ie)return 1;if(t===e){if(0!==t)return 0;var n=1/t;return n===1/e?0:n<0?-1:1}return t!=t?e!=e?0:1:-1};for(r=0;r1&&e.append_gw00v9$(n),!(i<0||p<=i))break;Rn(e,c,a)}return i>=0&&p>i&&e.append_gw00v9$(s),e.append_gw00v9$(o),e}function E(t,e,n,r,o,i,s){return void 0===e&&(e=", "),void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o=-1),void 0===i&&(i="..."),void 0===s&&(s=null),N(t,Pe(),e,n,r,o,i,s).toString()}function L(){}function C(){}function M(){}function I(){}function j(){}function S(){}function A(){}function T(){}function P(){}function q(){}function R(){}function z(){}function B(){}function U(){}function D(){}function W(t,e,n){U.call(this),this.step=n,this.finalElement_0=0|e,this.hasNext_0=this.step>0?t<=e:t>=e,this.next_0=this.hasNext_0?0|t:this.finalElement_0}function H(t,e,n){D.call(this),this.step=n,this.finalElement_0=e,this.hasNext_0=this.step.toNumber()>0?t.compareTo_11rb$(e)<=0:t.compareTo_11rb$(e)>=0,this.next_0=this.hasNext_0?t:this.finalElement_0}function K(t,e,n){if(G(),0===n)throw Lt("Step must be non-zero.");if(-2147483648===n)throw Lt("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=l(_t(0|t,0|e,n)),this.step=n}function V(){F=this}new t.Long(-1478467534,-1720727600),new t.Long(-888910638,1920087921),new t.Long(1993859828,793161749),new t.Long(1,-2147483648),new t.Long(1908874354,-59652324),t.Long.fromInt(2047),wt.prototype=Object.create(k.prototype),wt.prototype.constructor=wt,Ot.prototype=Object.create(wt.prototype),Ot.prototype.constructor=Ot,W.prototype=Object.create(U.prototype),W.prototype.constructor=W,H.prototype=Object.create(D.prototype),H.prototype.constructor=H,tt.prototype=Object.create(K.prototype),tt.prototype.constructor=tt,ot.prototype=Object.create(Z.prototype),ot.prototype.constructor=ot,xt.prototype=Object.create(k.prototype),xt.prototype.constructor=xt,Et.prototype=Object.create(Ot.prototype),Et.prototype.constructor=Et,Ct.prototype=Object.create(Ot.prototype),Ct.prototype.constructor=Ct,It.prototype=Object.create(Ot.prototype),It.prototype.constructor=It,jt.prototype=Object.create(Ot.prototype),jt.prototype.constructor=jt,Tt.prototype=Object.create(Ot.prototype),Tt.prototype.constructor=Tt,Pt.prototype=Object.create(Ot.prototype),Pt.prototype.constructor=Pt,qt.prototype=Object.create(Ot.prototype),qt.prototype.constructor=qt,Dt.prototype=Object.create(De.prototype),Dt.prototype.constructor=Dt,Jt.prototype=Object.create(Dt.prototype),Jt.prototype.constructor=Jt,Kt.prototype=Object.create(Jt.prototype),Kt.prototype.constructor=Kt,Vt.prototype=Object.create(Jt.prototype),Vt.prototype.constructor=Vt,Gt.prototype=Object.create(Dt.prototype),Gt.prototype.constructor=Gt,Wt.prototype=Object.create(Fe.prototype),Wt.prototype.constructor=Wt,re.prototype=Object.create(Kt.prototype),re.prototype.constructor=re,ne.prototype=Object.create(Wt.prototype),ne.prototype.constructor=ne,se.prototype=Object.create(Jt.prototype),se.prototype.constructor=se,fe.prototype=Object.create(Ht.prototype),fe.prototype.constructor=fe,ye.prototype=Object.create(Kt.prototype),ye.prototype.constructor=ye,he.prototype=Object.create(ne.prototype),he.prototype.constructor=he,me.prototype=Object.create(se.prototype),me.prototype.constructor=me,$e.prototype=Object.create(ge.prototype),$e.prototype.constructor=$e,ve.prototype=Object.create(ge.prototype),ve.prototype.constructor=ve,be.prototype=Object.create(ve.prototype),be.prototype.constructor=be,en.prototype=Object.create(De.prototype),en.prototype.constructor=en,Ge.prototype=Object.create(en.prototype),Ge.prototype.constructor=Ge,Je.prototype=Object.create(De.prototype),Je.prototype.constructor=Je,jn.prototype=Object.create(g.prototype),jn.prototype.constructor=jn,Fn.prototype=Object.create(xt.prototype),Fn.prototype.constructor=Fn,L.$metadata$={kind:_,simpleName:"CharSequence",interfaces:[]},C.$metadata$={kind:_,simpleName:"Iterable",interfaces:[]},M.$metadata$={kind:_,simpleName:"MutableIterable",interfaces:[C]},I.$metadata$={kind:_,simpleName:"Collection",interfaces:[C]},j.$metadata$={kind:_,simpleName:"MutableCollection",interfaces:[M,I]},S.$metadata$={kind:_,simpleName:"Set",interfaces:[I]},A.$metadata$={kind:_,simpleName:"MutableSet",interfaces:[j,S]},T.prototype.getOrDefault_xwzc9p$=function(t,e){throw new Fn},P.$metadata$={kind:_,simpleName:"Entry",interfaces:[]},T.$metadata$={kind:_,simpleName:"Map",interfaces:[]},q.prototype.remove_xwzc9p$=function(t,e){return!0},R.$metadata$={kind:_,simpleName:"MutableEntry",interfaces:[P]},q.$metadata$={kind:_,simpleName:"MutableMap",interfaces:[T]},z.$metadata$={kind:_,simpleName:"Iterator",interfaces:[]},B.$metadata$={kind:_,simpleName:"MutableIterator",interfaces:[z]},U.prototype.next=function(){return i(this.nextChar())},U.$metadata$={kind:c,simpleName:"CharIterator",interfaces:[z]},D.prototype.next=function(){return this.nextLong()},D.$metadata$={kind:c,simpleName:"LongIterator",interfaces:[z]},W.prototype.hasNext=function(){return this.hasNext_0},W.prototype.nextChar=function(){var t=this.next_0;if(t===this.finalElement_0){if(!this.hasNext_0)throw Rt();this.hasNext_0=!1}else this.next_0=this.next_0+this.step|0;return l(t)},W.$metadata$={kind:c,simpleName:"CharProgressionIterator",interfaces:[U]},H.prototype.hasNext=function(){return this.hasNext_0},H.prototype.nextLong=function(){var t=this.next_0;if(o(t,this.finalElement_0)){if(!this.hasNext_0)throw Rt();this.hasNext_0=!1}else this.next_0=this.next_0.add(this.step);return t},H.$metadata$={kind:c,simpleName:"LongProgressionIterator",interfaces:[D]},K.prototype.iterator=function(){return new W(this.first,this.last,this.step)},K.prototype.isEmpty=function(){return this.step>0?this.first>this.last:this.first0?String.fromCharCode(this.first)+".."+String.fromCharCode(this.last)+" step "+this.step:String.fromCharCode(this.first)+" downTo "+String.fromCharCode(this.last)+" step "+(0|-this.step)},V.prototype.fromClosedRange_ayra44$=function(t,e,n){return new K(t,e,n)},V.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var F=null;function G(){return null===F&&new V,F}function Z(t,e,n){if(Y(),o(n,a))throw Lt("Step must be non-zero.");if(o(n,f))throw Lt("Step must be greater than Long.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=dt(t,e,n),this.step=n}function J(){X=this}K.$metadata$={kind:c,simpleName:"CharProgression",interfaces:[C]},Z.prototype.iterator=function(){return new H(this.first,this.last,this.step)},Z.prototype.isEmpty=function(){return this.step.toNumber()>0?this.first.compareTo_11rb$(this.last)>0:this.first.compareTo_11rb$(this.last)<0},Z.prototype.equals=function(e){return t.isType(e,Z)&&(this.isEmpty()&&e.isEmpty()||o(this.first,e.first)&&o(this.last,e.last)&&o(this.step,e.step))},Z.prototype.hashCode=function(){return this.isEmpty()?-1:t.Long.fromInt(31).multiply(t.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32)))).add(this.step.xor(this.step.shiftRightUnsigned(32))).toInt()},Z.prototype.toString=function(){return this.step.toNumber()>0?this.first.toString()+".."+this.last.toString()+" step "+this.step.toString():this.first.toString()+" downTo "+this.last.toString()+" step "+this.step.unaryMinus().toString()},J.prototype.fromClosedRange_b9bd0d$=function(t,e,n){return new Z(t,e,n)},J.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var X=null;function Y(){return null===X&&new J,X}function Q(){}function tt(t,e){rt(),K.call(this,t,e,1)}function et(){nt=this,this.EMPTY=new tt(l(1),l(0))}Z.$metadata$={kind:c,simpleName:"LongProgression",interfaces:[C]},Q.prototype.contains_mef7kx$=function(e){return t.compareTo(e,this.start)>=0&&t.compareTo(e,this.endInclusive)<=0},Q.prototype.isEmpty=function(){return t.compareTo(this.start,this.endInclusive)>0},Q.$metadata$={kind:_,simpleName:"ClosedRange",interfaces:[]},Object.defineProperty(tt.prototype,"start",{configurable:!0,get:function(){return i(this.first)}}),Object.defineProperty(tt.prototype,"endInclusive",{configurable:!0,get:function(){return i(this.last)}}),tt.prototype.contains_mef7kx$=function(t){return this.first<=t&&t<=this.last},tt.prototype.isEmpty=function(){return this.first>this.last},tt.prototype.equals=function(e){return t.isType(e,tt)&&(this.isEmpty()&&e.isEmpty()||this.first===e.first&&this.last===e.last)},tt.prototype.hashCode=function(){return this.isEmpty()?-1:(31*(0|this.first)|0)+(0|this.last)|0},tt.prototype.toString=function(){return String.fromCharCode(this.first)+".."+String.fromCharCode(this.last)},et.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var nt=null;function rt(){return null===nt&&new et,nt}function ot(t,e){at(),Z.call(this,t,e,m)}function it(){st=this,this.EMPTY=new ot(m,a)}tt.$metadata$={kind:c,simpleName:"CharRange",interfaces:[Q,K]},Object.defineProperty(ot.prototype,"start",{configurable:!0,get:function(){return this.first}}),Object.defineProperty(ot.prototype,"endInclusive",{configurable:!0,get:function(){return this.last}}),ot.prototype.contains_mef7kx$=function(t){return this.first.compareTo_11rb$(t)<=0&&t.compareTo_11rb$(this.last)<=0},ot.prototype.isEmpty=function(){return this.first.compareTo_11rb$(this.last)>0},ot.prototype.equals=function(e){return t.isType(e,ot)&&(this.isEmpty()&&e.isEmpty()||o(this.first,e.first)&&o(this.last,e.last))},ot.prototype.hashCode=function(){return this.isEmpty()?-1:t.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32))).toInt()},ot.prototype.toString=function(){return this.first.toString()+".."+this.last.toString()},it.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var st=null;function at(){return null===st&&new it,st}function ut(){pt=this}ot.$metadata$={kind:c,simpleName:"LongRange",interfaces:[Q,Z]},ut.prototype.toString=function(){return"kotlin.Unit"},ut.$metadata$={kind:d,simpleName:"Unit",interfaces:[]};var pt=null;function ct(){return null===pt&&new ut,pt}function lt(t,e){var n=t%e;return n>=0?n:n+e|0}function ht(t,e){var n=t.modulo(e);return n.toNumber()>=0?n:n.add(e)}function ft(t,e,n){return lt(lt(t,n)-lt(e,n)|0,n)}function yt(t,e,n){return ht(ht(t,n).subtract(ht(e,n)),n)}function _t(t,e,n){if(n>0)return t>=e?e:e-ft(e,t,n)|0;if(n<0)return t<=e?e:e+ft(t,e,0|-n)|0;throw Lt("Step is zero.")}function dt(t,e,n){if(n.toNumber()>0)return t.compareTo_11rb$(e)>=0?e:e.subtract(yt(e,t,n));if(n.toNumber()<0)return t.compareTo_11rb$(e)<=0?e:e.add(yt(t,e,n.unaryMinus()));throw Lt("Step is zero.")}function mt(t){this.c=t}function gt(t){this.resultContinuation_0=t,this.state_0=0,this.exceptionState_0=0,this.result_0=null,this.exception_0=null,this.finallyPath_0=null,this.context_hxcuhl$_0=this.resultContinuation_0.context,this.intercepted__0=null}function $t(){vt=this}mt.prototype.equals=function(e){return t.isType(e,mt)&&this.c===e.c},mt.prototype.hashCode=function(){return this.c},mt.prototype.toString=function(){return String.fromCharCode(s(this.c))},mt.prototype.compareTo_11rb$=function(t){return this.c-t},mt.prototype.valueOf=function(){return this.c},mt.$metadata$={kind:c,simpleName:"BoxedChar",interfaces:[$]},Object.defineProperty(gt.prototype,"context",{configurable:!0,get:function(){return this.context_hxcuhl$_0}}),gt.prototype.intercepted=function(){var t,e,n,r;if(null!=(n=this.intercepted__0))r=n;else{var o=null!=(e=null!=(t=this.context.get_j3r2sn$(yn()))?t.interceptContinuation_wj8d80$(this):null)?e:this;this.intercepted__0=o,r=o}return r},gt.prototype.resumeWith_tl1gpc$=function(e){for(var n,r={v:this},o={v:e.isFailure?null:null==(n=e.value)||t.isType(n,b)?n:x()},i={v:e.exceptionOrNull()};;){var s,a,u=r.v,p=u.resultContinuation_0;null==i.v?u.result_0=o.v:(u.state_0=u.exceptionState_0,u.exception_0=i.v);try{var c=u.doResume();if(c===In())return;o.v=c,i.v=null}catch(t){o.v=null,i.v=t}if(u.releaseIntercepted_0(),!t.isType(p,gt))return null!=(s=i.v)?(p.resumeWith_tl1gpc$(new Bn(Kn(s))),a=ut):a=null,void(null==a&&p.resumeWith_tl1gpc$(new Bn(o.v)));r.v=p}},gt.prototype.releaseIntercepted_0=function(){var t=this.intercepted__0;null!=t&&t!==this&&v(this.context.get_j3r2sn$(yn())).releaseInterceptedContinuation_k98bjh$(t),this.intercepted__0=bt()},gt.$metadata$={kind:c,simpleName:"CoroutineImpl",interfaces:[cn]},Object.defineProperty($t.prototype,"context",{configurable:!0,get:function(){throw Mt("This continuation is already complete".toString())}}),$t.prototype.resumeWith_tl1gpc$=function(t){throw Mt("This continuation is already complete".toString())},$t.prototype.toString=function(){return"This continuation is already complete"},$t.$metadata$={kind:d,simpleName:"CompletedContinuation",interfaces:[cn]};var vt=null;function bt(){return null===vt&&new $t,vt}function xt(e,n){var r;k.call(this),r=null!=n?n:null,this.message_q7r8iu$_0=void 0===e&&null!=r?t.toString(r):e,this.cause_us9j0c$_0=r,t.captureStack(k,this),this.name="Error"}function kt(t,e){return e=e||Object.create(xt.prototype),xt.call(e,t,null),e}function wt(e,n){var r;k.call(this),r=null!=n?n:null,this.message_8yp7un$_0=void 0===e&&null!=r?t.toString(r):e,this.cause_th0jdv$_0=r,t.captureStack(k,this),this.name="Exception"}function Ot(t,e){wt.call(this,t,e),this.name="RuntimeException"}function Nt(t,e){return e=e||Object.create(Ot.prototype),Ot.call(e,t,null),e}function Et(t,e){Ot.call(this,t,e),this.name="IllegalArgumentException"}function Lt(t,e){return e=e||Object.create(Et.prototype),Et.call(e,t,null),e}function Ct(t,e){Ot.call(this,t,e),this.name="IllegalStateException"}function Mt(t,e){return e=e||Object.create(Ct.prototype),Ct.call(e,t,null),e}function It(t){Nt(t,this),this.name="IndexOutOfBoundsException"}function jt(t,e){Ot.call(this,t,e),this.name="UnsupportedOperationException"}function St(t){return t=t||Object.create(jt.prototype),jt.call(t,null,null),t}function At(t,e){return e=e||Object.create(jt.prototype),jt.call(e,t,null),e}function Tt(t){Nt(t,this),this.name="NullPointerException"}function Pt(t){Nt(t,this),this.name="ClassCastException"}function qt(t){Nt(t,this),this.name="NoSuchElementException"}function Rt(t){return t=t||Object.create(qt.prototype),qt.call(t,null),t}function zt(t){this.function$=t}function Bt(t){for(var e=[],n=t.iterator();n.hasNext();)e.push(n.next());return e}function Ut(t,e){var n;if(e.length=0&&(this.buffer=this.buffer+e.substring(0,n),this.flush(),e=e.substring(n+1|0)),this.buffer=this.buffer+e},be.prototype.flush=function(){console.log(this.buffer),this.buffer=""},be.$metadata$={kind:c,simpleName:"BufferedOutputToConsoleLog",interfaces:[ve]},Object.defineProperty(xe.prototype,"context",{configurable:!0,get:function(){return this.delegate_0.context}}),xe.prototype.resumeWith_tl1gpc$=function(t){var e=this.result_0;if(e===Tn())this.result_0=t.value;else{if(e!==In())throw Mt("Already resumed");this.result_0=Pn(),this.delegate_0.resumeWith_tl1gpc$(t)}},xe.prototype.getOrThrow=function(){var e;if(this.result_0===Tn())return this.result_0=In(),In();var n=this.result_0;if(n===Pn())e=In();else{if(t.isType(n,Hn))throw n.exception;e=n}return e},xe.$metadata$={kind:c,simpleName:"SafeContinuation",interfaces:[cn]},Object.defineProperty(ke.prototype,"context",{configurable:!0,get:function(){return this.closure$context}}),ke.prototype.resumeWith_tl1gpc$=function(t){this.closure$resumeWith(t)},ke.$metadata$={kind:c,interfaces:[cn]},Ne.$metadata$={kind:_,simpleName:"Serializable",interfaces:[]},Ee.$metadata$={kind:_,simpleName:"KCallable",interfaces:[]},Le.$metadata$={kind:_,simpleName:"KProperty",interfaces:[Ee]},Ce.$metadata$={kind:_,simpleName:"KMutableProperty",interfaces:[Le]},Me.$metadata$={kind:_,simpleName:"KProperty0",interfaces:[Le]},Ie.$metadata$={kind:_,simpleName:"KMutableProperty0",interfaces:[Ce,Me]},je.$metadata$={kind:_,simpleName:"KProperty1",interfaces:[Le]},Se.$metadata$={kind:_,simpleName:"KMutableProperty1",interfaces:[Ce,je]},Ae.$metadata$={kind:_,simpleName:"Appendable",interfaces:[]},Object.defineProperty(Te.prototype,"length",{configurable:!0,get:function(){return this.string_0.length}}),Te.prototype.charCodeAt=function(t){var e=this.string_0;if(!(t>=0&&t<=zn(e)))throw new It("index: "+t+", length: "+this.length+"}");return e.charCodeAt(t)},Te.prototype.subSequence_vux9f0$=function(t,e){return this.string_0.substring(t,e)},Te.prototype.append_s8itvh$=function(t){return this.string_0+=String.fromCharCode(t),this},Te.prototype.append_gw00v9$=function(t){return this.string_0+=y(t),this},Te.prototype.append_ezbsdh$=function(t,e,n){return this.appendRange_3peag4$(null!=t?t:"null",e,n)},Te.prototype.reverse=function(){for(var t,e,n="",r=this.string_0.length-1|0;r>=0;){var o=this.string_0.charCodeAt((r=(t=r)-1|0,t));if(Re(o)&&r>=0){var s=this.string_0.charCodeAt((r=(e=r)-1|0,e));n=qe(s)?n+String.fromCharCode(i(s))+String.fromCharCode(i(o)):n+String.fromCharCode(i(o))+String.fromCharCode(i(s))}else n+=String.fromCharCode(o)}return this.string_0=n,this},Te.prototype.append_s8jyv4$=function(t){return this.string_0+=y(t),this},Te.prototype.append_6taknv$=function(t){return this.string_0+=t,this},Te.prototype.append_4hbowm$=function(t){return this.string_0+=ze(t),this},Te.prototype.append_61zpoe$=function(t){return this.append_pdl1vj$(t)},Te.prototype.append_pdl1vj$=function(t){return this.string_0=this.string_0+(null!=t?t:"null"),this},Te.prototype.capacity=function(){return this.length},Te.prototype.ensureCapacity_za3lpa$=function(t){},Te.prototype.indexOf_61zpoe$=function(t){return this.string_0.indexOf(t)},Te.prototype.indexOf_bm4lxs$=function(t,e){return this.string_0.indexOf(t,e)},Te.prototype.lastIndexOf_61zpoe$=function(t){return this.string_0.lastIndexOf(t)},Te.prototype.lastIndexOf_bm4lxs$=function(t,e){return 0===t.length&&e<0?-1:this.string_0.lastIndexOf(t,e)},Te.prototype.insert_fzusl$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Te.prototype.insert_6t1mh3$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+String.fromCharCode(i(e))+this.string_0.substring(t),this},Te.prototype.insert_7u455s$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+ze(e)+this.string_0.substring(t),this},Te.prototype.insert_1u9bqd$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Te.prototype.insert_6t2rgq$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Te.prototype.insert_19mbxw$=function(t,e){return this.insert_vqvrqt$(t,e)},Te.prototype.insert_vqvrqt$=function(t,e){Ve().checkPositionIndex_6xvm5r$(t,this.length);var n=null!=e?e:"null";return this.string_0=this.string_0.substring(0,t)+n+this.string_0.substring(t),this},Te.prototype.setLength_za3lpa$=function(t){if(t<0)throw Lt("Negative new length: "+t+".");if(t<=this.length)this.string_0=this.string_0.substring(0,t);else for(var e=this.length;en)throw new It("startIndex: "+t+", length: "+n);if(t>e)throw Lt("startIndex("+t+") > endIndex("+e+")")},Te.prototype.deleteAt_za3lpa$=function(t){return Ve().checkElementIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+this.string_0.substring(t+1|0),this},Te.prototype.deleteRange_vux9f0$=function(t,e){return this.checkReplaceRange_0(t,e,this.length),this.string_0=this.string_0.substring(0,t)+this.string_0.substring(e),this},Te.prototype.toCharArray_pqkatk$=function(t,e,n,r){var o;void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=this.length),Ve().checkBoundsIndexes_cub51b$(n,r,this.length),Ve().checkBoundsIndexes_cub51b$(e,e+r-n|0,t.length);for(var i=e,s=n;s=e)throw new It("index: "+t+", size: "+e)},He.prototype.checkPositionIndex_6xvm5r$=function(t,e){if(t<0||t>e)throw new It("index: "+t+", size: "+e)},He.prototype.checkRangeIndexes_cub51b$=function(t,e,n){if(t<0||e>n)throw new It("fromIndex: "+t+", toIndex: "+e+", size: "+n);if(t>e)throw Lt("fromIndex: "+t+" > toIndex: "+e)},He.prototype.checkBoundsIndexes_cub51b$=function(t,e,n){if(t<0||e>n)throw new It("startIndex: "+t+", endIndex: "+e+", size: "+n);if(t>e)throw Lt("startIndex: "+t+" > endIndex: "+e)},He.prototype.orderedHashCode_nykoif$=function(t){var e,n,r=1;for(e=t.iterator();e.hasNext();){var o=e.next();r=(31*r|0)+(null!=(n=null!=o?w(o):null)?n:0)|0}return r},He.prototype.orderedEquals_e92ka7$=function(t,e){var n;if(t.size!==e.size)return!1;var r=e.iterator();for(n=t.iterator();n.hasNext();){var i=n.next(),s=r.next();if(!o(i,s))return!1}return!0},He.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var Ke=null;function Ve(){return null===Ke&&new He,Ke}function Fe(){tn(),this._keys_up5z3z$_0=null,this._values_6nw1f1$_0=null}function Ge(t){this.this$AbstractMap=t,en.call(this)}function Ze(t){this.closure$entryIterator=t}function Je(t){this.this$AbstractMap=t,De.call(this)}function Xe(t){this.closure$entryIterator=t}function Ye(){Qe=this}Fe.prototype.containsKey_11rb$=function(t){return null!=this.implFindEntry_8k1i24$_0(t)},Fe.prototype.containsValue_11rc$=function(e){var n,r=this.entries;t:do{var i;if(t.isType(r,I)&&r.isEmpty()){n=!1;break t}for(i=r.iterator();i.hasNext();){var s=i.next();if(o(s.value,e)){n=!0;break t}}n=!1}while(0);return n},Fe.prototype.containsEntry_8hxqw4$=function(e){if(!t.isType(e,P))return!1;var n=e.key,r=e.value,i=(t.isType(this,T)?this:x()).get_11rb$(n);if(!o(r,i))return!1;var s=null==i;return s&&(s=!(t.isType(this,T)?this:x()).containsKey_11rb$(n)),!s},Fe.prototype.equals=function(e){if(e===this)return!0;if(!t.isType(e,T))return!1;if(this.size!==e.size)return!1;var n,r=e.entries;t:do{var o;if(t.isType(r,I)&&r.isEmpty()){n=!0;break t}for(o=r.iterator();o.hasNext();){var i=o.next();if(!this.containsEntry_8hxqw4$(i)){n=!1;break t}}n=!0}while(0);return n},Fe.prototype.get_11rb$=function(t){var e;return null!=(e=this.implFindEntry_8k1i24$_0(t))?e.value:null},Fe.prototype.hashCode=function(){return w(this.entries)},Fe.prototype.isEmpty=function(){return 0===this.size},Object.defineProperty(Fe.prototype,"size",{configurable:!0,get:function(){return this.entries.size}}),Ge.prototype.contains_11rb$=function(t){return this.this$AbstractMap.containsKey_11rb$(t)},Ze.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Ze.prototype.next=function(){return this.closure$entryIterator.next().key},Ze.$metadata$={kind:c,interfaces:[z]},Ge.prototype.iterator=function(){return new Ze(this.this$AbstractMap.entries.iterator())},Object.defineProperty(Ge.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMap.size}}),Ge.$metadata$={kind:c,interfaces:[en]},Object.defineProperty(Fe.prototype,"keys",{configurable:!0,get:function(){return null==this._keys_up5z3z$_0&&(this._keys_up5z3z$_0=new Ge(this)),v(this._keys_up5z3z$_0)}}),Fe.prototype.toString=function(){return E(this.entries,", ","{","}",void 0,void 0,(t=this,function(e){return t.toString_55he67$_0(e)}));var t},Fe.prototype.toString_55he67$_0=function(t){return this.toString_kthv8s$_0(t.key)+"="+this.toString_kthv8s$_0(t.value)},Fe.prototype.toString_kthv8s$_0=function(t){return t===this?"(this Map)":y(t)},Je.prototype.contains_11rb$=function(t){return this.this$AbstractMap.containsValue_11rc$(t)},Xe.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Xe.prototype.next=function(){return this.closure$entryIterator.next().value},Xe.$metadata$={kind:c,interfaces:[z]},Je.prototype.iterator=function(){return new Xe(this.this$AbstractMap.entries.iterator())},Object.defineProperty(Je.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMap.size}}),Je.$metadata$={kind:c,interfaces:[De]},Object.defineProperty(Fe.prototype,"values",{configurable:!0,get:function(){return null==this._values_6nw1f1$_0&&(this._values_6nw1f1$_0=new Je(this)),v(this._values_6nw1f1$_0)}}),Fe.prototype.implFindEntry_8k1i24$_0=function(t){var e,n=this.entries;t:do{var r;for(r=n.iterator();r.hasNext();){var i=r.next();if(o(i.key,t)){e=i;break t}}e=null}while(0);return e},Ye.prototype.entryHashCode_9fthdn$=function(t){var e,n,r,o;return(null!=(n=null!=(e=t.key)?w(e):null)?n:0)^(null!=(o=null!=(r=t.value)?w(r):null)?o:0)},Ye.prototype.entryToString_9fthdn$=function(t){return y(t.key)+"="+y(t.value)},Ye.prototype.entryEquals_js7fox$=function(e,n){return!!t.isType(n,P)&&o(e.key,n.key)&&o(e.value,n.value)},Ye.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var Qe=null;function tn(){return null===Qe&&new Ye,Qe}function en(){on(),De.call(this)}function nn(){rn=this}Fe.$metadata$={kind:c,simpleName:"AbstractMap",interfaces:[T]},en.prototype.equals=function(e){return e===this||!!t.isType(e,S)&&on().setEquals_y8f7en$(this,e)},en.prototype.hashCode=function(){return on().unorderedHashCode_nykoif$(this)},nn.prototype.unorderedHashCode_nykoif$=function(t){var e,n=0;for(e=t.iterator();e.hasNext();){var r,o=e.next();n=n+(null!=(r=null!=o?w(o):null)?r:0)|0}return n},nn.prototype.setEquals_y8f7en$=function(t,e){return t.size===e.size&&t.containsAll_brywnq$(e)},nn.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var rn=null;function on(){return null===rn&&new nn,rn}function sn(){}function an(){}function un(t,e){this.map_a09uzx$_0=t,this.default_0=e}function pn(t,e){return function(t,e,n){for(var r={v:!1},o=t.iterator();o.hasNext();)e(o.next())===n&&(o.remove(),r.v=!0);return r.v}(t,e,!0)}function cn(){}function ln(){yn()}function hn(){fn=this}en.$metadata$={kind:c,simpleName:"AbstractSet",interfaces:[S,De]},cn.$metadata$={kind:_,simpleName:"Continuation",interfaces:[]},e("kotlin.kotlin.coroutines.suspendCoroutine_922awp$",r((function(){var e=p.kotlin.coroutines.intrinsics.intercepted_f9mg25$,n=p.kotlin.coroutines.SafeContinuation_init_wj8d80$;return function(r,o){var i;return t.suspendCall((i=r,function(t){var r=n(e(t));return i(r),r.getOrThrow()})(t.coroutineReceiver())),t.coroutineResult(t.coroutineReceiver())}}))),hn.$metadata$={kind:d,simpleName:"Key",interfaces:[mn]};var fn=null;function yn(){return null===fn&&new hn,fn}function _n(){}function dn(t,e){var n=t.minusKey_yeqjby$(e.key);if(n===xn())return e;var r=n.get_j3r2sn$(yn());if(null==r)return new kn(n,e);var o=n.minusKey_yeqjby$(yn());return o===xn()?new kn(e,r):new kn(new kn(o,e),r)}function mn(){}function gn(){}function $n(t){this.key_no4tas$_0=t}function vn(){bn=this,this.serialVersionUID_0=a}_n.prototype.plus_1fupul$=function(t){return t===xn()?this:t.fold_3cc69b$(this,dn)},mn.$metadata$={kind:_,simpleName:"Key",interfaces:[]},gn.prototype.get_j3r2sn$=function(e){return o(this.key,e)?t.isType(this,gn)?this:we():null},gn.prototype.fold_3cc69b$=function(t,e){return e(t,this)},gn.prototype.minusKey_yeqjby$=function(t){return o(this.key,t)?xn():this},gn.$metadata$={kind:_,simpleName:"Element",interfaces:[_n]},_n.$metadata$={kind:_,simpleName:"CoroutineContext",interfaces:[]},vn.prototype.readResolve_0=function(){return xn()},vn.prototype.get_j3r2sn$=function(t){return null},vn.prototype.fold_3cc69b$=function(t,e){return t},vn.prototype.plus_1fupul$=function(t){return t},vn.prototype.minusKey_yeqjby$=function(t){return this},vn.prototype.hashCode=function(){return 0},vn.prototype.toString=function(){return"EmptyCoroutineContext"},vn.$metadata$={kind:d,simpleName:"EmptyCoroutineContext",interfaces:[Ne,_n]};var bn=null;function xn(){return null===bn&&new vn,bn}function kn(t,e){this.left_0=t,this.element_0=e}function wn(t,e){return 0===t.length?e.toString():t+", "+e}function On(t){null===Mn&&new Nn,this.elements=t}function Nn(){Mn=this,this.serialVersionUID_0=a}kn.prototype.get_j3r2sn$=function(e){for(var n,r=this;;){if(null!=(n=r.element_0.get_j3r2sn$(e)))return n;var o=r.left_0;if(!t.isType(o,kn))return o.get_j3r2sn$(e);r=o}},kn.prototype.fold_3cc69b$=function(t,e){return e(this.left_0.fold_3cc69b$(t,e),this.element_0)},kn.prototype.minusKey_yeqjby$=function(t){if(null!=this.element_0.get_j3r2sn$(t))return this.left_0;var e=this.left_0.minusKey_yeqjby$(t);return e===this.left_0?this:e===xn()?this.element_0:new kn(e,this.element_0)},kn.prototype.size_0=function(){for(var e,n,r=this,o=2;;){if(null==(n=t.isType(e=r.left_0,kn)?e:null))return o;r=n,o=o+1|0}},kn.prototype.contains_0=function(t){return o(this.get_j3r2sn$(t.key),t)},kn.prototype.containsAll_0=function(e){for(var n,r=e;;){if(!this.contains_0(r.element_0))return!1;var o=r.left_0;if(!t.isType(o,kn))return this.contains_0(t.isType(n=o,gn)?n:we());r=o}},kn.prototype.equals=function(e){return this===e||t.isType(e,kn)&&e.size_0()===this.size_0()&&e.containsAll_0(this)},kn.prototype.hashCode=function(){return w(this.left_0)+w(this.element_0)|0},kn.prototype.toString=function(){return"["+this.fold_3cc69b$("",wn)+"]"},kn.prototype.writeReplace_0=function(){var e,n,r,o=this.size_0(),i=t.newArray(o,null),s={v:0};if(this.fold_3cc69b$(ct(),(n=i,r=s,function(t,e){var o;return n[(o=r.v,r.v=o+1|0,o)]=e,ut})),s.v!==o)throw Mt("Check failed.".toString());return new On(t.isArray(e=i)?e:we())},Nn.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var En,Ln,Cn,Mn=null;function In(){return An()}function jn(t,e){g.call(this),this.name$=t,this.ordinal$=e}function Sn(){Sn=function(){},En=new jn("COROUTINE_SUSPENDED",0),Ln=new jn("UNDECIDED",1),Cn=new jn("RESUMED",2)}function An(){return Sn(),En}function Tn(){return Sn(),Ln}function Pn(){return Sn(),Cn}function qn(t,e){this.start_p1gsmm$_0=t,this.endInclusive_jj4lf7$_0=e}function Rn(e,n,r){null!=r?e.append_gw00v9$(r(n)):null==n||t.isCharSequence(n)?e.append_gw00v9$(n):t.isChar(n)?e.append_s8itvh$(s(n)):e.append_gw00v9$(y(n))}function zn(t){return t.length-1|0}function Bn(t){Wn(),this.value=t}function Un(){Dn=this}On.prototype.readResolve_0=function(){var t,e=this.elements,n=xn();for(t=0;t!==e.length;++t){var r=e[t];n=n.plus_1fupul$(r)}return n},On.$metadata$={kind:c,simpleName:"Serialized",interfaces:[Ne]},kn.$metadata$={kind:c,simpleName:"CombinedContext",interfaces:[Ne,_n]},e("kotlin.kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn_zb0pmy$",r((function(){var t=p.kotlin.NotImplementedError;return function(e,n){throw new t("Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic")}}))),jn.$metadata$={kind:c,simpleName:"CoroutineSingletons",interfaces:[g]},jn.values=function(){return[An(),Tn(),Pn()]},jn.valueOf_61zpoe$=function(t){switch(t){case"COROUTINE_SUSPENDED":return An();case"UNDECIDED":return Tn();case"RESUMED":return Pn();default:Oe("No enum constant kotlin.coroutines.intrinsics.CoroutineSingletons."+t)}},Object.defineProperty(Bn.prototype,"isSuccess",{configurable:!0,get:function(){return!t.isType(this.value,Hn)}}),Object.defineProperty(Bn.prototype,"isFailure",{configurable:!0,get:function(){return t.isType(this.value,Hn)}}),Bn.prototype.getOrNull=e("kotlin.kotlin.Result.getOrNull",r((function(){var e=Object,n=t.throwCCE;return function(){var r;return this.isFailure?null:null==(r=this.value)||t.isType(r,e)?r:n()}}))),Bn.prototype.exceptionOrNull=function(){return t.isType(this.value,Hn)?this.value.exception:null},Bn.prototype.toString=function(){return t.isType(this.value,Hn)?this.value.toString():"Success("+y(this.value)+")"},Un.prototype.success_mh5how$=e("kotlin.kotlin.Result.Companion.success_mh5how$",r((function(){var t=p.kotlin.Result;return function(e){return new t(e)}}))),Un.prototype.failure_lsqlk3$=e("kotlin.kotlin.Result.Companion.failure_lsqlk3$",r((function(){var t=p.kotlin.createFailure_tcv7n7$,e=p.kotlin.Result;return function(n){return new e(t(n))}}))),Un.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var Dn=null;function Wn(){return null===Dn&&new Un,Dn}function Hn(t){this.exception=t}function Kn(t){return new Hn(t)}function Vn(e){if(t.isType(e.value,Hn))throw e.value.exception}function Fn(t){void 0===t&&(t="An operation is not implemented."),kt(t,this),this.name="NotImplementedError"}Hn.prototype.equals=function(e){return t.isType(e,Hn)&&o(this.exception,e.exception)},Hn.prototype.hashCode=function(){return w(this.exception)},Hn.prototype.toString=function(){return"Failure("+this.exception+")"},Hn.$metadata$={kind:c,simpleName:"Failure",interfaces:[Ne]},Bn.$metadata$={kind:c,simpleName:"Result",interfaces:[Ne]},Bn.prototype.unbox=function(){return this.value},Bn.prototype.hashCode=function(){var e=0;return e=31*e+t.hashCode(this.value)|0},Bn.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.value,e.value)},Fn.$metadata$={kind:c,simpleName:"NotImplementedError",interfaces:[xt]};var Gn=p.kotlin||(p.kotlin={}),Zn=Gn.collections||(Gn.collections={}),Jn=Gn.ranges||(Gn.ranges={});Gn.IllegalArgumentException_init_pdl1vj$=Lt,Zn.LinkedHashMap_init_q3lmfv$=de,Gn.NoSuchElementException_init=Rt,Gn.UnsupportedOperationException_init_pdl1vj$=At,Zn.Collection=I,Zn.joinTo_gcc71v$=N,Zn.joinToString_fmv235$=E;var Xn=Gn.text||(Gn.text={});Xn.get_lastIndex_gw00vp$=zn,Xn.StringBuilder_init=Pe,Gn.js||(Gn.js={}),Gn.CharSequence=L,Zn.Iterable=C,Zn.MutableIterable=M,Zn.MutableCollection=j,Zn.Set=S,Zn.MutableSet=A,T.Entry=P,Zn.Map=T,q.MutableEntry=R,Zn.MutableMap=q,Zn.Iterator=z,Zn.MutableIterator=B,Zn.CharIterator=U,Zn.LongIterator=D,Jn.CharProgressionIterator=W,Jn.LongProgressionIterator=H,Object.defineProperty(K,"Companion",{get:G}),Jn.CharProgression=K,Object.defineProperty(Z,"Companion",{get:Y}),Jn.LongProgression=Z,Jn.ClosedRange=Q,Object.defineProperty(tt,"Companion",{get:rt}),Jn.CharRange=tt,Object.defineProperty(ot,"Companion",{get:at}),Jn.LongRange=ot,Object.defineProperty(Gn,"Unit",{get:ct});var Yn=Gn.internal||(Gn.internal={});Yn.getProgressionLastElement_qt1dr2$=_t,Yn.getProgressionLastElement_b9bd0d$=dt,p.captureStack=function(t,e){Error.captureStackTrace?Error.captureStackTrace(e):e.stack=(new Error).stack},p.BoxedChar=mt;var Qn=Gn.coroutines||(Gn.coroutines={});Qn.CoroutineImpl=gt,Object.defineProperty(Qn,"CompletedContinuation",{get:bt});var tr=Qn.intrinsics||(Qn.intrinsics={});tr.intercepted_f9mg25$=function(e){var n,r,o;return null!=(o=null!=(r=t.isType(n=e,gt)?n:null)?r.intercepted():null)?o:e},Gn.Error_init_pdl1vj$=kt,Gn.Error=xt,Gn.Exception=wt,Gn.RuntimeException_init_pdl1vj$=Nt,Gn.RuntimeException=Ot,Gn.IllegalArgumentException=Et,Gn.IllegalStateException_init_pdl1vj$=Mt,Gn.IllegalStateException=Ct,Gn.IndexOutOfBoundsException=It,Gn.UnsupportedOperationException_init=St,Gn.UnsupportedOperationException=jt,Gn.NullPointerException=Tt,Gn.ClassCastException=Pt,Gn.NoSuchElementException=qt,Gn.Comparator=zt,Zn.copyToArrayImpl=Bt,Zn.copyToExistingArrayImpl=Ut,Zn.LinkedHashSet_init_287e2$=function(t){return t=t||Object.create(me.prototype),ae(de(),t),me.call(t),t},Zn.AbstractMutableCollection=Dt,Wt.SimpleEntry_init_trwmqg$=function(t,e){return e=e||Object.create(Ht.prototype),Ht.call(e,t.key,t.value),e},Wt.SimpleEntry=Ht,Wt.AbstractEntrySet=Kt,Zn.AbstractMutableMap=Wt,Zn.AbstractMutableSet=Jt,Object.defineProperty(Xt,"HashCode",{get:ee}),Zn.EqualityComparator=Xt,Zn.HashMap_init_va96d4$=oe,Zn.HashMap_init_q3lmfv$=ie,Zn.HashMap=ne,Zn.HashSet_init_nn01ho$=ae,Zn.HashSet=se,Zn.InternalHashCodeMap=ue,Zn.InternalMap=ce,Zn.InternalStringMap=le,Zn.LinkedHashMap=he,Zn.LinkedHashSet=me;var er=Gn.io||(Gn.io={});er.BaseOutput=ge,er.NodeJsOutput=$e,er.BufferedOutput=ve,er.BufferedOutputToConsoleLog=be,er.println_s8jyv4$=function(t){Qt.println_s8jyv4$(t)},Qn.SafeContinuation_init_wj8d80$=function(t,e){return e=e||Object.create(xe.prototype),xe.call(e,t,Tn()),e},Qn.SafeContinuation=xe,p.throwNPE=function(t){throw new Tt(t)},p.throwCCE=we,p.throwISE=Oe,er.Serializable=Ne;var nr=Gn.reflect||(Gn.reflect={});nr.KCallable=Ee,nr.KProperty=Le,nr.KMutableProperty=Ce,nr.KProperty0=Me,nr.KMutableProperty0=Ie,nr.KProperty1=je,nr.KMutableProperty1=Se,Xn.Appendable=Ae,Xn.StringBuilder=Te,Xn.isHighSurrogate_myv2d0$=qe,Xn.isLowSurrogate_myv2d0$=Re,Xn.concatToString_355ntz$=ze,Xn.concatToString_wlitf7$=Be,Xn.compareTo_7epoxm$=Ue,Zn.AbstractCollection=De,Object.defineProperty(We,"Companion",{get:Ve}),Zn.AbstractList=We,Object.defineProperty(Fe,"Companion",{get:tn}),Zn.AbstractMap=Fe,Object.defineProperty(en,"Companion",{get:on}),Zn.AbstractSet=en,Zn.removeAll_uhyeqt$=pn,Qn.Continuation=cn,Gn.Result=Bn,tr.get_COROUTINE_SUSPENDED=In,Object.defineProperty(ln,"Key",{get:yn}),Qn.ContinuationInterceptor=ln,_n.Key=mn,_n.Element=gn,Qn.CoroutineContext=_n,Qn.AbstractCoroutineContextElement=$n,Object.defineProperty(Qn,"EmptyCoroutineContext",{get:xn}),Qn.CombinedContext=kn,Object.defineProperty(tr,"COROUTINE_SUSPENDED",{get:In}),Object.defineProperty(jn,"COROUTINE_SUSPENDED",{get:An}),Object.defineProperty(jn,"UNDECIDED",{get:Tn}),Object.defineProperty(jn,"RESUMED",{get:Pn}),tr.CoroutineSingletons=jn,Xn.appendElement_k2zgzt$=Rn,Gn.createFailure_tcv7n7$=Kn,Object.defineProperty(Bn,"Companion",{get:Wn}),Bn.Failure=Hn,Gn.throwOnFailure_iacion$=Vn,Gn.NotImplementedError=Fn,q.prototype.getOrDefault_xwzc9p$=T.prototype.getOrDefault_xwzc9p$,Fe.prototype.getOrDefault_xwzc9p$=T.prototype.getOrDefault_xwzc9p$,Wt.prototype.remove_xwzc9p$=q.prototype.remove_xwzc9p$,ue.prototype.createJsMap=ce.prototype.createJsMap,le.prototype.createJsMap=ce.prototype.createJsMap,sn.prototype.getOrDefault_xwzc9p$=T.prototype.getOrDefault_xwzc9p$,an.prototype.remove_xwzc9p$=q.prototype.remove_xwzc9p$,an.prototype.getOrDefault_xwzc9p$=q.prototype.getOrDefault_xwzc9p$,sn.prototype.getOrDefault_xwzc9p$,un.prototype.remove_xwzc9p$=an.prototype.remove_xwzc9p$,un.prototype.getOrDefault_xwzc9p$=an.prototype.getOrDefault_xwzc9p$,T.prototype.getOrDefault_xwzc9p$,gn.prototype.plus_1fupul$=_n.prototype.plus_1fupul$,ln.prototype.fold_3cc69b$=gn.prototype.fold_3cc69b$,ln.prototype.plus_1fupul$=gn.prototype.plus_1fupul$,$n.prototype.get_j3r2sn$=gn.prototype.get_j3r2sn$,$n.prototype.fold_3cc69b$=gn.prototype.fold_3cc69b$,$n.prototype.minusKey_yeqjby$=gn.prototype.minusKey_yeqjby$,$n.prototype.plus_1fupul$=gn.prototype.plus_1fupul$,kn.prototype.plus_1fupul$=_n.prototype.plus_1fupul$,qn.prototype.contains_mef7kx$=Q.prototype.contains_mef7kx$,qn.prototype.isEmpty=Q.prototype.isEmpty;var rr=void 0!==n&&n.versions&&!!n.versions.node;Qt=rr?new $e(n.stdout):new be,new ke(xn(),(function(e){var n;return Vn(e),null==(n=e.value)||t.isType(n,b)||x(),ut})),u.pow(2,-26),u.pow(2,-53),t.newArray(0,null),new zt((function(t,e){return Ue(t,e,!0)})),new Int8Array([h(239),h(191),h(189)]),new Bn(In())}()})?r.apply(e,o):r)||(t.exports=i)}).call(this,n(3))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,p=[],c=!1,l=-1;function h(){c&&u&&(c=!1,u.length?p=u.concat(p):l=-1,p.length&&f())}function f(){if(!c){var t=a(h);c=!0;for(var e=p.length;e;){for(u=p,p=[];++l1)for(var n=1;n + + + + Javascript External Script + + + + + + + + + diff --git a/library/build.gradle.kts b/library/build.gradle.kts index ca856a1..2158ec0 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -56,13 +56,12 @@ kotlin { kotlinOptions.jvmTarget = "1.8" } } - js(LEGACY) { + js { browser { - testTask { - useKarma { - useChromeHeadless() - } + webpackTask { + output.libraryTarget = "umd" } + binaries.executable() } } iosX64 { diff --git a/library/src/commonMain/kotlin/dev/bluefalcon/BlueFalconDelegate.kt b/library/src/commonMain/kotlin/dev/bluefalcon/BlueFalconDelegate.kt index d22a529..d2a872d 100644 --- a/library/src/commonMain/kotlin/dev/bluefalcon/BlueFalconDelegate.kt +++ b/library/src/commonMain/kotlin/dev/bluefalcon/BlueFalconDelegate.kt @@ -1,18 +1,30 @@ package dev.bluefalcon +import kotlin.js.JsName + +@JsName("BlueFalconDelegate") interface BlueFalconDelegate { + @JsName("didDiscoverDevice") fun didDiscoverDevice(bluetoothPeripheral: BluetoothPeripheral) + @JsName("didConnect") fun didConnect(bluetoothPeripheral: BluetoothPeripheral) + @JsName("didDisconnect") fun didDisconnect(bluetoothPeripheral: BluetoothPeripheral) + @JsName("didDiscoverServices") fun didDiscoverServices(bluetoothPeripheral: BluetoothPeripheral) + @JsName("didDiscoverCharacteristics") fun didDiscoverCharacteristics(bluetoothPeripheral: BluetoothPeripheral) + @JsName("didCharacteristcValueChanged") fun didCharacteristcValueChanged( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic ) + @JsName("didRssiUpdate") fun didRssiUpdate(bluetoothPeripheral: BluetoothPeripheral) + @JsName("didUpdateMTU") fun didUpdateMTU(bluetoothPeripheral: BluetoothPeripheral) + @JsName("didReadDescriptor") fun didReadDescriptor( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristicDescriptor: BluetoothCharacteristicDescriptor diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/BlueFalcon.kt b/library/src/jsMain/kotlin/dev/bluefalcon/BlueFalcon.kt index b0d6412..8e39742 100644 --- a/library/src/jsMain/kotlin/dev/bluefalcon/BlueFalcon.kt +++ b/library/src/jsMain/kotlin/dev/bluefalcon/BlueFalcon.kt @@ -1,26 +1,69 @@ package dev.bluefalcon +import kotlinx.browser.window +import org.w3c.dom.Navigator + +@JsName("blueFalcon") +val blueFalcon = BlueFalcon(ApplicationContext(), null) + actual class BlueFalcon actual constructor(context: ApplicationContext, serviceUUID: String?) { actual val delegates: MutableSet = mutableSetOf() actual var isScanning: Boolean = false + private inline val Navigator.bluetooth: Bluetooth get() = asDynamic().bluetooth as Bluetooth + + @JsName("addDelegate") + fun addDelegate(blueFalconDelegate: BlueFalconDelegate) { delegates.add(blueFalconDelegate) } + + @JsName("removeDelegate") + fun removeDelegate(blueFalconDelegate: BlueFalconDelegate) { delegates.remove(blueFalconDelegate) } + + @JsName("connect") actual fun connect(bluetoothPeripheral: BluetoothPeripheral, autoConnect: Boolean) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + log("connect -> ${bluetoothPeripheral.device}:${bluetoothPeripheral.device.gatt} gatt connected? ${bluetoothPeripheral.device.gatt?.connected}") + if(bluetoothPeripheral.device.gatt?.connected == true) { + delegates.forEach { it.didConnect(bluetoothPeripheral) } + //need to check via https + bluetoothPeripheral.device.gatt.getPrimaryServices(null) + } else { + bluetoothPeripheral.device.gatt?.connect()?.then { gatt -> + connect(bluetoothPeripheral, autoConnect) + } + } } + @JsName("disconnect") actual fun disconnect(bluetoothPeripheral: BluetoothPeripheral) { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + bluetoothPeripheral.device.gatt?.disconnect() } - actual fun stopScanning() { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - } + actual fun stopScanning() {} + @JsName("scan") actual fun scan() { - TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + window.navigator.bluetooth.requestDevice(BluetoothOptions(true)) + .then { bluetoothDevice -> + val device = BluetoothPeripheral(bluetoothDevice) + delegates.forEach { + it.didDiscoverDevice(device) + } + } } + /*@JsName("readService") + fun readService( + bluetoothPeripheral: BluetoothPeripheral, + serviceUUID: String? + ) { + bluetoothPeripheral.device.gatt?.getPrimaryServices(serviceUUID)?.then { services -> + services.forEach { + log("Service: ${it.uuid}") + } + } + }*/ + + @JsName("readCharacteristic") actual fun readCharacteristic( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic @@ -28,6 +71,7 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU TODO("not implemented") } + @JsName("writeCharacteristic") actual fun writeCharacteristic( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic, @@ -46,6 +90,7 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU TODO("not implemented") } + @JsName("notifyCharacteristic") actual fun notifyCharacteristic( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic, @@ -54,6 +99,7 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU TODO("not implemented") } + @JsName("indicateCharacteristic") actual fun indicateCharacteristic( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic, @@ -62,6 +108,7 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU TODO("not implemented") } + @JsName("notifyAndIndicateCharacteristic") actual fun notifyAndIndicateCharacteristic( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic, @@ -70,6 +117,7 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU TODO("not implemented") } + @JsName("readDescriptor") actual fun readDescriptor( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic, @@ -78,6 +126,7 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU TODO("not implemented") } + @JsName("changeMTU") actual fun changeMTU(bluetoothPeripheral: BluetoothPeripheral, mtuSize: Int) { TODO("not implemented") } diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/Bluetooth.kt b/library/src/jsMain/kotlin/dev/bluefalcon/Bluetooth.kt new file mode 100644 index 0000000..94fe667 --- /dev/null +++ b/library/src/jsMain/kotlin/dev/bluefalcon/Bluetooth.kt @@ -0,0 +1,13 @@ +package dev.bluefalcon + +import kotlin.js.Promise + +external class Bluetooth { + val referringDevice: BluetoothDevice? + fun getDevices(): Promise> + fun requestDevice(options: BluetoothOptions?): Promise +} + +data class BluetoothOptions( + val acceptAllDevices: Boolean +) diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothDevice.kt b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothDevice.kt new file mode 100644 index 0000000..3c885ae --- /dev/null +++ b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothDevice.kt @@ -0,0 +1,34 @@ +package dev.bluefalcon + +import kotlin.js.Promise + +//https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice +data class BluetoothDevice( + val id: String, + val name: String?, + val gatt: BluetoothRemoteGATTServer? +) + +interface BluetoothRemoteGATTServer { + val device: BluetoothDevice + val connected: Boolean + fun connect(): Promise + fun disconnect() + @JsName("getPrimaryService") + fun getPrimaryService(bluetoothServiceUUID: String): Promise + @JsName("getPrimaryServices") + fun getPrimaryServices(bluetoothServiceUUID: String?): Promise> +} + +interface BluetoothRemoteGATTService { + val uuid: String + val isPrimary: Boolean + val device: BluetoothDevice + + fun getCharacteristic(bluetoothCharacteristicUUID: String): Promise + //Promise getCharacteristic(BluetoothCharacteristicUUID characteristic); + fun getCharacteristics(bluetoothCharacteristicUUID: String?): Promise> +// Promise> getCharacteristics(optional BluetoothCharacteristicUUID characteristic); +// Promise getIncludedService(BluetoothServiceUUID service); +// Promise> getIncludedServices(optional BluetoothServiceUUID service); +}; \ No newline at end of file diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothPeripheral.kt b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothPeripheral.kt index 1bfe576..b7abff6 100644 --- a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothPeripheral.kt +++ b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothPeripheral.kt @@ -1,12 +1,12 @@ package dev.bluefalcon -actual class BluetoothPeripheral { +actual class BluetoothPeripheral(val device: BluetoothDevice) { actual val name: String? - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + get() = device.name actual val services: List get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. actual val uuid: String - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + get() = device.id actual var rssi: Float? get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. set(value) {} From 9640cd78b1bd186ccc573b6f972a373cb0c21853 Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Sat, 20 Mar 2021 13:36:01 +0000 Subject: [PATCH 2/3] Added working JS bluetooth - read and write to characteristics. --- examples/JS-Example/blue-falcon.js | 2 +- examples/JS-Example/index.html | 56 +++++++++++++++++-- .../kotlin/dev/bluefalcon/BlueFalcon.kt | 45 ++++++++++----- .../jsMain/kotlin/dev/bluefalcon/Bluetooth.kt | 13 ----- .../dev/bluefalcon/BluetoothCharacteristic.kt | 17 ++++-- .../kotlin/dev/bluefalcon/BluetoothDevice.kt | 34 ----------- .../dev/bluefalcon/BluetoothPeripheral.kt | 7 ++- .../kotlin/dev/bluefalcon/BluetoothService.kt | 12 +++- .../dev/bluefalcon/external/Bluetooth.kt | 10 ++++ .../bluefalcon/external/BluetoothDevice.kt | 17 ++++++ .../bluefalcon/external/BluetoothOptions.kt | 51 +++++++++++++++++ .../BluetoothRemoteGATTCharacteristic.kt | 21 +++++++ .../external/BluetoothRemoteGATTServer.kt | 14 +++++ .../external/BluetoothRemoteGATTService.kt | 17 ++++++ 14 files changed, 243 insertions(+), 73 deletions(-) delete mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/Bluetooth.kt delete mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/BluetoothDevice.kt create mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/external/Bluetooth.kt create mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothDevice.kt create mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothOptions.kt create mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTCharacteristic.kt create mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTServer.kt create mode 100644 library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTService.kt diff --git a/examples/JS-Example/blue-falcon.js b/examples/JS-Example/blue-falcon.js index c785ac1..41267b7 100644 --- a/examples/JS-Example/blue-falcon.js +++ b/examples/JS-Example/blue-falcon.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["blue-falcon"]=e():t["blue-falcon"]=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){var r,o,i;o=[e,n(2)],void 0===(i="function"==typeof(r=function(t,e){"use strict";e.Kind.INTERFACE;var n=e.Kind.CLASS,r=(e.kotlin.Exception,e.throwCCE),o=e.toString,i=e.kotlin.Unit,s=e.kotlin.collections.LinkedHashSet_init_287e2$,a=e.kotlin.NotImplementedError,u=e.kotlin.io.println_s8jyv4$;function p(){}function c(t,e){this.delegates=s(),this.isScanning=!1}function l(t){var e;for(e=t.iterator();e.hasNext();)y("Service: "+e.next().uuid);return i}function h(t){this.acceptAllDevices=t}function f(t){this.device=t}function y(t){u(t)}p.$metadata$={kind:n,simpleName:"ApplicationContext",interfaces:[]},c.prototype.get_bluetooth_0=function(t){var n;return e.isType(n=t.bluetooth,Bluetooth)?n:r()},c.prototype.addDelegate=function(t){this.delegates.add_11rb$(t)},c.prototype.removeDelegate=function(t){this.delegates.remove_11rb$(t)},c.prototype.connect=function(t,e){var n,r,s,a,u,p,c;if(void 0===e&&(e=!1),y("connect -> "+t.device+":"+o(t.device.gatt)+" gatt connected? "+o(null!=(n=t.device.gatt)?n.connected:null)),!0===(null!=(r=t.device.gatt)?r.connected:null))for(u=this.delegates.iterator();u.hasNext();)u.next().didConnect(t);else null!=(a=null!=(s=t.device.gatt)?s.connect():null)&&a.then((p=t,c=this,function(t){return c.connect(p),i}))},c.prototype.disconnect=function(t){var e;null!=(e=t.device.gatt)&&e.disconnect()},c.prototype.stopScanning=function(){},c.prototype.scan=function(){var t,n;(e.isType(t=window.navigator.bluetooth,Bluetooth)?t:r()).requestDevice(new h(!0)).then((n=this,function(t){var e,r=new f(t);for(e=n.delegates.iterator();e.hasNext();)e.next().didDiscoverDevice(r);return i}))},c.prototype.readService=function(t,e){var n,r;null!=(r=null!=(n=t.device.gatt)?n.getPrimaryServices(e):null)&&r.then(l)},c.prototype.readCharacteristic=function(t,e){throw new a("An operation is not implemented: not implemented")},c.prototype.writeCharacteristic=function(t,e,n,r){throw new a("An operation is not implemented: not implemented")},c.prototype.writeCharacteristic_5wdhue$=function(t,e,n,r){throw new a("An operation is not implemented: not implemented")},c.prototype.notifyCharacteristic=function(t,e,n){throw new a("An operation is not implemented: not implemented")},c.prototype.indicateCharacteristic=function(t,e,n){throw new a("An operation is not implemented: not implemented")},c.prototype.notifyAndIndicateCharacteristic=function(t,e,n){throw new a("An operation is not implemented: not implemented")},c.prototype.readDescriptor=function(t,e,n){throw new a("An operation is not implemented: not implemented")},c.prototype.changeMTU=function(t,e){throw new a("An operation is not implemented: not implemented")},c.$metadata$={kind:n,simpleName:"BlueFalcon",interfaces:[]},h.$metadata$={kind:n,simpleName:"BluetoothOptions",interfaces:[]},h.prototype.component1=function(){return this.acceptAllDevices},h.prototype.copy_6taknv$=function(t){return new h(void 0===t?this.acceptAllDevices:t)},h.prototype.toString=function(){return"BluetoothOptions(acceptAllDevices="+e.toString(this.acceptAllDevices)+")"},h.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.acceptAllDevices)|0},h.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.acceptAllDevices,t.acceptAllDevices)},Object.defineProperty(f.prototype,"name",{configurable:!0,get:function(){return this.device.name}}),Object.defineProperty(f.prototype,"services",{configurable:!0,get:function(){throw new a("An operation is not implemented: not implemented")}}),Object.defineProperty(f.prototype,"uuid",{configurable:!0,get:function(){return this.device.id}}),Object.defineProperty(f.prototype,"rssi",{configurable:!0,get:function(){throw new a("An operation is not implemented: not implemented")},set:function(t){}}),f.$metadata$={kind:n,simpleName:"BluetoothPeripheral",interfaces:[]};var _=t.dev||(t.dev={}),d=_.bluefalcon||(_.bluefalcon={});return d.ApplicationContext=p,d.BlueFalcon=c,d.BluetoothOptions=h,d.BluetoothPeripheral=f,d.log_61zpoe$=y,new c(new p,null),t})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){(function(n){var r,o,i;o=[e],void 0===(i="function"==typeof(r=function(t){var e,r,o,i,s,a,u,p=t;function c(t){if(!("kotlinHashCodeValue$"in t)){var e=4294967296*Math.random()|0;Object.defineProperty(t,"kotlinHashCodeValue$",{value:e,enumerable:!1})}return t.kotlinHashCodeValue$}function l(){throw new Error("This marker function should never been called. Looks like compiler did not eliminate it properly. Please, report an issue if you caught this exception.")}function h(t,e){return(4294901760&t)*(65535&e)+(65535&t)*(0|e)|0}t.isArray=function(t){return Array.isArray(t)&&!t.$type$},t.isArrayish=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)},t.toByte=function(t){return(255&t)<<24>>24},t.toChar=function(t){return 65535&t},t.toBoxedChar=function(e){return null==e||e instanceof t.BoxedChar?e:new t.BoxedChar(e)},t.unboxChar=function(e){return null==e?e:t.toChar(e)},t.equals=function(t,e){return null==t?null==e:null!=e&&(t!=t?e!=e:"object"==typeof t&&"function"==typeof t.equals?t.equals(e):"number"==typeof t&&"number"==typeof e?t===e&&(0!==t||1/t==1/e):t===e)},t.hashCode=function(e){if(null==e)return 0;var n=typeof e;return"object"===n?"function"==typeof e.hashCode?e.hashCode():c(e):"function"===n?c(e):"number"===n?t.numberHashCode(e):"boolean"===n?Number(e):function(t){for(var e=0,n=0;n=t.Long.TWO_PWR_63_DBL_?t.Long.MAX_VALUE:e<0?t.Long.fromNumber(-e).negate():new t.Long(e%t.Long.TWO_PWR_32_DBL_|0,e/t.Long.TWO_PWR_32_DBL_|0)},t.Long.fromBits=function(e,n){return new t.Long(e,n)},t.Long.fromString=function(e,n){if(0==e.length)throw Error("number format error: empty string");var r=n||10;if(r<2||36=0)throw Error('number format error: interior "-" character: '+e);for(var o=t.Long.fromNumber(Math.pow(r,8)),i=t.Long.ZERO,s=0;s=0?this.low_:t.Long.TWO_PWR_32_DBL_+this.low_},t.Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equalsLong(t.Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=0!=this.high_?this.high_:this.low_,n=31;n>0&&0==(e&1<0},t.Long.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},t.Long.prototype.compare=function(t){if(this.equalsLong(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.subtract(t).isNegative()?-1:1},t.Long.prototype.negate=function(){return this.equalsLong(t.Long.MIN_VALUE)?t.Long.MIN_VALUE:this.not().add(t.Long.ONE)},t.Long.prototype.add=function(e){var n=this.high_>>>16,r=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,u=e.low_>>>16,p=0,c=0,l=0,h=0;return l+=(h+=i+(65535&e.low_))>>>16,h&=65535,c+=(l+=o+u)>>>16,l&=65535,p+=(c+=r+a)>>>16,c&=65535,p+=n+s,p&=65535,t.Long.fromBits(l<<16|h,p<<16|c)},t.Long.prototype.subtract=function(t){return this.add(t.negate())},t.Long.prototype.multiply=function(e){if(this.isZero())return t.Long.ZERO;if(e.isZero())return t.Long.ZERO;if(this.equalsLong(t.Long.MIN_VALUE))return e.isOdd()?t.Long.MIN_VALUE:t.Long.ZERO;if(e.equalsLong(t.Long.MIN_VALUE))return this.isOdd()?t.Long.MIN_VALUE:t.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(t.Long.TWO_PWR_24_)&&e.lessThan(t.Long.TWO_PWR_24_))return t.Long.fromNumber(this.toNumber()*e.toNumber());var n=this.high_>>>16,r=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,u=e.low_>>>16,p=65535&e.low_,c=0,l=0,h=0,f=0;return h+=(f+=i*p)>>>16,f&=65535,l+=(h+=o*p)>>>16,h&=65535,l+=(h+=i*u)>>>16,h&=65535,c+=(l+=r*p)>>>16,l&=65535,c+=(l+=o*u)>>>16,l&=65535,c+=(l+=i*a)>>>16,l&=65535,c+=n*p+r*u+o*a+i*s,c&=65535,t.Long.fromBits(h<<16|f,c<<16|l)},t.Long.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return t.Long.ZERO;if(this.equalsLong(t.Long.MIN_VALUE)){if(e.equalsLong(t.Long.ONE)||e.equalsLong(t.Long.NEG_ONE))return t.Long.MIN_VALUE;if(e.equalsLong(t.Long.MIN_VALUE))return t.Long.ONE;if((o=this.shiftRight(1).div(e).shiftLeft(1)).equalsLong(t.Long.ZERO))return e.isNegative()?t.Long.ONE:t.Long.NEG_ONE;var n=this.subtract(e.multiply(o));return o.add(n.div(e))}if(e.equalsLong(t.Long.MIN_VALUE))return t.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().div(e.negate()):this.negate().div(e).negate();if(e.isNegative())return this.div(e.negate()).negate();var r=t.Long.ZERO;for(n=this;n.greaterThanOrEqual(e);){for(var o=Math.max(1,Math.floor(n.toNumber()/e.toNumber())),i=Math.ceil(Math.log(o)/Math.LN2),s=i<=48?1:Math.pow(2,i-48),a=t.Long.fromNumber(o),u=a.multiply(e);u.isNegative()||u.greaterThan(n);)o-=s,u=(a=t.Long.fromNumber(o)).multiply(e);a.isZero()&&(a=t.Long.ONE),r=r.add(a),n=n.subtract(u)}return r},t.Long.prototype.modulo=function(t){return this.subtract(this.div(t).multiply(t))},t.Long.prototype.not=function(){return t.Long.fromBits(~this.low_,~this.high_)},t.Long.prototype.and=function(e){return t.Long.fromBits(this.low_&e.low_,this.high_&e.high_)},t.Long.prototype.or=function(e){return t.Long.fromBits(this.low_|e.low_,this.high_|e.high_)},t.Long.prototype.xor=function(e){return t.Long.fromBits(this.low_^e.low_,this.high_^e.high_)},t.Long.prototype.shiftLeft=function(e){if(0==(e&=63))return this;var n=this.low_;if(e<32){var r=this.high_;return t.Long.fromBits(n<>>32-e)}return t.Long.fromBits(0,n<>>e|n<<32-e,n>>e)}return t.Long.fromBits(n>>e-32,n>=0?0:-1)},t.Long.prototype.shiftRightUnsigned=function(e){if(0==(e&=63))return this;var n=this.high_;if(e<32){var r=this.low_;return t.Long.fromBits(r>>>e|n<<32-e,n>>>e)}return 32==e?t.Long.fromBits(n,0):t.Long.fromBits(n>>>e-32,0)},t.Long.prototype.equals=function(e){return e instanceof t.Long&&this.equalsLong(e)},t.Long.prototype.compareTo_11rb$=t.Long.prototype.compare,t.Long.prototype.inc=function(){return this.add(t.Long.ONE)},t.Long.prototype.dec=function(){return this.add(t.Long.NEG_ONE)},t.Long.prototype.valueOf=function(){return this.toNumber()},t.Long.prototype.unaryPlus=function(){return this},t.Long.prototype.unaryMinus=t.Long.prototype.negate,t.Long.prototype.inv=t.Long.prototype.not,t.Long.prototype.rangeTo=function(e){return new t.kotlin.ranges.LongRange(this,e)},t.defineInlineFunction=function(t,e){return e},t.wrapFunction=function(t){var e=function(){return(e=t()).apply(this,arguments)};return function(){return e.apply(this,arguments)}},t.suspendCall=function(t){return t},t.coroutineResult=function(t){l()},t.coroutineReceiver=function(t){l()},t.compareTo=function(e,n){var r=typeof e;return"number"===r?"number"==typeof n?t.doubleCompareTo(e,n):t.primitiveCompareTo(e,n):"string"===r||"boolean"===r?t.primitiveCompareTo(e,n):e.compareTo_11rb$(n)},t.primitiveCompareTo=function(t,e){return te?1:0},t.doubleCompareTo=function(t,e){if(te)return 1;if(t===e){if(0!==t)return 0;var n=1/t;return n===1/e?0:n<0?-1:1}return t!=t?e!=e?0:1:-1},t.imul=Math.imul||h,t.imulEmulated=h,e=new ArrayBuffer(8),r=new Float64Array(e),new Float32Array(e),o=new Int32Array(e),i=0,s=1,r[0]=-1,0!==o[i]&&(i=1,s=0),t.numberHashCode=function(t){return(0|t)===t?0|t:(r[0]=t,(31*o[s]|0)+o[i]|0)},t.ensureNotNull=function(e){return null!=e?e:t.throwNPE()},void 0===String.prototype.startsWith&&Object.defineProperty(String.prototype,"startsWith",{value:function(t,e){return e=e||0,this.lastIndexOf(t,e)===e}}),void 0===String.prototype.endsWith&&Object.defineProperty(String.prototype,"endsWith",{value:function(t,e){var n=this.toString();(void 0===e||e>n.length)&&(e=n.length),e-=t.length;var r=n.indexOf(t,e);return-1!==r&&r===e}}),void 0===Math.sign&&(Math.sign=function(t){return 0==(t=+t)||isNaN(t)?Number(t):t>0?1:-1}),void 0===Math.trunc&&(Math.trunc=function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)}),function(){var t=Math.sqrt(2220446049250313e-31),e=Math.sqrt(t),n=1/t,r=1/e;if(void 0===Math.sinh&&(Math.sinh=function(n){if(Math.abs(n)t&&(r+=n*n*n/6),r}var o=Math.exp(n),i=1/o;return isFinite(o)?isFinite(i)?(o-i)/2:-Math.exp(-n-Math.LN2):Math.exp(n-Math.LN2)}),void 0===Math.cosh&&(Math.cosh=function(t){var e=Math.exp(t),n=1/e;return isFinite(e)&&isFinite(n)?(e+n)/2:Math.exp(Math.abs(t)-Math.LN2)}),void 0===Math.tanh&&(Math.tanh=function(n){if(Math.abs(n)t&&(r-=n*n*n/3),r}var o=Math.exp(+n),i=Math.exp(-n);return o===1/0?1:i===1/0?-1:(o-i)/(o+i)}),void 0===Math.asinh){var o=function(i){if(i>=+e)return i>r?i>n?Math.log(i)+Math.LN2:Math.log(2*i+1/(2*i)):Math.log(i+Math.sqrt(i*i+1));if(i<=-e)return-o(-i);var s=i;return Math.abs(i)>=t&&(s-=i*i*i/6),s};Math.asinh=o}void 0===Math.acosh&&(Math.acosh=function(r){if(r<1)return NaN;if(r-1>=e)return r>n?Math.log(r)+Math.LN2:Math.log(r+Math.sqrt(r*r-1));var o=Math.sqrt(r-1),i=o;return o>=t&&(i-=o*o*o/12),Math.sqrt(2)*i}),void 0===Math.atanh&&(Math.atanh=function(n){if(Math.abs(n)t&&(r+=n*n*n/3),r}return Math.log((1+n)/(1-n))/2}),void 0===Math.log1p&&(Math.log1p=function(t){if(Math.abs(t)>>0;return 0===e?32:31-(a(e)/u|0)|0})),void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(t){return null!=t&&null!=t.__proto__&&t.__proto__.__proto__===Int8Array.prototype.__proto__}),void 0===Array.prototype.fill&&Object.defineProperty(Array.prototype,"fill",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),n=e.length>>>0,r=arguments[1],o=r>>0,i=o<0?Math.max(n+o,0):Math.min(o,n),s=arguments[2],a=void 0===s?n:s>>0,u=a<0?Math.max(n+a,0):Math.min(a,n);ie)return 1;if(t===e){if(0!==t)return 0;var n=1/t;return n===1/e?0:n<0?-1:1}return t!=t?e!=e?0:1:-1};for(r=0;r1&&e.append_gw00v9$(n),!(i<0||p<=i))break;Rn(e,c,a)}return i>=0&&p>i&&e.append_gw00v9$(s),e.append_gw00v9$(o),e}function E(t,e,n,r,o,i,s){return void 0===e&&(e=", "),void 0===n&&(n=""),void 0===r&&(r=""),void 0===o&&(o=-1),void 0===i&&(i="..."),void 0===s&&(s=null),N(t,Pe(),e,n,r,o,i,s).toString()}function L(){}function C(){}function M(){}function I(){}function j(){}function S(){}function A(){}function T(){}function P(){}function q(){}function R(){}function z(){}function B(){}function U(){}function D(){}function W(t,e,n){U.call(this),this.step=n,this.finalElement_0=0|e,this.hasNext_0=this.step>0?t<=e:t>=e,this.next_0=this.hasNext_0?0|t:this.finalElement_0}function H(t,e,n){D.call(this),this.step=n,this.finalElement_0=e,this.hasNext_0=this.step.toNumber()>0?t.compareTo_11rb$(e)<=0:t.compareTo_11rb$(e)>=0,this.next_0=this.hasNext_0?t:this.finalElement_0}function K(t,e,n){if(G(),0===n)throw Lt("Step must be non-zero.");if(-2147483648===n)throw Lt("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=l(_t(0|t,0|e,n)),this.step=n}function V(){F=this}new t.Long(-1478467534,-1720727600),new t.Long(-888910638,1920087921),new t.Long(1993859828,793161749),new t.Long(1,-2147483648),new t.Long(1908874354,-59652324),t.Long.fromInt(2047),wt.prototype=Object.create(k.prototype),wt.prototype.constructor=wt,Ot.prototype=Object.create(wt.prototype),Ot.prototype.constructor=Ot,W.prototype=Object.create(U.prototype),W.prototype.constructor=W,H.prototype=Object.create(D.prototype),H.prototype.constructor=H,tt.prototype=Object.create(K.prototype),tt.prototype.constructor=tt,ot.prototype=Object.create(Z.prototype),ot.prototype.constructor=ot,xt.prototype=Object.create(k.prototype),xt.prototype.constructor=xt,Et.prototype=Object.create(Ot.prototype),Et.prototype.constructor=Et,Ct.prototype=Object.create(Ot.prototype),Ct.prototype.constructor=Ct,It.prototype=Object.create(Ot.prototype),It.prototype.constructor=It,jt.prototype=Object.create(Ot.prototype),jt.prototype.constructor=jt,Tt.prototype=Object.create(Ot.prototype),Tt.prototype.constructor=Tt,Pt.prototype=Object.create(Ot.prototype),Pt.prototype.constructor=Pt,qt.prototype=Object.create(Ot.prototype),qt.prototype.constructor=qt,Dt.prototype=Object.create(De.prototype),Dt.prototype.constructor=Dt,Jt.prototype=Object.create(Dt.prototype),Jt.prototype.constructor=Jt,Kt.prototype=Object.create(Jt.prototype),Kt.prototype.constructor=Kt,Vt.prototype=Object.create(Jt.prototype),Vt.prototype.constructor=Vt,Gt.prototype=Object.create(Dt.prototype),Gt.prototype.constructor=Gt,Wt.prototype=Object.create(Fe.prototype),Wt.prototype.constructor=Wt,re.prototype=Object.create(Kt.prototype),re.prototype.constructor=re,ne.prototype=Object.create(Wt.prototype),ne.prototype.constructor=ne,se.prototype=Object.create(Jt.prototype),se.prototype.constructor=se,fe.prototype=Object.create(Ht.prototype),fe.prototype.constructor=fe,ye.prototype=Object.create(Kt.prototype),ye.prototype.constructor=ye,he.prototype=Object.create(ne.prototype),he.prototype.constructor=he,me.prototype=Object.create(se.prototype),me.prototype.constructor=me,$e.prototype=Object.create(ge.prototype),$e.prototype.constructor=$e,ve.prototype=Object.create(ge.prototype),ve.prototype.constructor=ve,be.prototype=Object.create(ve.prototype),be.prototype.constructor=be,en.prototype=Object.create(De.prototype),en.prototype.constructor=en,Ge.prototype=Object.create(en.prototype),Ge.prototype.constructor=Ge,Je.prototype=Object.create(De.prototype),Je.prototype.constructor=Je,jn.prototype=Object.create(g.prototype),jn.prototype.constructor=jn,Fn.prototype=Object.create(xt.prototype),Fn.prototype.constructor=Fn,L.$metadata$={kind:_,simpleName:"CharSequence",interfaces:[]},C.$metadata$={kind:_,simpleName:"Iterable",interfaces:[]},M.$metadata$={kind:_,simpleName:"MutableIterable",interfaces:[C]},I.$metadata$={kind:_,simpleName:"Collection",interfaces:[C]},j.$metadata$={kind:_,simpleName:"MutableCollection",interfaces:[M,I]},S.$metadata$={kind:_,simpleName:"Set",interfaces:[I]},A.$metadata$={kind:_,simpleName:"MutableSet",interfaces:[j,S]},T.prototype.getOrDefault_xwzc9p$=function(t,e){throw new Fn},P.$metadata$={kind:_,simpleName:"Entry",interfaces:[]},T.$metadata$={kind:_,simpleName:"Map",interfaces:[]},q.prototype.remove_xwzc9p$=function(t,e){return!0},R.$metadata$={kind:_,simpleName:"MutableEntry",interfaces:[P]},q.$metadata$={kind:_,simpleName:"MutableMap",interfaces:[T]},z.$metadata$={kind:_,simpleName:"Iterator",interfaces:[]},B.$metadata$={kind:_,simpleName:"MutableIterator",interfaces:[z]},U.prototype.next=function(){return i(this.nextChar())},U.$metadata$={kind:c,simpleName:"CharIterator",interfaces:[z]},D.prototype.next=function(){return this.nextLong()},D.$metadata$={kind:c,simpleName:"LongIterator",interfaces:[z]},W.prototype.hasNext=function(){return this.hasNext_0},W.prototype.nextChar=function(){var t=this.next_0;if(t===this.finalElement_0){if(!this.hasNext_0)throw Rt();this.hasNext_0=!1}else this.next_0=this.next_0+this.step|0;return l(t)},W.$metadata$={kind:c,simpleName:"CharProgressionIterator",interfaces:[U]},H.prototype.hasNext=function(){return this.hasNext_0},H.prototype.nextLong=function(){var t=this.next_0;if(o(t,this.finalElement_0)){if(!this.hasNext_0)throw Rt();this.hasNext_0=!1}else this.next_0=this.next_0.add(this.step);return t},H.$metadata$={kind:c,simpleName:"LongProgressionIterator",interfaces:[D]},K.prototype.iterator=function(){return new W(this.first,this.last,this.step)},K.prototype.isEmpty=function(){return this.step>0?this.first>this.last:this.first0?String.fromCharCode(this.first)+".."+String.fromCharCode(this.last)+" step "+this.step:String.fromCharCode(this.first)+" downTo "+String.fromCharCode(this.last)+" step "+(0|-this.step)},V.prototype.fromClosedRange_ayra44$=function(t,e,n){return new K(t,e,n)},V.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var F=null;function G(){return null===F&&new V,F}function Z(t,e,n){if(Y(),o(n,a))throw Lt("Step must be non-zero.");if(o(n,f))throw Lt("Step must be greater than Long.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=dt(t,e,n),this.step=n}function J(){X=this}K.$metadata$={kind:c,simpleName:"CharProgression",interfaces:[C]},Z.prototype.iterator=function(){return new H(this.first,this.last,this.step)},Z.prototype.isEmpty=function(){return this.step.toNumber()>0?this.first.compareTo_11rb$(this.last)>0:this.first.compareTo_11rb$(this.last)<0},Z.prototype.equals=function(e){return t.isType(e,Z)&&(this.isEmpty()&&e.isEmpty()||o(this.first,e.first)&&o(this.last,e.last)&&o(this.step,e.step))},Z.prototype.hashCode=function(){return this.isEmpty()?-1:t.Long.fromInt(31).multiply(t.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32)))).add(this.step.xor(this.step.shiftRightUnsigned(32))).toInt()},Z.prototype.toString=function(){return this.step.toNumber()>0?this.first.toString()+".."+this.last.toString()+" step "+this.step.toString():this.first.toString()+" downTo "+this.last.toString()+" step "+this.step.unaryMinus().toString()},J.prototype.fromClosedRange_b9bd0d$=function(t,e,n){return new Z(t,e,n)},J.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var X=null;function Y(){return null===X&&new J,X}function Q(){}function tt(t,e){rt(),K.call(this,t,e,1)}function et(){nt=this,this.EMPTY=new tt(l(1),l(0))}Z.$metadata$={kind:c,simpleName:"LongProgression",interfaces:[C]},Q.prototype.contains_mef7kx$=function(e){return t.compareTo(e,this.start)>=0&&t.compareTo(e,this.endInclusive)<=0},Q.prototype.isEmpty=function(){return t.compareTo(this.start,this.endInclusive)>0},Q.$metadata$={kind:_,simpleName:"ClosedRange",interfaces:[]},Object.defineProperty(tt.prototype,"start",{configurable:!0,get:function(){return i(this.first)}}),Object.defineProperty(tt.prototype,"endInclusive",{configurable:!0,get:function(){return i(this.last)}}),tt.prototype.contains_mef7kx$=function(t){return this.first<=t&&t<=this.last},tt.prototype.isEmpty=function(){return this.first>this.last},tt.prototype.equals=function(e){return t.isType(e,tt)&&(this.isEmpty()&&e.isEmpty()||this.first===e.first&&this.last===e.last)},tt.prototype.hashCode=function(){return this.isEmpty()?-1:(31*(0|this.first)|0)+(0|this.last)|0},tt.prototype.toString=function(){return String.fromCharCode(this.first)+".."+String.fromCharCode(this.last)},et.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var nt=null;function rt(){return null===nt&&new et,nt}function ot(t,e){at(),Z.call(this,t,e,m)}function it(){st=this,this.EMPTY=new ot(m,a)}tt.$metadata$={kind:c,simpleName:"CharRange",interfaces:[Q,K]},Object.defineProperty(ot.prototype,"start",{configurable:!0,get:function(){return this.first}}),Object.defineProperty(ot.prototype,"endInclusive",{configurable:!0,get:function(){return this.last}}),ot.prototype.contains_mef7kx$=function(t){return this.first.compareTo_11rb$(t)<=0&&t.compareTo_11rb$(this.last)<=0},ot.prototype.isEmpty=function(){return this.first.compareTo_11rb$(this.last)>0},ot.prototype.equals=function(e){return t.isType(e,ot)&&(this.isEmpty()&&e.isEmpty()||o(this.first,e.first)&&o(this.last,e.last))},ot.prototype.hashCode=function(){return this.isEmpty()?-1:t.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32))).toInt()},ot.prototype.toString=function(){return this.first.toString()+".."+this.last.toString()},it.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var st=null;function at(){return null===st&&new it,st}function ut(){pt=this}ot.$metadata$={kind:c,simpleName:"LongRange",interfaces:[Q,Z]},ut.prototype.toString=function(){return"kotlin.Unit"},ut.$metadata$={kind:d,simpleName:"Unit",interfaces:[]};var pt=null;function ct(){return null===pt&&new ut,pt}function lt(t,e){var n=t%e;return n>=0?n:n+e|0}function ht(t,e){var n=t.modulo(e);return n.toNumber()>=0?n:n.add(e)}function ft(t,e,n){return lt(lt(t,n)-lt(e,n)|0,n)}function yt(t,e,n){return ht(ht(t,n).subtract(ht(e,n)),n)}function _t(t,e,n){if(n>0)return t>=e?e:e-ft(e,t,n)|0;if(n<0)return t<=e?e:e+ft(t,e,0|-n)|0;throw Lt("Step is zero.")}function dt(t,e,n){if(n.toNumber()>0)return t.compareTo_11rb$(e)>=0?e:e.subtract(yt(e,t,n));if(n.toNumber()<0)return t.compareTo_11rb$(e)<=0?e:e.add(yt(t,e,n.unaryMinus()));throw Lt("Step is zero.")}function mt(t){this.c=t}function gt(t){this.resultContinuation_0=t,this.state_0=0,this.exceptionState_0=0,this.result_0=null,this.exception_0=null,this.finallyPath_0=null,this.context_hxcuhl$_0=this.resultContinuation_0.context,this.intercepted__0=null}function $t(){vt=this}mt.prototype.equals=function(e){return t.isType(e,mt)&&this.c===e.c},mt.prototype.hashCode=function(){return this.c},mt.prototype.toString=function(){return String.fromCharCode(s(this.c))},mt.prototype.compareTo_11rb$=function(t){return this.c-t},mt.prototype.valueOf=function(){return this.c},mt.$metadata$={kind:c,simpleName:"BoxedChar",interfaces:[$]},Object.defineProperty(gt.prototype,"context",{configurable:!0,get:function(){return this.context_hxcuhl$_0}}),gt.prototype.intercepted=function(){var t,e,n,r;if(null!=(n=this.intercepted__0))r=n;else{var o=null!=(e=null!=(t=this.context.get_j3r2sn$(yn()))?t.interceptContinuation_wj8d80$(this):null)?e:this;this.intercepted__0=o,r=o}return r},gt.prototype.resumeWith_tl1gpc$=function(e){for(var n,r={v:this},o={v:e.isFailure?null:null==(n=e.value)||t.isType(n,b)?n:x()},i={v:e.exceptionOrNull()};;){var s,a,u=r.v,p=u.resultContinuation_0;null==i.v?u.result_0=o.v:(u.state_0=u.exceptionState_0,u.exception_0=i.v);try{var c=u.doResume();if(c===In())return;o.v=c,i.v=null}catch(t){o.v=null,i.v=t}if(u.releaseIntercepted_0(),!t.isType(p,gt))return null!=(s=i.v)?(p.resumeWith_tl1gpc$(new Bn(Kn(s))),a=ut):a=null,void(null==a&&p.resumeWith_tl1gpc$(new Bn(o.v)));r.v=p}},gt.prototype.releaseIntercepted_0=function(){var t=this.intercepted__0;null!=t&&t!==this&&v(this.context.get_j3r2sn$(yn())).releaseInterceptedContinuation_k98bjh$(t),this.intercepted__0=bt()},gt.$metadata$={kind:c,simpleName:"CoroutineImpl",interfaces:[cn]},Object.defineProperty($t.prototype,"context",{configurable:!0,get:function(){throw Mt("This continuation is already complete".toString())}}),$t.prototype.resumeWith_tl1gpc$=function(t){throw Mt("This continuation is already complete".toString())},$t.prototype.toString=function(){return"This continuation is already complete"},$t.$metadata$={kind:d,simpleName:"CompletedContinuation",interfaces:[cn]};var vt=null;function bt(){return null===vt&&new $t,vt}function xt(e,n){var r;k.call(this),r=null!=n?n:null,this.message_q7r8iu$_0=void 0===e&&null!=r?t.toString(r):e,this.cause_us9j0c$_0=r,t.captureStack(k,this),this.name="Error"}function kt(t,e){return e=e||Object.create(xt.prototype),xt.call(e,t,null),e}function wt(e,n){var r;k.call(this),r=null!=n?n:null,this.message_8yp7un$_0=void 0===e&&null!=r?t.toString(r):e,this.cause_th0jdv$_0=r,t.captureStack(k,this),this.name="Exception"}function Ot(t,e){wt.call(this,t,e),this.name="RuntimeException"}function Nt(t,e){return e=e||Object.create(Ot.prototype),Ot.call(e,t,null),e}function Et(t,e){Ot.call(this,t,e),this.name="IllegalArgumentException"}function Lt(t,e){return e=e||Object.create(Et.prototype),Et.call(e,t,null),e}function Ct(t,e){Ot.call(this,t,e),this.name="IllegalStateException"}function Mt(t,e){return e=e||Object.create(Ct.prototype),Ct.call(e,t,null),e}function It(t){Nt(t,this),this.name="IndexOutOfBoundsException"}function jt(t,e){Ot.call(this,t,e),this.name="UnsupportedOperationException"}function St(t){return t=t||Object.create(jt.prototype),jt.call(t,null,null),t}function At(t,e){return e=e||Object.create(jt.prototype),jt.call(e,t,null),e}function Tt(t){Nt(t,this),this.name="NullPointerException"}function Pt(t){Nt(t,this),this.name="ClassCastException"}function qt(t){Nt(t,this),this.name="NoSuchElementException"}function Rt(t){return t=t||Object.create(qt.prototype),qt.call(t,null),t}function zt(t){this.function$=t}function Bt(t){for(var e=[],n=t.iterator();n.hasNext();)e.push(n.next());return e}function Ut(t,e){var n;if(e.length=0&&(this.buffer=this.buffer+e.substring(0,n),this.flush(),e=e.substring(n+1|0)),this.buffer=this.buffer+e},be.prototype.flush=function(){console.log(this.buffer),this.buffer=""},be.$metadata$={kind:c,simpleName:"BufferedOutputToConsoleLog",interfaces:[ve]},Object.defineProperty(xe.prototype,"context",{configurable:!0,get:function(){return this.delegate_0.context}}),xe.prototype.resumeWith_tl1gpc$=function(t){var e=this.result_0;if(e===Tn())this.result_0=t.value;else{if(e!==In())throw Mt("Already resumed");this.result_0=Pn(),this.delegate_0.resumeWith_tl1gpc$(t)}},xe.prototype.getOrThrow=function(){var e;if(this.result_0===Tn())return this.result_0=In(),In();var n=this.result_0;if(n===Pn())e=In();else{if(t.isType(n,Hn))throw n.exception;e=n}return e},xe.$metadata$={kind:c,simpleName:"SafeContinuation",interfaces:[cn]},Object.defineProperty(ke.prototype,"context",{configurable:!0,get:function(){return this.closure$context}}),ke.prototype.resumeWith_tl1gpc$=function(t){this.closure$resumeWith(t)},ke.$metadata$={kind:c,interfaces:[cn]},Ne.$metadata$={kind:_,simpleName:"Serializable",interfaces:[]},Ee.$metadata$={kind:_,simpleName:"KCallable",interfaces:[]},Le.$metadata$={kind:_,simpleName:"KProperty",interfaces:[Ee]},Ce.$metadata$={kind:_,simpleName:"KMutableProperty",interfaces:[Le]},Me.$metadata$={kind:_,simpleName:"KProperty0",interfaces:[Le]},Ie.$metadata$={kind:_,simpleName:"KMutableProperty0",interfaces:[Ce,Me]},je.$metadata$={kind:_,simpleName:"KProperty1",interfaces:[Le]},Se.$metadata$={kind:_,simpleName:"KMutableProperty1",interfaces:[Ce,je]},Ae.$metadata$={kind:_,simpleName:"Appendable",interfaces:[]},Object.defineProperty(Te.prototype,"length",{configurable:!0,get:function(){return this.string_0.length}}),Te.prototype.charCodeAt=function(t){var e=this.string_0;if(!(t>=0&&t<=zn(e)))throw new It("index: "+t+", length: "+this.length+"}");return e.charCodeAt(t)},Te.prototype.subSequence_vux9f0$=function(t,e){return this.string_0.substring(t,e)},Te.prototype.append_s8itvh$=function(t){return this.string_0+=String.fromCharCode(t),this},Te.prototype.append_gw00v9$=function(t){return this.string_0+=y(t),this},Te.prototype.append_ezbsdh$=function(t,e,n){return this.appendRange_3peag4$(null!=t?t:"null",e,n)},Te.prototype.reverse=function(){for(var t,e,n="",r=this.string_0.length-1|0;r>=0;){var o=this.string_0.charCodeAt((r=(t=r)-1|0,t));if(Re(o)&&r>=0){var s=this.string_0.charCodeAt((r=(e=r)-1|0,e));n=qe(s)?n+String.fromCharCode(i(s))+String.fromCharCode(i(o)):n+String.fromCharCode(i(o))+String.fromCharCode(i(s))}else n+=String.fromCharCode(o)}return this.string_0=n,this},Te.prototype.append_s8jyv4$=function(t){return this.string_0+=y(t),this},Te.prototype.append_6taknv$=function(t){return this.string_0+=t,this},Te.prototype.append_4hbowm$=function(t){return this.string_0+=ze(t),this},Te.prototype.append_61zpoe$=function(t){return this.append_pdl1vj$(t)},Te.prototype.append_pdl1vj$=function(t){return this.string_0=this.string_0+(null!=t?t:"null"),this},Te.prototype.capacity=function(){return this.length},Te.prototype.ensureCapacity_za3lpa$=function(t){},Te.prototype.indexOf_61zpoe$=function(t){return this.string_0.indexOf(t)},Te.prototype.indexOf_bm4lxs$=function(t,e){return this.string_0.indexOf(t,e)},Te.prototype.lastIndexOf_61zpoe$=function(t){return this.string_0.lastIndexOf(t)},Te.prototype.lastIndexOf_bm4lxs$=function(t,e){return 0===t.length&&e<0?-1:this.string_0.lastIndexOf(t,e)},Te.prototype.insert_fzusl$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Te.prototype.insert_6t1mh3$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+String.fromCharCode(i(e))+this.string_0.substring(t),this},Te.prototype.insert_7u455s$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+ze(e)+this.string_0.substring(t),this},Te.prototype.insert_1u9bqd$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Te.prototype.insert_6t2rgq$=function(t,e){return Ve().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Te.prototype.insert_19mbxw$=function(t,e){return this.insert_vqvrqt$(t,e)},Te.prototype.insert_vqvrqt$=function(t,e){Ve().checkPositionIndex_6xvm5r$(t,this.length);var n=null!=e?e:"null";return this.string_0=this.string_0.substring(0,t)+n+this.string_0.substring(t),this},Te.prototype.setLength_za3lpa$=function(t){if(t<0)throw Lt("Negative new length: "+t+".");if(t<=this.length)this.string_0=this.string_0.substring(0,t);else for(var e=this.length;en)throw new It("startIndex: "+t+", length: "+n);if(t>e)throw Lt("startIndex("+t+") > endIndex("+e+")")},Te.prototype.deleteAt_za3lpa$=function(t){return Ve().checkElementIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+this.string_0.substring(t+1|0),this},Te.prototype.deleteRange_vux9f0$=function(t,e){return this.checkReplaceRange_0(t,e,this.length),this.string_0=this.string_0.substring(0,t)+this.string_0.substring(e),this},Te.prototype.toCharArray_pqkatk$=function(t,e,n,r){var o;void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=this.length),Ve().checkBoundsIndexes_cub51b$(n,r,this.length),Ve().checkBoundsIndexes_cub51b$(e,e+r-n|0,t.length);for(var i=e,s=n;s=e)throw new It("index: "+t+", size: "+e)},He.prototype.checkPositionIndex_6xvm5r$=function(t,e){if(t<0||t>e)throw new It("index: "+t+", size: "+e)},He.prototype.checkRangeIndexes_cub51b$=function(t,e,n){if(t<0||e>n)throw new It("fromIndex: "+t+", toIndex: "+e+", size: "+n);if(t>e)throw Lt("fromIndex: "+t+" > toIndex: "+e)},He.prototype.checkBoundsIndexes_cub51b$=function(t,e,n){if(t<0||e>n)throw new It("startIndex: "+t+", endIndex: "+e+", size: "+n);if(t>e)throw Lt("startIndex: "+t+" > endIndex: "+e)},He.prototype.orderedHashCode_nykoif$=function(t){var e,n,r=1;for(e=t.iterator();e.hasNext();){var o=e.next();r=(31*r|0)+(null!=(n=null!=o?w(o):null)?n:0)|0}return r},He.prototype.orderedEquals_e92ka7$=function(t,e){var n;if(t.size!==e.size)return!1;var r=e.iterator();for(n=t.iterator();n.hasNext();){var i=n.next(),s=r.next();if(!o(i,s))return!1}return!0},He.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var Ke=null;function Ve(){return null===Ke&&new He,Ke}function Fe(){tn(),this._keys_up5z3z$_0=null,this._values_6nw1f1$_0=null}function Ge(t){this.this$AbstractMap=t,en.call(this)}function Ze(t){this.closure$entryIterator=t}function Je(t){this.this$AbstractMap=t,De.call(this)}function Xe(t){this.closure$entryIterator=t}function Ye(){Qe=this}Fe.prototype.containsKey_11rb$=function(t){return null!=this.implFindEntry_8k1i24$_0(t)},Fe.prototype.containsValue_11rc$=function(e){var n,r=this.entries;t:do{var i;if(t.isType(r,I)&&r.isEmpty()){n=!1;break t}for(i=r.iterator();i.hasNext();){var s=i.next();if(o(s.value,e)){n=!0;break t}}n=!1}while(0);return n},Fe.prototype.containsEntry_8hxqw4$=function(e){if(!t.isType(e,P))return!1;var n=e.key,r=e.value,i=(t.isType(this,T)?this:x()).get_11rb$(n);if(!o(r,i))return!1;var s=null==i;return s&&(s=!(t.isType(this,T)?this:x()).containsKey_11rb$(n)),!s},Fe.prototype.equals=function(e){if(e===this)return!0;if(!t.isType(e,T))return!1;if(this.size!==e.size)return!1;var n,r=e.entries;t:do{var o;if(t.isType(r,I)&&r.isEmpty()){n=!0;break t}for(o=r.iterator();o.hasNext();){var i=o.next();if(!this.containsEntry_8hxqw4$(i)){n=!1;break t}}n=!0}while(0);return n},Fe.prototype.get_11rb$=function(t){var e;return null!=(e=this.implFindEntry_8k1i24$_0(t))?e.value:null},Fe.prototype.hashCode=function(){return w(this.entries)},Fe.prototype.isEmpty=function(){return 0===this.size},Object.defineProperty(Fe.prototype,"size",{configurable:!0,get:function(){return this.entries.size}}),Ge.prototype.contains_11rb$=function(t){return this.this$AbstractMap.containsKey_11rb$(t)},Ze.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Ze.prototype.next=function(){return this.closure$entryIterator.next().key},Ze.$metadata$={kind:c,interfaces:[z]},Ge.prototype.iterator=function(){return new Ze(this.this$AbstractMap.entries.iterator())},Object.defineProperty(Ge.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMap.size}}),Ge.$metadata$={kind:c,interfaces:[en]},Object.defineProperty(Fe.prototype,"keys",{configurable:!0,get:function(){return null==this._keys_up5z3z$_0&&(this._keys_up5z3z$_0=new Ge(this)),v(this._keys_up5z3z$_0)}}),Fe.prototype.toString=function(){return E(this.entries,", ","{","}",void 0,void 0,(t=this,function(e){return t.toString_55he67$_0(e)}));var t},Fe.prototype.toString_55he67$_0=function(t){return this.toString_kthv8s$_0(t.key)+"="+this.toString_kthv8s$_0(t.value)},Fe.prototype.toString_kthv8s$_0=function(t){return t===this?"(this Map)":y(t)},Je.prototype.contains_11rb$=function(t){return this.this$AbstractMap.containsValue_11rc$(t)},Xe.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Xe.prototype.next=function(){return this.closure$entryIterator.next().value},Xe.$metadata$={kind:c,interfaces:[z]},Je.prototype.iterator=function(){return new Xe(this.this$AbstractMap.entries.iterator())},Object.defineProperty(Je.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMap.size}}),Je.$metadata$={kind:c,interfaces:[De]},Object.defineProperty(Fe.prototype,"values",{configurable:!0,get:function(){return null==this._values_6nw1f1$_0&&(this._values_6nw1f1$_0=new Je(this)),v(this._values_6nw1f1$_0)}}),Fe.prototype.implFindEntry_8k1i24$_0=function(t){var e,n=this.entries;t:do{var r;for(r=n.iterator();r.hasNext();){var i=r.next();if(o(i.key,t)){e=i;break t}}e=null}while(0);return e},Ye.prototype.entryHashCode_9fthdn$=function(t){var e,n,r,o;return(null!=(n=null!=(e=t.key)?w(e):null)?n:0)^(null!=(o=null!=(r=t.value)?w(r):null)?o:0)},Ye.prototype.entryToString_9fthdn$=function(t){return y(t.key)+"="+y(t.value)},Ye.prototype.entryEquals_js7fox$=function(e,n){return!!t.isType(n,P)&&o(e.key,n.key)&&o(e.value,n.value)},Ye.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var Qe=null;function tn(){return null===Qe&&new Ye,Qe}function en(){on(),De.call(this)}function nn(){rn=this}Fe.$metadata$={kind:c,simpleName:"AbstractMap",interfaces:[T]},en.prototype.equals=function(e){return e===this||!!t.isType(e,S)&&on().setEquals_y8f7en$(this,e)},en.prototype.hashCode=function(){return on().unorderedHashCode_nykoif$(this)},nn.prototype.unorderedHashCode_nykoif$=function(t){var e,n=0;for(e=t.iterator();e.hasNext();){var r,o=e.next();n=n+(null!=(r=null!=o?w(o):null)?r:0)|0}return n},nn.prototype.setEquals_y8f7en$=function(t,e){return t.size===e.size&&t.containsAll_brywnq$(e)},nn.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var rn=null;function on(){return null===rn&&new nn,rn}function sn(){}function an(){}function un(t,e){this.map_a09uzx$_0=t,this.default_0=e}function pn(t,e){return function(t,e,n){for(var r={v:!1},o=t.iterator();o.hasNext();)e(o.next())===n&&(o.remove(),r.v=!0);return r.v}(t,e,!0)}function cn(){}function ln(){yn()}function hn(){fn=this}en.$metadata$={kind:c,simpleName:"AbstractSet",interfaces:[S,De]},cn.$metadata$={kind:_,simpleName:"Continuation",interfaces:[]},e("kotlin.kotlin.coroutines.suspendCoroutine_922awp$",r((function(){var e=p.kotlin.coroutines.intrinsics.intercepted_f9mg25$,n=p.kotlin.coroutines.SafeContinuation_init_wj8d80$;return function(r,o){var i;return t.suspendCall((i=r,function(t){var r=n(e(t));return i(r),r.getOrThrow()})(t.coroutineReceiver())),t.coroutineResult(t.coroutineReceiver())}}))),hn.$metadata$={kind:d,simpleName:"Key",interfaces:[mn]};var fn=null;function yn(){return null===fn&&new hn,fn}function _n(){}function dn(t,e){var n=t.minusKey_yeqjby$(e.key);if(n===xn())return e;var r=n.get_j3r2sn$(yn());if(null==r)return new kn(n,e);var o=n.minusKey_yeqjby$(yn());return o===xn()?new kn(e,r):new kn(new kn(o,e),r)}function mn(){}function gn(){}function $n(t){this.key_no4tas$_0=t}function vn(){bn=this,this.serialVersionUID_0=a}_n.prototype.plus_1fupul$=function(t){return t===xn()?this:t.fold_3cc69b$(this,dn)},mn.$metadata$={kind:_,simpleName:"Key",interfaces:[]},gn.prototype.get_j3r2sn$=function(e){return o(this.key,e)?t.isType(this,gn)?this:we():null},gn.prototype.fold_3cc69b$=function(t,e){return e(t,this)},gn.prototype.minusKey_yeqjby$=function(t){return o(this.key,t)?xn():this},gn.$metadata$={kind:_,simpleName:"Element",interfaces:[_n]},_n.$metadata$={kind:_,simpleName:"CoroutineContext",interfaces:[]},vn.prototype.readResolve_0=function(){return xn()},vn.prototype.get_j3r2sn$=function(t){return null},vn.prototype.fold_3cc69b$=function(t,e){return t},vn.prototype.plus_1fupul$=function(t){return t},vn.prototype.minusKey_yeqjby$=function(t){return this},vn.prototype.hashCode=function(){return 0},vn.prototype.toString=function(){return"EmptyCoroutineContext"},vn.$metadata$={kind:d,simpleName:"EmptyCoroutineContext",interfaces:[Ne,_n]};var bn=null;function xn(){return null===bn&&new vn,bn}function kn(t,e){this.left_0=t,this.element_0=e}function wn(t,e){return 0===t.length?e.toString():t+", "+e}function On(t){null===Mn&&new Nn,this.elements=t}function Nn(){Mn=this,this.serialVersionUID_0=a}kn.prototype.get_j3r2sn$=function(e){for(var n,r=this;;){if(null!=(n=r.element_0.get_j3r2sn$(e)))return n;var o=r.left_0;if(!t.isType(o,kn))return o.get_j3r2sn$(e);r=o}},kn.prototype.fold_3cc69b$=function(t,e){return e(this.left_0.fold_3cc69b$(t,e),this.element_0)},kn.prototype.minusKey_yeqjby$=function(t){if(null!=this.element_0.get_j3r2sn$(t))return this.left_0;var e=this.left_0.minusKey_yeqjby$(t);return e===this.left_0?this:e===xn()?this.element_0:new kn(e,this.element_0)},kn.prototype.size_0=function(){for(var e,n,r=this,o=2;;){if(null==(n=t.isType(e=r.left_0,kn)?e:null))return o;r=n,o=o+1|0}},kn.prototype.contains_0=function(t){return o(this.get_j3r2sn$(t.key),t)},kn.prototype.containsAll_0=function(e){for(var n,r=e;;){if(!this.contains_0(r.element_0))return!1;var o=r.left_0;if(!t.isType(o,kn))return this.contains_0(t.isType(n=o,gn)?n:we());r=o}},kn.prototype.equals=function(e){return this===e||t.isType(e,kn)&&e.size_0()===this.size_0()&&e.containsAll_0(this)},kn.prototype.hashCode=function(){return w(this.left_0)+w(this.element_0)|0},kn.prototype.toString=function(){return"["+this.fold_3cc69b$("",wn)+"]"},kn.prototype.writeReplace_0=function(){var e,n,r,o=this.size_0(),i=t.newArray(o,null),s={v:0};if(this.fold_3cc69b$(ct(),(n=i,r=s,function(t,e){var o;return n[(o=r.v,r.v=o+1|0,o)]=e,ut})),s.v!==o)throw Mt("Check failed.".toString());return new On(t.isArray(e=i)?e:we())},Nn.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var En,Ln,Cn,Mn=null;function In(){return An()}function jn(t,e){g.call(this),this.name$=t,this.ordinal$=e}function Sn(){Sn=function(){},En=new jn("COROUTINE_SUSPENDED",0),Ln=new jn("UNDECIDED",1),Cn=new jn("RESUMED",2)}function An(){return Sn(),En}function Tn(){return Sn(),Ln}function Pn(){return Sn(),Cn}function qn(t,e){this.start_p1gsmm$_0=t,this.endInclusive_jj4lf7$_0=e}function Rn(e,n,r){null!=r?e.append_gw00v9$(r(n)):null==n||t.isCharSequence(n)?e.append_gw00v9$(n):t.isChar(n)?e.append_s8itvh$(s(n)):e.append_gw00v9$(y(n))}function zn(t){return t.length-1|0}function Bn(t){Wn(),this.value=t}function Un(){Dn=this}On.prototype.readResolve_0=function(){var t,e=this.elements,n=xn();for(t=0;t!==e.length;++t){var r=e[t];n=n.plus_1fupul$(r)}return n},On.$metadata$={kind:c,simpleName:"Serialized",interfaces:[Ne]},kn.$metadata$={kind:c,simpleName:"CombinedContext",interfaces:[Ne,_n]},e("kotlin.kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn_zb0pmy$",r((function(){var t=p.kotlin.NotImplementedError;return function(e,n){throw new t("Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic")}}))),jn.$metadata$={kind:c,simpleName:"CoroutineSingletons",interfaces:[g]},jn.values=function(){return[An(),Tn(),Pn()]},jn.valueOf_61zpoe$=function(t){switch(t){case"COROUTINE_SUSPENDED":return An();case"UNDECIDED":return Tn();case"RESUMED":return Pn();default:Oe("No enum constant kotlin.coroutines.intrinsics.CoroutineSingletons."+t)}},Object.defineProperty(Bn.prototype,"isSuccess",{configurable:!0,get:function(){return!t.isType(this.value,Hn)}}),Object.defineProperty(Bn.prototype,"isFailure",{configurable:!0,get:function(){return t.isType(this.value,Hn)}}),Bn.prototype.getOrNull=e("kotlin.kotlin.Result.getOrNull",r((function(){var e=Object,n=t.throwCCE;return function(){var r;return this.isFailure?null:null==(r=this.value)||t.isType(r,e)?r:n()}}))),Bn.prototype.exceptionOrNull=function(){return t.isType(this.value,Hn)?this.value.exception:null},Bn.prototype.toString=function(){return t.isType(this.value,Hn)?this.value.toString():"Success("+y(this.value)+")"},Un.prototype.success_mh5how$=e("kotlin.kotlin.Result.Companion.success_mh5how$",r((function(){var t=p.kotlin.Result;return function(e){return new t(e)}}))),Un.prototype.failure_lsqlk3$=e("kotlin.kotlin.Result.Companion.failure_lsqlk3$",r((function(){var t=p.kotlin.createFailure_tcv7n7$,e=p.kotlin.Result;return function(n){return new e(t(n))}}))),Un.$metadata$={kind:d,simpleName:"Companion",interfaces:[]};var Dn=null;function Wn(){return null===Dn&&new Un,Dn}function Hn(t){this.exception=t}function Kn(t){return new Hn(t)}function Vn(e){if(t.isType(e.value,Hn))throw e.value.exception}function Fn(t){void 0===t&&(t="An operation is not implemented."),kt(t,this),this.name="NotImplementedError"}Hn.prototype.equals=function(e){return t.isType(e,Hn)&&o(this.exception,e.exception)},Hn.prototype.hashCode=function(){return w(this.exception)},Hn.prototype.toString=function(){return"Failure("+this.exception+")"},Hn.$metadata$={kind:c,simpleName:"Failure",interfaces:[Ne]},Bn.$metadata$={kind:c,simpleName:"Result",interfaces:[Ne]},Bn.prototype.unbox=function(){return this.value},Bn.prototype.hashCode=function(){var e=0;return e=31*e+t.hashCode(this.value)|0},Bn.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.value,e.value)},Fn.$metadata$={kind:c,simpleName:"NotImplementedError",interfaces:[xt]};var Gn=p.kotlin||(p.kotlin={}),Zn=Gn.collections||(Gn.collections={}),Jn=Gn.ranges||(Gn.ranges={});Gn.IllegalArgumentException_init_pdl1vj$=Lt,Zn.LinkedHashMap_init_q3lmfv$=de,Gn.NoSuchElementException_init=Rt,Gn.UnsupportedOperationException_init_pdl1vj$=At,Zn.Collection=I,Zn.joinTo_gcc71v$=N,Zn.joinToString_fmv235$=E;var Xn=Gn.text||(Gn.text={});Xn.get_lastIndex_gw00vp$=zn,Xn.StringBuilder_init=Pe,Gn.js||(Gn.js={}),Gn.CharSequence=L,Zn.Iterable=C,Zn.MutableIterable=M,Zn.MutableCollection=j,Zn.Set=S,Zn.MutableSet=A,T.Entry=P,Zn.Map=T,q.MutableEntry=R,Zn.MutableMap=q,Zn.Iterator=z,Zn.MutableIterator=B,Zn.CharIterator=U,Zn.LongIterator=D,Jn.CharProgressionIterator=W,Jn.LongProgressionIterator=H,Object.defineProperty(K,"Companion",{get:G}),Jn.CharProgression=K,Object.defineProperty(Z,"Companion",{get:Y}),Jn.LongProgression=Z,Jn.ClosedRange=Q,Object.defineProperty(tt,"Companion",{get:rt}),Jn.CharRange=tt,Object.defineProperty(ot,"Companion",{get:at}),Jn.LongRange=ot,Object.defineProperty(Gn,"Unit",{get:ct});var Yn=Gn.internal||(Gn.internal={});Yn.getProgressionLastElement_qt1dr2$=_t,Yn.getProgressionLastElement_b9bd0d$=dt,p.captureStack=function(t,e){Error.captureStackTrace?Error.captureStackTrace(e):e.stack=(new Error).stack},p.BoxedChar=mt;var Qn=Gn.coroutines||(Gn.coroutines={});Qn.CoroutineImpl=gt,Object.defineProperty(Qn,"CompletedContinuation",{get:bt});var tr=Qn.intrinsics||(Qn.intrinsics={});tr.intercepted_f9mg25$=function(e){var n,r,o;return null!=(o=null!=(r=t.isType(n=e,gt)?n:null)?r.intercepted():null)?o:e},Gn.Error_init_pdl1vj$=kt,Gn.Error=xt,Gn.Exception=wt,Gn.RuntimeException_init_pdl1vj$=Nt,Gn.RuntimeException=Ot,Gn.IllegalArgumentException=Et,Gn.IllegalStateException_init_pdl1vj$=Mt,Gn.IllegalStateException=Ct,Gn.IndexOutOfBoundsException=It,Gn.UnsupportedOperationException_init=St,Gn.UnsupportedOperationException=jt,Gn.NullPointerException=Tt,Gn.ClassCastException=Pt,Gn.NoSuchElementException=qt,Gn.Comparator=zt,Zn.copyToArrayImpl=Bt,Zn.copyToExistingArrayImpl=Ut,Zn.LinkedHashSet_init_287e2$=function(t){return t=t||Object.create(me.prototype),ae(de(),t),me.call(t),t},Zn.AbstractMutableCollection=Dt,Wt.SimpleEntry_init_trwmqg$=function(t,e){return e=e||Object.create(Ht.prototype),Ht.call(e,t.key,t.value),e},Wt.SimpleEntry=Ht,Wt.AbstractEntrySet=Kt,Zn.AbstractMutableMap=Wt,Zn.AbstractMutableSet=Jt,Object.defineProperty(Xt,"HashCode",{get:ee}),Zn.EqualityComparator=Xt,Zn.HashMap_init_va96d4$=oe,Zn.HashMap_init_q3lmfv$=ie,Zn.HashMap=ne,Zn.HashSet_init_nn01ho$=ae,Zn.HashSet=se,Zn.InternalHashCodeMap=ue,Zn.InternalMap=ce,Zn.InternalStringMap=le,Zn.LinkedHashMap=he,Zn.LinkedHashSet=me;var er=Gn.io||(Gn.io={});er.BaseOutput=ge,er.NodeJsOutput=$e,er.BufferedOutput=ve,er.BufferedOutputToConsoleLog=be,er.println_s8jyv4$=function(t){Qt.println_s8jyv4$(t)},Qn.SafeContinuation_init_wj8d80$=function(t,e){return e=e||Object.create(xe.prototype),xe.call(e,t,Tn()),e},Qn.SafeContinuation=xe,p.throwNPE=function(t){throw new Tt(t)},p.throwCCE=we,p.throwISE=Oe,er.Serializable=Ne;var nr=Gn.reflect||(Gn.reflect={});nr.KCallable=Ee,nr.KProperty=Le,nr.KMutableProperty=Ce,nr.KProperty0=Me,nr.KMutableProperty0=Ie,nr.KProperty1=je,nr.KMutableProperty1=Se,Xn.Appendable=Ae,Xn.StringBuilder=Te,Xn.isHighSurrogate_myv2d0$=qe,Xn.isLowSurrogate_myv2d0$=Re,Xn.concatToString_355ntz$=ze,Xn.concatToString_wlitf7$=Be,Xn.compareTo_7epoxm$=Ue,Zn.AbstractCollection=De,Object.defineProperty(We,"Companion",{get:Ve}),Zn.AbstractList=We,Object.defineProperty(Fe,"Companion",{get:tn}),Zn.AbstractMap=Fe,Object.defineProperty(en,"Companion",{get:on}),Zn.AbstractSet=en,Zn.removeAll_uhyeqt$=pn,Qn.Continuation=cn,Gn.Result=Bn,tr.get_COROUTINE_SUSPENDED=In,Object.defineProperty(ln,"Key",{get:yn}),Qn.ContinuationInterceptor=ln,_n.Key=mn,_n.Element=gn,Qn.CoroutineContext=_n,Qn.AbstractCoroutineContextElement=$n,Object.defineProperty(Qn,"EmptyCoroutineContext",{get:xn}),Qn.CombinedContext=kn,Object.defineProperty(tr,"COROUTINE_SUSPENDED",{get:In}),Object.defineProperty(jn,"COROUTINE_SUSPENDED",{get:An}),Object.defineProperty(jn,"UNDECIDED",{get:Tn}),Object.defineProperty(jn,"RESUMED",{get:Pn}),tr.CoroutineSingletons=jn,Xn.appendElement_k2zgzt$=Rn,Gn.createFailure_tcv7n7$=Kn,Object.defineProperty(Bn,"Companion",{get:Wn}),Bn.Failure=Hn,Gn.throwOnFailure_iacion$=Vn,Gn.NotImplementedError=Fn,q.prototype.getOrDefault_xwzc9p$=T.prototype.getOrDefault_xwzc9p$,Fe.prototype.getOrDefault_xwzc9p$=T.prototype.getOrDefault_xwzc9p$,Wt.prototype.remove_xwzc9p$=q.prototype.remove_xwzc9p$,ue.prototype.createJsMap=ce.prototype.createJsMap,le.prototype.createJsMap=ce.prototype.createJsMap,sn.prototype.getOrDefault_xwzc9p$=T.prototype.getOrDefault_xwzc9p$,an.prototype.remove_xwzc9p$=q.prototype.remove_xwzc9p$,an.prototype.getOrDefault_xwzc9p$=q.prototype.getOrDefault_xwzc9p$,sn.prototype.getOrDefault_xwzc9p$,un.prototype.remove_xwzc9p$=an.prototype.remove_xwzc9p$,un.prototype.getOrDefault_xwzc9p$=an.prototype.getOrDefault_xwzc9p$,T.prototype.getOrDefault_xwzc9p$,gn.prototype.plus_1fupul$=_n.prototype.plus_1fupul$,ln.prototype.fold_3cc69b$=gn.prototype.fold_3cc69b$,ln.prototype.plus_1fupul$=gn.prototype.plus_1fupul$,$n.prototype.get_j3r2sn$=gn.prototype.get_j3r2sn$,$n.prototype.fold_3cc69b$=gn.prototype.fold_3cc69b$,$n.prototype.minusKey_yeqjby$=gn.prototype.minusKey_yeqjby$,$n.prototype.plus_1fupul$=gn.prototype.plus_1fupul$,kn.prototype.plus_1fupul$=_n.prototype.plus_1fupul$,qn.prototype.contains_mef7kx$=Q.prototype.contains_mef7kx$,qn.prototype.isEmpty=Q.prototype.isEmpty;var rr=void 0!==n&&n.versions&&!!n.versions.node;Qt=rr?new $e(n.stdout):new be,new ke(xn(),(function(e){var n;return Vn(e),null==(n=e.value)||t.isType(n,b)||x(),ut})),u.pow(2,-26),u.pow(2,-53),t.newArray(0,null),new zt((function(t,e){return Ue(t,e,!0)})),new Int8Array([h(239),h(191),h(189)]),new Bn(In())}()})?r.apply(e,o):r)||(t.exports=i)}).call(this,n(3))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,p=[],c=!1,l=-1;function h(){c&&u&&(c=!1,u.length?p=u.concat(p):l=-1,p.length&&f())}function f(){if(!c){var t=a(h);c=!0;for(var e=p.length;e;){for(u=p,p=[];++l1)for(var n=1;n "+t.device+":"+i(t.device.gatt)+" gatt connected? "+i(null!=(n=t.device.gatt)?n.connected:null)),!0===(null!=(r=t.device.gatt)?r.connected:null))for(u=this.delegates.iterator();u.hasNext();)u.next().didConnect(t);else null!=(a=null!=(s=t.device.gatt)?s.connect():null)&&a.then((p=t,c=e,l=this,function(t){return l.connect(p,c),o}))},v.prototype.disconnect=function(t){var e;null!=(e=t.device.gatt)&&e.disconnect()},v.prototype.stopScanning=function(){},v.prototype.scan=function(t){this.optionalServices_0=t,this.rescan()},v.prototype.rescan=function(){var t,n;(e.isType(t=window.navigator.bluetooth,Bluetooth)?t:r()).requestDevice(new O(!1,[new A(this.optionalServices_0)],this.optionalServices_0)).then((n=this,function(t){var e,r=new k(t);for(e=n.delegates.iterator();e.hasNext();)e.next().didDiscoverDevice(r);return o}))},v.prototype.readService=function(t,e){var n,r,i,s;null!=(r=null!=(n=t.device.gatt)?n.getPrimaryServices(e):null)&&r.then((i=t,s=this,function(t){var e,n,r,a=i.deviceServices_8be2vx$,p=u(t.length);for(e=0;e!==t.length;++e){var c=t[e];p.add_11rb$(new C(c))}for(a.addAll_brywnq$(p),n=s.delegates.iterator();n.hasNext();)n.next().didDiscoverServices(i);for(r=i.deviceServices_8be2vx$.iterator();r.hasNext();){var l=r.next(),h=s,f=i;l.service.getCharacteristics(void 0).then(b(l,h,f))}return o}))},v.prototype.readCharacteristic=function(t,e){var n,r,i;e.characteristic.readValue().then((n=this,r=t,i=e,function(t){var e;for(e=n.delegates.iterator();e.hasNext();)e.next().didCharacteristcValueChanged(r,i);return o}))},v.prototype.writeCharacteristic_l9arxu$=function(t,e,n,r){},v.prototype.writeCharacteristic=function(t,e,n,r){e.characteristic.writeValue(n)},v.prototype.notifyCharacteristic=function(t,e,n){throw new p("An operation is not implemented: not implemented")},v.prototype.indicateCharacteristic=function(t,e,n){throw new p("An operation is not implemented: not implemented")},v.prototype.notifyAndIndicateCharacteristic=function(t,e,n){throw new p("An operation is not implemented: not implemented")},v.prototype.readDescriptor=function(t,e,n){throw new p("An operation is not implemented: not implemented")},v.prototype.changeMTU=function(t,e){throw new p("An operation is not implemented: not implemented")},v.$metadata$={kind:n,simpleName:"BlueFalcon",interfaces:[]},Object.defineProperty(x.prototype,"name",{configurable:!0,get:function(){return this.characteristic.uuid}}),Object.defineProperty(x.prototype,"value",{configurable:!0,get:function(){var t;return w(null!=(t=this.characteristic.value)?t.buffer:null)}}),Object.defineProperty(x.prototype,"descriptors",{configurable:!0,get:function(){throw new p("An operation is not implemented: not implemented")}}),Object.defineProperty(x.prototype,"stringValue",{configurable:!0,get:function(){var t;return null!=(t=this.value)?c(t):null}}),x.$metadata$={kind:n,simpleName:"BluetoothCharacteristic",interfaces:[]},Object.defineProperty(k.prototype,"name",{configurable:!0,get:function(){return this.device.name}}),Object.defineProperty(k.prototype,"services",{configurable:!0,get:function(){return l(this.deviceServices_8be2vx$)}}),Object.defineProperty(k.prototype,"uuid",{configurable:!0,get:function(){return this.device.id}}),Object.defineProperty(k.prototype,"rssi",{configurable:!0,get:function(){throw new p("An operation is not implemented: not implemented")},set:function(t){}}),Object.defineProperty(k.prototype,"serviceArray",{configurable:!0,get:function(){return h(this.services)}}),k.$metadata$={kind:n,simpleName:"BluetoothPeripheral",interfaces:[]},Object.defineProperty(C.prototype,"name",{configurable:!0,get:function(){return this.service.uuid}}),Object.defineProperty(C.prototype,"characteristics",{configurable:!0,get:function(){return l(this.deviceCharacteristics_8be2vx$)}}),Object.defineProperty(C.prototype,"characteristicArray",{configurable:!0,get:function(){return h(this.characteristics)}}),C.$metadata$={kind:n,simpleName:"BluetoothService",interfaces:[]},E.$metadata$={kind:n,simpleName:"Name",interfaces:[I]},E.prototype.component1=function(){return this.name},E.prototype.copy_61zpoe$=function(t){return new E(void 0===t?this.name:t)},E.prototype.toString=function(){return"Name(name="+e.toString(this.name)+")"},E.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.name)|0},E.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)},L.$metadata$={kind:n,simpleName:"NamePrefix",interfaces:[I]},L.prototype.component1=function(){return this.namePrefix},L.prototype.copy_61zpoe$=function(t){return new L(void 0===t?this.namePrefix:t)},L.prototype.toString=function(){return"NamePrefix(namePrefix="+e.toString(this.namePrefix)+")"},L.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.namePrefix)|0},L.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.namePrefix,t.namePrefix)},A.prototype.equals=function(t){return this===t||!(null==t||!d(y(e.getKClassFromExpression(this)),y(e.getKClassFromExpression(t))))&&(e.isType(t,A)||r(),!!_(this.services,t.services))},A.prototype.hashCode=function(){return m(this.services)},A.$metadata$={kind:n,simpleName:"Services",interfaces:[I]},A.prototype.component1=function(){return this.services},A.prototype.copy_kand9s$=function(t){return new A(void 0===t?this.services:t)},A.prototype.toString=function(){return"Services(services="+e.toString(this.services)+")"},I.$metadata$={kind:n,simpleName:"Filter",interfaces:[]},O.prototype.equals=function(t){if(this===t)return!0;if(null==t||!d(y(e.getKClassFromExpression(this)),y(e.getKClassFromExpression(t))))return!1;if(e.isType(t,O)||r(),this.acceptAllDevices!==t.acceptAllDevices)return!1;if(null!=this.filters){if(null==t.filters)return!1;if(!_(this.filters,t.filters))return!1}else if(null!=t.filters)return!1;return!!_(this.optionalServices,t.optionalServices)},O.prototype.hashCode=function(){var t,e,n=$(this.acceptAllDevices);return n=(31*(n=(31*n|0)+(null!=(e=null!=(t=this.filters)?m(t):null)?e:0)|0)|0)+m(this.optionalServices)|0},O.$metadata$={kind:n,simpleName:"BluetoothOptions",interfaces:[]},O.prototype.component1=function(){return this.acceptAllDevices},O.prototype.component2=function(){return this.filters},O.prototype.component3=function(){return this.optionalServices},O.prototype.copy_2qwm2r$=function(t,e,n){return new O(void 0===t?this.acceptAllDevices:t,void 0===e?this.filters:e,void 0===n?this.optionalServices:n)},O.prototype.toString=function(){return"BluetoothOptions(acceptAllDevices="+e.toString(this.acceptAllDevices)+", filters="+e.toString(this.filters)+", optionalServices="+e.toString(this.optionalServices)+")"};var M=t.dev||(t.dev={}),j=M.bluefalcon||(M.bluefalcon={});return j.ApplicationContext=g,j.BlueFalcon=v,j.BluetoothCharacteristic=x,j.toByteArray_x4j1ys$=w,j.BluetoothPeripheral=k,j.BluetoothService=C,j.log_61zpoe$=N,I.Name=E,I.NamePrefix=L,I.Services=A,O.Filter=I,(j.external||(j.external={})).BluetoothOptions=O,new v(new g,null),t})?r.apply(e,i):r)||(t.exports=o)},function(t,e,n){(function(n){var r,i,o;i=[e],void 0===(o="function"==typeof(r=function(t){var e,r,i,o,s,a,u,p=t;function c(t){if(!("kotlinHashCodeValue$"in t)){var e=4294967296*Math.random()|0;Object.defineProperty(t,"kotlinHashCodeValue$",{value:e,enumerable:!1})}return t.kotlinHashCodeValue$}function l(){throw new Error("This marker function should never been called. Looks like compiler did not eliminate it properly. Please, report an issue if you caught this exception.")}function h(t,e){return(4294901760&t)*(65535&e)+(65535&t)*(0|e)|0}t.isBooleanArray=function(t){return(Array.isArray(t)||t instanceof Int8Array)&&"BooleanArray"===t.$type$},t.isByteArray=function(t){return t instanceof Int8Array&&"BooleanArray"!==t.$type$},t.isShortArray=function(t){return t instanceof Int16Array},t.isCharArray=function(t){return t instanceof Uint16Array&&"CharArray"===t.$type$},t.isIntArray=function(t){return t instanceof Int32Array},t.isFloatArray=function(t){return t instanceof Float32Array},t.isDoubleArray=function(t){return t instanceof Float64Array},t.isLongArray=function(t){return Array.isArray(t)&&"LongArray"===t.$type$},t.isArray=function(t){return Array.isArray(t)&&!t.$type$},t.isArrayish=function(t){return Array.isArray(t)||ArrayBuffer.isView(t)},t.arrayToString=function(e){if(null===e)return"null";var n=t.isCharArray(e)?String.fromCharCode:t.toString;return"["+Array.prototype.map.call(e,(function(t){return n(t)})).join(", ")+"]"},t.arrayEquals=function(e,n){if(e===n)return!0;if(null===e||null===n||!t.isArrayish(n)||e.length!==n.length)return!1;for(var r=0,i=e.length;r>24},t.toChar=function(t){return 65535&t},t.toBoxedChar=function(e){return null==e||e instanceof t.BoxedChar?e:new t.BoxedChar(e)},t.unboxChar=function(e){return null==e?e:t.toChar(e)},t.equals=function(t,e){return null==t?null==e:null!=e&&(t!=t?e!=e:"object"==typeof t&&"function"==typeof t.equals?t.equals(e):"number"==typeof t&&"number"==typeof e?t===e&&(0!==t||1/t==1/e):t===e)},t.hashCode=function(e){if(null==e)return 0;var n=typeof e;return"object"===n?"function"==typeof e.hashCode?e.hashCode():c(e):"function"===n?c(e):"number"===n?t.numberHashCode(e):"boolean"===n?Number(e):function(t){for(var e=0,n=0;n=t.Long.TWO_PWR_63_DBL_?t.Long.MAX_VALUE:e<0?t.Long.fromNumber(-e).negate():new t.Long(e%t.Long.TWO_PWR_32_DBL_|0,e/t.Long.TWO_PWR_32_DBL_|0)},t.Long.fromBits=function(e,n){return new t.Long(e,n)},t.Long.fromString=function(e,n){if(0==e.length)throw Error("number format error: empty string");var r=n||10;if(r<2||36=0)throw Error('number format error: interior "-" character: '+e);for(var i=t.Long.fromNumber(Math.pow(r,8)),o=t.Long.ZERO,s=0;s=0?this.low_:t.Long.TWO_PWR_32_DBL_+this.low_},t.Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equalsLong(t.Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=0!=this.high_?this.high_:this.low_,n=31;n>0&&0==(e&1<0},t.Long.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0},t.Long.prototype.compare=function(t){if(this.equalsLong(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.subtract(t).isNegative()?-1:1},t.Long.prototype.negate=function(){return this.equalsLong(t.Long.MIN_VALUE)?t.Long.MIN_VALUE:this.not().add(t.Long.ONE)},t.Long.prototype.add=function(e){var n=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,u=e.low_>>>16,p=0,c=0,l=0,h=0;return l+=(h+=o+(65535&e.low_))>>>16,h&=65535,c+=(l+=i+u)>>>16,l&=65535,p+=(c+=r+a)>>>16,c&=65535,p+=n+s,p&=65535,t.Long.fromBits(l<<16|h,p<<16|c)},t.Long.prototype.subtract=function(t){return this.add(t.negate())},t.Long.prototype.multiply=function(e){if(this.isZero())return t.Long.ZERO;if(e.isZero())return t.Long.ZERO;if(this.equalsLong(t.Long.MIN_VALUE))return e.isOdd()?t.Long.MIN_VALUE:t.Long.ZERO;if(e.equalsLong(t.Long.MIN_VALUE))return this.isOdd()?t.Long.MIN_VALUE:t.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(t.Long.TWO_PWR_24_)&&e.lessThan(t.Long.TWO_PWR_24_))return t.Long.fromNumber(this.toNumber()*e.toNumber());var n=this.high_>>>16,r=65535&this.high_,i=this.low_>>>16,o=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,u=e.low_>>>16,p=65535&e.low_,c=0,l=0,h=0,f=0;return h+=(f+=o*p)>>>16,f&=65535,l+=(h+=i*p)>>>16,h&=65535,l+=(h+=o*u)>>>16,h&=65535,c+=(l+=r*p)>>>16,l&=65535,c+=(l+=i*u)>>>16,l&=65535,c+=(l+=o*a)>>>16,l&=65535,c+=n*p+r*u+i*a+o*s,c&=65535,t.Long.fromBits(h<<16|f,c<<16|l)},t.Long.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return t.Long.ZERO;if(this.equalsLong(t.Long.MIN_VALUE)){if(e.equalsLong(t.Long.ONE)||e.equalsLong(t.Long.NEG_ONE))return t.Long.MIN_VALUE;if(e.equalsLong(t.Long.MIN_VALUE))return t.Long.ONE;if((i=this.shiftRight(1).div(e).shiftLeft(1)).equalsLong(t.Long.ZERO))return e.isNegative()?t.Long.ONE:t.Long.NEG_ONE;var n=this.subtract(e.multiply(i));return i.add(n.div(e))}if(e.equalsLong(t.Long.MIN_VALUE))return t.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().div(e.negate()):this.negate().div(e).negate();if(e.isNegative())return this.div(e.negate()).negate();var r=t.Long.ZERO;for(n=this;n.greaterThanOrEqual(e);){for(var i=Math.max(1,Math.floor(n.toNumber()/e.toNumber())),o=Math.ceil(Math.log(i)/Math.LN2),s=o<=48?1:Math.pow(2,o-48),a=t.Long.fromNumber(i),u=a.multiply(e);u.isNegative()||u.greaterThan(n);)i-=s,u=(a=t.Long.fromNumber(i)).multiply(e);a.isZero()&&(a=t.Long.ONE),r=r.add(a),n=n.subtract(u)}return r},t.Long.prototype.modulo=function(t){return this.subtract(this.div(t).multiply(t))},t.Long.prototype.not=function(){return t.Long.fromBits(~this.low_,~this.high_)},t.Long.prototype.and=function(e){return t.Long.fromBits(this.low_&e.low_,this.high_&e.high_)},t.Long.prototype.or=function(e){return t.Long.fromBits(this.low_|e.low_,this.high_|e.high_)},t.Long.prototype.xor=function(e){return t.Long.fromBits(this.low_^e.low_,this.high_^e.high_)},t.Long.prototype.shiftLeft=function(e){if(0==(e&=63))return this;var n=this.low_;if(e<32){var r=this.high_;return t.Long.fromBits(n<>>32-e)}return t.Long.fromBits(0,n<>>e|n<<32-e,n>>e)}return t.Long.fromBits(n>>e-32,n>=0?0:-1)},t.Long.prototype.shiftRightUnsigned=function(e){if(0==(e&=63))return this;var n=this.high_;if(e<32){var r=this.low_;return t.Long.fromBits(r>>>e|n<<32-e,n>>>e)}return 32==e?t.Long.fromBits(n,0):t.Long.fromBits(n>>>e-32,0)},t.Long.prototype.equals=function(e){return e instanceof t.Long&&this.equalsLong(e)},t.Long.prototype.compareTo_11rb$=t.Long.prototype.compare,t.Long.prototype.inc=function(){return this.add(t.Long.ONE)},t.Long.prototype.dec=function(){return this.add(t.Long.NEG_ONE)},t.Long.prototype.valueOf=function(){return this.toNumber()},t.Long.prototype.unaryPlus=function(){return this},t.Long.prototype.unaryMinus=t.Long.prototype.negate,t.Long.prototype.inv=t.Long.prototype.not,t.Long.prototype.rangeTo=function(e){return new t.kotlin.ranges.LongRange(this,e)},t.defineInlineFunction=function(t,e){return e},t.wrapFunction=function(t){var e=function(){return(e=t()).apply(this,arguments)};return function(){return e.apply(this,arguments)}},t.suspendCall=function(t){return t},t.coroutineResult=function(t){l()},t.coroutineReceiver=function(t){l()},t.compareTo=function(e,n){var r=typeof e;return"number"===r?"number"==typeof n?t.doubleCompareTo(e,n):t.primitiveCompareTo(e,n):"string"===r||"boolean"===r?t.primitiveCompareTo(e,n):e.compareTo_11rb$(n)},t.primitiveCompareTo=function(t,e){return te?1:0},t.doubleCompareTo=function(t,e){if(te)return 1;if(t===e){if(0!==t)return 0;var n=1/t;return n===1/e?0:n<0?-1:1}return t!=t?e!=e?0:1:-1},t.imul=Math.imul||h,t.imulEmulated=h,e=new ArrayBuffer(8),r=new Float64Array(e),new Float32Array(e),i=new Int32Array(e),o=0,s=1,r[0]=-1,0!==i[o]&&(o=1,s=0),t.numberHashCode=function(t){return(0|t)===t?0|t:(r[0]=t,(31*i[s]|0)+i[o]|0)},t.ensureNotNull=function(e){return null!=e?e:t.throwNPE()},void 0===String.prototype.startsWith&&Object.defineProperty(String.prototype,"startsWith",{value:function(t,e){return e=e||0,this.lastIndexOf(t,e)===e}}),void 0===String.prototype.endsWith&&Object.defineProperty(String.prototype,"endsWith",{value:function(t,e){var n=this.toString();(void 0===e||e>n.length)&&(e=n.length),e-=t.length;var r=n.indexOf(t,e);return-1!==r&&r===e}}),void 0===Math.sign&&(Math.sign=function(t){return 0==(t=+t)||isNaN(t)?Number(t):t>0?1:-1}),void 0===Math.trunc&&(Math.trunc=function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)}),function(){var t=Math.sqrt(2220446049250313e-31),e=Math.sqrt(t),n=1/t,r=1/e;if(void 0===Math.sinh&&(Math.sinh=function(n){if(Math.abs(n)t&&(r+=n*n*n/6),r}var i=Math.exp(n),o=1/i;return isFinite(i)?isFinite(o)?(i-o)/2:-Math.exp(-n-Math.LN2):Math.exp(n-Math.LN2)}),void 0===Math.cosh&&(Math.cosh=function(t){var e=Math.exp(t),n=1/e;return isFinite(e)&&isFinite(n)?(e+n)/2:Math.exp(Math.abs(t)-Math.LN2)}),void 0===Math.tanh&&(Math.tanh=function(n){if(Math.abs(n)t&&(r-=n*n*n/3),r}var i=Math.exp(+n),o=Math.exp(-n);return i===1/0?1:o===1/0?-1:(i-o)/(i+o)}),void 0===Math.asinh){var i=function(o){if(o>=+e)return o>r?o>n?Math.log(o)+Math.LN2:Math.log(2*o+1/(2*o)):Math.log(o+Math.sqrt(o*o+1));if(o<=-e)return-i(-o);var s=o;return Math.abs(o)>=t&&(s-=o*o*o/6),s};Math.asinh=i}void 0===Math.acosh&&(Math.acosh=function(r){if(r<1)return NaN;if(r-1>=e)return r>n?Math.log(r)+Math.LN2:Math.log(r+Math.sqrt(r*r-1));var i=Math.sqrt(r-1),o=i;return i>=t&&(o-=i*i*i/12),Math.sqrt(2)*o}),void 0===Math.atanh&&(Math.atanh=function(n){if(Math.abs(n)t&&(r+=n*n*n/3),r}return Math.log((1+n)/(1-n))/2}),void 0===Math.log1p&&(Math.log1p=function(t){if(Math.abs(t)>>0;return 0===e?32:31-(a(e)/u|0)|0})),void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(t){return null!=t&&null!=t.__proto__&&t.__proto__.__proto__===Int8Array.prototype.__proto__}),void 0===Array.prototype.fill&&Object.defineProperty(Array.prototype,"fill",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),n=e.length>>>0,r=arguments[1],i=r>>0,o=i<0?Math.max(n+i,0):Math.min(i,n),s=arguments[2],a=void 0===s?n:s>>0,u=a<0?Math.max(n+a,0):Math.min(a,n);oe)return 1;if(t===e){if(0!==t)return 0;var n=1/t;return n===1/e?0:n<0?-1:1}return t!=t?e!=e?0:1:-1};for(r=0;r=0}function E(t,e){if(null==e){for(var n=0;n!==t.length;++n)if(null==t[n])return n}else for(var r=0;r!==t.length;++r)if(i(e,t[r]))return r;return-1}function L(t,e){var n,r;if(null==e)for(n=z(A(t)).iterator();n.hasNext();){var o=n.next();if(null==t[o])return o}else for(r=z(A(t)).iterator();r.hasNext();){var s=r.next();if(i(e,t[s]))return s}return-1}function A(t){return new Lt(0,M(t))}function M(t){return t.length-1|0}function j(t,e){var n;for(n=t.iterator();n.hasNext();){var r=n.next();e.add_11rb$(r)}return e}function S(e){return t.isType(e,U)?P(e):j(e,Qe())}function P(t){return tn(t)}function T(t,e,n,r,i,o,s,a){var u;void 0===n&&(n=", "),void 0===r&&(r=""),void 0===i&&(i=""),void 0===o&&(o=-1),void 0===s&&(s="..."),void 0===a&&(a=null),e.append_gw00v9$(r);var p=0;for(u=t.iterator();u.hasNext();){var c=u.next();if((p=p+1|0)>1&&e.append_gw00v9$(n),!(o<0||p<=o))break;Hi(e,c,a)}return o>=0&&p>o&&e.append_gw00v9$(s),e.append_gw00v9$(i),e}function q(t,e,n,r,i,o,s){return void 0===e&&(e=", "),void 0===n&&(n=""),void 0===r&&(r=""),void 0===i&&(i=-1),void 0===o&&(o="..."),void 0===s&&(s=null),T(t,Nr(),e,n,r,i,o,s).toString()}function z(t){return vt().fromClosedRange_qt1dr2$(t.last,t.first,0|-t.step)}function R(){}function B(){}function D(){}function U(){}function K(){}function W(){}function F(){}function H(){}function V(){}function G(){}function Z(){}function J(){}function X(){}function Y(){}function Q(){}function tt(){}function et(){}function nt(){}function rt(){}function it(){}function ot(){}function st(){}function at(){}function ut(){}function pt(){}function ct(t,e,n){rt.call(this),this.step=n,this.finalElement_0=0|e,this.hasNext_0=this.step>0?t<=e:t>=e,this.next_0=this.hasNext_0?0|t:this.finalElement_0}function lt(t,e,n){ot.call(this),this.step=n,this.finalElement_0=e,this.hasNext_0=this.step>0?t<=e:t>=e,this.next_0=this.hasNext_0?t:this.finalElement_0}function ht(t,e,n){st.call(this),this.step=n,this.finalElement_0=e,this.hasNext_0=this.step.toNumber()>0?t.compareTo_11rb$(e)<=0:t.compareTo_11rb$(e)>=0,this.next_0=this.hasNext_0?t:this.finalElement_0}function ft(t,e,n){if(_t(),0===n)throw xe("Step must be non-zero.");if(-2147483648===n)throw xe("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=l(Ft(0|t,0|e,n)),this.step=n}function yt(){dt=this}new t.Long(-888910638,1920087921),new t.Long(1993859828,793161749),new t.Long(1,-2147483648),new t.Long(1908874354,-59652324),t.Long.fromInt(2047),me.prototype=Object.create(w.prototype),me.prototype.constructor=me,ge.prototype=Object.create(me.prototype),ge.prototype.constructor=ge,ct.prototype=Object.create(rt.prototype),ct.prototype.constructor=ct,lt.prototype=Object.create(ot.prototype),lt.prototype.constructor=lt,ht.prototype=Object.create(st.prototype),ht.prototype.constructor=ht,Nt.prototype=Object.create(ft.prototype),Nt.prototype.constructor=Nt,Lt.prototype=Object.create(mt.prototype),Lt.prototype.constructor=Lt,St.prototype=Object.create(bt.prototype),St.prototype.constructor=St,Gt.prototype=Object.create(pt.prototype),Gt.prototype.constructor=Gt,Jt.prototype=Object.create(nt.prototype),Jt.prototype.constructor=Jt,Yt.prototype=Object.create(it.prototype),Yt.prototype.constructor=Yt,te.prototype=Object.create(rt.prototype),te.prototype.constructor=te,ne.prototype=Object.create(ot.prototype),ne.prototype.constructor=ne,ie.prototype=Object.create(at.prototype),ie.prototype.constructor=ie,se.prototype=Object.create(ut.prototype),se.prototype.constructor=se,ue.prototype=Object.create(st.prototype),ue.prototype.constructor=ue,de.prototype=Object.create(w.prototype),de.prototype.constructor=de,be.prototype=Object.create(ge.prototype),be.prototype.constructor=be,we.prototype=Object.create(ge.prototype),we.prototype.constructor=we,Ce.prototype=Object.create(ge.prototype),Ce.prototype.constructor=Ce,Ne.prototype=Object.create(ge.prototype),Ne.prototype.constructor=Ne,Ee.prototype=Object.create(ge.prototype),Ee.prototype.constructor=Ee,Le.prototype=Object.create(ge.prototype),Le.prototype.constructor=Le,Ae.prototype=Object.create(ge.prototype),Ae.prototype.constructor=Ae,Re.prototype=Object.create(qr.prototype),Re.prototype.constructor=Re,Ue.prototype=Object.create(De.prototype),Ue.prototype.constructor=Ue,Be.prototype=Object.create(Re.prototype),Be.prototype.constructor=Be,Ke.prototype=Object.create(Be.prototype),Ke.prototype.constructor=Ke,Xe.prototype=Object.create(Re.prototype),Xe.prototype.constructor=Xe,He.prototype=Object.create(Xe.prototype),He.prototype.constructor=He,Ve.prototype=Object.create(Xe.prototype),Ve.prototype.constructor=Ve,Ze.prototype=Object.create(Re.prototype),Ze.prototype.constructor=Ze,We.prototype=Object.create(Ur.prototype),We.prototype.constructor=We,Ye.prototype=Object.create(Be.prototype),Ye.prototype.constructor=Ye,un.prototype=Object.create(He.prototype),un.prototype.constructor=un,an.prototype=Object.create(We.prototype),an.prototype.constructor=an,ln.prototype=Object.create(Xe.prototype),ln.prototype.constructor=ln,$n.prototype=Object.create(Fe.prototype),$n.prototype.constructor=$n,gn.prototype=Object.create(He.prototype),gn.prototype.constructor=gn,mn.prototype=Object.create(an.prototype),mn.prototype.constructor=mn,xn.prototype=Object.create(ln.prototype),xn.prototype.constructor=xn,On.prototype=Object.create(Nn.prototype),On.prototype.constructor=On,In.prototype=Object.create(Nn.prototype),In.prototype.constructor=In,En.prototype=Object.create(In.prototype),En.prototype.constructor=En,zn.prototype=Object.create(qn.prototype),zn.prototype.constructor=zn,Rn.prototype=Object.create(qn.prototype),Rn.prototype.constructor=Rn,Bn.prototype=Object.create(qn.prototype),Bn.prototype.constructor=Bn,kr.prototype=Object.create(me.prototype),kr.prototype.constructor=kr,Jr.prototype=Object.create(qr.prototype),Jr.prototype.constructor=Jr,Kr.prototype=Object.create(Jr.prototype),Kr.prototype.constructor=Kr,Fr.prototype=Object.create(qr.prototype),Fr.prototype.constructor=Fr,Ri.prototype=Object.create($.prototype),Ri.prototype.constructor=Ri,eo.prototype=Object.create(de.prototype),eo.prototype.constructor=eo,R.$metadata$={kind:d,simpleName:"CharSequence",interfaces:[]},B.$metadata$={kind:d,simpleName:"Iterable",interfaces:[]},D.$metadata$={kind:d,simpleName:"MutableIterable",interfaces:[B]},U.$metadata$={kind:d,simpleName:"Collection",interfaces:[B]},K.$metadata$={kind:d,simpleName:"MutableCollection",interfaces:[D,U]},W.$metadata$={kind:d,simpleName:"List",interfaces:[U]},F.$metadata$={kind:d,simpleName:"MutableList",interfaces:[K,W]},H.$metadata$={kind:d,simpleName:"Set",interfaces:[U]},V.$metadata$={kind:d,simpleName:"MutableSet",interfaces:[K,H]},G.prototype.getOrDefault_xwzc9p$=function(t,e){throw new eo},Z.$metadata$={kind:d,simpleName:"Entry",interfaces:[]},G.$metadata$={kind:d,simpleName:"Map",interfaces:[]},J.prototype.remove_xwzc9p$=function(t,e){return!0},X.$metadata$={kind:d,simpleName:"MutableEntry",interfaces:[Z]},J.$metadata$={kind:d,simpleName:"MutableMap",interfaces:[G]},Y.$metadata$={kind:d,simpleName:"Iterator",interfaces:[]},Q.$metadata$={kind:d,simpleName:"MutableIterator",interfaces:[Y]},tt.$metadata$={kind:d,simpleName:"ListIterator",interfaces:[Y]},et.$metadata$={kind:d,simpleName:"MutableListIterator",interfaces:[Q,tt]},nt.prototype.next=function(){return this.nextByte()},nt.$metadata$={kind:c,simpleName:"ByteIterator",interfaces:[Y]},rt.prototype.next=function(){return o(this.nextChar())},rt.$metadata$={kind:c,simpleName:"CharIterator",interfaces:[Y]},it.prototype.next=function(){return this.nextShort()},it.$metadata$={kind:c,simpleName:"ShortIterator",interfaces:[Y]},ot.prototype.next=function(){return this.nextInt()},ot.$metadata$={kind:c,simpleName:"IntIterator",interfaces:[Y]},st.prototype.next=function(){return this.nextLong()},st.$metadata$={kind:c,simpleName:"LongIterator",interfaces:[Y]},at.prototype.next=function(){return this.nextFloat()},at.$metadata$={kind:c,simpleName:"FloatIterator",interfaces:[Y]},ut.prototype.next=function(){return this.nextDouble()},ut.$metadata$={kind:c,simpleName:"DoubleIterator",interfaces:[Y]},pt.prototype.next=function(){return this.nextBoolean()},pt.$metadata$={kind:c,simpleName:"BooleanIterator",interfaces:[Y]},ct.prototype.hasNext=function(){return this.hasNext_0},ct.prototype.nextChar=function(){var t=this.next_0;if(t===this.finalElement_0){if(!this.hasNext_0)throw Me();this.hasNext_0=!1}else this.next_0=this.next_0+this.step|0;return l(t)},ct.$metadata$={kind:c,simpleName:"CharProgressionIterator",interfaces:[rt]},lt.prototype.hasNext=function(){return this.hasNext_0},lt.prototype.nextInt=function(){var t=this.next_0;if(t===this.finalElement_0){if(!this.hasNext_0)throw Me();this.hasNext_0=!1}else this.next_0=this.next_0+this.step|0;return t},lt.$metadata$={kind:c,simpleName:"IntProgressionIterator",interfaces:[ot]},ht.prototype.hasNext=function(){return this.hasNext_0},ht.prototype.nextLong=function(){var t=this.next_0;if(i(t,this.finalElement_0)){if(!this.hasNext_0)throw Me();this.hasNext_0=!1}else this.next_0=this.next_0.add(this.step);return t},ht.$metadata$={kind:c,simpleName:"LongProgressionIterator",interfaces:[st]},ft.prototype.iterator=function(){return new ct(this.first,this.last,this.step)},ft.prototype.isEmpty=function(){return this.step>0?this.first>this.last:this.first0?String.fromCharCode(this.first)+".."+String.fromCharCode(this.last)+" step "+this.step:String.fromCharCode(this.first)+" downTo "+String.fromCharCode(this.last)+" step "+(0|-this.step)},yt.prototype.fromClosedRange_ayra44$=function(t,e,n){return new ft(t,e,n)},yt.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var dt=null;function _t(){return null===dt&&new yt,dt}function mt(t,e,n){if(vt(),0===n)throw xe("Step must be non-zero.");if(-2147483648===n)throw xe("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=Ft(t,e,n),this.step=n}function $t(){gt=this}ft.$metadata$={kind:c,simpleName:"CharProgression",interfaces:[B]},mt.prototype.iterator=function(){return new lt(this.first,this.last,this.step)},mt.prototype.isEmpty=function(){return this.step>0?this.first>this.last:this.first0?this.first.toString()+".."+this.last+" step "+this.step:this.first.toString()+" downTo "+this.last+" step "+(0|-this.step)},$t.prototype.fromClosedRange_qt1dr2$=function(t,e,n){return new mt(t,e,n)},$t.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var gt=null;function vt(){return null===gt&&new $t,gt}function bt(t,e,n){if(kt(),i(n,a))throw xe("Step must be non-zero.");if(i(n,f))throw xe("Step must be greater than Long.MIN_VALUE to avoid overflow on negation.");this.first=t,this.last=Ht(t,e,n),this.step=n}function xt(){wt=this}mt.$metadata$={kind:c,simpleName:"IntProgression",interfaces:[B]},bt.prototype.iterator=function(){return new ht(this.first,this.last,this.step)},bt.prototype.isEmpty=function(){return this.step.toNumber()>0?this.first.compareTo_11rb$(this.last)>0:this.first.compareTo_11rb$(this.last)<0},bt.prototype.equals=function(e){return t.isType(e,bt)&&(this.isEmpty()&&e.isEmpty()||i(this.first,e.first)&&i(this.last,e.last)&&i(this.step,e.step))},bt.prototype.hashCode=function(){return this.isEmpty()?-1:t.Long.fromInt(31).multiply(t.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32)))).add(this.step.xor(this.step.shiftRightUnsigned(32))).toInt()},bt.prototype.toString=function(){return this.step.toNumber()>0?this.first.toString()+".."+this.last.toString()+" step "+this.step.toString():this.first.toString()+" downTo "+this.last.toString()+" step "+this.step.unaryMinus().toString()},xt.prototype.fromClosedRange_b9bd0d$=function(t,e,n){return new bt(t,e,n)},xt.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var wt=null;function kt(){return null===wt&&new xt,wt}function Ct(){}function Nt(t,e){Et(),ft.call(this,t,e,1)}function Ot(){It=this,this.EMPTY=new Nt(l(1),l(0))}bt.$metadata$={kind:c,simpleName:"LongProgression",interfaces:[B]},Ct.prototype.contains_mef7kx$=function(e){return t.compareTo(e,this.start)>=0&&t.compareTo(e,this.endInclusive)<=0},Ct.prototype.isEmpty=function(){return t.compareTo(this.start,this.endInclusive)>0},Ct.$metadata$={kind:d,simpleName:"ClosedRange",interfaces:[]},Object.defineProperty(Nt.prototype,"start",{configurable:!0,get:function(){return o(this.first)}}),Object.defineProperty(Nt.prototype,"endInclusive",{configurable:!0,get:function(){return o(this.last)}}),Nt.prototype.contains_mef7kx$=function(t){return this.first<=t&&t<=this.last},Nt.prototype.isEmpty=function(){return this.first>this.last},Nt.prototype.equals=function(e){return t.isType(e,Nt)&&(this.isEmpty()&&e.isEmpty()||this.first===e.first&&this.last===e.last)},Nt.prototype.hashCode=function(){return this.isEmpty()?-1:(31*(0|this.first)|0)+(0|this.last)|0},Nt.prototype.toString=function(){return String.fromCharCode(this.first)+".."+String.fromCharCode(this.last)},Ot.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var It=null;function Et(){return null===It&&new Ot,It}function Lt(t,e){jt(),mt.call(this,t,e,1)}function At(){Mt=this,this.EMPTY=new Lt(1,0)}Nt.$metadata$={kind:c,simpleName:"CharRange",interfaces:[Ct,ft]},Object.defineProperty(Lt.prototype,"start",{configurable:!0,get:function(){return this.first}}),Object.defineProperty(Lt.prototype,"endInclusive",{configurable:!0,get:function(){return this.last}}),Lt.prototype.contains_mef7kx$=function(t){return this.first<=t&&t<=this.last},Lt.prototype.isEmpty=function(){return this.first>this.last},Lt.prototype.equals=function(e){return t.isType(e,Lt)&&(this.isEmpty()&&e.isEmpty()||this.first===e.first&&this.last===e.last)},Lt.prototype.hashCode=function(){return this.isEmpty()?-1:(31*this.first|0)+this.last|0},Lt.prototype.toString=function(){return this.first.toString()+".."+this.last},At.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var Mt=null;function jt(){return null===Mt&&new At,Mt}function St(t,e){qt(),bt.call(this,t,e,m)}function Pt(){Tt=this,this.EMPTY=new St(m,a)}Lt.$metadata$={kind:c,simpleName:"IntRange",interfaces:[Ct,mt]},Object.defineProperty(St.prototype,"start",{configurable:!0,get:function(){return this.first}}),Object.defineProperty(St.prototype,"endInclusive",{configurable:!0,get:function(){return this.last}}),St.prototype.contains_mef7kx$=function(t){return this.first.compareTo_11rb$(t)<=0&&t.compareTo_11rb$(this.last)<=0},St.prototype.isEmpty=function(){return this.first.compareTo_11rb$(this.last)>0},St.prototype.equals=function(e){return t.isType(e,St)&&(this.isEmpty()&&e.isEmpty()||i(this.first,e.first)&&i(this.last,e.last))},St.prototype.hashCode=function(){return this.isEmpty()?-1:t.Long.fromInt(31).multiply(this.first.xor(this.first.shiftRightUnsigned(32))).add(this.last.xor(this.last.shiftRightUnsigned(32))).toInt()},St.prototype.toString=function(){return this.first.toString()+".."+this.last.toString()},Pt.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var Tt=null;function qt(){return null===Tt&&new Pt,Tt}function zt(){Rt=this}St.$metadata$={kind:c,simpleName:"LongRange",interfaces:[Ct,bt]},zt.prototype.toString=function(){return"kotlin.Unit"},zt.$metadata$={kind:_,simpleName:"Unit",interfaces:[]};var Rt=null;function Bt(){return null===Rt&&new zt,Rt}function Dt(t,e){var n=t%e;return n>=0?n:n+e|0}function Ut(t,e){var n=t.modulo(e);return n.toNumber()>=0?n:n.add(e)}function Kt(t,e,n){return Dt(Dt(t,n)-Dt(e,n)|0,n)}function Wt(t,e,n){return Ut(Ut(t,n).subtract(Ut(e,n)),n)}function Ft(t,e,n){if(n>0)return t>=e?e:e-Kt(e,t,n)|0;if(n<0)return t<=e?e:e+Kt(t,e,0|-n)|0;throw xe("Step is zero.")}function Ht(t,e,n){if(n.toNumber()>0)return t.compareTo_11rb$(e)>=0?e:e.subtract(Wt(e,t,n));if(n.toNumber()<0)return t.compareTo_11rb$(e)<=0?e:e.add(Wt(t,e,n.unaryMinus()));throw xe("Step is zero.")}function Vt(t){this.closure$arr=t,this.index=0}function Gt(t){this.closure$array=t,pt.call(this),this.index=0}function Zt(t){return new Gt(t)}function Jt(t){this.closure$array=t,nt.call(this),this.index=0}function Xt(t){return new Jt(t)}function Yt(t){this.closure$array=t,it.call(this),this.index=0}function Qt(t){return new Yt(t)}function te(t){this.closure$array=t,rt.call(this),this.index=0}function ee(t){return new te(t)}function ne(t){this.closure$array=t,ot.call(this),this.index=0}function re(t){return new ne(t)}function ie(t){this.closure$array=t,at.call(this),this.index=0}function oe(t){return new ie(t)}function se(t){this.closure$array=t,ut.call(this),this.index=0}function ae(t){return new se(t)}function ue(t){this.closure$array=t,st.call(this),this.index=0}function pe(t){return new ue(t)}function ce(t){this.c=t}function le(t){this.resultContinuation_0=t,this.state_0=0,this.exceptionState_0=0,this.result_0=null,this.exception_0=null,this.finallyPath_0=null,this.context_hxcuhl$_0=this.resultContinuation_0.context,this.intercepted__0=null}function he(){fe=this}Vt.prototype.hasNext=function(){return this.index=0},Be.prototype.indexOf_11rb$=function(t){var e;e=pi(this);for(var n=0;n<=e;n++)if(i(this.get_za3lpa$(n),t))return n;return-1},Be.prototype.lastIndexOf_11rb$=function(t){for(var e=pi(this);e>=0;e--)if(i(this.get_za3lpa$(e),t))return e;return-1},Be.prototype.listIterator=function(){return this.listIterator_za3lpa$(0)},Be.prototype.listIterator_za3lpa$=function(t){return new Ue(this,t)},Be.prototype.subList_vux9f0$=function(t,e){return new Ke(this,t,e)},Be.prototype.removeRange_vux9f0$=function(t,e){for(var n=this.listIterator_za3lpa$(t),r=e-t|0,i=0;i0},Ue.prototype.nextIndex=function(){return this.index_0},Ue.prototype.previous=function(){if(!this.hasPrevious())throw Me();return this.last_0=(this.index_0=this.index_0-1|0,this.index_0),this.$outer.get_za3lpa$(this.last_0)},Ue.prototype.previousIndex=function(){return this.index_0-1|0},Ue.prototype.add_11rb$=function(t){this.$outer.add_wxm5ur$(this.index_0,t),this.index_0=this.index_0+1|0,this.last_0=-1},Ue.prototype.set_11rb$=function(t){if(-1===this.last_0)throw ke("Call next() or previous() before updating element value with the iterator.".toString());this.$outer.set_wxm5ur$(this.last_0,t)},Ue.$metadata$={kind:c,simpleName:"ListIteratorImpl",interfaces:[et,De]},Ke.prototype.add_wxm5ur$=function(t,e){Dr().checkPositionIndex_6xvm5r$(t,this._size_0),this.list_0.add_wxm5ur$(this.fromIndex_0+t|0,e),this._size_0=this._size_0+1|0},Ke.prototype.get_za3lpa$=function(t){return Dr().checkElementIndex_6xvm5r$(t,this._size_0),this.list_0.get_za3lpa$(this.fromIndex_0+t|0)},Ke.prototype.removeAt_za3lpa$=function(t){Dr().checkElementIndex_6xvm5r$(t,this._size_0);var e=this.list_0.removeAt_za3lpa$(this.fromIndex_0+t|0);return this._size_0=this._size_0-1|0,e},Ke.prototype.set_wxm5ur$=function(t,e){return Dr().checkElementIndex_6xvm5r$(t,this._size_0),this.list_0.set_wxm5ur$(this.fromIndex_0+t|0,e)},Object.defineProperty(Ke.prototype,"size",{configurable:!0,get:function(){return this._size_0}}),Ke.prototype.checkIsMutable=function(){this.list_0.checkIsMutable()},Ke.$metadata$={kind:c,simpleName:"SubList",interfaces:[Cn,Be]},Be.$metadata$={kind:c,simpleName:"AbstractMutableList",interfaces:[F,Re]},Object.defineProperty(Fe.prototype,"key",{get:function(){return this.key_5xhq3d$_0}}),Object.defineProperty(Fe.prototype,"value",{configurable:!0,get:function(){return this._value_0}}),Fe.prototype.setValue_11rc$=function(t){var e=this._value_0;return this._value_0=t,e},Fe.prototype.hashCode=function(){return Zr().entryHashCode_9fthdn$(this)},Fe.prototype.toString=function(){return Zr().entryToString_9fthdn$(this)},Fe.prototype.equals=function(t){return Zr().entryEquals_js7fox$(this,t)},Fe.$metadata$={kind:c,simpleName:"SimpleEntry",interfaces:[X]},He.prototype.contains_11rb$=function(t){return this.containsEntry_kw6fkd$(t)},He.$metadata$={kind:c,simpleName:"AbstractEntrySet",interfaces:[Xe]},We.prototype.clear=function(){this.entries.clear()},Ve.prototype.add_11rb$=function(t){throw Ie("Add is not supported on keys")},Ve.prototype.clear=function(){this.this$AbstractMutableMap.clear()},Ve.prototype.contains_11rb$=function(t){return this.this$AbstractMutableMap.containsKey_11rb$(t)},Ge.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Ge.prototype.next=function(){return this.closure$entryIterator.next().key},Ge.prototype.remove=function(){this.closure$entryIterator.remove()},Ge.$metadata$={kind:c,interfaces:[Q]},Ve.prototype.iterator=function(){return new Ge(this.this$AbstractMutableMap.entries.iterator())},Ve.prototype.remove_11rb$=function(t){return this.checkIsMutable(),!!this.this$AbstractMutableMap.containsKey_11rb$(t)&&(this.this$AbstractMutableMap.remove_11rb$(t),!0)},Object.defineProperty(Ve.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMutableMap.size}}),Ve.prototype.checkIsMutable=function(){this.this$AbstractMutableMap.checkIsMutable()},Ve.$metadata$={kind:c,interfaces:[Xe]},Object.defineProperty(We.prototype,"keys",{configurable:!0,get:function(){return null==this._keys_qe2m0n$_0&&(this._keys_qe2m0n$_0=new Ve(this)),v(this._keys_qe2m0n$_0)}}),We.prototype.putAll_a2k3zr$=function(t){var e;for(this.checkIsMutable(),e=t.entries.iterator();e.hasNext();){var n=e.next(),r=n.key,i=n.value;this.put_xwzc9p$(r,i)}},Ze.prototype.add_11rb$=function(t){throw Ie("Add is not supported on values")},Ze.prototype.clear=function(){this.this$AbstractMutableMap.clear()},Ze.prototype.contains_11rb$=function(t){return this.this$AbstractMutableMap.containsValue_11rc$(t)},Je.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Je.prototype.next=function(){return this.closure$entryIterator.next().value},Je.prototype.remove=function(){this.closure$entryIterator.remove()},Je.$metadata$={kind:c,interfaces:[Q]},Ze.prototype.iterator=function(){return new Je(this.this$AbstractMutableMap.entries.iterator())},Object.defineProperty(Ze.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMutableMap.size}}),Ze.prototype.equals=function(e){return this===e||!!t.isType(e,U)&&Dr().orderedEquals_e92ka7$(this,e)},Ze.prototype.hashCode=function(){return Dr().orderedHashCode_nykoif$(this)},Ze.prototype.checkIsMutable=function(){this.this$AbstractMutableMap.checkIsMutable()},Ze.$metadata$={kind:c,interfaces:[Re]},Object.defineProperty(We.prototype,"values",{configurable:!0,get:function(){return null==this._values_kxdlqh$_0&&(this._values_kxdlqh$_0=new Ze(this)),v(this._values_kxdlqh$_0)}}),We.prototype.remove_11rb$=function(t){this.checkIsMutable();for(var e=this.entries.iterator();e.hasNext();){var n=e.next(),r=n.key;if(i(t,r)){var o=n.value;return e.remove(),o}}return null},We.prototype.checkIsMutable=function(){},We.$metadata$={kind:c,simpleName:"AbstractMutableMap",interfaces:[J,Ur]},Xe.prototype.equals=function(e){return e===this||!!t.isType(e,H)&&Qr().setEquals_y8f7en$(this,e)},Xe.prototype.hashCode=function(){return Qr().unorderedHashCode_nykoif$(this)},Xe.$metadata$={kind:c,simpleName:"AbstractMutableSet",interfaces:[V,Re]},Ye.prototype.build=function(){return this.checkIsMutable(),this.isReadOnly_dbt2oh$_0=!0,this},Ye.prototype.trimToSize=function(){},Ye.prototype.ensureCapacity_za3lpa$=function(t){},Object.defineProperty(Ye.prototype,"size",{configurable:!0,get:function(){return this.array_hd7ov6$_0.length}}),Ye.prototype.get_za3lpa$=function(e){var n;return null==(n=this.array_hd7ov6$_0[this.rangeCheck_xcmk5o$_0(e)])||t.isType(n,b)?n:Mn()},Ye.prototype.set_wxm5ur$=function(e,n){var r;this.checkIsMutable(),this.rangeCheck_xcmk5o$_0(e);var i=this.array_hd7ov6$_0[e];return this.array_hd7ov6$_0[e]=n,null==(r=i)||t.isType(r,b)?r:Mn()},Ye.prototype.add_11rb$=function(t){return this.checkIsMutable(),this.array_hd7ov6$_0.push(t),this.modCount=this.modCount+1|0,!0},Ye.prototype.add_wxm5ur$=function(t,e){this.checkIsMutable(),this.array_hd7ov6$_0.splice(this.insertionRangeCheck_xwivfl$_0(t),0,e),this.modCount=this.modCount+1|0},Ye.prototype.addAll_brywnq$=function(t){return this.checkIsMutable(),!t.isEmpty()&&(this.array_hd7ov6$_0=this.array_hd7ov6$_0.concat(Pe(t)),this.modCount=this.modCount+1|0,!0)},Ye.prototype.addAll_u57x28$=function(t,e){return this.checkIsMutable(),this.insertionRangeCheck_xwivfl$_0(t),t===this.size?this.addAll_brywnq$(e):!e.isEmpty()&&(t===this.size?this.addAll_brywnq$(e):(this.array_hd7ov6$_0=0===t?Pe(e).concat(this.array_hd7ov6$_0):je(this.array_hd7ov6$_0,0,t).concat(Pe(e),je(this.array_hd7ov6$_0,t,this.size)),this.modCount=this.modCount+1|0,!0))},Ye.prototype.removeAt_za3lpa$=function(t){return this.checkIsMutable(),this.rangeCheck_xcmk5o$_0(t),this.modCount=this.modCount+1|0,t===pi(this)?this.array_hd7ov6$_0.pop():this.array_hd7ov6$_0.splice(t,1)[0]},Ye.prototype.remove_11rb$=function(t){var e;this.checkIsMutable(),e=this.array_hd7ov6$_0;for(var n=0;n!==e.length;++n)if(i(this.array_hd7ov6$_0[n],t))return this.array_hd7ov6$_0.splice(n,1),this.modCount=this.modCount+1|0,!0;return!1},Ye.prototype.removeRange_vux9f0$=function(t,e){this.checkIsMutable(),this.modCount=this.modCount+1|0,this.array_hd7ov6$_0.splice(t,e-t|0)},Ye.prototype.clear=function(){this.checkIsMutable(),this.array_hd7ov6$_0=[],this.modCount=this.modCount+1|0},Ye.prototype.indexOf_11rb$=function(t){return E(this.array_hd7ov6$_0,t)},Ye.prototype.lastIndexOf_11rb$=function(t){return L(this.array_hd7ov6$_0,t)},Ye.prototype.toString=function(){return k(this.array_hd7ov6$_0)},Ye.prototype.toArray=function(){return[].slice.call(this.array_hd7ov6$_0)},Ye.prototype.checkIsMutable=function(){if(this.isReadOnly_dbt2oh$_0)throw Oe()},Ye.prototype.rangeCheck_xcmk5o$_0=function(t){return Dr().checkElementIndex_6xvm5r$(t,this.size),t},Ye.prototype.insertionRangeCheck_xwivfl$_0=function(t){return Dr().checkPositionIndex_6xvm5r$(t,this.size),t},Ye.$metadata$={kind:c,simpleName:"ArrayList",interfaces:[Cn,Be,F]},nn.prototype.equals_oaftn8$=function(t,e){return i(t,e)},nn.prototype.getHashCode_s8jyv4$=function(t){var e;return null!=(e=null!=t?C(t):null)?e:0},nn.$metadata$={kind:_,simpleName:"HashCode",interfaces:[en]};var rn,on=null;function sn(){return null===on&&new nn,on}function an(){this.internalMap_uxhen5$_0=null,this.equality_vgh6cm$_0=null,this._entries_7ih87x$_0=null}function un(t){this.$outer=t,He.call(this)}function pn(t,e){return e=e||Object.create(an.prototype),We.call(e),an.call(e),e.internalMap_uxhen5$_0=t,e.equality_vgh6cm$_0=t.equality,e}function cn(t){return t=t||Object.create(an.prototype),pn(new fn(sn()),t),t}function ln(){this.map_8be2vx$=null}function hn(t,e){return e=e||Object.create(ln.prototype),Xe.call(e),ln.call(e),e.map_8be2vx$=t,e}function fn(t){this.equality_mamlu8$_0=t,this.backingMap_0=this.createJsMap(),this.size_x3bm7r$_0=0}function yn(t){this.this$InternalHashCodeMap=t,this.state=-1,this.keys=Object.keys(t.backingMap_0),this.keyIndex=-1,this.chainOrEntry=null,this.isChain=!1,this.itemIndex=-1,this.lastEntry=null}function dn(){}function _n(t){this.equality_qma612$_0=t,this.backingMap_0=this.createJsMap(),this.size_6u3ykz$_0=0}function mn(){this.head_1lr44l$_0=null,this.map_97q5dv$_0=null,this.isReadOnly_uhyvn5$_0=!1}function $n(t,e,n){this.$outer=t,Fe.call(this,e,n),this.next_8be2vx$=null,this.prev_8be2vx$=null}function gn(t){this.$outer=t,He.call(this)}function vn(t){this.$outer=t,this.last_0=null,this.next_0=null,this.next_0=this.$outer.$outer.head_1lr44l$_0}function bn(t){return cn(t=t||Object.create(mn.prototype)),mn.call(t),t.map_97q5dv$_0=cn(),t}function xn(){}function wn(t){return t=t||Object.create(xn.prototype),hn(bn(),t),xn.call(t),t}function kn(t,e){return e=e||Object.create(xn.prototype),hn(bn(),e),xn.call(e),e.addAll_brywnq$(t),e}function Cn(){}function Nn(){}function On(t){Nn.call(this),this.outputStream=t}function In(){Nn.call(this),this.buffer=""}function En(){In.call(this)}function Ln(t,e){this.delegate_0=t,this.result_0=e}function An(t,e){this.closure$context=t,this.closure$resumeWith=e}function Mn(){throw new Le("Illegal cast")}function jn(t){throw ke(t)}function Sn(){}function Pn(){}function Tn(){}function qn(t){this.jClass_1ppatx$_0=t}function zn(t){var e;qn.call(this,t),this.simpleName_m7mxi0$_0=null!=(e=t.$metadata$)?e.simpleName:null}function Rn(t,e,n){qn.call(this,t),this.givenSimpleName_0=e,this.isInstanceFunction_0=n}function Bn(){Dn=this,qn.call(this,Object),this.simpleName_lnzy73$_0="Nothing"}en.$metadata$={kind:d,simpleName:"EqualityComparator",interfaces:[]},un.prototype.add_11rb$=function(t){throw Ie("Add is not supported on entries")},un.prototype.clear=function(){this.$outer.clear()},un.prototype.containsEntry_kw6fkd$=function(t){return this.$outer.containsEntry_8hxqw4$(t)},un.prototype.iterator=function(){return this.$outer.internalMap_uxhen5$_0.iterator()},un.prototype.remove_11rb$=function(t){return!!this.contains_11rb$(t)&&(this.$outer.remove_11rb$(t.key),!0)},Object.defineProperty(un.prototype,"size",{configurable:!0,get:function(){return this.$outer.size}}),un.$metadata$={kind:c,simpleName:"EntrySet",interfaces:[He]},an.prototype.clear=function(){this.internalMap_uxhen5$_0.clear()},an.prototype.containsKey_11rb$=function(t){return this.internalMap_uxhen5$_0.contains_11rb$(t)},an.prototype.containsValue_11rc$=function(e){var n,r=this.internalMap_uxhen5$_0;t:do{var i;if(t.isType(r,U)&&r.isEmpty()){n=!1;break t}for(i=r.iterator();i.hasNext();){var o=i.next();if(this.equality_vgh6cm$_0.equals_oaftn8$(o.value,e)){n=!0;break t}}n=!1}while(0);return n},Object.defineProperty(an.prototype,"entries",{configurable:!0,get:function(){return null==this._entries_7ih87x$_0&&(this._entries_7ih87x$_0=this.createEntrySet()),v(this._entries_7ih87x$_0)}}),an.prototype.createEntrySet=function(){return new un(this)},an.prototype.get_11rb$=function(t){return this.internalMap_uxhen5$_0.get_11rb$(t)},an.prototype.put_xwzc9p$=function(t,e){return this.internalMap_uxhen5$_0.put_xwzc9p$(t,e)},an.prototype.remove_11rb$=function(t){return this.internalMap_uxhen5$_0.remove_11rb$(t)},Object.defineProperty(an.prototype,"size",{configurable:!0,get:function(){return this.internalMap_uxhen5$_0.size}}),an.$metadata$={kind:c,simpleName:"HashMap",interfaces:[We,J]},ln.prototype.add_11rb$=function(t){return null==this.map_8be2vx$.put_xwzc9p$(t,this)},ln.prototype.clear=function(){this.map_8be2vx$.clear()},ln.prototype.contains_11rb$=function(t){return this.map_8be2vx$.containsKey_11rb$(t)},ln.prototype.isEmpty=function(){return this.map_8be2vx$.isEmpty()},ln.prototype.iterator=function(){return this.map_8be2vx$.keys.iterator()},ln.prototype.remove_11rb$=function(t){return null!=this.map_8be2vx$.remove_11rb$(t)},Object.defineProperty(ln.prototype,"size",{configurable:!0,get:function(){return this.map_8be2vx$.size}}),ln.$metadata$={kind:c,simpleName:"HashSet",interfaces:[Xe,V]},Object.defineProperty(fn.prototype,"equality",{get:function(){return this.equality_mamlu8$_0}}),Object.defineProperty(fn.prototype,"size",{configurable:!0,get:function(){return this.size_x3bm7r$_0},set:function(t){this.size_x3bm7r$_0=t}}),fn.prototype.put_xwzc9p$=function(e,n){var r=this.equality.getHashCode_s8jyv4$(e),i=this.getChainOrEntryOrNull_0(r);if(null==i)this.backingMap_0[r]=new Fe(e,n);else{if(!t.isArray(i)){var o=i;return this.equality.equals_oaftn8$(o.key,e)?o.setValue_11rc$(n):(this.backingMap_0[r]=[o,new Fe(e,n)],this.size=this.size+1|0,null)}var s=i,a=this.findEntryInChain_0(s,e);if(null!=a)return a.setValue_11rc$(n);s.push(new Fe(e,n))}return this.size=this.size+1|0,null},fn.prototype.remove_11rb$=function(e){var n,r=this.equality.getHashCode_s8jyv4$(e);if(null==(n=this.getChainOrEntryOrNull_0(r)))return null;var i=n;if(!t.isArray(i)){var o=i;return this.equality.equals_oaftn8$(o.key,e)?(delete this.backingMap_0[r],this.size=this.size-1|0,o.value):null}for(var s=i,a=0;a!==s.length;++a){var u=s[a];if(this.equality.equals_oaftn8$(e,u.key))return 1===s.length?(s.length=0,delete this.backingMap_0[r]):s.splice(a,1),this.size=this.size-1|0,u.value}return null},fn.prototype.clear=function(){this.backingMap_0=this.createJsMap(),this.size=0},fn.prototype.contains_11rb$=function(t){return null!=this.getEntry_0(t)},fn.prototype.get_11rb$=function(t){var e;return null!=(e=this.getEntry_0(t))?e.value:null},fn.prototype.getEntry_0=function(e){var n;if(null==(n=this.getChainOrEntryOrNull_0(this.equality.getHashCode_s8jyv4$(e))))return null;var r=n;if(t.isArray(r)){var i=r;return this.findEntryInChain_0(i,e)}var o=r;return this.equality.equals_oaftn8$(o.key,e)?o:null},fn.prototype.findEntryInChain_0=function(t,e){var n;t:do{var r;for(r=0;r!==t.length;++r){var i=t[r];if(this.equality.equals_oaftn8$(i.key,e)){n=i;break t}}n=null}while(0);return n},yn.prototype.computeNext_0=function(){if(null!=this.chainOrEntry&&this.isChain){var e=this.chainOrEntry.length;if(this.itemIndex=this.itemIndex+1|0,this.itemIndex=0&&(this.buffer=this.buffer+e.substring(0,n),this.flush(),e=e.substring(n+1|0)),this.buffer=this.buffer+e},En.prototype.flush=function(){console.log(this.buffer),this.buffer=""},En.$metadata$={kind:c,simpleName:"BufferedOutputToConsoleLog",interfaces:[In]},Object.defineProperty(Ln.prototype,"context",{configurable:!0,get:function(){return this.delegate_0.context}}),Ln.prototype.resumeWith_tl1gpc$=function(t){var e=this.result_0;if(e===Ui())this.result_0=t.value;else{if(e!==zi())throw ke("Already resumed");this.result_0=Ki(),this.delegate_0.resumeWith_tl1gpc$(t)}},Ln.prototype.getOrThrow=function(){var e;if(this.result_0===Ui())return this.result_0=zi(),zi();var n=this.result_0;if(n===Ki())e=zi();else{if(t.isType(n,Yi))throw n.exception;e=n}return e},Ln.$metadata$={kind:c,simpleName:"SafeContinuation",interfaces:[mi]},Object.defineProperty(An.prototype,"context",{configurable:!0,get:function(){return this.closure$context}}),An.prototype.resumeWith_tl1gpc$=function(t){this.closure$resumeWith(t)},An.$metadata$={kind:c,interfaces:[mi]},Sn.$metadata$={kind:d,simpleName:"Serializable",interfaces:[]},Pn.$metadata$={kind:d,simpleName:"KCallable",interfaces:[]},Tn.$metadata$={kind:d,simpleName:"KClass",interfaces:[Fi]},Object.defineProperty(qn.prototype,"jClass",{get:function(){return this.jClass_1ppatx$_0}}),Object.defineProperty(qn.prototype,"qualifiedName",{configurable:!0,get:function(){throw new eo}}),qn.prototype.equals=function(e){return t.isType(e,qn)&&i(this.jClass,e.jClass)},qn.prototype.hashCode=function(){var t,e;return null!=(e=null!=(t=this.simpleName)?C(t):null)?e:0},qn.prototype.toString=function(){return"class "+y(this.simpleName)},qn.$metadata$={kind:c,simpleName:"KClassImpl",interfaces:[Tn]},Object.defineProperty(zn.prototype,"simpleName",{configurable:!0,get:function(){return this.simpleName_m7mxi0$_0}}),zn.prototype.isInstance_s8jyv4$=function(e){var n=this.jClass;return t.isType(e,n)},zn.$metadata$={kind:c,simpleName:"SimpleKClassImpl",interfaces:[qn]},Rn.prototype.equals=function(e){return!!t.isType(e,Rn)&&qn.prototype.equals.call(this,e)&&i(this.givenSimpleName_0,e.givenSimpleName_0)},Object.defineProperty(Rn.prototype,"simpleName",{configurable:!0,get:function(){return this.givenSimpleName_0}}),Rn.prototype.isInstance_s8jyv4$=function(t){return this.isInstanceFunction_0(t)},Rn.$metadata$={kind:c,simpleName:"PrimitiveKClassImpl",interfaces:[qn]},Object.defineProperty(Bn.prototype,"simpleName",{configurable:!0,get:function(){return this.simpleName_lnzy73$_0}}),Bn.prototype.isInstance_s8jyv4$=function(t){return!1},Object.defineProperty(Bn.prototype,"jClass",{configurable:!0,get:function(){throw Ie("There's no native JS class for Nothing type")}}),Bn.prototype.equals=function(t){return t===this},Bn.prototype.hashCode=function(){return 0},Bn.$metadata$={kind:_,simpleName:"NothingKClassImpl",interfaces:[qn]};var Dn=null;function Un(){return null===Dn&&new Bn,Dn}function Kn(){}function Wn(){}function Fn(){}function Hn(){}function Vn(){}function Gn(){}function Zn(){}function Jn(){$r=this,this.anyClass=new Rn(Object,"Any",Xn),this.numberClass=new Rn(Number,"Number",Yn),this.nothingClass=Un(),this.booleanClass=new Rn(Boolean,"Boolean",Qn),this.byteClass=new Rn(Number,"Byte",tr),this.shortClass=new Rn(Number,"Short",er),this.intClass=new Rn(Number,"Int",nr),this.floatClass=new Rn(Number,"Float",rr),this.doubleClass=new Rn(Number,"Double",ir),this.arrayClass=new Rn(Array,"Array",or),this.stringClass=new Rn(String,"String",sr),this.throwableClass=new Rn(Error,"Throwable",ar),this.booleanArrayClass=new Rn(Array,"BooleanArray",ur),this.charArrayClass=new Rn(Uint16Array,"CharArray",pr),this.byteArrayClass=new Rn(Int8Array,"ByteArray",cr),this.shortArrayClass=new Rn(Int16Array,"ShortArray",lr),this.intArrayClass=new Rn(Int32Array,"IntArray",hr),this.longArrayClass=new Rn(Array,"LongArray",fr),this.floatArrayClass=new Rn(Float32Array,"FloatArray",yr),this.doubleArrayClass=new Rn(Float64Array,"DoubleArray",dr)}function Xn(e){return t.isType(e,b)}function Yn(e){return t.isNumber(e)}function Qn(t){return"boolean"==typeof t}function tr(t){return"number"==typeof t}function er(t){return"number"==typeof t}function nr(t){return"number"==typeof t}function rr(t){return"number"==typeof t}function ir(t){return"number"==typeof t}function or(e){return t.isArray(e)}function sr(t){return"string"==typeof t}function ar(e){return t.isType(e,w)}function ur(e){return t.isBooleanArray(e)}function pr(e){return t.isCharArray(e)}function cr(e){return t.isByteArray(e)}function lr(e){return t.isShortArray(e)}function hr(e){return t.isIntArray(e)}function fr(e){return t.isLongArray(e)}function yr(e){return t.isFloatArray(e)}function dr(e){return t.isDoubleArray(e)}Object.defineProperty(Kn.prototype,"simpleName",{configurable:!0,get:function(){throw ke("Unknown simpleName for ErrorKClass".toString())}}),Object.defineProperty(Kn.prototype,"qualifiedName",{configurable:!0,get:function(){throw ke("Unknown qualifiedName for ErrorKClass".toString())}}),Kn.prototype.isInstance_s8jyv4$=function(t){throw ke("Can's check isInstance on ErrorKClass".toString())},Kn.prototype.equals=function(t){return t===this},Kn.prototype.hashCode=function(){return 0},Kn.$metadata$={kind:c,simpleName:"ErrorKClass",interfaces:[Tn]},Wn.$metadata$={kind:d,simpleName:"KProperty",interfaces:[Pn]},Fn.$metadata$={kind:d,simpleName:"KMutableProperty",interfaces:[Wn]},Hn.$metadata$={kind:d,simpleName:"KProperty0",interfaces:[Wn]},Vn.$metadata$={kind:d,simpleName:"KMutableProperty0",interfaces:[Fn,Hn]},Gn.$metadata$={kind:d,simpleName:"KProperty1",interfaces:[Wn]},Zn.$metadata$={kind:d,simpleName:"KMutableProperty1",interfaces:[Fn,Gn]},Jn.prototype.functionClass=function(t){var e,n,r;if(null!=(e=_r[t]))n=e;else{var i=new Rn(Function,"Function"+t,(r=t,function(t){return"function"==typeof t&&t.length===r}));_r[t]=i,n=i}return n},Jn.$metadata$={kind:_,simpleName:"PrimitiveClasses",interfaces:[]};var _r,mr,$r=null;function gr(){return null===$r&&new Jn,$r}function vr(t){return Array.isArray(t)?br(t):xr(t)}function br(t){switch(t.length){case 1:return xr(t[0]);case 0:return Un();default:return new Kn}}function xr(t){var e;if(t===String)return gr().stringClass;var n=t.$metadata$;if(null!=n)if(null==n.$kClass$){var r=new zn(t);n.$kClass$=r,e=r}else e=n.$kClass$;else e=new zn(t);return e}function wr(){}function kr(t){$e(t,this),this.name="CharacterCodingException"}function Cr(t){this.string_0=void 0!==t?t:""}function Nr(t){return t=t||Object.create(Cr.prototype),Cr.call(t,""),t}function Or(t){return new Nt(N.MIN_HIGH_SURROGATE,N.MAX_HIGH_SURROGATE).contains_mef7kx$(t)}function Ir(t){return new Nt(N.MIN_LOW_SURROGATE,N.MAX_LOW_SURROGATE).contains_mef7kx$(t)}function Er(t){var e,n="";for(e=0;e!==t.length;++e){var r=s(t[e]);n+=String.fromCharCode(r)}return n}function Lr(t,e,n){void 0===e&&(e=0),void 0===n&&(n=t.length),Dr().checkBoundsIndexes_cub51b$(e,n,t.length);for(var r="",i=e;i=r)return Mr(0,n,i);var o=t[n];return 128!=(192&o)?Mr(0,n,i):e<<6^o^3968}function Sr(t,e,n,r,i){if(n>=r)return Mr(0,n,i);var o=t[n];if(0==(15&e)){if(160!=(224&o))return Mr(0,n,i)}else if(13==(15&e)){if(128!=(224&o))return Mr(0,n,i)}else if(128!=(192&o))return Mr(0,n,i);if((n+1|0)===r)return Mr(1,n,i);var s=t[n+1|0];return 128!=(192&s)?Mr(1,n,i):e<<12^o<<6^s^-123008}function Pr(t,e,n,r,i){n>=r&&Mr(0,n,i);var o=t[n];if(0==(15&e)){if((240&o)<=128)return Mr(0,n,i)}else if(4==(15&e)){if(128!=(240&o))return Mr(0,n,i)}else{if((15&e)>4)return Mr(0,n,i);if(128!=(192&o))return Mr(0,n,i)}if((n+1|0)===r)return Mr(1,n,i);var s=t[n+1|0];if(128!=(192&s))return Mr(1,n,i);if((n+2|0)===r)return Mr(2,n,i);var a=t[n+2|0];return 128!=(192&a)?Mr(2,n,i):e<<18^o<<12^s<<6^a^3678080}function Tr(t,e,n,r){var i;if(!(e>=0&&n<=t.length&&e<=n))throw xe("Failed requirement.".toString());for(var o=e,s=Nr();o=0)s.append_s8itvh$(l(a));else if(a>>5==-2){var u=jr(t,a,o,n,r);u<=0?(s.append_s8itvh$(mr),o=o+(0|-u)|0):(s.append_s8itvh$(l(u)),o=o+1|0)}else if(a>>4==-2){var p=Sr(t,a,o,n,r);p<=0?(s.append_s8itvh$(mr),o=o+(0|-p)|0):(s.append_s8itvh$(l(p)),o=o+2|0)}else if(a>>3==-2){var c=Pr(t,a,o,n,r);if(c<=0)s.append_s8itvh$(mr),o=o+(0|-c)|0;else{var h=c-65536>>10|55296,f=1023&c|56320;s.append_s8itvh$(l(h)),s.append_s8itvh$(l(f)),o=o+3|0}}else Mr(0,o,r),s.append_s8itvh$(mr)}return s.toString()}function qr(){}function zr(){Dr(),qr.call(this)}function Rr(){Br=this}wr.$metadata$={kind:d,simpleName:"Appendable",interfaces:[]},kr.$metadata$={kind:c,simpleName:"CharacterCodingException",interfaces:[me]},Object.defineProperty(Cr.prototype,"length",{configurable:!0,get:function(){return this.string_0.length}}),Cr.prototype.charCodeAt=function(t){var e=this.string_0;if(!(t>=0&&t<=Vi(e)))throw new Ce("index: "+t+", length: "+this.length+"}");return e.charCodeAt(t)},Cr.prototype.subSequence_vux9f0$=function(t,e){return this.string_0.substring(t,e)},Cr.prototype.append_s8itvh$=function(t){return this.string_0+=String.fromCharCode(t),this},Cr.prototype.append_gw00v9$=function(t){return this.string_0+=y(t),this},Cr.prototype.append_ezbsdh$=function(t,e,n){return this.appendRange_3peag4$(null!=t?t:"null",e,n)},Cr.prototype.reverse=function(){for(var t,e,n="",r=this.string_0.length-1|0;r>=0;){var i=this.string_0.charCodeAt((r=(t=r)-1|0,t));if(Ir(i)&&r>=0){var s=this.string_0.charCodeAt((r=(e=r)-1|0,e));n=Or(s)?n+String.fromCharCode(o(s))+String.fromCharCode(o(i)):n+String.fromCharCode(o(i))+String.fromCharCode(o(s))}else n+=String.fromCharCode(i)}return this.string_0=n,this},Cr.prototype.append_s8jyv4$=function(t){return this.string_0+=y(t),this},Cr.prototype.append_6taknv$=function(t){return this.string_0+=t,this},Cr.prototype.append_4hbowm$=function(t){return this.string_0+=Er(t),this},Cr.prototype.append_61zpoe$=function(t){return this.append_pdl1vj$(t)},Cr.prototype.append_pdl1vj$=function(t){return this.string_0=this.string_0+(null!=t?t:"null"),this},Cr.prototype.capacity=function(){return this.length},Cr.prototype.ensureCapacity_za3lpa$=function(t){},Cr.prototype.indexOf_61zpoe$=function(t){return this.string_0.indexOf(t)},Cr.prototype.indexOf_bm4lxs$=function(t,e){return this.string_0.indexOf(t,e)},Cr.prototype.lastIndexOf_61zpoe$=function(t){return this.string_0.lastIndexOf(t)},Cr.prototype.lastIndexOf_bm4lxs$=function(t,e){return 0===t.length&&e<0?-1:this.string_0.lastIndexOf(t,e)},Cr.prototype.insert_fzusl$=function(t,e){return Dr().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Cr.prototype.insert_6t1mh3$=function(t,e){return Dr().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+String.fromCharCode(o(e))+this.string_0.substring(t),this},Cr.prototype.insert_7u455s$=function(t,e){return Dr().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+Er(e)+this.string_0.substring(t),this},Cr.prototype.insert_1u9bqd$=function(t,e){return Dr().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Cr.prototype.insert_6t2rgq$=function(t,e){return Dr().checkPositionIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+y(e)+this.string_0.substring(t),this},Cr.prototype.insert_19mbxw$=function(t,e){return this.insert_vqvrqt$(t,e)},Cr.prototype.insert_vqvrqt$=function(t,e){Dr().checkPositionIndex_6xvm5r$(t,this.length);var n=null!=e?e:"null";return this.string_0=this.string_0.substring(0,t)+n+this.string_0.substring(t),this},Cr.prototype.setLength_za3lpa$=function(t){if(t<0)throw xe("Negative new length: "+t+".");if(t<=this.length)this.string_0=this.string_0.substring(0,t);else for(var e=this.length;en)throw new Ce("startIndex: "+t+", length: "+n);if(t>e)throw xe("startIndex("+t+") > endIndex("+e+")")},Cr.prototype.deleteAt_za3lpa$=function(t){return Dr().checkElementIndex_6xvm5r$(t,this.length),this.string_0=this.string_0.substring(0,t)+this.string_0.substring(t+1|0),this},Cr.prototype.deleteRange_vux9f0$=function(t,e){return this.checkReplaceRange_0(t,e,this.length),this.string_0=this.string_0.substring(0,t)+this.string_0.substring(e),this},Cr.prototype.toCharArray_pqkatk$=function(t,e,n,r){var i;void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=this.length),Dr().checkBoundsIndexes_cub51b$(n,r,this.length),Dr().checkBoundsIndexes_cub51b$(e,e+r-n|0,t.length);for(var o=e,s=n;s=e)throw new Ce("index: "+t+", size: "+e)},Rr.prototype.checkPositionIndex_6xvm5r$=function(t,e){if(t<0||t>e)throw new Ce("index: "+t+", size: "+e)},Rr.prototype.checkRangeIndexes_cub51b$=function(t,e,n){if(t<0||e>n)throw new Ce("fromIndex: "+t+", toIndex: "+e+", size: "+n);if(t>e)throw xe("fromIndex: "+t+" > toIndex: "+e)},Rr.prototype.checkBoundsIndexes_cub51b$=function(t,e,n){if(t<0||e>n)throw new Ce("startIndex: "+t+", endIndex: "+e+", size: "+n);if(t>e)throw xe("startIndex: "+t+" > endIndex: "+e)},Rr.prototype.orderedHashCode_nykoif$=function(t){var e,n,r=1;for(e=t.iterator();e.hasNext();){var i=e.next();r=(31*r|0)+(null!=(n=null!=i?C(i):null)?n:0)|0}return r},Rr.prototype.orderedEquals_e92ka7$=function(t,e){var n;if(t.size!==e.size)return!1;var r=e.iterator();for(n=t.iterator();n.hasNext();){var o=n.next(),s=r.next();if(!i(o,s))return!1}return!0},Rr.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var Br=null;function Dr(){return null===Br&&new Rr,Br}function Ur(){Zr(),this._keys_up5z3z$_0=null,this._values_6nw1f1$_0=null}function Kr(t){this.this$AbstractMap=t,Jr.call(this)}function Wr(t){this.closure$entryIterator=t}function Fr(t){this.this$AbstractMap=t,qr.call(this)}function Hr(t){this.closure$entryIterator=t}function Vr(){Gr=this}Ur.prototype.containsKey_11rb$=function(t){return null!=this.implFindEntry_8k1i24$_0(t)},Ur.prototype.containsValue_11rc$=function(e){var n,r=this.entries;t:do{var o;if(t.isType(r,U)&&r.isEmpty()){n=!1;break t}for(o=r.iterator();o.hasNext();){var s=o.next();if(i(s.value,e)){n=!0;break t}}n=!1}while(0);return n},Ur.prototype.containsEntry_8hxqw4$=function(e){if(!t.isType(e,Z))return!1;var n=e.key,r=e.value,o=(t.isType(this,G)?this:x()).get_11rb$(n);if(!i(r,o))return!1;var s=null==o;return s&&(s=!(t.isType(this,G)?this:x()).containsKey_11rb$(n)),!s},Ur.prototype.equals=function(e){if(e===this)return!0;if(!t.isType(e,G))return!1;if(this.size!==e.size)return!1;var n,r=e.entries;t:do{var i;if(t.isType(r,U)&&r.isEmpty()){n=!0;break t}for(i=r.iterator();i.hasNext();){var o=i.next();if(!this.containsEntry_8hxqw4$(o)){n=!1;break t}}n=!0}while(0);return n},Ur.prototype.get_11rb$=function(t){var e;return null!=(e=this.implFindEntry_8k1i24$_0(t))?e.value:null},Ur.prototype.hashCode=function(){return C(this.entries)},Ur.prototype.isEmpty=function(){return 0===this.size},Object.defineProperty(Ur.prototype,"size",{configurable:!0,get:function(){return this.entries.size}}),Kr.prototype.contains_11rb$=function(t){return this.this$AbstractMap.containsKey_11rb$(t)},Wr.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Wr.prototype.next=function(){return this.closure$entryIterator.next().key},Wr.$metadata$={kind:c,interfaces:[Y]},Kr.prototype.iterator=function(){return new Wr(this.this$AbstractMap.entries.iterator())},Object.defineProperty(Kr.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMap.size}}),Kr.$metadata$={kind:c,interfaces:[Jr]},Object.defineProperty(Ur.prototype,"keys",{configurable:!0,get:function(){return null==this._keys_up5z3z$_0&&(this._keys_up5z3z$_0=new Kr(this)),v(this._keys_up5z3z$_0)}}),Ur.prototype.toString=function(){return q(this.entries,", ","{","}",void 0,void 0,(t=this,function(e){return t.toString_55he67$_0(e)}));var t},Ur.prototype.toString_55he67$_0=function(t){return this.toString_kthv8s$_0(t.key)+"="+this.toString_kthv8s$_0(t.value)},Ur.prototype.toString_kthv8s$_0=function(t){return t===this?"(this Map)":y(t)},Fr.prototype.contains_11rb$=function(t){return this.this$AbstractMap.containsValue_11rc$(t)},Hr.prototype.hasNext=function(){return this.closure$entryIterator.hasNext()},Hr.prototype.next=function(){return this.closure$entryIterator.next().value},Hr.$metadata$={kind:c,interfaces:[Y]},Fr.prototype.iterator=function(){return new Hr(this.this$AbstractMap.entries.iterator())},Object.defineProperty(Fr.prototype,"size",{configurable:!0,get:function(){return this.this$AbstractMap.size}}),Fr.$metadata$={kind:c,interfaces:[qr]},Object.defineProperty(Ur.prototype,"values",{configurable:!0,get:function(){return null==this._values_6nw1f1$_0&&(this._values_6nw1f1$_0=new Fr(this)),v(this._values_6nw1f1$_0)}}),Ur.prototype.implFindEntry_8k1i24$_0=function(t){var e,n=this.entries;t:do{var r;for(r=n.iterator();r.hasNext();){var o=r.next();if(i(o.key,t)){e=o;break t}}e=null}while(0);return e},Vr.prototype.entryHashCode_9fthdn$=function(t){var e,n,r,i;return(null!=(n=null!=(e=t.key)?C(e):null)?n:0)^(null!=(i=null!=(r=t.value)?C(r):null)?i:0)},Vr.prototype.entryToString_9fthdn$=function(t){return y(t.key)+"="+y(t.value)},Vr.prototype.entryEquals_js7fox$=function(e,n){return!!t.isType(n,Z)&&i(e.key,n.key)&&i(e.value,n.value)},Vr.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var Gr=null;function Zr(){return null===Gr&&new Vr,Gr}function Jr(){Qr(),qr.call(this)}function Xr(){Yr=this}Ur.$metadata$={kind:c,simpleName:"AbstractMap",interfaces:[G]},Jr.prototype.equals=function(e){return e===this||!!t.isType(e,H)&&Qr().setEquals_y8f7en$(this,e)},Jr.prototype.hashCode=function(){return Qr().unorderedHashCode_nykoif$(this)},Xr.prototype.unorderedHashCode_nykoif$=function(t){var e,n=0;for(e=t.iterator();e.hasNext();){var r,i=e.next();n=n+(null!=(r=null!=i?C(i):null)?r:0)|0}return n},Xr.prototype.setEquals_y8f7en$=function(t,e){return t.size===e.size&&t.containsAll_brywnq$(e)},Xr.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var Yr=null;function Qr(){return null===Yr&&new Xr,Yr}function ti(){ei=this}Jr.$metadata$={kind:c,simpleName:"AbstractSet",interfaces:[H,qr]},ti.prototype.hasNext=function(){return!1},ti.prototype.hasPrevious=function(){return!1},ti.prototype.nextIndex=function(){return 0},ti.prototype.previousIndex=function(){return-1},ti.prototype.next=function(){throw Me()},ti.prototype.previous=function(){throw Me()},ti.$metadata$={kind:_,simpleName:"EmptyIterator",interfaces:[tt]};var ei=null;function ni(){return null===ei&&new ti,ei}function ri(){ii=this,this.serialVersionUID_0=O}ri.prototype.equals=function(e){return t.isType(e,W)&&e.isEmpty()},ri.prototype.hashCode=function(){return 1},ri.prototype.toString=function(){return"[]"},Object.defineProperty(ri.prototype,"size",{configurable:!0,get:function(){return 0}}),ri.prototype.isEmpty=function(){return!0},ri.prototype.contains_11rb$=function(t){return!1},ri.prototype.containsAll_brywnq$=function(t){return t.isEmpty()},ri.prototype.get_za3lpa$=function(t){throw new Ce("Empty list doesn't contain element at index "+t+".")},ri.prototype.indexOf_11rb$=function(t){return-1},ri.prototype.lastIndexOf_11rb$=function(t){return-1},ri.prototype.iterator=function(){return ni()},ri.prototype.listIterator=function(){return ni()},ri.prototype.listIterator_za3lpa$=function(t){if(0!==t)throw new Ce("Index: "+t);return ni()},ri.prototype.subList_vux9f0$=function(t,e){if(0===t&&0===e)return this;throw new Ce("fromIndex: "+t+", toIndex: "+e)},ri.prototype.readResolve_0=function(){return oi()},ri.$metadata$={kind:_,simpleName:"EmptyList",interfaces:[Cn,Sn,W]};var ii=null;function oi(){return null===ii&&new ri,ii}function si(t,e){this.values=t,this.isVarargs=e}function ai(){return oi()}function ui(t){return 0===t.length?Qe():tn(new si(t,!0))}function pi(t){return t.size-1|0}function ci(t){switch(t.size){case 0:return ai();case 1:return ze(t.get_za3lpa$(0));default:return t}}function li(){}function hi(){}function fi(t,e){this.map_a09uzx$_0=t,this.default_0=e}function yi(t,e){return di(t,e,!0)}function di(t,e,n){for(var r={v:!1},i=t.iterator();i.hasNext();)e(i.next())===n&&(i.remove(),r.v=!0);return r.v}function _i(e,n){return function(e,n,r){var i,o,s,a;if(!t.isType(e,Cn))return di(t.isType(i=e,D)?i:Mn(),n,r);var u=0;o=pi(e);for(var p=0;p<=o;p++){var c=e.get_za3lpa$(p);n(c)!==r&&(u!==p&&e.set_wxm5ur$(u,c),u=u+1|0)}if(u=a;l--)e.removeAt_za3lpa$(l);return!0}return!1}(e,n,!0)}function mi(){}function $i(){bi()}function gi(){vi=this}Object.defineProperty(si.prototype,"size",{configurable:!0,get:function(){return this.values.length}}),si.prototype.isEmpty=function(){return 0===this.values.length},si.prototype.contains_11rb$=function(t){return I(this.values,t)},si.prototype.containsAll_brywnq$=function(e){var n;t:do{var r;if(t.isType(e,U)&&e.isEmpty()){n=!0;break t}for(r=e.iterator();r.hasNext();){var i=r.next();if(!this.contains_11rb$(i)){n=!1;break t}}n=!0}while(0);return n},si.prototype.iterator=function(){return t.arrayIterator(this.values)},si.prototype.toArray=function(){var t=this.values;return this.isVarargs?t:t.slice()},si.$metadata$={kind:c,simpleName:"ArrayAsCollection",interfaces:[U]},mi.$metadata$={kind:d,simpleName:"Continuation",interfaces:[]},e("kotlin.kotlin.coroutines.suspendCoroutine_922awp$",r((function(){var e=p.kotlin.coroutines.intrinsics.intercepted_f9mg25$,n=p.kotlin.coroutines.SafeContinuation_init_wj8d80$;return function(r,i){var o;return t.suspendCall((o=r,function(t){var r=n(e(t));return o(r),r.getOrThrow()})(t.coroutineReceiver())),t.coroutineResult(t.coroutineReceiver())}}))),gi.$metadata$={kind:_,simpleName:"Key",interfaces:[ki]};var vi=null;function bi(){return null===vi&&new gi,vi}function xi(){}function wi(t,e){var n=t.minusKey_yeqjby$(e.key);if(n===Ei())return e;var r=n.get_j3r2sn$(bi());if(null==r)return new Li(n,e);var i=n.minusKey_yeqjby$(bi());return i===Ei()?new Li(e,r):new Li(new Li(i,e),r)}function ki(){}function Ci(){}function Ni(t){this.key_no4tas$_0=t}function Oi(){Ii=this,this.serialVersionUID_0=a}xi.prototype.plus_1fupul$=function(t){return t===Ei()?this:t.fold_3cc69b$(this,wi)},ki.$metadata$={kind:d,simpleName:"Key",interfaces:[]},Ci.prototype.get_j3r2sn$=function(e){return i(this.key,e)?t.isType(this,Ci)?this:Mn():null},Ci.prototype.fold_3cc69b$=function(t,e){return e(t,this)},Ci.prototype.minusKey_yeqjby$=function(t){return i(this.key,t)?Ei():this},Ci.$metadata$={kind:d,simpleName:"Element",interfaces:[xi]},xi.$metadata$={kind:d,simpleName:"CoroutineContext",interfaces:[]},Oi.prototype.readResolve_0=function(){return Ei()},Oi.prototype.get_j3r2sn$=function(t){return null},Oi.prototype.fold_3cc69b$=function(t,e){return t},Oi.prototype.plus_1fupul$=function(t){return t},Oi.prototype.minusKey_yeqjby$=function(t){return this},Oi.prototype.hashCode=function(){return 0},Oi.prototype.toString=function(){return"EmptyCoroutineContext"},Oi.$metadata$={kind:_,simpleName:"EmptyCoroutineContext",interfaces:[Sn,xi]};var Ii=null;function Ei(){return null===Ii&&new Oi,Ii}function Li(t,e){this.left_0=t,this.element_0=e}function Ai(t,e){return 0===t.length?e.toString():t+", "+e}function Mi(t){null===qi&&new ji,this.elements=t}function ji(){qi=this,this.serialVersionUID_0=a}Li.prototype.get_j3r2sn$=function(e){for(var n,r=this;;){if(null!=(n=r.element_0.get_j3r2sn$(e)))return n;var i=r.left_0;if(!t.isType(i,Li))return i.get_j3r2sn$(e);r=i}},Li.prototype.fold_3cc69b$=function(t,e){return e(this.left_0.fold_3cc69b$(t,e),this.element_0)},Li.prototype.minusKey_yeqjby$=function(t){if(null!=this.element_0.get_j3r2sn$(t))return this.left_0;var e=this.left_0.minusKey_yeqjby$(t);return e===this.left_0?this:e===Ei()?this.element_0:new Li(e,this.element_0)},Li.prototype.size_0=function(){for(var e,n,r=this,i=2;;){if(null==(n=t.isType(e=r.left_0,Li)?e:null))return i;r=n,i=i+1|0}},Li.prototype.contains_0=function(t){return i(this.get_j3r2sn$(t.key),t)},Li.prototype.containsAll_0=function(e){for(var n,r=e;;){if(!this.contains_0(r.element_0))return!1;var i=r.left_0;if(!t.isType(i,Li))return this.contains_0(t.isType(n=i,Ci)?n:Mn());r=i}},Li.prototype.equals=function(e){return this===e||t.isType(e,Li)&&e.size_0()===this.size_0()&&e.containsAll_0(this)},Li.prototype.hashCode=function(){return C(this.left_0)+C(this.element_0)|0},Li.prototype.toString=function(){return"["+this.fold_3cc69b$("",Ai)+"]"},Li.prototype.writeReplace_0=function(){var e,n,r,i=this.size_0(),o=t.newArray(i,null),s={v:0};if(this.fold_3cc69b$(Bt(),(n=o,r=s,function(t,e){var i;return n[(i=r.v,r.v=i+1|0,i)]=e,zt})),s.v!==i)throw ke("Check failed.".toString());return new Mi(t.isArray(e=o)?e:Mn())},ji.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var Si,Pi,Ti,qi=null;function zi(){return Di()}function Ri(t,e){$.call(this),this.name$=t,this.ordinal$=e}function Bi(){Bi=function(){},Si=new Ri("COROUTINE_SUSPENDED",0),Pi=new Ri("UNDECIDED",1),Ti=new Ri("RESUMED",2)}function Di(){return Bi(),Si}function Ui(){return Bi(),Pi}function Ki(){return Bi(),Ti}function Wi(t,e){this.start_p1gsmm$_0=t,this.endInclusive_jj4lf7$_0=e}function Fi(){}function Hi(e,n,r){null!=r?e.append_gw00v9$(r(n)):null==n||t.isCharSequence(n)?e.append_gw00v9$(n):t.isChar(n)?e.append_s8itvh$(s(n)):e.append_gw00v9$(y(n))}function Vi(t){return t.length-1|0}function Gi(t){Xi(),this.value=t}function Zi(){Ji=this}Mi.prototype.readResolve_0=function(){var t,e=this.elements,n=Ei();for(t=0;t!==e.length;++t){var r=e[t];n=n.plus_1fupul$(r)}return n},Mi.$metadata$={kind:c,simpleName:"Serialized",interfaces:[Sn]},Li.$metadata$={kind:c,simpleName:"CombinedContext",interfaces:[Sn,xi]},e("kotlin.kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn_zb0pmy$",r((function(){var t=p.kotlin.NotImplementedError;return function(e,n){throw new t("Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic")}}))),Ri.$metadata$={kind:c,simpleName:"CoroutineSingletons",interfaces:[$]},Ri.values=function(){return[Di(),Ui(),Ki()]},Ri.valueOf_61zpoe$=function(t){switch(t){case"COROUTINE_SUSPENDED":return Di();case"UNDECIDED":return Ui();case"RESUMED":return Ki();default:jn("No enum constant kotlin.coroutines.intrinsics.CoroutineSingletons."+t)}},Fi.$metadata$={kind:d,simpleName:"KClassifier",interfaces:[]},Object.defineProperty(Gi.prototype,"isSuccess",{configurable:!0,get:function(){return!t.isType(this.value,Yi)}}),Object.defineProperty(Gi.prototype,"isFailure",{configurable:!0,get:function(){return t.isType(this.value,Yi)}}),Gi.prototype.getOrNull=e("kotlin.kotlin.Result.getOrNull",r((function(){var e=Object,n=t.throwCCE;return function(){var r;return this.isFailure?null:null==(r=this.value)||t.isType(r,e)?r:n()}}))),Gi.prototype.exceptionOrNull=function(){return t.isType(this.value,Yi)?this.value.exception:null},Gi.prototype.toString=function(){return t.isType(this.value,Yi)?this.value.toString():"Success("+y(this.value)+")"},Zi.prototype.success_mh5how$=e("kotlin.kotlin.Result.Companion.success_mh5how$",r((function(){var t=p.kotlin.Result;return function(e){return new t(e)}}))),Zi.prototype.failure_lsqlk3$=e("kotlin.kotlin.Result.Companion.failure_lsqlk3$",r((function(){var t=p.kotlin.createFailure_tcv7n7$,e=p.kotlin.Result;return function(n){return new e(t(n))}}))),Zi.$metadata$={kind:_,simpleName:"Companion",interfaces:[]};var Ji=null;function Xi(){return null===Ji&&new Zi,Ji}function Yi(t){this.exception=t}function Qi(t){return new Yi(t)}function to(e){if(t.isType(e.value,Yi))throw e.value.exception}function eo(t){void 0===t&&(t="An operation is not implemented."),_e(t,this),this.name="NotImplementedError"}Yi.prototype.equals=function(e){return t.isType(e,Yi)&&i(this.exception,e.exception)},Yi.prototype.hashCode=function(){return C(this.exception)},Yi.prototype.toString=function(){return"Failure("+this.exception+")"},Yi.$metadata$={kind:c,simpleName:"Failure",interfaces:[Sn]},Gi.$metadata$={kind:c,simpleName:"Result",interfaces:[Sn]},Gi.prototype.unbox=function(){return this.value},Gi.prototype.hashCode=function(){var e=0;return e=31*e+t.hashCode(this.value)|0},Gi.prototype.equals=function(e){return this===e||null!==e&&"object"==typeof e&&Object.getPrototypeOf(this)===Object.getPrototypeOf(e)&&t.equals(this.value,e.value)},eo.$metadata$={kind:c,simpleName:"NotImplementedError",interfaces:[de]};var no=p.kotlin||(p.kotlin={}),ro=no.collections||(no.collections={});ro.contains_mjy6jw$=I,ro.get_lastIndex_m7z4lg$=M,ro.indexOf_mjy6jw$=E,ro.get_indices_m7z4lg$=A;var io=no.ranges||(no.ranges={});io.reversed_zf1xzc$=z,ro.lastIndexOf_mjy6jw$=L,no.IllegalArgumentException_init_pdl1vj$=xe,ro.emptyList_287e2$=ai,ro.ArrayList_init_287e2$=Qe,ro.LinkedHashMap_init_q3lmfv$=bn,ro.ArrayList_init_ww73n8$=function(t,e){return void 0===t&&(t=0),e=e||Object.create(Ye.prototype),Ye.call(e,[]),e},no.NoSuchElementException_init=Me,no.UnsupportedOperationException_init_pdl1vj$=Ie,ro.listOf_mh5how$=ze,ro.get_lastIndex_55thoc$=pi,ro.toList_7wnvza$=function(e){var n;if(t.isType(e,U)){switch(e.size){case 0:n=ai();break;case 1:n=ze(t.isType(e,W)?e.get_za3lpa$(0):e.iterator().next());break;default:n=P(e)}return n}return ci(S(e))},ro.toCollection_5cfyqp$=j,ro.toMutableList_7wnvza$=S,ro.toMutableList_4c7yge$=P,ro.toMutableSet_7wnvza$=function(e){return t.isType(e,U)?kn(e):j(e,wn())},ro.Collection=U,ro.joinTo_gcc71v$=T,ro.joinToString_fmv235$=q;var oo=no.text||(no.text={});oo.get_lastIndex_gw00vp$=Vi,oo.StringBuilder_init=Nr;var so=no.js||(no.js={});no.CharSequence=R,ro.Iterable=B,ro.MutableIterable=D,ro.MutableCollection=K,ro.List=W,ro.MutableList=F,ro.Set=H,ro.MutableSet=V,G.Entry=Z,ro.Map=G,J.MutableEntry=X,ro.MutableMap=J,ro.Iterator=Y,ro.MutableIterator=Q,ro.ListIterator=tt,ro.MutableListIterator=et,ro.ByteIterator=nt,ro.CharIterator=rt,ro.ShortIterator=it,ro.IntIterator=ot,ro.LongIterator=st,ro.FloatIterator=at,ro.DoubleIterator=ut,ro.BooleanIterator=pt,io.CharProgressionIterator=ct,io.IntProgressionIterator=lt,io.LongProgressionIterator=ht,Object.defineProperty(ft,"Companion",{get:_t}),io.CharProgression=ft,Object.defineProperty(mt,"Companion",{get:vt}),io.IntProgression=mt,Object.defineProperty(bt,"Companion",{get:kt}),io.LongProgression=bt,io.ClosedRange=Ct,Object.defineProperty(Nt,"Companion",{get:Et}),io.CharRange=Nt,Object.defineProperty(Lt,"Companion",{get:jt}),io.IntRange=Lt,Object.defineProperty(St,"Companion",{get:qt}),io.LongRange=St,Object.defineProperty(no,"Unit",{get:Bt});var ao=no.internal||(no.internal={});ao.getProgressionLastElement_qt1dr2$=Ft,ao.getProgressionLastElement_b9bd0d$=Ht,p.arrayIterator=function(t,e){if(null==e)return new Vt(t);switch(e){case"BooleanArray":return Zt(t);case"ByteArray":return Xt(t);case"ShortArray":return Qt(t);case"CharArray":return ee(t);case"IntArray":return re(t);case"LongArray":return pe(t);case"FloatArray":return oe(t);case"DoubleArray":return ae(t);default:throw ke("Unsupported type argument for arrayIterator: "+y(e))}},p.booleanArrayIterator=Zt,p.byteArrayIterator=Xt,p.shortArrayIterator=Qt,p.charArrayIterator=ee,p.intArrayIterator=re,p.floatArrayIterator=oe,p.doubleArrayIterator=ae,p.longArrayIterator=pe,p.captureStack=function(t,e){Error.captureStackTrace?Error.captureStackTrace(e):e.stack=(new Error).stack},p.BoxedChar=ce;var uo=no.coroutines||(no.coroutines={});uo.CoroutineImpl=le,Object.defineProperty(uo,"CompletedContinuation",{get:ye});var po=uo.intrinsics||(uo.intrinsics={});po.intercepted_f9mg25$=function(e){var n,r,i;return null!=(i=null!=(r=t.isType(n=e,le)?n:null)?r.intercepted():null)?i:e},no.Error_init_pdl1vj$=_e,no.Error=de,no.Exception_init_pdl1vj$=$e,no.Exception=me,no.RuntimeException_init_pdl1vj$=ve,no.RuntimeException=ge,no.IllegalArgumentException=be,no.IllegalStateException_init_pdl1vj$=ke,no.IllegalStateException=we,no.IndexOutOfBoundsException=Ce,no.UnsupportedOperationException_init=Oe,no.UnsupportedOperationException=Ne,no.NullPointerException=Ee,no.ClassCastException=Le,no.NoSuchElementException=Ae,ro.copyOfRange_5f8l3u$=je,no.Comparator=Se,ro.copyToArray=Pe,ro.copyToArrayImpl=Te,ro.copyToExistingArrayImpl=qe,ro.LinkedHashSet_init_287e2$=wn,ro.AbstractMutableCollection=Re,ro.AbstractMutableList=Be,We.SimpleEntry_init_trwmqg$=function(t,e){return e=e||Object.create(Fe.prototype),Fe.call(e,t.key,t.value),e},We.SimpleEntry=Fe,We.AbstractEntrySet=He,ro.AbstractMutableMap=We,ro.AbstractMutableSet=Xe,ro.ArrayList_init_mqih57$=tn,ro.ArrayList=Ye,Object.defineProperty(en,"HashCode",{get:sn}),ro.EqualityComparator=en,ro.HashMap_init_va96d4$=pn,ro.HashMap_init_q3lmfv$=cn,ro.HashMap=an,ro.HashSet_init_nn01ho$=hn,ro.HashSet=ln,ro.InternalHashCodeMap=fn,ro.InternalMap=dn,ro.InternalStringMap=_n,ro.LinkedHashMap=mn,ro.LinkedHashSet_init_mqih57$=kn,ro.LinkedHashSet=xn,ro.RandomAccess=Cn;var co=no.io||(no.io={});co.BaseOutput=Nn,co.NodeJsOutput=On,co.BufferedOutput=In,co.BufferedOutputToConsoleLog=En,co.println_s8jyv4$=function(t){rn.println_s8jyv4$(t)},uo.SafeContinuation_init_wj8d80$=function(t,e){return e=e||Object.create(Ln.prototype),Ln.call(e,t,Ui()),e},uo.SafeContinuation=Ln,p.throwNPE=function(t){throw new Ee(t)},p.throwCCE=Mn,p.throwISE=jn,co.Serializable=Sn;var lo=no.reflect||(no.reflect={});so.get_js_1yb8b7$=function(e){var n;return(t.isType(n=e,qn)?n:Mn()).jClass},lo.KCallable=Pn,lo.KClass=Tn;var ho=lo.js||(lo.js={}),fo=ho.internal||(ho.internal={});fo.KClassImpl=qn,fo.SimpleKClassImpl=zn,fo.PrimitiveKClassImpl=Rn,Object.defineProperty(fo,"NothingKClassImpl",{get:Un}),fo.ErrorKClass=Kn,lo.KProperty=Wn,lo.KMutableProperty=Fn,lo.KProperty0=Hn,lo.KMutableProperty0=Vn,lo.KProperty1=Gn,lo.KMutableProperty1=Zn,Object.defineProperty(fo,"PrimitiveClasses",{get:gr}),p.getKClass=vr,p.getKClassM=br,p.getKClassFromExpression=function(e){var n;switch(typeof e){case"string":n=gr().stringClass;break;case"number":n=(0|e)===e?gr().intClass:gr().doubleClass;break;case"boolean":n=gr().booleanClass;break;case"function":n=gr().functionClass(e.length);break;default:if(t.isBooleanArray(e))n=gr().booleanArrayClass;else if(t.isCharArray(e))n=gr().charArrayClass;else if(t.isByteArray(e))n=gr().byteArrayClass;else if(t.isShortArray(e))n=gr().shortArrayClass;else if(t.isIntArray(e))n=gr().intArrayClass;else if(t.isLongArray(e))n=gr().longArrayClass;else if(t.isFloatArray(e))n=gr().floatArrayClass;else if(t.isDoubleArray(e))n=gr().doubleArrayClass;else if(t.isType(e,Tn))n=vr(Tn);else if(t.isArray(e))n=gr().arrayClass;else{var r=Object.getPrototypeOf(e).constructor;n=r===Object?gr().anyClass:r===Error?gr().throwableClass:xr(r)}}return n},p.getKClass1=xr,oo.Appendable=wr,oo.CharacterCodingException=kr,oo.StringBuilder=Cr,oo.isHighSurrogate_myv2d0$=Or,oo.isLowSurrogate_myv2d0$=Ir,oo.concatToString_355ntz$=Er,oo.concatToString_wlitf7$=Lr,oo.decodeToString_964n91$=function(t){return Tr(t,0,t.length,!1)},oo.compareTo_7epoxm$=Ar,oo.decodeUtf8_bndkiu$=Tr,ro.AbstractCollection=qr,Object.defineProperty(zr,"Companion",{get:Dr}),ro.AbstractList=zr,Object.defineProperty(Ur,"Companion",{get:Zr}),ro.AbstractMap=Ur,Object.defineProperty(Jr,"Companion",{get:Qr}),ro.AbstractSet=Jr,Object.defineProperty(ro,"EmptyIterator",{get:ni}),Object.defineProperty(ro,"EmptyList",{get:oi}),ro.arrayListOf_i5x0yv$=ui,ro.optimizeReadOnlyList_qzupvv$=ci,ro.removeAll_uhyeqt$=yi,ro.removeAll_qafx1e$=_i,uo.Continuation=mi,no.Result=Gi,po.get_COROUTINE_SUSPENDED=zi,Object.defineProperty($i,"Key",{get:bi}),uo.ContinuationInterceptor=$i,xi.Key=ki,xi.Element=Ci,uo.CoroutineContext=xi,uo.AbstractCoroutineContextElement=Ni,Object.defineProperty(uo,"EmptyCoroutineContext",{get:Ei}),uo.CombinedContext=Li,Object.defineProperty(po,"COROUTINE_SUSPENDED",{get:zi}),Object.defineProperty(Ri,"COROUTINE_SUSPENDED",{get:Di}),Object.defineProperty(Ri,"UNDECIDED",{get:Ui}),Object.defineProperty(Ri,"RESUMED",{get:Ki}),po.CoroutineSingletons=Ri,lo.KClassifier=Fi,oo.appendElement_k2zgzt$=Hi,no.createFailure_tcv7n7$=Qi,Object.defineProperty(Gi,"Companion",{get:Xi}),Gi.Failure=Yi,no.throwOnFailure_iacion$=to,no.NotImplementedError=eo,J.prototype.getOrDefault_xwzc9p$=G.prototype.getOrDefault_xwzc9p$,Ur.prototype.getOrDefault_xwzc9p$=G.prototype.getOrDefault_xwzc9p$,We.prototype.remove_xwzc9p$=J.prototype.remove_xwzc9p$,fn.prototype.createJsMap=dn.prototype.createJsMap,_n.prototype.createJsMap=dn.prototype.createJsMap,li.prototype.getOrDefault_xwzc9p$=G.prototype.getOrDefault_xwzc9p$,hi.prototype.remove_xwzc9p$=J.prototype.remove_xwzc9p$,hi.prototype.getOrDefault_xwzc9p$=J.prototype.getOrDefault_xwzc9p$,li.prototype.getOrDefault_xwzc9p$,fi.prototype.remove_xwzc9p$=hi.prototype.remove_xwzc9p$,fi.prototype.getOrDefault_xwzc9p$=hi.prototype.getOrDefault_xwzc9p$,G.prototype.getOrDefault_xwzc9p$,Ci.prototype.plus_1fupul$=xi.prototype.plus_1fupul$,$i.prototype.fold_3cc69b$=Ci.prototype.fold_3cc69b$,$i.prototype.plus_1fupul$=Ci.prototype.plus_1fupul$,Ni.prototype.get_j3r2sn$=Ci.prototype.get_j3r2sn$,Ni.prototype.fold_3cc69b$=Ci.prototype.fold_3cc69b$,Ni.prototype.minusKey_yeqjby$=Ci.prototype.minusKey_yeqjby$,Ni.prototype.plus_1fupul$=Ci.prototype.plus_1fupul$,Li.prototype.plus_1fupul$=xi.prototype.plus_1fupul$,Wi.prototype.contains_mef7kx$=Ct.prototype.contains_mef7kx$,Wi.prototype.isEmpty=Ct.prototype.isEmpty;var yo=void 0!==n&&n.versions&&!!n.versions.node;rn=yo?new On(n.stdout):new En,new An(Ei(),(function(e){var n;return to(e),null==(n=e.value)||t.isType(n,b)||x(),zt})),u.pow(2,-26),u.pow(2,-53),_r=t.newArray(0,null),new Se((function(t,e){return Ar(t,e,!0)})),new Int8Array([h(239),h(191),h(189)]),mr=65533,new Gi(zi())}()})?r.apply(e,i):r)||(t.exports=o)}).call(this,n(3))},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,p=[],c=!1,l=-1;function h(){c&&u&&(c=!1,u.length?p=u.concat(p):l=-1,p.length&&f())}function f(){if(!c){var t=a(h);c=!0;for(var e=p.length;e;){for(u=p,p=[];++l1)for(var n=1;n Javascript External Script + + - + - + +

Blue Falcon JS Example

+ +

Enter a bluetooth service uuid and press the scan button, for example: 000000ee-0000-1000-8000-00805f9b34fb

+
+ + +
+ + diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/BlueFalcon.kt b/library/src/jsMain/kotlin/dev/bluefalcon/BlueFalcon.kt index 8e39742..1f7cf16 100644 --- a/library/src/jsMain/kotlin/dev/bluefalcon/BlueFalcon.kt +++ b/library/src/jsMain/kotlin/dev/bluefalcon/BlueFalcon.kt @@ -1,5 +1,7 @@ package dev.bluefalcon +import dev.bluefalcon.external.Bluetooth +import dev.bluefalcon.external.BluetoothOptions import kotlinx.browser.window import org.w3c.dom.Navigator @@ -12,6 +14,7 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU actual var isScanning: Boolean = false private inline val Navigator.bluetooth: Bluetooth get() = asDynamic().bluetooth as Bluetooth + private var optionalServices: Array = emptyArray() @JsName("addDelegate") fun addDelegate(blueFalconDelegate: BlueFalconDelegate) { delegates.add(blueFalconDelegate) } @@ -24,8 +27,6 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU log("connect -> ${bluetoothPeripheral.device}:${bluetoothPeripheral.device.gatt} gatt connected? ${bluetoothPeripheral.device.gatt?.connected}") if(bluetoothPeripheral.device.gatt?.connected == true) { delegates.forEach { it.didConnect(bluetoothPeripheral) } - //need to check via https - bluetoothPeripheral.device.gatt.getPrimaryServices(null) } else { bluetoothPeripheral.device.gatt?.connect()?.then { gatt -> connect(bluetoothPeripheral, autoConnect) @@ -41,8 +42,14 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU actual fun stopScanning() {} @JsName("scan") + fun scan(optionalServices: Array) { + this.optionalServices = optionalServices + scan() + } + + @JsName("rescan") actual fun scan() { - window.navigator.bluetooth.requestDevice(BluetoothOptions(true)) + window.navigator.bluetooth.requestDevice(BluetoothOptions(false, arrayOf(BluetoothOptions.Filter.Services(optionalServices)), optionalServices)) .then { bluetoothDevice -> val device = BluetoothPeripheral(bluetoothDevice) delegates.forEach { @@ -51,43 +58,55 @@ actual class BlueFalcon actual constructor(context: ApplicationContext, serviceU } } - /*@JsName("readService") + @JsName("readService") fun readService( bluetoothPeripheral: BluetoothPeripheral, serviceUUID: String? ) { bluetoothPeripheral.device.gatt?.getPrimaryServices(serviceUUID)?.then { services -> - services.forEach { - log("Service: ${it.uuid}") + bluetoothPeripheral.deviceServices.addAll(services.map { BluetoothService(it) }) + delegates.forEach { + it.didDiscoverServices(bluetoothPeripheral) + } + bluetoothPeripheral.deviceServices.forEach { service -> + service.service.getCharacteristics(undefined).then { characteristics -> + service.deviceCharacteristics = characteristics.map { BluetoothCharacteristic(it) }.toMutableSet() + delegates.forEach { + it.didDiscoverCharacteristics(bluetoothPeripheral) + } + } } } - }*/ + } @JsName("readCharacteristic") actual fun readCharacteristic( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic ) { - TODO("not implemented") + bluetoothCharacteristic.characteristic.readValue().then { _ -> + delegates.forEach { + it.didCharacteristcValueChanged(bluetoothPeripheral, bluetoothCharacteristic) + } + } } - @JsName("writeCharacteristic") + actual fun writeCharacteristic( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic, value: String, writeType: Int? - ) { - TODO("not implemented") - } + ) {} + @JsName("writeCharacteristic") actual fun writeCharacteristic( bluetoothPeripheral: BluetoothPeripheral, bluetoothCharacteristic: BluetoothCharacteristic, value: ByteArray, writeType: Int? ){ - TODO("not implemented") + bluetoothCharacteristic.characteristic.writeValue(value) } @JsName("notifyCharacteristic") diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/Bluetooth.kt b/library/src/jsMain/kotlin/dev/bluefalcon/Bluetooth.kt deleted file mode 100644 index 94fe667..0000000 --- a/library/src/jsMain/kotlin/dev/bluefalcon/Bluetooth.kt +++ /dev/null @@ -1,13 +0,0 @@ -package dev.bluefalcon - -import kotlin.js.Promise - -external class Bluetooth { - val referringDevice: BluetoothDevice? - fun getDevices(): Promise> - fun requestDevice(options: BluetoothOptions?): Promise -} - -data class BluetoothOptions( - val acceptAllDevices: Boolean -) diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothCharacteristic.kt b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothCharacteristic.kt index f1fa282..48bd284 100644 --- a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothCharacteristic.kt +++ b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothCharacteristic.kt @@ -1,12 +1,21 @@ package dev.bluefalcon -actual class BluetoothCharacteristic { +import dev.bluefalcon.external.BluetoothRemoteGATTCharacteristic +import org.khronos.webgl.ArrayBuffer +import org.khronos.webgl.Int8Array + +actual class BluetoothCharacteristic(val characteristic: BluetoothRemoteGATTCharacteristic) { actual val name: String? - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + get() = characteristic.uuid actual val value: ByteArray? - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + get() = characteristic.value?.buffer.toByteArray() + //characteristic.value.toString().encodeToByteArray() actual val descriptors: List get() = TODO("not implemented") + + val stringValue get() = value?.decodeToString() } -actual class BluetoothCharacteristicDescriptor \ No newline at end of file +actual class BluetoothCharacteristicDescriptor + +fun ArrayBuffer?.toByteArray(): ByteArray? = this?.run { Int8Array(this).unsafeCast() } \ No newline at end of file diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothDevice.kt b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothDevice.kt deleted file mode 100644 index 3c885ae..0000000 --- a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothDevice.kt +++ /dev/null @@ -1,34 +0,0 @@ -package dev.bluefalcon - -import kotlin.js.Promise - -//https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice -data class BluetoothDevice( - val id: String, - val name: String?, - val gatt: BluetoothRemoteGATTServer? -) - -interface BluetoothRemoteGATTServer { - val device: BluetoothDevice - val connected: Boolean - fun connect(): Promise - fun disconnect() - @JsName("getPrimaryService") - fun getPrimaryService(bluetoothServiceUUID: String): Promise - @JsName("getPrimaryServices") - fun getPrimaryServices(bluetoothServiceUUID: String?): Promise> -} - -interface BluetoothRemoteGATTService { - val uuid: String - val isPrimary: Boolean - val device: BluetoothDevice - - fun getCharacteristic(bluetoothCharacteristicUUID: String): Promise - //Promise getCharacteristic(BluetoothCharacteristicUUID characteristic); - fun getCharacteristics(bluetoothCharacteristicUUID: String?): Promise> -// Promise> getCharacteristics(optional BluetoothCharacteristicUUID characteristic); -// Promise getIncludedService(BluetoothServiceUUID service); -// Promise> getIncludedServices(optional BluetoothServiceUUID service); -}; \ No newline at end of file diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothPeripheral.kt b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothPeripheral.kt index b7abff6..e5ffa85 100644 --- a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothPeripheral.kt +++ b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothPeripheral.kt @@ -1,13 +1,18 @@ package dev.bluefalcon +import dev.bluefalcon.external.BluetoothDevice + actual class BluetoothPeripheral(val device: BluetoothDevice) { actual val name: String? get() = device.name actual val services: List - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + get() = deviceServices.toList() actual val uuid: String get() = device.id actual var rssi: Float? get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. set(value) {} + + internal var deviceServices: MutableSet = mutableSetOf() + val serviceArray: Array get() = services.toTypedArray() } \ No newline at end of file diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothService.kt b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothService.kt index 9094839..6651db5 100644 --- a/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothService.kt +++ b/library/src/jsMain/kotlin/dev/bluefalcon/BluetoothService.kt @@ -1,8 +1,14 @@ package dev.bluefalcon -actual class BluetoothService { +import dev.bluefalcon.external.BluetoothRemoteGATTService + +actual class BluetoothService(val service: BluetoothRemoteGATTService) { actual val name: String? - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + get() = service.uuid actual val characteristics: List - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + get() = deviceCharacteristics.toList() + + internal var deviceCharacteristics: MutableSet = mutableSetOf() + + val characteristicArray: Array get() = characteristics.toTypedArray() } \ No newline at end of file diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/external/Bluetooth.kt b/library/src/jsMain/kotlin/dev/bluefalcon/external/Bluetooth.kt new file mode 100644 index 0000000..73cc2af --- /dev/null +++ b/library/src/jsMain/kotlin/dev/bluefalcon/external/Bluetooth.kt @@ -0,0 +1,10 @@ +package dev.bluefalcon.external + +import org.w3c.dom.events.EventTarget +import kotlin.js.Promise + +external class Bluetooth: EventTarget { + val referringDevice: BluetoothDevice? + fun getDevices(): Promise> + fun requestDevice(options: BluetoothOptions?): Promise +} diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothDevice.kt b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothDevice.kt new file mode 100644 index 0000000..f883ede --- /dev/null +++ b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothDevice.kt @@ -0,0 +1,17 @@ +package dev.bluefalcon.external + +import org.w3c.dom.events.EventTarget +import kotlin.js.Promise + +//https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice +abstract external class BluetoothDevice : EventTarget { + val id: String + val name: String? + val gatt: BluetoothRemoteGATTServer? + + fun watchAdvertisements(): Promise + fun unwatchAdvertisements(): Promise + val watchingAdvertisements: Boolean +} + + diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothOptions.kt b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothOptions.kt new file mode 100644 index 0000000..ffb0e3e --- /dev/null +++ b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothOptions.kt @@ -0,0 +1,51 @@ +package dev.bluefalcon.external + +data class BluetoothOptions( + val acceptAllDevices: Boolean, + val filters: Array? = null, + val optionalServices: Array = emptyArray() +) { + sealed class Filter { + + data class Name(val name: String) : Filter() + + data class NamePrefix(val namePrefix: String) : Filter() + + data class Services(val services: Array) : Filter() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class.js != other::class.js) return false + other as Services + if (!services.contentEquals(other.services)) return false + return true + } + + override fun hashCode(): Int { + return services.contentHashCode() + } + } + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class.js != other::class.js) return false + + other as BluetoothOptions + + if (acceptAllDevices != other.acceptAllDevices) return false + if (filters != null) { + if (other.filters == null) return false + if (!filters.contentEquals(other.filters)) return false + } else if (other.filters != null) return false + if (!optionalServices.contentEquals(other.optionalServices)) return false + + return true + } + + override fun hashCode(): Int { + var result = acceptAllDevices.hashCode() + result = 31 * result + (filters?.contentHashCode() ?: 0) + result = 31 * result + optionalServices.contentHashCode() + return result + } +} \ No newline at end of file diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTCharacteristic.kt b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTCharacteristic.kt new file mode 100644 index 0000000..6f541fe --- /dev/null +++ b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTCharacteristic.kt @@ -0,0 +1,21 @@ +package dev.bluefalcon.external + +import org.khronos.webgl.DataView +import org.w3c.dom.events.EventTarget +import kotlin.js.Promise + +abstract external class BluetoothRemoteGATTCharacteristic : EventTarget { + val uuid: String + val value: DataView? + +// fun getDescriptor(descriptor: BluetoothDescriptorUUID): Promise +// fun getDescriptors(): Promise> + + fun readValue(): Promise + fun writeValue(value: BufferSource): Promise + + fun startNotifications(): Promise + fun stopNotifications(): Promise +} + +internal typealias BufferSource = ByteArray \ No newline at end of file diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTServer.kt b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTServer.kt new file mode 100644 index 0000000..7258b85 --- /dev/null +++ b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTServer.kt @@ -0,0 +1,14 @@ +package dev.bluefalcon.external + +import kotlin.js.Promise + +external interface BluetoothRemoteGATTServer { + val device: BluetoothDevice + val connected: Boolean + fun connect(): Promise + fun disconnect() + @JsName("getPrimaryService") + fun getPrimaryService(bluetoothServiceUUID: String): Promise + @JsName("getPrimaryServices") + fun getPrimaryServices(bluetoothServiceUUID: String?): Promise> +} \ No newline at end of file diff --git a/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTService.kt b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTService.kt new file mode 100644 index 0000000..a9862e5 --- /dev/null +++ b/library/src/jsMain/kotlin/dev/bluefalcon/external/BluetoothRemoteGATTService.kt @@ -0,0 +1,17 @@ +package dev.bluefalcon.external + +import org.w3c.dom.events.EventTarget +import kotlin.js.Promise + +abstract external class BluetoothRemoteGATTService: EventTarget { + val uuid: String + val isPrimary: Boolean + val device: BluetoothDevice + + fun getCharacteristic(bluetoothCharacteristicUUID: String): Promise + //Promise getCharacteristic(BluetoothCharacteristicUUID characteristic); + fun getCharacteristics(bluetoothCharacteristicUUID: String?): Promise> +// Promise> getCharacteristics(optional BluetoothCharacteristicUUID characteristic); +// Promise getIncludedService(BluetoothServiceUUID service); +// Promise> getIncludedServices(optional BluetoothServiceUUID service); +} \ No newline at end of file From 6fb88c08fd41c20cca025d8f41b47ed58d85ea2c Mon Sep 17 00:00:00 2001 From: Andrew Reed Date: Sat, 20 Mar 2021 13:43:35 +0000 Subject: [PATCH 3/3] Added js support --- README.md | 28 +++++++++++++++++++++------- library/gradle.properties | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9f44d07..23d811f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ![Blue Falcon](bluefalcon.png) Blue-Falcon ![CI](https://github.com/Reedyuk/blue-falcon/workflows/CI/badge.svg) [![Kotlin](https://img.shields.io/badge/kotlin-1.4.31-blue.svg)](http://kotlinlang.org) ![badge][badge-android] ![badge][badge-native] ![badge][badge-mac] ![badge][badge-rpi] +# ![Blue Falcon](bluefalcon.png) Blue-Falcon ![CI](https://github.com/Reedyuk/blue-falcon/workflows/CI/badge.svg) [![Kotlin](https://img.shields.io/badge/kotlin-1.4.31-blue.svg)](http://kotlinlang.org) ![badge][badge-android] ![badge][badge-native] ![badge][badge-mac] ![badge][badge-rpi] ![badge][badge-js] -A Bluetooth "Cross Platform" Kotlin Multiplatform library for iOS, Android, MacOS and Raspberry Pi. +A Bluetooth "Cross Platform" Kotlin Multiplatform library for iOS, Android, MacOS, Raspberry Pi and Javascript. Bluetooth in general has the same functionality for all platforms, e.g. connect to device, fetch services, fetch characteristics. @@ -8,7 +8,7 @@ This library is the glue that brings those together so that mobile developers ca The idea is to have a common api for using bluetooth as the principle of bluetooth is the same but each platform ios and android has different apis which means you have to duplicate the logic for each platform. -What this library isn't? It is not a cross platform library, this is a multiplatform library. The difference? each platform is compiled down to the native code, so when you use the library in iOS, you are consuming an obj-c library and same principle for Android. +What this library isn't? It is not a cross platform library, this is a multiplatform library. The difference? each platform is compiled down to the native code, so when you use the library in iOS, you are consuming an obj-c library and same principle for Android and so on. ## Basic Usage @@ -28,13 +28,13 @@ blueFalcon.scan() #### Install ```kotlin -implementation 'dev.bluefalcon:blue-falcon-android:0.9.3' +implementation 'dev.bluefalcon:blue-falcon-android:0.9.4' ``` And if you are using the debug variant: ```kotlin -implementation 'dev.bluefalcon:blue-falcon-android-debug:0.9.3' +implementation 'dev.bluefalcon:blue-falcon-android-debug:0.9.4' ``` The Android sdk requires an Application context, we do this by passing in on the BlueFalcon constructor, in this example we are calling the code from an activity(this). @@ -57,15 +57,23 @@ try { The Raspberry Pi library is using Java. ```kotlin -implementation 'dev.bluefalcon:blue-falcon-rpi:0.9.3' +implementation 'dev.bluefalcon:blue-falcon-rpi:0.9.4' ``` +### Javascript + +#### Install + +Simply copy the compiled javascript file (blue-falcon.js) to your web directory. + +See the JS-Example for details on how to use. + ### Kotlin Multiplatform ### Install ```kotlin -implementation 'dev.bluefalcon:blue-falcon:0.9.3' +implementation 'dev.bluefalcon:blue-falcon:0.9.4' ``` Please look at the Kotlin Multiplatform example in the Examples folder. @@ -122,6 +130,10 @@ Open the root directory of the project in Android Studio and run the Android app This example can only be ran on a Raspberry pi, it will crash otherwise. +### Javascript + +Open the index.html file in a web browser. + ## Support For a **bug, feature request, or cool idea**, please [file a Github issue](https://github.com/Reedyuk/blue-falcon/issues/new). @@ -130,6 +142,8 @@ For a **bug, feature request, or cool idea**, please [file a Github issue](https Keep in mind that Blue-Falcon is maintained by volunteers. Please be patient if you don’t immediately get an answer to your question; we all have jobs, families, obligations, and lives beyond this project. +Many thanks to everyone so far who has contributed to the project, it really means alot. + [badge-android]: http://img.shields.io/badge/platform-android-brightgreen.svg?style=flat [badge-native]: http://img.shields.io/badge/platform-native-lightgrey.svg?style=flat diff --git a/library/gradle.properties b/library/gradle.properties index f314fc1..58611b0 100644 --- a/library/gradle.properties +++ b/library/gradle.properties @@ -12,7 +12,7 @@ org.gradle.configureondemand = false android.useAndroidX=true android.enableJetifier=true -version=0.9.3 +version=0.9.4 group=dev.bluefalcon libraryName=blue-falcon