jazz-tools 2.0.0-alpha.66 → 2.0.0-alpha.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/inspector-ui/10.js +2 -2
- package/dist/backend/inspector-ui/11.js +2 -2
- package/dist/backend/inspector-ui/12.js +2 -2
- package/dist/backend/inspector-ui/18.js +1 -1
- package/dist/backend/inspector-ui/9.js +2 -2
- package/dist/backend/inspector-ui-files.js +4 -4
- package/dist/dev/inspector-overlay/embedded/assets/{index-DbxzzKYS.js → index-Dy2YbFMK.js} +3 -3
- package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-nRxyqRt5.js → jazz-broker-worker-OYLmDTMs.js} +2 -2
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm-C2VuKMqv.js → jazz_wasm-mBuVt23h.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-Biazm84G.wasm → jazz_wasm_bg-ZC330TX3.wasm} +0 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprints.d.ts +2 -2
- package/dist/worker/jazz-broker-worker.js +2 -2
- package/dist/worker/jazz_wasm_bg.wasm +0 -0
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=Object.getOwnPropertyNames,n=(e,n)=>function(){return e&&(n=(0,e[t(e)[0]])(e=0)),n},r=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},i={};r(i,{PendingNativeRead:()=>ve,StreamingMutation:()=>ye,UpstreamLink:()=>be,WasmDb:()=>xe,WasmPendingSubscription:()=>Se,WasmPermissionAdviceRequest:()=>Ce,WasmTransport:()=>M,WasmWrite:()=>N,__testBindingCodecGoldenFixture:()=>a,__testValidateWireFrameBatchCorpus:()=>o,__testWireFrameCorpusFeatures:()=>s,captureTextAnchor:()=>c,captureTextRange:()=>l,currentTimestamp:()=>u,default:()=>_e,deriveUserId:()=>d,drainTraceEntries:()=>f,generateId:()=>p,init:()=>m,initSync:()=>ge,mintAnonymousToken:()=>h,mintLocalFirstToken:()=>g,nativeArtifactFingerprint:()=>_,resolveTextAnchor:()=>ee,resolveTextRange:()=>v,setJsonSchemaValidator:()=>y,setTraceEntryCollectionEnabled:()=>te,subscribeTraceEntries:()=>ne,validateSchema:()=>re});function a(){let e,t;try{let n=F.__testBindingCodecGoldenFixture();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function o(e,t,n){let r=k(e,F.__wbindgen_malloc),i=P,a=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=F.__testValidateWireFrameBatchCorpus(r,i,a,o,s,c);if(l[1])throw j(l[0])}function s(){let e,t;try{let n=F.__testWireFrameCorpusFeatures();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function c(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=F.captureTextAnchor(i,a,!D(t),D(t)?0:t,n,r);if(o[2])throw j(o[1]);return j(o[0])}function l(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=F.captureTextRange(i,a,!D(t),D(t)?0:t,n,r);if(o[2])throw j(o[1]);return j(o[0])}function u(){let e=F.currentTimestamp();return BigInt.asUintN(64,e)}function d(e){let t,n;try{let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=F.deriveUserId(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,j(s[2]);return t=r,n=i,T(r,i)}finally{F.__wbindgen_free(t,n,1)}}function f(){return F.drainTraceEntries()}function p(){let e,t;try{let n=F.generateId();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function m(){F.init()}function h(e,t,n,r){let i,a;try{let c=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=F.mintAnonymousToken(c,l,u,d,n,r);var o=f[0],s=f[1];if(f[3])throw o=0,s=0,j(f[2]);return i=o,a=s,T(o,s)}finally{F.__wbindgen_free(i,a,1)}}function g(e,t,n,r){let i,a;try{let c=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=F.mintLocalFirstToken(c,l,u,d,n,r);var o=f[0],s=f[1];if(f[3])throw o=0,s=0,j(f[2]);return i=o,a=s,T(o,s)}finally{F.__wbindgen_free(i,a,1)}}function _(){let e,t;try{let n=F.nativeArtifactFingerprint();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function ee(e,t,n){let r=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=F.resolveTextAnchor(e,r,i,!D(n),D(n)?0:n);if(a[2])throw j(a[1]);return j(a[0])}function v(e,t,n){let r=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=F.resolveTextRange(e,r,i,!D(n),D(n)?0:n);if(a[2])throw j(a[1]);return j(a[0])}function y(e){F.setJsonSchemaValidator(e)}function te(e){F.setTraceEntryCollectionEnabled(e)}function ne(e){return F.subscribeTraceEntries(e)}function re(e){let t=k(e,F.__wbindgen_malloc),n=P,r=F.validateSchema(t,n);if(r[1])throw j(r[0])}function b(){return{__proto__:null,"./jazz_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(e,t){return Error(T(e,t))},__wbg_Number_e6ffdb596c888833:function(e){return Number(e)},__wbg_String_8564e559799eccda:function(e,t){let n=A(String(t),F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;w().setInt32(e+4,r,!0),w().setInt32(e+0,n,!0)},__wbg_Window_70131fc0c91e4b3c:function(e){return e.Window},__wbg_WorkerGlobalScope_601c48015b8cc78e:function(e){return e.WorkerGlobalScope},__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2:function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;w().setBigInt64(e+8,D(r)?BigInt(0):r,!0),w().setInt32(e+0,!D(r),!0)},__wbg___wbindgen_boolean_get_a86c216575a75c30:function(e){let t=e,n=typeof t==`boolean`?t:void 0;return D(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57:function(e,t){let n=A(ue(t),F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;w().setInt32(e+4,r,!0),w().setInt32(e+0,n,!0)},__wbg___wbindgen_in_4bd7a57e54337366:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6c98f7e945dacdde:function(e){return typeof e==`bigint`},__wbg___wbindgen_is_function_49868bde5eb1e745:function(e){return typeof e==`function`},__wbg___wbindgen_is_null_344c8750a8525473:function(e){return e===null},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(e){let t=e;return typeof t==`object`&&!!t},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(e){return typeof e==`string`},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_7d430e744a913d26:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944:function(e,t){return e==t},__wbg___wbindgen_number_get_7579aab02a8a620c:function(e,t){let n=t,r=typeof n==`number`?n:void 0;w().setFloat64(e+8,D(r)?0:r,!0),w().setInt32(e+0,!D(r),!0)},__wbg___wbindgen_string_get_914df97fcfa788f2:function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=D(r)?0:A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P;w().setInt32(e+4,a,!0),w().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_81fc77679af83bc6:function(e,t){throw Error(T(e,t))},__wbg__wbg_cb_unref_3c3b4f651835fbcb:function(e){e._wbg_cb_unref()},__wbg_abort_cfab06d16d2d33a6:function(){return E(function(e){e.abort()},arguments)},__wbg_bound_88db1072ea68e901:function(){return E(function(e,t,n,r){return IDBKeyRange.bound(e,t,n!==0,r!==0)},arguments)},__wbg_call_368fa9c372d473ba:function(){return E(function(e,t,n,r){return e.call(t,n,r)},arguments)},__wbg_call_7f2987183bb62793:function(){return E(function(e,t){return e.call(t)},arguments)},__wbg_call_d578befcc3145dee:function(){return E(function(e,t,n){return e.call(t,n)},arguments)},__wbg_commit_e9c1332714c53826:function(){return E(function(e){e.commit()},arguments)},__wbg_construct_adeb3d5948c3d19a:function(){return E(function(e,t){return Reflect.construct(e,t)},arguments)},__wbg_createObjectStore_6e567b25160be2fa:function(){return E(function(e,t,n,r){return e.createObjectStore(T(t,n),r)},arguments)},__wbg_delete_fc24bd7dfa57938e:function(){return E(function(e,t){return e.delete(t)},arguments)},__wbg_done_547d467e97529006:function(e){return e.done},__wbg_entries_616b1a459b85be0b:function(e){return Object.entries(e)},__wbg_error_58469b8474e13592:function(){return E(function(e){let t=e.error;return D(t)?0:S(t)},arguments)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(T(e,t))}finally{F.__wbindgen_free(n,r,1)}},__wbg_getAll_93336699ea033b51:function(){return E(function(e,t){return e.getAll(t)},arguments)},__wbg_getDate_bafac038eaae076e:function(e){return e.getDate()},__wbg_getDay_6eebc8fe9cb183f5:function(e){return e.getDay()},__wbg_getFullYear_8f83597f7403c865:function(e){return e.getFullYear()},__wbg_getHours_81348c8e800060e7:function(e){return e.getHours()},__wbg_getMinutes_bd1ccf17dab913bf:function(e){return e.getMinutes()},__wbg_getMonth_288607689622719c:function(e){return e.getMonth()},__wbg_getRandomValues_15134f5c0ae6b0d0:function(){return E(function(e,t){globalThis.crypto.getRandomValues(C(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return E(function(e,t){globalThis.crypto.getRandomValues(C(e,t))},arguments)},__wbg_getSeconds_edef7266627a185f:function(e){return e.getSeconds()},__wbg_getTime_f6ac312467f7cf09:function(e){return e.getTime()},__wbg_getTimezoneOffset_ac5be603b21a5797:function(e){return e.getTimezoneOffset()},__wbg_get_4848e350b40afc16:function(e,t){return e[t>>>0]},__wbg_get_ed0642c4b9d31ddf:function(){return E(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_f96702c6245e4ef9:function(){return E(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_7d7babe32e9e6a54:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_global_e30ac0b7684506d0:function(e){return e.global},__wbg_has_3ec5c22db2e5237a:function(){return E(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_indexedDB_065ce3ad400579e3:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_indexedDB_a2139150e2ea2a08:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_indexedDB_af74cb6df65fa636:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_DomException_37f96d3fb69189bd:function(e){let t;try{t=e instanceof DOMException}catch{t=!1}return t},__wbg_instanceof_Error_e3390d6805733dad:function(e){let t;try{t=e instanceof Error}catch{t=!1}return t},__wbg_instanceof_IdbDatabase_0af111edb4be95f4:function(e){let t;try{t=e instanceof IDBDatabase}catch{t=!1}return t},__wbg_instanceof_IdbRequest_fc5918c726448f04:function(e){let t;try{t=e instanceof IDBRequest}catch{t=!1}return t},__wbg_instanceof_Map_a10a2795ef4bfe97:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Uint8Array_4b8da683deb25d72:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_db61795ad004c139:function(e){return Array.isArray(e)},__wbg_isSafeInteger_ea83862ba994770c:function(e){return Number.isSafeInteger(e)},__wbg_iterator_de403ef31815a3e6:function(){return Symbol.iterator},__wbg_length_0c32cb8543c8e4c8:function(e){return e.length},__wbg_length_6e821edde497a532:function(e){return e.length},__wbg_log_6a8b55ee2e172f54:function(e,t,n,r,i,a,o,s){let c,l;try{c=e,l=t,console.log(T(e,t),T(n,r),T(i,a),T(o,s))}finally{F.__wbindgen_free(c,l,1)}},__wbg_lowerBound_279c232a69ac0f79:function(){return E(function(e,t){return IDBKeyRange.lowerBound(e,t!==0)},arguments)},__wbg_message_52a9425f28c45ebc:function(e,t){let n=t.message,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_message_7367f8c7d0fa1589:function(e){return e.message},__wbg_name_d7bb38b41d6d953e:function(e,t){let n=t.name,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_new_0_bfa2ef4bc447daa2:function(){return new Date},__wbg_new_0f6d2ddfe083319b:function(e){return new Date(e)},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_new_40792555590ec35c:function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return le(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=0}},__wbg_new_4f9fafbb3909af72:function(){return{}},__wbg_new_99cabae501c0a8a0:function(){return new Map},__wbg_new_a560378ea1240b14:function(e){return new Uint8Array(e)},__wbg_new_e3b04b4d53d1b593:function(e,t){return Error(T(e,t))},__wbg_new_f3c9df4f38f3f798:function(){return[]},__wbg_new_from_slice_2580ff33d0d10520:function(e,t){return new Uint8Array(C(e,t))},__wbg_new_typed_14d7cc391ce53d2c:function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return le(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=0}},__wbg_new_with_length_9cedd08484b73942:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_year_month_day_d7dc1e63a7b42902:function(e,t,n){return new Date(e>>>0,t,n)},__wbg_next_01132ed6134b8ef5:function(e){return e.next},__wbg_next_b3713ec761a9dbfd:function(){return E(function(e){return e.next()},arguments)},__wbg_now_6798946be0e6fe2b:function(){return E(function(){return Date.now()},arguments)},__wbg_now_88621c9c9a4f3ffc:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(e){return e.now()},__wbg_objectStore_3d4cade4416cd432:function(){return E(function(e,t,n){return e.objectStore(T(t,n))},arguments)},__wbg_open_ac04ec9d75d0eeaf:function(){return E(function(e,t,n,r){return e.open(T(t,n),r>>>0)},arguments)},__wbg_pendingnativeread_new:function(e){return ve.__wrap(e)},__wbg_performance_3fcf6e32a7e1ed0a:function(e){return e.performance},__wbg_prototypesetcall_3e05eb9545565046:function(e,t,n){Uint8Array.prototype.set.call(C(e,t),n)},__wbg_push_6bdbc990be5ac37b:function(e,t){return e.push(t)},__wbg_put_015a7e88e46a2502:function(){return E(function(e,t){return e.put(t)},arguments)},__wbg_queueMicrotask_abaf92f0bd4e80a4:function(e){return e.queueMicrotask},__wbg_queueMicrotask_df5a6dac26d818f3:function(e){queueMicrotask(e)},__wbg_random_a72d453e63c9558c:function(){return Math.random()},__wbg_readyState_accbdf425c074d9c:function(e){let t=e.readyState;return(we.indexOf(t)+1||3)-1},__wbg_reject_1340e1211c01825b:function(e){return Promise.reject(e)},__wbg_resolve_0a79de24e9d2267b:function(e){return Promise.resolve(e)},__wbg_result_452c1006fc727317:function(){return E(function(e){return e.result},arguments)},__wbg_set_08463b1df38a7e29:function(e,t,n){return e.set(t,n)},__wbg_set_16a9c1a07b3d38ec:function(e,t,n){e.set(C(t,n))},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_6c60b2e8ad0e9383:function(e,t,n){e[t>>>0]=n},__wbg_set_8ee2d34facb8466e:function(){return E(function(e,t,n){return Reflect.set(e,t,n)},arguments)},__wbg_set_key_path_6edd6ee0e8d75af3:function(e,t){e.keyPath=t},__wbg_set_onabort_6b6df7a41aa97c23:function(e,t){e.onabort=t},__wbg_set_oncomplete_20fb27150b4ee0d4:function(e,t){e.oncomplete=t},__wbg_set_onerror_2b7dfa4e6dea4159:function(e,t){e.onerror=t},__wbg_set_onerror_3c4b5087146b11b6:function(e,t){e.onerror=t},__wbg_set_onsuccess_f7e5b5cbed5008b1:function(e,t){e.onsuccess=t},__wbg_set_onupgradeneeded_d7e8e03a1999bf5d:function(e,t){e.onupgradeneeded=t},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){let e=typeof globalThis>`u`?null:globalThis;return D(e)?0:S(e)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){let e=typeof global>`u`?null:global;return D(e)?0:S(e)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){let e=typeof self>`u`?null:self;return D(e)?0:S(e)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){let e=typeof window>`u`?null:window;return D(e)?0:S(e)},__wbg_subarray_0f98d3fb634508ad:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_target_732d56b173b7e87c:function(e){let t=e.target;return D(t)?0:S(t)},__wbg_then_00eed3ac0b8e82cb:function(e,t,n){return e.then(t,n)},__wbg_then_a0c8db0381c8994c:function(e,t){return e.then(t)},__wbg_toString_891d991e862e1d44:function(e){return e.toString()},__wbg_transaction_cc65dcef07fabb06:function(e){return e.transaction},__wbg_transaction_f909284bfed41115:function(){return E(function(e,t,n,r){return e.transaction(T(t,n),Te[r])},arguments)},__wbg_upperBound_2f3c07fb628c7a3c:function(){return E(function(e,t){return IDBKeyRange.upperBound(e,t!==0)},arguments)},__wbg_value_7f6052747ccf940f:function(e){return e.value},__wbg_wasmdb_new:function(e){return xe.__wrap(e)},__wbg_wasmtransport_new:function(e){return M.__wrap(e)},__wbg_wasmwrite_new:function(e){return N.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return O(e,t,se)},__wbindgen_cast_0000000000000002:function(e,t){return O(e,t,oe)},__wbindgen_cast_0000000000000003:function(e,t){return O(e,t,ae)},__wbindgen_cast_0000000000000004:function(e,t){return O(e,t,ce)},__wbindgen_cast_0000000000000005:function(e,t){return O(e,t,x)},__wbindgen_cast_0000000000000006:function(e,t){return O(e,t,ie)},__wbindgen_cast_0000000000000007:function(e){return e},__wbindgen_cast_0000000000000008:function(e){return e},__wbindgen_cast_0000000000000009:function(e,t){return T(e,t)},__wbindgen_cast_000000000000000a:function(e){return BigInt.asUintN(64,e)},__wbindgen_init_externref_table:function(){let e=F.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function x(e,t){F.wasm_bindgen__convert__closures_____invoke__h69610db431037c77(e,t)}function ie(e,t){F.wasm_bindgen__convert__closures_____invoke__h492b14c1fd17d971(e,t)}function ae(e,t,n){F.wasm_bindgen__convert__closures_____invoke__hf83e1094fac4ab4c(e,t,n)}function oe(e,t,n){return F.wasm_bindgen__convert__closures_____invoke__hdac149749bdb2c9a(e,t,n)}function se(e,t,n){let r=F.wasm_bindgen__convert__closures_____invoke__hf2d3ca0c7acb67d9(e,t,n);if(r[1])throw j(r[0])}function ce(e,t,n){let r=F.wasm_bindgen__convert__closures_____invoke__h05f214157d9fa149(e,t,n);if(r[1])throw j(r[0])}function le(e,t,n,r){F.wasm_bindgen__convert__closures_____invoke__h0c5680e9ed94b2e6(e,t,n,r)}function S(e){let t=F.__externref_table_alloc();return F.__wbindgen_externrefs.set(t,e),t}function ue(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=ue(e[0]));for(let r=1;r<t;r++)n+=`, `+ue(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}
|
|
2
|
-
${e.stack}`:r}function de(e,t){e>>>=0;let n=w(),r=[];for(let i=e;i<e+4*t;i+=4)r.push(F.__wbindgen_externrefs.get(n.getUint32(i,!0)));return F.__externref_drop_slice(e,t),r}function C(e,t){return e>>>=0,fe().subarray(e/1,e/1+t)}function w(){return(Fe===null||Fe.buffer.detached===!0||Fe.buffer.detached===void 0&&Fe.buffer!==F.memory.buffer)&&(Fe=new DataView(F.memory.buffer)),Fe}function T(e,t){return e>>>=0,pe(e,t)}function fe(){return(Ie===null||Ie.byteLength===0)&&(Ie=new Uint8Array(F.memory.buffer)),Ie}function E(e,t){try{return e.apply(this,t)}catch(e){let t=S(e);F.__wbindgen_exn_store(t)}}function D(e){return e==null}function O(e,t,n){let r={a:e,b:t,cnt:1},i=(...e)=>{r.cnt++;let t=r.a;r.a=0;try{return n(t,r.b,...e)}finally{r.a=t,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--r.cnt===0&&(F.__wbindgen_destroy_closure(r.a,r.b),r.a=0,Pe.unregister(r))},Pe.register(i,r,r),i}function k(e,t){let n=t(e.length*1,1)>>>0;return fe().set(e,n/1),P=e.length,n}function A(e,t,n){if(n===void 0){let n=Be.encode(e),r=t(n.length,1)>>>0;return fe().subarray(r,r+n.length).set(n),P=n.length,r}let r=e.length,i=t(r,1)>>>0,a=fe(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=fe().subarray(i+o,i+r),a=Be.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return P=o,i}function j(e){let t=F.__wbindgen_externrefs.get(e);return F.__externref_table_dealloc(e),t}function pe(e,t){return ze+=t,ze>=Re&&(Le=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),Le.decode(),ze=t),Le.decode(fe().subarray(e,e+t))}function me(e,t){return F=e.exports,Ve=t,Fe=null,Ie=null,F.__wbindgen_start(),F}async function he(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.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",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function ge(e){if(F!==void 0)return F;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=b();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),me(new WebAssembly.Instance(e,t),e)}async function _e(e){if(F!==void 0)return F;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0&&(e=new URL(``+new URL(`jazz_wasm_bg-Biazm84G.wasm`,import.meta.url).href,``+import.meta.url));let t=b();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await he(await e,t);return me(n,r)}var ve,ye,be,xe,Se,Ce,M,N,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,P,Ve,F,He=n({"../../crates/jazz-wasm/pkg/jazz_wasm.js"(){ve=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,De.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,De.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_pendingnativeread_free(e,0)}cancel(){F.pendingnativeread_cancel(this.__wbg_ptr)}poll(){let e=F.pendingnativeread_poll(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}},Symbol.dispose&&(ve.prototype[Symbol.dispose]=ve.prototype.free),ye=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ae.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ae.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_streamingmutation_free(e,0)}abort(){return F.wasmstreamingmutation_abort(this.__wbg_ptr)}finish(){return F.wasmstreamingmutation_finish(this.__wbg_ptr)}finishInTransaction(){let e=F.wasmstreamingmutation_finishInTransaction(this.__wbg_ptr);if(e[1])throw j(e[0])}push(e){let t=k(e,F.__wbindgen_malloc),n=P;return F.wasmstreamingmutation_push(this.__wbg_ptr,t,n)}},Symbol.dispose&&(ye.prototype[Symbol.dispose]=ye.prototype.free),be=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Me.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Me.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_upstreamlink_free(e,0)}handle(e,t){let n,r;try{let o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=F.upstreamlink_handle(this.__wbg_ptr,e,o,s);var i=c[0],a=c[1];if(c[3])throw i=0,a=0,j(c[2]);return n=i,r=a,T(i,a)}finally{F.__wbindgen_free(n,r,1)}}constructor(e){return this.__wbg_ptr=F.upstreamlink_new(e)>>>0,Me.register(this,this.__wbg_ptr,this),this}},Symbol.dispose&&(be.prototype[Symbol.dispose]=be.prototype.free),xe=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ee.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ee.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmdb_free(e,0)}acceptSubscriber(e,t,n){let r=k(e,F.__wbindgen_malloc),i=P,a=F.wasmdb_acceptSubscriber(this.__wbg_ptr,r,i,t,!D(n),D(n)?BigInt(0):n);if(a[2])throw j(a[1]);return j(a[0])}acceptSubscriberWithSelfSignedProof(e,t,n,r,i){let a=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),u=P,d=F.wasmdb_acceptSubscriberWithSelfSignedProof(this.__wbg_ptr,e,a,o,s,c,l,u,!D(i),D(i)?BigInt(0):i);if(d[2])throw j(d[1]);return j(d[0])}all(e,t,n,r,i){let a=k(e,F.__wbindgen_malloc),o=P;var s=D(n)?0:A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=D(r)?0:k(r,F.__wbindgen_malloc),u=P;let d=F.wasmdb_all(this.__wbg_ptr,a,o,t,s,c,l,u,i);if(d[2])throw j(d[1]);return j(d[0])}beginStreamingMutation(e,t,n,r,i,a,o,s,c,l,u){let d=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),f=P,p=k(t,F.__wbindgen_malloc),m=P,h=k(n,F.__wbindgen_malloc),g=P,_=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),ee=P;var v=D(i)?0:A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),y=P,te=D(a)?0:k(a,F.__wbindgen_malloc),ne=P,re=D(o)?0:k(o,F.__wbindgen_malloc),b=P,x=D(u)?0:A(u,F.__wbindgen_malloc,F.__wbindgen_realloc),ie=P;let ae=F.wasmdb_beginStreamingMutation(this.__wbg_ptr,d,f,p,m,h,g,_,ee,v,y,te,ne,re,b,!D(s),D(s)?0:s,D(c)?0:S(c),D(l)?0:S(l),x,ie);if(ae[2])throw j(ae[1]);return ye.__wrap(ae[0])}beginTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P;var c=D(n)?0:k(n,F.__wbindgen_malloc),l=P,u=D(r)?0:k(r,F.__wbindgen_malloc),d=P;let f=F.wasmdb_beginTransaction(this.__wbg_ptr,i,a,o,s,c,l,u,d);if(f[1])throw j(f[0])}canInsert(e,t){let n,r;try{let o=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(t,F.__wbindgen_malloc),l=P,u=F.wasmdb_canInsert(this.__wbg_ptr,o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,j(u[2]);return n=i,r=a,T(i,a)}finally{F.__wbindgen_free(n,r,1)}}captureSnapshot(){let e=F.wasmdb_captureSnapshot(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}close(){return F.wasmdb_close(this.__wbg_ptr)}commitTransaction(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;var i=D(t)?0:A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P;let o=F.wasmdb_commitTransaction(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return N.__wrap(o[0])}connectUpstream(){let e=F.wasmdb_connectUpstream(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}connectUpstreamWithSession(e,t,n,r,i,a){let o=k(n,F.__wbindgen_malloc),s=P,c=k(i,F.__wbindgen_malloc),l=P,u=F.wasmdb_connectUpstreamWithSession(this.__wbg_ptr,e,t,o,s,r,c,l,a);if(u[2])throw j(u[1]);return j(u[0])}createUpstreamLink(e){let t=F.wasmdb_createUpstreamLink(this.__wbg_ptr,e);return be.__wrap(t)}delete(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=F.wasmdb_delete(this.__wbg_ptr,r,i,a,o,n);if(s[2])throw j(s[1]);return N.__wrap(s[0])}deleteInTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_deleteInTransaction(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[1])throw j(u[0])}static destroyBrowserStorage(e,t){let n=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;return F.wasmdb_destroyBrowserStorage(e,n,r)}evictExpiredStagedLargeValues(){return F.wasmdb_evictExpiredStagedLargeValues(this.__wbg_ptr)}flush(){return F.wasmdb_flush(this.__wbg_ptr)}foregroundTxTimeHighWater(){let e=F.wasmdb_foregroundTxTimeHighWater(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}insert(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=F.wasmdb_insert(this.__wbg_ptr,r,i,a,o,n);if(s[2])throw j(s[1]);return N.__wrap(s[0])}insertInTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_insertInTransaction(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[3])throw j(u[2]);var d=C(u[0],u[1]).slice();return F.__wbindgen_free(u[0],u[1]*1,1),d}localCurrentRow(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_localCurrentRow(this.__wbg_ptr,n,r,i,a);if(o[3])throw j(o[2]);var s=C(o[0],o[1]).slice();return F.__wbindgen_free(o[0],o[1]*1,1),s}onMutationError(e){F.wasmdb_onMutationError(this.__wbg_ptr,e)}onStorageFailure(e){F.wasmdb_onStorageFailure(this.__wbg_ptr,e)}static openBrowser(e,t,n,r){let i=k(t,F.__wbindgen_malloc),a=P,o=k(n,F.__wbindgen_malloc),s=P,c=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P;return F.wasmdb_openBrowser(e,i,a,o,s,c,l)}static openBrowserWithSelfSignedProof(e,t,n,r,i,a,o){let s=k(t,F.__wbindgen_malloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),f=P,p=A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),m=P,h=A(a,F.__wbindgen_malloc,F.__wbindgen_realloc),g=P,_=A(o,F.__wbindgen_malloc,F.__wbindgen_realloc),ee=P;return F.wasmdb_openBrowserWithSelfSignedProof(e,s,c,l,u,d,f,p,m,h,g,_,ee)}static openMemory(t,n){let r=k(t,F.__wbindgen_malloc),i=P,a=k(n,F.__wbindgen_malloc),o=P,s=F.wasmdb_openMemory(r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}static openMemoryAsBackend(t,n){let r=k(t,F.__wbindgen_malloc),i=P,a=k(n,F.__wbindgen_malloc),o=P,s=F.wasmdb_openMemoryAsBackend(r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}static openMemoryWithSelfSignedProof(t,n,r,i,a){let o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),p=P,m=A(a,F.__wbindgen_malloc,F.__wbindgen_realloc),h=P,g=F.wasmdb_openMemoryWithSelfSignedProof(o,s,c,l,u,d,f,p,m,h);if(g[2])throw j(g[1]);return e.__wrap(g[0])}registerSchema(t,n){let r=k(t,F.__wbindgen_malloc),i=P;var a=D(n)?0:k(n,F.__wbindgen_malloc),o=P;let s=F.wasmdb_registerSchema(this.__wbg_ptr,r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}requestDeletePermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestDeletePermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestInsertPermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestInsertPermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestReadPermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestReadPermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestUpdatePermissionAdvice(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=k(n,F.__wbindgen_malloc),c=P,l=F.wasmdb_requestUpdatePermissionAdvice(this.__wbg_ptr,r,i,a,o,s,c);if(l[2])throw j(l[1]);return Ce.__wrap(l[0])}restore(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P;var c=D(n)?0:k(n,F.__wbindgen_malloc),l=P;let u=F.wasmdb_restore(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}restoreInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P;var d=D(r)?0:k(r,F.__wbindgen_malloc),f=P;let p=F.wasmdb_restoreInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}rollbackTransaction(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_rollbackTransaction(this.__wbg_ptr,t,n);if(r[1])throw j(r[0])}seedForegroundTxTimeHighWater(e){let t=F.wasmdb_seedForegroundTxTimeHighWater(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setIdentityClaims(e,t){let n=k(e,F.__wbindgen_malloc),r=P,i=F.wasmdb_setIdentityClaims(this.__wbg_ptr,n,r,t);if(i[1])throw j(i[0])}setLargeValueStagingPolicy(e,t,n){let r=F.wasmdb_setLargeValueStagingPolicy(this.__wbg_ptr,e,t,!D(n),D(n)?0:n);if(r[1])throw j(r[0])}setNonDurableClient(){let e=F.wasmdb_setNonDurableClient(this.__wbg_ptr);if(e[1])throw j(e[0])}setRemoteLinkHint(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_setRemoteLinkHint(this.__wbg_ptr,t,n);if(r[1])throw j(r[0])}setSessionClaims(e){let t=F.wasmdb_setSessionClaims(this.__wbg_ptr,e);if(t[2])throw j(t[1]);return j(t[0])}setSlowQueryThresholdMs(e){let t=F.wasmdb_setSlowQueryThresholdMs(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setTickScheduler(e){F.wasmdb_setTickScheduler(this.__wbg_ptr,e)}subscribe(e,t,n,r){let i=k(e,F.__wbindgen_malloc),a=P;var o=D(n)?0:k(n,F.__wbindgen_malloc),s=P;let c=F.wasmdb_subscribe(this.__wbg_ptr,i,a,t,o,s,r);if(c[2])throw j(c[1]);return j(c[0])}takeSlowQueryReport(e){var t=D(e)?0:A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P;let r=F.wasmdb_takeSlowQueryReport(this.__wbg_ptr,t,n);if(r[3])throw j(r[2]);var i=de(r[0],r[1]).slice();return F.__wbindgen_free(r[0],r[1]*4,4),i}tick(){return F.wasmdb_tick(this.__wbg_ptr)}update(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_update(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}updateInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=k(r,F.__wbindgen_malloc),f=P,p=F.wasmdb_updateInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}updateLargeValues(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=k(t,F.__wbindgen_malloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=F.wasmdb_updateLargeValues(this.__wbg_ptr,a,o,s,c,l,u,r,!D(i),D(i)?0:i);if(d[2])throw j(d[1]);return N.__wrap(d[0])}updateLargeValuesInTransaction(e,t,n,r,i,a){let o=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=k(n,F.__wbindgen_malloc),d=P,f=k(r,F.__wbindgen_malloc),p=P,m=F.wasmdb_updateLargeValuesInTransaction(this.__wbg_ptr,o,s,c,l,u,d,f,p,i,!D(a),D(a)?0:a);if(m[1])throw j(m[0])}uploadStatus(){let e=F.wasmdb_uploadStatus(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}upsert(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_upsert(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}upsertInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=k(r,F.__wbindgen_malloc),f=P,p=F.wasmdb_upsertInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}waitForPendingWrites(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;return F.wasmdb_waitForPendingWrites(this.__wbg_ptr,r,i,D(t)?0:S(t),D(n)?16777215:n?1:0)}wireFeatures(){return F.wasmdb_wireFeatures(this.__wbg_ptr)>>>0}},Symbol.dispose&&(xe.prototype[Symbol.dispose]=xe.prototype.free),Se=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Oe.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmpendingsubscription_free(e,0)}cancel(){F.wasmpendingsubscription_cancel(this.__wbg_ptr)}poll(){let e=F.wasmpendingsubscription_poll(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}setWake(e){F.wasmpendingsubscription_setWake(this.__wbg_ptr,e)}},Symbol.dispose&&(Se.prototype[Symbol.dispose]=Se.prototype.free),Ce=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ke.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ke.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmpermissionadvicerequest_free(e,0)}cancel(){F.wasmpermissionadvicerequest_cancel(this.__wbg_ptr)}get promise(){return F.wasmpermissionadvicerequest_promise(this.__wbg_ptr)}},Symbol.dispose&&(Ce.prototype[Symbol.dispose]=Ce.prototype.free),M=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,je.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,je.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmtransport_free(e,0)}auxiliaryOutboundReady(){return F.wasmtransport_auxiliaryOutboundReady(this.__wbg_ptr)}auxiliaryReceiveTimeoutMs(){let e=F.wasmtransport_auxiliaryReceiveTimeoutMs(this.__wbg_ptr);return e===4294967297?void 0:e}clearOutboundScheduler(){F.wasmtransport_clearOutboundScheduler(this.__wbg_ptr)}close(){return F.wasmtransport_close(this.__wbg_ptr)!==0}expireAuxiliaryReceive(){F.wasmtransport_expireAuxiliaryReceive(this.__wbg_ptr)}recvAuxiliaryWireFrames(e,t){return F.wasmtransport_recvAuxiliaryWireFrames(this.__wbg_ptr,D(e)?4294967297:e>>>0,D(t)?4294967297:t>>>0)}recvWireFrames(){return F.wasmtransport_recvWireFrames(this.__wbg_ptr)}routeAuxiliaryWireFrame(e){let t=k(e,F.__wbindgen_malloc),n=P;return F.wasmtransport_routeAuxiliaryWireFrame(this.__wbg_ptr,t,n)}sendWireFrame(e){let t=k(e,F.__wbindgen_malloc),n=P;F.wasmtransport_sendWireFrame(this.__wbg_ptr,t,n)}sendWireFrames(e){F.wasmtransport_sendWireFrames(this.__wbg_ptr,e)}setAuxiliaryTraceEnabled(e){F.wasmtransport_setAuxiliaryTraceEnabled(this.__wbg_ptr,e)}setOutboundScheduler(e){F.wasmtransport_setOutboundScheduler(this.__wbg_ptr,e)}takeAuxiliaryTrace(){return F.wasmtransport_takeAuxiliaryTrace(this.__wbg_ptr)}tick(){return F.wasmtransport_tick(this.__wbg_ptr)}updateAuthenticatedClaims(e){let t=F.wasmtransport_updateAuthenticatedClaims(this.__wbg_ptr,e);if(t[2])throw j(t[1]);return j(t[0])}upstreamRefusal(){return F.wasmtransport_upstreamRefusal(this.__wbg_ptr)}},Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free),N=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ne.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ne.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmwrite_free(e,0)}close(){return F.wasmwrite_close(this.__wbg_ptr)!==0}get payload(){let e=F.wasmwrite_payload(this.__wbg_ptr);var t=C(e[0],e[1]).slice();return F.__wbindgen_free(e[0],e[1]*1,1),t}get rowId(){let e=F.wasmwrite_rowId(this.__wbg_ptr);var t=C(e[0],e[1]).slice();return F.__wbindgen_free(e[0],e[1]*1,1),t}get txId(){let e,t;try{let n=F.wasmwrite_txId(this.__wbg_ptr);return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}wait(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=F.wasmwrite_wait(this.__wbg_ptr,n,r,D(t)?16777215:t?1:0);if(i[2])throw j(i[1]);return j(i[0])}writeState(){let e=F.wasmwrite_writeState(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}},Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free),we=[`pending`,`done`],Te=[`readonly`,`readwrite`,`versionchange`,`readwriteflush`,`cleanup`],Ee=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmdb_free(e>>>0,1)),De=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_pendingnativeread_free(e>>>0,1)),Oe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmpendingsubscription_free(e>>>0,1)),ke=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmpermissionadvicerequest_free(e>>>0,1)),Ae=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_streamingmutation_free(e>>>0,1)),je=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmtransport_free(e>>>0,1)),Me=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_upstreamlink_free(e>>>0,1)),Ne=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmwrite_free(e>>>0,1)),Pe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbindgen_destroy_closure(e.a,e.b)),Fe=null,Ie=null,Le=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),Le.decode(),Re=2146435072,ze=0,Be=new TextEncoder,`encodeInto`in Be||(Be.encodeInto=function(e,t){let n=Be.encode(e);return t.set(n),{read:e.length,written:n.length}}),P=0}}),Ue,We=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/OTLPExporterBase.js"(){Ue=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}}}),Ge,Ke=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js"(){Ge=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}}}});function qe(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Je(e){if(e!=null)return async()=>e}function Ye(e,t,n){return{timeoutMillis:qe(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function Xe(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Ze=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/shared-configuration.js"(){}});function Qe(e){return new $e(e.concurrencyLimit)}var $e,et=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/bounded-queue-export-promise-handler.js"(){$e=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}}}),tt,nt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js"(){tt=`1.9.1`}});function rt(e){let t=new Set([e]),n=new Set,r=e.match(it);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(it);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var it,at,ot=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js"(){nt(),it=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,at=rt(tt)}});function st(e,t,n,r=!1){let i=ft[dt]=ft[dt]??{version:tt};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==tt){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${tt}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${tt}.`),!0}function ct(e){let t=ft[dt]?.version;if(!(!t||!at(t)))return ft[dt]?.[e]}function lt(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${tt}.`);let n=ft[dt];n&&delete n[e]}var ut,dt,ft,pt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"(){nt(),ot(),ut=tt.split(`.`)[0],dt=Symbol.for(`opentelemetry.js.api.${ut}`),ft=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}});function mt(e,t,n){let r=ct(`diag`);if(r)return r[e](t,...n)}var ht,gt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"(){pt(),ht=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return mt(`debug`,this._namespace,e)}error(...e){return mt(`error`,this._namespace,e)}info(...e){return mt(`info`,this._namespace,e)}warn(...e){return mt(`warn`,this._namespace,e)}verbose(...e){return mt(`verbose`,this._namespace,e)}}}}),I,_t=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js"(){(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(I||={})}});function vt(e,t){e<I.NONE?e=I.NONE:e>I.ALL&&(e=I.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,I.ERROR),warn:n(`warn`,I.WARN),info:n(`info`,I.INFO),debug:n(`debug`,I.DEBUG),verbose:n(`verbose`,I.VERBOSE)}}var yt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"(){_t()}}),bt,xt,St=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js"(){gt(),yt(),_t(),pt(),bt=`diag`,xt=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=ct(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:I.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=ct(`diag`),i=vt(n.logLevel??I.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return st(`diag`,i,t,!0)},t.disable=()=>{lt(bt,t)},t.createComponentLogger=e=>new ht(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}});function Ct(e){return Symbol.for(e)}var wt,Tt,Et=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js"(){wt=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Tt=new wt}});function Dt(){return Rt}var Ot,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js"(){Ot=class{constructor(){}createGauge(e,t){return Bt}createHistogram(e,t){return Vt}createCounter(e,t){return zt}createUpDownCounter(e,t){return Ht}createObservableGauge(e,t){return Wt}createObservableCounter(e,t){return Ut}createObservableUpDownCounter(e,t){return Gt}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},kt=class{},At=class extends kt{add(e,t){}},jt=class extends kt{add(e,t){}},Mt=class extends kt{record(e,t){}},Nt=class extends kt{record(e,t){}},Pt=class{addCallback(e){}removeCallback(e){}},Ft=class extends Pt{},It=class extends Pt{},Lt=class extends Pt{},Rt=new Ot,zt=new At,Bt=new Mt,Vt=new Nt,Ht=new jt,Ut=new Ft,Wt=new It,Gt=new Lt}}),qt,Jt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"(){Et(),qt=class{active(){return Tt}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}}}),Yt,Xt,Zt,Qt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js"(){Jt(),pt(),St(),Yt=`context`,Xt=new qt,Zt=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return st(Yt,e,xt.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return ct(Yt)||Xt}disable(){this._getContextManager().disable(),lt(Yt,xt.instance())}}}}),L,$t=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js"(){(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(L||={})}}),en,tn,nn,rn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js"(){$t(),en=`0000000000000000`,tn=`00000000000000000000000000000000`,nn={traceId:tn,spanId:en,traceFlags:L.NONE}}}),an,on=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js"(){rn(),an=class{constructor(e=nn){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}});function sn(e){return e.getValue(pn)||void 0}function cn(){return sn(Zt.getInstance().active())}function ln(e,t){return e.setValue(pn,t)}function un(e){return e.deleteValue(pn)}function dn(e,t){return ln(e,new an(t))}function fn(e){return sn(e)?.spanContext()}var pn,mn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js"(){Et(),on(),Qt(),pn=Ct(`OpenTelemetry Context Key SPAN`)}});function hn(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(bn[e.charCodeAt(t)]|0)+(bn[e.charCodeAt(t+1)]|0)+(bn[e.charCodeAt(t+2)]|0)+(bn[e.charCodeAt(t+3)]|0);return n===t}function gn(e){return hn(e,32)&&e!==tn}function _n(e){return hn(e,16)&&e!==en}function vn(e){return gn(e.traceId)&&_n(e.spanId)}function yn(e){return new an(e)}var bn,xn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js"(){rn(),on(),bn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}});function Sn(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Cn,wn,Tn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js"(){Qt(),mn(),on(),xn(),Cn=Zt.getInstance(),wn=class{startSpan(e,t,n=Cn.active()){if(t?.root)return new an;let r=n&&fn(n);return Sn(r)&&vn(r)?new an(r):new an}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Cn.active(),c=this.startSpan(e,i,s),l=ln(s,c);return Cn.with(l,o,void 0,c)}}}}),En,Dn,On=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js"(){Tn(),En=new wn,Dn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):En}}}}),kn,An=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js"(){Tn(),kn=class{getTracer(e,t,n){return new wn}}}}),jn,Mn,Nn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js"(){On(),An(),jn=new kn,Mn=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Dn(this,e,t,n)}getDelegate(){return this._delegate??jn}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}}}),Pn,Fn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js"(){(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Pn||={})}}),In,Ln=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js"(){(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(In||={})}}),Rn,zn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js"(){(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Rn||={})}}),R,Bn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js"(){Qt(),R=Zt.getInstance()}}),z,Vn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag-api.js"(){St(),z=xt.instance()}}),Hn,Un,Wn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js"(){pt(),Nn(),xn(),mn(),St(),Hn=`trace`,Un=class e{constructor(){this._proxyTracerProvider=new Mn,this.wrapSpanContext=yn,this.isSpanContextValid=vn,this.deleteSpan=un,this.getSpan=sn,this.getActiveSpan=cn,this.getSpanContext=fn,this.setSpan=ln,this.setSpanContext=dn}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=st(Hn,this._proxyTracerProvider,xt.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return ct(Hn)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){lt(Hn,xt.instance()),this._proxyTracerProvider=new Mn}}}}),Gn,Kn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js"(){Wn(),Gn=Un.getInstance()}}),B=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/index.js"(){Et(),Kt(),Fn(),Ln(),zn(),$t(),xn(),rn(),Bn(),Vn(),Kn()}});function qn(e){return e.setValue(Yn,!0)}function Jn(e){return e.getValue(Yn)===!0}var Yn,Xn=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js"(){B(),Yn=Ct(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}});function Zn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Qn(n)){z.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!$n(r)){z.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Qn(e){return typeof e==`string`&&e!==``}function $n(e){return e==null?!0:Array.isArray(e)?er(e):tr(typeof e)}function er(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(tr(e)){t=e;continue}return!1}return!1}}return!0}function tr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var nr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/attributes.js"(){B()}});function rr(){return e=>{z.error(ir(e))}}function ir(e){return typeof e==`string`?e:JSON.stringify(ar(e))}function ar(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var or=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js"(){B()}});function V(e){try{sr(e)}catch{}}var sr,cr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js"(){or(),sr=rr()}}),lr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js"(){}}),ur,dr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/version.js"(){ur=`2.7.1`}}),fr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),pr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){fr()}}),mr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),hr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){mr()}}),gr,_r,vr,yr,br=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){gr=`telemetry.sdk.language`,_r=`webjs`,vr=`telemetry.sdk.name`,yr=`telemetry.sdk.version`}}),xr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),Sr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),Cr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){pr(),hr(),br(),xr(),Sr()}}),wr,Tr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/semconv.js"(){wr=`process.runtime.name`}}),Er,Dr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js"(){dr(),Cr(),Tr(),Er={[vr]:`opentelemetry`,[wr]:`browser`,[gr]:_r,[yr]:ur}}}),Or,kr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"(){lr(),Dr(),Or=performance}});function Ar(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Vr)]}function jr(e){return Rr(Ar(Or.timeOrigin),Ar(typeof e==`number`?e:Or.now()))}function Mr(e){if(Ir(e))return e;if(typeof e==`number`)return e<Or.timeOrigin?jr(e):Ar(e);if(e instanceof Date)return Ar(e.getTime());throw TypeError(`Invalid input type`)}function Nr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Hr),[n,r]}function Pr(e){return e[0]*Hr+e[1]}function Fr(e){return e[0]*1e6+e[1]/1e3}function Ir(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Lr(e){return Ir(e)||typeof e==`number`||e instanceof Date}function Rr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Hr&&(n[1]-=Hr,n[0]+=1),n}var zr,Br,Vr,Hr,Ur=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js"(){kr(),zr=9,Br=6,Vr=10**Br,Hr=10**zr}}),H,Wr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/ExportResult.js"(){(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(H||={})}});function Gr(e){if(!Kr(e)||qr(e)!==Xr)return!1;let t=ni(e);if(t===null)return!0;let n=ii.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ei.call(n)===ti}function Kr(e){return typeof e==`object`&&!!e}function qr(e){return e==null?e===void 0?Qr:Zr:ai&&ai in Object(e)?Jr(e):Yr(e)}function Jr(e){let t=ii.call(e,ai),n=e[ai],r=!1;try{e[ai]=void 0,r=!0}catch{}let i=oi.call(e);return r&&(t?e[ai]=n:delete e[ai]),i}function Yr(e){return oi.call(e)}var Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js"(){Xr=`[object Object]`,Zr=`[object Null]`,Qr=`[object Undefined]`,$r=Function.prototype,ei=$r.toString,ti=ei.call(Object),ni=Object.getPrototypeOf,ri=Object.prototype,ii=ri.hasOwnProperty,ai=Symbol?Symbol.toStringTag:void 0,oi=ri.toString}});function ci(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ui(t,e.shift(),0,n);return t}function li(e){return fi(e)?e.slice():e}function ui(e,t,n=0,r){let i;if(!(n>_i)){if(n++,hi(e)||hi(t)||pi(t))i=li(t);else if(fi(e)){if(i=e.slice(),fi(t))for(let e=0,n=t.length;e<n;e++)i.push(li(t[e]));else if(mi(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=li(t[r]))}}}else if(mi(e))if(mi(t)){if(!gi(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(hi(c))typeof c>`u`?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(di(e,s,r)||di(t,s,r))delete i[s];else{if(mi(a)&&mi(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=ui(i[s],c,n,r)}}}}else i=t;return i}}function di(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function fi(e){return Array.isArray(e)}function pi(e){return typeof e==`function`}function mi(e){return!hi(e)&&!fi(e)&&!pi(e)&&typeof e==`object`}function hi(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e>`u`||e instanceof Date||e instanceof RegExp||e===null}function gi(e,t){return!(!Gr(e)||!Gr(t))}var _i,vi=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/merge.js"(){si(),_i=20}});function yi(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new bi(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var bi,xi=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/timeout.js"(){bi=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}}),Si,Ci=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/promise.js"(){Si=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}}}),wi,Ti=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/callback.js"(){Ci(),wi=class{_isCalled=!1;_deferred=new Si;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}});function Ei(e,t){return new Promise(n=>{R.with(qn(R.active()),()=>{e.export(t,n)})})}var Di=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/exporter.js"(){B(),Xn()}}),Oi,U=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/index.js"(){nr(),cr(),Ur(),Wr(),kr(),Xn(),vi(),xi(),Ti(),Di(),Oi={_export:Ei}}});function ki(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Ai(){return{handleResponse(e){e==null||!ki(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||z.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var ji=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/logging-response-handler.js"(){B()}});function Mi(e,t){return new Ni(e.transport,e.serializer,Ai(),e.promiseHandler,t.timeout)}var Ni,Pi=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js"(){U(),Ke(),ji(),B(),Ni=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=z.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:H.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:H.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:H.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:H.FAILED,error:e.error});return}else e.status===`retryable`?t({code:H.FAILED,error:e.error??new Ge(`Export failed with retryable status`)}):t({code:H.FAILED,error:new Ge(`Export failed with unknown error`)})},e=>t({code:H.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}}}});function Fi(e,t,n){return Mi({transport:n,serializer:t,promiseHandler:Qe(e)},{timeout:e.timeoutMillis})}var Ii=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-network-export-delegate.js"(){et(),Pi()}}),Li=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js"(){We()}}),Ri,zi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/types/LogRecord.js"(){(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(Ri||={})}}),Bi,Vi,Hi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js"(){Bi=class{emit(e){}enabled(){return!1}},Vi=new Bi}});function Ui(e,t,n){return r=>r===e?t:n}var Wi,Gi,Ki,qi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js"(){Wi=Symbol.for(`io.opentelemetry.js.api.logs`),Gi=globalThis,Ki=1}}),Ji,Yi,Xi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js"(){Hi(),Ji=class{getLogger(e,t,n){return new Bi}},Yi=new Ji}}),Zi,Qi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js"(){Hi(),Zi=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Vi}}}}),$i,ea=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js"(){Xi(),Qi(),$i=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Zi(this,e,t,n)}_getDelegate(){return this._delegate??Yi}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}}}),ta,na=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js"(){qi(),Xi(),ea(),ta=class e{constructor(){this._proxyLoggerProvider=new $i}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return Gi[Wi]?this.getLoggerProvider():(Gi[Wi]=Ui(Ki,e,Yi),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return Gi[Wi]?.call(Gi,Ki)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Gi[Wi],this._proxyLoggerProvider=new $i}}}}),ra=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/index.js"(){zi(),Hi(),na(),ta.getInstance()}}),ia=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),aa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){ia()}}),oa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),sa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){oa()}}),ca,la,ua,da,fa,pa,ma,ha=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){ca=`exception.message`,la=`exception.stacktrace`,ua=`exception.type`,da=`service.name`,fa=`telemetry.sdk.language`,pa=`telemetry.sdk.name`,ma=`telemetry.sdk.version`}}),ga=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),_a=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),va=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){aa(),sa(),ha(),ga(),_a()}});function ya(){if(ba===void 0)try{let e=globalThis.process.argv0;ba=e?`unknown_service:${e}`:`unknown_service`}catch{ba=`unknown_service`}return ba}var ba,xa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js"(){}}),Sa,Ca=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js"(){Sa=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}});function wa(e,t){return ja.FromAttributeList(Object.entries(e),t)}function Ta(e,t){return new ja(e,t)}function Ea(){return wa({})}function Da(){return wa({[da]:ya(),[fa]:Er[fa],[pa]:Er[pa],[ma]:Er[ma]})}function Oa(e){return e.map(([e,t])=>Sa(t)?[e,t.catch(t=>{z.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ka(e){if(typeof e==`string`||e===void 0)return e;z.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Aa(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;z.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var ja,Ma=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js"(){B(),U(),va(),xa(),Ca(),ja=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Oa(t),r._asyncAttributesPending=t.filter(([e,t])=>Sa(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Sa(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Oa(this._rawAttributes),this._schemaUrl=ka(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Sa(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&z.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Sa(n)){z.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Aa(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}}}),Na,Pa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detect-resources.js"(){B(),Ma(),Na=(e={})=>(e.detectors||[]).map(t=>{try{let n=Ta(t.detect(e));return z.debug(`${t.constructor.name} found resource.`,n),n}catch(e){return z.debug(`${t.constructor.name} failed: ${e.message}`),Ea()}}).reduce((e,t)=>e.merge(t),Ea())}}),Fa,Ia,La=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js"(){B(),va(),U(),Fa=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(e){return{attributes:{}}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`)}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},Ia=new Fa}}),Ra,za,Ba=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/NoopDetector.js"(){Ra=class{detect(){return{attributes:{}}}},za=new Ra}}),Va,Ha=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/HostDetector.js"(){Ba(),Va=za}}),Ua,Wa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/OSDetector.js"(){Ba(),Ua=za}}),Ga,Ka=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ProcessDetector.js"(){Ba(),Ga=za}}),qa,Ja=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ServiceInstanceIdDetector.js"(){Ba(),qa=za}}),Ya=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/index.js"(){Ha(),Wa(),Ka(),Ja()}}),Xa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/index.js"(){La(),Ya()}}),Za={};r(Za,{defaultResource:()=>Da,defaultServiceName:()=>ya,detectResources:()=>Na,emptyResource:()=>Ea,envDetector:()=>Ia,hostDetector:()=>Va,osDetector:()=>Ua,processDetector:()=>Ga,resourceFromAttributes:()=>wa,serviceInstanceIdDetector:()=>qa});var Qa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/index.js"(){Pa(),Xa(),Ma(),xa()}});function $a(e,t){let n={attributes:to(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function eo(e){return{name:e.name,version:e.version}}function to(e,t){return Object.keys(e).map(n=>no(n,e[n],t))}function no(e,t,n){return{key:e,value:ro(t,n)}}function ro(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ro(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:ro(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var io=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js"(){}});function ao(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function oo(e){return ao(e).toString()}function so(e){return e}var co,lo,uo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js"(){U(),co=typeof BigInt<`u`?oo:Pr,lo={encodeHrTime:co,encodeSpanContext:so,encodeOptionalSpanContext:so,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}}}});function fo(e,t){let n=e&255|yo;return t&&(n|=bo),n}function po(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:to(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>ho(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>mo(e,t)),droppedLinksCount:e.droppedLinksCount,flags:fo(n.traceFlags,e.parentSpanContext?.isRemote)}}function mo(e,t){return{attributes:e.attributes?to(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:fo(e.context.traceFlags,e.context.isRemote)}}function ho(e,t){return{attributes:e.attributes?to(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function go(e,t){return{resourceSpans:vo(e,t)}}function _o(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function vo(e,t){let n=_o(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>po(e,t));o.push({scope:eo(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=$a(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var yo,bo,xo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js"(){io(),yo=256,bo=512}});function So(e,t){return{resourceLogs:wo(e,t)}}function Co(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function wo(e,t){let n=Co(e);return Array.from(n,([e,n])=>{let r=$a(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:eo(e[0].instrumentationScope),logRecords:e.map(e=>To(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function To(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:ro(e.body,t),eventName:e.eventName,attributes:Eo(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function Eo(e,t){return Object.keys(e).map(n=>no(n,e[n],t))}var Do=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js"(){io()}}),Oo,ko=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/logs.js"(){Do(),uo(),B(),Oo={serializeRequest:e=>{let t=So(e,lo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return z.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}}}}),Ao=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/index.js"(){ko()}}),jo,Mo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js"(){xo(),uo(),B(),jo={serializeRequest:e=>{let t=go(e,lo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return z.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}}}}),No=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/index.js"(){Mo()}}),Po=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/index.js"(){Ao(),No()}});function Fo(){return 2*Vo*Math.random()-Vo}function Io(e){return new Ho(e.transport)}var Lo,Ro,zo,Bo,Vo,Ho,Uo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/retrying-transport.js"(){B(),Lo=5,Ro=1e3,zo=5e3,Bo=1.5,Vo=.2,Ho=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Lo,r=Ro,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+Fo()),zo),0);r*=Bo;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return z.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;z.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?z.verbose(`Export succeeded after ${Lo-n} retry attempts.`):a.status===`retryable`?z.info(`Export failed after maximum retry attempts (${Lo}).`):z.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}}}});function Wo(e){return e===429||e===502||e===503||e===504}function Go(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var Ko=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js"(){}});function qo(e){return new $o(e)}function Jo(e){return e instanceof TypeError&&!e.cause}var Yo,Xo,Zo,Qo,$o,es=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/fetch-transport.js"(){B(),Ko(),Yo=60*1024,Xo=9,Zo=0,Qo=0,$o=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t),i=globalThis.fetch;typeof i.__original==`function`&&(i=i.__original);let a=e.byteLength,o=Zo+a>Yo,s=!o&&!(Qo>=Xo);if(s)Zo+=a,Qo++;else{let e=o?`size limit`:`count limit`;z.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${Qo} pending (${e})`)}try{let t=new URL(this._parameters.url),r=await i(t.href,{method:`POST`,headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:s,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return r.status>=200&&r.status<=299?(z.debug(`export response success (status: ${r.status})`),{status:`success`}):Wo(r.status)?(z.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:Go(r.headers.get(`Retry-After`))}):(z.error(`export response failure (status: ${r.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${r.status}`)})}catch(e){return Jo(e)?(z.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(z.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(r),s&&(Zo-=a,Qo--)}}shutdown(){}}}});function ts(e,t){return Fi(e,t,Io({transport:qo(e)}))}var ns=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-browser-http-export-delegate.js"(){Uo(),Ii(),es()}});function rs(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{typeof n<`u`?t[e]=String(n):z.warn(`Header "${e}" has invalid value (${n}) and will be ignored`)}),t}var is=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/util.js"(){B()}});function as(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,rs(await e())),Object.assign(i,r)}}function os(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function ss(e,t,n){return{...Ye(e,t,n),headers:as(e.headers,t.headers,n.headers),url:os(e.url)??t.url??n.url}}function cs(e,t){return{...Xe(),headers:async()=>e,url:`http://localhost:4318/`+t}}var ls=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-http-configuration.js"(){Ze(),is()}});function us(e){return typeof e.headers==`function`?e.headers:Je(e.headers)}var ds=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-http-options.js"(){Ze()}});function fs(e,t,n){return ss({url:e.url,timeoutMillis:e.timeoutMillis,headers:us(e),concurrencyLimit:e.concurrencyLimit},{},cs(n,t))}var ps=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-browser-http-options.js"(){ls(),ds()}});function ms(e,t,n,r){return ts(fs(e,n,r),t)}var hs=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/create-legacy-browser-delegate.js"(){ns(),ps()}}),gs=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index-browser-http.js"(){hs()}}),_s,vs=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/OTLPTraceExporter.js"(){Li(),Po(),gs(),_s=class extends Ue{constructor(e={}){super(ms(e,jo,`v1/traces`,{"Content-Type":`application/json`}))}}}}),ys=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/index.js"(){vs()}}),bs={};r(bs,{OTLPTraceExporter:()=>_s});var xs=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/index.js"(){ys()}}),Ss,Cs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/enums.js"(){Ss=`exception`}}),ws,Ts=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js"(){B(),U(),va(),Cs(),ws=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Rn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Or.now(),this._performanceOffset=t-(this._performanceStartTime+Or.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return z.warn(`Invalid attribute key: ${e}`),this;if(!$n(t))return z.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return z.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&z.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Lr(t)&&(Lr(n)||(n=t),t=void 0);let i=Zn(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&z.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=Zn(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Rn.UNSET||this.status.code===Rn.OK)return this;let t={code:e.code};return e.code===Rn.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&z.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){z.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=Nr(this.startTime,this.endTime),this._duration[0]<0&&(z.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&z.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&z.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=Or.now())return jr(e+this._performanceOffset);if(typeof e==`number`)return Ar(e);if(e instanceof Date)return Ar(e.getTime());if(Ir(e))return e;if(this._startTimeProvided)return Ar(Date.now());let t=Or.now()-this._performanceStartTime;return Rr(this.startTime,Ar(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[ca]=e:e&&(e.code?n[ua]=e.code.toString():e.name&&(n[ua]=e.name),e.message&&(n[ca]=e.message),e.stack&&(n[la]=e.stack)),n[ua]||n[ca]?this.addEvent(Ss,n,t):z.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);z.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(z.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}}}}),Es,Ds=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js"(){(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Es||={})}}),Os,ks=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOffSampler.js"(){Ds(),Os=class{shouldSample(){return{decision:Es.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}}}),As,js=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOnSampler.js"(){Ds(),As=class{shouldSample(){return{decision:Es.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}}}),Ms,Ns=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/ParentBasedSampler.js"(){B(),U(),ks(),js(),Ms=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(V(Error(`ParentBasedSampler must have a root sampler configured`)),new As),this._remoteParentSampled=e.remoteParentSampled??new As,this._remoteParentNotSampled=e.remoteParentNotSampled??new Os,this._localParentSampled=e.localParentSampled??new As,this._localParentNotSampled=e.localParentNotSampled??new Os}shouldSample(e,t,n,r,i,a){let o=Gn.getSpanContext(e);return!o||!vn(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&L.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&L.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}}}),Ps,Fs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/TraceIdRatioBasedSampler.js"(){B(),Ds(),Ps=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:gn(t)&&this._accumulate(t)<this._upperBound?Es.RECORD_AND_SAMPLED:Es.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}}});function Is(){return{sampler:Ls(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Ls(){let e=zs.ParentBasedAlwaysOn;switch(e){case zs.AlwaysOn:return new As;case zs.AlwaysOff:return new Os;case zs.ParentBasedAlwaysOn:return new Ms({root:new As});case zs.ParentBasedAlwaysOff:return new Ms({root:new Os});case zs.TraceIdRatio:return new Ps(Rs());case zs.ParentBasedTraceIdRatio:return new Ms({root:new Ps(Rs())});default:return z.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${zs.ParentBasedAlwaysOn}".`),new Ms({root:new As})}}function Rs(){return z.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Bs}.`),Bs}var zs,Bs,Vs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/config.js"(){B(),U(),ks(),js(),Ns(),Fs(),(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(zs||={}),Bs=1}});function Hs(e){let t={sampler:Ls()},n=Is(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function Us(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??Ws,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??Gs,Object.assign({},e,{spanLimits:t})}var Ws,Gs,Ks=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/utility.js"(){Vs(),U(),Ws=128,Gs=1/0}}),qs,Js=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js"(){B(),U(),qs=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize=typeof t?.maxExportBatchSize==`number`?t.maxExportBatchSize:512,this._maxQueueSize=typeof t?.maxQueueSize==`number`?t.maxQueueSize:2048,this._scheduledDelayMillis=typeof t?.scheduledDelayMillis==`number`?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof t?.exportTimeoutMillis==`number`?t.exportTimeoutMillis:3e4,this._shutdownOnce=new wi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(z.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&z.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(z.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);R.with(qn(R.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{clearTimeout(n),r.code===H.SUCCESS?e():t(r.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{V(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,V(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}}}),Ys,Xs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/export/BatchSpanProcessor.js"(){Js(),U(),Ys=class extends qs{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{V(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{V(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}}}});function Zs(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Qs(e){let t=``;for(let n=0;n<e.length;n++)t+=rc[e[n]];return t}var $s,ec,tc,nc,rc,ic,ac=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/RandomIdGenerator.js"(){$s=16,ec=8,tc=new Uint8Array($s),nc=new Uint8Array(ec),rc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),ic=class{generateTraceId(){return Zs(tc),Qs(tc)}generateSpanId(){return Zs(nc),Qs(nc)}}}}),oc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/index.js"(){Xs(),ac()}}),sc,cc,lc,uc,dc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/semconv.js"(){sc=`otel.span.parent.origin`,cc=`otel.span.sampling_result`,lc=`otel.sdk.span.live`,uc=`otel.sdk.span.started`}});function fc(e){return e?e.isRemote?`remote`:`local`:`none`}function pc(e){switch(e){case Es.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Es.RECORD:return`RECORD_ONLY`;case Es.NOT_RECORD:return`DROP`}}var mc,hc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/TracerMetrics.js"(){Ds(),dc(),mc=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(uc,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(lc,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=pc(t);if(this.startedSpans.add(1,{[sc]:fc(e),[cc]:n}),t===Es.NOT_RECORD)return()=>{};let r={[cc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}}}),gc,_c=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js"(){gc=`2.7.1`}}),vc,yc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js"(){B(),U(),Ts(),Ks(),oc(),hc(),_c(),vc=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,n,r){let i=Hs(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new ic,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,gc):Dt();this._tracerMetrics=new mc(a)}startSpan(e,t={},n=R.active()){t.root&&(n=Gn.deleteSpan(n));let r=Gn.getSpan(n);if(Jn(n))return z.debug(`Instrumentation suppressed, returning Noop Span`),Gn.wrapSpanContext(nn);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!Gn.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??In.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:Zn(e.attributes)})),d=Zn(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===Pn.RECORD_AND_SAMPLED?L.SAMPLED:L.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===Pn.NOT_RECORD)return z.debug(`Recording is off, propagating context in a non-recording span`),Gn.wrapSpanContext(h);let g=Zn(Object.assign(d,f.attributes));return new ws({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:g,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??R.active(),c=this.startSpan(e,i,s),l=Gn.setSpan(s,c);return R.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}}}),bc,xc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js"(){U(),bc=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{V(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}}}),Sc,Cc,wc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js"(){U(),Qa(),yc(),Vs(),xc(),Ks(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Sc||={}),Cc=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=ci({},Is(),Us(e));this._resource=t.resource??Da(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new bc(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new vc({name:e,version:t,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Sc.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Sc.timeout&&(r=Sc.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Sc.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Sc.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}}}),Tc,Ec=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/ConsoleSpanExporter.js"(){U(),Tc=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Fr(e.startTime),duration:Fr(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:H.SUCCESS})}}}}),Dc,Oc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/InMemorySpanExporter.js"(){U(),Dc=class{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:H.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...e),setTimeout(()=>t({code:H.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}}}),kc,Ac=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/SimpleSpanProcessor.js"(){B(),U(),kc=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new wi(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>V(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await Oi._export(this._exporter,[e]);if(t.code!==H.SUCCESS)throw t.error??Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),jc,Mc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/NoopSpanProcessor.js"(){jc=class{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}}}),Nc={};r(Nc,{AlwaysOffSampler:()=>Os,AlwaysOnSampler:()=>As,BasicTracerProvider:()=>Cc,BatchSpanProcessor:()=>Ys,ConsoleSpanExporter:()=>Tc,InMemorySpanExporter:()=>Dc,NoopSpanProcessor:()=>jc,ParentBasedSampler:()=>Ms,RandomIdGenerator:()=>ic,SamplingDecision:()=>Es,SimpleSpanProcessor:()=>kc,TraceIdRatioBasedSampler:()=>Ps});var Pc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/index.js"(){wc(),oc(),Ec(),Oc(),Ac(),Mc(),ks(),js(),Ns(),Fs(),Ds()}}),Fc,Ic=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/browser/OTLPLogExporter.js"(){Li(),Po(),gs(),Fc=class extends Ue{constructor(e={}){super(ms(e,Oo,`v1/logs`,{"Content-Type":`application/json`}))}}}}),Lc=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/browser/index.js"(){Ic()}}),Rc={};r(Rc,{OTLPLogExporter:()=>Fc});var zc=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/index.js"(){Lc()}});function Bc(e){return Vc(e,new WeakSet)}function Vc(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Vc(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Vc(e,t))}return!1}var Hc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js"(){}}),Uc,Wc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js"(){B(),U(),va(),Hc(),Uc=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=Mr(r??f),this.hrTimeObserved=Mr(i??f),d){let e=Gn.getSpanContext(d);e&&vn(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return z.warn(`Invalid attribute key: ${e}`),this;if(!Bc(t))return z.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&z.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return z.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,ca)||this.setAttribute(ca,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,ua)||this.setAttribute(ua,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,ua)||this.setAttribute(ua,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,ca)||this.setAttribute(ca,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,la)||this.setAttribute(la,n.stack),t=!0)}t||z.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&z.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}}}),Gc,Kc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js"(){ra(),B(),Wc(),Gc=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||R.active(),r=e.severityNumber??Ri.UNSPECIFIED;if(r!==Ri.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=Gn.getSpanContext(n);if(e&&vn(e)&&(e.traceFlags&L.SAMPLED)!==L.SAMPLED)return}let i=new Uc(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Ri.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||R.active();if(t.traceBased){let e=Gn.getSpanContext(r);if(e&&vn(e)&&(e.traceFlags&L.SAMPLED)!==L.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}}}),qc,Jc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/NoopLogRecordProcessor.js"(){qc=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}}}),Yc,Xc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/MultiLogRecordProcessor.js"(){U(),Yc=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>yi(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}});function Zc(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Qc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js"(){}}),$c,el=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/semconv.js"(){$c=`otel.sdk.log.created`}}),tl,nl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerMetrics.js"(){el(),tl=class{createdLogs;constructor(e){this.createdLogs=e.createCounter($c,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}}}),rl,il=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/version.js"(){rl=`0.216.0`}}),al,ol,sl,cl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js"(){B(),ra(),Jc(),Xc(),Qc(),nl(),il(),al={disabled:!1,minimumSeverity:Ri.UNSPECIFIED,traceBased:!1},ol=()=>({...al}),sl=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,n,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Yc(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new qc,this._loggerConfigurator=i??ol;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,rl):Dt();this.loggerMetrics=new tl(o)}getLoggerConfig(e){let t=Zc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}}}),ll,ul,dl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js"(){B(),ra(),Qa(),U(),Kc(),cl(),ll=`unknown`,ul=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??Da(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??ol,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new sl(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new wi(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return z.warn(`A shutdown LoggerProvider cannot provide a Logger`),Vi;e||z.warn(`Logger requested without instrumentation scope name.`);let r=e||ll,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Gc({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(z.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(z.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}}}),fl,pl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/ConsoleLogRecordExporter.js"(){U(),fl=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:Fr(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:H.SUCCESS})}}}}),ml,hl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js"(){U(),ml=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new wi(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let t=()=>Oi._export(this._exporter,[e]).then(e=>{e.code!==H.SUCCESS&&V(e.error??Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(V);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),t()),V);n!=null&&this._unresolvedExports.add(n)}else t()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),gl,_l=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/InMemoryLogRecordExporter.js"(){U(),gl=class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:H.FAILED,error:Error(`Exporter has been stopped`)});this._finishedLogRecords.push(...e),t({code:H.SUCCESS})}async shutdown(){this._stopped=!0,this.reset()}async forceFlush(){}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}}}});async function vl(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var yl,bl,xl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/BatchLogRecordProcessorBase.js"(){B(),U(),yl=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(e,t,n){this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await vl(t),await R.with(qn(R.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){V(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===H.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},bl=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new wi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(z.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new yl(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){V(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new yl(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,V(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}}}),Sl,Cl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/platform/browser/export/BatchLogRecordProcessor.js"(){xl(),Sl=class extends bl{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){e?.disableAutoFlushOnDocumentHide===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}}}}),wl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/platform/browser/index.js"(){Cl()}});function Tl(e){return t=>{let n=t.name;for(let{pattern:t,config:r}of e)if(El(n,t))return{disabled:r.disabled??Dl.disabled,minimumSeverity:r.minimumSeverity??Dl.minimumSeverity,traceBased:r.traceBased??Dl.traceBased};return{...Dl}}}function El(e,t){if(t===e)return!0;if(t.includes(`*`)){let n=t.split(`*`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`.*`);return RegExp(`^${n}$`).test(e)}return!1}var Dl,Ol=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/config/LoggerConfigurators.js"(){ra(),Dl={disabled:!1,minimumSeverity:Ri.UNSPECIFIED,traceBased:!1}}}),kl={};r(kl,{BatchLogRecordProcessor:()=>Sl,ConsoleLogRecordExporter:()=>fl,InMemoryLogRecordExporter:()=>gl,LoggerProvider:()=>ul,SimpleLogRecordProcessor:()=>ml,createLoggerConfigurator:()=>Tl});var Al=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/index.js"(){dl(),pl(),hl(),_l(),wl(),Ol()}}),jl;function Ml(e){if(globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(new Uint8Array(e));if(jl){let t=jl();if(!(t instanceof Uint8Array)||t.byteLength<e)throw Error(`Native runtime entropy returned fewer than ${e*8} bits`);return t.slice(0,e)}throw Error(`Jazz requires a cryptographically secure runtime entropy source`)}function Nl(e=Ml(16)){let t=e.slice(0,16);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}function Pl(e=()=>Ml(16)){for(;;){let t=e(),n=new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,!0);if(n!==0n)return n}}var Fl=`jazz-snapshot-v1:`,Il=72,Ll=48,Rl=class extends Error{name=`SnapshotRefFormatError`;code=`invalid_snapshot_ref`;constructor(){super(`Invalid or unsupported snapshot reference`)}};function zl(e){if(typeof e!=`string`||!e.startsWith(Fl))throw new Rl;let t=e.slice(Fl.length);if(t.length<Il||!/^[0-9a-f]+$/.test(t))throw new Rl;let n=0;for(let e=0;e<4;e++)n+=parseInt(t.slice(64+e*2,66+e*2),16)*2**(e*8);if(t.length!==Il+n*Ll)throw new Rl;return e}var Bl=class extends Error{name=`UnsupportedSnapshotError`;code=`unsupported_snapshot`;constructor(e=`Capturing snapshots is not supported by this runtime yet`){super(e)}},Vl=class{native;fatal;constructor(e={}){this.fatal=e.fatal??!1,this.native=typeof globalThis.TextDecoder==`function`?new globalThis.TextDecoder(`utf-8`,e):void 0}decode(e=new Uint8Array){if(this.native)return this.native.decode(e);let t=e instanceof Uint8Array?e:new Uint8Array(e),n=[],r=[],i=!1,a=e=>{!i&&(i=!0,e===``)||(r.push(e),r.length===4096&&(n.push(r.join(``)),r=[]))},o=()=>{if(this.fatal)throw TypeError(`The encoded data was not valid UTF-8`);a(`�`)},s=0,c=0,l=128,u=191;for(let e=0;e<t.length;e++){let n=t[e];c===0?n<=127?a(String.fromCharCode(n)):n>=194&&n<=223?(c=1,s=n&31):n>=224&&n<=239?(c=2,s=n&15,n===224&&(l=160),n===237&&(u=159)):n>=240&&n<=244?(c=3,s=n&7,n===240&&(l=144),n===244&&(u=143)):o():n<l||n>u?(c=0,l=128,u=191,o(),e--):(l=128,u=191,s=s<<6|n&63,--c===0&&a(String.fromCodePoint(s)))}return c!==0&&o(),r.length&&n.push(r.join(``)),n.join(``)}};function Hl(e){return e instanceof Error?e:Error(String(e))}function Ul(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wl(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}var Gl=new Vl({fatal:!0});function Kl(e){try{return Gl.decode(e),!0}catch{return!1}}function ql(e,t){if(t instanceof Uint8Array)return Array.from(t);if(typeof t==`bigint`)return t.toString();if(typeof t==`number`&&!Number.isFinite(t))throw Error(`Cannot serialize non-finite number in schema JSON (key "${e}"): ${t}.`);return t}function Jl(e){return Object.fromEntries(Object.keys(e).sort().map(t=>[t,e[t]]))}function Yl(e,t){return JSON.stringify({tables:Jl(e),...t?{migrations:t}:{}},ql)}function Xl(e,t){let n={__jazzRuntimeSchema:1,schema:Jl(e),loadedPolicyBundle:t?.loadedPolicyBundle??!1};return JSON.stringify(n,ql)}new Vl({fatal:!0});function Zl(e){let t=!1;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319){let r=e.charCodeAt(n+1);if(Number.isNaN(r)||r<56320||r>57343)return!1;t=!0,n+=1;continue}if(r>=56320&&r<=57343)return!1;r!==32&&(r<9||r>13)&&(t=!0)}return t}function Ql(e){return Zl(e)}function $l(e,t,n){if(typeof e!=`string`)throw Error(`Author identity is missing an issuer`);if(typeof t!=`string`)throw Error(`Author identity is missing a subject`);if(!Zl(e)||!Zl(t))throw Error(`Author issuer and subject must be portable and nonempty`);if(n!==void 0&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(n))throw Error(`Author account must be a canonical UUID`);return JSON.stringify(n===void 0?[e,t]:[n,e,t])}function eu(e){try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2&&t.length!==3)return null;let n=t.length===3?t[0]:void 0;if(n!==void 0&&typeof n!=`string`)return null;let[r,i]=t.slice(t.length===3?1:0);if(typeof r!=`string`||typeof i!=`string`)return null;let a=$l(r,i,n);return e===a?{...n===void 0?{}:{account_id:n},issuer:r,user_id:i,canonical:a}:null}catch{return null}}function tu(e){return new TextEncoder().encode($l(e.issuer,e.user_id,e.account_id))}function nu(e){if(e.type!==`Row`||e.value.values.length!==2)throw Error(`invalid structured author record`);let[t,n]=e.value.values;if(t?.type!==`Uuid`||n?.type!==`Row`||n.value.values.length!==2)throw Error(`invalid structured author record`);let[r,i]=n.value.values;if(r?.type!==`Text`||i?.type!==`Text`)throw Error(`invalid structured author identity`);$l(r.value,i.value,t.value)}var ru=`urn:jazz:local-first`,iu=`urn:jazz:anonymous`,au=`urn:jazz:system`,ou=[au,ru,`urn:jazz:static-bearer`,iu];function su(e){return ou.includes(e)}var cu=`__jazz_trusted_reserved_session`,lu=new WeakSet,uu=new WeakMap,du=new Map;function fu(){let e=Ml(16);return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function pu(e){return su(e.issuer)&&lu.add(e),e}function mu(e){if(!lu.has(e)||!su(e.issuer))return;let t=uu.get(e);return t||(t=fu(),uu.set(e,t)),du.set(t,{account_id:e.account_id,issuer:e.issuer,user_id:e.user_id,authMode:e.authMode}),t}function hu(e,t){if(!su(e.issuer)||typeof t!=`string`)return!1;let n=du.get(t);return n?.issuer===e.issuer&&n.account_id===e.account_id&&n.user_id===e.user_id&&n.authMode===e.authMode}var gu=new Set([`sub`,`exp`,`nbf`,`iat`,`iss`,`aud`,`jti`]);function _u(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):Array.isArray(e)?e.every(_u):Ul(e)&&Object.values(e).every(_u)}function vu(e){let t=Object.create(null);for(let[n,r]of Object.entries(e).sort(yu))!gu.has(n)&&_u(r)&&(t[n]=r);return t}function yu([e],[t]){let n=new TextEncoder().encode(e),r=new TextEncoder().encode(t);for(let e=0;e<Math.min(n.length,r.length);e+=1){let t=n[e]-r[e];if(t!==0)return t}return n.length-r.length}function bu(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function xu(){return globalThis.Buffer}function Su(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===0?t:t+`=`.repeat(4-n)}function Cu(e){let t=xu();if(t)try{return t.from(e,`base64`).toString(`utf8`)}catch{return null}if(typeof atob==`function`)try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return new Vl().decode(n)}catch{return null}return null}function wu(e){let t=bu(e);if(!t)return null;let n=t.split(`.`);if(n.length<2)return null;let r=n[1];if(r===void 0)return null;let i=Cu(Su(r));if(!i)return null;try{let e=JSON.parse(i);return Ul(e)?e:null}catch{return null}}function Tu(e){return e!==`disabled`&&e!==`revoked`}var Eu=new Set([`expired`,`missing`,`invalid`,`disabled`,`revoked`]);function Du(e){if(Eu.has(e))return e;let t=e.toLowerCase();return t.includes(`expired`)?`expired`:t.includes(`missing`)?`missing`:t.includes(`disabled`)?`disabled`:t.includes(`revoked`)?`revoked`:`invalid`}var W=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ou(e){let t=``;for(let n=0;n<e.length;n++)t+=W[e[n]&255];return t}function ku(e,t){return W[e[t]&255]+W[e[t+1]&255]+W[e[t+2]&255]+W[e[t+3]&255]+`-`+W[e[t+4]&255]+W[e[t+5]&255]+`-`+W[e[t+6]&255]+W[e[t+7]&255]+`-`+W[e[t+8]&255]+W[e[t+9]&255]+`-`+W[e[t+10]&255]+W[e[t+11]&255]+W[e[t+12]&255]+W[e[t+13]&255]+W[e[t+14]&255]+W[e[t+15]&255]}var Au=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,ju=/^[0-9a-fA-F]{32}$/;function Mu(e){if(!Au.test(e)&&!ju.test(e))return;let t=e.replaceAll(`-`,``),n=new Uint8Array(16);for(let e=0;e<16;e+=1)n[e]=Number.parseInt(t.slice(e*2,e*2+2),16);return n}function Nu(e){return ku(e,0)}var Pu=new Map;function Fu(e){if(Pu.size!==0)try{return Pu.get(new URL(e).host)}catch{return}}function Iu(e){return Fu(e)?.fetch??globalThis.fetch}function Lu(e){return Fu(e)?.WebSocket}function Ru(){let e=Ml(16),t=Date.now();return e[0]=Math.floor(t/2**40)&255,e[1]=Math.floor(t/2**32)&255,e[2]=Math.floor(t/2**24)&255,e[3]=Math.floor(t/2**16)&255,e[4]=Math.floor(t/2**8)&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128,[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function zu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`}function Bu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`||t===`blob:`}function Vu(e){return new URL(`/`,e).href}function Hu(e,t){try{return new URL(e).href}catch{}if(t)try{return new URL(e,t).href}catch{}return e}function Uu(e,t){if(!t?.wasmVersion)return e;try{let n=new URL(e);return n.searchParams.set(`jazz-runtime-version`,t.wasmVersion),n.href}catch{return e}}function Wu(e,t){try{return new URL(e).href}catch{}return t?new URL(e,t).href:null}function Gu(e,t,n){return!t||zu(e)||!n&&Bu(t)?null:new URL(`jazz_wasm_bg.wasm`,Vu(t)).href}function Ku(e){return e?.wasmModule?{module:e.wasmModule}:e?.wasmSource?{module:e.wasmSource}:null}function qu(e,t,n){if(n?.wasmUrl)return Uu(Hu(n.wasmUrl,t),n);if(n?.baseUrl){let e=Wu(n.baseUrl,t);if(e)return Uu(new URL(`jazz_wasm_bg.wasm`,e).href,n)}return Gu(typeof e==`function`?e():e,t,!1)}var Ju={napi:`293b3c4ee11055c99bd31d3b6f532991c45407a3509436dec7ff3f45505d5e45`,wasm:`ea0408b6249e4383ff90c9554149de9dc9ddee467b464fb33b913b7e4214c5d0`};function Yu(e,t,n=[]){let r=Ju[t.toLowerCase()];if(typeof e.nativeArtifactFingerprint!=`function`)throw Error(`Jazz ${t} artifact is stale or incompatible: missing nativeArtifactFingerprint (expected ${r}). In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`);let i=e.nativeArtifactFingerprint();if(i!==r)throw Error(`Jazz ${t} artifact ABI mismatch: expected ${r}, got ${String(i)}. In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`);for(let r of n)if(typeof e[r]!=`function`)throw Error(`Jazz ${t} artifact is incomplete despite matching fingerprint: missing ${r}.`)}var Xu=class extends Error{},Zu=class extends Error{},Qu=new Set(`\\.+*?()|[]{}^$#&-~`),$u=new Set(`imsUuRx`),ed=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]);function td(e){return Qu.has(e)?!0:e.codePointAt(0)>127?!1:!/[0-9A-Za-z<>]/.test(e)}var nd=class{constructor(e){this.pattern=e,this.chars=[...e]}chars;index=0;flags={multiLine:!1,dotAll:!1,swapGreed:!1};fancy=!1;caseInsensitive=!1;captures=0;names=new Set;unsupported=[];fancyInvalid=[];bellOutsideClass=!1;parse(){let e;try{e=this.parseAlternation(0),this.eof()||this.fail(`unopened group`)}catch(e){throw e instanceof Xu&&this.fancy?new Zu(e.message):e}return!this.fancy&&this.bellOutsideClass&&this.fail("`\\a` is not supported"),{node:e,fancy:this.fancy,caseInsensitive:this.caseInsensitive,captures:this.captures,unsupported:this.unsupported,fancyInvalid:this.fancyInvalid}}eof(){return this.index>=this.chars.length}char(){return this.chars[this.index]}peek(e=1){return this.chars[this.index+e]}startsWith(e){return this.chars.slice(this.index,this.index+e.length).join(``)===e}fail(e){throw new Xu(e)}parseAlternation(e){let t=[this.parseConcat(e)];for(;!this.eof()&&this.char()===`|`;)this.index++,t.push(this.parseConcat(e));return t.length===1?t[0]:{kind:`alternation`,items:t}}parseConcat(e){let t=[],n=0;for(;!this.eof();){let r=this.char();if(r===`|`||r===`)`)break;if(r===`?`||r===`*`||r===`+`||r===`{`?(n++,n===2&&r===`+`?this.unsupported.push(`possessive quantifiers`):n===2&&r===`{`?this.unsupported.push(`a counted repetition right after another quantifier`):n>=2&&this.fancyInvalid.push(`a quantifier right after another quantifier`)):n=0,r===`(`)t.push(this.parseGroup(e));else if(r===`[`)t.push({kind:`class`,item:this.parseBracketed()});else if(r===`?`||r===`*`||r===`+`){this.index++;let[e,n]=r===`?`?[0,1]:r===`*`?[0,1/0]:[1,1/0],i=!0;!this.eof()&&this.char()===`?`&&(i=!1,this.index++),this.repeatLast(t,e,n,i)}else r===`{`?this.parseCountedRepetition(t):t.push(this.parsePrimitive())}return t.length===1?t[0]:{kind:`concat`,items:t}}repeatLast(e,t,n,r){let i=e.pop();(i===void 0||i.kind===`flags`)&&this.fail(`repetition operator missing expression`),i.kind===`look`&&this.fancyInvalid.push(`a quantifier on a lookaround`),e.push({kind:`repeat`,body:i,min:t,max:n,greedy:r!==this.flags.swapGreed})}skipWhitespaceInRepetition(){let e=!1;for(;!this.eof()&&/\p{White_Space}/u.test(this.char());)this.index++,e=!0;e&&this.unsupported.push(`spaces inside a counted repetition`)}parseDecimal(){this.skipWhitespaceInRepetition();let e=``;for(;!this.eof()&&/[0-9]/.test(this.char());)e+=this.chars[this.index++];if(this.skipWhitespaceInRepetition(),e===``)return;let t=Number(e);return t>4294967295&&this.fail(`repetition count is too large`),t}parseCountedRepetition(e){let t=e[e.length-1];(t===void 0||t.kind===`flags`)&&this.fail(`repetition operator missing expression`),this.index++,this.eof()&&this.fail(`unclosed counted repetition`);let n=this.parseDecimal();this.eof()&&this.fail(`unclosed counted repetition`);let r;if(this.char()===`,`)if(this.index++,this.eof()&&this.fail(`unclosed counted repetition`),this.char()!==`}`){let e=this.parseDecimal();(n===void 0||e===void 0)&&this.fail(`repetition count is empty`),r=e}else n===void 0&&this.fail(`repetition count is empty`),r=1/0;else n===void 0&&this.fail(`repetition count is empty`),r=n;(this.eof()||this.char()!==`}`)&&this.fail(`unclosed counted repetition`),this.index++;let i=!0;!this.eof()&&this.char()===`?`&&(i=!1,this.index++),n>r&&this.fail(`invalid repetition range`),this.repeatLast(e,n,r,i)}parseGroup(e){let t=this.index===0;this.index++;for(let t of[`=`,`!`,`<=`,`<!`])if(this.startsWith(`?${t}`))return this.fancy=!0,this.index+=t.length+1,{kind:`look`,op:t,body:this.parseGroupBody(e)};if(this.startsWith(`?P<`)||this.startsWith(`?<`))return this.index+=this.startsWith(`?P<`)?3:2,this.captures++,this.parseCaptureName(),{kind:`group`,capture:!0,body:this.parseGroupBody(e)};if(!this.eof()&&this.char()===`?`){this.index++,this.eof()&&this.fail(`unclosed group`);let n=this.flags,r=this.parseFlags(),i=this.char();if(this.index++,i===`)`)return r!==void 0&&(r&&t?this.caseInsensitive=!0:this.unsupported.push("`(?i)` anywhere but at the start of the pattern")),{kind:`flags`};r!==void 0&&this.unsupported.push("`(?i)` anywhere but at the start of the pattern");let a=this.parseGroupBody(e);return this.flags=n,{kind:`group`,capture:!1,body:a}}return this.captures++,{kind:`group`,capture:!0,body:this.parseGroupBody(e)}}parseGroupBody(e){let t=this.flags,n=this.parseAlternation(e+1);return this.eof()&&this.fail(`unclosed group`),this.index++,this.flags=t,n}parseCaptureName(){this.eof()&&this.fail(`unexpected end of group name`);let e=``;for(;!this.eof()&&this.char()!==`>`;){let t=this.char();(e===``?t===`_`||/\p{Alphabetic}/u.test(t):t===`_`||t===`.`||t===`[`||t===`]`||/[\p{Alphabetic}\p{N}]/u.test(t))||this.fail(`invalid group name`),e+=t,this.index++}this.eof()&&this.fail(`unexpected end of group name`),this.index++,e===``&&this.fail(`empty group name`),this.names.has(e)&&this.fail(`duplicate group name "${e}"`),this.names.add(e)}parseFlags(){let e=new Set,t=!1,n=!1,r,i={...this.flags};for(;this.char()!==`:`&&this.char()!==`)`;){let a=this.char();if(a===`-`)t&&this.fail(`repeated negation in flags`),t=!0,n=!0;else{n=!1,$u.has(a)||this.fail(`unrecognized flag "${a}"`),e.has(a)&&this.fail(`duplicate flag "${a}"`),e.add(a);let o=!t;a===`i`?r=o:a===`m`?i.multiLine=o:a===`s`?i.dotAll=o:a===`U`?i.swapGreed=o:a===`x`?this.unsupported.push("the `x` flag"):a===`R`?this.unsupported.push("the `R` flag"):a===`u`&&!o&&this.unsupported.push("turning off the `u` flag")}this.index++,this.eof()&&this.fail(`unexpected end of flags`)}return n&&this.fail(`dangling flag negation`),e.size===0&&this.char()===`)`&&this.fail(`repetition operator missing expression`),this.flags=i,r}parsePrimitive(){let e=this.char();return e===`\\`?this.parseEscape(!1):(this.index++,e===`.`?{kind:`dot`,dotAll:this.flags.dotAll}:e===`^`?this.assertion(`start`):e===`$`?this.assertion(`end`):{kind:`literal`,char:e})}assertion(e){return{kind:`assertion`,assertion:e,multiLine:this.flags.multiLine}}parseEscape(e){this.index++,this.eof()&&this.fail(`incomplete escape`);let t=this.char();if(/[0-9]/.test(t)){this.fancy=!0;let t=``;for(;!this.eof()&&/[0-9]/.test(this.char());)t+=this.chars[this.index++];return(e||t.startsWith(`0`))&&this.unsupported.push(`\`\\${t}\``),{kind:`backref`,index:Number(t)}}if(t===`x`||t===`u`||t===`U`)return{kind:`literal`,char:this.parseHex(t)};if(t===`p`||t===`P`)return{kind:`class`,item:this.parseUnicodeClass(t===`P`)};if(`dswDSW`.includes(t)){this.index++;let e=t.toLowerCase();return{kind:`class`,item:{kind:`perl`,perl:e,negated:t!==e}}}if(this.index++,td(t))return{kind:`literal`,char:t};let n={f:`\f`,t:` `,n:`
|
|
1
|
+
var e=Object.defineProperty,t=Object.getOwnPropertyNames,n=(e,n)=>function(){return e&&(n=(0,e[t(e)[0]])(e=0)),n},r=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},i={};r(i,{PendingNativeRead:()=>ve,StreamingMutation:()=>ye,UpstreamLink:()=>be,WasmDb:()=>xe,WasmPendingSubscription:()=>Se,WasmPermissionAdviceRequest:()=>Ce,WasmTransport:()=>M,WasmWrite:()=>N,__testBindingCodecGoldenFixture:()=>a,__testValidateWireFrameBatchCorpus:()=>o,__testWireFrameCorpusFeatures:()=>s,captureTextAnchor:()=>c,captureTextRange:()=>l,currentTimestamp:()=>u,default:()=>_e,deriveUserId:()=>d,drainTraceEntries:()=>f,generateId:()=>p,init:()=>m,initSync:()=>ge,mintAnonymousToken:()=>h,mintLocalFirstToken:()=>g,nativeArtifactFingerprint:()=>_,resolveTextAnchor:()=>ee,resolveTextRange:()=>v,setJsonSchemaValidator:()=>y,setTraceEntryCollectionEnabled:()=>te,subscribeTraceEntries:()=>ne,validateSchema:()=>re});function a(){let e,t;try{let n=F.__testBindingCodecGoldenFixture();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function o(e,t,n){let r=k(e,F.__wbindgen_malloc),i=P,a=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=F.__testValidateWireFrameBatchCorpus(r,i,a,o,s,c);if(l[1])throw j(l[0])}function s(){let e,t;try{let n=F.__testWireFrameCorpusFeatures();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function c(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=F.captureTextAnchor(i,a,!D(t),D(t)?0:t,n,r);if(o[2])throw j(o[1]);return j(o[0])}function l(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=F.captureTextRange(i,a,!D(t),D(t)?0:t,n,r);if(o[2])throw j(o[1]);return j(o[0])}function u(){let e=F.currentTimestamp();return BigInt.asUintN(64,e)}function d(e){let t,n;try{let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=F.deriveUserId(a,o);var r=s[0],i=s[1];if(s[3])throw r=0,i=0,j(s[2]);return t=r,n=i,T(r,i)}finally{F.__wbindgen_free(t,n,1)}}function f(){return F.drainTraceEntries()}function p(){let e,t;try{let n=F.generateId();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function m(){F.init()}function h(e,t,n,r){let i,a;try{let c=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=F.mintAnonymousToken(c,l,u,d,n,r);var o=f[0],s=f[1];if(f[3])throw o=0,s=0,j(f[2]);return i=o,a=s,T(o,s)}finally{F.__wbindgen_free(i,a,1)}}function g(e,t,n,r){let i,a;try{let c=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=F.mintLocalFirstToken(c,l,u,d,n,r);var o=f[0],s=f[1];if(f[3])throw o=0,s=0,j(f[2]);return i=o,a=s,T(o,s)}finally{F.__wbindgen_free(i,a,1)}}function _(){let e,t;try{let n=F.nativeArtifactFingerprint();return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}function ee(e,t,n){let r=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=F.resolveTextAnchor(e,r,i,!D(n),D(n)?0:n);if(a[2])throw j(a[1]);return j(a[0])}function v(e,t,n){let r=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=F.resolveTextRange(e,r,i,!D(n),D(n)?0:n);if(a[2])throw j(a[1]);return j(a[0])}function y(e){F.setJsonSchemaValidator(e)}function te(e){F.setTraceEntryCollectionEnabled(e)}function ne(e){return F.subscribeTraceEntries(e)}function re(e){let t=k(e,F.__wbindgen_malloc),n=P,r=F.validateSchema(t,n);if(r[1])throw j(r[0])}function b(){return{__proto__:null,"./jazz_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(e,t){return Error(T(e,t))},__wbg_Number_e6ffdb596c888833:function(e){return Number(e)},__wbg_String_8564e559799eccda:function(e,t){let n=A(String(t),F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;w().setInt32(e+4,r,!0),w().setInt32(e+0,n,!0)},__wbg_Window_70131fc0c91e4b3c:function(e){return e.Window},__wbg_WorkerGlobalScope_601c48015b8cc78e:function(e){return e.WorkerGlobalScope},__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2:function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;w().setBigInt64(e+8,D(r)?BigInt(0):r,!0),w().setInt32(e+0,!D(r),!0)},__wbg___wbindgen_boolean_get_a86c216575a75c30:function(e){let t=e,n=typeof t==`boolean`?t:void 0;return D(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57:function(e,t){let n=A(ue(t),F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;w().setInt32(e+4,r,!0),w().setInt32(e+0,n,!0)},__wbg___wbindgen_in_4bd7a57e54337366:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6c98f7e945dacdde:function(e){return typeof e==`bigint`},__wbg___wbindgen_is_function_49868bde5eb1e745:function(e){return typeof e==`function`},__wbg___wbindgen_is_null_344c8750a8525473:function(e){return e===null},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(e){let t=e;return typeof t==`object`&&!!t},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(e){return typeof e==`string`},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_7d430e744a913d26:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944:function(e,t){return e==t},__wbg___wbindgen_number_get_7579aab02a8a620c:function(e,t){let n=t,r=typeof n==`number`?n:void 0;w().setFloat64(e+8,D(r)?0:r,!0),w().setInt32(e+0,!D(r),!0)},__wbg___wbindgen_string_get_914df97fcfa788f2:function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=D(r)?0:A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P;w().setInt32(e+4,a,!0),w().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_81fc77679af83bc6:function(e,t){throw Error(T(e,t))},__wbg__wbg_cb_unref_3c3b4f651835fbcb:function(e){e._wbg_cb_unref()},__wbg_abort_cfab06d16d2d33a6:function(){return E(function(e){e.abort()},arguments)},__wbg_bound_88db1072ea68e901:function(){return E(function(e,t,n,r){return IDBKeyRange.bound(e,t,n!==0,r!==0)},arguments)},__wbg_call_368fa9c372d473ba:function(){return E(function(e,t,n,r){return e.call(t,n,r)},arguments)},__wbg_call_7f2987183bb62793:function(){return E(function(e,t){return e.call(t)},arguments)},__wbg_call_d578befcc3145dee:function(){return E(function(e,t,n){return e.call(t,n)},arguments)},__wbg_commit_e9c1332714c53826:function(){return E(function(e){e.commit()},arguments)},__wbg_construct_adeb3d5948c3d19a:function(){return E(function(e,t){return Reflect.construct(e,t)},arguments)},__wbg_createObjectStore_6e567b25160be2fa:function(){return E(function(e,t,n,r){return e.createObjectStore(T(t,n),r)},arguments)},__wbg_delete_fc24bd7dfa57938e:function(){return E(function(e,t){return e.delete(t)},arguments)},__wbg_done_547d467e97529006:function(e){return e.done},__wbg_entries_616b1a459b85be0b:function(e){return Object.entries(e)},__wbg_error_58469b8474e13592:function(){return E(function(e){let t=e.error;return D(t)?0:S(t)},arguments)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(T(e,t))}finally{F.__wbindgen_free(n,r,1)}},__wbg_getAll_93336699ea033b51:function(){return E(function(e,t){return e.getAll(t)},arguments)},__wbg_getDate_bafac038eaae076e:function(e){return e.getDate()},__wbg_getDay_6eebc8fe9cb183f5:function(e){return e.getDay()},__wbg_getFullYear_8f83597f7403c865:function(e){return e.getFullYear()},__wbg_getHours_81348c8e800060e7:function(e){return e.getHours()},__wbg_getMinutes_bd1ccf17dab913bf:function(e){return e.getMinutes()},__wbg_getMonth_288607689622719c:function(e){return e.getMonth()},__wbg_getRandomValues_15134f5c0ae6b0d0:function(){return E(function(e,t){globalThis.crypto.getRandomValues(C(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return E(function(e,t){globalThis.crypto.getRandomValues(C(e,t))},arguments)},__wbg_getSeconds_edef7266627a185f:function(e){return e.getSeconds()},__wbg_getTime_f6ac312467f7cf09:function(e){return e.getTime()},__wbg_getTimezoneOffset_ac5be603b21a5797:function(e){return e.getTimezoneOffset()},__wbg_get_4848e350b40afc16:function(e,t){return e[t>>>0]},__wbg_get_ed0642c4b9d31ddf:function(){return E(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_f96702c6245e4ef9:function(){return E(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_7d7babe32e9e6a54:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_global_e30ac0b7684506d0:function(e){return e.global},__wbg_has_3ec5c22db2e5237a:function(){return E(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_indexedDB_065ce3ad400579e3:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_indexedDB_a2139150e2ea2a08:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_indexedDB_af74cb6df65fa636:function(){return E(function(e){let t=e.indexedDB;return D(t)?0:S(t)},arguments)},__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_DomException_37f96d3fb69189bd:function(e){let t;try{t=e instanceof DOMException}catch{t=!1}return t},__wbg_instanceof_Error_e3390d6805733dad:function(e){let t;try{t=e instanceof Error}catch{t=!1}return t},__wbg_instanceof_IdbDatabase_0af111edb4be95f4:function(e){let t;try{t=e instanceof IDBDatabase}catch{t=!1}return t},__wbg_instanceof_IdbRequest_fc5918c726448f04:function(e){let t;try{t=e instanceof IDBRequest}catch{t=!1}return t},__wbg_instanceof_Map_a10a2795ef4bfe97:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Uint8Array_4b8da683deb25d72:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_db61795ad004c139:function(e){return Array.isArray(e)},__wbg_isSafeInteger_ea83862ba994770c:function(e){return Number.isSafeInteger(e)},__wbg_iterator_de403ef31815a3e6:function(){return Symbol.iterator},__wbg_length_0c32cb8543c8e4c8:function(e){return e.length},__wbg_length_6e821edde497a532:function(e){return e.length},__wbg_log_6a8b55ee2e172f54:function(e,t,n,r,i,a,o,s){let c,l;try{c=e,l=t,console.log(T(e,t),T(n,r),T(i,a),T(o,s))}finally{F.__wbindgen_free(c,l,1)}},__wbg_lowerBound_279c232a69ac0f79:function(){return E(function(e,t){return IDBKeyRange.lowerBound(e,t!==0)},arguments)},__wbg_message_52a9425f28c45ebc:function(e,t){let n=t.message,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_message_7367f8c7d0fa1589:function(e){return e.message},__wbg_name_d7bb38b41d6d953e:function(e,t){let n=t.name,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_new_0_bfa2ef4bc447daa2:function(){return new Date},__wbg_new_0f6d2ddfe083319b:function(e){return new Date(e)},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_new_40792555590ec35c:function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return le(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=0}},__wbg_new_4f9fafbb3909af72:function(){return{}},__wbg_new_99cabae501c0a8a0:function(){return new Map},__wbg_new_a560378ea1240b14:function(e){return new Uint8Array(e)},__wbg_new_e3b04b4d53d1b593:function(e,t){return Error(T(e,t))},__wbg_new_f3c9df4f38f3f798:function(){return[]},__wbg_new_from_slice_2580ff33d0d10520:function(e,t){return new Uint8Array(C(e,t))},__wbg_new_typed_14d7cc391ce53d2c:function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return le(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=0}},__wbg_new_with_length_9cedd08484b73942:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_year_month_day_d7dc1e63a7b42902:function(e,t,n){return new Date(e>>>0,t,n)},__wbg_next_01132ed6134b8ef5:function(e){return e.next},__wbg_next_b3713ec761a9dbfd:function(){return E(function(e){return e.next()},arguments)},__wbg_now_6798946be0e6fe2b:function(){return E(function(){return Date.now()},arguments)},__wbg_now_88621c9c9a4f3ffc:function(){return Date.now()},__wbg_now_e7c6795a7f81e10f:function(e){return e.now()},__wbg_objectStore_3d4cade4416cd432:function(){return E(function(e,t,n){return e.objectStore(T(t,n))},arguments)},__wbg_open_ac04ec9d75d0eeaf:function(){return E(function(e,t,n,r){return e.open(T(t,n),r>>>0)},arguments)},__wbg_pendingnativeread_new:function(e){return ve.__wrap(e)},__wbg_performance_3fcf6e32a7e1ed0a:function(e){return e.performance},__wbg_prototypesetcall_3e05eb9545565046:function(e,t,n){Uint8Array.prototype.set.call(C(e,t),n)},__wbg_push_6bdbc990be5ac37b:function(e,t){return e.push(t)},__wbg_put_015a7e88e46a2502:function(){return E(function(e,t){return e.put(t)},arguments)},__wbg_queueMicrotask_abaf92f0bd4e80a4:function(e){return e.queueMicrotask},__wbg_queueMicrotask_df5a6dac26d818f3:function(e){queueMicrotask(e)},__wbg_random_a72d453e63c9558c:function(){return Math.random()},__wbg_readyState_accbdf425c074d9c:function(e){let t=e.readyState;return(we.indexOf(t)+1||3)-1},__wbg_reject_1340e1211c01825b:function(e){return Promise.reject(e)},__wbg_resolve_0a79de24e9d2267b:function(e){return Promise.resolve(e)},__wbg_result_452c1006fc727317:function(){return E(function(e){return e.result},arguments)},__wbg_set_08463b1df38a7e29:function(e,t,n){return e.set(t,n)},__wbg_set_16a9c1a07b3d38ec:function(e,t,n){e.set(C(t,n))},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_6c60b2e8ad0e9383:function(e,t,n){e[t>>>0]=n},__wbg_set_8ee2d34facb8466e:function(){return E(function(e,t,n){return Reflect.set(e,t,n)},arguments)},__wbg_set_key_path_6edd6ee0e8d75af3:function(e,t){e.keyPath=t},__wbg_set_onabort_6b6df7a41aa97c23:function(e,t){e.onabort=t},__wbg_set_oncomplete_20fb27150b4ee0d4:function(e,t){e.oncomplete=t},__wbg_set_onerror_2b7dfa4e6dea4159:function(e,t){e.onerror=t},__wbg_set_onerror_3c4b5087146b11b6:function(e,t){e.onerror=t},__wbg_set_onsuccess_f7e5b5cbed5008b1:function(e,t){e.onsuccess=t},__wbg_set_onupgradeneeded_d7e8e03a1999bf5d:function(e,t){e.onupgradeneeded=t},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;w().setInt32(e+4,i,!0),w().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){let e=typeof globalThis>`u`?null:globalThis;return D(e)?0:S(e)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){let e=typeof global>`u`?null:global;return D(e)?0:S(e)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){let e=typeof self>`u`?null:self;return D(e)?0:S(e)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){let e=typeof window>`u`?null:window;return D(e)?0:S(e)},__wbg_subarray_0f98d3fb634508ad:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_target_732d56b173b7e87c:function(e){let t=e.target;return D(t)?0:S(t)},__wbg_then_00eed3ac0b8e82cb:function(e,t,n){return e.then(t,n)},__wbg_then_a0c8db0381c8994c:function(e,t){return e.then(t)},__wbg_toString_891d991e862e1d44:function(e){return e.toString()},__wbg_transaction_cc65dcef07fabb06:function(e){return e.transaction},__wbg_transaction_f909284bfed41115:function(){return E(function(e,t,n,r){return e.transaction(T(t,n),Te[r])},arguments)},__wbg_upperBound_2f3c07fb628c7a3c:function(){return E(function(e,t){return IDBKeyRange.upperBound(e,t!==0)},arguments)},__wbg_value_7f6052747ccf940f:function(e){return e.value},__wbg_wasmdb_new:function(e){return xe.__wrap(e)},__wbg_wasmtransport_new:function(e){return M.__wrap(e)},__wbg_wasmwrite_new:function(e){return N.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return O(e,t,se)},__wbindgen_cast_0000000000000002:function(e,t){return O(e,t,oe)},__wbindgen_cast_0000000000000003:function(e,t){return O(e,t,ae)},__wbindgen_cast_0000000000000004:function(e,t){return O(e,t,ce)},__wbindgen_cast_0000000000000005:function(e,t){return O(e,t,x)},__wbindgen_cast_0000000000000006:function(e,t){return O(e,t,ie)},__wbindgen_cast_0000000000000007:function(e){return e},__wbindgen_cast_0000000000000008:function(e){return e},__wbindgen_cast_0000000000000009:function(e,t){return T(e,t)},__wbindgen_cast_000000000000000a:function(e){return BigInt.asUintN(64,e)},__wbindgen_init_externref_table:function(){let e=F.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function x(e,t){F.wasm_bindgen__convert__closures_____invoke__h69610db431037c77(e,t)}function ie(e,t){F.wasm_bindgen__convert__closures_____invoke__h492b14c1fd17d971(e,t)}function ae(e,t,n){F.wasm_bindgen__convert__closures_____invoke__hf83e1094fac4ab4c(e,t,n)}function oe(e,t,n){return F.wasm_bindgen__convert__closures_____invoke__h204415932d107275(e,t,n)}function se(e,t,n){let r=F.wasm_bindgen__convert__closures_____invoke__hf2d3ca0c7acb67d9(e,t,n);if(r[1])throw j(r[0])}function ce(e,t,n){let r=F.wasm_bindgen__convert__closures_____invoke__h9a626ac5c10dc9c9(e,t,n);if(r[1])throw j(r[0])}function le(e,t,n,r){F.wasm_bindgen__convert__closures_____invoke__h0c5680e9ed94b2e6(e,t,n,r)}function S(e){let t=F.__externref_table_alloc();return F.__wbindgen_externrefs.set(t,e),t}function ue(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=ue(e[0]));for(let r=1;r<t;r++)n+=`, `+ue(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}
|
|
2
|
+
${e.stack}`:r}function de(e,t){e>>>=0;let n=w(),r=[];for(let i=e;i<e+4*t;i+=4)r.push(F.__wbindgen_externrefs.get(n.getUint32(i,!0)));return F.__externref_drop_slice(e,t),r}function C(e,t){return e>>>=0,fe().subarray(e/1,e/1+t)}function w(){return(Fe===null||Fe.buffer.detached===!0||Fe.buffer.detached===void 0&&Fe.buffer!==F.memory.buffer)&&(Fe=new DataView(F.memory.buffer)),Fe}function T(e,t){return e>>>=0,pe(e,t)}function fe(){return(Ie===null||Ie.byteLength===0)&&(Ie=new Uint8Array(F.memory.buffer)),Ie}function E(e,t){try{return e.apply(this,t)}catch(e){let t=S(e);F.__wbindgen_exn_store(t)}}function D(e){return e==null}function O(e,t,n){let r={a:e,b:t,cnt:1},i=(...e)=>{r.cnt++;let t=r.a;r.a=0;try{return n(t,r.b,...e)}finally{r.a=t,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--r.cnt===0&&(F.__wbindgen_destroy_closure(r.a,r.b),r.a=0,Pe.unregister(r))},Pe.register(i,r,r),i}function k(e,t){let n=t(e.length*1,1)>>>0;return fe().set(e,n/1),P=e.length,n}function A(e,t,n){if(n===void 0){let n=Be.encode(e),r=t(n.length,1)>>>0;return fe().subarray(r,r+n.length).set(n),P=n.length,r}let r=e.length,i=t(r,1)>>>0,a=fe(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=fe().subarray(i+o,i+r),a=Be.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return P=o,i}function j(e){let t=F.__wbindgen_externrefs.get(e);return F.__externref_table_dealloc(e),t}function pe(e,t){return ze+=t,ze>=Re&&(Le=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),Le.decode(),ze=t),Le.decode(fe().subarray(e,e+t))}function me(e,t){return F=e.exports,Ve=t,Fe=null,Ie=null,F.__wbindgen_start(),F}async function he(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.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",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}function ge(e){if(F!==void 0)return F;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let t=b();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),me(new WebAssembly.Instance(e,t),e)}async function _e(e){if(F!==void 0)return F;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0&&(e=new URL(``+new URL(`jazz_wasm_bg-ZC330TX3.wasm`,import.meta.url).href,``+import.meta.url));let t=b();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await he(await e,t);return me(n,r)}var ve,ye,be,xe,Se,Ce,M,N,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,P,Ve,F,He=n({"../../crates/jazz-wasm/pkg/jazz_wasm.js"(){ve=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,De.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,De.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_pendingnativeread_free(e,0)}cancel(){F.pendingnativeread_cancel(this.__wbg_ptr)}poll(){let e=F.pendingnativeread_poll(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}},Symbol.dispose&&(ve.prototype[Symbol.dispose]=ve.prototype.free),ye=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ae.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ae.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_streamingmutation_free(e,0)}abort(){return F.wasmstreamingmutation_abort(this.__wbg_ptr)}finish(){return F.wasmstreamingmutation_finish(this.__wbg_ptr)}finishInTransaction(){let e=F.wasmstreamingmutation_finishInTransaction(this.__wbg_ptr);if(e[1])throw j(e[0])}push(e){let t=k(e,F.__wbindgen_malloc),n=P;return F.wasmstreamingmutation_push(this.__wbg_ptr,t,n)}},Symbol.dispose&&(ye.prototype[Symbol.dispose]=ye.prototype.free),be=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Me.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Me.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_upstreamlink_free(e,0)}handle(e,t){let n,r;try{let o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=F.upstreamlink_handle(this.__wbg_ptr,e,o,s);var i=c[0],a=c[1];if(c[3])throw i=0,a=0,j(c[2]);return n=i,r=a,T(i,a)}finally{F.__wbindgen_free(n,r,1)}}constructor(e){return this.__wbg_ptr=F.upstreamlink_new(e)>>>0,Me.register(this,this.__wbg_ptr,this),this}},Symbol.dispose&&(be.prototype[Symbol.dispose]=be.prototype.free),xe=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ee.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ee.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmdb_free(e,0)}acceptSubscriber(e,t,n){let r=k(e,F.__wbindgen_malloc),i=P,a=F.wasmdb_acceptSubscriber(this.__wbg_ptr,r,i,t,!D(n),D(n)?BigInt(0):n);if(a[2])throw j(a[1]);return j(a[0])}acceptSubscriberWithSelfSignedProof(e,t,n,r,i){let a=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),u=P,d=F.wasmdb_acceptSubscriberWithSelfSignedProof(this.__wbg_ptr,e,a,o,s,c,l,u,!D(i),D(i)?BigInt(0):i);if(d[2])throw j(d[1]);return j(d[0])}all(e,t,n,r,i){let a=k(e,F.__wbindgen_malloc),o=P;var s=D(n)?0:A(n,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=D(r)?0:k(r,F.__wbindgen_malloc),u=P;let d=F.wasmdb_all(this.__wbg_ptr,a,o,t,s,c,l,u,i);if(d[2])throw j(d[1]);return j(d[0])}beginStreamingMutation(e,t,n,r,i,a,o,s,c,l,u){let d=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),f=P,p=k(t,F.__wbindgen_malloc),m=P,h=k(n,F.__wbindgen_malloc),g=P,_=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),ee=P;var v=D(i)?0:A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),y=P,te=D(a)?0:k(a,F.__wbindgen_malloc),ne=P,re=D(o)?0:k(o,F.__wbindgen_malloc),b=P,x=D(u)?0:A(u,F.__wbindgen_malloc,F.__wbindgen_realloc),ie=P;let ae=F.wasmdb_beginStreamingMutation(this.__wbg_ptr,d,f,p,m,h,g,_,ee,v,y,te,ne,re,b,!D(s),D(s)?0:s,D(c)?0:S(c),D(l)?0:S(l),x,ie);if(ae[2])throw j(ae[1]);return ye.__wrap(ae[0])}beginTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P;var c=D(n)?0:k(n,F.__wbindgen_malloc),l=P,u=D(r)?0:k(r,F.__wbindgen_malloc),d=P;let f=F.wasmdb_beginTransaction(this.__wbg_ptr,i,a,o,s,c,l,u,d);if(f[1])throw j(f[0])}canInsert(e,t){let n,r;try{let o=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(t,F.__wbindgen_malloc),l=P,u=F.wasmdb_canInsert(this.__wbg_ptr,o,s,c,l);var i=u[0],a=u[1];if(u[3])throw i=0,a=0,j(u[2]);return n=i,r=a,T(i,a)}finally{F.__wbindgen_free(n,r,1)}}captureSnapshot(){let e=F.wasmdb_captureSnapshot(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}close(){return F.wasmdb_close(this.__wbg_ptr)}commitTransaction(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;var i=D(t)?0:A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P;let o=F.wasmdb_commitTransaction(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return N.__wrap(o[0])}connectUpstream(){let e=F.wasmdb_connectUpstream(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}connectUpstreamWithSession(e,t,n,r,i,a){let o=k(n,F.__wbindgen_malloc),s=P,c=k(i,F.__wbindgen_malloc),l=P,u=F.wasmdb_connectUpstreamWithSession(this.__wbg_ptr,e,t,o,s,r,c,l,a);if(u[2])throw j(u[1]);return j(u[0])}createUpstreamLink(e){let t=F.wasmdb_createUpstreamLink(this.__wbg_ptr,e);return be.__wrap(t)}delete(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=F.wasmdb_delete(this.__wbg_ptr,r,i,a,o,n);if(s[2])throw j(s[1]);return N.__wrap(s[0])}deleteInTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_deleteInTransaction(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[1])throw j(u[0])}static destroyBrowserStorage(e,t){let n=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P;return F.wasmdb_destroyBrowserStorage(e,n,r)}evictExpiredStagedLargeValues(){return F.wasmdb_evictExpiredStagedLargeValues(this.__wbg_ptr)}flush(){return F.wasmdb_flush(this.__wbg_ptr)}foregroundTxTimeHighWater(){let e=F.wasmdb_foregroundTxTimeHighWater(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}insert(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=F.wasmdb_insert(this.__wbg_ptr,r,i,a,o,n);if(s[2])throw j(s[1]);return N.__wrap(s[0])}insertInTransaction(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_insertInTransaction(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[3])throw j(u[2]);var d=C(u[0],u[1]).slice();return F.__wbindgen_free(u[0],u[1]*1,1),d}localCurrentRow(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_localCurrentRow(this.__wbg_ptr,n,r,i,a);if(o[3])throw j(o[2]);var s=C(o[0],o[1]).slice();return F.__wbindgen_free(o[0],o[1]*1,1),s}onMutationError(e){F.wasmdb_onMutationError(this.__wbg_ptr,e)}onStorageFailure(e){F.wasmdb_onStorageFailure(this.__wbg_ptr,e)}static openBrowser(e,t,n,r){let i=k(t,F.__wbindgen_malloc),a=P,o=k(n,F.__wbindgen_malloc),s=P,c=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P;return F.wasmdb_openBrowser(e,i,a,o,s,c,l)}static openBrowserWithSelfSignedProof(e,t,n,r,i,a,o){let s=k(t,F.__wbindgen_malloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),f=P,p=A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),m=P,h=A(a,F.__wbindgen_malloc,F.__wbindgen_realloc),g=P,_=A(o,F.__wbindgen_malloc,F.__wbindgen_realloc),ee=P;return F.wasmdb_openBrowserWithSelfSignedProof(e,s,c,l,u,d,f,p,m,h,g,_,ee)}static openMemory(t,n){let r=k(t,F.__wbindgen_malloc),i=P,a=k(n,F.__wbindgen_malloc),o=P,s=F.wasmdb_openMemory(r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}static openMemoryAsBackend(t,n){let r=k(t,F.__wbindgen_malloc),i=P,a=k(n,F.__wbindgen_malloc),o=P,s=F.wasmdb_openMemoryAsBackend(r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}static openMemoryWithSelfSignedProof(t,n,r,i,a){let o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=A(r,F.__wbindgen_malloc,F.__wbindgen_realloc),d=P,f=A(i,F.__wbindgen_malloc,F.__wbindgen_realloc),p=P,m=A(a,F.__wbindgen_malloc,F.__wbindgen_realloc),h=P,g=F.wasmdb_openMemoryWithSelfSignedProof(o,s,c,l,u,d,f,p,m,h);if(g[2])throw j(g[1]);return e.__wrap(g[0])}registerSchema(t,n){let r=k(t,F.__wbindgen_malloc),i=P;var a=D(n)?0:k(n,F.__wbindgen_malloc),o=P;let s=F.wasmdb_registerSchema(this.__wbg_ptr,r,i,a,o);if(s[2])throw j(s[1]);return e.__wrap(s[0])}requestDeletePermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestDeletePermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestInsertPermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestInsertPermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestReadPermissionAdvice(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=k(t,F.__wbindgen_malloc),a=P,o=F.wasmdb_requestReadPermissionAdvice(this.__wbg_ptr,n,r,i,a);if(o[2])throw j(o[1]);return Ce.__wrap(o[0])}requestUpdatePermissionAdvice(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P,a=k(t,F.__wbindgen_malloc),o=P,s=k(n,F.__wbindgen_malloc),c=P,l=F.wasmdb_requestUpdatePermissionAdvice(this.__wbg_ptr,r,i,a,o,s,c);if(l[2])throw j(l[1]);return Ce.__wrap(l[0])}restore(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P;var c=D(n)?0:k(n,F.__wbindgen_malloc),l=P;let u=F.wasmdb_restore(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}restoreInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P;var d=D(r)?0:k(r,F.__wbindgen_malloc),f=P;let p=F.wasmdb_restoreInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}rollbackTransaction(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_rollbackTransaction(this.__wbg_ptr,t,n);if(r[1])throw j(r[0])}seedForegroundTxTimeHighWater(e){let t=F.wasmdb_seedForegroundTxTimeHighWater(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setIdentityClaims(e,t){let n=k(e,F.__wbindgen_malloc),r=P,i=F.wasmdb_setIdentityClaims(this.__wbg_ptr,n,r,t);if(i[1])throw j(i[0])}setLargeValueStagingPolicy(e,t,n){let r=F.wasmdb_setLargeValueStagingPolicy(this.__wbg_ptr,e,t,!D(n),D(n)?0:n);if(r[1])throw j(r[0])}setNonDurableClient(){let e=F.wasmdb_setNonDurableClient(this.__wbg_ptr);if(e[1])throw j(e[0])}setRemoteLinkHint(e){let t=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P,r=F.wasmdb_setRemoteLinkHint(this.__wbg_ptr,t,n);if(r[1])throw j(r[0])}setSessionClaims(e){let t=F.wasmdb_setSessionClaims(this.__wbg_ptr,e);if(t[2])throw j(t[1]);return j(t[0])}setSlowQueryThresholdMs(e){let t=F.wasmdb_setSlowQueryThresholdMs(this.__wbg_ptr,e);if(t[1])throw j(t[0])}setTickScheduler(e){F.wasmdb_setTickScheduler(this.__wbg_ptr,e)}subscribe(e,t,n,r){let i=k(e,F.__wbindgen_malloc),a=P;var o=D(n)?0:k(n,F.__wbindgen_malloc),s=P;let c=F.wasmdb_subscribe(this.__wbg_ptr,i,a,t,o,s,r);if(c[2])throw j(c[1]);return j(c[0])}takeSlowQueryReport(e){var t=D(e)?0:A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),n=P;let r=F.wasmdb_takeSlowQueryReport(this.__wbg_ptr,t,n);if(r[3])throw j(r[2]);var i=de(r[0],r[1]).slice();return F.__wbindgen_free(r[0],r[1]*4,4),i}tick(){return F.wasmdb_tick(this.__wbg_ptr)}update(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_update(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}updateInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=k(r,F.__wbindgen_malloc),f=P,p=F.wasmdb_updateInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}updateLargeValues(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=k(t,F.__wbindgen_malloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=F.wasmdb_updateLargeValues(this.__wbg_ptr,a,o,s,c,l,u,r,!D(i),D(i)?0:i);if(d[2])throw j(d[1]);return N.__wrap(d[0])}updateLargeValuesInTransaction(e,t,n,r,i,a){let o=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),s=P,c=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),l=P,u=k(n,F.__wbindgen_malloc),d=P,f=k(r,F.__wbindgen_malloc),p=P,m=F.wasmdb_updateLargeValuesInTransaction(this.__wbg_ptr,o,s,c,l,u,d,f,p,i,!D(a),D(a)?0:a);if(m[1])throw j(m[0])}uploadStatus(){let e=F.wasmdb_uploadStatus(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}upsert(e,t,n,r){let i=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),a=P,o=k(t,F.__wbindgen_malloc),s=P,c=k(n,F.__wbindgen_malloc),l=P,u=F.wasmdb_upsert(this.__wbg_ptr,i,a,o,s,c,l,r);if(u[2])throw j(u[1]);return N.__wrap(u[0])}upsertInTransaction(e,t,n,r,i){let a=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),o=P,s=A(t,F.__wbindgen_malloc,F.__wbindgen_realloc),c=P,l=k(n,F.__wbindgen_malloc),u=P,d=k(r,F.__wbindgen_malloc),f=P,p=F.wasmdb_upsertInTransaction(this.__wbg_ptr,a,o,s,c,l,u,d,f,i);if(p[1])throw j(p[0])}waitForPendingWrites(e,t,n){let r=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),i=P;return F.wasmdb_waitForPendingWrites(this.__wbg_ptr,r,i,D(t)?0:S(t),D(n)?16777215:n?1:0)}wireFeatures(){return F.wasmdb_wireFeatures(this.__wbg_ptr)>>>0}},Symbol.dispose&&(xe.prototype[Symbol.dispose]=xe.prototype.free),Se=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Oe.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmpendingsubscription_free(e,0)}cancel(){F.wasmpendingsubscription_cancel(this.__wbg_ptr)}poll(){let e=F.wasmpendingsubscription_poll(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}setWake(e){F.wasmpendingsubscription_setWake(this.__wbg_ptr,e)}},Symbol.dispose&&(Se.prototype[Symbol.dispose]=Se.prototype.free),Ce=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ke.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ke.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmpermissionadvicerequest_free(e,0)}cancel(){F.wasmpermissionadvicerequest_cancel(this.__wbg_ptr)}get promise(){return F.wasmpermissionadvicerequest_promise(this.__wbg_ptr)}},Symbol.dispose&&(Ce.prototype[Symbol.dispose]=Ce.prototype.free),M=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,je.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,je.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmtransport_free(e,0)}auxiliaryOutboundReady(){return F.wasmtransport_auxiliaryOutboundReady(this.__wbg_ptr)}auxiliaryReceiveTimeoutMs(){let e=F.wasmtransport_auxiliaryReceiveTimeoutMs(this.__wbg_ptr);return e===4294967297?void 0:e}clearOutboundScheduler(){F.wasmtransport_clearOutboundScheduler(this.__wbg_ptr)}close(){return F.wasmtransport_close(this.__wbg_ptr)!==0}expireAuxiliaryReceive(){F.wasmtransport_expireAuxiliaryReceive(this.__wbg_ptr)}recvAuxiliaryWireFrames(e,t){return F.wasmtransport_recvAuxiliaryWireFrames(this.__wbg_ptr,D(e)?4294967297:e>>>0,D(t)?4294967297:t>>>0)}recvWireFrames(){return F.wasmtransport_recvWireFrames(this.__wbg_ptr)}routeAuxiliaryWireFrame(e){let t=k(e,F.__wbindgen_malloc),n=P;return F.wasmtransport_routeAuxiliaryWireFrame(this.__wbg_ptr,t,n)}sendWireFrame(e){let t=k(e,F.__wbindgen_malloc),n=P;F.wasmtransport_sendWireFrame(this.__wbg_ptr,t,n)}sendWireFrames(e){F.wasmtransport_sendWireFrames(this.__wbg_ptr,e)}setAuxiliaryTraceEnabled(e){F.wasmtransport_setAuxiliaryTraceEnabled(this.__wbg_ptr,e)}setOutboundScheduler(e){F.wasmtransport_setOutboundScheduler(this.__wbg_ptr,e)}takeAuxiliaryTrace(){return F.wasmtransport_takeAuxiliaryTrace(this.__wbg_ptr)}tick(){return F.wasmtransport_tick(this.__wbg_ptr)}updateAuthenticatedClaims(e){let t=F.wasmtransport_updateAuthenticatedClaims(this.__wbg_ptr,e);if(t[2])throw j(t[1]);return j(t[0])}upstreamRefusal(){return F.wasmtransport_upstreamRefusal(this.__wbg_ptr)}},Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free),N=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ne.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ne.unregister(this),e}free(){let e=this.__destroy_into_raw();F.__wbg_wasmwrite_free(e,0)}close(){return F.wasmwrite_close(this.__wbg_ptr)!==0}get payload(){let e=F.wasmwrite_payload(this.__wbg_ptr);var t=C(e[0],e[1]).slice();return F.__wbindgen_free(e[0],e[1]*1,1),t}get rowId(){let e=F.wasmwrite_rowId(this.__wbg_ptr);var t=C(e[0],e[1]).slice();return F.__wbindgen_free(e[0],e[1]*1,1),t}get txId(){let e,t;try{let n=F.wasmwrite_txId(this.__wbg_ptr);return e=n[0],t=n[1],T(n[0],n[1])}finally{F.__wbindgen_free(e,t,1)}}wait(e,t){let n=A(e,F.__wbindgen_malloc,F.__wbindgen_realloc),r=P,i=F.wasmwrite_wait(this.__wbg_ptr,n,r,D(t)?16777215:t?1:0);if(i[2])throw j(i[1]);return j(i[0])}writeState(){let e=F.wasmwrite_writeState(this.__wbg_ptr);if(e[2])throw j(e[1]);return j(e[0])}},Symbol.dispose&&(N.prototype[Symbol.dispose]=N.prototype.free),we=[`pending`,`done`],Te=[`readonly`,`readwrite`,`versionchange`,`readwriteflush`,`cleanup`],Ee=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmdb_free(e>>>0,1)),De=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_pendingnativeread_free(e>>>0,1)),Oe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmpendingsubscription_free(e>>>0,1)),ke=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmpermissionadvicerequest_free(e>>>0,1)),Ae=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_streamingmutation_free(e>>>0,1)),je=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmtransport_free(e>>>0,1)),Me=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_upstreamlink_free(e>>>0,1)),Ne=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbg_wasmwrite_free(e>>>0,1)),Pe=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>F.__wbindgen_destroy_closure(e.a,e.b)),Fe=null,Ie=null,Le=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),Le.decode(),Re=2146435072,ze=0,Be=new TextEncoder,`encodeInto`in Be||(Be.encodeInto=function(e,t){let n=Be.encode(e);return t.set(n),{read:e.length,written:n.length}}),P=0}}),Ue,We=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/OTLPExporterBase.js"(){Ue=class{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}}}),Ge,Ke=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js"(){Ge=class extends Error{code;name=`OTLPExporterError`;data;constructor(e,t,n){super(e),this.data=n,this.code=t}}}});function qe(e){if(Number.isFinite(e)&&e>0)return e;throw Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function Je(e){if(e!=null)return async()=>e}function Ye(e,t,n){return{timeoutMillis:qe(e.timeoutMillis??t.timeoutMillis??n.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??n.concurrencyLimit,compression:e.compression??t.compression??n.compression}}function Xe(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:`none`}}var Ze=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/shared-configuration.js"(){}});function Qe(e){return new $e(e.concurrencyLimit)}var $e,et=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/bounded-queue-export-promise-handler.js"(){$e=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw Error(`Concurrency Limit reached`);this._sendingPromises.push(e);let t=()=>{let t=this._sendingPromises.indexOf(e);this._sendingPromises.splice(t,1)};e.then(t,t)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}}}),tt,nt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js"(){tt=`1.9.1`}});function rt(e){let t=new Set([e]),n=new Set,r=e.match(it);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(it);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var it,at,ot=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js"(){nt(),it=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,at=rt(tt)}});function st(e,t,n,r=!1){let i=ft[dt]=ft[dt]??{version:tt};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==tt){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${tt}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${tt}.`),!0}function ct(e){let t=ft[dt]?.version;if(!(!t||!at(t)))return ft[dt]?.[e]}function lt(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${tt}.`);let n=ft[dt];n&&delete n[e]}var ut,dt,ft,pt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"(){nt(),ot(),ut=tt.split(`.`)[0],dt=Symbol.for(`opentelemetry.js.api.${ut}`),ft=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}});function mt(e,t,n){let r=ct(`diag`);if(r)return r[e](t,...n)}var ht,gt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"(){pt(),ht=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return mt(`debug`,this._namespace,e)}error(...e){return mt(`error`,this._namespace,e)}info(...e){return mt(`info`,this._namespace,e)}warn(...e){return mt(`warn`,this._namespace,e)}verbose(...e){return mt(`verbose`,this._namespace,e)}}}}),I,_t=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js"(){(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(I||={})}});function vt(e,t){e<I.NONE?e=I.NONE:e>I.ALL&&(e=I.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,I.ERROR),warn:n(`warn`,I.WARN),info:n(`info`,I.INFO),debug:n(`debug`,I.DEBUG),verbose:n(`verbose`,I.VERBOSE)}}var yt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"(){_t()}}),bt,xt,St=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js"(){gt(),yt(),_t(),pt(),bt=`diag`,xt=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=ct(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:I.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=ct(`diag`),i=vt(n.logLevel??I.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return st(`diag`,i,t,!0)},t.disable=()=>{lt(bt,t)},t.createComponentLogger=e=>new ht(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}});function Ct(e){return Symbol.for(e)}var wt,Tt,Et=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js"(){wt=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Tt=new wt}});function Dt(){return Rt}var Ot,kt,At,jt,Mt,Nt,Pt,Ft,It,Lt,Rt,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js"(){Ot=class{constructor(){}createGauge(e,t){return Bt}createHistogram(e,t){return Vt}createCounter(e,t){return zt}createUpDownCounter(e,t){return Ht}createObservableGauge(e,t){return Wt}createObservableCounter(e,t){return Ut}createObservableUpDownCounter(e,t){return Gt}addBatchObservableCallback(e,t){}removeBatchObservableCallback(e){}},kt=class{},At=class extends kt{add(e,t){}},jt=class extends kt{add(e,t){}},Mt=class extends kt{record(e,t){}},Nt=class extends kt{record(e,t){}},Pt=class{addCallback(e){}removeCallback(e){}},Ft=class extends Pt{},It=class extends Pt{},Lt=class extends Pt{},Rt=new Ot,zt=new At,Bt=new Mt,Vt=new Nt,Ht=new jt,Ut=new Ft,Wt=new It,Gt=new Lt}}),qt,Jt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"(){Et(),qt=class{active(){return Tt}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}}}),Yt,Xt,Zt,Qt=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js"(){Jt(),pt(),St(),Yt=`context`,Xt=new qt,Zt=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return st(Yt,e,xt.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return ct(Yt)||Xt}disable(){this._getContextManager().disable(),lt(Yt,xt.instance())}}}}),L,$t=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js"(){(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(L||={})}}),en,tn,nn,rn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js"(){$t(),en=`0000000000000000`,tn=`00000000000000000000000000000000`,nn={traceId:tn,spanId:en,traceFlags:L.NONE}}}),an,on=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js"(){rn(),an=class{constructor(e=nn){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}});function sn(e){return e.getValue(pn)||void 0}function cn(){return sn(Zt.getInstance().active())}function ln(e,t){return e.setValue(pn,t)}function un(e){return e.deleteValue(pn)}function dn(e,t){return ln(e,new an(t))}function fn(e){return sn(e)?.spanContext()}var pn,mn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js"(){Et(),on(),Qt(),pn=Ct(`OpenTelemetry Context Key SPAN`)}});function hn(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(bn[e.charCodeAt(t)]|0)+(bn[e.charCodeAt(t+1)]|0)+(bn[e.charCodeAt(t+2)]|0)+(bn[e.charCodeAt(t+3)]|0);return n===t}function gn(e){return hn(e,32)&&e!==tn}function _n(e){return hn(e,16)&&e!==en}function vn(e){return gn(e.traceId)&&_n(e.spanId)}function yn(e){return new an(e)}var bn,xn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js"(){rn(),on(),bn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}});function Sn(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Cn,wn,Tn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js"(){Qt(),mn(),on(),xn(),Cn=Zt.getInstance(),wn=class{startSpan(e,t,n=Cn.active()){if(t?.root)return new an;let r=n&&fn(n);return Sn(r)&&vn(r)?new an(r):new an}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Cn.active(),c=this.startSpan(e,i,s),l=ln(s,c);return Cn.with(l,o,void 0,c)}}}}),En,Dn,On=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js"(){Tn(),En=new wn,Dn=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):En}}}}),kn,An=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js"(){Tn(),kn=class{getTracer(e,t,n){return new wn}}}}),jn,Mn,Nn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js"(){On(),An(),jn=new kn,Mn=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Dn(this,e,t,n)}getDelegate(){return this._delegate??jn}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}}}),Pn,Fn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/SamplingResult.js"(){(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Pn||={})}}),In,Ln=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js"(){(function(e){e[e.INTERNAL=0]=`INTERNAL`,e[e.SERVER=1]=`SERVER`,e[e.CLIENT=2]=`CLIENT`,e[e.PRODUCER=3]=`PRODUCER`,e[e.CONSUMER=4]=`CONSUMER`})(In||={})}}),Rn,zn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js"(){(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Rn||={})}}),R,Bn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js"(){Qt(),R=Zt.getInstance()}}),z,Vn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag-api.js"(){St(),z=xt.instance()}}),Hn,Un,Wn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js"(){pt(),Nn(),xn(),mn(),St(),Hn=`trace`,Un=class e{constructor(){this._proxyTracerProvider=new Mn,this.wrapSpanContext=yn,this.isSpanContextValid=vn,this.deleteSpan=un,this.getSpan=sn,this.getActiveSpan=cn,this.getSpanContext=fn,this.setSpan=ln,this.setSpanContext=dn}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=st(Hn,this._proxyTracerProvider,xt.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return ct(Hn)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){lt(Hn,xt.instance()),this._proxyTracerProvider=new Mn}}}}),Gn,Kn=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js"(){Wn(),Gn=Un.getInstance()}}),B=n({"../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/index.js"(){Et(),Kt(),Fn(),Ln(),zn(),$t(),xn(),rn(),Bn(),Vn(),Kn()}});function qn(e){return e.setValue(Yn,!0)}function Jn(e){return e.getValue(Yn)===!0}var Yn,Xn=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js"(){B(),Yn=Ct(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}});function Zn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!Qn(n)){z.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!$n(r)){z.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function Qn(e){return typeof e==`string`&&e!==``}function $n(e){return e==null?!0:Array.isArray(e)?er(e):tr(typeof e)}function er(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(tr(e)){t=e;continue}return!1}return!1}}return!0}function tr(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var nr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/attributes.js"(){B()}});function rr(){return e=>{z.error(ir(e))}}function ir(e){return typeof e==`string`?e:JSON.stringify(ar(e))}function ar(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var or=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/logging-error-handler.js"(){B()}});function V(e){try{sr(e)}catch{}}var sr,cr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/global-error-handler.js"(){or(),sr=rr()}}),lr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/environment.js"(){}}),ur,dr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/version.js"(){ur=`2.7.1`}}),fr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),pr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){fr()}}),mr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),hr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){mr()}}),gr,_r,vr,yr,br=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){gr=`telemetry.sdk.language`,_r=`webjs`,vr=`telemetry.sdk.name`,yr=`telemetry.sdk.version`}}),xr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),Sr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),Cr=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.43.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){pr(),hr(),br(),xr(),Sr()}}),wr,Tr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/semconv.js"(){wr=`process.runtime.name`}}),Er,Dr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/sdk-info.js"(){dr(),Cr(),Tr(),Er={[vr]:`opentelemetry`,[wr]:`browser`,[gr]:_r,[yr]:ur}}}),Or,kr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/platform/browser/index.js"(){lr(),Dr(),Or=performance}});function Ar(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Vr)]}function jr(e){return Rr(Ar(Or.timeOrigin),Ar(typeof e==`number`?e:Or.now()))}function Mr(e){if(Ir(e))return e;if(typeof e==`number`)return e<Or.timeOrigin?jr(e):Ar(e);if(e instanceof Date)return Ar(e.getTime());throw TypeError(`Invalid input type`)}function Nr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Hr),[n,r]}function Pr(e){return e[0]*Hr+e[1]}function Fr(e){return e[0]*1e6+e[1]/1e3}function Ir(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Lr(e){return Ir(e)||typeof e==`number`||e instanceof Date}function Rr(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Hr&&(n[1]-=Hr,n[0]+=1),n}var zr,Br,Vr,Hr,Ur=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/common/time.js"(){kr(),zr=9,Br=6,Vr=10**Br,Hr=10**zr}}),H,Wr=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/ExportResult.js"(){(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(H||={})}});function Gr(e){if(!Kr(e)||qr(e)!==Xr)return!1;let t=ni(e);if(t===null)return!0;let n=ii.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ei.call(n)===ti}function Kr(e){return typeof e==`object`&&!!e}function qr(e){return e==null?e===void 0?Qr:Zr:ai&&ai in Object(e)?Jr(e):Yr(e)}function Jr(e){let t=ii.call(e,ai),n=e[ai],r=!1;try{e[ai]=void 0,r=!0}catch{}let i=oi.call(e);return r&&(t?e[ai]=n:delete e[ai]),i}function Yr(e){return oi.call(e)}var Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/lodash.merge.js"(){Xr=`[object Object]`,Zr=`[object Null]`,Qr=`[object Undefined]`,$r=Function.prototype,ei=$r.toString,ti=ei.call(Object),ni=Object.getPrototypeOf,ri=Object.prototype,ii=ri.hasOwnProperty,ai=Symbol?Symbol.toStringTag:void 0,oi=ri.toString}});function ci(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=ui(t,e.shift(),0,n);return t}function li(e){return fi(e)?e.slice():e}function ui(e,t,n=0,r){let i;if(!(n>_i)){if(n++,hi(e)||hi(t)||pi(t))i=li(t);else if(fi(e)){if(i=e.slice(),fi(t))for(let e=0,n=t.length;e<n;e++)i.push(li(t[e]));else if(mi(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=li(t[r]))}}}else if(mi(e))if(mi(t)){if(!gi(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(hi(c))typeof c>`u`?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(di(e,s,r)||di(t,s,r))delete i[s];else{if(mi(a)&&mi(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=ui(i[s],c,n,r)}}}}else i=t;return i}}function di(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function fi(e){return Array.isArray(e)}function pi(e){return typeof e==`function`}function mi(e){return!hi(e)&&!fi(e)&&!pi(e)&&typeof e==`object`}function hi(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e>`u`||e instanceof Date||e instanceof RegExp||e===null}function gi(e,t){return!(!Gr(e)||!Gr(t))}var _i,vi=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/merge.js"(){si(),_i=20}});function yi(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new bi(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}var bi,xi=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/timeout.js"(){bi=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}}}}),Si,Ci=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/promise.js"(){Si=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}}}),wi,Ti=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/utils/callback.js"(){Ci(),wi=class{_isCalled=!1;_deferred=new Si;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}});function Ei(e,t){return new Promise(n=>{R.with(qn(R.active()),()=>{e.export(t,n)})})}var Di=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/internal/exporter.js"(){B(),Xn()}}),Oi,U=n({"../../node_modules/.pnpm/@opentelemetry+core@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/core/build/esm/index.js"(){nr(),cr(),Ur(),Wr(),kr(),Xn(),vi(),xi(),Ti(),Di(),Oi={_export:Ei}}});function ki(e){return Object.prototype.hasOwnProperty.call(e,`partialSuccess`)}function Ai(){return{handleResponse(e){e==null||!ki(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||z.warn(`Received Partial Success response:`,JSON.stringify(e.partialSuccess))}}}var ji=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/logging-response-handler.js"(){B()}});function Mi(e,t){return new Ni(e.transport,e.serializer,Ai(),e.promiseHandler,t.timeout)}var Ni,Pi=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js"(){U(),Ke(),ji(),B(),Ni=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,t,n,r,i){this._transport=e,this._serializer=t,this._responseHandler=n,this._promiseQueue=r,this._timeout=i,this._diagLogger=z.createComponentLogger({namespace:`OTLPExportDelegate`})}export(e,t){if(this._diagLogger.debug(`items to be sent`,e),this._promiseQueue.hasReachedLimit()){t({code:H.FAILED,error:Error(`Concurrent export limit reached`)});return}let n=this._serializer.serializeRequest(e);if(n==null){t({code:H.FAILED,error:Error(`Nothing to send`)});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(e=>{if(e.status===`success`){if(e.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(e.data))}catch(t){this._diagLogger.warn(`Export succeeded but could not deserialize response - is the response specification compliant?`,t,e.data)}t({code:H.SUCCESS});return}else if(e.status===`failure`&&e.error){t({code:H.FAILED,error:e.error});return}else e.status===`retryable`?t({code:H.FAILED,error:e.error??new Ge(`Export failed with retryable status`)}):t({code:H.FAILED,error:new Ge(`Export failed with unknown error`)})},e=>t({code:H.FAILED,error:e})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug(`shutdown started`),await this.forceFlush(),this._transport.shutdown()}}}});function Fi(e,t,n){return Mi({transport:n,serializer:t,promiseHandler:Qe(e)},{timeout:e.timeoutMillis})}var Ii=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-network-export-delegate.js"(){et(),Pi()}}),Li=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js"(){We()}}),Ri,zi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/types/LogRecord.js"(){(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(Ri||={})}}),Bi,Vi,Hi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js"(){Bi=class{emit(e){}enabled(){return!1}},Vi=new Bi}});function Ui(e,t,n){return r=>r===e?t:n}var Wi,Gi,Ki,qi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js"(){Wi=Symbol.for(`io.opentelemetry.js.api.logs`),Gi=globalThis,Ki=1}}),Ji,Yi,Xi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js"(){Hi(),Ji=class{getLogger(e,t,n){return new Bi}},Yi=new Ji}}),Zi,Qi=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js"(){Hi(),Zi=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Vi}}}}),$i,ea=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js"(){Xi(),Qi(),$i=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new Zi(this,e,t,n)}_getDelegate(){return this._delegate??Yi}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}}}),ta,na=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js"(){qi(),Xi(),ea(),ta=class e{constructor(){this._proxyLoggerProvider=new $i}static getInstance(){return this._instance||=new e,this._instance}setGlobalLoggerProvider(e){return Gi[Wi]?this.getLoggerProvider():(Gi[Wi]=Ui(Ki,e,Yi),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return Gi[Wi]?.call(Gi,Ki)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete Gi[Wi],this._proxyLoggerProvider=new $i}}}}),ra=n({"../../node_modules/.pnpm/@opentelemetry+api-logs@0.216.0/node_modules/@opentelemetry/api-logs/build/esm/index.js"(){zi(),Hi(),na(),ta.getInstance()}}),ia=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/SemanticAttributes.js"(){}}),aa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/trace/index.js"(){ia()}}),oa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/SemanticResourceAttributes.js"(){}}),sa=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/resource/index.js"(){oa()}}),ca,la,ua,da,fa,pa,ma,ha=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_attributes.js"(){ca=`exception.message`,la=`exception.stacktrace`,ua=`exception.type`,da=`service.name`,fa=`telemetry.sdk.language`,pa=`telemetry.sdk.name`,ma=`telemetry.sdk.version`}}),ga=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_metrics.js"(){}}),_a=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/stable_events.js"(){}}),va=n({"../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.40.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js"(){aa(),sa(),ha(),ga(),_a()}});function ya(){if(ba===void 0)try{let e=globalThis.process.argv0;ba=e?`unknown_service:${e}`:`unknown_service`}catch{ba=`unknown_service`}return ba}var ba,xa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/default-service-name.js"(){}}),Sa,Ca=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/utils.js"(){Sa=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}});function wa(e,t){return ja.FromAttributeList(Object.entries(e),t)}function Ta(e,t){return new ja(e,t)}function Ea(){return wa({})}function Da(){return wa({[da]:ya(),[fa]:Er[fa],[pa]:Er[pa],[ma]:Er[ma]})}function Oa(e){return e.map(([e,t])=>Sa(t)?[e,t.catch(t=>{z.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function ka(e){if(typeof e==`string`||e===void 0)return e;z.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function Aa(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;z.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var ja,Ma=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/ResourceImpl.js"(){B(),U(),va(),xa(),Ca(),ja=class e{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=Oa(t),r._asyncAttributesPending=t.filter(([e,t])=>Sa(t)).length>0,r}constructor(e,t){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Sa(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Oa(this._rawAttributes),this._schemaUrl=ka(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Sa(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&z.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Sa(n)){z.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=Aa(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}}}),Na,Pa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detect-resources.js"(){B(),Ma(),Na=(e={})=>(e.detectors||[]).map(t=>{try{let n=Ta(t.detect(e));return z.debug(`${t.constructor.name} found resource.`,n),n}catch(e){return z.debug(`${t.constructor.name} failed: ${e.message}`),Ea()}}).reduce((e,t)=>e.merge(t),Ea())}}),Fa,Ia,La=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/EnvDetector.js"(){B(),va(),U(),Fa=class{_MAX_LENGTH=255;_COMMA_SEPARATOR=`,`;_LABEL_KEY_VALUE_SPLITTER=`=`;detect(e){return{attributes:{}}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`)}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},Ia=new Fa}}),Ra,za,Ba=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/NoopDetector.js"(){Ra=class{detect(){return{attributes:{}}}},za=new Ra}}),Va,Ha=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/HostDetector.js"(){Ba(),Va=za}}),Ua,Wa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/OSDetector.js"(){Ba(),Ua=za}}),Ga,Ka=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ProcessDetector.js"(){Ba(),Ga=za}}),qa,Ja=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/ServiceInstanceIdDetector.js"(){Ba(),qa=za}}),Ya=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/platform/browser/index.js"(){Ha(),Wa(),Ka(),Ja()}}),Xa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/detectors/index.js"(){La(),Ya()}}),Za={};r(Za,{defaultResource:()=>Da,defaultServiceName:()=>ya,detectResources:()=>Na,emptyResource:()=>Ea,envDetector:()=>Ia,hostDetector:()=>Va,osDetector:()=>Ua,processDetector:()=>Ga,resourceFromAttributes:()=>wa,serviceInstanceIdDetector:()=>qa});var Qa=n({"../../node_modules/.pnpm/@opentelemetry+resources@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/resources/build/esm/index.js"(){Pa(),Xa(),Ma(),xa()}});function $a(e,t){let n={attributes:to(e.attributes,t),droppedAttributesCount:0},r=e.schemaUrl;return r&&r!==``&&(n.schemaUrl=r),n}function eo(e){return{name:e.name,version:e.version}}function to(e,t){return Object.keys(e).map(n=>no(n,e[n],t))}function no(e,t,n){return{key:e,value:ro(t,n)}}function ro(e,t){let n=typeof e;if(n===`string`)return{stringValue:e};if(n===`number`)return Number.isInteger(e)?{intValue:e}:{doubleValue:e};if(n===`boolean`)return{boolValue:e};if(e instanceof Uint8Array)return{bytesValue:t.encodeUint8Array(e)};if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=ro(e[r],t);return{arrayValue:{values:n}}}if(n===`object`&&e!=null){let n=Object.keys(e),r=Array(n.length);for(let i=0;i<n.length;i++)r[i]={key:n[i],value:ro(e[n[i]],t)};return{kvlistValue:{values:r}}}return{}}var io=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/internal.js"(){}});function ao(e){let t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function oo(e){return ao(e).toString()}function so(e){return e}var co,lo,uo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/common/utils.js"(){U(),co=typeof BigInt<`u`?oo:Pr,lo={encodeHrTime:co,encodeSpanContext:so,encodeOptionalSpanContext:so,encodeUint8Array:e=>{if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=String.fromCharCode(e[n]);return btoa(t.join(``))}}}});function fo(e,t){let n=e&255|yo;return t&&(n|=bo),n}function po(e,t){let n=e.spanContext(),r=e.status,i=e.parentSpanContext?.spanId?t.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:t.encodeSpanContext(n.traceId),spanId:t.encodeSpanContext(n.spanId),parentSpanId:i,traceState:n.traceState?.serialize(),name:e.name,kind:e.kind==null?0:e.kind+1,startTimeUnixNano:t.encodeHrTime(e.startTime),endTimeUnixNano:t.encodeHrTime(e.endTime),attributes:to(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>ho(e,t)),droppedEventsCount:e.droppedEventsCount,status:{code:r.code,message:r.message},links:e.links.map(e=>mo(e,t)),droppedLinksCount:e.droppedLinksCount,flags:fo(n.traceFlags,e.parentSpanContext?.isRemote)}}function mo(e,t){return{attributes:e.attributes?to(e.attributes,t):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:fo(e.context.traceFlags,e.context.isRemote)}}function ho(e,t){return{attributes:e.attributes?to(e.attributes,t):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0}}function go(e,t){return{resourceSpans:vo(e,t)}}function _o(e){let t=new Map;for(let n of e){let e=t.get(n.resource);e||(e=new Map,t.set(n.resource,e));let r=`${n.instrumentationScope.name}@${n.instrumentationScope.version||``}:${n.instrumentationScope.schemaUrl||``}`,i=e.get(r);i||(i=[],e.set(r,i)),i.push(n)}return t}function vo(e,t){let n=_o(e),r=[],i=n.entries(),a=i.next();for(;!a.done;){let[e,n]=a.value,o=[],s=n.values(),c=s.next();for(;!c.done;){let e=c.value;if(e.length>0){let n=e.map(e=>po(e,t));o.push({scope:eo(e[0].instrumentationScope),spans:n,schemaUrl:e[0].instrumentationScope.schemaUrl})}c=s.next()}let l=$a(e,t),u={resource:l,scopeSpans:o,schemaUrl:l.schemaUrl};r.push(u),a=i.next()}return r}var yo,bo,xo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/internal.js"(){io(),yo=256,bo=512}});function So(e,t){return{resourceLogs:wo(e,t)}}function Co(e){let t=new Map;for(let n of e){let{resource:e,instrumentationScope:{name:r,version:i=``,schemaUrl:a=``}}=n,o=t.get(e);o||(o=new Map,t.set(e,o));let s=`${r}@${i}:${a}`,c=o.get(s);c||(c=[],o.set(s,c)),c.push(n)}return t}function wo(e,t){let n=Co(e);return Array.from(n,([e,n])=>{let r=$a(e,t);return{resource:r,scopeLogs:Array.from(n,([,e])=>({scope:eo(e[0].instrumentationScope),logRecords:e.map(e=>To(e,t)),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:r.schemaUrl}})}function To(e,t){return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:ro(e.body,t),eventName:e.eventName,attributes:Eo(e.attributes,t),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)}}function Eo(e,t){return Object.keys(e).map(n=>no(n,e[n],t))}var Do=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/internal.js"(){io()}}),Oo,ko=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/logs.js"(){Do(),uo(),B(),Oo={serializeRequest:e=>{let t=So(e,lo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return z.warn(`Failed to parse logs export response: ${e.message}. Returning empty response`),{}}}}}}),Ao=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/logs/json/index.js"(){ko()}}),jo,Mo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/trace.js"(){xo(),uo(),B(),jo={serializeRequest:e=>{let t=go(e,lo);return new TextEncoder().encode(JSON.stringify(t))},deserializeResponse:e=>{if(e.length===0)return{};let t=new TextDecoder;try{return JSON.parse(t.decode(e))}catch(e){return z.warn(`Failed to parse trace export response: ${e.message}. Returning empty response`),{}}}}}}),No=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/trace/json/index.js"(){Mo()}}),Po=n({"../../node_modules/.pnpm/@opentelemetry+otlp-transformer@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-transformer/build/esm/index.js"(){Ao(),No()}});function Fo(){return 2*Vo*Math.random()-Vo}function Io(e){return new Ho(e.transport)}var Lo,Ro,zo,Bo,Vo,Ho,Uo=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/retrying-transport.js"(){B(),Lo=5,Ro=1e3,zo=5e3,Bo=1.5,Vo=.2,Ho=class{_transport;constructor(e){this._transport=e}retry(e,t,n){return new Promise((r,i)=>{setTimeout(()=>{this._transport.send(e,t).then(r,i)},n)})}async send(e,t){let n=Lo,r=Ro,i=Date.now()+t,a=await this._transport.send(e,t);for(;a.status===`retryable`&&n>0;){n--;let t=Math.max(Math.min(r*(1+Fo()),zo),0);r*=Bo;let o=a.retryInMillis??t,s=i-Date.now();if(o>s)return z.info(`Export retry time ${Math.round(o)}ms exceeds remaining timeout ${Math.round(s)}ms, not retrying further.`),a;z.verbose(`Scheduling export retry in ${Math.round(o)}ms`),a=await this.retry(e,s,o)}return a.status===`success`?z.verbose(`Export succeeded after ${Lo-n} retry attempts.`):a.status===`retryable`?z.info(`Export failed after maximum retry attempts (${Lo}).`):z.info(`Export failed with non-retryable error: ${a.error}`),a}shutdown(){return this._transport.shutdown()}}}});function Wo(e){return e===429||e===502||e===503||e===504}function Go(e){if(e==null)return;let t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;let n=new Date(e).getTime()-Date.now();return n>=0?n:0}var Ko=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/is-export-retryable.js"(){}});function qo(e){return new $o(e)}function Jo(e){return e instanceof TypeError&&!e.cause}var Yo,Xo,Zo,Qo,$o,es=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/fetch-transport.js"(){B(),Ko(),Yo=60*1024,Xo=9,Zo=0,Qo=0,$o=class{_parameters;constructor(e){this._parameters=e}async send(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t),i=globalThis.fetch;typeof i.__original==`function`&&(i=i.__original);let a=e.byteLength,o=Zo+a>Yo,s=!o&&!(Qo>=Xo);if(s)Zo+=a,Qo++;else{let e=o?`size limit`:`count limit`;z.debug(`keepalive disabled: ${(a/1024).toFixed(1)}KB payload, ${Qo} pending (${e})`)}try{let t=new URL(this._parameters.url),r=await i(t.href,{method:`POST`,headers:await this._parameters.headers(),body:e,signal:n.signal,keepalive:s,mode:globalThis.location?globalThis.location.origin===t.origin?`same-origin`:`cors`:`no-cors`});return r.status>=200&&r.status<=299?(z.debug(`export response success (status: ${r.status})`),{status:`success`}):Wo(r.status)?(z.warn(`export response retryable (status: ${r.status})`),{status:`retryable`,retryInMillis:Go(r.headers.get(`Retry-After`))}):(z.error(`export response failure (status: ${r.status})`),{status:`failure`,error:Error(`Fetch request failed with non-retryable status ${r.status}`)})}catch(e){return Jo(e)?(z.warn(`export request retryable (network error: ${e})`),{status:`retryable`,error:Error(`Fetch request encountered a network error`,{cause:e})}):(z.error(`export request failure (error: ${e})`),{status:`failure`,error:Error(`Fetch request errored`,{cause:e})})}finally{clearTimeout(r),s&&(Zo-=a,Qo--)}}shutdown(){}}}});function ts(e,t){return Fi(e,t,Io({transport:qo(e)}))}var ns=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-browser-http-export-delegate.js"(){Uo(),Ii(),es()}});function rs(e){let t={};return Object.entries(e??{}).forEach(([e,n])=>{typeof n<`u`?t[e]=String(n):z.warn(`Header "${e}" has invalid value (${n}) and will be ignored`)}),t}var is=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/util.js"(){B()}});function as(e,t,n){return async()=>{let r={...await n()},i={};return t!=null&&Object.assign(i,await t()),e!=null&&Object.assign(i,rs(await e())),Object.assign(i,r)}}function os(e){if(e!=null)try{let t=globalThis.location?.href;return new URL(e,t).href}catch{throw Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function ss(e,t,n){return{...Ye(e,t,n),headers:as(e.headers,t.headers,n.headers),url:os(e.url)??t.url??n.url}}function cs(e,t){return{...Xe(),headers:async()=>e,url:`http://localhost:4318/`+t}}var ls=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/otlp-http-configuration.js"(){Ze(),is()}});function us(e){return typeof e.headers==`function`?e.headers:Je(e.headers)}var ds=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-http-options.js"(){Ze()}});function fs(e,t,n){return ss({url:e.url,timeoutMillis:e.timeoutMillis,headers:us(e),concurrencyLimit:e.concurrencyLimit},{},cs(n,t))}var ps=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/convert-legacy-browser-http-options.js"(){ls(),ds()}});function ms(e,t,n,r){return ts(fs(e,n,r),t)}var hs=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/configuration/create-legacy-browser-delegate.js"(){ns(),ps()}}),gs=n({"../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index-browser-http.js"(){hs()}}),_s,vs=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/OTLPTraceExporter.js"(){Li(),Po(),gs(),_s=class extends Ue{constructor(e={}){super(ms(e,jo,`v1/traces`,{"Content-Type":`application/json`}))}}}}),ys=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/browser/index.js"(){vs()}}),bs={};r(bs,{OTLPTraceExporter:()=>_s});var xs=n({"../../node_modules/.pnpm/@opentelemetry+exporter-trace-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/index.js"(){ys()}}),Ss,Cs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/enums.js"(){Ss=`exception`}}),ws,Ts=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Span.js"(){B(),U(),va(),Cs(),ws=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Rn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Or.now(),this._performanceOffset=t-(this._performanceStartTime+Or.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return z.warn(`Invalid attribute key: ${e}`),this;if(!$n(t))return z.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return z.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&z.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Lr(t)&&(Lr(n)||(n=t),t=void 0);let i=Zn(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&z.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=Zn(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===Rn.UNSET||this.status.code===Rn.OK)return this;let t={code:e.code};return e.code===Rn.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&z.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){z.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=Nr(this.startTime,this.endTime),this._duration[0]<0&&(z.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&z.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&z.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=Or.now())return jr(e+this._performanceOffset);if(typeof e==`number`)return Ar(e);if(e instanceof Date)return Ar(e.getTime());if(Ir(e))return e;if(this._startTimeProvided)return Ar(Date.now());let t=Or.now()-this._performanceStartTime;return Rr(this.startTime,Ar(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[ca]=e:e&&(e.code?n[ua]=e.code.toString():e.name&&(n[ua]=e.name),e.message&&(n[ca]=e.message),e.stack&&(n[la]=e.stack)),n[ua]||n[ca]?this.addEvent(Ss,n,t):z.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);z.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(z.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}}}}),Es,Ds=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Sampler.js"(){(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(Es||={})}}),Os,ks=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOffSampler.js"(){Ds(),Os=class{shouldSample(){return{decision:Es.NOT_RECORD}}toString(){return`AlwaysOffSampler`}}}}),As,js=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/AlwaysOnSampler.js"(){Ds(),As=class{shouldSample(){return{decision:Es.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}}}}),Ms,Ns=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/ParentBasedSampler.js"(){B(),U(),ks(),js(),Ms=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||=(V(Error(`ParentBasedSampler must have a root sampler configured`)),new As),this._remoteParentSampled=e.remoteParentSampled??new As,this._remoteParentNotSampled=e.remoteParentNotSampled??new Os,this._localParentSampled=e.localParentSampled??new As,this._localParentNotSampled=e.localParentNotSampled??new Os}shouldSample(e,t,n,r,i,a){let o=Gn.getSpanContext(e);return!o||!vn(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&L.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&L.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}}}),Ps,Fs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/sampler/TraceIdRatioBasedSampler.js"(){B(),Ds(),Ps=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:gn(t)&&this._accumulate(t)<this._upperBound?Es.RECORD_AND_SAMPLED:Es.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}}}});function Is(){return{sampler:Ls(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function Ls(){let e=zs.ParentBasedAlwaysOn;switch(e){case zs.AlwaysOn:return new As;case zs.AlwaysOff:return new Os;case zs.ParentBasedAlwaysOn:return new Ms({root:new As});case zs.ParentBasedAlwaysOff:return new Ms({root:new Os});case zs.TraceIdRatio:return new Ps(Rs());case zs.ParentBasedTraceIdRatio:return new Ms({root:new Ps(Rs())});default:return z.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${zs.ParentBasedAlwaysOn}".`),new Ms({root:new As})}}function Rs(){return z.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${Bs}.`),Bs}var zs,Bs,Vs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/config.js"(){B(),U(),ks(),js(),Ns(),Fs(),(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(zs||={}),Bs=1}});function Hs(e){let t={sampler:Ls()},n=Is(),r=Object.assign({},n,t,e);return r.generalLimits=Object.assign({},n.generalLimits,e.generalLimits||{}),r.spanLimits=Object.assign({},n.spanLimits,e.spanLimits||{}),r}function Us(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??void 0??void 0??Ws,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??void 0??void 0??Gs,Object.assign({},e,{spanLimits:t})}var Ws,Gs,Ks=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/utility.js"(){Vs(),U(),Ws=128,Gs=1/0}}),qs,Js=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/BatchSpanProcessorBase.js"(){B(),U(),qs=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize=typeof t?.maxExportBatchSize==`number`?t.maxExportBatchSize:512,this._maxQueueSize=typeof t?.maxQueueSize==`number`?t.maxQueueSize:2048,this._scheduledDelayMillis=typeof t?.scheduledDelayMillis==`number`?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis=typeof t?.exportTimeoutMillis==`number`?t.exportTimeoutMillis:3e4,this._shutdownOnce=new wi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(z.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&z.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++;return}this._droppedSpansCount>0&&(z.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);R.with(qn(R.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,r=>{clearTimeout(n),r.code===H.SUCCESS?e():t(r.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??=[],a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{V(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,V(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}}}),Ys,Xs=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/export/BatchSpanProcessor.js"(){Js(),U(),Ys=class extends qs{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){e?.disableAutoFlushOnDocumentHide!==!0&&typeof document<`u`&&(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush().catch(e=>{V(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{V(e)})},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}onShutdown(){typeof document<`u`&&(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}}}});function Zs(e){for(let t=0;t<e.length;t++)e[t]=Math.random()*256>>>0;for(let t=0;t<e.length;t++)if(e[t]>0)return;e[e.length-1]=1}function Qs(e){let t=``;for(let n=0;n<e.length;n++)t+=rc[e[n]];return t}var $s,ec,tc,nc,rc,ic,ac=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/RandomIdGenerator.js"(){$s=16,ec=8,tc=new Uint8Array($s),nc=new Uint8Array(ec),rc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`)),ic=class{generateTraceId(){return Zs(tc),Qs(tc)}generateSpanId(){return Zs(nc),Qs(nc)}}}}),oc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/platform/browser/index.js"(){Xs(),ac()}}),sc,cc,lc,uc,dc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/semconv.js"(){sc=`otel.span.parent.origin`,cc=`otel.span.sampling_result`,lc=`otel.sdk.span.live`,uc=`otel.sdk.span.started`}});function fc(e){return e?e.isRemote?`remote`:`local`:`none`}function pc(e){switch(e){case Es.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case Es.RECORD:return`RECORD_ONLY`;case Es.NOT_RECORD:return`DROP`}}var mc,hc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/TracerMetrics.js"(){Ds(),dc(),mc=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(uc,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(lc,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=pc(t);if(this.startedSpans.add(1,{[sc]:fc(e),[cc]:n}),t===Es.NOT_RECORD)return()=>{};let r={[cc]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}}}}),gc,_c=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/version.js"(){gc=`2.7.1`}}),vc,yc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/Tracer.js"(){B(),U(),Ts(),Ks(),oc(),hc(),_c(),vc=class{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,n,r){let i=Hs(t);this._sampler=i.sampler,this._generalLimits=i.generalLimits,this._spanLimits=i.spanLimits,this._idGenerator=t.idGenerator||new ic,this._resource=n,this._spanProcessor=r,this.instrumentationScope=e;let a=i.meterProvider?i.meterProvider.getMeter(`@opentelemetry/sdk-trace`,gc):Dt();this._tracerMetrics=new mc(a)}startSpan(e,t={},n=R.active()){t.root&&(n=Gn.deleteSpan(n));let r=Gn.getSpan(n);if(Jn(n))return z.debug(`Instrumentation suppressed, returning Noop Span`),Gn.wrapSpanContext(nn);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,c;!i||!Gn.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,c=i.traceState,o=i);let l=t.kind??In.INTERNAL,u=(t.links??[]).map(e=>({context:e.context,attributes:Zn(e.attributes)})),d=Zn(t.attributes),f=this._sampler.shouldSample(n,s,e,l,d,u),p=this._tracerMetrics.startSpan(i,f.decision);c=f.traceState??c;let m=f.decision===Pn.RECORD_AND_SAMPLED?L.SAMPLED:L.NONE,h={traceId:s,spanId:a,traceFlags:m,traceState:c};if(f.decision===Pn.NOT_RECORD)return z.debug(`Recording is off, propagating context in a non-recording span`),Gn.wrapSpanContext(h);let g=Zn(Object.assign(d,f.attributes));return new ws({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:h,name:e,kind:l,links:u,parentSpanContext:o,attributes:g,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:p})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??R.active(),c=this.startSpan(e,i,s),l=Gn.setSpan(s,c);return R.with(l,o,void 0,c)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}}}),bc,xc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/MultiSpanProcessor.js"(){U(),bc=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{V(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}}}}),Sc,Cc,wc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/BasicTracerProvider.js"(){U(),Qa(),yc(),Vs(),xc(),Ks(),(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Sc||={}),Cc=class{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){let t=ci({},Is(),Us(e));this._resource=t.resource??Da(),this._config=Object.assign({},t,{resource:this._resource});let n=[];e.spanProcessors?.length&&n.push(...e.spanProcessors),this._activeSpanProcessor=new bc(n)}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new vc({name:e,version:t,schemaUrl:n?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(r)}forceFlush(){let e=this._config.forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Sc.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Sc.timeout&&(r=Sc.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Sc.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Sc.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}}}),Tc,Ec=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/ConsoleSpanExporter.js"(){U(),Tc=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Fr(e.startTime),duration:Fr(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:H.SUCCESS})}}}}),Dc,Oc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/InMemorySpanExporter.js"(){U(),Dc=class{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:H.FAILED,error:Error(`Exporter has been stopped`)});this._finishedSpans.push(...e),setTimeout(()=>t({code:H.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}}}),kc,Ac=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/SimpleSpanProcessor.js"(){B(),U(),kc=class{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new wi(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&L.SAMPLED)===0)return;let t=this._doExport(e).catch(e=>V(e));this._pendingExports.add(t),t.finally(()=>this._pendingExports.delete(t))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let t=await Oi._export(this._exporter,[e]);if(t.code!==H.SUCCESS)throw t.error??Error(`SimpleSpanProcessor: span export failed (status ${t})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),jc,Mc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/export/NoopSpanProcessor.js"(){jc=class{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}}}),Nc={};r(Nc,{AlwaysOffSampler:()=>Os,AlwaysOnSampler:()=>As,BasicTracerProvider:()=>Cc,BatchSpanProcessor:()=>Ys,ConsoleSpanExporter:()=>Tc,InMemorySpanExporter:()=>Dc,NoopSpanProcessor:()=>jc,ParentBasedSampler:()=>Ms,RandomIdGenerator:()=>ic,SamplingDecision:()=>Es,SimpleSpanProcessor:()=>kc,TraceIdRatioBasedSampler:()=>Ps});var Pc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-trace-base@2.7.1_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/esm/index.js"(){wc(),oc(),Ec(),Oc(),Ac(),Mc(),ks(),js(),Ns(),Fs(),Ds()}}),Fc,Ic=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/browser/OTLPLogExporter.js"(){Li(),Po(),gs(),Fc=class extends Ue{constructor(e={}){super(ms(e,Oo,`v1/logs`,{"Content-Type":`application/json`}))}}}}),Lc=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/browser/index.js"(){Ic()}}),Rc={};r(Rc,{OTLPLogExporter:()=>Fc});var zc=n({"../../node_modules/.pnpm/@opentelemetry+exporter-logs-otlp-http@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/index.js"(){Lc()}});function Bc(e){return Vc(e,new WeakSet)}function Vc(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Vc(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Vc(e,t))}return!1}var Hc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js"(){}}),Uc,Wc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js"(){B(),U(),va(),Hc(),Uc=class{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;_attributesCount=0;_droppedAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:o,severityText:s,body:c,attributes:l={},exception:u,context:d}=n,f=Date.now();if(this.hrTime=Mr(r??f),this.hrTimeObserved=Mr(i??f),d){let e=Gn.getSpanContext(d);e&&vn(e)&&(this.spanContext=e)}this.severityNumber=o,this.severityText=s,this.body=c,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(l),u!=null&&this._setException(u)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return z.warn(`Invalid attribute key: ${e}`),this;if(!Bc(t))return z.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&z.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return z.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,ca)||this.setAttribute(ca,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,ua)||this.setAttribute(ua,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,ua)||this.setAttribute(ua,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,ca)||this.setAttribute(ca,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,la)||this.setAttribute(la,n.stack),t=!0)}t||z.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&z.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}}}),Gc,Kc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js"(){ra(),B(),Wc(),Gc=class{instrumentationScope;_sharedState;_loggerConfig;constructor(e,t){this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||R.active(),r=e.severityNumber??Ri.UNSPECIFIED;if(r!==Ri.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=Gn.getSpanContext(n);if(e&&vn(e)&&(e.traceFlags&L.SAMPLED)!==L.SAMPLED)return}let i=new Uc(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==Ri.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||R.active();if(t.traceBased){let e=Gn.getSpanContext(r);if(e&&vn(e)&&(e.traceFlags&L.SAMPLED)!==L.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}}}),qc,Jc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/NoopLogRecordProcessor.js"(){qc=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}}}),Yc,Xc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/MultiLogRecordProcessor.js"(){U(),Yc=class{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>yi(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}});function Zc(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var Qc=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js"(){}}),$c,el=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/semconv.js"(){$c=`otel.sdk.log.created`}}),tl,nl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerMetrics.js"(){el(),tl=class{createdLogs;constructor(e){this.createdLogs=e.createCounter($c,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}}}),rl,il=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/version.js"(){rl=`0.216.0`}}),al,ol,sl,cl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js"(){B(),ra(),Jc(),Xc(),Qc(),nl(),il(),al={disabled:!1,minimumSeverity:Ri.UNSPECIFIED,traceBased:!1},ol=()=>({...al}),sl=class{loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggerMetrics;_loggerConfigurator;_loggerConfigs=new Map;constructor(e,t,n,r,i,a){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Yc(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new qc,this._loggerConfigurator=i??ol;let o=a?a.getMeter(`@opentelemetry/sdk-logs`,rl):Dt();this.loggerMetrics=new tl(o)}getLoggerConfig(e){let t=Zc(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}}}),ll,ul,dl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js"(){B(),ra(),Qa(),U(),Kc(),cl(),ll=`unknown`,ul=class{_shutdownOnce;_sharedState;constructor(e={}){let t={resource:e.resource??Da(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??ol,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new sl(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new wi(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return z.warn(`A shutdown LoggerProvider cannot provide a Logger`),Vi;e||z.warn(`Logger requested without instrumentation scope name.`);let r=e||ll,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Gc({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(z.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(z.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}}}),fl,pl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/ConsoleLogRecordExporter.js"(){U(),fl=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:Fr(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:H.SUCCESS})}}}}),ml,hl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/SimpleLogRecordProcessor.js"(){U(),ml=class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new wi(this._shutdown,this),this._unresolvedExports=new Set}onEmit(e){if(this._shutdownOnce.isCalled)return;let t=()=>Oi._export(this._exporter,[e]).then(e=>{e.code!==H.SUCCESS&&V(e.error??Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(V);if(e.resource.asyncAttributesPending){let n=e.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(n),t()),V);n!=null&&this._unresolvedExports.add(n)}else t()}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}}}),gl,_l=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/InMemoryLogRecordExporter.js"(){U(),gl=class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:H.FAILED,error:Error(`Exporter has been stopped`)});this._finishedLogRecords.push(...e),t({code:H.SUCCESS})}async shutdown(){this._stopped=!0,this.reset()}async forceFlush(){}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}}}});async function vl(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var yl,bl,xl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/export/BatchLogRecordProcessorBase.js"(){B(),U(),yl=class{_exportCompleted;_exportScheduledPromise;_exportScheduledResolve;constructor(e,t,n){this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await vl(t),await R.with(qn(R.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){V(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===H.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},bl=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_currentExport=null;_finishedLogRecords=[];_timer;_shutdownOnce;_flushing=!1;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new wi(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(z.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new yl(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){V(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new yl(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,V(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}}}),Sl,Cl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/platform/browser/export/BatchLogRecordProcessor.js"(){xl(),Sl=class extends bl{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){typeof document>`u`||(this._visibilityChangeListener&&document.removeEventListener(`visibilitychange`,this._visibilityChangeListener),this._pageHideListener&&document.removeEventListener(`pagehide`,this._pageHideListener))}_onInit(e){e?.disableAutoFlushOnDocumentHide===!0||typeof document>`u`||(this._visibilityChangeListener=()=>{document.visibilityState===`hidden`&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener(`visibilitychange`,this._visibilityChangeListener),document.addEventListener(`pagehide`,this._pageHideListener))}}}}),wl=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/platform/browser/index.js"(){Cl()}});function Tl(e){return t=>{let n=t.name;for(let{pattern:t,config:r}of e)if(El(n,t))return{disabled:r.disabled??Dl.disabled,minimumSeverity:r.minimumSeverity??Dl.minimumSeverity,traceBased:r.traceBased??Dl.traceBased};return{...Dl}}}function El(e,t){if(t===e)return!0;if(t.includes(`*`)){let n=t.split(`*`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`.*`);return RegExp(`^${n}$`).test(e)}return!1}var Dl,Ol=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/config/LoggerConfigurators.js"(){ra(),Dl={disabled:!1,minimumSeverity:Ri.UNSPECIFIED,traceBased:!1}}}),kl={};r(kl,{BatchLogRecordProcessor:()=>Sl,ConsoleLogRecordExporter:()=>fl,InMemoryLogRecordExporter:()=>gl,LoggerProvider:()=>ul,SimpleLogRecordProcessor:()=>ml,createLoggerConfigurator:()=>Tl});var Al=n({"../../node_modules/.pnpm/@opentelemetry+sdk-logs@0.216.0_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/esm/index.js"(){dl(),pl(),hl(),_l(),wl(),Ol()}}),jl;function Ml(e){if(globalThis.crypto?.getRandomValues)return globalThis.crypto.getRandomValues(new Uint8Array(e));if(jl){let t=jl();if(!(t instanceof Uint8Array)||t.byteLength<e)throw Error(`Native runtime entropy returned fewer than ${e*8} bits`);return t.slice(0,e)}throw Error(`Jazz requires a cryptographically secure runtime entropy source`)}function Nl(e=Ml(16)){let t=e.slice(0,16);return t[6]=t[6]&15|64,t[8]=t[8]&63|128,t}function Pl(e=()=>Ml(16)){for(;;){let t=e(),n=new DataView(t.buffer,t.byteOffset,t.byteLength).getBigUint64(0,!0);if(n!==0n)return n}}var Fl=`jazz-snapshot-v1:`,Il=72,Ll=48,Rl=class extends Error{name=`SnapshotRefFormatError`;code=`invalid_snapshot_ref`;constructor(){super(`Invalid or unsupported snapshot reference`)}};function zl(e){if(typeof e!=`string`||!e.startsWith(Fl))throw new Rl;let t=e.slice(Fl.length);if(t.length<Il||!/^[0-9a-f]+$/.test(t))throw new Rl;let n=0;for(let e=0;e<4;e++)n+=parseInt(t.slice(64+e*2,66+e*2),16)*2**(e*8);if(t.length!==Il+n*Ll)throw new Rl;return e}var Bl=class extends Error{name=`UnsupportedSnapshotError`;code=`unsupported_snapshot`;constructor(e=`Capturing snapshots is not supported by this runtime yet`){super(e)}},Vl=class{native;fatal;constructor(e={}){this.fatal=e.fatal??!1,this.native=typeof globalThis.TextDecoder==`function`?new globalThis.TextDecoder(`utf-8`,e):void 0}decode(e=new Uint8Array){if(this.native)return this.native.decode(e);let t=e instanceof Uint8Array?e:new Uint8Array(e),n=[],r=[],i=!1,a=e=>{!i&&(i=!0,e===``)||(r.push(e),r.length===4096&&(n.push(r.join(``)),r=[]))},o=()=>{if(this.fatal)throw TypeError(`The encoded data was not valid UTF-8`);a(`�`)},s=0,c=0,l=128,u=191;for(let e=0;e<t.length;e++){let n=t[e];c===0?n<=127?a(String.fromCharCode(n)):n>=194&&n<=223?(c=1,s=n&31):n>=224&&n<=239?(c=2,s=n&15,n===224&&(l=160),n===237&&(u=159)):n>=240&&n<=244?(c=3,s=n&7,n===240&&(l=144),n===244&&(u=143)):o():n<l||n>u?(c=0,l=128,u=191,o(),e--):(l=128,u=191,s=s<<6|n&63,--c===0&&a(String.fromCodePoint(s)))}return c!==0&&o(),r.length&&n.push(r.join(``)),n.join(``)}};function Hl(e){return e instanceof Error?e:Error(String(e))}function Ul(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wl(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}var Gl=new Vl({fatal:!0});function Kl(e){try{return Gl.decode(e),!0}catch{return!1}}function ql(e,t){if(t instanceof Uint8Array)return Array.from(t);if(typeof t==`bigint`)return t.toString();if(typeof t==`number`&&!Number.isFinite(t))throw Error(`Cannot serialize non-finite number in schema JSON (key "${e}"): ${t}.`);return t}function Jl(e){return Object.fromEntries(Object.keys(e).sort().map(t=>[t,e[t]]))}function Yl(e,t){return JSON.stringify({tables:Jl(e),...t?{migrations:t}:{}},ql)}function Xl(e,t){let n={__jazzRuntimeSchema:1,schema:Jl(e),loadedPolicyBundle:t?.loadedPolicyBundle??!1};return JSON.stringify(n,ql)}new Vl({fatal:!0});function Zl(e){let t=!1;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319){let r=e.charCodeAt(n+1);if(Number.isNaN(r)||r<56320||r>57343)return!1;t=!0,n+=1;continue}if(r>=56320&&r<=57343)return!1;r!==32&&(r<9||r>13)&&(t=!0)}return t}function Ql(e){return Zl(e)}function $l(e,t,n){if(typeof e!=`string`)throw Error(`Author identity is missing an issuer`);if(typeof t!=`string`)throw Error(`Author identity is missing a subject`);if(!Zl(e)||!Zl(t))throw Error(`Author issuer and subject must be portable and nonempty`);if(n!==void 0&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(n))throw Error(`Author account must be a canonical UUID`);return JSON.stringify(n===void 0?[e,t]:[n,e,t])}function eu(e){try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length!==2&&t.length!==3)return null;let n=t.length===3?t[0]:void 0;if(n!==void 0&&typeof n!=`string`)return null;let[r,i]=t.slice(t.length===3?1:0);if(typeof r!=`string`||typeof i!=`string`)return null;let a=$l(r,i,n);return e===a?{...n===void 0?{}:{account_id:n},issuer:r,user_id:i,canonical:a}:null}catch{return null}}function tu(e){return new TextEncoder().encode($l(e.issuer,e.user_id,e.account_id))}function nu(e){if(e.type!==`Row`||e.value.values.length!==2)throw Error(`invalid structured author record`);let[t,n]=e.value.values;if(t?.type!==`Uuid`||n?.type!==`Row`||n.value.values.length!==2)throw Error(`invalid structured author record`);let[r,i]=n.value.values;if(r?.type!==`Text`||i?.type!==`Text`)throw Error(`invalid structured author identity`);$l(r.value,i.value,t.value)}var ru=`urn:jazz:local-first`,iu=`urn:jazz:anonymous`,au=`urn:jazz:system`,ou=[au,ru,`urn:jazz:static-bearer`,iu];function su(e){return ou.includes(e)}var cu=`__jazz_trusted_reserved_session`,lu=new WeakSet,uu=new WeakMap,du=new Map;function fu(){let e=Ml(16);return Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function pu(e){return su(e.issuer)&&lu.add(e),e}function mu(e){if(!lu.has(e)||!su(e.issuer))return;let t=uu.get(e);return t||(t=fu(),uu.set(e,t)),du.set(t,{account_id:e.account_id,issuer:e.issuer,user_id:e.user_id,authMode:e.authMode}),t}function hu(e,t){if(!su(e.issuer)||typeof t!=`string`)return!1;let n=du.get(t);return n?.issuer===e.issuer&&n.account_id===e.account_id&&n.user_id===e.user_id&&n.authMode===e.authMode}var gu=new Set([`sub`,`exp`,`nbf`,`iat`,`iss`,`aud`,`jti`]);function _u(e){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):Array.isArray(e)?e.every(_u):Ul(e)&&Object.values(e).every(_u)}function vu(e){let t=Object.create(null);for(let[n,r]of Object.entries(e).sort(yu))!gu.has(n)&&_u(r)&&(t[n]=r);return t}function yu([e],[t]){let n=new TextEncoder().encode(e),r=new TextEncoder().encode(t);for(let e=0;e<Math.min(n.length,r.length);e+=1){let t=n[e]-r[e];if(t!==0)return t}return n.length-r.length}function bu(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function xu(){return globalThis.Buffer}function Su(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n===0?t:t+`=`.repeat(4-n)}function Cu(e){let t=xu();if(t)try{return t.from(e,`base64`).toString(`utf8`)}catch{return null}if(typeof atob==`function`)try{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return new Vl().decode(n)}catch{return null}return null}function wu(e){let t=bu(e);if(!t)return null;let n=t.split(`.`);if(n.length<2)return null;let r=n[1];if(r===void 0)return null;let i=Cu(Su(r));if(!i)return null;try{let e=JSON.parse(i);return Ul(e)?e:null}catch{return null}}function Tu(e){return e!==`disabled`&&e!==`revoked`}var Eu=new Set([`expired`,`missing`,`invalid`,`disabled`,`revoked`]);function Du(e){if(Eu.has(e))return e;let t=e.toLowerCase();return t.includes(`expired`)?`expired`:t.includes(`missing`)?`missing`:t.includes(`disabled`)?`disabled`:t.includes(`revoked`)?`revoked`:`invalid`}var W=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ou(e){let t=``;for(let n=0;n<e.length;n++)t+=W[e[n]&255];return t}function ku(e,t){return W[e[t]&255]+W[e[t+1]&255]+W[e[t+2]&255]+W[e[t+3]&255]+`-`+W[e[t+4]&255]+W[e[t+5]&255]+`-`+W[e[t+6]&255]+W[e[t+7]&255]+`-`+W[e[t+8]&255]+W[e[t+9]&255]+`-`+W[e[t+10]&255]+W[e[t+11]&255]+W[e[t+12]&255]+W[e[t+13]&255]+W[e[t+14]&255]+W[e[t+15]&255]}var Au=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,ju=/^[0-9a-fA-F]{32}$/;function Mu(e){if(!Au.test(e)&&!ju.test(e))return;let t=e.replaceAll(`-`,``),n=new Uint8Array(16);for(let e=0;e<16;e+=1)n[e]=Number.parseInt(t.slice(e*2,e*2+2),16);return n}function Nu(e){return ku(e,0)}var Pu=new Map;function Fu(e){if(Pu.size!==0)try{return Pu.get(new URL(e).host)}catch{return}}function Iu(e){return Fu(e)?.fetch??globalThis.fetch}function Lu(e){return Fu(e)?.WebSocket}function Ru(){let e=Ml(16),t=Date.now();return e[0]=Math.floor(t/2**40)&255,e[1]=Math.floor(t/2**32)&255,e[2]=Math.floor(t/2**24)&255,e[3]=Math.floor(t/2**16)&255,e[4]=Math.floor(t/2**8)&255,e[5]=t&255,e[6]=e[6]&15|112,e[8]=e[8]&63|128,[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function zu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`}function Bu(e){let t=new URL(e).protocol;return t===`http:`||t===`https:`||t===`blob:`}function Vu(e){return new URL(`/`,e).href}function Hu(e,t){try{return new URL(e).href}catch{}if(t)try{return new URL(e,t).href}catch{}return e}function Uu(e,t){if(!t?.wasmVersion)return e;try{let n=new URL(e);return n.searchParams.set(`jazz-runtime-version`,t.wasmVersion),n.href}catch{return e}}function Wu(e,t){try{return new URL(e).href}catch{}return t?new URL(e,t).href:null}function Gu(e,t,n){return!t||zu(e)||!n&&Bu(t)?null:new URL(`jazz_wasm_bg.wasm`,Vu(t)).href}function Ku(e){return e?.wasmModule?{module:e.wasmModule}:e?.wasmSource?{module:e.wasmSource}:null}function qu(e,t,n){if(n?.wasmUrl)return Uu(Hu(n.wasmUrl,t),n);if(n?.baseUrl){let e=Wu(n.baseUrl,t);if(e)return Uu(new URL(`jazz_wasm_bg.wasm`,e).href,n)}return Gu(typeof e==`function`?e():e,t,!1)}var Ju={napi:`b84e0904a2a57ac95066df0640d867441da3c2c06464eb57123a3b9824623f57`,wasm:`d7ba77fde7fc70f887022c32e739c08358627d9b32911fddde3ebbabf1767191`};function Yu(e,t,n=[]){let r=Ju[t.toLowerCase()];if(typeof e.nativeArtifactFingerprint!=`function`)throw Error(`Jazz ${t} artifact is stale or incompatible: missing nativeArtifactFingerprint (expected ${r}). In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`);let i=e.nativeArtifactFingerprint();if(i!==r)throw Error(`Jazz ${t} artifact ABI mismatch: expected ${r}, got ${String(i)}. In this monorepo rebuild generated bindings; for installed packages reinstall matching Jazz package versions.`);for(let r of n)if(typeof e[r]!=`function`)throw Error(`Jazz ${t} artifact is incomplete despite matching fingerprint: missing ${r}.`)}var Xu=class extends Error{},Zu=class extends Error{},Qu=new Set(`\\.+*?()|[]{}^$#&-~`),$u=new Set(`imsUuRx`),ed=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]);function td(e){return Qu.has(e)?!0:e.codePointAt(0)>127?!1:!/[0-9A-Za-z<>]/.test(e)}var nd=class{constructor(e){this.pattern=e,this.chars=[...e]}chars;index=0;flags={multiLine:!1,dotAll:!1,swapGreed:!1};fancy=!1;caseInsensitive=!1;captures=0;names=new Set;unsupported=[];fancyInvalid=[];bellOutsideClass=!1;parse(){let e;try{e=this.parseAlternation(0),this.eof()||this.fail(`unopened group`)}catch(e){throw e instanceof Xu&&this.fancy?new Zu(e.message):e}return!this.fancy&&this.bellOutsideClass&&this.fail("`\\a` is not supported"),{node:e,fancy:this.fancy,caseInsensitive:this.caseInsensitive,captures:this.captures,unsupported:this.unsupported,fancyInvalid:this.fancyInvalid}}eof(){return this.index>=this.chars.length}char(){return this.chars[this.index]}peek(e=1){return this.chars[this.index+e]}startsWith(e){return this.chars.slice(this.index,this.index+e.length).join(``)===e}fail(e){throw new Xu(e)}parseAlternation(e){let t=[this.parseConcat(e)];for(;!this.eof()&&this.char()===`|`;)this.index++,t.push(this.parseConcat(e));return t.length===1?t[0]:{kind:`alternation`,items:t}}parseConcat(e){let t=[],n=0;for(;!this.eof();){let r=this.char();if(r===`|`||r===`)`)break;if(r===`?`||r===`*`||r===`+`||r===`{`?(n++,n===2&&r===`+`?this.unsupported.push(`possessive quantifiers`):n===2&&r===`{`?this.unsupported.push(`a counted repetition right after another quantifier`):n>=2&&this.fancyInvalid.push(`a quantifier right after another quantifier`)):n=0,r===`(`)t.push(this.parseGroup(e));else if(r===`[`)t.push({kind:`class`,item:this.parseBracketed()});else if(r===`?`||r===`*`||r===`+`){this.index++;let[e,n]=r===`?`?[0,1]:r===`*`?[0,1/0]:[1,1/0],i=!0;!this.eof()&&this.char()===`?`&&(i=!1,this.index++),this.repeatLast(t,e,n,i)}else r===`{`?this.parseCountedRepetition(t):t.push(this.parsePrimitive())}return t.length===1?t[0]:{kind:`concat`,items:t}}repeatLast(e,t,n,r){let i=e.pop();(i===void 0||i.kind===`flags`)&&this.fail(`repetition operator missing expression`),i.kind===`look`&&this.fancyInvalid.push(`a quantifier on a lookaround`),e.push({kind:`repeat`,body:i,min:t,max:n,greedy:r!==this.flags.swapGreed})}skipWhitespaceInRepetition(){let e=!1;for(;!this.eof()&&/\p{White_Space}/u.test(this.char());)this.index++,e=!0;e&&this.unsupported.push(`spaces inside a counted repetition`)}parseDecimal(){this.skipWhitespaceInRepetition();let e=``;for(;!this.eof()&&/[0-9]/.test(this.char());)e+=this.chars[this.index++];if(this.skipWhitespaceInRepetition(),e===``)return;let t=Number(e);return t>4294967295&&this.fail(`repetition count is too large`),t}parseCountedRepetition(e){let t=e[e.length-1];(t===void 0||t.kind===`flags`)&&this.fail(`repetition operator missing expression`),this.index++,this.eof()&&this.fail(`unclosed counted repetition`);let n=this.parseDecimal();this.eof()&&this.fail(`unclosed counted repetition`);let r;if(this.char()===`,`)if(this.index++,this.eof()&&this.fail(`unclosed counted repetition`),this.char()!==`}`){let e=this.parseDecimal();(n===void 0||e===void 0)&&this.fail(`repetition count is empty`),r=e}else n===void 0&&this.fail(`repetition count is empty`),r=1/0;else n===void 0&&this.fail(`repetition count is empty`),r=n;(this.eof()||this.char()!==`}`)&&this.fail(`unclosed counted repetition`),this.index++;let i=!0;!this.eof()&&this.char()===`?`&&(i=!1,this.index++),n>r&&this.fail(`invalid repetition range`),this.repeatLast(e,n,r,i)}parseGroup(e){let t=this.index===0;this.index++;for(let t of[`=`,`!`,`<=`,`<!`])if(this.startsWith(`?${t}`))return this.fancy=!0,this.index+=t.length+1,{kind:`look`,op:t,body:this.parseGroupBody(e)};if(this.startsWith(`?P<`)||this.startsWith(`?<`))return this.index+=this.startsWith(`?P<`)?3:2,this.captures++,this.parseCaptureName(),{kind:`group`,capture:!0,body:this.parseGroupBody(e)};if(!this.eof()&&this.char()===`?`){this.index++,this.eof()&&this.fail(`unclosed group`);let n=this.flags,r=this.parseFlags(),i=this.char();if(this.index++,i===`)`)return r!==void 0&&(r&&t?this.caseInsensitive=!0:this.unsupported.push("`(?i)` anywhere but at the start of the pattern")),{kind:`flags`};r!==void 0&&this.unsupported.push("`(?i)` anywhere but at the start of the pattern");let a=this.parseGroupBody(e);return this.flags=n,{kind:`group`,capture:!1,body:a}}return this.captures++,{kind:`group`,capture:!0,body:this.parseGroupBody(e)}}parseGroupBody(e){let t=this.flags,n=this.parseAlternation(e+1);return this.eof()&&this.fail(`unclosed group`),this.index++,this.flags=t,n}parseCaptureName(){this.eof()&&this.fail(`unexpected end of group name`);let e=``;for(;!this.eof()&&this.char()!==`>`;){let t=this.char();(e===``?t===`_`||/\p{Alphabetic}/u.test(t):t===`_`||t===`.`||t===`[`||t===`]`||/[\p{Alphabetic}\p{N}]/u.test(t))||this.fail(`invalid group name`),e+=t,this.index++}this.eof()&&this.fail(`unexpected end of group name`),this.index++,e===``&&this.fail(`empty group name`),this.names.has(e)&&this.fail(`duplicate group name "${e}"`),this.names.add(e)}parseFlags(){let e=new Set,t=!1,n=!1,r,i={...this.flags};for(;this.char()!==`:`&&this.char()!==`)`;){let a=this.char();if(a===`-`)t&&this.fail(`repeated negation in flags`),t=!0,n=!0;else{n=!1,$u.has(a)||this.fail(`unrecognized flag "${a}"`),e.has(a)&&this.fail(`duplicate flag "${a}"`),e.add(a);let o=!t;a===`i`?r=o:a===`m`?i.multiLine=o:a===`s`?i.dotAll=o:a===`U`?i.swapGreed=o:a===`x`?this.unsupported.push("the `x` flag"):a===`R`?this.unsupported.push("the `R` flag"):a===`u`&&!o&&this.unsupported.push("turning off the `u` flag")}this.index++,this.eof()&&this.fail(`unexpected end of flags`)}return n&&this.fail(`dangling flag negation`),e.size===0&&this.char()===`)`&&this.fail(`repetition operator missing expression`),this.flags=i,r}parsePrimitive(){let e=this.char();return e===`\\`?this.parseEscape(!1):(this.index++,e===`.`?{kind:`dot`,dotAll:this.flags.dotAll}:e===`^`?this.assertion(`start`):e===`$`?this.assertion(`end`):{kind:`literal`,char:e})}assertion(e){return{kind:`assertion`,assertion:e,multiLine:this.flags.multiLine}}parseEscape(e){this.index++,this.eof()&&this.fail(`incomplete escape`);let t=this.char();if(/[0-9]/.test(t)){this.fancy=!0;let t=``;for(;!this.eof()&&/[0-9]/.test(this.char());)t+=this.chars[this.index++];return(e||t.startsWith(`0`))&&this.unsupported.push(`\`\\${t}\``),{kind:`backref`,index:Number(t)}}if(t===`x`||t===`u`||t===`U`)return{kind:`literal`,char:this.parseHex(t)};if(t===`p`||t===`P`)return{kind:`class`,item:this.parseUnicodeClass(t===`P`)};if(`dswDSW`.includes(t)){this.index++;let e=t.toLowerCase();return{kind:`class`,item:{kind:`perl`,perl:e,negated:t!==e}}}if(this.index++,td(t))return{kind:`literal`,char:t};let n={f:`\f`,t:` `,n:`
|
|
3
3
|
`,r:`\r`,v:`\v`};if(n[t]!==void 0)return{kind:`literal`,char:n[t]};if(t===`a`)return e||(this.bellOutsideClass=!0),{kind:`literal`,char:`\x07`};if(t===`c`){let e=this.eof()?void 0:this.char();return(e===void 0||!/[A-Za-z]/.test(e))&&this.fail("invalid `\\c` escape"),this.index++,{kind:`literal`,char:String.fromCharCode(e.charCodeAt(0)%32)}}return e&&`AzbB<>`.includes(t)&&this.fail(`\`\\${t}\` is not allowed in a class`),t===`A`?this.assertion(`startText`):t===`z`?this.assertion(`endText`):t===`B`?this.assertion(`notWordBoundary`):t===`<`?this.assertion(`wordStart`):t===`>`?this.assertion(`wordEnd`):t===`b`?this.assertion(this.parseSpecialWordBoundary()):this.fail(`unrecognized escape \`\\${t}\``)}parseSpecialWordBoundary(){if(this.eof()||this.char()!==`{`)return`wordBoundary`;let e=this.index;if(this.index++,this.eof()&&this.fail(`unexpected end of special word boundary`),!/[A-Za-z-]/.test(this.char()))return this.index=e,`wordBoundary`;let t=``;for(;!this.eof()&&/[A-Za-z-]/.test(this.char());)t+=this.chars[this.index++];return(this.eof()||this.char()!==`}`)&&this.fail(`unclosed special word boundary`),this.index++,{start:`wordStart`,end:`wordEnd`,"start-half":`wordStartHalf`,"end-half":`wordEndHalf`}[t]??this.fail(`unrecognized special word boundary "${t}"`)}parseHex(e){this.index++,this.eof()&&this.fail(`incomplete hex escape`);let t=``;if(this.char()===`{`){for(this.index++;!this.eof()&&this.char()!==`}`;)/[0-9A-Fa-f]/.test(this.char())||this.fail(`invalid hex digit`),t+=this.chars[this.index++];this.eof()&&this.fail(`incomplete hex escape`),this.index++,t===``&&this.fail(`empty hex escape`)}else{let n=e===`x`?2:e===`u`?4:8;for(let e=0;e<n;e++)this.eof()&&this.fail(`incomplete hex escape`),/[0-9A-Fa-f]/.test(this.char())||this.fail(`invalid hex digit`),t+=this.chars[this.index++]}let n=parseInt(t,16);return(t.length>8||n>1114111||n>=55296&&n<=57343)&&this.fail(`invalid Unicode scalar value`),String.fromCodePoint(n)}parseUnicodeClass(e){if(this.index++,this.eof()&&this.fail(`incomplete Unicode class`),this.char()===`{`){this.index++;let t=``;for(;!this.eof()&&this.char()!==`}`;)t+=this.chars[this.index++];this.eof()&&this.fail(`incomplete Unicode class`),this.index++;let n=t.indexOf(`!=`);return n>=0?{kind:`unicode`,name:`${t.slice(0,n)}=${t.slice(n+2)}`,negated:!e}:{kind:`unicode`,name:t.replace(`:`,`=`),negated:e}}let t=this.char();return t===`\\`&&this.fail(`invalid Unicode class`),this.index++,{kind:`unicode`,name:t,negated:e}}parseBracketed(){this.index++,this.eof()&&this.fail(`unclosed class`);let e=!1;this.char()===`^`&&(e=!0,this.index++,this.eof()&&this.fail(`unclosed class`));let t=[];for(;this.char()===`-`;)t.push({kind:`literal`,char:`-`}),this.index++,this.eof()&&this.fail(`unclosed class`);t.length===0&&this.char()===`]`&&(t.push({kind:`literal`,char:`]`}),this.index++,this.eof()&&this.fail(`unclosed class`));let n,r,i=()=>{let e={kind:`union`,items:t};return n===void 0?e:{kind:`op`,op:r,lhs:n,rhs:e}};for(;;){this.eof()&&this.fail(`unclosed class`);let a=this.char();if(a===`[`){let e=this.maybeParseAsciiClass();t.push(e??this.parseBracketed())}else{if(a===`]`)return this.index++,{kind:`bracket`,negated:e,set:i()};(a===`&`||a===`-`||a===`~`)&&this.peek()===a?(n=i(),r=`${a}${a}`,t=[],this.index+=2):t.push(this.parseClassRange())}}}maybeParseAsciiClass(){let e=/^\[:(\^?)([^:]*):\]/.exec(this.chars.slice(this.index).join(``));if(!(!e||!ed.has(e[2])))return this.index+=[...e[0]].length,{kind:`ascii`,ascii:e[2],negated:e[1]===`^`}}parseClassItem(){return this.char()===`\\`?this.parseEscape(!0):{kind:`literal`,char:this.chars[this.index++]}}parseClassRange(){let e=this.parseClassItem();if(this.eof()&&this.fail(`unclosed class`),this.char()!==`-`||this.peek()===`]`||this.peek()===`-`)return this.toClassItem(e);this.index++,this.eof()&&this.fail(`unclosed class`);let t=this.parseClassItem();return(e.kind!==`literal`||t.kind!==`literal`)&&this.fail(`class ranges need literal endpoints`),e.char.codePointAt(0)>t.char.codePointAt(0)&&this.fail(`invalid class range`),{kind:`range`,start:e.char,end:t.char}}toClassItem(e){return e.kind===`literal`?{kind:`literal`,char:e.char}:e.kind===`class`?e.item:{kind:`literal`,char:`\0`}}},rd={alnum:[[48,57],[65,90],[97,122]],alpha:[[65,90],[97,122]],ascii:[[0,127]],blank:[[9,9],[32,32]],cntrl:[[0,31],[127,127]],digit:[[48,57]],graph:[[33,126]],lower:[[97,122]],print:[[32,126]],punct:[[33,47],[58,64],[91,96],[123,126]],space:[[9,13],[32,32]],upper:[[65,90]],word:[[48,57],[65,90],[95,95],[97,122]],xdigit:[[48,57],[65,70],[97,102]],d:[[48,57]],w:[[48,57],[65,90],[95,95],[97,122]],s:[[9,13],[32,32],[160,160],[8195,8195],[8233,8233],[65279,65279]]},id=`\\p{Alphabetic}\\p{M}\\p{Nd}\\p{Pc}\\p{Join_Control}`,ad={d:`\\p{Nd}`,s:`\\p{White_Space}`,w:id};function od(e){return/^[A-Za-z0-9]$/.test(e)?e:`\\u{${e.codePointAt(0).toString(16)}}`}function sd(e){return e.map(([e,t])=>{let n=od(String.fromCodePoint(e));return e===t?n:`${n}-${od(String.fromCodePoint(t))}`}).join(``)}var cd=class{constructor(e){this.parsed=e}emit(e){switch(e.kind){case`flags`:return``;case`literal`:return od(e.char);case`dot`:return e.dotAll?`[^]`:`[^\\n]`;case`assertion`:return this.assertion(e.assertion,e.multiLine);case`class`:return this.item(e.item).atom;case`group`:return`(${e.capture&&this.parsed.fancy?``:`?:`}${this.emit(e.body)})`;case`look`:return`(?${e.op}${this.emit(e.body)})`;case`backref`:if(e.index===0||e.index>this.parsed.captures)throw new Zu(`backreference \`\\${e.index}\``);return`\\${e.index}(?:)`;case`repeat`:{let{min:t,max:n}=e,r=n===1/0?t===0?`*`:t===1?`+`:`{${t},}`:t===0&&n===1?`?`:t===n?`{${t}}`:`{${t},${n}}`;return`(?:${this.emit(e.body)})${r}${e.greedy?``:`?`}`}case`concat`:return e.items.map(e=>this.emit(e)).join(``);case`alternation`:return e.items.map(e=>this.emit(e)).join(`|`)}}assertion(e,t){let n=`[${id}]`;switch(e){case`start`:return t?`(?<![^\\n])`:`^`;case`end`:return t?`(?![^\\n])`:`$`;case`startText`:return`^`;case`endText`:return`$`;case`wordBoundary`:return`(?:(?<=${n})(?!${n})|(?<!${n})(?=${n}))`;case`notWordBoundary`:return`(?:(?<=${n})(?=${n})|(?<!${n})(?!${n}))`;case`wordStart`:return`(?<!${n})(?=${n})`;case`wordEnd`:return`(?<=${n})(?!${n})`;case`wordStartHalf`:return`(?<!${n})`;case`wordEndHalf`:return`(?!${n})`}}item(e){switch(e.kind){case`literal`:{let t=od(e.char);return{fragment:t,atom:`[${t}]`}}case`range`:{let t=`${od(e.start)}-${od(e.end)}`;return{fragment:t,atom:`[${t}]`}}case`perl`:return ld(this.parsed.fancy?ad[e.perl]:sd(rd[e.perl]),e.negated);case`ascii`:return ld(sd(rd[e.ascii]),e.negated);case`unicode`:return ld(ud(e.name),e.negated);case`bracket`:{let t=this.set(e.set);return e.negated?t.fragment===void 0?{atom:`(?:(?!${t.atom})[^])`}:{atom:`[^${t.fragment}]`}:t}}}set(e){if(e.kind===`union`){let t=e.items.map(e=>this.item(e));if(t.every(e=>e.fragment!==void 0)){let e=t.map(e=>e.fragment).join(``);return{fragment:e,atom:`[${e}]`}}return{atom:`(?:${t.map(e=>e.atom).join(`|`)})`}}let t=this.set(e.lhs).atom,n=this.set(e.rhs).atom;switch(e.op){case`&&`:return{atom:`(?:(?=${t})${n})`};case`--`:return{atom:`(?:(?!${n})${t})`};case`~~`:return{atom:`(?:(?!${n})${t}|(?!${t})${n})`}}}};function ld(e,t){return t?{atom:`[^${e}]`}:{fragment:e,atom:`[${e}]`}}function ud(e){for(let t of[e,`Script=${e}`])try{return RegExp(`\\p{${t}}`,`u`),`\\p{${t}}`}catch{}throw new Zu(`the Unicode class \`${e}\``)}function dd(e){try{return new nd(e).parse(),!0}catch(e){return e instanceof Zu}}var fd=new Map,pd=1024;function md(e){let t=fd.get(e);if(t)return t;let n=new nd(e).parse();if(n.fancyInvalid.length>0)throw new Xu(n.fancyInvalid[0]);if(n.unsupported.length>0)throw new Zu(n.unsupported[0]);let r=new cd(n).emit(n.node);return t=new RegExp(r,n.caseInsensitive?`iu`:`u`),fd.size>=pd&&fd.clear(),fd.set(e,t),t}function hd(e,t){let n=e.charCodeAt(t)-48,r=e.charCodeAt(t+1)-48;if(!(n<0||n>9||r<0||r>9))return n*10+r}function gd(e){return e%4==0&&e%100!=0||e%400==0}function _d(e){if(e.length!==10||e[4]!==`-`||e[7]!==`-`||!/^[0-9]{4}$/.test(e.slice(0,4)))return!1;let t=Number(e.slice(0,4)),n=hd(e,5),r=hd(e,8);return n===void 0||n<1||n>12||r===void 0||r===0?!1:n===2?r<=(gd(t)?29:28):r<=([4,6,9,11].includes(n)?30:31)}function vd(e){if(e.length<9||e[2]!==`:`||e[5]!==`:`)return!1;let t=hd(e,0),n=hd(e,3),r=hd(e,6);if(t===void 0||n===void 0||r===void 0||t>23||n>59||r>60)return!1;let i=8;if(e[i]===`.`){i++;let t=i;for(;i<e.length&&e.charCodeAt(i)>=48&&e.charCodeAt(i)<=57;)i++;if(i===t)return!1}if(i===e.length)return!1;let a=e[i];if(a===`Z`||a===`z`)return i===e.length-1&&(r!==60||t===23&&n===59);if(a!==`+`&&a!==`-`||e.length-i!==6||e[i+3]!==`:`)return!1;let o=hd(e,i+1),s=hd(e,i+4);if(o===void 0||s===void 0||o>23||s>59)return!1;if(r!==60)return!0;let c=a===`+`?-1:1,l=t+c*o,u=n+c*s;return l+=Math.trunc(u/60),u%=60,u<0&&(u+=60,--l),l=(l+24)%24,l===23&&u===59}function yd(e){let t=e.search(/[Tt]/);return t<0?!1:_d(e.slice(0,t))&&vd(e.slice(t+1))}var bd=`(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])`,xd=`${bd}(?:\\.${bd}){3}`,G=`[0-9A-Fa-f]{1,4}`,Sd=`(?:${G}:${G}|${xd})`,Cd=[`(?:${G}:){6}${Sd}`,`::(?:${G}:){5}${Sd}`,`(?:${G})?::(?:${G}:){4}${Sd}`,`(?:(?:${G}:){0,1}${G})?::(?:${G}:){3}${Sd}`,`(?:(?:${G}:){0,2}${G})?::(?:${G}:){2}${Sd}`,`(?:(?:${G}:){0,3}${G})?::${G}:${Sd}`,`(?:(?:${G}:){0,4}${G})?::${Sd}`,`(?:(?:${G}:){0,5}${G})?::${G}`,`(?:(?:${G}:){0,6}${G})?::`].map(e=>`(?:${e})`).join(`|`),wd=RegExp(`^${xd}$`),Td=RegExp(`^(?:${Cd})$`),Ed=e=>wd.test(e),Dd=e=>Td.test(e);function Od(e){if(e.length===0||e.length>253||e.endsWith(`.`)||!/^[A-Za-z0-9.-]*$/.test(e))return!1;let t=e.split(`.`);for(let e of t){if(e.length===0||e.length>63||e.startsWith(`-`)||e.endsWith(`-`))return!1;let t=e.startsWith(`xn--`);if(e.slice(2,4)===`--`&&!t)return!1;if(t){let t=Pd(e.slice(4));if(t===void 0||!Rd(t))return!1}}return!0}var kd=36,Ad=1,jd=26,Md=4294967295;function Nd(e,t,n){let r=Math.trunc(e/(n?700:2));r+=Math.trunc(r/t);let i=0;for(;r>(kd-Ad)*jd>>1;)r=Math.trunc(r/(kd-Ad)),i+=kd;return i+Math.trunc((kd-Ad+1)*r/(r+38))}function Pd(e){let t=e.lastIndexOf(`-`),n=t>0?e.slice(0,t):``,r=t>0?e.slice(t+1):e,i=[...n].map(e=>e.charCodeAt(0)),a=128,o=72,s=0,c=0;for(;c<r.length;){let e=s,t=1;for(let e=kd;;e+=kd){if(c>=r.length)return;let n=Fd(r.charCodeAt(c++));if(n===void 0||(s+=n*t,n*t>Md||s>Md))return;let i=e<=o?Ad:e>=o+jd?jd:e-o;if(n<i)break;if(t*=kd-i,t>Md)return}let n=i.length+1;if(o=Nd(s-e,n,e===0),a+=Math.trunc(s/n),a>Md||(s%=n,a>1114111||a>=55296&&a<=57343))return;i.splice(s,0,a),s++}return String.fromCodePoint(...i)}function Fd(e){if(e>=48&&e<=57)return e-48+26;if(e>=65&&e<=90)return e-65;if(e>=97&&e<=122)return e-97}var Id=new Set([2381,2509,2637,2765,2893,3021,3149,3277,3405,3530,3642,3972,4153,5908,5940,6098,6752,6980,7082,7154,7155,11647,43014,43204,43347,44013,68159,69702,69759,69817,69939,70080,70197,70378,70477,70722,70850,71103,71231,71350,71467,71737,72160,72244,72263,72345,72767,73028,73029,73111].map(e=>String.fromCodePoint(e))),Ld=new Set([1600,2042,12334,12335,12337,12338,12339,12340,12341,12347].map(e=>String.fromCodePoint(e)));function Rd(e){let t=[...e];if(t.length>0&&/^\p{M}/u.test(t[0]))return!1;let n=!1,r=!1,i=!1,a=!1;for(let e=0;e<t.length;e++){let o=t[e],s=t[e-1],c=t[e+1],l=o.codePointAt(0);if(o===``){if(s===void 0||!Id.has(s))return!1}else if(o===`·`){if(s!==`l`||c!==`l`)return!1}else if(o===`͵`){let e=c?.codePointAt(0);if(e===void 0||e<880||e>1023)return!1}else if(o===`׳`||o===`״`){let e=s?.codePointAt(0);if(e===void 0||e<1424||e>1535)return!1}else if(o===`・`)n=!0;else if(l>=12352&&l<=12447||l>=12448&&l<=12543||l>=19968&&l<=40959)r=!0;else if(l>=1632&&l<=1641)i=!0;else if(l>=1776&&l<=1785)a=!0;else if(Ld.has(o))return!1}return!(n&&!r||i&&a)}var zd=new TextEncoder;function Bd(e){return zd.encode(e).length}function Vd(e){let t=e.codePointAt(0),n=t>>>24,r=t>>>16&255,i=t>>>8&255,a=t&255,o=e=>e>=128&&e<=191;return n===0&&r===0?i>=194&&i<=223&&o(a):n===0?r===224?i>=160&&i<=191&&o(a):r>=225&&r<=236?o(i)&&o(a):r===237?i>=128&&i<=159&&o(a):r===238||r===239?o(i)&&o(a):!1:n===240?r>=144&&r<=191&&o(i)&&o(a):n>=241&&n<=243?o(r)&&o(i)&&o(a):n===244?r>=128&&r<=143&&o(i)&&o(a):!1}var Hd=/^[\p{Alphabetic}\p{N}]$/u,Ud=new Set("!#$%&'*+-/=?^_`{|}~");function Wd(e){return Hd.test(e)||Ud.has(e)||Vd(e)}function Gd(e){return e.length>0&&[...e].every(Wd)}function Kd(e){let t=[...e];for(let e=0;e<t.length;e++){let n=t[e],r=n.codePointAt(0);if(n===`\\`){let n=t[++e]?.codePointAt(0);if(n===void 0||n<33||n>126)return!1}else if(!(n===` `||n===` `||r===33||r>=35&&r<=91||r>=93&&r<=126||Vd(n)))return!1}return!0}function qd(e){let t=e.codePointAt(0);return t>=33&&t<=90||t>=94&&t<=126||Vd(e)}function Jd(e){return e.replace(/^\p{White_Space}+|\p{White_Space}+$/gu,``)}function Yd(e){let t=e,n=``,r=e.lastIndexOf(` <`);if(r>=0){let i=Jd(e.slice(r+2));if(!i.endsWith(`>`))return!1;t=i.slice(0,-1),n=Jd(e.slice(0,r))}let i=t.lastIndexOf(`@`);if(i<0)return!1;let a=t.slice(0,i),o=t.slice(i+1);if(n===``&&a.startsWith(`<`)||a.length===0||Bd(a)>64)return!1;if(a.startsWith(`"`)&&a.endsWith(`"`)){if(a.length<=2||!Kd(a.slice(1,-1)))return!1}else if(!a.split(`.`).every(Gd))return!1;if(o.length===0||Bd(o)>254)return!1;if(o.startsWith(`[`)&&o.endsWith(`]`)){let e=o.slice(1,-1);return[...e].every(qd)?e.startsWith(`IPv6:`)?Dd(e.slice(5)):Ed(e):!1}for(let e of o.split(`.`)){let t=[...e];if(t.length===0||!Hd.test(t[0])||!Hd.test(t[t.length-1])||Bd(e)>63||!Gd(e))return!1}return Od(o)}var Xd=`A-Za-z0-9\\-._~`,Zd=`!$&'()*+,;=`,Qd=`%[0-9A-Fa-f]{2}`,$d=`(?:[${Xd}${Zd}:@]|${Qd})`,ef=`${$d}*`,tf=`${$d}+`,nf=`(?:[${Xd}${Zd}@]|${Qd})+`,rf=`\\[(?:${Cd}|[vV][0-9A-Fa-f]+\\.[${Xd}${Zd}:]+)\\]`,af=`(?:[${Xd}${Zd}]|${Qd})*`,of=`(?:${`(?:[${Xd}${Zd}:]|${Qd})*`}@)?(?:${rf}|${af})(?::[0-9]*)?`,sf=`(?:/${ef})*`,cf=`/(?:${tf}(?:/${ef})*)?`,lf=`${tf}(?:/${ef})*`,uf=`${nf}(?:/${ef})*`,df=`(?:${$d}|[/?])*`,ff=`[A-Za-z][A-Za-z0-9+\\-.]*`,pf=`(?://${of}${sf}|${cf}|${lf}|)`,mf=`(?://${of}${sf}|${cf}|${uf}|)`,hf=`(?:\\?${df})?(?:#${df})?`,gf=RegExp(`^${ff}:${pf}${hf}$`),_f=RegExp(`^(?:${ff}:${pf}|${mf})${hf}$`);function vf(e){return e===``||/^(?:\/(?:[^~/]|~[01])*)+$/.test(e)}function yf(e){let t=/^(0|[1-9][0-9]*)(.*)$/s.exec(e);if(!t)return!1;let n=t[2];return n===``||n===`#`||n.startsWith(`/`)&&vf(n)}var bf=new Set(`+#./;?&=,!@|`),xf=new Set(`"'<>%\\^\`{|}`);function Sf(e){let t=0,n=t=>/^[0-9A-Fa-f]$/.test(e[t]??``),r=t=>/^[A-Za-z0-9_]$/.test(e[t]??``),i=()=>{let i=t;for(;t<e.length;)if(r(t))t++;else if(e[t]===`%`){if(t+2>=e.length||!n(t+1)||!n(t+2))return!1;t+=3}else break;return t>i},a=()=>{if(!i())return!1;for(;t<e.length;)if(e[t]===`.`){if(t++,!i())return!1}else if(r(t)||e[t]===`%`){if(!i())return!1}else break;return!0},o=()=>{if(!a())return!1;if(e[t]===`:`){if(t++,!/^[1-9]$/.test(e[t]??``))return!1;t++;for(let n=1;n<4&&/^[0-9]$/.test(e[t]??``);n++)t++}else e[t]===`*`&&t++;return!0};for(;t<e.length;){let r=e[t];if(r===`{`){if(t++,t>=e.length||bf.has(e[t])&&(t++,t>=e.length)||!o())return!1;for(;e[t]===`,`;)if(t++,!o())return!1;if(e[t]!==`}`)return!1;t++}else{if(r===`}`)return!1;if(r===`%`){if(t+2>=e.length||!n(t+1)||!n(t+2))return!1;t+=3}else{let n=e.charCodeAt(t);if(n<=32||n===127||xf.has(r))return!1;t++}}}return!0}var Cf={date:_d,"date-time":yd,email:Yd,hostname:Od,ipv4:Ed,ipv6:Dd,"json-pointer":vf,regex:dd,"relative-json-pointer":yf,time:vd,uri:e=>gf.test(e),"uri-reference":e=>_f.test(e),"uri-template":Sf},wf=class{constructor(e){this.value=e}},Tf=2n**64n-1n,Ef=-(2n**63n),Df=/-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/y,Of=/[ \t\n\r]*/y;function kf(e){let t=0,n=()=>{throw SyntaxError(`invalid JSON at position ${t}`)},r=()=>{Of.lastIndex=t,Of.test(e),t=Of.lastIndex},i=()=>{let r=t;t++;let i=!1;for(;t<e.length;){let a=e.charCodeAt(t);if(a===34){t++;let n=e.slice(r,t);return i?JSON.parse(n):n.slice(1,-1)}a===92?(i=!0,t++):a<32&&n(),t++}return n()},a=()=>{Df.lastIndex=t;let r=Df.exec(e);if(!r)return n();t=Df.lastIndex;let i=r[0],a=Number(i);if(r[1]!==void 0||r[2]!==void 0)return Number.isInteger(a)?new wf(a):a;if(Object.is(a,-0))return new wf(a);if(Number.isSafeInteger(a))return a;let o=BigInt(i);return o<Ef||o>Tf?new wf(a):BigInt(a)===o?a:o},o=()=>{r();let s=e[t];if(s===`{`){t++;let a=Object.create(null);if(r(),e[t]===`}`)return t++,a;for(;;){r(),e[t]!==`"`&&n();let s=i();if(r(),e[t]!==`:`&&n(),t++,a[s]=o(),r(),e[t]===`,`)t++;else{if(e[t]===`}`)return t++,a;n()}}}if(s===`[`){t++;let i=[];if(r(),e[t]===`]`)return t++,i;for(;;)if(i.push(o()),r(),e[t]===`,`)t++;else{if(e[t]===`]`)return t++,i;n()}}return s===`"`?i():e.startsWith(`true`,t)?(t+=4,!0):e.startsWith(`false`,t)?(t+=5,!1):e.startsWith(`null`,t)?(t+=4,null):a()},s=o();return r(),t!==e.length&&n(),s}function Af(e){return typeof e==`number`||typeof e==`bigint`||e instanceof wf}function jf(e){return e instanceof wf?e.value:e}function Mf(e,t){return typeof e==`bigint`?!0:e instanceof wf?!t:Number.isInteger(e)}function Nf(e){if(typeof e==`bigint`)return e.toString();if(e instanceof wf){if(Object.is(e.value,-0))return`-0.0`;let t=Number.isSafeInteger(e.value)?String(e.value):Pf(e.value);return/[.e]/.test(t)?t:`${t}.0`}return typeof e==`number`&&Number.isInteger(e)?Pf(e):Array.isArray(e)?`[${e.map(Nf).join(`,`)}]`:typeof e==`object`&&e?`{${Object.entries(e).map(([e,t])=>`${JSON.stringify(e)}:${Nf(t)}`).join(`,`)}}`:JSON.stringify(e)}function Pf(e){return Number.isFinite(e)&&Math.abs(e)<1e21?BigInt(e).toString():String(e)}function Ff(e){if(e instanceof wf)return e.value;if(Array.isArray(e))return e.map(Ff);if(typeof e!=`object`||!e)return e;let t=Object.create(null);for(let[n,r]of Object.entries(e))t[n]=Ff(r);return t}function If(e,t){if(Af(e))return Af(t)?jf(e)==jf(t):!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>If(e,t[n]));if(typeof e==`object`&&e){if(typeof t!=`object`||!t||Array.isArray(t)||Af(t))return!1;let n=Object.keys(e);return n.length===Object.keys(t).length?n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&If(e[n],t[n])):!1}return e===t}function Lf(e,t){let n=Number(jf(e)),r=Number(jf(t));if(Number.isInteger(r))return Number.isInteger(n)&&n%r===0;if(n===0)return!0;if(n<r)return!1;let[i,a]=Rf(n),[o,s]=Rf(r);if(o===0n)return!0;let c=a*o;return i*s%c===0n}function Rf(e){let t=0,n=e;for(;!(Math.abs(Math.floor(n)-n)<2**-52);)if(t++,n=e*zf(10,t),!Number.isFinite(n))return Bf(e);let r=BigInt(Math.trunc(Math.abs(n)));return[e<0?-r:r,BigInt(zf(10,t))]}function zf(e,t){let n=1,r=e;for(let e=t;e&1&&(n*=r),e=Math.trunc(e/2),e!==0;)r*=r;return n}function Bf(e){let[t,n]=Math.abs(e).toExponential().split(`e`),[r,i=``]=t.split(`.`),a=Number(n)-i.length,o=BigInt(r+i),s=1n;return a>=0?o*=10n**BigInt(a):s=10n**BigInt(-a),[e<0?-o:o,s]}var Vf={additionalItems:!0,unevaluatedItems:!0,items:!0,contains:!0,additionalProperties:!0,unevaluatedProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Hf={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},Uf={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},Wf=new URL(`json-schema:///`);function Gf(e){return encodeURI(e.replace(/~/g,`~0`).replace(/\//g,`~1`))}function Kf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qf(e,t=Object.create(null),n=[],r=Wf,i=!0){let a=(e,n)=>{t[e]===void 0&&(t[e]=n)};if(typeof e==`boolean`)return i&&a(r.href,e),t;if(!Kf(e))return t;let o=e.$id??e.id;if(typeof o==`string`){let t=new URL(o,r.href);t.hash.length>1||(t.hash=``,r=t),a(t.href,e)}if(i&&a(r.href,e),typeof e.$ref==`string`&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,r.href);t.hash=t.hash,Object.defineProperty(e,`__absolute_ref__`,{enumerable:!1,value:t.href}),n.push(t.href)}if(typeof e.$recursiveRef==`string`&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,r.href);t.hash=t.hash,Object.defineProperty(e,`__absolute_recursive_ref__`,{enumerable:!1,value:t.href})}typeof e.$anchor==`string`&&a(new URL(`#`+e.$anchor,r.href).href,e);for(let i in e){let a=e[i];if(Hf[i]&&Array.isArray(a))for(let e of a)qf(e,t,n,r,!1);else if(Vf[i])qf(a,t,n,r,!1);else if((Uf[i]||i===`dependencies`)&&Kf(a))for(let e in a)qf(a[e],t,n,r,!1)}return t}function Jf(e,t){let n=e[t];if(n!==void 0)return n;let r=t.indexOf(`#`);if(r<0)return;let i=e[t.slice(0,r)],a=t.slice(r+1);if(!(i===void 0||!a.startsWith(`/`))){for(let e of a.slice(1).split(`/`)){let t;try{t=decodeURIComponent(e).replace(/~1/g,`/`).replace(/~0/g,`~`)}catch{return}if(Array.isArray(i)){if(!/^(?:0|[1-9][0-9]*)$/.test(t))return;i=i[Number(t)]}else if(Kf(i)&&Object.prototype.hasOwnProperty.call(i,t))i=i[t];else return}return typeof i==`boolean`||Kf(i)?i:void 0}}function Yf(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r>=55296&&r<=56319&&n+1<e.length&&(e.charCodeAt(n+1)&64512)==56320&&n++,t++}return t}function Xf(e){if(e===null)return`null`;if(Af(e))return`number`;if(Array.isArray(e))return`array`;switch(typeof e){case`boolean`:case`string`:return typeof e;case`object`:return`object`;default:throw Error(`Instances of "${typeof e}" type are not supported.`)}}function Zf(e,t,n,r,i){return K(e,t,{draft:n,lookup:r,shortCircuit:i},null,`#`,`#`)}function K(e,t,n,r,i,a,o=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:i,keyword:`false`,keywordLocation:i,error:`False boolean schema.`}]};let{draft:s,lookup:c,shortCircuit:l}=n,u=Xf(e),{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:g,required:_,not:ee,anyOf:v,allOf:y,oneOf:te,if:ne,then:re,else:b,format:x,properties:ie,patternProperties:ae,additionalProperties:oe,unevaluatedProperties:se,minProperties:ce,maxProperties:le,propertyNames:S,dependentRequired:ue,dependentSchemas:de,dependencies:C,prefixItems:w,items:T,additionalItems:fe,unevaluatedItems:E,contains:D,minContains:O,maxContains:k,minItems:A,maxItems:j,uniqueItems:pe,minimum:me,maximum:he,exclusiveMinimum:ge,exclusiveMaximum:_e,multipleOf:ve,minLength:ye,maxLength:be,pattern:xe,__absolute_ref__:Se,__absolute_recursive_ref__:Ce}=t,M=[];if(p===!0&&r===null&&(r=t),f===`#`){let s=r===null?Jf(c,Ce):r,l=`${a}/$recursiveRef`,u=K(e,r===null?t:r,n,s,i,l,o);u.valid||M.push({instanceLocation:i,keyword:`$recursiveRef`,keywordLocation:l,error:`A subschema had errors.`},...u.errors)}if(d!==void 0){let t=Jf(c,Se??d);if(t===void 0)throw Error(`Unresolved $ref "${d}".`);let l=`${a}/$ref`,u=K(e,t,n,r,i,l,o);if(u.valid||M.push({instanceLocation:i,keyword:`$ref`,keywordLocation:l,error:`A subschema had errors.`},...u.errors),s===`4`||s===`6`||s===`7`)return{valid:M.length===0,errors:M}}let N=u===`number`&&Mf(e,s===`4`);if(Array.isArray(m)?m.some(e=>e===u||e===`integer`&&N)||M.push({instanceLocation:i,keyword:`type`,keywordLocation:`${a}/type`,error:`Instance type "${u}" is invalid. Expected "${m.join(`", "`)}".`}):m===`integer`?N||M.push({instanceLocation:i,keyword:`type`,keywordLocation:`${a}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}):m!==void 0&&u!==m&&M.push({instanceLocation:i,keyword:`type`,keywordLocation:`${a}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}),h!==void 0&&!If(e,h)&&M.push({instanceLocation:i,keyword:`const`,keywordLocation:`${a}/const`,error:`Instance does not match ${Nf(h)}.`}),g!==void 0&&!g.some(t=>If(e,t))&&M.push({instanceLocation:i,keyword:`enum`,keywordLocation:`${a}/enum`,error:`Instance does not match any of ${Nf(g)}.`}),ee!==void 0){let t=`${a}/not`;K(e,ee,n,r,i,t).valid&&M.push({instanceLocation:i,keyword:`not`,keywordLocation:t,error:`Instance matched "not" schema.`})}let we=[];if(v!==void 0){let t=`${a}/anyOf`,s=M.length,c=!1;for(let a=0;a<v.length;a++){let s=Object.create(o),l=K(e,v[a],n,p===!0?r:null,i,`${t}/${a}`,s);M.push(...l.errors),c||=l.valid,l.valid&&we.push(s)}c?M.length=s:M.splice(s,0,{instanceLocation:i,keyword:`anyOf`,keywordLocation:t,error:`Instance does not match any subschemas.`})}if(y!==void 0){let t=`${a}/allOf`,s=M.length,c=!0;for(let a=0;a<y.length;a++){let s=Object.create(o),l=K(e,y[a],n,p===!0?r:null,i,`${t}/${a}`,s);M.push(...l.errors),c&&=l.valid,l.valid&&we.push(s)}c?M.length=s:M.splice(s,0,{instanceLocation:i,keyword:`allOf`,keywordLocation:t,error:`Instance does not match every subschema.`})}if(te!==void 0){let t=`${a}/oneOf`,s=M.length,c=te.filter((a,s)=>{let c=Object.create(o),l=K(e,a,n,p===!0?r:null,i,`${t}/${s}`,c);return M.push(...l.errors),l.valid&&we.push(c),l.valid}).length;c===1?M.length=s:M.splice(s,0,{instanceLocation:i,keyword:`oneOf`,keywordLocation:t,error:`Instance does not match exactly one subschema (${c} matches).`})}if((u===`object`||u===`array`)&&Object.assign(o,...we),ne!==void 0){let t=`${a}/if`,s=Object.create(o);if(K(e,ne,n,r,i,t,s).valid){if(Object.assign(o,s),re!==void 0){let s=K(e,re,n,r,i,`${a}/then`,o);s.valid||M.push({instanceLocation:i,keyword:`if`,keywordLocation:t,error:`Instance does not match "then" schema.`},...s.errors)}}else if(b!==void 0){let s=K(e,b,n,r,i,`${a}/else`,o);s.valid||M.push({instanceLocation:i,keyword:`if`,keywordLocation:t,error:`Instance does not match "else" schema.`},...s.errors)}}if(u===`object`){let t=e;if(_!==void 0)for(let e of _)e in t||M.push({instanceLocation:i,keyword:`required`,keywordLocation:`${a}/required`,error:`Instance does not have required property "${e}".`});let s=Object.keys(t);if(ce!==void 0&&s.length<ce&&M.push({instanceLocation:i,keyword:`minProperties`,keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${ce} properties.`}),le!==void 0&&s.length>le&&M.push({instanceLocation:i,keyword:`maxProperties`,keywordLocation:`${a}/maxProperties`,error:`Instance has more than ${le} properties.`}),S!==void 0){let e=`${a}/propertyNames`;for(let a in t){let t=`${i}/${Gf(a)}`,o=K(a,S,n,r,t,e);o.valid||M.push({instanceLocation:i,keyword:`propertyNames`,keywordLocation:e,error:`Property name "${a}" does not match schema.`},...o.errors)}}if(ue!==void 0){let e=`${a}/dependentRequired`;for(let n in ue)if(n in t)for(let r of ue[n])r in t||M.push({instanceLocation:i,keyword:`dependentRequired`,keywordLocation:e,error:`Instance has "${n}" but does not have "${r}".`})}if(de!==void 0)for(let s in de){let c=`${a}/dependentSchemas`;if(s in t){let t=K(e,de[s],n,r,i,`${c}/${Gf(s)}`,o);t.valid||M.push({instanceLocation:i,keyword:`dependentSchemas`,keywordLocation:c,error:`Instance has "${s}" but does not match dependant schema.`},...t.errors)}}if(C!==void 0){let o=`${a}/dependencies`;for(let a in C)if(a in t){let s=C[a];if(Array.isArray(s))for(let e of s)e in t||M.push({instanceLocation:i,keyword:`dependencies`,keywordLocation:o,error:`Instance has "${a}" but does not have "${e}".`});else{let t=K(e,s,n,r,i,`${o}/${Gf(a)}`);t.valid||M.push({instanceLocation:i,keyword:`dependencies`,keywordLocation:o,error:`Instance has "${a}" but does not match dependant schema.`},...t.errors)}}}let c=Object.create(null),u=!1;if(ie!==void 0){let e=`${a}/properties`;for(let a in ie){if(!(a in t))continue;let s=`${i}/${Gf(a)}`,d=K(t[a],ie[a],n,r,s,`${e}/${Gf(a)}`);if(d.valid)o[a]=c[a]=!0;else if(u=l,M.push({instanceLocation:i,keyword:`properties`,keywordLocation:e,error:`Property "${a}" does not match schema.`},...d.errors),u)break}}if(!u&&ae!==void 0){let e=`${a}/patternProperties`;for(let a in ae){let s=md(a),d=ae[a];for(let f in t){if(!s.test(f))continue;let p=`${i}/${Gf(f)}`,m=K(t[f],d,n,r,p,`${e}/${Gf(a)}`);m.valid?o[f]=c[f]=!0:(u=l,M.push({instanceLocation:i,keyword:`patternProperties`,keywordLocation:e,error:`Property "${f}" matches pattern "${a}" but does not match associated schema.`},...m.errors))}}}if(!u&&oe!==void 0){let e=`${a}/additionalProperties`;for(let a in t){if(c[a])continue;let s=`${i}/${Gf(a)}`,d=K(t[a],oe,n,r,s,e);d.valid?o[a]=!0:(u=l,M.push({instanceLocation:i,keyword:`additionalProperties`,keywordLocation:e,error:`Property "${a}" does not match additional properties schema.`},...d.errors))}}else if(!u&&se!==void 0){let e=`${a}/unevaluatedProperties`;for(let a in t)if(!o[a]){let s=`${i}/${Gf(a)}`,c=K(t[a],se,n,r,s,e);c.valid?o[a]=!0:M.push({instanceLocation:i,keyword:`unevaluatedProperties`,keywordLocation:e,error:`Property "${a}" does not match unevaluated properties schema.`},...c.errors)}}}else if(u===`array`){let t=e,s=t.length;j!==void 0&&s>j&&M.push({instanceLocation:i,keyword:`maxItems`,keywordLocation:`${a}/maxItems`,error:`Array has too many items (${s} > ${j}).`}),A!==void 0&&s<A&&M.push({instanceLocation:i,keyword:`minItems`,keywordLocation:`${a}/minItems`,error:`Array has too few items (${s} < ${A}).`});let c=0,u=!1;if(w!==void 0){let e=`${a}/prefixItems`,d=Math.min(w.length,s);for(;c<d;c++){let a=K(t[c],w[c],n,r,`${i}/${c}`,`${e}/${c}`);if(o[c]=!0,!a.valid&&(u=l,M.push({instanceLocation:i,keyword:`prefixItems`,keywordLocation:e,error:`Items did not match schema.`},...a.errors),u))break}}if(T!==void 0){let e=`${a}/items`;if(Array.isArray(T)){let a=Math.min(T.length,s);for(;c<a;c++){let a=K(t[c],T[c],n,r,`${i}/${c}`,`${e}/${c}`);if(o[c]=!0,!a.valid&&(u=l,M.push({instanceLocation:i,keyword:`items`,keywordLocation:e,error:`Items did not match schema.`},...a.errors),u))break}}else for(;c<s;c++){let a=K(t[c],T,n,r,`${i}/${c}`,e);if(o[c]=!0,!a.valid&&(u=l,M.push({instanceLocation:i,keyword:`items`,keywordLocation:e,error:`Items did not match schema.`},...a.errors),u))break}if(!u&&fe!==void 0){let e=`${a}/additionalItems`;for(;c<s;c++){let a=K(t[c],fe,n,r,`${i}/${c}`,e);o[c]=!0,a.valid||(u=l,M.push({instanceLocation:i,keyword:`additionalItems`,keywordLocation:e,error:`Items did not match additional items schema.`},...a.errors))}}}if(D!==void 0)if(s===0&&O===void 0)M.push({instanceLocation:i,keyword:`contains`,keywordLocation:`${a}/contains`,error:`Array is empty. It must contain at least one item matching the schema.`});else if(O!==void 0&&s<O)M.push({instanceLocation:i,keyword:`minContains`,keywordLocation:`${a}/minContains`,error:`Array has less items (${s}) than minContains (${O}).`});else{let e=`${a}/contains`,c=M.length,l=0;for(let a=0;a<s;a++){let s=K(t[a],D,n,r,`${i}/${a}`,e);s.valid?(o[a]=!0,l++):M.push(...s.errors)}l>=(O||0)&&(M.length=c),O===void 0&&k===void 0&&l===0?M.splice(c,0,{instanceLocation:i,keyword:`contains`,keywordLocation:e,error:`Array does not contain item matching schema.`}):O!==void 0&&l<O?M.push({instanceLocation:i,keyword:`minContains`,keywordLocation:`${a}/minContains`,error:`Array must contain at least ${O} items matching schema. Only ${l} items were found.`}):k!==void 0&&l>k&&M.push({instanceLocation:i,keyword:`maxContains`,keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${k} items matching schema. ${l} items were found.`})}if(!u&&E!==void 0){let e=`${a}/unevaluatedItems`;for(;c<s;c++){if(o[c])continue;let a=K(t[c],E,n,r,`${i}/${c}`,e);o[c]=!0,a.valid||M.push({instanceLocation:i,keyword:`unevaluatedItems`,keywordLocation:e,error:`Items did not match unevaluated items schema.`},...a.errors)}}if(pe){e:for(let e=0;e<s;e++)for(let n=e+1;n<s;n++)if(If(t[e],t[n])){M.push({instanceLocation:i,keyword:`uniqueItems`,keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${e} and ${n}.`});break e}}}else if(u===`number`){let t=jf(e);s===`4`?(me!==void 0&&(ge===!0&&t<=me||t<me)&&M.push({instanceLocation:i,keyword:`minimum`,keywordLocation:`${a}/minimum`,error:`${t} is less than ${ge?`or equal to `:``}${me}.`}),he!==void 0&&(_e===!0&&t>=he||t>he)&&M.push({instanceLocation:i,keyword:`maximum`,keywordLocation:`${a}/maximum`,error:`${t} is greater than ${_e?`or equal to `:``}${he}.`})):(me!==void 0&&t<me&&M.push({instanceLocation:i,keyword:`minimum`,keywordLocation:`${a}/minimum`,error:`${t} is less than ${me}.`}),he!==void 0&&t>he&&M.push({instanceLocation:i,keyword:`maximum`,keywordLocation:`${a}/maximum`,error:`${t} is greater than ${he}.`}),ge!==void 0&&t<=ge&&M.push({instanceLocation:i,keyword:`exclusiveMinimum`,keywordLocation:`${a}/exclusiveMinimum`,error:`${t} is less than or equal to ${ge}.`}),_e!==void 0&&t>=_e&&M.push({instanceLocation:i,keyword:`exclusiveMaximum`,keywordLocation:`${a}/exclusiveMaximum`,error:`${t} is greater than or equal to ${_e}.`})),ve!==void 0&&!Lf(e,ve)&&M.push({instanceLocation:i,keyword:`multipleOf`,keywordLocation:`${a}/multipleOf`,error:`${t} is not a multiple of ${ve}.`})}else if(u===`string`){let t=e,n=ye===void 0&&be===void 0?0:Yf(t);ye!==void 0&&n<ye&&M.push({instanceLocation:i,keyword:`minLength`,keywordLocation:`${a}/minLength`,error:`String is too short (${n} < ${ye}).`}),be!==void 0&&n>be&&M.push({instanceLocation:i,keyword:`maxLength`,keywordLocation:`${a}/maxLength`,error:`String is too long (${n} > ${be}).`}),xe!==void 0&&!md(xe).test(t)&&M.push({instanceLocation:i,keyword:`pattern`,keywordLocation:`${a}/pattern`,error:`String does not match pattern.`});let r=x===void 0?void 0:Cf[x];r&&!r(t)&&M.push({instanceLocation:i,keyword:`format`,keywordLocation:`${a}/format`,error:`String does not match format "${x}".`})}return{valid:M.length===0,errors:M}}var Qf={draft4:[{id:`http://json-schema.org/draft-04/schema#`,$schema:`http://json-schema.org/draft-04/schema#`,description:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},positiveInteger:{type:`integer`,minimum:0},positiveIntegerDefault0:{allOf:[{$ref:`#/definitions/positiveInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},minItems:1,uniqueItems:!0}},type:`object`,properties:{id:{type:`string`},$schema:{type:`string`},title:{type:`string`},description:{type:`string`},default:{},multipleOf:{type:`number`,minimum:0,exclusiveMinimum:!0},maximum:{type:`number`},exclusiveMaximum:{type:`boolean`,default:!1},minimum:{type:`number`},exclusiveMinimum:{type:`boolean`,default:!1},maxLength:{$ref:`#/definitions/positiveInteger`},minLength:{$ref:`#/definitions/positiveIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{anyOf:[{type:`boolean`},{$ref:`#`}],default:{}},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:{}},maxItems:{$ref:`#/definitions/positiveInteger`},minItems:{$ref:`#/definitions/positiveIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxProperties:{$ref:`#/definitions/positiveInteger`},minProperties:{$ref:`#/definitions/positiveIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{anyOf:[{type:`boolean`},{$ref:`#`}],default:{}},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},enum:{type:`array`},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},dependencies:{exclusiveMaximum:[`maximum`],exclusiveMinimum:[`minimum`]},default:{}}],draft6:[{$schema:`http://json-schema.org/draft-06/schema#`,$id:`http://json-schema.org/draft-06/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},title:{type:`string`},description:{type:`string`},default:{},examples:{type:`array`,items:{}},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:{}},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:{},enum:{type:`array`},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:{}}],draft7:[{$schema:`http://json-schema.org/draft-07/schema#`,$id:`http://json-schema.org/draft-07/schema#`,title:`Core schema meta-schema`,definitions:{schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},default:!0}],draft201909:[{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/schema`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:`Core and Validation specifications meta-schema`,allOf:[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format`},{$ref:`meta/content`}],type:[`object`,`boolean`],properties:{definitions:{$comment:`While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.`,type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},dependencies:{$comment:`"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"`,type:`object`,additionalProperties:{anyOf:[{$recursiveRef:`#`},{$ref:`meta/validation#/$defs/stringArray`}]}}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/core`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:`Core vocabulary meta-schema`,type:[`object`,`boolean`],properties:{$id:{type:`string`,format:`uri-reference`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{type:`string`,format:`uri`},$anchor:{type:`string`,pattern:`^[A-Za-z][-A-Za-z0-9.:_]*$`},$ref:{type:`string`,format:`uri-reference`},$recursiveRef:{type:`string`,format:`uri-reference`},$recursiveAnchor:{type:`boolean`,default:!1},$vocabulary:{type:`object`,propertyNames:{type:`string`,format:`uri`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/applicator`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:`Applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{additionalItems:{$recursiveRef:`#`},unevaluatedItems:{$recursiveRef:`#`},items:{anyOf:[{$recursiveRef:`#`},{$ref:`#/$defs/schemaArray`}]},contains:{$recursiveRef:`#`},additionalProperties:{$recursiveRef:`#`},unevaluatedProperties:{$recursiveRef:`#`},properties:{type:`object`,additionalProperties:{$recursiveRef:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$recursiveRef:`#`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$recursiveRef:`#`}},propertyNames:{$recursiveRef:`#`},if:{$recursiveRef:`#`},then:{$recursiveRef:`#`},else:{$recursiveRef:`#`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$recursiveRef:`#`}},$defs:{schemaArray:{type:`array`,minItems:1,items:{$recursiveRef:`#`}}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/validation`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:`Validation vocabulary meta-schema`,type:[`object`,`boolean`],properties:{multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}},const:!0,enum:{type:`array`,items:!0},type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/meta-data`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:`Meta-data vocabulary meta-schema`,type:[`object`,`boolean`],properties:{title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/format`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:`Format vocabulary meta-schema`,type:[`object`,`boolean`],properties:{format:{type:`string`}}},{$schema:`https://json-schema.org/draft/2019-09/schema`,$id:`https://json-schema.org/draft/2019-09/meta/content`,$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:`Content vocabulary meta-schema`,type:[`object`,`boolean`],properties:{contentMediaType:{type:`string`},contentEncoding:{type:`string`},contentSchema:{$recursiveRef:`#`}}}],draft202012:[{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/schema`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:`meta`,title:`Core and Validation specifications meta-schema`,allOf:[{$ref:`meta/core`},{$ref:`meta/applicator`},{$ref:`meta/unevaluated`},{$ref:`meta/validation`},{$ref:`meta/meta-data`},{$ref:`meta/format-annotation`},{$ref:`meta/content`}],type:[`object`,`boolean`],$comment:`This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.`,properties:{definitions:{$comment:`"definitions" has been replaced by "$defs".`,type:`object`,additionalProperties:{$dynamicRef:`#meta`},deprecated:!0,default:{}},dependencies:{$comment:`"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.`,type:`object`,additionalProperties:{anyOf:[{$dynamicRef:`#meta`},{$ref:`meta/validation#/$defs/stringArray`}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:`"$recursiveAnchor" has been replaced by "$dynamicAnchor".`,$ref:`meta/core#/$defs/anchorString`,deprecated:!0},$recursiveRef:{$comment:`"$recursiveRef" has been replaced by "$dynamicRef".`,$ref:`meta/core#/$defs/uriReferenceString`,deprecated:!0}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/core`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:`meta`,title:`Core vocabulary meta-schema`,type:[`object`,`boolean`],properties:{$id:{$ref:`#/$defs/uriReferenceString`,$comment:`Non-empty fragments not allowed.`,pattern:`^[^#]*#?$`},$schema:{$ref:`#/$defs/uriString`},$ref:{$ref:`#/$defs/uriReferenceString`},$anchor:{$ref:`#/$defs/anchorString`},$dynamicRef:{$ref:`#/$defs/uriReferenceString`},$dynamicAnchor:{$ref:`#/$defs/anchorString`},$vocabulary:{type:`object`,propertyNames:{$ref:`#/$defs/uriString`},additionalProperties:{type:`boolean`}},$comment:{type:`string`},$defs:{type:`object`,additionalProperties:{$dynamicRef:`#meta`}}},$defs:{anchorString:{type:`string`,pattern:`^[A-Za-z_][-A-Za-z0-9._]*$`},uriString:{type:`string`,format:`uri`},uriReferenceString:{type:`string`,format:`uri-reference`}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/applicator`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:`meta`,title:`Applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{prefixItems:{$ref:`#/$defs/schemaArray`},items:{$dynamicRef:`#meta`},contains:{$dynamicRef:`#meta`},additionalProperties:{$dynamicRef:`#meta`},properties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},patternProperties:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},propertyNames:{format:`regex`},default:{}},dependentSchemas:{type:`object`,additionalProperties:{$dynamicRef:`#meta`},default:{}},propertyNames:{$dynamicRef:`#meta`},if:{$dynamicRef:`#meta`},then:{$dynamicRef:`#meta`},else:{$dynamicRef:`#meta`},allOf:{$ref:`#/$defs/schemaArray`},anyOf:{$ref:`#/$defs/schemaArray`},oneOf:{$ref:`#/$defs/schemaArray`},not:{$dynamicRef:`#meta`}},$defs:{schemaArray:{type:`array`,minItems:1,items:{$dynamicRef:`#meta`}}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/unevaluated`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:`meta`,title:`Unevaluated applicator vocabulary meta-schema`,type:[`object`,`boolean`],properties:{unevaluatedItems:{$dynamicRef:`#meta`},unevaluatedProperties:{$dynamicRef:`#meta`}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/validation`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:`meta`,title:`Validation vocabulary meta-schema`,type:[`object`,`boolean`],properties:{type:{anyOf:[{$ref:`#/$defs/simpleTypes`},{type:`array`,items:{$ref:`#/$defs/simpleTypes`},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/$defs/nonNegativeInteger`},minLength:{$ref:`#/$defs/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},maxItems:{$ref:`#/$defs/nonNegativeInteger`},minItems:{$ref:`#/$defs/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},maxContains:{$ref:`#/$defs/nonNegativeInteger`},minContains:{$ref:`#/$defs/nonNegativeInteger`,default:1},maxProperties:{$ref:`#/$defs/nonNegativeInteger`},minProperties:{$ref:`#/$defs/nonNegativeIntegerDefault0`},required:{$ref:`#/$defs/stringArray`},dependentRequired:{type:`object`,additionalProperties:{$ref:`#/$defs/stringArray`}}},$defs:{nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{$ref:`#/$defs/nonNegativeInteger`,default:0},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/meta-data`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:`meta`,title:`Meta-data vocabulary meta-schema`,type:[`object`,`boolean`],properties:{title:{type:`string`},description:{type:`string`},default:!0,deprecated:{type:`boolean`,default:!1},readOnly:{type:`boolean`,default:!1},writeOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/format-annotation`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:`meta`,title:`Format vocabulary meta-schema for annotation results`,type:[`object`,`boolean`],properties:{format:{type:`string`}}},{$schema:`https://json-schema.org/draft/2020-12/schema`,$id:`https://json-schema.org/draft/2020-12/meta/content`,$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:`meta`,title:`Content vocabulary meta-schema`,type:[`object`,`boolean`],properties:{contentEncoding:{type:`string`},contentMediaType:{type:`string`},contentSchema:{$dynamicRef:`#meta`}}}]},$f={"json-schema.org/draft/2020-12/schema":`2020-12`,"json-schema.org/draft/2019-09/schema":`2019-09`,"json-schema.org/draft-07/schema":`7`,"json-schema.org/draft-06/schema":`6`,"json-schema.org/draft-04/schema":`4`},ep=new Set(`$anchor.$id.$recursiveAnchor.$recursiveRef.$ref.additionalItems.additionalProperties.allOf.anyOf.const.contains.dependencies.dependentRequired.dependentSchemas.else.enum.exclusiveMaximum.exclusiveMinimum.format.id.if.items.maxContains.maxItems.maxLength.maxProperties.maximum.minContains.minItems.minLength.minProperties.minimum.multipleOf.not.oneOf.pattern.patternProperties.prefixItems.properties.propertyNames.required.then.type.unevaluatedItems.unevaluatedProperties.uniqueItems`.split(`.`)),tp={single:[`additionalItems`,`additionalProperties`,`items`,`not`],array:[`allOf`,`anyOf`,`items`,`oneOf`],map:[`definitions`,`dependencies`,`patternProperties`,`properties`],plain:[`$ref`,`enum`,`exclusiveMaximum`,`exclusiveMinimum`,`format`,`id`,`maxItems`,`maxLength`,`maxProperties`,`maximum`,`minItems`,`minLength`,`minProperties`,`minimum`,`multipleOf`,`pattern`,`required`,`type`,`uniqueItems`]},np={...tp,single:[...tp.single,`contains`,`propertyNames`],plain:[...tp.plain.filter(e=>e!==`id`),`$id`,`const`]},rp={...np,single:[...np.single,`if`,`then`,`else`]},ip={single:[...rp.single,`unevaluatedItems`,`unevaluatedProperties`],array:rp.array,map:[...rp.map,`$defs`,`dependentSchemas`],plain:[...rp.plain.filter(e=>e!==`format`),`$anchor`,`$recursiveAnchor`,`$recursiveRef`,`dependentRequired`,`maxContains`,`minContains`]},ap={single:ip.single.filter(e=>e!==`additionalItems`),array:[`allOf`,`anyOf`,`oneOf`,`prefixItems`],map:ip.map,plain:ip.plain.filter(e=>e!==`$recursiveAnchor`&&e!==`$recursiveRef`)},op={4:tp,6:np,7:rp,"2019-09":ip,"2020-12":ap},sp={4:[],6:[`contentMediaType`],7:[`contentMediaType`],"2019-09":[],"2020-12":[`$dynamicAnchor`,`$dynamicRef`]},cp=[`date`,`date-time`,`email`,`hostname`,`idn-email`,`ipv4`,`ipv6`,`regex`,`time`,`uri`],lp=[...cp,`json-pointer`,`uri-reference`,`uri-template`],up={4:cp,6:lp,7:[...lp,`idn-hostname`,`iri`,`iri-reference`,`relative-json-pointer`]},dp=[`idn-email`,`idn-hostname`,`iri`,`iri-reference`],fp={base64:pp(`A-Za-z0-9+/`),base64url:pp(`A-Za-z0-9\\-_`),base32:mp(`A-Z2-7`,`AEIMQUY4`,`AQ`,`ACEGIKMOQSUWY246`,`AIQY`),base32hex:mp(`0-9A-V`,`048CGKOS`,`0G`,`02468ACEGIKMOQSU`,`08GO`),base16:`^(?:[0-9A-Fa-f]{2})*$`};function pp(e){let t=`[${e}]`;return`^(?:${t}{4})*(?:${t}[AQgw]==|${t}{2}[AEIMQUYcgkosw048]=)?$`}function mp(e,t,n,r,i){let a=`[${e}]`;return`^(?:${a}{8})*(?:${a}[${t}]={6}|${a}{3}[${n}]={4}|${a}{4}[${r}]={3}|${a}{6}[${i}]=)?$`}var hp=class extends Error{};function gp(e){if(!Ul(e))return`2020-12`;let t=e.$schema;if(typeof t!=`string`)return`2020-12`;let n=$f[t.replace(/#+$/,``).replace(/^https?:\/\//,``)];if(!n)throw new hp(`unknown JSON Schema dialect "${t}"`);return n}function _p(e,t,n=[]){if(typeof e==`boolean`)return e;if(!Ul(e))return{};let r=op[t],i=new Set([...r.single,...r.array,...r.map,...r.plain,...n]),a=typeof e.$ref==`string`&&[`4`,`6`,`7`].includes(t),o=[];for(let[s,c]of Object.entries(e)){if(sp[t].includes(s)&&!n.includes(s))throw new hp(`the \`${s}\` keyword is not supported by the browser runtime yet`);if(!(ep.has(s)&&(!i.has(s)||a&&s!==`$ref`))){if(s===`pattern`&&typeof c==`string`&&yp(c),s===`patternProperties`&&Ul(c))for(let e of Object.keys(c))yp(e);if(s===`format`&&typeof c==`string`){if(!up[t]?.includes(c))continue;if(dp.includes(c))throw new hp(`the "${c}" format is not supported by the browser runtime yet`)}r.array.includes(s)&&Array.isArray(c)?o.push([s,c.map(e=>_p(e,t,n))]):r.single.includes(s)?o.push([s,_p(c,t,n)]):r.map.includes(s)&&Ul(c)?o.push([s,vp(c,t,n)]):o.push([s,c])}}let s=e.contentEncoding;if(!a&&(t===`6`||t===`7`)&&typeof s==`string`){let e=fp[s];if(e){let t=o.find(([e])=>e===`allOf`);t?t[1]=[...t[1],{pattern:e}]:o.push([`allOf`,[{pattern:e}]])}}return Object.fromEntries(o)}function vp(e,t,n){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,Array.isArray(r)?r:_p(r,t,n)]))}function yp(e){try{md(e)}catch(t){throw t instanceof Xu?new hp(`"${e}" is not a valid regular expression: ${t.message}`):t instanceof Zu?new hp(`the regular expression "${e}" is not supported by the browser runtime yet: ${t.message}`):t}}function bp(e){for(let t of e.references)if(Jf(e.lookup,t)===void 0)throw new hp(`unresolvable reference "${decodeURI(t.replace(/^json-schema:\/\/\//,``))}"`)}function xp(e){if(Array.isArray(e))return e.map(xp);if(!Ul(e))return e;let t=[];for(let[n,r]of Object.entries(e))n===`$dynamicAnchor`?t.push([`$recursiveAnchor`,!0]):n===`$dynamicRef`?t.push([`$recursiveRef`,`#`]):t.push([n,xp(r)]);return Object.fromEntries(t)}var Sp={4:Qf.draft4,6:Qf.draft6,7:Qf.draft7,"2019-09":Qf.draft201909,"2020-12":Qf.draft202012};function Cp(e){return Sp[e].map(t=>e===`2020-12`?xp(_p(t,e,[`$dynamicAnchor`,`$dynamicRef`])):_p(t,e))}var wp=class{constructor(e,t,n,r){this.schema=e,this.dialect=t,this.shortCircuit=n,this.lookup=qf(e,void 0,this.references);for(let e of r)qf(e,this.lookup)}lookup;references=[];validate(e){return Zf(e,this.schema,this.dialect,this.lookup,this.shortCircuit)}},Tp=new Map;function Ep(e){let t=Tp.get(e);if(!t){let[n,...r]=Cp(e);t=new wp(n,e,!1,r),Tp.set(e,t)}return t}function Dp(e){let t=e[e.length-1];if(!t)return`value does not match the schema`;let n=t.instanceLocation.replace(/^#/,``);return n?`${t.error} (at ${n})`:t.error}function Op(e){let t=gp(e);if(typeof e==`boolean`){if(t===`4`)throw new hp(`boolean schemas need draft 6 or later`)}else{let n=Ep(t).validate(e);if(!n.valid)throw new hp(Dp(n.errors))}let n=new wp(_p(Ff(e),t),t,!0,Cp(t));return bp(n),e=>{let t=n.validate(kf(e));return t.valid?void 0:Dp(t.errors)}}function kp(e){return Op(kf(e))}function Ap(e){e.setJsonSchemaValidator(kp)}function jp(){return import.meta.url}function Mp(){return null}var Np=`Jazz's local-first client needs its Metro setup on Expo web: wrap your Metro config in withJazz from jazz-tools/expo/metro (module.exports = withJazz(getDefaultConfig(__dirname))) and restart Metro with --clear.`;function Pp(){return`__METRO_GLOBAL_PREFIX__`in globalThis}async function Fp(){let e=process.getBuiltinModule?.(`module`),t=process.getBuiltinModule?.(`fs`),n=process.getBuiltinModule?.(`path`);if(!e||!t||!n)return null;let{createRequire:r}=e,{existsSync:i,readFileSync:a}=t,{dirname:o,resolve:s}=n,c={}.JAZZ_CORRECTNESS_WASM_PACKAGE;if({}.JAZZ_CORRECTNESS_ARTIFACT_RUN===`1`&&!c)throw Error(`sealed correctness consumer is missing its admitted WASM package`);if(c){let e=s(c,`jazz_wasm_bg.wasm`);return i(e)?a(e):null}let l=s(o(r(import.meta.url).resolve(`jazz-wasm/package.json`)),`pkg/jazz_wasm_bg.wasm`);return i(l)?a(l):null}var Ip=Promise.resolve(),Lp;function Rp(e){let t=Ip.then(()=>zp(e));return Ip=t.then(()=>{},()=>{}),t}async function zp(e){let t=await Promise.resolve().then(()=>(He(),i)),n=Ku(e);if(n)return t.initSync(n),Bp(t);let r=!1;if(typeof process<`u`&&process.versions?.node)try{let e=await Fp();e&&(t.initSync({module:e}),r=!0)}catch{}if(!r&&typeof t.default==`function`){let n=typeof location<`u`?qu(jp,location.href,e)??Mp():null;if(n)await Vp(t,n);else{if(typeof location<`u`&&Pp())throw Error(Np);await t.default()}}return Bp(t)}function Bp(e){return Yu(e,`WASM`,[`initSync`,`WasmDb`,`setJsonSchemaValidator`]),Ap(e),e}async function Vp(e,t){if(Lp===t)return;let n=await fetch(t);if(!n.ok)throw Error(`WASM asset request failed (${n.status} ${n.statusText}) for ${t}`);let r=n.headers.get(`content-type`);if(Hp(r)){let i;try{i=await WebAssembly.compileStreaming(n)}catch(e){throw e instanceof WebAssembly.CompileError?Error(`WASM asset response is not a WebAssembly binary for ${t} (${r}): ${e.message}`):e}await e.default({module_or_path:i}),Lp=t;return}let i=new Uint8Array(await n.arrayBuffer());if(i.length<4||i[0]!==0||i[1]!==97||i[2]!==115||i[3]!==109)throw Error(`WASM asset response is not a WebAssembly binary for ${t} (${r??`unknown content type`})`);await e.default({module_or_path:i}),Lp=t}function Hp(e){return typeof WebAssembly.compileStreaming==`function`?e?.trim()===`application/wasm`:!1}var Up=class extends Error{constructor(e){super(`IndexedDB database ${e} is active in another Jazz SharedWorker realm; wait for that worker to close before retrying`),this.databaseName=e,this.name=`BrowserPhysicalDatabaseBusyError`}},Wp=new WeakMap;function Gp(e,t){let n=Wp.get(e);if(!n||n.databaseName!==t||!n.active()||n.claimed)throw Error(`IndexedDB reclamation requires an unclaimed live database Web Lock`);return n.claimed=!0,n.active}async function Kp(e,t=globalThis.navigator?.locks){if(!t)throw Error(`Persistent browser storage requires the Web Locks API`);let n,r,i=new Promise((e,t)=>{n=e,r=t}),a=!1,o,s=new Promise(e=>{o=e}),c,l=new Promise(e=>{c=e}),u=crypto.randomUUID();return t.request(`jazz:browser-physical-database:${e}`,{mode:`exclusive`,ifAvailable:!0},async t=>{if(!t){r(new Up(e));return}let i={id:u,release:()=>(a||(a=!0,o()),l)};Wp.set(i,{databaseName:e,active:()=>!a,claimed:!1}),n(i),await s}).then(()=>{a=!0,c()},e=>{a=!0,c(),r(Hl(e))}),await i}var qp=`unsupported_storage_codecs`,Jp=class extends Error{name=`UnsupportedStorageCodecsError`;code=qp;missing;unknown;format;constructor(e,t,n=`Unsupported storage format: this store lacks codec families ${JSON.stringify(e)} required by this build and declares ${JSON.stringify(t)} that this build does not read`,r){super(n,r),this.missing=e,this.unknown=t,r?.format!==void 0&&(this.format=r.format)}};function Yp(e){return!e||typeof e!=`object`?!1:e.code===qp}function Xp(e){if(e instanceof Jp||!Yp(e))return e;let{missing:t,unknown:n,format:r}=e;return r!==void 0&&(typeof r!=`string`||r.length===0)||!(t===void 0&&n===void 0)&&(!Zp(t)||!Zp(n))?e:new Jp([...t??[]],[...n??[]],e.message,{cause:e,...r===void 0?{}:{format:r}})}function Zp(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}var Qp=1,$p=`jazz-idb-tree`,em=3,tm=`pages`,nm=`metadata`,q=`storage-manifest`,rm=`epoch`,im=`browser-runtime-owner`,am=`browser-worker-epoch-v1`,om=`jazz-browser-worker-epoch-v1`,sm=`replica-node-v1`,cm=16,lm=`foreground-node-leases-v1`,um=`jazz-foreground-node-leases-v1`,dm=(1n<<64n)-1n,fm=`current`,pm=1024,mm=2147483648,hm=16*1024,gm=1,_m={storageEpoch:gm,adapterId:`jazz-idb-tree`,adapterFormatVersion:Qp,requiredCodecIds:[`jazz.sqlite-storage.v1`],pageSize:hm,pageChecksum:`xxh3-64-le`,pageFormatMagic:`IDBTREE\0`,pageFormatVersion:Qp},vm=class extends Error{constructor(e){super(`IndexedDB storage was invalidated: ${e}`),this.databaseName=e,this.name=`IndexedDbStorageInvalidatedError`}},ym=class extends Error{code=`storage`;constructor(e){super(`browser storage: could not write to IndexedDB (QuotaExceededError); the browser may be out of storage space for this site`,{cause:e}),this.name=`IndexedDbStorageFullError`}};function bm(e,t){return e?.name===`QuotaExceededError`?new ym(e):e??Error(t)}var xm=class e{constructor(e,t,n){this.db=e,this.name=t,n&&this.invalidationListeners.add(n),e.addEventListener(`versionchange`,this.handleVersionChange),e.addEventListener(`close`,this.handleUnexpectedClose)}invalidated=!1;reclamationOwnership=null;treeClaims=new Set;nextTreeToken=0;treeTransactions=new Set;ownershipRevision=0;claimTreeOwnership(){if(this.assertValid(),this.reclamationOwnership&&(this.treeClaims.size>0||this.treeTransactions.size>0))throw Error(`IndexedDB reclamation owner already has a tree or pending transaction`);if(this.nextTreeToken===2**53-1)throw Error(`IndexedDB tree token space exhausted`);let e=++this.nextTreeToken;return this.treeClaims.add(e),e}releaseTreeOwnership(e){this.treeClaims.delete(e)}isTreeOwnershipActive(e){return!this.invalidated&&this.treeClaims.has(e)&&(this.reclamationOwnership===null||this.reclamationOwnership())}async retireTreeOwnership(){this.treeClaims.clear(),await Promise.allSettled(this.treeTransactions)}get canReclaimObsoletePages(){return!this.invalidated&&this.treeClaims.size===1&&this.reclamationOwnership?.()===!0}replicaNodeBytes=null;invalidationListeners=new Set;onInvalidated(e){return this.invalidationListeners.add(e),()=>this.invalidationListeners.delete(e)}static async open(t,n={}){let r=indexedDB.open(t,em),i=!1;r.onupgradeneeded=e=>{if(e.oldVersion!==0){i=!0,r.result.close(),r.transaction?.abort();return}let t=r.result;if(t.objectStoreNames.contains(tm)||t.createObjectStore(tm),t.objectStoreNames.contains(nm)||t.createObjectStore(nm),!t.objectStoreNames.contains(q)){let e=t.createObjectStore(q);r.transaction&&(e.put(_m,rm),e.put(Cm().buffer,sm))}};let a;try{a=await Rm(r)}catch(e){throw i?Error(`Missing or invalid IndexedDB storage epoch manifest`):e}let o=new e(a,t,n.onInvalidated);try{return await o.assertStorageManifest(),n.owner&&await o.claimBrowserRuntimeOwner(n.owner),o.replicaNodeBytes=await o.readReplicaNodeBytes(),o}catch(e){throw o.close(),e}}get replicaNode(){if(!this.replicaNodeBytes)throw Error(`IndexedDB replica node is unavailable before storage admission`);return this.replicaNodeBytes.slice()}async acquireForegroundNodeLease(e=!1){return await this.updateForegroundNodeLeasePool(t=>{if(e){for(let e of t.active)t.retired.push(e.node);t.active=[]}let n=t.reusable.pop(),r={leaseId:crypto.randomUUID(),node:n?.node??wm(Cm()),confirmedTxTime:n?.confirmedTxTime??`0`};return t.active.push(r),Em(r)})}async returnForegroundNodeLease(e,t){if(!Mm(e)||!Fm(t))throw Error(`Invalid IndexedDB foreground node lease handoff`);await this.updateForegroundNodeLeasePool(n=>{let r=n.active.findIndex(t=>t.leaseId===e);if(r<0)throw Error(`Unknown IndexedDB foreground node lease`);let[i]=n.active.splice(r,1);if(!i)throw Error(`Unknown IndexedDB foreground node lease`);let a=BigInt(i.confirmedTxTime);n.reusable.push({...i,confirmedTxTime:(t>a?t:a).toString()})})}async retireForegroundNodeLease(e){if(!Mm(e))throw Error(`Invalid IndexedDB foreground node lease`);await this.updateForegroundNodeLeasePool(t=>{let n=t.active.findIndex(t=>t.leaseId===e);if(n<0)return;let[r]=t.active.splice(n,1);r&&t.retired.push(r.node)})}async foregroundNodeLeaseNodeState(e){if(e.byteLength!==cm)throw Error(`Invalid IndexedDB foreground node identity`);this.assertValid();let t=this.db.transaction(q,`readonly`),n=zm(t);try{let r=await Rm(t.objectStore(q).get(lm));if(await n,r===void 0)return`missing`;let i=Dm(r),a=Im(wm(e));return i.active.some(e=>Im(e.node)===a)?`active`:i.reusable.some(e=>Im(e.node)===a)?`reusable`:i.retired.some(e=>Im(e)===a)?`retired`:`missing`}catch(e){throw await n.catch(()=>{}),e}}async claimBrowserWorkerEpoch(e,t){if(!Nm(e))throw Error(`Invalid browser worker epoch`);if(this.assertValid(),t&&(t.id!==e||this.treeClaims.size>0))throw Error(`IndexedDB reclamation ownership must precede tree construction`);let n=this.ownershipRevision,r=t?Gp(t,this.name):null,i=this.db.transaction(q,`readwrite`),a=zm(i);if(i.objectStore(q).put({format:om,epoch:e},am),await a,this.assertValid(),n!==this.ownershipRevision)throw Error(`IndexedDB worker ownership was released while claiming`);this.reclamationOwnership=r}async releaseBrowserWorkerEpoch(e){if(this.treeClaims.clear(),this.ownershipRevision++,this.reclamationOwnership=null,!Nm(e))throw Error(`Invalid browser worker epoch`);this.assertValid();let t=this.db.transaction(q,`readwrite`),n=zm(t),r=t.objectStore(q),i=await Rm(r.get(am));i&&typeof i==`object`&&i.format===om&&i.epoch===e&&r.delete(am),await n}async metadata(){this.assertValid();let e=this.db.transaction(nm,`readonly`),t=zm(e),n=await Rm(e.objectStore(nm).get(fm));return await t,n===void 0?null:(Vm(n),n)}async assertStorageManifest(){let e=this.db.transaction(q,`readonly`),t=zm(e),n=await Rm(e.objectStore(q).get(rm));await t,Um(n)}async claimBrowserRuntimeOwner(e){if(typeof e!=`string`||e.length===0)throw Error(`Invalid browser IndexedDB runtime owner`);let t=this.db.transaction(q,`readwrite`),n=zm(t),r=t.objectStore(q),i=await Rm(r.get(im));if(i===void 0){r.put(e,im),await n;return}if(i===e){await n;return}throw t.abort(),await n.catch(()=>{}),Error(`IndexedDB database ${this.name} is already owned by a different Jazz browser session; this indicates a wrong physical root or namespace derivation error. Reset this scoped database only if you intend to discard its cache`)}async readReplicaNodeBytes(){let e=this.db.transaction(q,`readonly`),t=zm(e),n=await Rm(e.objectStore(q).get(sm));if(await t,!(n instanceof ArrayBuffer)&&!ArrayBuffer.isView(n))throw Error(`Missing or invalid IndexedDB replica node identity`);let r=n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if(r.byteLength!==cm)throw Error(`Missing or invalid IndexedDB replica node identity`);return r.slice()}async updateForegroundNodeLeasePool(e){this.assertValid();let t=Sm(this.db,[q]),n=zm(t),r=t.objectStore(q);try{let t=await Rm(r.get(lm)),i=t===void 0?Tm():Dm(t),a=e(i);return km(i),r.put(i,lm),await n,a}catch(e){try{t.abort()}catch{}throw await n.catch(()=>{}),e}}async readPage(e){return(await this.readPages([e]))[0]}async readPages(e){this.assertValid();for(let t of e)Gm(t);if(e.length===0)return[];let t=this.db.transaction(tm,`readonly`),n=zm(t),r=t.objectStore(tm),i;try{i=await Promise.all(e.map(e=>Rm(r.get(e))))}catch(e){throw await n.catch(()=>{}),e}return await n,i.map((t,n)=>Lm(e[n],t))}async commit(e,t){if(this.assertValid(),Hm(e),t!==void 0&&!this.isTreeOwnershipActive(t))throw Error(`IndexedDB tree ownership has expired`);let n=(e.deletedPageIds?.length??0)>0;if(n&&!this.canReclaimObsoletePages)throw Error(`IndexedDB page reclamation ownership is not active`);let r=Sm(this.db,[tm,nm]),i=zm(r),a=r.objectStore(tm),o=r.objectStore(nm),s=await Rm(o.get(fm)),c=s===void 0?0:Bm(s);if(c!==e.expectedGeneration)throw r.abort(),await i.catch(()=>{}),Error(`IndexedDB B-tree generation changed: expected ${e.expectedGeneration}, found ${c}`);let l={...e.metadata,formatMagic:$p,formatVersion:Qp,generation:c+1};Vm(l);try{if(l.rootPageId!==null&&!e.pages.has(l.rootPageId)&&await Rm(a.get(l.rootPageId))===void 0)throw Error(`IndexedDB B-tree root page ${l.rootPageId} is missing`);if(t!==void 0&&!this.isTreeOwnershipActive(t))throw Error(`IndexedDB tree ownership expired before publication`);if(n&&!this.canReclaimObsoletePages)throw Error(`IndexedDB page reclamation ownership expired before publication`);for(let[t,n]of e.pages){if(n.byteLength>l.pageSize)throw Error(`IndexedDB B-tree page ${t} exceeds configured page size`);a.put(n.slice().buffer,t)}for(let t of e.deletedPageIds??[])a.delete(t);return o.put(l,fm),await i,l}catch(e){try{r.abort()}catch{}throw await i.catch(()=>{}),e}}commitPages(e,t,n,r,i,a,o,s){if(i.length!==a.length)return Promise.reject(Error(`IDBTree page ids and page bytes have different lengths`));let c=this.commit({expectedGeneration:e,metadata:{pageSize:t,rootPageId:n<0?null:n,nextPageId:r},pages:new Map(i.map((e,t)=>[e,a[t]])),deletedPageIds:o},s);return s!==void 0&&(this.treeTransactions.add(c),c.then(()=>this.treeTransactions.delete(c),()=>this.treeTransactions.delete(c))),c}close(){this.treeClaims.clear(),this.invalidated=!0,this.ownershipRevision++,this.reclamationOwnership=null,this.removeInvalidationListeners(),this.db.close()}async clear(){this.assertValid();let e=Sm(this.db,[tm,nm]),t=zm(e);e.objectStore(tm).clear(),e.objectStore(nm).clear(),await t}static async destroy(e){let t=indexedDB.deleteDatabase(e);await new Promise((n,r)=>{t.onsuccess=()=>n(),t.onerror=()=>r(t.error??Error(`IndexedDB deletion failed`)),t.onblocked=()=>r(Error(`IndexedDB deletion was blocked by an open connection: ${e}`))})}handleVersionChange=()=>{this.db.close(),this.invalidate()};handleUnexpectedClose=()=>{this.invalidate()};invalidate(){if(this.invalidated)return;this.invalidated=!0,this.treeClaims.clear(),this.reclamationOwnership=null,this.removeInvalidationListeners();let e=new vm(this.name);for(let t of this.invalidationListeners)t(e)}assertValid(){if(this.invalidated)throw new vm(this.name)}removeInvalidationListeners(){this.db.removeEventListener(`versionchange`,this.handleVersionChange),this.db.removeEventListener(`close`,this.handleUnexpectedClose)}};function Sm(e,t){return e.transaction(t,`readwrite`,{durability:`relaxed`})}function Cm(){if(!globalThis.crypto?.getRandomValues)throw Error(`Browser storage requires cryptographic random values for its replica identity`);return Nl(globalThis.crypto.getRandomValues(new Uint8Array(cm)))}function wm(e){return e.slice().buffer}function Tm(){return{format:um,active:[],reusable:[],retired:[]}}function Em(e){return{leaseId:e.leaseId,node:new Uint8Array(e.node).slice(),confirmedTxTime:BigInt(e.confirmedTxTime)}}function Dm(e){return km(e),{format:e.format,active:e.active.map(Om),reusable:e.reusable.map(Om),retired:e.retired.map(e=>e.slice(0))}}function Om(e){return{leaseId:e.leaseId,node:e.node.slice(0),confirmedTxTime:e.confirmedTxTime}}function km(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB foreground node lease pool`);let t=e;if(t.format!==um||!Array.isArray(t.active)||!Array.isArray(t.reusable)||!Array.isArray(t.retired))throw Error(`Invalid IndexedDB foreground node lease pool`);let n=new Set,r=new Set;for(let e of[...t.active,...t.reusable]){Am(e);let t=Im(e.node);if(r.has(e.leaseId)||n.has(t))throw Error(`Invalid IndexedDB foreground node lease pool`);r.add(e.leaseId),n.add(t)}for(let e of t.retired){let t=jm(e)?Im(e):null;if(!t||n.has(t))throw Error(`Invalid IndexedDB foreground node lease pool`);n.add(t)}}function Am(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB foreground node lease`);let t=e;if(!Mm(t.leaseId)||!jm(t.node)||!Pm(t.confirmedTxTime)||!Fm(BigInt(t.confirmedTxTime)))throw Error(`Invalid IndexedDB foreground node lease`)}function jm(e){return e instanceof ArrayBuffer&&e.byteLength===cm}function Mm(e){return typeof e==`string`&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Nm(e){return typeof e==`string`&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function Pm(e){return typeof e==`string`&&/^(0|[1-9][0-9]*)$/.test(e)}function Fm(e){return e>=0n&&e<=dm}function Im(e){return Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}function Lm(e,t){if(t===void 0)return null;if(!(t instanceof ArrayBuffer)&&!ArrayBuffer.isView(t))throw Error(`IndexedDB B-tree page ${e} is not binary data`);return(t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)).slice()}function Rm(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(bm(e.error,`IndexedDB request failed`))})}function zm(e){return new Promise((t,n)=>{e.oncomplete=()=>t(),e.onabort=()=>n(bm(e.error,`IndexedDB transaction aborted`)),e.onerror=t=>{let r=t.target===e?null:t.target;n(bm(e.error??r?.error??null,`IndexedDB transaction failed`))}})}function Bm(e){return Vm(e),e.generation}function Vm(e){if(!e||typeof e!=`object`)throw Error(`Invalid IndexedDB B-tree metadata`);let t=e;if(t.formatMagic!==$p||t.formatVersion!==Qp||!Wm(t.pageSize)||t.pageSize!==hm||!Number.isSafeInteger(t.generation)||Number(t.generation)<1||t.rootPageId!==null&&!Km(t.rootPageId)||!Number.isSafeInteger(t.nextPageId)||Number(t.nextPageId)<0||t.rootPageId!==null&&Number(t.rootPageId)>=Number(t.nextPageId))throw Error(`Invalid IndexedDB B-tree metadata`)}function Hm(e){if(!Number.isSafeInteger(e.expectedGeneration)||e.expectedGeneration<0)throw Error(`Invalid IndexedDB B-tree expected generation`);let{pageSize:t,rootPageId:n,nextPageId:r}=e.metadata;if(!Wm(t)||t!==hm||!Km(r))throw Error(`Invalid IndexedDB B-tree commit metadata`);if(n!==null&&(!Km(n)||n>=r))throw Error(`Invalid IndexedDB B-tree commit root page id`);let i=new Set;for(let[n,a]of e.pages){if(!Km(n)||n>=r||a.byteLength>t)throw Error(`Invalid IndexedDB B-tree page commit`);i.add(n)}for(let t of e.deletedPageIds??[])if(!Km(t)||t>=r||t===n||i.has(t))throw Error(`Invalid IndexedDB B-tree deleted page commit`)}function Um(e){if(!e||typeof e!=`object`)throw Error(`Missing or invalid IndexedDB storage epoch manifest`);let t=e,n=Object.keys(t).sort(),r=Object.keys(_m).sort();if(n.length!==r.length||n.some((e,t)=>e!==r[t])||t.storageEpoch!==_m.storageEpoch||t.adapterId!==_m.adapterId||t.adapterFormatVersion!==_m.adapterFormatVersion||t.pageSize!==_m.pageSize||t.pageChecksum!==_m.pageChecksum||t.pageFormatMagic!==_m.pageFormatMagic||t.pageFormatVersion!==_m.pageFormatVersion||!Array.isArray(t.requiredCodecIds)||!t.requiredCodecIds.every(e=>typeof e==`string`))throw Error(`Missing or invalid IndexedDB storage epoch manifest`);let i=t.requiredCodecIds,a=_m.requiredCodecIds;if(i.length!==a.length||i.some((e,t)=>e!==a[t])){let e=a.filter(e=>!i.includes(e)),t=i.filter(e=>!a.includes(e));throw new Jp(e,t,`Missing or invalid IndexedDB storage epoch manifest: unsupported storage format: this epoch-${gm} root lacks codec families ${JSON.stringify(e)} required by this build and declares ${JSON.stringify(t)} that this build does not read`)}}function Wm(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=pm&&e<=mm&&Number.isInteger(Math.log2(e))}function Gm(e){if(!Km(e))throw Error(`Invalid IndexedDB B-tree page id: ${e}`)}function Km(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}var qm=new WeakMap,Jm=256,Ym=5e3,Xm=1,Zm={TRACE:1,DEBUG:5,INFO:9,WARN:13,ERROR:17};function Qm(e,t){let n=e.trim().replace(/\/+$/,``),r=`/v1/${t}`;return n.endsWith(`/v1/logs`)?`${n.slice(0,-8)}${r}`:n.endsWith(`/v1/traces`)?`${n.slice(0,-10)}${r}`:`${n}${r}`}function $m(e){if(!e.collectorUrl)return()=>{};let t={traceUrl:Qm(e.collectorUrl,`traces`),logUrl:Qm(e.collectorUrl,`logs`)},{runtimeThread:n,wasmModule:r}=e;if(!rh(r))return console.warn(`[jazz] WASM telemetry unavailable: trace entry hooks are missing.`),()=>{};let i=qm.get(r);if(i){if(i.closing)throw Error(`WASM telemetry collector is closing`);if(i.runtimeThread!==n)throw Error(`incompatible WASM telemetry runtime thread`);if(i.identity.traceUrl!==t.traceUrl||i.identity.logUrl!==t.logUrl)throw Error(`incompatible WASM telemetry collector`);return eh(r,i)}i={identity:t,runtimeThread:n,leases:new Set,nextLeaseId:0,closing:!1,unsubscribe:null,exporter:null,exportTail:Promise.resolve(),shutdownScheduled:!1,drainMicrotaskPending:!1},qm.set(r,i);let a=()=>{let e=r.drainTraceEntries();!Array.isArray(e)||e.length===0||th(i,e)},o=()=>{i.closing||i.drainMicrotaskPending||(i.drainMicrotaskPending=!0,queueMicrotask(()=>{i.drainMicrotaskPending=!1,!i.closing&&a()}))},s=!1;try{return i.unsubscribe=r.subscribeTraceEntries(o),s=!0,r.setTraceEntryCollectionEnabled(!0),eh(r,i)}catch(e){if(s)try{r.setTraceEntryCollectionEnabled(!1)}catch{}try{i.unsubscribe?.()}catch{}throw i.unsubscribe=null,qm.get(r)===i&&qm.delete(r),e}}function eh(e,t){let n=t.nextLeaseId++;t.leases.add(n);let r=!1;return()=>{if(r||(r=!0,t.leases.delete(n),t.leases.size>0||t.closing))return;t.closing=!0;let i;try{t.unsubscribe?.()}catch(e){i=e}finally{try{let n=e.drainTraceEntries();Array.isArray(n)&&n.length>0&&th(t,n)}catch(e){i??=e}finally{try{e.setTraceEntryCollectionEnabled(!1)}catch(e){i??=e}finally{t.unsubscribe=null,nh(t),!i&&qm.get(e)===t&&qm.delete(e)}}}if(i)throw i}}function th(e,t){e.exportTail=e.exportTail.catch(()=>{}).then(async()=>{e.exporter||=ah(e.identity.traceUrl,e.identity.logUrl);try{let n=await e.exporter;for(let r of t)try{ih(n,e.runtimeThread,r)}catch(e){console.warn(`[jazz] WASM telemetry export failed:`,e)}}catch(t){e.exporter=null,console.warn(`[jazz] WASM telemetry export failed:`,t)}})}function nh(e){e.shutdownScheduled||(e.shutdownScheduled=!0,e.exportTail.catch(()=>{}).then(async()=>{try{await(e.exporter?await e.exporter:void 0)?.shutdown()}catch(e){console.warn(`[jazz] WASM telemetry shutdown failed:`,e)}}))}function rh(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.subscribeTraceEntries==`function`&&typeof t.drainTraceEntries==`function`&&typeof t.setTraceEntryCollectionEnabled==`function`}function ih(e,t,n){if(n.kind===`span`){let r={"jazz.runtime_thread":t,"jazz.span.sequence":n.sequence,"jazz.span.level":n.level,"jazz.span.target":n.target,"jazz.span.fields":lh(n.fields)};e.tracer.startSpan(n.name||`wasm span`,{kind:Xm,startTime:n.startUnixNano,attributes:ch(n.fields)?{...oh(n.fields),...r}:r}).end(n.endUnixNano);return}if(n.kind===`log`){let r={"jazz.runtime_thread":t,"jazz.log.sequence":n.sequence,"jazz.log.target":n.target,"jazz.log.fields":lh(n.fields)};e.logger.emit({timestamp:n.timestampUnixNano,severityNumber:sh(n.level),severityText:n.level,body:n.message,attributes:ch(n.fields)?{...oh(n.fields),...r}:r});return}e.logger.emit({severityNumber:Zm.WARN,severityText:`WARN`,body:`Dropped ${n.count} WASM telemetry records`,attributes:{"jazz.runtime_thread":t,"jazz.telemetry.dropped_count":n.count}})}async function ah(e,t){let[{OTLPTraceExporter:n},{BasicTracerProvider:r,BatchSpanProcessor:i},{OTLPLogExporter:a},{LoggerProvider:o,BatchLogRecordProcessor:s},{resourceFromAttributes:c}]=await Promise.all([Promise.resolve().then(()=>(xs(),bs)),Promise.resolve().then(()=>(Pc(),Nc)),Promise.resolve().then(()=>(zc(),Rc)),Promise.resolve().then(()=>(Al(),kl)),Promise.resolve().then(()=>(Qa(),Za))]),l=c({"service.name":`jazz-browser`,"telemetry.sdk.language":`webjs`}),u={maxExportBatchSize:Jm,maxQueueSize:Ym,scheduledDelayMillis:1e3},d=new r({resource:l,spanProcessors:[new i(new n({url:e}),u)]}),f=new o({resource:l,processors:[new s(new a({url:t}),u)]});return{tracer:d.getTracer(`jazz-wasm.tracing`),logger:f.getLogger(`jazz-wasm.tracing`),shutdown:async()=>{await Promise.all([typeof d.shutdown==`function`?d.shutdown():void 0,typeof f.shutdown==`function`?f.shutdown():void 0])}}}function oh(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e))n.startsWith(`jazz.`)||r!=null&&(typeof r==`string`||typeof r==`number`||typeof r==`boolean`?t[n]=r:t[n]=JSON.stringify(r));return t}function sh(e){switch(e.toUpperCase()){case`TRACE`:return Zm.TRACE;case`DEBUG`:return Zm.DEBUG;case`INFO`:return Zm.INFO;case`WARN`:case`WARNING`:return Zm.WARN;case`ERROR`:return Zm.ERROR;default:return 0}}function ch(e){if(!e)return!1;for(let t in e)return!0;return!1}function lh(e){return ch(e)?JSON.stringify(e):`{}`}var uh=class{constructor(e,t){this.transport=e,this.onError=t}timer;deadline;closed=!1;refresh(){if(!this.closed)try{let e=this.transport.auxiliaryReceiveTimeoutMs?.();if(e==null){this.clear();return}if(!Number.isFinite(e)||e<0||!this.transport.expireAuxiliaryReceive)throw Error(`Invalid auxiliary receive deadline capability`);let t=performance.now()+e;if(this.deadline!==void 0&&this.deadline<=t)return;this.clear(),this.deadline=t,this.timer=setTimeout(()=>{if(this.timer=void 0,this.deadline=void 0,!this.closed)try{this.transport.expireAuxiliaryReceive(),this.refresh()}catch(e){this.fail(e)}},e)}catch(e){this.fail(e)}}close(){this.closed=!0,this.clear()}clear(){this.timer!==void 0&&clearTimeout(this.timer),this.timer=void 0,this.deadline=void 0}fail(e){this.close(),this.onError(e)}},dh=8,fh=1024*1024,ph=class{constructor(e,t,n,r,i){this.runtime=e,this.transport=t,this.sendFrames=n,this.onError=r,this.onAuxiliaryTrace=i,this.receiveDeadline=new uh(t,e=>{this.close(),this.onError(e)}),this.removeWorkListener=e.onPeerTransportWork(this.handleRuntimeWork);try{this.transport.setAuxiliaryTraceEnabled?.(i!==void 0),this.transport.setOutboundScheduler?.(()=>this.scheduleOutboundDrain())}catch(e){this.closed=!0;try{this.removeWorkListener()}finally{try{this.transport.clearOutboundScheduler?.()}finally{this.transport.setAuxiliaryTraceEnabled?.(!1)}}throw e}this.watchAuxiliaryOutbound().catch(e=>{this.closed||this.onError(e)}),this.schedule(!0)}receiveDeadline;scheduled=!1;running=!1;runAgain=!1;closed=!1;outboundDrainScheduled=!1;inboundRouting=Promise.resolve();requestedGeneration=0;completedGeneration=0;flushWaiters=new Set;removeWorkListener;handleRuntimeWork=e=>this.schedule(e??!1);receive(e){this.closed||e.length===0||(this.inboundRouting=this.inboundRouting.then(()=>this.routeInboundFrames(e)).catch(e=>{this.closed||this.onError(e)}))}schedule(e=!0){if(!this.closed){if(this.requestedGeneration+=1,this.running){this.runAgain||=e;return}this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.pump().catch(e=>{this.closed||this.onError(e)})}))}}close(){if(!this.closed){this.closed=!0,this.receiveDeadline.close(),this.removeWorkListener(),this.transport.clearOutboundScheduler?.(),this.transport.setAuxiliaryTraceEnabled?.(!1),this.runtime.retirePeerTransport(this.transport).catch(this.onError);for(let e of this.flushWaiters)e.resolve();this.flushWaiters.clear()}}async flush(){if(this.closed)return;this.schedule();let e=this.requestedGeneration;this.completedGeneration>=e||await new Promise(t=>this.flushWaiters.add({target:e,resolve:t}))}drainOutboundFrames(){if(this.closed)return!1;let e=hh(this.transport.recvWireFrames());e.length>0&&this.sendFrames(e);let t=this.transport.recvAuxiliaryWireFrames;if(!t)return!1;let n=hh(t.call(this.transport,dh,fh));return n.length>0&&this.sendFrames(n),this.publishAuxiliaryTrace(),n.length>0}scheduleOutboundDrain(){this.closed||this.outboundDrainScheduled||(this.outboundDrainScheduled=!0,queueMicrotask(()=>{this.outboundDrainScheduled=!1,this.closed||this.drainOutboundFrames()}))}async pump(){if(this.closed||this.running)return;this.running=!0;let e=this.requestedGeneration;try{if(this.drainOutboundFrames(),await this.runtime.progressPeerTransport(),this.closed)return;this.drainOutboundFrames()}finally{this.running=!1,this.completedGeneration=Math.max(this.completedGeneration,e);for(let e of this.flushWaiters)e.target>this.completedGeneration||(this.flushWaiters.delete(e),e.resolve())}this.closed||this.runAgain&&(this.runAgain=!1,this.schedule())}async routeInboundFrames(e){if(this.closed)return;let t=[];for(let n of e){let e=this.transport.routeAuxiliaryWireFrame?await this.transport.routeAuxiliaryWireFrame(n):n;if(this.receiveDeadline.refresh(),this.closed)return;e!=null&&t.push(gh(e))}if(!this.closed){if(t.length>0)if(this.transport.sendWireFrames)this.transport.sendWireFrames(t);else for(let e of t)this.transport.sendWireFrame(e);this.runtime.notifyPeerTransportActivity?.(),this.publishAuxiliaryTrace(),this.schedule()}}publishAuxiliaryTrace(){if(!this.onAuxiliaryTrace)return;let e=this.transport.takeAuxiliaryTrace?.();!e||e.length===0||this.onAuxiliaryTrace(e)}async watchAuxiliaryOutbound(){for(;!this.closed;){let e=this.transport.auxiliaryOutboundReady?.();if(!e||typeof e==`boolean`||(await e,this.closed))return;this.drainOutboundFrames()&&await _h()}}};function mh(e){return e.map(e=>e.slice())}function hh(e){return e.map(gh)}function gh(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Browser worker transport received a non-binary wire frame`)}function _h(){return new Promise(e=>setTimeout(e,0))}var vh=`this account's store is open under another sign-in in another tab`,yh=32,bh=64*1024,xh=128,Sh=64,Ch=128,wh=256,Th=8*1024,Eh=16*1024,Dh=2*1024;function J(e){let t={remaining:bh},n=Oh(e,t),r=e,i=n,a=new WeakSet;for(let e=0;e<yh;e+=1){if(r&&typeof r==`object`){if(a.has(r))break;a.add(r)}let n=Nh(r,`cause`);if(n===void 0)break;if(!kh(n)){let e=Lh(n,t);e!==void 0&&(i.cause=e);break}if(e+1>yh||t.remaining===0||a.has(n))break;let o=Oh(n,t);i.cause=o,i=o,r=n}return n}function Oh(e,t){let n=Ph(e,`stack`),r=Ah(Nh(e,`code`)),i={name:Ih(Ph(e,`name`)??`Error`,wh,t),message:Ih(Ph(e,`message`)??Fh(e),Th,t),...n===void 0?{}:{stack:Ih(n,Eh,t)}};if(r!==void 0&&r.length<=t.remaining&&(i.code=Ih(r,xh,t)),i.code===qp){let n=jh(Nh(e,`missing`)),r=jh(Nh(e,`unknown`));n!==void 0&&r!==void 0&&Mh(n)+Mh(r)<=t.remaining&&(t.remaining-=Mh(n)+Mh(r),i.missing=[...n],i.unknown=[...r])}return i}function kh(e){return typeof e==`object`&&!!e&&typeof Nh(e,`message`)==`string`}function Ah(e){return typeof e==`string`&&e.length>0&&e.length<=xh?e:void 0}function jh(e){return Array.isArray(e)&&e.length<=Sh&&e.every(e=>typeof e==`string`&&e.length>0&&e.length<=Ch)?e:void 0}function Mh(e){return e.reduce((e,t)=>e+t.length,0)}function Nh(e,t){if(!(e===null||typeof e!=`object`&&typeof e!=`function`))try{return e[t]}catch{return}}function Ph(e,t){let n=Nh(e,t);return typeof n==`string`?n:void 0}function Fh(e){try{return String(e)}catch{return`Unstringifiable relay error`}}function Ih(e,t,n){let r=Math.min(e.length,t,n.remaining);return n.remaining-=r,e.slice(0,r)}function Lh(e,t){if(e===null||typeof e==`boolean`||typeof e==`number`)return e;if(typeof e==`string`)return Ih(e,Dh,t);if(e!==void 0)return Ih(`[non-error relay cause omitted]`,Dh,t)}var Rh=-(1n<<63n),zh=(1n<<63n)-1n;function Bh(e,t){if(typeof e==`number`&&!Number.isSafeInteger(e))throw Error(`${t} must be a safe integer when passed as a number, got ${e}`);let n=BigInt(e);if(n<Rh||n>zh)throw Error(`${t} must be a signed 64-bit integer`);return n}var Vh=new Vl({fatal:!0});function Hh(e){if(e.kind!==`hidden-metadata`)return e.kind===`stored-column`?e.outputName:e.name}function Uh(e){return{table:e.string(),descriptor:Gh(e),rows:e.readVec(e=>({rowId:e.bytes(),deleted:e.bool(),raw:e.bytes()}))}}function Wh(e,t){e.vec((e,n)=>{let r=t[n];e.u64(r.kind===`stored-column`?0:r.kind===`result-field`?1:2),r.kind===`stored-column`?(e.u64(r.id),e.string(r.outputName)):e.string(r.name),tg(e,r.valueType)},t.length)}function Gh(e){return e.readVec(e=>{let t=e.u64();return t===0?{kind:`stored-column`,id:e.u64(),outputName:e.string(),valueType:ng(e)}:t===1?{kind:`result-field`,name:e.string(),valueType:ng(e)}:t===2?{kind:`hidden-metadata`,name:e.string(),valueType:ng(e)}:Kh(t)})}function Kh(e){throw Error(`unknown native row descriptor field kind ${e}`)}function qh(e){let t={added:e.readVec(Uh),updated:e.readVec(Uh),removed:e.readVec(Qh),addedOccurrenceKeys:e.readVec(e=>Jh(e)),updatedOccurrenceKeys:e.readVec(e=>Jh(e)),removedOccurrenceKeys:e.readVec(e=>Jh(e)),addedIndices:e.readVec(e=>e.u64()),updatedPreviousIndices:e.readVec(e=>e.u64()),updatedIndices:e.readVec(e=>e.u64()),removedIndices:e.readVec(e=>e.u64()),updatedSplices:e.readVec(e=>e.readVec(e=>({column:e.string(),splices:e.readVec(e=>({at:e.u64(),delete:e.u64(),insert:e.bytes(),atUtf16:e.u64(),deleteUtf16:e.u64()}))})))},n=e=>e.reduce((e,t)=>e+t.rows.length,0);if(t.addedOccurrenceKeys.length!==n(t.added)||t.updatedOccurrenceKeys.length!==n(t.updated)||t.removedOccurrenceKeys.length!==t.removed.length||t.addedIndices.length!==n(t.added)||t.updatedPreviousIndices.length!==n(t.updated)||t.updatedIndices.length!==n(t.updated)||t.removedIndices.length!==t.removed.length||t.updatedSplices.length!==n(t.updated))throw Error(`subscription occurrence sidecar length mismatch`);return Zh(e,`subscription delta`),t}function Jh(e){let t=e.bytes();if(t[0]!==2||!Yh(t.subarray(1)))throw Error(`malformed ResultKey`);return t}function Yh(e){let t=t=>(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0;if(e.length<25)return!1;let n=16,r=t(n);if(n+=4,r>256||n+r*16+4>e.length)return!1;n+=r*16;let i=t(n);if(n+=4,i>r+1)return!1;let a=-1;for(let o=0;o<i;o++){if(n+8>e.length)return!1;let i=t(n),o=t(n+4);if(n+=8,i>r||i<=a||o===0||o>4096||n+o>e.length||!Kl(e.subarray(n,n+o)))return!1;a=i,n+=o}for(let t=0;t<=r;t++){let t=e[n++];if(t===1)n+=24;else if(t!==0)return!1}return n===e.length}function Xh(e){let t=e.u64(),n=e.readVec(Uh);return Zh(e,`relation snapshot`),{rootCount:t,rows:n}}function Zh(e,t){if(!e.done())throw Error(`${t} has trailing postcard bytes`)}function Qh(e){return{table:e.string(),rowId:e.bytes()}}function $h(e,t){e.vec((e,n)=>{e.some(e=>e.string(t[n].name??``)),tg(e,t[n].valueType)},t.length)}function eg(e){return e.readVec(e=>({name:e.option(e=>e.string()),valueType:ng(e)}))}function tg(e,t){if(e.enumUnit(t.tag),t.tag===10){if(!t.internal)throw Error(`missing physical type for ValueType::Internal`);if(e.enumUnit(t.internal.tag),t.internal.tag===2){if(t.internal.kind==null)throw Error(`missing stored-scalar kind`);e.enumUnit(t.internal.kind)}return}if(t.tag===12){let n=t.enumSchema,r=n?.variants;if(!n||!r)throw Error(`missing enum schema for ValueType::Enum`);e.u64(n.registryId??0),e.string(n.name),e.vec((e,t)=>e.string(r[t]),r.length);return}if(t.tag===13){let n=t.members??(t.inner?[t.inner]:[]);e.vec((e,t)=>tg(e,n[t]),n.length);return}if(t.tag===14||t.tag===15){if(!t.inner)throw Error(`missing inner value type for tag ${t.tag}`);tg(e,t.inner);return}if(t.tag===16){if(!t.record)throw Error(`missing inline record descriptor for tag 16`);$h(e,t.record);return}if(t.tag===17){let n=t.enumSchema,r=n?.cases;if(!n||!r)throw Error(`missing cases for ValueType::Enum`);e.u64(n.registryId??0),e.string(n.name),e.vec((e,t)=>{let n=r[t];e.string(n.name),$h(e,n.payload)},r.length)}}function ng(e){let t=e.u64();if(t===10){let n=e.u64();return{tag:t,internal:{tag:n,kind:n===2?e.u64():void 0}}}if(t===12)return{tag:t,enumSchema:{registryId:e.u64(),name:e.string(),variants:e.readVec(e=>e.string())}};if(t===14||t===15)return{tag:t,inner:ng(e)};if(t===13){let n=e.readVec(ng);return{tag:t,members:n,inner:n[0]}}return t===16?{tag:t,record:eg(e)}:t===17?{tag:t,enumSchema:{registryId:e.u64(),name:e.string(),cases:e.readVec(e=>({name:e.string(),payload:eg(e)}))}}:{tag:t}}function rg(e,t){let n=zg(e),r=n.fixed.map(e=>t[e.logicalIndex]),i=n.variable.map(e=>t[e.logicalIndex]),a=Wl(r),o=new Ug,s=a.length+Math.max(0,i.length-1)*4;for(let e of i.slice(0,-1))s+=e.length,o.u32Le(s);return Wl([a,o.finish(),...i])}function ig(e,t){let n=pg(yg(e));return e.map((e,r)=>{let i=n(t,r);return i==null?{type:`Null`}:jg(e.column_type,i)})}function ag(e,t){return Object.defineProperty(e,`valuesByColumn`,{value:t,enumerable:!1,configurable:!0}),e}function og(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r];i&&n.set(i.name,t[r])}return n}var sg={name:`__jazz_terminal_row_key`,column_type:{type:`Uuid`},nullable:!1};function cg(e,t,n){let r=lg([sg,...t],n),i=r[0];if(i?.type!==`Uuid`||i.value!==e)throw Error(`terminal record key ${i?.type===`Uuid`?i.value:`<non-uuid>`} does not match addressed key ${e}`);let a=r.slice(1);return ag({id:e,values:a},og(t,a))}function lg(e,t){let n=pg(yg(e));return e.map((e,r)=>{let i=n(t,r);return i==null?{type:`Null`}:ug(e.column_type,i,e.name)})}function ug(e,t,n){switch(e.type){case`Timestamp`:return{type:`Timestamp`,value:Ig(t,n)};case`Array`:return{type:`Array`,value:dg(e.element,t)};case`Row`:if(t.byteLength<16)throw Error(`terminal nested row is missing its physical key`);return{type:`Row`,value:cg(Lg(t.subarray(0,16)),e.columns,t)};default:return jg(e,t)}}function dg(e,t){return Fg(e,t,t=>ug(e,t))}function fg(e,t){return rg(yg(e),e.map((e,n)=>bg(e,t[n])))}function pg(e){let t=zg(e);return(n,r)=>mg(e,t,n,r)}function mg(e,t,n,r){let i=t.fields[r];if(!i)throw Error(`field is not present`);let a=e[r].valueType;if(i.kind===`fixed`){if(i.offset+i.size>n.length)throw Error(`unexpected end of record`);return hg(n.subarray(i.offset,i.offset+i.size),a)}let o=t.fixedSize,s=t.fixedSize+Math.max(0,t.variable.length-1)*4,c=i.variableIndex===0?s:Bg(n,o+(i.variableIndex-1)*4),l=i.variableIndex===t.variable.length-1?n.length:Bg(n,o+i.variableIndex*4);if(c>l||l>n.length){let t=e[r],i=l-c,o=Math.max(0,n.length-c);throw Error(`invalid offset for ${t?.name??`<field ${r}>`}: declared type ${gg(a)}, tag ${a.tag}, claimed width ${i}, remaining buffer ${o}, current offset ${c}, end offset ${l}, record length ${n.length}`)}return hg(n.subarray(c,l),a)}function hg(e,t){if(t.tag!==15)return e;let n=vg(e);return n==null?null:t.inner?hg(n,t.inner):n}function gg(e){return e.tag===14||e.tag===15?`${e.tag===14?`Array`:`Nullable`}<${e.inner?gg(e.inner):`?`}>`:_g(e.tag)}function _g(e){switch(e){case 0:return`U8`;case 1:return`U16`;case 2:return`U32`;case 3:return`U64`;case 4:return`I32`;case 5:return`I64`;case 6:return`F64`;case 7:return`Bool`;case 8:return`String`;case 9:return`Bytes`;case 10:return`Internal`;case 11:return`Uuid`;case 12:return`EnumTag`;case 13:return`Tuple`;case 14:return`Array`;case 15:return`Nullable`;case 16:return`Record`;case 17:return`Enum`;default:return`unknown(${e})`}}function vg(e){return e[0]===0?null:e[0]===1?e.subarray(1):e}function yg(e){return e.map(e=>({name:e.name,valueType:Og(e)}))}function bg(e,t){let n=Ag(e.column_type),r=e.nullable?{tag:15,inner:n}:n;if(!t){if(e.sparse)return Sg({tag:15,inner:r});if(!e.nullable)throw Error(`missing non-nullable value for ${e.name}`);return Sg(r)}if(t.type===`Null`){if(!e.nullable)throw Error(`missing non-nullable value for ${e.name}`);let t=Sg(r);return e.sparse?xg(t,r):t}let i=Cg(e.column_type,t);return e.nullable&&(i=xg(i,n)),e.sparse?xg(i,r):i}function xg(e,t){if(Rg(t)==null)return Wl([Uint8Array.of(1),e]);let n=new Uint8Array(1+e.length);return n[0]=1,n.set(e,1),n}function Sg(e){let t=Rg(e);return t==null?Uint8Array.of(0):new Uint8Array(t)}function Cg(e,t){switch(e.type){case`Boolean`:if(t.type!==`Boolean`)throw Error(`expected Boolean value`);return Uint8Array.of(t.value?1:0);case`Integer`:{let e=Vg(t),n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),n}case`Timestamp`:{if(t.type!==`Timestamp`||!Number.isSafeInteger(t.value))throw Error(`expected ${e.type} value`);if(t.value<0)throw Error(`Timestamp value must be a non-negative safe integer (dates before 1970 are not supported), got ${t.value}`);let n=new Uint8Array(8);return new DataView(n.buffer).setBigUint64(0,BigInt(t.value),!0),n}case`BigInt`:{let e=Hg(t),n=new Uint8Array(8);return new DataView(n.buffer).setBigInt64(0,e,!0),n}case`Double`:{if(t.type!==`Double`)throw Error(`expected Double value`);let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t.value,!0),e}case`Text`:case`Json`:case`Enum`:if(t.type!==`Text`)throw Error(`expected ${e.type} value`);return Wl([Uint8Array.of(0),new TextEncoder().encode(t.value)]);case`Uuid`:if(t.type!==`Uuid`)throw Error(`expected Uuid value`);return Dg(t.value);case`Bytea`:if(t.type!==`Bytea`)throw Error(`expected Bytea value`);return Wl([Uint8Array.of(0),t.value]);case`Array`:if(t.type!==`Array`)throw Error(`expected Array value`);return Tg(e.element,t.value);case`Row`:if(t.type!==`Row`)throw Error(`expected Row value`);return wg(e.columns,t.value)}}function wg(e,t){let n=fg(e,t.valuesByColumn?e.map(e=>t.valuesByColumn?.get(e.name)??(e.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`})):t.values),r=t.id?Dg(t.id):new Uint8Array;return Wl([Uint8Array.of(t.id?1:0),r,Eg(n.byteLength),n])}function Tg(e,t){let n=t.map(t=>Cg(e,t));if(Rg(Ag(e))!=null)return Wl(n);let r=new Uint8Array(Math.max(0,t.length-1)*4),i=new DataView(r.buffer),a=4+r.byteLength;return n.slice(0,-1).forEach((e,t)=>{a+=e.length,i.setUint32(t*4,a,!0)}),Wl([Eg(t.length),r,...n])}function Eg(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t}function Dg(e){let t=Mu(e);if(!t)throw Error(`invalid UUID value ${e}`);return t}function Og(e){let t=Ag(e.column_type);return e.nullable&&(t={tag:15,inner:t}),e.sparse?{tag:15,inner:t}:t}function kg(e){return e.map(e=>({...e,sparse:void 0,column_type:e.column_type.type===`Row`?{...e.column_type,columns:[...kg(e.column_type.columns)]}:e.column_type.type===`Array`&&e.column_type.element.type===`Row`?{...e.column_type,element:{...e.column_type.element,columns:[...kg(e.column_type.element.columns)]}}:e.column_type}))}function Ag(e){switch(e.type){case`Boolean`:return{tag:7};case`Integer`:return{tag:4};case`BigInt`:return{tag:5};case`Timestamp`:return{tag:3};case`Double`:return{tag:6};case`Text`:case`Json`:case`Enum`:return{tag:8};case`Bytea`:return{tag:9};case`Uuid`:return{tag:11};case`Array`:return{tag:14,inner:Ag(e.element)};case`Row`:return{tag:9}}}function jg(e,t){let n=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(e.type){case`Boolean`:return{type:`Boolean`,value:t[0]!==0};case`Integer`:return{type:`Integer`,value:n.getInt32(0,!0)};case`BigInt`:return{type:`BigInt`,value:n.getBigInt64(0,!0)};case`Double`:return{type:`Double`,value:n.getFloat64(0,!0)};case`Timestamp`:return{type:`Timestamp`,value:Number(n.getBigUint64(0,!0))};case`Text`:case`Json`:case`Enum`:return{type:`Text`,value:Vh.decode(Mg(t))};case`Uuid`:return{type:`Uuid`,value:Lg(t)};case`Bytea`:return{type:`Bytea`,value:Mg(t).slice()};case`Array`:return{type:`Array`,value:Pg(e.element,t)};case`Row`:return{type:`Row`,value:Ng(e.columns,t)}}}function Mg(e){if(e[0]!==0)throw Error(`indirect scalar crossed a logical binding boundary`);return e.subarray(1)}function Ng(e,t){if(t.byteLength<5)throw Error(`invalid nested row value`);let n=t[0]===1,r=1,i;n&&(i=Lg(t.subarray(r,r+16)),r+=16);let a=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(r,!0);r+=4;let o=t.subarray(r,r+a);if(o.byteLength!==a)throw Error(`invalid nested row value length`);let s=ig(e,o);return ag({id:i,values:s},og(e,s))}function Pg(e,t){return Fg(e,t,t=>jg(e,t))}function Fg(e,t,n){let r=Rg(Ag(e));if(r!=null){if(r===0)return[];if(t.length%r!==0)throw Error(`invalid fixed-width array byte length ${t.length}`);let e=[];for(let i=0;i<t.length;i+=r)e.push(n(t.subarray(i,i+r)));return e}if(t.length<4)throw Error(`invalid variable-width array byte length`);let i=Bg(t,0),a=4+Math.max(0,i-1)*4;if(a>t.length)throw Error(`invalid variable-width array offset table`);let o=[];for(let e=0;e<i;e+=1){let r=e===0?a:Bg(t,4+(e-1)*4),s=e===i-1?t.length:Bg(t,4+e*4);if(r>s||s>t.length)throw Error(`invalid variable-width array element offset`);o.push(n(t.subarray(r,s)))}return o}function Ig(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength).getBigUint64(0,!0);return Number(n)}function Lg(e){if(e.length>=16)return ku(e,0);let t=Ou(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Rg(e){switch(e.tag){case 0:case 7:case 12:return 1;case 1:return 2;case 2:case 4:return 4;case 3:case 5:case 6:return 8;case 11:return 16;case 13:return(e.members??(e.inner?[e.inner]:[])).reduce((e,t)=>{if(e==null)return;let n=Rg(t);return n==null?void 0:e+n},0);case 10:case 14:return;case 15:{let t=e.inner?Rg(e.inner):void 0;return t==null?void 0:t+1}default:return}}function zg(e){let t=[];t.length=e.length;let n=[],r=[],i=0;for(let r=0;r<e.length;r+=1){let a=Rg(e[r].valueType);if(a==null)continue;let o={kind:`fixed`,logicalIndex:r,offset:i,size:a};t[r]=o,n.push(o),i+=a}for(let n=0;n<e.length;n+=1){if(Rg(e[n].valueType)!=null)continue;let i={kind:`variable`,logicalIndex:n,variableIndex:r.length};t[n]=i,r.push(i)}return{fields:t,fixed:n,variable:r,fixedSize:i}}function Bg(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Vg(e){if(e.type!==`Integer`||!Number.isSafeInteger(e.value)||e.value<-2147483648||e.value>2147483647)throw Error(`Integer value must be a signed 32-bit integer`);return e.value}function Hg(e){if(e.type!==`BigInt`)throw Error(`expected BigInt value`);return Bh(e.value,`BigInt value`)}var Ug=class{#e=[];u32Le(e){if(!Number.isInteger(e)||e<0||e>4294967295)throw Error(`offset must be an unsigned 32-bit integer, got ${e}`);this.#e.push(e&255,e>>>8&255,e>>>16&255,e>>>24&255)}finish(){return new Uint8Array(this.#e)}},Wg=class{constructor(e){this.text=e}};function Gg(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){if(++t>=e.length||e.charCodeAt(t)<56320||e.charCodeAt(t)>57343)throw Error(`invalid relation query: unpaired surrogate`)}else if(n>=56320&&n<=57343)throw Error(`invalid relation query: unpaired surrogate`)}}function Kg(e){let t=JSON.parse(e),n=(e,t)=>typeof e==`string`?(Gg(e),e.includes(t)):Array.isArray(e)?e.some(e=>n(e,t)):e&&typeof e==`object`?Object.entries(e).some(([e,r])=>(Gg(e),e.includes(t)||n(r,t))):!1,r=`__jrq_raw_number_`;for(;e.includes(r)||n(t,r);)r=`_${r}`;let i=[],a=``,o=!1,s=!1;for(let t=0;t<e.length;t++){let n=e[t];if(o){a+=n,s?s=!1:n===`\\`?s=!0:n===`"`&&(o=!1);continue}if(n===`"`){o=!0,a+=n;continue}if(n===`-`||n>=`0`&&n<=`9`){let n=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(t));if(n){i.push(n[0]),a+=JSON.stringify(`${r}${i.length-1}__`),t+=n[0].length-1;continue}}a+=n}let c=e=>{if(typeof e==`string`){let t=RegExp(`^${r}(\\d+)__$`).exec(e);return t?new Wg(i[Number(t[1])]):e}return Array.isArray(e)?e.map(c):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,c(t)])):e};return c(JSON.parse(a))}function qg(e){let t=[],n=0,r=0,i=new TextEncoder,a=e=>{throw Error(`invalid relation Postcard: ${e}`)},o=(...e)=>{e.some(e=>!Number.isInteger(e)||e<0||e>255)&&a(`byte`),t.length>1048576-e.length&&a(`byte limit`),t.push(...e)},s=e=>{(!Number.isSafeInteger(e)||e<0||e>4096)&&a(`collection`),u(e)},c=()=>{++r>4096&&a(`node limit`)},l=e=>{++n>128&&a(`depth limit`);try{e()}finally{n--}},u=e=>{let t=typeof e==`bigint`?e:BigInt(e);(t<0n||t>18446744073709551615n)&&a(`integer range`);do{let e=Number(t&127n);t>>=7n,t&&(e|=128),o(e)}while(t)},d=e=>u(e<0n?(-e<<1n)-1n:e<<1n),f=e=>{typeof e!=`string`&&a(`string`),Gg(e);let t=i.encode(e);t.length>65536&&a(`string limit`),u(t.length),o(...t)},p=(e,t)=>{e==null?o(0):(o(1),t())},m=(e,t,n)=>{let r=Object.keys(e);(r.length!==1||!t.includes(r[0]))&&a(n)},h=(e,t,n)=>{Object.keys(e).some(e=>!t.includes(e))&&a(n)},g=e=>{e instanceof Wg&&(/^(?:0|[1-9]\d*)$/.test(e.text)||a(`dimension`),e=Number(e.text));let t=typeof e==`number`?e:a(`dimension`);(!Number.isSafeInteger(t)||t<0||t>4294967295)&&a(`dimension`),u(t)},_=e=>{(!e||typeof e!=`object`)&&a(`column`),h(e,[`scope`,`column`],`column`),(typeof e.column!=`string`||e.scope!==void 0&&typeof e.scope!=`string`)&&a(`column`),p(e.scope,()=>f(e.scope)),f(e.column)},ee=e=>u(e===`Current`?0:e===`Outer`?1:e===`Frontier`?2:a(`row id`)),v=e=>{if(c(),e instanceof Wg){if(/^(?:0|[1-9]\d*|-[1-9]\d*)$/.test(e.text)){let t=BigInt(e.text);if(t>=-9223372036854775808n&&t<=9223372036854775807n){u(2),d(t);return}if(t>=0n&&t<=18446744073709551615n){u(3),u(t);return}}let t=Number(e.text);Number.isFinite(t)||a(`number`),u(4);let n=new DataView(new ArrayBuffer(8));n.setFloat64(0,t,!0),u(n.getBigUint64(0,!0));return}if(e===null){u(0);return}if(typeof e==`boolean`){u(1),o(e?1:0);return}if(typeof e==`number`){if(Number.isFinite(e)||a(`number`),Number.isInteger(e)&&!Object.is(e,-0)){let t=JSON.stringify(e);if(/^(?:0|[1-9]\d*|-[1-9]\d*)$/.test(t)){let e=BigInt(t);if(e>=-9223372036854775808n&&e<=9223372036854775807n){u(2),d(e);return}if(e>=0n&&e<=18446744073709551615n){u(3),u(e);return}}}u(4);let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e,!0),u(t.getBigUint64(0,!0));return}if(typeof e==`string`){u(5),f(e);return}if(Array.isArray(e)){u(6),s(e.length),e.forEach(e=>l(()=>v(e)));return}(!e||typeof e!=`object`)&&a(`literal`),u(7);let t=Object.entries(e).sort(([e],[t])=>{let n=i.encode(e),r=i.encode(t);for(let e=0;e<Math.min(n.length,r.length);e++)if(n[e]!==r[e])return n[e]-r[e];return n.length-r.length});s(t.length);for(let[e,n]of t)f(e),l(()=>v(n))},y=e=>{c(),m(e,[`Column`,`RowId`],`key`),`Column`in e?(u(0),_(e.Column)):(u(1),ee(e.RowId))},te=e=>{c(),m(e,[`Column`,`RowId`],`project`),`Column`in e?(u(0),_(e.Column)):(u(1),ee(e.RowId))},ne=e=>{c(),m(e,[`Literal`,`Param`,`SessionRef`,`OuterColumn`,`FrontierColumn`,`RowId`],`value`),`Literal`in e?(u(0),v(e.Literal)):`Param`in e?(u(1),f(e.Param)):`SessionRef`in e?(u(2),s(e.SessionRef.length),e.SessionRef.forEach(f)):`OuterColumn`in e?(u(3),_(e.OuterColumn)):`FrontierColumn`in e?(u(4),_(e.FrontierColumn)):(u(5),ee(e.RowId))},re=e=>{if(c(),e===`True`){u(9);return}if(e===`False`){u(10);return}if(m(e,[`Cmp`,`IsNull`,`IsNotNull`,`In`,`Contains`,`And`,`Or`,`Not`],`predicate`),`Cmp`in e){u(0),_(e.Cmp.left);let t=[`Eq`,`Ne`,`Lt`,`Le`,`Gt`,`Ge`].indexOf(e.Cmp.op);t<0&&a(`comparison operator`),u(t),l(()=>ne(e.Cmp.right))}else `IsNull`in e?(u(1),_(e.IsNull.column)):`IsNotNull`in e?(u(2),_(e.IsNotNull.column)):`In`in e?(u(3),_(e.In.left),s(e.In.values.length),e.In.values.forEach(e=>l(()=>ne(e)))):`Contains`in e?(u(4),_(e.Contains.left),l(()=>ne(e.Contains.right))):`And`in e?(u(6),s(e.And.length),e.And.forEach(e=>l(()=>re(e)))):`Or`in e?(u(7),s(e.Or.length),e.Or.forEach(e=>l(()=>re(e)))):(u(8),l(()=>re(e.Not)))},b=e=>{c(),m(e,[`TableScan`,`Filter`,`Union`,`Join`,`Project`,`Gather`,`Distinct`,`OrderBy`,`Offset`,`Limit`],`expression`),`TableScan`in e?(h(e.TableScan,[`table`,`alias`],`table scan`),u(0),f(e.TableScan.table),p(e.TableScan.alias,()=>f(e.TableScan.alias))):`Filter`in e?(u(1),l(()=>b(e.Filter.input)),l(()=>re(e.Filter.predicate))):`Union`in e?(u(2),s(e.Union.inputs.length),e.Union.inputs.forEach(e=>{f(e.label),l(()=>b(e.input))})):`Join`in e?(h(e.Join,[`left`,`right`,`on`,`join_kind`],`join`),u(3),l(()=>b(e.Join.left)),l(()=>b(e.Join.right)),s(e.Join.on.length),e.Join.on.forEach(e=>{c(),_(e.left),_(e.right)}),e.Join.join_kind!==`Inner`&&e.Join.join_kind!==`Left`&&a(`join kind`),u(e.Join.join_kind===`Inner`?0:1)):`Project`in e?(u(4),l(()=>b(e.Project.input)),s(e.Project.columns.length),e.Project.columns.forEach(e=>{f(e.alias),te(e.expr)})):`Gather`in e?(u(5),l(()=>b(e.Gather.seed)),l(()=>b(e.Gather.step)),y(e.Gather.frontier_key),e.Gather.bound===`Fixpoint`?u(0):(u(1),g(e.Gather.bound.MaxDepth)),s(e.Gather.dedupe_key.length),e.Gather.dedupe_key.forEach(y)):`Distinct`in e?(u(6),l(()=>b(e.Distinct.input)),s(e.Distinct.key.length),e.Distinct.key.forEach(y)):`OrderBy`in e?(u(7),l(()=>b(e.OrderBy.input)),s(e.OrderBy.terms.length),e.OrderBy.terms.forEach(e=>{c(),h(e,[`column`,`direction`],`order term`),_(e.column),e.direction!==`Asc`&&e.direction!==`Desc`&&a(`order direction`),u(e.direction===`Asc`?0:1)})):`Offset`in e?(u(8),l(()=>b(e.Offset.input)),g(e.Offset.offset)):(u(9),l(()=>b(e.Limit.input)),g(e.Limit.limit))};return b(e),Uint8Array.from(t)}var Jg=new Vl({fatal:!0}),Yg=new TextEncoder().encode(`["https://jazz.invalid","self-signed-open"]`);function Xg(e,t){return t?Yg:e}function Zg(e,t,n,r=!1,i,a,o,s){let c=new f_;return c.bytes(e),c.string(Qg(Xg(t,a))),n==null?c.none():c.some(e=>e.u64(n)),c.bool(r),i==null?c.none():c.some(e=>e.u64(i)),o==null?c.none():c.some(e=>e.bytes(m_(o))),s==null?c.none():c.some(e=>e.bytes(s)),c.finish()}function Qg(e){try{let t=Jg.decode(e);if(eu(t))return t}catch{}throw Error(`native open config author must be a canonical UTF-8 author identity`)}function $g(e,t,n={}){let{limit:r,offset:i=0,orderBy:a=[],select:o,arraySubqueries:s=[],relation:c,partial:l=[]}=typeof n==`number`?{limit:n}:n;r!=null&&n_(`query limit`,r),n_(`query offset`,i);let u=new f_;return u.string(e),u.vec((e,n)=>{let r=t[n];i_(e,r)},t.length),u.vec(()=>{},0),u.none(),u.vec(()=>{},0),u.vec(()=>{},0),u.vec(()=>{},0),u.vec(()=>{},0),u.vec((e,t)=>{t_(e,s[t])},s.length),o==null?u.none():u.some(e=>{e.vec((e,t)=>{e.string(o[t])},o.length)}),u.vec((e,t)=>{let n=a[t];e.string(n.column),e.u64(n.direction===`Asc`?0:1)},a.length),u.none(),r==null?u.none():u.some(e=>e.u64(r)),u.u64(i),c==null?u.none():u.some(e=>e.bytes(qg(c),!1)),e_(u,l),u.finish()}function e_(e,t){e.vec((e,n)=>{let r=t[n];if(e.string(r.column),r.kind===`json_pointer`){e.u64(3),e.string(r.at);return}n_(`partial selection ${r.column} start`,r.from),n_(`partial selection ${r.column} end`,r.to),e.u64(r.kind===`bytes`?0:r.kind===`text_utf16`?1:2),e.u64(r.from),e.u64(r.to)},t.length)}function t_(e,t){let{filters:n=[],select:r,orderBy:i=[],limit:a=null,offset:o=0,requirement:s=`Optional`,nestedArrays:c=[]}=t;a!=null&&n_(`array subquery ${t.columnName} limit`,a),n_(`array subquery ${t.columnName} offset`,o),e.string(t.columnName),e.string(t.table),e.string(t.innerColumn),e.string(t.outerColumn),e.vec((e,t)=>{i_(e,n[t])},n.length),r==null?e.none():e.some(e=>{e.vec((e,t)=>{e.string(r[t])},r.length)}),e.vec((e,t)=>{let n=i[t];e.string(n.column),e.u64(n.direction===`Asc`?0:1)},i.length),a==null?e.none():e.some(e=>e.u64(a)),e.u64(o),e.u64(r_(s)),e.vec((e,t)=>{t_(e,c[t])},c.length),e_(e,[])}function n_(e,t){if(!Number.isSafeInteger(t)||t<0)throw Error(`${e} must be a non-negative safe integer`)}function r_(e){switch(e){case`Optional`:return 0;case`AtLeastOne`:return 1;case`MatchCorrelationCardinality`:return 2}}function i_(e,t){if(t.op===`All`||t.op===`Any`){e.u64(t.op===`All`?0:1),e.vec((e,n)=>i_(e,t.predicates[n]),t.predicates.length);return}if(t.op===`Not`){e.u64(2),i_(e,t.predicate);return}if(t.op===`In`){e.u64(5),s_(e,t.column),e.vec((e,n)=>{e.u64(3),u_(e,t.values[n])},t.values.length);return}if(t.op===`Contains`){e.u64(10),s_(e,t.column),c_(e,t.value);return}if(t.op===`IsNull`||t.op===`IsNotNull`){t.op===`IsNotNull`&&e.u64(2),e.u64(12),s_(e,t.column);return}if(a_(t)){o_(e,t.column,t.op,t.value);return}throw Error(`unsupported query predicate ${JSON.stringify(t)}`)}function a_(e){return e.op===`Eq`||e.op===`Ne`||e.op===`Gt`||e.op===`Gte`||e.op===`Lt`||e.op===`Lte`}function o_(e,t,n,r){e.u64(l_(n)),s_(e,t),c_(e,r)}function s_(e,t){e.u64(0),e.string(t)}function c_(e,t){e.u64(3),u_(e,t)}function l_(e){switch(e){case`Eq`:return 3;case`Ne`:return 4;case`Gt`:return 6;case`Gte`:return 7;case`Lt`:return 8;case`Lte`:return 9}}function u_(e,t){if(t.type===`U64`){if(t.value<0n||t.value>(1n<<64n)-1n)throw Error(`U64 value must be an unsigned 64-bit integer`);e.u64(3),e.u64(t.value);return}if(t.type===`Nullable`){e.u64(13),t.value==null?e.none():e.some(e=>u_(e,t.value));return}if(t.type===`Boolean`){e.u64(5),e.bool(t.value);return}if(t.type===`Integer`){if(!Number.isSafeInteger(t.value)||t.value<-2147483648||t.value>2147483647)throw Error(`Integer value must be a signed 32-bit integer`);e.u64(15),e.i64(t.value);return}if(t.type===`BigInt`){if(t.value<-(1n<<63n)||t.value>(1n<<63n)-1n)throw Error(`BigInt value must be a signed 64-bit integer`);e.u64(14),e.i64(t.value);return}if(t.type===`Timestamp`){if(!Number.isSafeInteger(t.value)||t.value<0)throw Error(`${t.type} value must be a non-negative safe integer`);e.u64(3),e.u64(t.value);return}if(t.type===`Double`){if(!Number.isFinite(t.value))throw Error(`Double value must be finite`);e.u64(4),e.f64Le(t.value);return}if(t.type===`Uuid`){e.u64(9);let n=Mu(t.value);if(!n)throw Error(`invalid uuid ${t.value}`);e.bytes(n);return}if(t.type===`Bytea`){e.u64(7),e.bytes(t.value);return}if(t.type===`Array`){e.u64(12),e.vec((e,n)=>u_(e,t.value[n]),t.value.length);return}e.u64(6),e.string(t.value)}var d_=64,f_=class{chunks=[];parts=[];partsBytes=0;finish(){if(this.parts.length===0)return Uint8Array.from(this.chunks);this.flushChunks();let e=new Uint8Array(this.partsBytes),t=0;for(let n of this.parts)e.set(n,t),t+=n.byteLength;return e}flushChunks(){this.chunks.length!==0&&(this.pushPart(Uint8Array.from(this.chunks)),this.chunks=[])}pushPart(e){this.parts.push(e),this.partsBytes+=e.byteLength}u64(e){if(typeof e==`bigint`){if(e<0n||e>18446744073709551615n)throw Error(`u64 out of range: ${e}`);this.u64Big(e);return}if(!Number.isSafeInteger(e)||e<0)throw Error(`u64 must be a non-negative safe integer, got ${e}`);let t=e;do{let e=t&127;t=Math.floor(t/128),t!==0&&(e|=128),this.chunks.push(e)}while(t!==0)}i64(e){let t=Bh(e,`i64`),n=t<0n?(-t<<1n)-1n:t<<1n;this.u64Big(n)}u64Big(e){let t=e;do{let e=Number(t&127n);t>>=7n,t!==0n&&(e|=128),this.chunks.push(e)}while(t!==0n)}u32Le(e){if(!Number.isInteger(e)||e<0||e>4294967295)throw Error(`u32Le must be an unsigned 32-bit integer, got ${e}`);this.chunks.push(e&255,e>>>8&255,e>>>16&255,e>>>24&255)}f64Le(e){let t=new Uint8Array(8);new DataView(t.buffer).setFloat64(0,e,!0),this.bytes(t,!1)}bool(e){this.chunks.push(e?1:0)}string(e){this.bytes(h_(e))}bytes(e,t=!0){if(t&&this.u64(e.length),e.length<d_){for(let t of e)this.chunks.push(t);return}this.flushChunks(),this.pushPart(new Uint8Array(e))}vec(e,t){this.u64(t);for(let n=0;n<t;n+=1)e(this,n)}map(e){this.u64(e)}set(e){this.u64(e)}none(){this.chunks.push(0)}some(e){this.chunks.push(1),e(this)}enumUnit(e){this.u64(e)}},p_=class{constructor(e){this.bytesValue=e}offset=0;u64(){let e=this.readCanonicalU64();if(e>BigInt(2**53-1))throw Error(`postcard u64 exceeds Number.MAX_SAFE_INTEGER: ${e}`);return Number(e)}u64BigInt(){return this.readCanonicalU64()}i64(){let e=this.readCanonicalU64();return(e&1n)==0n?e>>1n:-(e+1n>>1n)}readCanonicalU64(){let e=0n;for(let t=0;t<10;t+=1){let n=this.readByte(),r=BigInt(n&127);if(t===9&&r>1n)throw Error(`postcard u64 overflow`);if(e|=r<<BigInt(t*7),!(n&128)){if(t!==0&&e<1n<<BigInt(t*7))throw Error(`postcard u64 is not minimally encoded`);return e}}throw Error(`postcard u64 overflow`)}string(){return Jg.decode(this.bytes())}bool(){let e=this.readByte();if(e===0)return!1;if(e===1)return!0;throw Error(`invalid bool tag ${e}`)}f64Le(){let e=this.bytesOfLength(8);return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(0,!0)}bytes(e=!0){let t=e?this.u64():16;return this.bytesOfLength(t)}bytesAtMost(e,t){let n=this.u64();if(n>e)throw Error(`${t} exceeds maximum length of ${e} bytes`);return this.bytesOfLength(n)}bytesOfLength(e){let t=this.offset+e;if(t>this.bytesValue.length)throw Error(`postcard bytes overflow`);let n=this.bytesValue.subarray(this.offset,t);return this.offset=t,n}option(e){let t=this.readByte();if(t!==0){if(t!==1)throw Error(`invalid option tag ${t}`);return e(this)}}readVec(e){let t=this.u64();return Array.from({length:t},()=>e(this))}done(){return this.offset===this.bytesValue.length}readByte(){if(this.offset>=this.bytesValue.length)throw Error(`postcard eof`);return this.bytesValue[this.offset++]}};function m_(e){return h_(JSON.stringify(e,ql))}function h_(e){return new TextEncoder().encode(e)}async function*g_(e){let t=e;if(typeof t.getReader!=`function`){let t=e[Symbol.asyncIterator](),n=!1;try{for(;;){let e=await t.next();if(e.done){n=!0;return}yield e.value}}finally{if(!n)try{Promise.resolve(t.return?.()).catch(()=>{})}catch{}}}let n=t.getReader(),r=!1;try{for(;;){let e=await n.read();if(e.done){r=!0;return}yield e.value}}finally{if(!r)try{Promise.resolve(n.cancel()).catch(()=>{})}catch{}n.releaseLock()}}var __=`history.`;function v_(e){return y_(e)!==void 0}function y_(e){return e.startsWith(__)?e.slice(__.length):void 0}var b_=[{name:`$transactionId`,column_type:{type:`Text`},nullable:!1},{name:`$acceptedAt`,column_type:{type:`Timestamp`},nullable:!1}],x_=new WeakMap;function S_(e,t){let n=y_(t);if(n===void 0)return e[t];if(v_(n)||!Object.hasOwn(e,n))return;let r=x_.get(e);r||x_.set(e,r=new Map);let i=r.get(t);if(!i){let a=e[n];i={columns:[...a.columns,...b_],...a.branchBy?{branchBy:a.branchBy}:{}},r.set(t,i)}return i}var C_=`authority_changed`,w_=class extends Error{name=`AuthorityChangedError`;code=C_;constructor(e,t){super(e,t)}};function T_(e){return!e||typeof e!=`object`?!1:e.code===C_}function E_(e){if(e==null)return null;let t=typeof e==`object`&&typeof e.message==`string`?e.message:String(e);if(T_(e))return new w_(t,{cause:e});if(e instanceof Error)return e;let n=Error(t),r=typeof e==`object`?e.code:void 0;return typeof r==`string`&&Object.assign(n,{code:r}),n}var D_=`core_tick_failed`,O_=class extends Error{name=`CoreTickFailedError`;code=D_;constructor(e){super(`core tick failed: ${A_(e)}`,{cause:e})}};function k_(e){return!e||typeof e!=`object`?!1:e.code===D_}function A_(e){if(e instanceof Error)return e.message;if(e&&typeof e==`object`){let t=e.message;if(typeof t==`string`)return t}return String(e)}function j_(e){if(e.startsWith(`$`))return e;let t=e.indexOf(`.$`);return t>=0?e.slice(t+1):e.split(`.`).at(-1)??e}function M_(){return{type:`Row`,columns:[{name:`account`,column_type:{type:`Uuid`},nullable:!1},{name:`identity`,nullable:!1,column_type:{type:`Row`,columns:[{name:`issuer`,column_type:{type:`Text`},nullable:!1},{name:`subject`,column_type:{type:`Text`},nullable:!1}]}}]}}var N_=[`$canRead`],P_=[`$createdBy`,`$createdAt`,`$updatedBy`,`$updatedAt`,`$createdBy.account`,`$createdBy.identity`,`$createdBy.identity.issuer`,`$createdBy.identity.subject`,`$updatedBy.account`,`$updatedBy.identity`,`$updatedBy.identity.issuer`,`$updatedBy.identity.subject`];function F_(e){return N_.includes(e)}function I_(e){return P_.includes(e)}function L_(e){if(e===`$createdBy`||e===`$updatedBy`||e===`$deletedBy`)return M_();if(e===`$createdAt`||e===`$updatedAt`||e===`$deletedAt`)return{type:`Timestamp`};let[t,...n]=e.split(`.`);if((t===`$createdBy`||t===`$updatedBy`||t===`$deletedBy`)&&n.length){let e=M_();for(let t of n){if(e.type!==`Row`)return;let n=e.columns.find(e=>e.name===t);if(!n)return;e=n.column_type}return e}}var R_=`__jazz_include_`;function z_(e,t,n,r){let i=n.filter(e=>!e.name.startsWith(R_)),a=new Map;for(let e of i)a.set(e.name,r[e.name]??e.default??{type:`Null`});return Object.defineProperty({table:e,id:t,values:i.filter(e=>!I_(e.name)).map(e=>a.get(e.name))},`valuesByColumn`,{value:a,configurable:!0})}var B_=Object.freeze({pending:0,oldestPendingAt:null,rejected:0,lastRejection:null});function V_(e,t){if(e.state!==`offline`||e.reason===`disconnected`)return null;let n={network:`The server is unreachable; retrying.`,auth:`The server refused this client's credential.`,stopped:`The link stopped for good; only db.reconnect() tries again.`,"authority-changed":`The server serves another history than this client's local store.`,"held-by-another-tab":`Another tab holds this account's local store under another sign-in.`}[e.reason];return{kind:e.reason,message:t||n,at:Date.now()}}var H_=Object.freeze({state:`local-only`}),U_=Object.freeze({state:`connecting`}),W_=Object.freeze({state:`connected`});function G_(e,t=e===`network`){return{state:`offline`,reason:e,retrying:t}}function K_(e){switch(e?.phase??`noServer`){case`noServer`:return H_;case`offline`:return G_(`disconnected`);case`live`:return W_;case`connecting`:case`backoff`:return e.outagePublished?G_(`network`):U_;case`awaitingCredential`:return G_(`auth`);case`stopped`:return G_(`stopped`)}}function q_(e,t){return e.state===t.state?e.state!==`offline`||t.state!==`offline`?!0:e.reason===t.reason&&e.retrying===t.retrying:!1}function J_(e,t){return e.pending===t.pending&&e.oldestPendingAt===t.oldestPendingAt&&e.rejected===t.rejected&&e.lastRejection?.at===t.lastRejection?.at&&e.lastRejection?.code===t.lastRejection?.code}var Y_=class{constructor(e,t=Object.is){this.read=e,this.same=t}listeners=new Set;published;scheduled=!1;subscribe(e,t){t.aborted||(this.listeners.size===0&&(this.published=this.read()),this.listeners.add(e),t.addEventListener(`abort`,()=>this.listeners.delete(e),{once:!0}))}get hasListeners(){return this.listeners.size>0}changed(){this.scheduled||this.listeners.size===0||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1;let e=this.read();if(!(this.published!==void 0&&this.same(e,this.published))){this.published=e;for(let t of[...this.listeners])t(e)}}))}},X_=class extends Y_{},Z_=`system`;pu({issuer:au,user_id:Z_,claims:{},authMode:`external`});var Q_=new TextEncoder;function $_(e){return Q_.encode(Yl(e))}function ev(e){let t=new f_;return t.string(e.table),Wh(t,[...e.descriptor]),Ou(t.finish())}function tv(e){if(!e||typeof e!=`object`)return;let t=e.code;return typeof t==`string`?t:void 0}var nv=new Set([`schema`,`query`,`write_rejected`,`transaction_conflict`,`storage`,`protocol`,`backpressure`,`not_observed`,`historical_read_requires_server`,`unsupported_storage_codecs`,`authority_changed`,`store_opened_without_migrations`]);function rv(e){let t=tv(e);return t!==void 0&&nv.has(t)?t:void 0}var iv=new Set([`authorization_denied`,`client_clock_too_far_ahead`,`serialization_conflict`,`row_already_deleted`,`row_already_exists`,`row_not_deleted`,`missing_required`,`branch_move`,`missing_chunks`,`predecessor_rejected`,`schema_version_not_deployed`,`identity_mismatch`]);function av(e){if(!e||typeof e!=`object`)return;let t=e.reason;return typeof t==`string`&&iv.has(t)?t:void 0}var ov=3600*1e3,sv=500,cv=`jazz-http-stream-endpoints`,lv=`endpoints`;function uv(){return globalThis.indexedDB!==void 0}function dv(){let e=globalThis.indexedDB;if(e)return new Promise((t,n)=>{let r=e.open(cv,1);r.onupgradeneeded=()=>r.result.createObjectStore(lv),r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error),r.onblocked=()=>n(Error(`blocked`))})}async function fv(e,t){let n=dv();if(!n)return;let r=await n;try{return await new Promise((n,i)=>{let a=t(r.transaction(lv,e).objectStore(lv));a.onsuccess=()=>n(a.result),a.onerror=()=>i(a.error)})}finally{r.close()}}var pv=`jazz-stream-endpoint:`,mv=600*1e3;function hv(){if(!(typeof document>`u`))try{return globalThis.localStorage??void 0}catch{return}}function gv(e,t=Date.now()){let n=hv();if(n)try{let r=n.getItem(pv+e);if(r===null)return;let[i,a]=r.split(`:`);if(i!==`stream`&&i!==`none`||!(Number(a)>t)){n.removeItem(pv+e);return}return i===`stream`}catch{return}}function _v(e,t,n){let r=hv();if(r)try{r.setItem(pv+e,`${t}:${n}`)}catch{try{r.removeItem(pv+e)}catch{}}}async function vv(e,t=Date.now()){let n,r=await Promise.race([fv(`readonly`,t=>t.get(e)).then(e=>({until:e}),()=>{}),new Promise(e=>{n=setTimeout(()=>e(void 0),sv)})]).finally(()=>clearTimeout(n));if(!r)return!1;let i=typeof r.until==`number`&&r.until>t;return i?_v(e,`stream`,r.until):_v(e,`none`,t+mv),i}function yv(e,t=Date.now()){return _v(e,`stream`,t+ov),fv(`readwrite`,n=>n.put(t+ov,e)).then(()=>{},()=>{})}function bv(e){return _v(e,`none`,Date.now()+mv),fv(`readwrite`,t=>t.delete(e)).then(()=>{},()=>{})}var xv=0,Sv=`x-jazz-stream-key`,Cv=1,wv=2;function Tv(e,t){let n=new Uint8Array(5+t.byteLength);return n[0]=e,new DataView(n.buffer).setUint32(1,t.byteLength,!1),n.set(t,5),n}function Ev(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}var Dv=class{buffered=new Uint8Array;push(e){this.buffered=this.buffered.byteLength?Ev([this.buffered,e]):e;let t=[],n=0;for(;this.buffered.byteLength-n>=5;){let e=new DataView(this.buffered.buffer,this.buffered.byteOffset+n).getUint32(1,!1);if(this.buffered.byteLength-n<5+e)break;t.push({kind:this.buffered[n],payload:this.buffered.slice(n+5,n+5+e)}),n+=5+e}return this.buffered=this.buffered.slice(n),t}get pending(){return this.buffered.byteLength}},Ov=new TextEncoder,kv=new TextDecoder;function Av(e){let t=new URL(e);return t.protocol===`ws:`&&(t.protocol=`http:`),t.protocol===`wss:`&&(t.protocol=`https:`),t.pathname=t.pathname.replace(/\/ws\/?$/,`/stream`),t.toString()}var jv=class{listeners=new Map;addEventListener(e,t){let n=this.listeners.get(e)??[];n.push(t),this.listeners.set(e,n)}emit(e,t){for(let n of this.listeners.get(e)??[])n(t)}},Mv=4*1024*1024,Nv=(e,t)=>fetch(e,t),Pv=class extends jv{constructor(e,t=Nv){super(),this.request=t,this.streamUrl=Av(e),this.run()}binaryType=`arraybuffer`;readyState=0;streamUrl;abort=new AbortController;session;queued=[];sending=!1;send(e){if(this.readyState!==1)throw Error(`HTTP stream session is not open`);let t=typeof e==`string`?Ov.encode(e):e;this.queued.push(Tv(Cv,t)),this.flush()}close(){if(this.readyState>=2)return;let e=this.session;if(!e)return this.finish(1e3,`client closed`);this.finish(1e3,`client closed`,!1),this.request(`${this.streamUrl}/${encodeURIComponent(e.id)}`,{method:`DELETE`,credentials:`same-origin`,headers:{[Sv]:e.key},signal:AbortSignal.timeout?.(Rv)}).catch(()=>{}).finally(()=>this.abort.abort())}async run(){try{let e=await this.request(this.streamUrl,{method:`POST`,credentials:`same-origin`,signal:this.abort.signal});if(!e.ok||!e.body)throw Error(`HTTP stream refused (${e.status})`);let t=e.body.getReader(),n=new Dv;for(;;){let{done:e,value:r}=await t.read();if(e)break;for(let e of n.push(r)){if(this.readyState>=2)return;this.receive(e.kind,e.payload)}}this.fail(1006,`HTTP stream ended`)}catch(e){if(this.readyState>=2)return;this.emit(`error`,e),this.fail(1006,e instanceof Error?e.message:String(e))}}receive(e,t){if(e===xv)this.session=JSON.parse(kv.decode(t)),this.readyState=1,this.emit(`open`);else if(e===Cv){let e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);this.emit(`message`,{data:e})}else if(e===wv){let{code:e,reason:n}=JSON.parse(kv.decode(t));this.finish(e,n)}}async flush(){if(!(this.sending||!this.session)){this.sending=!0;try{for(;this.queued.length>0&&this.readyState===1;){let e=0,t=0;for(;e<this.queued.length&&(e===0||t+this.queued[e].byteLength<=Mv);)t+=this.queued[e].byteLength,e+=1;let n=Ev(this.queued.splice(0,e)),r=await this.request(`${this.streamUrl}/${encodeURIComponent(this.session.id)}`,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/octet-stream`,[Sv]:this.session.key},body:n});if(!r.ok)throw Error(`HTTP stream send refused (${r.status})`)}}catch(e){this.emit(`error`,e),this.close()}finally{this.sending=!1}}}fail(e,t){this.finish(e,t)}finish(e,t,n=!0){this.readyState>=2||(this.readyState=3,n&&this.abort.abort(),this.emit(`close`,{code:e,reason:t}))}},Fv=new Set,Iv=new Map,Lv=3,Rv=1e4,zv=2,Bv=new Map,Vv=`x-jazz-stream`,Hv=new Set,Uv=`x-jazz-store-error`,Wv=new Set;async function Gv(e,t){try{let n=await t(e.replace(/^ws/,`http`),{method:`POST`,credentials:`same-origin`,signal:AbortSignal.timeout?.(Rv)});if(n.status===503&&n.headers.get(Uv)===`1`){let t=await n.text().catch(()=>``);return t&&!Wv.has(`${e}
|
|
4
4
|
${t}`)&&(Wv.add(`${e}
|
|
5
5
|
${t}`),console.error(`jazz: the backend at ${e} can't serve: ${t}`)),`other`}return n.body?.cancel().catch(()=>{}),n.status===403?`refused`:n.status===426?n.headers.get(Vv)===`1`?`stream`:`upgrades`:`other`}catch{return`silent`}}async function Kv(e,t,n){let r=await Gv(e,n);if(r===`stream`)return r;if(r!==`upgrades`)return Iv.delete(e),Bv.delete(e),r===`refused`&&!Hv.has(e)&&(Hv.add(e),console.warn(`jazz: the backend at ${e} refuses this page's origin (403). If a proxy rewrites the Host header, set the backend's publicUrl or allowedOrigins.`)),r;let i=(Iv.get(e)??0)+1;Iv.set(e,i);let a=t?(Bv.get(e)??0)+1:0;t?Bv.set(e,a):Bv.delete(e);let o=a>=zv;return i<Lv&&!o?r:(Iv.delete(e),Bv.delete(e),o?(console.warn(`jazz: ${a} WebSockets in a row to ${e} got no answer in ${Rv/1e3} s, although the backend answers and upgrades them: something in between (a proxy or dev server) doesn't pass WebSocket upgrades on. Syncing over the HTTP stream instead, for as long as this client runs.`),`stream-in-between`):(console.warn(`jazz: ${i} WebSockets in a row to ${e} failed, although the backend answers and upgrades them: something in between (a proxy or dev server) doesn't pass WebSocket upgrades on. Syncing over the HTTP stream instead, for as long as this client runs.`),`stream-in-between`))}function qv(e,t={}){let n=t.fetch??Nv,r=t.describeFailedUpgrade;return class extends jv{constructor(e){if(super(),this.url=e,Fv.has(e)){this.openStream();return}if(!uv()){this.inner=this.openNative();return}let t=gv(e);if(t===!0){Fv.add(e),this.openStream();return}if(t===!1){this.inner=this.openNative();return}vv(e).then(t=>{this.closedEarly||(t?(Fv.add(e),this.openStream()):this.inner=this.openNative())})}binaryType=`arraybuffer`;inner;closedEarly=!1;closedByClient=!1;settled=!1;probing=!1;openDeadline;abort=new AbortController;get readyState(){return this.inner?this.probing?0:this.inner.readyState:this.closedEarly?3:0}send(e){if(!this.inner)throw Error(`WebSocket is not open`);this.inner.send(e)}close(){if(this.closedByClient=!0,this.settled=!0,this.probing=!1,clearTimeout(this.openDeadline),this.abort.abort(),this.inner)return this.inner.close();this.closedEarly||(this.closedEarly=!0,queueMicrotask(()=>this.emit(`close`,{code:1e3,reason:``})))}openStream(){let e=new Pv(this.url,n),t=!1;e.addEventListener(`open`,()=>{t=!0}),e.addEventListener(`close`,()=>{!t&&!this.closedByClient&&(Fv.delete(this.url),bv(this.url))}),this.inner=e,this.forward(e)}openNative(){let t=new e(this.url);t.binaryType=`arraybuffer`;let i=!1,a,o=(e,t,i=!1)=>{if(clearTimeout(this.openDeadline),!this.settled){if(a){a[e]??=t;return}a={[e]:t},this.probing=!0,Kv(this.url,i,n).then(async e=>{let t=e===`stream`||e===`stream-in-between`,n=!(!i&&(e===`upgrades`||e===`other`))||this.settled?void 0:await r?.(this.url,this.abort.signal).catch(()=>{});if(this.probing=!1,!this.settled){if(this.settled=!0,t){Fv.add(this.url),e===`stream`&&yv(this.url),this.openStream();return}if(n){this.emit(`error`,Error(n)),this.emit(`close`,{code:1006,reason:n});return}a?.error!==void 0&&this.emit(`error`,a.error),this.emit(`close`,a?.close??{code:1006,reason:``})}})}};return this.openDeadline=setTimeout(()=>{o(`close`,{code:1006,reason:`the WebSocket upgrade got no answer`},!0),t.close()},Rv),t.addEventListener(`open`,()=>{a||(clearTimeout(this.openDeadline),i=!0,Iv.delete(this.url),Bv.delete(this.url),this.settled=!0,this.emit(`open`))}),t.addEventListener(`message`,e=>{a||this.emit(`message`,e)}),t.addEventListener(`error`,e=>{i?this.emit(`error`,e):o(`error`,e)}),t.addEventListener(`close`,e=>{i?this.emit(`close`,e):o(`close`,e)}),t}forward(e){e.addEventListener(`open`,()=>this.emit(`open`)),e.addEventListener(`message`,e=>this.emit(`message`,e)),e.addEventListener(`error`,e=>this.emit(`error`,e)),e.addEventListener(`close`,e=>this.emit(`close`,e))}}}var Jv=`jazz_renewal`,Yv=`X-Jazz-Renew`,Xv=64,Zv=65,Qv=2048;function $v(e){let t=new p_(e);if(t.u64()!==Xv)throw Error(`not a renew-soon frame`);let n=t.string(),r=t.u64();if(!t.done()||!n||n.length>Qv)throw Error(`malformed renew-soon frame`);return{session:n,renewInMs:r}}function ey(e){let t=new f_;return t.u64(Zv),t.string(e),t.finish()}function ty(e){return e[0]===Xv}function ny(e){try{let t=new URL(e);return/\/ws\/?$/.test(t.pathname)?(t.protocol=t.protocol===`wss:`?`https:`:t.protocol===`ws:`?`http:`:t.protocol,t.pathname=t.pathname.replace(/\/ws\/?$/,`/accounts/backend-user`),t.search=``,t.hash=``,t.toString()):null}catch{return null}}function ry(e){try{return`jazz-session-refresh:${new URL(e.replace(/^ws/,`http`)).origin}`}catch{return`jazz-session-refresh:${e}`}}var iy=class extends Error{wireError;constructor(e){super(`websocket ${e.code} before server hello: ${e.message}`),this.name=`PreHelloWireError`,this.wireError=e}};function ay(e){return e.retry===`later`&&(e.code===`not_ready`||e.code===`backpressure`)}var oy=`reauthenticate:`;function sy(e){return e.code===`auth_failed`&&e.retry===`after_resume`&&e.message.startsWith(oy)}function cy(e){return e.retry===`later`&&(e.code===`websocket_closed`||e.code===`websocket_error`||e.code===`websocket_silent`)}var ly=6,uy=ly,dy=ly,fy=16,py=128,my=256,hy=2048,gy=12e4,_y=1e4,vy=1e3,yy=7,by=fy|py|my|4096,xy=1<<20,Sy=5,Cy=5,wy=2*1024*1024,Ty=4096;function Ey(e){Oy(e);let t=new f_;t.vec((t,n)=>t.bytes(e[n]),e.length);let n=t.finish();if(n.byteLength>wy)throw Error(`websocket frame batch exceeds maximum length of ${wy} bytes`);return n}function Dy(e){if(e.byteLength>wy)throw Error(`websocket frame batch exceeds maximum length of ${wy} bytes`);let t=new p_(e),n=t.u64();if(n===0||n>Ty)throw Error(`websocket frame batch exceeds frame-count limit of ${Ty}`);let r=[];for(let e=0;e<n;e+=1)r.push(t.bytesAtMost(wy,`websocket frame`));return Hy(t,`websocket frame batch`),r}function Oy(e){if(e.length===0||e.length>Ty)throw Error(`websocket frame batch exceeds frame-count limit of ${Ty}`);for(let t of e)if(t.byteLength>wy)throw Error(`websocket frame exceeds maximum length of ${wy} bytes`)}function ky(e=by){zy(e,`client wire features`);let t=new f_;return t.u64(0),t.u64(uy),t.u64(dy),t.u64(e),t.u64(0),t.none(),t.finish()}var Ay=0,jy=1;function My(e){if(e[0]!==Ay)return!1;let t=new p_(e);t.u64();let{min:n,max:r}=By(t);return n===ly&&r===ly&&Vy(t),!0}function Ny(e){if(e[0]!==jy)return!1;let t=new p_(e);return t.u64(),Fy(t),!0}function Py(e){let t=new p_(e),n=t.u64();if(n!==1)throw Error(`expected WireFrame::Error, got tag ${n}`);return Fy(t)}function Fy(e){let t={code:sb(e.u64()),retry:cb(e.u64()),message:e.string()};return Hy(e,`WireFrame::Error`),t}function Iy(e){return e.code===`auth_failed`?Du(e.message):null}var Ly=class{url;socket;onFrame;onError;onTerminal;localFeatures;opened;resolveNegotiation;rejectNegotiation;negotiated=!1;closing=!1;terminated=!1;lastInbound=performance.now();silenceTimer;handshakeTimer;renewalUrl;renewalTimer;constructor(e){this.url=e.endpointUrl;let t=e.WebSocket??Lu(this.url)??ib(this.url);this.onFrame=e.onFrame,this.onError=e.onError,this.onTerminal=e.onTerminal,this.localFeatures=(e.features??by)|hy,this.renewalUrl=Gy(e.authJson)?ny(this.url):null,zy(this.localFeatures,`client wire features`),this.socket=new t(this.url),this.socket.binaryType=`arraybuffer`,this.watchHandshake(e.handshakeTimeoutMs??_y),this.opened=new Promise((e,t)=>{this.resolveNegotiation=e,this.rejectNegotiation=t}),lb(this.socket).then(()=>{this.closing||(this.socket.send(Wy(e.authJson??`{}`,e.peerIdentity,e.requestedLink,this.renewalUrl!==null)),this.socket.send(Ey([ky(this.localFeatures)])))},e=>{this.reportTerminal({code:`websocket_error`,retry:`later`,message:e instanceof Error?e.message:String(e)}),this.close()}),this.socket.addEventListener(`message`,e=>{this.lastInbound=performance.now(),this.handleMessage(e.data).catch(e=>{this.reportTerminal({code:`protocol_error`,retry:`never`,message:e instanceof Error?e.message:String(e)},void 0,!1),this.close()})}),this.socket.addEventListener(`error`,e=>{this.reportTerminal({code:`websocket_error`,retry:`later`,message:e instanceof Error?e.message:`websocket transport error`})}),this.socket.addEventListener(`close`,e=>{let t=Uy(e);this.reportTerminal({code:`websocket_closed`,retry:`later`,message:`websocket closed (code=${t.code??`unknown`}, reason=${t.reason??`none`})`})})}async send(e){await this.sendBatch([e])}async sendBatch(e){await this.ready();let t=[],n=Cy;for(let r of e){let e=r.byteLength+Sy;t.length>0&&(t.length>=Ty||n+e>xy)&&(this.socket.send(Ey(t)),t=[],n=Cy),t.push(r),n+=e}t.length>0&&this.socket.send(Ey(t))}ready(){return this.opened}get hasNegotiated(){return this.negotiated}close(){if(!this.closing){this.closing=!0,clearTimeout(this.silenceTimer),clearTimeout(this.handshakeTimer),clearTimeout(this.renewalTimer),this.reportTerminal({code:`websocket_closed`,retry:`never`,message:`websocket closed before server hello`},Error(`websocket closed before server hello`),!1,!1);try{this.socket.close()}catch{}}}reportTerminal(e,t=Error(e.message),n=!0,r=!0){this.terminated||(this.terminated=!0,clearTimeout(this.silenceTimer),clearTimeout(this.handshakeTimer),clearTimeout(this.renewalTimer),this.rejectNegotiation(t),n&&this.onError?.(e),r&&this.onTerminal?.(e))}watchHandshake(e){this.handshakeTimer=setTimeout(()=>{this.handshakeTimer=setTimeout(()=>{this.negotiated||this.terminated||(this.reportTerminal({code:`websocket_silent`,retry:`later`,message:`the server did not answer the connection within ${Math.round(e/1e3)} s`}),this.close())},vy)},e)}scheduleRenewal({session:e,renewInMs:t}){clearTimeout(this.renewalTimer);let n=this.renewalUrl;n&&(this.renewalTimer=setTimeout(()=>{this.renewalTimer=void 0,!(this.closing||this.terminated)&&qy(n,e).then(e=>{if(!(!e||this.closing||this.terminated))return this.send(ey(e))}).catch(()=>{})},Math.min(t,2**31-1)))}watchSilence(e=!1){if(clearTimeout(this.silenceTimer),this.closing||this.terminated)return;let t=performance.now()-this.lastInbound;if(t>=gy&&!e){this.silenceTimer=setTimeout(()=>this.watchSilence(!0),vy);return}if(t>=gy){this.reportTerminal({code:`websocket_silent`,retry:`later`,message:`the server sent nothing for ${Math.round(t/1e3)} s, not even a heartbeat`}),this.close();return}this.silenceTimer=setTimeout(()=>this.watchSilence(),gy-t)}async handleMessage(e){for(let t of Dy(await rb(e))){if(this.closing)return;if(My(t)){if(this.negotiated)continue;this.negotiated=!0,clearTimeout(this.handshakeTimer);let e=Ry(t,this.localFeatures);(e.features&hy)!==0&&this.watchSilence(),this.resolveNegotiation({...e,features:e.features&~hy});continue}if(!(this.negotiated&&t.byteLength===1&&t[0]===yy)){if(this.negotiated&&this.renewalUrl&&ty(t)){this.scheduleRenewal($v(t));continue}if(!this.negotiated){if(Ny(t)){let e=Py(t);if(Iy(e)){this.reportTerminal(e,Error(`websocket authentication failed before server hello: ${e.message}`)),this.close();return}this.reportTerminal(e,new iy(e)),this.close();return}this.reportTerminal({code:`protocol_error`,retry:`never`,message:`websocket received semantic frame before server hello`},void 0,!1),this.close();return}if(Ny(t)){let e=Py(t);if(ay(e)){this.reportTerminal(e),this.close();return}this.onError?.(e);continue}this.onFrame(t)}}}};function Ry(e,t=by){let n=new p_(e);if(n.u64()!==0)throw Error(`expected WireFrame::Hello`);let{min:r,max:i}=By(n);if(r!==ly||i!==ly)throw Error(`server must advertise exactly wire protocol ${ly}, got ${r}..=${i}`);let{features:a,role:o,authority:s}=Vy(n),c=a&~BigInt(t);if(c!==0n)throw Error(`server accepted unsupported wire features 0x${c.toString(16)}`);if(o!==1)throw Error(`expected WirePeerRole::Core server hello`);return{protocolVersion:ly,features:Number(a),authority:s}}function zy(e,t){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw Error(`${t} must be an unsigned 32-bit integer, got ${e}`)}function By(e){return{min:e.u64(),max:e.u64()}}function Vy(e){let t=e.u64BigInt(),n=e.u64(),r=e.option(e=>{let t=e.bytes();if(t.byteLength!==16)throw Error(`WireHello.authority.node must be exactly 16 bytes, got ${t.byteLength}`);return{node:t,epoch:e.u64BigInt()}});return Hy(e,`WireFrame::Hello`),{features:t,role:n,authority:r}}function Hy(e,t){if(!e.done())throw Error(`${t} has trailing postcard bytes`)}function Uy(e){if(!e||typeof e!=`object`)return{};let t=e;return{code:typeof t.code==`number`?t.code:void 0,reason:typeof t.reason==`string`?t.reason:void 0}}function Wy(e,t,n,r=!1){let i=JSON.parse(e),a=new Vl().decode(t),o=ub(i)??nb(a)??a;return JSON.stringify({peer_identity:a,...i,auth:{...i,sub:o},sub:o,...n?{requested_link:n}:{},...r?{[Jv]:1}:{}})}function Gy(e){if(!e)return!1;try{let t=JSON.parse(e);return t.backend_session!=null&&t.jwt_token==null&&t.admin_secret==null&&t.backend_secret==null}catch{return!1}}var Ky=3e4;async function qy(e,t){return Jy(ry(e),()=>Yy(e,t))}async function Jy(e,t){let n=globalThis.navigator?.locks;if(!n)return t();let r,i=()=>r??=t();try{await n.request(e,()=>{let e;return Promise.race([i().catch(()=>{}),new Promise(t=>{e=setTimeout(t,Ky)})]).finally(()=>clearTimeout(e))})}catch{}return i()}async function Yy(e,t){try{let n=await Iu(e)(e,{method:`POST`,credentials:`same-origin`,redirect:`error`,headers:{[Yv]:t}});if(!n.ok)return null;let r=await n.json();return typeof r.renewal==`string`?r.renewal:null}catch{return null}}function Xy(e){let t=JSON.parse(e);if(t.admin_secret)return{};if(typeof t.backend_secret==`string`){let e=t.backend_session,n=e&&typeof e==`object`?e.claims:void 0;return n&&typeof n==`object`&&!Array.isArray(n)?n:{}}if(typeof t.jwt_token!=`string`)return{};let n=wu(t.jwt_token);if(!n)return{};if(n.iss===`urn:jazz:local-first`||n.iss===`urn:jazz:anonymous`){let{jazz_pub_key:e,...t}=n;return vu(t)}return vu(n)}function Zy(e,t){let n=JSON.parse(e);if(typeof n.admin_secret==`string`||typeof n.backend_secret==`string`&&!$y(n))return new TextEncoder().encode($l(`urn:jazz:system`,`system`));let r=tb(n),i=null;try{i=eu(new Vl({fatal:!0}).decode(t))}catch{}if(i?.account_id&&r){let e=eu(r);if(e.issuer!==i.issuer||e.user_id!==i.user_id||e.account_id!==void 0&&e.account_id!==i.account_id)throw Error(`WebSocket credential must match the context account identity`);return t}return r?new TextEncoder().encode(r):t}function Qy(e){let t=JSON.parse(e);return typeof t.backend_secret==`string`&&!t.admin_secret&&!$y(t)&&delete t.jwt_token,JSON.stringify(t)}function $y(e){let t=e.backend_session;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.issuer==`string`&&typeof t.user_id==`string`&&Ql(t.issuer)&&Ql(t.user_id)}function eb(e){let t=JSON.parse(e);return typeof t.admin_secret==`string`||typeof t.backend_secret==`string`||tb(t)!==null}function tb(e){if(typeof e.admin_secret==`string`)return null;if(typeof e.backend_secret==`string`&&$y(e)){let t=e.backend_session;return $l(t.issuer,t.user_id,t.account_id)}if(typeof e.jwt_token==`string`){let t=wu(e.jwt_token),n=typeof t?.iss==`string`?t.iss:void 0,r=t?.sub;if(typeof n==`string`&&typeof r==`string`&&Ql(n)&&Ql(r))return $l(n,r)}return null}function nb(e){return eu(e)?.user_id??null}async function rb(e){if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(typeof Blob<`u`&&e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw Error(`expected binary websocket message, got ${typeof e}`)}function ib(e){let t=ob();return ab(e)?qv(t):t}function ab(e){let t=globalThis.location;if(!t?.host)return!1;try{return new URL(e).host===t.host}catch{return!1}}function ob(){let e=globalThis.WebSocket;if(!e)throw Error(`browser WebSocket is not available`);return e}function sb(e){switch(e){case 0:return`unsupported_protocol_version`;case 1:return`unsupported_feature`;case 2:return`malformed_frame`;case 3:return`auth_failed`;case 4:return`backpressure`;case 5:return`internal`;case 6:return`not_ready`;default:throw Error(`unknown WireErrorCode discriminant ${e}`)}}function cb(e){switch(e){case 0:return`never`;case 1:return`after_auth`;case 2:return`after_resume`;case 3:return`later`;default:throw Error(`unknown WireRetry discriminant ${e}`)}}function lb(e){return e.readyState===1?Promise.resolve():new Promise((t,n)=>{let r=!1,i=e=>{r||(r=!0,e())};e.addEventListener(`open`,()=>i(t)),e.addEventListener(`error`,e=>i(()=>n(e))),e.addEventListener(`close`,()=>i(()=>n(Error(`websocket closed before open`))))})}function ub(e){let t=e.sub;if(typeof t==`string`&&Ql(t))return t;let n=e.jwt_token;if(typeof n==`string`){let e=db(n);if(e)return e}let r=e.backend_session;if(r&&typeof r==`object`){let e=r.user_id;if(typeof e==`string`&&Ql(e))return e}return null}function db(e){let t=e.split(`.`);if(t.length<2)return null;try{let e=JSON.parse(fb(t[1]));return typeof e.sub==`string`&&Ql(e.sub)?e.sub:null}catch{return null}}function fb(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.padEnd(Math.ceil(t.length/4)*4,`=`);return typeof atob==`function`?atob(n):Buffer.from(n,`base64`).toString(`binary`)}var pb=20,mb=/^(?:0|[1-9][0-9]*|-[1-9][0-9]*)$/,hb=16,gb={none:`none`,connecting:`attempting`,connected:`live`,unavailable:`failed`},_b=250,vb=4;function yb(e){return typeof e?.poll==`function`}function bb(e){if(!e||e instanceof Uint8Array)throw Error(`Native runtime direct mutation did not return a write receipt`);return e}function xb(e){let t=e;return typeof t?.poll==`function`&&typeof t.cancel==`function`}function Sb(e,t){let n=e.message;return sy(e)?{kind:`reauthenticate`,message:n}:Iy(e)?{kind:`authRejected`,message:n}:ay(e)||e.code===`internal`&&e.retry===`later`?t?{kind:`network`,message:n}:{kind:e.code===`not_ready`?`serverNotReady`:`refused`,message:n}:cy(e)?{kind:`network`,message:n}:{kind:`fatal`,message:n}}function Cb(e,t){return e?Promise.allSettled([e,t]).then(e=>{for(let t of e)if(t.status===`rejected`)throw t.reason}):t}function wb(e){let t=e;return typeof t?.poll==`function`&&typeof t.cancel==`function`&&typeof t.setWake==`function`}var Tb=new Vl({fatal:!0}),Eb=new WeakMap;function Db(e,t,n,r,i,a=!1){try{return Ob(e,t,n,r,i,a)}catch(e){throw Xp(e)}}function Ob(e,t,n,r,i,a){if(i&&a)throw Error(`A native runtime cannot be both self-signed and backend-scoped`);if(a){if(!e.openPersistentAsBackend)throw Error(`Native runtime does not support explicit backend opens; rebuild the matching Jazz native artifact`);return e.openPersistentAsBackend(t,n,r)}if(i){if(!e.openPersistentWithSelfSignedProof)throw Error(`Native runtime does not support self-signed client opens; rebuild the matching Jazz native artifact`);return e.openPersistentWithSelfSignedProof(t,n,r,i.token,i.appId,i.claimedAuthor)}if(!e.openPersistent)throw Error(`Native runtime does not expose persistent storage`);return e.openPersistent(t,n,r)}function kb(e,t,n,r,i=!1){if(r&&i)throw Error(`A native runtime cannot be both self-signed and backend-scoped`);if(i){if(!e.openMemoryAsBackend)throw Error(`Native runtime does not support explicit backend opens; rebuild the matching Jazz native artifact`);return e.openMemoryAsBackend(t,n)}if(!r)return e.openMemory(t,n);if(!e.openMemoryWithSelfSignedProof)throw Error(`Native runtime does not support self-signed client opens; rebuild the matching Jazz native artifact`);return e.openMemoryWithSelfSignedProof(t,n,r.token,r.appId,r.claimedAuthor)}function Ab(e){let t=e.indexOf(`. Plan: `);return t===-1?e:e.slice(0,t)}var jb=class e{constructor(e,t,n,r,i,a,o){if(this.schema=t,this.node=n,this.ownerRuntime=o?.owner?.ownerRuntime??this,this.readAuthorizationHost=o?.owner?.readAuthorizationHost??o?.readAuthorizationHost??`client-local`,this.transactionOwner=o?.owner?.transactionOwner??{pendingTxs:new Map,completedTxs:new Map,writes:new Map},this.pendingTxs=this.transactionOwner.pendingTxs,this.completedTxs=this.transactionOwner.completedTxs,this.writes=this.transactionOwner.writes,this.schemaBytes=$_(t),this.trustedBackend=(o?.owner?.trustedBackend??o?.backendMode)===!0,this.selfSignedClientProof=o?.selfSignedClientProof,this.scopeIsolatedRelay=o?.scopeIsolatedRelay===!0,this.webSocket=o?.webSocket,this.configBytes=Zg(n,r,void 0,a,o?.initialSyncFlushEvery,o?.selfSignedClientProof,o?.migrations,o?.systemNode),this.peerIdentity=r,this.migrations=o?.owner?.migrations??o?.migrations,this.schemaHash=Xl(t),o?.db)this.db=o.db;else if(o?.persistentPath){if(!e)throw Error(`Native runtime constructor required for persistent storage`);this.db=Db(e,o.persistentPath,this.schemaBytes,this.configBytes,o?.selfSignedClientProof,o?.backendMode)}else{if(!e)throw Error(`Native runtime constructor required for memory storage`);this.db=kb(e,this.schemaBytes,this.configBytes,o?.selfSignedClientProof,o?.backendMode)}if(o?.owner)return;this.slowQueryApp=o?.slowQueryLog?.appId,this.slowQueryConsoleDetail=o?.slowQueryLog?.consoleDetail;let s=o?.slowQueryLog?.thresholdMs;if(s!==void 0){if(!Number.isFinite(s)||s<0)throw Error(`slowQueryThresholdMs must be a non-negative number of milliseconds`);this.db.setSlowQueryThresholdMs?.(s)}if(typeof this.db.setTickScheduler!=`function`)throw Error(`Native runtime requires db.setTickScheduler`);this.db.setTickScheduler(((e,t)=>{let n=typeof e==`string`?e:t;(n===`immediate`||n===`deferred`||n===`after-current-turn`||typeof n==`string`&&n.startsWith(`after:`))&&this.scheduleCoreWake(n)})),this.db.onUpstreamFailure?.(e=>{if(!e)return this.nativeAuthRefusalRenewable=!1,this.clearRemoteServerTransportError();let t=e.code?E_({code:e.code,message:e.reason}):Error(e.reason);this.handleServerTransportError(t,this.serverConnectionGeneration,e.retrying||this.nativeAuthRefusalRenewable)})}auxiliaryReceiveDeadlines=new Map;pendingNativeAdmissionCancels=new Set;pendingNativeReadCancels=new Set;db;schemaBytes;configBytes;peerIdentity;upstreamPrincipal=null;selfSignedClientProof;scopeIsolatedRelay;schemaHash;trustedBackend;transactionOwner;pendingTxs;completedTxs;writes;pendingLocalSettlements=new Set;localSettlementListeners=new Set;pendingStreamingMutations=new Set;streamingFinalization=Promise.resolve();ownerRuntime;slowQueryApp;slowQueryConsoleDetail;get preparationOwner(){return this.ownerRuntime}readAuthorizationHost;subscriptions=new Map;subscriptionPool;pooledSubscriptions=new Map;drainingSubscriptionPool=!1;subscriptionPoolDirty=!1;authFailureCallback=null;mutationErrorCallback=null;serverTransportErrorCallback=null;deliveredMutationErrors=new Set;serverTransport=null;peerUpstreamAttached=!1;nonDurableClient=!1;serverCarrier=null;webSocket;serverCarrierPromise=null;serverConnectionAttempt=null;serverReplacementRetirement=null;serverTransportError=null;serverTransportErrorWaiters=[];localStorageFailure=null;localStorageFailureWaiters=new Set;serverTransportWorkEpoch=0;serverTransportWorkWaiters=[];serverEndpointUrl=null;serverAuthJson=null;link=null;linkStatus=null;linkInputs=[];linkStepping=!1;linkAttemptId=null;linkTimer=null;linkConnection=null;linkFailure=null;upstreamRefusal=null;linkCloseReason=`server transport replaced`;serverTransportErrorRetrying=!1;serverTransportErrorAwaitsAuth=!1;nativeAuthRefusalRenewable=!1;nativeLinkEverConnected=!1;nativeLinkPoll=null;firstLoadWaitSeen=!1;remoteLink=new X_(()=>this.readRemoteLinkState());linkStatusPublisher=new Y_(()=>this.upstreamLinkStatus(),q_);syncStatusPublisher=new Y_(()=>this.readSyncStatus(),(e,t)=>J_(e.uploads,t.uploads)&&q_(e.link,t.link));lastFailure=null;failingAs=null;pendingInboundServerFrames=[];serverInboundRouting=Promise.resolve();serverInboundProcessed=!1;peerTransportWorkListeners=new Set;auxiliaryTraceListeners=new Set;queryCoverageTraceListeners=new Set;peerTransportActivityEpoch=0;peerTransportProcessedActivityEpoch=0;coreTickScheduled=!1;coreDeadlineTimer;coreDeadlineAt;coreTickAgain=!1;coreOperation=null;pendingTransportRetirements=new Map;serverPumpScheduled=!1;serverPumpRunning=!1;serverPumpAgain=!1;serverConnectionGeneration=0;closed=!1;foregroundLeaseQuiesced=!1;foregroundLeaseCapture=null;foregroundLeaseDraining=!1;physicalCloseStarted=!1;nextSubscriptionId=1;static fromDb(t,n,r,i,a,o,s){return new e(null,n,r,i,a,o,{db:t,selfSignedClientProof:s?.selfSignedClientProof,scopeIsolatedRelay:s?.scopeIsolatedRelay,slowQueryLog:s?.slowQueryLog})}migrations;registerSchemaView(t,n){return new e(null,t,this.node,this.peerIdentity,1,!0,{db:this.db.registerSchema($_(t),n?m_(n):void 0),backendMode:this.trustedBackend,owner:this})}createPeerAuthority(){return{node:this.node,epoch:Pl(),features:this.nativeWireFeatures()}}async connectUpstreamPeer(e){return this===this.ownerRuntime?(this.peerUpstreamAttached=!0,e?this.connectNegotiatedUpstream({protocolVersion:ly,features:e.features,authority:e}):await this.db.connectUpstream()):await this.ownerRuntime.connectUpstreamPeer(e)}onPeerTransportWork(e){return this===this.ownerRuntime?(this.peerTransportWorkListeners.add(e),()=>{this.peerTransportWorkListeners.delete(e)}):this.ownerRuntime.onPeerTransportWork(e)}onAuxiliaryTrace(e){return this===this.ownerRuntime?(this.auxiliaryTraceListeners.add(e),this.serverTransport?.setAuxiliaryTraceEnabled?.(!0),()=>{this.auxiliaryTraceListeners.delete(e),this.auxiliaryTraceListeners.size===0&&this.serverTransport?.setAuxiliaryTraceEnabled?.(!1)}):this.ownerRuntime.onAuxiliaryTrace(e)}onQueryCoverageTrace(e){return this===this.ownerRuntime?(this.queryCoverageTraceListeners.add(e),()=>this.queryCoverageTraceListeners.delete(e)):this.ownerRuntime.onQueryCoverageTrace(e)}emitQueryCoverageTrace(e){if(this!==this.ownerRuntime){this.ownerRuntime.emitQueryCoverageTrace(e);return}let t={stage:e,peerActivityEpoch:this.peerTransportActivityEpoch,peerProcessedActivityEpoch:this.peerTransportProcessedActivityEpoch};for(let e of this.queryCoverageTraceListeners)e(t)}notifyPeerTransportActivity(){if(this!==this.ownerRuntime)return this.ownerRuntime.notifyPeerTransportActivity();this.peerTransportActivityEpoch+=1,this.notifyPeerTransportWork(!0)}async progressPeerTransport(){if(this!==this.ownerRuntime)return this.ownerRuntime.progressPeerTransport();let e=this.peerTransportActivityEpoch;await this.runCoreTick(),!this.closed&&(this.peerTransportProcessedActivityEpoch=Math.max(this.peerTransportProcessedActivityEpoch,e))}retirePeerTransport(e){return this===this.ownerRuntime?(this.auxiliaryReceiveDeadlines.get(e)?.close(),this.auxiliaryReceiveDeadlines.delete(e),this.coreOperation?new Promise((t,n)=>{let r=this.pendingTransportRetirements.get(e)??[];r.push({resolve:t,reject:n}),this.pendingTransportRetirements.set(e,r)}):(e.close(),Promise.resolve())):this.ownerRuntime.retirePeerTransport(e)}setNonDurableClient(){if(this!==this.ownerRuntime)return this.ownerRuntime.setNonDurableClient();if(!this.db.setNonDurableClient)throw Error(`Native runtime does not expose non-durable client mode`);this.db.setNonDurableClient(),this.nonDurableClient=!0}foregroundTxTimeHighWater(){if(this!==this.ownerRuntime)return this.ownerRuntime.foregroundTxTimeHighWater();if(!this.db.foregroundTxTimeHighWater)throw Error(`Native runtime does not expose foreground transaction high-water`);return this.db.foregroundTxTimeHighWater()}quiesceForegroundTxTimeHighWater(){if(this!==this.ownerRuntime)return this.ownerRuntime.quiesceForegroundTxTimeHighWater();if(this.foregroundLeaseCapture)return this.foregroundLeaseCapture;if(this.closed)throw Error(`Native runtime is already closed`);this.closed=!0,this.clearCoreDeadline(),this.foregroundLeaseQuiesced=!0,this.foregroundLeaseDraining=!0;let e=this.captureForegroundTxTimeHighWater().finally(()=>{this.foregroundLeaseDraining=!1,this.clearCoreDeadline()});return this.foregroundLeaseCapture=e,e}coreProgressAllowed(){return!this.closed||this.foregroundLeaseDraining}async captureForegroundTxTimeHighWater(){return await Promise.all(this.pendingStreamingMutations),await Promise.all(this.pendingLocalSettlements),await this.coreOperation?.completion.catch(()=>{}),await this.foregroundTxTimeHighWater()}seedForegroundTxTimeHighWater(e){if(this!==this.ownerRuntime)return this.ownerRuntime.seedForegroundTxTimeHighWater(e);if(!this.db.seedForegroundTxTimeHighWater)throw Error(`Native runtime does not expose foreground transaction high-water seeding`);this.db.seedForegroundTxTimeHighWater(e)}setLargeValueStagingPolicy(e,t,n){if(this!==this.ownerRuntime)return this.ownerRuntime.setLargeValueStagingPolicy(e,t,n);if(!this.db.setLargeValueStagingPolicy)throw Error(`Native runtime does not expose large-value staging policy`);this.db.setLargeValueStagingPolicy(e,t,n)}async evictExpiredStagedLargeValues(){if(this!==this.ownerRuntime)return await this.ownerRuntime.evictExpiredStagedLargeValues();if(!this.db.evictExpiredStagedLargeValues)throw Error(`Native runtime does not expose large-value staging maintenance`);return await this.db.evictExpiredStagedLargeValues()}async acceptPeer(e={},t,n=this.peerIdentity){if(this!==this.ownerRuntime)return this.ownerRuntime.acceptPeer(e,t,n);if(this.closed)throw Error(`Native runtime is closed`);return this.runWhenCoreIdle(async()=>{if(this.closed)throw Error(`Native runtime is closed`);let r;this.coreOperation={kind:`admission`,completion:new Promise(e=>{r=e})};try{let r=this.selfSignedClientProof,i;if(r){if(!QS(n,this.peerIdentity))throw Fx();if(!this.db.acceptSubscriberWithSelfSignedProof)throw Error(`Native runtime does not support self-signed subscriber admission; rebuild the matching Jazz WASM artifact`);i=await this.db.acceptSubscriberWithSelfSignedProof(e,r.token,r.appId,r.claimedAuthor,t)}else{if(!this.db.acceptSubscriber)throw Error(`Native runtime does not expose subscriber links`);i=await this.db.acceptSubscriber(n,e,t)}if(this.closed)throw i.close(),Error(`Native runtime closed during subscriber admission`);return i}finally{this.drainTransportRetirements(),this.coreOperation=null,r(),this.coreTickAgain&&!this.closed&&this.scheduleCoreTick()}})}async runWhenCoreIdle(e){let t=this.ownerRuntime;for(;t.coreOperation;)await t.coreOperation.completion;return e()}setRemoteLinkHint(e){if(this!==this.ownerRuntime)return this.ownerRuntime.setRemoteLinkHint(e);this.closed||this.db.setRemoteLinkHint?.(gb[e])}remoteLinkState(){return this===this.ownerRuntime?this.readRemoteLinkState():this.ownerRuntime.remoteLinkState()}onRemoteLinkStateChange(e,t){if(this!==this.ownerRuntime){this.ownerRuntime.onRemoteLinkStateChange(e,t);return}this.remoteLink.subscribe(e,t),this.startNativeLinkPoll()}startNativeLinkPoll(){!this.db?.nativeConnectionStatus||this.nativeLinkPoll||this.closed||!this.linkHasListeners()||(this.nativeLinkPoll=setInterval(()=>{this.linkHasListeners()?this.linkChanged():this.stopNativeLinkPoll()},_b))}noteFirstLoadWait(e){if(!Xb(e))return;let t=this.ownerRuntime;t.firstLoadWaitSeen||(t.firstLoadWaitSeen=!0,t.startNativeLinkPoll())}stopNativeLinkPoll(){this.nativeLinkPoll&&clearInterval(this.nativeLinkPoll),this.nativeLinkPoll=null}linkHasListeners(){return this.syncStatusPublisher.hasListeners||this.linkStatusPublisher.hasListeners||this.firstLoadWaitSeen&&this.remoteLink.hasListeners}linkChanged(){this===this.ownerRuntime&&this.noteLinkFailure(),this.remoteLink.changed(),this.linkStatusPublisher.changed(),this.syncStatusPublisher.changed()}upstreamLinkStatus(){if(this!==this.ownerRuntime)return this.ownerRuntime.upstreamLinkStatus();if(this.closed)return G_(`stopped`,!1);let e=this.db?.nativeConnectionStatus?.();return e?e.configured?e.explicitlyOffline?G_(`disconnected`):e.authRejected?G_(`auth`):e.connected?W_:this.serverTransportError?this.serverTransportErrorRetrying?G_(`network`):T_(this.serverTransportError)?G_(`authority-changed`,!1):G_(`stopped`):U_:H_:this.linkStatus?.phase===`stopped`&&T_(this.upstreamRefusal)?G_(`authority-changed`,!1):K_(this.linkStatus)}canClearClientStorage(){return this===this.ownerRuntime?typeof this.db?.deleteNativeStore==`function`:this.ownerRuntime.canClearClientStorage()}async clearClientStorage(){if(this!==this.ownerRuntime)return this.ownerRuntime.clearClientStorage();if(!this.db?.deleteNativeStore)throw Error(`Runtime does not support client storage reset.`);let e=this.db.deleteNativeStore();return this.closed=!0,e}uploadStatus(){return this===this.ownerRuntime?this.closed?B_:this.db?.uploadStatus?.()??B_:this.ownerRuntime.uploadStatus()}lastLinkFailure(){return this===this.ownerRuntime?(this.noteLinkFailure(),this.lastFailure):this.ownerRuntime.lastLinkFailure()}noteLinkFailure(){let e=this.upstreamLinkStatus(),t=e.state===`offline`?e.reason:null;if(t===this.failingAs)return;this.failingAs=t;let n=V_(e,(this.linkFailure??this.serverTransportError)?.message);n&&(this.lastFailure=n)}onUpstreamLinkStatusChange(e,t){if(this!==this.ownerRuntime){this.ownerRuntime.onUpstreamLinkStatusChange(e,t);return}this.linkStatusPublisher.subscribe(e,t),this.startNativeLinkPoll()}onSyncStatusChange(e,t){if(this!==this.ownerRuntime){this.ownerRuntime.onSyncStatusChange(e,t);return}this.syncStatusPublisher.subscribe(e,t),this.startNativeLinkPoll()}readSyncStatus(){return{link:this.upstreamLinkStatus(),uploads:this.uploadStatus()}}readRemoteLinkState(){if(this.closed)return`unavailable`;let e=this.db?.nativeConnectionStatus?.();if(e)return e.configured?e.explicitlyOffline||e.authRejected?`unavailable`:e.connected?(this.nativeLinkEverConnected=!0,`connected`):this.serverTransportError||this.nativeLinkEverConnected?`unavailable`:`connecting`:`none`;switch(this.linkStatus?.phase??`noServer`){case`noServer`:return`none`;case`live`:return`connected`;case`connecting`:return this.serverTransportError?`unavailable`:`connecting`;default:return`unavailable`}}async waitForUpstreamServerConnection(){if(this!==this.ownerRuntime)return await this.ownerRuntime.waitForUpstreamServerConnection();if(!this.serverCarrierPromise){if(this.serverTransportError)throw this.serverTransportError;return}if(this.linkStatus?.outagePublished&&this.serverTransportError)throw this.serverTransportError;let e=this.linkStatus?.consecutiveFailures?this.waitForServerTransportError(`global`):null;try{await(e?Promise.race([this.serverCarrierPromise,e.promise]):this.serverCarrierPromise)}finally{e?.cancel()}}isClosed(){return this.ownerRuntime.closed}async close(){if(this!==this.ownerRuntime){this.closeRuntimeState();return}if(!this.physicalCloseStarted&&!(this.closed&&!this.foregroundLeaseQuiesced)){this.physicalCloseStarted=!0,this.closed=!0,this.clearCoreDeadline();for(let e of this.pendingNativeAdmissionCancels)e();for(let e of this.pendingNativeReadCancels)e();await this.foregroundLeaseCapture?.catch(()=>{}),this.pendingStreamingMutations.size>0&&await Promise.all(this.pendingStreamingMutations),this.pendingLocalSettlements.size>0&&await Promise.all(this.pendingLocalSettlements),await this.coreOperation?.completion.catch(()=>{}),this.closeRuntimeState(!0),await this.db.close?.()}}discard(){this.closeRuntimeState()}closeRuntimeState(e=!1){if(this.closed&&!e)return!1;this.closed=!0,this.clearCoreDeadline();for(let e of this.pendingNativeAdmissionCancels)e();for(let e of this.pendingNativeReadCancels)e();for(let[e,t]of this.subscriptions)this.terminateSubscription(e,t);if(this!==this.ownerRuntime)return this.subscriptions.clear(),!1;for(let e of this.writes.values())e.close?.();this.subscriptions.clear(),this.pendingTxs.clear(),this.completedTxs.clear(),this.writes.clear(),this.serverConnectionGeneration+=1,this.clearLinkTimer(),this.linkAttemptId=null,this.settleLinkConnection(Error(`server transport disconnected`)),this.stopNativeLinkPoll(),this.linkChanged();let t=this.serverConnectionAttempt;this.serverConnectionAttempt=null,t&&this.finishServerConnectionAttempt(t,Error(`runtime closed`)),this.serverCarrierPromise=null,this.clearServerTransportErrorWaiters(),this.resolveServerTransportWorkWaiters(),this.peerTransportWorkListeners.clear(),this.localSettlementListeners.clear(),this.pendingInboundServerFrames.length=0;let n=this.serverTransport;return this.serverTransport=null,n&&this.retirePeerTransport(n).catch(tC),this.peerUpstreamAttached=!1,this.serverCarrier?.close(),this.serverCarrier=null,!0}previewInsert(e,t,n){let r=this.rowStateFromValues(e,n?XS(n):Ml(16),t);return{id:r.id,values:r.values}}insert(e,t,n,r){this.assertMutationAdmission(`Insert`);let i=r?XS(r):void 0,a=zb(n);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(n),c=Hb(n),l=Ib(n);Rb(s,l);let u=this.currentTx(n,`Insert`);u&&this.assertTransactionAttribution(u,s);let d=_S(this.table(e),t);if(u){this.assertTransactionWriteIdentity(u,s?void 0:o);let r=this.db.insertInTransaction(u.id,e,d,{rowId:i,branch:l?.head,updatedAtMs:c??void 0});if(!(r instanceof Uint8Array))throw Error(`Native runtime transaction insert did not return a row id`);let a=this.rowStateFromValues(e,r,t);return u.hasStagedMutations=!0,{id:a.id,values:a.values,kind:`staged`,openTransactionId:Fb(n)}}let f=jx(`Insert`,()=>bb(this.db.insert(e,d,{rowId:i,author:s?void 0:o,attribution:s,branch:l?.head,updatedAtMs:c??void 0})));return this.finishInsert(e,i??f.rowId,t,f)}async streamingMutation(e,t,n,r,i,a,o){let s=this.db.beginStreamingMutation,c=e===`insert`?`Insert`:e===`update`?`Update`:`Upsert`;this.assertMutationAdmission(c);let l=this.currentTx(a,c),u=zb(a);this.applySessionClaims(u);let d=this.trustedWriteIdentity(u),f=this.backendAttribution(a),p=Ib(a),m=Hb(a);if(Rb(f,p),l&&(this.assertTransactionAttribution(l,f),this.assertTransactionWriteIdentity(l,f?void 0:d)),!s)throw Error(`Native runtime does not expose streaming mutations`);let h=this.table(t),g=h.columns.find(e=>e.name===r)?.column_type.type;if(g!==`Text`&&g!==`Json`&&g!==`Bytea`)throw Error(`Streaming insert requires a Text, Json, or Bytea column: ${t}.${r}`);let _=o?XS(o):Ml(16),ee=e===`insert`?vS(h,n,r,t):yS(h,n,r),v=s.call(this.db,t,_,ee,r,e,f?void 0:d,f,m??void 0,p?.head,p?.base,l?.id);if(l&&!v.finishInTransaction)throw await v.abort(),Error(`This native runtime does not support streaming inside a transaction yet`);let y=this.ownerRuntime,te,ne=new Promise(e=>{te=e});y.pendingStreamingMutations.add(ne);let re=new TextEncoder,b=async e=>{for(let t=0;t<e.byteLength;t+=65536)await v.push(e.subarray(t,t+65536))},x=``;try{for await(let e of g_(i))if(typeof e==`string`){if(g===`Bytea`)throw Error(`Bytea streams require Uint8Array chunks`);let t=x+e;x=``;let n=t.charCodeAt(t.length-1);n>=55296&&n<=56319&&(x=t.slice(-1),t=t.slice(0,-1)),t.length>0&&await b(re.encode(t))}else if(e instanceof Uint8Array)x&&=(await b(re.encode(x)),``),await b(e);else throw Error(`Streaming insert chunks must be strings or Uint8Array values`);x&&await b(re.encode(x));let e=y.streamingFinalization,t,n=new Promise(e=>{t=e});y.streamingFinalization=e.then(()=>n),await e;let r;try{l?(await v.finishInTransaction(),l.hasStagedMutations=!0,r={kind:`staged`,openTransactionId:l.id}):r=this.finishMutation(await v.finish())}finally{t()}return{id:Nu(_),...r}}catch(e){throw await v.abort(),e}finally{te(),y.pendingStreamingMutations.delete(ne)}}restore(e,t,n,r){this.assertMutationAdmission(`Restore`);let i=XS(t),a=zb(r);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(r),c=Hb(r),l=Ib(r);Rb(s,l);let u=this.currentTx(r,`Restore`);u&&this.assertTransactionAttribution(u,s);let d=_S(this.table(e),n);if(u){this.assertTransactionWriteIdentity(u,s?void 0:o),this.db.restoreInTransaction(u.id,e,i,d,{branch:l?.head,updatedAtMs:c??void 0});let t=this.rowStateFromValues(e,i,n);return u.hasStagedMutations=!0,{id:t.id,values:t.values,kind:`staged`,openTransactionId:Fb(r)}}let f=jx(`Restore`,()=>bb(this.db.restore(e,i,d,{author:s?void 0:o,attribution:s,branch:l?.head,updatedAtMs:c??void 0})));return this.finishInsert(e,i,n,f)}update(e,t,n,r){this.assertMutationAdmission(`Update`);let i=XS(t),a=zb(r);this.applySessionClaims(a);let o=this.trustedWriteIdentity(a),s=this.backendAttribution(r),c=Hb(r),l=Ib(r);Rb(s,l);let u=this.currentTx(r,`Update`);u&&this.assertTransactionAttribution(u,s);let d=bS(this.table(e),n);if(u)return this.assertTransactionWriteIdentity(u,s?void 0:o),this.db.updateInTransaction(u.id,e,i,d,{head:l?.head,base:l?.base,updatedAtMs:c??void 0}),u.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Fb(r)};let f=jx(`Update`,()=>bb(this.db.update(e,i,d,{author:s?void 0:o,attribution:s,head:l?.head,base:l?.base,updatedAtMs:c??void 0})));return this.finishMutation(f)}updateLargeValues(e,t,n,r,i){this.assertMutationAdmission(`Update`);let a=XS(t),o=Hb(i),s=Ib(i),c=this.currentTx(i,`Update`);if(s)throw Error(`Partial-value updates (applyDiffs, editedFrom) are not yet supported in branch views.`);if(c){let t=zb(i);this.applySessionClaims(t);let s=this.trustedWriteIdentity(t),l=this.backendAttribution(i);this.assertTransactionAttribution(c,l),this.assertTransactionWriteIdentity(c,l?void 0:s);let u=this.db.updateLargeValuesInTransaction;if(!u)throw Mx(`Update`,`typed partial-value updates in transactions are not supported by this runtime`);let d=bS(this.table(e),n);return u.call(this.db,c.id,e,a,d,r,o??void 0),c.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Fb(i)}}if(Lb(i,this.peerIdentity))throw Error(`Partial-value updates (applyDiffs, editedFrom) do not yet support a session or attributed identity outside a transaction.`);let l=this.db.updateLargeValues;if(!l)throw Error(`Native runtime does not support typed partial-value updates.`);let u=bS(this.table(e),n),d=jx(`Update`,()=>l.call(this.db,e,a,u,r,o??void 0));return this.finishMutation(d)}upsert(e,t,n,r){this.assertMutationAdmission(`Upsert`);let i=XS(t),a=this.table(e),o=zb(r);this.applySessionClaims(o);let s=this.trustedWriteIdentity(o),c=this.backendAttribution(r),l=Hb(r),u=Ib(r);Rb(c,u);let d=this.currentTx(r,`Upsert`);d&&this.assertTransactionAttribution(d,c);let f;try{f=bS(a,n)}catch(e){throw Mx(`Upsert`,Nx(Px(e)))}if(d)return this.assertTransactionWriteIdentity(d,c?void 0:s),this.db.upsertInTransaction(d.id,e,i,f,{head:u?.head,base:u?.base,updatedAtMs:l??void 0}),d.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Fb(r)};let p=jx(`Upsert`,()=>bb(this.db.upsert(e,i,f,{author:c?void 0:s,attribution:c,head:u?.head,base:u?.base,updatedAtMs:l??void 0})));return this.finishMutation(p)}delete(e,t,n){this.assertMutationAdmission(`Delete`),this.table(e);let r=XS(t),i=zb(n);this.applySessionClaims(i);let a=this.trustedWriteIdentity(i),o=this.backendAttribution(n),s=Hb(n),c=Ib(n);Rb(o,c);let l=this.currentTx(n,`Delete`);if(l&&this.assertTransactionAttribution(l,o),l)return this.assertTransactionWriteIdentity(l,o?void 0:a),this.db.deleteInTransaction(l.id,e,r,{head:c?.head,base:c?.base,updatedAtMs:s??void 0}),l.hasStagedMutations=!0,{kind:`staged`,openTransactionId:Fb(n)};let u=jx(`Delete`,()=>bb(this.db.delete(e,r,{author:o?void 0:a,attribution:o,head:c?.head,base:c?.base,updatedAtMs:s??void 0})));return this.finishMutation(u)}canInsertLocally(e,t,n){return`unknown`}canReadLocally(e,t,n){return`unknown`}canUpdateLocally(e,t,n,r){return`unknown`}canDeleteLocally(e,t,n){return`unknown`}isScopedPermissionAdvice(e){return this.readAuthorizationHost!==`trusted-serving`||!e?!1:!(this.trustedBackend&&e.issuer===au&&e.user_id===Z_&&hu(e,mu(e)))}delegatedPermissionAdviceSession(e){if(!this.trustedBackend||!e||!this.isScopedPermissionAdvice(e))return null;try{return $b(JSON.stringify(e))}catch{return null}}explainReadClauses(e,t,n){if(!this.trustedBackend)throw Error(`explain runs only on a trusted backend`);let r=this.db.explainReadClauses;if(!r)throw Error(`explain is not supported yet by this runtime`);let i=$b(JSON.stringify(n));if(!i?.identity)throw Error(`explain needs a user to explain for`);return r.call(this.db,e,t,i.identity,i.claims)}requestInsertPermissionAdvice(e,t,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve(`unknown`);let r=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!r)return Promise.resolve(`unknown`);let i=this.db.requestInsertPermissionAdvice;if(!i)return Promise.resolve(`unknown`);let a=_S(this.table(e),t,e);return this.withPermissionAdviceTimeout(()=>i.call(this.db,e,a,r?.identity,r?.claims))}requestReadPermissionAdvice(e,t,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve(`unknown`);let r=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!r)return Promise.resolve(`unknown`);let i=this.db.requestReadPermissionAdvice;return i?this.withPermissionAdviceTimeout(()=>i.call(this.db,e,XS(t),r?.identity,r?.claims)):Promise.resolve(`unknown`)}requestUpdatePermissionAdvice(e,t,n,r){if(this.isScopedPermissionAdvice(r)&&!this.trustedBackend)return Promise.resolve(`unknown`);let i=this.delegatedPermissionAdviceSession(r);if(this.isScopedPermissionAdvice(r)&&!i)return Promise.resolve(`unknown`);let a=this.db.requestUpdatePermissionAdvice;if(!a)return Promise.resolve(`unknown`);let o=bS(this.table(e),n);return this.withPermissionAdviceTimeout(()=>a.call(this.db,e,XS(t),o,i?.identity,i?.claims))}requestDeletePermissionAdvice(e,t,n){if(this.isScopedPermissionAdvice(n)&&!this.trustedBackend)return Promise.resolve(`unknown`);let r=this.delegatedPermissionAdviceSession(n);if(this.isScopedPermissionAdvice(n)&&!r)return Promise.resolve(`unknown`);let i=this.db.requestDeletePermissionAdvice;return i?this.withPermissionAdviceTimeout(()=>i.call(this.db,e,XS(t),r?.identity,r?.claims)):Promise.resolve(`unknown`)}captureSnapshot(){if(this!==this.ownerRuntime)return this.ownerRuntime.captureSnapshot();if(this.closed)return Promise.reject(Error(`Cannot capture a snapshot: native runtime is closed`));if(!this.db.captureSnapshot)return Promise.reject(new Bl);let e=this.db.captureSnapshot();return this.scheduleCoreTick(),this.awaitNativeRead(e).then(e=>zl(Tb.decode(e)))}beginTransaction(e,t,n){if(this!==this.ownerRuntime)return this.ownerRuntime.beginTransaction(e,t,n);if(this.closed)throw Error(`Begin transaction failed: native runtime is closed`);if(this.pendingTxs.has(t)||this.completedTxs.has(t))throw Error(`Begin transaction failed: transaction ${t} has already been opened`);let r=zb(n);this.applySessionClaims(r);let i=this.trustedWriteIdentity(r),a=this.backendAttribution(n),o=a?void 0:i;return this.db.beginTransaction(t,e,o,a),this.pendingTxs.set(t,{id:t,kind:e,identity:o,requestSession:o?r??void 0:void 0,attribution:a,hasStagedMutations:!1}),t}hasStagedTransactionWrites(e){return this===this.ownerRuntime?this.pendingTxs.get(e)?.hasStagedMutations:this.ownerRuntime.hasStagedTransactionWrites(e)}commitTransaction(e){if(this!==this.ownerRuntime)return this.ownerRuntime.commitTransaction(e);if(this.closed)throw Error(`Commit transaction failed: native runtime is closed`);let t=this.pendingTxs.get(e);if(!t)throw Error(Wb(e,this.completedTxs));if(!t.hasStagedMutations&&t.kind===`mergeable`)throw Error(`Commit transaction failed: empty mergeable transaction has no committed unit; roll it back instead`);let n=this.db.commitTransaction(e,t.kind);this.pendingTxs.delete(e),this.completedTxs.set(e,{kind:t.kind,state:`committed`}),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork();let r=Pb(n,this.writes);return this.nonDurableClient&&this.trackLocalSettlement(r),r}async waitForTransaction(e,t,n={}){if(this!==this.ownerRuntime)return this.ownerRuntime.waitForTransaction(e,t,n);typeof e!=`string`&&(e=await e);let r=this.writes.get(e);if(!r)throw Error(`Wait for transaction failed: unknown transaction ${e}`);let{signal:i}=n,a=n.observeOnly?r.wait(t,!0):r.wait(t);if(a.catch(()=>{}),n.ready)if(i){let e,t=new Promise(t=>{e=()=>t(),i.addEventListener(`abort`,e,{once:!0})});try{await Promise.race([n.ready,t])}finally{i.removeEventListener(`abort`,e)}}else await n.ready;let o=a.then(()=>`settled`);for(o.catch(()=>{});;){if(this.closed)throw Error(`Wait for transaction failed: native runtime is closed`);i?.throwIfAborted(),this.throwServerTransportErrorForTier(t,!0);let n=this.serverTransportWorkEpoch;this.startServerPump(),this.throwServerTransportErrorForTier(t,!0);let r=this.waitForServerTransportError(t,!0),a=this.waitForServerTransportWork(t,n),s=this.waitForLocalStorageFailure(t),c;try{let e=[o];if(r&&e.push(r.promise),s&&e.push(s.promise),a&&e.push(a.promise.then(()=>`work`)),i&&e.push(new Promise(e=>{let t=()=>e(`work`);i.addEventListener(`abort`,t,{once:!0}),c=()=>i.removeEventListener(`abort`,t)})),await Promise.race(e)===`settled`){this.pumpSubscriptions();return}}catch(t){throw Ox(e,t)||t}finally{c?.(),r?.cancel(),a?.cancel(),s?.cancel()}}}rollbackTransaction(e){if(this!==this.ownerRuntime)return this.ownerRuntime.rollbackTransaction(e);let t=this.pendingTxs.get(e);if(!t)throw Error(Gb(e,this.completedTxs));try{this.db.rollbackTransaction(e)}finally{this.pendingTxs.delete(e)}return this.completedTxs.set(e,{kind:t.kind,state:`rolled_back`}),Promise.resolve(!0)}async query(e,t,n,r){if(this.closed||this.ownerRuntime.closed)throw Error(`Native runtime is closed`);Zb(n,r),this.noteFirstLoadWait(r),Kb(r,this.pendingTxs,this.completedTxs);let i=$b(t);sx(e);let a=Tx(e),o=qb(r,this.pendingTxs),s=Yb(n,ix(a),r),c=this.nativeReadContext(i,o),l=ox(a,this.schema);if(await this.ensureClientSessionClaims(i),await this.waitForStrictRemoteQueryTransport(n),await this.processPendingPeerActivityBeforeRead(),this.closed||this.ownerRuntime.closed)return[];if(o||this.attachLocalReadCoverageInBackground(n,l,i),this.emitQueryCoverageTrace(`attach`),ax(a)){if(o){let e=await this.readRowsForContextAsync(l,s,c,o.id);return this.emitQueryCoverageTrace(`covered`),OS(TS(e),this.schema,yx(a,this.schema).rootColumns)}let e=await this.readRowsForContextAsync(l,s,c);return this.emitQueryCoverageTrace(`covered`),OS(TS(e),this.schema,yx(a,this.schema).rootColumns)}let u=yx(a,this.schema).rootColumns,d=await this.readPlainRows(l,s,i??void 0,o);return this.emitQueryCoverageTrace(`covered`),ES(wS(d),this.schema,u)}createSubscription(e,t,n,r){Zb(n,r),this.noteFirstLoadWait(r);let i=$b(t),a=this.nativeReadContext(i);sx(e);let o=this.nextSubscriptionId++,s=Yb(n,ix(e),r);this.subscriptions.set(o,{openingAbort:new AbortController,reading:!1,outputColumns:yx(e,this.schema),tier:n??`local-first`,cancelled:!1});let c=this.subscriptions.get(o),l=ox(e,this.schema),u=e=>{let t=WS(e);if(c.cancelled||this.closed||this.ownerRuntime.closed){rx(t);return}c.source=t,c.callback&&this.startSubscriptionReader(o,c)},d=e=>{c.cancelled||this.failSubscription(c,e instanceof Error?e:Error(String(e)))},f=()=>{if(this.closed||this.ownerRuntime.closed)throw Error(`Native runtime is closed`);if(c.cancelled)throw Error(`native operation was cancelled`);let e=this.subscribeForContext(l,s,a);return wb(e)?this.awaitNativeOperation(e,c.openingAbort.signal):e};try{let e=this.ensureClientSessionClaims(i),t=e instanceof Promise?e.then(f):f();t instanceof Promise?t.then(u).catch(d):u(t)}catch(e){d(e)}return o}executeSubscription(e,t){let n=this.subscriptions.get(e);if(n){if(n.callback)throw Error(`Subscription has already been activated`);if(n.callback=t,n.terminalError){this.deliverSubscriptionFailure(n);return}this.startSubscriptionReader(e,n)}}unsubscribe(e){let t=this.subscriptions.get(e);t&&this.terminateSubscription(e,t)}connect(e,t){if(this!==this.ownerRuntime)return this.ownerRuntime.connect(e,t);if(this.db?.reconnectNativeUpstream){this.db.reconnectNativeUpstream(),this.nativeLinkEverConnected=!1,this.linkChanged();return}let n=Qy(t);this.assertCredentialKeepsPrincipal(n),this.nativeWireFeatures(),this.link??=this.createUpstreamLink(),this.serverEndpointUrl=e,this.serverAuthJson=n,this.linkCloseReason=`server transport replaced`,this.stepLink(this.linkStatus&&this.linkStatus.phase!==`noServer`?{type:`setOffline`,offline:!1}:{type:`serverConfigured`,configured:!0})}createUpstreamLink(){if(!this.db.createUpstreamLink)throw Error(`native runtime binding does not expose the upstream link machine; install the matching Jazz native runtime package`);return this.db.createUpstreamLink(Math.floor(Math.random()*(2**53-1)))}stepLink(e){if(this.linkInputs.push(e),!this.linkStepping){this.linkStepping=!0;try{for(let e=this.linkInputs.shift();e;e=this.linkInputs.shift()){if(this.closed||!this.link)continue;let t=JSON.parse(this.link.handle(Date.now(),JSON.stringify(e))),n=this.linkStatus;this.linkStatus=t.status;for(let e of t.actions)this.runLinkAction(e);this.applyLinkStatus(n,t.status);for(let e of t.events)e.type===`authFailed`&&this.authFailureCallback?.(e.reason);this.linkChanged()}}catch(e){throw this.linkInputs.length=0,e}finally{this.linkStepping=!1}}}runLinkAction(e){switch(e.type){case`connect`:this.runLinkAttempt(e.attempt);return;case`close`:{this.linkAttemptId===e.attempt&&(this.linkAttemptId=null);let t=this.serverConnectionAttempt;t?.id===e.attempt&&this.finishServerConnectionAttempt(t,Error(this.linkCloseReason),!1),this.pendingInboundServerFrames.length=0,this.serverPumpScheduled=!1,this.serverPumpAgain=!1;return}case`armTimer`:{this.clearLinkTimer();let t=e.token;this.linkTimer={token:t,handle:setTimeout(()=>{this.linkTimer?.token===t&&(this.linkTimer=null,this.stepLink({type:`timerFired`,token:t}))},e.afterMs)};return}case`cancelTimer`:this.linkTimer?.token===e.token&&this.clearLinkTimer();return}}applyLinkStatus(e,t){let n=this.linkFailure??Error(t.reason??`server transport failed`);switch(t.phase){case`live`:e?.outagePublished&&this.forgetServerTransportError();return;case`connecting`:case`backoff`:this.linkConnection||this.awaitLinkConnection(),t.outagePublished&&!e?.outagePublished&&this.handleServerTransportError(Error(n.message),void 0,!0);return;case`awaitingCredential`:case`stopped`:if(e?.phase!==t.phase){let e=t.phase===`awaitingCredential`&&!t.terminal;this.handleServerTransportError(n,void 0,e),this.serverTransportErrorAwaitsAuth=e,this.settleLinkConnection(n)}return;case`offline`:case`noServer`:this.settleLinkConnection(Error(`server transport disconnected`));return}}awaitLinkConnection(){let e=new Promise((e,t)=>{this.linkConnection={resolve:e,reject:t}});e.catch(()=>{}),this.serverCarrierPromise=e}settleLinkConnection(e){let t=this.linkConnection;this.linkConnection=null,e instanceof Error?(this.serverCarrierPromise=null,t?.reject(e)):(this.serverCarrierPromise=Promise.resolve(e),t?.resolve(e))}clearLinkTimer(){this.linkTimer&&clearTimeout(this.linkTimer.handle),this.linkTimer=null}endLinkAttempt(e,t,n){if(e.finished)return;let r=e.id===this.linkAttemptId;if(this.finishServerConnectionAttempt(e,t,!1),!(!r||this.closed)){this.linkAttemptId=null,this.pendingInboundServerFrames.length=0,this.linkFailure=t;try{this.stepLink({type:`ended`,attempt:e.id,failure:n})}finally{this.linkFailure=null}}}runLinkAttempt(e){this.linkAttemptId=e,this.linkConnection||this.awaitLinkConnection();let t=this.serverEndpointUrl,n=this.serverAuthJson;(async()=>{for(let e=this.serverReplacementRetirement;e;e=this.serverReplacementRetirement)await e,this.serverReplacementRetirement===e&&(this.serverReplacementRetirement=null);this.closed||this.linkAttemptId!==e||t===null||n===null||this.startServerConnection(e,t,n)})().catch(t=>{if(this.closed||this.linkAttemptId!==e)return;this.linkAttemptId=null;let n=t instanceof Error?t:Error(Px(t));this.linkFailure=n;try{this.stepLink({type:`ended`,attempt:e,failure:{kind:`fatal`,message:n.message}})}finally{this.linkFailure=null}})}startServerConnection(e,t,n){this.serverConnectionGeneration+=1;let r=this.serverConnectionGeneration,i=this.nativeWireFeatures(),a=Zy(n,this.peerIdentity);this.linkStatus?.outagePublished||this.forgetServerTransportError(),this.upstreamRefusal=null,this.linkChanged();let o,s=new Promise(e=>{o=e}),c=null,l=e=>{if(!c)return;let t=this.serverTransportError&&!this.linkStatus?.outagePublished?{kind:`fatal`,message:e.message}:Sb(e,c.carrier.hasNegotiated);this.endLinkAttempt(c,Error(e.message),t)},u=new Ly({WebSocket:this.webSocket,endpointUrl:t,peerIdentity:a,features:i,authJson:n,requestedLink:this.scopeIsolatedRelay?`scope_isolated_client_relay`:void 0,onFrame:e=>{r===this.serverConnectionGeneration&&(this.pendingInboundServerFrames.push(e),this.notifyServerTransportWork(),this.scheduleServerPump(),this.serverPumpRunning&&queueMicrotask(()=>{!this.serverPumpRunning||this.pendingInboundServerFrames.length===0||this.routePendingInboundServerFrames().catch(e=>this.handleServerTransportError(e,r))}))},onError:e=>{ay(e)||e.code===`websocket_closed`||e.code===`websocket_error`||e.code===`websocket_silent`||l(e)},onTerminal:l});c={id:e,generation:r,carrier:u,terminal:s,resolveTerminal:o,finished:!1,outcome:null,transport:null,retirement:null,admission:null},this.serverConnectionAttempt=c,this.serverCarrier=u;let d=()=>!this.closed&&r===this.serverConnectionGeneration&&u===this.serverCarrier&&c===this.serverConnectionAttempt;Promise.race([u.ready(),s.then(e=>{throw e})]).then(async t=>{if(!d()){u.close();return}if(!this.trustedBackend&&(await this.runWhenCoreIdle(()=>{if(d())return this.installClientSessionClaims(Xy(n))}),!d())){u.close();return}let i=this.connectNegotiatedUpstream(t).catch(e=>{throw Ix(`connecting the negotiated upstream transport`,e)});c.admission=i;let a=await Promise.race([i.then(e=>({type:`admitted`,transport:e})),s.then(e=>({type:`terminal`,error:e}))]);if(a.type===`terminal`)return;c.admission=null;let o=a.transport;if(!d()){u.close(),c.finished?await c.retirement:await this.retirePeerTransport(o);return}c.transport=o,this.serverTransport=o,o.setAuxiliaryTraceEnabled?.(this.auxiliaryTraceListeners.size>0),this.watchAuxiliaryOutbound(o,u,r).catch(e=>this.handleServerTransportError(e,r));let l=this.pumpServerTransport();l.catch(e=>this.handleServerTransportError(e,r)),this.pumpSubscriptions(),this.pinUpstreamPrincipal(n),this.stepLink({type:`admitted`,attempt:e}),await Promise.race([l.catch(()=>{}),new Promise(e=>setTimeout(e,0))]),d()&&this.settleLinkConnection(u)}).catch(e=>{let t=e instanceof Error?e:Error(Px(e));this.endLinkAttempt(c,t,{kind:`fatal`,message:t.message})})}async connectNegotiatedUpstream(e){let t=e.authority,n=this.db.connectUpstreamWithSession;if(!t||!n)return await this.db.connectUpstream();let r=Pl();return await n.call(this.db,e.protocolVersion,e.features,t.node,t.epoch,this.node,r)}nativeWireFeatures(){if(!this.db.wireFeatures)throw Error(`native runtime binding does not expose its wire feature mask; install the matching Jazz native runtime package`);let e=this.db.wireFeatures();if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw Error(`native binding returned invalid wire feature mask ${e}`);return e}nativeUpstreamConfigured(){return this===this.ownerRuntime?this.db.nativeConnectionStatus?.().configured===!0:this.ownerRuntime.nativeUpstreamConfigured()}async disconnect(e={}){if(this!==this.ownerRuntime)return this.ownerRuntime.disconnect(e);if(this.db?.disconnectNativeUpstream){this.db.disconnectNativeUpstream(),this.linkChanged();return}let t=this.serverTransport,n=this.serverConnectionAttempt,r=n?.transport;this.linkCloseReason=`server transport disconnected`,this.stepLink({type:`setOffline`,offline:!0}),this.linkCloseReason=`server transport replaced`,this.serverEndpointUrl=null,this.serverAuthJson=null,this.serverReplacementRetirement||this.forgetServerTransportError(),e.rejectWaiters??!0?this.resolveServerTransportErrorWaiters(Error(`server transport disconnected`)):this.clearServerTransportErrorWaiters(),this.resolveServerTransportWorkWaiters(),this.serverTransport=null;let i=[];n?.retirement&&i.push(n.retirement),t&&t!==r&&i.push(Promise.resolve().then(()=>this.retirePeerTransport(t))),this.linkChanged(),await Promise.all(i)}updateAuth(e){if(this!==this.ownerRuntime)return this.ownerRuntime.updateAuth(e);if(this.nativeAuthRefusalRenewable=!1,this.db?.rejectAuthUpdate)return this.db.rejectAuthUpdate();let t=Qy(e);this.assertCredentialKeepsPrincipal(t),this.serverEndpointUrl&&(this.serverAuthJson=t,this.stepLink({type:`credentialUpdated`}))}assertCredentialKeepsPrincipal(e){if(this!==this.ownerRuntime)return this.ownerRuntime.assertCredentialKeepsPrincipal(e);if(!this.upstreamPrincipal)return;let t=Qy(e);if(!eb(t))return;let n;try{n=Zy(t,this.peerIdentity)}catch{n=null}if(!n||!QS(n,this.upstreamPrincipal))throw Fx(`a credential refresh must keep the principal this store connects upstream as`)}pinUpstreamPrincipal(e){this.upstreamPrincipal||!eb(e)||(this.upstreamPrincipal=Zy(e,this.peerIdentity))}onAuthFailure(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onAuthFailure(e);this.authFailureCallback=e,this.db.onAuthRejected?.(e=>{this.nativeAuthRefusalRenewable=Tu(Du(e)),this.authFailureCallback?.(e)})}onMutationError(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onMutationError(e);this.mutationErrorCallback=e,this.db.onMutationError(e=>this.deliverMutationError(e))}onStorageFailure(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onStorageFailure(e);this.db.onStorageFailure?.(e)}onServerTransportError(e){if(this!==this.ownerRuntime)return this.ownerRuntime.onServerTransportError(e);this.serverTransportErrorCallback=e}endCredentialWait(){if(this!==this.ownerRuntime)return this.ownerRuntime.endCredentialWait();this.nativeAuthRefusalRenewable=!1;let e=this.serverTransportError;!e||!this.serverTransportErrorRetrying||(this.serverTransportErrorAwaitsAuth=!1,this.handleServerTransportError(e,this.serverConnectionGeneration,!1))}reportRemoteServerTransportError(e,t=!1){if(this!==this.ownerRuntime)return this.ownerRuntime.reportRemoteServerTransportError(e,t);this.handleServerTransportError(e,this.serverConnectionGeneration,t)}clearRemoteServerTransportError(){if(this!==this.ownerRuntime)return this.ownerRuntime.clearRemoteServerTransportError();this.serverTransportError&&(this.forgetServerTransportError(),this.linkChanged())}reportLocalStorageFailure(e){if(this!==this.ownerRuntime)return this.ownerRuntime.reportLocalStorageFailure(e);if(e===null){this.localStorageFailure=null;return}let t=Object.assign(Error(e),{code:`storage`});this.localStorageFailure=t;for(let e of this.localStorageFailureWaiters)e(t);this.localStorageFailureWaiters.clear()}waitForLocalStorageFailure(e){if(e!==`local`||!this.nonDurableClient)return null;if(this.localStorageFailure)return{promise:Promise.reject(this.localStorageFailure),cancel:()=>{}};let t,n=new Promise((e,n)=>{t=n});return this.localStorageFailureWaiters.add(t),{promise:n,cancel:()=>this.localStorageFailureWaiters.delete(t)}}reportRemoteMutationError(e){if(this!==this.ownerRuntime)return this.ownerRuntime.reportRemoteMutationError(e);this.deliverMutationError(e)}async waitForPendingWrites(e=`global`,t={}){if(this!==this.ownerRuntime)return this.ownerRuntime.waitForPendingWrites(e,t);if(!this.db.waitForPendingWrites)throw Error(`Native runtime lacks graceful sync shutdown; rebuild its bindings`);let{throughOutage:n=!1,signal:r}=t;r?.throwIfAborted(),await this.flushLocalSettlements(),this.throwServerTransportErrorForTier(e,n),this.startServerPump();let i=this.waitForServerTransportError(e,n),a=new AbortController,o=new Promise((e,t)=>{a.signal.addEventListener(`abort`,()=>t(a.signal.reason),{once:!0})});o.catch(()=>{});let s=new Promise(e=>{a.signal.addEventListener(`abort`,()=>e(),{once:!0})}),c=()=>a.abort(r?.reason);r?.addEventListener(`abort`,c,{once:!0});try{let{sync:n}=t,r=n?this.db.waitForSync?this.db.waitForSync(e,this.trustedWriteIdentity(zb(n.writeContext))??null):this.db.waitForPendingWrites(e,s,!0):this.db.waitForPendingWrites(e,s),c=this.awaitNativeRead(Promise.resolve(r).then(e=>e??new Uint8Array),void 0,a.signal);c.catch(()=>{});let l=[c,o];i&&l.push(i.promise),await Promise.race(l)}finally{i?.cancel(),r?.removeEventListener(`abort`,c),a.abort(Error(`waitForPendingWrites ended`))}}async flushLocalSettlements(){if(this!==this.ownerRuntime)return this.ownerRuntime.flushLocalSettlements();this.pendingLocalSettlements.size>0&&await Promise.all(this.pendingLocalSettlements)}onLocalSettlementChange(e){return this===this.ownerRuntime?(this.localSettlementListeners.add(e),e(this.pendingLocalSettlements.size>0),()=>this.localSettlementListeners.delete(e)):this.ownerRuntime.onLocalSettlementChange(e)}deliverMutationError(e){let t=e.transaction.transactionId;this.deliveredMutationErrors.has(t)||(this.deliveredMutationErrors.add(t),this.mutationErrorCallback?.(e))}trackLocalSettlement(e){if(this!==this.ownerRuntime)return this.ownerRuntime.trackLocalSettlement(e);let t;t=this.waitForTransaction(e,`local`,{observeOnly:!0}).catch(()=>{}).finally(()=>{if(this.pendingLocalSettlements.delete(t),this.pendingLocalSettlements.size===0)for(let e of this.localSettlementListeners)e(!1)});let n=this.pendingLocalSettlements.size===0;if(this.pendingLocalSettlements.add(t),n)for(let e of this.localSettlementListeners)e(!0)}finishInsert(e,t,n,r){let i=Pb(r,this.writes);this.nonDurableClient&&this.trackLocalSettlement(i),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork();let a=this.rowStateFromValues(e,t,n);return{id:a.id,values:a.values,kind:`committed`,txId:i}}finishMutation(e){let t=Pb(e,this.writes);return this.nonDurableClient&&this.trackLocalSettlement(t),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork(),{kind:`committed`,txId:t}}assertMutationAdmission(e){if(this.ownerRuntime.closed)throw Error(`${e} failed: native runtime is closed`)}rowStateFromValues(e,t,n){return z_(e,Nu(t),this.table(e).columns,n)}async readPlainRows(e,t,n,r){let i=this.nativeReadContext(n,r);return this.readRowsForContextAsync(e,t,i,r?.id)}readRowsForContext(e,t,n){let r=this.db.all(e,{...t,sync:!0},void 0,this.nativeReadAuthor(n),this.nativeReadClaims(n));if(typeof r.then==`function`)throw Error(`native read is asynchronous; use the asynchronous read boundary`);if(yb(r))throw Error(`native read is pending; use the asynchronous read boundary`);return r}async readRowsForContextAsync(e,t,n,r){return this.awaitNativeRead(this.startRowsForContext(e,t,n,r),t.tier)}startRowsForContext(e,t,n,r){let i=this.nativeReadAuthor(n);return this.db.all(e,t,r,i,this.nativeReadClaims(n))}nativeReadAuthor(e){return e.kind===`session-authority`?e.identity:void 0}nativeReadClaims(e){return e.kind===`session-authority`?e.claims:void 0}nativeReadContext(e,t){return this.trustedBackend&&(e?.backendAuthority||!e&&!t?.identity)?{kind:`backend-authority`}:this.readAuthorizationHost===`trusted-serving`?{kind:`session-authority`,identity:t?.identity??e?.identity??this.peerIdentity,claims:t?.requestSession?.claims??e?.claims}:{kind:`client-local`}}subscribeForContext(e,t,n){if(!this.db.subscribe)throw Error(`Native runtime does not support subscriptions`);let r=n.kind===`session-authority`?n.identity:void 0;return this.db.subscribe(e,t,r,this.nativeReadClaims(n))}async awaitNativeRead(e,t,n){let r=await e;if(!yb(r))return r;let i=()=>r.cancel();this.ownerRuntime.pendingNativeReadCancels.add(i);try{for(;;){if(this.closed||this.ownerRuntime.closed)throw Error(`native read was cancelled by runtime shutdown`);n?.throwIfAborted(),t&&this.throwServerTransportErrorForTier(t);let e=r.poll();if(e!==null)return e;this.startServerPump(),t&&this.throwServerTransportErrorForTier(t),await Dx(0)}}finally{this.ownerRuntime.pendingNativeReadCancels.delete(i),i(),this.ownerRuntime.scheduleCoreTick()}}trustedWriteIdentity(e){let t=this.readAuthorizationHost===`trusted-serving`;return e?!this.trustedBackend&&!t&&QS(e.identity,this.peerIdentity)?void 0:e.identity:t&&!this.trustedBackend?this.peerIdentity:void 0}backendAttribution(e){if(!this.trustedBackend||!e)return;let t;try{t=JSON.parse(e).attribution}catch{return}if(t===void 0)return;if(typeof t!=`string`||!eu(t))throw Error(`backend attribution must be a canonical author subject string`);let n=zb(e);if(!n)throw Error(`backend attribution requires a valid author`);return n.identity}awaitNativeOperation(e,t){let n=0,r,i=!1,a,o=()=>{n+=1,r?.()},s=()=>{i=!0,e.cancel(),o()};this.pendingNativeAdmissionCancels.add(s),t?.addEventListener(`abort`,s,{once:!0});let c=()=>{this.pendingNativeAdmissionCancels.delete(s),t?.removeEventListener(`abort`,s),e.cancel()},l=()=>{for(;;){if(this.closed||i||t?.aborted)throw Error(`native operation was cancelled`);if(a)throw a;let s=n,c=e.poll();if(c!=null)return c;if(this.pumpServerTransport().catch(e=>{a=e,o()}),n===s)return new Promise(e=>{r=e,n!==s&&e()}).then(()=>(r=void 0,l()))}};try{e.setWake(o);let t=l();return t instanceof Promise?t.finally(c):(c(),t)}catch(e){throw c(),e}}clientSessionClaimsKey;installClientSessionClaims(e){let t=tx(e);if(t===this.clientSessionClaimsKey)return;let n=this.db.setSessionClaims?.(e);if(n instanceof Promise)return n.then(()=>{this.clientSessionClaimsKey=t});this.clientSessionClaimsKey=t}ensureClientSessionClaims(e){if(this.closed||this.ownerRuntime.closed)throw Error(`Native runtime is closed`);if(!e||e.backendAuthority||this.readAuthorizationHost===`trusted-serving`||tx(e.claims)===this.clientSessionClaimsKey)return;let t=()=>{if(this.closed||this.ownerRuntime.closed)throw Error(`Native runtime is closed`);return this.installClientSessionClaims(e.claims)};return this.ownerRuntime.coreOperation?this.runWhenCoreIdle(t):t()}async waitForStrictRemoteQueryTransport(e){if(e!==`remote`)return;let t=this.serverEndpointUrl,n=Zy(this.serverAuthJson??`{}`,this.peerIdentity);for(;!this.hasUpstream();){this.throwServerTransportErrorForTier(`global`);let e=this.serverCarrierPromise;if(!e)return;let r=this.serverConnectionAttempt,i=e.then(()=>null,e=>e instanceof Error?e:Error(Px(e))),a=this.waitForServerTransportError(`global`),o=a?.promise.catch(e=>e instanceof Error?e:Error(Px(e))),s;try{s=await Promise.race([i,...r?.carrier===this.serverCarrier?[r.terminal]:[],...o?[o]:[]])}finally{a?.cancel()}if(this.closed)return;let c=this.serverEndpointUrl,l=this.serverAuthJson??`{}`;if(this.serverCarrierPromise&&(c!==t||!YS(n,Zy(l,this.peerIdentity))))throw Error(`server transport scope changed while waiting for remote query`);if(s){if((s.message===`server transport replaced`||s.message===`server transport disconnected`)&&this.serverCarrierPromise!==null||this.linkStatus?.phase===`connecting`&&this.serverCarrierPromise!==null)continue;throw s}}}async processPendingPeerActivityBeforeRead(){if(this.nonDurableClient)for(;!this.closed&&this.peerTransportProcessedActivityEpoch<this.peerTransportActivityEpoch;)await this.progressPeerTransport()}attachLocalReadCoverageInBackground(e,t,n){e!=null&&e!==`local-first`||this.nonDurableClient||!this.serverTransport||(async()=>{await this.serverCarrierPromise,!(this.closed||this.ownerRuntime.closed)&&(await this.waitForStrictRemoteQueryTransport(`remote`),!(this.closed||this.ownerRuntime.closed)&&await this.readRowsForContextAsync(t,Yb(`remote`,!1),this.nativeReadContext(n)))})().catch(()=>{})}admitLocalFirstSession(e,t,n){if(!this.trustedBackend||e.issuer!==ru||!e.account_id||!hu(e,mu(e)))throw Error(`Local-first native admission requires a verified account session`);if(!this.db.admitLocalFirstSession)throw Error(`Native runtime lacks local-first session admission`);this.db.admitLocalFirstSession(t,n,new Vl().decode(tu(e)))}applySessionClaims(e){!e||e.backendAuthority||this.readAuthorizationHost!==`trusted-serving`||!this.db.setIdentityClaims||this.db.setIdentityClaims(e.identity,e.claims)}table(e){let t=this.schema[e];if(!t)throw Error(`unknown table ${e}`);return t}currentTx(e,t){let n=Fb(e);if(!n)return;let r=this.pendingTxs.get(n);if(r)return r;throw Error(`${t} failed: WriteError("${Ub(n,this.completedTxs)}")`)}assertTransactionWriteIdentity(e,t){if(e.kind===`serializable`){if(e.identity&&(!t||!QS(e.identity,t)))throw Error(`Native runtime serializable transaction cannot mix write identities`);return}if(e.identity&&(!t||!QS(e.identity,t))||t&&!e.identity)throw Error(`Native runtime mergeable transaction cannot mix write identities`)}assertTransactionAttribution(e,t){if(!(!e.attribution&&!t)){if(!e.attribution)throw Error(`Native runtime transaction was opened without backend attribution`);if(!t||!QS(e.attribution,t))throw Error(`Native runtime backend-attributed transaction requires its original provenance subject`)}}pumpSubscriptions(){this.drainSubscriptionPool();for(let[e,t]of this.subscriptions)t.poolId===void 0&&this.startSubscriptionReader(e,t)}nativeSubscriptionPool(){return this.subscriptionPool===void 0&&(this.subscriptionPool=this.db.createSubscriptionPool?.()??null),this.subscriptionPool}drainSubscriptionPool(){let e=this.subscriptionPool;if(!(!e||this.pooledSubscriptions.size===0)){if(this.drainingSubscriptionPool){this.subscriptionPoolDirty=!0;return}this.drainingSubscriptionPool=!0;try{do{this.subscriptionPoolDirty=!1;for(let t of e.drain())this.applyPooledBatch(t)}while(this.subscriptionPoolDirty&&!this.closed)}finally{this.drainingSubscriptionPool=!1}}}applyPooledBatch(e){let t=this.pooledSubscriptions.get(e.id);if(t===void 0)return;let n=this.subscriptions.get(t),r=()=>n!==void 0&&!n.cancelled&&this.subscriptions.get(t)===n;if(!n||!r()){this.pooledSubscriptions.delete(e.id);return}for(let i of e.events){if(!r())break;try{this.applySubscriptionChunk(t,n,i)}catch(e){this.failSubscription(n,e instanceof Error?e:Error(String(e)))}}if(e.error&&(this.pooledSubscriptions.delete(e.id),!this.closed&&r())){let t=Error(e.error.message);t.code=e.error.code,this.failSubscription(n,t)}r()||this.pooledSubscriptions.delete(e.id)}withPermissionAdviceTimeout(e){if(this!==this.ownerRuntime)return this.ownerRuntime.withPermissionAdviceTimeout(e);if(this.closed||(!this.serverTransport||!this.serverCarrier)&&!this.nativeUpstreamConfigured())return Promise.resolve(`unknown`);let t=e(),n=xb(t)?{promise:this.awaitNativePermissionAdvice(t),cancel:()=>t.cancel()}:typeof t==`string`?{promise:Promise.resolve(t===`allowed`||t===`denied`||t===`unknown`?t:`unknown`),cancel:()=>{}}:t;return new Promise(e=>{let t=!1,r=n=>{t||(t=!0,clearTimeout(i),e(n))},i=setTimeout(()=>{n.cancel(),r(`unknown`)},2e3);n.promise.then(r,()=>r(`unknown`))})}async awaitNativePermissionAdvice(e){for(;;){if(this.closed)return e.cancel(),`unknown`;let t=e.poll();if(t!==null)return t===`allowed`||t===`denied`||t===`unknown`?t:`unknown`;await this.pumpServerTransport(),await Dx(0)}}clearCoreDeadline(){this.coreDeadlineTimer!==void 0&&clearTimeout(this.coreDeadlineTimer),this.coreDeadlineTimer=void 0,this.coreDeadlineAt=void 0}scheduleCoreWake(e){if(this.coreProgressAllowed()){if(e===`after-current-turn`){setTimeout(()=>this.scheduleCoreWake(`immediate`),0);return}if(e.startsWith(`after:`)){let t=Number(e.slice(6));if(!Number.isSafeInteger(t)||t<0)return;let n=performance.now()+t;if(this.coreDeadlineAt!==void 0&&this.coreDeadlineAt<=n)return;this.clearCoreDeadline(),this.coreDeadlineAt=n,this.coreDeadlineTimer=setTimeout(()=>{this.coreDeadlineTimer=void 0,this.coreDeadlineAt=void 0,this.scheduleCoreWake(`immediate`)},t);return}if(this.notifyPeerTransportWork(),e===`immediate`){this.scheduleCoreTick();return}queueMicrotask(()=>{this.scheduleCoreTick()})}}scheduleCoreTick(){if(this.coreProgressAllowed()){if(this.coreOperation){this.coreTickAgain=!0;return}this.coreTickScheduled||(this.coreTickScheduled=!0,queueMicrotask(()=>{if(this.coreTickScheduled=!1,this.coreProgressAllowed()){if(this.coreOperation){this.coreTickAgain=!0;return}this.runCoreTick().catch(e=>{try{if(this.db.isNativeForegroundClosed?.())return}catch(e){tC(e);return}this.serverTransport!==null||this.serverEndpointUrl!==null?this.handleServerTransportError(e):tC(e)})}}))}}runCoreTick(){if(!this.coreProgressAllowed())return Promise.resolve();let e=this.coreOperation;if(e)return this.coreTickAgain=!0,e.kind===`tick`?e.completion:e.completion.then(()=>this.runCoreTick());let t,n,r=new Promise((e,r)=>{t=e,n=r});return this.coreOperation={kind:`tick`,completion:r},this.driveCoreTicks().then(t,n),r}reportSlowQueries(){let e=this.ownerRuntime;for(let t of this.db.takeSlowQueryReport?.(e.slowQueryApp)??[]){if(e.slowQueryConsoleDetail!==`summary`){console.warn(`[jazz] ${t}`);continue}let n=Ab(t);if(n===t){console.warn(`[jazz] ${t}`);continue}console.warn(`[jazz] ${n}. Plan and SQL are logged at the debug ("Verbose") level.`),console.debug(`[jazz] ${t}`)}}async driveCoreTicks(){let e=!1;try{for(let t=0;;t+=1){this.coreTickAgain=!1;try{await this.db.tick()}catch(e){throw new O_(e)}if(this.syncStatusPublisher.changed(),this.reportSlowQueries(),this.pumpSubscriptions(),this.scheduleServerPump(),this.notifyPeerTransportWork(),!this.coreProgressAllowed()||!this.coreTickAgain)break;if(t+1>=vb){e=!0;break}}}finally{this.drainTransportRetirements(),this.coreOperation=null}e&&this.coreProgressAllowed()&&setTimeout(()=>this.scheduleCoreTick(),0)}drainTransportRetirements(){let e=[...this.pendingTransportRetirements];this.pendingTransportRetirements.clear();for(let[t,n]of e)try{t.close();for(let e of n)e.resolve()}catch(e){for(let t of n)t.reject(e)}}startSubscriptionReader(e,t){let n=t.source;if(t.cancelled||t.reading||!t.callback||!n)return;if(t.poolId!==void 0){this.drainSubscriptionPool();return}let r=n.joinPool?this.nativeSubscriptionPool():null;if(r&&n.joinPool){let i=n.joinPool(r);t.poolId=i,this.pooledSubscriptions.set(i,e),this.drainSubscriptionPool();return}t.reading=!0,this.readSubscription(e,t,n)}readSubscription(e,t,n){let r=()=>!t.cancelled&&this.subscriptions.get(e)===t,i=()=>{t.reading=!1},a=e=>{!this.closed&&r()&&this.failSubscription(t,e instanceof Error?e:Error(String(e))),i()},o=n=>{if(n.type===`closed`||!r())return n.type===`closed`&&this.terminateSubscription(e,t),i(),!1;if(n.type===`pending`)return this.pumpServerTransport().then(()=>Dx(Math.max(0,n.retryAfterMs))).then(s).catch(a),!1;for(let a of n.events){if(!r())return i(),!1;try{this.applySubscriptionChunk(e,t,a)}catch(e){this.failSubscription(t,e instanceof Error?e:Error(String(e)))}}return n.events.length===0||!r()?(i(),!1):!0},s=()=>{for(;r();){let e;try{e=n.pull(e=>{o(e)&&s()},a)}catch(e){a(e);return}if(e===void 0||!o(e))return}i()};s()}applySubscriptionChunk(e,t,n){let r=VS(n);if(r.type===`closed`){this.terminateSubscription(e,t);return}if(r.type===`rejected`){if(r.reason.type===`ShapeRegistrationPendingCatalogueAdmission`)return;this.failSubscription(t,US(r.reason));return}let i=jS(r.delta,this.schema,r.reset===!0,t.outputColumns);i.terminalOperations=bx(r.terminalOperations,t.outputColumns?.rootColumns),t.callback?.(i)}scheduleServerPump(){if(!(this.closed||!this.serverTransport)){if(this.serverPumpRunning){this.serverPumpAgain=!0;return}this.serverPumpScheduled||(this.serverPumpScheduled=!0,setTimeout(()=>{this.serverPumpScheduled=!1,!this.closed&&this.startServerPump()},hb))}}startServerPump(){let e=this.serverConnectionGeneration;this.pumpServerTransport().catch(t=>this.handleServerTransportError(t,e))}notifyPeerTransportWork(e=!1){for(let t of this.peerTransportWorkListeners)t(e)}hasUpstream(){return this.serverTransport!=null||this.peerUpstreamAttached}async pumpServerTransport(){let e=this.serverTransport,t=this.serverCarrier,n=this.serverConnectionGeneration;if(!(this.closed||!e||!t)){if(this.serverPumpRunning){this.serverPumpAgain=!0;return}this.serverPumpRunning=!0;try{let r=this.pendingInboundServerFrames.length>0?await this.routePendingInboundServerFrames():!1;r||=this.serverInboundProcessed,this.serverInboundProcessed=!1;for(let i=0;i<32;i+=1){if(await this.runCoreTick(),this.flushAuxiliaryOutbound(e,t,n),(r||this.serverInboundProcessed)&&(r=!1,this.serverInboundProcessed=!1,this.notifyServerTransportWork(),queueMicrotask(()=>this.notifyServerTransportWork())),this.closed||n!==this.serverConnectionGeneration||e!==this.serverTransport||t!==this.serverCarrier||this.stopRefusedUpstream(e))return;let i=Mb(e.recvWireFrames());if(i.length>0&&this.sendServerFrames(i,t,n),this.pumpSubscriptions(),i.length===0)return}this.serverPumpAgain=!0}finally{this.serverPumpRunning=!1,this.serverPumpAgain&&(this.serverPumpAgain=!1,this.scheduleServerPump())}}}stopRefusedUpstream(e){let t=E_(e.upstreamRefusal?.());if(!t)return!1;let n=this.serverConnectionAttempt;return!n||n.transport!==e?!1:(this.upstreamRefusal=t,this.endLinkAttempt(n,t,{kind:`fatal`,message:t.message}),!0)}async routePendingInboundServerFrames(){let e=!1,t=this.serverInboundRouting.then(async()=>{let t=this.serverTransport,n=this.serverCarrier,r=this.serverConnectionGeneration;if(!t||this.pendingInboundServerFrames.length===0)return;let i=this.pendingInboundServerFrames.splice(0);e=!0,this.serverInboundProcessed=!0;let a=[];for(let e of i){let i=t.routeAuxiliaryWireFrame?await t.routeAuxiliaryWireFrame(e):e;if(n&&this.refreshAuxiliaryReceiveDeadline(t,n,r),t!==this.serverTransport||r!==this.serverConnectionGeneration)return;i!=null&&a.push(Nb(i))}if(this.publishAuxiliaryTrace(t),a.length>0)if(t.sendWireFrames)t.sendWireFrames(a);else for(let e of a)t.sendWireFrame(e);this.notifyPeerTransportWork(!0),n&&this.flushAuxiliaryOutbound(t,n,this.serverConnectionGeneration)});return this.serverInboundRouting=t.then(()=>{},()=>{}),await t,e}refreshAuxiliaryReceiveDeadline(e,t,n){if(this.closed||e!==this.serverTransport||n!==this.serverConnectionGeneration)return;let r=this.auxiliaryReceiveDeadlines.get(e);r||(r=new uh(e,r=>{if(this.closed||e!==this.serverTransport||n!==this.serverConnectionGeneration)return;let i=r instanceof Error?r:Error(Px(r)),a=this.serverConnectionAttempt;a?.transport===e?this.finishServerConnectionAttempt(a,i):(t.close(),this.handleServerTransportError(i,n),this.retirePeerTransport(e).catch(tC))}),this.auxiliaryReceiveDeadlines.set(e,r)),r.refresh()}flushAuxiliaryOutbound(e,t,n){let r=e.recvAuxiliaryWireFrames;if(!r)return;let i=Mb(r.call(e));i.length>0&&this.sendServerFrames(i,t,n),this.publishAuxiliaryTrace(e)}publishAuxiliaryTrace(e){let t=e.takeAuxiliaryTrace?.();if(!(!t||t.length===0))for(let e of this.auxiliaryTraceListeners)e(t)}async watchAuxiliaryOutbound(e,t,n){for(;!this.closed&&e===this.serverTransport&&t===this.serverCarrier&&n===this.serverConnectionGeneration;){let r=e.auxiliaryOutboundReady?.();if(!r||typeof r==`boolean`||(await r,e!==this.serverTransport||t!==this.serverCarrier))return;this.flushAuxiliaryOutbound(e,t,n)}}sendServerFrames(e,t,n){n!==this.serverConnectionGeneration||t!==this.serverCarrier||t.sendBatch(e).catch(e=>{this.handleServerTransportError(e,n)})}forgetServerTransportError(){this.serverTransportError=null,this.serverTransportErrorRetrying=!1,this.serverTransportErrorAwaitsAuth=!1}handleServerTransportError(e,t=this.serverConnectionGeneration,n=!1){if(t!==this.serverConnectionGeneration&&(this.closed||!k_(e)))return;let r=Px(e);if(this.serverTransportError&&r===`websocket closed`){if(n||!this.serverTransportErrorRetrying)return;e=this.serverTransportError}e===this.serverTransportError&&this.serverTransportErrorAwaitsAuth&&(n=!0),this.serverTransportErrorAwaitsAuth=!1;let i=this.serverTransportError===null||this.serverTransportErrorRetrying&&!n;this.serverTransportError=e instanceof Error?e:Error(r),this.serverTransportErrorRetrying=n,this.linkChanged(),n||this.failRemoteSubscriptions(this.serverTransportError),this.resolveServerTransportErrorWaiters(this.serverTransportError,n),i&&this.serverTransportErrorCallback?.(this.serverTransportError,{retrying:n})}finishServerConnectionAttempt(e,t,n=!0){if(e.finished)return;e.finished=!0,this.linkChanged(),e.outcome=t,e.resolveTerminal(t);let r=e===this.serverConnectionAttempt&&e.generation===this.serverConnectionGeneration&&e.carrier===this.serverCarrier;r&&(this.serverConnectionGeneration+=1,this.serverConnectionAttempt=null,this.serverCarrier=null),e.carrier.close();let i=e.transport;if(e.transport=null,i){i===this.serverTransport&&(this.serverTransport=null);try{if(this.coreOperation){let t=Promise.resolve(this.retirePeerTransport(i));e.retirement=t,t.catch(e=>{this.closed||this.handleServerTransportError(e)})}else this.retirePeerTransport(i),e.retirement=null}catch(t){let n=Promise.reject(t);e.retirement=n,n.catch(e=>{this.closed||this.handleServerTransportError(e)})}}if(e.admission){let t=e.admission;e.admission=null,e.retirement=t.then(e=>this.retirePeerTransport(e),()=>{}),e.retirement.catch(e=>{this.closed||this.handleServerTransportError(e)})}e.retirement&&(this.serverReplacementRetirement=Cb(this.serverReplacementRetirement,e.retirement),this.serverReplacementRetirement.catch(()=>{})),r&&(n&&this.handleServerTransportError(t),this.resolveServerTransportWorkWaiters())}failRemoteSubscriptions(e){for(let t of this.subscriptions.values())t.cancelled||t.tier===`remote`&&this.failSubscription(t,e)}terminateSubscription(e,t){this.subscriptions.get(e)===t&&this.subscriptions.delete(e),this.retireSubscriptionResources(t)}failSubscription(e,t){e.cancelled||(e.terminalError=t,this.retireSubscriptionResources(e),this.deliverSubscriptionFailure(e))}retireSubscriptionResources(e){if(e.cancelled)return;e.cancelled=!0,e.poolId!==void 0&&this.pooledSubscriptions.delete(e.poolId),e.openingAbort?.abort();let t=e.source;if(e.source=void 0,t)try{rx(t)}catch(e){console.error(`Jazz subscription source cleanup failed`,e)}}deliverSubscriptionFailure(e){if(!(!e.callback||!e.terminalError||e.terminalErrorDelivered)){e.terminalErrorDelivered=!0;try{e.callback(e.terminalError)}catch(e){setTimeout(()=>{throw e},0)}}}serverTransportErrorFor(e){return e&&this.serverTransportErrorRetrying?null:this.serverTransportError}throwServerTransportErrorForTier(e,t=!1){if(e!==`global`&&e!==`remote`)return;let n=this.serverTransportErrorFor(t);if(n)throw n}waitForServerTransportError(e,t=!1){if(e!==`global`&&e!==`remote`)return null;let n=this.serverTransportErrorFor(t);if(n)return{promise:Promise.reject(n),cancel:()=>{}};let r={active:!0,throughOutage:t,reject:()=>{}},i=new Promise((e,t)=>{r.reject=t});return this.serverTransportErrorWaiters.push(r),{promise:i,cancel:()=>{if(!r.active)return;r.active=!1;let e=this.serverTransportErrorWaiters.indexOf(r);e>=0&&this.serverTransportErrorWaiters.splice(e,1)}}}resolveServerTransportErrorWaiters(e,t=!1){let n=this.serverTransportErrorWaiters.splice(0);for(let r of n)r.active&&(t&&r.throughOutage?this.serverTransportErrorWaiters.push(r):r.reject(e))}clearServerTransportErrorWaiters(){for(let e of this.serverTransportErrorWaiters)e.active=!1;this.serverTransportErrorWaiters.length=0}waitForServerTransportWork(e,t){if(e!==`global`&&e!==`remote`)return null;if(this.serverTransportWorkEpoch!==t)return{promise:Promise.resolve(),cancel:()=>{}};let n={active:!0,resolve:()=>{}},r=new Promise(e=>{n.resolve=e});return this.serverTransportWorkWaiters.push(n),{promise:r,cancel:()=>{if(!n.active)return;n.active=!1;let e=this.serverTransportWorkWaiters.indexOf(n);e>=0&&this.serverTransportWorkWaiters.splice(e,1)}}}notifyServerTransportWork(){this.serverTransportWorkEpoch+=1,this.resolveServerTransportWorkWaiters()}resolveServerTransportWorkWaiters(){let e=this.serverTransportWorkWaiters.splice(0);for(let t of e)t.active&&t.resolve()}};function Mb(e){return e.filter(e=>ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`)}function Nb(e){let t=Mb([e])[0];if(!t)throw Error(`native transport returned a non-byte wire frame`);return t}function Pb(e,t){let n=e.txId;return t.set(n,e),n}function Fb(e){if(e)try{let t=JSON.parse(e);return typeof t.transaction_id==`string`?t.transaction_id:void 0}catch{return}}function Ib(e){if(e)try{let t=JSON.parse(e);if(!t.branch_view||typeof t.branch_view!=`object`)return;let n=t.branch_view;return n.head==null?void 0:{head:n.head,base:n.base}}catch{return}}function Lb(e,t){if(!e)return!1;let n;try{if(n=JSON.parse(e),n.attribution!==void 0)return!0;if(!(n.issuer!==void 0||n.user_id!==void 0||n.session!==void 0))return!1}catch{return!1}try{let n=zb(e);return n===null||!QS(n.identity,t)}catch{return!0}}function Rb(e,t){if(e&&t)throw Error(`Backend-attributed writes do not support branch views`)}function zb(e){if(!e)return null;try{let t=JSON.parse(e);if(t.attribution===Z_)throw Error(`Native runtime public session uses reserved issuer`);let n=typeof t.attribution==`string`?eu(t.attribution):null;if(n?.issuer===au)throw Error(`Native runtime public session uses reserved issuer`);let r=n?.user_id??(typeof t.user_id==`string`?t.user_id:typeof t.session?.user_id==`string`?t.session.user_id:void 0);if(!r||!Ql(r))return null;let i=n?.issuer??t.session?.issuer??t.issuer;if(typeof i!=`string`||!Ql(i))throw Error(`session is missing issuer`);let a={account_id:Qb(n?n.account_id:(t.session??t).account_id),issuer:i,user_id:r,authMode:typeof t.session?.authMode==`string`?t.session.authMode:typeof t.authMode==`string`?t.authMode:`external`};Bb(a.issuer,a.user_id,a.authMode,t.session?.[cu]??t[cu],a.account_id);let o=t.session?.[cu]??t[cu],s=nx(t.session?.claims??t.claims,a);return{...a,claims:s,identity:tu(a),backendAuthority:a.issuer===au&&a.user_id===Z_&&hu(a,o)}}catch(e){if(e instanceof Error&&(e.message===`session is missing issuer`||e.message===`session has invalid account_id`||e.message===`Native runtime public session uses reserved issuer`))throw e;return null}}function Bb(e,t,n,r,i){if(su(e)&&!((n===`local-first`||n===`anonymous`||n===`external`)&&hu({issuer:e,user_id:t,authMode:n,account_id:i},r)))throw Error(`Native runtime public session uses reserved issuer`)}function Vb(e){if(!e)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t.updated_at==`number`){if(!Number.isSafeInteger(t.updated_at)||t.updated_at<0)throw Error(`updatedAt must be a nonnegative safe integer`);return t.updated_at}}function Hb(e){return Vb(e)??null}function Ub(e,t){return t.get(e)?.state===`committed`?`open transaction ${e} is already committed`:`open transaction ${e} has already been completed or was never opened`}function Wb(e,t){let n=Ub(e,t);return t.get(e)?.state===`committed`?`Write error: ${n}`:`Commit transaction failed: Write error: ${n}`}function Gb(e,t){let n=Ub(e,t);return t.get(e)?.state===`committed`?`Write error: ${n}`:`Rollback transaction failed: Write error: ${n}`}function Kb(e,t,n){let r=Jb(e);if(!(!r||t.has(r)))throw Error(`Query setup failed: Write error: ${Ub(r,n)}`)}function qb(e,t){let n=Jb(e);return n?t.get(n):void 0}function Jb(e){if(e)try{let t=JSON.parse(e);return typeof t.transaction_id==`string`?t.transaction_id:void 0}catch{return}}function Yb(e,t=!1,n){let r=n==null?{}:JSON.parse(n),i={};e!=null&&(i.tier=e),t&&(i.include_deleted=!0),typeof r.first_load_remote_wait_ms==`number`&&r.first_load_remote_wait_ms>0&&(i.first_load_remote_wait_ms=r.first_load_remote_wait_ms);let a=r.read_view??r.readView;return a!=null&&(i.read_view=a),Array.isArray(r.splices)&&r.splices.length>0&&(i.splices=r.splices),i}function Xb(e){if(e==null)return!1;try{let t=JSON.parse(e);return typeof t.first_load_remote_wait_ms==`number`&&t.first_load_remote_wait_ms>0}catch{return!1}}function Zb(e,t){if(e!=null&&![`local-first`,`remote`,`local-only`].includes(e))throw Error(`Native runtime received unsupported read tier '${e}'`);t!=null&&JSON.parse(t)}function Qb(e){if(e!==void 0){if(typeof e!=`string`||!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(e))throw Error(`session has invalid account_id`);return e}}function $b(e){if(e==null)return null;let t=JSON.parse(e);if(typeof t.user_id!=`string`||!Ql(t.user_id))throw Error(`Native runtime session is missing user_id`);if(typeof t.issuer!=`string`||!Ql(t.issuer))throw Error(`Native runtime session is missing issuer`);let n={account_id:Qb(t.account_id),issuer:t.issuer,user_id:t.user_id,authMode:typeof t.authMode==`string`?t.authMode:`external`};Bb(n.issuer,n.user_id,n.authMode,t[cu],n.account_id);let r=n.issuer===au&&n.user_id===Z_&&hu(n,t[cu]);return{...n,claims:nx(t.claims,n),identity:tu(n),backendAuthority:r}}function ex(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tx(e){return e===null||typeof e==`boolean`||typeof e==`string`?JSON.stringify(e):typeof e==`number`?Number.isFinite(e)?JSON.stringify(e):`null`:Array.isArray(e)?`[${e.map(tx).join(`,`)}]`:ex(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${tx(e[t])}`).join(`,`)}}`:`null`}function nx(e,t){return{...ex(e)?e:{},iss:t.issuer,sub:t.user_id}}function rx(e){e.close()}function ix(e){try{return JSON.parse(e).include_deleted===!0}catch{return!1}}function ax(e){try{let t=JSON.parse(e).array_subqueries;return Array.isArray(t)&&t.length>0}catch{return!1}}function ox(e,t){return Wx(e,t)}function sx(e){if(cx(e))throw Error(`Native runtime does not support permission-introspection query columns or predicates ($canRead) until unified policy lowering exists.`)}function cx(e){let t=JSON.parse(e);return px(t.select_columns??t.select)||mx(t.conditions)||lx(t.relation_ir)||ux(t.relation_ir)||hx(t.array_subqueries)}function lx(e){return _x(e)}function ux(e){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e))return e.some(ux);let t=e,n=t.Project;if(n&&typeof n==`object`){let e=n.columns;if(Array.isArray(e))for(let t of e){if(!t||typeof t!=`object`)continue;let e=t,n=fx(e.expr??e.source);if(n&&F_(n))return!0}}return Object.values(t).some(ux)}function dx(e){if(!e||typeof e!=`object`)return null;let t=e;return dS(t.left??t.column)}function fx(e){return!e||typeof e!=`object`?null:`Column`in e?dS(e.Column):dS(e)}function px(e){return Array.isArray(e)?e.some(e=>typeof e==`string`&&F_(vx(e))):!1}function mx(e){return Array.isArray(e)?e.some(_x):!1}function hx(e){return Array.isArray(e)?e.some(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return px(t.select_columns??t.select)||gx(t.filters)||hx(t.nested_arrays)}):!1}function gx(e){return Array.isArray(e)?e.some(_x):!1}function _x(e){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e))return e.some(_x);let t=e;if(typeof t.op==`string`&&typeof t.column==`string`&&F_(vx(t.column)))return!0;for(let e of[`Eq`,`Ne`,`Gt`,`Ge`,`Lt`,`Le`,`IsNull`,`IsNotNull`,`Contains`]){let n=t[e];if(!n||typeof n!=`object`)continue;let r=n.column;if(typeof r==`string`&&F_(vx(r)))return!0}let n=dx(t.Cmp)??dx(t.In)??dx(t.IsNull)??dx(t.IsNotNull)??dx(t.Contains);return n&&F_(vx(n))?!0:Object.entries(t).some(([e,t])=>e!==`Literal`&&_x(t))}function vx(e){return j_(e)}function yx(e,t){let n=JSON.parse(e);if(typeof n.table!=`string`)throw Error(`Native runtime only supports table queries in this slice`);return{rootTable:n.table,rootColumns:wx(n.table,t,Jx(n.select_columns??n.select),Xx(n.array_subqueries,n.table,t)??[])}}function bx(e,t){if(!(!e||e.length===0))return e.map(e=>{let n=t,r,i=e.path.map(e=>{if(`Key`in e)return{Key:xx(e.Key)};if(!n)throw Error(`native terminal collection path requires subscription output columns`);let t=e.Collection.startsWith(R_)?e.Collection.slice(R_.length):e.Collection,i=n.findIndex(e=>e.name===t),a=n[i]?.column_type;if(a?.type!==`Array`||a.element.type!==`Row`)throw Error(`native terminal operation addressed unknown collection ${t}`);return n=a.element.columns,r=n,{Collection:i}}),a=e.edit;if(`Insert`in a){if(!r)throw Error(`native terminal insert has no collection target`);let t=Cx(a.Insert.key);return{root_key:xx(e.root_key),path:i,edit:{Insert:{index:a.Insert.index,key:xx(a.Insert.key),row:cg(t,r,Sx(a.Insert.value))}}}}if(`Update`in a){if(!r)throw Error(`native terminal update has no collection target`);let t=Cx(a.Update.key);return{root_key:xx(e.root_key),path:i,edit:{Update:{key:xx(a.Update.key),row:cg(t,r,Sx(a.Update.value))}}}}return`Remove`in a?{root_key:xx(e.root_key),path:i,edit:{Remove:{key:xx(a.Remove.key)}}}:{root_key:xx(e.root_key),path:i,edit:{Move:{key:xx(a.Move.key),index:a.Move.index}}}})}function xx(e){return Array.isArray(e)?e:Array.from(e)}function Sx(e){return e instanceof Uint8Array?e:Uint8Array.from(e)}function Cx(e){let t=Sx(e);if(t.length<17||t[0]!==10)throw Error(`terminal key must begin with a UUID row key`);return Nu(t.subarray(1,17))}function wx(e,t,n,r,i=!0){let a=S_(t,e);if(!a)throw Error(`missing schema for subscription table ${e}`);let o=n===void 0,s=(n??a.columns.map(e=>e.name)).map(e=>{let t=a.columns.find(t=>t.name===e);if(t)return o&&i?{...t,sparse:!0}:t;let n=L_(e);return n?{name:e,column_type:n,nullable:e===`$deletedAt`||e.startsWith(`$deletedBy`)}:void 0}).filter(e=>e!==void 0);for(let e of r){let n=wx(e.table,t,e.select,e.nestedArrays??[],!1);s.push({name:e.columnName,column_type:{type:`Array`,element:{type:`Row`,columns:n}},nullable:!1})}return s}function Tx(e){let t=JSON.parse(e);return Ex(t.array_subqueries),JSON.stringify(t)}function Ex(e){if(Array.isArray(e))for(let t of e){if(!t||typeof t!=`object`)continue;let e=t;if(Array.isArray(e.select_columns)&&Array.isArray(e.nested_arrays))for(let t of e.nested_arrays){if(!t||typeof t!=`object`)continue;let n=t.outer_column;if(typeof n!=`string`)continue;let r=j_(n);(Jx(e.select_columns)??[]).includes(r)||e.select_columns.push(r)}Ex(e.nested_arrays)}}function Dx(e){return new Promise(t=>setTimeout(t,e))}function Ox(e,t){return Vx(t)?kx(e,t):Hx(t)?Ax(e,t):null}function kx(e,t){let n=Px(t),r={kind:`rejected`,transactionId:e,code:`transaction_conflict`,reason:/^\(transaction_conflict\):\s*(.*)$/s.exec(n)?.[1]||n,message:n};return Object.defineProperty(r,`message`,{enumerable:!1}),r}function Ax(e,t){let n=Px(t),r={kind:`rejected`,transactionId:e,code:Rx(av(t)),reason:Bx(n,av(t)),message:n};return Object.defineProperty(r,`message`,{enumerable:!1}),r}function jx(e,t){try{return t()}catch(t){if(Hx(t)){let n=Px(t),r=Ux(n)??n,i=av(t)??(r.startsWith(`authorization_denied:`)?`authorization_denied`:void 0);throw Object.assign(Error(`${e} failed: WriteError("${r}")`),{code:Rx(i)})}throw t}}function Mx(e,t){return Error(`${e} failed: WriteError("${t.replaceAll(`"`,`\\"`)}")`)}function Nx(e){let t=/^missing required column ([A-Za-z_$][\w$]*)$/.exec(e);return t?`missing required field \`${t[1]}\``:e}function Px(e){if(e instanceof Error)return e.message;if(e&&typeof e==`object`){let t=e.message;if(typeof t==`string`&&t.trim())return t;try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}}return String(e)}function Fx(e=`a store configured as one user serves only its own identity's peers`){return Object.assign(Error(e),{code:`protocol`,reason:`identity_mismatch`})}function Ix(e,t){let n=t instanceof Error?t:Error(Px(t));return Error(`${e}: ${n.message}`,{cause:n})}var Lx={authorization_denied:`permission_denied`,client_clock_too_far_ahead:`client_clock_too_far_ahead`,serialization_conflict:`serialization_conflict`,row_already_deleted:`write_rejected`,row_already_exists:`write_rejected`,row_not_deleted:`write_rejected`,missing_required:`write_rejected`,branch_move:`write_rejected`,missing_chunks:`write_rejected`,predecessor_rejected:`write_rejected`,schema_version_not_deployed:`write_rejected`,identity_mismatch:`write_rejected`};function Rx(e){return e===void 0?`write_rejected`:Lx[e]}var zx={permission_denied:`Write rejected by server authorization`,serialization_conflict:`Serializable transaction conflicted with another write`,client_clock_too_far_ahead:`Client clock is too far ahead`};function Bx(e,t){let n=Ux(e);return n===null?e:zx[Rx(t)]??(n||`Write rejected`)}function Vx(e){return rv(e)===`transaction_conflict`}function Hx(e){return rv(e)===`write_rejected`}function Ux(e){let t=/^WriteRejected:\s*(.*)$/s.exec(e);return t?t[1]:null}function Wx(e,t){let n=JSON.parse(e);if(typeof n.table!=`string`)throw Error(`Native runtime only supports table queries in this slice`);let r=n.table;if(n.relation_ir!=null){let i=Kg(e);if(!i.relation_ir||typeof i.relation_ir!=`object`)throw Error(`Relation query is missing relation_ir`);return $g(r,[],{relation:i.relation_ir,select:Jx(n.select_columns??n.select),partial:qx(n.select_columns),arraySubqueries:Xx(n.array_subqueries,r,t)})}let i=oS(n.conditions);if(!i)throw Y();return $g(r,i.map(e=>Gx(r,e,t)),{limit:mS(n.limit),offset:hS(n.offset),orderBy:Yx(n.order_by??n.orderBy),select:Jx(n.select_columns??n.select),partial:qx(n.select_columns),arraySubqueries:Xx(n.array_subqueries,r,t)})}function Y(e){let t=e?` (${e})`:``;return Error(`Native runtime cannot encode this query shape${t}.`)}function Gx(e,t,n){if(t.op===`All`||t.op===`Any`)return{op:t.op,predicates:t.predicates.map(t=>Gx(e,t,n))};if(t.op===`Not`)return{op:`Not`,predicate:Gx(e,t.predicate,n)};if(v_(e)&&`column`in t){if(t.column===`$transactionId`)throw Error(`History $transactionId predicates do not accept user-provided values`);if(t.column===`$acceptedAt`){if(t.op===`In`)return{op:`Any`,predicates:t.values.map(r=>Gx(e,{column:t.column,op:`Eq`,value:r},n))};if(Kx(t)){let r=rS(e,t.column,t.value,n);if(r.type!==`Timestamp`||!Number.isSafeInteger(r.value))throw Error(`History $acceptedAt predicates require a valid Date or integer milliseconds`);let i=BigInt(r.value)<<18n,a=i+(1n<<18n)-1n,o=(e,n)=>n<0n||n>(1n<<64n)-1n?{op:(n<0n?e===`Gt`||e===`Gte`:e===`Lt`||e===`Lte`)?`All`:`Any`,predicates:[]}:{column:t.column,op:e,value:{type:`U64`,value:n}};switch(t.op){case`Eq`:return{op:`All`,predicates:[o(`Gte`,i),o(`Lte`,a)]};case`Ne`:return{op:`Not`,predicate:{op:`All`,predicates:[o(`Gte`,i),o(`Lte`,a)]}};case`Gt`:return o(`Gt`,a);case`Gte`:return o(`Gte`,i);case`Lt`:return o(`Lt`,i);case`Lte`:return o(`Lte`,a)}}}}if(t.op===`In`){let r=t.column===`id`?{type:`Uuid`}:S_(n,e)?.columns.find(e=>e.name===t.column)?.column_type;return r?.type===`Array`?{op:`Any`,predicates:t.values.map(i=>i.type===`Array`?{column:t.column,op:`Eq`,value:rS(e,t.column,i,n)}:{column:t.column,op:`Contains`,value:iS(i,r.element,!1)})}:{...t,values:t.values.map(r=>rS(e,t.column,r,n))}}if(t.op===`Contains`){let r=t.column===`id`?{type:`Uuid`}:S_(n,e)?.columns.find(e=>e.name===t.column)?.column_type;return{...t,value:r?.type===`Array`?iS(t.value,r.element,!1):rS(e,t.column,t.value,n)}}if(t.op===`IsNull`||t.op===`IsNotNull`)return t;if(Kx(t))return{...t,value:rS(e,t.column,t.value,n)};throw Error(`unsupported query predicate ${JSON.stringify(t)}`)}function Kx(e){return e.op===`Eq`||e.op===`Ne`||e.op===`Gt`||e.op===`Gte`||e.op===`Lt`||e.op===`Lte`}function qx(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.kind===`json_pointer`){if(typeof e.at!=`string`)throw Y(`select_columns`);t.push({column:e.column,kind:`json_pointer`,at:e.at})}else if(e.kind===`bytes`||e.kind===`text_utf16`||e.kind===`text_utf8`){if(typeof e.from!=`number`||typeof e.to!=`number`)throw Y(`select_columns`);t.push({column:e.column,kind:e.kind,from:e.from,to:e.to})}}return t}function Jx(e){if(e==null)return;if(!Array.isArray(e))throw Y();let t=[];for(let n of e){if(typeof n==`string`){t.push(n);continue}if(!n||typeof n!=`object`||typeof n.column!=`string`)throw Y();let e=n;if(e.kind!==`full`&&e.kind!==`bytes`&&e.kind!==`text_utf16`&&e.kind!==`text_utf8`&&e.kind!==`json_pointer`)throw Y();t.push(e.column)}return t}function Yx(e){if(e==null)return[];if(!Array.isArray(e))throw Y(`order_by`);return e.map(e=>{if(Array.isArray(e)&&e.length===2&&typeof e[0]==`string`){if(e[1]!==`asc`&&e[1]!==`desc`)throw Y(`order_by`);return{column:e[0],direction:e[1]===`asc`?`Asc`:`Desc`}}if(!e||typeof e!=`object`)throw Y(`order_by`);let t=e;if(typeof t.column!=`string`||t.direction!==`Asc`&&t.direction!==`Desc`)throw Y(`order_by`);return{column:t.column,direction:t.direction}})}function Xx(e,t,n){if(e!=null){if(!Array.isArray(e))throw Y(`array_subqueries`);return e.map(e=>Zx(e,t,n))}}function Zx(e,t,n){if(!e||typeof e!=`object`)throw Y(`array_subqueries`);let r=e;if(typeof r.column_name!=`string`||typeof r.table!=`string`||typeof r.inner_column!=`string`||typeof r.outer_column!=`string`)throw Y(`array_subqueries`);if(Array.isArray(r.joins)&&r.joins.length>0)throw Y(`array_subqueries.joins`);let i=Qx(r.filters,r.table,n),a=Jx(r.select_columns),o=eS(r.order_by),s=Xx(r.nested_arrays,r.table,n)??[];return{columnName:r.column_name,table:r.table,innerColumn:r.inner_column,outerColumn:nS(r.outer_column,t),filters:i,select:a,orderBy:o,limit:r.limit==null?null:pS(r.limit),offset:hS(r.offset),requirement:tS(r.requirement),nestedArrays:s}}function Qx(e,t,n){if(e==null)return[];if(!Array.isArray(e))throw Y(`array_subqueries.filters`);let r=[];for(let i of e){let e=$x(i);if(!e)throw Y(`array_subqueries.filters`);r.push(...e.map(e=>Gx(t,e,n)))}return r}function $x(e){let t=cS(e);if(t)return[t];if(!e||typeof e!=`object`)return null;let n=e;for(let[e,t]of[[`Eq`,`Eq`],[`Ne`,`Ne`],[`Gt`,`Gt`],[`Ge`,`Gte`],[`Lt`,`Lt`],[`Le`,`Lte`]]){let r=n[e];if(r&&typeof r==`object`){let{column:e,value:n}=r;return typeof e==`string`?[{column:e,op:t,value:lS(n)}]:null}}let r=n.IsNull;if(r&&typeof r==`object`){let e=r.column;return typeof e==`string`?[{column:e,op:`IsNull`}]:null}let i=n.IsNotNull;if(i&&typeof i==`object`){let e=i.column;return typeof e==`string`?[{column:e,op:`IsNotNull`}]:null}let a=n.Contains;if(a&&typeof a==`object`){let{column:e,value:t}=a;return typeof e==`string`?[{column:e,op:`Contains`,value:lS(t)}]:null}return null}function eS(e){if(e==null)return[];if(!Array.isArray(e))throw Y(`array_subqueries.order_by`);return e.map(e=>{if(!Array.isArray(e)||e.length!==2||typeof e[0]!=`string`||e[1]!==`Ascending`&&e[1]!==`Descending`)throw Y(`array_subqueries.order_by`);return{column:e[0],direction:e[1]===`Ascending`?`Asc`:`Desc`}})}function tS(e){if(e==null||e===`Optional`)return`Optional`;if(e===`AtLeastOne`||e===`MatchCorrelationCardinality`)return e;throw Y(`array_subqueries.requirement`)}function nS(e,t){let n=`${t}.`;return e.startsWith(n)?e.slice(n.length):e}function rS(e,t,n,r){let i=t===`id`?{type:`Uuid`}:L_(t)??S_(r,e)?.columns.find(e=>e.name===t)?.column_type;if(i?.type===`Bytea`&&n.type===`Array`)return{type:`Bytea`,value:Uint8Array.from(n.value.map(aS))};if(n.type===`Array`){let i=t===`id`?{type:`Uuid`}:S_(r,e)?.columns.find(e=>e.name===t)?.column_type,a=i?.type===`Array`?i.element:i;return{type:`Array`,value:n.value.map(e=>iS(e,a,!1))}}return iS(n,i,!0)}function iS(e,t,n){if(e.type===`Nullable`)return n&&e.value?{type:`Nullable`,value:iS(e.value,t,!1)}:e;if(t?.type===`Uuid`&&e.type===`Text`&&gS(e.value))return{type:`Uuid`,value:e.value};if(t?.type===`Text`&&e.type===`Uuid`)return{type:`Text`,value:e.value};if(t?.type===`Double`&&e.type===`Integer`)return{type:`Double`,value:e.value};if(t?.type===`BigInt`&&e.type===`Integer`)return{type:`BigInt`,value:Bh(e.value,`BigInt value`)};if(t?.type===`Timestamp`&&e.type===`Integer`)return{type:`Timestamp`,value:e.value};if(t?.type===`Timestamp`&&e.type===`Text`){let t=Date.parse(e.value);if(Number.isFinite(t))return{type:`Timestamp`,value:t}}return t?.type===`Bytea`&&e.type===`Array`?{type:`Bytea`,value:Uint8Array.from(e.value.map(aS))}:t?.type===`Array`&&e.type===`Array`?{type:`Array`,value:e.value.map(e=>iS(e,t.element,!1))}:e}function aS(e){if(e.type!==`Integer`||e.value<0||e.value>255)throw Error(`Bytea values must contain integers in range 0..255`);return e.value}function oS(e){if(e==null)return[];if(!Array.isArray(e))return null;let t=[];for(let n of e){if(!n||typeof n!=`object`)return null;let e=cS(n);if(e){t.push(e);continue}let r=n;if(typeof r.column!=`string`||typeof r.op!=`string`)return null;let i=j_(r.column);switch(r.op){case`eq`:r.value===null?t.push({column:i,op:`IsNull`}):t.push({column:i,op:`Eq`,value:lS(r.value)});break;case`ne`:r.value===null?t.push({column:i,op:`IsNotNull`}):t.push({column:i,op:`Ne`,value:lS(r.value)});break;case`gt`:t.push({column:i,op:`Gt`,value:lS(r.value)});break;case`gte`:t.push({column:i,op:`Gte`,value:lS(r.value)});break;case`lt`:t.push({column:i,op:`Lt`,value:lS(r.value)});break;case`lte`:t.push({column:i,op:`Lte`,value:lS(r.value)});break;case`contains`:t.push({column:i,op:`Contains`,value:lS(r.value)});break;case`isNull`:if(typeof r.value!=`boolean`)return null;t.push({column:i,op:r.value?`IsNull`:`IsNotNull`});break;case`in`:if(!Array.isArray(r.value))return null;t.push({column:i,op:`In`,values:r.value.map(lS)});break;default:return null}}return t}function sS(e){if(e===`True`)return[];if(e===`False`)return[{column:`id`,op:`In`,values:[]}];if(!e||typeof e!=`object`)return null;let t=e;if(Array.isArray(t.And)){let e=[];for(let n of t.And){let t=sS(n);if(!t)return null;e.push(...t)}return e}if(Array.isArray(t.Or))return null;if(t.Not){let e=cS(t.Not);return e?[{op:`Not`,predicate:e}]:null}let n=t.IsNull;if(n&&typeof n==`object`){let e=dS(n.column);return e?[{column:e,op:`IsNull`}]:null}let r=t.IsNotNull;if(r&&typeof r==`object`){let e=dS(r.column);return e?[{column:e,op:`IsNotNull`}]:null}let i=t.Contains;if(i&&typeof i==`object`){let e=i,t=dS(e.left),n=fS(e.right);return t&&n?[{column:t,op:`Contains`,value:n}]:null}let a=t.In;if(a&&typeof a==`object`){let e=a,t=dS(e.left);if(!t||!Array.isArray(e.values))return null;let n=e.values.map(fS);return n.every(e=>e!=null)?[{column:t,op:`In`,values:n}]:null}let o=t.Cmp;if(!o||typeof o!=`object`)return null;let s=o,c=uS(s.op);if(!c)return null;let l=dS(s.left),u=fS(s.right);return l&&u?[{column:l,op:c,value:u}]:null}function cS(e){if(e===`True`)return{op:`All`,predicates:[]};if(e===`False`)return{op:`Any`,predicates:[]};if(!e||typeof e!=`object`)return null;let t=e;if(Array.isArray(t.And)||Array.isArray(t.Or)){let e=Array.isArray(t.And)?`All`:`Any`,n=(t.And??t.Or).map(cS);return n.every(e=>e!==null)?{op:e,predicates:n}:null}if(t.Not){let e=cS(t.Not);return e?{op:`Not`,predicate:e}:null}let n=sS(e);return n?.length===1?n[0]:null}function lS(e){if(e==null)return{type:`Nullable`,value:null};if(typeof e==`boolean`)return{type:`Boolean`,value:e};if(typeof e==`number`&&Number.isSafeInteger(e))return{type:`Integer`,value:e};if(typeof e==`number`&&Number.isFinite(e))return{type:`Double`,value:e};if(typeof e==`bigint`)return{type:`BigInt`,value:e};if(typeof e==`string`)return gS(e)?{type:`Uuid`,value:e}:{type:`Text`,value:e};if(e instanceof Uint8Array)return{type:`Bytea`,value:e};if(Array.isArray(e))return{type:`Array`,value:e.map(lS)};throw Y()}function uS(e){switch(e){case`Eq`:case`Ne`:case`Gt`:case`Gte`:case`Lt`:case`Lte`:return e;case`Ge`:return`Gte`;case`Le`:return`Lte`;default:return null}}function dS(e){if(!e||typeof e!=`object`)return null;let t=e.column;return typeof t==`string`?j_(t):null}function fS(e){if(!e||typeof e!=`object`||!(`Literal`in e))return null;let t=e.Literal;if(!t||typeof t!=`object`)return null;let n=t;if(n.type===`Boolean`&&typeof n.value==`boolean`)return{type:`Boolean`,value:n.value};if(n.type===`Integer`&&typeof n.value==`number`&&Number.isSafeInteger(n.value))return{type:`Integer`,value:n.value};if(n.type===`BigInt`){if(typeof n.value==`string`&&n.value.length<=pb&&mb.test(n.value))try{return{type:`BigInt`,value:Bh(BigInt(n.value),`BigInt value`)}}catch{return null}if(typeof n.value==`bigint`||typeof n.value==`number`&&Number.isSafeInteger(n.value))return{type:`BigInt`,value:BigInt(n.value)}}if(n.type===`Timestamp`&&typeof n.value==`number`&&Number.isSafeInteger(n.value))return{type:`Timestamp`,value:n.value};if(n.type===`Double`&&typeof n.value==`number`&&Number.isFinite(n.value))return{type:`Double`,value:n.value};if(n.type===`Bytea`&&Array.isArray(n.value))return{type:`Bytea`,value:Uint8Array.from(n.value.map(Number))};if(n.type===`Null`)return{type:`Nullable`,value:null};if(n.type===`Array`&&Array.isArray(n.value)){let e=n.value.map(e=>fS({Literal:e}));if(e.every(e=>e!=null))return{type:`Array`,value:e}}return n.type===`Uuid`&&typeof n.value==`string`?{type:`Uuid`,value:n.value}:(n.type===`Text`||n.type===`Enum`)&&typeof n.value==`string`?{type:`Text`,value:n.value}:null}function pS(e){if(typeof e!=`number`||!Number.isSafeInteger(e)||e<0)throw Error(`query limit must be a non-negative safe integer`);return e}function mS(e){return e==null?void 0:pS(e)}function hS(e){if(e==null)return 0;if(typeof e!=`number`||!Number.isSafeInteger(e)||e<0)throw Error(`query offset must be a non-negative safe integer`);return e}function gS(e){return/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}function _S(e,t,n){return SS(e.columns,t,n),xS(e.columns.filter(e=>Object.hasOwn(t,e.name)),e=>t[e.name],!0)}function vS(e,t,n,r){return SS(e.columns.filter(e=>e.name!==n),t,r),xS(e.columns.filter(e=>e.name!==n&&Object.hasOwn(t,e.name)),e=>t[e.name],!0)}function yS(e,t,n){return xS(e.columns.filter(e=>e.name!==n&&Object.hasOwn(t,e.name)),e=>t[e.name],!1)}function bS(e,t){return xS(e.columns.filter(e=>Object.hasOwn(t,e.name)),e=>t[e.name],!1)}function xS(e,t,n){let r=[...e].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({name:e.name,valueType:Og(e),column:e})),i=r.map(({column:e})=>CS(e,t(e),n)),a=new f_;return $h(a,r),a.bytes(rg(r,i)),a.finish()}function SS(e,t,n){for(let r of e){let e=t[r.name]??r.default;if(!(e&&e.type!==`Null`)&&!r.nullable)throw Error(n?`encoding error: missing required field \`${r.name}\` on table \`${n}\``:`missing required column ${r.name}`)}}function CS(e,t,n){let r=t;if(!r){if(e.nullable)return Sg(Og(e));if(n&&e.default==null)throw Error(`missing required column ${e.name}`);return new Uint8Array}return bg(e,r)}function wS(e){return new p_(e).readVec(Uh)}function TS(e){return Xh(new p_(e))}function ES(e,t,n,r=`full-record`){let i=[];for(let a of e){let e=DS(a,t,n),o=pg(a.descriptor);for(let t of a.rows){let n=[],s=new Map;for(let i of e){let e=PS(i,o,t.raw,r);s.set(i.name,e),i.includeInValues&&n.push(e)}i.push(ag({table:a.table,id:Nu(t.rowId),values:n},s))}}return i}function DS(e,t,n){let r=Eb.get(t);r||(r=new Map,Eb.set(t,r));let i=ev(e),a=n?void 0:r.get(i);if(a)return a;let o=n??S_(t,e.table)?.columns??[],s=new Map(o.map(e=>[e.name,e])),c=n?new Set(n.map(e=>e.name)):null,l=[];for(let t=0;t<e.descriptor.length;t+=1){let n=e.descriptor[t],r=n&&Hh(n);if(!r)continue;let i=L_(r)??s.get(r)?.column_type;l.push({name:r,index:t,type:i,storageType:e.descriptor[t].valueType,includeInValues:!$S(r)&&(!I_(r)||c?.has(r)===!0)})}return n||r.set(i,l),l}function OS(e,t,n,r=`full-record`){return AS(ES(e.rows,t,n,r),t).slice(0,e.rootCount)}var kS=new Set([`table`,`layer`,`schema_version`,`parents`,`created_by`,`created_at`,`updated_by`,`updated_at`]);function AS(e,t){return e.map(e=>{if(!e.valuesByColumn)return e;let n=new Set((S_(t,e.table)?.columns??[]).map(e=>e.name)),r=new Map(e.valuesByColumn),i=new Set;for(let e of kS){if(n.has(e))continue;let t=r.get(e);t&&(i.add(t),r.delete(e))}return i.size===0?e:ag({...e,values:e.values.filter(e=>!i.has(e))},r)})}function jS(e,t,n=!1,r=null){let i=(e,n,i,a)=>{let o=NS(e,t,r,`full-record`);if(o.length!==n.length)throw Error(`subscription occurrence sidecar length mismatch`);return o.flatMap((e,o)=>{if(r&&e.table!==r.rootTable)return[];let s=a?.[o];return[{sourceId:e.id,occurrenceKey:n[o],index:i[o],row:GS(e,t,r),...s&&s.length>0?{splices:MS(s,t,e.table)}:{}}]})};return{added:i(e.added,e.addedOccurrenceKeys,e.addedIndices),updated:i(e.updated,e.updatedOccurrenceKeys,e.updatedIndices,e.updatedSplices),removed:e.removed.flatMap((t,n)=>r&&t.table!==r.rootTable?[]:[{sourceId:Nu(t.rowId),occurrenceKey:e.removedOccurrenceKeys[n],index:e.removedIndices[n]}]),...n?{reset:!0}:{}}}function MS(e,t,n){let r=S_(t,n)?.columns??[],i={};for(let{column:t,splices:n}of e){let e=r.find(e=>e.name===t)?.column_type.type;if(e===`Text`)i[t]=n.map(e=>({at:e.atUtf16,delete:e.deleteUtf16,insert:Tb.decode(e.insert)}));else if(e===`Bytea`)i[t]=n.map(e=>({at:e.at,delete:e.delete,insert:e.insert}));else throw Error(`subscription splices for column "${t}" of type ${e} are not supported yet`)}return i}function NS(e,t,n,r){return e.flatMap(e=>ES([e],t,e.table===n?.rootTable?n.rootColumns:void 0,r))}function PS(e,t,n,r){let i=t(n,e.index);if(i==null)return{type:`Null`};if(!e.type)return{type:`Bytea`,value:i};try{return FS(e.type,i,e.name,e.storageType,r)}catch(t){throw Error(`${String(t)} while decoding ${e.name} as ${e.type.type} from storage tag ${e.storageType.tag} (${i.byteLength} bytes)`)}}function FS(e,t,n,r,i=`full-record`){let a=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(e.type){case`Boolean`:return{type:`Boolean`,value:t[0]!==0};case`Integer`:return{type:`Integer`,value:a.getInt32(0,!0)};case`BigInt`:return{type:`BigInt`,value:IS(r)?.tag===3?a.getBigUint64(0,!0):a.getBigInt64(0,!0)};case`Double`:return{type:`Double`,value:a.getFloat64(0,!0)};case`Timestamp`:return{type:`Timestamp`,value:Number(a.getBigUint64(0,!0))};case`Text`:case`Json`:case`Enum`:if(t[0]!==0)throw Error(`indirect scalar crossed a logical binding boundary`);return{type:`Text`,value:Tb.decode(t.subarray(1))};case`Uuid`:return{type:`Uuid`,value:Nu(t)};case`Bytea`:if(t[0]!==0)throw Error(`indirect scalar crossed a logical binding boundary`);return{type:`Bytea`,value:t.subarray(1).slice()};case`Array`:return{type:`Array`,value:BS(e.element,t,LS(r),i)};case`Row`:{let a={type:`Row`,value:zS(e.columns,t,RS(r),i)};return(n===`$createdBy`||n===`$updatedBy`)&&nu(a),a}}}function IS(e){let t=e;for(;t?.tag===15;)t=t.inner;return t}function LS(e){let t=IS(e);return t?.tag===14?t.inner:void 0}function RS(e){let t=IS(e);return t?.tag===16?t.record:void 0}function zS(e,t,n,r=`full-record`){if(n){let i=r===`keyed-terminal`;if(i&&n[0]?.name!==`row_uuid`)throw Error(`keyed terminal nested row descriptor must start with row_uuid`);if(i&&t.byteLength<16)throw Error(`terminal nested row is missing its key`);let a=i?n.slice(1):n,o=i?t.subarray(16):t,s=pg(a),c=new Map(e.map(e=>[e.name,e])),l=new Map,u=i?Nu(t.subarray(0,16)):void 0;for(let e=0;e<a.length;e+=1){let t=a[e]?.name;if(!t)continue;let n=s(o,e);if(!i&&t===`row_uuid`&&n){u=Nu(n);continue}let d=c.get(t);d&&l.set(t,n==null?{type:`Null`}:FS(d.column_type,n,t,a[e]?.valueType,r))}let d=e.map(e=>l.get(e.name)??(e.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`}));return ag({id:u,values:d},l)}if(t.byteLength<5)throw Error(`invalid nested row value`);let i=t[0]===1,a=1,o;if(i){if(t.byteLength<21)throw Error(`invalid nested row id`);o=Nu(t.subarray(a,a+16)),a+=16}let s=ZS(t,a);a+=4;let c=t.subarray(a,a+s);if(c.byteLength!==s)throw Error(`invalid nested row value length`);return{id:o,values:ig(e,c)}}function BS(e,t,n,r=`full-record`){let i=Rg(n??Ag(e));if(i!=null){if(i===0)return[];if(t.length%i!==0)throw Error(`invalid fixed-width array byte length ${t.length}`);let a=[];for(let o=0;o<t.length;o+=i)a.push(FS(e,t.subarray(o,o+i),void 0,n,r));return a}if(t.length<4)throw Error(`invalid variable-width array byte length`);let a=ZS(t,0),o=4+Math.max(0,a-1)*4;if(o>t.length)throw Error(`invalid variable-width array offset table`);let s=[];for(let i=0;i<a;i+=1){let c=i===0?o:ZS(t,4+(i-1)*4),l=i===a-1?t.length:ZS(t,4+i*4);if(c>l||l>t.length)throw Error(`invalid variable-width array element offset`);s.push(FS(e,t.subarray(c,l),void 0,n,r))}return s}function VS(e){if(!e||typeof e!=`object`)throw Error(`expected subscription chunk`);let t=e;if(t.type===`closed`||t.type===`Closed`)return{type:`closed`};if(t.type===`delta`||t.type===`Delta`)return{type:`delta`,reset:t.reset===!0,delta:qh(new p_(eC(t.delta,`subscription delta`))),terminalOperations:Array.isArray(t.terminalOperations)?t.terminalOperations:void 0};if(t.type===`rejected`||t.type===`Rejected`)return{type:`rejected`,reason:HS(t.reason)};throw Error(`unknown subscription chunk`)}function HS(e){if(!e||typeof e!=`object`)throw Error(`expected subscription rejection reason`);let t=e;if(t.type===`UnsupportedShapeCapability`&&typeof t.detail==`string`)return{type:`UnsupportedShapeCapability`,detail:t.detail};if(t.type===`ShapeRegistrationPendingCatalogueAdmission`)return{type:`ShapeRegistrationPendingCatalogueAdmission`};let n=t.code??t.detail;if(t.type===`ServerFailure`&&typeof n==`string`)return typeof t.errorCode==`string`?{type:`ServerFailure`,code:n,errorCode:t.errorCode}:{type:`ServerFailure`,code:n};if(t.type===`InvalidAuthoritySourceClosure`&&typeof t.transition==`string`)return{type:`InvalidAuthoritySourceClosure`,transition:t.transition};throw Error(`unknown subscription rejection reason`)}function US(e){let t=e.type===`UnsupportedShapeCapability`?e.detail:e.type===`ServerFailure`?e.code:e.type===`InvalidAuthoritySourceClosure`?e.transition:`catalogue admission pending`,n=`Subscription rejected: ${e.type}: ${t}`,r=e.type===`ServerFailure`?e.errorCode:void 0;return r===void 0?Error(n):E_({code:r,message:n})??Error(n)}function WS(e){let t=e;if(typeof t.getReader==`function`){let e=t.getReader();return{pull(t,n){e.read().then(e=>t(e.done?{type:`closed`}:{type:`batch`,events:[e.value]}),n)},close(){e.cancel().catch(()=>{})}}}let n=e;return{joinPool:n.joinPool?e=>n.joinPool(e):void 0,pull(){let e=n.readAll();return Array.isArray(e)?{type:`batch`,events:e}:{type:`pending`,retryAfterMs:e.retryAfterMs?.()??0}},close(){n.close?.()}}}function GS(e,t,n=null){let r=n&&e.table===n.rootTable?n.rootColumns:t?.[e.table]?.columns,i=r?kg(r):void 0;if(!i)throw Error(`missing schema for subscription row table ${e.table}`);let a=JS(e,i).map((e,t)=>KS(e,i[t].column_type));return ag({id:e.id,values:a},og(i,a))}function KS(e,t){return e.type===`Null`?e:t.type===`Array`&&e.type===`Array`?{type:`Array`,value:e.value.map(e=>KS(e,t.element))}:t.type===`Row`&&e.type===`Row`?{type:`Row`,value:qS(e.value,t.columns)}:e}function qS(e,t){let n=e.valuesByColumn,r=t.map((t,r)=>KS(n?.get(t.name)??e.values[r]??(t.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`}),t.column_type));return ag({id:e.id,values:r},og(t,r))}function JS(e,t){if(!e.valuesByColumn)return e.values.slice(0,t.length);let n=[];n.length=t.length;for(let r=0;r<t.length;r+=1){let i=t[r];n[r]=e.valuesByColumn.get(i.name)??(i.column_type.type===`Array`?{type:`Array`,value:[]}:{type:`Null`})}return n}function YS(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function XS(e){let t=Mu(e);if(!t)throw Error(`invalid uuid ${e}`);return t}function ZS(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function QS(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function $S(e){return e.startsWith(R_)}function eC(e,t){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return Uint8Array.from(e);throw Error(`expected ${t} bytes`)}function tC(e){queueMicrotask(()=>{throw e})}function nC(e,t,n){for(let r of e)n(r,t)}function rC(e,t,n){if(e===t)return`admit`;try{let{authClass:r,schemaHash:i,...a}=JSON.parse(e),{authClass:o,schemaHash:s,...c}=JSON.parse(t);if(JSON.stringify(a)!==JSON.stringify(c))return`incompatible`;let l=Object.keys(n).length===0;return i!==s&&!l?`incompatible`:r===o?`admit`:`held-by-another-sign-in`}catch{return`incompatible`}}Error.stackTraceLimit=50;var iC=`warn`;function aC(e,t){let n=e.context.options;if(!e.inspectorAttachment||!t||t.appId!==n.appId||t.physicalDbName!==n.dbName||t.authSessionKey!==n.authSessionKey||t.storageOwner!==n.storageOwner)throw Error(`Inspector attachment does not match the worker account and storage scope`)}function oC(e){if(e===null||typeof e==`boolean`||typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`)return Number.isFinite(e)?JSON.stringify(e):`null`;if(Array.isArray(e))return`[${e.map(oC).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${oC(t[e])}`).join(`,`)}}`}return`null`}function sC(e,t){if(oC(t)!==oC(e.options.sessionClaims))throw Error(`Browser tab claims differ from the persistent worker's authenticated upstream session`)}async function cC(e,t){await Promise.all([...e.peers.values()].map(e=>e.subscriber?.updateAuthenticatedClaims?.(t))),e.options.sessionClaims=t}var lC=globalThis,uC=crypto.randomUUID(),dC=null,X=new Map,fC=new Map,Z=new Map,pC=new Map,mC=new Map,hC=new Set,gC=null,_C=null,vC=Promise.resolve(),yC=1,bC=0,xC=null,SC=!1,CC=[],wC=1,TC=128;function EC(e,t,n){return e.filter(e=>e.authSessionKey===t&&n.has(e.dbName)).map(({authSessionKey:e,...t})=>t)}function DC(e,t,n,r={}){let i=[...Z.values()].reduce((e,t)=>e+t.activeLeaseIds.size,0);CC.push({sequence:wC++,event:e,dbName:t,authSessionKey:n,peerCount:[...X.values()].reduce((e,t)=>e+t.peers.size,0),pendingBootstraps:bC,activeLeases:i,...r}),CC.length>TC&&CC.splice(0,CC.length-TC)}async function OC(e,t){let n=pC.get(e);if(n){if(n.release)return await n.release,await OC(e,t);if(n.storageOwner!==t)throw Error(`IndexedDB database ${e} is already owned by a different Jazz browser session; choose a different driver.dbName or reset this database before changing accounts`);return n}let r=mC.get(e);if(r){let n=await r;if(n.storageOwner!==t)throw Error(`IndexedDB database ${e} is already owned by a different Jazz browser session; choose a different driver.dbName or reset this database before changing accounts`);return n}let i=kC(e,t);mC.set(e,i);try{return await i}finally{mC.get(e)===i&&mC.delete(e)}}async function kC(e,t){let n=await Kp(e),r=null;try{r=await xm.open(e,{owner:t}),await r.claimBrowserWorkerEpoch(n.id,n);let i={epoch:n,pageStore:r,storageOwner:t,release:null,disposeInvalidation:null};return pC.set(e,i),i.disposeInvalidation=r.onInvalidated(()=>jC(e)),i}catch(e){throw r?.close(),await n.release(),e}}async function AC(e){let t=pC.get(e);t&&(t.release||=(async()=>{try{await t.pageStore.releaseBrowserWorkerEpoch(t.epoch.id)}finally{t.disposeInvalidation?.(),t.disposeInvalidation=null,t.pageStore.close(),await t.epoch.release(),fC.get(e)===t&&fC.delete(e),pC.delete(e)}})(),await t.release)}function jC(e){Z.delete(e),AC(e).catch(()=>{}).finally(()=>dw())}function MC(e={}){dC=e.foregroundLeaseTestHooks??null,lC.onconnect=e=>{let t=e.ports[0];t&&NC(t)}}function NC(e,t){bC+=1;let n=!1,r=!1,i=null,a=!1,o=!1,s=new AbortController,c=setTimeout(()=>d(),3e4),l=()=>{n||(n=!0,clearTimeout(c),--bC,dw(),RC())},u=()=>{e.removeEventListener(`message`,f),e.removeEventListener(`messageerror`,p)},d=()=>{r||(r=!0,s.abort(),u(),l(),e.close())};function f(n){let r=n.data;if(r?.type===`cancel-runtime-bootstrap`&&o){s.abort(),$(e,{type:`runtime-bootstrap-cancelled`}),u(),l();return}if(!a){if(t&&(r.type===`connect-runtime`||r.type===`acquire-foreground-node-lease`&&(r.dbName!==t.dbName||r.storageOwner!==t.storageOwner))){$(e,{type:`foreground-node-lease-error`,error:J(Error(`Inspector lease cannot select another storage scope`))}),d();return}if(SC){r?.type===`connect-runtime`?$(e,{type:`worker-closing`}):r?.type===`delete-store`?$(e,{type:`delete-store-result`,outcome:`held`}):(r?.type===`probe-foreground-node-lease-worker`||r?.type===`acquire-foreground-node-lease`)&&$(e,{type:`foreground-node-lease-worker-closing`,attemptId:r.attemptId??``}),d();return}if(r?.type===`probe-foreground-node-lease-worker`){i=r.attemptId,$(e,{type:`foreground-node-lease-worker-alive`,attemptId:r.attemptId}),r.wasmPrefetch&&HC(r.wasmPrefetch.runtimeSources);return}if(r?.type===`cancel-foreground-node-lease`){d();return}if(r?.type===`delete-store`){if(t){d();return}a=!0,clearTimeout(c),DC(`delete-store`,r.dbName,null),PC(r.dbName,r.runtimeSources).then(t=>$(e,{type:`delete-store-result`,outcome:t}),t=>$(e,{type:`delete-store-error`,error:J(Hl(t))})).finally(d);return}if(!(r?.type!==`connect-runtime`&&r?.type!==`acquire-foreground-node-lease`))if(a=!0,clearTimeout(c),r.type===`connect-runtime`)o=!0,DC(`bootstrap-start`,r.options.dbName,r.options.authSessionKey),$(e,{type:`worker-alive`}),zC(e,r,s.signal,()=>{u(),l()});else{if(u(),i!==null&&r.attemptId!==i){l(),$(e,{type:`foreground-node-lease-error`,error:J(Error(`Foreground node lease request did not match its worker probe`))}),d();return}DC(`lease-request`,r.dbName,null),FC(e,r,s.signal).finally(l)}}}function p(){d()}return e.addEventListener(`message`,f),e.addEventListener(`messageerror`,p),e.start(),()=>{s.abort(),a||d()}}async function PC(e,t){for(let t of[...X.values()])if(t.options.dbName===e){if(t.peers.size!==0||t.pendingAdmissionTasks!==0)return`held`;await lw(t)}let n=Z.get(e);if([...X.values()].some(t=>t.options.dbName===e)||mC.has(e)||n&&(n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0))return`held`;fC.delete(e),await AC(e).catch(()=>{}),n&&(Z.delete(e),n.pageStore.close());let r;try{r=await Kp(e)}catch(e){if(e instanceof Up)return`held`;throw e}try{await xm.destroy(e),await(await UC(t)).WasmDb.destroyBrowserStorage(void 0,e)}finally{await r.release()}return`deleted`}async function FC(e,t,n){let r=dC,i=null,a=null,o=null,s=!1,c=null,l=!1,u=()=>{n?.removeEventListener(`abort`,g),e.removeEventListener(`message`,m),e.removeEventListener(`messageerror`,h)},d=async t=>{if(!l){if(!i){if(t===void 0)return;l=!0,$(e,{type:`foreground-node-lease-cancelled`,error:J(t)}),u(),e.close(),dw();return}if(await o?.catch(()=>{}),!l){if(!a){l=!0,$(e,{type:`foreground-node-lease-cancelled`}),u(),e.close(),dw();return}l=!0;try{await LC(i,a.leaseId);let t=r?await r.cancellationRetired(i.pageStore,a.node):void 0;$(e,{type:`foreground-node-lease-cancelled`,...t===void 0?{}:{testLeaseState:t}})}catch(t){$(e,{type:`foreground-node-lease-cancelled`,error:J(Error(`Shared browser foreground lease cancellation failed`,{cause:Hl(t)}))})}finally{u(),e.close(),dw()}}}},f=e=>(l||(s=!0,(i||e!==void 0)&&!c&&(c=d(e))),c),p=async()=>{l||!a||!i||(l=!0,await LC(i,a.leaseId))},m=t=>{(async()=>{let n=t.data;try{if(n?.type===`cancel-foreground-node-lease`){f();return}if(!a||!i||l||s)return;if(n?.type===`return-foreground-node-lease`){if(!/^(0|[1-9][0-9]*)$/.test(n.confirmedTxTime))throw Error(`Invalid foreground node lease high-water`);let t=BigInt(n.confirmedTxTime);if(t>(1n<<64n)-1n)throw Error(`Invalid foreground node lease high-water`);await i.pageStore.returnForegroundNodeLease(a.leaseId,t),l=!0,i.activeLeaseIds.delete(a.leaseId),$(e,{type:`foreground-node-lease-result`}),u(),e.close(),dw();return}n?.type===`retire-foreground-node-lease`&&(await p(),$(e,{type:`foreground-node-lease-result`}),u(),e.close())}catch(t){await p().catch(()=>{}),$(e,{type:`foreground-node-lease-result`,error:J(t)}),u(),e.close()}})()},h=()=>{f()},g=()=>{f()};n?.addEventListener(`abort`,g,{once:!0}),n?.aborted&&g(),e.addEventListener(`message`,m),e.addEventListener(`messageerror`,h);try{if(i=Z.get(t.dbName)??null,!i){let e=await OC(t.dbName,t.storageOwner);i=Z.get(t.dbName)??null,i||(i={pageStore:e.pageStore,storageOwner:t.storageOwner,activeLeaseIds:new Set,pendingLeaseAllocations:0,pendingLeaseFinalizations:0,allocationTail:Promise.resolve()},Z.set(t.dbName,i))}if(i.storageOwner!==t.storageOwner)throw Error(`IndexedDB database ${t.dbName} is already owned by a different Jazz browser session; choose a different driver.dbName or reset this database before changing accounts`);if(s){await f();return}let c=IC(i,t,e,r);if(o=(async()=>{let n=await c,i=r?.delayAfterLeaseAllocation(t);if(i!==void 0){if(!Number.isSafeInteger(i)||i<0||i>1e3)throw Error(`Invalid foreground lease test delay`);r?.allocationCommitted(e,n.node.slice(),uC),await new Promise(e=>setTimeout(e,i))}return n})(),a=await o,s){await f();return}n?.removeEventListener(`abort`,g),DC(`lease-admitted`,t.dbName,null),$(e,{type:`foreground-node-lease-ready`,workerRealmId:uC,leaseId:a.leaseId,node:a.node,confirmedTxTime:a.confirmedTxTime.toString()})}catch(t){if(s){await f(t);return}u(),t instanceof Up?$(e,{type:`foreground-node-lease-busy`,message:t.message}):$(e,{type:`foreground-node-lease-error`,error:J(t)}),e.close()}}async function IC(e,t,n,r){e.pendingLeaseAllocations+=1;let i=e.allocationTail,a;e.allocationTail=new Promise(e=>{a=e}),await i;try{let i=r?.delayBeforeLeaseAllocation(t);if(i!==void 0){if(!Number.isSafeInteger(i)||i<0||i>1e3)throw Error(`Invalid foreground lease test delay`);r?.allocationQueued(n),await new Promise(e=>setTimeout(e,i))}let a=await e.pageStore.acquireForegroundNodeLease(e.activeLeaseIds.size===0);return e.activeLeaseIds.add(a.leaseId),a}finally{--e.pendingLeaseAllocations,a(),dw()}}async function LC(e,t){e.pendingLeaseFinalizations+=1,e.activeLeaseIds.delete(t);try{await e.pageStore.retireForegroundNodeLease(t)}catch(n){throw e.activeLeaseIds.add(t),n}finally{--e.pendingLeaseFinalizations,dw()}}function RC(){if(bC===0)for(let[e,t]of fC){if(pC.get(e)!==t||X.has(e)){fC.delete(e);continue}let n=Z.get(e);n&&(n.activeLeaseIds.size>0||n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0)||(fC.delete(e),Z.delete(e),AC(e).catch(()=>{}))}}async function zC(e,t,n,r){let i=Symbol(`runtime-admission`),a,o=!1,s=()=>{o&&(o=!1,a?.admissionClaims.delete(i))},c=()=>{if(n.throwIfAborted(),a&&(a.closing||X.get(a.key)!==a))throw Error(`Shared browser runtime context closed during initialization`)};n.addEventListener(`abort`,s,{once:!0});try{c();let n=Sw(t.options),l=X.get(n);if(l?.closing&&(await l.closing,c(),l=X.get(n)),l&&l.options.storageOwner!==t.options.storageOwner)throw Error(`IndexedDB database ${t.options.dbName} is already owned by a different Jazz browser session; choose a different driver.dbName or reset this database before changing accounts`);if(l&&!xw(l.options,t.options))throw Error(`incompatible persistent browser telemetry configuration`);let u=l?rC(l.fingerprint,t.fingerprint,t.options.schema):`admit`;if(u!==`admit`)throw Error(u===`held-by-another-sign-in`?vh:`incompatible persistent browser configuration`);l?.idleReleaseTimer&&(clearTimeout(l.idleReleaseTimer),l.idleReleaseTimer=null),l||(l=BC(n,t.fingerprint,t.options),X.set(n,l)),a=l,l.admissionClaims.add(i),o=!0,l.pendingAdmissionTasks+=1,await l.initialize,c(),await YC(l,()=>(c(),KC(l,t.options))),c(),$C(l,t.tabId,e,t.options.author),s(),r(),$(e,{type:`runtime-ready`})}catch(t){r(),n.aborted||($(e,{type:`runtime-error`,error:J(t)}),e.close())}finally{if(n.removeEventListener(`abort`,s),s(),a&&(--a.pendingAdmissionTasks,a.pendingAdmissionTasks===0&&a.admissionClaims.size===0&&a.peers.size===0)){let e=pC.get(t.options.dbName);await lw(a),e&&pC.get(t.options.dbName)===e&&fC.set(t.options.dbName,e),RC(),dw()}}}function BC(e,t,n){let r={key:e,fingerprint:t,options:n,peers:new Map,admissionClaims:new Set,pendingAdmissionTasks:0,runtime:null,pageStore:null,disposePageStoreInvalidation:null,disposeTelemetry:null,disposeAuxiliaryTrace:null,resetBarrier:null,storageInvalidated:!1,intentionalStorageReset:!1,serverUrl:n.serverUrl??null,serverAuthJson:n.authJson,serverConnectionStarted:!1,explicitlyDisconnected:!1,transportTransition:Promise.resolve(),transportStateEpoch:0,transportStateWaiters:new Set,authFailureEpoch:0,storageFailure:null,initialize:Promise.resolve(),closing:null,idleReleaseTimer:null},i=vC.then(()=>VC(r));return vC=i.catch(()=>{}),r.initialize=i,r}async function VC(e){let t=null;try{let{options:n}=e;e.pageStore=(await OC(n.dbName,n.storageOwner)).pageStore,e.disposePageStoreInvalidation=e.pageStore.onInvalidated(()=>hw(e)),lC.__JAZZ_WASM_LOG_LEVEL=n.logLevel??iC;let r=await UC(n.runtimeSources);e.disposeTelemetry=$m({wasmModule:r,collectorUrl:n.telemetryCollectorUrl,runtimeThread:`worker`});let i=e.pageStore.replicaNode,a=$_(n.schema),o=n.selfSignedClientProof,s=Zg(i,n.author,1,!1,n.initialSyncFlushEvery,o,n.migrations);if(o&&typeof r.WasmDb.openBrowserWithSelfSignedProof!=`function`)throw Error(`WASM runtime does not support self-signed client opens; rebuild the matching Jazz WASM artifact`);t=o?await r.WasmDb.openBrowserWithSelfSignedProof(e.pageStore,a,s,o.token,o.appId,o.claimedAuthor,n.dbName):await r.WasmDb.openBrowser(e.pageStore,a,s,n.dbName);let c=jb.fromDb(t,n.schema,i,n.author,1,!1,{selfSignedClientProof:o,scopeIsolatedRelay:!0,slowQueryLog:{appId:n.appId,thresholdMs:n.slowQueryThresholdMs,consoleDetail:`summary`}});e.runtime=c,t=null,e.runtime.onAuthFailure(t=>{e.authFailureEpoch+=1,ow(e,{type:`auth-failure`,reason:t})}),e.runtime.onStorageFailure(t=>{e.storageFailure=t,ow(e,{type:`storage-failure`,message:t})}),e.runtime.onMutationError(t=>{nC(e.peers.values(),t,(e,t)=>$(e.port,{type:`mutation-error`,event:t}))});let l=null,u=()=>{if(e.runtime!==c)return;let t=c.remoteLinkState(),n=c.upstreamLinkStatus();l?.state===t&&q_(l.link,n)||(l={state:t,link:n},ow(e,{type:`remote-link`,state:t,link:n}))};c.onRemoteLinkStateChange(u,new AbortController().signal),c.onUpstreamLinkStatusChange(u,new AbortController().signal),e.runtime.onServerTransportError((t,{retrying:n})=>{for(let r of e.peers.values())!r.subscriber||!r.pump||$(r.port,{type:`transport-error`,error:J(t),retrying:n})}),n.logLevel===`trace`&&(e.disposeAuxiliaryTrace=e.runtime.onAuxiliaryTrace(t=>{ow(e,{type:`relay-trace`,entries:t.map(e=>({...e,hop:`worker-server`}))})}))}catch(n){try{await t?.close()}catch{}try{GC(e)}catch{}throw n}}function HC(e){gC||e?.wasmModule||e?.wasmSource||UC(e).catch(()=>{})}async function UC(e){let t=WC(e);if(gC&&(!t||_C!==t))throw Error(`incompatible WASM asset source for this SharedWorker; start a worker scoped to the new asset URL`);let n=gC??Rp(e);gC=n,_C=t;try{return await n}catch(e){throw gC===n&&(gC=null,_C=null),e}}function WC(e){return e?.wasmModule?e.workerWasmAssetIdentity?`module:${e.workerWasmAssetIdentity}`:null:e?.wasmSource?e.workerWasmAssetIdentity?`source:${e.workerWasmAssetIdentity}`:null:e?.wasmUrl??`worker-local`}function GC(e){let t=e.runtime,n=e.disposePageStoreInvalidation,r=e.disposeTelemetry,i=e.disposeAuxiliaryTrace;e.runtime=null,e.pageStore=null,e.disposePageStoreInvalidation=null,e.disposeTelemetry=null,e.disposeAuxiliaryTrace=null,X.get(e.key)===e&&X.delete(e.key);try{t?.discard()}finally{try{n?.()}finally{try{r?.()}finally{i?.()}}}dw()}async function KC(e,t){let n=t.serverUrl??null;if(e.serverUrl===n){if(!qC(t.authJson)&&qC(e.serverAuthJson))return;e.runtime?.assertCredentialKeepsPrincipal(t.authJson),e.serverAuthJson=t.authJson,e.serverConnectionStarted&&await sw(e).updateAuth(t.authJson);return}if(e.peers.size>0)throw Error(`incompatible persistent browser server configuration`);e.serverConnectionStarted&&=(await sw(e).disconnect({rejectWaiters:!1}),!1),e.serverUrl=n,e.serverAuthJson=t.authJson}function qC(e){try{let t=JSON.parse(e);return!!t&&(typeof t.jwt_token==`string`||typeof t.admin_secret==`string`||typeof t.backend_secret==`string`||t.backend_session!=null)}catch{return!1}}function JC(e){let t=e.serverUrl;t||e.runtime?.setRemoteLinkHint(`none`),!(!t||e.explicitlyDisconnected)&&(e.serverConnectionStarted||qC(e.serverAuthJson)&&(sw(e).connect(t,e.serverAuthJson),e.serverConnectionStarted=!0))}function YC(e,t){let n=e.transportTransition.then(t,t);return e.transportTransition=n.catch(()=>{}),n}function XC(e){e.transportStateEpoch+=1,ow(e,{type:`transport-state`,explicitlyDisconnected:e.explicitlyDisconnected});let t=[...e.transportStateWaiters];e.transportStateWaiters.clear();for(let e of t)e()}function ZC(e,t,n){return e.transportStateEpoch!==t||n?.aborted?Promise.resolve():new Promise(t=>{let r=()=>{e.transportStateWaiters.delete(r),n?.removeEventListener(`abort`,r),t()};n?.addEventListener(`abort`,r,{once:!0}),e.transportStateWaiters.add(r)})}async function QC(e,t,n){for(;;){if(n?.aborted||(await e.transportTransition,n?.aborted))return;if(e.explicitlyDisconnected){let t=e.transportStateEpoch;await ZC(e,t,n);continue}if(await t.waitForUpstreamServerConnection(),!e.explicitlyDisconnected)return}}function $C(e,t,n,r,i=!1){iw(e,t);let a,o=e=>{tw(a,e.data)},s=()=>iw(e,t);a={tabId:t,context:e,author:r,port:n,pump:null,subscriber:null,pendingFrames:[],flushedLocal:!1,flushRequestId:null,flushPumpComplete:!1,flushObserved:!1,transportWaitAbort:new AbortController,inspectorAttachment:i,watchedLivenessLock:null,pendingInspectorBootstraps:new Set,inspectorSubscriptions:new Map,inspectorWrites:new Set,onMessage:o,onMessageError:s},e.peers.set(t,a),n.addEventListener(`message`,o),n.addEventListener(`messageerror`,s),n.start()}function ew(e,t){let{context:n,tabId:r}=e,i=globalThis.navigator?.locks;!i||e.watchedLivenessLock!==null||(e.watchedLivenessLock=t,i.request(t,{signal:e.transportWaitAbort.signal},()=>{n.peers.get(r)===e&&(iw(n,r),n.peers.size===0&&n.pendingAdmissionTasks===0&&uw(n))}).catch(()=>{}))}async function tw(e,t){if(e.context.peers.get(e.tabId)===e){if(t.type===`liveness-lock`){ew(e,t.name);return}if(t.type===`runtime-probe`){$(e.port,{type:`runtime-pong`,connectionId:t.connectionId,nonce:t.nonce});return}if(t.type===`frames`){if(e.context.options.logLevel===`trace`&&DC(`peer-frames`,e.context.options.dbName,e.context.options.authSessionKey,{frameCount:t.frames.length}),e.flushedLocal=!1,!e.pump){e.pendingFrames.push(...t.frames);return}e.pump.receive(t.frames);return}if(t.type===`close`){let n=e.context.peers.size===1&&e.context.pendingAdmissionTasks===0&&t.releaseContext;iw(e.context,e.tabId,!1);try{n&&await lw(e.context),t.id!==void 0&&$(e.port,{type:`result`,id:t.id}),n&&uw(e.context)}catch(n){t.id!==void 0&&$(e.port,{type:`result`,id:t.id,error:J(Hl(n))})}return}if(t.type===`diagnostic-query-coverage`){DC(t.stage===`attach`?`query-attach`:`query-covered`,e.context.options.dbName,e.context.options.authSessionKey,{peerActivityEpoch:t.peerActivityEpoch,peerProcessedActivityEpoch:t.peerProcessedActivityEpoch});return}if(t.type===`storage-reset-observed`){_w(e,t.resetId);return}if(t.type===`flush-local-observed`){e.flushObserved=!0,bw(e);return}if(t.type===`open-inspector-control`){nw(e.context.options.authSessionKey,t.port),Q(e,t.id);return}if(t.type===`store-pending-uploads`){let n;try{n=e.context.runtime?.uploadStatus().pending}catch{n=void 0}Q(e,t.id,void 0,{pendingUploads:n});return}if(t.type===`prepare-storage-reset`){e.context.intentionalStorageReset=!0;let n;try{n=e.context.runtime?.uploadStatus().pending}catch{n=void 0}Q(e,t.id,void 0,{pendingUploads:n});return}if(t.type===`abort-storage-reset`){e.context.intentionalStorageReset=!1,Q(e,t.id);return}if(t.type===`finish-storage-reset`){await cw(e.context),gw(e.context),Q(e,t.id);return}try{let n=sw(e.context);if(t.type===`inspect-query`||t.type===`inspect-subscribe`||t.type===`inspect-unsubscribe`||t.type===`inspect-commit`||t.type===`inspect-wait`){if(aC(e,t.binding),!e.subscriber||!e.pump||e.context.storageInvalidated||e.context.closing)throw Error(`Inspector cache reads require an active authenticated attachment`);if(!Number.isSafeInteger(t.id)||t.id>=-1)throw Error(`Invalid Inspector query identifier`);if(t.type===`inspect-commit`){let r=Ru();n.beginTransaction(`mergeable`,r);let i;try{for(let e of t.edits){let t=JSON.stringify({transaction_id:r,updated_at:e.updatedAt});switch(e.operation){case`insert`:n.insert(e.table,e.values??{},t,e.rowId);break;case`update`:n.update(e.table,e.rowId,e.values??{},t);break;case`delete`:n.delete(e.table,e.rowId,t);break;default:throw Error(`Invalid Inspector edit operation`)}}i=n.commitTransaction(r)}catch(e){try{await n.rollbackTransaction(r)}catch{}throw e}e.inspectorWrites.add(i),$(e.port,{type:`inspector-query-result`,id:t.id,value:i});return}if(t.type===`inspect-wait`){let r=t.txId;if(!e.inspectorWrites.has(r))throw Error(`Unknown Inspector write`);await n.waitForTransaction(r,t.tier),e.context.peers.get(e.tabId)===e&&e.context.runtime===n&&!e.context.storageInvalidated&&!e.context.closing&&$(e.port,{type:`inspector-query-result`,id:t.id,value:null});return}if(t.type===`inspect-unsubscribe`){let r=e.inspectorSubscriptions.get(t.id);e.inspectorSubscriptions.delete(t.id),r!==void 0&&n.unsubscribe(r);return}let r=t.options,i=()=>e.context.peers.get(e.tabId)===e&&e.context.runtime===n&&!e.context.storageInvalidated&&!e.context.closing&&!!e.subscriber;if(t.type===`inspect-query`){let a=await n.query(t.query,void 0,`local-only`,r);i()&&$(e.port,{type:`inspector-query-result`,id:t.id,value:a})}else{if(e.inspectorSubscriptions.has(t.id))throw Error(`Inspector subscription already exists`);let a=n.createSubscription(t.query,void 0,`local-only`,r);e.inspectorSubscriptions.set(t.id,a),n.executeSubscription(a,n=>{!i()||e.inspectorSubscriptions.get(t.id)!==a||$(e.port,n instanceof Error?{type:`inspector-query-result`,id:t.id,error:J(n)}:{type:`inspector-query-result`,id:t.id,value:n})})}return}if(t.type===`inspect-binding`){aC(e,t.binding),t.leasePort&&e.pendingInspectorBootstraps.add(NC(t.leasePort,e.context.options)),$(e.port,{type:`inspector-binding`,id:t.id,binding:t.binding});return}if(t.type===`init`){await YC(e.context,async()=>{let r=()=>e.context.peers.get(e.tabId)===e&&e.context.runtime===n&&!e.context.storageInvalidated&&!e.context.closing;if(!r())return;if((e.inspectorAttachment||t.inspectorBinding)&&aC(e,t.inspectorBinding),e.pump||e.subscriber)throw Error(`Browser tab is already initialized`);sC(e.context,t.sessionClaims);let i=null;try{let a=n.createPeerAuthority();if(i=await n.acceptPeer(t.sessionClaims,a.epoch,e.author),!r())return;let o=yw(e,n,i);if(i=null,DC(`peer-attached`,e.context.options.dbName,e.context.options.authSessionKey),e.pendingFrames.length>0){let t=e.pendingFrames.splice(0);o.receive(t)}e.context.explicitlyDisconnected?$(e.port,{type:`transport-state`,explicitlyDisconnected:!0}):JC(e.context),e.context.storageFailure!==null&&$(e.port,{type:`storage-failure`,message:e.context.storageFailure}),$(e.port,{type:`remote-link`,state:n.remoteLinkState(),link:n.upstreamLinkStatus()}),Q(e,t.id,void 0,{peerAuthority:a,workerRealmId:uC,...e.inspectorAttachment?{inspectorAttachmentPhysicalDbName:e.context.options.dbName}:{}})}catch(e){if(r())throw e}finally{i&&await n.retirePeerTransport(i)}});return}if(t.type===`update-auth`){if(!e.subscriber)throw Error(`Browser tab is not initialized`);let r=!1;await YC(e.context,async()=>{n.assertCredentialKeepsPrincipal(t.authJson);let i=e.context.authFailureEpoch;try{e.context.explicitlyDisconnected||(e.context.serverConnectionStarted?await n.updateAuth(t.authJson):(e.context.serverAuthJson=t.authJson,JC(e.context)),await n.waitForUpstreamServerConnection())}catch(t){if(e.context.authFailureEpoch!==i){r=!0;return}throw t}e.context.serverAuthJson=t.authJson,await cC(e.context,t.sessionClaims)}),r||ow(e.context,{type:`auth-restored`});return}if(t.type===`disconnect`){await YC(e.context,async()=>{let t=e.context.explicitlyDisconnected;e.context.explicitlyDisconnected=!0,e.context.serverConnectionStarted=!1;try{await n.disconnect({rejectWaiters:!1})}catch(n){throw e.context.explicitlyDisconnected=t,t||JC(e.context),n}XC(e.context)}),Q(e,t.id);return}if(t.type===`flush-pending-writes`){e.context.runtime.waitForPendingWrites(`global`).then(()=>Q(e,t.id),n=>Q(e,t.id,Hl(n)));return}if(t.type===`flush-local`){if(e.flushRequestId!==null){Q(e,t.id,Error(`Browser tab already has a local flush in progress`));return}e.flushRequestId=t.id,e.flushPumpComplete=!1,e.flushObserved=!1,e.pump?.drainOutboundFrames(),e.flushPumpComplete=!0,bw(e);return}if(t.type===`reconnect`){let r=e.context.serverUrl;if(!r)throw Error(`Browser runtime reconnect requires a serverUrl`);await YC(e.context,async()=>{let i=qC(t.authJson)||!qC(e.context.serverAuthJson),a=i?t.authJson:e.context.serverAuthJson;n.assertCredentialKeepsPrincipal(a);let o=qC(a);o&&(n.connect(r,a),await n.waitForUpstreamServerConnection()),e.context.serverAuthJson=a,i&&await cC(e.context,t.sessionClaims),e.context.explicitlyDisconnected=!1,e.context.serverConnectionStarted=o,XC(e.context)}),Q(e,t.id);return}if(await QC(e.context,n,e.transportWaitAbort.signal),e.transportWaitAbort.signal.aborted)return;Q(e,t.id)}catch(n){if(t.type===`init`&&(!e.context.runtime||e.context.storageInvalidated||e.context.closing))return;`id`in t?Q(e,t.id,Hl(n)):rw(e,Hl(n))}}}function nw(e,t){hC.add(t);let n=n=>{let i=n.data;if(i.type===`close`){r();return}if(i.type===`list-contexts`){let n=[...X.values()].filter(t=>t.options.authSessionKey===e&&!t.storageInvalidated&&t.runtime!==null).map(e=>({workerRealmId:uC,key:e.key,appId:e.options.appId,dbName:e.options.dbName,schema:e.options.schema}));t.postMessage({type:`contexts`,id:i.id,contexts:n});return}if(i.type===`lifecycle-trace`){let n=new Set([...X.values()].filter(t=>t.options.authSessionKey===e&&!t.storageInvalidated&&t.runtime!==null).map(e=>e.options.dbName));t.postMessage({type:`lifecycle-trace`,id:i.id,entries:EC(CC,e,n)});return}if(i.type===`terminate-worker`){if(X.size>0){t.postMessage({type:`result`,id:i.id,error:J(Error(`Worker still has live runtime contexts`))});return}if(bC>0){t.postMessage({type:`result`,id:i.id,error:J(Error(`Worker still has pending bootstrap operations`))});return}if(pw()){t.postMessage({type:`result`,id:i.id,error:J(Error(`Worker still has pending or active foreground node leases`))});return}SC=!0,t.postMessage({type:`result`,id:i.id,workerTerminated:!0}),setTimeout(()=>lC.close(),0);return}let a=X.get(i.contextKey);if(!a||a.options.authSessionKey!==e||a.storageInvalidated||!a.runtime){i.port.close(),t.postMessage({type:`result`,id:i.id,error:J(Error(`Inspector context is no longer available`))});return}$C(a,i.tabId,i.port,a.options.author,!0),t.postMessage({type:`result`,id:i.id})},r=()=>{t.removeEventListener(`message`,n),t.removeEventListener(`messageerror`,r),hC.delete(t),t.close(),dw()};t.addEventListener(`message`,n),t.addEventListener(`messageerror`,r),t.start()}function Q(e,t,n,r){e.context.peers.get(e.tabId)===e&&$(e.port,{type:`result`,id:t,...n?{error:J(n)}:{},...r})}function rw(e,t){$(e.port,{type:`error`,error:J(t)}),iw(e.context,e.tabId)}function iw(e,t,n=!0){let r=e.peers.get(t);if(r){e.peers.delete(t),r.transportWaitAbort.abort();for(let e of r.pendingInspectorBootstraps)e();r.pendingInspectorBootstraps.clear();for(let t of r.inspectorSubscriptions.values())e.runtime?.unsubscribe(t);r.inspectorSubscriptions.clear(),r.inspectorWrites.clear(),vw(e,t),r.port.removeEventListener(`message`,r.onMessage),r.port.removeEventListener(`messageerror`,r.onMessageError),aw(r),n&&r.port.close()}}function aw(e){e.pump?.close(),e.pump=null,e.subscriber=null,e.pendingFrames.length=0}function ow(e,t){for(let n of e.peers.values())$(n.port,t)}function sw(e){if(!e.runtime)throw Error(`Shared browser runtime is closed`);return e.runtime}async function cw(e){e.intentionalStorageReset=!1;for(let t of e.peers.values())t.pump=null,t.subscriber=null,t.pendingFrames.length=0;e.runtime?.discard(),e.runtime=null,e.disposePageStoreInvalidation?.(),e.disposePageStoreInvalidation=null,e.pageStore=null,await(await gC)?.WasmDb.destroyBrowserStorage(void 0,e.options.dbName),e.disposeTelemetry?.(),e.disposeTelemetry=null,e.disposeAuxiliaryTrace?.(),e.disposeAuxiliaryTrace=null,X.delete(e.key);let t=Z.get(e.options.dbName);t&&(Z.delete(e.options.dbName),t.pageStore.close()),await AC(e.options.dbName).catch(()=>{})}async function lw(e){X.get(e.key)===e&&(e.peers.size!==0||e.pendingAdmissionTasks!==0||(e.closing||=(async()=>{for(let t of e.peers.values())t.pump?.close(),t.pump=null,t.subscriber=null,t.pendingFrames.length=0;let t=pC.get(e.options.dbName),n=e.pageStore?.retireTreeOwnership();e.runtime?.discard(),e.runtime=null,e.disposePageStoreInvalidation?.(),e.disposePageStoreInvalidation=null,e.pageStore=null,e.disposeTelemetry?.(),e.disposeTelemetry=null,e.disposeAuxiliaryTrace?.(),e.disposeAuxiliaryTrace=null,await n,X.get(e.key)===e&&(X.delete(e.key),t&&pC.get(e.options.dbName)===t&&fC.set(e.options.dbName,t),RC())})(),await e.closing))}function uw(e){e.idleReleaseTimer&&clearTimeout(e.idleReleaseTimer),e.idleReleaseTimer=setTimeout(()=>{e.idleReleaseTimer=null,!(e.peers.size!==0||e.pendingAdmissionTasks!==0)&&lw(e).then(()=>{dw()})},50)}function dw(){if(RC(),!fw()){if(xC)return;let e=Symbol(`worker-idle-close`);xC=e;let t=new Set([...Z.keys(),...pC.keys()]);for(let e of t)DC(`owner-release-start`,e,null);Z.clear(),Promise.all([...t].map(e=>AC(e))).catch(()=>{}).finally(()=>{if(xC===e){if(fw()){xC=null;return}for(let e of t)DC(`owner-release-finished`,e,null);xC=null}})}}function fw(){return X.size>0||hC.size>0||bC>0||pw()}function pw(e){return[...Z.entries()].some(([t,n])=>(e===void 0||t===e)&&(n.activeLeaseIds.size>0||n.pendingLeaseAllocations>0||n.pendingLeaseFinalizations>0))}function mw(e){for(let t of e.peers.keys())iw(e,t)}function hw(e){if(e.intentionalStorageReset){e.runtime?.discard(),e.runtime=null,e.pageStore=null;return}e.storageInvalidated||(e.storageInvalidated=!0,X.delete(e.key),e.disposePageStoreInvalidation?.(),e.disposePageStoreInvalidation=null,e.pageStore=null,e.runtime?.discard(),e.runtime=null,e.disposeTelemetry?.(),e.disposeTelemetry=null,e.disposeAuxiliaryTrace?.(),e.disposeAuxiliaryTrace=null,jC(e.options.dbName),ow(e,{type:`storage-invalidated`}),setTimeout(()=>mw(e),0))}async function gw(e){let t=new Set(e.peers.keys());if(t.size===0)return;let n=yC++;await new Promise(r=>{e.resetBarrier={id:n,pending:t,resolve:r},ow(e,{type:`storage-reset`,resetId:n})})}function _w(e,t){e.context.resetBarrier?.id===t&&vw(e.context,e.tabId)}function vw(e,t){let n=e.resetBarrier;!n||!n.pending.delete(t)||n.pending.size!==0||(e.resetBarrier=null,n.resolve())}function yw(e,t,n){let r=new ph(t,n,t=>{let n=mh(t);e.port.postMessage({type:`frames`,frames:n},n.map(e=>e.buffer))},t=>rw(e,Hl(t)),e.context.options.logLevel===`trace`?t=>{$(e.port,{type:`relay-trace`,entries:t.map(e=>({...e,hop:`worker-tab`}))})}:void 0);return e.subscriber=n,e.pump=r,r}function bw(e){let t=e.flushRequestId;t===null||!e.flushPumpComplete||!e.flushObserved||(e.flushRequestId=null,e.flushedLocal=!0,Q(e,t))}function xw(e,t){let n=e.telemetryCollectorUrl?.trim()||void 0,r=t.telemetryCollectorUrl?.trim()||void 0;return!n!=!r||n&&r&&(Qm(n,`traces`)!==Qm(r,`traces`)||Qm(n,`logs`)!==Qm(r,`logs`))?!1:(e.logLevel??iC)===(t.logLevel??iC)}function Sw(e){return e.dbName}function $(e,t){e.postMessage(t)}MC();
|