@perspective-dev/client 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  var ce=Object.defineProperty;var ae=(n,e)=>{for(var t in e)ce(n,t,{get:e[t],enumerable:!0})};var z={};ae(z,{Client:()=>O,ProxySession:()=>B,Table:()=>L,View:()=>P,default:()=>F,init:()=>q,initSync:()=>he});var _,d=new Array(128).fill(void 0);d.push(void 0,null,!0,!1);function o(n){return d[n]}var y=0,j=null;function S(){return(j===null||j.byteLength===0)&&(j=new Uint8Array(_.memory.buffer)),j}var J=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},ue=function(n,e){return J.encodeInto(n,e)};function x(n,e,t){if(t===void 0){let b=J.encode(n),g=e(b.length,1)>>>0;return S().subarray(g,g+b.length).set(b),y=b.length,g}let r=n.length,s=e(r,1)>>>0,c=S(),u=0;for(;u<r;u++){let b=n.charCodeAt(u);if(b>127)break;c[s+u]=b}if(u!==r){u!==0&&(n=n.slice(u)),s=t(s,r,r=u+n.length*3,1)>>>0;let b=S().subarray(s+u,s+r),g=ue(n,b);u+=g.written,s=t(s,r,u,1)>>>0}return y=u,s}var A=null;function l(){return(A===null||A.buffer.detached===!0||A.buffer.detached===void 0&&A.buffer!==_.memory.buffer)&&(A=new DataView(_.memory.buffer)),A}var M=d.length;function i(n){M===d.length&&d.push(d.length+1);let e=M;return M=d[e],d[e]=n,e}function p(n,e){try{return n.apply(this,e)}catch(t){_.__wbindgen_export_2(i(t))}}var K=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&K.decode();function w(n,e){return n=n>>>0,K.decode(S().subarray(n,n+e))}function fe(n,e){return n=n>>>0,S().subarray(n/1,n/1+e)}function f(n){return n==null}function be(n){n<132||(d[n]=M,M=n)}function a(n){let e=o(n);return be(n),e}var U=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>{_.__wbindgen_export_4.get(n.dtor)(n.a,n.b)});function le(n,e,t,r){let s={a:n,b:e,cnt:1,dtor:t},c=(...u)=>{s.cnt++;let b=s.a;s.a=0;try{return r(b,s.b,...u)}finally{--s.cnt===0?(_.__wbindgen_export_4.get(s.dtor)(b,s.b),U.unregister(s)):s.a=b}};return c.original=s,U.register(c,s,s),c}function ge(n,e,t,r){let s={a:n,b:e,cnt:1,dtor:t},c=(...u)=>{s.cnt++;try{return r(s.a,s.b,...u)}finally{--s.cnt===0&&(_.__wbindgen_export_4.get(s.dtor)(s.a,s.b),s.a=0,U.unregister(s))}};return c.original=s,U.register(c,s,s),c}function C(n){let e=typeof n;if(e=="number"||e=="boolean"||n==null)return`${n}`;if(e=="string")return`"${n}"`;if(e=="symbol"){let s=n.description;return s==null?"Symbol":`Symbol(${s})`}if(e=="function"){let s=n.name;return typeof s=="string"&&s.length>0?`Function(${s})`:"Function"}if(Array.isArray(n)){let s=n.length,c="[";s>0&&(c+=C(n[0]));for(let u=1;u<s;u++)c+=", "+C(n[u]);return c+="]",c}let t=/\[object ([^\]]+)\]/.exec(toString.call(n)),r;if(t&&t.length>1)r=t[1];else return toString.call(n);if(r=="Object")try{return"Object("+JSON.stringify(n)+")"}catch{return"Object"}return n instanceof Error?`${n.name}: ${n.message}
2
- ${n.stack}`:r}function we(n,e){if(!(n instanceof e))throw new Error(`expected instance of ${e.name}`)}var I=128;function Q(n){if(I==1)throw new Error("out of js stack");return d[--I]=n,I}function q(){_.init()}function de(n,e){let t=_.__wbindgen_export_5(n,e);return a(t)}function pe(n,e,t){_.__wbindgen_export_6(n,e,i(t))}function ye(n,e,t,r){_.__wbindgen_export_7(n,e,i(t),i(r))}var N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>_.__wbg_client_free(n>>>0,1)),O=class n{static __wrap(e){e=e>>>0;let t=Object.create(n.prototype);return t.__wbg_ptr=e,N.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_client_free(e,0)}__getClassname(){let e,t;try{let c=_.__wbindgen_add_to_stack_pointer(-16);_.client___getClassname(c,this.__wbg_ptr);var r=l().getInt32(c+0,!0),s=l().getInt32(c+4,!0);return e=r,t=s,w(r,s)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_3(e,t,1)}}constructor(e,t){try{let u=_.__wbindgen_add_to_stack_pointer(-16);_.client_new(u,i(e),f(t)?0:i(t));var r=l().getInt32(u+0,!0),s=l().getInt32(u+4,!0),c=l().getInt32(u+8,!0);if(c)throw a(s);return this.__wbg_ptr=r>>>0,N.register(this,this.__wbg_ptr,this),this}finally{_.__wbindgen_add_to_stack_pointer(16)}}new_proxy_session(e){try{let t=_.client_new_proxy_session(this.__wbg_ptr,Q(e));return B.__wrap(t)}finally{d[I++]=void 0}}handle_response(e){let t=_.client_handle_response(this.__wbg_ptr,i(e));return a(t)}handle_error(e,t){let r=x(e,_.__wbindgen_export_0,_.__wbindgen_export_1),s=y,c=_.client_handle_error(this.__wbg_ptr,r,s,f(t)?0:i(t));return a(c)}on_error(e){let t=_.client_on_error(this.__wbg_ptr,i(e));return a(t)}table(e,t){let r=_.client_table(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}terminate(){try{let s=_.__wbindgen_add_to_stack_pointer(-16);_.client_terminate(s,this.__wbg_ptr);var e=l().getInt32(s+0,!0),t=l().getInt32(s+4,!0),r=l().getInt32(s+8,!0);if(r)throw a(t);return a(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}open_table(e){let t=x(e,_.__wbindgen_export_0,_.__wbindgen_export_1),r=y,s=_.client_open_table(this.__wbg_ptr,t,r);return a(s)}get_hosted_table_names(){let e=_.client_get_hosted_table_names(this.__wbg_ptr);return a(e)}on_hosted_tables_update(e){let t=_.client_on_hosted_tables_update(this.__wbg_ptr,i(e));return a(t)}remove_hosted_tables_update(e){let t=_.client_remove_hosted_tables_update(this.__wbg_ptr,e);return a(t)}system_info(){let e=_.client_system_info(this.__wbg_ptr);return a(e)}},T=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>_.__wbg_proxysession_free(n>>>0,1)),B=class n{static __wrap(e){e=e>>>0;let t=Object.create(n.prototype);return t.__wbg_ptr=e,T.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,T.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_proxysession_free(e,0)}constructor(e,t){try{we(e,O);let r=_.client_new_proxy_session(e.__wbg_ptr,Q(t));return this.__wbg_ptr=r>>>0,T.register(this,this.__wbg_ptr,this),this}finally{d[I++]=void 0}}handle_request(e){let t=_.proxysession_handle_request(this.__wbg_ptr,i(e));return a(t)}close(){let e=this.__destroy_into_raw(),t=_.proxysession_close(e);return a(t)}},G=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>_.__wbg_table_free(n>>>0,1)),L=class n{static __wrap(e){e=e>>>0;let t=Object.create(n.prototype);return t.__wbg_ptr=e,G.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,G.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_table_free(e,0)}__getClassname(){let e,t;try{let c=_.__wbindgen_add_to_stack_pointer(-16);_.table___getClassname(c,this.__wbg_ptr);var r=l().getInt32(c+0,!0),s=l().getInt32(c+4,!0);return e=r,t=s,w(r,s)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_3(e,t,1)}}get_index(){let e=_.table_get_index(this.__wbg_ptr);return a(e)}get_client(){let e=_.table_get_client(this.__wbg_ptr);return a(e)}get_name(){let e=_.table_get_name(this.__wbg_ptr);return a(e)}get_limit(){let e=_.table_get_limit(this.__wbg_ptr);return a(e)}clear(){let e=_.table_clear(this.__wbg_ptr);return a(e)}delete(e){let t=this.__destroy_into_raw(),r=_.table_delete(t,f(e)?0:i(e));return a(r)}size(){let e=_.table_size(this.__wbg_ptr);return a(e)}schema(){let e=_.table_schema(this.__wbg_ptr);return a(e)}columns(){let e=_.table_columns(this.__wbg_ptr);return a(e)}make_port(){let e=_.table_make_port(this.__wbg_ptr);return a(e)}on_delete(e){let t=_.table_on_delete(this.__wbg_ptr,i(e));return a(t)}remove_delete(e){let t=_.table_remove_delete(this.__wbg_ptr,e);return a(t)}remove(e,t){let r=_.table_remove(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}replace(e,t){let r=_.table_replace(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}update(e,t){let r=_.table_update(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}view(e){let t=_.table_view(this.__wbg_ptr,f(e)?0:i(e));return a(t)}validate_expressions(e){let t=_.table_validate_expressions(this.__wbg_ptr,i(e));return a(t)}},V=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>_.__wbg_view_free(n>>>0,1)),P=class n{static __wrap(e){e=e>>>0;let t=Object.create(n.prototype);return t.__wbg_ptr=e,V.register(t,t.__wbg_ptr,t),t}static __unwrap(e){return e instanceof n?e.__destroy_into_raw():0}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,V.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_view_free(e,0)}__get_model(){let e=_.view___get_model(this.__wbg_ptr);return n.__wrap(e)}column_paths(e){let t=_.view_column_paths(this.__wbg_ptr,f(e)?0:i(e));return a(t)}delete(){let e=this.__destroy_into_raw(),t=_.view_delete(e);return a(t)}dimensions(){let e=_.view_dimensions(this.__wbg_ptr);return a(e)}expression_schema(){let e=_.view_expression_schema(this.__wbg_ptr);return a(e)}get_config(){let e=_.view_get_config(this.__wbg_ptr);return a(e)}get_min_max(e){let t=x(e,_.__wbindgen_export_0,_.__wbindgen_export_1),r=y,s=_.view_get_min_max(this.__wbg_ptr,t,r);return a(s)}num_rows(){let e=_.view_num_rows(this.__wbg_ptr);return a(e)}schema(){let e=_.view_schema(this.__wbg_ptr);return a(e)}to_arrow(e){let t=_.view_to_arrow(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_columns_string(e){let t=_.view_to_columns_string(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_columns(e){let t=_.view_to_columns(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_json_string(e){let t=_.view_to_json_string(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_json(e){let t=_.view_to_json(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_ndjson(e){let t=_.view_to_ndjson(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_csv(e){let t=_.view_to_csv(this.__wbg_ptr,f(e)?0:i(e));return a(t)}on_update(e,t){let r=_.view_on_update(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}remove_update(e){let t=_.view_remove_update(this.__wbg_ptr,e);return a(t)}on_delete(e){let t=_.view_on_delete(this.__wbg_ptr,i(e));return a(t)}num_columns(){let e=_.view_num_columns(this.__wbg_ptr);return a(e)}remove_delete(e){let t=_.view_remove_delete(this.__wbg_ptr,e);return a(t)}collapse(e){let t=_.view_collapse(this.__wbg_ptr,e);return a(t)}expand(e){let t=_.view_expand(this.__wbg_ptr,e);return a(t)}set_depth(e){let t=_.view_set_depth(this.__wbg_ptr,e);return a(t)}};async function me(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function X(){let n={};return n.wbg={},n.wbg.__wbg_String_8f0eb39a4a4c2f66=function(e,t){let r=String(o(t)),s=x(r,_.__wbindgen_export_0,_.__wbindgen_export_1),c=y;l().setInt32(e+4,c,!0),l().setInt32(e+0,s,!0)},n.wbg.__wbg_at_7d852dd9f194d43e=function(e,t){let r=o(e).at(t);return i(r)},n.wbg.__wbg_buffer_09165b52af8c5237=function(e){let t=o(e).buffer;return i(t)},n.wbg.__wbg_buffer_609cc3eee51ed158=function(e){let t=o(e).buffer;return i(t)},n.wbg.__wbg_call_672a4d21634d4a24=function(){return p(function(e,t){let r=o(e).call(o(t));return i(r)},arguments)},n.wbg.__wbg_call_7cccdd69e0791ae2=function(){return p(function(e,t,r){let s=o(e).call(o(t),o(r));return i(s)},arguments)},n.wbg.__wbg_call_833bed5770ea2041=function(){return p(function(e,t,r,s){let c=o(e).call(o(t),o(r),o(s));return i(c)},arguments)},n.wbg.__wbg_client_new=function(e){let t=O.__wrap(e);return i(t)},n.wbg.__wbg_debug_3cb59063b29f58c1=function(e){console.debug(o(e))},n.wbg.__wbg_debug_e17b51583ca6a632=function(e,t,r,s){console.debug(o(e),o(t),o(r),o(s))},n.wbg.__wbg_done_769e5ede4b31c67b=function(e){return o(e).done},n.wbg.__wbg_entries_3265d4158b33e5dc=function(e){let t=Object.entries(o(e));return i(t)},n.wbg.__wbg_error_1004b8c64097413f=function(e,t){console.error(o(e),o(t))},n.wbg.__wbg_error_524f506f44df1645=function(e){console.error(o(e))},n.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,t){let r,s;try{r=e,s=t,console.error(w(e,t))}finally{_.__wbindgen_export_3(r,s,1)}},n.wbg.__wbg_error_80de38b3f7cc3c3c=function(e,t,r,s){console.error(o(e),o(t),o(r),o(s))},n.wbg.__wbg_from_2a5d3e218e67aa85=function(e){let t=Array.from(o(e));return i(t)},n.wbg.__wbg_getEntriesByName_2a5a14d4b09f36a4=function(e,t,r,s,c){let u=o(e).getEntriesByName(w(t,r),w(s,c));return i(u)},n.wbg.__wbg_getRandomValues_21a0191e74d0e1d3=function(){return p(function(e,t){globalThis.crypto.getRandomValues(fe(e,t))},arguments)},n.wbg.__wbg_get_67b2ba62fc30de12=function(){return p(function(e,t){let r=Reflect.get(o(e),o(t));return i(r)},arguments)},n.wbg.__wbg_get_74b8744f6a23f4fa=function(e,t,r){let s=o(e)[w(t,r)];return f(s)?0:i(s)},n.wbg.__wbg_get_b9b93047fe3cf45b=function(e,t){let r=o(e)[t>>>0];return i(r)},n.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(e,t){let r=o(e)[o(t)];return i(r)},n.wbg.__wbg_has_a5ea9117f258a0ec=function(){return p(function(e,t){return Reflect.has(o(e),o(t))},arguments)},n.wbg.__wbg_info_033d8b8a0838f1d3=function(e,t,r,s){console.info(o(e),o(t),o(r),o(s))},n.wbg.__wbg_info_3daf2e093e091b66=function(e){console.info(o(e))},n.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(e){let t;try{t=o(e)instanceof ArrayBuffer}catch{t=!1}return t},n.wbg.__wbg_instanceof_Array_6ac07133d621675a=function(e){let t;try{t=o(e)instanceof Array}catch{t=!1}return t},n.wbg.__wbg_instanceof_Error_4d54113b22d20306=function(e){let t;try{t=o(e)instanceof Error}catch{t=!1}return t},n.wbg.__wbg_instanceof_Map_f3469ce2244d2430=function(e){let t;try{t=o(e)instanceof Map}catch{t=!1}return t},n.wbg.__wbg_instanceof_Object_7f2dcef8f78644a4=function(e){let t;try{t=o(e)instanceof Object}catch{t=!1}return t},n.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(e){let t;try{t=o(e)instanceof Uint8Array}catch{t=!1}return t},n.wbg.__wbg_instanceof_Window_def73ea0955fc569=function(e){let t;try{t=o(e)instanceof Window}catch{t=!1}return t},n.wbg.__wbg_isArray_a1eab7e0d067391b=function(e){return Array.isArray(o(e))},n.wbg.__wbg_isSafeInteger_343e2beeeece1bb0=function(e){return Number.isSafeInteger(o(e))},n.wbg.__wbg_iterator_9a24c88df860dc65=function(){return i(Symbol.iterator)},n.wbg.__wbg_keys_5c77a08ddc2fb8a6=function(e){let t=Object.keys(o(e));return i(t)},n.wbg.__wbg_length_a446193dc22c12f8=function(e){return o(e).length},n.wbg.__wbg_length_e2d2a49132c1b256=function(e){return o(e).length},n.wbg.__wbg_mark_001da84b098c950f=function(){return p(function(e,t,r){o(e).mark(w(t,r))},arguments)},n.wbg.__wbg_measure_65e49f8bc0e203a8=function(){return p(function(e,t,r,s,c){o(e).measure(w(t,r),w(s,c))},arguments)},n.wbg.__wbg_message_97a2af9b89d693a3=function(e){let t=o(e).message;return i(t)},n.wbg.__wbg_new_23a2665fac83c611=function(e,t){try{var r={a:e,b:t},s=(u,b)=>{let g=r.a;r.a=0;try{return ye(g,r.b,u,b)}finally{r.a=g}};let c=new Promise(s);return i(c)}finally{r.a=r.b=0}},n.wbg.__wbg_new_405e22f390576ce2=function(){let e=new Object;return i(e)},n.wbg.__wbg_new_5e0be73521bc8c17=function(){return i(new Map)},n.wbg.__wbg_new_78feb108b6472713=function(){let e=new Array;return i(e)},n.wbg.__wbg_new_8a6f238a6ece86ea=function(){let e=new Error;return i(e)},n.wbg.__wbg_new_a12002a7f91c75be=function(e){let t=new Uint8Array(o(e));return i(t)},n.wbg.__wbg_new_c68d7209be747379=function(e,t){let r=new Error(w(e,t));return i(r)},n.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,t){let r=new Function(w(e,t));return i(r)},n.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,t,r){let s=new Uint8Array(o(e),t>>>0,r>>>0);return i(s)},n.wbg.__wbg_next_25feadfc0913fea9=function(e){let t=o(e).next;return i(t)},n.wbg.__wbg_next_6574e1a8a62d1055=function(){return p(function(e){let t=o(e).next();return i(t)},arguments)},n.wbg.__wbg_now_d18023d54d4e5500=function(e){return o(e).now()},n.wbg.__wbg_parse_def2e24ef1252aff=function(){return p(function(e,t){let r=JSON.parse(w(e,t));return i(r)},arguments)},n.wbg.__wbg_performance_c185c0cdc2766575=function(e){let t=o(e).performance;return f(t)?0:i(t)},n.wbg.__wbg_push_737cfc8c1432c2c6=function(e,t){return o(e).push(o(t))},n.wbg.__wbg_queueMicrotask_6808622725a52272=function(e){let t=o(e).queueMicrotask;return i(t)},n.wbg.__wbg_queueMicrotask_ef0e86b0263a71ee=function(e){queueMicrotask(o(e))},n.wbg.__wbg_reject_b3fcf99063186ff7=function(e){let t=Promise.reject(o(e));return i(t)},n.wbg.__wbg_resolve_4851785c9c5f573d=function(e){let t=Promise.resolve(o(e));return i(t)},n.wbg.__wbg_set_37837023f3d740e8=function(e,t,r){o(e)[t>>>0]=a(r)},n.wbg.__wbg_set_3f1d0b984ed272ed=function(e,t,r){o(e)[a(t)]=a(r)},n.wbg.__wbg_set_65595bdd868b3009=function(e,t,r){o(e).set(o(t),r>>>0)},n.wbg.__wbg_set_8fc6bf8a5b1071d1=function(e,t,r){let s=o(e).set(o(t),o(r));return i(s)},n.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,t){let r=o(t).stack,s=x(r,_.__wbindgen_export_0,_.__wbindgen_export_1),c=y;l().setInt32(e+4,c,!0),l().setInt32(e+0,s,!0)},n.wbg.__wbg_startTime_c051731d0a31602f=function(e){return o(e).startTime},n.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){let e=typeof global>"u"?null:global;return f(e)?0:i(e)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){let e=typeof globalThis>"u"?null:globalThis;return f(e)?0:i(e)},n.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){let e=typeof self>"u"?null:self;return f(e)?0:i(e)},n.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){let e=typeof window>"u"?null:window;return f(e)?0:i(e)},n.wbg.__wbg_stringify_f7ed6987935b4a24=function(){return p(function(e){let t=JSON.stringify(o(e));return i(t)},arguments)},n.wbg.__wbg_table_new=function(e){let t=L.__wrap(e);return i(t)},n.wbg.__wbg_then_44b73946d2fb3e7d=function(e,t){let r=o(e).then(o(t));return i(r)},n.wbg.__wbg_then_48b406749878a531=function(e,t,r){let s=o(e).then(o(t),o(r));return i(s)},n.wbg.__wbg_toString_5285597960676b7b=function(e){let t=o(e).toString();return i(t)},n.wbg.__wbg_trace_d12a9ac890a2cbb8=function(e,t,r,s){console.trace(o(e),o(t),o(r),o(s))},n.wbg.__wbg_trace_e758b839df8d34f1=function(e){console.trace(o(e))},n.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){let t=o(e).value;return i(t)},n.wbg.__wbg_values_fcb8ba8c0aad8b58=function(e){let t=Object.values(o(e));return i(t)},n.wbg.__wbg_view_new=function(e){let t=P.__wrap(e);return i(t)},n.wbg.__wbg_view_unwrap=function(e){return P.__unwrap(a(e))},n.wbg.__wbg_warn_4ca3906c248c47c4=function(e){console.warn(o(e))},n.wbg.__wbg_warn_aaf1f4664a035bd6=function(e,t,r,s){console.warn(o(e),o(t),o(r),o(s))},n.wbg.__wbindgen_as_number=function(e){return+o(e)},n.wbg.__wbindgen_bigint_from_i64=function(e){return i(e)},n.wbg.__wbindgen_bigint_from_u64=function(e){let t=BigInt.asUintN(64,e);return i(t)},n.wbg.__wbindgen_bigint_get_as_i64=function(e,t){let r=o(t),s=typeof r=="bigint"?r:void 0;l().setBigInt64(e+8,f(s)?BigInt(0):s,!0),l().setInt32(e+0,!f(s),!0)},n.wbg.__wbindgen_boolean_get=function(e){let t=o(e);return typeof t=="boolean"?t?1:0:2},n.wbg.__wbindgen_cb_drop=function(e){let t=a(e).original;return t.cnt--==1?(t.a=0,!0):!1},n.wbg.__wbindgen_closure_wrapper3224=function(e,t,r){let s=le(e,t,468,pe);return i(s)},n.wbg.__wbindgen_closure_wrapper367=function(e,t,r){let s=ge(e,t,7,de);return i(s)},n.wbg.__wbindgen_debug_string=function(e,t){let r=C(o(t)),s=x(r,_.__wbindgen_export_0,_.__wbindgen_export_1),c=y;l().setInt32(e+4,c,!0),l().setInt32(e+0,s,!0)},n.wbg.__wbindgen_error_new=function(e,t){let r=new Error(w(e,t));return i(r)},n.wbg.__wbindgen_in=function(e,t){return o(e)in o(t)},n.wbg.__wbindgen_is_bigint=function(e){return typeof o(e)=="bigint"},n.wbg.__wbindgen_is_function=function(e){return typeof o(e)=="function"},n.wbg.__wbindgen_is_object=function(e){let t=o(e);return typeof t=="object"&&t!==null},n.wbg.__wbindgen_is_string=function(e){return typeof o(e)=="string"},n.wbg.__wbindgen_is_undefined=function(e){return o(e)===void 0},n.wbg.__wbindgen_jsval_eq=function(e,t){return o(e)===o(t)},n.wbg.__wbindgen_jsval_loose_eq=function(e,t){return o(e)==o(t)},n.wbg.__wbindgen_memory=function(){let e=_.memory;return i(e)},n.wbg.__wbindgen_number_get=function(e,t){let r=o(t),s=typeof r=="number"?r:void 0;l().setFloat64(e+8,f(s)?0:s,!0),l().setInt32(e+0,!f(s),!0)},n.wbg.__wbindgen_number_new=function(e){return i(e)},n.wbg.__wbindgen_object_clone_ref=function(e){let t=o(e);return i(t)},n.wbg.__wbindgen_object_drop_ref=function(e){a(e)},n.wbg.__wbindgen_string_get=function(e,t){let r=o(t),s=typeof r=="string"?r:void 0;var c=f(s)?0:x(s,_.__wbindgen_export_0,_.__wbindgen_export_1),u=y;l().setInt32(e+4,u,!0),l().setInt32(e+0,c,!0)},n.wbg.__wbindgen_string_new=function(e,t){let r=w(e,t);return i(r)},n.wbg.__wbindgen_throw=function(e,t){throw new Error(w(e,t))},n}function Y(n,e){return _=n.exports,Z.__wbindgen_wasm_module=e,A=null,j=null,_}function he(n){if(_!==void 0)return _;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module:n}=n:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=X();n instanceof WebAssembly.Module||(n=new WebAssembly.Module(n));let t=new WebAssembly.Instance(n,e);return Y(t,n)}async function Z(n){if(_!==void 0)return _;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead"));let e=X();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));let{instance:t,module:r}=await me(await n,e);return Y(t,r)}var F=Z;function ve(){let n,e,t=new Promise((r,s)=>{n=r,e=s});return[n,t,e]}async function ee(n,e,t,r){let s,c;async function u(){if(c?.readyState===n.CONNECTING||c?.readyState===n.OPEN){console.warn(`Already connected ${c.readyState}`);return}let[W,m,$]=ve();c=new n(t,r),c.onopen=W,c.binaryType="arraybuffer",c.onerror=k=>{let E=k.message||"Generic Websocket Error";s.handle_error(E,u),$(E)},c.onclose=k=>{let E=`WebSocket closed ${k.code}`;s.handle_error(E,u),$(E)},c.onmessage=k=>{s.handle_response(k.data)},await m}async function b(W){if(c.readyState===n.CLOSING||c.readyState===n.CLOSED){let m=`WebSocket transport error (${c.readyState})`;throw s.handle_error(m,u),new Error(m)}else if(c.readyState===n.CONNECTING){let m=`WebSocket message dropped (${c.readyState})`;throw new Error(m)}else{let m=W.slice().buffer;c.send(m)}}async function g(){console.debug("Closing WebSocket"),c.close()}return s=new e(b,g),await u(),s}function xe(){let n,e,t=new Promise((r,s)=>{n=r,e=s});return[n,t,e]}async function We(n,e){let[t,r]=xe();n.addEventListener("message",function s(c){n.removeEventListener("message",s),t(null)}),n.onmessage=function(c){n.onmessage=function(){},t(null)},n.onmessageerror=console.error,n.postMessage({cmd:"init",args:[e]},{transfer:e instanceof WebAssembly.Module?[]:[e]}),await r}async function te(n,e,t){let[r,s]=await Promise.all([e,t]),{Client:c}=await n,u;if(typeof SharedWorker<"u"&&s instanceof SharedWorker)u=s.port;else{s=s;let g=new MessageChannel;s.postMessage(null,[g.port2]),u=g.port1}let b=new c(async g=>{let W=g.slice().buffer;u.postMessage(W,{transfer:[W]})},async()=>{console.debug("Closing WebWorker"),u.close(),s instanceof Worker&&s.terminate()});return await We(u,r),u.addEventListener("message",g=>{b.handle_response(g.data)}),b}async function ne(n,e){let{Client:t}=await n;return await ee(WebSocket,t,e)}async function re(n){let e;typeof n?.then=="function"&&(n=await n),n instanceof Response?e=await WebAssembly.instantiateStreaming(n):typeof n=="string"?e=await WebAssembly.instantiateStreaming(fetch(n)):n instanceof ArrayBuffer?e=await WebAssembly.instantiate(n):n instanceof Uint8Array?e=await WebAssembly.instantiate(n.buffer):e=n;let t=e.instance.exports,[r]=WebAssembly.Module.customSections(e.module,"psp-runtime"),[s]=WebAssembly.Module.customSections(e.module,"psp-len"),c=new DataView(s).getUint32(0,!0),u=t.resize(r.byteLength);new Uint8Array(t.memory.buffer).set(new Uint8Array(r),u);let b=t.compile(r.byteLength,c);return new Uint8Array(t.memory.buffer).slice(b,c+b)}if(typeof WebAssembly>"u")throw new Error("WebAssembly not supported.");async function D(n){n instanceof Function&&(n=await n());try{return await re(n)}catch{return console.warn("Stage 0 wasm loading failed, skipping"),new Uint8Array(n)}}var H='"use strict";(()=>{var I=Object.defineProperty;var S=(s,t,r)=>t in s?I(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var f=(s,t,r)=>S(s,typeof t!="symbol"?t+"":t,r);var v=class{constructor(t){f(this,"poll_handle");f(this,"server");this.server=t}set_poll_handle(){return this.poll_handle=new Promise((t,r)=>setTimeout(()=>this.server.poll().then(t).catch(r).finally(()=>{this.poll_handle=void 0}))),this.poll_handle}async on_poll_request(){this.poll_handle?await this.poll_handle.then(()=>{if(!this.poll_handle)return this.set_poll_handle()}):await this.set_poll_handle()}},h=class{constructor(t,r){f(this,"clients");f(this,"server");f(this,"module");f(this,"on_poll_request");this.clients=new Map,this.module=t,this.on_poll_request=r?.on_poll_request,this.server=t._psp_new_server(r?.on_poll_request?1:0)}make_session(t){let r=this.module._psp_new_session(this.server);return this.clients.set(r,t),new P(this.module,this.server,r,this.clients,this.on_poll_request&&(()=>this.on_poll_request(this)))}async poll(){let t=this.module._psp_poll(this.server);await A(this.module,t,async r=>{await this.clients.get(r.client_id)(r.data)})}delete(){this.module._psp_delete_server(this.server)}},P=class{constructor(t,r,i,a,l){this.mod=t;this.server=r;this.client_id=i;this.client_map=a;this.on_poll_request=l}async handle_request(t){let r=await H(this.mod,t,async i=>this.mod._psp_handle_request(this.server,this.client_id,i,this.mod._psp_is_memory64()?BigInt(t.byteLength):t.byteLength));await A(this.mod,r,async i=>{await this.client_map.get(i.client_id)(i.data)}),this.on_poll_request?await this.on_poll_request():await this.poll()}async poll(){let t=this.mod._psp_poll(this.server);await A(this.mod,t,async r=>{r.client_id===0?await this.client_map.get(this.client_id)(r.data):await this.client_map.get(r.client_id)(r.data)})}close(){this.mod._psp_close_session(this.server,this.client_id)}};async function H(s,t,r){let i=s._psp_alloc(s._psp_is_memory64()?BigInt(t.byteLength):t.byteLength);s.HEAPU8.set(t,Number(i));let a=await r(i);return s._psp_free(i),a}async function A(s,t,r){let i=s._psp_is_memory64(),a=new DataView(s.HEAPU8.buffer,Number(t),i?12:8),l=a.getUint32(0,!0),u=i?a.getBigInt64(4,!0):a.getUint32(4,!0),e=new DataView(s.HEAPU8.buffer,Number(u),l*(i?16:12));try{for(let n=0;n<l;n++){let[o,p,y]=i?[e.getBigInt64(n*16,!0),e.getInt32(n*16+8,!0),e.getInt32(n*16+12,!0)]:[e.getInt32(n*12,!0),e.getInt32(n*12+4,!0),e.getInt32(n*12+8,!0)],c=new Uint8Array(s.HEAPU8.buffer,Number(o),p);await r({client_id:y,data:c})}}finally{for(let n=0;n<l;n++){let o=i?e.getBigInt64(n*16,!0):e.getInt32(n*12,!0);s._psp_free(o)}s._psp_free(i?BigInt(e.byteOffset):e.byteOffset),s._psp_free(i?BigInt(a.byteOffset):a.byteOffset)}}var q=console.log.bind(console),L=console.error.bind(console),N=new TextDecoder("utf8"),R=[null,[],[]];function j(s,t=0,r=NaN){for(var i=t+r,a=t;s[a]&&!(a>=i);)++a;return N.decode(s instanceof Uint8Array?s.subarray(t,a):new Uint8Array(s.slice(t,a)))}function E(s,t){var r=R[s];t===0||t===10?((s===1?q:L)(j(r,0)),r.length=0):r.push(t)}async function U(s){let t,r=!1,i,a={HaveOffsetConverter(){console.error("HaveOffsetConverter")},__syscall_ftruncate64(...e){console.error("__syscall_frtuncate64",e)},__syscall_getdents64(...e){console.error("__syscall_frtuncate64",e)},__syscall_unlinkat(...e){console.error("__syscall_frtuncate64",e)},__throw_exception_with_stack_trace(e){let n=new WebAssembly.Exception(t.__cpp_exception,[e],{traceStack:!0});throw n.message="Unexpected internal error",n},clock_time_get(e,n,o){if(r){if(o=o,o=Number(o),!(e==0||e==1||e==2||e==3))return 28;var p;e===0?p=Date.now():p=performance.now();let c=Math.round(p*1e3*1e3),_=new BigInt64Array(i.buffer);return _[o/8]=BigInt(c),0}else{if(o=o,o>>>=0,!(e==0||e==1||e==2||e==3))return 28;var p;e===0?p=Date.now():p=performance.now();var y=Math.round(p*1e6);let _=new BigInt64Array(i.buffer);return _[o>>>3]=BigInt(y),0}},emscripten_asm_const_int(...e){return 0},emscripten_notify_memory_growth(e){r?e=Number(e):(e=e,e>>>=0),e!=0&&console.error("abort")},environ_get(...e){return 0},environ_sizes_get(...e){return 0},fd_close(...e){return console.error("fd_close",e),0},fd_read(...e){return console.error("fd_read",e),0},fd_seek(...e){return console.error("fs_seek",e),0},fd_write(e,n,o,p){let y=new Uint8Array(i.buffer);if(r){n=Number(n),o=Number(o),p=Number(p);let c=0,_=new BigUint64Array(i.buffer);for(let d=0;d<o;d++){let w=Number(_[n/8]),b=Number(_[(n+8)/8]);n+=16;for(let m=0;m<b;m++)E(e,y[w+m]);c+=b}return _[p/8]=BigInt(c),0}else{n=n,o=o,p=p,n>>>=0,o>>>=0,p>>>=0;let c=0,_=new Uint32Array(i.buffer);for(let d=0;d<o;d++){let w=_[n>>>2>>>0],b=_[n+4>>>2>>>0];n+=8;for(let m=0;m<b;m++)E(e,y[w+m>>>0]);c+=b}return _[p>>>2>>>0]=c,0}},proc_exit(e){return console.error("proc_exit",e),0}},l=await s.instantiateWasm({env:a,wasi_snapshot_preview1:a},e=>{t=e.exports,r=!!t.psp_is_memory64(),i=e.exports.memory,t._initialize()}),u={};for(let[e,n]of Object.entries(l))u[`_${e}`]=n;return{...l,...u,get HEAPU8(){return new Uint8Array(i.buffer)}}}async function M(s){let t=await U({locateFile(r){return r},instantiateWasm:async(r,i)=>{r.env={...r.env,psp_stack_trace(){let l=Error().stack||"",e=new TextEncoder().encode(l),n=t._psp_alloc(t._psp_is_memory64()?BigInt(e.byteLength+1):e.byteLength+1);return t.HEAPU8.set(e,Number(n)),t.HEAPU8[Number(n)+e.byteLength]=0,n},psp_heap_size(){return t._psp_is_memory64()?BigInt(t.HEAPU8.buffer.byteLength):t.HEAPU8.buffer.byteLength}};let a=await WebAssembly.instantiate(s,r);return i(a.instance),a.instance.exports}});return t}var g,x;function B(s){let t=s.ports[0],r;t.addEventListener("message",async i=>{if(i.data.cmd==="init"){let a=i.data.id;if(!g){let l=await M(i.data.args[0]);g=new h(l,{on_poll_request:()=>x.on_poll_request()}),x=new v(g)}r=g.make_session(async l=>{let u=l.slice().buffer;t.postMessage(u,{transfer:[u]})}),t.postMessage({id:a})}else await r.handle_request(new Uint8Array(i.data))}),t.start()}self.addEventListener("connect",B);self.addEventListener("message",B);})();\n';function se(n,e){function t(c,u){c==="message"&&n.push(u)}function r(c){let u=n.indexOf(c);u>-1&&n.splice(u,1)}function s(c,u){for(let b of e)b({data:c,ports:u})}return{addEventListener:t,removeEventListener:r,postMessage:s,location:{href:""}}}function je(n){console.error("Running perspective in single-threaded mode");let e=Function("const self = arguments[0];"+n),t=[],r=[];return e(se(t,r)),se(r,t)}var Se=async function(){try{if(window.location.protocol.startsWith("file"))return console.warn("file:// protocol does not support Web Workers"),je(H);{let n=new Blob([H],{type:"application/javascript"}),e=URL.createObjectURL(n);return new Worker(e,{type:"module"})}}catch(n){console.error("Error instantiating engine",n)}},oe=Se;var h;function Me(n,e=!1){n instanceof Uint8Array?h=Promise.resolve(n.buffer):n instanceof Response?h=Promise.resolve(n):n instanceof Promise?h=n:h=Promise.resolve(n),e||(h=h.then(t=>D(t).then(r=>r.buffer)))}var v;async function R(n,e=!1){let t=e?n:await D(n);return await F({module_or_path:t}),await q(),z}function Ie(n,e=!1){n instanceof Uint8Array?v=R(n.buffer,e):n instanceof ArrayBuffer||n instanceof Response||n instanceof Promise?v=R(n,e):n instanceof Object&&(v=Promise.resolve(n))}function ie(){let n=customElements.get("perspective-viewer");if(n)v=Promise.resolve(n.__wasm_module__);else if(v===void 0)throw new Error("Missing perspective-client.wasm");return v}function Oe(){if(h===void 0)throw new Error("Missing perspective-server.wasm");return h.then(n=>n instanceof WebAssembly.Module?n:n.slice(0))}var _e;function Pe(){return _e===void 0?oe():_e()}async function Ue(n){return await ne(ie(),n)}async function Be(n){return typeof n>"u"&&(n=Pe()),await te(ie(),Oe(),n)}var He={websocket:Ue,worker:Be,init_client:Ie,init_server:Me};export{He as default,Ie as init_client,Me as init_server,Ue as websocket,Be as worker};
2
+ ${n.stack}`:r}function we(n,e){if(!(n instanceof e))throw new Error(`expected instance of ${e.name}`)}var I=128;function Q(n){if(I==1)throw new Error("out of js stack");return d[--I]=n,I}function q(){_.init()}function de(n,e){let t=_.__wbindgen_export_5(n,e);return a(t)}function pe(n,e,t){_.__wbindgen_export_6(n,e,i(t))}function ye(n,e,t,r){_.__wbindgen_export_7(n,e,i(t),i(r))}var N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>_.__wbg_client_free(n>>>0,1)),O=class n{static __wrap(e){e=e>>>0;let t=Object.create(n.prototype);return t.__wbg_ptr=e,N.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_client_free(e,0)}__getClassname(){let e,t;try{let c=_.__wbindgen_add_to_stack_pointer(-16);_.client___getClassname(c,this.__wbg_ptr);var r=l().getInt32(c+0,!0),s=l().getInt32(c+4,!0);return e=r,t=s,w(r,s)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_3(e,t,1)}}constructor(e,t){try{let u=_.__wbindgen_add_to_stack_pointer(-16);_.client_new(u,i(e),f(t)?0:i(t));var r=l().getInt32(u+0,!0),s=l().getInt32(u+4,!0),c=l().getInt32(u+8,!0);if(c)throw a(s);return this.__wbg_ptr=r>>>0,N.register(this,this.__wbg_ptr,this),this}finally{_.__wbindgen_add_to_stack_pointer(16)}}new_proxy_session(e){try{let t=_.client_new_proxy_session(this.__wbg_ptr,Q(e));return B.__wrap(t)}finally{d[I++]=void 0}}handle_response(e){let t=_.client_handle_response(this.__wbg_ptr,i(e));return a(t)}handle_error(e,t){let r=x(e,_.__wbindgen_export_0,_.__wbindgen_export_1),s=y,c=_.client_handle_error(this.__wbg_ptr,r,s,f(t)?0:i(t));return a(c)}on_error(e){let t=_.client_on_error(this.__wbg_ptr,i(e));return a(t)}table(e,t){let r=_.client_table(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}terminate(){try{let s=_.__wbindgen_add_to_stack_pointer(-16);_.client_terminate(s,this.__wbg_ptr);var e=l().getInt32(s+0,!0),t=l().getInt32(s+4,!0),r=l().getInt32(s+8,!0);if(r)throw a(t);return a(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}open_table(e){let t=x(e,_.__wbindgen_export_0,_.__wbindgen_export_1),r=y,s=_.client_open_table(this.__wbg_ptr,t,r);return a(s)}get_hosted_table_names(){let e=_.client_get_hosted_table_names(this.__wbg_ptr);return a(e)}on_hosted_tables_update(e){let t=_.client_on_hosted_tables_update(this.__wbg_ptr,i(e));return a(t)}remove_hosted_tables_update(e){let t=_.client_remove_hosted_tables_update(this.__wbg_ptr,e);return a(t)}system_info(){let e=_.client_system_info(this.__wbg_ptr);return a(e)}},T=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>_.__wbg_proxysession_free(n>>>0,1)),B=class n{static __wrap(e){e=e>>>0;let t=Object.create(n.prototype);return t.__wbg_ptr=e,T.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,T.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_proxysession_free(e,0)}constructor(e,t){try{we(e,O);let r=_.client_new_proxy_session(e.__wbg_ptr,Q(t));return this.__wbg_ptr=r>>>0,T.register(this,this.__wbg_ptr,this),this}finally{d[I++]=void 0}}handle_request(e){let t=_.proxysession_handle_request(this.__wbg_ptr,i(e));return a(t)}close(){let e=this.__destroy_into_raw(),t=_.proxysession_close(e);return a(t)}},G=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>_.__wbg_table_free(n>>>0,1)),L=class n{static __wrap(e){e=e>>>0;let t=Object.create(n.prototype);return t.__wbg_ptr=e,G.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,G.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_table_free(e,0)}__getClassname(){let e,t;try{let c=_.__wbindgen_add_to_stack_pointer(-16);_.table___getClassname(c,this.__wbg_ptr);var r=l().getInt32(c+0,!0),s=l().getInt32(c+4,!0);return e=r,t=s,w(r,s)}finally{_.__wbindgen_add_to_stack_pointer(16),_.__wbindgen_export_3(e,t,1)}}get_index(){let e=_.table_get_index(this.__wbg_ptr);return a(e)}get_client(){let e=_.table_get_client(this.__wbg_ptr);return a(e)}get_name(){let e=_.table_get_name(this.__wbg_ptr);return a(e)}get_limit(){let e=_.table_get_limit(this.__wbg_ptr);return a(e)}clear(){let e=_.table_clear(this.__wbg_ptr);return a(e)}delete(e){let t=this.__destroy_into_raw(),r=_.table_delete(t,f(e)?0:i(e));return a(r)}size(){let e=_.table_size(this.__wbg_ptr);return a(e)}schema(){let e=_.table_schema(this.__wbg_ptr);return a(e)}columns(){let e=_.table_columns(this.__wbg_ptr);return a(e)}make_port(){let e=_.table_make_port(this.__wbg_ptr);return a(e)}on_delete(e){let t=_.table_on_delete(this.__wbg_ptr,i(e));return a(t)}remove_delete(e){let t=_.table_remove_delete(this.__wbg_ptr,e);return a(t)}remove(e,t){let r=_.table_remove(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}replace(e,t){let r=_.table_replace(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}update(e,t){let r=_.table_update(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}view(e){let t=_.table_view(this.__wbg_ptr,f(e)?0:i(e));return a(t)}validate_expressions(e){let t=_.table_validate_expressions(this.__wbg_ptr,i(e));return a(t)}},V=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>_.__wbg_view_free(n>>>0,1)),P=class n{static __wrap(e){e=e>>>0;let t=Object.create(n.prototype);return t.__wbg_ptr=e,V.register(t,t.__wbg_ptr,t),t}static __unwrap(e){return e instanceof n?e.__destroy_into_raw():0}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,V.unregister(this),e}free(){let e=this.__destroy_into_raw();_.__wbg_view_free(e,0)}__get_model(){let e=_.view___get_model(this.__wbg_ptr);return n.__wrap(e)}column_paths(e){let t=_.view_column_paths(this.__wbg_ptr,f(e)?0:i(e));return a(t)}delete(){let e=this.__destroy_into_raw(),t=_.view_delete(e);return a(t)}dimensions(){let e=_.view_dimensions(this.__wbg_ptr);return a(e)}expression_schema(){let e=_.view_expression_schema(this.__wbg_ptr);return a(e)}get_config(){let e=_.view_get_config(this.__wbg_ptr);return a(e)}get_min_max(e){let t=x(e,_.__wbindgen_export_0,_.__wbindgen_export_1),r=y,s=_.view_get_min_max(this.__wbg_ptr,t,r);return a(s)}num_rows(){let e=_.view_num_rows(this.__wbg_ptr);return a(e)}schema(){let e=_.view_schema(this.__wbg_ptr);return a(e)}to_arrow(e){let t=_.view_to_arrow(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_columns_string(e){let t=_.view_to_columns_string(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_columns(e){let t=_.view_to_columns(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_json_string(e){let t=_.view_to_json_string(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_json(e){let t=_.view_to_json(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_ndjson(e){let t=_.view_to_ndjson(this.__wbg_ptr,f(e)?0:i(e));return a(t)}to_csv(e){let t=_.view_to_csv(this.__wbg_ptr,f(e)?0:i(e));return a(t)}on_update(e,t){let r=_.view_on_update(this.__wbg_ptr,i(e),f(t)?0:i(t));return a(r)}remove_update(e){let t=_.view_remove_update(this.__wbg_ptr,e);return a(t)}on_delete(e){let t=_.view_on_delete(this.__wbg_ptr,i(e));return a(t)}num_columns(){let e=_.view_num_columns(this.__wbg_ptr);return a(e)}remove_delete(e){let t=_.view_remove_delete(this.__wbg_ptr,e);return a(t)}collapse(e){let t=_.view_collapse(this.__wbg_ptr,e);return a(t)}expand(e){let t=_.view_expand(this.__wbg_ptr,e);return a(t)}set_depth(e){let t=_.view_set_depth(this.__wbg_ptr,e);return a(t)}};async function me(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(r){if(n.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let t=await n.arrayBuffer();return await WebAssembly.instantiate(t,e)}else{let t=await WebAssembly.instantiate(n,e);return t instanceof WebAssembly.Instance?{instance:t,module:n}:t}}function X(){let n={};return n.wbg={},n.wbg.__wbg_String_8f0eb39a4a4c2f66=function(e,t){let r=String(o(t)),s=x(r,_.__wbindgen_export_0,_.__wbindgen_export_1),c=y;l().setInt32(e+4,c,!0),l().setInt32(e+0,s,!0)},n.wbg.__wbg_at_7d852dd9f194d43e=function(e,t){let r=o(e).at(t);return i(r)},n.wbg.__wbg_buffer_09165b52af8c5237=function(e){let t=o(e).buffer;return i(t)},n.wbg.__wbg_buffer_609cc3eee51ed158=function(e){let t=o(e).buffer;return i(t)},n.wbg.__wbg_call_672a4d21634d4a24=function(){return p(function(e,t){let r=o(e).call(o(t));return i(r)},arguments)},n.wbg.__wbg_call_7cccdd69e0791ae2=function(){return p(function(e,t,r){let s=o(e).call(o(t),o(r));return i(s)},arguments)},n.wbg.__wbg_call_833bed5770ea2041=function(){return p(function(e,t,r,s){let c=o(e).call(o(t),o(r),o(s));return i(c)},arguments)},n.wbg.__wbg_client_new=function(e){let t=O.__wrap(e);return i(t)},n.wbg.__wbg_debug_3cb59063b29f58c1=function(e){console.debug(o(e))},n.wbg.__wbg_debug_e17b51583ca6a632=function(e,t,r,s){console.debug(o(e),o(t),o(r),o(s))},n.wbg.__wbg_done_769e5ede4b31c67b=function(e){return o(e).done},n.wbg.__wbg_entries_3265d4158b33e5dc=function(e){let t=Object.entries(o(e));return i(t)},n.wbg.__wbg_error_1004b8c64097413f=function(e,t){console.error(o(e),o(t))},n.wbg.__wbg_error_524f506f44df1645=function(e){console.error(o(e))},n.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,t){let r,s;try{r=e,s=t,console.error(w(e,t))}finally{_.__wbindgen_export_3(r,s,1)}},n.wbg.__wbg_error_80de38b3f7cc3c3c=function(e,t,r,s){console.error(o(e),o(t),o(r),o(s))},n.wbg.__wbg_from_2a5d3e218e67aa85=function(e){let t=Array.from(o(e));return i(t)},n.wbg.__wbg_getEntriesByName_2a5a14d4b09f36a4=function(e,t,r,s,c){let u=o(e).getEntriesByName(w(t,r),w(s,c));return i(u)},n.wbg.__wbg_getRandomValues_21a0191e74d0e1d3=function(){return p(function(e,t){globalThis.crypto.getRandomValues(fe(e,t))},arguments)},n.wbg.__wbg_get_67b2ba62fc30de12=function(){return p(function(e,t){let r=Reflect.get(o(e),o(t));return i(r)},arguments)},n.wbg.__wbg_get_74b8744f6a23f4fa=function(e,t,r){let s=o(e)[w(t,r)];return f(s)?0:i(s)},n.wbg.__wbg_get_b9b93047fe3cf45b=function(e,t){let r=o(e)[t>>>0];return i(r)},n.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(e,t){let r=o(e)[o(t)];return i(r)},n.wbg.__wbg_has_a5ea9117f258a0ec=function(){return p(function(e,t){return Reflect.has(o(e),o(t))},arguments)},n.wbg.__wbg_info_033d8b8a0838f1d3=function(e,t,r,s){console.info(o(e),o(t),o(r),o(s))},n.wbg.__wbg_info_3daf2e093e091b66=function(e){console.info(o(e))},n.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc=function(e){let t;try{t=o(e)instanceof ArrayBuffer}catch{t=!1}return t},n.wbg.__wbg_instanceof_Array_6ac07133d621675a=function(e){let t;try{t=o(e)instanceof Array}catch{t=!1}return t},n.wbg.__wbg_instanceof_Error_4d54113b22d20306=function(e){let t;try{t=o(e)instanceof Error}catch{t=!1}return t},n.wbg.__wbg_instanceof_Map_f3469ce2244d2430=function(e){let t;try{t=o(e)instanceof Map}catch{t=!1}return t},n.wbg.__wbg_instanceof_Object_7f2dcef8f78644a4=function(e){let t;try{t=o(e)instanceof Object}catch{t=!1}return t},n.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9=function(e){let t;try{t=o(e)instanceof Uint8Array}catch{t=!1}return t},n.wbg.__wbg_instanceof_Window_def73ea0955fc569=function(e){let t;try{t=o(e)instanceof Window}catch{t=!1}return t},n.wbg.__wbg_isArray_a1eab7e0d067391b=function(e){return Array.isArray(o(e))},n.wbg.__wbg_isSafeInteger_343e2beeeece1bb0=function(e){return Number.isSafeInteger(o(e))},n.wbg.__wbg_iterator_9a24c88df860dc65=function(){return i(Symbol.iterator)},n.wbg.__wbg_keys_5c77a08ddc2fb8a6=function(e){let t=Object.keys(o(e));return i(t)},n.wbg.__wbg_length_a446193dc22c12f8=function(e){return o(e).length},n.wbg.__wbg_length_e2d2a49132c1b256=function(e){return o(e).length},n.wbg.__wbg_mark_001da84b098c950f=function(){return p(function(e,t,r){o(e).mark(w(t,r))},arguments)},n.wbg.__wbg_measure_65e49f8bc0e203a8=function(){return p(function(e,t,r,s,c){o(e).measure(w(t,r),w(s,c))},arguments)},n.wbg.__wbg_message_97a2af9b89d693a3=function(e){let t=o(e).message;return i(t)},n.wbg.__wbg_new_23a2665fac83c611=function(e,t){try{var r={a:e,b:t},s=(u,b)=>{let g=r.a;r.a=0;try{return ye(g,r.b,u,b)}finally{r.a=g}};let c=new Promise(s);return i(c)}finally{r.a=r.b=0}},n.wbg.__wbg_new_405e22f390576ce2=function(){let e=new Object;return i(e)},n.wbg.__wbg_new_5e0be73521bc8c17=function(){return i(new Map)},n.wbg.__wbg_new_78feb108b6472713=function(){let e=new Array;return i(e)},n.wbg.__wbg_new_8a6f238a6ece86ea=function(){let e=new Error;return i(e)},n.wbg.__wbg_new_a12002a7f91c75be=function(e){let t=new Uint8Array(o(e));return i(t)},n.wbg.__wbg_new_c68d7209be747379=function(e,t){let r=new Error(w(e,t));return i(r)},n.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,t){let r=new Function(w(e,t));return i(r)},n.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,t,r){let s=new Uint8Array(o(e),t>>>0,r>>>0);return i(s)},n.wbg.__wbg_next_25feadfc0913fea9=function(e){let t=o(e).next;return i(t)},n.wbg.__wbg_next_6574e1a8a62d1055=function(){return p(function(e){let t=o(e).next();return i(t)},arguments)},n.wbg.__wbg_now_d18023d54d4e5500=function(e){return o(e).now()},n.wbg.__wbg_parse_def2e24ef1252aff=function(){return p(function(e,t){let r=JSON.parse(w(e,t));return i(r)},arguments)},n.wbg.__wbg_performance_c185c0cdc2766575=function(e){let t=o(e).performance;return f(t)?0:i(t)},n.wbg.__wbg_push_737cfc8c1432c2c6=function(e,t){return o(e).push(o(t))},n.wbg.__wbg_queueMicrotask_6808622725a52272=function(e){let t=o(e).queueMicrotask;return i(t)},n.wbg.__wbg_queueMicrotask_ef0e86b0263a71ee=function(e){queueMicrotask(o(e))},n.wbg.__wbg_reject_b3fcf99063186ff7=function(e){let t=Promise.reject(o(e));return i(t)},n.wbg.__wbg_resolve_4851785c9c5f573d=function(e){let t=Promise.resolve(o(e));return i(t)},n.wbg.__wbg_set_37837023f3d740e8=function(e,t,r){o(e)[t>>>0]=a(r)},n.wbg.__wbg_set_3f1d0b984ed272ed=function(e,t,r){o(e)[a(t)]=a(r)},n.wbg.__wbg_set_65595bdd868b3009=function(e,t,r){o(e).set(o(t),r>>>0)},n.wbg.__wbg_set_8fc6bf8a5b1071d1=function(e,t,r){let s=o(e).set(o(t),o(r));return i(s)},n.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,t){let r=o(t).stack,s=x(r,_.__wbindgen_export_0,_.__wbindgen_export_1),c=y;l().setInt32(e+4,c,!0),l().setInt32(e+0,s,!0)},n.wbg.__wbg_startTime_c051731d0a31602f=function(e){return o(e).startTime},n.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){let e=typeof global>"u"?null:global;return f(e)?0:i(e)},n.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){let e=typeof globalThis>"u"?null:globalThis;return f(e)?0:i(e)},n.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){let e=typeof self>"u"?null:self;return f(e)?0:i(e)},n.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){let e=typeof window>"u"?null:window;return f(e)?0:i(e)},n.wbg.__wbg_stringify_f7ed6987935b4a24=function(){return p(function(e){let t=JSON.stringify(o(e));return i(t)},arguments)},n.wbg.__wbg_table_new=function(e){let t=L.__wrap(e);return i(t)},n.wbg.__wbg_then_44b73946d2fb3e7d=function(e,t){let r=o(e).then(o(t));return i(r)},n.wbg.__wbg_then_48b406749878a531=function(e,t,r){let s=o(e).then(o(t),o(r));return i(s)},n.wbg.__wbg_toString_5285597960676b7b=function(e){let t=o(e).toString();return i(t)},n.wbg.__wbg_trace_d12a9ac890a2cbb8=function(e,t,r,s){console.trace(o(e),o(t),o(r),o(s))},n.wbg.__wbg_trace_e758b839df8d34f1=function(e){console.trace(o(e))},n.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){let t=o(e).value;return i(t)},n.wbg.__wbg_values_fcb8ba8c0aad8b58=function(e){let t=Object.values(o(e));return i(t)},n.wbg.__wbg_view_new=function(e){let t=P.__wrap(e);return i(t)},n.wbg.__wbg_view_unwrap=function(e){return P.__unwrap(a(e))},n.wbg.__wbg_warn_4ca3906c248c47c4=function(e){console.warn(o(e))},n.wbg.__wbg_warn_aaf1f4664a035bd6=function(e,t,r,s){console.warn(o(e),o(t),o(r),o(s))},n.wbg.__wbindgen_as_number=function(e){return+o(e)},n.wbg.__wbindgen_bigint_from_i64=function(e){return i(e)},n.wbg.__wbindgen_bigint_from_u64=function(e){let t=BigInt.asUintN(64,e);return i(t)},n.wbg.__wbindgen_bigint_get_as_i64=function(e,t){let r=o(t),s=typeof r=="bigint"?r:void 0;l().setBigInt64(e+8,f(s)?BigInt(0):s,!0),l().setInt32(e+0,!f(s),!0)},n.wbg.__wbindgen_boolean_get=function(e){let t=o(e);return typeof t=="boolean"?t?1:0:2},n.wbg.__wbindgen_cb_drop=function(e){let t=a(e).original;return t.cnt--==1?(t.a=0,!0):!1},n.wbg.__wbindgen_closure_wrapper3223=function(e,t,r){let s=le(e,t,468,pe);return i(s)},n.wbg.__wbindgen_closure_wrapper367=function(e,t,r){let s=ge(e,t,7,de);return i(s)},n.wbg.__wbindgen_debug_string=function(e,t){let r=C(o(t)),s=x(r,_.__wbindgen_export_0,_.__wbindgen_export_1),c=y;l().setInt32(e+4,c,!0),l().setInt32(e+0,s,!0)},n.wbg.__wbindgen_error_new=function(e,t){let r=new Error(w(e,t));return i(r)},n.wbg.__wbindgen_in=function(e,t){return o(e)in o(t)},n.wbg.__wbindgen_is_bigint=function(e){return typeof o(e)=="bigint"},n.wbg.__wbindgen_is_function=function(e){return typeof o(e)=="function"},n.wbg.__wbindgen_is_object=function(e){let t=o(e);return typeof t=="object"&&t!==null},n.wbg.__wbindgen_is_string=function(e){return typeof o(e)=="string"},n.wbg.__wbindgen_is_undefined=function(e){return o(e)===void 0},n.wbg.__wbindgen_jsval_eq=function(e,t){return o(e)===o(t)},n.wbg.__wbindgen_jsval_loose_eq=function(e,t){return o(e)==o(t)},n.wbg.__wbindgen_memory=function(){let e=_.memory;return i(e)},n.wbg.__wbindgen_number_get=function(e,t){let r=o(t),s=typeof r=="number"?r:void 0;l().setFloat64(e+8,f(s)?0:s,!0),l().setInt32(e+0,!f(s),!0)},n.wbg.__wbindgen_number_new=function(e){return i(e)},n.wbg.__wbindgen_object_clone_ref=function(e){let t=o(e);return i(t)},n.wbg.__wbindgen_object_drop_ref=function(e){a(e)},n.wbg.__wbindgen_string_get=function(e,t){let r=o(t),s=typeof r=="string"?r:void 0;var c=f(s)?0:x(s,_.__wbindgen_export_0,_.__wbindgen_export_1),u=y;l().setInt32(e+4,u,!0),l().setInt32(e+0,c,!0)},n.wbg.__wbindgen_string_new=function(e,t){let r=w(e,t);return i(r)},n.wbg.__wbindgen_throw=function(e,t){throw new Error(w(e,t))},n}function Y(n,e){return _=n.exports,Z.__wbindgen_wasm_module=e,A=null,j=null,_}function he(n){if(_!==void 0)return _;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module:n}=n:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=X();n instanceof WebAssembly.Module||(n=new WebAssembly.Module(n));let t=new WebAssembly.Instance(n,e);return Y(t,n)}async function Z(n){if(_!==void 0)return _;typeof n<"u"&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead"));let e=X();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));let{instance:t,module:r}=await me(await n,e);return Y(t,r)}var F=Z;function ve(){let n,e,t=new Promise((r,s)=>{n=r,e=s});return[n,t,e]}async function ee(n,e,t,r){let s,c;async function u(){if(c?.readyState===n.CONNECTING||c?.readyState===n.OPEN){console.warn(`Already connected ${c.readyState}`);return}let[W,m,$]=ve();c=new n(t,r),c.onopen=W,c.binaryType="arraybuffer",c.onerror=k=>{let E=k.message||"Generic Websocket Error";s.handle_error(E,u),$(E)},c.onclose=k=>{let E=`WebSocket closed ${k.code}`;s.handle_error(E,u),$(E)},c.onmessage=k=>{s.handle_response(k.data)},await m}async function b(W){if(c.readyState===n.CLOSING||c.readyState===n.CLOSED){let m=`WebSocket transport error (${c.readyState})`;throw s.handle_error(m,u),new Error(m)}else if(c.readyState===n.CONNECTING){let m=`WebSocket message dropped (${c.readyState})`;throw new Error(m)}else{let m=W.slice().buffer;c.send(m)}}async function g(){console.debug("Closing WebSocket"),c.close()}return s=new e(b,g),await u(),s}function xe(){let n,e,t=new Promise((r,s)=>{n=r,e=s});return[n,t,e]}async function We(n,e){let[t,r]=xe();n.addEventListener("message",function s(c){n.removeEventListener("message",s),t(null)}),n.onmessage=function(c){n.onmessage=function(){},t(null)},n.onmessageerror=console.error,n.postMessage({cmd:"init",args:[e]},{transfer:e instanceof WebAssembly.Module?[]:[e]}),await r}async function te(n,e,t){let[r,s]=await Promise.all([e,t]),{Client:c}=await n,u;if(typeof SharedWorker<"u"&&s instanceof SharedWorker)u=s.port;else{s=s;let g=new MessageChannel;s.postMessage(null,[g.port2]),u=g.port1}let b=new c(async g=>{let W=g.slice().buffer;u.postMessage(W,{transfer:[W]})},async()=>{console.debug("Closing WebWorker"),u.close(),s instanceof Worker&&s.terminate()});return await We(u,r),u.addEventListener("message",g=>{b.handle_response(g.data)}),b}async function ne(n,e){let{Client:t}=await n;return await ee(WebSocket,t,e)}async function re(n){let e;typeof n?.then=="function"&&(n=await n),n instanceof Response?e=await WebAssembly.instantiateStreaming(n):typeof n=="string"?e=await WebAssembly.instantiateStreaming(fetch(n)):n instanceof ArrayBuffer?e=await WebAssembly.instantiate(n):n instanceof Uint8Array?e=await WebAssembly.instantiate(n.buffer):e=n;let t=e.instance.exports,[r]=WebAssembly.Module.customSections(e.module,"psp-runtime"),[s]=WebAssembly.Module.customSections(e.module,"psp-len"),c=new DataView(s).getUint32(0,!0),u=t.resize(r.byteLength);new Uint8Array(t.memory.buffer).set(new Uint8Array(r),u);let b=t.compile(r.byteLength,c);return new Uint8Array(t.memory.buffer).slice(b,c+b)}if(typeof WebAssembly>"u")throw new Error("WebAssembly not supported.");async function D(n){n instanceof Function&&(n=await n());try{return await re(n)}catch{return console.warn("Stage 0 wasm loading failed, skipping"),new Uint8Array(n)}}var H='"use strict";(()=>{var I=Object.defineProperty;var S=(s,t,r)=>t in s?I(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var f=(s,t,r)=>S(s,typeof t!="symbol"?t+"":t,r);var v=class{constructor(t){f(this,"poll_handle");f(this,"server");this.server=t}set_poll_handle(){return this.poll_handle=new Promise((t,r)=>setTimeout(()=>this.server.poll().then(t).catch(r).finally(()=>{this.poll_handle=void 0}))),this.poll_handle}async on_poll_request(){this.poll_handle?await this.poll_handle.then(()=>{if(!this.poll_handle)return this.set_poll_handle()}):await this.set_poll_handle()}},h=class{constructor(t,r){f(this,"clients");f(this,"server");f(this,"module");f(this,"on_poll_request");this.clients=new Map,this.module=t,this.on_poll_request=r?.on_poll_request,this.server=t._psp_new_server(r?.on_poll_request?1:0)}make_session(t){let r=this.module._psp_new_session(this.server);return this.clients.set(r,t),new P(this.module,this.server,r,this.clients,this.on_poll_request&&(()=>this.on_poll_request(this)))}async poll(){let t=this.module._psp_poll(this.server);await A(this.module,t,async r=>{await this.clients.get(r.client_id)(r.data)})}delete(){this.module._psp_delete_server(this.server)}},P=class{constructor(t,r,i,a,l){this.mod=t;this.server=r;this.client_id=i;this.client_map=a;this.on_poll_request=l}async handle_request(t){let r=await H(this.mod,t,async i=>this.mod._psp_handle_request(this.server,this.client_id,i,this.mod._psp_is_memory64()?BigInt(t.byteLength):t.byteLength));await A(this.mod,r,async i=>{await this.client_map.get(i.client_id)(i.data)}),this.on_poll_request?await this.on_poll_request():await this.poll()}async poll(){let t=this.mod._psp_poll(this.server);await A(this.mod,t,async r=>{r.client_id===0?await this.client_map.get(this.client_id)(r.data):await this.client_map.get(r.client_id)(r.data)})}close(){this.mod._psp_close_session(this.server,this.client_id)}};async function H(s,t,r){let i=s._psp_alloc(s._psp_is_memory64()?BigInt(t.byteLength):t.byteLength);s.HEAPU8.set(t,Number(i));let a=await r(i);return s._psp_free(i),a}async function A(s,t,r){let i=s._psp_is_memory64(),a=new DataView(s.HEAPU8.buffer,Number(t),i?12:8),l=a.getUint32(0,!0),u=i?a.getBigInt64(4,!0):a.getUint32(4,!0),e=new DataView(s.HEAPU8.buffer,Number(u),l*(i?16:12));try{for(let n=0;n<l;n++){let[o,p,y]=i?[e.getBigInt64(n*16,!0),e.getInt32(n*16+8,!0),e.getInt32(n*16+12,!0)]:[e.getInt32(n*12,!0),e.getInt32(n*12+4,!0),e.getInt32(n*12+8,!0)],c=new Uint8Array(s.HEAPU8.buffer,Number(o),p);await r({client_id:y,data:c})}}finally{for(let n=0;n<l;n++){let o=i?e.getBigInt64(n*16,!0):e.getInt32(n*12,!0);s._psp_free(o)}s._psp_free(i?BigInt(e.byteOffset):e.byteOffset),s._psp_free(i?BigInt(a.byteOffset):a.byteOffset)}}var q=console.log.bind(console),L=console.error.bind(console),N=new TextDecoder("utf8"),R=[null,[],[]];function j(s,t=0,r=NaN){for(var i=t+r,a=t;s[a]&&!(a>=i);)++a;return N.decode(s instanceof Uint8Array?s.subarray(t,a):new Uint8Array(s.slice(t,a)))}function E(s,t){var r=R[s];t===0||t===10?((s===1?q:L)(j(r,0)),r.length=0):r.push(t)}async function U(s){let t,r=!1,i,a={HaveOffsetConverter(){console.error("HaveOffsetConverter")},__syscall_ftruncate64(...e){console.error("__syscall_frtuncate64",e)},__syscall_getdents64(...e){console.error("__syscall_frtuncate64",e)},__syscall_unlinkat(...e){console.error("__syscall_frtuncate64",e)},__throw_exception_with_stack_trace(e){let n=new WebAssembly.Exception(t.__cpp_exception,[e],{traceStack:!0});throw n.message="Unexpected internal error",n},clock_time_get(e,n,o){if(r){if(o=o,o=Number(o),!(e==0||e==1||e==2||e==3))return 28;var p;e===0?p=Date.now():p=performance.now();let c=Math.round(p*1e3*1e3),_=new BigInt64Array(i.buffer);return _[o/8]=BigInt(c),0}else{if(o=o,o>>>=0,!(e==0||e==1||e==2||e==3))return 28;var p;e===0?p=Date.now():p=performance.now();var y=Math.round(p*1e6);let _=new BigInt64Array(i.buffer);return _[o>>>3]=BigInt(y),0}},emscripten_asm_const_int(...e){return 0},emscripten_notify_memory_growth(e){r?e=Number(e):(e=e,e>>>=0),e!=0&&console.error("abort")},environ_get(...e){return 0},environ_sizes_get(...e){return 0},fd_close(...e){return console.error("fd_close",e),0},fd_read(...e){return console.error("fd_read",e),0},fd_seek(...e){return console.error("fs_seek",e),0},fd_write(e,n,o,p){let y=new Uint8Array(i.buffer);if(r){n=Number(n),o=Number(o),p=Number(p);let c=0,_=new BigUint64Array(i.buffer);for(let d=0;d<o;d++){let w=Number(_[n/8]),b=Number(_[(n+8)/8]);n+=16;for(let m=0;m<b;m++)E(e,y[w+m]);c+=b}return _[p/8]=BigInt(c),0}else{n=n,o=o,p=p,n>>>=0,o>>>=0,p>>>=0;let c=0,_=new Uint32Array(i.buffer);for(let d=0;d<o;d++){let w=_[n>>>2>>>0],b=_[n+4>>>2>>>0];n+=8;for(let m=0;m<b;m++)E(e,y[w+m>>>0]);c+=b}return _[p>>>2>>>0]=c,0}},proc_exit(e){return console.error("proc_exit",e),0}},l=await s.instantiateWasm({env:a,wasi_snapshot_preview1:a},e=>{t=e.exports,r=!!t.psp_is_memory64(),i=e.exports.memory,t._initialize()}),u={};for(let[e,n]of Object.entries(l))u[`_${e}`]=n;return{...l,...u,get HEAPU8(){return new Uint8Array(i.buffer)}}}async function M(s){let t=await U({locateFile(r){return r},instantiateWasm:async(r,i)=>{r.env={...r.env,psp_stack_trace(){let l=Error().stack||"",e=new TextEncoder().encode(l),n=t._psp_alloc(t._psp_is_memory64()?BigInt(e.byteLength+1):e.byteLength+1);return t.HEAPU8.set(e,Number(n)),t.HEAPU8[Number(n)+e.byteLength]=0,n},psp_heap_size(){return t._psp_is_memory64()?BigInt(t.HEAPU8.buffer.byteLength):t.HEAPU8.buffer.byteLength}};let a=await WebAssembly.instantiate(s,r);return i(a.instance),a.instance.exports}});return t}var g,x;function B(s){let t=s.ports[0],r;t.addEventListener("message",async i=>{if(i.data.cmd==="init"){let a=i.data.id;if(!g){let l=await M(i.data.args[0]);g=new h(l,{on_poll_request:()=>x.on_poll_request()}),x=new v(g)}r=g.make_session(async l=>{let u=l.slice().buffer;t.postMessage(u,{transfer:[u]})}),t.postMessage({id:a})}else await r.handle_request(new Uint8Array(i.data))}),t.start()}self.addEventListener("connect",B);self.addEventListener("message",B);})();\n';function se(n,e){function t(c,u){c==="message"&&n.push(u)}function r(c){let u=n.indexOf(c);u>-1&&n.splice(u,1)}function s(c,u){for(let b of e)b({data:c,ports:u})}return{addEventListener:t,removeEventListener:r,postMessage:s,location:{href:""}}}function je(n){console.error("Running perspective in single-threaded mode");let e=Function("const self = arguments[0];"+n),t=[],r=[];return e(se(t,r)),se(r,t)}var Se=async function(){try{if(window.location.protocol.startsWith("file"))return console.warn("file:// protocol does not support Web Workers"),je(H);{let n=new Blob([H],{type:"application/javascript"}),e=URL.createObjectURL(n);return new Worker(e,{type:"module"})}}catch(n){console.error("Error instantiating engine",n)}},oe=Se;var h;function Me(n,e=!1){n instanceof Uint8Array?h=Promise.resolve(n.buffer):n instanceof Response?h=Promise.resolve(n):n instanceof Promise?h=n:h=Promise.resolve(n),e||(h=h.then(t=>D(t).then(r=>r.buffer)))}var v;async function R(n,e=!1){let t=e?n:await D(n);return await F({module_or_path:t}),await q(),z}function Ie(n,e=!1){n instanceof Uint8Array?v=R(n.buffer,e):n instanceof ArrayBuffer||n instanceof Response||n instanceof Promise?v=R(n,e):n instanceof Object&&(v=Promise.resolve(n))}function ie(){let n=customElements.get("perspective-viewer");if(n)v=Promise.resolve(n.__wasm_module__);else if(v===void 0)throw new Error("Missing perspective-client.wasm");return v}function Oe(){if(h===void 0)throw new Error("Missing perspective-server.wasm");return h.then(n=>n instanceof WebAssembly.Module?n:n.slice(0))}var _e;function Pe(){return _e===void 0?oe():_e()}async function Ue(n){return await ne(ie(),n)}async function Be(n){return typeof n>"u"&&(n=Pe()),await te(ie(),Oe(),n)}var He={websocket:Ue,worker:Be,init_client:Ie,init_server:Me};export{He as default,Ie as init_client,Me as init_server,Ue as websocket,Be as worker};
3
3
  //# sourceMappingURL=perspective.js.map