@camera.ui/server 0.0.100 → 0.0.101
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/interface/assets/404-DBPDAI6j.js +1 -0
- package/dist/interface/assets/About-D4UsNvMg.js +1 -0
- package/dist/interface/assets/Adminpanel-cbJVgUsL.js +1 -0
- package/dist/interface/assets/Automation-B6tOVEKs.js +2 -0
- package/dist/interface/assets/Automations-BgAPf85q.js +1 -0
- package/dist/interface/assets/Camera-BG8K5bH_.css +1 -0
- package/dist/interface/assets/Camera-Bu4FA0WG.js +2 -0
- package/dist/interface/assets/{CameraConsole-BuPu7Vkg.js → CameraConsole-Czt_xw6B.js} +1 -1
- package/dist/interface/assets/Cameras-Bt_BGW6f.js +656 -0
- package/dist/interface/assets/Camview-BDoDrnbG.js +1 -0
- package/dist/interface/assets/{Camview-DpSC1WEC.css → Camview-Gxca3bvT.css} +1 -1
- package/dist/interface/assets/Config-CWq78sls.js +2 -0
- package/dist/interface/assets/ConfigActionCameraControl-DEKdoQQX.js +1 -0
- package/dist/interface/assets/ConfigActionDelay-D3AHm3Ca.js +1 -0
- package/dist/interface/assets/{ConfigActionHttp-DaceGA-q.js → ConfigActionHttp-Dajw5K3s.js} +1 -1
- package/dist/interface/assets/ConfigActionImageInput-CtJhFLyI.js +1 -0
- package/dist/interface/assets/ConfigActionNotification-DwqSnOgO.js +1 -0
- package/dist/interface/assets/ConfigActionOutput-CZ5oAVUN.js +1 -0
- package/dist/interface/assets/ConfigActionPlugin-CMcyYHzs.js +1 -0
- package/dist/interface/assets/ConfigActionSensor-BilCBSG7.js +1 -0
- package/dist/interface/assets/ConfigActionSnapshot-bxYO8LXe.js +1 -0
- package/dist/interface/assets/ConfigActionVariable-DhIkKDOd.js +1 -0
- package/dist/interface/assets/ConfigConditionIfElse-BTmZQL1D.js +1 -0
- package/dist/interface/assets/ConfigConditionSensorState-ChYGA6xn.js +1 -0
- package/dist/interface/assets/ConfigConditionSwitch-DWvWWxLe.js +1 -0
- package/dist/interface/assets/ConfigConditionTime-Bv4jXfBz.js +1 -0
- package/dist/interface/assets/{ConfigTriggerDetection-DX67r7Ei.js → ConfigTriggerDetection-ed8PwAuR.js} +1 -1
- package/dist/interface/assets/ConfigTriggerGeofence-DVDTg19w.js +1 -0
- package/dist/interface/assets/ConfigTriggerManual-Bs-d4UNY.js +1 -0
- package/dist/interface/assets/ConfigTriggerSchedule-Oq6AIbsA.js +1 -0
- package/dist/interface/assets/ConfigTriggerSensor-D7UrF-8S.js +1 -0
- package/dist/interface/assets/{ConfigTriggerSystem-DsiOLb60.js → ConfigTriggerSystem-CSw5pmui.js} +1 -1
- package/dist/interface/assets/ConfigTriggerWebhook-BIE2k8wo.js +1 -0
- package/dist/interface/assets/Console-CZ9aYOZ2.js +1 -0
- package/dist/interface/assets/CuiActionButton-DDCUTy7T.js +1 -0
- package/dist/interface/assets/{CuiAvatar-CnTqaIix.js → CuiAvatar-D2rNULcI.js} +1 -1
- package/dist/interface/assets/CuiBBoxPlayground-C_euuLOd.js +1 -0
- package/dist/interface/assets/CuiBottomSheet-2XT9FISM.js +1 -0
- package/dist/interface/assets/CuiBottomSheet-FWywPKGt.js +1 -0
- package/dist/interface/assets/{CuiCameraCard-D3pxt8gc.css → CuiCameraCard-BxGmxXxZ.css} +1 -1
- package/dist/interface/assets/CuiCameraCard-jWf1UIZQ.js +1 -0
- package/dist/interface/assets/CuiCameraPipCard-DV72XWMT.js +1 -0
- package/dist/interface/assets/CuiCameraRecordings-BVKPQj4i.js +1 -0
- package/dist/interface/assets/CuiCameraShares-C0iP7R6r.js +1 -0
- package/dist/interface/assets/CuiCameraSnapshot-D4tvlK9C.js +1 -0
- package/dist/interface/assets/CuiCameraTable-vFbAZlVA.js +2 -0
- package/dist/interface/assets/CuiFloatingButton-Bo7fbOpK.js +1 -0
- package/dist/interface/assets/CuiImage-D_wd-n9e.js +1 -0
- package/dist/interface/assets/CuiMenu-C8Z7_x95.js +1 -0
- package/dist/interface/assets/CuiPluginCard-D9-AyaFe.js +2 -0
- package/dist/interface/assets/CuiPluginOAuthButton-5KDOsXnI.js +2 -0
- package/dist/interface/assets/CuiQRCode-BtErH65J.css +1 -0
- package/dist/interface/assets/CuiQRCode-HenvF2PR.js +1 -0
- package/dist/interface/assets/CuiRecordingsGrid-Dwy7QYFn.js +1 -0
- package/dist/interface/assets/{CuiRecordingsGrid-CZIZiEuT.css → CuiRecordingsGrid-lcLty5PV.css} +1 -1
- package/dist/interface/assets/CuiSchema-AVvCVdCJ.js +1 -0
- package/dist/interface/assets/CuiTopNavbarItem-DcRuDa_7.js +1 -0
- package/dist/interface/assets/{CuiTopbarSlot-DKgEs0YR.js → CuiTopbarSlot-CBFJ3FSj.js} +1 -1
- package/dist/interface/assets/Faces-ACWdjEVA.js +1 -0
- package/dist/interface/assets/FirstSteps-DlhmhdED.js +1 -0
- package/dist/interface/assets/Instances-pv1upyFN.js +1 -0
- package/dist/interface/assets/Logs-4GW0dhoa.js +6 -0
- package/dist/interface/assets/Menu--YOcQDbg.js +1 -0
- package/dist/interface/assets/OAuthDeviceFlow-BbC7WXST.js +1 -0
- package/dist/interface/assets/Plugin-CH2px8L_.js +1 -0
- package/dist/interface/assets/Plugin-CHdZvbiP.css +1 -0
- package/dist/interface/assets/{PluginConsole-dpqKoxaP.js → PluginConsole-B6rHdU_C.js} +1 -1
- package/dist/interface/assets/PluginSchema-BnmdwWpI.js +1 -0
- package/dist/interface/assets/Plugins-CeRqlri7.js +2 -0
- package/dist/interface/assets/Recordings-C-bKxs2Z.js +1 -0
- package/dist/interface/assets/Settings-Crs_WXgW.js +1 -0
- package/dist/interface/assets/SettingsAccount-CRdg-kP8.js +1 -0
- package/dist/interface/assets/SettingsAccount-DguOq4Om.js +1 -0
- package/dist/interface/assets/SettingsAppearance-B-UxkVN8.js +1 -0
- package/dist/interface/assets/SettingsAppearance-DDAdcNsD.js +1 -0
- package/dist/interface/assets/SettingsBackup-Te8nw2uC.js +1 -0
- package/dist/interface/assets/SettingsNotifications-DHgYU38a.js +2 -0
- package/dist/interface/assets/SettingsRecordings-XrSL1Z9N.js +1 -0
- package/dist/interface/assets/SettingsRemote-DX6_ZVzx.js +1 -0
- package/dist/interface/assets/SettingsRemote-PB1t8pgR.css +1 -0
- package/dist/interface/assets/SettingsSystem-BVZrSinS.js +2 -0
- package/dist/interface/assets/SettingsUsers-BDOqt6Tm.js +1 -0
- package/dist/interface/assets/Terminal-DTPO237B.js +4 -0
- package/dist/interface/assets/{VariableInput-NAuwYlcN.js → VariableInput-DgEgFOBv.js} +1 -1
- package/dist/interface/assets/VariableSuggestions-BDXGYcko.js +1 -0
- package/dist/interface/assets/VersionsHandler-s9lehdQp.js +7 -0
- package/dist/interface/assets/Workers-DvLYYzYM.js +1 -0
- package/dist/interface/assets/api-B0-Lu1F7.js +1 -0
- package/dist/interface/assets/api-CnChd_Sx.js +2 -0
- package/dist/interface/assets/api-Dbhyyb4d.css +2 -0
- package/dist/interface/assets/arrow-left-Db2sFBAJ.js +1 -0
- package/dist/interface/assets/{auth-BL6McQ6L.js → auth-ZCpagWtK.js} +1 -1
- package/dist/interface/assets/{automations-CSeo6eSD.js → automations-C7taScXB.js} +1 -1
- package/dist/interface/assets/{automations-DdW_9hGf.js → automations-CJJ5vpHU.js} +1 -1
- package/dist/interface/assets/{backup-DaOmyROh.js → backup-DAQCbRHq.js} +1 -1
- package/dist/interface/assets/{cameras-CpcEVB7O.js → cameras-DEhevRDD.js} +1 -1
- package/dist/interface/assets/{cameras.schema-DdfxDJ8z.js → cameras.schema-Rhon3fGM.js} +1 -1
- package/dist/interface/assets/cloudHandoff-CanqDW4p.js +1 -0
- package/dist/interface/assets/{deviceId-CgqSyDFE.js → deviceId-C4RW4doQ.js} +1 -1
- package/dist/interface/assets/{hasPermission-CPbg1G8S.js → hasPermission-DSn4z35q.js} +1 -1
- package/dist/interface/assets/instances-DE1T_eT9.js +1 -0
- package/dist/interface/assets/locale-BtgvinNj.js +1 -0
- package/dist/interface/assets/{main-D5ZtdcGl.css → main-CQ6uGnBt.css} +1 -1
- package/dist/interface/assets/main-DsgrWrzA.js +3 -0
- package/dist/interface/assets/{notifications-Bt2rS0oF.js → notifications-CWOKoPn0.js} +1 -1
- package/dist/interface/assets/{plugins-djfAdtBz.js → plugins-CpC6ZonD.js} +1 -1
- package/dist/interface/assets/round-restart-alt-DD9aV3ph.js +1 -0
- package/dist/interface/assets/{router-CUsPNy4_.css → router-BUTKN1yM.css} +1 -1
- package/dist/interface/assets/router-DjSvn_UI.js +2 -0
- package/dist/interface/assets/{routerState-D7nuOTwH.js → routerState-D4PO17do.js} +1 -1
- package/dist/interface/assets/{server-viIVfNS-.js → server-CtFv7i_5.js} +1 -1
- package/dist/interface/assets/{shares-DSm5T_aw.js → shares-CC5N8_Ys.js} +1 -1
- package/dist/interface/assets/{theme-C1AnsszZ.js → theme-DIicT67D.js} +1 -1
- package/dist/interface/assets/trash2-Dwe2mhU5.js +1 -0
- package/dist/interface/assets/types-D7U7GI1s.js +1 -0
- package/dist/interface/assets/{ui-DH2DdvbF.js → ui-B1v3TgOV.js} +1 -1
- package/dist/interface/assets/{useBiometricCredentials-B0HhBwzS.js → useBiometricCredentials-BhQz9KOn.js} +1 -1
- package/dist/interface/assets/useCameraOptions-CffbHWXA.js +1 -0
- package/dist/interface/assets/useCuiCameraDrawer-Cd33ibcV.js +1 -0
- package/dist/interface/assets/useCuiDialog-ZYQfCReO.js +2 -0
- package/dist/interface/assets/{useFileDownload-BDSINVzz.js → useFileDownload-FT07LYdP.js} +1 -1
- package/dist/interface/assets/useLogsSocket-BYv9mop4.js +5 -0
- package/dist/interface/assets/useSharedComposables-BGt2jhlo.js +1 -0
- package/dist/interface/assets/{useStreamStatus-oYi-uo1K.js → useStreamStatus-BEvOhIHN.js} +1 -1
- package/dist/interface/assets/{users.schema-C48akApP.js → users.schema-D2Ch_Jbx.js} +1 -1
- package/dist/interface/assets/vendor-cameraui-DsfgZMon.js +1978 -0
- package/dist/interface/assets/vendor-core-CZMEiCMT.js +1 -0
- package/dist/interface/assets/{vendor-primevue-ltaQolO-.js → vendor-primevue-CnvdQWaM.js} +81 -81
- package/dist/interface/assets/view-grid-CpYpSctv.js +1 -0
- package/dist/interface/assets/view-grid-D04t817d.css +1 -0
- package/dist/interface/index.html +45 -44
- package/dist/interface/sw.js +1 -1
- package/dist/server/package.json +3 -3
- package/dist/server/src/plugins/worker.d.ts +5 -0
- package/dist/server/src/plugins/worker.js +38 -23
- package/dist/server/src/plugins/worker.js.map +1 -1
- package/package.json +3 -3
- package/dist/interface/assets/404-D8RFqFtN.js +0 -1
- package/dist/interface/assets/About-CjPUstm7.js +0 -1
- package/dist/interface/assets/Adminpanel-DsaHh-eh.js +0 -1
- package/dist/interface/assets/Automation-CdDySbn-.js +0 -2
- package/dist/interface/assets/Automations-SZ6YPt__.js +0 -1
- package/dist/interface/assets/Camera-7MHb-HMp.css +0 -1
- package/dist/interface/assets/Camera-CA-QFUXm.js +0 -2
- package/dist/interface/assets/Cameras-Dq22gBdr.js +0 -656
- package/dist/interface/assets/Camview-B89OyWl0.js +0 -1
- package/dist/interface/assets/Config-CxQeXv7R.js +0 -2
- package/dist/interface/assets/ConfigActionCameraControl-Bk_xZEzK.js +0 -1
- package/dist/interface/assets/ConfigActionDelay-rw5LkC5w.js +0 -1
- package/dist/interface/assets/ConfigActionImageInput-DltWuY4s.js +0 -1
- package/dist/interface/assets/ConfigActionNotification-B_RqqBYf.js +0 -1
- package/dist/interface/assets/ConfigActionOutput-rcLwE5fC.js +0 -1
- package/dist/interface/assets/ConfigActionPlugin-BmeA5hq9.js +0 -1
- package/dist/interface/assets/ConfigActionSensor-B46DLHLE.js +0 -1
- package/dist/interface/assets/ConfigActionSnapshot-mXndDdgD.js +0 -1
- package/dist/interface/assets/ConfigActionVariable-RjcIOgcK.js +0 -1
- package/dist/interface/assets/ConfigConditionIfElse-C1huxVbZ.js +0 -1
- package/dist/interface/assets/ConfigConditionSensorState-ByPrF_oE.js +0 -1
- package/dist/interface/assets/ConfigConditionSwitch-D0KCLIn9.js +0 -1
- package/dist/interface/assets/ConfigConditionTime-DMcoYQPg.js +0 -1
- package/dist/interface/assets/ConfigTriggerGeofence-iOY28Af8.js +0 -1
- package/dist/interface/assets/ConfigTriggerManual-BofNKINz.js +0 -1
- package/dist/interface/assets/ConfigTriggerSchedule-BqiAXGxy.js +0 -1
- package/dist/interface/assets/ConfigTriggerSensor-cCSBON5J.js +0 -1
- package/dist/interface/assets/ConfigTriggerWebhook-Dg5d6RiU.js +0 -1
- package/dist/interface/assets/Console-D8WZI01G.js +0 -6
- package/dist/interface/assets/CuiActionButton-eLmRgo3n.js +0 -1
- package/dist/interface/assets/CuiBBoxPlayground-C_Ne315a.js +0 -1
- package/dist/interface/assets/CuiBottomSheet-DPRsmfpj.js +0 -1
- package/dist/interface/assets/CuiBottomSheet-mLC2sZgD.js +0 -1
- package/dist/interface/assets/CuiCameraCard-OBn8Nb9y.js +0 -1
- package/dist/interface/assets/CuiCameraPipCard-CW0ifYUy.js +0 -1
- package/dist/interface/assets/CuiCameraRecordings-rS89MUeZ.js +0 -1
- package/dist/interface/assets/CuiCameraShares-DhxkZYoU.js +0 -1
- package/dist/interface/assets/CuiCameraSnapshot-vsRyJQpZ.js +0 -1
- package/dist/interface/assets/CuiCameraTable-D1tc874k.js +0 -2
- package/dist/interface/assets/CuiFloatingButton-BoUfL0hi.js +0 -1
- package/dist/interface/assets/CuiImage-Dqy-7RA9.js +0 -1
- package/dist/interface/assets/CuiMenu-DMY8m12e.js +0 -1
- package/dist/interface/assets/CuiPluginCard-BApYHaYK.js +0 -2
- package/dist/interface/assets/CuiPluginOAuthButton-Dzs0u-yw.js +0 -2
- package/dist/interface/assets/CuiQRCode-C3l07Uwh.css +0 -1
- package/dist/interface/assets/CuiQRCode-Dar7Jb_i.js +0 -1
- package/dist/interface/assets/CuiRecordingsGrid-DurKs7YQ.js +0 -1
- package/dist/interface/assets/CuiSchema-Cssi_QZC.js +0 -1
- package/dist/interface/assets/CuiTopNavbarItem-Cq6_w74W.js +0 -1
- package/dist/interface/assets/Faces-DP6AvOBj.js +0 -1
- package/dist/interface/assets/FirstSteps-BALuuLPG.js +0 -1
- package/dist/interface/assets/Instances-DqqVwkeN.js +0 -1
- package/dist/interface/assets/Menu-Dn4PBKpX.js +0 -1
- package/dist/interface/assets/OAuthDeviceFlow-BADWIcbz.js +0 -1
- package/dist/interface/assets/Plugin-LKueZ7Bz.css +0 -1
- package/dist/interface/assets/Plugin-x4MnVpDQ.js +0 -1
- package/dist/interface/assets/PluginSchema-fi8Qsc2m.js +0 -1
- package/dist/interface/assets/Plugins-Bqj_gBEG.js +0 -2
- package/dist/interface/assets/Recordings-B1VQ1Yv3.js +0 -1
- package/dist/interface/assets/Settings-CYuslqlv.js +0 -1
- package/dist/interface/assets/SettingsAccount-BWzvGQ3j.js +0 -1
- package/dist/interface/assets/SettingsAccount-CGSm6KyF.js +0 -1
- package/dist/interface/assets/SettingsAppearance-BZdc6hOW.js +0 -1
- package/dist/interface/assets/SettingsAppearance-DWb6W8lv.js +0 -1
- package/dist/interface/assets/SettingsBackup-DvTuMs1p.js +0 -1
- package/dist/interface/assets/SettingsNotifications-Ckbz5l12.js +0 -2
- package/dist/interface/assets/SettingsRecordings-DpdRTfkH.js +0 -1
- package/dist/interface/assets/SettingsRemote-DuLKYaeG.js +0 -1
- package/dist/interface/assets/SettingsRemote-uybnhgZ-.css +0 -1
- package/dist/interface/assets/SettingsSystem-BpLtRIrb.js +0 -2
- package/dist/interface/assets/SettingsUsers-BTd-ieHZ.js +0 -1
- package/dist/interface/assets/Terminal-D8zC4BIF.js +0 -4
- package/dist/interface/assets/VariableSuggestions-RN6Jmb60.js +0 -1
- package/dist/interface/assets/VersionsHandler-BZtmjoFr.js +0 -7
- package/dist/interface/assets/Workers-BPQIxEg9.js +0 -1
- package/dist/interface/assets/api-BXAjPStr.js +0 -1
- package/dist/interface/assets/api-Cy-xAQGE.css +0 -2
- package/dist/interface/assets/api-ip5Qz2cl.js +0 -2
- package/dist/interface/assets/cloudHandoff-DJ1YT2O6.js +0 -1
- package/dist/interface/assets/instances-AgSMbtUw.js +0 -1
- package/dist/interface/assets/locale-De9OgPRf.js +0 -1
- package/dist/interface/assets/main-BsF04agf.js +0 -3
- package/dist/interface/assets/round-restart-alt-DAOUjIH0.js +0 -1
- package/dist/interface/assets/router-ygEo0Buu.js +0 -2
- package/dist/interface/assets/types-Cq5Oxm4w.js +0 -1
- package/dist/interface/assets/useCameraOptions-DWRGUM7f.js +0 -1
- package/dist/interface/assets/useCuiCameraDrawer-D2QdlhvQ.js +0 -1
- package/dist/interface/assets/useCuiDialog-D1vgIZ97.js +0 -2
- package/dist/interface/assets/useLogsSocket-Dki7w7JS.js +0 -5
- package/dist/interface/assets/useSharedComposables-DNGRhsgh.js +0 -1
- package/dist/interface/assets/vendor-cameraui-dvS1_qYI.js +0 -1976
- package/dist/interface/assets/vendor-core-Dpu78NB8.js +0 -1
- package/dist/interface/assets/view-grid-Kk3PF5wP.js +0 -1
- package/dist/interface/assets/view-grid-ftaUV_r1.css +0 -1
|
@@ -1,1976 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime-DAXXjFlN.js";import{$ as o,$n as s,$t as c,An as l,At as u,B as d,Cn as f,Ct as p,Dn as m,Dt as h,En as g,Et as _,Ft as v,G as y,Gn as b,Gt as x,H as S,Hn as C,Ht as w,In as T,It as E,J as D,Jn as O,Jt as k,K as A,Lt as j,Mt as M,Nn as N,Nt as P,On as F,Ot as I,Pt as ee,Q as te,Qn as L,Qt as R,Rn as z,Rt as B,Sn as ne,St as re,Tn as ie,Tt as ae,U as oe,Un as se,Ut as ce,V as le,Vn as ue,W as de,Wn as fe,Wt as pe,X as me,Xn as he,Xt as V,Y as ge,Yn as _e,Yt as H,Z as ve,Zn as ye,Zt as be,_t as xe,ar as Se,at as Ce,bt as we,cr as Te,ct as Ee,dn as De,dr as Oe,dt as ke,et as Ae,ft as je,gn as Me,gt as Ne,hn as U,ht as Pe,in as Fe,ir as Ie,it as Le,jt as Re,kn as ze,ln as Be,lt as Ve,mt as He,nr as W,nt as Ue,on as We,or as G,ot as Ge,pt as Ke,q as qe,qt as Je,rn as Ye,rr as Xe,rt as Ze,sn as Qe,sr as K,st as $e,tn as et,tr as tt,tt as nt,un as rt,ur as it,ut as at,vt as ot,wn as q,wt as st,xt as ct,yn as lt,yt as ut,zn as dt}from"./vendor-TwHhULaP.js";function ft(e,t){return e===t?!0:!(!e||!t||e.endpoint.url!==t.endpoint.url||e.endpoint.mode!==t.endpoint.mode||e.tokens.access!==t.tokens.access||(e.tokens.proxySession??null)!==(t.tokens.proxySession??null))}function pt(e,t){return e===t?!1:!e||!t?!0:e.endpoint.url!==t.endpoint.url||e.endpoint.mode!==t.endpoint.mode}var mt=class{listeners=new Map;on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>{n.delete(t)}}emit(e,t){let n=this.listeners.get(e);if(n)for(let e of[...n])e(t)}clear(){this.listeners.clear()}},ht=new Map,gt=5e3;function _t(e,t,n){switch(t.type){case`RESET`:return e.kind===`idle`?e:{kind:`idle`};case`BOOT`:return e.kind!==`idle`&&e.kind!==`offline`&&e.kind!==`needs-auth`?e:{kind:`discovering`,instanceId:t.instanceId,attempt:1};case`USER_RETRY`:return e.kind===`offline`?{kind:`discovering`,instanceId:e.instanceId??``,attempt:1}:e.kind===`reconnecting`?{kind:`discovering`,instanceId:e.instanceId,attempt:1}:e.kind===`needs-auth`?{kind:`discovering`,instanceId:e.instanceId??``,attempt:1}:e.kind===`online`?{kind:`discovering`,instanceId:e.instanceId,attempt:1}:e;case`PROBE_SUCCEEDED`:return e.kind===`discovering`?{kind:`online`,instanceId:e.instanceId,target:{endpoint:t.endpoint,tokens:t.tokens},transports:ht}:e.kind===`reconnecting`?{kind:`online`,instanceId:e.instanceId,target:{endpoint:t.endpoint,tokens:t.tokens},transports:e.transports}:e;case`PROBE_FAILED_ALL`:{if(e.kind!==`discovering`&&e.kind!==`reconnecting`)return e;if(t.error===`needs-auth`)return{kind:`needs-auth`,instanceId:e.instanceId,reason:t.error};let r=e.kind===`discovering`?e.attempt:1,i=n.retryBackoffMs?.(r)??gt;return{kind:`offline`,instanceId:e.instanceId,lastError:t.error,nextRetryAt:n.now()+i}}case`TRANSPORT_UP`:if(e.kind===`online`)return{...e,transports:vt(e.transports,t.id,{up:!0})};if(e.kind===`reconnecting`){let r=vt(e.transports,t.id,{up:!0});return e.lastTarget&&yt(r,n)?{kind:`online`,instanceId:e.instanceId,target:e.lastTarget,transports:r}:{...e,transports:r}}return e;case`TRANSPORT_DOWN`:return e.kind===`online`||e.kind===`reconnecting`?{...e,transports:vt(e.transports,t.id,{up:!1,lastError:t.reason,downSince:n.now()})}:e;case`TRANSPORT_DOWN_CONFIRMED`:return e.kind!==`online`||!n.specs.get(t.id)?.phaseGating?e:{kind:`reconnecting`,instanceId:e.instanceId,lastTarget:e.target,cause:`transport-down`,since:n.now(),transports:vt(e.transports,t.id,{up:!1,lastError:`down-confirmed`,downSince:n.now()})};case`TOKENS_REFRESHED`:return e.kind===`online`?bt(e.target.tokens,t.tokens)?e:{...e,target:{...e.target,tokens:t.tokens}}:e.kind===`reconnecting`&&e.lastTarget?bt(e.lastTarget.tokens,t.tokens)?e:{...e,lastTarget:{...e.lastTarget,tokens:t.tokens}}:e;case`TOKENS_INVALID`:if(e.kind!==`online`&&e.kind!==`reconnecting`)return e;if(t.transient===!0){let r=n.retryBackoffMs?.(1)??gt;return{kind:`offline`,instanceId:e.instanceId,lastError:`tokens invalid: ${t.reason}`,nextRetryAt:n.now()+r}}return{kind:`needs-auth`,instanceId:e.instanceId,reason:`tokens invalid: ${t.reason}`};case`BACKOFF_HINT`:{if(e.kind!==`offline`)return e;let r=n.now(),i=r+t.retryAfterMs;return i<=e.nextRetryAt?e:{...e,nextRetryAt:i,backoffHint:{retryAfterMs:t.retryAfterMs,setAt:r,source:t.source}}}}}function vt(e,t,n){let r=new Map(e);return r.set(t,n),r}function yt(e,t){for(let[n,r]of t.specs)if(r.phaseGating&&!e.get(n)?.up)return!1;return!0}function bt(e,t){return e.access===t.access&&e.refresh===t.refresh&&e.accessExpiresAt===t.accessExpiresAt&&e.refreshExpiresAt===t.refreshExpiresAt&&e.proxySession===t.proxySession&&e.proxySessionExpiresAt===t.proxySessionExpiresAt&&e.proxyRefresh===t.proxyRefresh}function xt(e){let t=e.initial??{kind:`idle`},n=new Set,r=[],i=!1,a=!1;function o(o){if(!a){if(i){r.push(o);return}i=!0;try{let i=o;for(;i;){let a=t,o=_t(a,i,e.context);if(o!==a){t=o;for(let e of[...n])try{e(o,a,i)}catch(e){console.warn(`[kernel] listener threw on`,i.type,e)}}i=r.shift()}}finally{i=!1}}}function s(e){return n.add(e),()=>{n.delete(e)}}function c(){a=!0,n.clear(),r.length=0}return{get phase(){return t},dispatch:o,subscribe:s,dispose:c}}var St=[5e3,1e4,3e4,6e4];function Ct(e){let t=e.schedule??St;if(t.length===0)throw Error(`backoff: schedule must have at least one entry`);let n=e.now??(()=>Date.now()),r=e.setTimer??((e,t)=>setTimeout(e,t)),i=e.clearTimer??(e=>clearTimeout(e)),a,o=0,s=!1;function c(t){a!==void 0&&(i(a),a=void 0,t&&e.onCancelled?.(t))}function l(i,l){c(l?`rescheduled`:void 0);let u=t[Math.min(o,t.length-1)],d=Math.max(0,i.nextRetryAt-n()),f=Math.max(u,d);e.onScheduled?.(o+1,f),i.backoffHint&&d>u&&e.onHintApplied?.(f,i.backoffHint.source),a=r(()=>{a=void 0,!s&&e.kernel.phase.kind===`offline`&&(o+=1,e.onFire?.(o),e.kernel.dispatch({type:`USER_RETRY`}))},f)}let u=e.kernel.subscribe((e,t)=>{if(e.kind===`offline`&&t.kind!==`offline`){l(e,!1);return}if(e.kind===`offline`&&t.kind===`offline`&&e.nextRetryAt!==t.nextRetryAt){l(e,!0);return}t.kind===`offline`&&e.kind!==`offline`&&c(`phase-left-offline`),(e.kind===`online`||e.kind===`idle`)&&(o=0)});return e.kernel.phase.kind===`offline`&&l(e.kernel.phase,!1),()=>{s=!0,c(`detach`),u()}}var wt=`camera.ui:transport:target`;function Tt(e){let t=e.key??wt,n=e.source??(typeof window<`u`?window:void 0);if(!n)throw Error("attachCrossTab: no `source` provided and no global `window` available");function r(n){let r=n;if(r.key!==t)return;if(r.newValue===null){let t=e.kernel.phase.kind;if(t!==`online`&&t!==`reconnecting`)return;e.kernel.dispatch({type:`RESET`}),e.onResetReceived?.();return}let i;try{i=JSON.parse(r.newValue)}catch(t){e.onError?.(`parse`,t);return}if(!i?.tokens?.access)return;let a=e.kernel.phase.kind;a!==`online`&&a!==`reconnecting`||(e.kernel.dispatch({type:`TOKENS_REFRESHED`,tokens:i.tokens}),e.onTokensReceived?.(i.tokens))}return n.addEventListener(`storage`,r),()=>{n.removeEventListener(`storage`,r)}}function Et(e){let t=!1,n=n=>{t||e.onChange(e.kernel,n)};return e.source.addEventListener(`change`,n),()=>{t=!0,e.source.removeEventListener(`change`,n)}}var Dt=`camera.ui:transport:target`;function Ot(e){let t=e.key??Dt,n=e.onError??(()=>{}),r=!1,i=null;a();async function a(){let a;try{a=await e.storage.get(t)}catch(e){n(`get`,e),a=null}if(!r){if(i!==null){e.onRestore?.(i);return}if(!a){e.onRestore?.(null);return}try{let t=JSON.parse(a);if(!t?.endpoint?.url||!t?.tokens?.access){e.onRestore?.(null);return}i={endpoint:t.endpoint,tokens:t.tokens},e.onRestore?.(i)}catch(t){n(`parse`,t),e.onRestore?.(null)}}}async function o(r){let a={endpoint:r.endpoint,tokens:r.tokens,savedAt:Date.now(),version:1};i={endpoint:r.endpoint,tokens:r.tokens};try{await e.storage.set(t,JSON.stringify(a)),e.onPersist?.(r)}catch(e){n(`set`,e)}}async function s(){i=null;try{await e.storage.del(t),e.onClear?.()}catch(e){n(`del`,e)}}let c=e.kernel.subscribe((e,t)=>{if(r)return;let n=e.kind===`online`?e.target:e.kind===`reconnecting`?e.lastTarget:null,i=t.kind===`online`?t.target:t.kind===`reconnecting`?t.lastTarget:null;if(n&&n!==i){o(n);return}e.kind===`idle`&&t.kind!==`idle`&&s()});return{detach:()=>{r=!0,c()},peek:()=>i,seed:async e=>{r||await o(e)}}}function kt(e=globalThis.localStorage){if(!e)throw Error(`localStorageAdapter: localStorage is not available in this environment`);return{get(t){return e.getItem(t)},set(t,n){e.setItem(t,n)},del(t){e.removeItem(t)}}}var At=e=>{e.phase.kind===`offline`&&e.dispatch({type:`USER_RETRY`})};function jt(e){let t=e.networkSource===void 0?typeof globalThis<`u`&&`window`in globalThis?globalThis.window:null:e.networkSource,n=e.visibilitySource===void 0?typeof globalThis<`u`&&`document`in globalThis?globalThis.document:null:e.visibilitySource,r=e.onOnline??At,i=e.onOffline,a=[];if(t){let n=()=>r(e.kernel),o=()=>i?.(e.kernel);t.addEventListener(`online`,n),t.addEventListener(`offline`,o),a.push(()=>{t.removeEventListener(`online`,n),t.removeEventListener(`offline`,o)})}if(n&&(e.onVisibilityVisible||e.onVisibilityHidden)){let t=()=>{n.visibilityState===`hidden`?e.onVisibilityHidden?.(e.kernel):e.onVisibilityVisible?.(e.kernel)};n.addEventListener(`visibilitychange`,t),a.push(()=>{n.removeEventListener(`visibilitychange`,t)})}return()=>{for(let e of a)e();a.length=0}}var Mt={"direct-lan":2e3,"direct-wan":5e3},Nt=class extends Error{endpoint;cause;kind;constructor(e,t,n,r){super(e),this.name=`RaceFirstError`,this.endpoint=t,this.cause=n,this.kind=r}};function Pt(e,t={}){let{timeoutByMode:n=e=>Mt[e]??5e3,shortCircuit:r,parentSignal:i}=t;return new Promise((t,a)=>{if(e.length===0){a(new Nt(`raceFirst: no candidates`,{url:``,mode:`direct-lan`},void 0,`all-failed`));return}if(i?.aborted){a(new Nt(`raceFirst: parent aborted`,e[0].endpoint,void 0,`aborted`));return}let o=!1,s=e.length,c=new Map,l=[],u=[];function d(e){for(let e of u)clearTimeout(e);for(let t of l)t!==e&&t.abort()}function f(e,n,r){o||(o=!0,d(r),m&&i?.removeEventListener(`abort`,m),t({endpoint:e,value:n}))}function p(e){o||(o=!0,d(null),m&&i?.removeEventListener(`abort`,m),a(e))}let m=i?()=>p(new Nt(`raceFirst: parent aborted`,e[0].endpoint,void 0,`aborted`)):null;m&&i.addEventListener(`abort`,m),e.forEach(e=>{let t=new AbortController;l.push(t);let a=n(e.endpoint.mode),d=setTimeout(()=>t.abort(),a);u.push(d),e.run(t.signal).then(n=>f(e.endpoint,n,t),n=>{if(o){c.set(e.endpoint,n);return}let l=t.signal.aborted&&!i?.aborted?new Nt(`timeout (${a}ms)`,e.endpoint,n,`all-failed`):n;if(c.set(e.endpoint,l),r?.(l)){p(new Nt(`raceFirst: short-circuit`,e.endpoint,l,`short-circuit`));return}if(s--,s<=0){let[t,n]=[...c.entries()].find(([,e])=>e instanceof Nt?e.kind!==`all-failed`||!(e.cause instanceof Error&&e.cause.message===`aborted`):!0)??[e.endpoint,l];p(new Nt(`raceFirst: all candidates failed`,t,n,`all-failed`))}})})})}function Ft(e,t){let n=Error(t);return n.kind=e,n}function It(e){return e instanceof Error&&typeof e.kind==`string`}function Lt(e){let t,n=!1;function r(){t&&=(t.abort(),void 0)}async function i(){if(n)return;r();let a=new AbortController;t=a;let o;try{if(e.onDiscoverStart?.(),o=await e.discover(a.signal),a.signal.aborted)return;e.onDiscoverSuccess?.(o)}catch(t){if(a.signal.aborted)return;e.onDiscoverError?.(t);let n=t instanceof Error?`discover: ${t.message}`:`discover failed`;e.onAllFailed?.(n),e.kernel.dispatch({type:`PROBE_FAILED_ALL`,error:n});return}if(o.length===0){let t=`discover returned empty pool`;e.onAllFailed?.(t),e.kernel.dispatch({type:`PROBE_FAILED_ALL`,error:t});return}let s=e.lastTarget?.()?.tokens,c=o.map(t=>({endpoint:t,run:async n=>{e.onProbeStart?.(t);try{let r=await e.probe({endpoint:t,lastTokens:s,signal:n});return e.onProbeSuccess?.(t,r),r}catch(r){let i=n.aborted&&!a.signal.aborted&&!It(r),o=(e.timeoutByMode??(e=>Mt[e]??5e3))(t.mode),s=i?Ft(`transient`,`timeout (${o}ms)`):r;throw e.onProbeError?.(t,s),s}}}));try{let{endpoint:t,value:n}=await Pt(c,{timeoutByMode:e.timeoutByMode,parentSignal:a.signal,shortCircuit:e=>It(e)&&(e.kind===`needs-auth`||e.kind===`fatal`||e.kind===`aborted`)});if(a.signal.aborted)return;e.kernel.dispatch({type:`PROBE_SUCCEEDED`,endpoint:t,tokens:n})}catch(t){if(a.signal.aborted)return;let r=t instanceof Nt?t.cause:t;if(It(r)&&r.kind===`aborted`){setTimeout(()=>{n||i()},200);return}let o=It(r)&&r.kind===`needs-auth`?`needs-auth`:r instanceof Error?r.message:`all endpoints failed`;e.onAllFailed?.(o),e.kernel.dispatch({type:`PROBE_FAILED_ALL`,error:o})}}let a=e.kernel.subscribe((e,t)=>{e.kind===`discovering`&&t.kind!==`discovering`?i():e.kind!==`discovering`&&t.kind===`discovering`&&r()});return e.kernel.phase.kind===`discovering`&&i(),()=>{n=!0,r(),a()}}var Rt=12e3;function zt(e){let t=e.escalateAfterMs??Rt,n=e.setTimer??((e,t)=>setTimeout(e,t)),r=e.clearTimer??(e=>clearTimeout(e)),i,a=0,o=!1;function s(){i!==void 0&&(r(i),i=void 0)}function c(){s(),i=n(()=>{i=void 0,!o&&e.kernel.phase.kind===`reconnecting`&&(a+=1,e.onEscalate?.(a),e.kernel.dispatch({type:`USER_RETRY`}))},t)}let l=e.kernel.subscribe((e,t)=>{e.kind===`reconnecting`&&t.kind!==`reconnecting`?c():e.kind!==`reconnecting`&&t.kind===`reconnecting`&&s(),(e.kind===`online`||e.kind===`idle`)&&(a=0)});return e.kernel.phase.kind===`reconnecting`&&c(),()=>{o=!0,s(),l()}}var Bt=5e3,Vt=3,Ht=2e3;function Ut(e){let t=e.graceMs??Bt,n=e.isTransientError??(()=>!1),r=e.maxTransientRetries??Vt,i=e.transientRetryDelayMs??Ht,a=e.now??(()=>Date.now()),o=e.setTimer??((e,t)=>setTimeout(e,t)),s=e.clearTimer??(e=>clearTimeout(e)),c,l=!1,u=!1,d=0,f=!1,p=[];function m(){c!==void 0&&(s(c),c=void 0)}function h(n){m();let r=n.tokens.accessExpiresAt;if(!r)return;let i=Math.max(0,r-a()-t);e.onScheduled?.(i,r),c=o(()=>{c=void 0,g(`proactive`)},i)}async function g(s){if(u){e.onTriggerSkipped?.(s,`detached`,e.kernel.phase.kind);return}if(l){s===`auth-error`&&(f=!0),e.onTriggerSkipped?.(s,`already-inflight`,e.kernel.phase.kind);return}let p=e.kernel.phase,h=p.kind===`online`?p.target:p.kind===`reconnecting`?p.lastTarget:null;if(!h){e.onTriggerSkipped?.(s,`no-target`,p.kind);return}l=!0,e.onRefreshStart?.(s);try{let n=await(e.acquireRefreshLock??(e=>e()))(async()=>{let n=e.getLatestTokens?.();if(n?.accessExpiresAt&&n.accessExpiresAt>a()+t)return e.kernel.dispatch({type:`TOKENS_REFRESHED`,tokens:n}),{tokens:n,skipped:!0};let r=await e.refresh(h,s);return u||e.kernel.dispatch({type:`TOKENS_REFRESHED`,tokens:r}),{tokens:r,skipped:!1}});if(u)return;d=0,n.skipped?e.onRefreshSkipped?.(s,n.tokens):e.onRefreshSuccess?.(s,n.tokens)}catch(t){if(u)return;let a=n(t);if(a&&d<r){d++;let n=r-d;e.onRefreshError?.(s,t,{transient:!0,retriesLeft:n,willRetry:!0}),m(),c=o(()=>{c=void 0,g(s)},i)}else d=0,e.onRefreshError?.(s,t,{transient:a,retriesLeft:0,willRetry:!1}),e.kernel.dispatch({type:`TOKENS_INVALID`,reason:Wt(t),transient:a})}finally{l=!1,!u&&f&&(f=!1,g(`auth-error`))}}let _=e.kernel.subscribe((e,t)=>{e.kind===`online`?(t.kind!==`online`||t.target.tokens.access!==e.target.tokens.access)&&(d=0,h(e.target)):e.kind===`reconnecting`||(m(),d=0)});p.push(_);for(let t of e.transports){let e=t.on(`auth-error`,()=>{g(`auth-error`)});p.push(e)}e.kernel.phase.kind===`online`&&h(e.kernel.phase.target);function v(){u=!0,m();for(let e of p)e()}function y(){if(u)return;let n=e.kernel.phase,r=n.kind===`online`?n.target:n.kind===`reconnecting`?n.lastTarget:null;if(!r){e.onWakeChecked?.({decision:`no-target`,phase:n.kind});return}let i=r.tokens.accessExpiresAt;if(!i){e.onWakeChecked?.({decision:`no-expiry`,phase:n.kind});return}let o=i-a();o<t?(e.onWakeChecked?.({decision:`refresh-now`,remainingMs:o,phase:n.kind}),g(`proactive`)):e.onWakeChecked?.({decision:`still-fresh`,remainingMs:o,phase:n.kind})}return{detach:v,wake:y}}function Wt(e){return e instanceof Error?e.message:typeof e==`string`?e:`refresh-failed`}var Gt=Symbol(`transport-sync-skip`);function Kt(e){switch(e.kind){case`idle`:case`offline`:case`needs-auth`:return null;case`online`:return e.target;case`reconnecting`:return e.lastTarget;case`discovering`:return Gt}}function qt(e){let t=!1,n=!1,r=null;function i(i){if(!t&&!(n&&ft(r,i))){n=!0,r=i;for(let t of e.transports)t.apply(i).catch(n=>{e.onError?.(t,i,n)});e.onApplied?.(i)}}function a(e){let t=Kt(e);t!==Gt&&i(t)}a(e.kernel.phase);let o=e.kernel.subscribe(e=>{a(e)});return()=>{t=!0,o()}}var Jt=4e3;function Yt(e){let t=e.defaultGraceMs??Jt,n=e.setTimer??((e,t)=>setTimeout(e,t)),r=e.clearTimer??(e=>clearTimeout(e)),i=new Map,a=[],o=!1;function s(t,n){let a=i.get(t);a!==void 0&&(r(a),i.delete(t),e.onGraceCleared?.(t,n))}function c(e){for(let t of[...i.keys()])s(t,e)}for(let r of e.transports){let c=r.spec,l=r.on(`up`,()=>{o||(s(c.id,`up`),e.kernel.dispatch({type:`TRANSPORT_UP`,id:c.id}))}),u=r.on(`down`,r=>{if(o||(e.kernel.dispatch({type:`TRANSPORT_DOWN`,id:c.id,reason:r.reason}),!c.phaseGating)||e.kernel.phase.kind!==`online`||i.has(c.id))return;let a=c.graceMs??t;e.onGraceStarted?.(c.id,a);let s=n(()=>{i.delete(c.id),!o&&(e.onConfirmed?.(c.id),e.kernel.dispatch({type:`TRANSPORT_DOWN_CONFIRMED`,id:c.id}))},a);i.set(c.id,s)});a.push(l,u)}let l=e.kernel.subscribe((e,t)=>{t.kind===`online`&&e.kind!==`online`&&c(`phase-change`)});return a.push(l),()=>{o=!0,c(`detach`);for(let e of a)e()}}function Xt(e){let t=0,n=!1,r=new Map;function i(e){return t++,{type:`kernel-sync`,generation:t,phase:e}}function a(r){if(n)return;let a=i(r),o=0;for(let t of e.hosts())try{t.postMessage(a),o++,s(t)}catch(e){console.warn(`[workerBridge] broadcast postMessage failed`,{gen:a.generation,phase:r.kind,err:e})}e.onBroadcast?.(t,o)}function o(r){if(n)return;let a=i(e.kernel.phase);try{r.postMessage(a),s(r),e.onSyncHost?.(t)}catch(e){console.warn(`[workerBridge] syncOne postMessage failed`,{gen:a.generation,err:e})}}function s(t){if(!e.listenForResyncRequests||!t.addEventListener||r.has(t))return;let i=e=>{n||e.data?.type===`kernel-sync-request`&&o(t)};t.addEventListener(`message`,i),r.set(t,()=>{t.removeEventListener?.(`message`,i)})}let c=e.kernel.subscribe(e=>{a(e)});return{detach(){n=!0,c();for(let e of r.values())e();r.clear()},syncHost(e){o(e)},syncAll(){a(e.kernel.phase)},revalidateWorkers(){if(!n)for(let t of e.hosts())try{t.postMessage({type:`kernel-revalidate`}),s(t)}catch(e){console.warn(`[workerBridge] revalidate postMessage failed`,e)}}}}var Zt={id:`http`,kind:`request`,phaseGating:!1};function Qt(e={}){let t={...Zt,...e.spec},n=e.apiPrefix??`/api`,r=e.targetWaitMs??15e3,i=new mt,a=null,o={up:!1},s=!1,c=new Set,l=E.create({timeout:e.timeoutMs??3e4});function u(e){return a?Promise.resolve():new Promise((t,n)=>{let i={resolve:()=>{s(),t()},reject:e=>{s(),n(e)}},a=setTimeout(()=>i.reject(new E.Cancel(`http-transport: no target`)),r),o=()=>i.reject(new E.Cancel(`http-transport: aborted`));function s(){clearTimeout(a),c.delete(i),e?.removeEventListener?.(`abort`,o)}if(e?.aborted){i.reject(new E.Cancel(`http-transport: aborted`));return}e?.addEventListener?.(`abort`,o),c.add(i)})}function d(){if(a)for(let e of[...c])e.resolve()}l.interceptors.request.use(async e=>{a||await u(e.signal);let t=a;if(!t)throw new E.Cancel(`http-transport: no target`);return e.baseURL||=`${t.endpoint.url}${n}`,e.headers.set(`Authorization`,`Bearer ${t.tokens.access}`),t.tokens.proxySession&&e.headers.set(`X-Proxy-Session`,t.tokens.proxySession),e}),l.interceptors.response.use(e=>(o.up||(o={up:!0},i.emit(`up`,void 0)),e),e=>E.isCancel(e)?Promise.reject(e):e.response?(e.response.status===401&&i.emit(`auth-error`,{status:401,message:$t(e)}),Promise.reject(e)):(f(e.message??`network`),Promise.reject(e)));function f(e){(o.up||o.lastError!==e)&&(o={up:!1,lastError:e},i.emit(`down`,{reason:e}))}async function p(e){if(s)throw Error(`http-transport disposed`);if(ft(a,e))return;let t=pt(a,e);if(a=e,!e){o={up:!1},i.emit(`down`,{reason:`detached`});return}t&&(o={up:!1}),d()}function m(){return o}function h(e,t){return i.on(e,t)}async function g(){s=!0,a=null,o={up:!1};for(let e of[...c])e.reject(new E.Cancel(`http-transport: disposed`));i.clear()}return{spec:t,client:l,apply:p,health:m,on:h,dispose:g}}function $t(e){let t=e.response?.data;return t&&typeof t==`object`&&`message`in t&&typeof t.message==`string`?t.message:e.message}function en(...e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;let n=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++)n.set(e[t],r),r+=e[t].length;return n}function tn(...e){let t=[];for(let n=0;n<e.length;n++)t.push(an.encode(e[n]));return t.length===0?rn:t.length===1?t[0]:en(...t)}function nn(e){return!e||e.length===0?``:on.decode(e)}var rn,an,on,sn=n((()=>{rn=new Uint8Array,an=new TextEncoder,on=new TextDecoder})),cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn=n((()=>{cn=class extends Error{constructor(e,t){super(`illegal subject: '${e}'`,t),this.name=`InvalidSubjectError`}},ln=class e extends Error{constructor(e,t){super(e,t),this.name=`InvalidArgumentError`}static format(t,n,r){return Array.isArray(n)&&n.length>1&&(n=n[0]),Array.isArray(t)?(t=t.map(e=>`'${e}'`),t=t.join(`,`)):t=`'${t}'`,new e(`${t} ${n}`,r)}},un=class extends Error{constructor(e,t){super(e,t),this.name=`InvalidOperationError`}},dn=class e extends Error{constructor(e,t){super(e,t),this.name=`UserAuthenticationExpiredError`}static parse(t){return t.toLowerCase().indexOf(`user authentication expired`)===-1?null:new e(t)}},fn=class e extends Error{constructor(e,t){super(e,t),this.name=`AuthorizationError`}static parse(t){let n=[`authorization violation`,`account authentication expired`,`authentication timeout`],r=t.toLowerCase();for(let i=0;i<n.length;i++)if(r.indexOf(n[i])!==-1)return new e(t);return null}},pn=class extends Error{constructor(){super(`closed connection`),this.name=`ClosedConnectionError`}},mn=class extends Error{constructor(){super(`connection draining`),this.name=`DrainingConnectionError`}},hn=class extends Error{constructor(e,t){super(e,t),this.name=`ConnectionError`}},gn=class extends Error{constructor(e,t){super(e,t),this.name=`ProtocolError`}},_n=class extends Error{constructor(e=``,t){super(e,t),this.name=`RequestError`}isNoResponders(){return this.cause instanceof yn}},vn=class extends Error{constructor(e){super(`timeout`,e),this.name=`TimeoutError`}},yn=class extends Error{subject;constructor(e,t){super(`no responders: '${e}'`,t),this.subject=e,this.name=`NoResponders`}},bn=class e extends Error{operation;subject;queue;constructor(e,t,n,r,i){super(e,i),this.name=`PermissionViolationError`,this.operation=t,this.subject=n,this.queue=r}static parse(t){if((t?t.toLowerCase():``).indexOf(`permissions violation`)===-1)return null;let n=`publish`,r=``,i,a=t.match(/(Publish|Subscription) to "(\S+)"/);if(a&&(n=a[1].toLowerCase(),r=a[2],n===`subscription`)){let e=t.match(/using queue "(\S+)"/);e&&(i=e[1])}return new e(t,n,r,i)}},xn={AuthorizationError:fn,ClosedConnectionError:pn,ConnectionError:hn,DrainingConnectionError:mn,InvalidArgumentError:ln,InvalidOperationError:un,InvalidSubjectError:cn,NoRespondersError:yn,PermissionViolationError:bn,ProtocolError:gn,RequestError:_n,TimeoutError:vn,UserAuthenticationExpiredError:dn}}));function Cn(e,...t){for(let n=0;n<t.length;n++){let r=t[n];Object.keys(r).forEach(function(t){e[t]=r[t]})}return e}function wn(e){return on.decode(e).replace(/\n/g,`␊`).replace(/\r/g,`␍`)}function Tn(e,t=!0){let n=t?new vn:null,r,i,a=new Promise((t,a)=>{r={cancel:()=>{i&&clearTimeout(i)}},i=setTimeout(()=>{a(n===null?new vn:n)},e)});return Object.assign(a,r)}function En(e=0){let t,n=new Promise(n=>{let r=setTimeout(()=>{n()},e);t={cancel:()=>{r&&(clearTimeout(r),n())}}});return Object.assign(n,t)}async function Dn(e,t=1e3){let n=On(),r=setTimeout(()=>{n.reject(new vn)},t);try{return await Promise.race([e,n])}finally{clearTimeout(r)}}function On(){let e={},t=new Promise((t,n)=>{e={resolve:t,reject:n}});return Object.assign(t,e)}function kn(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e}async function An(e){let t=[];for await(let n of e)t.push(n);return t}function jn(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function Mn(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);let t=e.length-1;return{backoff(n){return jn(n>t?e[t]:e[n])}}}function Nn(e){return e*1e6}function Pn(e){return Math.floor(e/1e6)}function Fn(){let e=Math.floor(Math.random()*Bn),t=e%62,n=zn[t];e=(e-t)/62,t=e%62;let r=zn[t];e=(e-t)/62,t=e%62;let i=zn[t];e=(e-t)/62,t=e%62;let a=zn[t];e=(e-t)/62,t=e%62;let o=zn[t];e=(e-t)/62,t=e%62;let s=zn[t];e=(e-t)/62,t=e%62;let c=zn[t];e=(e-t)/62;let l=zn[e];return String.fromCharCode(n,r,i,a,o,s,c,l)}var In,Ln,Rn,zn,Bn,Vn=n((()=>{sn(),Sn(),In=class{timers;measures;constructor(){this.timers=new Map,this.measures=new Map}mark(e){this.timers.set(e,performance.now())}measure(e,t,n){let r=this.timers.get(t);if(r===void 0)throw Error(`${t} is not defined`);let i=this.timers.get(n);if(i===void 0)throw Error(`${n} is not defined`);this.measures.set(e,i-r)}getEntries(){let e=[];return this.measures.forEach((t,n)=>{e.push({name:n,duration:t})}),e}},Ln=class{max;current;waiting;constructor(e=1){this.max=e,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let e=On();return this.waiting.push(e),e}unlock(){this.current--,this.waiting.pop()?.resolve()}},Rn=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,zn=new Uint8Array(62);for(let e=0;e<62;e++)zn[e]=Rn.charCodeAt(e);Bn=0xc694446f0100})),Hn=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.nuid=e.NuidImpl=void 0;var t=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,n=62,r=12,i=10,a=33,o=333,s=22,c=new Uint8Array(n);for(let e=0;e<n;e++)c[e]=t.charCodeAt(e);var l=4294967296,u=BigInt(n)**BigInt(i),d=Number(u/(1n<<32n)),f=Number(u%(1n<<32n));function p(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}function m(e){globalThis?.crypto?.getRandomValues?globalThis.crypto.getRandomValues(e):p(e)}var h=class{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(s),this.cbuf=new Uint8Array(r),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let e=0;do this.seqHi=Math.floor(Math.random()*(d+1)),this.seqLo=Math.floor(Math.random()*l);while(e++<8&&this.seqHi===d&&this.seqLo>=f);this.seqHi===d&&this.seqLo>=f&&(this.seqLo=0),this.inc=Math.random()*(o-a)+a|0}setPre(){m(this.cbuf);for(let e=0;e<r;e++)this.buf[e]=c[this.cbuf[e]%n]}fillSeq(){let e=this.seqHi,t=this.seqLo;for(let i=s-1;i>=r;i--){let r=Math.floor(e/n),a=(e-r*n)*l+t,o=Math.floor(a/n),s=a-o*n;this.buf[i]=c[s],e=r,t=o}}next(){this.inited||this.init(),this.seqLo+=this.inc,this.seqLo>=l&&(this.seqLo-=l,this.seqHi+=1),(this.seqHi>d||this.seqHi===d&&this.seqLo>=f)&&(this.setPre(),this.initSeqAndInc()),this.fillSeq();let e=this.buf;return String.fromCharCode(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15],e[16],e[17],e[18],e[19],e[20],e[21])}reset(){this.init()}};e.NuidImpl=h,e.nuid=new h})),Un=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.nuid=e.Nuid=void 0;var t=Hn();e.Nuid=t.NuidImpl,e.nuid=t.nuid})),Wn,Gn=n((()=>{Wn=Un()}));function Kn(e){let t=e[Symbol.asyncIterator]();return{async next(){let e=await t.next();return e.done?Promise.resolve(null):Promise.resolve(e.value)}}}function qn(e=``){if(e||=`_INBOX`,typeof e!=`string`)throw TypeError(`prefix must be a string`);return e.split(`.`).forEach(t=>{if(t===`*`||t===`>`)throw ln.format(`prefix`,`cannot have wildcards ('${e}')`)}),`${e}.${Wn.nuid.next()}`}var Jn,Yn,Xn,Zn=n((()=>{Gn(),Sn(),Jn={Exact:`exact`,CanonicalMIME:`canonical`,IgnoreCase:`insensitive`},Yn=4222,Xn=`127.0.0.1`})),Qn,$n=n((()=>{sn(),Qn=class{buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;let n=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++)n.set(e[t],r),r+=e[t].length;return n}static fromAscii(e){return e||=``,an.encode(e)}static toAscii(e){return on.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){let e=new Uint8Array(this.byteLength),t=0;for(let n=0;n<this.buffers.length;n++)e.set(this.buffers[n],t),t+=this.buffers[n].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){let e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array}drain(e){if(this.buffers.length){this.pack();let t=this.buffers.pop();if(t){let n=this.byteLength;(e===void 0||e>n)&&(e=n);let r=t.subarray(0,e);return n>e&&this.buffers.push(t.subarray(e)),this.byteLength=n-e,r}}return new Uint8Array}fill(e,...t){e&&(this.buffers.push(e),this.byteLength+=e.length);for(let e=0;e<t.length;e++)t[e]&&t[e].length&&(this.buffers.push(t[e]),this.byteLength+=t[e].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array}size(){return this.byteLength}length(){return this.buffers.length}}}));function er(e){sr=e}function tr(){return sr!==void 0&&sr.defaultPort!==void 0?sr.defaultPort:Yn}function nr(){return sr!==void 0&&sr.urlParseFn?sr.urlParseFn:void 0}function rr(){if(!sr||typeof sr.factory!=`function`)throw Error(`transport fn is not set`);return sr.factory()}function ir(){return sr!==void 0&&sr.dnsResolveFn?sr.dnsResolveFn:void 0}function ar(e){for(let t=0;t<e.length;t++){let n=t+1;if(e.byteLength>n&&e[t]===lr&&e[n]===ur)return n+1}return 0}function or(e){let t=ar(e);if(t>0){let n=new Uint8Array(e).slice(0,t);return on.decode(n)}return``}var sr,cr,lr,ur,dr=n((()=>{sn(),Zn(),$n(),cr=Qn.fromAscii(`\r
|
|
2
|
-
`),lr=new Uint8Array(cr)[0],ur=new Uint8Array(cr)[1]}));function fr(e,t,n,r){let i=new Uint8Array(br);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((e,t)=>{i[t]=e}),i[12]=e,i[13]=t,i[14]=n,i[15]=r,i}function pr(e){return mr(e)!==void 0}function mr(e){for(let t=0;t<e.length;t++)switch(e[t]){case`.`:return hr(e);case`:`:return gr(e)}}function hr(e){let t=new Uint8Array(yr);for(let n=0;n<yr;n++){if(e.length===0)return;if(n>0){if(e[0]!==`.`)return;e=e.substring(1)}let{n:r,c:i,ok:a}=_r(e);if(!a||r>255)return;e=e.substring(i),t[n]=r}return fr(t[0],t[1],t[2],t[3])}function gr(e){let t=new Uint8Array(br),n=-1;if(e.length>=2&&e[0]===`:`&&e[1]===`:`&&(n=0,e=e.substring(2),e.length===0))return t;let r=0;for(;r<br;){let{n:i,c:a,ok:o}=vr(e);if(!o||i>65535)return;if(a<e.length&&e[a]===`.`){if(n<0&&r!=br-yr||r+yr>br)return;let i=hr(e);if(i===void 0)return;t[r]=i[12],t[r+1]=i[13],t[r+2]=i[14],t[r+3]=i[15],e=``,r+=yr;break}if(t[r]=i>>8,t[r+1]=i,r+=2,e=e.substring(a),e.length===0)break;if(e[0]!==`:`||e.length==1)return;if(e=e.substring(1),e[0]===`:`){if(n>=0)return;if(n=r,e=e.substring(1),e.length===0)break}}if(e.length===0){if(r<br){if(n<0)return;let e=br-r;for(let i=r-1;i>=n;i--)t[i+e]=t[i];for(let r=n+e-1;r>=n;r--)t[r]=0}else if(n>=0)return;return t}}function _r(e){let t=0,n=0;for(t=0;t<e.length&&xr<=e.charCodeAt(t)&&e.charCodeAt(t)<=Sr;t++)if(n=n*10+(e.charCodeAt(t)-xr),n>=Dr)return{n:Dr,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n,c:t,ok:!0}}function vr(e){let t=0,n=0;for(n=0;n<e.length;n++){if(xr<=e.charCodeAt(n)&&e.charCodeAt(n)<=Sr)t*=16,t+=e.charCodeAt(n)-xr;else if(Tr<=e.charCodeAt(n)&&e.charCodeAt(n)<=Er)t*=16,t+=e.charCodeAt(n)-Tr+10;else if(Cr<=e.charCodeAt(n)&&e.charCodeAt(n)<=wr)t*=16,t+=e.charCodeAt(n)-Cr+10;else break;if(t>=Dr)return{n:0,c:n,ok:!1}}return n===0?{n:0,c:n,ok:!1}:{n:t,c:n,ok:!0}}var yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or=n((()=>{yr=4,br=16,xr=48,Sr=57,Cr=65,wr=70,Tr=97,Er=102,Dr=16777215}));function kr(e){return e.indexOf(`[`)!==-1||e.indexOf(`::`)!==-1?!1:e.indexOf(`.`)!==-1||e.split(`:`).length<=2}function Ar(e){return!kr(e)}function jr(e){let t=e.toUpperCase().indexOf(`::FFFF:`);if(t!==-1&&e.indexOf(`.`)!==-1){let n=e.substring(t+7);return n=n.replace(`[`,``),n.replace(`]`,``)}return e}function Mr(e){e=e.trim(),e.match(/^(.*:\/\/)(.*)/m)&&(e=e.replace(/^(.*:\/\/)(.*)/gm,`$2`)),e=jr(e),Ar(e)&&e.indexOf(`[`)===-1&&(e=`[${e}]`);let t=Ar(e)?e.match(/(]:)(\d+)/):e.match(/(:)(\d+)/),n=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):Yn,r=new URL(`${n===80?`https`:`http`}://${e}`);r.port=`${n}`;let i=r.hostname;return i.charAt(0)===`[`&&(i=i.substring(1,i.length-1)),{listen:r.host,hostname:i,port:n}}var Nr,Pr,Fr=n((()=>{dr(),Vn(),Or(),Zn(),Sn(),Nr=class e{src;listen;hostname;port;didConnect;reconnects;lastConnect;gossiped;tlsName;resolves;constructor(e,t=!1){this.src=e,this.tlsName=``;let n=Mr(e);this.listen=n.listen,this.hostname=n.hostname,this.port=n.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=t}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];let n=[];if(pr(this.hostname))return[this];{let r=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${r.join(`,`)}`);for(let t of r){let r=this.port===80?`https`:`http`,i=new URL(`${r}://${Ar(t)?`[`+t+`]`:t}`);i.port=`${this.port}`;let a=new e(i.host,!1);a.tlsName=this.hostname,n.push(a)}}return t.randomize&&kn(n),this.resolves=n,n}},Pr=class e{firstSelect;servers;currentServer;tlsName;randomize;constructor(e={}){this.firstSelect=!0,this.servers=[],this.tlsName=``,this.randomize=e.randomize||!1}setServers(e){if(!Array.isArray(e)||e.length===0)throw ln.format(`servers`,`cannot be empty`);let t=nr(),n=new Map;for(let e of this.servers)n.set(e.listen,e);let r=[];for(let i of e){i=t?t(i):i;let{listen:e}=Mr(i),a=n.get(e);a?(a.gossiped=!1,a.src!==i&&(a.src=i),r.push(a)):r.push(new Nr(i))}this.randomize&&kn(r),this.servers=r,(this.currentServer===void 0||!r.includes(this.currentServer))&&(this.currentServer=r[0],this.firstSelect=!0)}clear(){this.servers.length=0}updateTLSName(){let e=this.getCurrentServer();pr(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(e=>{e.gossiped&&(e.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,t=!1){let n=nr();e=n?n(e):e;let r=new Nr(e,t);pr(r.hostname)&&(r.tlsName=this.tlsName),this.servers.push(r)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;let e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){let t=this.servers.indexOf(e);this.servers.splice(t,1)}}snapshot(){return e.freezeAll(this.servers)}snapshotForHandler(){let t=this.currentServer;if(!t)return this.snapshot();let n=this.servers.indexOf(t);return n<=0?this.snapshot():e.freezeAll([t,...this.servers.slice(0,n),...this.servers.slice(n+1)])}static freezeAll(e){return e.map(e=>Object.freeze({hostname:e.hostname,port:e.port,listen:e.listen,src:e.src,tlsName:e.tlsName,reconnects:e.reconnects,lastConnect:e.lastConnect,gossiped:e.gossiped,didConnect:e.didConnect}))}find(e){return this.servers.find(t=>t.listen===e.listen)}setCurrent(e){this.currentServer=e}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(e,t){let n=[],r=[],i=nr(),a=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(e=>{e=i?i(e,t):e;let n=new Nr(e,!0);a.set(e,n)});let o=[];if(this.servers.forEach((e,t)=>{let n=e.listen;e.gossiped&&this.currentServer.listen!==n&&a.get(n)===void 0&&o.push(t),a.delete(n)}),o.reverse(),o.forEach(e=>{let t=this.servers.splice(e,1);r=r.concat(t[0].listen)}),a.forEach((e,t)=>{this.servers.push(e),n.push(t)}),this.randomize&&n.length>0){let e=this.currentServer,t=this.servers.filter(t=>t!==e);kn(t),this.servers=e?[e,...t]:t}return{added:n,deleted:r}}}})),Ir,Lr=n((()=>{Vn(),Sn(),Ir=class{inflight;processed;received;noIterator;iterClosed;done;signal;yields;filtered;pendingFiltered;ctx;_data;err;time;profile;yielding;didBreak;constructor(){this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=On(),this.yields=[],this.iterClosed=On(),this.time=0,this.yielding=!1,this.didBreak=!1,this.profile=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(!this.done){if(this.didBreak){if(typeof e==`function`){let t=e;try{t()}catch{}}return}typeof e==`function`&&this.pendingFiltered++,this.yields.push(e),this.signal.resolve()}}async*iterate(){if(this.noIterator)throw new un(`iterator cannot be used when a callback is registered`);if(this.yielding)throw new un(`iterator is already yielding`);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;let e=this.yields;this.inflight=e.length,this.yields=[];for(let t=0;t<e.length;t++){if(typeof e[t]==`function`){this.pendingFiltered--;let n=e[t];try{n()}catch(e){throw e}if(this.err)throw this.err;continue}this.processed++,this.inflight--;let n=this.profile?Date.now():0;yield e[t],this.time=this.profile?Date.now()-n:0}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=On())}}finally{this.didBreak=!0,this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}})),Rr,zr=n((()=>{Zn(),Sn(),Rr=class{baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${qn(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){let t=e.subject||``;return t.indexOf(this.baseInbox)===0?t.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,t){if(e)return this.all().forEach(e=>{e.resolver(t,{})}),!0;if(t.operation===`publish`){let e=this.all().find(e=>e.requestSubject===t.subject);if(e)return e.resolver(t,{}),!0}return!1}dispatcher(){return(e,t)=>{let n=this.getToken(t);if(n){let r=this.get(n);r&&(e===null&&(e=t?.data?.length===0&&t.headers?.code===503?new yn(r.requestSubject):null),r.resolver(e,t))}}}close(){let e=new _n(`connection closed`);this.reqs.forEach(t=>{t.resolver(e,{})})}}})),Br,Vr=n((()=>{Vn(),Br=class{ph;interval;maxOut;timeout;timer;pendings;constructor(e,t,n,r=0){this.ph=e,this.interval=t,this.maxOut=n,this.timeout=r,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&=(clearTimeout(this.timer),void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:`ping`,pendingPings:this.pendings.length+1}),this.pendings.length===this.maxOut){this.cancel(!0);return}let e=On(),t;this.timeout>0&&(t=setTimeout(()=>{t=void 0,this.cancel(!0)},this.timeout));let n=()=>{t!==void 0&&(clearTimeout(t),t=void 0)};this.ph.flush(e).then(()=>{n(),this._reset()}).catch(()=>{n(),this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}}));function Hr(e,t=`Assertion failed.`){if(!e)throw new Kr(t)}function Ur(e,t,n=0){let r=t.byteLength-n;return e.byteLength>r&&(e=e.subarray(0,r)),t.set(e,n),e.byteLength}function Wr(e){let t=new Yr;return t.readFrom(e),t.bytes()}function Gr(e,t){let n=0;for(;n<t.length;)n+=e.write(t.subarray(n))}var Kr,qr,Jr,Yr,Xr=n((()=>{sn(),Kr=class extends Error{constructor(e){super(e),this.name=`AssertionError`}},qr=32*1024,Jr=2**32-2,Yr=class{_buf;_off;constructor(e){if(this._off=0,e==null){this._buf=new Uint8Array;return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error(`bytes.Buffer: truncation out of range`);this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){let t=this._buf.byteLength;return e<=this.capacity-t?(this._reslice(t+e),t):-1}_reslice(e){Hr(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){let e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;let t=Ur(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(an.encode(e))}write(e){let t=this._grow(e.byteLength);return Ur(e,this._buf,t)}_grow(e){let t=this.length;t===0&&this._off!==0&&this.reset();let n=this._tryGrowByReslice(e);if(n>=0)return n;let r=this.capacity;if(e<=Math.floor(r/2)-t)Ur(this._buf.subarray(this._off),this._buf);else if(r+e>Jr)throw Error(`The buffer cannot be grown beyond the maximum size.`);else{let t=new Uint8Array(Math.min(2*r+e,Jr));Ur(this._buf.subarray(this._off),t),this._buf=t}return this._off=0,this._reslice(Math.min(t+e,Jr)),t}grow(e){if(e<0)throw Error(`Buffer._grow: negative count`);let t=this._grow(e);this._reslice(t)}readFrom(e){let t=0,n=new Uint8Array(qr);for(;;){let r=this.capacity-this.length<qr,i=r?n:new Uint8Array(this._buf.buffer,this.length),a=e.read(i);if(a===null)return t;r?this.write(i.subarray(0,a)):this._reslice(this.length+a),t+=a}}}}));function Zr(e){let t,n=``;switch(e.kind){case $r.MSG:t=`MSG`;break;case $r.OK:t=`OK`;break;case $r.ERR:t=`ERR`,n=on.decode(e.data);break;case $r.PING:t=`PING`;break;case $r.PONG:t=`PONG`;break;case $r.INFO:t=`INFO`,n=on.decode(e.data)}return`${t}: ${n}`}function Qr(){let e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}var $r,ei,ti,ni,ri,J,Y,ii=n((()=>{Xr(),sn(),$r={OK:0,ERR:1,MSG:2,INFO:3,PING:4,PONG:5},ei=48,ti=57,ni=64*1024*1024,ri=class{dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor(e){this.dispatcher=e,this.state=J.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let t;for(t=0;t<e.length;t++){let n=e[t];switch(this.state){case J.OP_START:switch(n){case Y.M:case Y.m:this.state=J.OP_M,this.hdr=-1,this.ma=Qr();break;case Y.H:case Y.h:this.state=J.OP_H,this.hdr=0,this.ma=Qr();break;case Y.P:case Y.p:this.state=J.OP_P;break;case Y.PLUS:this.state=J.OP_PLUS;break;case Y.MINUS:this.state=J.OP_MINUS;break;case Y.I:case Y.i:this.state=J.OP_I;break;default:throw this.fail(e.subarray(t))}break;case J.OP_H:switch(n){case Y.M:case Y.m:this.state=J.OP_M;break;default:throw this.fail(e.subarray(t))}break;case J.OP_M:switch(n){case Y.S:case Y.s:this.state=J.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case J.OP_MS:switch(n){case Y.G:case Y.g:this.state=J.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case J.OP_MSG:switch(n){case Y.SPACE:case Y.TAB:this.state=J.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case J.OP_MSG_SPC:switch(n){case Y.SPACE:case Y.TAB:continue;default:this.state=J.MSG_ARG,this.as=t}break;case J.MSG_ARG:switch(n){case Y.CR:this.drop=1;break;case Y.NL:{let n=this.argBuf?this.argBuf.bytes():e.subarray(this.as,t-this.drop);this.processMsgArgs(n),this.drop=0,this.as=t+1,this.state=J.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case J.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){let e=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:$r.MSG,msg:this.ma,data:e}),this.argBuf=void 0,this.msgBuf=void 0,this.state=J.MSG_END}else{let r=this.ma.size-this.msgBuf.length,i=e.length-t;i<r&&(r=i),r>0?(this.msgBuf.write(e.subarray(t,t+r)),t=t+r-1):this.msgBuf.writeByte(n)}else t-this.as>=this.ma.size&&(this.dispatcher.push({kind:$r.MSG,msg:this.ma,data:e.subarray(this.as,t)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=J.MSG_END);break;case J.MSG_END:switch(n){case Y.NL:this.drop=0,this.as=t+1,this.state=J.OP_START;break;default:continue}break;case J.OP_PLUS:switch(n){case Y.O:case Y.o:this.state=J.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case J.OP_PLUS_O:switch(n){case Y.K:case Y.k:this.state=J.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case J.OP_PLUS_OK:switch(n){case Y.NL:this.dispatcher.push({kind:$r.OK}),this.drop=0,this.state=J.OP_START;break}break;case J.OP_MINUS:switch(n){case Y.E:case Y.e:this.state=J.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case J.OP_MINUS_E:switch(n){case Y.R:case Y.r:this.state=J.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case J.OP_MINUS_ER:switch(n){case Y.R:case Y.r:this.state=J.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case J.OP_MINUS_ERR:switch(n){case Y.SPACE:case Y.TAB:this.state=J.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case J.OP_MINUS_ERR_SPC:switch(n){case Y.SPACE:case Y.TAB:continue;default:this.state=J.MINUS_ERR_ARG,this.as=t}break;case J.MINUS_ERR_ARG:switch(n){case Y.CR:this.drop=1;break;case Y.NL:{let n;this.argBuf?(n=this.argBuf.bytes(),this.argBuf=void 0):n=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:$r.ERR,data:n}),this.drop=0,this.as=t+1,this.state=J.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case J.OP_P:switch(n){case Y.I:case Y.i:this.state=J.OP_PI;break;case Y.O:case Y.o:this.state=J.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case J.OP_PO:switch(n){case Y.N:case Y.n:this.state=J.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case J.OP_PON:switch(n){case Y.G:case Y.g:this.state=J.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case J.OP_PONG:switch(n){case Y.NL:this.dispatcher.push({kind:$r.PONG}),this.drop=0,this.state=J.OP_START;break}break;case J.OP_PI:switch(n){case Y.N:case Y.n:this.state=J.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case J.OP_PIN:switch(n){case Y.G:case Y.g:this.state=J.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case J.OP_PING:switch(n){case Y.NL:this.dispatcher.push({kind:$r.PING}),this.drop=0,this.state=J.OP_START;break}break;case J.OP_I:switch(n){case Y.N:case Y.n:this.state=J.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case J.OP_IN:switch(n){case Y.F:case Y.f:this.state=J.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case J.OP_INF:switch(n){case Y.O:case Y.o:this.state=J.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case J.OP_INFO:switch(n){case Y.SPACE:case Y.TAB:this.state=J.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case J.OP_INFO_SPC:switch(n){case Y.SPACE:case Y.TAB:continue;default:this.state=J.INFO_ARG,this.as=t}break;case J.INFO_ARG:switch(n){case Y.CR:this.drop=1;break;case Y.NL:{let n;this.argBuf?(n=this.argBuf.bytes(),this.argBuf=void 0):n=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:$r.INFO,data:n}),this.drop=0,this.as=t+1,this.state=J.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}(this.state===J.MSG_ARG||this.state===J.MINUS_ERR_ARG||this.state===J.INFO_ARG)&&!this.argBuf&&(this.argBuf=new Yr(e.subarray(this.as,t-this.drop))),this.state===J.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new Yr(e.subarray(this.as)))}cloneMsgArg(){let e=this.ma.subject.length,t=this.ma.reply?this.ma.reply.length:0,n=new Uint8Array(e+t);n.set(this.ma.subject),this.ma.reply&&n.set(this.ma.reply,e),this.argBuf=new Yr(n),this.ma.subject=n.subarray(0,e),this.ma.reply&&(this.ma.reply=n.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);let t=[],n=-1;for(let r=0;r<e.length;r++)switch(e[r]){case Y.SPACE:case Y.TAB:case Y.CR:case Y.NL:n>=0&&(t.push(e.subarray(n,r)),n=-1);break;default:n<0&&(n=r)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 3:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(t[2],ni);break;case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.size=this.protoParseInt(t[3],ni);break;default:throw this.fail(e,`processMsgArgs Parse Error`)}if(this.ma.sid<0)throw this.fail(e,`processMsgArgs Bad or Missing Sid Error`);if(this.ma.size<0)throw this.fail(e,`processMsgArgs Bad or Missing Size Error`)}fail(e,t=``){return t=t?`${t} [${this.state}]`:`parse error [${this.state}]`,Error(`${t}: ${on.decode(e)}`)}processHeaderMsgArgs(e){let t=[],n=-1;for(let r=0;r<e.length;r++)switch(e[r]){case Y.SPACE:case Y.TAB:case Y.CR:case Y.NL:n>=0&&(t.push(e.subarray(n,r)),n=-1);break;default:n<0&&(n=r)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(t[2],ni),this.ma.size=this.protoParseInt(t[3],ni);break;case 5:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.hdr=this.protoParseInt(t[3],ni),this.ma.size=this.protoParseInt(t[4],ni);break;default:throw this.fail(e,`processHeaderMsgArgs Parse Error`)}if(this.ma.sid<0)throw this.fail(e,`processHeaderMsgArgs Bad or Missing Sid Error`);if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,`processHeaderMsgArgs Bad or Missing Header Size Error`);if(this.ma.size<0)throw this.fail(e,`processHeaderMsgArgs Bad or Missing Size Error`)}protoParseInt(e,t){if(e.length===0||e.length>15)return-1;let n=0;for(let t=0;t<e.length;t++){if(e[t]<ei||e[t]>ti)return-1;n=n*10+(e[t]-ei)}return t!==void 0&&n>t?-1:n}},J={OP_START:0,OP_PLUS:1,OP_PLUS_O:2,OP_PLUS_OK:3,OP_MINUS:4,OP_MINUS_E:5,OP_MINUS_ER:6,OP_MINUS_ERR:7,OP_MINUS_ERR_SPC:8,MINUS_ERR_ARG:9,OP_M:10,OP_MS:11,OP_MSG:12,OP_MSG_SPC:13,MSG_ARG:14,MSG_PAYLOAD:15,MSG_END:16,OP_H:17,OP_P:18,OP_PI:19,OP_PIN:20,OP_PING:21,OP_PO:22,OP_PON:23,OP_PONG:24,OP_I:25,OP_IN:26,OP_INF:27,OP_INFO:28,OP_INFO_SPC:29,INFO_ARG:30},Y={CR:13,E:69,e:101,F:70,f:102,G:71,g:103,H:72,h:104,I:73,i:105,K:75,k:107,M:77,m:109,MINUS:45,N:78,n:110,NL:10,O:79,o:111,P:80,p:112,PLUS:43,R:82,r:114,S:83,s:115,SPACE:32,TAB:9}}));function ai(e){let t=!0,n=Array(e.length);for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i===58||i<33||i>126)throw ln.format(`header`,`'${e[r]}' is not a valid character in a header name`);t&&97<=i&&i<=122?i-=32:!t&&65<=i&&i<=90&&(i+=32),n[r]=i,t=i==45}return String.fromCharCode(...n)}function oi(e=0,t=``){if(e===0&&t!==``)throw ln.format(`code`,`is required`);if(e>0&&t===``)throw ln.format(`description`,`is required`);return new ci(e,t)}var si,ci,li=n((()=>{sn(),Zn(),Sn(),si=`NATS/1.0`,ci=class e{_code;headers;_description;constructor(e=0,t=``){this._code=e,this._description=t,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(let[t,n]of this.headers){let r=e.values(t);if(n.length!==r.length)return!1;let i=[...n].sort(),a=[...r].sort();for(let e=0;e<i.length;e++)if(i[e]!==a[e])return!1}return!0}return!1}static decode(t){let n=new e,r=on.decode(t).split(`\r
|
|
3
|
-
`),i=r[0];if(i!==si){let e=i.replace(si,``).trim();if(e.length>0){n._code=parseInt(e,10),isNaN(n._code)&&(n._code=0);let t=n._code.toString();e=e.replace(t,``),n._description=e.trim()}}return r.length>=1&&r.slice(1).map(e=>{if(e){let t=e.indexOf(`:`);if(t>-1){let r=e.slice(0,t),i=e.slice(t+1).trim();n.append(r,i)}}}),n}toString(){if(this.headers.size===0&&this._code===0)return``;let e=si;this._code>0&&this._description!==``&&(e+=` ${this._code} ${this._description}`);for(let[t,n]of this.headers)for(let r=0;r<n.length;r++)e=`${e}\r\n${t}: ${n[r]}`;return`${e}\r\n\r\n`}encode(){return an.encode(this.toString())}static validHeaderValue(e){if(/[\r\n]/.test(e))throw ln.format(`header`,`values cannot contain \\r or \\n`);return e.trim()}keys(){let e=[];for(let t of this.headers.keys())e.push(t);return e}findKeys(e,t=Jn.Exact){let n=this.keys();switch(t){case Jn.Exact:return n.filter(t=>t===e);case Jn.CanonicalMIME:return e=ai(e),n.filter(t=>t===e);default:{let t=e.toLowerCase();return n.filter(e=>t===e.toLowerCase())}}}get(e,t=Jn.Exact){let n=this.findKeys(e,t);if(n.length){let e=this.headers.get(n[0]);if(e)return Array.isArray(e)?e[0]:e}return``}last(e,t=Jn.Exact){let n=this.findKeys(e,t);if(n.length){let e=this.headers.get(n[0]);if(e)return Array.isArray(e)?e[e.length-1]:e}return``}has(e,t=Jn.Exact){return this.findKeys(e,t).length>0}set(e,t,n=Jn.Exact){this.delete(e,n),this.append(e,t,n)}append(t,n,r=Jn.Exact){let i=ai(t);r===Jn.CanonicalMIME&&(t=i);let a=this.findKeys(t,r);t=a.length>0?a[0]:t;let o=e.validHeaderValue(n),s=this.headers.get(t);s||(s=[],this.headers.set(t,s)),s.push(o)}values(e,t=Jn.Exact){let n=[];return this.findKeys(e,t).forEach(e=>{let t=this.headers.get(e);t&&n.push(...t)}),n}delete(e,t=Jn.Exact){this.findKeys(e,t).forEach(e=>{this.headers.delete(e)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){let e={};return this.keys().forEach(t=>{e[t]=this.values(t)}),e}get code(){return this._code}get description(){return this._description}static fromRecord(t){let n=new e;for(let e in t){let r=t[e];n.headers.set(e,Array.isArray(r)?r:[`${r}`])}return n}}})),ui,di=n((()=>{li(),sn(),ui=class{_headers;_msg;_rdata;_reply;_subject;publisher;constructor(e,t,n){this._msg=e,this._rdata=t,this.publisher=n}get subject(){return this._subject||=on.decode(this._msg.subject),this._subject}get reply(){return this._reply||=on.decode(this._msg.reply),this._reply}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){let e=this._rdata.subarray(0,this._msg.hdr);this._headers=ci.decode(e)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array}respond(e=rn,t){return this.reply?(this.publisher.publish(this.reply,e,t),!0):!1}size(){let e=this._msg.subject.length,t=this._msg.reply?.length||0,n=this._msg.size===-1?0:this._msg.size;return e+t+n}json(e){return JSON.parse(this.string(),e)}string(){return on.decode(this.data)}requestInfo(){let e=this.headers?.get(`Nats-Request-Info`);return e?JSON.parse(e,function(e,t){return(e===`start`||e===`stop`)&&t!==``?new Date(Date.parse(t)):t}):null}}}));function fi(e=``){let t=e.match(/(\d+).(\d+).(\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw Error(`'${e}' is not a semver value`)}function pi(e,t){return e.major<t.major?-1:e.major>t.major?1:e.minor<t.minor?-1:e.minor>t.minor?1:e.micro<t.micro?-1:+(e.micro>t.micro)}var mi,hi,gi=n((()=>{mi={JS_KV:`js_kv`,JS_OBJECTSTORE:`js_objectstore`,JS_PULL_MAX_BYTES:`js_pull_max_bytes`,JS_NEW_CONSUMER_CREATE_API:`js_new_consumer_create`,JS_ALLOW_DIRECT:`js_allow_direct`,JS_MULTIPLE_CONSUMER_FILTER:`js_multiple_consumer_filter`,JS_SIMPLIFICATION:`js_simplification`,JS_STREAM_CONSUMER_METADATA:`js_stream_consumer_metadata`,JS_CONSUMER_FILTER_SUBJECTS:`js_consumer_filter_subjects`,JS_STREAM_FIRST_SEQ:`js_stream_first_seq`,JS_STREAM_SUBJECT_TRANSFORM:`js_stream_subject_transform`,JS_STREAM_SOURCE_SUBJECT_TRANSFORM:`js_stream_source_subject_transform`,JS_STREAM_COMPRESSION:`js_stream_compression`,JS_DEFAULT_CONSUMER_LIMITS:`js_default_consumer_limits`,JS_BATCH_DIRECT_GET:`js_batch_direct_get`,JS_PRIORITY_GROUPS:`js_priority_groups`,JS_CONSUMER_RESET:`js_consumer_reset`},hi=class{server;features;disabled;constructor(e){this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e==`string`&&(e=fi(e)),this.server=e,this.set(mi.JS_KV,`2.6.2`),this.set(mi.JS_OBJECTSTORE,`2.6.3`),this.set(mi.JS_PULL_MAX_BYTES,`2.8.3`),this.set(mi.JS_NEW_CONSUMER_CREATE_API,`2.9.0`),this.set(mi.JS_ALLOW_DIRECT,`2.9.0`),this.set(mi.JS_MULTIPLE_CONSUMER_FILTER,`2.10.0`),this.set(mi.JS_SIMPLIFICATION,`2.9.4`),this.set(mi.JS_STREAM_CONSUMER_METADATA,`2.10.0`),this.set(mi.JS_CONSUMER_FILTER_SUBJECTS,`2.10.0`),this.set(mi.JS_STREAM_FIRST_SEQ,`2.10.0`),this.set(mi.JS_STREAM_SUBJECT_TRANSFORM,`2.10.0`),this.set(mi.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,`2.10.0`),this.set(mi.JS_STREAM_COMPRESSION,`2.10.0`),this.set(mi.JS_DEFAULT_CONSUMER_LIMITS,`2.10.0`),this.set(mi.JS_BATCH_DIRECT_GET,`2.11.0`),this.set(mi.JS_PRIORITY_GROUPS,`2.11.0`),this.set(mi.JS_CONSUMER_RESET,`2.14.0`),this.disabled.forEach(e=>{this.features.delete(e)})}set(e,t){this.features.set(e,{min:t,ok:pi(this.server,fi(t))>=0})}get(e){return this.features.get(e)||{min:`unknown`,ok:!1}}supports(e){return this.get(e)?.ok||!1}require(e){return typeof e==`string`&&(e=fi(e)),pi(this.server,e)>=0}}})),_i=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.crc16=void 0;var t=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);e.crc16=class e{static checksum(e){let n=0;for(let r=0;r<e.byteLength;r++){let i=e[r];n=n<<8&65535^t[(n>>8^i)&255]}return n}static validate(t,n){return e.checksum(t)==n}}})),vi=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.base32=void 0;var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`;e.base32=class{static encode(e){let n=0,r=0,i=new Uint8Array(e),a=new Uint8Array(e.byteLength*2),o=0;for(let e=0;e<i.byteLength;e++)for(r=r<<8|i[e],n+=8;n>=5;){let e=r>>>n-5&31;a[o++]=t.charAt(e).charCodeAt(0),n-=5}if(n>0){let e=r<<5-n&31;a[o++]=t.charAt(e).charCodeAt(0)}return a.slice(0,o)}static decode(e){let n=0,r=0,i=0,a=new Uint8Array(e),o=new Uint8Array(a.byteLength*5/8|0);for(let e=0;e<a.byteLength;e++){let s=String.fromCharCode(a[e]),c=t.indexOf(s);if(c===-1)throw Error(`Illegal Base32 character: `+a[e]);r=r<<5|c,n+=5,n>=8&&(o[i++]=r>>>n-8&255,n-=8)}return o.slice(0,i)}}})),yi=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Codec=void 0;var t=_i(),n=Ei(),r=vi();e.Codec=class e{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new n.NKeysError(n.NKeysErrorCode.SerializationError);if(!n.Prefixes.isValidPrefix(t))throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);return e._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new n.NKeysError(n.NKeysErrorCode.ApiError);if(!n.Prefixes.isValidPublicPrefix(t))throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);if(r.byteLength!==32)throw new n.NKeysError(n.NKeysErrorCode.InvalidSeedLen);return e._encode(!0,t,r)}static decode(t,r){if(!n.Prefixes.isValidPrefix(t))throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);let i=e._decode(r);if(i[0]!==t)throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);return i.slice(1)}static decodeSeed(t){let r=e._decode(t),i=e._decodePrefix(r);if(i[0]!=n.Prefix.Seed)throw new n.NKeysError(n.NKeysErrorCode.InvalidSeed);if(!n.Prefixes.isValidPublicPrefix(i[1]))throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);return{buf:r.slice(2),prefix:i[1]}}static _encode(i,a,o){let s=i?2:1,c=o.byteLength,l=s+c+2,u=s+c,d=new Uint8Array(l);if(i){let t=e._encodePrefix(n.Prefix.Seed,a);d.set(t)}else d[0]=a;d.set(o,s);let f=t.crc16.checksum(d.slice(0,u));return new DataView(d.buffer).setUint16(u,f,!0),r.base32.encode(d)}static _decode(e){if(e.byteLength<4)throw new n.NKeysError(n.NKeysErrorCode.InvalidEncoding);let i;try{i=r.base32.decode(e)}catch(e){throw new n.NKeysError(n.NKeysErrorCode.InvalidEncoding,{cause:e})}let a=i.byteLength-2,o=new DataView(i.buffer).getUint16(a,!0),s=i.slice(0,a);if(!t.crc16.validate(s,o))throw new n.NKeysError(n.NKeysErrorCode.InvalidChecksum);return s}static _encodePrefix(e,t){let n=e|t>>5,r=(t&31)<<3;return new Uint8Array([n,r])}static _decodePrefix(e){let t=e[0]&248,n=(e[0]&7)<<5|(e[1]&248)>>3;return new Uint8Array([t,n])}}})),bi=a(((e,t)=>{t.exports={}})),xi=a(((e,n)=>{(function(e){var n=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t<e.length;t++)n[t]=e[t];return n},r=function(){throw Error(`no PRNG`)},i=new Uint8Array(16),a=new Uint8Array(32);a[0]=9;var o=n(),s=n([1]),c=n([56129,1]),l=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),d=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),f=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),p=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function m(e,t,n,r){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=r&255}function h(e,t,n,r,i){var a,o=0;for(a=0;a<i;a++)o|=e[t+a]^n[r+a];return(1&o-1>>>8)-1}function g(e,t,n,r){return h(e,t,n,r,16)}function _(e,t,n,r){return h(e,t,n,r,32)}function v(e,t,n,r){for(var i=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,a=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,s=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,l=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,u=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,d=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,f=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,p=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,h=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,g=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,_=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,v=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,y=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,b=i,x=a,S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,j=h,M=g,N=_,P=v,F=y,I,ee=0;ee<20;ee+=2)I=b+M|0,w^=I<<7|I>>>25,I=w+b|0,O^=I<<9|I>>>23,I=O+w|0,M^=I<<13|I>>>19,I=M+O|0,b^=I<<18|I>>>14,I=T+x|0,k^=I<<7|I>>>25,I=k+T|0,N^=I<<9|I>>>23,I=N+k|0,x^=I<<13|I>>>19,I=x+N|0,T^=I<<18|I>>>14,I=A+E|0,P^=I<<7|I>>>25,I=P+A|0,S^=I<<9|I>>>23,I=S+P|0,E^=I<<13|I>>>19,I=E+S|0,A^=I<<18|I>>>14,I=F+j|0,C^=I<<7|I>>>25,I=C+F|0,D^=I<<9|I>>>23,I=D+C|0,j^=I<<13|I>>>19,I=j+D|0,F^=I<<18|I>>>14,I=b+C|0,x^=I<<7|I>>>25,I=x+b|0,S^=I<<9|I>>>23,I=S+x|0,C^=I<<13|I>>>19,I=C+S|0,b^=I<<18|I>>>14,I=T+w|0,E^=I<<7|I>>>25,I=E+T|0,D^=I<<9|I>>>23,I=D+E|0,w^=I<<13|I>>>19,I=w+D|0,T^=I<<18|I>>>14,I=A+k|0,j^=I<<7|I>>>25,I=j+A|0,O^=I<<9|I>>>23,I=O+j|0,k^=I<<13|I>>>19,I=k+O|0,A^=I<<18|I>>>14,I=F+P|0,M^=I<<7|I>>>25,I=M+F|0,N^=I<<9|I>>>23,I=N+M|0,P^=I<<13|I>>>19,I=P+N|0,F^=I<<18|I>>>14;b=b+i|0,x=x+a|0,S=S+o|0,C=C+s|0,w=w+c|0,T=T+l|0,E=E+u|0,D=D+d|0,O=O+f|0,k=k+p|0,A=A+m|0,j=j+h|0,M=M+g|0,N=N+_|0,P=P+v|0,F=F+y|0,e[0]=b>>>0&255,e[1]=b>>>8&255,e[2]=b>>>16&255,e[3]=b>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=C>>>0&255,e[13]=C>>>8&255,e[14]=C>>>16&255,e[15]=C>>>24&255,e[16]=w>>>0&255,e[17]=w>>>8&255,e[18]=w>>>16&255,e[19]=w>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=E>>>0&255,e[25]=E>>>8&255,e[26]=E>>>16&255,e[27]=E>>>24&255,e[28]=D>>>0&255,e[29]=D>>>8&255,e[30]=D>>>16&255,e[31]=D>>>24&255,e[32]=O>>>0&255,e[33]=O>>>8&255,e[34]=O>>>16&255,e[35]=O>>>24&255,e[36]=k>>>0&255,e[37]=k>>>8&255,e[38]=k>>>16&255,e[39]=k>>>24&255,e[40]=A>>>0&255,e[41]=A>>>8&255,e[42]=A>>>16&255,e[43]=A>>>24&255,e[44]=j>>>0&255,e[45]=j>>>8&255,e[46]=j>>>16&255,e[47]=j>>>24&255,e[48]=M>>>0&255,e[49]=M>>>8&255,e[50]=M>>>16&255,e[51]=M>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}function y(e,t,n,r){for(var i=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,a=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,s=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,l=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,u=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,d=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,f=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,p=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,h=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,g=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,_=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,v=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,y=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,b=i,x=a,S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,j=h,M=g,N=_,P=v,F=y,I,ee=0;ee<20;ee+=2)I=b+M|0,w^=I<<7|I>>>25,I=w+b|0,O^=I<<9|I>>>23,I=O+w|0,M^=I<<13|I>>>19,I=M+O|0,b^=I<<18|I>>>14,I=T+x|0,k^=I<<7|I>>>25,I=k+T|0,N^=I<<9|I>>>23,I=N+k|0,x^=I<<13|I>>>19,I=x+N|0,T^=I<<18|I>>>14,I=A+E|0,P^=I<<7|I>>>25,I=P+A|0,S^=I<<9|I>>>23,I=S+P|0,E^=I<<13|I>>>19,I=E+S|0,A^=I<<18|I>>>14,I=F+j|0,C^=I<<7|I>>>25,I=C+F|0,D^=I<<9|I>>>23,I=D+C|0,j^=I<<13|I>>>19,I=j+D|0,F^=I<<18|I>>>14,I=b+C|0,x^=I<<7|I>>>25,I=x+b|0,S^=I<<9|I>>>23,I=S+x|0,C^=I<<13|I>>>19,I=C+S|0,b^=I<<18|I>>>14,I=T+w|0,E^=I<<7|I>>>25,I=E+T|0,D^=I<<9|I>>>23,I=D+E|0,w^=I<<13|I>>>19,I=w+D|0,T^=I<<18|I>>>14,I=A+k|0,j^=I<<7|I>>>25,I=j+A|0,O^=I<<9|I>>>23,I=O+j|0,k^=I<<13|I>>>19,I=k+O|0,A^=I<<18|I>>>14,I=F+P|0,M^=I<<7|I>>>25,I=M+F|0,N^=I<<9|I>>>23,I=N+M|0,P^=I<<13|I>>>19,I=P+N|0,F^=I<<18|I>>>14;e[0]=b>>>0&255,e[1]=b>>>8&255,e[2]=b>>>16&255,e[3]=b>>>24&255,e[4]=T>>>0&255,e[5]=T>>>8&255,e[6]=T>>>16&255,e[7]=T>>>24&255,e[8]=A>>>0&255,e[9]=A>>>8&255,e[10]=A>>>16&255,e[11]=A>>>24&255,e[12]=F>>>0&255,e[13]=F>>>8&255,e[14]=F>>>16&255,e[15]=F>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=D>>>0&255,e[21]=D>>>8&255,e[22]=D>>>16&255,e[23]=D>>>24&255,e[24]=O>>>0&255,e[25]=O>>>8&255,e[26]=O>>>16&255,e[27]=O>>>24&255,e[28]=k>>>0&255,e[29]=k>>>8&255,e[30]=k>>>16&255,e[31]=k>>>24&255}function b(e,t,n,r){v(e,t,n,r)}function x(e,t,n,r){y(e,t,n,r)}var S=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function C(e,t,n,r,i,a,o){var s=new Uint8Array(16),c=new Uint8Array(64),l,u;for(u=0;u<16;u++)s[u]=0;for(u=0;u<8;u++)s[u]=a[u];for(;i>=64;){for(b(c,s,o,S),u=0;u<64;u++)e[t+u]=n[r+u]^c[u];for(l=1,u=8;u<16;u++)l=l+(s[u]&255)|0,s[u]=l&255,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(b(c,s,o,S),u=0;u<i;u++)e[t+u]=n[r+u]^c[u];return 0}function w(e,t,n,r,i){var a=new Uint8Array(16),o=new Uint8Array(64),s,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=r[c];for(;n>=64;){for(b(o,a,i,S),c=0;c<64;c++)e[t+c]=o[c];for(s=1,c=8;c<16;c++)s=s+(a[c]&255)|0,a[c]=s&255,s>>>=8;n-=64,t+=64}if(n>0)for(b(o,a,i,S),c=0;c<n;c++)e[t+c]=o[c];return 0}function T(e,t,n,r,i){var a=new Uint8Array(32);x(a,r,i,S);for(var o=new Uint8Array(8),s=0;s<8;s++)o[s]=r[s+16];return w(e,t,n,o,a)}function E(e,t,n,r,i,a,o){var s=new Uint8Array(32);x(s,a,o,S);for(var c=new Uint8Array(8),l=0;l<8;l++)c[l]=a[l+16];return C(e,t,n,r,i,c,s)}var D=function(e){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var t=e[0]&255|(e[1]&255)<<8,n,r,i,a,o,s,c;this.r[0]=t&8191,n=e[2]&255|(e[3]&255)<<8,this.r[1]=(t>>>13|n<<3)&8191,r=e[4]&255|(e[5]&255)<<8,this.r[2]=(n>>>10|r<<6)&7939,i=e[6]&255|(e[7]&255)<<8,this.r[3]=(r>>>7|i<<9)&8191,a=e[8]&255|(e[9]&255)<<8,this.r[4]=(i>>>4|a<<12)&255,this.r[5]=a>>>1&8190,o=e[10]&255|(e[11]&255)<<8,this.r[6]=(a>>>14|o<<2)&8191,s=e[12]&255|(e[13]&255)<<8,this.r[7]=(o>>>11|s<<5)&8065,c=e[14]&255|(e[15]&255)<<8,this.r[8]=(s>>>8|c<<8)&8191,this.r[9]=c>>>5&127,this.pad[0]=e[16]&255|(e[17]&255)<<8,this.pad[1]=e[18]&255|(e[19]&255)<<8,this.pad[2]=e[20]&255|(e[21]&255)<<8,this.pad[3]=e[22]&255|(e[23]&255)<<8,this.pad[4]=e[24]&255|(e[25]&255)<<8,this.pad[5]=e[26]&255|(e[27]&255)<<8,this.pad[6]=e[28]&255|(e[29]&255)<<8,this.pad[7]=e[30]&255|(e[31]&255)<<8};D.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C=this.h[0],w=this.h[1],T=this.h[2],E=this.h[3],D=this.h[4],O=this.h[5],k=this.h[6],A=this.h[7],j=this.h[8],M=this.h[9],N=this.r[0],P=this.r[1],F=this.r[2],I=this.r[3],ee=this.r[4],te=this.r[5],L=this.r[6],R=this.r[7],z=this.r[8],B=this.r[9];n>=16;)i=e[t+0]&255|(e[t+1]&255)<<8,C+=i&8191,a=e[t+2]&255|(e[t+3]&255)<<8,w+=(i>>>13|a<<3)&8191,o=e[t+4]&255|(e[t+5]&255)<<8,T+=(a>>>10|o<<6)&8191,s=e[t+6]&255|(e[t+7]&255)<<8,E+=(o>>>7|s<<9)&8191,c=e[t+8]&255|(e[t+9]&255)<<8,D+=(s>>>4|c<<12)&8191,O+=c>>>1&8191,l=e[t+10]&255|(e[t+11]&255)<<8,k+=(c>>>14|l<<2)&8191,u=e[t+12]&255|(e[t+13]&255)<<8,A+=(l>>>11|u<<5)&8191,d=e[t+14]&255|(e[t+15]&255)<<8,j+=(u>>>8|d<<8)&8191,M+=d>>>5|r,f=0,p=f,p+=C*N,p+=5*B*w,p+=5*z*T,p+=5*R*E,p+=5*L*D,f=p>>>13,p&=8191,p+=5*te*O,p+=5*ee*k,p+=5*I*A,p+=5*F*j,p+=5*P*M,f+=p>>>13,p&=8191,m=f,m+=C*P,m+=w*N,m+=5*B*T,m+=5*z*E,m+=5*R*D,f=m>>>13,m&=8191,m+=5*L*O,m+=5*te*k,m+=5*ee*A,m+=5*I*j,m+=5*F*M,f+=m>>>13,m&=8191,h=f,h+=C*F,h+=w*P,h+=T*N,h+=5*B*E,h+=5*z*D,f=h>>>13,h&=8191,h+=5*R*O,h+=5*L*k,h+=5*te*A,h+=5*ee*j,h+=5*I*M,f+=h>>>13,h&=8191,g=f,g+=C*I,g+=w*F,g+=T*P,g+=E*N,g+=5*B*D,f=g>>>13,g&=8191,g+=5*z*O,g+=5*R*k,g+=5*L*A,g+=5*te*j,g+=5*ee*M,f+=g>>>13,g&=8191,_=f,_+=C*ee,_+=w*I,_+=T*F,_+=E*P,_+=D*N,f=_>>>13,_&=8191,_+=5*B*O,_+=5*z*k,_+=5*R*A,_+=5*L*j,_+=5*te*M,f+=_>>>13,_&=8191,v=f,v+=C*te,v+=w*ee,v+=T*I,v+=E*F,v+=D*P,f=v>>>13,v&=8191,v+=O*N,v+=5*B*k,v+=5*z*A,v+=5*R*j,v+=5*L*M,f+=v>>>13,v&=8191,y=f,y+=C*L,y+=w*te,y+=T*ee,y+=E*I,y+=D*F,f=y>>>13,y&=8191,y+=O*P,y+=k*N,y+=5*B*A,y+=5*z*j,y+=5*R*M,f+=y>>>13,y&=8191,b=f,b+=C*R,b+=w*L,b+=T*te,b+=E*ee,b+=D*I,f=b>>>13,b&=8191,b+=O*F,b+=k*P,b+=A*N,b+=5*B*j,b+=5*z*M,f+=b>>>13,b&=8191,x=f,x+=C*z,x+=w*R,x+=T*L,x+=E*te,x+=D*ee,f=x>>>13,x&=8191,x+=O*I,x+=k*F,x+=A*P,x+=j*N,x+=5*B*M,f+=x>>>13,x&=8191,S=f,S+=C*B,S+=w*z,S+=T*R,S+=E*L,S+=D*te,f=S>>>13,S&=8191,S+=O*ee,S+=k*I,S+=A*F,S+=j*P,S+=M*N,f+=S>>>13,S&=8191,f=(f<<2)+f|0,f=f+p|0,p=f&8191,f>>>=13,m+=f,C=p,w=m,T=h,E=g,D=_,O=v,k=y,A=b,j=x,M=S,t+=16,n-=16;this.h[0]=C,this.h[1]=w,this.h[2]=T,this.h[3]=E,this.h[4]=D,this.h[5]=O,this.h[6]=k,this.h[7]=A,this.h[8]=j,this.h[9]=M},D.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,a,o;if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=r*5,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,o=1;o<10;o++)n[o]=this.h[o]+r,r=n[o]>>>13,n[o]&=8191;for(n[9]-=8192,i=(r^1)-1,o=0;o<10;o++)n[o]&=i;for(i=~i,o=0;o<10;o++)this.h[o]=this.h[o]&i|n[o];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,a=this.h[0]+this.pad[0],this.h[0]=a&65535,o=1;o<8;o++)a=(this.h[o]+this.pad[o]|0)+(a>>>16)|0,this.h[o]=a&65535;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},D.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r<i;r++)this.buffer[this.leftover+r]=e[t+r];if(n-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r<n;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=n}};function O(e,t,n,r,i,a){var o=new D(a);return o.update(n,r,i),o.finish(e,t),0}function k(e,t,n,r,i,a){var o=new Uint8Array(16);return O(o,0,n,r,i,a),g(e,t,o,0)}function A(e,t,n,r,i){var a;if(n<32)return-1;for(E(e,0,t,0,n,r,i),O(e,16,e,32,n-32,e),a=0;a<16;a++)e[a]=0;return 0}function j(e,t,n,r,i){var a,o=new Uint8Array(32);if(n<32||(T(o,0,32,r,i),k(t,16,t,32,n-32,o)!==0))return-1;for(E(e,0,t,0,n,r,i),a=0;a<32;a++)e[a]=0;return 0}function M(e,t){var n;for(n=0;n<16;n++)e[n]=t[n]|0}function N(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-r*65536;e[0]+=r-1+37*(r-1)}function P(e,t,n){for(var r,i=~(n-1),a=0;a<16;a++)r=i&(e[a]^t[a]),e[a]^=r,t[a]^=r}function F(e,t){var r,i,a,o=n(),s=n();for(r=0;r<16;r++)s[r]=t[r];for(N(s),N(s),N(s),i=0;i<2;i++){for(o[0]=s[0]-65517,r=1;r<15;r++)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),a=o[15]>>16&1,o[14]&=65535,P(s,o,1-a)}for(r=0;r<16;r++)e[2*r]=s[r]&255,e[2*r+1]=s[r]>>8}function I(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return F(n,e),F(r,t),_(n,0,r,0)}function ee(e){var t=new Uint8Array(32);return F(t,e),t[0]&1}function te(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function L(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function R(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function z(e,t,n){var r,i,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=0,S=0,C=0,w=0,T=0,E=0,D=0,O=0,k=0,A=0,j=0,M=0,N=0,P=0,F=0,I=n[0],ee=n[1],te=n[2],L=n[3],R=n[4],z=n[5],B=n[6],ne=n[7],re=n[8],ie=n[9],ae=n[10],oe=n[11],se=n[12],ce=n[13],le=n[14],ue=n[15];r=t[0],a+=r*I,o+=r*ee,s+=r*te,c+=r*L,l+=r*R,u+=r*z,d+=r*B,f+=r*ne,p+=r*re,m+=r*ie,h+=r*ae,g+=r*oe,_+=r*se,v+=r*ce,y+=r*le,b+=r*ue,r=t[1],o+=r*I,s+=r*ee,c+=r*te,l+=r*L,u+=r*R,d+=r*z,f+=r*B,p+=r*ne,m+=r*re,h+=r*ie,g+=r*ae,_+=r*oe,v+=r*se,y+=r*ce,b+=r*le,x+=r*ue,r=t[2],s+=r*I,c+=r*ee,l+=r*te,u+=r*L,d+=r*R,f+=r*z,p+=r*B,m+=r*ne,h+=r*re,g+=r*ie,_+=r*ae,v+=r*oe,y+=r*se,b+=r*ce,x+=r*le,S+=r*ue,r=t[3],c+=r*I,l+=r*ee,u+=r*te,d+=r*L,f+=r*R,p+=r*z,m+=r*B,h+=r*ne,g+=r*re,_+=r*ie,v+=r*ae,y+=r*oe,b+=r*se,x+=r*ce,S+=r*le,C+=r*ue,r=t[4],l+=r*I,u+=r*ee,d+=r*te,f+=r*L,p+=r*R,m+=r*z,h+=r*B,g+=r*ne,_+=r*re,v+=r*ie,y+=r*ae,b+=r*oe,x+=r*se,S+=r*ce,C+=r*le,w+=r*ue,r=t[5],u+=r*I,d+=r*ee,f+=r*te,p+=r*L,m+=r*R,h+=r*z,g+=r*B,_+=r*ne,v+=r*re,y+=r*ie,b+=r*ae,x+=r*oe,S+=r*se,C+=r*ce,w+=r*le,T+=r*ue,r=t[6],d+=r*I,f+=r*ee,p+=r*te,m+=r*L,h+=r*R,g+=r*z,_+=r*B,v+=r*ne,y+=r*re,b+=r*ie,x+=r*ae,S+=r*oe,C+=r*se,w+=r*ce,T+=r*le,E+=r*ue,r=t[7],f+=r*I,p+=r*ee,m+=r*te,h+=r*L,g+=r*R,_+=r*z,v+=r*B,y+=r*ne,b+=r*re,x+=r*ie,S+=r*ae,C+=r*oe,w+=r*se,T+=r*ce,E+=r*le,D+=r*ue,r=t[8],p+=r*I,m+=r*ee,h+=r*te,g+=r*L,_+=r*R,v+=r*z,y+=r*B,b+=r*ne,x+=r*re,S+=r*ie,C+=r*ae,w+=r*oe,T+=r*se,E+=r*ce,D+=r*le,O+=r*ue,r=t[9],m+=r*I,h+=r*ee,g+=r*te,_+=r*L,v+=r*R,y+=r*z,b+=r*B,x+=r*ne,S+=r*re,C+=r*ie,w+=r*ae,T+=r*oe,E+=r*se,D+=r*ce,O+=r*le,k+=r*ue,r=t[10],h+=r*I,g+=r*ee,_+=r*te,v+=r*L,y+=r*R,b+=r*z,x+=r*B,S+=r*ne,C+=r*re,w+=r*ie,T+=r*ae,E+=r*oe,D+=r*se,O+=r*ce,k+=r*le,A+=r*ue,r=t[11],g+=r*I,_+=r*ee,v+=r*te,y+=r*L,b+=r*R,x+=r*z,S+=r*B,C+=r*ne,w+=r*re,T+=r*ie,E+=r*ae,D+=r*oe,O+=r*se,k+=r*ce,A+=r*le,j+=r*ue,r=t[12],_+=r*I,v+=r*ee,y+=r*te,b+=r*L,x+=r*R,S+=r*z,C+=r*B,w+=r*ne,T+=r*re,E+=r*ie,D+=r*ae,O+=r*oe,k+=r*se,A+=r*ce,j+=r*le,M+=r*ue,r=t[13],v+=r*I,y+=r*ee,b+=r*te,x+=r*L,S+=r*R,C+=r*z,w+=r*B,T+=r*ne,E+=r*re,D+=r*ie,O+=r*ae,k+=r*oe,A+=r*se,j+=r*ce,M+=r*le,N+=r*ue,r=t[14],y+=r*I,b+=r*ee,x+=r*te,S+=r*L,C+=r*R,w+=r*z,T+=r*B,E+=r*ne,D+=r*re,O+=r*ie,k+=r*ae,A+=r*oe,j+=r*se,M+=r*ce,N+=r*le,P+=r*ue,r=t[15],b+=r*I,x+=r*ee,S+=r*te,C+=r*L,w+=r*R,T+=r*z,E+=r*B,D+=r*ne,O+=r*re,k+=r*ie,A+=r*ae,j+=r*oe,M+=r*se,N+=r*ce,P+=r*le,F+=r*ue,a+=38*x,o+=38*S,s+=38*C,c+=38*w,l+=38*T,u+=38*E,d+=38*D,f+=38*O,p+=38*k,m+=38*A,h+=38*j,g+=38*M,_+=38*N,v+=38*P,y+=38*F,i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),e[0]=a,e[1]=o,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=m,e[10]=h,e[11]=g,e[12]=_,e[13]=v,e[14]=y,e[15]=b}function B(e,t){z(e,t,t)}function ne(e,t){var r=n(),i;for(i=0;i<16;i++)r[i]=t[i];for(i=253;i>=0;i--)B(r,r),i!==2&&i!==4&&z(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}function re(e,t){var r=n(),i;for(i=0;i<16;i++)r[i]=t[i];for(i=250;i>=0;i--)B(r,r),i!==1&&z(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}function ie(e,t,r){var i=new Uint8Array(32),a=new Float64Array(80),o,s,l=n(),u=n(),d=n(),f=n(),p=n(),m=n();for(s=0;s<31;s++)i[s]=t[s];for(i[31]=t[31]&127|64,i[0]&=248,te(a,r),s=0;s<16;s++)u[s]=a[s],f[s]=l[s]=d[s]=0;for(l[0]=f[0]=1,s=254;s>=0;--s)o=i[s>>>3]>>>(s&7)&1,P(l,u,o),P(d,f,o),L(p,l,d),R(l,l,d),L(d,u,f),R(u,u,f),B(f,p),B(m,l),z(l,d,l),z(d,u,p),L(p,l,d),R(l,l,d),B(u,l),R(d,f,m),z(l,d,c),L(l,l,f),z(d,d,l),z(l,f,m),z(f,u,a),B(u,p),P(l,u,o),P(d,f,o);for(s=0;s<16;s++)a[s+16]=l[s],a[s+32]=d[s],a[s+48]=u[s],a[s+64]=f[s];var h=a.subarray(32),g=a.subarray(16);return ne(h,h),z(g,g,h),F(e,g),0}function ae(e,t){return ie(e,t,a)}function oe(e,t){return r(t,32),ae(e,t)}function se(e,t,n){var r=new Uint8Array(32);return ie(r,n,t),x(e,i,r,S)}var ce=A,le=j;function ue(e,t,n,r,i,a){var o=new Uint8Array(32);return se(o,i,a),ce(e,t,n,r,o)}function de(e,t,n,r,i,a){var o=new Uint8Array(32);return se(o,i,a),le(e,t,n,r,o)}var fe=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function pe(e,t,n,r){for(var i=new Int32Array(16),a=new Int32Array(16),o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=e[0],N=e[1],P=e[2],F=e[3],I=e[4],ee=e[5],te=e[6],L=e[7],R=t[0],z=t[1],B=t[2],ne=t[3],re=t[4],ie=t[5],ae=t[6],oe=t[7],se=0;r>=128;){for(w=0;w<16;w++)T=8*w+se,i[w]=n[T+0]<<24|n[T+1]<<16|n[T+2]<<8|n[T+3],a[w]=n[T+4]<<24|n[T+5]<<16|n[T+6]<<8|n[T+7];for(w=0;w<80;w++)if(o=M,s=N,c=P,l=F,u=I,d=ee,f=te,p=L,m=R,h=z,g=B,_=ne,v=re,y=ie,b=ae,x=oe,E=L,D=oe,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=(I>>>14|re<<18)^(I>>>18|re<<14)^(re>>>9|I<<23),D=(re>>>14|I<<18)^(re>>>18|I<<14)^(I>>>9|re<<23),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=I&ee^~I&te,D=re&ie^~re&ae,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=fe[w*2],D=fe[w*2+1],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=i[w%16],D=a[w%16],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,S=A&65535|j<<16,C=O&65535|k<<16,E=S,D=C,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=(M>>>28|R<<4)^(R>>>2|M<<30)^(R>>>7|M<<25),D=(R>>>28|M<<4)^(M>>>2|R<<30)^(M>>>7|R<<25),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=M&N^M&P^N&P,D=R&z^R&B^z&B,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,p=A&65535|j<<16,x=O&65535|k<<16,E=l,D=_,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=S,D=C,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,l=A&65535|j<<16,_=O&65535|k<<16,N=o,P=s,F=c,I=l,ee=u,te=d,L=f,M=p,z=m,B=h,ne=g,re=_,ie=v,ae=y,oe=b,R=x,w%16==15)for(T=0;T<16;T++)E=i[T],D=a[T],O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=i[(T+9)%16],D=a[(T+9)%16],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,S=i[(T+1)%16],C=a[(T+1)%16],E=(S>>>1|C<<31)^(S>>>8|C<<24)^S>>>7,D=(C>>>1|S<<31)^(C>>>8|S<<24)^(C>>>7|S<<25),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,S=i[(T+14)%16],C=a[(T+14)%16],E=(S>>>19|C<<13)^(C>>>29|S<<3)^S>>>6,D=(C>>>19|S<<13)^(S>>>29|C<<3)^(C>>>6|S<<26),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,i[T]=A&65535|j<<16,a[T]=O&65535|k<<16;E=M,D=R,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[0],D=t[0],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[0]=M=A&65535|j<<16,t[0]=R=O&65535|k<<16,E=N,D=z,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[1],D=t[1],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[1]=N=A&65535|j<<16,t[1]=z=O&65535|k<<16,E=P,D=B,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[2],D=t[2],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[2]=P=A&65535|j<<16,t[2]=B=O&65535|k<<16,E=F,D=ne,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[3],D=t[3],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[3]=F=A&65535|j<<16,t[3]=ne=O&65535|k<<16,E=I,D=re,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[4],D=t[4],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[4]=I=A&65535|j<<16,t[4]=re=O&65535|k<<16,E=ee,D=ie,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[5],D=t[5],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[5]=ee=A&65535|j<<16,t[5]=ie=O&65535|k<<16,E=te,D=ae,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[6],D=t[6],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[6]=te=A&65535|j<<16,t[6]=ae=O&65535|k<<16,E=L,D=oe,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[7],D=t[7],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[7]=L=A&65535|j<<16,t[7]=oe=O&65535|k<<16,se+=128,r-=128}return r}function me(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),a=new Uint8Array(256),o,s=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,pe(r,i,t,n),n%=128,o=0;o<n;o++)a[o]=t[s-n+o];for(a[n]=128,n=256-128*(n<112),a[n-9]=0,m(a,n-8,s/536870912|0,s<<3),pe(r,i,a,n),o=0;o<8;o++)m(e,8*o,r[o],i[o]);return 0}function he(e,t){var r=n(),i=n(),a=n(),o=n(),s=n(),c=n(),l=n(),d=n(),f=n();R(r,e[1],e[0]),R(f,t[1],t[0]),z(r,r,f),L(i,e[0],e[1]),L(f,t[0],t[1]),z(i,i,f),z(a,e[3],t[3]),z(a,a,u),z(o,e[2],t[2]),L(o,o,o),R(s,i,r),R(c,o,a),L(l,o,a),L(d,i,r),z(e[0],s,c),z(e[1],d,l),z(e[2],l,c),z(e[3],s,d)}function V(e,t,n){var r;for(r=0;r<4;r++)P(e[r],t[r],n)}function ge(e,t){var r=n(),i=n(),a=n();ne(a,t[2]),z(r,t[0],a),z(i,t[1],a),F(e,i),e[31]^=ee(r)<<7}function _e(e,t,n){var r,i;for(M(e[0],o),M(e[1],s),M(e[2],s),M(e[3],o),i=255;i>=0;--i)r=n[i/8|0]>>(i&7)&1,V(e,t,r),he(t,e),he(e,e),V(e,t,r)}function H(e,t){var r=[n(),n(),n(),n()];M(r[0],d),M(r[1],f),M(r[2],s),z(r[3],d,f),_e(e,r,t)}function ve(e,t,i){var a=new Uint8Array(64),o=[n(),n(),n(),n()],s;for(i||r(t,32),me(a,t,32),a[0]&=248,a[31]&=127,a[31]|=64,H(o,a),ge(e,o),s=0;s<32;s++)t[s+32]=e[s];return 0}var ye=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function be(e,t){var n,r,i,a;for(r=63;r>=32;--r){for(n=0,i=r-32,a=r-12;i<a;++i)t[i]+=n-16*t[r]*ye[i-(r-32)],n=Math.floor((t[i]+128)/256),t[i]-=n*256;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*ye[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*ye[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function xe(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;be(e,t)}function Se(e,t,r,i){var a=new Uint8Array(64),o=new Uint8Array(64),s=new Uint8Array(64),c,l,u=new Float64Array(64),d=[n(),n(),n(),n()];me(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=r+64;for(c=0;c<r;c++)e[64+c]=t[c];for(c=0;c<32;c++)e[32+c]=a[32+c];for(me(s,e.subarray(32),r+32),xe(s),H(d,s),ge(e,d),c=32;c<64;c++)e[c]=i[c];for(me(o,e,r+64),xe(o),c=0;c<64;c++)u[c]=0;for(c=0;c<32;c++)u[c]=s[c];for(c=0;c<32;c++)for(l=0;l<32;l++)u[c+l]+=o[c]*a[l];return be(e.subarray(32),u),f}function Ce(e,t){var r=n(),i=n(),a=n(),c=n(),u=n(),d=n(),f=n();return M(e[2],s),te(e[1],t),B(a,e[1]),z(c,a,l),R(a,a,e[2]),L(c,e[2],c),B(u,c),B(d,u),z(f,d,u),z(r,f,a),z(r,r,c),re(r,r),z(r,r,a),z(r,r,c),z(r,r,c),z(e[0],r,c),B(i,e[0]),z(i,i,c),I(i,a)&&z(e[0],e[0],p),B(i,e[0]),z(i,i,c),I(i,a)?-1:(ee(e[0])===t[31]>>7&&R(e[0],o,e[0]),z(e[3],e[0],e[1]),0)}function we(e,t,r,i){var a,o=new Uint8Array(32),s=new Uint8Array(64),c=[n(),n(),n(),n()],l=[n(),n(),n(),n()];if(r<64||Ce(l,i))return-1;for(a=0;a<r;a++)e[a]=t[a];for(a=0;a<32;a++)e[a+32]=i[a];if(me(s,e,r),xe(s),_e(c,l,s),H(l,t.subarray(32)),he(c,l),ge(o,c),r-=64,_(t,0,o,0)){for(a=0;a<r;a++)e[a]=0;return-1}for(a=0;a<r;a++)e[a]=t[a+64];return r}var Te=32,Ee=24,De=32,Oe=16,ke=32,Ae=32,je=32,Me=32,Ne=32,U=Ee,Pe=De,Fe=Oe,Ie=64,Le=32,Re=64,ze=32,Be=64;e.lowlevel={crypto_core_hsalsa20:x,crypto_stream_xor:E,crypto_stream:T,crypto_stream_salsa20_xor:C,crypto_stream_salsa20:w,crypto_onetimeauth:O,crypto_onetimeauth_verify:k,crypto_verify_16:g,crypto_verify_32:_,crypto_secretbox:A,crypto_secretbox_open:j,crypto_scalarmult:ie,crypto_scalarmult_base:ae,crypto_box_beforenm:se,crypto_box_afternm:ce,crypto_box:ue,crypto_box_open:de,crypto_box_keypair:oe,crypto_hash:me,crypto_sign:Se,crypto_sign_keypair:ve,crypto_sign_open:we,crypto_secretbox_KEYBYTES:Te,crypto_secretbox_NONCEBYTES:Ee,crypto_secretbox_ZEROBYTES:De,crypto_secretbox_BOXZEROBYTES:Oe,crypto_scalarmult_BYTES:ke,crypto_scalarmult_SCALARBYTES:Ae,crypto_box_PUBLICKEYBYTES:je,crypto_box_SECRETKEYBYTES:Me,crypto_box_BEFORENMBYTES:Ne,crypto_box_NONCEBYTES:U,crypto_box_ZEROBYTES:Pe,crypto_box_BOXZEROBYTES:Fe,crypto_sign_BYTES:Ie,crypto_sign_PUBLICKEYBYTES:Le,crypto_sign_SECRETKEYBYTES:Re,crypto_sign_SEEDBYTES:ze,crypto_hash_BYTES:Be,gf:n,D:l,L:ye,pack25519:F,unpack25519:te,M:z,A:L,S:B,Z:R,pow2523:re,add:he,set25519:M,modL:be,scalarmult:_e,scalarbase:H};function Ve(e,t){if(e.length!==Te)throw Error(`bad key size`);if(t.length!==Ee)throw Error(`bad nonce size`)}function He(e,t){if(e.length!==je)throw Error(`bad public key size`);if(t.length!==Me)throw Error(`bad secret key size`)}function W(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw TypeError(`unexpected type, use Uint8Array`)}function Ue(e){for(var t=0;t<e.length;t++)e[t]=0}e.randomBytes=function(e){var t=new Uint8Array(e);return r(t,e),t},e.secretbox=function(e,t,n){W(e,t,n),Ve(n,t);for(var r=new Uint8Array(De+e.length),i=new Uint8Array(r.length),a=0;a<e.length;a++)r[a+De]=e[a];return A(i,r,r.length,t,n),i.subarray(Oe)},e.secretbox.open=function(e,t,n){W(e,t,n),Ve(n,t);for(var r=new Uint8Array(Oe+e.length),i=new Uint8Array(r.length),a=0;a<e.length;a++)r[a+Oe]=e[a];return r.length<32||j(i,r,r.length,t,n)!==0?null:i.subarray(De)},e.secretbox.keyLength=Te,e.secretbox.nonceLength=Ee,e.secretbox.overheadLength=Oe,e.scalarMult=function(e,t){if(W(e,t),e.length!==Ae)throw Error(`bad n size`);if(t.length!==ke)throw Error(`bad p size`);var n=new Uint8Array(ke);return ie(n,e,t),n},e.scalarMult.base=function(e){if(W(e),e.length!==Ae)throw Error(`bad n size`);var t=new Uint8Array(ke);return ae(t,e),t},e.scalarMult.scalarLength=Ae,e.scalarMult.groupElementLength=ke,e.box=function(t,n,r,i){var a=e.box.before(r,i);return e.secretbox(t,n,a)},e.box.before=function(e,t){W(e,t),He(e,t);var n=new Uint8Array(Ne);return se(n,e,t),n},e.box.after=e.secretbox,e.box.open=function(t,n,r,i){var a=e.box.before(r,i);return e.secretbox.open(t,n,a)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(je),t=new Uint8Array(Me);return oe(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(W(e),e.length!==Me)throw Error(`bad secret key size`);var t=new Uint8Array(je);return ae(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=je,e.box.secretKeyLength=Me,e.box.sharedKeyLength=Ne,e.box.nonceLength=U,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(W(e,t),t.length!==Re)throw Error(`bad secret key size`);var n=new Uint8Array(Ie+e.length);return Se(n,e,e.length,t),n},e.sign.open=function(e,t){if(W(e,t),t.length!==Le)throw Error(`bad public key size`);var n=new Uint8Array(e.length),r=we(n,e,e.length,t);if(r<0)return null;for(var i=new Uint8Array(r),a=0;a<i.length;a++)i[a]=n[a];return i},e.sign.detached=function(t,n){for(var r=e.sign(t,n),i=new Uint8Array(Ie),a=0;a<i.length;a++)i[a]=r[a];return i},e.sign.detached.verify=function(e,t,n){if(W(e,t,n),t.length!==Ie)throw Error(`bad signature size`);if(n.length!==Le)throw Error(`bad public key size`);var r=new Uint8Array(Ie+e.length),i=new Uint8Array(Ie+e.length),a;for(a=0;a<Ie;a++)r[a]=t[a];for(a=0;a<e.length;a++)r[a+Ie]=e[a];return we(i,r,r.length,n)>=0},e.sign.keyPair=function(){var e=new Uint8Array(Le),t=new Uint8Array(Re);return ve(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(W(e),e.length!==Re)throw Error(`bad secret key size`);for(var t=new Uint8Array(Le),n=0;n<t.length;n++)t[n]=e[32+n];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(W(e),e.length!==ze)throw Error(`bad seed size`);for(var t=new Uint8Array(Le),n=new Uint8Array(Re),r=0;r<32;r++)n[r]=e[r];return ve(t,n,!0),{publicKey:t,secretKey:n}},e.sign.publicKeyLength=Le,e.sign.secretKeyLength=Re,e.sign.seedLength=ze,e.sign.signatureLength=Ie,e.hash=function(e){W(e);var t=new Uint8Array(Be);return me(t,e,e.length),t},e.hash.hashLength=Be,e.verify=function(e,t){return W(e,t),e.length===0||t.length===0||e.length!==t.length?!1:h(e,0,t,0,e.length)===0},e.setPRNG=function(e){r=e},(function(){var n=typeof self<`u`?self.crypto||self.msCrypto:null;if(n&&n.getRandomValues){var r=65536;e.setPRNG(function(e,t){var i,a=new Uint8Array(t);for(i=0;i<t;i+=r)n.getRandomValues(a.subarray(i,i+Math.min(t-i,r)));for(i=0;i<t;i++)e[i]=a[i];Ue(a)})}else t!==void 0&&(n=bi(),n&&n.randomBytes&&e.setPRNG(function(e,t){var r,i=n.randomBytes(t);for(r=0;r<t;r++)e[r]=i[r];Ue(i)}))})()})(n!==void 0&&n.exports?n.exports:self.nacl=self.nacl||{})})),Si=a((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=t(xi()).default})),Ci=a((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.KP=void 0;var n=yi(),r=Ei(),i=t(Si());e.KP=class{seed;constructor(e){this.seed=e}getRawSeed(){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);return n.Codec.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let e=n.Codec.decodeSeed(this.seed),t=i.default.sign.keyPair.fromSeed(this.getRawSeed()),a=n.Codec.encode(e.prefix,t.publicKey);return new TextDecoder().decode(a)}getPrivateKey(){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let e=i.default.sign.keyPair.fromSeed(this.getRawSeed());return n.Codec.encode(r.Prefix.Private,e.secretKey)}sign(e){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let t=i.default.sign.keyPair.fromSeed(this.getRawSeed());return i.default.sign.detached(e,t.secretKey)}verify(e,t){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let n=i.default.sign.keyPair.fromSeed(this.getRawSeed());return i.default.sign.detached.verify(e,t,n.publicKey)}clear(){this.seed&&=(this.seed.fill(0),void 0)}seal(e,t,n){throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation)}open(e,t){throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation)}}})),wi=a((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=void 0;var n=yi(),r=Ei(),i=t(Si());e.PublicKey=class{publicKey;constructor(e){this.publicKey=e}getPublicKey(){if(!this.publicKey)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new r.NKeysError(r.NKeysErrorCode.PublicKeyOnly):new r.NKeysError(r.NKeysErrorCode.ClearedPair)}getSeed(){throw this.publicKey?new r.NKeysError(r.NKeysErrorCode.PublicKeyOnly):new r.NKeysError(r.NKeysErrorCode.ClearedPair)}sign(e){throw this.publicKey?new r.NKeysError(r.NKeysErrorCode.CannotSign):new r.NKeysError(r.NKeysErrorCode.ClearedPair)}verify(e,t){if(!this.publicKey)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let a=n.Codec._decode(this.publicKey);return i.default.sign.detached.verify(e,t,a.slice(1))}clear(){this.publicKey&&=(this.publicKey.fill(0),void 0)}seal(e,t,n){throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation)}open(e,t){throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation)}}})),Ti=a((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.CurveKP=e.curveNonceLen=e.curveKeyLen=void 0;var n=Ei(),r=t(Si()),i=yi(),a=Ei(),o=vi(),s=_i();e.curveKeyLen=32;var c=35;e.curveNonceLen=24;var l=[120,107,118,49];e.CurveKP=class{seed;constructor(e){this.seed=e}clear(){this.seed&&=(this.seed.fill(0),void 0)}getPrivateKey(){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);return i.Codec.encode(a.Prefix.Private,this.seed)}getPublicKey(){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);let e=r.default.scalarMult.base(this.seed),t=i.Codec.encode(a.Prefix.Curve,e);return new TextDecoder().decode(t)}getSeed(){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);return i.Codec.encodeSeed(a.Prefix.Curve,this.seed)}sign(){throw new n.NKeysError(n.NKeysErrorCode.InvalidCurveOperation)}verify(){throw new n.NKeysError(n.NKeysErrorCode.InvalidCurveOperation)}decodePubCurveKey(e){try{let t=o.base32.decode(new TextEncoder().encode(e));if(t.byteLength!==c)throw new n.NKeysError(n.NKeysErrorCode.InvalidCurveKey);if(t[0]!==a.Prefix.Curve)throw new n.NKeysError(n.NKeysErrorCode.InvalidPublicKey);let r=t.byteLength-2,i=new DataView(t.buffer).getUint16(r,!0),l=t.slice(0,r);if(!s.crc16.validate(l,i))throw new n.NKeysError(n.NKeysErrorCode.InvalidChecksum);return l.slice(1)}catch(e){throw new n.NKeysError(n.NKeysErrorCode.InvalidRecipient,{cause:e})}}seal(t,i,a){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);a||=r.default.randomBytes(e.curveNonceLen);let o=this.decodePubCurveKey(i),s=new Uint8Array(l.length+e.curveNonceLen);s.set(l,0),s.set(a,l.length);let c=r.default.box(t,a,o,this.seed),u=new Uint8Array(s.length+c.length);return u.set(s),u.set(c,s.length),u}open(t,i){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);if(t.length<=e.curveNonceLen+l.length)throw new n.NKeysError(n.NKeysErrorCode.InvalidEncrypted);for(let e=0;e<l.length;e++)if(t[e]!==l[e])throw new n.NKeysError(n.NKeysErrorCode.InvalidEncrypted);let a=this.decodePubCurveKey(i);t=t.slice(l.length);let o=t.slice(0,e.curveNonceLen);return t=t.slice(e.curveNonceLen),r.default.box.open(t,o,a,this.seed)}}})),Ei=a((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.NKeysError=e.NKeysErrorCode=e.Prefixes=e.Prefix=void 0,e.createPair=s,e.createOperator=c,e.createAccount=l,e.createUser=u,e.createCluster=d,e.createServer=f,e.createCurve=p,e.fromPublic=m,e.fromCurveSeed=h,e.fromSeed=g;var n=Ci(),r=wi(),i=yi(),a=Ti(),o=t(Si());function s(e){let t=e===_.Curve?a.curveKeyLen:32,r=o.default.randomBytes(t),s=i.Codec.encodeSeed(e,new Uint8Array(r));return e===_.Curve?new a.CurveKP(new Uint8Array(r)):new n.KP(s)}function c(){return s(_.Operator)}function l(){return s(_.Account)}function u(){return s(_.User)}function d(){return s(_.Cluster)}function f(){return s(_.Server)}function p(){return s(_.Curve)}function m(e){let t=new TextEncoder().encode(e),n=i.Codec._decode(t),a=v.parsePrefix(n[0]);if(v.isValidPublicPrefix(a))return new r.PublicKey(t);throw new b(y.InvalidPublicKey)}function h(e){let t=i.Codec.decodeSeed(e);if(t.prefix!==_.Curve)throw new b(y.InvalidCurveSeed);if(t.buf.byteLength!==a.curveKeyLen)throw new b(y.InvalidSeedLen);return new a.CurveKP(t.buf)}function g(e){return i.Codec.decodeSeed(e).prefix===_.Curve?h(e):new n.KP(e)}var _;(function(e){e[e.Unknown=-1]=`Unknown`,e[e.Seed=144]=`Seed`,e[e.Private=120]=`Private`,e[e.Operator=112]=`Operator`,e[e.Server=104]=`Server`,e[e.Cluster=16]=`Cluster`,e[e.Account=0]=`Account`,e[e.User=160]=`User`,e[e.Curve=184]=`Curve`})(_||(e.Prefix=_={}));var v=class{static isValidPublicPrefix(e){return e==_.Server||e==_.Operator||e==_.Cluster||e==_.Account||e==_.User||e==_.Curve}static startsWithValidPrefix(e){let t=e[0];return t==`S`||t==`P`||t==`O`||t==`N`||t==`C`||t==`A`||t==`U`||t==`X`}static isValidPrefix(e){return this.parsePrefix(e)!==_.Unknown}static parsePrefix(e){switch(e){case _.Seed:return _.Seed;case _.Private:return _.Private;case _.Operator:return _.Operator;case _.Server:return _.Server;case _.Cluster:return _.Cluster;case _.Account:return _.Account;case _.User:return _.User;case _.Curve:return _.Curve;default:return _.Unknown}}};e.Prefixes=v;var y;(function(e){e.InvalidPrefixByte=`nkeys: invalid prefix byte`,e.InvalidKey=`nkeys: invalid key`,e.InvalidPublicKey=`nkeys: invalid public key`,e.InvalidSeedLen=`nkeys: invalid seed length`,e.InvalidSeed=`nkeys: invalid seed`,e.InvalidCurveSeed=`nkeys: invalid curve seed`,e.InvalidCurveKey=`nkeys: not a valid curve key`,e.InvalidCurveOperation=`nkeys: curve key is not valid for sign/verify`,e.InvalidNKeyOperation=`keys: only curve key can seal/open`,e.InvalidEncoding=`nkeys: invalid encoded key`,e.InvalidRecipient=`nkeys: not a valid recipient public curve key`,e.InvalidEncrypted=`nkeys: encrypted input is not valid`,e.CannotSign=`nkeys: cannot sign, no private key available`,e.PublicKeyOnly=`nkeys: no seed or private key available`,e.InvalidChecksum=`nkeys: invalid checksum`,e.SerializationError=`nkeys: serialization error`,e.ApiError=`nkeys: api error`,e.ClearedPair=`nkeys: pair is cleared`})(y||(e.NKeysErrorCode=y={}));var b=class extends Error{code;constructor(e,t){super(e,t),this.code=e}};e.NKeysError=b})),Di=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.encode=t,e.decode=n,e.dump=r;function t(e){return btoa(String.fromCharCode(...e))}function n(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function r(e,t){t&&console.log(t);let n=[];for(let t=0;t<e.byteLength;t++){t%8==0&&n.push(`
|
|
4
|
-
`);let r=e[t].toString(16);r.length===1&&(r=`0`+r),n.push(r)}console.log(n.join(` `))}})),Oi=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.version=void 0,e.version=`2.0.3`})),ki=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.encode=e.decode=e.Prefixes=e.Prefix=e.NKeysErrorCode=e.NKeysError=e.fromSeed=e.fromPublic=e.fromCurveSeed=e.createUser=e.createServer=e.createPair=e.createOperator=e.createCurve=e.createCluster=e.createAccount=void 0;var t=Ei();Object.defineProperty(e,"createAccount",{enumerable:!0,get:function(){return t.createAccount}}),Object.defineProperty(e,"createCluster",{enumerable:!0,get:function(){return t.createCluster}}),Object.defineProperty(e,"createCurve",{enumerable:!0,get:function(){return t.createCurve}}),Object.defineProperty(e,"createOperator",{enumerable:!0,get:function(){return t.createOperator}}),Object.defineProperty(e,"createPair",{enumerable:!0,get:function(){return t.createPair}}),Object.defineProperty(e,"createServer",{enumerable:!0,get:function(){return t.createServer}}),Object.defineProperty(e,"createUser",{enumerable:!0,get:function(){return t.createUser}}),Object.defineProperty(e,"fromCurveSeed",{enumerable:!0,get:function(){return t.fromCurveSeed}}),Object.defineProperty(e,"fromPublic",{enumerable:!0,get:function(){return t.fromPublic}}),Object.defineProperty(e,"fromSeed",{enumerable:!0,get:function(){return t.fromSeed}}),Object.defineProperty(e,"NKeysError",{enumerable:!0,get:function(){return t.NKeysError}}),Object.defineProperty(e,"NKeysErrorCode",{enumerable:!0,get:function(){return t.NKeysErrorCode}}),Object.defineProperty(e,"Prefix",{enumerable:!0,get:function(){return t.Prefix}}),Object.defineProperty(e,"Prefixes",{enumerable:!0,get:function(){return t.Prefixes}});var n=Di();Object.defineProperty(e,"decode",{enumerable:!0,get:function(){return n.decode}}),Object.defineProperty(e,"encode",{enumerable:!0,get:function(){return n.encode}});var r=Oi();Object.defineProperty(e,"version",{enumerable:!0,get:function(){return r.version}})})),Ai,ji=n((()=>{Ai=r(ki(),1)}));function Mi(e){return t=>{let n={};return e.forEach(e=>{let r=e(t)||{};n=Object.assign(n,r)}),n}}function Ni(){return()=>{}}function Pi(e,t){return()=>({user:typeof e==`function`?e():e,pass:typeof t==`function`?t():t})}function Fi(e){return()=>({auth_token:typeof e==`function`?e():e})}function Ii(e){return t=>{let n=typeof e==`function`?e():e,r=n?Ai.fromSeed(n):void 0,i=r?r.getPublicKey():``,a=an.encode(t||``),o=r!==void 0&&t?r.sign(a):void 0;return{nkey:i,sig:o?Ai.encode(o):``}}}function Li(e,t){return n=>{let r=typeof e==`function`?e():e,{nkey:i,sig:a}=Ii(t)(n);return{jwt:r,nkey:i,sig:a}}}function Ri(e){let t=typeof e==`function`?e:()=>e,n=()=>{let e=/\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/gi,n=on.decode(t()),r=e.exec(n);if(!r)throw Error(`unable to parse credentials`);let i=r[1].trim();if(r=e.exec(n),!r)throw Error(`unable to parse credentials`);return{jwt:i,seed:an.encode(r[1].trim())}};return Li(()=>{let{jwt:e}=n();return e},()=>{let{seed:e}=n();return e})}var zi=n((()=>{sn()}));function Bi(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:qi,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:Ki,reconnectTimeWait:Ji,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function Vi(e){if(e){let{servers:t}=e;if(typeof t==`string`&&(t=[t]),t)for(let e=0;e<t.length;e++){let n=t[e].toLowerCase();if(n.startsWith(`ws://`)||n.startsWith(`wss://`))return!0}}return!1}function Hi(e){let t=[];return typeof e.authenticator==`function`&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(Fi(e.token)),e.user&&t.push(Pi(e.user,e.pass)),t.length===0?Ni():Mi(t)}function Ui(e){let t=`${Xn}:${tr()}`;if(e||={servers:[t]},e.servers=e.servers||[],typeof e.servers==`string`&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw ln.format([`servers`,`port`],`are mutually exclusive`);e.servers.length===0&&e.port&&(e.servers=[`${Xn}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);let n=Cn(Bi(),e);if(n.authenticator=Hi(n),[`reconnectDelayHandler`,`authenticator`].forEach(e=>{if(n[e]&&typeof n[e]!=`function`)throw TypeError(`'${e}' must be a function`)}),n.reconnectDelayHandler||=(e=0)=>{let t=n.reconnectTimeWait??2e3,r=n.reconnectionDelayMax??0,i=n.reconnectionRandomizationFactor??0;if(r>0){let n=Math.min(t*2**Math.max(0,e),r);if(i>0){let e=n*(1-i),t=n*(1+i);n=e+Math.random()*(t-e)}return Math.round(n)}let a=n.tls?n.reconnectJitterTLS:n.reconnectJitter;return a&&=(a++,Math.floor(Math.random()*a)),t+(a??0)},n.inboxPrefix&&qn(n.inboxPrefix),n.resolve===void 0&&(n.resolve=typeof ir()==`function`),n.resolve&&typeof ir()!=`function`)throw ln.format(`resolve`,`is not supported in the current runtime`);return n}function Wi(e,t){let{proto:n,tls_required:r,tls_available:i}=e;if((n===void 0||n<1)&&t.noEcho)throw new xn.ConnectionError(`server does not support 'noEcho'`);let a=r||i||!1;if(t.tls&&!a)throw new xn.ConnectionError(`server does not support 'tls'`)}function Gi(e,t){if(t)throw ln.format(e,`is not supported`)}var Ki,qi,Ji,Yi=n((()=>{Vn(),dr(),Zn(),zi(),Sn(),Ki=1e3,qi=120*1e3,Ji=2*1e3}));function Xi(e){return typeof e==`object`&&!!e&&`server`in e&&`delay`in e}function Zi(e){let t=e.reason;if(t instanceof Error)return t;if(typeof t==`string`)return Error(t);if(t!=null)try{return Error(String(t))}catch{}return Error(`aborted`)}var Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la=n((()=>{sn(),dr(),Vn(),$n(),Fr(),Lr(),zr(),Vr(),ii(),di(),gi(),Yi(),Sn(),Qi=1024*32,$i=/^INFO\s+([^\r\n]+)\r\n/i,ea=tn(`PONG\r
|
|
5
|
-
`),ta=tn(`PING\r
|
|
6
|
-
`),na=`client option reconnectToServer handler failed`,ra=`returned server is not in the pool`,ia=class{echo;no_responders;protocol;verbose;pedantic;jwt;nkey;sig;user;pass;auth_token;tls_required;name;lang;version;headers;constructor(e,t,n){this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=t.noEcho?!1:void 0,this.verbose=t.verbose,this.pedantic=t.pedantic,this.tls_required=t.tls?!0:void 0,this.name=t.name;let r=(t&&typeof t.authenticator==`function`?t.authenticator(n):{})||{};Cn(this,r)}},aa=class{slow;cb;notified;constructor(e,t){this.slow=e,this.cb=t,this.notified=!1}maybeNotify(e){e<=this.slow?this.notified=!1:this.notified||=(this.cb(e),!0)}},oa=class extends Ir{sid;queue;draining;max;subject;drained;protocol;timer;info;cleanupFn;closed;requestSubject;slow;constructor(e,t,n={}){super(),Cn(this,n),this.protocol=e,this.subject=t,this.draining=!1,this.noIterator=typeof n.callback==`function`,this.closed=On();let r=!e.options?.noAsyncTraces;n.timeout&&(this.timer=Tn(n.timeout,r),this.timer.then(()=>{this.timer=void 0}).catch(e=>{this.stop(e),this.noIterator&&this.callback(e,{})})),this.noIterator||this.iterClosed.then(e=>{this.closed.resolve(e),this.unsubscribe()})}setSlowNotificationFn(e,t){if(this.slow=void 0,t){if(this.noIterator)throw Error(`callbacks don't support slow notifications`);this.slow=new aa(e,t)}}callback(e,t){this.cancelTimeout(),e?this.stop(e):this.push(t),!e&&this.slow&&this.slow.maybeNotify(this.getPending())}close(e){if(!this.isClosed()){this.cancelTimeout();let t=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve(e)};this.noIterator?t():this.push(t)}}unsubscribe(e){this.protocol.unsubscribe(this,e)}cancelTimeout(){this.timer&&=(this.timer.cancel(),void 0)}drain(){return this.protocol.isClosed()?Promise.reject(new xn.ClosedConnectionError):this.isClosed()?Promise.reject(new xn.InvalidOperationError(`subscription is already closed`)):(this.drained||=(this.draining=!0,this.protocol.unsub(this),this.protocol.flush(On()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}async[Symbol.asyncDispose](){if(!(this.protocol.isClosed()||this.isClosed())){if(this.drained){await this.drained;return}await this.drain()}}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}},sa=class{mux;subs;sidCounter;constructor(){this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){let t=this.all(),n;return e.operation===`subscription`?n=t.find(t=>t.subject===e.subject&&t.queue===e.queue):e.operation===`publish`&&(n=t.find(t=>t.requestSubject===e.subject)),n?(n.callback(e,{}),n.close(e),this.subs.delete(n.sid),n!==this.mux):!1}close(){this.subs.forEach(e=>{e.close()})}},ca=class e{connected;connectedOnce;infoReceived;info;muxSubscriptions;options;outbound;pongs;subscriptions;transport;noMorePublishing;connectError;publisher;_closed;closed;listeners;heartbeats;parser;outMsgs;inMsgs;outBytes;inBytes;pendingLimit;lastError;abortReconnect;whyClosed;servers;server;features;connectPromise;dialDelay;raceTimer;constructor(e,t){this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=Qi,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new sa,this.muxSubscriptions=new Rr,this.outbound=new Qn,this.pongs=[],this.whyClosed=``,this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new hi({major:0,minor:0,micro:0}),this.connectPromise=null,this.dialDelay=null;let n=typeof e.servers==`string`?[e.servers]:e.servers;this.servers=new Pr({randomize:!e.noRandomize}),this.servers.setServers(n),this.closed=On(),this.parser=new ri(this),this.heartbeats=new Br(this,this.options.pingInterval||12e4,this.options.maxPingOut||2,this.options.pingTimeout??0)}resetOutbound(){this.outbound.reset();let e=this.pongs;this.pongs=[];let t=new xn.RequestError(`connection disconnected`);t.stack=``,e.forEach(e=>{e.reject(t)}),this.parser=new ri(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();let e=On();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=rr(),this.transport.closed().then(async e=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:`staleConnection`}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:`forceReconnect`}),this.transport.disconnect()),Promise.resolve()}forceReconnect(){return this.dispatchStatus({type:`forceReconnect`}),this.dialDelay?.cancel(),this.raceTimer?.cancel(),this.connected?(this.transport.disconnect(),Promise.resolve()):this.connectPromise===null&&!this._closed?this.dialLoop().then(()=>{this.dispatchStatus({type:`reconnect`,server:this.servers.getCurrentServer().toString()})}).catch(e=>{this.close(e).catch(()=>{})}):Promise.resolve()}async disconnected(e){this.dispatchStatus({type:`disconnect`,server:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{this.dispatchStatus({type:`reconnect`,server:this.servers.getCurrentServer().toString()}),this.lastError instanceof xn.UserAuthenticationExpiredError&&(this.lastError=void 0)}).catch(e=>{this.close(e).catch()}):await this.close(e).catch()}async dial(e){let t=this.prepare();try{this.raceTimer=Tn(this.options.timeout||2e4);let t=this.transport.connect(e,this.options);await Promise.race([t,this.raceTimer]),(async()=>{try{for await(let e of this.transport)this.parser.parse(e)}catch(e){console.log(`reader closed`,e)}})().then()}catch(e){t.reject(e)}try{await Promise.race([this.raceTimer,t]),this.raceTimer?.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(e){throw this.raceTimer?.cancel(),await this.transport.close(e),e}}async _doDial(e){let{resolve:t}=this.options,n=await e.resolve({fn:ir(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:t}),r=null;for(let e of n)try{r=null,this.dispatchStatus({type:`reconnecting`}),await this.dial(e);return}catch(e){r=e}throw r}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();let t=this.selectServer(),n=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler(t?.reconnects??0):Ji,r=n;if(!t||this.abortReconnect)throw e||(this.lastError?this.lastError:new xn.ConnectionError(`connection refused`));let i=Date.now();if(t.lastConnect===0||t.lastConnect+n<=i){let n=t,r=0;if(this.options.reconnectToServer)try{let e=this.servers.snapshotForHandler(),i=this.options.reconnectToServer(e,this.info??null),a;if(Xi(i)?(a=i.server,r=Number.isFinite(i.delay)&&i.delay>0?Math.floor(i.delay):0):a=i,a!==null){let e=this.servers.find(a);if(!e)throw Error(ra);e!==t&&(n=e,this.servers.setCurrent(n),this.server=n)}}catch(e){let t=e instanceof Error?e:Error(String(e));throw new xn.ConnectionError(`${na}: ${t.message}`,{cause:t})}r>0&&(this.dialDelay=En(r),await this.dialDelay),n.lastConnect=Date.now();try{await this._doDial(n);break}catch(t){if(e=t,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}n.reconnects++;let r=this.options.maxReconnectAttempts||0;r!==-1&&n.reconnects>=r&&this.servers.removeCurrentServer()}}else r=Math.min(r,t.lastConnect+n-i),this.dialDelay=En(r),await this.dialDelay}}static async connect(t,n){let r=new e(t,n),i=t.signal,a;if(i){if(i.aborted){let e=Zi(i);throw r.abortClose(e),e}a=()=>{try{r.abortClose(Zi(i))}catch{}},i.addEventListener(`abort`,a,{once:!0})}try{return await r.dialLoop(),r}finally{i&&a&&i.removeEventListener(`abort`,a)}}static toError(e){let t=xn.PermissionViolationError.parse(e);return t||(t=xn.UserAuthenticationExpiredError.parse(e),t)||(t=xn.AuthorizationError.parse(e),t)?t:new xn.ProtocolError(e)}processMsg(e,t){if(this.inMsgs++,this.inBytes+=t.length,!this.subscriptions.sidCounter)return;let n=this.subscriptions.get(e.sid);n&&(n.received+=1,n.callback&&n.callback(null,new ui(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(t){let n=nn(t);n.startsWith(`'`)&&n.endsWith(`'`)&&(n=n.slice(1,n.length-1));let r=e.toError(n);switch(r.constructor){case xn.PermissionViolationError:{let e=r,t=this.subscriptions.getMux(),n=t?e.subject===t.subject:!1;this.subscriptions.handleError(e),this.muxSubscriptions.handleError(n,e),n&&this.subscriptions.setMux(null)}}this.dispatchStatus({type:`error`,error:r}),this.handleError(r)}handleError(e){(e instanceof xn.UserAuthenticationExpiredError||e instanceof xn.AuthorizationError)&&this.handleAuthError(e),e instanceof xn.PermissionViolationError||(this.lastError=e)}handleAuthError(e){(this.lastError instanceof xn.UserAuthenticationExpiredError||this.lastError instanceof xn.AuthorizationError)&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(ea)}processPong(){let e=this.pongs.shift();e&&e.resolve()}processInfo(e){let t=JSON.parse(nn(e));this.info=t;let n=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(t,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(fi(t.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();let{version:e,lang:n}=this.transport;try{let r=new ia({version:e,lang:n},this.options,t.nonce);t.headers&&(r.headers=!0,r.no_responders=!0);let i=JSON.stringify(r);this.transport.send(tn(`CONNECT ${i}\r
|
|
7
|
-
`)),this.transport.send(ta)}catch(e){this.close(e).catch()}}if(n){let{added:e,deleted:t}=n;this.dispatchStatus({type:`update`,added:e,deleted:t})}t.ldm!==void 0&&t.ldm&&this.dispatchStatus({type:`ldm`,server:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case $r.MSG:{let{msg:t,data:n}=e;this.processMsg(t,n);break}case $r.OK:break;case $r.ERR:this.processError(e.data);break;case $r.PING:this.processPing();break;case $r.PONG:this.processPong();break;case $r.INFO:this.processInfo(e.data);break}}sendCommand(e,...t){let n=this.outbound.length(),r;r=typeof e==`string`?tn(e):e,this.outbound.fill(r,...t),n===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,t=rn,n){let r;if(t instanceof Uint8Array)r=t;else if(typeof t==`string`)r=an.encode(t);else throw TypeError(`payload types can be strings or Uint8Array`);let i=r.length;n||={},n.reply=n.reply||``;let a=rn,o=0;if(n.headers&&(this.info&&!this.info.headers&&ln.format(`headers`,`are not available on this server`),a=n.headers.encode(),o=a.length,i=r.length+o),this.info&&i>this.info.max_payload)throw ln.format(`payload`,`max_payload size exceeded`);this.outBytes+=i,this.outMsgs++;let s;n.headers?(s=n.reply?`HPUB ${e} ${n.reply} ${o} ${i}\r\n`:`HPUB ${e} ${o} ${i}\r\n`,this.sendCommand(s,a,r,cr)):(s=n.reply?`PUB ${e} ${n.reply} ${i}\r\n`:`PUB ${e} ${i}\r\n`,this.sendCommand(s,r,cr))}request(e){return this.initMux(),this.muxSubscriptions.add(e),e}subscribe(e){return this.subscriptions.add(e),this._subunsub(e),e}_sub(e){e.queue?this.sendCommand(`SUB ${e.subject} ${e.queue} ${e.sid}\r\n`):this.sendCommand(`SUB ${e.subject} ${e.sid}\r\n`)}_subunsub(e){return this._sub(e),e.max&&this.unsubscribe(e,e.max),e}unsubscribe(e,t){this.unsub(e,t),(e.max===void 0||e.received>=e.max)&&this.subscriptions.cancel(e)}unsub(e,t){!e||this.isClosed()||(t?this.sendCommand(`UNSUB ${e.sid} ${t}\r\n`):this.sendCommand(`UNSUB ${e.sid}\r\n`),e.max=t)}resub(e,t){!e||this.isClosed()||(this.unsub(e),e.subject=t,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||=On(),this.pongs.push(e),this.outbound.fill(ta),this.flushPending(),e}sendSubscriptions(){let e=[];this.subscriptions.all().forEach(t=>{let n=t;n.queue?e.push(`SUB ${n.subject} ${n.queue} ${n.sid}\r
|
|
8
|
-
`):e.push(`SUB ${n.subject} ${n.sid}\r
|
|
9
|
-
`)}),e.length&&this.transport.send(tn(e.join(``)))}async close(e){if(this._closed)return;this.whyClosed=Error(`close trace`).stack||``,this.heartbeats.cancel(),this.connectError&&=(this.connectError(e),void 0),this.muxSubscriptions.close(),this.subscriptions.close();let t=[];for(let e=0;e<this.listeners.length;e++){let n=this.listeners[e];n&&(n.push({type:`close`}),n.stop(),t.push(n.iterClosed))}t.length&&await Promise.all(t),this._closed=!0,await this.transport.close(e),this.raceTimer?.cancel(),this.dialDelay?.cancel(),this.closed.resolve(e)}abortClose(e){if(!this._closed){this.whyClosed=Error(`abortClose trace`).stack||``,this._closed=!0,this.abortReconnect=!0,this.heartbeats.cancel(),this.connectError&&=(this.connectError(e),void 0),this.muxSubscriptions.close(),this.subscriptions.close();for(let e=0;e<this.listeners.length;e++){let t=this.listeners[e];t&&(t.push({type:`close`}),t.stop())}this.raceTimer?.cancel(),this.dialDelay?.cancel();try{this.transport?.close(e)}catch{}this.closed.resolve(e)}}isClosed(){return this._closed}async drain(){let e=this.subscriptions.all(),t=[];e.forEach(e=>{t.push(e.drain())});try{await Promise.allSettled(t)}catch{}finally{this.noMorePublishing=!0,await this.flush()}return this.close()}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){let e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){let e=this.muxSubscriptions.init(this.options.inboxPrefix),t=new oa(this,`${e}*`);t.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(t),this.subscribe(t)}}selectServer(){let e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}})),ua,da,fa,pa=n((()=>{Vn(),Sn(),ua=class{token;received;ctx;requestSubject;mux;constructor(e,t,n=!0){this.mux=e,this.requestSubject=t,this.received=0,this.token=Fn(),n&&(this.ctx=new _n)}},da=class extends ua{callback;done;timer;max;opts;constructor(e,t,n={maxWait:1e3}){if(super(e,t),this.opts=n,typeof this.opts.callback!=`function`)throw TypeError(`callback must be a function`);this.callback=this.opts.callback,this.max=typeof n.maxMessages==`number`&&n.maxMessages>0?n.maxMessages:-1,this.done=On(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},n.maxWait)}cancel(e){e&&this.callback(e,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(e,t){e?(this.ctx&&(e.stack+=`\n\n${this.ctx.stack}`),this.cancel(e)):(this.callback(null,t),this.opts.strategy===`count`&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===`stall`&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.stall||300)),this.opts.strategy===`sentinel`&&t&&t.data.length===0&&this.cancel())}},fa=class extends ua{deferred;timer;constructor(e,t,n={timeout:1e3},r=!0){super(e,t,r),this.deferred=On(),this.timer=Tn(n.timeout,r)}resolver(e,t){this.timer&&this.timer.cancel(),e?(e instanceof vn||(this.ctx?(this.ctx.message=e.message,this.ctx.cause=e,e=this.ctx):e=new xn.RequestError(e.message,{cause:e})),this.deferred.reject(e)):this.deferred.resolve(t),this.cancel()}cancel(e){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(e||new _n(`cancelled`))}}})),ma,ha,ga,_a=n((()=>{Vn(),la(),sn(),li(),gi(),Yi(),Lr(),pa(),Zn(),Sn(),ma=/[ \n\r\t]/,ha=class e{options;protocol;draining;closeListeners;constructor(e){this.draining=!1,this.options=Ui(e)}static connect(t={}){return new Promise((n,r)=>{let i=new e(t);ca.connect(i.options,i).then(e=>{i.protocol=e,n(i)}).catch(e=>{r(e)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}abortClose(e){this.protocol.abortClose(e)}_check(e,t,n){if(this.isClosed())throw new xn.ClosedConnectionError;if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw new xn.DrainingConnectionError;if(e||=``,e.length===0||ma.test(e))throw new xn.InvalidSubjectError(e)}publish(e,t,n){if(this._check(e,!1,!0),n?.reply&&this._check(n.reply,!1,!0),typeof n?.traceOnly==`boolean`){let e=n.headers||oi();e.set(`Nats-Trace-Only`,`true`),n.headers=e}if(typeof n?.traceDestination==`string`){let e=n.headers||oi();e.set(`Nats-Trace-Dest`,n.traceDestination),n.headers=e}this.protocol.publish(e,t,n)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return e.reply?(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0):!1}subscribe(e,t={}){this._check(e,!0,!1);let n=new oa(this.protocol,e,t);return typeof t.callback!=`function`&&typeof t.slow==`number`&&n.setSlowNotificationFn(t.slow,e=>{this.protocol.dispatchStatus({type:`slowConsumer`,sub:n,pending:e})}),this.protocol.subscribe(n),n}_resub(e,t,n){this._check(t,!0,!1);let r=e;r.max=n,n&&(r.max=n+r.received),this.protocol.resub(r,t)}requestMany(e,t=rn,n={maxWait:1e3,maxMessages:-1}){let r=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(e){return Promise.reject(e)}if(n.strategy=n.strategy||`timer`,n.maxWait=n.maxWait||1e3,n.maxWait<1)return Promise.reject(ln.format(`timeout`,`must be greater than 0`));let i=new Ir;function a(e){i.push(()=>{i.stop(e)})}function o(e,t){e||t===null?a(e===null?void 0:e):i.push(t)}if(n.noMux){let s=r?Error().stack:null,c=typeof n.maxMessages==`number`&&n.maxMessages>0?n.maxMessages:-1,l=this.subscribe(qn(this.options.inboxPrefix),{callback:(t,r)=>{if(r?.data?.length===0&&r?.headers?.status===`503`&&(t=new xn.NoRespondersError(e)),t){s&&(t.stack+=`\n\n${s}`),u(t);return}o(null,r),n.strategy===`count`&&(c--,c===0&&u()),n.strategy===`stall`&&(h(),m=setTimeout(()=>{u()},300)),n.strategy===`sentinel`&&r&&r.data.length===0&&u()}});l.requestSubject=e,l.closed.then(()=>{a()}).catch(e=>{i.stop(e)});let u=e=>{e&&i.push(()=>{throw e}),h(),l.drain().then(()=>{a()}).catch(e=>{a()})};i.iterClosed.then(()=>{h(),l?.unsubscribe()}).catch(e=>{h(),l?.unsubscribe()});let{headers:d,traceDestination:f,traceOnly:p}=n;try{this.publish(e,t,{reply:l.getSubject(),headers:d,traceDestination:f,traceOnly:p})}catch(e){u(e)}let m=setTimeout(()=>{u()},n.maxWait),h=()=>{m&&clearTimeout(m)}}else{let r=n;r.callback=o,i.iterClosed.then(()=>{a.cancel()}).catch(e=>{a.cancel(e)});let a=new da(this.protocol.muxSubscriptions,e,r);this.protocol.request(a);let{headers:s,traceDestination:c,traceOnly:l}=n;try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${a.token}`,headers:s,traceDestination:c,traceOnly:l})}catch(e){a.cancel(e)}}return Promise.resolve(i)}request(e,t,n={timeout:1e3,noMux:!1}){try{this._check(e,!0,!0)}catch(e){return Promise.reject(e)}let r=!this.protocol.options.noAsyncTraces;if(n.timeout=n.timeout||1e3,n.timeout<1)return Promise.reject(ln.format(`timeout`,`must be greater than 0`));if(!n.noMux&&n.reply)return Promise.reject(ln.format([`reply`,`noMux`],`are mutually exclusive`));if(n.noMux){let i=n.reply?n.reply:qn(this.options.inboxPrefix),a=On(),o=r?new xn.RequestError(``):null,s=this.subscribe(i,{max:1,timeout:n.timeout,callback:(t,n)=>{n&&n.data?.length===0&&n.headers?.code===503&&(t=new xn.NoRespondersError(e)),t?(t instanceof vn||(o?(o.message=t.message,o.cause=t,t=o):t=new xn.RequestError(t.message,{cause:t})),a.reject(t),s.unsubscribe()):a.resolve(n)}});return s.requestSubject=e,this.protocol.publish(e,t,{reply:i,headers:n.headers}),a}else{let i=new fa(this.protocol.muxSubscriptions,e,n,r);this.protocol.request(i);let{headers:a,traceDestination:o,traceOnly:s}=n;try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${i.token}`,headers:a,traceDestination:o,traceOnly:s})}catch(e){i.cancel(e)}let c=Promise.race([i.timer,i.deferred]);return c.catch(()=>{i.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(new xn.ClosedConnectionError):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(new xn.ClosedConnectionError):this.isDraining()?Promise.reject(new xn.DrainingConnectionError):(this.draining=!0,this.protocol.drain())}async[Symbol.asyncDispose](){if(!this.isClosed()){if(this.isDraining()){await this.closed();return}await this.drain()}}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){let e=this.protocol.getServer();return e?e.listen:``}setServers(e){this.protocol.servers.setServers(e)}getServers(){return this.protocol.servers.snapshot()}status(){let e=new Ir;return e.iterClosed.then(()=>{let t=this.protocol.listeners.indexOf(e);t>-1&&this.protocol.listeners.splice(t,1)}),this.protocol.listeners.push(e),e}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request(`$SYS.REQ.USER.INFO`)).json((e,t)=>e===`time`?new Date(Date.parse(t)):t)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}getServerVersion(){let e=this.info;return e?fi(e.version):void 0}async rtt(){if(this.isClosed())throw new xn.ClosedConnectionError;if(!this.protocol.connected)throw new xn.RequestError(`connection disconnected`);let e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}reconnect(){return this.isClosed()?Promise.reject(new xn.ClosedConnectionError):this.isDraining()?Promise.reject(new xn.DrainingConnectionError):this.protocol.reconnect()}forceReconnect(){return this.isClosed()?Promise.reject(new xn.ClosedConnectionError):this.isDraining()?Promise.reject(new xn.DrainingConnectionError):this.protocol.forceReconnect()}addCloseListener(e){this.closeListeners===void 0&&(this.closeListeners=new ga(this.closed())),this.closeListeners.add(e)}removeCloseListener(e){this.closeListeners&&this.closeListeners.remove(e)}},ga=class{listeners;constructor(e){this.listeners=[],e.then(e=>{this.notify(e)})}add(e){this.listeners.push(e)}remove(e){this.listeners=this.listeners.filter(t=>t!==e)}notify(e){this.listeners.forEach(t=>{if(typeof t.connectionClosedCallback==`function`)try{t.connectionClosedCallback(e)}catch{}}),this.listeners=[]}}})),va=n((()=>{sn()}));function ya(e,t){return`${ba(e/t)}/sec`}function ba(e,t=!1){let n=t?1e3:1024,r=t?[`k`,`M`,`G`,`T`,`P`,`E`]:[`K`,`M`,`G`,`T`,`P`,`E`],i=t?`iB`:`B`;if(e<n)return`${e.toFixed(2)} ${i}`;let a=parseInt(Math.log(e)/Math.log(n)+``),o=parseInt(a-1+``);return`${(e/n**+a).toFixed(2)} ${r[o]}${i}`}function xa(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,`,`)}var Sa,Ca,wa=n((()=>{va(),Gn(),Vn(),Sa=class{name;duration;date;payload;msgs;lang;version;bytes;asyncRequests;min;max;constructor(e,t){this.name=e,this.duration=t,this.date=Date.now(),this.payload=0,this.msgs=0,this.bytes=0}toString(){let e=this.duration/1e3,t=Math.round(this.msgs/e),n=this.asyncRequests?`asyncRequests`:``,r=``;return this.max&&(r=`${this.min}/${this.max}`),`${this.name}${n?` [asyncRequests]`:``} ${xa(t)} msgs/sec - [${e.toFixed(2)} secs] ~ ${ya(this.bytes,e)} ${r}`}toCsv(){return`"${this.name}",${new Date(this.date).toISOString()},${this.lang},${this.version},${this.msgs},${this.payload},${this.bytes},${this.duration},${this.asyncRequests?this.asyncRequests:!1}\n`}static header(){return`Test,Date,Lang,Version,Count,MsgPayload,Bytes,Millis,Async
|
|
10
|
-
`}},Ca=class{nc;callbacks;msgs;size;subject;asyncRequests;pub;sub;req;rep;perf;payload;constructor(e,t={msgs:1e5,size:128,subject:``,asyncRequests:!1,pub:!1,sub:!1,req:!1,rep:!1}){if(this.nc=e,this.callbacks=t.callbacks||!1,this.msgs=t.msgs||0,this.size=t.size||0,this.subject=t.subject||Wn.nuid.next(),this.asyncRequests=t.asyncRequests||!1,this.pub=t.pub||!1,this.sub=t.sub||!1,this.req=t.req||!1,this.rep=t.rep||!1,this.perf=new In,this.payload=this.size?new Uint8Array(this.size):rn,!this.pub&&!this.sub&&!this.req&&!this.rep)throw Error(`no options selected`)}async run(){return this.nc.closed().then(e=>{if(e)throw e}),this.callbacks?await this.runCallbacks():await this.runAsync(),this.processMetrics()}processMetrics(){let{lang:e,version:t}=this.nc.protocol.transport;this.pub&&this.sub&&this.perf.measure(`pubsub`,`pubStart`,`subStop`),this.req&&this.rep&&this.perf.measure(`reqrep`,`reqStart`,`reqStop`);let n=this.perf.getEntries(),r=n.find(e=>e.name===`pubsub`),i=n.find(e=>e.name===`reqrep`),a=n.find(e=>e.name===`req`),o=n.find(e=>e.name===`rep`),s=n.find(e=>e.name===`pub`),c=n.find(e=>e.name===`sub`),l=this.nc.stats(),u=[];if(r){let{name:n,duration:i}=r,a=new Sa(n,i);a.msgs=this.msgs*2,a.bytes=l.inBytes+l.outBytes,a.lang=e,a.version=t,a.payload=this.payload.length,u.push(a)}if(i){let{name:n,duration:r}=i,a=new Sa(n,r);a.msgs=this.msgs*2,a.bytes=l.inBytes+l.outBytes,a.lang=e,a.version=t,a.payload=this.payload.length,u.push(a)}if(s){let{name:n,duration:r}=s,i=new Sa(n,r);i.msgs=this.msgs,i.bytes=l.outBytes,i.lang=e,i.version=t,i.payload=this.payload.length,u.push(i)}if(c){let{name:n,duration:r}=c,i=new Sa(n,r);i.msgs=this.msgs,i.bytes=l.inBytes,i.lang=e,i.version=t,i.payload=this.payload.length,u.push(i)}if(o){let{name:n,duration:r}=o,i=new Sa(n,r);i.msgs=this.msgs,i.bytes=l.inBytes+l.outBytes,i.lang=e,i.version=t,i.payload=this.payload.length,u.push(i)}if(a){let{name:n,duration:r}=a,i=new Sa(n,r);i.msgs=this.msgs,i.bytes=l.inBytes+l.outBytes,i.lang=e,i.version=t,i.payload=this.payload.length,u.push(i)}return u}async runCallbacks(){let e=[];if(this.sub){let t=On();e.push(t);let n=0;this.nc.subscribe(this.subject,{max:this.msgs,callback:()=>{n++,n===1&&this.perf.mark(`subStart`),n===this.msgs&&(this.perf.mark(`subStop`),this.perf.measure(`sub`,`subStart`,`subStop`),t.resolve())}})}if(this.rep){let t=On();e.push(t);let n=0;this.nc.subscribe(this.subject,{max:this.msgs,callback:(e,r)=>{r.respond(this.payload),n++,n===1&&this.perf.mark(`repStart`),n===this.msgs&&(this.perf.mark(`repStop`),this.perf.measure(`rep`,`repStart`,`repStop`),t.resolve())}})}if(this.pub){let t=(async()=>{this.perf.mark(`pubStart`);for(let e=0;e<this.msgs;e++)this.nc.publish(this.subject,this.payload);await this.nc.flush(),this.perf.mark(`pubStop`),this.perf.measure(`pub`,`pubStart`,`pubStop`)})();e.push(t)}if(this.req){let t=(async()=>{if(this.asyncRequests){this.perf.mark(`reqStart`);let e=[];for(let t=0;t<this.msgs;t++)e.push(this.nc.request(this.subject,this.payload,{timeout:2e4}));await Promise.all(e),this.perf.mark(`reqStop`),this.perf.measure(`req`,`reqStart`,`reqStop`)}else{this.perf.mark(`reqStart`);for(let e=0;e<this.msgs;e++)await this.nc.request(this.subject);this.perf.mark(`reqStop`),this.perf.measure(`req`,`reqStart`,`reqStop`)}})();e.push(t)}await Promise.all(e)}async runAsync(){let e=[];if(this.rep){let t=!1,n=this.nc.subscribe(this.subject,{max:this.msgs}),r=(async()=>{for await(let e of n)t||=(this.perf.mark(`repStart`),!0),e.respond(this.payload);await this.nc.flush(),this.perf.mark(`repStop`),this.perf.measure(`rep`,`repStart`,`repStop`)})();e.push(r)}if(this.sub){let t=!1,n=this.nc.subscribe(this.subject,{max:this.msgs}),r=(async()=>{for await(let e of n)t||=(this.perf.mark(`subStart`),!0);this.perf.mark(`subStop`),this.perf.measure(`sub`,`subStart`,`subStop`)})();e.push(r)}if(this.pub){let t=(async()=>{this.perf.mark(`pubStart`);for(let e=0;e<this.msgs;e++)this.nc.publish(this.subject,this.payload);await this.nc.flush(),this.perf.mark(`pubStop`),this.perf.measure(`pub`,`pubStart`,`pubStop`)})();e.push(t)}if(this.req){let t=(async()=>{if(this.asyncRequests){this.perf.mark(`reqStart`);let e=[];for(let t=0;t<this.msgs;t++)e.push(this.nc.request(this.subject,this.payload,{timeout:2e4}));await Promise.all(e),this.perf.mark(`reqStop`),this.perf.measure(`req`,`reqStart`,`reqStop`)}else{this.perf.mark(`reqStart`);for(let e=0;e<this.msgs;e++)await this.nc.request(this.subject);this.perf.mark(`reqStop`),this.perf.measure(`req`,`reqStart`,`reqStop`)}})();e.push(t)}await Promise.all(e)}}})),Ta,Ea=n((()=>{Ta=class{interval;maxOut;cancelAfter;timer;autoCancelTimer;last;missed;count;callback;constructor(e,t,n={maxOut:2}){this.interval=e,this.maxOut=n?.maxOut||2,this.cancelAfter=n?.cancelAfter||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=t,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(e,t=0,n=2){this.interval=e,this.maxOut=n,this.cancelAfter=t,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(e){console.log(e)}},this.interval)}}})),Da,Oa=n((()=>{Da=`3.4.0`}));function ka(e,t){/^(.*:\/\/)(.*)/.test(e)||(e=typeof t==`boolean`?`${t===!0?`https`:`http`}://${e}`:`https://${e}`);let n=new URL(e),r=n.protocol.toLowerCase();r===`ws:`&&(t=!1),r===`wss:`&&(t=!0),r!==`https:`&&r!==`http`&&(e=e.replace(/^(.*:\/\/)(.*)/gm,`$2`),n=new URL(`http://${e}`));let i,a,o=n.hostname,s=n.pathname,c=n.search||``;switch(r){case`http:`:case`ws:`:case`nats:`:a=n.port||`80`,i=`ws:`;break;case`https:`:case`wss:`:case`tls:`:a=n.port||`443`,i=`wss:`;break;default:a=n.port||t===!0?`443`:`80`,i=t===!0?`wss:`:`ws:`;break}return`${i}//${o}:${a}${s}${c}`}function Aa(e={}){return er({defaultPort:443,urlParseFn:ka,factory:()=>{if(e.tls)throw ln.format(`tls`,`is not configurable on w3c websocket connections`);return new Na}}),ha.connect(e)}var ja,Ma,Na,Pa=n((()=>{Vn(),dr(),Yi(),$n(),la(),_a(),Oa(),Sn(),ja=Da,Ma=`nats.ws`,Na=class{version;lang;closeError;connected;done;socket;options;socketClosed;encrypted;peeked;yields;signal;closedNotification;constructor(){this.version=ja,this.lang=Ma,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=On(),this.closedNotification=On()}async connect(e,t){let n=On();this.options=t;let r=e.src;if(t.wsFactory){let{socket:n,encrypted:r}=await t.wsFactory(e.src,t);this.socket=n,this.encrypted=r}else this.encrypted=r.indexOf(`wss://`)===0,this.socket=new WebSocket(r);return this.socket.binaryType=`arraybuffer`,this.socket.onopen=()=>{this.done&&this._closed(Error(`aborted`))},this.socket.onmessage=e=>{if(this.done)return;if(this.yields.push(new Uint8Array(e.data)),this.peeked){this.signal.resolve();return}let r=Qn.concat(...this.yields),i=or(r);if(i!==``){let e=$i.exec(i);if(!e){t.debug&&console.error(`!!!`,wn(r)),n.reject(Error(`unexpected response from server`));return}try{Wi(JSON.parse(e[1]),this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),n.resolve()}catch(e){n.reject(e);return}}},this.socket.onclose=e=>{let t;e.code>=4e3&&e.code<=4999?t=Error(e.reason||`close code ${e.code}`):!e.wasClean&&e.reason!==``&&(t=Error(e.reason)),this._closed(t),this._cleanup()},this.socket.onerror=e=>{if(this.done)return;let t=e,r=new xn.ConnectionError(t.message);n.reject(r),this._cleanup()},n}_cleanup(){this.socketClosed===!1&&(this.socketClosed=!0,this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.closedNotification.resolve(this.closeError))}disconnect(){this._closed(void 0,!0)}async _closed(e,t=!0){if(this.done){try{this.socket.close()}catch{}return}if(this.closeError=e,!e){let e=Date.now();for(;!this.socketClosed&&this.socket.bufferedAmount>0&&!(Date.now()-e>=3e3);)await En(100)}this.done=!0;try{this.socket.close()}catch{}return this._cleanup(),this.closedNotification}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.done)return;this.yields.length===0&&await this.signal;let e=this.yields;this.yields=[];for(let t=0;t<e.length;t++)this.options.debug&&console.info(`> ${wn(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=On())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.done)try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${wn(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${wn(e)}: ${t}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}discard(){this.socket?.close()}}})),Fa=i({AuthorizationError:()=>fn,Bench:()=>Ca,ClosedConnectionError:()=>pn,Connect:()=>ia,ConnectionError:()=>hn,DEFAULT_MAX_RECONNECT_ATTEMPTS:()=>10,DataBuffer:()=>Qn,DenoBuffer:()=>Yr,DrainingConnectionError:()=>mn,Empty:()=>rn,Feature:()=>mi,Features:()=>hi,Heartbeat:()=>Br,INFO:()=>$i,IdleHeartbeatMonitor:()=>Ta,InvalidArgumentError:()=>ln,InvalidOperationError:()=>un,InvalidSubjectError:()=>cn,Kind:()=>$r,MAX_SIZE:()=>Jr,Match:()=>Jn,Metric:()=>Sa,MsgHdrsImpl:()=>ci,MsgImpl:()=>ui,MuxSubscription:()=>Rr,NatsConnectionImpl:()=>ha,NoRespondersError:()=>yn,Nuid:()=>Wn.Nuid,Parser:()=>ri,PermissionViolationError:()=>bn,ProtocolError:()=>gn,ProtocolHandler:()=>ca,QueuedIteratorImpl:()=>Ir,RequestError:()=>_n,RequestOne:()=>fa,Servers:()=>Pr,SimpleMutex:()=>Ln,State:()=>J,SubscriptionImpl:()=>oa,Subscriptions:()=>sa,TD:()=>on,TE:()=>an,TimeoutError:()=>vn,UserAuthenticationExpiredError:()=>dn,backoff:()=>Mn,buildAuthenticator:()=>Hi,canonicalMIMEHeaderKey:()=>ai,checkOptions:()=>Wi,checkUnsupportedOption:()=>Gi,collect:()=>An,compare:()=>pi,createInbox:()=>qn,credsAuthenticator:()=>Ri,deadline:()=>Dn,defaultOptions:()=>Bi,deferred:()=>On,delay:()=>En,describe:()=>Zr,errors:()=>xn,extend:()=>Cn,extractProtocolMessage:()=>or,getResolveFn:()=>ir,hasWsProtocol:()=>Vi,headers:()=>oi,ipV4:()=>fr,isIP:()=>pr,isIPV4OrHostname:()=>kr,jwtAuthenticator:()=>Li,millis:()=>Pn,nanos:()=>Nn,nkeyAuthenticator:()=>Ii,nkeys:()=>Ai,nuid:()=>Wn.nuid,parseIP:()=>mr,parseOptions:()=>Ui,parseSemVer:()=>fi,protoLen:()=>ar,readAll:()=>Wr,render:()=>wn,setTransportFactory:()=>er,syncIterator:()=>Kn,timeout:()=>Tn,tokenAuthenticator:()=>Fi,usernamePasswordAuthenticator:()=>Pi,writeAll:()=>Gr,wsUrlParseFn:()=>ka,wsconnect:()=>Aa}),Ia=n((()=>{_a(),Gn(),di(),dr(),la(),Vn(),li(),Vr(),zr(),$n(),Yi(),pa(),zi(),ji(),Lr(),ii(),Xr(),wa(),sn(),Or(),gi(),va(),Zn(),Ea(),Fr(),Pa(),Sn()})),La=Symbol.for(`rpc.callbacks`),Ra=Symbol.for(`rpc.callbacks.oneway`);function za(e){return!!e&&typeof e==`object`&&e[La]===!0}function Ba(e){return e?.[Ra]??[]}function Va(e){if(e instanceof Promise)return!0;if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.then==`function`&&typeof t.catch==`function`}function Ha(e,t,n=[],r=null){let i=r,a=e=>{i??=new Set(e)},o=e=>{if(e instanceof Uint8Array||e instanceof ArrayBuffer)return e;if(e&&typeof e==`object`&&`__methods`in e){a(e.__methods);let{__methods:t,...n}=e;return Array.isArray(e)?Object.assign([...e],n):n}return e};return new Proxy({},{get(r,a){if(a===`then`||a===`catch`||a===`finally`)return;if(typeof a==`symbol`||a===`toString`)return()=>`[RPCProxy ${t}${n.length?`.`+n.join(`.`):``}]`;if(i&&n.length===0&&!i.has(a))return;let s=[...n,a];return new Proxy(function(){},{apply(n,r,i){let c=`rpc.${t}.${s.join(`.`)}`,l=a.toLowerCase().includes(`pull`),u=i.findIndex(e=>za(e));if(u!==-1){let t=i[u],n=Ba(t),r=i.filter((e,t)=>t!==u);return e.callPullIteratorWithCallback(c,t,n,...r)}let d=i.findIndex(e=>typeof e==`function`);if(d!==-1){let t=i[d],n=i.filter((e,t)=>t!==d);return e.callWithCallback(c,n,t)}return a.toLowerCase().includes(`generate`)?e.callStream(c,...i):l?e.callPullIterator(c,...i):(async()=>o(await e.call(c,...i)))()},get(n,r){if(r===`then`||r===`catch`||r===`finally`){let n=s.join(`.`),i=(async()=>(!e.isConnected&&!e.isClosed&&await e.connect(),o(await e.call(`rpc.${t}.${n}`))))();return i[r].bind(i)}return Ha(e,t,s,i)[r]}})}})}function Ua(e,t,n,r=[]){return new Proxy({},{get(i,a){if(a===`then`||a===`catch`||a===`finally`)return;if(typeof a==`symbol`||a===`toString`)return()=>`[ServiceProxy ${t.name}${r.length?`.`+r.join(`.`):``}]`;if(a in i)return i[a];let o=[...r,a],s=o.join(`.`),c=t.endpoints.find(e=>{if(e.subject===s)return!0;let t=e.subject.split(`.`);return t[t.length-1]===a&&t.slice(0,-1).join(`.`)===r.join(`.`)});if(c)return new Proxy(function(){},{apply(t,n,r){let i=a.toLowerCase().includes(`pull`),o=r.findIndex(e=>za(e));if(o!==-1){let t=r[o],n=Ba(t),i=r.filter((e,t)=>t!==o);return e.callPullIteratorWithCallback(c.subject,t,n,...i)}let s=r.findIndex(e=>typeof e==`function`);if(s!==-1){let t=r[s],n=r.filter((e,t)=>t!==s);return e.callWithCallback(c.subject,n,t)}return a.toLowerCase().includes(`generate`)?e.callStream(c.subject,...r):i?e.callPullIterator(c.subject,...r):e.call(c.subject,...r)}});let l=s+`.`;if(t.endpoints.some(e=>e.subject.startsWith(l)))return Ua(e,t,n,o)}})}function Wa(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function Ga(e){return new Promise(t=>setTimeout(t,e))}var Ka=class{client;channelId;closed=!1;unsubscribe;initialized=!1;handlers=new Map;closeHandlers=new Set;errorHandlers=new Set;subscriptions=[];get isClosed(){return this.closed}get id(){return this.channelId}constructor(e,t){this.client=e,this.channelId=t}async init(){if(this.initialized)return;this.initialized=!0;let e=`channel.${this.channelId}`;this.unsubscribe=await this.client.subscribe(e,async e=>{switch(e.type){case`message`:this.emit(`message`,e.data);break;case`close`:this.handleClose();break;case`error`:this.handleError(Error(e.error??`Channel error`));break}})}async send(e){if(this.closed)throw Error(`Channel is closed`);let t={type:`message`,data:e};await this.client.publish(`channel.${this.channelId}`,t)}async request(e,t=5e3){if(this.closed)throw Error(`Channel is closed`);let n=`channel.${this.channelId}.request`;return this.client.request(n,e,{timeout:t})}async onRequest(e){let t=`channel.${this.channelId}.request`,n=this.client.onRequest(t,e);return this.subscriptions.push(n),n}on(e,t){e===`close`?this.closeHandlers.add(t):e===`error`?this.errorHandlers.add(t):(this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t))}off(e,t){e===`close`?this.closeHandlers.delete(t):e===`error`?this.errorHandlers.delete(t):this.handlers.get(e)?.delete(t)}async close(){if(!this.closed){this.closed=!0;try{await this.client.publish(`channel.${this.channelId}`,{type:`close`})}catch{}await this.cleanup()}}handlerChain=Promise.resolve();runHandler(e,t,n){let r;try{r=e(t)}catch(e){console.error(`Error in ${n}:`,e);return}if(Va(r)){let e=r;this.handlerChain=this.handlerChain.then(()=>e).catch(e=>console.error(`Error in ${n}:`,e))}}emit(e,t){let n=this.handlers.get(e);if(n)for(let e of n)this.runHandler(e,t,`channel handler`)}handleClose(){if(!this.closed){this.closed=!0;for(let e of this.closeHandlers)this.runHandler(()=>e(),void 0,`close handler`);this.cleanup().catch(console.error)}}handleError(e){for(let t of this.errorHandlers)this.runHandler(t,e,`error handler`)}async cleanup(){if(this.handlers.clear(),this.closeHandlers.clear(),this.errorHandlers.clear(),await Promise.allSettled(this.subscriptions.map(e=>e)),this.unsubscribe){try{this.unsubscribe()}catch{}this.unsubscribe=void 0}let e=this._isolatedClient;if(e)try{await e.disconnect()}catch{}}},qa=class extends Ka{targetClientId;clientId;remoteClientId;get remoteId(){return this.remoteClientId}constructor(e,t,n){super(e,t),this.targetClientId=n;let r=e.options.name??`client-${Date.now()}`;this.clientId=r.replace(/-(channel|private)-.*$/,``)}async init(){if(this.initialized)return;this.initialized=!0;let e=[this.clientId,this.targetClientId].sort(),t=`channel.private.${this.channelId}.${e.join(`.`)}`;this.unsubscribe=await this.client.subscribe(t,async e=>{if(e.sender!==this.clientId&&e.sender===this.targetClientId&&(!this.remoteClientId&&e.sender&&(this.remoteClientId=e.sender),!(this.remoteClientId&&e.sender!==this.remoteClientId)))switch(e.type){case`message`:if(e.data&&typeof e.data==`object`&&`__handshake`in e.data)return;this.emit(`message`,e.data);break;case`close`:this.handleClose();break;case`error`:this.handleError(Error(e.error??`Channel error`));break}});try{await this.sendRaw({type:`message`,data:{__handshake:!0},sender:this.clientId})}catch{}}async send(e){if(this.closed)throw Error(`Channel is closed`);await this.sendRaw({type:`message`,data:e,sender:this.clientId})}async request(e,t=5e3){if(this.closed)throw Error(`Channel is closed`);let n=[this.clientId,this.targetClientId].sort(),r=`channel.private.${this.channelId}.${n.join(`.`)}.request`;return this.client.request(r,e,{timeout:t})}async onRequest(e){let t=[this.clientId,this.targetClientId].sort(),n=`channel.private.${this.channelId}.${t.join(`.`)}.request`;return this.client.onRequest(n,e)}async close(){if(!this.closed){this.closed=!0;try{await this.sendRaw({type:`close`,sender:this.clientId})}catch{}await this.cleanup()}}isConnectedTo(e){return this.remoteClientId===e}async sendRaw(e){let t=[this.clientId,this.targetClientId].sort(),n=`channel.private.${this.channelId}.${t.join(`.`)}`;await this.client.publish(n,e)}},Ja;try{Ja=new TextDecoder}catch{}var X,Ya,Z=0,Xa=[],Za=Xa,Qa=0,$a={},eo,to,no=0,ro=0,io,ao,oo=[],so,co={useRecords:!1,mapsAsObjects:!0},lo=class{},uo=new lo;uo.name=`MessagePack 0xC1`;var fo=!1,po=2,mo=class e{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||=0)),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType=`number`)),Object.assign(this,e)}unpack(t,n){if(X)return Uo(()=>(Wo(),this?this.unpack(t,n):e.prototype.unpack.call(co,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<`u`?Buffer.from(t):new Uint8Array(t)),typeof n==`object`?(Ya=n.end||t.length,Z=n.start||0):(Z=0,Ya=n>-1?n:t.length),Qa=0,ro=0,to=null,Za=Xa,io=null,X=t;try{so=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw X=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if($a=this,this.structures)return eo=this.structures,ho(n);(!eo||eo.length>0)&&(eo=[])}else $a=co,(!eo||eo.length>0)&&(eo=[]);return ho(n)}unpackMultiple(e,t){let n,r=0;try{fo=!0;let i=e.length,a=this?this.unpack(e,i):Ko.unpack(e,i);if(t){if(t(a,r,Z)===!1)return;for(;Z<i;)if(r=Z,t(ho(),r,Z)===!1)return}else{for(n=[a];Z<i;)r=Z,n.push(ho());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{fo=!1,Wo()}}_mergeStructures(e,t){this._onLoadedStructures&&(e=this._onLoadedStructures(e)),e||=[],Object.isFrozen(e)&&(e=e.map(e=>e.slice(0)));for(let t=0,n=e.length;t<n;t++){let n=e[t];n&&(n.isShared=!0,t>=32&&(n.highByte=t-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||=[])[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function ho(e){try{if(!$a.trusted&&!fo){let e=eo.sharedLength||0;e<eo.length&&(eo.length=e)}let t;if($a._readStruct&&X[Z]<64&&X[Z]>=32?(t=$a._readStruct(X,Z,Ya),X=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Z=Ya):t=_o(),io&&=(Z=io.postBundlePosition,null),fo&&(eo.restoreStructures=null),Z==Ya)eo&&eo.restoreStructures&&go(),eo=null,X=null,ao&&=null;else if(Z>Ya)throw Error(`Unexpected end of MessagePack data`);else if(!fo){let e;try{e=JSON.stringify(t,(e,t)=>typeof t==`bigint`?`${t}n`:t).slice(0,100)}catch(t){e=`(JSON view not available `+t+`)`}throw Error(`Data read, but end of buffer not reached `+e)}return t}catch(e){throw eo&&eo.restoreStructures&&go(),Wo(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`)||Z>Ya)&&(e.incomplete=!0),e}}function go(){for(let e in eo.restoreStructures)eo[e]=eo.restoreStructures[e];eo.restoreStructures=null}function _o(){let e=X[Z++];if(e<160)if(e<128){if(e<64)return e;{let t=eo[e&63]||$a.getStructures&&xo()[e&63];return t?(t.read||=yo(t,e&63),t.read()):e}}else if(e<144)if(e-=128,$a.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Io();e===`__proto__`&&(e=`__proto_`),t[e]=_o()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(_o(),_o());return t}else{e-=144;let t=Array(e);for(let n=0;n<e;n++)t[n]=_o();return $a.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(ro>=Z)return to.slice(Z-no,(Z+=t)-no);if(ro==0&&Ya<140){let e=t<16?jo(t):Ao(t);if(e!=null)return e}return So(t)}else{let t;switch(e){case 192:return null;case 193:return io?(t=_o(),t>0?io[1].slice(io.position1,io.position1+=t):io[0].slice(io.position0,io.position0-=t)):uo;case 194:return!1;case 195:return!0;case 196:if(t=X[Z++],t===void 0)throw Error(`Unexpected end of buffer`);return No(t);case 197:return t=so.getUint16(Z),Z+=2,No(t);case 198:return t=so.getUint32(Z),Z+=4,No(t);case 199:return Po(X[Z++]);case 200:return t=so.getUint16(Z),Z+=2,Po(t);case 201:return t=so.getUint32(Z),Z+=4,Po(t);case 202:if(t=so.getFloat32(Z),$a.useFloat32>2){let e=Go[(X[Z]&127)<<1|X[Z+1]>>7];return Z+=4,(e*t+(t>0?.5:-.5)>>0)/e}return Z+=4,t;case 203:return t=so.getFloat64(Z),Z+=8,t;case 204:return X[Z++];case 205:return t=so.getUint16(Z),Z+=2,t;case 206:return t=so.getUint32(Z),Z+=4,t;case 207:return $a.int64AsType===`number`?(t=so.getUint32(Z)*4294967296,t+=so.getUint32(Z+4)):$a.int64AsType===`string`?t=so.getBigUint64(Z).toString():$a.int64AsType===`auto`?(t=so.getBigUint64(Z),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=so.getBigUint64(Z),Z+=8,t;case 208:return so.getInt8(Z++);case 209:return t=so.getInt16(Z),Z+=2,t;case 210:return t=so.getInt32(Z),Z+=4,t;case 211:return $a.int64AsType===`number`?(t=so.getInt32(Z)*4294967296,t+=so.getUint32(Z+4)):$a.int64AsType===`string`?t=so.getBigInt64(Z).toString():$a.int64AsType===`auto`?(t=so.getBigInt64(Z),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=so.getBigInt64(Z),Z+=8,t;case 212:if(t=X[Z++],t==114)return Ro(X[Z++]&63);{let e=oo[t];if(e)return e.read?(Z++,e.read(_o())):e.noBuffer?(Z++,e()):e(X.subarray(Z,++Z));throw Error(`Unknown extension `+t)}case 213:return t=X[Z],t==114?(Z++,Ro(X[Z++]&63,X[Z++])):Po(2);case 214:return Po(4);case 215:return Po(8);case 216:return Po(16);case 217:return t=X[Z++],ro>=Z?to.slice(Z-no,(Z+=t)-no):Co(t);case 218:return t=so.getUint16(Z),Z+=2,ro>=Z?to.slice(Z-no,(Z+=t)-no):wo(t);case 219:return t=so.getUint32(Z),Z+=4,ro>=Z?to.slice(Z-no,(Z+=t)-no):To(t);case 220:return t=so.getUint16(Z),Z+=2,Do(t);case 221:return t=so.getUint32(Z),Z+=4,Do(t);case 222:return t=so.getUint16(Z),Z+=2,Oo(t);case 223:return t=so.getUint32(Z),Z+=4,Oo(t);default:if(e>=224)return e-256;if(e===void 0){let e=Error(`Unexpected end of MessagePack data`);throw e.incomplete=!0,e}throw Error(`Unknown MessagePack token `+e)}}}var vo=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function yo(e,t){function n(){if(n.count++>po){let r;try{r=e.read=Function(`r`,`return function(){return `+($a.freezeData?`Object.freeze`:``)+`({`+e.map(e=>e===`__proto__`?`__proto_:r()`:vo.test(e)?e+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`})}`)(_o)}catch{return po=1/0,n()}return e.read0=r,e.highByte===0&&(e.read=bo(t,e.read)),r()}let r={};for(let t=0,n=e.length;t<n;t++){let n=e[t];n===`__proto__`&&(n=`__proto_`),r[n]=_o()}return $a.freezeData?Object.freeze(r):r}return n.count=0,e.read0=n,e.highByte===0?bo(t,n):n}var bo=(e,t)=>function(){let n=X[Z++];if(n===0)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),i=eo[r]||xo()[r];if(!i)throw Error(`Record id is not defined for `+r);return i.read||=yo(i,e),i.read()};function xo(){let e=Uo(()=>(X=null,$a.getStructures()));return eo=$a._mergeStructures(e,eo)}var So=Eo,Co=Eo,wo=Eo,To=Eo;function Eo(e){let t;if(e<16&&(t=jo(e)))return t;if(e>64&&Ja)return Ja.decode(X.subarray(Z,Z+=e));let n=Z+e,r=[];for(t=``;Z<n;){let e=X[Z++];if(!(e&128))r.push(e);else if((e&224)==192){let t=X[Z++]&63,n=(e&31)<<6|t;n<128?r.push(65533):r.push(n)}else if((e&240)==224){let t=X[Z++]&63,n=X[Z++]&63,i=(e&31)<<12|t<<6|n;i<2048||i>=55296&&i<=57343?r.push(65533):r.push(i)}else if((e&248)==240){let t=X[Z++]&63,n=X[Z++]&63,i=X[Z++]&63,a=(e&7)<<18|t<<12|n<<6|i;a<65536||a>1114111?r.push(65533):a>65535?(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023,r.push(a)):r.push(a)}else r.push(65533);r.length>=4096&&(t+=ko.apply(String,r),r.length=0)}return r.length>0&&(t+=ko.apply(String,r)),t}function Do(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=_o();return $a.freezeData?Object.freeze(t):t}function Oo(e){if($a.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=Io();e===`__proto__`&&(e=`__proto_`),t[e]=_o()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(_o(),_o());return t}}var ko=String.fromCharCode;function Ao(e){let t=Z,n=Array(e);for(let r=0;r<e;r++){let e=X[Z++];if((e&128)>0){Z=t;return}n[r]=e}return ko.apply(String,n)}function jo(e){if(e<4)if(e<2){if(e===0)return``;{let e=X[Z++];if((e&128)>1){--Z;return}return ko(e)}}else{let t=X[Z++],n=X[Z++];if((t&128)>0||(n&128)>0){Z-=2;return}if(e<3)return ko(t,n);let r=X[Z++];if((r&128)>0){Z-=3;return}return ko(t,n,r)}else{let t=X[Z++],n=X[Z++],r=X[Z++],i=X[Z++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){Z-=4;return}if(e<6){if(e===4)return ko(t,n,r,i);{let e=X[Z++];if((e&128)>0){Z-=5;return}return ko(t,n,r,i,e)}}else if(e<8){let a=X[Z++],o=X[Z++];if((a&128)>0||(o&128)>0){Z-=6;return}if(e<7)return ko(t,n,r,i,a,o);let s=X[Z++];if((s&128)>0){Z-=7;return}return ko(t,n,r,i,a,o,s)}else{let a=X[Z++],o=X[Z++],s=X[Z++],c=X[Z++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){Z-=8;return}if(e<10){if(e===8)return ko(t,n,r,i,a,o,s,c);{let e=X[Z++];if((e&128)>0){Z-=9;return}return ko(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=X[Z++],u=X[Z++];if((l&128)>0||(u&128)>0){Z-=10;return}if(e<11)return ko(t,n,r,i,a,o,s,c,l,u);let d=X[Z++];if((d&128)>0){Z-=11;return}return ko(t,n,r,i,a,o,s,c,l,u,d)}else{let l=X[Z++],u=X[Z++],d=X[Z++],f=X[Z++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){Z-=12;return}if(e<14){if(e===12)return ko(t,n,r,i,a,o,s,c,l,u,d,f);{let e=X[Z++];if((e&128)>0){Z-=13;return}return ko(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=X[Z++],m=X[Z++];if((p&128)>0||(m&128)>0){Z-=14;return}if(e<15)return ko(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=X[Z++];if((h&128)>0){Z-=15;return}return ko(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function Mo(){let e=X[Z++],t;if(e<192)t=e-160;else switch(e){case 217:t=X[Z++];break;case 218:t=so.getUint16(Z),Z+=2;break;case 219:t=so.getUint32(Z),Z+=4;break;default:throw Error(`Expected string`)}return Eo(t)}function No(e){return $a.copyBuffers?Uint8Array.prototype.slice.call(X,Z,Z+=e):X.subarray(Z,Z+=e)}function Po(e){let t=X[Z++];if(oo[t]){let n;return oo[t](X.subarray(Z,n=Z+=e),e=>{Z=e;try{return _o()}finally{Z=n}})}else throw Error(`Unknown extension type `+t)}var Fo=Array(4096);function Io(){let e=X[Z++];if(e>=160&&e<192){if(e-=160,ro>=Z)return to.slice(Z-no,(Z+=e)-no);if(!(ro==0&&Ya<180))return So(e)}else return Z--,Lo(_o());let t=(e<<5^(e>1?so.getUint16(Z):e>0?X[Z]:0))&4095,n=Fo[t],r=Z,i=Z+e-3,a,o=0;if(n&&n.bytes==e){for(;r<i;){if(a=so.getUint32(r),a!=n[o++]){r=1879048192;break}r+=4}for(i+=3;r<i;)if(a=X[r++],a!=n[o++]){r=1879048192;break}if(r===i)return Z=r,n.string;i-=3,r=Z}for(n=[],Fo[t]=n,n.bytes=e;r<i;)a=so.getUint32(r),n.push(a),r+=4;for(i+=3;r<i;)a=X[r++],n.push(a);let s=e<16?jo(e):Ao(e);return s==null?n.string=So(e):n.string=s}function Lo(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;if($a.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(e=>[`string`,`number`,`boolean`,`bigint`].includes(typeof e)))return e.flat().toString();throw Error(`Invalid property type for record: ${typeof e}`)}var Ro=(e,t)=>{let n=_o().map(Lo),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=eo[e];return i&&(i.isShared||fo)&&((eo.restoreStructures||=[])[e]=i),eo[e]=n,n.read=yo(n,r),(n.read0||n.read)()};oo[0]=()=>{},oo[0].noBuffer=!0,oo[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=BigInt(8),n+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=(e,t)=>{let n=t-e;if(n<=40){let n=r.getBigUint64(e);for(let i=e+8;i<t;i+=8)n<<=BigInt(64),n|=r.getBigUint64(i);return n}let a=e+(n>>4<<3),o=i(e,a),s=i(a,t);return o<<BigInt((t-a)*8)|s};n=n<<BigInt((r.byteLength-t)*8)|i(t,r.byteLength)}return n};var zo={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==`function`?AggregateError:null};oo[101]=()=>{let e=_o();if(!zo[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return zo[e[0]](e[1],{cause:e[2]})},oo[105]=e=>{if($a.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=so.getUint32(Z-4);ao||=new Map;let n=X[Z],r;r=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&X[Z+1]===115?new Set:{};let i={target:r};ao.set(t,i);let a=_o();if(i.used)Object.assign(r,a);else return i.target=a;if(r instanceof Map)for(let[e,t]of a.entries())r.set(e,t);if(r instanceof Set)for(let e of Array.from(a))r.add(e);return r},oo[112]=e=>{if($a.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=so.getUint32(Z-4),n=ao.get(t);return n.used=!0,n.target},oo[115]=()=>new Set(_o());var Bo=[`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`,`BigInt64`,`BigUint64`].map(e=>e+`Array`),Vo=typeof globalThis==`object`?globalThis:window;oo[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,r=Bo[t];if(!r){if(t===16)return n;if(t===17)return new DataView(n);throw Error(`Could not find typed array for code `+t)}return new Vo[r](n)},oo[120]=()=>{let e=_o();return new RegExp(e[0],e[1])};var Ho=[];oo[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=Z;return Z+=t-e.length,io=Ho,io=[Mo(),Mo()],io.position0=0,io.position1=0,io.postBundlePosition=Z,Z=n,_o()},oo[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date(`invalid`);function Uo(e){$a&&$a._onSaveState&&$a._onSaveState();let t=Ya,n=Z,r=Qa,i=no,a=ro,o=to,s=Za,c=ao,l=io,u=new Uint8Array(X.slice(0,Ya)),d=eo,f=eo.slice(0,eo.length),p=$a,m=fo,h=e();return Ya=t,Z=n,Qa=r,no=i,ro=a,to=o,Za=s,ao=c,io=l,X=u,fo=m,eo=d,eo.splice(0,eo.length,...f),$a=p,so=new DataView(X.buffer,X.byteOffset,X.byteLength),h}function Wo(){X=null,ao=null,eo=null}var Go=Array(147);for(let e=0;e<256;e++)Go[e]=+(`1e`+Math.floor(45.15-e*.30103));var Ko=new mo({useRecords:!1});Ko.unpack,Ko.unpackMultiple,Ko.unpack;var qo={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};new Uint8Array(new Float32Array(1).buffer,0,4),mo.SUPPORTS_STRUCT_HOOKS=!0;var Jo;try{Jo=new TextEncoder}catch{}var Yo,Xo,Zo=typeof Buffer<`u`,Qo=Zo?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,$o=Zo?Buffer:Uint8Array,es=Zo?4294967296:2144337920,Q,ts,ns,$=0,rs,is=null,as=21760,os=/[\u0080-\uFFFF]/,ss=Symbol(`record-id`),cs=class extends mo{constructor(e){super(e),this.offset=0;let t,n,r,i,a=$o.prototype.utf8Write?function(e,t){return Q.utf8Write(e,t,Q.byteLength-t)}:Jo&&Jo.encodeInto?function(e,t){return Jo.encodeInto(e,Q.subarray(t)).written}:!1,o=this;e||={};let s=e&&e.sequential,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?32:0,l>8160)throw Error(`Maximum maxSharedStructure is 8160`);e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let u=e.maxOwnStructures;u??=c?32:64,!this.structures&&e.useRecords!=0&&(this.structures=[]);let d=l>32||u+l>64,f=l+64,p=l+u+64;if(p>8256)throw Error(`Maximum maxSharedStructure + maxOwnStructure is 8192`);let m=[],h=0,g=0;this.pack=this.encode=function(e,a){if(Q||(Q=new Qo(8192),ns=Q.dataView||=new DataView(Q.buffer,0,8192),$=0),rs=Q.length-10,rs-$<2048?(Q=new Qo(Q.length),ns=Q.dataView||=new DataView(Q.buffer,0,Q.length),rs=Q.length-10,$=0):$=$+7&2147483640,t=$,a&2048&&($+=a&255),i=o.structuredClone?new Map:null,o.bundleStrings&&typeof e!=`string`?(is=[],is.size=1/0):is=null,r=o.structures,r){r.uninitialized&&(r=o._mergeStructures(o.getStructures()));let e=r.sharedLength||0;if(e>l)throw Error(`Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to `+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||=i[r]=Object.create(null),i=n}i[ss]=t+64}this.lastNamedStructuresLength=e}s||(r.nextId=e+64)}n&&=!1;let c;try{o._writeStruct&&e&&typeof e==`object`?e.constructor===Object?w(e):e.constructor!==Map&&!Array.isArray(e)&&!Xo.some(t=>e instanceof t)?w(e.toJSON?e.toJSON():e):y(e):y(e);let n=is;if(is&&ps(t,y,0),i&&i.idsToInsert){let e=i.idsToInsert.sort((e,t)=>e.offset>t.offset?1:-1),r=e.length,a=-1;for(;n&&r>0;){let i=e[--r].offset+t;i<n.stringsPosition+t&&a===-1&&(a=0),i>n.position+t?a>=0&&(a+=6):(a>=0&&(ns.setUint32(n.position+t,ns.getUint32(n.position+t)+a),a=-1),n=n.previous,r++)}a>=0&&n&&ns.setUint32(n.position+t,ns.getUint32(n.position+t)+a),$+=e.length*6,$>rs&&T($),o.offset=$;let s=fs(Q.subarray(t,$),e);return i=null,s}return o.offset=$,a&512?(Q.start=t,Q.end=$,Q):Q.subarray(t,$)}catch(e){throw c=e,e}finally{if(r&&(_(),n&&o.saveStructures)){let n=r.sharedLength||0,i=Q.subarray(t,$),s=(o._prepareStructures||ms)(r,o);if(!c)return o.saveStructures(s,s.isCompatible)===!1?(r.uninitialized=!0,o.pack(e,a)):(o.lastNamedStructuresLength=n,Q.length>1073741824&&(Q=null),i)}Q.length>1073741824&&(Q=null),a&1024&&($=t)}};let _=()=>{g<10&&g++;let e=r.sharedLength||0;if(r.length>e&&!s&&(r.length=e),h>1e4)r.transitions=null,g=0,h=0,m.length>0&&(m=[]);else if(m.length>0&&!s){for(let e=0,t=m.length;e<t;e++)m[e][ss]=0;m=[]}},v=e=>{var t=e.length;t<16?Q[$++]=144|t:t<65536?(Q[$++]=220,Q[$++]=t>>8,Q[$++]=t&255):(Q[$++]=221,ns.setUint32($,t),$+=4);for(let n=0;n<t;n++)y(e[n])},y=e=>{$>rs&&(Q=T($));var n=typeof e,r;if(n===`string`){let n=e.length;if(is&&n>=4&&n<4096){if((is.size+=n)>as){let e,n=(is[0]?is[0].length*3+is[1].length:0)+10;$+n>rs&&(Q=T($+n));let r;is.position?(r=is,Q[$]=200,$+=3,Q[$++]=98,e=$-t,$+=4,ps(t,y,0),ns.setUint16(e+t-3,$-t-e)):(Q[$++]=214,Q[$++]=98,e=$-t,$+=4),is=[``,``],is.previous=r,is.size=0,is.position=e}let r=os.test(e);is[+!r]+=e,Q[$++]=193,y(r?-n:n);return}let i;i=n<32?1:n<256?2:n<65536?3:5;let o=n*3;if($+o>rs&&(Q=T($+o)),n<64||!a){let t,a,o,s=$+i;for(t=0;t<n;t++)a=e.charCodeAt(t),a<128?Q[s++]=a:a<2048?(Q[s++]=a>>6|192,Q[s++]=a&63|128):(a&64512)==55296&&((o=e.charCodeAt(t+1))&64512)==56320?(a=65536+((a&1023)<<10)+(o&1023),t++,Q[s++]=a>>18|240,Q[s++]=a>>12&63|128,Q[s++]=a>>6&63|128,Q[s++]=a&63|128):(Q[s++]=a>>12|224,Q[s++]=a>>6&63|128,Q[s++]=a&63|128);r=s-$-i}else r=a(e,$+i);r<32?Q[$++]=160|r:r<256?(i<2&&Q.copyWithin($+2,$+1,$+1+r),Q[$++]=217,Q[$++]=r):r<65536?(i<3&&Q.copyWithin($+3,$+2,$+2+r),Q[$++]=218,Q[$++]=r>>8,Q[$++]=r&255):(i<5&&Q.copyWithin($+5,$+3,$+3+r),Q[$++]=219,ns.setUint32($,r),$+=4),$+=r}else if(n===`number`)if(e>>>0===e)e<32||e<128&&this.useRecords===!1||e<64&&!this._writeStruct?Q[$++]=e:e<256?(Q[$++]=204,Q[$++]=e):e<65536?(Q[$++]=205,Q[$++]=e>>8,Q[$++]=e&255):(Q[$++]=206,ns.setUint32($,e),$+=4);else if(e>>0===e)e>=-32?Q[$++]=256+e:e>=-128?(Q[$++]=208,Q[$++]=e+256):e>=-32768?(Q[$++]=209,ns.setInt16($,e),$+=2):(Q[$++]=210,ns.setInt32($,e),$+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){Q[$++]=202,ns.setFloat32($,e);let n;if(t<4||(n=e*Go[(Q[$]&127)<<1|Q[$+1]>>7])>>0===n){$+=4;return}else $--}Q[$++]=203,ns.setFloat64($,e),$+=8}else if(n===`object`||n===`function`)if(!e)Q[$++]=192;else{if(i){let n=i.get(e);if(n){n.id||=(i.idsToInsert||=[]).push(n),Q[$++]=214,Q[$++]=112,ns.setUint32($,n.id),$+=4;return}else i.set(e,{offset:$-t})}let a=e.constructor;if(a===Object)C(e);else if(a===Array)v(e);else if(a===Map)if(this.mapAsEmptyObject)Q[$++]=128;else{r=e.size,r<16?Q[$++]=128|r:r<65536?(Q[$++]=222,Q[$++]=r>>8,Q[$++]=r&255):(Q[$++]=223,ns.setUint32($,r),$+=4);for(let[t,n]of e)y(t),y(n)}else{for(let t=0,n=Yo.length;t<n;t++){let n=Xo[t];if(e instanceof n){let n=Yo[t];if(n.write){n.type&&(Q[$++]=212,Q[$++]=n.type,Q[$++]=0);let t=n.write.call(this,e);t===e?Array.isArray(e)?v(e):C(e):y(t);return}let r=Q,i=ns,a=$;Q=null;let o;try{o=n.pack.call(this,e,e=>(Q=r,r=null,$+=e,$>rs&&T($),{target:Q,targetView:ns,position:$-e}),y)}finally{r&&(Q=r,ns=i,$=a,rs=Q.length-10)}o&&(o.length+$>rs&&T(o.length+$),$=ds(o,Q,$,n.type));return}}if(Array.isArray(e))v(e);else{if(e.toJSON){let t=e.toJSON();if(t!==e)return y(t)}if(n===`function`)return y(this.writeFunction&&this.writeFunction(e));C(e)}}}else if(n===`boolean`)Q[$++]=e?195:194;else if(n===`bigint`){if(e<0x8000000000000000&&e>=-0x8000000000000000)Q[$++]=211,ns.setBigInt64($,e);else if(e<0x10000000000000000&&e>0)Q[$++]=207,ns.setBigUint64($,e);else if(this.largeBigIntToFloat)Q[$++]=203,ns.setFloat64($,Number(e));else if(this.largeBigIntToString)return y(e.toString());else if(this.useBigIntExtension||this.moreTypes){let t=BigInt(e<0?-1:0),n;if(e>>BigInt(65536)===t){let r=BigInt(0x10000000000000000)-BigInt(1),i=[];for(;i.push(e&r),e>>BigInt(63)!==t;)e>>=BigInt(64);n=new Uint8Array(new BigUint64Array(i).buffer),n.reverse()}else{let t=e<0,r=(t?~e:e).toString(16);if(r.length%2?r=`0`+r:parseInt(r.charAt(0),16)>=8&&(r=`00`+r),Zo)n=Buffer.from(r,`hex`);else{n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(r.slice(e*2,e*2+2),16)}if(t)for(let e=0;e<n.length;e++)n[e]=~n[e]}n.length+$>rs&&T(n.length+$),$=ds(n,Q,$,66);return}else throw RangeError(e+` was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string`);$+=8}else if(n===`undefined`)this.encodeUndefinedAsNil?Q[$++]=192:(Q[$++]=212,Q[$++]=0,Q[$++]=0);else throw Error(`Unknown type: `+n)},b=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?e=>{let t;if(this.skipValues){t=[];for(let n in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(n))&&!this.skipValues.includes(e[n])&&t.push(n)}else t=Object.keys(e);let n=t.length;n<16?Q[$++]=128|n:n<65536?(Q[$++]=222,Q[$++]=n>>8,Q[$++]=n&255):(Q[$++]=223,ns.setUint32($,n),$+=4);let r;if(this.coercibleKeyAsNumber)for(let i=0;i<n;i++){r=t[i];let n=Number(r);y(isNaN(n)?r:n),y(e[r])}else for(let i=0;i<n;i++)y(r=t[i]),y(e[r])}:e=>{Q[$++]=222;let n=$-t;$+=2;let r=0;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(y(t),y(e[t]),r++);if(r>65535)throw Error(`Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object`);Q[n+++t]=r>>8,Q[n+t]=r&255},x=this.useRecords===!1?b:e.progressiveRecords&&!d?e=>{let n,i=r.transitions||=Object.create(null),a=$++-t,o;for(let s in e)if(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(s)){if(n=i[s],n)i=n;else{let c=Object.keys(e),l=i;i=r.transitions;let u=0;for(let e=0,t=c.length;e<t;e++){let t=c[e];n=i[t],n||(n=i[t]=Object.create(null),u++),i=n}a+t+1==$?($--,E(i,c,u)):D(i,c,a,u),o=!0,i=l[s]}y(e[s])}if(!o){let n=i[ss];n?Q[a+t]=n:D(i,Object.keys(e),a,0)}}:e=>{let t,n=r.transitions||=Object.create(null),i=0;for(let r in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(r))&&(t=n[r],t||(t=n[r]=Object.create(null),i++),n=t);let a=n[ss];a?a>=96&&d?(Q[$++]=((a-=96)&31)+96,Q[$++]=a>>5):Q[$++]=a:E(n,n.__keys__||Object.keys(e),i);for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&y(e[t])},S=typeof this.useRecords==`function`&&this.useRecords,C=S?e=>{S(e)?x(e):b(e)}:x,w=e=>{let i=o._writeStruct(e,Q,t,$,r,T,(e,t,r)=>{if(r)return n=!0;$=t;let i=Q;return y(e),_(),i===Q?$:{position:$,targetView:ns,target:Q}});if(i===0)return C(e);$=i},T=e=>{let n;if(e>16777216){if(e-t>es)throw Error(`Packed buffer would be larger than maximum buffer size`);n=Math.min(es,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,Q.length-1)>>12)+1<<12;let r=new Qo(n);return ns=r.dataView||=new DataView(r.buffer,0,n),e=Math.min(e,Q.length),Q.copy?Q.copy(r,0,t,e):r.set(Q.slice(t,e)),$-=t,t=0,rs=r.length-10,Q=r},E=(e,t,i)=>{let a=r.nextId;a||=64,a<f&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(a=r.nextOwnId,a<p||(a=f),r.nextOwnId=a+1):(a>=p&&(a=f),r.nextId=a+1);let o=t.highByte=a>=96&&d?a-96>>5:-1;e[ss]=a,e.__keys__=t,r[a-64]=t,a<f?(t.isShared=!0,r.sharedLength=a-63,n=!0,o>=0?(Q[$++]=(a&31)+96,Q[$++]=o):Q[$++]=a):(o>=0?(Q[$++]=213,Q[$++]=114,Q[$++]=(a&31)+96,Q[$++]=o):(Q[$++]=212,Q[$++]=114,Q[$++]=a),i&&(h+=g*i),m.length>=u&&(m.shift()[ss]=0),m.push(e),y(t))},D=(e,n,r,i)=>{let a=Q,o=$,s=rs,c=t;Q=ts,$=0,t=0,Q||(ts=Q=new Qo(8192)),rs=Q.length-10,E(e,n,i),ts=Q;let l=$;if(Q=a,$=o,rs=s,t=c,l>1){let e=$+l-1;e>rs&&T(e);let n=r+t;Q.copyWithin(n+l,n+1,$),Q.set(ts.slice(0,l),n),$=e}else Q[r+t]=ts[0]}}useBuffer(e){Q=e,Q.dataView||=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),ns=Q.dataView,$=0}set position(e){$=e}get position(){return $}clearSharedData(){this.structures&&=[],this.typedStructs&&=[]}};Xo=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,lo],Yo=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:n,targetView:i,position:a}=t(10);n[a++]=215,n[a++]=255,i.setUint32(a,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:e,targetView:r,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:n,targetView:i,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,i.setUint32(a,e.getMilliseconds()*1e6),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(r)}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=101,r[i++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=120,r[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?ls(e,16,t):us(Zo?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==$o&&this.moreTypes?ls(e,Bo.indexOf(n.name),t):us(e,t)}},{pack(e,t){this.moreTypes?ls(e,17,t):us(Zo?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];function ls(e,t,n,r){let i=e.byteLength;if(i+1<256){var{target:a,position:o}=n(4+i);a[o++]=199,a[o++]=i+1}else if(i+1<65536){var{target:a,position:o}=n(5+i);a[o++]=200,a[o++]=i+1>>8,a[o++]=i+1&255}else{var{target:a,position:o,targetView:s}=n(7+i);a[o++]=201,s.setUint32(o,i+1),o+=4}a[o++]=116,a[o++]=t,e.buffer||(e=new Uint8Array(e)),a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function us(e,t){let n=e.byteLength;var r,i;if(n<256){var{target:r,position:i}=t(n+2);r[i++]=196,r[i++]=n}else if(n<65536){var{target:r,position:i}=t(n+3);r[i++]=197,r[i++]=n>>8,r[i++]=n&255}else{var{target:r,position:i,targetView:a}=t(n+5);r[i++]=198,a.setUint32(i,n),i+=4}r.set(e,i)}function ds(e,t,n,r){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=i&255):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=i&255)}return t[n++]=r,t.set(e,n),n+=i,n}function fs(e,t){let n,r=t.length*6,i=e.length-r;for(;n=t.pop();){let t=n.offset,a=n.id;e.copyWithin(t+r,t,i),r-=6;let o=t+r;e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=a&255,i=t}return e}function ps(e,t,n){if(is.length>0){ns.setUint32(is.position+e,$+n-is.position-e),is.stringsPosition=$-e;let r=is;is=null,t(r[0]),t(r[1])}}function ms(e,t){return e.isCompatible=e=>{let n=!e||(t.lastNamedStructuresLength||0)===e.length;return n||t._mergeStructures(e),n},e}cs.SUPPORTS_STRUCT_HOOKS=!0;var hs=new cs({useRecords:!1});hs.pack,hs.pack;var{NEVER:gs,ALWAYS:_s,DECIMAL_ROUND:vs,DECIMAL_FIT:ys}=qo,bs=new cs({useRecords:!1,bundleStrings:!1,int64AsType:`number`}),xs=new mo({useRecords:!1,bundleStrings:!1,int64AsType:`number`});function Ss(e){return bs.pack(e)}function Cs(e){return xs.unpack(e)}function*ws(e,t,n){let r=e.length,i=Math.ceil(r/n);for(let a=0;a<i;a++){let o=a*n,s=Math.min(o+n,r),c=e.subarray(o,s);yield{id:t,chunkIndex:a,data:c,isLast:a===i-1}}}var Ts=class{id;buffer;receivedChunks=new Set;totalChunks=0;chunkSize=0;constructor(e,t,n,r){this.id=e,this.totalChunks=n,this.chunkSize=r??Math.ceil(t/n),this.buffer=new Uint8Array(t)}addChunk(e){if(e.id!==this.id)throw Error(`Chunk ID mismatch: expected ${this.id}, got ${e.id}`);let t=e.chunkIndex*this.chunkSize;return this.buffer.set(e.data,t),this.receivedChunks.add(e.chunkIndex),this.isComplete()}isComplete(){return this.receivedChunks.size===this.totalChunks}getData(){if(!this.isComplete())throw Error(`Not all chunks received`);return Cs(this.buffer)}getProgress(){let e=this.receivedChunks.size,t=this.totalChunks;return{received:e,total:t,percentage:t>0?e/t*100:0}}},Es=class{assemblers=new Map;completedCallbacks=new Map;errorCallbacks=new Map;startReceiving(e,t,n,r,i,a){let o=new Ts(e,i,t,a);this.assemblers.set(e,o),this.completedCallbacks.set(e,n),this.errorCallbacks.set(e,r)}processChunk(e){let t=this.assemblers.get(e.id);if(!t){console.warn(`Received chunk for unknown transfer: ${e.id}`);return}try{if(t.addChunk(e)){let n=t.getData(),r=this.completedCallbacks.get(e.id);this.assemblers.delete(e.id),this.completedCallbacks.delete(e.id),this.errorCallbacks.delete(e.id),r&&r(n)}}catch(t){let n=this.errorCallbacks.get(e.id);this.assemblers.delete(e.id),this.completedCallbacks.delete(e.id),this.errorCallbacks.delete(e.id),n&&n(t)}}cancel(e){let t=this.errorCallbacks.get(e);this.assemblers.delete(e),this.completedCallbacks.delete(e),this.errorCallbacks.delete(e),t&&t(Error(`Transfer cancelled`))}getProgress(e){let t=this.assemblers.get(e);return t?t.getProgress():null}};M();var Ds=Symbol(`rpc:methods`),Os=Symbol(`rpc:nested`),ks=Symbol(`rpc:exposeAll`);function As(e,t=[],n={},r=new WeakSet){if(!e||typeof e!=`object`||r.has(e))return n;r.add(e);let i=Object.getOwnPropertyNames(e),a=[],o=Object.getPrototypeOf(e);for(;o&&o!==Object.prototype;)a.push(...Object.getOwnPropertyNames(o)),o=Object.getPrototypeOf(o);let s=[...new Set([...i,...a])];for(let r of s)if(!(r===`constructor`||r.startsWith(`_`)||r.startsWith(`#`)))try{if(e.constructor&&Object.prototype.hasOwnProperty.call(e.constructor,r))continue;let i=Object.getOwnPropertyDescriptor(e,r);if(!i){let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype&&!i;)i=Object.getOwnPropertyDescriptor(t,r),t=Object.getPrototypeOf(t)}if(i&&(i.get||i.set)&&!i.value){let i=e[r];if(typeof i==`function`){let a=[...t,r].join(`.`);n[a]=i.bind(e)}continue}let a=e[r],o=[...t,r].join(`.`);typeof a==`function`&&(n[o]=a.bind(e))}catch{}return n}function js(e,t=[],n={},r=new WeakSet){if(r.has(e))return n;r.add(e);let i=e.constructor===Object||e.constructor===void 0,a=Object.getPrototypeOf(e),o=Reflect.hasMetadata(Ds,e)||Reflect.hasMetadata(Ds,a)||Reflect.hasMetadata(Os,e)||Reflect.hasMetadata(Os,a)||Reflect.hasMetadata(ks,a);if(i&&!o){let i=Object.getOwnPropertyNames(e);for(let a of i)if(!(a===`constructor`||a.startsWith(`_`)))try{let i=e[a],o=[...t,a].join(`.`);typeof i==`function`?n[o]=i.bind(e):typeof i==`object`&&i&&!Array.isArray(i)?js(i,[...t,a],n,r):n[o]=async()=>i}catch{}}else{let i=a&&Reflect.getMetadata(ks,a),o=[...Reflect.getMetadata(Ds,e)??[],...(a&&Reflect.getMetadata(Ds,a))??[]],s=[...Reflect.getMetadata(Os,e)??[],...(a&&Reflect.getMetadata(Os,a))??[]],c=Object.getOwnPropertyNames(e);a&&c.push(...Object.getOwnPropertyNames(a).filter(e=>e!==`constructor`));for(let l of c)if(l!==`constructor`)try{let c=e[l]??a?.[l];if(!c)continue;let u=[...t,l].join(`.`);typeof c==`function`?(i&&!l.startsWith(`_`)||o.includes(l))&&(n[u]=c.bind(e)):o.includes(l)?n[u]=async()=>e[l]:typeof c==`object`&&c&&s.includes(l)&&js(c,[...t,l],n,r)}catch{}}return n}var Ms=class e extends Error{code;data;constructor(e,t,n){super(t),this.name=`RPCException`,this.code=e,this.data=n}static fromJSON(t){return new e(t.code,t.message,t.data)}toJSON(){return{code:this.code,message:this.message,data:this.data}}};function Ns(e,t,n){return new Ms(e,t,n)}var Ps={METHOD_NOT_FOUND:`METHOD_NOT_FOUND`,INVALID_PARAMS:`INVALID_PARAMS`,INTERNAL_ERROR:`INTERNAL_ERROR`,TIMEOUT:`TIMEOUT`,CONNECTION_CLOSED:`CONNECTION_CLOSED`,STREAM_ERROR:`STREAM_ERROR`,PAYLOAD_TOO_LARGE:`PAYLOAD_TOO_LARGE`,NOT_FOUND:`NOT_FOUND`};async function Fs(e,t,n,r,i){let a,o=e(...t);if(o&&typeof o.then==`function`){let e=await o;if(e&&typeof e[Symbol.asyncIterator]==`function`)a=e;else if(e&&typeof e[Symbol.iterator]==`function`)a=(async function*(){for(let t of e)yield t})();else throw Ns(Ps.INTERNAL_ERROR,`Handler must return a generator for stream`)}else if(o&&typeof o[Symbol.asyncIterator]==`function`)a=o;else if(o&&typeof o[Symbol.iterator]==`function`)a=(async function*(){for(let e of o)yield e})();else throw Ns(Ps.INTERNAL_ERROR,`Handler must return a generator for stream`);let s=!1,c=await i.subscribe(`${n}.cancel`,()=>{s=!0});await Ga(0);try{for await(let e of a){if(s||!i.isConnected)break;let t={id:r,type:`data`,data:e};await i.publish(n,t)}if(!s&&i.isConnected){let e={id:r,type:`end`};await i.publish(n,e)}}catch(e){if(!s&&i.isConnected)try{let t={id:r,type:`error`,error:Ls(e)};await i.publish(n,t)}catch{}}finally{if(c(),a.return)try{await a.return()}catch{}}}async function Is(e,t){return e(...Array.isArray(t)?t:t==null?[]:[t])}function Ls(e){return e instanceof Ms?e.toJSON():{code:Ps.INTERNAL_ERROR,message:e instanceof Error?e.message:`Internal error`}}async function Rs(e,t,n,r){let i,a=e(...t);if(a&&typeof a.then==`function`){let e=await a;if(e&&typeof e[Symbol.asyncIterator]==`function`)i=e;else if(e&&typeof e[Symbol.iterator]==`function`)i=(async function*(){for(let t of e)yield t})();else throw Ns(Ps.INTERNAL_ERROR,`Handler must return a generator for pull iterator`)}else if(a&&typeof a[Symbol.asyncIterator]==`function`)i=a;else if(a&&typeof a[Symbol.iterator]==`function`)i=(async function*(){for(let e of a)yield e})();else throw Ns(Ps.INTERNAL_ERROR,`Handler must return a generator for pull iterator`);let o=`_rpc.iterator.${n}.request`,s=`_rpc.iterator.${n}.response`,c=!0,l=await r.subscribe(o,async e=>{if(c)try{if(e.type===`cancel`){c=!1,i.return&&await i.return();let e={id:n,type:`done`};await r.publish(s,e)}else if(e.type===`next`){let{value:e,done:t}=await i.next();if(t){c=!1;let e={id:n,type:`done`};await r.publish(s,e)}else{let t={id:n,type:`value`,value:e};await r.publish(s,t)}}}catch(e){c=!1;let t={id:n,type:`error`,error:Ls(e)};await r.publish(s,t)}});return async()=>{if(c=!1,l(),i.return)try{await i.return()}catch{}}}async function zs(e,t,n,r,i,a,o){let s=new Set(a),c={},l=!0;for(let e of i)s.has(e)?c[e]=(...t)=>{if(!l||!o.isConnected)return;let n={method:e,args:t};o.publish(r,n).catch(()=>{})}:c[e]=()=>{throw Ns(Ps.INTERNAL_ERROR,`Request-reply callback '${e}' not supported in v1`)};let u,d=e(...t,c),f=e=>{if(e&&typeof e[Symbol.asyncIterator]==`function`)return e;if(e&&typeof e[Symbol.iterator]==`function`)return(async function*(){for(let t of e)yield t})();throw Ns(Ps.INTERNAL_ERROR,`Handler must return a generator for pull-callback iterator`)};u=d&&typeof d.then==`function`?f(await d):f(d);let p=`_rpc.iterator.${n}.request`,m=`_rpc.iterator.${n}.response`,h=!0,g=await o.subscribe(p,async e=>{if(h)try{if(e.type===`cancel`){h=!1,l=!1,u.return&&await u.return();let e={id:n,type:`done`};await o.publish(m,e)}else if(e.type===`next`){let{done:e}=await u.next();if(e){h=!1,l=!1;let e={id:n,type:`done`};await o.publish(m,e)}else{let e={id:n,type:`value`};await o.publish(m,e)}}}catch(e){h=!1,l=!1;let t={id:n,type:`error`,error:Ls(e)};await o.publish(m,t)}});return async()=>{if(h=!1,l=!1,g(),u.return)try{await u.return()}catch{}}}async function Bs(e,t,n,r,i){let a=async e=>{if(!i.isConnected)return;let t={id:r,type:`data`,data:e};await i.publish(n,t)},o;try{let n=e(...t,a);n&&typeof n.then==`function`?o=await n:typeof n==`function`&&(o=n)}catch(e){let t={id:r,type:`error`,error:Ls(e)};throw await i.publish(n,t),e}let s=await i.subscribe(`${n}.cancel`,async()=>{o&&await o()});return async()=>{s(),o&&await o()}}var Vs=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceVerb=e.ServiceError=e.ServiceErrorCodeHeader=e.ServiceErrorHeader=e.ServiceResponseType=void 0,e.ServiceResponseType={STATS:`io.nats.micro.v1.stats_response`,INFO:`io.nats.micro.v1.info_response`,PING:`io.nats.micro.v1.ping_response`},e.ServiceErrorHeader=`Nats-Service-Error`,e.ServiceErrorCodeHeader=`Nats-Service-Error-Code`,e.ServiceError=class t extends Error{code;constructor(e,t){super(t),this.code=e}static isServiceError(e){return t.toServiceError(e)!==null}static toServiceError(n){let r=n?.headers?.get(e.ServiceErrorCodeHeader)||``;if(r!==``){let i=parseInt(r)||400,a=n?.headers?.get(e.ServiceErrorHeader)||``;return new t(i,a.length?a:r)}return null}},e.ServiceVerb={PING:`PING`,STATS:`STATS`,INFO:`INFO`}})),Hs=a((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceImpl=t.ServiceGroupImpl=t.ServiceMsgImpl=t.ServiceApiPrefix=void 0;var n=(Ia(),e(Fa)),r=Vs();function i(e,t=``){if(t===``)throw Error(`${e} name required`);let n=a(t);if(n.length)throw Error(`invalid ${e} name - ${e} name ${n}`)}function a(e=``){if(!e)throw Error(`name required`);let t=/^[-\w]+$/g;if(e.match(t)===null){for(let n of e.split(``))if(n.match(t)===null)return`cannot contain '${n}'`}return``}t.ServiceApiPrefix=`$SRV`;var o=class{msg;constructor(e){this.msg=e}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||``}get headers(){return this.msg.headers}respond(e,t){return this.msg.respond(e,t)}respondError(e,t,i,a){return a||={},a.headers=a.headers||(0,n.headers)(),a.headers?.set(r.ServiceErrorCodeHeader,`${e}`),a.headers?.set(r.ServiceErrorHeader,t),this.msg.respond(i,a)}json(e){return this.msg.json(e)}string(){return this.msg.string()}};t.ServiceMsgImpl=o;var s=class e{subject;queue;srv;constructor(t,n=``,r=``){n!==``&&l(`service group`,n);let i=``;if(t instanceof u)this.srv=t,i=``;else if(t instanceof e){let e=t;this.srv=e.srv,r===void 0&&(r=e.queue),i=e.subject}else throw Error(`unknown ServiceGroup type`);this.subject=this.calcSubject(i,n),this.queue=r}calcSubject(e,t=``){return t===``?e:e===``?t:`${e}.${t}`}addEndpoint(e=``,t){t||={subject:e};let n=typeof t==`function`?{handler:t,subject:e}:t;i(`endpoint`,e);let{subject:r,handler:a,metadata:o,queue:s}=n;r||=e,s||=this.queue,c(`endpoint subject`,r),r=this.calcSubject(this.subject,r);let l={name:e,subject:r,queue:s,handler:a,metadata:o};return this.srv._addEndpoint(l)}addGroup(t=``,n){return n===void 0&&(n=this.queue),new e(this,t,n)}};t.ServiceGroupImpl=s;function c(e,t){if(t===``)throw Error(`${e} cannot be empty`);if(t.indexOf(` `)!==-1)throw Error(`${e} cannot contain spaces: '${t}'`);let n=t.split(`.`);n.forEach((r,i)=>{if(r===`>`&&i!==n.length-1)throw Error(`${e} cannot have internal '>': '${t}'`)})}function l(e,t){if(t.indexOf(` `)!==-1)throw Error(`${e} cannot contain spaces: '${t}'`);t.split(`.`).forEach(n=>{if(n===`>`)throw Error(`${e} name cannot contain internal '>': '${t}'`)})}var u=class e{nc;_id;config;handlers;internal;_stopped;_done;started;closeListener;static controlSubject(e,n=``,r=``,a){let o=a??t.ServiceApiPrefix;return n===``&&r===``?`${o}.${e}`:(i(`control subject name`,n),r===``?`${o}.${e}.${n}`:(i(`control subject id`,r),`${o}.${e}.${n}.${r}`))}constructor(e,t={name:``,version:``}){this.nc=e,this.config=Object.assign({},t),this.config.queue===void 0&&(this.config.queue=`q`),t.metadata=Object.freeze(t.metadata||{}),i(`name`,this.config.name),this.config.queue&&i(`queue`,this.config.queue),(0,n.parseSemVer)(this.config.version),this._id=n.nuid.next(),this.internal=[],this._done=(0,n.deferred)(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.closeListener={connectionClosedCallback:e=>{this.close(e).catch()}},this.nc.addCloseListener(this.closeListener)}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??``}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(e){let t=(0,n.headers)();if(e instanceof r.ServiceError){let n=e;t.set(r.ServiceErrorHeader,n.message),t.set(r.ServiceErrorCodeHeader,`${n.code}`)}else t.set(r.ServiceErrorHeader,e.message),t.set(r.ServiceErrorCodeHeader,`500`);return t}setupHandler(e,t=!1){let r=t?``:e.queue?e.queue:this.config.queue,{name:i,subject:a,handler:s}=e,c=e;c.internal=t,t&&this.internal.push(c),c.stats=new d(i,a,r),c.queue=r;let l=s?(e,t)=>{if(e){this.close(e);return}let r=Date.now();try{s(e,new o(t))}catch(e){c.stats.countError(e),t?.respond(n.Empty,{headers:this.errorToHeader(e)})}finally{c.stats.countLatency(r)}}:void 0;return c.sub=this.nc.subscribe(a,{callback:l,queue:r}),c.sub.closed.then(()=>{this._stopped||this.close(Error(`required subscription ${e.subject} stopped`)).catch()}).catch(t=>{if(!this._stopped){let n=Error(`required subscription ${e.subject} errored: ${t.message}`);n.stack=t.stack,this.close(n).catch()}}),c}info(){return{type:r.ServiceResponseType.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{let{subject:t,metadata:n,name:r,queue:i}=e;return{subject:t,metadata:n,name:r,queue_group:i}})}async stats(){let e=[];for(let t of this.handlers){if(typeof this.config.statsHandler==`function`)try{t.stats.data=await this.config.statsHandler(t)}catch(e){t.stats.countError(e)}e.push(t.stats.stats(t.qi))}return{type:r.ServiceResponseType.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,t){let n=`${e}`.toUpperCase();this._doAddInternalHandler(`${n}-all`,e,t),this._doAddInternalHandler(`${n}-kind`,e,t,this.name),this._doAddInternalHandler(`${n}`,e,t,this.name,this.id)}_doAddInternalHandler(t,n,r,i=``,a=``){let o={};o.name=t,o.subject=e.controlSubject(n,i,a),o.handler=r,this.setupHandler(o,!0)}start(){let e=(e,t)=>e?(this.close(e),Promise.reject(e)):this.stats().then(e=>(t?.respond(JSON.stringify(e)),Promise.resolve())),t=(e,t)=>e?(this.close(e),Promise.reject(e)):(t?.respond(JSON.stringify(this.info())),Promise.resolve()),n=JSON.stringify(this.ping());return this.addInternalHandler(r.ServiceVerb.PING,(e,t)=>e?(this.close(e).then().catch(),Promise.reject(e)):(t.respond(n),Promise.resolve())),this.addInternalHandler(r.ServiceVerb.STATS,e),this.addInternalHandler(r.ServiceVerb.INFO,t),this.handlers.forEach(e=>{let{subject:t}=e;typeof t==`string`&&e.handler!==null&&this.setupHandler(e)}),Promise.resolve(this)}close(e){if(this._stopped)return this._done;this._stopped=!0,this.nc.removeCloseListener(this.closeListener);let t=[];return this.nc.isClosed()||(t=this.handlers.concat(this.internal).map(e=>e.sub.drain())),Promise.allSettled(t).then(()=>{this._done.resolve(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:r.ServiceResponseType.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(let e of this.handlers)e.stats.reset(e.qi)}addGroup(e,t){return new s(this,e,t)}addEndpoint(e,t){return new s(this).addEndpoint(e,t)}_addEndpoint(e){let t=new n.QueuedIteratorImpl;t.profile=!0,t.noIterator=typeof e.handler==`function`,t.noIterator||(e.handler=(e,n)=>{e?this.stop(e).catch():t.push(new o(n))},t.iterClosed.then(()=>{this.close().catch()}));let r=this.setupHandler(e,!1);return r.sub.closed.then(e=>{e?this.stop(e):t.stop()}),r.qi=t,this.handlers.push(r),t}};t.ServiceImpl=u;var d=class{name;subject;average_processing_time;num_requests;processing_time;num_errors;last_error;data;metadata;queue;constructor(e,t,n=``){this.name=e,this.subject=t,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=n}reset(e){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;let t=e;t&&(t.time=0,t.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=(0,n.nanos)(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){let{name:e,subject:t,average_processing_time:n,num_errors:r,num_requests:i,processing_time:a,last_error:o,data:s,queue:c}=this;return{name:e,subject:t,average_processing_time:n,num_errors:r,num_requests:i,processing_time:a,last_error:o,data:s,queue_group:c}}stats(e){let t=e;return t?.noIterator===!1&&(this.processing_time=(0,n.nanos)(t.time),this.num_requests=t.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}})),Us=a((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ServiceClientImpl=void 0;var n=(Ia(),e(Fa)),r=Hs(),i=Vs();t.ServiceClientImpl=class{nc;prefix;opts;constructor(e,t={strategy:`stall`,maxWait:2e3},n){this.nc=e,this.prefix=n,this.opts=t}ping(e=``,t=``){return this.q(i.ServiceVerb.PING,e,t)}stats(e=``,t=``){return this.q(i.ServiceVerb.STATS,e,t)}info(e=``,t=``){return this.q(i.ServiceVerb.INFO,e,t)}async q(e,t=``,i=``){let a=new n.QueuedIteratorImpl,o=r.ServiceImpl.controlSubject(e,t,i,this.prefix),s=await this.nc.requestMany(o,n.Empty,this.opts);return(async()=>{for await(let e of s)try{let t=e.json();a.push(t)}catch(e){a.push(()=>{a.stop(e)})}a.push(()=>{a.stop()})})().catch(e=>{a.stop(e)}),a}}})),Ws=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Svcm=e.ServiceVerb=e.ServiceResponseType=e.ServiceErrorHeader=e.ServiceErrorCodeHeader=e.ServiceError=void 0;var t=Hs(),n=Us(),r=Vs();Object.defineProperty(e,"ServiceError",{enumerable:!0,get:function(){return r.ServiceError}}),Object.defineProperty(e,"ServiceErrorCodeHeader",{enumerable:!0,get:function(){return r.ServiceErrorCodeHeader}}),Object.defineProperty(e,"ServiceErrorHeader",{enumerable:!0,get:function(){return r.ServiceErrorHeader}}),Object.defineProperty(e,"ServiceResponseType",{enumerable:!0,get:function(){return r.ServiceResponseType}}),Object.defineProperty(e,"ServiceVerb",{enumerable:!0,get:function(){return r.ServiceVerb}}),e.Svcm=class{nc;constructor(e){this.nc=e}add(e){try{return new t.ServiceImpl(this.nc,e).start()}catch(e){return Promise.reject(e)}}client(e,t){return new n.ServiceClientImpl(this.nc,e,t)}}})),Gs=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Svcm=e.ServiceVerb=e.ServiceResponseType=e.ServiceErrorHeader=e.ServiceErrorCodeHeader=e.ServiceError=void 0;var t=Ws();Object.defineProperty(e,"ServiceError",{enumerable:!0,get:function(){return t.ServiceError}}),Object.defineProperty(e,"ServiceErrorCodeHeader",{enumerable:!0,get:function(){return t.ServiceErrorCodeHeader}}),Object.defineProperty(e,"ServiceErrorHeader",{enumerable:!0,get:function(){return t.ServiceErrorHeader}}),Object.defineProperty(e,"ServiceResponseType",{enumerable:!0,get:function(){return t.ServiceResponseType}}),Object.defineProperty(e,"ServiceVerb",{enumerable:!0,get:function(){return t.ServiceVerb}}),Object.defineProperty(e,"Svcm",{enumerable:!0,get:function(){return t.Svcm}})}))(),Ks=class{client;svc;services=[];initialized=!1;constructor(e){this.client=e}init(e){this.initialized||(this.initialized=!0,this.svc=new Gs.Svcm(e),this.services=[])}async registerHandler(e,t,n){if(!this.svc)throw Error(`RPCService is not initialized. Call init() first.`);let r=new Map,i=this.client,a=this.svc;n?.isolatedConnection&&(i=this.client.createIsolatedClient({...this.client.options,name:`${this.client.options.name}-service-${e.name}`}),a=new Gs.Svcm(await i.connect()));let o=await a.add(e);this.services.push(o),n?.isolatedConnection&&(o._isolatedClient=i);let s=js(t),c=new Map;for(let[e,t]of Object.entries(s)){let n=e.split(`.`),a=n.pop(),s=o;if(n.length>0){let e=n.join(`.`);if(!c.has(e)){let t=o;for(let e of n)t=t.addGroup(e);c.set(e,t)}s=c.get(e)}s.addEndpoint(a,async(e,n)=>{if(e){n.respondError(500,e.message);return}try{let e=n.headers?.get(`x-chunked-transfer`);if(e===`header`){let e=Cs(n.data),t=n.headers?.get(`x-chunk-id`);if(!t||e.transferId!==t){console.error(`Invalid chunk header`);return}i.chunkingManager.startReceiving(e.transferId,e.totalChunks,async e=>{await o(e,n)},e=>{console.error(`Error assembling chunks for ${a}:`,e)},e.totalSize,e.chunkSize)}else if(e===`chunk`){let e=n.headers?.get(`x-chunk-id`),t=parseInt(n.headers?.get(`x-chunk-index`)??`0`);if(!e){console.error(`Chunk missing chunk ID`);return}i.chunkingManager.processChunk({id:e,chunkIndex:t,data:n.data,isLast:!1})}else await o(Cs(n.data),n)}catch(e){console.error(`Error processing message for ${a}:`,e)}async function o(e,n){let a={id:e.id};try{if(e.params?.__stream&&e.params?.__streamSubject){let n=e.params.__streamSubject;await Fs(t,e.params.args??[],n,e.id,i)}else if(e.params?.__pullIterator||Array.isArray(e.params)&&e.params[0]?.__pullIterator){let o=e.params?.__pullIterator?e.params:e.params[0],s=o.args??[],c=o.__iteratorId??e.id,l=await Rs(t,s,c,i);r.set(c,l),a.result={iteratorId:c};let u=`${n.subject}.reply.${e.id}`;await i.publish(u,a)}else{a.result=await Is(t,e.params);let r=`${n.subject}.reply.${e.id}`;await i.publish(r,a)}}catch(t){a.error=Ls(t);try{let t=`${n.subject}.reply.${e.id}`;await i.publish(t,a)}catch(e){if(i.isClosed)return;console.error(`Failed to send error response:`,e)}}}})}let l=o;l._pullIteratorCleanups=r;let u=o.stop.bind(o);return o.stop=async e=>(await Promise.allSettled(Array.from(r.values()).map(e=>e())),r.clear(),u(e)),new qs(o)}monitor(){if(!this.svc)throw Error(`RPCService is not initialized. Call init() first.`);return this.svc.client({strategy:`stall`,stall:10,maxWait:2e3})}async stopAll(){await Promise.allSettled(this.services.map(async e=>{await e.stop();let t=e._isolatedClient;t&&await t.disconnect()})),this.services=[]}async stop(e){let t=this.services.find(t=>t.info().name===e);if(t)try{await t.stop();let e=t._isolatedClient;e&&await e.disconnect(),this.services=this.services.filter(e=>e!==t)}catch{}}getAllInfo(){return this.services.map(e=>e.info())}getInfo(e){return this.services.find(t=>t.info().name===e)?.info()}async getAllStats(){return Promise.all(this.services.map(e=>e.stats()))}async getStats(e){return this.services.find(t=>t.info().name===e)?.stats()}},qs=class{natsService;get isStopped(){return this.natsService.isStopped}constructor(e){this.natsService=e}info(){return this.natsService.info()}stats(){return this.natsService.stats()}async stop(e){try{await this.natsService.stop(e)}catch{}}};Pa(),Zn(),Sn(),li();function Js(e){return new Ys(e)}var Ys=class e{options;service=new Ks(this);chunkingManager=new Es;pullIteratorCleanups=new Map;callbackCleanups=new Map;nc;subscriptions=new Map;_subscriptionMeta=new Map;_maxPayloadSize=1024*1024;connectionPromise;closed=!1;isolatedClients=[];pendingRequests=new Map;streamHandlers=new Map;get isConnected(){return this.nc?.isClosed()===!1}get isClosed(){return this.closed}get maxPayloadSize(){return this._maxPayloadSize}status(){return this.nc?.status()}async flush(e=5e3){if(!this.nc)throw Ns(Ps.CONNECTION_CLOSED,`Not connected`);let t;try{await Promise.race([this.nc.flush(),new Promise((n,r)=>{t=setTimeout(()=>r(Ns(Ps.TIMEOUT,`flush() timed out after ${e}ms`)),e)})])}finally{t&&clearTimeout(t)}}constructor(e){this.options=e}createIsolatedClient(t){return new e(t)}async connect(e){if(e?.signal?.aborted)throw new DOMException(`Aborted`,`AbortError`);if(this.nc&&!this.nc.isClosed())return this.nc;let t={servers:this.options.servers,user:this.options.auth?.user,pass:this.options.auth?.password,name:this.options.name,reconnect:this.options.reconnect??!0,maxPingOut:this.options.maxPingOut??2,maxReconnectAttempts:this.options.maxReconnectAttempts??-1,reconnectTimeWait:this.options.reconnectTimeWait??2e3,reconnectJitter:this.options.reconnectJitter??100,reconnectJitterTLS:this.options.reconnectJitterTLS??1e3,ignoreAuthErrorAbort:this.options.ignoreAuthErrorAbort??!1,pingInterval:this.options.pingInterval??12e4,pingTimeout:this.options.pingTimeout??0,reconnectionDelayMax:this.options.reconnectionDelayMax??0,reconnectionRandomizationFactor:this.options.reconnectionRandomizationFactor??0,tls:this.options.tls,debug:this.options.debug??!1,noAsyncTraces:!0,waitOnFirstConnect:this.options.waitOnFirstConnect??!0,signal:e?.signal};this.connectionPromise??=Aa(t);let n=this.connectionPromise;try{this.nc=await Xs(n,e?.signal)}finally{this.connectionPromise=void 0}this.service.init(this.nc);try{let e=this.nc.info;this._maxPayloadSize=e?.max_payload??this.options.maxPayloadSize??1024*1024}catch{this._maxPayloadSize=this.options.maxPayloadSize??1024*1024}if(this._maxPayloadSize-=8192,this._subscriptionMeta.size>0){let e=[...this._subscriptionMeta.values()];this._subscriptionMeta.clear();for(let t of e)await this.subscribe(t.pattern,t.handler,t.options)}return this.nc}async disconnect(){this.closed=!0;for(let[,e]of this.pendingRequests)e.timeout&&clearTimeout(e.timeout),e.reject(Ns(Ps.CONNECTION_CLOSED,`Connection closed`));this.pendingRequests.clear();for(let[,e]of this.streamHandlers)try{e.end()}catch{}this.streamHandlers.clear(),await Promise.allSettled(Array.from(this.pullIteratorCleanups.values()).map(e=>e())),this.pullIteratorCleanups.clear(),await Promise.allSettled(Array.from(this.callbackCleanups.values()).map(e=>e())),this.callbackCleanups.clear();for(let e of this.subscriptions.values())for(let t of e)try{t.unsubscribe()}catch{}if(this.subscriptions.clear(),this._subscriptionMeta.clear(),this.chunkingManager=new Es,await Promise.allSettled(this.isolatedClients.map(e=>e.disconnect())),this.nc){try{await this.nc.close()}catch{}try{let e=this.options.disconnectTimeout??2e3;await Promise.race([this.nc.closed(),new Promise(t=>setTimeout(t,e))])}catch{}this.nc=void 0}}reconfigure(e){if(this.nc&&!this.nc.isClosed())throw Error(`Cannot reconfigure while connected. Call suspend() first.`);e.servers!==void 0&&(this.options.servers=e.servers),e.auth!==void 0&&(this.options.auth=e.auth);for(let t of this.isolatedClients)t.reconfigure(e)}setServers(e){this.options.servers=e,this.nc&&!this.nc.isClosed()&&this.nc.setServers(e);for(let t of this.isolatedClients)t.setServers(e)}async forceReconnect(){let e=this.nc;if(!(!e||e.isClosed())){try{typeof e.forceReconnect==`function`?await e.forceReconnect():typeof e.reconnect==`function`&&await e.reconnect()}catch{}await Promise.allSettled(this.isolatedClients.map(e=>e.forceReconnect()))}}abortClose(e){this.closed=!0;for(let[,e]of this.pendingRequests)e.timeout&&clearTimeout(e.timeout),e.reject(Ns(Ps.CONNECTION_CLOSED,`Connection closed`));this.pendingRequests.clear();for(let[,e]of this.streamHandlers)try{e.end()}catch{}this.streamHandlers.clear();for(let e of this.pullIteratorCleanups.values())try{e()}catch{}this.pullIteratorCleanups.clear();for(let e of this.callbackCleanups.values())try{e()}catch{}this.callbackCleanups.clear();for(let t of this.isolatedClients)try{t.abortClose(e)}catch{}let t=this.nc;if(t){try{typeof t.abortClose==`function`?t.abortClose(e):t.close().catch(()=>{})}catch{}this.nc=void 0}}async suspend(){for(let[,e]of this.pendingRequests)e.timeout&&clearTimeout(e.timeout),e.reject(Ns(Ps.CONNECTION_CLOSED,`Connection closed`));this.pendingRequests.clear();for(let[,e]of this.streamHandlers)try{e.end()}catch{}this.streamHandlers.clear(),await Promise.allSettled(Array.from(this.pullIteratorCleanups.values()).map(e=>e())),this.pullIteratorCleanups.clear(),await Promise.allSettled(Array.from(this.callbackCleanups.values()).map(e=>e())),this.callbackCleanups.clear();for(let e of this.subscriptions.values())for(let t of e)try{t.unsubscribe()}catch{}if(this.subscriptions.clear(),this.chunkingManager=new Es,await Promise.allSettled(this.isolatedClients.map(e=>e.suspend())),this.nc){try{await this.nc.close()}catch{}try{let e=this.options.disconnectTimeout??2e3;await Promise.race([this.nc.closed(),new Promise(t=>setTimeout(t,e))])}catch{}this.nc=void 0}this.connectionPromise=void 0}async publish(e,t,n){if(!this.nc)throw Error(`Not connected`);let r=Ss(t);if(r.length<=this._maxPayloadSize){this.nc.publish(e,r,n);return}let i=Wa(),a={type:`chunked`,transferId:i,totalChunks:Math.ceil(r.length/this._maxPayloadSize),totalSize:r.length,chunkSize:this._maxPayloadSize},o=n?.headers??oi();o.set(`x-chunked-transfer`,`header`),o.set(`x-chunk-id`,i),this.nc.publish(e,Ss(a),{headers:o,reply:n?.reply});let s=0;for(let t of ws(r,i,this._maxPayloadSize)){let r=oi();r.set(`x-chunked-transfer`,`chunk`),r.set(`x-chunk-id`,i),r.set(`x-chunk-index`,s.toString()),this.nc.publish(e,t.data,{headers:r,reply:n?.reply}),s>0&&s%50==0&&await Ga(0),s++}}async subscribe(e,t,n){if(!this.nc)throw Error(`Not connected`);let r=Promise.resolve(),i=n=>{let i;try{i=t(n)}catch(t){console.error(`Error in handler for ${e}:`,t);return}if(Va(i)){let t=i;r=r.then(()=>t).catch(t=>console.error(`Error in handler for ${e}:`,t))}},a=(t,n)=>{if(t){console.error(`Subscription error for ${e}:`,t);return}try{let t=n.headers?.get(`x-chunked-transfer`);if(t===`header`){let t=Cs(n.data),r=n.headers?.get(`x-chunk-id`);if(!r||t.transferId!==r){console.error(`Invalid chunk header`);return}this.chunkingManager.startReceiving(t.transferId,t.totalChunks,e=>{i(e)},t=>{console.error(`Error assembling chunks for ${e}:`,t)},t.totalSize,t.chunkSize)}else if(t===`chunk`){let e=n.headers?.get(`x-chunk-id`),t=parseInt(n.headers?.get(`x-chunk-index`)??`0`);if(!e){console.error(`Chunk missing chunk ID`);return}this.chunkingManager.processChunk({id:e,chunkIndex:t,data:n.data,isLast:!1})}else i(Cs(n.data))}catch(t){console.error(`Error processing message for ${e}:`,t)}},o=this.nc.subscribe(e,{...n?.queue?{queue:n.queue}:{},callback:a});return this.subscriptions.set(e,[o]),this._subscriptionMeta.set(e,{pattern:e,handler:t,options:n}),()=>{try{o.unsubscribe()}catch{}finally{this.subscriptions.delete(e),this._subscriptionMeta.delete(e)}}}async request(e,t,n){return this.withNoResponderRetry(()=>this._requestOnce(e,t,n),n?.noResponderRetry)}async _requestOnce(e,t,n){if(!this.nc)throw Error(`Not connected`);let r=n?.timeout??5e3,i=Ss(t);try{let t=await this.nc.request(e,i,{timeout:r,headers:n?.headers,noMux:!1});if(t.headers?.get(`Nats-Service-Error-Code`)){let e=t.headers.get(`Nats-Service-Error-Code`)||`500`,n=t.headers.get(`Nats-Service-Error`)||`Service error`,r=null;if(t.data)try{r=Cs(t.data)}catch{}throw Ns(e,n,r)}let a=Cs(t.data);if(a?.error)throw Ns(a.code??Ps.INTERNAL_ERROR,a.error??`Unknown error`,a);return a}catch(t){throw t.code===`503`||t.message?.includes(`no responders`)?Ns(Ps.NOT_FOUND,`No responders available`):t.code===`TIMEOUT`||t.message?.includes(`timeout`)?Ns(Ps.TIMEOUT,`Request to "${e}" timed out after ${r}ms`):t}}async withNoResponderRetry(e,t){let n=t?.maxRetries??this.options.noResponderRetry?.maxRetries??3,r=t?.delays??this.options.noResponderRetry?.delays??[500,1e3,2e3];for(let t=0;;t++)try{return await e()}catch(e){if(!(e instanceof xn.NoRespondersError||e instanceof Ms&&e.code===Ps.NOT_FOUND)||t>=n||this.closed)throw e;let i=r[Math.min(t,r.length-1)];await Ga(i)}}async call(e,...t){return this.withNoResponderRetry(()=>this._callOnce(e,...t))}async _callOnce(e,...t){if(!this.isConnected&&!this.isClosed&&await this.connect(),!this.nc)throw Error(`Not connected`);let n=Wa(),r=this.options.timeout??3e4,i=e.startsWith(`rpc.`)?`rpc.reply.${n}`:`${e}.reply.${n}`;return new Promise(async(a,o)=>{let s,c,l=setTimeout(()=>{this.pendingRequests.has(n)&&(this.pendingRequests.delete(n),o(Ns(Ps.TIMEOUT,`RPC call to "${e}" timed out after ${r}ms`)))},r);this.pendingRequests.set(n,{resolve:a,reject:o,timeout:l});let u=async()=>{if(this.pendingRequests.has(n)){let e=this.pendingRequests.get(n);e?.timeout&&clearTimeout(e.timeout),this.pendingRequests.delete(n)}if(s&&!s.isClosed())try{s.unsubscribe()}catch{}c?.()},d=async e=>{let t=e;if(t.id===n){let e=this.pendingRequests.get(t.id);if(e)if(this.pendingRequests.delete(t.id),e.timeout&&clearTimeout(e.timeout),await u(),t.error)e.reject(Ms.fromJSON(t.error));else{let n=t.result,r=n instanceof Uint8Array||n instanceof ArrayBuffer||typeof Buffer<`u`&&Buffer.isBuffer(n);t.__methods&&typeof n==`object`&&n&&!r&&(n.__methods=t.__methods),e.resolve(n)}}},f=(t,n)=>{n&&n.data?.length===0&&n.headers?.code===503?(o(new xn.NoRespondersError(e)),u()):t&&(o(t),u())};try{c=await this.subscribe(i,d);let r=qn();s=this.nc.subscribe(r,{max:1,callback:f});let a={id:n,method:`call`,params:t};await this.publish(e,a,{reply:r})}catch(e){await u(),o(e)}})}async*callStream(e,...t){let n=this.options.noResponderRetry?.maxRetries??3,r=this.options.noResponderRetry?.delays??[500,1e3,2e3];for(let i=0;;i++)try{yield*this._callStreamOnce(e,...t);return}catch(e){if(!(e instanceof xn.NoRespondersError||e instanceof Ms&&e.code===Ps.NOT_FOUND)||i>=n||this.closed)throw e;await Ga(r[Math.min(i,r.length-1)])}}_callStreamOnce(e,...t){let n=this,r=!1,i=!1,a=!1,o=!1,s=null,c=``,l=``,u,d,f=[],p=null,m=()=>{let e=p;e&&(p=null,e({value:void 0,done:!0}))},h={push:e=>{if(!o)if(p){let t=p;p=null,t({value:e,done:!1})}else f.push(e)},end:()=>{o=!0,m()},error:e=>{s=e,o=!0,m()}},g=async()=>{if(!a){if(a=!0,n.streamHandlers.delete(c),u&&!u.isClosed())try{u.unsubscribe()}catch{}if(d?.(),!o){o=!0;try{await n.publish(`${l}.cancel`,{id:c})}catch{}}}},_=async e=>{if(e.id!==c)return;let t=n.streamHandlers.get(e.id);if(t)switch(e.type){case`data`:t.push(e.data);break;case`end`:t.end(),await g();break;case`error`:t.error(Ms.fromJSON(e.error)),await g();break}},v=(t,r)=>{r&&r.data?.length===0&&r.headers?.code===503?(n.streamHandlers.get(c)?.error(new xn.NoRespondersError(e)),g()):t&&(n.streamHandlers.get(c)?.error(t),g())},y=async()=>{if(!n.isConnected&&!n.isClosed&&await n.connect(),!n.nc)throw Error(`Not connected`);c=Wa(),l=`stream.${e}.${c}`,n.streamHandlers.set(c,h),d=await n.subscribe(l,_);let r=qn();u=n.nc.subscribe(r,{max:1,callback:v});let i={id:c,method:`stream`,params:{__stream:!0,__streamSubject:l,args:t}};await n.publish(e,i,{reply:r})},b={async next(){if(i)return{value:void 0,done:!0};if(!r){r=!0;try{await y()}catch(e){throw await g(),e}if(i)return await g(),{value:void 0,done:!0}}if(s)throw await g(),s;if(f.length>0)return{value:f.shift(),done:!1};if(o)return await g(),{value:void 0,done:!0};let e=await new Promise((e,t)=>{if(i){e({value:void 0,done:!0});return}if(o){e({value:void 0,done:!0});return}if(s){t(s);return}p=e});if(i)return await g(),{value:void 0,done:!0};if(e.done){if(s)throw await g(),s;return await g(),{value:void 0,done:!0}}return{value:e.value,done:!1}},async return(e){return i?{value:e,done:!0}:(i=!0,m(),r&&await g(),{value:e,done:!0})},async throw(e){throw i?e:(i=!0,m(),r&&await g(),e)},[Symbol.asyncIterator](){return b},async[Symbol.asyncDispose](){await b.return()}};return b}callPullIterator(e,...t){let n=this,r=!1,i=!1,a=!1,o=!1,s=null,c=``,l=``,u=``,d,f=``,p,m=[],h=null,g=()=>{let e=h;e&&(h=null,e({id:c,type:`done`}))},_=async()=>{if(!a){if(a=!0,p?.(),d&&!d.isClosed())try{d.unsubscribe()}catch{}if(!o){o=!0;try{let e={id:c,type:`cancel`};await n.publish(l,e)}catch{}}}},v=async()=>{if(!n.isConnected&&!n.isClosed&&await n.connect(),!n.nc)throw Error(`Not connected`);if(c=Wa(),l=`_rpc.iterator.${c}.request`,u=`_rpc.iterator.${c}.response`,(await n.call(e,{__pullIterator:!0,__iteratorId:c,args:t}))?.iteratorId!==c)throw Error(`Failed to initialize pull iterator`);p=await n.subscribe(u,e=>{if(e.type===`error`?(s=Ms.fromJSON(e.error),o=!0):e.type===`done`&&(o=!0),h){let t=h;h=null,t(e)}else m.push(e)}),f=qn(),d=n.nc.subscribe(f,{max:1,callback:(t,n)=>{let r=!1;if(n&&n.data?.length===0&&n.headers?.code===503){let t=new xn.NoRespondersError(e);r=!0,o=!0,s=Ns(`503`,t.message)}else t&&(r=!0,o=!0,s=Ns(Ps.INTERNAL_ERROR,t.message));if(r){let e={type:`error`,id:c,error:s?s.toJSON():void 0};if(h){let t=h;h=null,t(e)}else m.push(e)}}})},y={async next(){if(i)return{value:void 0,done:!0};if(!r){r=!0;try{await v()}catch(e){throw await _(),e}if(i)return await _(),{value:void 0,done:!0}}let e={id:c,type:`next`};try{await n.publish(l,e,{reply:f})}catch(e){throw await _(),e}let t=await new Promise((e,t)=>{if(i){e({id:c,type:`done`});return}m.length>0?e(m.shift()):o&&s?t(s):o?e({id:c,type:`done`}):h=e});if(i)return await _(),{value:void 0,done:!0};if(t.type===`error`)throw await _(),Ms.fromJSON(t.error);return t.type===`done`?(await _(),{value:void 0,done:!0}):{value:t.value,done:!1}},async return(e){return i?{value:e,done:!0}:(i=!0,g(),r&&await _(),{value:e,done:!0})},async throw(e){throw i?e:(i=!0,g(),r&&await _(),e)},[Symbol.asyncIterator](){return y},async[Symbol.asyncDispose](){await y.return()}};return y}callPullIteratorWithCallback(e,t,n,...r){let i=this,a=!1,o=!1,s=!1,c=!1,l=null,u=``,d=``,f=``,p=``,m,h=``,g,_,v=[],y=null,b=Promise.resolve(),x=()=>{let e=y;e&&(y=null,e({id:u,type:`done`}))},S=async()=>{if(!s){if(s=!0,g?.(),_?.(),m&&!m.isClosed())try{m.unsubscribe()}catch{}if(!c){c=!0;try{let e={id:u,type:`cancel`};await i.publish(d,e)}catch{}}}},C=async()=>{if(!i.isConnected&&!i.isClosed&&await i.connect(),!i.nc)throw Error(`Not connected`);u=Wa(),d=`_rpc.iterator.${u}.request`,f=`_rpc.iterator.${u}.response`,p=`_rpc.cb.${u}`;let a=Object.keys(t).filter(e=>typeof t[e]==`function`);g=await i.subscribe(p,e=>{let n=t[e.method];if(!n){console.error(`[rpc] Pull-callback: unknown method '${e.method}'`);return}b=b.then(async()=>{try{await n(...e.args??[])}catch(t){console.error(`[rpc] Pull-callback handler '${e.method}' threw:`,t)}})});let o={__pullCallback:!0,__iteratorId:u,__callbackSubject:p,__callbackMethods:a,__onewayMethods:n,args:r},s;try{s=await i.call(e,o)}catch(e){throw g?.(),g=void 0,e}if(s?.iteratorId!==u)throw g?.(),g=void 0,Error(`Failed to initialize pull-callback iterator`);_=await i.subscribe(f,e=>{if(e.type===`error`?(l=Ms.fromJSON(e.error),c=!0):e.type===`done`&&(c=!0),y){let t=y;y=null,t(e)}else v.push(e)}),h=qn(),m=i.nc.subscribe(h,{max:1,callback:(t,n)=>{let r=!1;if(n&&n.data?.length===0&&n.headers?.code===503){let t=new xn.NoRespondersError(e);r=!0,c=!0,l=Ns(`503`,t.message)}else t&&(r=!0,c=!0,l=Ns(Ps.INTERNAL_ERROR,t.message));if(r){let e={type:`error`,id:u,error:l?l.toJSON():void 0};if(y){let t=y;y=null,t(e)}else v.push(e)}}})},w={async next(){if(o)return{value:void 0,done:!0};if(!a){a=!0;try{await C()}catch(e){throw await S(),e}if(o)return await S(),{value:void 0,done:!0}}let e={id:u,type:`next`};try{await i.publish(d,e,{reply:h})}catch(e){throw await S(),e}let t=await new Promise((e,t)=>{if(o){e({id:u,type:`done`});return}v.length>0?e(v.shift()):c&&l?t(l):c?e({id:u,type:`done`}):y=e});if(o)return await S(),{value:void 0,done:!0};if(t.type===`error`)throw await S(),Ms.fromJSON(t.error);return t.type===`done`?(await S(),{value:void 0,done:!0}):(await b,{value:void 0,done:!1})},async return(e){return o?{value:e,done:!0}:(o=!0,x(),a&&await S(),{value:e,done:!0})},async throw(e){throw o?e:(o=!0,x(),a&&await S(),e)},[Symbol.asyncIterator](){return w},async[Symbol.asyncDispose](){await w.return()}};return w}async callWithCallback(e,t,n){if(!this.isConnected&&!this.isClosed&&await this.connect(),!this.nc)throw Error(`Not connected`);let r=Wa(),i=`rpc.cb.${r}`,a=await this.subscribe(i,async e=>{if(e.type===`data`)try{await n(e.data)}catch(e){console.error(`[rpc] Callback error:`,e)}else e.type===`error`&&console.error(`[rpc] Callback error:`,e.error)}),o={__callback:!0,__callbackSubject:i,args:t};try{await this.call(e,o)}catch(e){throw a(),e}return()=>{this.publish(`${i}.cancel`,{id:r}).catch(()=>{}),a()}}async registerHandler(e,t,n){if(!this.nc&&!n?.isolatedConnection)throw Error(`Not connected`);let r=this;n?.isolatedConnection&&(r=this.createIsolatedClient({...this.options,name:`${this.options.name}-handler-${e}`}),await r.connect(),this.isolatedClients.push(r));let i=[],a=[],o=n?.withoutDecorators?As(t):js(t),s=Object.keys(o);for(let[t,c]of Object.entries(o)){let o=`rpc.${e}.${t}`,l=await r.subscribe(o,async e=>{let n={id:e.id,__methods:s};try{if(e.params?.__stream&&e.params?.__streamSubject){let n=e.params.__streamSubject;Fs(c,e.params.args??[],n,e.id,r).catch(e=>{console.error(`Stream request error for ${t}:`,e)});return}else if(e.params?.__pullIterator||Array.isArray(e.params)&&e.params[0]?.__pullIterator){let t=e.params?.__pullIterator?e.params:e.params[0],i=t.args??[],o=t.__iteratorId??e.id,s=await Rs(c,i,o,r);r.pullIteratorCleanups.set(o,s),a.push(o),n.result={iteratorId:o};let l=`rpc.reply.${e.id}`;await r.publish(l,n)}else if(e.params?.__pullCallback||Array.isArray(e.params)&&e.params[0]?.__pullCallback){let t=e.params?.__pullCallback?e.params:e.params[0],i=t.args??[],o=t.__iteratorId??e.id,s=t.__callbackSubject,l=await zs(c,i,o,s,t.__callbackMethods??[],t.__onewayMethods??[],r);r.pullIteratorCleanups.set(o,l),a.push(o),n.result={iteratorId:o};let u=`rpc.reply.${e.id}`;await r.publish(u,n)}else if(e.params&&typeof e.params==`object`&&!Array.isArray(e.params)&&e.params.__callback&&e.params.__callbackSubject||Array.isArray(e.params)&&e.params.length>0&&typeof e.params[0]==`object`&&e.params[0]?.__callback){let t=Array.isArray(e.params)&&e.params[0]?.__callback?e.params[0]:e.params,i=t.__callbackSubject,a=await Bs(c,t.args??[],i,e.id,r);r.callbackCleanups.set(e.id,a),n.result={ok:!0};let o=`rpc.reply.${e.id}`;await r.publish(o,n)}else{n.result=await Is(c,e.params);let t=`rpc.reply.${e.id}`;await r.publish(t,n)}}catch(t){n.error=Ls(t);try{let t=`rpc.reply.${e.id}`;await r.publish(t,n)}catch(e){if(r.isClosed)return;console.error(`Failed to send error response:`,e)}}},n?.queue?{queue:n.queue}:void 0);i.push(l)}return async()=>{for(let e of i)e();if(await Promise.allSettled(Array.from(r.pullIteratorCleanups.entries()).map(([e,t])=>(r.pullIteratorCleanups.delete(e),t()))),await Promise.allSettled(Array.from(r.callbackCleanups.entries()).map(([e,t])=>(r.callbackCleanups.delete(e),t()))),n?.isolatedConnection){await r.disconnect();let e=this.isolatedClients.indexOf(r);e>=0&&this.isolatedClients.splice(e,1)}}}async onRequest(e,t){if(!this.nc)throw Error(`Not connected`);let n=this.nc.subscribe(e,{callback:(n,r)=>{(async()=>{try{let e=await t(Cs(r.data));if(r.reply){let t=Ss(e);r.respond(t)}}catch(t){if(r.reply){let e=Ss({error:t instanceof Error?t.message:`Internal error`,code:t instanceof Ms?t.code:Ps.INTERNAL_ERROR});r.respond(e)}console.error(`Error in request handler for ${e}:`,t)}})()}});return()=>{n.unsubscribe()}}async channel(e,t){let n;t?.isolatedConnection?(n=this.createIsolatedClient({...this.options,name:`${this.options.name}-channel-${e}`}),this.isolatedClients.push(n),await n.connect()):n=this;let r=new Ka(n,e);return await r.init(),t?.isolatedConnection&&(r._isolatedClient=n),r}async privateChannel(e,t,n){let r;n?.isolatedConnection?(r=this.createIsolatedClient({...this.options,name:`${this.options.name}-private-${e}`}),this.isolatedClients.push(r),await r.connect()):r=this;let i=new qa(r,e,t);return await i.init(),n?.isolatedConnection&&(i._isolatedClient=r),i}createProxy(e,t){let n;t?.isolatedConnection?(n=this.createIsolatedClient({...this.options,name:`${this.options.name}-proxy-${e}`}),this.isolatedClients.push(n)):n=this;let r=Ha(n,e);return t?.isolatedConnection?(r._isolatedClient=n,{proxy:r,close:async()=>{await n.disconnect();let e=this.isolatedClients.indexOf(n);e>=0&&this.isolatedClients.splice(e,1)}}):r}async createServiceProxy(e,t){let n;t?.isolatedConnection?(n=this.createIsolatedClient({...this.options,name:`${this.options.name}-service-${e}`}),this.isolatedClients.push(n),await n.connect()):n=this;let r=n.service.monitor(),i=[];for await(let t of await r.info(e))i.push(t);if(i.length===0){if(t?.isolatedConnection){await n.disconnect();let e=this.isolatedClients.indexOf(n);e>=0&&this.isolatedClients.splice(e,1)}throw Error(`No services found with name: ${e}`)}let a=t?.preferredId?i.find(e=>e.id===t.preferredId)??i[0]:i[0],o=Ua(n,a,t?.timeout);return t?.isolatedConnection?(o._isolatedClient=n,{proxy:o,close:async()=>{await n.disconnect();let e=this.isolatedClients.indexOf(n);e>=0&&this.isolatedClients.splice(e,1)}}):o}};function Xs(e,t){return t?t.aborted?(e.then(e=>Zs(e)).catch(()=>{}),Promise.reject(new DOMException(`Aborted`,`AbortError`))):new Promise((n,r)=>{let i=!1,a=()=>{i||(i=!0,e.then(e=>Zs(e)).catch(()=>{}),r(new DOMException(`Aborted`,`AbortError`)))};t.addEventListener(`abort`,a,{once:!0}),e.then(e=>{if(i){Zs(e);return}i=!0,t.removeEventListener(`abort`,a),n(e)},e=>{i||(i=!0,t.removeEventListener(`abort`,a),r(e))})}):e}function Zs(e){let t=e;try{typeof t.abortClose==`function`?t.abortClose():e.close().catch(()=>{})}catch{}}var Qs={id:`nats`,kind:`persistent`,phaseGating:!0,graceMs:4e3};function $s(e={}){let t={...Qs,...e.spec},n=e.proxyPath??`/api/proxy`,r=e.clientName??`@camera.ui/transport/nats`,i=e.natsUser??`secret`,a=e.natsPassword??`secret`,o=e.reconnectTimeWait??1e3,s=e.reconnectionDelayMax??5e3,c=e.reconnectionRandomizationFactor??.5,l=e.timeout??1e4,u=e.pingInterval??25e3,d=e.pingTimeout??2e4,f=e.maxPingOut??1,p=new mt,m=new Set,h=null,g=null,_={up:!1},v=null,y=!1;function b(e){let t=new URL(e.endpoint.url),r=t.protocol===`https:`?`wss:`:`ws:`,i=t.port||(t.protocol===`https:`?`443`:`80`),a=new URLSearchParams({token:e.tokens.access});return e.tokens.proxySession&&a.set(`session`,e.tokens.proxySession),[`${r}//${t.hostname}:${i}${n}?${a.toString()}`]}function x(){let e=_.up?h:null;for(let t of[...m])try{t(e)}catch{}}function S(){_.up||(_={up:!0},p.emit(`up`,void 0))}function C(e){!_.up&&_.lastError===e||(_={up:!1,lastError:e},p.emit(`down`,{reason:e}))}function w(){v?.abort(),v=null}function T(e){w();let t=new AbortController;v=t,(async()=>{let n=e.status();if(n)for await(let e of n){if(t.signal.aborted)break;switch(e.type){case`reconnect`:S(),x();break;case`disconnect`:C(`disconnect`),x();break;case`staleConnection`:C(`staleConnection`),x();break;case`error`:E(e);break}}})().catch(()=>{})}function E(e){let t=ec(e.data),n=t.toLowerCase();if(n.includes(`auth`)||n.includes(`401`)||n.includes(`forbidden`)||n.includes(`403`)){p.emit(`auth-error`,{message:t});return}C(t)}async function D(e){if(w(),h){try{h.abortClose()}catch{}h=null,x()}let t=Js({servers:b(e),name:r,auth:{user:i,password:a},reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:o,reconnectionDelayMax:s,reconnectionRandomizationFactor:c,timeout:l,pingInterval:u,pingTimeout:d,maxPingOut:f,ignoreAuthErrorAbort:!0});try{await t.connect()}catch(e){try{t.abortClose()}catch{}throw C(e instanceof Error?e.message:String(e)),e}h=t,S(),x(),T(t)}async function O(e){if(y)throw Error(`nats-transport disposed`);if(ft(g,e))return;let t=pt(g,e);if(g=e,!e){if(w(),h){try{h.abortClose()}catch{}h=null,x()}C(`detached`);return}if(t||!h){await D(e);return}let n=b(e);h.setServers(n)}function k(){return _}function A(e,t){return p.on(e,t)}async function j(){if(y=!0,w(),h){try{h.abortClose()}catch{}h=null,x()}m.clear(),_={up:!1},p.clear()}function M(){return h}function N(e){return m.add(e),e(h),()=>m.delete(e)}async function P(e=5e3){if(!h)throw Error(`nats-transport: no client`);await h.flush(e)}async function F(){h&&await h.forceReconnect()}return{spec:t,apply:O,health:k,on:A,dispose:j,getClient:M,subscribeClient:N,probeAlive:P,forceReconnect:F}}function ec(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var tc={id:`socketio`,kind:`persistent`,phaseGating:!0,graceMs:4e3};function nc(e={}){let t={...tc,...e.spec},n=e.path??`/api/socket.io`,r=e.mainNamespace??`/camera.ui`,i=e.reconnection??!0,a=e.reconnectionDelay??1e3,o=e.reconnectionDelayMax??5e3,s=e.timeout??2e4,c=new mt,l=new Map,d=null,f=null,p={up:!1},m=!1;function h(e){let t={token:`Bearer ${e.tokens.access}`};return e.tokens.proxySession&&(t.session=e.tokens.proxySession),t}function g(e){let t={};return e.tokens.proxySession&&(t.session=e.tokens.proxySession),t}function _(){p.up||(p={up:!0},c.emit(`up`,void 0))}function v(e){!p.up&&p.lastError===e||(p={up:!1,lastError:e},c.emit(`down`,{reason:e}))}function y(e){let t=e.toLowerCase();return t.includes(`auth`)||t.includes(`unauthorized`)}function b(e){let t=!1;e.on(`unauthenticated`,()=>{let n=f?h(f):null,r=e.auth?.token;n&&r!==n.token?(e.auth=n,t=!0):c.emit(`auth-error`,{message:`unauthenticated`})}),e.on(`disconnect`,()=>{t&&(t=!1,e.connect())})}function x(e){e.on(`connect`,()=>_()),e.on(`disconnect`,e=>v(e)),e.on(`connect_error`,e=>{let t=e?.message??`connect_error`;if(y(t)){c.emit(`auth-error`,{message:t});return}v(t)}),b(e)}function S(e){e.on(`connect_error`,e=>{let t=e?.message??`connect_error`;y(t)&&c.emit(`auth-error`,{message:t})}),b(e)}function C(e,t){let r=u(`${t.endpoint.url}${e}`,{path:n,auth:h(t),query:g(t),reconnection:i,reconnectionDelay:a,reconnectionDelayMax:o,timeout:s,rejectUnauthorized:!1,transports:[`websocket`]});return l.set(e,r),r}function w(e){T(),d=new Re(e.endpoint.url,{path:n,autoConnect:!1,reconnection:i,reconnectionDelay:a,reconnectionDelayMax:o,timeout:s,rejectUnauthorized:!1,transports:[`websocket`]}),x(C(r,e))}function T(){for(let e of l.values())e.removeAllListeners(),e.disconnect();l.clear(),d&&=(d._close(),null)}function E(e){let t=h(e);for(let e of l.values())e.auth=t,e.connected||e.connect()}async function D(e){if(m)throw Error(`socketio-transport disposed`);if(ft(f,e))return;let t=pt(f,e);if(f=e,!e){T(),v(`detached`);return}if(t||!d){w(e);return}E(e)}function O(){return p}function k(e,t){return c.on(e,t)}async function A(){m=!0,T(),f=null,p={up:!1},c.clear()}function j(e=r){return l.get(e)??null}function M(e){if(!f)return null;let t=l.get(e);return t||(t=C(e,f),S(t)),t}function N(){if(!f)return;let e=h(f);for(let t of l.values())t.connected||(t.auth=e,t.connect())}return{get spec(){return t},get manager(){return d},apply:D,health:O,on:k,dispose:A,socket:j,ensureSocket:M,reviveDeadSockets:N}}var rc={id:`ws`,kind:`per-resource`,phaseGating:!1},ic=4e3,ac=4001,oc=4002;function sc(e={}){let t={...rc,...e.spec},n=e.tokenParam??`token`,r=e.sessionParam??`session`,i=e.webSocketCtor??(typeof WebSocket<`u`?WebSocket:void 0),a=new mt,o=new Set,s=null,c={up:!1},l=!1;function u(){if(!i)throw Error(`ws-transport: no WebSocket constructor available; pass webSocketCtor in non-browser environments`);return i}function d(e,t){let i=new URL(e.endpoint.url),a=i.protocol===`https:`?`wss:`:`ws:`,o=i.port||(i.protocol===`https:`?`443`:`80`),s=new URLSearchParams;for(let[e,n]of Object.entries(t.query??{}))n!=null&&n!==``&&s.set(e,n);return s.set(n,e.tokens.access),e.tokens.proxySession&&s.set(r,e.tokens.proxySession),`${a}//${i.hostname}:${o}${t.path}?${s.toString()}`}function f(e){if(e.code===1008||e.code===4401)return!0;if(!e.reason)return!1;let t=e.reason.toLowerCase();return t.includes(`unauthorized`)||t.includes(`forbidden`)||t.includes(`401`)||t.includes(`403`)}function p(e,t){t.onopen=()=>{if(!(e.disposed||e.ws!==t)){c.up||(c={up:!0},a.emit(`up`,void 0));for(let t of[...e.listeners.open])t()}},t.onclose=n=>{e.ws===t&&(e.ws=null,e.url=null),f(n)&&a.emit(`auth-error`,{message:n.reason||`ws close code ${n.code}`});let r={code:n.code,reason:n.reason,wasClean:n.wasClean};for(let t of[...e.listeners.close])t(r)},t.onmessage=n=>{if(!(e.disposed||e.ws!==t))for(let t of[...e.listeners.message])t(n)},t.onerror=n=>{if(!(e.disposed||e.ws!==t))for(let t of[...e.listeners.error])t(n)}}function m(e,t,n){let r=e.ws;if(!r)return;let i=u();if(r.readyState===i.OPEN||r.readyState===i.CONNECTING){try{r.close(t,n)}catch{}return}e.ws===r&&(e.ws=null,e.url=null);let a={code:t,reason:n,wasClean:!1};for(let t of[...e.listeners.close])t(a)}function h(e){if(e.disposed||!s)return;let t=d(s,e.spec),n=new(u())(t,e.spec.protocols);e.spec.binaryType&&(n.binaryType=e.spec.binaryType),e.ws=n,e.url=t,p(e,n)}function g(e,t){let n=[...o];for(let r of n)m(r,e,t);if(c.up&&(c={up:!1,lastError:t},a.emit(`down`,{reason:t})),s)for(let e of o)e.disposed||h(e)}async function _(e){if(l)throw Error(`ws-transport disposed`);if(ft(s,e))return;let t=pt(s,e);if(s=e,!e){let e=[...o];for(let t of e)m(t,ac,`detached`);c={up:!1},a.emit(`down`,{reason:`detached`});return}t&&g(ic,`endpoint-changed`)}function v(){return c}function y(e,t){return a.on(e,t)}async function b(){l=!0;let e=[...o];for(let t of e)t.disposed=!0,t.listeners.open.clear(),t.listeners.close.clear(),t.listeners.message.clear(),t.listeners.error.clear(),m(t,oc,`disposed`);o.clear(),s=null,c={up:!1},a.clear()}function x(e){if(l)throw Error(`ws-transport disposed`);let t={api:void 0,spec:e,listeners:{open:new Set,close:new Set,message:new Set,error:new Set},ws:null,url:null,disposed:!1};function n(e){if(t.disposed)throw Error(`ws-handle disposed`);let n=t.ws;if(!n)throw Error(`ws-handle: no active socket`);if(n.readyState!==i.OPEN)throw Error(`ws-handle: socket not open`);n.send(e)}function r(e,n){m(t,e??1e3,n??``)}function a(e,n){let r=t.listeners[e];return r.add(n),()=>{r.delete(n)}}function c(){t.disposed||(t.disposed=!0,t.listeners.open.clear(),t.listeners.close.clear(),t.listeners.message.clear(),t.listeners.error.clear(),m(t,oc,`disposed`),o.delete(t))}return t.api={get readyState(){return t.ws?.readyState??i?.CLOSED??3},get url(){return t.url},send:n,close:r,on:a,dispose:c},o.add(t),s&&h(t),t.api}return{get spec(){return t},get handleCount(){return o.size},apply:_,health:v,on:y,dispose:b,open:x}}function cc(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lc(e){let t=e.url??``,n=e.baseURL??``;return n&&!cc(t)?`${n.replace(/\/+$/,``)}/${t.replace(/^\/+/,``)}`:t}function uc(e){let t;try{t=new URL(e).hostname}catch{return!1}return!t||t===`localhost`||t.endsWith(`.local`)||t.includes(`:`)||/^\d{1,3}(?:\.\d{1,3}){3}$/.test(t)?!1:t.includes(`.`)}function dc(e){return!e.withCredentials&&uc(lc(e))}function fc(e){return async t=>{mc(t.signal);let n=gc(t.headers);e.extraHeaders&&Object.assign(n,e.extraHeaders);let r=typeof t.timeout==`number`&&t.timeout>0?t.timeout:void 0,i=e.request({url:lc(t),method:(t.method??`get`).toUpperCase(),headers:n,params:_c(t.params),data:vc(t),responseType:yc(t.responseType),connectTimeout:r,readTimeout:r}),a;try{a=await hc(i,t.signal)}catch(e){throw e instanceof v?e:new P(e instanceof Error?e.message:`Network Error`,P.ERR_NETWORK,t,i)}let o={data:a.data,status:a.status,statusText:``,headers:ee.from(a.headers??{}),config:t,request:i};if(!t.validateStatus||t.validateStatus(a.status))return o;throw new P(`Request failed with status code ${a.status}`,a.status>=500?P.ERR_BAD_RESPONSE:P.ERR_BAD_REQUEST,t,i,o)}}function pc(e,t){if(!t.enabled)return;let n=E.getAdapter(e.defaults.adapter??E.defaults.adapter),r=fc(t);e.defaults.adapter=e=>dc(e)?r(e):n(e)}function mc(e){if(e?.aborted)throw new v(`canceled`)}function hc(e,t){return!t||typeof t.addEventListener!=`function`?e:t.aborted?Promise.reject(new v(`canceled`)):new Promise((n,r)=>{let i=()=>r(new v(`canceled`));t.addEventListener(`abort`,i,{once:!0});let a=()=>t.removeEventListener?.(`abort`,i);e.then(e=>{a(),n(e)},e=>{a(),r(e)})})}function gc(e){let t={};if(!e)return t;let n=ee.from(e).toJSON();for(let[e,r]of Object.entries(n))r!=null&&(t[e]=Array.isArray(r)?r.join(`, `):String(r));return t}function _c(e){if(!e||typeof e!=`object`)return;let t={};for(let[n,r]of Object.entries(e))r!=null&&(t[n]=String(r));return t}function vc(e){let t=e.data;if(typeof t!=`string`)return t;if(String(ee.from(e.headers).get(`Content-Type`)??``).includes(`application/json`))try{return JSON.parse(t)}catch{}return t}function yc(e){switch(e){case`blob`:return`blob`;case`arraybuffer`:return`arraybuffer`;default:return`text`}}function bc(e={}){function t(e){return typeof e==`function`}let n=t(e)?{mounted:e,updated:e}:e,{mounted:r,unmounted:i}=n;if(!t(r))return e;let a=new WeakMap;return{...n,mounted(e,t,n,i){let o=a.get(e)??fe();a.set(e,o),o.run(()=>{r?.(e,t,n,i)})},unmounted(e,n,r,o){var s;(s=a.get(e))==null||s.stop(),a.delete(e),t(i)&&i(e,n,r,o)}}}function xc(e,t){return b()?(he(e,t),!0):!1}var Sc=new WeakMap,Cc=(...e)=>{let t=e[0],n=Qe()?.proxy??b();if(n==null&&!rt())throw Error(`injectLocal must be called in setup`);return n&&Sc.has(n)&&t in Sc.get(n)?Sc.get(n)[t]:De(...e)},wc=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var Tc=e=>e!=null,Ec=Object.prototype.toString,Dc=e=>Ec.call(e)===`[object Object]`,Oc=()=>{},kc=Ac();function Ac(){var e,t;return wc&&!!(!((e=window)==null||(e=e.navigator)==null)&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)==null||(t=t.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function jc(...e){if(e.length!==1)return Ie(...e);let t=e[0];return typeof t==`function`?L(se(()=>({get:t,set:Oc}))):s(t)}function Mc(e,t){function n(...n){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(r).catch(i)})}return n}var Nc=e=>e();function Pc(e,t={}){let n,r,i=Oc,a=e=>{clearTimeout(e),i(),i=Oc},o;return s=>{let c=G(e),l=G(t.maxWait);return n&&a(n),c<=0||l!==void 0&&l<=0?(r&&=(a(r),void 0),Promise.resolve(s())):new Promise((e,u)=>{i=t.rejectOnCancel?u:e,o=s,l&&!r&&(r=setTimeout(()=>{n&&a(n),r=void 0,e(o())},l)),n=setTimeout(()=>{r&&a(r),r=void 0,e(s())},c)})}}function Fc(...e){let t=0,n,r=!0,i=Oc,a,o,s,c,l;!O(e[0])&&typeof e[0]==`object`?{delay:o,trailing:s=!0,leading:c=!0,rejectOnCancel:l=!1}=e[0]:[o,s=!0,c=!0,l=!1]=e;let u=()=>{n&&(clearTimeout(n),n=void 0,i(),i=Oc)};return e=>{let d=G(o),f=Date.now()-t,p=()=>a=e();return u(),d<=0?(t=Date.now(),p()):(f>d?(t=Date.now(),(c||!r)&&p()):s&&(a=new Promise((e,a)=>{i=l?a:e,n=setTimeout(()=>{t=Date.now(),r=!0,e(p()),u()},Math.max(0,d-f))})),!c&&!n&&(n=setTimeout(()=>r=!0,d)),r=!1,a)}}function Ic(e=Nc,t={}){let{initialState:n=`active`}=t,r=jc(n===`active`);function i(){r.value=!1}function a(){r.value=!0}return{isActive:tt(r),pause:i,resume:a,eventFilter:(...t)=>{r.value&&e(...t)}}}function Lc(e){let t;function n(){return t||=e(),t}return n.reset=async()=>{let e=t;t=void 0,e&&await e},n}function Rc(e){return e.endsWith(`rem`)?Number.parseFloat(e)*16:Number.parseFloat(e)}function zc(e){return Array.isArray(e)?e:[e]}function Bc(e){let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))}var Vc=/-(\w)/g,Hc=Bc(e=>e.replace(Vc,(e,t)=>t?t.toUpperCase():``));function Uc(e){return e||Qe()}function Wc(e){if(!wc)return e;let t=0,n,r,i=()=>{--t,r&&t<=0&&(r.stop(),n=void 0,r=void 0)};return((...a)=>(t+=1,r||(r=fe(!0),n=r.run(()=>e(...a))),xc(i),n))}function Gc(e,t,{enumerable:n=!1,unwrap:r=!0}={}){for(let[i,a]of Object.entries(t))i!==`value`&&(O(a)&&r?Object.defineProperty(e,i,{get(){return a.value},set(e){a.value=e},enumerable:n}):Object.defineProperty(e,i,{value:a,enumerable:n}));return e}function Kc(e,t){if(typeof Symbol<`u`){let n={...e};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let e=0;return{next:()=>({value:t[e++],done:e>t.length})}}}),n}else return Object.assign([...t],e)}function qc(e){return O(e)?ye(new Proxy({},{get(t,n,r){return K(Reflect.get(e.value,n,r))},set(t,n,r){return O(e.value[n])&&!O(r)?e.value[n].value=r:e.value[n]=r,!0},deleteProperty(t,n){return Reflect.deleteProperty(e.value,n)},has(t,n){return Reflect.has(e.value,n)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}})):ye(e)}function Jc(e){return qc(H(e))}function Yc(e,...t){let n=t.flat(),r=n[0];return Jc(()=>Object.fromEntries(typeof r==`function`?Object.entries(Se(e)).filter(([e,t])=>!r(G(t),e)):Object.entries(Se(e)).filter(e=>!n.includes(e[0]))))}function Xc(e,t=200,n={}){return Mc(Pc(t,n),e)}function Zc(e,t=200,n=!1,r=!0,i=!1){return Mc(Fc(t,n,r,i),e)}function Qc(e,t={}){let n=e,r,i,a=se((e,t)=>(r=e,i=t,{get(){return o()},set(e){s(e)}}));function o(e=!0){return e&&r(),n}function s(e,r=!0){var a;if(e===n)return;let o=n;t.onBeforeChange?.call(t,e,o)!==!1&&(n=e,(a=t.onChanged)==null||a.call(t,e,o),r&&i())}return Gc(a,{get:o,set:s,untrackedGet:()=>o(!1),silentSet:e=>s(e,!1),peek:()=>o(!1),lay:e=>s(e,!1)},{enumerable:!0})}function $c(e,t,n={}){let{eventFilter:r=Nc,...i}=n;return z(e,Mc(r,t),i)}function el(e,t,n={}){let{eventFilter:r,initialState:i=`active`,...a}=n,{eventFilter:o,pause:s,resume:c,isActive:l}=Ic(r,{initialState:i});return{stop:$c(e,t,{...a,eventFilter:o}),pause:s,resume:c,isActive:l}}function tl(e,t={}){if(!O(e))return Se(e);let n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(let r in e.value)n[r]=se(()=>({get(){return e.value[r]},set(n){if(G(t.replaceRef)??!0)if(Array.isArray(e.value)){let t=[...e.value];t[r]=n,e.value=t}else{let t={...e.value,[r]:n};Object.setPrototypeOf(t,Object.getPrototypeOf(e.value)),e.value=t}else e.value[r]=n}}));return n}function nl(e,t=!0,n){Uc(n)?ne(e,n):t?e():Me(e)}function rl(e,t){Uc(t)&&f(e,t)}var il=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,al=/[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|z{1,4}|SSS/g;function ol(e,t,n,r){let i=e<12?`AM`:`PM`;return r&&(i=i.split(``).reduce((e,t)=>e+=`${t}.`,``)),n?i.toLowerCase():i}function sl(e){let t=[`th`,`st`,`nd`,`rd`],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function cl(e,t,n={}){let r=e.getFullYear(),i=e.getMonth(),a=e.getDate(),o=e.getHours(),s=e.getMinutes(),c=e.getSeconds(),l=e.getMilliseconds(),u=e.getDay(),d=n.customMeridiem??ol,f=e=>e.split(` `)[1]??``,p={Yo:()=>sl(r),YY:()=>String(r).slice(-2),YYYY:()=>r,M:()=>i+1,Mo:()=>sl(i+1),MM:()=>`${i+1}`.padStart(2,`0`),MMM:()=>e.toLocaleDateString(G(n.locales),{month:`short`}),MMMM:()=>e.toLocaleDateString(G(n.locales),{month:`long`}),D:()=>String(a),Do:()=>sl(a),DD:()=>`${a}`.padStart(2,`0`),H:()=>String(o),Ho:()=>sl(o),HH:()=>`${o}`.padStart(2,`0`),h:()=>`${o%12||12}`.padStart(1,`0`),ho:()=>sl(o%12||12),hh:()=>`${o%12||12}`.padStart(2,`0`),m:()=>String(s),mo:()=>sl(s),mm:()=>`${s}`.padStart(2,`0`),s:()=>String(c),so:()=>sl(c),ss:()=>`${c}`.padStart(2,`0`),SSS:()=>`${l}`.padStart(3,`0`),d:()=>u,dd:()=>e.toLocaleDateString(G(n.locales),{weekday:`narrow`}),ddd:()=>e.toLocaleDateString(G(n.locales),{weekday:`short`}),dddd:()=>e.toLocaleDateString(G(n.locales),{weekday:`long`}),A:()=>d(o,s),AA:()=>d(o,s,!1,!0),a:()=>d(o,s,!0),aa:()=>d(o,s,!0,!0),z:()=>f(e.toLocaleDateString(G(n.locales),{timeZoneName:`shortOffset`})),zz:()=>f(e.toLocaleDateString(G(n.locales),{timeZoneName:`shortOffset`})),zzz:()=>f(e.toLocaleDateString(G(n.locales),{timeZoneName:`shortOffset`})),zzzz:()=>f(e.toLocaleDateString(G(n.locales),{timeZoneName:`longOffset`}))};return t.replace(al,(e,t)=>t??p[e]?.call(p)??e)}function ll(e){if(e===null)return new Date(NaN);if(e===void 0)return new Date;if(e instanceof Date)return new Date(e);if(typeof e==`string`&&!/Z$/i.test(e)){let t=e.match(il);if(t){let e=t[2]-1||0,n=(t[7]||`0`).substring(0,3);return new Date(t[1],e,t[3]||1,t[4]||0,t[5]||0,t[6]||0,n)}}return new Date(e)}function ul(e,t=`HH:mm:ss`,n={}){return H(()=>cl(ll(G(e)),G(t),n))}function dl(e,t=1e3,n={}){let{immediate:r=!0,immediateCallback:i=!1}=n,a=null,o=W(!1);function s(){a&&=(clearInterval(a),null)}function c(){o.value=!1,s()}function l(){let n=G(t);n<=0||(o.value=!0,i&&e(),s(),o.value&&(a=setInterval(e,n)))}return r&&wc&&l(),(O(t)||typeof t==`function`)&&xc(z(t,()=>{o.value&&wc&&l()})),xc(c),{isActive:tt(o),pause:c,resume:l}}function fl(e,t,n={}){let{immediate:r=!0,immediateCallback:i=!1}=n,a=W(!1),o;function s(){o&&=(clearTimeout(o),void 0)}function c(){a.value=!1,s()}function l(...n){i&&e(),s(),a.value=!0,o=setTimeout(()=>{a.value=!1,o=void 0,e(...n)},G(t))}return r&&(a.value=!0,wc&&l()),xc(c),{isPending:tt(a),start:l,stop:c}}function pl(e,t,n){return z(e,t,{...n,immediate:!0})}function ml(e,t,n){return z(e,t,{...n,once:!0})}function hl(e,t,n={}){let{throttle:r=0,trailing:i=!0,leading:a=!0,...o}=n;return $c(e,t,{...o,eventFilter:Fc(r,i,a)})}function gl(e,t,n){let r=z(e,(e,i,a)=>{e&&(n?.once&&Me(()=>r()),t(e,i,a))},{...n,once:!1});return r}function _l(e,t,n){let r;r=O(n)?{evaluating:n}:n||{};let{lazy:i=!1,flush:a=`sync`,evaluating:o=void 0,shallow:c=!0,onError:l=globalThis.reportError??Oc}=r,u=W(!i),d=c?W(t):s(t),f=0;return dt(async t=>{if(!u.value)return;f++;let n=f,r=!1;o&&Promise.resolve().then(()=>{o.value=!0});try{let i=await e(e=>{t(()=>{o&&(o.value=!1),r||e()})});n===f&&(d.value=i)}catch(e){l(e)}finally{o&&n===f&&(o.value=!1),r=!0}},{flush:a}),i?H(()=>(u.value=!0,d.value)):d}function vl(e={}){let{inheritAttrs:t=!0,name:n=`ReusableTemplate`}=e,r=W(),i=We({name:`${n}.define`,setup(e,{slots:t}){return()=>{r.value=t.default}}}),a=We({inheritAttrs:t,name:`${n}.reuse`,props:e.props,setup(n,{attrs:i,slots:a}){return()=>{if(!r.value)throw Error(`[VueUse] Failed to find the definition of reusable template`);let o=r.value?.call(r,{...e.props==null?yl(i):n,$slots:a});return t&&o?.length===1?o[0]:o}}});return Kc({define:i,reuse:a},[i,a])}function yl(e){let t={};for(let n in e)t[Hc(n)]=e[n];return t}var bl=wc?window:void 0;wc&&window.document;var xl=wc?window.navigator:void 0;wc&&window.location;function Sl(e){let t=G(e);return t?.$el??t}function Cl(...e){let t=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),n=H(()=>{let t=zc(G(e[0])).filter(e=>e!=null);return t.every(e=>typeof e!=`string`)?t:void 0});return pl(()=>[n.value?.map(e=>Sl(e))??[bl].filter(e=>e!=null),zc(G(n.value?e[1]:e[0])),zc(K(n.value?e[2]:e[1])),G(n.value?e[3]:e[2])],([e,n,r,i],a,o)=>{if(!e?.length||!n?.length||!r?.length)return;let s=Dc(i)?{...i}:i,c=e.flatMap(e=>n.flatMap(n=>r.map(r=>t(e,n,r,s))));o(()=>{c.forEach(e=>e())})},{flush:`post`})}var wl=!1;function Tl(e,t,n={}){let{window:r=bl,ignore:i=[],capture:a=!0,detectIframe:o=!1,controls:s=!1}=n;if(!r)return s?{stop:Oc,cancel:Oc,trigger:Oc}:Oc;if(kc&&!wl){wl=!0;let e={passive:!0};Array.from(r.document.body.children).forEach(t=>t.addEventListener(`click`,Oc,e)),r.document.documentElement.addEventListener(`click`,Oc,e)}let c=!0,l=e=>G(i).some(t=>{if(typeof t==`string`)return Array.from(r.document.querySelectorAll(t)).some(t=>t===e.target||e.composedPath().includes(t));{let n=Sl(t);return n&&(e.target===n||e.composedPath().includes(n))}});function u(e){let t=G(e);return t&&t.$.subTree.shapeFlag===16}function d(e,t){let n=G(e),r=n.$.subTree&&n.$.subTree.children;return r==null||!Array.isArray(r)?!1:r.some(e=>e.el===t.target||t.composedPath().includes(e.el))}let f=n=>{let r=Sl(e);if(n.target!=null&&!(!(r instanceof Element)&&u(e)&&d(e,n))&&!(!r||r===n.target||n.composedPath().includes(r))){if(`detail`in n&&n.detail===0&&(c=!l(n)),!c){c=!0;return}t(n)}},p=!1,m=[Cl(r,`click`,e=>{p||(p=!0,setTimeout(()=>{p=!1},0),f(e))},{passive:!0,capture:a}),Cl(r,`pointerdown`,t=>{let n=Sl(e);c=!l(t)&&!!(n&&!t.composedPath().includes(n))},{passive:!0}),o&&Cl(r,`blur`,n=>{setTimeout(()=>{let i=Sl(e),a=r.document.activeElement;for(;a?.shadowRoot;)a=a.shadowRoot.activeElement;a?.tagName===`IFRAME`&&!i?.contains(r.document.activeElement)&&t(n)},0)},{passive:!0})].filter(Boolean),h=()=>m.forEach(e=>e());return s?{stop:h,cancel:()=>{c=!1},trigger:e=>{c=!0,f(e),c=!1}}:h}function El(){let e=W(!1),t=Qe();return t&&ne(()=>{e.value=!0},t),e}function Dl(e){let t=El();return H(()=>(t.value,!!e()))}function Ol(e,t,n={}){let{window:r=bl,...i}=n,a,o=Dl(()=>r&&`MutationObserver`in r),s=()=>{a&&=(a.disconnect(),void 0)},c=z(H(()=>{let t=zc(G(e)).map(Sl).filter(Tc);return new Set(t)}),e=>{s(),o.value&&e.size&&(a=new MutationObserver(t),e.forEach(e=>a.observe(e,i)))},{immediate:!0,flush:`post`}),l=()=>a?.takeRecords(),u=()=>{c(),s()};return xc(u),{isSupported:o,stop:u,takeRecords:l}}function kl(e,t,n={}){let{window:r=bl,document:i=r?.document,flush:a=`sync`}=n;if(!r||!i)return Oc;let o,s=e=>{o?.(),o=e},c=dt(()=>{let n=Sl(e);if(n){let{stop:e}=Ol(i,e=>{e.map(e=>[...e.removedNodes]).flat().some(e=>e===n||e.contains(n))&&t(e)},{window:r,childList:!0,subtree:!0});s(e)}},{flush:a}),l=()=>{c(),s()};return xc(l),l}function Al(e){return typeof e==`function`?e:typeof e==`string`?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function jl(...e){let t,n,r={};e.length===3?(t=e[0],n=e[1],r=e[2]):e.length===2?typeof e[1]==`object`?(t=!0,n=e[0],r=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);let{target:i=bl,eventName:a=`keydown`,passive:o=!1,dedupe:s=!1}=r,c=Al(t);return Cl(i,a,e=>{e.repeat&&G(s)||c(e)&&n(e)},o)}var Ml=500,Nl=10;function Pl(e,t,n){var r,i;let a=H(()=>Sl(e)),o,s,c,l=!1;function u(){o&&=(clearTimeout(o),void 0),s=void 0,c=void 0,l=!1}function d(e){let t=n?.delay;return typeof t==`function`?t(e):t??Ml}function f(e){var t,r,i;let[o,d,f]=[c,s,l];if(u(),!n?.onMouseUp||!d||!o||!(n==null||(t=n.modifiers)==null)&&t.self&&e.target!==a.value)return;!(n==null||(r=n.modifiers)==null)&&r.prevent&&e.preventDefault(),!(n==null||(i=n.modifiers)==null)&&i.stop&&e.stopPropagation();let p=e.x-d.x,m=e.y-d.y,h=Math.sqrt(p*p+m*m);n.onMouseUp(e.timeStamp-o,h,f,e)}function p(e){var r,i,f;!(n==null||(r=n.modifiers)==null)&&r.self&&e.target!==a.value||(u(),!(n==null||(i=n.modifiers)==null)&&i.prevent&&e.preventDefault(),!(n==null||(f=n.modifiers)==null)&&f.stop&&e.stopPropagation(),s={x:e.x,y:e.y},c=e.timeStamp,o=setTimeout(()=>{l=!0,t(e)},d(e)))}function m(e){var t,r,i;if(!(n==null||(t=n.modifiers)==null)&&t.self&&e.target!==a.value||!s||n?.distanceThreshold===!1)return;!(n==null||(r=n.modifiers)==null)&&r.prevent&&e.preventDefault(),!(n==null||(i=n.modifiers)==null)&&i.stop&&e.stopPropagation();let o=e.x-s.x,c=e.y-s.y;Math.sqrt(o*o+c*c)>=(n?.distanceThreshold??Nl)&&u()}let h={capture:n==null||(r=n.modifiers)==null?void 0:r.capture,once:n==null||(i=n.modifiers)==null?void 0:i.once},g=[Cl(a,`pointerdown`,p,h),Cl(a,`pointermove`,m,h),Cl(a,[`pointerup`,`pointerleave`],f,h)];return()=>g.forEach(e=>e())}function Fl(e,t={}){let{immediate:n=!0,fpsLimit:r=null,window:i=bl,once:a=!1}=t,o=W(!1),s=H(()=>{let e=G(r);return e?1e3/e:null}),c=0,l=null;function u(t){if(!o.value||!i)return;c||=t;let n=t-c;if(s.value&&n<s.value){l=i.requestAnimationFrame(u);return}if(c=t,e({delta:n,timestamp:t}),a){o.value=!1,l=null;return}l=i.requestAnimationFrame(u)}function d(){!o.value&&i&&(o.value=!0,c=0,l=i.requestAnimationFrame(u))}function f(){o.value=!1,l!=null&&i&&(i.cancelAnimationFrame(l),l=null)}return n&&d(),xc(f),{isActive:tt(o),pause:f,resume:d}}var Il=Symbol(`vueuse-ssr-width`);function Ll(){let e=rt()?Cc(Il,null):null;return typeof e==`number`?e:void 0}function Rl(e,t={}){let{window:n=bl,ssrWidth:r=Ll()}=t,i=Dl(()=>n&&`matchMedia`in n&&typeof n.matchMedia==`function`),a=W(typeof r==`number`),o=W(),s=W(!1);return dt(()=>{if(a.value){a.value=!i.value,s.value=G(e).split(`,`).some(e=>{let t=e.includes(`not all`),n=e.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),i=e.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),a=!!(n||i);return n&&a&&(a=r>=Rc(n[1])),i&&a&&(a=r<=Rc(i[1])),t?!a:a});return}i.value&&(o.value=n.matchMedia(G(e)),s.value=o.value.matches)}),Cl(o,`change`,e=>{s.value=e.matches},{passive:!0}),H(()=>s.value)}function zl(e,t={}){let{controls:n=!1,navigator:r=xl}=t,i=Dl(()=>r&&`permissions`in r),a=W(),o=typeof e==`string`?{name:e}:e,s=W(),c=()=>{s.value=a.value?.state??`prompt`};Cl(a,`change`,c,{passive:!0});let l=Lc(async()=>{if(i.value){if(!a.value)try{a.value=await r.permissions.query(o)}catch{a.value=void 0}finally{c()}if(n)return Xe(a.value)}});return l(),n?{state:s,isSupported:i,query:l}:s}function Bl(e={}){let{navigator:t=xl,read:n=!1,source:r,copiedDuring:i=1500,legacy:a=!1}=e,o=Dl(()=>t&&`clipboard`in t),s=zl(`clipboard-read`),c=zl(`clipboard-write`),l=H(()=>o.value||a),u=W(``),d=W(!1),f=W(!1),p=fl(()=>d.value=!1,i,{immediate:!1}),m=0;async function h(){let e=!(o.value&&b(s.value));if(!e)try{u.value=await t.clipboard.readText()}catch{e=!0}e&&(u.value=y())}l.value&&n&&Cl([`copy`,`cut`],h,{passive:!0});async function g(e){let n=e??G(r);if(l.value&&n!=null){f.value=!0;let e=!(o.value&&b(c.value));if(!e)try{let e=_(n);await t.clipboard.write([e])}catch{e=!0}if(e)if(typeof n==`string`)u.value=n,v(n);else{let e=++m,t=await n();t!=null&&e===m&&(u.value=t,v(t))}d.value=!0,p.start(),f.value=!1}}function _(e){return typeof e==`string`?(u.value=e,new ClipboardItem({"text/plain":e})):new ClipboardItem({"text/plain":e().then((e=``)=>(u.value=e,new Blob([e],{type:`text/plain`})))})}function v(e){let t=document.createElement(`textarea`);t.value=e,t.style.position=`absolute`,t.style.opacity=`0`,t.setAttribute(`readonly`,``),document.body.appendChild(t),t.select(),document.execCommand(`copy`),t.remove()}function y(){var e,t;return((e=document)==null||(t=e.getSelection)==null||(t=t.call(e))==null?void 0:t.toString())??``}function b(e){return e===`granted`||e===`prompt`}return{copyPending:tt(f),isSupported:l,text:tt(u),copied:tt(d),copy:g}}var Vl=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},Hl=`__vueuse_ssr_handlers__`,Ul=Wl();function Wl(){return Hl in Vl||(Vl[Hl]=Vl[Hl]||{}),Vl[Hl]}function Gl(e,t){return Ul[e]||t}function Kl(e){return e==null?`any`:e instanceof Set?`set`:e instanceof Map?`map`:e instanceof Date?`date`:typeof e==`boolean`?`boolean`:typeof e==`string`?`string`:typeof e==`object`?`object`:Number.isNaN(e)?`any`:`number`}var ql={boolean:{read:e=>e===`true`,write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},Jl=`vueuse-storage`;function Yl(e,t,n,r={}){let{flush:i=`pre`,deep:a=!0,listenToStorageChanges:o=!0,writeDefaults:c=!0,mergeDefaults:l=!1,shallow:u,window:d=bl,eventFilter:f,onError:p=e=>{console.error(e)},initOnMounted:m}=r,h=(u?W:s)(typeof t==`function`?t():t),g=H(()=>G(e));if(!n)try{n=Gl(`getDefaultStorage`,()=>bl?.localStorage)()}catch(e){p(e)}if(!n)return h;let _=G(t),v=Kl(_),y=r.serializer??ql[v],{pause:b,resume:x}=el(h,e=>w(e),{flush:i,deep:a,eventFilter:f});z(g,()=>E(),{flush:i});let S=!1;d&&o&&(n instanceof Storage?Cl(d,`storage`,e=>{m&&!S||E(e)},{passive:!0}):Cl(d,Jl,e=>{m&&!S||D(e)})),m?nl(()=>{S=!0,E()}):E();function C(e,t){if(d){let r={key:g.value,oldValue:e,newValue:t,storageArea:n};d.dispatchEvent(n instanceof Storage?new StorageEvent(`storage`,r):new CustomEvent(Jl,{detail:r}))}}function w(e){try{let t=n.getItem(g.value);if(e==null)C(t,null),n.removeItem(g.value);else{let r=y.write(e);t!==r&&(n.setItem(g.value,r),C(t,r))}}catch(e){p(e)}}function T(e){let t=e?e.newValue:n.getItem(g.value);if(t==null)return c&&_!=null&&n.setItem(g.value,y.write(_)),_;if(!e&&l){let e=y.read(t);return typeof l==`function`?l(e,_):v===`object`&&!Array.isArray(e)?{..._,...e}:e}else if(typeof t!=`string`)return t;else return y.read(t)}function E(e){if(!(e&&e.storageArea!==n)){if(e&&e.key==null){h.value=_;return}if(!(e&&e.key!==g.value)){b();try{let t=y.write(h.value);(e===void 0||e?.newValue!==t)&&(h.value=T(e))}catch(e){p(e)}finally{e?Me(x):x()}}}}function D(e){E(e.detail)}return h}var Xl={speed:2,margin:30,direction:`both`};function Zl(e){e.scrollLeft>e.scrollWidth-e.clientWidth&&(e.scrollLeft=Math.max(0,e.scrollWidth-e.clientWidth)),e.scrollTop>e.scrollHeight-e.clientHeight&&(e.scrollTop=Math.max(0,e.scrollHeight-e.clientHeight))}function Ql(e,t={}){let{pointerTypes:n,preventDefault:r,stopPropagation:i,exact:a,onMove:o,onEnd:c,onStart:l,initialValue:u,axis:d=`both`,draggingElement:f=bl,containerElement:p,handle:m=e,buttons:h=[0],restrictInView:g,autoScroll:_=!1}=t,v=s(G(u)??{x:0,y:0}),y=s(),b=e=>n?n.includes(e.pointerType):!0,x=e=>{G(r)&&e.preventDefault(),G(i)&&e.stopPropagation()},S=G(_),C=typeof S==`object`?{speed:G(S.speed)??Xl.speed,margin:G(S.margin)??Xl.margin,direction:S.direction??Xl.direction}:Xl,w=e=>typeof e==`number`?[e,e]:[e.x,e.y],T=(e,t,n)=>{let{clientWidth:r,clientHeight:i,scrollLeft:a,scrollTop:o,scrollWidth:s,scrollHeight:c}=e,[l,u]=w(C.margin),[d,f]=w(C.speed),p=0,m=0;(C.direction===`x`||C.direction===`both`)&&(n.x<l&&a>0?p=-d:n.x+t.width>r-l&&a<s-r&&(p=d)),(C.direction===`y`||C.direction===`both`)&&(n.y<u&&o>0?m=-f:n.y+t.height>i-u&&o<c-i&&(m=f)),(p||m)&&e.scrollBy({left:p,top:m,behavior:`auto`})},E=null,D=()=>{let t=G(p);t&&!E&&(E=setInterval(()=>{let n=G(e).getBoundingClientRect(),{x:r,y:i}=v.value,a={x:r-t.scrollLeft,y:i-t.scrollTop};a.x>=0&&a.y>=0&&(T(t,n,a),a.x+=t.scrollLeft,a.y+=t.scrollTop,v.value=a)},1e3/60))},O=()=>{E&&=(clearInterval(E),null)},k=(e,t,n,r)=>{let[i,a]=typeof n==`number`?[n,n]:[n.x,n.y],{clientWidth:o,clientHeight:s}=t;return e.x<i||e.x+r.width>o-i||e.y<a||e.y+r.height>s-a};G(_)&&z(v,()=>{if(G(t.disabled)||!y.value)return;let n=G(p);if(!n)return;let r=G(e).getBoundingClientRect(),{x:i,y:a}=v.value;k({x:i-n.scrollLeft,y:a-n.scrollTop},n,C.margin,r)?D():O()});let A=n=>{var r;if(!G(h).includes(n.button)||G(t.disabled)||!b(n)||G(a)&&n.target!==G(e))return;let i=G(p),o=i==null||(r=i.getBoundingClientRect)==null?void 0:r.call(i),s=G(e).getBoundingClientRect(),c={x:n.clientX-(i?s.left-o.left+(_?0:i.scrollLeft):s.left),y:n.clientY-(i?s.top-o.top+(_?0:i.scrollTop):s.top)};l?.(c,n)!==!1&&(y.value=c,x(n))},j=n=>{if(G(t.disabled)||!b(n)||!y.value)return;let r=G(p);r instanceof HTMLElement&&Zl(r);let i=G(e).getBoundingClientRect(),{x:a,y:s}=v.value;if((d===`x`||d===`both`)&&(a=n.clientX-y.value.x,r&&(a=Math.min(Math.max(0,a),r.scrollWidth-i.width))),(d===`y`||d===`both`)&&(s=n.clientY-y.value.y,r&&(s=Math.min(Math.max(0,s),r.scrollHeight-i.height))),G(_)&&r&&(E===null&&T(r,i,{x:a,y:s}),a+=r.scrollLeft,s+=r.scrollTop),r&&(g||_)){if(d!==`y`){let e=a-r.scrollLeft;e<0?a=r.scrollLeft:e>r.clientWidth-i.width&&(a=r.clientWidth-i.width+r.scrollLeft)}if(d!==`x`){let e=s-r.scrollTop;e<0?s=r.scrollTop:e>r.clientHeight-i.height&&(s=r.clientHeight-i.height+r.scrollTop)}}v.value={x:a,y:s},o?.(v.value,n),x(n)},M=e=>{G(t.disabled)||!b(e)||y.value&&(y.value=void 0,_&&O(),c?.(v.value,e),x(e))};if(wc){let e=()=>({capture:t.capture??!0,passive:!G(r)});Cl(m,`pointerdown`,A,e),Cl(f,`pointermove`,j,e),Cl(f,`pointerup`,M,e)}return{...tl(v),position:v,isDragging:H(()=>!!y.value),style:H(()=>`
|
|
11
|
-
left: ${v.value.x}px;
|
|
12
|
-
top: ${v.value.y}px;
|
|
13
|
-
${_?`text-wrap: nowrap;`:``}
|
|
14
|
-
`)}}function $l(e,t,n={}){let{window:r=bl,...i}=n,a,o=Dl(()=>r&&`ResizeObserver`in r),s=()=>{a&&=(a.disconnect(),void 0)},c=z(H(()=>{let t=G(e);return Array.isArray(t)?t.map(e=>Sl(e)):[Sl(t)]}),e=>{if(s(),o.value&&r){a=new ResizeObserver(t);for(let t of e)t&&a.observe(t,i)}},{immediate:!0,flush:`post`}),l=()=>{s(),c()};return xc(l),{isSupported:o,stop:l}}function eu(e,t={}){let{reset:n=!0,windowResize:r=!0,windowScroll:i=!0,immediate:a=!0,updateTiming:o=`sync`}=t,s=W(0),c=W(0),l=W(0),u=W(0),d=W(0),f=W(0),p=W(0),m=W(0);function h(){let t=Sl(e);if(!t){n&&(s.value=0,c.value=0,l.value=0,u.value=0,d.value=0,f.value=0,p.value=0,m.value=0);return}let r=t.getBoundingClientRect();s.value=r.height,c.value=r.bottom,l.value=r.left,u.value=r.right,d.value=r.top,f.value=r.width,p.value=r.x,m.value=r.y}function g(){o===`sync`?h():o===`next-frame`&&requestAnimationFrame(()=>h())}return $l(e,g),z(()=>Sl(e),e=>!e&&g()),Ol(e,g,{attributeFilter:[`style`,`class`]}),i&&Cl(`scroll`,g,{capture:!0,passive:!0}),r&&Cl(`resize`,g,{passive:!0}),nl(()=>{a&&g()}),{height:s,bottom:c,left:l,right:u,top:d,width:f,x:p,y:m,update:g}}function tu(e,t={}){let{delayEnter:n=0,delayLeave:r=0,triggerOnRemoval:i=!1,window:a=bl}=t,o=W(!1),s,c=e=>{let t=e?n:r;s&&=(clearTimeout(s),void 0),t?s=setTimeout(()=>o.value=e,t):o.value=e};return a?(Cl(e,`mouseenter`,()=>c(!0),{passive:!0}),Cl(e,`mouseleave`,()=>c(!1),{passive:!0}),i&&kl(H(()=>Sl(e)),()=>c(!1)),o):o}function nu(e,t={width:0,height:0},n={}){let{window:r=bl,box:i=`content-box`}=n,a=H(()=>{var t;return(t=Sl(e))==null||(t=t.namespaceURI)==null?void 0:t.includes(`svg`)}),o=W(t.width),s=W(t.height),{stop:c}=$l(e,([t])=>{let n=i===`border-box`?t.borderBoxSize:i===`content-box`?t.contentBoxSize:t.devicePixelContentBoxSize;if(r&&a.value){let t=Sl(e);if(t){let e=t.getBoundingClientRect();o.value=e.width,s.value=e.height}}else if(n){let e=zc(n);o.value=e.reduce((e,{inlineSize:t})=>e+t,0),s.value=e.reduce((e,{blockSize:t})=>e+t,0)}else o.value=t.contentRect.width,s.value=t.contentRect.height},n);nl(()=>{let n=Sl(e);n&&(o.value=`offsetWidth`in n?n.offsetWidth:t.width,s.value=`offsetHeight`in n?n.offsetHeight:t.height)});let l=z(()=>Sl(e),e=>{o.value=e?t.width:0,s.value=e?t.height:0});function u(){c(),l()}return{width:o,height:s,stop:u}}function ru(e,t,n={}){let{root:r,rootMargin:i,threshold:a=0,window:o=bl,immediate:s=!0}=n,c=Dl(()=>o&&`IntersectionObserver`in o),l=H(()=>zc(G(e)).map(Sl).filter(Tc)),u=Oc,d=W(s),f=c.value?z(()=>[l.value,Sl(r),G(i),d.value],([e,n,r])=>{if(u(),!d.value||!e.length)return;let i=new IntersectionObserver(t,{root:Sl(n),rootMargin:r,threshold:a});e.forEach(e=>e&&i.observe(e)),u=()=>{i.disconnect(),u=Oc}},{immediate:s,flush:`post`}):Oc,p=()=>{u(),f(),d.value=!1};return xc(p),{isSupported:c,isActive:d,pause(){u(),d.value=!1},resume(){d.value=!0},stop:p}}function iu(e,t={}){let{window:n=bl,scrollTarget:r,threshold:i=0,rootMargin:a,once:o=!1,initialValue:s=!1}=t,c=W(s),l=ru(e,e=>{let t=c.value,n=0;for(let r of e)r.time>=n&&(n=r.time,t=r.isIntersecting);c.value=t,o&&ml(c,()=>{l.stop()})},{root:r,window:n,threshold:i,rootMargin:a});return t.controls?{...l,isVisible:c}:c}var au=new Map;function ou(e){let t=b();function n(n){var r;let a=au.get(e)||new Set;a.add(n),au.set(e,a);let o=()=>i(n);return t==null||(r=t.cleanups)==null||r.push(o),o}function r(e){function t(...n){i(t),e(...n)}return n(t)}function i(t){let n=au.get(e);n&&(n.delete(t),n.size||a())}function a(){au.delete(e)}function o(t,n){var r;(r=au.get(e))==null||r.forEach(e=>e(t,n))}return{on:n,once:r,off:i,emit:o,reset:a}}function su(e){return typeof Window<`u`&&e instanceof Window?e.document.documentElement:typeof Document<`u`&&e instanceof Document?e.documentElement:e}var cu=1;function lu(e,t={}){let{throttle:n=0,idle:r=200,onStop:i=Oc,onScroll:a=Oc,offset:o={left:0,right:0,top:0,bottom:0},observe:s={mutation:!1},eventListenerOptions:c={capture:!1,passive:!0},behavior:l=`auto`,window:u=bl,onError:d=e=>{console.error(e)}}=t,f=typeof s==`boolean`?{mutation:s}:s,p=W(0),m=W(0),h=H({get(){return p.value},set(e){_(e,void 0)}}),g=H({get(){return m.value},set(e){_(void 0,e)}});function _(t,n){var r,i;if(!u)return;let a=G(e);if(!a)return;(r=a instanceof Document?u.document.body:a)==null||r.scrollTo({top:G(n)??g.value,left:G(t)??h.value,behavior:G(l)});let o=(a==null||(i=a.document)==null?void 0:i.documentElement)||a?.documentElement||a;h!=null&&(p.value=o.scrollLeft),g!=null&&(m.value=o.scrollTop)}let v=W(!1),y=ye({left:!0,right:!1,top:!0,bottom:!1}),b=ye({left:!1,right:!1,top:!1,bottom:!1}),x=e=>{v.value&&(v.value=!1,b.left=!1,b.right=!1,b.top=!1,b.bottom=!1,i(e))},S=Xc(x,n+r),C=e=>{var t;if(!u)return;let n=(e==null||(t=e.document)==null?void 0:t.documentElement)||e?.documentElement||Sl(e),{display:r,flexDirection:i,direction:a}=u.getComputedStyle(n),s=a===`rtl`?-1:1,c=n.scrollLeft;b.left=c<p.value,b.right=c>p.value;let l=Math.abs(c*s)<=(o.left||0),d=Math.abs(c*s)+n.clientWidth>=n.scrollWidth-(o.right||0)-cu;r===`flex`&&i===`row-reverse`?(y.left=d,y.right=l):(y.left=l,y.right=d),p.value=c;let f=n.scrollTop;e===u.document&&!f&&(f=u.document.body.scrollTop),b.top=f<m.value,b.bottom=f>m.value;let h=Math.abs(f)<=(o.top||0),g=Math.abs(f)+n.clientHeight>=n.scrollHeight-(o.bottom||0)-cu;r===`flex`&&i===`column-reverse`?(y.top=g,y.bottom=h):(y.top=h,y.bottom=g),m.value=f},w=e=>{u&&(C(e.target.documentElement??e.target),v.value=!0,S(e),a(e))};return Cl(e,`scroll`,n?Zc(w,n,!0,!1):w,c),nl(()=>{try{let t=G(e);if(!t)return;C(t)}catch(e){d(e)}}),f?.mutation&&e!=null&&e!==u&&e!==document&&Ol(e,()=>{let t=G(e);t&&C(t)},{attributes:!0,childList:!0,subtree:!0}),Cl(e,`scrollend`,x,c),{x:h,y:g,isScrolling:v,arrivedState:y,directions:b,measure(){let t=G(e);u&&t&&C(t)}}}function uu(e,t,n={}){let{direction:r=`bottom`,interval:i=100,canLoadMore:a=()=>!0}=n,o=ye(lu(e,{...n,offset:{[r]:n.distance??0,...n.offset}})),s=W(),c=H(()=>!!s.value),l=H(()=>su(G(e))),u=iu(l),d=H(()=>l.value?a(l.value):!1);function f(){if(o.measure(),!l.value||!u.value||!d.value||s.value)return;let{scrollHeight:e,clientHeight:n,scrollWidth:a,clientWidth:c}=l.value,p=r===`bottom`||r===`top`?e<=n:a<=c;(o.arrivedState[r]||p)&&(s.value=Promise.all([t(o),new Promise(e=>setTimeout(e,i))]).finally(()=>{s.value=null,Me(()=>f())}))}return rl(z(()=>[o.arrivedState[r],u.value,d.value],f,{immediate:!0,flush:`post`})),{isLoading:c,reset(){Me(()=>f())}}}function du(e,t,n={}){let{window:r=bl}=n;return Yl(e,t,r?.localStorage,n)}var fu={page:e=>[e.pageX,e.pageY],client:e=>[e.clientX,e.clientY],screen:e=>[e.screenX,e.screenY],movement:e=>e instanceof MouseEvent?[e.movementX,e.movementY]:null};function pu(e={}){let{type:t=`page`,touch:n=!0,resetOnTouchEnds:r=!1,initialValue:i={x:0,y:0},window:a=bl,target:o=a,scroll:s=!0,eventFilter:c}=e,l=null,u=0,d=0,f=W(i.x),p=W(i.y),m=W(null),h=typeof t==`function`?t:fu[t],g=e=>{let t=h(e);l=e,t&&([f.value,p.value]=t,m.value=`mouse`),a&&(u=a.scrollX,d=a.scrollY)},_=e=>{if(e.touches.length>0){let t=h(e.touches[0]);t&&([f.value,p.value]=t,m.value=`touch`)}},v=()=>{if(!l||!a)return;let e=h(l);l instanceof MouseEvent&&e&&(f.value=e[0]+a.scrollX-u,p.value=e[1]+a.scrollY-d)},y=()=>{f.value=i.x,p.value=i.y},b=c?e=>c(()=>g(e),{}):e=>g(e),x=c?e=>c(()=>_(e),{}):e=>_(e),S=c?()=>c(()=>v(),{}):()=>v();if(o){let e={passive:!0};Cl(o,[`mousemove`,`dragover`],b,e),n&&t!==`movement`&&(Cl(o,[`touchstart`,`touchmove`],x,e),r&&Cl(o,`touchend`,y,e)),s&&t===`page`&&Cl(a,`scroll`,S,e)}return{x:f,y:p,sourceType:m}}function mu(e,t={}){let{windowResize:n=!0,windowScroll:r=!0,handleOutside:i=!0,window:a=bl}=t,o=t.type||`page`,{x:s,y:c,sourceType:l}=pu(t),u=W(e??a?.document.body),d=W(0),f=W(0),p=W(0),m=W(0),h=W(0),g=W(0),_=W(!0);function v(){if(!a)return;let e=Sl(u);if(!(!e||!(e instanceof Element)))for(let t of e.getClientRects()){let{left:e,top:n,width:r,height:l}=t;p.value=e+(o===`page`?a.pageXOffset:0),m.value=n+(o===`page`?a.pageYOffset:0),h.value=l,g.value=r;let u=s.value-p.value,v=c.value-m.value;if(_.value=r===0||l===0||u<0||v<0||u>r||v>l,(i||!_.value)&&(d.value=u,f.value=v),!_.value)break}}let y=[];function b(){y.forEach(e=>e()),y.length=0}if(nl(()=>{v()}),a){let{stop:e}=$l(u,v),{stop:t}=Ol(u,v,{attributeFilter:[`style`,`class`]}),i=z([u,s,c],v);y.push(e,t,i),Cl(document,`mouseleave`,()=>_.value=!0,{passive:!0}),r&&y.push(Cl(`scroll`,v,{capture:!0,passive:!0})),n&&y.push(Cl(`resize`,v,{passive:!0}))}return{x:s,y:c,sourceType:l,elementX:d,elementY:f,elementPositionX:p,elementPositionY:m,elementHeight:h,elementWidth:g,isOutside:_,stop:b}}function hu(e={}){let{touch:t=!0,drag:n=!0,capture:r=!1,initialValue:i=!1,window:a=bl}=e,o=W(i),s=W(null);if(!a)return{pressed:o,sourceType:s};let c=t=>n=>{var r;o.value=!0,s.value=t,(r=e.onPressed)==null||r.call(e,n)},l=t=>{var n;o.value=!1,s.value=null,(n=e.onReleased)==null||n.call(e,t)},u=H(()=>Sl(e.target)||a),d={passive:!0,capture:r};return Cl(u,`mousedown`,c(`mouse`),d),Cl(a,`mouseleave`,l,d),Cl(a,`mouseup`,l,d),n&&(Cl(u,`dragstart`,c(`mouse`),d),Cl(a,`drop`,l,d),Cl(a,`dragend`,l,d)),t&&(Cl(u,`touchstart`,c(`touch`),d),Cl(a,`touchend`,l,d),Cl(a,`touchcancel`,l,d)),{pressed:o,sourceType:s}}function gu(e){if(`interval`in e||`immediate`in e){let{interval:t=`requestAnimationFrame`,immediate:n=!0}=e;return t===`requestAnimationFrame`?e=>Fl(e,{immediate:n}):n=>dl(n,t,e)}return Fl}function _u(e={}){let{controls:t=!1,scheduler:n=gu(e)}=e,r=W(new Date),i=n(()=>r.value=new Date);return t?{now:r,...i}:r}function vu(e={}){let{window:t=bl}=e,n=Dl(()=>t&&`screen`in t&&`orientation`in t.screen),r=n.value?t.screen.orientation:{},i=W(r.type),a=W(r.angle||0);return n.value&&Cl(t,`orientationchange`,()=>{i.value=r.type,a.value=r.angle},{passive:!0}),{isSupported:n,orientation:i,angle:a,lockOrientation:e=>n.value&&typeof r.lock==`function`?r.lock(e):Promise.reject(Error(`Not supported`)),unlockOrientation:()=>{n.value&&typeof r.unlock==`function`&&r.unlock()}}}function yu(e,t={}){let n=jc(e),{threshold:r=50,onSwipe:i,onSwipeEnd:a,onSwipeStart:o,disableTextSelect:s=!1}=t,c=ye({x:0,y:0}),l=(e,t)=>{c.x=e,c.y=t},u=ye({x:0,y:0}),d=(e,t)=>{u.x=e,u.y=t},f=H(()=>c.x-u.x),p=H(()=>c.y-u.y),{max:m,abs:h}=Math,g=H(()=>m(h(f.value),h(p.value))>=r),_=W(!1),v=W(!1),y=H(()=>g.value?h(f.value)>h(p.value)?f.value>0?`left`:`right`:p.value>0?`up`:`down`:`none`),b=e=>{let n=e.buttons===0,r=e.buttons===1;return t.pointerTypes?.includes(e.pointerType)??(n||r)??!0},x={passive:!0},S=[Cl(e,`pointerdown`,e=>{if(!b(e))return;v.value=!0,e.target?.setPointerCapture(e.pointerId);let{clientX:t,clientY:n}=e;l(t,n),d(t,n),o?.(e)},x),Cl(e,`pointermove`,e=>{if(!b(e)||!v.value)return;let{clientX:t,clientY:n}=e;d(t,n),!_.value&&g.value&&(_.value=!0),_.value&&i?.(e)},x),Cl(e,`pointerup`,e=>{b(e)&&(_.value&&a?.(e,y.value),v.value=!1,_.value=!1)},x)];return nl(()=>{var e;if((e=n.value)==null||(e=e.style)==null||e.setProperty(`touch-action`,`pan-y`),s){var t,r,i;(t=n.value)==null||(t=t.style)==null||t.setProperty(`-webkit-user-select`,`none`),(r=n.value)==null||(r=r.style)==null||r.setProperty(`-ms-user-select`,`none`),(i=n.value)==null||(i=i.style)==null||i.setProperty(`user-select`,`none`)}}),{isSwiping:tt(_),direction:tt(y),posStart:L(c),posEnd:L(u),distanceX:f,distanceY:p,stop:()=>S.forEach(e=>e())}}function bu(e){let t=window.getComputedStyle(e);if(t.overflowX===`scroll`||t.overflowY===`scroll`||t.overflowX===`auto`&&e.clientWidth<e.scrollWidth||t.overflowY===`auto`&&e.clientHeight<e.scrollHeight)return!0;{let t=e.parentNode;return!t||t.tagName===`BODY`?!1:bu(t)}}function xu(e){let t=e||window.event,n=t.target;return bu(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.preventDefault(),!1)}var Su=new WeakMap;function Cu(e,t=!1){let n=W(t),r=null,i=``;z(jc(e),e=>{let t=su(G(e));if(t){let e=t;if(Su.get(e)||Su.set(e,e.style.overflow),e.style.overflow!==`hidden`&&(i=e.style.overflow),e.style.overflow===`hidden`)return n.value=!0;if(n.value)return e.style.overflow=`hidden`}},{immediate:!0});let a=()=>{let t=su(G(e));!t||n.value||(kc&&(r=Cl(t,`touchmove`,e=>{xu(e)},{passive:!1})),t.style.overflow=`hidden`,n.value=!0)},o=()=>{let t=su(G(e));!t||!n.value||(kc&&r?.(),t.style.overflow=i,Su.delete(t),n.value=!1)};return xc(o),H({get(){return n.value},set(e){e?a():o()}})}function wu(e,t,n={}){let{window:r=bl}=n;return Yl(e,t,r?.sessionStorage,n)}function Tu(e,t={}){let{threshold:n=50,onSwipe:r,onSwipeEnd:i,onSwipeStart:a,passive:o=!0}=t,s=ye({x:0,y:0}),c=ye({x:0,y:0}),l=H(()=>s.x-c.x),u=H(()=>s.y-c.y),{max:d,abs:f}=Math,p=H(()=>d(f(l.value),f(u.value))>=n),m=W(!1),h=H(()=>p.value?f(l.value)>f(u.value)?l.value>0?`left`:`right`:u.value>0?`up`:`down`:`none`),g=e=>[e.touches[0].clientX,e.touches[0].clientY],_=(e,t)=>{s.x=e,s.y=t},v=(e,t)=>{c.x=e,c.y=t},y={passive:o,capture:!o},b=[Cl(e,`touchstart`,e=>{if(e.touches.length!==1)return;let[t,n]=g(e);_(t,n),v(t,n),a?.(e)},y),Cl(e,`touchmove`,e=>{if(e.touches.length!==1)return;let[t,n]=g(e);v(t,n),y.capture&&!y.passive&&Math.abs(l.value)>Math.abs(u.value)&&e.preventDefault(),!m.value&&p.value&&(m.value=!0),m.value&&r?.(e)},y),Cl(e,[`touchend`,`touchcancel`],e=>{m.value&&i?.(e,h.value),m.value=!1},y)];return{isSwiping:m,direction:h,coordsStart:s,coordsEnd:c,lengthX:l,lengthY:u,stop:()=>b.forEach(e=>e())}}var Eu=[{max:6e4,value:1e3,name:`second`},{max:276e4,value:6e4,name:`minute`},{max:72e6,value:36e5,name:`hour`},{max:5184e5,value:864e5,name:`day`},{max:24192e5,value:6048e5,name:`week`},{max:28512e6,value:2592e6,name:`month`},{max:1/0,value:31536e6,name:`year`}],Du={justNow:`just now`,past:e=>/\d/.test(e)?`${e} ago`:e,future:e=>/\d/.test(e)?`in ${e}`:e,month:(e,t)=>e===1?t?`last month`:`next month`:`${e} month${e>1?`s`:``}`,year:(e,t)=>e===1?t?`last year`:`next year`:`${e} year${e>1?`s`:``}`,day:(e,t)=>e===1?t?`yesterday`:`tomorrow`:`${e} day${e>1?`s`:``}`,week:(e,t)=>e===1?t?`last week`:`next week`:`${e} week${e>1?`s`:``}`,hour:e=>`${e} hour${e>1?`s`:``}`,minute:e=>`${e} minute${e>1?`s`:``}`,second:e=>`${e} second${e>1?`s`:``}`,invalid:``};function Ou(e){return e.toISOString().slice(0,10)}function ku(e){if(`updateInterval`in e){let{updateInterval:t=3e4}=e;return e=>dl(e,t)}return e=>dl(e,3e4)}function Au(e,t={}){let{controls:n=!1,scheduler:r=ku(t)}=t,{now:i,...a}=_u({scheduler:r,controls:!0}),o=H(()=>ju(new Date(G(e)),t,G(i)));return n?{timeAgo:o,...a}:o}function ju(e,t={},n=Date.now()){let{max:r,messages:i=Du,fullDateFormatter:a=Ou,units:o=Eu,showSecond:s=!1,rounding:c=`round`}=t,l=typeof c==`number`?e=>+e.toFixed(c):Math[c],u=n-+e,d=Math.abs(u);function f(e,t){return l(Math.abs(e)/t.value)}function p(e,t){let n=f(e,t),r=e>0,i=m(t.name,n,r);return m(r?`past`:`future`,i,r)}function m(e,t,n){let r=i[e];return typeof r==`function`?r(t,n):r.replace(`{0}`,t.toString())}if(d<6e4&&!s)return i.justNow;if(typeof r==`number`&&d>r)return a(new Date(e));if(typeof r==`string`){let t=o.find(e=>e.name===r)?.max;if(t&&d>t)return a(new Date(e))}for(let[e,t]of o.entries()){if(f(u,t)<=0&&o[e-1])return p(u,o[e-1]);if(d<t.max)return p(u,t)}return i.invalid}function Mu(e={}){let{window:t=bl,initialWidth:n=1/0,initialHeight:r=1/0,listenOrientation:i=!0,includeScrollbar:a=!0,type:o=`inner`}=e,s=W(n),c=W(r),l=()=>{if(t)if(o===`outer`)s.value=t.outerWidth,c.value=t.outerHeight;else if(o===`visual`&&t.visualViewport){let{width:e,height:n,scale:r}=t.visualViewport;s.value=Math.round(e*r),c.value=Math.round(n*r)}else a?(s.value=t.innerWidth,c.value=t.innerHeight):(s.value=t.document.documentElement.clientWidth,c.value=t.document.documentElement.clientHeight)};l(),nl(l);let u={passive:!0};return Cl(`resize`,l,u),t&&o===`visual`&&t.visualViewport&&Cl(t.visualViewport,`resize`,l,u),i&&z(Rl(`(orientation: portrait)`),()=>l()),{width:s,height:c}}var Nu=`11.4.6`;function Pu(){typeof __VUE_I18N_FULL_INSTALL__!=`boolean`&&(Ne().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!=`boolean`&&(Ne().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!=`boolean`&&(Ne().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!=`boolean`&&(Ne().__INTLIFY_PROD_DEVTOOLS__=!1)}var Fu={UNEXPECTED_RETURN_TYPE:24,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function Iu(e,...t){return je(e,null,void 0)}Fu.UNEXPECTED_RETURN_TYPE,Fu.INVALID_ARGUMENT,Fu.MUST_BE_CALL_SETUP_TOP,Fu.NOT_INSTALLED,Fu.UNEXPECTED_ERROR,Fu.REQUIRED_VALUE,Fu.INVALID_VALUE,Fu.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN,Fu.NOT_INSTALLED_WITH_PROVIDE,Fu.NOT_COMPATIBLE_LEGACY_VUE_I18N,Fu.NOT_AVAILABLE_COMPOSITION_IN_LEGACY;var Lu=I(`__translateVNode`),Ru=I(`__datetimeParts`),zu=I(`__numberParts`),Bu=I(`__setPluralRules`);I(`__intlifyMeta`);var Vu=I(`__injectWithOption`),Hu=I(`__dispose`),Uu={FALLBACK_TO_ROOT:10,NOT_FOUND_PARENT_SCOPE:11,IGNORE_OBJ_FLATTEN:12,DEPRECATE_LEGACY_MODE:13,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:14,DUPLICATE_USE_I18N_CALLING:15};Uu.FALLBACK_TO_ROOT,Uu.NOT_FOUND_PARENT_SCOPE,Uu.IGNORE_OBJ_FLATTEN,Uu.DEPRECATE_LEGACY_MODE,Uu.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE,Uu.DUPLICATE_USE_I18N_CALLING;function Wu(e){if(!st(e)||ve(e))return e;for(let t in e)if(xe(e,t))if(!t.includes(`.`))st(e[t])&&Wu(e[t]);else{let n=t.split(`.`),r=n.length-1,i=e,a=!1;for(let e=0;e<r;e++){if(n[e]===`__proto__`)throw Error(`unsafe key: ${n[e]}`);if(n[e]in i||(i[n[e]]=He()),!st(i[n[e]])){a=!0;break}i=i[n[e]]}if(a||(ve(i)?d.includes(n[r])||delete e[t]:(i[n[r]]=e[t],delete e[t])),!ve(i)){let e=i[n[r]];st(e)&&Wu(e)}}return e}function Gu(e,t){let{messages:n,__i18n:r,messageResolver:i,flatJson:a}=t,o=ae(n)?n:ut(r)?He():{[e]:He()};if(ut(r)&&r.forEach(e=>{if(`locale`in e&&`resource`in e){let{locale:t,resource:n}=e;t?(o[t]=o[t]||He(),Pe(n,o[t])):Pe(n,o)}else h(e)&&Pe(JSON.parse(e),o)}),i==null&&a)for(let e in o)xe(o,e)&&Wu(o[e]);return o}function Ku(e){return e.type}function qu(e,t,n){let r=st(t.messages)?t.messages:He();`__i18nGlobal`in n&&(r=Gu(e.locale.value,{messages:r,__i18n:n.__i18nGlobal}));let i=Object.keys(r);if(i.length&&i.forEach(t=>{e.mergeLocaleMessage(t,r[t])}),st(t.datetimeFormats)){let n=Object.keys(t.datetimeFormats);n.length&&n.forEach(n=>{e.mergeDateTimeFormat(n,t.datetimeFormats[n])})}if(st(t.numberFormats)){let n=Object.keys(t.numberFormats);n.length&&n.forEach(n=>{e.mergeNumberFormat(n,t.numberFormats[n])})}}function Ju(e){return Fe(k,null,e,0)}function Yu(){let e=`currentInstance`;return e in j?j[e]:Qe()}var Xu=`__INTLIFY_META__`,Zu=()=>[],Qu=()=>!1,$u=0;function ed(e){return((t,n,r,i)=>e(n,r,Yu()||void 0,i))}var td=()=>{let e=Yu(),t=null;return e&&(t=Ku(e)[Xu])?{[Xu]:t}:null};function nd(e={}){let{__root:t,__injectWithOption:n}=e,r=t===void 0,i=e.flatJson,a=ot?s:W,c=we(e.inheritLocale)?e.inheritLocale:!0,l=a(t&&c?t.locale.value:h(e.locale)?e.locale:S),u=a(t&&c?t.fallbackLocale.value:h(e.fallbackLocale)||ut(e.fallbackLocale)||ae(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:l.value),d=a(Gu(l.value,e)),f=a(ae(e.datetimeFormats)?e.datetimeFormats:{[l.value]:{}}),m=a(ae(e.numberFormats)?e.numberFormats:{[l.value]:{}}),g=t?t.missingWarn:we(e.missingWarn)||_(e.missingWarn)?e.missingWarn:!0,v=t?t.fallbackWarn:we(e.fallbackWarn)||_(e.fallbackWarn)?e.fallbackWarn:!0,b=t?t.fallbackRoot:we(e.fallbackRoot)?e.fallbackRoot:!0,x=!!e.fallbackFormat,C=re(e.missing)?e.missing:null,w=re(e.missing)?ed(e.missing):null,T=re(e.postTranslation)?e.postTranslation:null,E=t?t.warnHtmlMessage:we(e.warnHtmlMessage)?e.warnHtmlMessage:!0,O=!!e.escapeParameter,k=t?t.modifiers:ae(e.modifiers)?e.modifiers:{},A=e.pluralRules||t&&t.pluralRules,j;j=(()=>{r&&Ve(null);let t={version:Nu,locale:l.value,fallbackLocale:u.value,messages:d.value,modifiers:k,pluralRules:A,missing:w===null?void 0:w,missingWarn:g,fallbackWarn:v,fallbackFormat:x,unresolving:!0,postTranslation:T===null?void 0:T,warnHtmlMessage:E,escapeParameter:O,messageResolver:e.messageResolver,messageCompiler:e.messageCompiler,__meta:{framework:`vue`}};t.datetimeFormats=f.value,t.numberFormats=m.value,t.__datetimeFormatters=ae(j)?j.__datetimeFormatters:void 0,t.__numberFormatters=ae(j)?j.__numberFormatters:void 0;let n=qe(t);return r&&Ve(n),n})(),ke(j,l.value,u.value);function M(){return[l.value,u.value,d.value,f.value,m.value]}let N=H({get:()=>l.value,set:e=>{j.locale=e,l.value=e}}),P=H({get:()=>u.value,set:e=>{j.fallbackLocale=e,u.value=e,ke(j,l.value,e)}}),F=H(()=>d.value),I=H(()=>f.value),ee=H(()=>m.value);function L(){return re(T)?T:null}function R(e){T=e,j.postTranslation=e}function B(){return C}function ne(e){e!==null&&(w=ed(e)),C=e,j.missing=w}let ie=(e,n,i,a,o,s)=>{M();let c;try{__INTLIFY_PROD_DEVTOOLS__&&$e(td()),r||(j.fallbackContext=t?me():void 0),c=e(j)}finally{__INTLIFY_PROD_DEVTOOLS__&&$e(null),r||(j.fallbackContext=void 0)}if(i!==`translate exists`&&p(c)&&c===-1||i===`translate exists`&&!c){let[e,r]=n();return t&&b?a(t):o(e)}else if(s(c))return c;else throw Iu(Fu.UNEXPECTED_RETURN_TYPE)};function oe(...e){return ie(t=>Reflect.apply(at,null,[t,...e]),()=>Ue(...e),`translate`,t=>Reflect.apply(t.t,t,[...e]),e=>e,e=>h(e))}function se(...e){let[t,n,r]=e;if(r&&!st(r))throw Iu(Fu.INVALID_ARGUMENT);return oe(t,n,Ke({resolvedMessage:!0},r||{}))}function ce(...e){return ie(t=>Reflect.apply(D,null,[t,...e]),()=>Ae(...e),`datetime format`,t=>Reflect.apply(t.d,t,[...e]),()=>``,e=>h(e)||ut(e))}function le(...e){return ie(t=>Reflect.apply(o,null,[t,...e]),()=>nt(...e),`number format`,t=>Reflect.apply(t.n,t,[...e]),()=>``,e=>h(e)||ut(e))}function ue(e){return e.map(e=>h(e)||p(e)||we(e)?Ju(String(e)):e)}let fe={normalize:ue,interpolate:e=>e,type:`vnode`};function pe(...e){return ie(t=>{let n,r=t;try{r.processor=fe,n=Reflect.apply(at,null,[r,...e])}finally{r.processor=null}return n},()=>Ue(...e),`translate`,t=>t[Lu](...e),e=>[Ju(e)],e=>ut(e))}function he(...e){return ie(t=>Reflect.apply(o,null,[t,...e]),()=>nt(...e),`number format`,t=>t[zu](...e),Zu,e=>h(e)||ut(e))}function V(...e){return ie(t=>Reflect.apply(D,null,[t,...e]),()=>Ae(...e),`datetime format`,t=>t[Ru](...e),Zu,e=>h(e)||ut(e))}function _e(e){A=e,j.pluralRules=A}function ye(e,t){return ie(()=>{if(!e)return!1;let n=h(t)?t:l.value,r=h(t)?[n]:ge(j,u.value,n);for(let t=0;t<r.length;t++){let n=Ce(r[t]),i=j.messageResolver(n,e);if(i===null&&(i=n[e]),ve(i)||te(i)||h(i))return!0}return!1},()=>[e],`translate exists`,n=>Reflect.apply(n.te,n,[e,t]),Qu,e=>we(e))}function be(e){let t=null,n=ge(j,u.value,l.value);for(let r=0;r<n.length;r++){let i=d.value[n[r]]||{},a=j.messageResolver(i,e);if(a!=null){t=a;break}}return t}function Se(e){return be(e)??(t&&t.tm(e)||{})}function Ce(e){return d.value[e]||{}}function Te(e,t){if(i){let n={[e]:t};for(let e in n)xe(n,e)&&Wu(n[e]);t=n[e]}d.value[e]=t,j.messages=d.value}function Ee(e,t){d.value[e]=d.value[e]||{};let n={[e]:t};if(i)for(let e in n)xe(n,e)&&Wu(n[e]);t=n[e],Pe(t,d.value[e]),j.messages=d.value}function De(e){return f.value[e]||{}}function Oe(e,t){f.value[e]=t,j.datetimeFormats=f.value,de(j,e,t)}function je(e,t){f.value[e]=Ke(f.value[e]||{},t),j.datetimeFormats=f.value,de(j,e,t)}function Me(e){return m.value[e]||{}}function Ne(e,t){m.value[e]=t,j.numberFormats=m.value,y(j,e,t)}function U(e,t){m.value[e]=Ke(m.value[e]||{},t),j.numberFormats=m.value,y(j,e,t)}$u++,t&&ot&&(z(t.locale,e=>{c&&(l.value=e,j.locale=e,ke(j,l.value,u.value))}),z(t.fallbackLocale,e=>{c&&(u.value=e,j.fallbackLocale=e,ke(j,l.value,u.value))}));let Fe={id:$u,locale:N,fallbackLocale:P,get inheritLocale(){return c},set inheritLocale(e){c=e,e&&t&&(l.value=t.locale.value,u.value=t.fallbackLocale.value,ke(j,l.value,u.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:F,get modifiers(){return k},get pluralRules(){return A||{}},get isGlobal(){return r},get missingWarn(){return g},set missingWarn(e){g=e,j.missingWarn=g},get fallbackWarn(){return v},set fallbackWarn(e){v=e,j.fallbackWarn=v},get fallbackRoot(){return b},set fallbackRoot(e){b=e},get fallbackFormat(){return x},set fallbackFormat(e){x=e,j.fallbackFormat=x},get warnHtmlMessage(){return E},set warnHtmlMessage(e){E=e,j.warnHtmlMessage=e},get escapeParameter(){return O},set escapeParameter(e){O=e,j.escapeParameter=e},t:oe,getLocaleMessage:Ce,setLocaleMessage:Te,mergeLocaleMessage:Ee,getPostTranslationHandler:L,setPostTranslationHandler:R,getMissingHandler:B,setMissingHandler:ne,[Bu]:_e};return Fe.datetimeFormats=I,Fe.numberFormats=ee,Fe.rt=se,Fe.te=ye,Fe.tm=Se,Fe.d=ce,Fe.n=le,Fe.getDateTimeFormat=De,Fe.setDateTimeFormat=Oe,Fe.mergeDateTimeFormat=je,Fe.getNumberFormat=Me,Fe.setNumberFormat=Ne,Fe.mergeNumberFormat=U,Fe[Vu]=n,Fe[Lu]=pe,Fe[Ru]=V,Fe[zu]=he,Fe}function rd(e){let t=h(e.locale)?e.locale:S,n=h(e.fallbackLocale)||ut(e.fallbackLocale)||ae(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:t,r=re(e.missing)?e.missing:void 0,i=we(e.silentTranslationWarn)||_(e.silentTranslationWarn)?!e.silentTranslationWarn:!0,a=we(e.silentFallbackWarn)||_(e.silentFallbackWarn)?!e.silentFallbackWarn:!0,o=we(e.fallbackRoot)?e.fallbackRoot:!0,s=!!e.formatFallbackMessages,c=ae(e.modifiers)?e.modifiers:{},l=e.pluralizationRules,u=re(e.postTranslation)?e.postTranslation:void 0,d=h(e.warnHtmlInMessage)?e.warnHtmlInMessage!==`off`:!0,f=!!e.escapeParameterHtml,p=we(e.sync)?e.sync:!0,m=e.messages;if(ae(e.sharedMessages)){let t=e.sharedMessages;m=Object.keys(t).reduce((e,n)=>(Ke(e[n]||(e[n]={}),t[n]),e),m||{})}let{__i18n:g,__root:v,__injectWithOption:y}=e,b=e.datetimeFormats,x=e.numberFormats,C=e.flatJson;return{locale:t,fallbackLocale:n,messages:m,flatJson:C,datetimeFormats:b,numberFormats:x,missing:r,missingWarn:i,fallbackWarn:a,fallbackRoot:o,fallbackFormat:s,modifiers:c,pluralRules:l,postTranslation:u,warnHtmlMessage:d,escapeParameter:f,messageResolver:e.messageResolver,inheritLocale:p,__i18n:g,__root:v,__injectWithOption:y}}function id(e={}){let t=nd(rd(e)),{__extender:n}=e,r={id:t.id,get locale(){return t.locale.value},set locale(e){t.locale.value=e},get fallbackLocale(){return t.fallbackLocale.value},set fallbackLocale(e){t.fallbackLocale.value=e},get messages(){return t.messages.value},get datetimeFormats(){return t.datetimeFormats.value},get numberFormats(){return t.numberFormats.value},get availableLocales(){return t.availableLocales},get missing(){return t.getMissingHandler()},set missing(e){t.setMissingHandler(e)},get silentTranslationWarn(){return we(t.missingWarn)?!t.missingWarn:t.missingWarn},set silentTranslationWarn(e){t.missingWarn=we(e)?!e:e},get silentFallbackWarn(){return we(t.fallbackWarn)?!t.fallbackWarn:t.fallbackWarn},set silentFallbackWarn(e){t.fallbackWarn=we(e)?!e:e},get modifiers(){return t.modifiers},get formatFallbackMessages(){return t.fallbackFormat},set formatFallbackMessages(e){t.fallbackFormat=e},get postTranslation(){return t.getPostTranslationHandler()},set postTranslation(e){t.setPostTranslationHandler(e)},get sync(){return t.inheritLocale},set sync(e){t.inheritLocale=e},get warnHtmlInMessage(){return t.warnHtmlMessage?`warn`:`off`},set warnHtmlInMessage(e){t.warnHtmlMessage=e!==`off`},get escapeParameterHtml(){return t.escapeParameter},set escapeParameterHtml(e){t.escapeParameter=e},get pluralizationRules(){return t.pluralRules||{}},__composer:t,t(...e){return Reflect.apply(t.t,t,[...e])},rt(...e){return Reflect.apply(t.rt,t,[...e])},te(e,n){return t.te(e,n)},tm(e){return t.tm(e)},getLocaleMessage(e){return t.getLocaleMessage(e)},setLocaleMessage(e,n){t.setLocaleMessage(e,n)},mergeLocaleMessage(e,n){t.mergeLocaleMessage(e,n)},d(...e){return Reflect.apply(t.d,t,[...e])},getDateTimeFormat(e){return t.getDateTimeFormat(e)},setDateTimeFormat(e,n){t.setDateTimeFormat(e,n)},mergeDateTimeFormat(e,n){t.mergeDateTimeFormat(e,n)},n(...e){return Reflect.apply(t.n,t,[...e])},getNumberFormat(e){return t.getNumberFormat(e)},setNumberFormat(e,n){t.setNumberFormat(e,n)},mergeNumberFormat(e,n){t.mergeNumberFormat(e,n)}};return r.__extender=n,r}function ad(e,t,n){return{beforeCreate(){let r=Yu();if(!r)throw Iu(Fu.UNEXPECTED_ERROR);let i=this.$options;if(i.i18n){let r=i.i18n;if(i.__i18n&&(r.__i18n=i.__i18n),r.__root=t,this===this.$root)this.$i18n=od(e,r);else{r.__injectWithOption=!0,r.__extender=n.__vueI18nExtend,this.$i18n=id(r);let e=this.$i18n;e.__extender&&(e.__disposer=e.__extender(this.$i18n))}}else if(i.__i18n)if(this===this.$root)this.$i18n=od(e,i);else{this.$i18n=id({__i18n:i.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:t});let e=this.$i18n;e.__extender&&(e.__disposer=e.__extender(this.$i18n))}else this.$i18n=e;i.__i18nGlobal&&qu(t,i,i),this.$t=(...e)=>this.$i18n.t(...e),this.$rt=(...e)=>this.$i18n.rt(...e),this.$te=(e,t)=>this.$i18n.te(e,t),this.$d=(...e)=>this.$i18n.d(...e),this.$n=(...e)=>this.$i18n.n(...e),this.$tm=e=>this.$i18n.tm(e),n.__setInstance(r,this.$i18n)},mounted(){},unmounted(){let e=Yu();if(!e)throw Iu(Fu.UNEXPECTED_ERROR);let t=this.$i18n;t&&(delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,t?.__disposer&&(t.__disposer(),delete t.__disposer,delete t.__extender),n.__deleteInstance(e),delete this.$i18n)}}}function od(e,t){e.locale=t.locale||e.locale,e.fallbackLocale=t.fallbackLocale||e.fallbackLocale,e.missing=t.missing||e.missing,e.silentTranslationWarn=t.silentTranslationWarn||e.silentFallbackWarn,e.silentFallbackWarn=t.silentFallbackWarn||e.silentFallbackWarn,e.formatFallbackMessages=t.formatFallbackMessages||e.formatFallbackMessages,e.postTranslation=t.postTranslation||e.postTranslation,e.warnHtmlInMessage=t.warnHtmlInMessage||e.warnHtmlInMessage,e.escapeParameterHtml=t.escapeParameterHtml||e.escapeParameterHtml,e.sync=t.sync||e.sync,e.__composer[Bu](t.pluralizationRules||e.pluralizationRules);let n=Gu(e.locale,{messages:t.messages,__i18n:t.__i18n});return Object.keys(n).forEach(t=>e.mergeLocaleMessage(t,n[t])),t.datetimeFormats&&Object.keys(t.datetimeFormats).forEach(n=>e.mergeDateTimeFormat(n,t.datetimeFormats[n])),t.numberFormats&&Object.keys(t.numberFormats).forEach(n=>e.mergeNumberFormat(n,t.numberFormats[n])),e}var sd={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>e===`parent`||e===`global`,default:`parent`},i18n:{type:Object}};function cd({slots:e},t){return t.length===1&&t[0]==="default"?(e.default?e.default():[]).reduce((e,t)=>[...e,...t.type===x?t.children:[t]],[]):t.reduce((t,n)=>{let r=e[n];return r&&(t[n]=r()),t},He())}function ld(){return x}var ud=We({name:`i18n-t`,props:Ke({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:e=>p(e)||!isNaN(e)}},sd),setup(e,t){let{slots:n,attrs:r}=t,i=e.i18n||xd({useScope:e.scope,__useComponent:!0});return()=>{let a=()=>{let r=Object.keys(n).filter(e=>e[0]!==`_`),a=He();e.locale&&(a.locale=e.locale),e.plural!==void 0&&(a.plural=h(e.plural)?+e.plural:e.plural);let o=cd(t,r);return i[Lu](e.keypath,o,a)},o=Ke(He(),r),s=h(e.tag)||st(e.tag)?e.tag:ld();return st(s)?Be(s,o,{default:a}):Be(s,o,a())}}});function dd(e){return ut(e)&&!h(e[0])}function fd(e,t,n,r){let{slots:i,attrs:a}=t;return()=>{let t=()=>{let t={part:!0},a=He();e.locale&&(t.locale=e.locale),h(e.format)?t.key=e.format:st(e.format)&&(h(e.format.key)&&(t.key=e.format.key),a=Object.keys(e.format).reduce((t,r)=>n.includes(r)?Ke(He(),t,{[r]:e.format[r]}):t,He()));let o=r(e.value,t,a),s=[t.key];return ut(o)?s=o.map((e,t)=>{let n=i[e.type],r=n?n({[e.type]:e.value,index:t,parts:o}):[e.value];return dd(r)&&(r[0].key=`${e.type}-${t}`),r}):h(o)&&(s=[o]),s},o=Ke(He(),a),s=h(e.tag)||st(e.tag)?e.tag:ld();return st(s)?Be(s,o,{default:t}):Be(s,o,t())}}var pd=We({name:`i18n-n`,props:Ke({value:{type:Number,required:!0},format:{type:[String,Object]}},sd),setup(e,t){let n=e.i18n||xd({useScope:e.scope,__useComponent:!0});return fd(e,t,oe,(...e)=>n[zu](...e))}});function md(e,t){let n=e;if(e.mode===`composition`)return n.__getInstance(t)||e.global;{let r=n.__getInstance(t);return r==null?e.global.__composer:r.__composer}}function hd(e){let t=t=>{let{instance:n,value:r}=t;if(!n||!n.$)throw Iu(Fu.UNEXPECTED_ERROR);let i=md(e,n.$),a=gd(r);return[Reflect.apply(i.t,i,[..._d(a)]),i]};return{created:(e,n)=>{let[r,i]=t(n);ot&&(e.__i18nWatcher=z(i.locale,()=>{n.instance&&n.instance.$forceUpdate()})),e.__composer=i,e.textContent=r},unmounted:e=>{ot&&e.__i18nWatcher&&(e.__i18nWatcher(),e.__i18nWatcher=void 0,delete e.__i18nWatcher),e.__composer&&(e.__composer=void 0,delete e.__composer)},beforeUpdate:(e,{value:t})=>{if(e.__composer){let n=e.__composer,r=gd(t);e.textContent=Reflect.apply(n.t,n,[..._d(r)])}},getSSRProps:e=>{let[n]=t(e);return{textContent:n}}}}function gd(e){if(h(e))return{path:e};if(ae(e)){if(!(`path`in e))throw Iu(Fu.REQUIRED_VALUE,`path`);return e}else throw Iu(Fu.INVALID_VALUE)}function _d(e){let{path:t,locale:n,args:r,choice:i,plural:a}=e,o={},s=r||{};return h(n)&&(o.locale=n),p(i)&&(o.plural=i),p(a)&&(o.plural=a),[t,s,o]}function vd(e,t,...n){let r=ae(n[0])?n[0]:{};(!we(r.globalInstall)||r.globalInstall)&&([ud.name,`I18nT`].forEach(t=>e.component(t,ud)),[pd.name,`I18nN`].forEach(t=>e.component(t,pd)),[Md.name,`I18nD`].forEach(t=>e.component(t,Md))),e.directive(`t`,hd(t))}var yd=I(`global-vue-i18n`);function bd(e={}){let t=__VUE_I18N_LEGACY_API__&&we(e.legacy)?e.legacy:__VUE_I18N_LEGACY_API__,n=we(e.globalInjection)?e.globalInjection:!0,r=new Map,[i,a]=Sd(e,t),o=I(``);function s(e){return r.get(e)||null}function c(e,t){r.set(e,t)}function l(e){r.delete(e)}let u={get mode(){return __VUE_I18N_LEGACY_API__&&t?`legacy`:`composition`},async install(e,...r){if(e.__VUE_I18N_SYMBOL__=o,e.provide(e.__VUE_I18N_SYMBOL__,u),ae(r[0])){let e=r[0];u.__composerExtend=e.__composerExtend,u.__vueI18nExtend=e.__vueI18nExtend}let i=null;!t&&n&&(i=jd(e,u.global)),__VUE_I18N_FULL_INSTALL__&&vd(e,u,...r),__VUE_I18N_LEGACY_API__&&t&&e.mixin(ad(a,a.__composer,u));let s=e.unmount;e.unmount=()=>{i&&i(),u.dispose(),s()}},get global(){return a},dispose(){i.stop()},__instances:r,__getInstance:s,__setInstance:c,__deleteInstance:l};return u}function xd(e={}){let t=Yu();if(t==null)throw Iu(Fu.MUST_BE_CALL_SETUP_TOP);if(!t.isCE&&t.appContext.app!=null&&!t.appContext.app.__VUE_I18N_SYMBOL__)throw Iu(Fu.NOT_INSTALLED);let n=Cd(t),r=Td(n),i=Ku(t),a=wd(e,i);if(a===`global`)return qu(r,e,i),r;if(a===`parent`){let i=Ed(n,t,e.__useComponent);return i??=r,i}if(a===`isolated`){if(n.mode!==`composition`)throw Iu(Fu.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);let i=n,a=Ke({},e);a.__root=Ed(n,t)||r;let o=nd(a);return i.__composerExtend&&(o[Hu]=i.__composerExtend(o)),b()&&he(()=>{let e=o[Hu];e&&(e(),delete o[Hu])}),o}let o=n,s=o.__getInstance(t);if(s==null){let n=Ke({},e);`__i18n`in i&&(n.__i18n=i.__i18n),r&&(n.__root=r),s=nd(n),o.__composerExtend&&(s[Hu]=o.__composerExtend(s)),Od(o,t,s),o.__setInstance(t,s)}return s}function Sd(e,t){let n=fe(),r=__VUE_I18N_LEGACY_API__&&t?n.run(()=>id(e)):n.run(()=>nd(e));if(r==null)throw Iu(Fu.UNEXPECTED_ERROR);return[n,r]}function Cd(e){let t=De(e.isCE?yd:e.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw Iu(e.isCE?Fu.NOT_INSTALLED_WITH_PROVIDE:Fu.UNEXPECTED_ERROR);return t}function wd(e,t){return ct(e)?`__i18n`in t?`local`:`global`:e.useScope?e.useScope:`local`}function Td(e){return e.mode===`composition`?e.global:e.global.__composer}function Ed(e,t,n=!1){let r=null,i=t.root,a=Dd(t,n);for(;a!=null;){let t=e;if(e.mode===`composition`)r=t.__getInstance(a);else if(__VUE_I18N_LEGACY_API__){let e=t.__getInstance(a);e!=null&&(r=e.__composer,n&&r&&!r[Vu]&&(r=null))}if(r!=null||i===a)break;a=a.parent}return r}function Dd(e,t=!1){return e==null?null:t&&e.vnode.ctx||e.parent}function Od(e,t,n){ne(()=>{},t),f(()=>{let r=n;e.__deleteInstance(t);let i=r[Hu];i&&(i(),delete r[Hu])},t)}var kd=[`locale`,`fallbackLocale`,`availableLocales`],Ad=[`t`,`rt`,`d`,`n`,`tm`,`te`];function jd(e,t){let n=Object.create(null);return kd.forEach(e=>{let r=Object.getOwnPropertyDescriptor(t,e);if(!r)throw Iu(Fu.UNEXPECTED_ERROR);let i=O(r.value)?{get(){return r.value.value},set(e){r.value.value=e}}:{get(){return r.get&&r.get()}};Object.defineProperty(n,e,i)}),e.config.globalProperties.$i18n=n,Ad.forEach(n=>{let r=Object.getOwnPropertyDescriptor(t,n);if(!r||!r.value)throw Iu(Fu.UNEXPECTED_ERROR);Object.defineProperty(e.config.globalProperties,`$${n}`,r)}),()=>{delete e.config.globalProperties.$i18n,Ad.forEach(t=>{delete e.config.globalProperties[`$${t}`]})}}var Md=We({name:`i18n-d`,props:Ke({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},sd),setup(e,t){let n=e.i18n||xd({useScope:e.scope,__useComponent:!0});return fd(e,t,le,(...e)=>n[Ru](...e))}});if(Pu(),Le(A),Ce(Ge),Ze(ge),__INTLIFY_PROD_DEVTOOLS__){let e=Ne();e.__INTLIFY__=!0,Ee(e.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}function Nd(...e){if(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(!r)continue;let i=typeof r;if(i===`string`||i===`number`)t.push(r);else if(i===`object`){let e=Array.isArray(r)?[Nd(...r)]:Object.entries(r).map(([e,t])=>t?e:void 0);t=e.length?t.concat(e.filter(e=>!!e)):t}}return t.join(` `).trim()}}function Pd(e,t){return e?e.classList?e.classList.contains(t):RegExp(`(^| )`+t+`( |$)`,`gi`).test(e.className):!1}function Fd(e,t){if(e&&t){let n=t=>{Pd(e,t)||(e.classList?e.classList.add(t):e.className+=` `+t)};[t].flat().filter(Boolean).forEach(e=>e.split(` `).forEach(n))}}function Id(){return window.innerWidth-document.documentElement.offsetWidth}function Ld(e){typeof e==`string`?Fd(document.body,e||`p-overflow-hidden`):(e!=null&&e.variableName&&document.body.style.setProperty(e.variableName,Id()+`px`),Fd(document.body,e?.className||`p-overflow-hidden`))}function Rd(e){if(e){let t=document.createElement(`a`);if(t.download!==void 0){let{name:n,src:r}=e;return t.setAttribute(`href`,r),t.setAttribute(`download`,n),t.style.display=`none`,document.body.appendChild(t),t.click(),document.body.removeChild(t),!0}}return!1}function zd(e,t){let n=new Blob([e],{type:`application/csv;charset=utf-8;`});window.navigator.msSaveOrOpenBlob?navigator.msSaveOrOpenBlob(n,t+`.csv`):Rd({name:t+`.csv`,src:URL.createObjectURL(n)})||(e=`data:text/csv;charset=utf-8,`+e,window.open(encodeURI(e)))}function Bd(e,t){if(e&&t){let n=t=>{e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(^|\\b)`+t.split(` `).join(`|`)+`(\\b|$)`,`gi`),` `)};[t].flat().filter(Boolean).forEach(e=>e.split(` `).forEach(n))}}function Vd(e){typeof e==`string`?Bd(document.body,e||`p-overflow-hidden`):(e!=null&&e.variableName&&document.body.style.removeProperty(e.variableName),Bd(document.body,e?.className||`p-overflow-hidden`))}function Hd(e){for(let t of document==null?void 0:document.styleSheets)try{for(let n of t?.cssRules)for(let t of n?.style)if(e.test(t))return{name:t,value:n.style.getPropertyValue(t).trim()}}catch{}return null}function Ud(e){let t={width:0,height:0};if(e){let[n,r]=[e.style.visibility,e.style.display],i=e.getBoundingClientRect();e.style.visibility=`hidden`,e.style.display=`block`,t.width=i.width||e.offsetWidth,t.height=i.height||e.offsetHeight,e.style.display=r,e.style.visibility=n}return t}function Wd(){let e=window,t=document,n=t.documentElement,r=t.getElementsByTagName(`body`)[0];return{width:e.innerWidth||n.clientWidth||r.clientWidth,height:e.innerHeight||n.clientHeight||r.clientHeight}}function Gd(e){return e?Math.abs(e.scrollLeft):0}function Kd(){let e=document.documentElement;return(window.pageXOffset||Gd(e))-(e.clientLeft||0)}function qd(){let e=document.documentElement;return(window.pageYOffset||e.scrollTop)-(e.clientTop||0)}function Jd(e){return e?getComputedStyle(e).direction===`rtl`:!1}function Yd(e,t,n=!0){if(e){let r=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:Ud(e),i=r.height,a=r.width,o=t.offsetHeight,s=t.offsetWidth,c=t.getBoundingClientRect(),l=qd(),u=Kd(),d=Wd(),f,p,m=`top`;c.top+o+i>d.height?(f=c.top+l-i,m=`bottom`,f<0&&(f=l)):f=o+c.top+l,p=c.left+a>d.width?Math.max(0,c.left+u+s-a):c.left+u,Jd(e)?e.style.insetInlineEnd=p+`px`:e.style.insetInlineStart=p+`px`,e.style.top=f+`px`,e.style.transformOrigin=m,n&&(e.style.marginTop=m===`bottom`?`calc(${Hd(/-anchor-gutter$/)?.value??`2px`} * -1)`:Hd(/-anchor-gutter$/)?.value??``)}}function Xd(e,t){e&&(typeof t==`string`?e.style.cssText=t:Object.entries(t||{}).forEach(([t,n])=>e.style[t]=n))}function Zd(e,t){if(e instanceof HTMLElement){let n=e.offsetWidth;if(t){let t=getComputedStyle(e);n+=parseFloat(t.marginLeft)+parseFloat(t.marginRight)}return n}return 0}function Qd(e,t,n=!0,r=void 0){if(e){let i=e.offsetParent?{width:e.offsetWidth,height:e.offsetHeight}:Ud(e),a=t.offsetHeight,o=t.getBoundingClientRect(),s=Wd(),c,l,u=r??`top`;if(!r&&o.top+a+i.height>s.height?(c=-1*i.height,u=`bottom`,o.top+c<0&&(c=-1*o.top)):c=a,l=i.width>s.width?o.left*-1:o.left+i.width>s.width?(o.left+i.width-s.width)*-1:0,e.style.top=c+`px`,e.style.insetInlineStart=l+`px`,e.style.transformOrigin=u,n){let t=Hd(/-anchor-gutter$/)?.value;e.style.marginTop=u===`bottom`?`calc(${t??`2px`} * -1)`:t??``}}}function $d(e){if(e){let t=e.parentNode;return t&&t instanceof ShadowRoot&&t.host&&(t=t.host),t}return null}function ef(e){return!!(e!=null&&e.nodeName&&$d(e))}function tf(e){return typeof Element<`u`?e instanceof Element:typeof e==`object`&&!!e&&e.nodeType===1&&typeof e.nodeName==`string`}function nf(){if(window.getSelection){let e=window.getSelection()||{};e.empty?e.empty():e.removeAllRanges&&e.rangeCount>0&&e.getRangeAt(0).getClientRects().length>0&&e.removeAllRanges()}}function rf(e,t={}){if(tf(e)){let n=(t,r)=>{var i;let a=(i=e?.$attrs)!=null&&i[t]?[e?.$attrs?.[t]]:[];return[r].flat().reduce((e,r)=>{if(r!=null){let i=typeof r;if(i===`string`||i===`number`)e.push(r);else if(i===`object`){let i=Array.isArray(r)?n(t,r):Object.entries(r).map(([e,n])=>t===`style`&&(n||n===0)?`${e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}:${n}`:n?e:void 0);e=i.length?e.concat(i.filter(e=>!!e)):e}}return e},a)};Object.entries(t).forEach(([t,r])=>{if(r!=null){let i=t.match(/^on(.+)/);i?e.addEventListener(i[1].toLowerCase(),r):t===`p-bind`||t===`pBind`?rf(e,r):(r=t===`class`?[...new Set(n(`class`,r))].join(` `).trim():t===`style`?n(`style`,r).join(`;`).trim():r,(e.$attrs=e.$attrs||{})&&(e.$attrs[t]=r),e.setAttribute(t,r))}})}}function af(e,t={},...n){if(e){let r=document.createElement(e);return rf(r,t),r.append(...n),r}}function of(e,t){if(e){e.style.opacity=`0`;let n=+new Date,r=`0`,i=function(){r=`${+e.style.opacity+(new Date().getTime()-n)/t}`,e.style.opacity=r,n=+new Date,+r<1&&(`requestAnimationFrame`in window?requestAnimationFrame(i):setTimeout(i,16))};i()}}function sf(e,t){return tf(e)?Array.from(e.querySelectorAll(t)):[]}function cf(e,t){return tf(e)?e.matches(t)?e:e.querySelector(t):null}function lf(e,t){e&&document.activeElement!==e&&e.focus(t)}function uf(e,t){if(tf(e)){let n=e.getAttribute(t);return isNaN(n)?n===`true`||n===`false`?n===`true`:n:+n}}function df(e,t=``){let n=sf(e,`button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
15
|
-
[href]:not([tabindex = "-1"]):not([style*="display:none"]):not([hidden])${t},
|
|
16
|
-
input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
17
|
-
select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
18
|
-
textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
19
|
-
[tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
20
|
-
[contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t}`),r=[];for(let e of n)getComputedStyle(e).display!=`none`&&getComputedStyle(e).visibility!=`hidden`&&r.push(e);return r}function ff(e,t){let n=df(e,t);return n.length>0?n[0]:null}function pf(e){if(e){let t=e.offsetHeight,n=getComputedStyle(e);return t-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),t}return 0}function mf(e){if(e){let[t,n]=[e.style.visibility,e.style.display];e.style.visibility=`hidden`,e.style.display=`block`;let r=e.offsetHeight;return e.style.display=n,e.style.visibility=t,r}return 0}function hf(e){if(e){let[t,n]=[e.style.visibility,e.style.display];e.style.visibility=`hidden`,e.style.display=`block`;let r=e.offsetWidth;return e.style.display=n,e.style.visibility=t,r}return 0}function gf(e){if(e){let t=$d(e)?.childNodes,n=0;if(t)for(let r=0;r<t.length;r++){if(t[r]===e)return n;t[r].nodeType===1&&n++}}return-1}function _f(e,t){let n=df(e,t);return n.length>0?n[n.length-1]:null}function vf(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}return null}function yf(e){if(e){let t=e.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:t.left+(window.pageXOffset||Gd(document.documentElement)||Gd(document.body)||0)}}return{top:`auto`,left:`auto`}}function bf(e,t){if(e){let n=e.offsetHeight;if(t){let t=getComputedStyle(e);n+=parseFloat(t.marginTop)+parseFloat(t.marginBottom)}return n}return 0}function xf(e,t=[]){let n=$d(e);return n===null?t:xf(n,t.concat([n]))}function Sf(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}return null}function Cf(e){let t=[];if(e){let n=xf(e),r=/(auto|scroll)/,i=e=>{try{let t=window.getComputedStyle(e,null);return r.test(t.getPropertyValue(`overflow`))||r.test(t.getPropertyValue(`overflowX`))||r.test(t.getPropertyValue(`overflowY`))}catch{return!1}};for(let e of n){let n=e.nodeType===1&&e.dataset.scrollselectors;if(n){let r=n.split(`,`);for(let n of r){let r=cf(e,n);r&&i(r)&&t.push(r)}}e.nodeType!==9&&i(e)&&t.push(e)}}return t}function wf(){if(window.getSelection)return window.getSelection().toString();if(document.getSelection)return document.getSelection().toString()}function Tf(e){if(e){let t=e.offsetWidth,n=getComputedStyle(e);return t-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)+parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth),t}return 0}function Ef(e,t,n){let r=e[t];typeof r==`function`&&r.apply(e,n??[])}function Df(){return/(android)/i.test(navigator.userAgent)}function Of(e,t,n){return tf(e)?uf(e,t)===n:!1}function kf(e){if(e){let t=e.nodeName,n=e.parentElement&&e.parentElement.nodeName;return t===`INPUT`||t===`TEXTAREA`||t===`BUTTON`||t===`A`||n===`INPUT`||n===`TEXTAREA`||n===`BUTTON`||n===`A`||!!e.closest(`.p-button, .p-checkbox, .p-radiobutton`)}return!1}function Af(){return!!(typeof window<`u`&&window.document&&window.document.createElement)}function jf(e,t=``){return tf(e)?e.matches(`button:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
21
|
-
[href][clientHeight][clientWidth]:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
22
|
-
input:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
23
|
-
select:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
24
|
-
textarea:not([tabindex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
25
|
-
[tabIndex]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t},
|
|
26
|
-
[contenteditable]:not([tabIndex = "-1"]):not([disabled]):not([style*="display:none"]):not([hidden])${t}`):!1}function Mf(e){return!!(e&&e.offsetParent!=null)}function Nf(){return`ontouchstart`in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Pf(e,t=``,n){tf(e)&&n!=null&&e.setAttribute(t,n)}function Ff(){let e=new Map;return{on(t,n){let r=e.get(t);return r?r.push(n):r=[n],e.set(t,r),this},off(t,n){let r=e.get(t);return r&&r.splice(r.indexOf(n)>>>0,1),this},emit(t,n){let r=e.get(t);r&&r.forEach(e=>{e(n)})},clear(){e.clear()}}}var If=Object.defineProperty,Lf=Object.getOwnPropertySymbols,Rf=Object.prototype.hasOwnProperty,zf=Object.prototype.propertyIsEnumerable,Bf=(e,t,n)=>t in e?If(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vf=(e,t)=>{for(var n in t||={})Rf.call(t,n)&&Bf(e,n,t[n]);if(Lf)for(var n of Lf(t))zf.call(t,n)&&Bf(e,n,t[n]);return e};function Hf(e){return e==null||e===``||Array.isArray(e)&&e.length===0||!(e instanceof Date)&&typeof e==`object`&&Object.keys(e).length===0}function Uf(e,t,n,r=1){let i=-1,a=Hf(e),o=Hf(t);return i=a&&o?0:a?r:o?-r:typeof e==`string`&&typeof t==`string`?n(e,t):e<t?-1:+(e>t),i}function Wf(e,t,n=new WeakSet){if(e===t)return!0;if(!e||!t||typeof e!=`object`||typeof t!=`object`||n.has(e)||n.has(t))return!1;n.add(e).add(t);let r=Array.isArray(e),i=Array.isArray(t),a,o,s;if(r&&i){if(o=e.length,o!=t.length)return!1;for(a=o;a--!==0;)if(!Wf(e[a],t[a],n))return!1;return!0}if(r!=i)return!1;let c=e instanceof Date,l=t instanceof Date;if(c!=l)return!1;if(c&&l)return e.getTime()==t.getTime();let u=e instanceof RegExp,d=t instanceof RegExp;if(u!=d)return!1;if(u&&d)return e.toString()==t.toString();let f=Object.keys(e);if(o=f.length,o!==Object.keys(t).length)return!1;for(a=o;a--!==0;)if(!Object.prototype.hasOwnProperty.call(t,f[a]))return!1;for(a=o;a--!==0;)if(s=f[a],!Wf(e[s],t[s],n))return!1;return!0}function Gf(e,t){return Wf(e,t)}function Kf(e){return typeof e==`function`&&`call`in e&&`apply`in e}function qf(e){return!Hf(e)}function Jf(e,t){if(!e||!t)return null;try{let n=e[t];if(qf(n))return n}catch{}if(Object.keys(e).length){if(Kf(t))return t(e);if(t.indexOf(`.`)===-1)return e[t];{let n=t.split(`.`),r=e;for(let e=0,t=n.length;e<t;++e){if(r==null)return null;r=r[n[e]]}return r}}return null}function Yf(e,t,n){return n?Jf(e,n)===Jf(t,n):Gf(e,t)}function Xf(e,t){if(e!=null&&t&&t.length){for(let n of t)if(Yf(e,n))return!0}return!1}function Zf(e,t=!0){return e instanceof Object&&e.constructor===Object&&(t||Object.keys(e).length!==0)}function Qf(e={},t={}){let n=Vf({},e);return Object.keys(t).forEach(r=>{let i=r;Zf(t[i])&&i in e&&Zf(e[i])?n[i]=Qf(e[i],t[i]):n[i]=t[i]}),n}function $f(...e){return e.reduce((e,t,n)=>n===0?t:Qf(e,t),{})}function ep(e,t){let n=-1;if(t){for(let r=0;r<t.length;r++)if(t[r]===e){n=r;break}}return n}function tp(e,t){let n=-1;if(qf(e))try{n=e.findLastIndex(t)}catch{n=e.lastIndexOf([...e].reverse().find(t))}return n}function np(e,...t){return Kf(e)?e(...t):e}function rp(e,t=!0){return typeof e==`string`&&(t||e!==``)}function ip(e){return rp(e)?e.replace(/(-|_)/g,``).toLowerCase():e}function ap(e,t=``,n={}){let r=ip(t).split(`.`),i=r.shift();return i?Zf(e)?ap(np(e[Object.keys(e).find(e=>ip(e)===i)||``],n),r.join(`.`),n):void 0:np(e,n)}function op(e,t=!0){return Array.isArray(e)&&(t||e.length!==0)}function sp(e){return e instanceof Date}function cp(e){return qf(e)&&!isNaN(e)}function lp(e=``){return qf(e)&&e.length===1&&!!e.match(/\S| /)}function up(){return new Intl.Collator(void 0,{numeric:!0}).compare}function dp(e,t){if(t){let n=t.test(e);return t.lastIndex=0,n}return!1}function fp(...e){return $f(...e)}function pp(e){return e&&e.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g,``).replace(/ {2,}/g,` `).replace(/ ([{:}]) /g,`$1`).replace(/([;,]) /g,`$1`).replace(/ !/g,`!`).replace(/: /g,`:`).trim()}function mp(e){if(e&&/[\xC0-\xFF\u0100-\u017E]/.test(e)){let t={A:/[\xC0-\xC5\u0100\u0102\u0104]/g,AE:/[\xC6]/g,C:/[\xC7\u0106\u0108\u010A\u010C]/g,D:/[\xD0\u010E\u0110]/g,E:/[\xC8-\xCB\u0112\u0114\u0116\u0118\u011A]/g,G:/[\u011C\u011E\u0120\u0122]/g,H:/[\u0124\u0126]/g,I:/[\xCC-\xCF\u0128\u012A\u012C\u012E\u0130]/g,IJ:/[\u0132]/g,J:/[\u0134]/g,K:/[\u0136]/g,L:/[\u0139\u013B\u013D\u013F\u0141]/g,N:/[\xD1\u0143\u0145\u0147\u014A]/g,O:/[\xD2-\xD6\xD8\u014C\u014E\u0150]/g,OE:/[\u0152]/g,R:/[\u0154\u0156\u0158]/g,S:/[\u015A\u015C\u015E\u0160]/g,T:/[\u0162\u0164\u0166]/g,U:/[\xD9-\xDC\u0168\u016A\u016C\u016E\u0170\u0172]/g,W:/[\u0174]/g,Y:/[\xDD\u0176\u0178]/g,Z:/[\u0179\u017B\u017D]/g,a:/[\xE0-\xE5\u0101\u0103\u0105]/g,ae:/[\xE6]/g,c:/[\xE7\u0107\u0109\u010B\u010D]/g,d:/[\u010F\u0111]/g,e:/[\xE8-\xEB\u0113\u0115\u0117\u0119\u011B]/g,g:/[\u011D\u011F\u0121\u0123]/g,i:/[\xEC-\xEF\u0129\u012B\u012D\u012F\u0131]/g,ij:/[\u0133]/g,j:/[\u0135]/g,k:/[\u0137,\u0138]/g,l:/[\u013A\u013C\u013E\u0140\u0142]/g,n:/[\xF1\u0144\u0146\u0148\u014B]/g,p:/[\xFE]/g,o:/[\xF2-\xF6\xF8\u014D\u014F\u0151]/g,oe:/[\u0153]/g,r:/[\u0155\u0157\u0159]/g,s:/[\u015B\u015D\u015F\u0161]/g,t:/[\u0163\u0165\u0167]/g,u:/[\xF9-\xFC\u0169\u016B\u016D\u016F\u0171\u0173]/g,w:/[\u0175]/g,y:/[\xFD\xFF\u0177]/g,z:/[\u017A\u017C\u017E]/g};for(let n in t)e=e.replace(t[n],n)}return e}function hp(e,t,n){e&&t!==n&&(n>=e.length&&(n%=e.length,t%=e.length),e.splice(n,0,e.splice(t,1)[0]))}function gp(e,t,n=1,r,i=1){let a=Uf(e,t,r,n),o=n;return(Hf(e)||Hf(t))&&(o=i===1?n:i),o*a}function _p(e){return rp(e,!1)?e[0].toUpperCase()+e.slice(1):e}function vp(e){return rp(e)?e.replace(/(_)/g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase():e}var yp={};function bp(e=`pui_id_`){return Object.hasOwn(yp,e)||(yp[e]=0),yp[e]++,`${e}${yp[e]}`}function xp(){let e=[],t=(t,n,r=999)=>{let a=i(t,n,r),o=a.value+(a.key===t?0:r)+1;return e.push({key:t,value:o}),o},n=t=>{e=e.filter(e=>e.value!==t)},r=(e,t)=>i(e,t).value,i=(t,n,r=0)=>[...e].reverse().find(e=>n?!0:e.key===t)||{key:t,value:r},a=e=>e&&parseInt(e.style.zIndex,10)||0;return{get:a,set:(e,n,r)=>{n&&(n.style.zIndex=String(t(e,!0,r)))},clear:e=>{e&&(n(a(e)),e.style.zIndex=``)},getCurrent:e=>r(e,!0)}}var Sp=xp(),Cp=Object.defineProperty,wp=Object.defineProperties,Tp=Object.getOwnPropertyDescriptors,Ep=Object.getOwnPropertySymbols,Dp=Object.prototype.hasOwnProperty,Op=Object.prototype.propertyIsEnumerable,kp=(e,t,n)=>t in e?Cp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ap=(e,t)=>{for(var n in t||={})Dp.call(t,n)&&kp(e,n,t[n]);if(Ep)for(var n of Ep(t))Op.call(t,n)&&kp(e,n,t[n]);return e},jp=(e,t)=>wp(e,Tp(t)),Mp=(e,t)=>{var n={};for(var r in e)Dp.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ep)for(var r of Ep(e))t.indexOf(r)<0&&Op.call(e,r)&&(n[r]=e[r]);return n};function Np(...e){return $f(...e)}var Pp=Ff(),Fp=/{([^}]*)}/g,Ip=/(\d+\s+[\+\-\*\/]\s+\d+)/g,Lp=/var\([^)]+\)/g;function Rp(e){return rp(e)?e.replace(/[A-Z]/g,(e,t)=>t===0?e:`.`+e.toLowerCase()).toLowerCase():e}function zp(e){return Zf(e)&&e.hasOwnProperty(`$value`)&&e.hasOwnProperty(`$type`)?e.$value:e}function Bp(e){return e.replaceAll(/ /g,``).replace(/[^\w]/g,`-`)}function Vp(e=``,t=``){return Bp(`${rp(e,!1)&&rp(t,!1)?`${e}-`:e}${t}`)}function Hp(e=``,t=``){return`--${Vp(e,t)}`}function Up(e=``){return((e.match(/{/g)||[]).length+(e.match(/}/g)||[]).length)%2!=0}function Wp(e,t=``,n=``,r=[],i){if(rp(e)){let t=e.trim();if(Up(t))return;if(dp(t,Fp)){let e=t.replaceAll(Fp,e=>`var(${Hp(n,vp(e.replace(/{|}/g,``).split(`.`).filter(e=>!r.some(t=>dp(e,t))).join(`-`)))}${qf(i)?`, ${i}`:``})`);return dp(e.replace(Lp,`0`),Ip)?`calc(${e})`:e}return t}else if(cp(e))return e}function Gp(e,t,n){rp(t,!1)&&e.push(`${t}:${n};`)}function Kp(e,t){return e?`${e}{${t}}`:``}function qp(e,t){if(e.indexOf(`dt(`)===-1)return e;function n(e,t){let n=[],i=0,a=``,o=null,s=0;for(;i<=e.length;){let c=e[i];if((c===`"`||c===`'`||c==="`")&&e[i-1]!==`\\`&&(o=o===c?null:c),!o&&(c===`(`&&s++,c===`)`&&s--,(c===`,`||i===e.length)&&s===0)){let e=a.trim();e.startsWith(`dt(`)?n.push(qp(e,t)):n.push(r(e)),a=``,i++;continue}c!==void 0&&(a+=c),i++}return n}function r(e){let t=e[0];if((t===`"`||t===`'`||t==="`")&&e[e.length-1]===t)return e.slice(1,-1);let n=Number(e);return isNaN(n)?e:n}let i=[],a=[];for(let t=0;t<e.length;t++)if(e[t]===`d`&&e.slice(t,t+3)===`dt(`)a.push(t),t+=2;else if(e[t]===`)`&&a.length>0){let e=a.pop();a.length===0&&i.push([e,t])}if(!i.length)return e;for(let r=i.length-1;r>=0;r--){let[a,o]=i[r],s=t(...n(e.slice(a+3,o),t));e=e.slice(0,a)+s+e.slice(o+1)}return e}var Jp=e=>{let t=tm.getTheme(),n=Xp(t,e,void 0,`variable`);return{name:n?.match(/--[\w-]+/g)?.[0],variable:n,value:Xp(t,e,void 0,`value`)}},Yp=(...e)=>Xp(tm.getTheme(),...e),Xp=(e={},t,n,r)=>{if(t){let{variable:i,options:a}=tm.defaults||{},{prefix:o,transform:s}=e?.options||a||{},c=dp(t,Fp)?t:`{${t}}`;return r===`value`||Hf(r)&&s===`strict`?tm.getTokenValue(t):Wp(c,void 0,o,[i.excludedKeyRegex],n)}return``};function Zp(e,...t){return e instanceof Array?qp(e.reduce((e,n,r)=>e+n+(np(t[r],{dt:Yp})??``),``),Yp):np(e,{dt:Yp})}var Qp=(e={})=>{let{preset:t,options:n}=e;return{preset(e){return t=t?fp(t,e):e,this},options(e){return n=n?Ap(Ap({},n),e):e,this},primaryPalette(e){let{semantic:n}=t||{};return t=jp(Ap({},t),{semantic:jp(Ap({},n),{primary:e})}),this},surfacePalette(e){let{semantic:n}=t||{},r=e&&Object.hasOwn(e,`light`)?e.light:e,i=e&&Object.hasOwn(e,`dark`)?e.dark:e,a={colorScheme:{light:Ap(Ap({},n?.colorScheme?.light),!!r&&{surface:r}),dark:Ap(Ap({},n?.colorScheme?.dark),!!i&&{surface:i})}};return t=jp(Ap({},t),{semantic:Ap(Ap({},n),a)}),this},define({useDefaultPreset:e=!1,useDefaultOptions:r=!1}={}){return{preset:e?tm.getPreset():t,options:r?tm.getOptions():n}},update({mergePresets:e=!0,mergeOptions:r=!0}={}){let i={preset:e?fp(tm.getPreset(),t):t,options:r?Ap(Ap({},tm.getOptions()),n):n};return tm.setTheme(i),i},use(e){let t=this.define(e);return tm.setTheme(t),t}}};function $p(e,t={}){let n=tm.defaults.variable,{prefix:r=n.prefix,selector:i=n.selector,excludedKeyRegex:a=n.excludedKeyRegex}=t,o=[],s=[],c=[{node:e,path:r}];for(;c.length;){let{node:e,path:t}=c.pop();for(let n in e){let i=e[n],l=zp(i),u=dp(n,a)?Vp(t):Vp(t,vp(n));if(Zf(l))c.push({node:l,path:u});else{Gp(s,Hp(u),Wp(l,u,r,[a]));let e=u;r&&e.startsWith(r+`-`)&&(e=e.slice(r.length+1)),o.push(e.replace(/-/g,`.`))}}}let l=s.join(``);return{value:s,tokens:o,declarations:l,css:Kp(i,l)}}var em={regex:{rules:{class:{pattern:/^\.([a-zA-Z][\w-]*)$/,resolve(e){return{type:`class`,selector:e,matched:this.pattern.test(e.trim())}}},attr:{pattern:/^\[(.*)\]$/,resolve(e){return{type:`attr`,selector:`:root${e},:host${e}`,matched:this.pattern.test(e.trim())}}},media:{pattern:/^@media (.*)$/,resolve(e){return{type:`media`,selector:e,matched:this.pattern.test(e.trim())}}},system:{pattern:/^system$/,resolve(e){return{type:`system`,selector:`@media (prefers-color-scheme: dark)`,matched:this.pattern.test(e.trim())}}},custom:{resolve(e){return{type:`custom`,selector:e,matched:!0}}}},resolve(e){let t=Object.keys(this.rules).filter(e=>e!==`custom`).map(e=>this.rules[e]);return[e].flat().map(e=>t.map(t=>t.resolve(e)).find(e=>e.matched)??this.rules.custom.resolve(e))}},_toVariables(e,t){return $p(e,{prefix:t?.prefix})},getCommon({name:e=``,theme:t={},params:n,set:r,defaults:i}){let{preset:a,options:o}=t,s,c,l,u,d,f,p;if(qf(a)&&o.transform!==`strict`){let{primitive:t,semantic:n,extend:m}=a,h=n||{},{colorScheme:g}=h,_=Mp(h,[`colorScheme`]),v=m||{},{colorScheme:y}=v,b=Mp(v,[`colorScheme`]),x=g||{},{dark:S}=x,C=Mp(x,[`dark`]),w=y||{},{dark:T}=w,E=Mp(w,[`dark`]),D=qf(t)?this._toVariables({primitive:t},o):{},O=qf(_)?this._toVariables({semantic:_},o):{},k=qf(C)?this._toVariables({light:C},o):{},A=qf(S)?this._toVariables({dark:S},o):{},j=qf(b)?this._toVariables({semantic:b},o):{},M=qf(E)?this._toVariables({light:E},o):{},N=qf(T)?this._toVariables({dark:T},o):{},[P,F]=[D.declarations??``,D.tokens],[I,ee]=[O.declarations??``,O.tokens||[]],[te,L]=[k.declarations??``,k.tokens||[]],[R,z]=[A.declarations??``,A.tokens||[]],[B,ne]=[j.declarations??``,j.tokens||[]],[re,ie]=[M.declarations??``,M.tokens||[]],[ae,oe]=[N.declarations??``,N.tokens||[]];s=this.transformCSS(e,P,`light`,`variable`,o,r,i),c=F,l=`${this.transformCSS(e,`${I}${te}`,`light`,`variable`,o,r,i)}${this.transformCSS(e,`${R}`,`dark`,`variable`,o,r,i)}`,u=[...new Set([...ee,...L,...z])],d=`${this.transformCSS(e,`${B}${re}color-scheme:light`,`light`,`variable`,o,r,i)}${this.transformCSS(e,`${ae}color-scheme:dark`,`dark`,`variable`,o,r,i)}`,f=[...new Set([...ne,...ie,...oe])],p=np(a.css,{dt:Yp})}return{primitive:{css:s,tokens:c},semantic:{css:l,tokens:u},global:{css:d,tokens:f},style:p}},getPreset({name:e=``,preset:t={},options:n,params:r,set:i,defaults:a,selector:o}){let s,c,l;if(qf(t)&&n.transform!==`strict`){let r=e.replace(`-directive`,``),u=t,{colorScheme:d,extend:f,css:p}=u,m=Mp(u,[`colorScheme`,`extend`,`css`]),h=f||{},{colorScheme:g}=h,_=Mp(h,[`colorScheme`]),v=d||{},{dark:y}=v,b=Mp(v,[`dark`]),x=g||{},{dark:S}=x,C=Mp(x,[`dark`]),w=qf(m)?this._toVariables({[r]:Ap(Ap({},m),_)},n):{},T=qf(b)?this._toVariables({[r]:Ap(Ap({},b),C)},n):{},E=qf(y)?this._toVariables({[r]:Ap(Ap({},y),S)},n):{},[D,O]=[w.declarations??``,w.tokens||[]],[k,A]=[T.declarations??``,T.tokens||[]],[j,M]=[E.declarations??``,E.tokens||[]];s=`${this.transformCSS(r,`${D}${k}`,`light`,`variable`,n,i,a,o)}${this.transformCSS(r,j,`dark`,`variable`,n,i,a,o)}`,c=[...new Set([...O,...A,...M])],l=np(p,{dt:Yp})}return{css:s,tokens:c,style:l}},getPresetC({name:e=``,theme:t={},params:n,set:r,defaults:i}){let{preset:a,options:o}=t,s=a?.components?.[e];return this.getPreset({name:e,preset:s,options:o,params:n,set:r,defaults:i})},getPresetD({name:e=``,theme:t={},params:n,set:r,defaults:i}){let a=e.replace(`-directive`,``),{preset:o,options:s}=t,c=o?.components?.[a]||o?.directives?.[a];return this.getPreset({name:a,preset:c,options:s,params:n,set:r,defaults:i})},applyDarkColorScheme(e){return!(e.darkModeSelector===`none`||e.darkModeSelector===!1)},getColorSchemeOption(e,t){return this.applyDarkColorScheme(e)?this.regex.resolve(e.darkModeSelector===!0?t.options.darkModeSelector:e.darkModeSelector??t.options.darkModeSelector):[]},getLayerOrder(e,t={},n,r){let{cssLayer:i}=t;return i?`@layer ${np(i.order||i.name||`primeui`,n)}`:``},getCommonStyleSheet({name:e=``,theme:t={},params:n,props:r={},set:i,defaults:a}){let o=this.getCommon({name:e,theme:t,params:n,set:i,defaults:a}),s=Object.entries(r).reduce((e,[t,n])=>e.push(`${t}="${n}"`)&&e,[]).join(` `);return Object.entries(o||{}).reduce((e,[t,n])=>{if(Zf(n)&&Object.hasOwn(n,`css`)){let r=pp(n.css),i=`${t}-variables`;e.push(`<style type="text/css" data-primevue-style-id="${i}" ${s}>${r}</style>`)}return e},[]).join(``)},getStyleSheet({name:e=``,theme:t={},params:n,props:r={},set:i,defaults:a}){let o={name:e,theme:t,params:n,set:i,defaults:a},s=(e.includes(`-directive`)?this.getPresetD(o):this.getPresetC(o))?.css,c=Object.entries(r).reduce((e,[t,n])=>e.push(`${t}="${n}"`)&&e,[]).join(` `);return s?`<style type="text/css" data-primevue-style-id="${e}-variables" ${c}>${pp(s)}</style>`:``},createTokens(e={},t,n=``,r=``,i={}){let a=function(e,t={},n=[]){if(n.includes(this.path))return console.warn(`Circular reference detected at ${this.path}`),{colorScheme:e,path:this.path,paths:t,value:void 0};n.push(this.path),t.name=this.path,t.binding||={};let r=this.value;if(typeof this.value==`string`&&Fp.test(this.value)){let i=this.value.trim().replace(Fp,r=>{let i=r.slice(1,-1),a=this.tokens[i];if(!a)return console.warn(`Token not found for path: ${i}`),`__UNRESOLVED__`;let o=a.computed(e,t,n);return Array.isArray(o)&&o.length===2?`light-dark(${o[0].value},${o[1].value})`:o?.value??`__UNRESOLVED__`});r=Ip.test(i.replace(Lp,`0`))?`calc(${i})`:i}return Hf(t.binding)&&delete t.binding,n.pop(),{colorScheme:e,path:this.path,paths:t,value:r.includes(`__UNRESOLVED__`)?void 0:r}},o=(e,n,r)=>{Object.entries(e).forEach(([e,s])=>{let c=dp(e,t.variable.excludedKeyRegex)?n:n?`${n}.${Rp(e)}`:Rp(e),l=r?`${r}.${e}`:e;Zf(s)?o(s,c,l):(i[c]||(i[c]={paths:[],computed:(e,t={},n=[])=>{if(i[c].paths.length===1)return i[c].paths[0].computed(i[c].paths[0].scheme,t.binding,n);if(e&&e!==`none`)for(let r=0;r<i[c].paths.length;r++){let a=i[c].paths[r];if(a.scheme===e)return a.computed(e,t.binding,n)}return i[c].paths.map(e=>e.computed(e.scheme,t[e.scheme],n))}}),i[c].paths.push({path:l,value:s,scheme:l.includes(`colorScheme.light`)?`light`:l.includes(`colorScheme.dark`)?`dark`:`none`,computed:a,tokens:i}))})};return o(e,n,r),i},getTokenValue(e,t,n){let r=(e=>e.split(`.`).filter(e=>!dp(e.toLowerCase(),n.variable.excludedKeyRegex)).join(`.`))(t),i=t.includes(`colorScheme.light`)?`light`:t.includes(`colorScheme.dark`)?`dark`:void 0,a=[e[r]?.computed(i)].flat().filter(e=>e);return a.length===1?a[0].value:a.reduce((e={},t)=>{let n=t,{colorScheme:r}=n;return e[r]=Mp(n,[`colorScheme`]),e},void 0)},getSelectorRule(e,t,n,r){return n===`class`||n===`attr`?Kp(qf(t)?`${e}${t},${e} ${t}`:e,r):Kp(e,Kp(t??`:root,:host`,r))},transformCSS(e,t,n,r,i={},a,o,s){if(qf(t)){let{cssLayer:c}=i;if(r!==`style`){let e=this.getColorSchemeOption(i,o);t=n===`dark`?e.reduce((e,{type:n,selector:r})=>(qf(r)&&(e+=r.includes(`[CSS]`)?r.replace(`[CSS]`,t):this.getSelectorRule(r,s,n,t)),e),``):Kp(s??`:root,:host`,t)}if(c){let n={name:`primeui`,order:`primeui`};Zf(c)&&(n.name=np(c.name,{name:e,type:r})),qf(n.name)&&(t=Kp(`@layer ${n.name}`,t),a?.layerNames(n.name))}return t}return``}},tm={defaults:{variable:{prefix:`p`,selector:`:root,:host`,excludedKeyRegex:/^(primitive|semantic|components|directives|variables|colorscheme|light|dark|common|root|states|extend|css)$/gi},options:{prefix:`p`,darkModeSelector:`system`,cssLayer:!1}},_theme:void 0,_layerNames:new Set,_loadedStyleNames:new Set,_loadingStyles:new Set,_tokens:{},update(e={}){let{theme:t}=e;t&&(this._theme=jp(Ap({},t),{options:Ap(Ap({},this.defaults.options),t.options)}),this._tokens=em.createTokens(this.preset,this.defaults),this.clearLoadedStyleNames())},get theme(){return this._theme},get preset(){return this.theme?.preset||{}},get options(){return this.theme?.options||{}},get tokens(){return this._tokens},getTheme(){return this.theme},setTheme(e){this.update({theme:e}),Pp.emit(`theme:change`,e)},getPreset(){return this.preset},setPreset(e){this._theme=jp(Ap({},this.theme),{preset:e}),this._tokens=em.createTokens(e,this.defaults),this.clearLoadedStyleNames(),Pp.emit(`preset:change`,e),Pp.emit(`theme:change`,this.theme)},getOptions(){return this.options},setOptions(e){this._theme=jp(Ap({},this.theme),{options:e}),this.clearLoadedStyleNames(),Pp.emit(`options:change`,e),Pp.emit(`theme:change`,this.theme)},getLayerNames(){return[...this._layerNames]},setLayerNames(e){this._layerNames.add(e)},getLoadedStyleNames(){return this._loadedStyleNames},isStyleNameLoaded(e){return this._loadedStyleNames.has(e)},setLoadedStyleName(e){this._loadedStyleNames.add(e)},deleteLoadedStyleName(e){this._loadedStyleNames.delete(e)},clearLoadedStyleNames(){this._loadedStyleNames.clear()},getTokenValue(e){return em.getTokenValue(this.tokens,e,this.defaults)},getCommon(e=``,t){return em.getCommon({name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getComponent(e=``,t){let n={name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return em.getPresetC(n)},getDirective(e=``,t){let n={name:e,theme:this.theme,params:t,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return em.getPresetD(n)},getCustomPreset(e=``,t,n,r){let i={name:e,preset:t,options:this.options,selector:n,params:r,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}};return em.getPreset(i)},getLayerOrderCSS(e=``){return em.getLayerOrder(e,this.options,{names:this.getLayerNames()},this.defaults)},transformCSS(e=``,t,n=`style`,r){return em.transformCSS(e,t,r,n,this.options,{layerNames:this.setLayerNames.bind(this)},this.defaults)},getCommonStyleSheet(e=``,t,n={}){return em.getCommonStyleSheet({name:e,theme:this.theme,params:t,props:n,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},getStyleSheet(e,t,n={}){return em.getStyleSheet({name:e,theme:this.theme,params:t,props:n,defaults:this.defaults,set:{layerNames:this.setLayerNames.bind(this)}})},onStyleMounted(e){this._loadingStyles.add(e)},onStyleUpdated(e){this._loadingStyles.add(e)},onStyleLoaded(e,{name:t}){this._loadingStyles.size&&(this._loadingStyles.delete(t),Pp.emit(`theme:${t}:load`,e),!this._loadingStyles.size&&Pp.emit(`theme:load`))}};function nm(...e){let t=$f(tm.getPreset(),...e);return tm.setPreset(t),t}function rm(e){return Qp().primaryPalette(e).update().preset}function im(e){return Qp().surfacePalette(e).update().preset}function am(...e){let t=$f(...e);return tm.setPreset(t),t}function om(e){return Qp(e).update({mergePresets:!1})}var sm={_loadedStyleNames:new Set,getLoadedStyleNames:function(){return this._loadedStyleNames},isStyleNameLoaded:function(e){return this._loadedStyleNames.has(e)},setLoadedStyleName:function(e){this._loadedStyleNames.add(e)},deleteLoadedStyleName:function(e){this._loadedStyleNames.delete(e)},clearLoadedStyleNames:function(){this._loadedStyleNames.clear()}},cm=`
|
|
27
|
-
*,
|
|
28
|
-
::before,
|
|
29
|
-
::after {
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.p-collapsible-enter-active {
|
|
34
|
-
animation: p-animate-collapsible-expand 0.2s ease-out;
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.p-collapsible-leave-active {
|
|
39
|
-
animation: p-animate-collapsible-collapse 0.2s ease-out;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@keyframes p-animate-collapsible-expand {
|
|
44
|
-
from {
|
|
45
|
-
grid-template-rows: 0fr;
|
|
46
|
-
}
|
|
47
|
-
to {
|
|
48
|
-
grid-template-rows: 1fr;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@keyframes p-animate-collapsible-collapse {
|
|
53
|
-
from {
|
|
54
|
-
grid-template-rows: 1fr;
|
|
55
|
-
}
|
|
56
|
-
to {
|
|
57
|
-
grid-template-rows: 0fr;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.p-disabled,
|
|
62
|
-
.p-disabled * {
|
|
63
|
-
cursor: default;
|
|
64
|
-
pointer-events: none;
|
|
65
|
-
user-select: none;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.p-disabled,
|
|
69
|
-
.p-component:disabled {
|
|
70
|
-
opacity: dt('disabled.opacity');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.pi {
|
|
74
|
-
font-size: dt('icon.size');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.p-icon {
|
|
78
|
-
width: dt('icon.size');
|
|
79
|
-
height: dt('icon.size');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.p-overlay-mask {
|
|
83
|
-
background: var(--px-mask-background, dt('mask.background'));
|
|
84
|
-
color: dt('mask.color');
|
|
85
|
-
position: fixed;
|
|
86
|
-
top: 0;
|
|
87
|
-
left: 0;
|
|
88
|
-
width: 100%;
|
|
89
|
-
height: 100%;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.p-overlay-mask-enter-active {
|
|
93
|
-
animation: p-animate-overlay-mask-enter dt('mask.transition.duration') forwards;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.p-overlay-mask-leave-active {
|
|
97
|
-
animation: p-animate-overlay-mask-leave dt('mask.transition.duration') forwards;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
@keyframes p-animate-overlay-mask-enter {
|
|
101
|
-
from {
|
|
102
|
-
background: transparent;
|
|
103
|
-
}
|
|
104
|
-
to {
|
|
105
|
-
background: var(--px-mask-background, dt('mask.background'));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
@keyframes p-animate-overlay-mask-leave {
|
|
109
|
-
from {
|
|
110
|
-
background: var(--px-mask-background, dt('mask.background'));
|
|
111
|
-
}
|
|
112
|
-
to {
|
|
113
|
-
background: transparent;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.p-anchored-overlay-enter-active {
|
|
118
|
-
animation: p-animate-anchored-overlay-enter 300ms cubic-bezier(.19,1,.22,1);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.p-anchored-overlay-leave-active {
|
|
122
|
-
animation: p-animate-anchored-overlay-leave 300ms cubic-bezier(.19,1,.22,1);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@keyframes p-animate-anchored-overlay-enter {
|
|
126
|
-
from {
|
|
127
|
-
opacity: 0;
|
|
128
|
-
transform: scale(0.93);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
@keyframes p-animate-anchored-overlay-leave {
|
|
133
|
-
to {
|
|
134
|
-
opacity: 0;
|
|
135
|
-
transform: scale(0.93);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
`;function lm(e){"@babel/helpers - typeof";return lm=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},lm(e)}function um(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?um(Object(n),!0).forEach(function(t){fm(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):um(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fm(e,t,n){return(t=pm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pm(e){var t=mm(e,`string`);return lm(t)==`symbol`?t:t+``}function mm(e,t){if(lm(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(lm(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function hm(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;Qe()&&Qe().components?ne(e):t?e():Me(e)}var gm=0;function _m(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=s(!1),r=s(e),i=s(null),a=Af()?window.document:void 0,o=t.document,c=o===void 0?a:o,l=t.immediate,u=l===void 0?!0:l,d=t.manual,f=d===void 0?!1:d,p=t.name,m=p===void 0?`style_${++gm}`:p,h=t.id,g=h===void 0?void 0:h,_=t.media,v=_===void 0?void 0:_,y=t.nonce,b=y===void 0?void 0:y,x=t.first,S=x===void 0?!1:x,C=t.onMounted,w=C===void 0?void 0:C,T=t.onUpdated,E=T===void 0?void 0:T,D=t.onLoad,O=D===void 0?void 0:D,k=t.props,A=k===void 0?{}:k,j=function(){},M=function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(c){var o=dm(dm({},A),a),s=o.name||m,l=o.id||g,u=o.nonce||b;i.value=c.querySelector(`style[data-primevue-style-id="${s}"]`)||c.getElementById(l)||c.createElement(`style`),i.value.isConnected||(r.value=t||e,rf(i.value,{type:`text/css`,id:l,media:v,nonce:u}),S?c.head.prepend(i.value):c.head.appendChild(i.value),Pf(i.value,`data-primevue-style-id`,s),rf(i.value,o),i.value.onload=function(e){return O?.(e,{name:s})},w?.(s)),!n.value&&(j=z(r,function(e){i.value.textContent=e,E?.(s)},{immediate:!0}),n.value=!0)}};return u&&!f&&hm(M),{id:g,name:m,el:i,css:r,unload:function(){!c||!n.value||(j(),ef(i.value)&&c.head.removeChild(i.value),n.value=!1,i.value=null)},load:M,isLoaded:L(n)}}function vm(e){"@babel/helpers - typeof";return vm=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},vm(e)}var ym,bm,xm,Sm;function Cm(e,t){return Om(e)||Dm(e,t)||Tm(e,t)||wm()}function wm(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
139
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tm(e,t){if(e){if(typeof e==`string`)return Em(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Em(e,t):void 0}}function Em(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Dm(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Om(e){if(Array.isArray(e))return e}function km(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Am(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?km(Object(n),!0).forEach(function(t){jm(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):km(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function jm(e,t,n){return(t=Mm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mm(e){var t=Nm(e,`string`);return vm(t)==`symbol`?t:t+``}function Nm(e,t){if(vm(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vm(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Pm(e,t){return t||=e.slice(0),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Fm={name:`base`,css:function(e){var t=e.dt;return`
|
|
140
|
-
.p-hidden-accessible {
|
|
141
|
-
border: 0;
|
|
142
|
-
clip: rect(0 0 0 0);
|
|
143
|
-
height: 1px;
|
|
144
|
-
margin: -1px;
|
|
145
|
-
opacity: 0;
|
|
146
|
-
overflow: hidden;
|
|
147
|
-
padding: 0;
|
|
148
|
-
pointer-events: none;
|
|
149
|
-
position: absolute;
|
|
150
|
-
white-space: nowrap;
|
|
151
|
-
width: 1px;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.p-overflow-hidden {
|
|
155
|
-
overflow: hidden;
|
|
156
|
-
padding-right: ${t(`scrollbar.width`)};
|
|
157
|
-
}
|
|
158
|
-
`},style:cm,classes:{},inlineStyles:{},load:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(e){return e})(Zp(ym||=Pm([``,``]),e));return qf(n)?_m(pp(n),Am({name:this.name},t)):{}},loadCSS:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.load(this.css,e)},loadStyle:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``;return this.load(this.style,t,function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``;return tm.transformCSS(t.name||e.name,`${r}${Zp(bm||=Pm([``,``]),n)}`)})},getCommonTheme:function(e){return tm.getCommon(this.name,e)},getComponentTheme:function(e){return tm.getComponent(this.name,e)},getDirectiveTheme:function(e){return tm.getDirective(this.name,e)},getPresetTheme:function(e,t,n){return tm.getCustomPreset(this.name,e,t,n)},getLayerOrderThemeCSS:function(){return tm.getLayerOrderCSS(this.name)},getStyleSheet:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.css){var n=np(this.css,{dt:Yp})||``,r=pp(Zp(xm||=Pm([``,``,``]),n,e)),i=Object.entries(t).reduce(function(e,t){var n=Cm(t,2),r=n[0],i=n[1];return e.push(`${r}="${i}"`)&&e},[]).join(` `);return qf(r)?`<style type="text/css" data-primevue-style-id="${this.name}" ${i}>${r}</style>`:``}return``},getCommonThemeStyleSheet:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return tm.getCommonStyleSheet(this.name,e,t)},getThemeStyleSheet:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=[tm.getStyleSheet(this.name,e,t)];if(this.style){var r=this.name===`base`?`global-style`:`${this.name}-style`,i=Zp(Sm||=Pm([``,``]),np(this.style,{dt:Yp})),a=pp(tm.transformCSS(r,i)),o=Object.entries(t).reduce(function(e,t){var n=Cm(t,2),r=n[0],i=n[1];return e.push(`${r}="${i}"`)&&e},[]).join(` `);qf(a)&&n.push(`<style type="text/css" data-primevue-style-id="${r}" ${o}>${a}</style>`)}return n.join(``)},extend:function(e){return Am(Am({},this),{},{css:void 0,style:void 0},e)}};function Im(){return`${arguments.length>0&&arguments[0]!==void 0?arguments[0]:`pc`}${N().replace(`v-`,``).replaceAll(`-`,`_`)}`}var Lm=Fm.extend({name:`common`});function Rm(e){"@babel/helpers - typeof";return Rm=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Rm(e)}function zm(e){return Km(e)||Bm(e)||Um(e)||Hm()}function Bm(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Vm(e,t){return Km(e)||Gm(e,t)||Um(e,t)||Hm()}function Hm(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
159
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Um(e,t){if(e){if(typeof e==`string`)return Wm(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wm(e,t):void 0}}function Wm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Gm(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Km(e){if(Array.isArray(e))return e}function qm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?qm(Object(n),!0).forEach(function(t){Ym(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ym(e,t,n){return(t=Xm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xm(e){var t=Zm(e,`string`);return Rm(t)==`symbol`?t:t+``}function Zm(e,t){if(Rm(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Rm(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Qm={name:`BaseComponent`,props:{pt:{type:Object,default:void 0},ptOptions:{type:Object,default:void 0},unstyled:{type:Boolean,default:void 0},dt:{type:Object,default:void 0}},inject:{$parentInstance:{default:void 0}},watch:{isUnstyled:{immediate:!0,handler:function(e){Pp.off(`theme:change`,this._loadCoreStyles),e||(this._loadCoreStyles(),this._themeChangeListener(this._loadCoreStyles))}},dt:{immediate:!0,handler:function(e,t){var n=this;Pp.off(`theme:change`,this._themeScopedListener),e?(this._loadScopedThemeStyles(e),this._themeScopedListener=function(){return n._loadScopedThemeStyles(e)},this._themeChangeListener(this._themeScopedListener)):this._unloadScopedThemeStyles()}}},scopedStyleEl:void 0,rootEl:void 0,uid:void 0,$attrSelector:void 0,beforeCreate:function(){var e,t,n,r,i,a,o,s,c,l,u=this.pt?._usept,d=u?(e=this.pt)==null||(e=e.originalValue)==null?void 0:e[this.$.type.name]:void 0;(n=(u?(t=this.pt)==null||(t=t.value)==null?void 0:t[this.$.type.name]:this.pt)||d)==null||(n=n.hooks)==null||(r=n.onBeforeCreate)==null||r.call(n);var f=(i=this.$primevueConfig)==null||(i=i.pt)==null?void 0:i._usept,p=f?(a=this.$primevue)==null||(a=a.config)==null||(a=a.pt)==null?void 0:a.originalValue:void 0;(c=(f?(o=this.$primevue)==null||(o=o.config)==null||(o=o.pt)==null?void 0:o.value:(s=this.$primevue)==null||(s=s.config)==null?void 0:s.pt)||p)==null||(c=c[this.$.type.name])==null||(c=c.hooks)==null||(l=c.onBeforeCreate)==null||l.call(c),this.$attrSelector=Im(),this.uid=this.$attrs.id||this.$attrSelector.replace(`pc`,`pv_id_`)},created:function(){this._hook(`onCreated`)},beforeMount:function(){this.rootEl=cf(tf(this.$el)?this.$el:this.$el?.parentElement,`[${this.$attrSelector}]`),this.rootEl&&(this.rootEl.$pc=Jm({name:this.$.type.name,attrSelector:this.$attrSelector},this.$params)),this._loadStyles(),this._hook(`onBeforeMount`)},mounted:function(){this._hook(`onMounted`)},beforeUpdate:function(){this._hook(`onBeforeUpdate`)},updated:function(){this._hook(`onUpdated`)},beforeUnmount:function(){this._hook(`onBeforeUnmount`)},unmounted:function(){this._removeThemeListeners(),this._unloadScopedThemeStyles(),this._hook(`onUnmounted`)},methods:{_hook:function(e){if(!this.$options.hostName){var t=this._usePT(this._getPT(this.pt,this.$.type.name),this._getOptionValue,`hooks.${e}`),n=this._useDefaultPT(this._getOptionValue,`hooks.${e}`);t?.(),n?.()}},_mergeProps:function(e){var t=[...arguments].slice(1);return Kf(e)?e.apply(void 0,t):U.apply(void 0,t)},_load:function(){sm.isStyleNameLoaded(`base`)||(Fm.loadCSS(this.$styleOptions),this._loadGlobalStyles(),sm.setLoadedStyleName(`base`)),this._loadThemeStyles()},_loadStyles:function(){this._load(),this._themeChangeListener(this._load)},_loadCoreStyles:function(){var e;!sm.isStyleNameLoaded(this.$style?.name)&&(e=this.$style)!=null&&e.name&&(Lm.loadCSS(this.$styleOptions),this.$options.style&&this.$style.loadCSS(this.$styleOptions),sm.setLoadedStyleName(this.$style.name))},_loadGlobalStyles:function(){var e=this._useGlobalPT(this._getOptionValue,`global.css`,this.$params);qf(e)&&Fm.load(e,Jm({name:`global`},this.$styleOptions))},_loadThemeStyles:function(){var e;if(!(this.isUnstyled||this.$theme===`none`)){if(!tm.isStyleNameLoaded(`common`)){var t,n,r=((t=this.$style)==null||(n=t.getCommonTheme)==null?void 0:n.call(t))||{},i=r.primitive,a=r.semantic,o=r.global,s=r.style;Fm.load(i?.css,Jm({name:`primitive-variables`},this.$styleOptions)),Fm.load(a?.css,Jm({name:`semantic-variables`},this.$styleOptions)),Fm.load(o?.css,Jm({name:`global-variables`},this.$styleOptions)),Fm.loadStyle(Jm({name:`global-style`},this.$styleOptions),s),tm.setLoadedStyleName(`common`)}if(!tm.isStyleNameLoaded(this.$style?.name)&&(e=this.$style)!=null&&e.name){var c,l,u,d,f=((c=this.$style)==null||(l=c.getComponentTheme)==null?void 0:l.call(c))||{},p=f.css,m=f.style;(u=this.$style)==null||u.load(p,Jm({name:`${this.$style.name}-variables`},this.$styleOptions)),(d=this.$style)==null||d.loadStyle(Jm({name:`${this.$style.name}-style`},this.$styleOptions),m),tm.setLoadedStyleName(this.$style.name)}if(!tm.isStyleNameLoaded(`layer-order`)){var h,g,_=(h=this.$style)==null||(g=h.getLayerOrderThemeCSS)==null?void 0:g.call(h);Fm.load(_,Jm({name:`layer-order`,first:!0},this.$styleOptions)),tm.setLoadedStyleName(`layer-order`)}}},_loadScopedThemeStyles:function(e){var t,n,r=(((t=this.$style)==null||(n=t.getPresetTheme)==null?void 0:n.call(t,e,`[${this.$attrSelector}]`))||{}).css,i=this.$style?.load(r,Jm({name:`${this.$attrSelector}-${this.$style.name}`},this.$styleOptions));this.scopedStyleEl=i.el},_unloadScopedThemeStyles:function(){var e;(e=this.scopedStyleEl)==null||(e=e.value)==null||e.remove()},_themeChangeListener:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){};sm.clearLoadedStyleNames(),Pp.on(`theme:change`,e)},_removeThemeListeners:function(){Pp.off(`theme:change`,this._loadCoreStyles),Pp.off(`theme:change`,this._load),Pp.off(`theme:change`,this._themeScopedListener)},_getHostInstance:function(e){return e?this.$options.hostName?e.$.type.name===this.$options.hostName?e:this._getHostInstance(e.$parentInstance):e.$parentInstance:void 0},_getPropValue:function(e){return this[e]||this._getHostInstance(this)?.[e]},_getOptionValue:function(e){return ap(e,arguments.length>1&&arguments[1]!==void 0?arguments[1]:``,arguments.length>2&&arguments[2]!==void 0?arguments[2]:{})},_getPTValue:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=/./g.test(t)&&!!n[t.split(`.`)[0]],a=this._getPropValue(`ptOptions`)||this.$primevueConfig?.ptOptions||{},o=a.mergeSections,s=o===void 0?!0:o,c=a.mergeProps,l=c===void 0?!1:c,u=r?i?this._useGlobalPT(this._getPTClassValue,t,n):this._useDefaultPT(this._getPTClassValue,t,n):void 0,d=i?void 0:this._getPTSelf(e,this._getPTClassValue,t,Jm(Jm({},n),{},{global:u||{}})),f=this._getPTDatasets(t);return s||!s&&d?l?this._mergeProps(l,u,d,f):Jm(Jm(Jm({},u),d),f):Jm(Jm({},d),f)},_getPTSelf:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=[...arguments].slice(1);return U(this._usePT.apply(this,[this._getPT(e,this.$name)].concat(t)),this._usePT.apply(this,[this.$_attrsPT].concat(t)))},_getPTDatasets:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,t=`data-pc-`,n=e===`root`&&qf(this.pt?.[`data-pc-section`]);return e!==`transition`&&Jm(Jm({},e===`root`&&Jm(Jm(Ym({},`${t}name`,ip(n?this.pt?.[`data-pc-section`]:this.$.type.name)),n&&Ym({},`${t}extend`,ip(this.$.type.name))),{},Ym({},`${this.$attrSelector}`,``))),{},Ym({},`${t}section`,ip(e)))},_getPTClassValue:function(){var e=this._getOptionValue.apply(this,arguments);return rp(e)||op(e)?{class:e}:e},_getPT:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``,r=arguments.length>2?arguments[2]:void 0,i=function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=r?r(e):e,o=ip(n),s=ip(t.$name);return(i&&o===s?void 0:a?.[o])??a};return e!=null&&e.hasOwnProperty(`_usept`)?{_usept:e._usept,originalValue:i(e.originalValue),value:i(e.value)}:i(e,!0)},_usePT:function(e,t,n,r){var i=function(e){return t(e,n,r)};if(e!=null&&e.hasOwnProperty(`_usept`)){var a=e._usept||this.$primevueConfig?.ptOptions||{},o=a.mergeSections,s=o===void 0?!0:o,c=a.mergeProps,l=c===void 0?!1:c,u=i(e.originalValue),d=i(e.value);return u===void 0&&d===void 0?void 0:rp(d)?d:rp(u)?u:s||!s&&d?l?this._mergeProps(l,u,d):Jm(Jm({},u),d):d}return i(e)},_useGlobalPT:function(e,t,n){return this._usePT(this.globalPT,e,t,n)},_useDefaultPT:function(e,t,n){return this._usePT(this.defaultPT,e,t,n)},ptm:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this._getPTValue(this.pt,e,Jm(Jm({},this.$params),t))},ptmi:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=U(this.$_attrsWithoutPT,this.ptm(e,t));return n!=null&&n.hasOwnProperty(`id`)&&(n.id??=this.$id),n},ptmo:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._getPTValue(e,t,Jm({instance:this},n),!1)},cx:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.isUnstyled?void 0:this._getOptionValue(this.$style.classes,e,Jm(Jm({},this.$params),t))},sx:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(t){var r=this._getOptionValue(this.$style.inlineStyles,e,Jm(Jm({},this.$params),n));return[this._getOptionValue(Lm.inlineStyles,e,Jm(Jm({},this.$params),n)),r]}}},computed:{globalPT:function(){var e=this;return this._getPT(this.$primevueConfig?.pt,void 0,function(t){return np(t,{instance:e})})},defaultPT:function(){var e=this;return this._getPT(this.$primevueConfig?.pt,void 0,function(t){return e._getOptionValue(t,e.$name,Jm({},e.$params))||np(t,Jm({},e.$params))})},isUnstyled:function(){return this.unstyled===void 0?this.$primevueConfig?.unstyled:this.unstyled},$id:function(){return this.$attrs.id||this.uid},$inProps:function(){var e=Object.keys(this.$.vnode?.props||{});return Object.fromEntries(Object.entries(this.$props).filter(function(t){var n=Vm(t,1)[0];return e?.includes(n)}))},$theme:function(){return this.$primevueConfig?.theme},$style:function(){return Jm(Jm({classes:void 0,inlineStyles:void 0,load:function(){},loadCSS:function(){},loadStyle:function(){}},(this._getHostInstance(this)||{}).$style),this.$options.style)},$styleOptions:function(){var e;return{nonce:(e=this.$primevueConfig)==null||(e=e.csp)==null?void 0:e.nonce}},$primevueConfig:function(){return this.$primevue?.config},$name:function(){return this.$options.hostName||this.$.type.name},$params:function(){var e=this._getHostInstance(this)||this.$parent;return{instance:this,props:this.$props,state:this.$data,attrs:this.$attrs,parent:{instance:e,props:e?.$props,state:e?.$data,attrs:e?.$attrs}}},$_attrsPT:function(){return Object.entries(this.$attrs||{}).filter(function(e){return Vm(e,1)[0]?.startsWith(`pt:`)}).reduce(function(e,t){var n=Vm(t,2),r=n[0],i=n[1];return Wm(zm(r.split(`:`))).slice(1)?.reduce(function(e,t,n,r){return!e[t]&&(e[t]=n===r.length-1?i:{}),e[t]},e),e},{})},$_attrsWithoutPT:function(){return Object.entries(this.$attrs||{}).filter(function(e){var t=Vm(e,1)[0];return!(t!=null&&t.startsWith(`pt:`))}).reduce(function(e,t){var n=Vm(t,2),r=n[0];return e[r]=n[1],e},{})}}},$m=Fm.extend({name:`baseicon`,css:`
|
|
160
|
-
.p-icon {
|
|
161
|
-
display: inline-block;
|
|
162
|
-
vertical-align: baseline;
|
|
163
|
-
flex-shrink: 0;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.p-icon-spin {
|
|
167
|
-
-webkit-animation: p-icon-spin 2s infinite linear;
|
|
168
|
-
animation: p-icon-spin 2s infinite linear;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@-webkit-keyframes p-icon-spin {
|
|
172
|
-
0% {
|
|
173
|
-
-webkit-transform: rotate(0deg);
|
|
174
|
-
transform: rotate(0deg);
|
|
175
|
-
}
|
|
176
|
-
100% {
|
|
177
|
-
-webkit-transform: rotate(359deg);
|
|
178
|
-
transform: rotate(359deg);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
@keyframes p-icon-spin {
|
|
183
|
-
0% {
|
|
184
|
-
-webkit-transform: rotate(0deg);
|
|
185
|
-
transform: rotate(0deg);
|
|
186
|
-
}
|
|
187
|
-
100% {
|
|
188
|
-
-webkit-transform: rotate(359deg);
|
|
189
|
-
transform: rotate(359deg);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
`});function eh(e){"@babel/helpers - typeof";return eh=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},eh(e)}function th(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?th(Object(n),!0).forEach(function(t){rh(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):th(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rh(e,t,n){return(t=ih(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ih(e){var t=ah(e,`string`);return eh(t)==`symbol`?t:t+``}function ah(e,t){if(eh(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(eh(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var oh={name:`BaseIcon`,extends:Qm,props:{label:{type:String,default:void 0},spin:{type:Boolean,default:!1}},style:$m,provide:function(){return{$pcIcon:this,$parentInstance:this}},methods:{pti:function(){var e=Hf(this.label);return nh(nh({},!this.isUnstyled&&{class:[`p-icon`,{"p-icon-spin":this.spin}]}),{},{role:e?void 0:`img`,"aria-label":e?void 0:this.label,"aria-hidden":e})}}},sh={name:`SpinnerIcon`,extends:oh};function ch(e){return fh(e)||dh(e)||uh(e)||lh()}function lh(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
193
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uh(e,t){if(e){if(typeof e==`string`)return ph(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ph(e,t):void 0}}function dh(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function fh(e){if(Array.isArray(e))return ph(e)}function ph(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mh(e,t,n,r,i,a){return q(),c(`svg`,U({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),ch(t[0]||=[V(`path`,{d:`M6.99701 14C5.85441 13.999 4.72939 13.7186 3.72012 13.1832C2.71084 12.6478 1.84795 11.8737 1.20673 10.9284C0.565504 9.98305 0.165424 8.89526 0.041387 7.75989C-0.0826496 6.62453 0.073125 5.47607 0.495122 4.4147C0.917119 3.35333 1.59252 2.4113 2.46241 1.67077C3.33229 0.930247 4.37024 0.413729 5.4857 0.166275C6.60117 -0.0811796 7.76026 -0.0520535 8.86188 0.251112C9.9635 0.554278 10.9742 1.12227 11.8057 1.90555C11.915 2.01493 11.9764 2.16319 11.9764 2.31778C11.9764 2.47236 11.915 2.62062 11.8057 2.73C11.7521 2.78503 11.688 2.82877 11.6171 2.85864C11.5463 2.8885 11.4702 2.90389 11.3933 2.90389C11.3165 2.90389 11.2404 2.8885 11.1695 2.85864C11.0987 2.82877 11.0346 2.78503 10.9809 2.73C9.9998 1.81273 8.73246 1.26138 7.39226 1.16876C6.05206 1.07615 4.72086 1.44794 3.62279 2.22152C2.52471 2.99511 1.72683 4.12325 1.36345 5.41602C1.00008 6.70879 1.09342 8.08723 1.62775 9.31926C2.16209 10.5513 3.10478 11.5617 4.29713 12.1803C5.48947 12.7989 6.85865 12.988 8.17414 12.7157C9.48963 12.4435 10.6711 11.7264 11.5196 10.6854C12.3681 9.64432 12.8319 8.34282 12.8328 7C12.8328 6.84529 12.8943 6.69692 13.0038 6.58752C13.1132 6.47812 13.2616 6.41667 13.4164 6.41667C13.5712 6.41667 13.7196 6.47812 13.8291 6.58752C13.9385 6.69692 14 6.84529 14 7C14 8.85651 13.2622 10.637 11.9489 11.9497C10.6356 13.2625 8.85432 14 6.99701 14Z`,fill:`currentColor`},null,-1)]),16)}sh.render=mh;var hh=Fm.extend({name:`badge`,style:`
|
|
194
|
-
.p-badge {
|
|
195
|
-
display: inline-flex;
|
|
196
|
-
border-radius: dt('badge.border.radius');
|
|
197
|
-
align-items: center;
|
|
198
|
-
justify-content: center;
|
|
199
|
-
padding: dt('badge.padding');
|
|
200
|
-
background: dt('badge.primary.background');
|
|
201
|
-
color: dt('badge.primary.color');
|
|
202
|
-
font-size: dt('badge.font.size');
|
|
203
|
-
font-weight: dt('badge.font.weight');
|
|
204
|
-
min-width: dt('badge.min.width');
|
|
205
|
-
height: dt('badge.height');
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.p-badge-dot {
|
|
209
|
-
width: dt('badge.dot.size');
|
|
210
|
-
min-width: dt('badge.dot.size');
|
|
211
|
-
height: dt('badge.dot.size');
|
|
212
|
-
border-radius: 50%;
|
|
213
|
-
padding: 0;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.p-badge-circle {
|
|
217
|
-
padding: 0;
|
|
218
|
-
border-radius: 50%;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.p-badge-secondary {
|
|
222
|
-
background: dt('badge.secondary.background');
|
|
223
|
-
color: dt('badge.secondary.color');
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.p-badge-success {
|
|
227
|
-
background: dt('badge.success.background');
|
|
228
|
-
color: dt('badge.success.color');
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.p-badge-info {
|
|
232
|
-
background: dt('badge.info.background');
|
|
233
|
-
color: dt('badge.info.color');
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.p-badge-warn {
|
|
237
|
-
background: dt('badge.warn.background');
|
|
238
|
-
color: dt('badge.warn.color');
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.p-badge-danger {
|
|
242
|
-
background: dt('badge.danger.background');
|
|
243
|
-
color: dt('badge.danger.color');
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.p-badge-contrast {
|
|
247
|
-
background: dt('badge.contrast.background');
|
|
248
|
-
color: dt('badge.contrast.color');
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
.p-badge-sm {
|
|
252
|
-
font-size: dt('badge.sm.font.size');
|
|
253
|
-
min-width: dt('badge.sm.min.width');
|
|
254
|
-
height: dt('badge.sm.height');
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
.p-badge-lg {
|
|
258
|
-
font-size: dt('badge.lg.font.size');
|
|
259
|
-
min-width: dt('badge.lg.min.width');
|
|
260
|
-
height: dt('badge.lg.height');
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.p-badge-xl {
|
|
264
|
-
font-size: dt('badge.xl.font.size');
|
|
265
|
-
min-width: dt('badge.xl.min.width');
|
|
266
|
-
height: dt('badge.xl.height');
|
|
267
|
-
}
|
|
268
|
-
`,classes:{root:function(e){var t=e.props,n=e.instance;return[`p-badge p-component`,{"p-badge-circle":qf(t.value)&&String(t.value).length===1,"p-badge-dot":Hf(t.value)&&!n.$slots.default,"p-badge-sm":t.size===`small`,"p-badge-lg":t.size===`large`,"p-badge-xl":t.size===`xlarge`,"p-badge-info":t.severity===`info`,"p-badge-success":t.severity===`success`,"p-badge-warn":t.severity===`warn`,"p-badge-danger":t.severity===`danger`,"p-badge-secondary":t.severity===`secondary`,"p-badge-contrast":t.severity===`contrast`}]}}}),gh={name:`BaseBadge`,extends:Qm,props:{value:{type:[String,Number],default:null},severity:{type:String,default:null},size:{type:String,default:null}},style:hh,provide:function(){return{$pcBadge:this,$parentInstance:this}}};function _h(e){"@babel/helpers - typeof";return _h=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_h(e)}function vh(e,t,n){return(t=yh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yh(e){var t=bh(e,`string`);return _h(t)==`symbol`?t:t+``}function bh(e,t){if(_h(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_h(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var xh={name:`Badge`,extends:gh,inheritAttrs:!1,computed:{dataP:function(){return Nd(vh(vh({circle:this.value!=null&&String(this.value).length===1,empty:this.value==null&&!this.$slots.default},this.severity,this.severity),this.size,this.size))}}},Sh=[`data-p`];function Ch(e,t,n,r,i,a){return q(),c(`span`,U({class:e.cx(`root`),"data-p":a.dataP},e.ptmi(`root`)),[m(e.$slots,`default`,{},function(){return[Ye(Oe(e.value),1)]})],16,Sh)}xh.render=Ch;var wh=Ff();function Th(e){"@babel/helpers - typeof";return Th=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Th(e)}function Eh(e,t){return jh(e)||Ah(e,t)||Oh(e,t)||Dh()}function Dh(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
269
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Oh(e,t){if(e){if(typeof e==`string`)return kh(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kh(e,t):void 0}}function kh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ah(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function jh(e){if(Array.isArray(e))return e}function Mh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Nh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Mh(Object(n),!0).forEach(function(t){Ph(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ph(e,t,n){return(t=Fh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fh(e){var t=Ih(e,`string`);return Th(t)==`symbol`?t:t+``}function Ih(e,t){if(Th(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Th(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Lh={_getMeta:function(){return[Zf(arguments.length<=0?void 0:arguments[0])||arguments.length<=0?void 0:arguments[0],np(Zf(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:arguments.length<=1?void 0:arguments[1])]},_getConfig:function(e,t){var n,r;return((e==null||(n=e.instance)==null?void 0:n.$primevue)||(t==null||(r=t.ctx)==null||(r=r.appContext)==null||(r=r.config)==null||(r=r.globalProperties)==null?void 0:r.$primevue))?.config},_getOptionValue:ap,_getPTValue:function(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:``,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=function(){var e=Lh._getOptionValue.apply(Lh,arguments);return rp(e)||op(e)?{class:e}:e},s=((e=t.binding)==null||(e=e.value)==null?void 0:e.ptOptions)||t.$primevueConfig?.ptOptions||{},c=s.mergeSections,l=c===void 0?!0:c,u=s.mergeProps,d=u===void 0?!1:u,f=a?Lh._useDefaultPT(t,t.defaultPT(),o,r,i):void 0,p=Lh._usePT(t,Lh._getPT(n,t.$name),o,r,Nh(Nh({},i),{},{global:f||{}})),m=Lh._getPTDatasets(t,r);return l||!l&&p?d?Lh._mergeProps(t,d,f,p,m):Nh(Nh(Nh({},f),p),m):Nh(Nh({},p),m)},_getPTDatasets:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``,n=`data-pc-`;return Nh(Nh({},t===`root`&&Ph({},`${n}name`,ip(e.$name))),{},Ph({},`${n}section`,ip(t)))},_getPT:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``,n=arguments.length>2?arguments[2]:void 0,r=function(e){var r=n?n(e):e,i=ip(t);return r?.[i]??r};return e&&Object.hasOwn(e,`_usept`)?{_usept:e._usept,originalValue:r(e.originalValue),value:r(e.value)}:r(e)},_usePT:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,a=function(e){return n(e,r,i)};if(t&&Object.hasOwn(t,`_usept`)){var o=t._usept||e.$primevueConfig?.ptOptions||{},s=o.mergeSections,c=s===void 0?!0:s,l=o.mergeProps,u=l===void 0?!1:l,d=a(t.originalValue),f=a(t.value);return d===void 0&&f===void 0?void 0:rp(f)?f:rp(d)?d:c||!c&&f?u?Lh._mergeProps(e,u,d,f):Nh(Nh({},d),f):f}return a(t)},_useDefaultPT:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;return Lh._usePT(e,t,n,r,i)},_loadStyles:function(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=Lh._getConfig(n,r),a={nonce:i==null||(e=i.csp)==null?void 0:e.nonce};Lh._loadCoreStyles(t,a),Lh._loadThemeStyles(t,a),Lh._loadScopedThemeStyles(t,a),Lh._removeThemeListeners(t),t.$loadStyles=function(){return Lh._loadThemeStyles(t,a)},Lh._themeChangeListener(t.$loadStyles)},_loadCoreStyles:function(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(!sm.isStyleNameLoaded(t.$style?.name)&&(e=t.$style)!=null&&e.name){var r;Fm.loadCSS(n),(r=t.$style)==null||r.loadCSS(n),sm.setLoadedStyleName(t.$style.name)}},_loadThemeStyles:function(){var e,t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(!(n!=null&&n.isUnstyled()||(n==null||(e=n.theme)==null?void 0:e.call(n))===`none`)){if(!tm.isStyleNameLoaded(`common`)){var i,a,o=((i=n.$style)==null||(a=i.getCommonTheme)==null?void 0:a.call(i))||{},s=o.primitive,c=o.semantic,l=o.global,u=o.style;Fm.load(s?.css,Nh({name:`primitive-variables`},r)),Fm.load(c?.css,Nh({name:`semantic-variables`},r)),Fm.load(l?.css,Nh({name:`global-variables`},r)),Fm.loadStyle(Nh({name:`global-style`},r),u),tm.setLoadedStyleName(`common`)}if(!tm.isStyleNameLoaded(n.$style?.name)&&(t=n.$style)!=null&&t.name){var d,f,p,m,h=((d=n.$style)==null||(f=d.getDirectiveTheme)==null?void 0:f.call(d))||{},g=h.css,_=h.style;(p=n.$style)==null||p.load(g,Nh({name:`${n.$style.name}-variables`},r)),(m=n.$style)==null||m.loadStyle(Nh({name:`${n.$style.name}-style`},r),_),tm.setLoadedStyleName(n.$style.name)}if(!tm.isStyleNameLoaded(`layer-order`)){var v,y,b=(v=n.$style)==null||(y=v.getLayerOrderThemeCSS)==null?void 0:y.call(v);Fm.load(b,Nh({name:`layer-order`,first:!0},r)),tm.setLoadedStyleName(`layer-order`)}}},_loadScopedThemeStyles:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=e.preset();if(n&&e.$attrSelector){var r,i,a=(((r=e.$style)==null||(i=r.getPresetTheme)==null?void 0:i.call(r,n,`[${e.$attrSelector}]`))||{}).css;e.scopedStyleEl=(e.$style?.load(a,Nh({name:`${e.$attrSelector}-${e.$style.name}`},t))).el}},_themeChangeListener:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){};sm.clearLoadedStyleNames(),Pp.on(`theme:change`,e)},_removeThemeListeners:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pp.off(`theme:change`,e.$loadStyles),e.$loadStyles=void 0},_hook:function(e,t,n,r,i,a){var o,s,c=`on${_p(t)}`,l=Lh._getConfig(r,i),u=n?.$instance,d=Lh._usePT(u,Lh._getPT(r==null||(o=r.value)==null?void 0:o.pt,e),Lh._getOptionValue,`hooks.${c}`),f=Lh._useDefaultPT(u,l==null||(s=l.pt)==null||(s=s.directives)==null?void 0:s[e],Lh._getOptionValue,`hooks.${c}`),p={el:n,binding:r,vnode:i,prevVnode:a};d?.(u,p),f?.(u,p)},_mergeProps:function(){var e=arguments.length>1?arguments[1]:void 0,t=[...arguments].slice(2);return Kf(e)?e.apply(void 0,t):U.apply(void 0,t)},_extend:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=function(n,r,i,a,o){var s,c,l;r._$instances=r._$instances||{};var u=Lh._getConfig(i,a),d=r._$instances[e]||{},f=Hf(d)?Nh(Nh({},t),t?.methods):{};r._$instances[e]=Nh(Nh({},d),{},{$name:e,$host:r,$binding:i,$modifiers:i?.modifiers,$value:i?.value,$el:d.$el||r||void 0,$style:Nh({classes:void 0,inlineStyles:void 0,load:function(){},loadCSS:function(){},loadStyle:function(){}},t?.style),$primevueConfig:u,$attrSelector:(s=r.$pd)==null||(s=s[e])==null?void 0:s.attrSelector,defaultPT:function(){return Lh._getPT(u?.pt,void 0,function(t){var n;return t==null||(n=t.directives)==null?void 0:n[e]})},isUnstyled:function(){var t,n;return((t=r._$instances[e])==null||(t=t.$binding)==null||(t=t.value)==null?void 0:t.unstyled)===void 0?u?.unstyled:(n=r._$instances[e])==null||(n=n.$binding)==null||(n=n.value)==null?void 0:n.unstyled},theme:function(){var t;return(t=r._$instances[e])==null||(t=t.$primevueConfig)==null?void 0:t.theme},preset:function(){var t;return(t=r._$instances[e])==null||(t=t.$binding)==null||(t=t.value)==null?void 0:t.dt},ptm:function(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Lh._getPTValue(r._$instances[e],(t=r._$instances[e])==null||(t=t.$binding)==null||(t=t.value)==null?void 0:t.pt,n,Nh({},i))},ptmo:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:``,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Lh._getPTValue(r._$instances[e],t,n,i,!1)},cx:function(){var t,n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return(t=r._$instances[e])!=null&&t.isUnstyled()?void 0:Lh._getOptionValue((n=r._$instances[e])==null||(n=n.$style)==null?void 0:n.classes,i,Nh({},a))},sx:function(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return i?Lh._getOptionValue((t=r._$instances[e])==null||(t=t.$style)==null?void 0:t.inlineStyles,n,Nh({},a)):void 0}},f),r.$instance=r._$instances[e],(c=(l=r.$instance)[n])==null||c.call(l,r,i,a,o),r[`\$${e}`]=r.$instance,Lh._hook(e,n,r,i,a,o),r.$pd||={},r.$pd[e]=Nh(Nh({},r.$pd?.[e]),{},{name:e,instance:r._$instances[e]})},r=function(t){var n,r,i,a=t._$instances[e],o=a?.watch,s=function(e){var t,n=e.newValue,r=e.oldValue;return o==null||(t=o.config)==null?void 0:t.call(a,n,r)},c=function(e){var t,n=e.newValue,r=e.oldValue;return o==null||(t=o[`config.ripple`])==null?void 0:t.call(a,n,r)};a.$watchersCallback={config:s,"config.ripple":c},o==null||(n=o.config)==null||n.call(a,a?.$primevueConfig),wh.on(`config:change`,s),o==null||(r=o[`config.ripple`])==null||r.call(a,a==null||(i=a.$primevueConfig)==null?void 0:i.ripple),wh.on(`config:ripple:change`,c)},i=function(t){var n=t._$instances[e].$watchersCallback;n&&(wh.off(`config:change`,n.config),wh.off(`config:ripple:change`,n[`config.ripple`]),t._$instances[e].$watchersCallback=void 0)};return{created:function(t,r,i,a){t.$pd||={},t.$pd[e]={name:e,attrSelector:bp(`pd`)},n(`created`,t,r,i,a)},beforeMount:function(t,i,a,o){Lh._loadStyles(t.$pd[e]?.instance,i,a),n(`beforeMount`,t,i,a,o),r(t)},mounted:function(t,r,i,a){Lh._loadStyles(t.$pd[e]?.instance,r,i),n(`mounted`,t,r,i,a)},beforeUpdate:function(e,t,r,i){n(`beforeUpdate`,e,t,r,i)},updated:function(t,r,i,a){Lh._loadStyles(t.$pd[e]?.instance,r,i),n(`updated`,t,r,i,a)},beforeUnmount:function(t,r,a,o){i(t),Lh._removeThemeListeners(t.$pd[e]?.instance),n(`beforeUnmount`,t,r,a,o)},unmounted:function(t,r,i,a){var o;(o=t.$pd[e])==null||(o=o.instance)==null||(o=o.scopedStyleEl)==null||(o=o.value)==null||o.remove(),n(`unmounted`,t,r,i,a)}}},extend:function(){var e=Eh(Lh._getMeta.apply(Lh,arguments),2),t=e[0],n=e[1];return Nh({extend:function(){var e=Eh(Lh._getMeta.apply(Lh,arguments),2),t=e[0],r=e[1];return Lh.extend(t,Nh(Nh(Nh({},n),n?.methods),r))}},Lh._extend(t,n))}},Rh=Fm.extend({name:`ripple-directive`,style:`
|
|
270
|
-
.p-ink {
|
|
271
|
-
display: block;
|
|
272
|
-
position: absolute;
|
|
273
|
-
background: dt('ripple.background');
|
|
274
|
-
border-radius: 100%;
|
|
275
|
-
transform: scale(0);
|
|
276
|
-
pointer-events: none;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.p-ink-active {
|
|
280
|
-
animation: ripple 0.4s linear;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
@keyframes ripple {
|
|
284
|
-
100% {
|
|
285
|
-
opacity: 0;
|
|
286
|
-
transform: scale(2.5);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
`,classes:{root:`p-ink`}}),zh=Lh.extend({style:Rh});function Bh(e){"@babel/helpers - typeof";return Bh=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Bh(e)}function Vh(e){return Gh(e)||Wh(e)||Uh(e)||Hh()}function Hh(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
290
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uh(e,t){if(e){if(typeof e==`string`)return Kh(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kh(e,t):void 0}}function Wh(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Gh(e){if(Array.isArray(e))return Kh(e)}function Kh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function qh(e,t,n){return(t=Jh(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jh(e){var t=Yh(e,`string`);return Bh(t)==`symbol`?t:t+``}function Yh(e,t){if(Bh(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Bh(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Xh=zh.extend(`ripple`,{watch:{"config.ripple":function(e){e?(this.createRipple(this.$host),this.bindEvents(this.$host),this.$host.setAttribute(`data-pd-ripple`,!0),this.$host.style.overflow=`hidden`,this.$host.style.position=`relative`):(this.remove(this.$host),this.$host.removeAttribute(`data-pd-ripple`))}},unmounted:function(e){this.remove(e)},timeout:void 0,methods:{bindEvents:function(e){e.addEventListener(`mousedown`,this.onMouseDown.bind(this))},unbindEvents:function(e){e.removeEventListener(`mousedown`,this.onMouseDown.bind(this))},createRipple:function(e){var t=this.getInk(e);t||(t=af(`span`,qh(qh({role:`presentation`,"aria-hidden":!0,"data-p-ink":!0,"data-p-ink-active":!1,class:!this.isUnstyled()&&this.cx(`root`),onAnimationEnd:this.onAnimationEnd.bind(this)},this.$attrSelector,``),`p-bind`,this.ptm(`root`))),e.appendChild(t),this.$el=t)},remove:function(e){var t=this.getInk(e);t&&(this.$host.style.overflow=``,this.$host.style.position=``,this.unbindEvents(e),t.removeEventListener(`animationend`,this.onAnimationEnd),t.remove())},onMouseDown:function(e){var t=this,n=e.currentTarget,r=this.getInk(n);if(!(!r||getComputedStyle(r,null).display===`none`)){if(!this.isUnstyled()&&Bd(r,`p-ink-active`),r.setAttribute(`data-p-ink-active`,`false`),!pf(r)&&!Tf(r)){var i=Math.max(Zd(n),bf(n));r.style.height=i+`px`,r.style.width=i+`px`}var a=yf(n),o=e.pageX-a.left+document.body.scrollTop-Tf(r)/2,s=e.pageY-a.top+document.body.scrollLeft-pf(r)/2;r.style.top=s+`px`,r.style.left=o+`px`,!this.isUnstyled()&&Fd(r,`p-ink-active`),r.setAttribute(`data-p-ink-active`,`true`),this.timeout=setTimeout(function(){r&&(!t.isUnstyled()&&Bd(r,`p-ink-active`),r.setAttribute(`data-p-ink-active`,`false`))},401)}},onAnimationEnd:function(e){this.timeout&&clearTimeout(this.timeout),!this.isUnstyled()&&Bd(e.currentTarget,`p-ink-active`),e.currentTarget.setAttribute(`data-p-ink-active`,`false`)},getInk:function(e){return e&&e.children?Vh(e.children).find(function(e){return uf(e,`data-pc-name`)===`ripple`}):void 0}}}),Zh=`
|
|
291
|
-
.p-button {
|
|
292
|
-
display: inline-flex;
|
|
293
|
-
cursor: pointer;
|
|
294
|
-
user-select: none;
|
|
295
|
-
align-items: center;
|
|
296
|
-
justify-content: center;
|
|
297
|
-
overflow: hidden;
|
|
298
|
-
position: relative;
|
|
299
|
-
color: dt('button.primary.color');
|
|
300
|
-
background: dt('button.primary.background');
|
|
301
|
-
border: 1px solid dt('button.primary.border.color');
|
|
302
|
-
padding: dt('button.padding.y') dt('button.padding.x');
|
|
303
|
-
font-size: 1rem;
|
|
304
|
-
font-family: inherit;
|
|
305
|
-
font-feature-settings: inherit;
|
|
306
|
-
transition:
|
|
307
|
-
background dt('button.transition.duration'),
|
|
308
|
-
color dt('button.transition.duration'),
|
|
309
|
-
border-color dt('button.transition.duration'),
|
|
310
|
-
outline-color dt('button.transition.duration'),
|
|
311
|
-
box-shadow dt('button.transition.duration');
|
|
312
|
-
border-radius: dt('button.border.radius');
|
|
313
|
-
outline-color: transparent;
|
|
314
|
-
gap: dt('button.gap');
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.p-button:disabled {
|
|
318
|
-
cursor: default;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.p-button-icon-right {
|
|
322
|
-
order: 1;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
.p-button-icon-right:dir(rtl) {
|
|
326
|
-
order: -1;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
.p-button:not(.p-button-vertical) .p-button-icon:not(.p-button-icon-right):dir(rtl) {
|
|
330
|
-
order: 1;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.p-button-icon-bottom {
|
|
334
|
-
order: 2;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.p-button-icon-only {
|
|
338
|
-
width: dt('button.icon.only.width');
|
|
339
|
-
padding-inline-start: 0;
|
|
340
|
-
padding-inline-end: 0;
|
|
341
|
-
gap: 0;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.p-button-icon-only.p-button-rounded {
|
|
345
|
-
border-radius: 50%;
|
|
346
|
-
height: dt('button.icon.only.width');
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.p-button-icon-only .p-button-label {
|
|
350
|
-
visibility: hidden;
|
|
351
|
-
width: 0;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
.p-button-icon-only::after {
|
|
355
|
-
content: "\xA0";
|
|
356
|
-
visibility: hidden;
|
|
357
|
-
width: 0;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.p-button-sm {
|
|
361
|
-
font-size: dt('button.sm.font.size');
|
|
362
|
-
padding: dt('button.sm.padding.y') dt('button.sm.padding.x');
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
.p-button-sm .p-button-icon {
|
|
366
|
-
font-size: dt('button.sm.font.size');
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
.p-button-sm.p-button-icon-only {
|
|
370
|
-
width: dt('button.sm.icon.only.width');
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
.p-button-sm.p-button-icon-only.p-button-rounded {
|
|
374
|
-
height: dt('button.sm.icon.only.width');
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.p-button-lg {
|
|
378
|
-
font-size: dt('button.lg.font.size');
|
|
379
|
-
padding: dt('button.lg.padding.y') dt('button.lg.padding.x');
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
.p-button-lg .p-button-icon {
|
|
383
|
-
font-size: dt('button.lg.font.size');
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
.p-button-lg.p-button-icon-only {
|
|
387
|
-
width: dt('button.lg.icon.only.width');
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
.p-button-lg.p-button-icon-only.p-button-rounded {
|
|
391
|
-
height: dt('button.lg.icon.only.width');
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.p-button-vertical {
|
|
395
|
-
flex-direction: column;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.p-button-label {
|
|
399
|
-
font-weight: dt('button.label.font.weight');
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.p-button-fluid {
|
|
403
|
-
width: 100%;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
.p-button-fluid.p-button-icon-only {
|
|
407
|
-
width: dt('button.icon.only.width');
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
.p-button:not(:disabled):hover {
|
|
411
|
-
background: dt('button.primary.hover.background');
|
|
412
|
-
border: 1px solid dt('button.primary.hover.border.color');
|
|
413
|
-
color: dt('button.primary.hover.color');
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
.p-button:not(:disabled):active {
|
|
417
|
-
background: dt('button.primary.active.background');
|
|
418
|
-
border: 1px solid dt('button.primary.active.border.color');
|
|
419
|
-
color: dt('button.primary.active.color');
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
.p-button:focus-visible {
|
|
423
|
-
box-shadow: dt('button.primary.focus.ring.shadow');
|
|
424
|
-
outline: dt('button.focus.ring.width') dt('button.focus.ring.style') dt('button.primary.focus.ring.color');
|
|
425
|
-
outline-offset: dt('button.focus.ring.offset');
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.p-button .p-badge {
|
|
429
|
-
min-width: dt('button.badge.size');
|
|
430
|
-
height: dt('button.badge.size');
|
|
431
|
-
line-height: dt('button.badge.size');
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
.p-button-raised {
|
|
435
|
-
box-shadow: dt('button.raised.shadow');
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
.p-button-rounded {
|
|
439
|
-
border-radius: dt('button.rounded.border.radius');
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
.p-button-secondary {
|
|
443
|
-
background: dt('button.secondary.background');
|
|
444
|
-
border: 1px solid dt('button.secondary.border.color');
|
|
445
|
-
color: dt('button.secondary.color');
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
.p-button-secondary:not(:disabled):hover {
|
|
449
|
-
background: dt('button.secondary.hover.background');
|
|
450
|
-
border: 1px solid dt('button.secondary.hover.border.color');
|
|
451
|
-
color: dt('button.secondary.hover.color');
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
.p-button-secondary:not(:disabled):active {
|
|
455
|
-
background: dt('button.secondary.active.background');
|
|
456
|
-
border: 1px solid dt('button.secondary.active.border.color');
|
|
457
|
-
color: dt('button.secondary.active.color');
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.p-button-secondary:focus-visible {
|
|
461
|
-
outline-color: dt('button.secondary.focus.ring.color');
|
|
462
|
-
box-shadow: dt('button.secondary.focus.ring.shadow');
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
.p-button-success {
|
|
466
|
-
background: dt('button.success.background');
|
|
467
|
-
border: 1px solid dt('button.success.border.color');
|
|
468
|
-
color: dt('button.success.color');
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
.p-button-success:not(:disabled):hover {
|
|
472
|
-
background: dt('button.success.hover.background');
|
|
473
|
-
border: 1px solid dt('button.success.hover.border.color');
|
|
474
|
-
color: dt('button.success.hover.color');
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
.p-button-success:not(:disabled):active {
|
|
478
|
-
background: dt('button.success.active.background');
|
|
479
|
-
border: 1px solid dt('button.success.active.border.color');
|
|
480
|
-
color: dt('button.success.active.color');
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
.p-button-success:focus-visible {
|
|
484
|
-
outline-color: dt('button.success.focus.ring.color');
|
|
485
|
-
box-shadow: dt('button.success.focus.ring.shadow');
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
.p-button-info {
|
|
489
|
-
background: dt('button.info.background');
|
|
490
|
-
border: 1px solid dt('button.info.border.color');
|
|
491
|
-
color: dt('button.info.color');
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
.p-button-info:not(:disabled):hover {
|
|
495
|
-
background: dt('button.info.hover.background');
|
|
496
|
-
border: 1px solid dt('button.info.hover.border.color');
|
|
497
|
-
color: dt('button.info.hover.color');
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.p-button-info:not(:disabled):active {
|
|
501
|
-
background: dt('button.info.active.background');
|
|
502
|
-
border: 1px solid dt('button.info.active.border.color');
|
|
503
|
-
color: dt('button.info.active.color');
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
.p-button-info:focus-visible {
|
|
507
|
-
outline-color: dt('button.info.focus.ring.color');
|
|
508
|
-
box-shadow: dt('button.info.focus.ring.shadow');
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
.p-button-warn {
|
|
512
|
-
background: dt('button.warn.background');
|
|
513
|
-
border: 1px solid dt('button.warn.border.color');
|
|
514
|
-
color: dt('button.warn.color');
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
.p-button-warn:not(:disabled):hover {
|
|
518
|
-
background: dt('button.warn.hover.background');
|
|
519
|
-
border: 1px solid dt('button.warn.hover.border.color');
|
|
520
|
-
color: dt('button.warn.hover.color');
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
.p-button-warn:not(:disabled):active {
|
|
524
|
-
background: dt('button.warn.active.background');
|
|
525
|
-
border: 1px solid dt('button.warn.active.border.color');
|
|
526
|
-
color: dt('button.warn.active.color');
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
.p-button-warn:focus-visible {
|
|
530
|
-
outline-color: dt('button.warn.focus.ring.color');
|
|
531
|
-
box-shadow: dt('button.warn.focus.ring.shadow');
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
.p-button-help {
|
|
535
|
-
background: dt('button.help.background');
|
|
536
|
-
border: 1px solid dt('button.help.border.color');
|
|
537
|
-
color: dt('button.help.color');
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
.p-button-help:not(:disabled):hover {
|
|
541
|
-
background: dt('button.help.hover.background');
|
|
542
|
-
border: 1px solid dt('button.help.hover.border.color');
|
|
543
|
-
color: dt('button.help.hover.color');
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
.p-button-help:not(:disabled):active {
|
|
547
|
-
background: dt('button.help.active.background');
|
|
548
|
-
border: 1px solid dt('button.help.active.border.color');
|
|
549
|
-
color: dt('button.help.active.color');
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
.p-button-help:focus-visible {
|
|
553
|
-
outline-color: dt('button.help.focus.ring.color');
|
|
554
|
-
box-shadow: dt('button.help.focus.ring.shadow');
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
.p-button-danger {
|
|
558
|
-
background: dt('button.danger.background');
|
|
559
|
-
border: 1px solid dt('button.danger.border.color');
|
|
560
|
-
color: dt('button.danger.color');
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
.p-button-danger:not(:disabled):hover {
|
|
564
|
-
background: dt('button.danger.hover.background');
|
|
565
|
-
border: 1px solid dt('button.danger.hover.border.color');
|
|
566
|
-
color: dt('button.danger.hover.color');
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
.p-button-danger:not(:disabled):active {
|
|
570
|
-
background: dt('button.danger.active.background');
|
|
571
|
-
border: 1px solid dt('button.danger.active.border.color');
|
|
572
|
-
color: dt('button.danger.active.color');
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
.p-button-danger:focus-visible {
|
|
576
|
-
outline-color: dt('button.danger.focus.ring.color');
|
|
577
|
-
box-shadow: dt('button.danger.focus.ring.shadow');
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
.p-button-contrast {
|
|
581
|
-
background: dt('button.contrast.background');
|
|
582
|
-
border: 1px solid dt('button.contrast.border.color');
|
|
583
|
-
color: dt('button.contrast.color');
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
.p-button-contrast:not(:disabled):hover {
|
|
587
|
-
background: dt('button.contrast.hover.background');
|
|
588
|
-
border: 1px solid dt('button.contrast.hover.border.color');
|
|
589
|
-
color: dt('button.contrast.hover.color');
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
.p-button-contrast:not(:disabled):active {
|
|
593
|
-
background: dt('button.contrast.active.background');
|
|
594
|
-
border: 1px solid dt('button.contrast.active.border.color');
|
|
595
|
-
color: dt('button.contrast.active.color');
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
.p-button-contrast:focus-visible {
|
|
599
|
-
outline-color: dt('button.contrast.focus.ring.color');
|
|
600
|
-
box-shadow: dt('button.contrast.focus.ring.shadow');
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
.p-button-outlined {
|
|
604
|
-
background: transparent;
|
|
605
|
-
border-color: dt('button.outlined.primary.border.color');
|
|
606
|
-
color: dt('button.outlined.primary.color');
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
.p-button-outlined:not(:disabled):hover {
|
|
610
|
-
background: dt('button.outlined.primary.hover.background');
|
|
611
|
-
border-color: dt('button.outlined.primary.border.color');
|
|
612
|
-
color: dt('button.outlined.primary.color');
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
.p-button-outlined:not(:disabled):active {
|
|
616
|
-
background: dt('button.outlined.primary.active.background');
|
|
617
|
-
border-color: dt('button.outlined.primary.border.color');
|
|
618
|
-
color: dt('button.outlined.primary.color');
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
.p-button-outlined.p-button-secondary {
|
|
622
|
-
border-color: dt('button.outlined.secondary.border.color');
|
|
623
|
-
color: dt('button.outlined.secondary.color');
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
.p-button-outlined.p-button-secondary:not(:disabled):hover {
|
|
627
|
-
background: dt('button.outlined.secondary.hover.background');
|
|
628
|
-
border-color: dt('button.outlined.secondary.border.color');
|
|
629
|
-
color: dt('button.outlined.secondary.color');
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
.p-button-outlined.p-button-secondary:not(:disabled):active {
|
|
633
|
-
background: dt('button.outlined.secondary.active.background');
|
|
634
|
-
border-color: dt('button.outlined.secondary.border.color');
|
|
635
|
-
color: dt('button.outlined.secondary.color');
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
.p-button-outlined.p-button-success {
|
|
639
|
-
border-color: dt('button.outlined.success.border.color');
|
|
640
|
-
color: dt('button.outlined.success.color');
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
.p-button-outlined.p-button-success:not(:disabled):hover {
|
|
644
|
-
background: dt('button.outlined.success.hover.background');
|
|
645
|
-
border-color: dt('button.outlined.success.border.color');
|
|
646
|
-
color: dt('button.outlined.success.color');
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
.p-button-outlined.p-button-success:not(:disabled):active {
|
|
650
|
-
background: dt('button.outlined.success.active.background');
|
|
651
|
-
border-color: dt('button.outlined.success.border.color');
|
|
652
|
-
color: dt('button.outlined.success.color');
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
.p-button-outlined.p-button-info {
|
|
656
|
-
border-color: dt('button.outlined.info.border.color');
|
|
657
|
-
color: dt('button.outlined.info.color');
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
.p-button-outlined.p-button-info:not(:disabled):hover {
|
|
661
|
-
background: dt('button.outlined.info.hover.background');
|
|
662
|
-
border-color: dt('button.outlined.info.border.color');
|
|
663
|
-
color: dt('button.outlined.info.color');
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
.p-button-outlined.p-button-info:not(:disabled):active {
|
|
667
|
-
background: dt('button.outlined.info.active.background');
|
|
668
|
-
border-color: dt('button.outlined.info.border.color');
|
|
669
|
-
color: dt('button.outlined.info.color');
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
.p-button-outlined.p-button-warn {
|
|
673
|
-
border-color: dt('button.outlined.warn.border.color');
|
|
674
|
-
color: dt('button.outlined.warn.color');
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
.p-button-outlined.p-button-warn:not(:disabled):hover {
|
|
678
|
-
background: dt('button.outlined.warn.hover.background');
|
|
679
|
-
border-color: dt('button.outlined.warn.border.color');
|
|
680
|
-
color: dt('button.outlined.warn.color');
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
.p-button-outlined.p-button-warn:not(:disabled):active {
|
|
684
|
-
background: dt('button.outlined.warn.active.background');
|
|
685
|
-
border-color: dt('button.outlined.warn.border.color');
|
|
686
|
-
color: dt('button.outlined.warn.color');
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
.p-button-outlined.p-button-help {
|
|
690
|
-
border-color: dt('button.outlined.help.border.color');
|
|
691
|
-
color: dt('button.outlined.help.color');
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
.p-button-outlined.p-button-help:not(:disabled):hover {
|
|
695
|
-
background: dt('button.outlined.help.hover.background');
|
|
696
|
-
border-color: dt('button.outlined.help.border.color');
|
|
697
|
-
color: dt('button.outlined.help.color');
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
.p-button-outlined.p-button-help:not(:disabled):active {
|
|
701
|
-
background: dt('button.outlined.help.active.background');
|
|
702
|
-
border-color: dt('button.outlined.help.border.color');
|
|
703
|
-
color: dt('button.outlined.help.color');
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
.p-button-outlined.p-button-danger {
|
|
707
|
-
border-color: dt('button.outlined.danger.border.color');
|
|
708
|
-
color: dt('button.outlined.danger.color');
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
.p-button-outlined.p-button-danger:not(:disabled):hover {
|
|
712
|
-
background: dt('button.outlined.danger.hover.background');
|
|
713
|
-
border-color: dt('button.outlined.danger.border.color');
|
|
714
|
-
color: dt('button.outlined.danger.color');
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
.p-button-outlined.p-button-danger:not(:disabled):active {
|
|
718
|
-
background: dt('button.outlined.danger.active.background');
|
|
719
|
-
border-color: dt('button.outlined.danger.border.color');
|
|
720
|
-
color: dt('button.outlined.danger.color');
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
.p-button-outlined.p-button-contrast {
|
|
724
|
-
border-color: dt('button.outlined.contrast.border.color');
|
|
725
|
-
color: dt('button.outlined.contrast.color');
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
.p-button-outlined.p-button-contrast:not(:disabled):hover {
|
|
729
|
-
background: dt('button.outlined.contrast.hover.background');
|
|
730
|
-
border-color: dt('button.outlined.contrast.border.color');
|
|
731
|
-
color: dt('button.outlined.contrast.color');
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
.p-button-outlined.p-button-contrast:not(:disabled):active {
|
|
735
|
-
background: dt('button.outlined.contrast.active.background');
|
|
736
|
-
border-color: dt('button.outlined.contrast.border.color');
|
|
737
|
-
color: dt('button.outlined.contrast.color');
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
.p-button-outlined.p-button-plain {
|
|
741
|
-
border-color: dt('button.outlined.plain.border.color');
|
|
742
|
-
color: dt('button.outlined.plain.color');
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
.p-button-outlined.p-button-plain:not(:disabled):hover {
|
|
746
|
-
background: dt('button.outlined.plain.hover.background');
|
|
747
|
-
border-color: dt('button.outlined.plain.border.color');
|
|
748
|
-
color: dt('button.outlined.plain.color');
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
.p-button-outlined.p-button-plain:not(:disabled):active {
|
|
752
|
-
background: dt('button.outlined.plain.active.background');
|
|
753
|
-
border-color: dt('button.outlined.plain.border.color');
|
|
754
|
-
color: dt('button.outlined.plain.color');
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
.p-button-text {
|
|
758
|
-
background: transparent;
|
|
759
|
-
border-color: transparent;
|
|
760
|
-
color: dt('button.text.primary.color');
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
.p-button-text:not(:disabled):hover {
|
|
764
|
-
background: dt('button.text.primary.hover.background');
|
|
765
|
-
border-color: transparent;
|
|
766
|
-
color: dt('button.text.primary.color');
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
.p-button-text:not(:disabled):active {
|
|
770
|
-
background: dt('button.text.primary.active.background');
|
|
771
|
-
border-color: transparent;
|
|
772
|
-
color: dt('button.text.primary.color');
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
.p-button-text.p-button-secondary {
|
|
776
|
-
background: transparent;
|
|
777
|
-
border-color: transparent;
|
|
778
|
-
color: dt('button.text.secondary.color');
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
.p-button-text.p-button-secondary:not(:disabled):hover {
|
|
782
|
-
background: dt('button.text.secondary.hover.background');
|
|
783
|
-
border-color: transparent;
|
|
784
|
-
color: dt('button.text.secondary.color');
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
.p-button-text.p-button-secondary:not(:disabled):active {
|
|
788
|
-
background: dt('button.text.secondary.active.background');
|
|
789
|
-
border-color: transparent;
|
|
790
|
-
color: dt('button.text.secondary.color');
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
.p-button-text.p-button-success {
|
|
794
|
-
background: transparent;
|
|
795
|
-
border-color: transparent;
|
|
796
|
-
color: dt('button.text.success.color');
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
.p-button-text.p-button-success:not(:disabled):hover {
|
|
800
|
-
background: dt('button.text.success.hover.background');
|
|
801
|
-
border-color: transparent;
|
|
802
|
-
color: dt('button.text.success.color');
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
.p-button-text.p-button-success:not(:disabled):active {
|
|
806
|
-
background: dt('button.text.success.active.background');
|
|
807
|
-
border-color: transparent;
|
|
808
|
-
color: dt('button.text.success.color');
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
.p-button-text.p-button-info {
|
|
812
|
-
background: transparent;
|
|
813
|
-
border-color: transparent;
|
|
814
|
-
color: dt('button.text.info.color');
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
.p-button-text.p-button-info:not(:disabled):hover {
|
|
818
|
-
background: dt('button.text.info.hover.background');
|
|
819
|
-
border-color: transparent;
|
|
820
|
-
color: dt('button.text.info.color');
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
.p-button-text.p-button-info:not(:disabled):active {
|
|
824
|
-
background: dt('button.text.info.active.background');
|
|
825
|
-
border-color: transparent;
|
|
826
|
-
color: dt('button.text.info.color');
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
.p-button-text.p-button-warn {
|
|
830
|
-
background: transparent;
|
|
831
|
-
border-color: transparent;
|
|
832
|
-
color: dt('button.text.warn.color');
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
.p-button-text.p-button-warn:not(:disabled):hover {
|
|
836
|
-
background: dt('button.text.warn.hover.background');
|
|
837
|
-
border-color: transparent;
|
|
838
|
-
color: dt('button.text.warn.color');
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
.p-button-text.p-button-warn:not(:disabled):active {
|
|
842
|
-
background: dt('button.text.warn.active.background');
|
|
843
|
-
border-color: transparent;
|
|
844
|
-
color: dt('button.text.warn.color');
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
.p-button-text.p-button-help {
|
|
848
|
-
background: transparent;
|
|
849
|
-
border-color: transparent;
|
|
850
|
-
color: dt('button.text.help.color');
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
.p-button-text.p-button-help:not(:disabled):hover {
|
|
854
|
-
background: dt('button.text.help.hover.background');
|
|
855
|
-
border-color: transparent;
|
|
856
|
-
color: dt('button.text.help.color');
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
.p-button-text.p-button-help:not(:disabled):active {
|
|
860
|
-
background: dt('button.text.help.active.background');
|
|
861
|
-
border-color: transparent;
|
|
862
|
-
color: dt('button.text.help.color');
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
.p-button-text.p-button-danger {
|
|
866
|
-
background: transparent;
|
|
867
|
-
border-color: transparent;
|
|
868
|
-
color: dt('button.text.danger.color');
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
.p-button-text.p-button-danger:not(:disabled):hover {
|
|
872
|
-
background: dt('button.text.danger.hover.background');
|
|
873
|
-
border-color: transparent;
|
|
874
|
-
color: dt('button.text.danger.color');
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
.p-button-text.p-button-danger:not(:disabled):active {
|
|
878
|
-
background: dt('button.text.danger.active.background');
|
|
879
|
-
border-color: transparent;
|
|
880
|
-
color: dt('button.text.danger.color');
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
.p-button-text.p-button-contrast {
|
|
884
|
-
background: transparent;
|
|
885
|
-
border-color: transparent;
|
|
886
|
-
color: dt('button.text.contrast.color');
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
.p-button-text.p-button-contrast:not(:disabled):hover {
|
|
890
|
-
background: dt('button.text.contrast.hover.background');
|
|
891
|
-
border-color: transparent;
|
|
892
|
-
color: dt('button.text.contrast.color');
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
.p-button-text.p-button-contrast:not(:disabled):active {
|
|
896
|
-
background: dt('button.text.contrast.active.background');
|
|
897
|
-
border-color: transparent;
|
|
898
|
-
color: dt('button.text.contrast.color');
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
.p-button-text.p-button-plain {
|
|
902
|
-
background: transparent;
|
|
903
|
-
border-color: transparent;
|
|
904
|
-
color: dt('button.text.plain.color');
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
.p-button-text.p-button-plain:not(:disabled):hover {
|
|
908
|
-
background: dt('button.text.plain.hover.background');
|
|
909
|
-
border-color: transparent;
|
|
910
|
-
color: dt('button.text.plain.color');
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
.p-button-text.p-button-plain:not(:disabled):active {
|
|
914
|
-
background: dt('button.text.plain.active.background');
|
|
915
|
-
border-color: transparent;
|
|
916
|
-
color: dt('button.text.plain.color');
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
.p-button-link {
|
|
920
|
-
background: transparent;
|
|
921
|
-
border-color: transparent;
|
|
922
|
-
color: dt('button.link.color');
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
.p-button-link:not(:disabled):hover {
|
|
926
|
-
background: transparent;
|
|
927
|
-
border-color: transparent;
|
|
928
|
-
color: dt('button.link.hover.color');
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
.p-button-link:not(:disabled):hover .p-button-label {
|
|
932
|
-
text-decoration: underline;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
.p-button-link:not(:disabled):active {
|
|
936
|
-
background: transparent;
|
|
937
|
-
border-color: transparent;
|
|
938
|
-
color: dt('button.link.active.color');
|
|
939
|
-
}
|
|
940
|
-
`;function Qh(e){"@babel/helpers - typeof";return Qh=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Qh(e)}function $h(e,t,n){return(t=eg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eg(e){var t=tg(e,`string`);return Qh(t)==`symbol`?t:t+``}function tg(e,t){if(Qh(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qh(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var ng=Fm.extend({name:`button`,style:Zh,classes:{root:function(e){var t=e.instance,n=e.props;return[`p-button p-component`,$h($h($h($h($h($h($h($h($h({"p-button-icon-only":t.hasIcon&&!n.label&&!n.badge,"p-button-vertical":(n.iconPos===`top`||n.iconPos===`bottom`)&&n.label,"p-button-loading":n.loading,"p-button-link":n.link||n.variant===`link`},`p-button-${n.severity}`,n.severity),`p-button-raised`,n.raised),`p-button-rounded`,n.rounded),`p-button-text`,n.text||n.variant===`text`),`p-button-outlined`,n.outlined||n.variant===`outlined`),`p-button-sm`,n.size===`small`),`p-button-lg`,n.size===`large`),`p-button-plain`,n.plain),`p-button-fluid`,t.hasFluid)]},loadingIcon:`p-button-loading-icon`,icon:function(e){var t=e.props;return[`p-button-icon`,$h({},`p-button-icon-${t.iconPos}`,t.label)]},label:`p-button-label`}}),rg={name:`BaseButton`,extends:Qm,props:{label:{type:String,default:null},icon:{type:String,default:null},iconPos:{type:String,default:`left`},iconClass:{type:[String,Object],default:null},badge:{type:String,default:null},badgeClass:{type:[String,Object],default:null},badgeSeverity:{type:String,default:`secondary`},loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:void 0},as:{type:[String,Object],default:`BUTTON`},asChild:{type:Boolean,default:!1},link:{type:Boolean,default:!1},severity:{type:String,default:null},raised:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},text:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},size:{type:String,default:null},variant:{type:String,default:null},plain:{type:Boolean,default:!1},fluid:{type:Boolean,default:null}},style:ng,provide:function(){return{$pcButton:this,$parentInstance:this}}};function ig(e){"@babel/helpers - typeof";return ig=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},ig(e)}function ag(e,t,n){return(t=og(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function og(e){var t=sg(e,`string`);return ig(t)==`symbol`?t:t+``}function sg(e,t){if(ig(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ig(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var cg={name:`Button`,extends:rg,inheritAttrs:!1,inject:{$pcFluid:{default:null}},methods:{getPTOptions:function(e){return(e===`root`?this.ptmi:this.ptm)(e,{context:{disabled:this.disabled}})}},computed:{disabled:function(){return this.$attrs.disabled||this.$attrs.disabled===``||this.loading},defaultAriaLabel:function(){return this.label?this.label+(this.badge?` `+this.badge:``):this.$attrs.ariaLabel},hasIcon:function(){return this.icon||this.$slots.icon},attrs:function(){return U(this.asAttrs,this.a11yAttrs,this.getPTOptions(`root`))},asAttrs:function(){return this.as===`BUTTON`?{type:`button`,disabled:this.disabled}:void 0},a11yAttrs:function(){return{"aria-label":this.defaultAriaLabel,"data-pc-name":`button`,"data-p-disabled":this.disabled,"data-p-severity":this.severity}},hasFluid:function(){return Hf(this.fluid)?!!this.$pcFluid:this.fluid},dataP:function(){return Nd(ag(ag(ag(ag(ag(ag(ag(ag(ag(ag({},this.size,this.size),`icon-only`,this.hasIcon&&!this.label&&!this.badge),`loading`,this.loading),`fluid`,this.hasFluid),`rounded`,this.rounded),`raised`,this.raised),`outlined`,this.outlined||this.variant===`outlined`),`text`,this.text||this.variant===`text`),`link`,this.link||this.variant===`link`),`vertical`,(this.iconPos===`top`||this.iconPos===`bottom`)&&this.label))},dataIconP:function(){return Nd(ag(ag({},this.iconPos,this.iconPos),this.size,this.size))},dataLabelP:function(){return Nd(ag(ag({},this.size,this.size),`icon-only`,this.hasIcon&&!this.label&&!this.badge))}},components:{SpinnerIcon:sh,Badge:xh},directives:{ripple:Xh}},lg=[`data-p`],ug=[`data-p`];function dg(e,t,n,r,i,a){var o=F(`SpinnerIcon`),s=F(`Badge`),u=ze(`ripple`);return e.asChild?m(e.$slots,`default`,{key:1,class:Te(e.cx(`root`)),a11yAttrs:a.a11yAttrs}):C((q(),be(l(e.as),U({key:0,class:e.cx(`root`),"data-p":a.dataP},a.attrs),{default:ue(function(){return[m(e.$slots,`default`,{},function(){return[e.loading?m(e.$slots,`loadingicon`,U({key:0,class:[e.cx(`loadingIcon`),e.cx(`icon`)]},e.ptm(`loadingIcon`)),function(){return[e.loadingIcon?(q(),c(`span`,U({key:0,class:[e.cx(`loadingIcon`),e.cx(`icon`),e.loadingIcon]},e.ptm(`loadingIcon`)),null,16)):(q(),be(o,U({key:1,class:[e.cx(`loadingIcon`),e.cx(`icon`)],spin:``},e.ptm(`loadingIcon`)),null,16,[`class`]))]}):m(e.$slots,`icon`,U({key:1,class:[e.cx(`icon`)]},e.ptm(`icon`)),function(){return[e.icon?(q(),c(`span`,U({key:0,class:[e.cx(`icon`),e.icon,e.iconClass],"data-p":a.dataIconP},e.ptm(`icon`)),null,16,lg)):R(``,!0)]}),e.label?(q(),c(`span`,U({key:2,class:e.cx(`label`)},e.ptm(`label`),{"data-p":a.dataLabelP}),Oe(e.label),17,ug)):R(``,!0),e.badge?(q(),be(s,{key:3,value:e.badge,class:Te(e.badgeClass),severity:e.badgeSeverity,unstyled:e.unstyled,pt:e.ptm(`pcBadge`)},null,8,[`value`,`class`,`severity`,`unstyled`,`pt`])):R(``,!0)]})]}),_:3},16,[`class`,`data-p`])),[[u]])}cg.render=dg;var fg=Fm.extend({name:`progressspinner`,style:`
|
|
941
|
-
.p-progressspinner {
|
|
942
|
-
position: relative;
|
|
943
|
-
margin: 0 auto;
|
|
944
|
-
width: 100px;
|
|
945
|
-
height: 100px;
|
|
946
|
-
display: inline-block;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
.p-progressspinner::before {
|
|
950
|
-
content: '';
|
|
951
|
-
display: block;
|
|
952
|
-
padding-top: 100%;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
.p-progressspinner-spin {
|
|
956
|
-
height: 100%;
|
|
957
|
-
transform-origin: center center;
|
|
958
|
-
width: 100%;
|
|
959
|
-
position: absolute;
|
|
960
|
-
top: 0;
|
|
961
|
-
bottom: 0;
|
|
962
|
-
left: 0;
|
|
963
|
-
right: 0;
|
|
964
|
-
margin: auto;
|
|
965
|
-
animation: p-progressspinner-rotate 2s linear infinite;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
.p-progressspinner-circle {
|
|
969
|
-
stroke-dasharray: 89, 200;
|
|
970
|
-
stroke-dashoffset: 0;
|
|
971
|
-
stroke: dt('progressspinner.colorOne');
|
|
972
|
-
animation:
|
|
973
|
-
p-progressspinner-dash 1.5s ease-in-out infinite,
|
|
974
|
-
p-progressspinner-color 6s ease-in-out infinite;
|
|
975
|
-
stroke-linecap: round;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
@keyframes p-progressspinner-rotate {
|
|
979
|
-
100% {
|
|
980
|
-
transform: rotate(360deg);
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
@keyframes p-progressspinner-dash {
|
|
984
|
-
0% {
|
|
985
|
-
stroke-dasharray: 1, 200;
|
|
986
|
-
stroke-dashoffset: 0;
|
|
987
|
-
}
|
|
988
|
-
50% {
|
|
989
|
-
stroke-dasharray: 89, 200;
|
|
990
|
-
stroke-dashoffset: -35px;
|
|
991
|
-
}
|
|
992
|
-
100% {
|
|
993
|
-
stroke-dasharray: 89, 200;
|
|
994
|
-
stroke-dashoffset: -124px;
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
@keyframes p-progressspinner-color {
|
|
998
|
-
100%,
|
|
999
|
-
0% {
|
|
1000
|
-
stroke: dt('progressspinner.color.one');
|
|
1001
|
-
}
|
|
1002
|
-
40% {
|
|
1003
|
-
stroke: dt('progressspinner.color.two');
|
|
1004
|
-
}
|
|
1005
|
-
66% {
|
|
1006
|
-
stroke: dt('progressspinner.color.three');
|
|
1007
|
-
}
|
|
1008
|
-
80%,
|
|
1009
|
-
90% {
|
|
1010
|
-
stroke: dt('progressspinner.color.four');
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
`,classes:{root:`p-progressspinner`,spin:`p-progressspinner-spin`,circle:`p-progressspinner-circle`}}),pg={name:`ProgressSpinner`,extends:{name:`BaseProgressSpinner`,extends:Qm,props:{strokeWidth:{type:String,default:`2`},fill:{type:String,default:`none`},animationDuration:{type:String,default:`2s`}},style:fg,provide:function(){return{$pcProgressSpinner:this,$parentInstance:this}}},inheritAttrs:!1,computed:{svgStyle:function(){return{"animation-duration":this.animationDuration}}}},mg=[`fill`,`stroke-width`];function hg(e,t,n,r,i,a){return q(),c(`div`,U({class:e.cx(`root`),role:`progressbar`},e.ptmi(`root`)),[(q(),c(`svg`,U({class:e.cx(`spin`),viewBox:`25 25 50 50`,style:a.svgStyle},e.ptm(`spin`)),[V(`circle`,U({class:e.cx(`circle`),cx:`50`,cy:`50`,r:`20`,fill:e.fill,"stroke-width":e.strokeWidth,strokeMiterlimit:`10`},e.ptm(`circle`)),null,16,mg)],16))],16)}pg.render=hg;function gg(e){"@babel/helpers - typeof";return gg=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},gg(e)}function _g(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function vg(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,bg(r.key),r)}}function yg(e,t,n){return t&&vg(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function bg(e){var t=xg(e,`string`);return gg(t)==`symbol`?t:t+``}function xg(e,t){if(gg(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gg(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}var Sg=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){};_g(this,e),this.element=t,this.listener=n}return yg(e,[{key:`bindScrollListener`,value:function(){this.scrollableParents=Cf(this.element);for(var e=0;e<this.scrollableParents.length;e++)this.scrollableParents[e].addEventListener(`scroll`,this.listener)}},{key:`unbindScrollListener`,value:function(){if(this.scrollableParents)for(var e=0;e<this.scrollableParents.length;e++)this.scrollableParents[e].removeEventListener(`scroll`,this.listener)}},{key:`destroy`,value:function(){this.unbindScrollListener(),this.element=null,this.listener=null,this.scrollableParents=null}}])}();function Cg(e){"@babel/helpers - typeof";return Cg=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Cg(e)}function wg(e){return Og(e)||Dg(e)||Eg(e)||Tg()}function Tg(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1014
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eg(e,t){if(e){if(typeof e==`string`)return kg(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kg(e,t):void 0}}function Dg(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Og(e){if(Array.isArray(e))return kg(e)}function kg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ag(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function jg(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Pg(r.key),r)}}function Mg(e,t,n){return t&&jg(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ng(e,t,n){return(t=Pg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pg(e){var t=Fg(e,`string`);return Cg(t)==`symbol`?t:t+``}function Fg(e,t){if(Cg(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Cg(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}var Ig=function(){function e(t){var n=t.init,r=t.type;Ag(this,e),Ng(this,`helpers`,void 0),Ng(this,`type`,void 0),this.helpers=new Set(n),this.type=r}return Mg(e,[{key:`add`,value:function(e){this.helpers.add(e)}},{key:`update`,value:function(){}},{key:`delete`,value:function(e){this.helpers.delete(e)}},{key:`clear`,value:function(){this.helpers.clear()}},{key:`get`,value:function(e,t){var n=this._get(e,t),r=n?this._recursive(wg(this.helpers),n):null;return qf(r)?r:null}},{key:`_isMatched`,value:function(e,t){var n,r=e?.parent;return(r==null||(n=r.vnode)==null?void 0:n.key)===t||r&&this._isMatched(r,t)||!1}},{key:`_get`,value:function(e,t){var n,r;return((n=t||e?.$slots)==null||(r=n.default)==null?void 0:r.call(n))||null}},{key:`_recursive`,value:function(){var e=this,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=[];return n.forEach(function(n){n.children instanceof Array?r=r.concat(e._recursive(t,n.children)):n.type.name===e.type?r.push(n):qf(n.key)&&(r=r.concat(t.filter(function(t){return e._isMatched(t,n.key)}).map(function(e){return e.vnode})))}),r}}])}();function Lg(e,t){if(e){var n=e.props;if(n){var r=t.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase(),i=Object.prototype.hasOwnProperty.call(n,r)?r:t;return e.type.extends.props[t].type===Boolean&&n[i]===``?!0:n[i]}}return null}var Rg={name:`TimesIcon`,extends:oh};function zg(e){return Ug(e)||Hg(e)||Vg(e)||Bg()}function Bg(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1015
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vg(e,t){if(e){if(typeof e==`string`)return Wg(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wg(e,t):void 0}}function Hg(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Ug(e){if(Array.isArray(e))return Wg(e)}function Wg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Gg(e,t,n,r,i,a){return q(),c(`svg`,U({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),zg(t[0]||=[V(`path`,{d:`M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z`,fill:`currentColor`},null,-1)]),16)}Rg.render=Gg;var Kg=Fm.extend({name:`focustrap-directive`}),qg=Lh.extend({style:Kg});function Jg(e){"@babel/helpers - typeof";return Jg=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Jg(e)}function Yg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Yg(Object(n),!0).forEach(function(t){Zg(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zg(e,t,n){return(t=Qg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qg(e){var t=$g(e,`string`);return Jg(t)==`symbol`?t:t+``}function $g(e,t){if(Jg(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Jg(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var e_=qg.extend(`focustrap`,{mounted:function(e,t){(t.value||{}).disabled||(this.createHiddenFocusableElements(e,t),this.bind(e,t),this.autoElementFocus(e,t)),e.setAttribute(`data-pd-focustrap`,!0),this.$el=e},updated:function(e,t){(t.value||{}).disabled&&this.unbind(e)},unmounted:function(e){this.unbind(e)},methods:{getComputedSelector:function(e){return`:not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])${e??``}`},bind:function(e,t){var n=this,r=t.value||{},i=r.onFocusIn,a=r.onFocusOut;e.$_pfocustrap_mutationobserver=new MutationObserver(function(t){t.forEach(function(t){if(t.type===`childList`&&!e.contains(document.activeElement)){var r=function(t){var i=jf(t)?jf(t,n.getComputedSelector(e.$_pfocustrap_focusableselector))?t:ff(e,n.getComputedSelector(e.$_pfocustrap_focusableselector)):ff(t);return qf(i)?i:t.nextSibling&&r(t.nextSibling)};lf(r(t.nextSibling))}})}),e.$_pfocustrap_mutationobserver.disconnect(),e.$_pfocustrap_mutationobserver.observe(e,{childList:!0}),e.$_pfocustrap_focusinlistener=function(e){return i&&i(e)},e.$_pfocustrap_focusoutlistener=function(e){return a&&a(e)},e.addEventListener(`focusin`,e.$_pfocustrap_focusinlistener),e.addEventListener(`focusout`,e.$_pfocustrap_focusoutlistener)},unbind:function(e){e.$_pfocustrap_mutationobserver&&e.$_pfocustrap_mutationobserver.disconnect(),e.$_pfocustrap_focusinlistener&&e.removeEventListener(`focusin`,e.$_pfocustrap_focusinlistener)&&(e.$_pfocustrap_focusinlistener=null),e.$_pfocustrap_focusoutlistener&&e.removeEventListener(`focusout`,e.$_pfocustrap_focusoutlistener)&&(e.$_pfocustrap_focusoutlistener=null)},autoFocus:function(e){this.autoElementFocus(this.$el,{value:Xg(Xg({},e),{},{autoFocus:!0})})},autoElementFocus:function(e,t){var n=t.value||{},r=n.autoFocusSelector,i=r===void 0?``:r,a=n.firstFocusableSelector,o=a===void 0?``:a,s=n.autoFocus,c=s===void 0?!1:s,l=ff(e,`[autofocus]${this.getComputedSelector(i)}`);c&&!l&&(l=ff(e,this.getComputedSelector(o))),lf(l)},onFirstHiddenElementFocus:function(e){var t,n=e.currentTarget,r=e.relatedTarget;lf(r===n.$_pfocustrap_lasthiddenfocusableelement||!((t=this.$el)!=null&&t.contains(r))?ff(n.parentElement,this.getComputedSelector(n.$_pfocustrap_focusableselector)):n.$_pfocustrap_lasthiddenfocusableelement)},onLastHiddenElementFocus:function(e){var t,n=e.currentTarget,r=e.relatedTarget;lf(r===n.$_pfocustrap_firsthiddenfocusableelement||!((t=this.$el)!=null&&t.contains(r))?_f(n.parentElement,this.getComputedSelector(n.$_pfocustrap_focusableselector)):n.$_pfocustrap_firsthiddenfocusableelement)},createHiddenFocusableElements:function(e,t){var n=this,r=t.value||{},i=r.tabIndex,a=i===void 0?0:i,o=r.firstFocusableSelector,s=o===void 0?``:o,c=r.lastFocusableSelector,l=c===void 0?``:c,u=function(e){return af(`span`,{class:`p-hidden-accessible p-hidden-focusable`,tabIndex:a,role:`presentation`,"aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:e?.bind(n)})},d=u(this.onFirstHiddenElementFocus),f=u(this.onLastHiddenElementFocus);d.$_pfocustrap_lasthiddenfocusableelement=f,d.$_pfocustrap_focusableselector=s,d.setAttribute(`data-pc-section`,`firstfocusableelement`),f.$_pfocustrap_firsthiddenfocusableelement=d,f.$_pfocustrap_focusableselector=l,f.setAttribute(`data-pc-section`,`lastfocusableelement`),e.prepend(d),e.append(f)}}}),t_={name:`Portal`,props:{appendTo:{type:[String,Object],default:`body`},disabled:{type:Boolean,default:!1}},data:function(){return{mounted:!1}},mounted:function(){this.mounted=Af()},computed:{inline:function(){return this.disabled||this.appendTo===`self`}}};function n_(e,t,n,r,i,a){return a.inline?m(e.$slots,`default`,{key:0}):i.mounted?(q(),be(Je,{key:1,to:n.appendTo},[m(e.$slots,`default`)],8,[`to`])):R(``,!0)}t_.render=n_;var r_={};r_.NODE_ENV,r_.CAMERA_UI_RUNMODE,r_.CAMERA_UI_RUNMODE,r_.CAMERA_UI_RUNMODE;var i_=[`motion`,`audio`,`contact`,`doorbell`,`switch`,`light`,`siren`,`security_system`,`line-crossing`],a_;(function(e){e.FINISH_LAUNCHING=`finishLaunching`,e.SHUTDOWN=`shutdown`})(a_||={});var o_;(function(e){e.Hub=`hub`,e.SensorProvider=`sensorProvider`,e.CameraController=`cameraController`,e.CameraAndSensorProvider=`cameraAndSensorProvider`})(o_||={});var s_;(function(e){e.MotionDetection=`MotionDetection`,e.ObjectDetection=`ObjectDetection`,e.AudioDetection=`AudioDetection`,e.FaceDetection=`FaceDetection`,e.LicensePlateDetection=`LicensePlateDetection`,e.ClassifierDetection=`ClassifierDetection`,e.ClipDetection=`ClipDetection`,e.DiscoveryProvider=`DiscoveryProvider`,e.NVR=`NVR`,e.Notifier=`Notifier`,e.OAuthCapable=`OAuthCapable`,e.OAuthDeviceFlow=`OAuthDeviceFlow`,e.OAuthAuthCodeFlow=`OAuthAuthCodeFlow`,e.OAuthClientCredentials=`OAuthClientCredentials`})(s_||={});var c_;(function(e){e.PublishNotifications=`publishNotifications`})(c_||={});function l_(e){return e.role===o_.Hub}function u_(e){return e.role===o_.SensorProvider||e.role===o_.CameraAndSensorProvider}function d_(e){return e.role===o_.CameraController||e.role===o_.CameraAndSensorProvider}function f_(e,t){return e.interfaces.includes(t)}var p_;(function(e){e.Info=`info`,e.Warn=`warn`,e.Error=`error`,e.Critical=`critical`})(p_||={});var m_;(function(e){e.Motion=`motion`,e.Object=`object`,e.Audio=`audio`,e.Face=`face`,e.LicensePlate=`licensePlate`,e.Classifier=`classifier`,e.Clip=`clip`,e.Contact=`contact`,e.Temperature=`temperature`,e.Humidity=`humidity`,e.Occupancy=`occupancy`,e.Smoke=`smoke`,e.Leak=`leak`,e.Light=`light`,e.Siren=`siren`,e.Switch=`switch`,e.Lock=`lock`,e.PTZ=`ptz`,e.SecuritySystem=`securitySystem`,e.Garage=`garage`,e.Doorbell=`doorbell`,e.Battery=`battery`})(m_||={});var h_;(function(e){e.Sensor=`sensor`,e.Control=`control`,e.Trigger=`trigger`,e.Info=`info`})(h_||={});var g_=[`doorbell`,`glass_break`,`siren`,`speaking`,`gunshot`,`dog_bark`,`baby_cry`,`alarm`,`scream`,`cat`,`car_alarm`,`smoke_alarm`],__;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Decibels=`decibels`,e.LastTriggered=`lastTriggered`})(__||={});var v_;(function(e){e.LowBattery=`lowBattery`,e.Charging=`charging`})(v_||={});var y_;(function(e){e.Level=`level`,e.Charging=`charging`,e.Low=`low`})(y_||={});var b_;(function(e){e.NotChargeable=`NOT_CHARGEABLE`,e.NotCharging=`NOT_CHARGING`,e.Charging=`CHARGING`,e.Full=`FULL`})(b_||={});var x_;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Labels=`labels`})(x_||={});var S_;(function(e){e.Detected=`detected`})(S_||={});var C_=[`motion`,`person`,`vehicle`,`animal`,`package`,`audio`],w_=[`face`,`license_plate`],T_;(function(e){e.Ring=`ring`})(T_||={});var E_;(function(e){e.Detected=`detected`,e.Detections=`detections`})(E_||={});var D_;(function(e){e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e[e.Opening=2]=`Opening`,e[e.Closing=3]=`Closing`,e[e.Stopped=4]=`Stopped`})(D_||={});var O_;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`,e.ObstructionDetected=`obstructionDetected`})(O_||={});var k_;(function(e){e.Current=`current`})(k_||={});var A_;(function(e){e.Detected=`detected`})(A_||={});var j_;(function(e){e.Detected=`detected`,e.Detections=`detections`})(j_||={});var M_;(function(e){e.Brightness=`brightness`})(M_||={});var N_;(function(e){e.On=`on`,e.Brightness=`brightness`})(N_||={});var P_;(function(e){e[e.Secured=0]=`Secured`,e[e.Unsecured=1]=`Unsecured`,e[e.Unknown=2]=`Unknown`})(P_||={});var F_;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`})(F_||={});var I_;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Blocked=`blocked`,e.LastTriggered=`lastTriggered`})(I_||={});var L_;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Labels=`labels`})(L_||={});var R_;(function(e){e.Detected=`detected`})(R_||={});var z_;(function(e){e.Pan=`pan`,e.Tilt=`tilt`,e.Zoom=`zoom`,e.Presets=`presets`,e.Home=`home`})(z_||={});var B_;(function(e){e.Position=`position`,e.Moving=`moving`,e.Presets=`presets`,e.Velocity=`velocity`,e.TargetPreset=`targetPreset`})(B_||={});var V_;(function(e){e[e.StayArm=0]=`StayArm`,e[e.AwayArm=1]=`AwayArm`,e[e.NightArm=2]=`NightArm`,e[e.Disarmed=3]=`Disarmed`,e[e.AlarmTriggered=4]=`AlarmTriggered`})(V_||={});var H_;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`})(H_||={});var U_;(function(e){e.Volume=`volume`})(U_||={});var W_;(function(e){e.Active=`active`,e.Volume=`volume`})(W_||={});var G_;(function(e){e.Detected=`detected`})(G_||={});var K_;(function(e){e.On=`on`})(K_||={});var q_;(function(e){e.Current=`current`})(q_||={});function J_(e,t,n,r=[]){if(Array.isArray(e)&&Array.isArray(t)){let i=n?n(e,t,void 0,e,t,r):void 0;return i===void 0?[...e,...t]:i}if(typeof t!=`object`)return e;for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)){let a=e[i],o=t[i];r.push({key:i,sourceObject:e,targetObject:t});let s=n?n(a,o,i,e,t,r):void 0;s===void 0?Array.isArray(a)&&Array.isArray(o)?e[i]=[...a,...o]:typeof a==`object`&&a&&typeof o==`object`&&o?e[i]=J_({...a},o,n,r):e[i]=o:e[i]=s,r.pop()}return e}function Y_(e){return new Promise(t=>setTimeout(t,e))}function X_(e,t,n=!1){if(e===t)return!0;if((e===void 0||t===void 0||e===null||t===null)&&(e||t))return!1;let r=e?.constructor.name,i=t?.constructor.name;if(r!==i)return!1;if(r===`Array`&&i===`Array`){if(e.length!==t.length)return!1;if(n){let r=[...t];return e.every(e=>{let t=r.findIndex(t=>X_(e,t,n));return t===-1?!1:(r.splice(t,1),!0)})}else{let r=!0;for(let i=0;i<e.length;i++)if(!X_(e[i],t[i],n)){r=!1;break}return r}}if(r===`Object`&&i===`Object`){let r=!0,i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let a=0;a<i.length;a++)if(e[i[a]]&&t[i[a]]){if(e[i[a]]===t[i[a]])continue;if(e[i[a]]&&(e[i[a]].constructor.name===`Array`||e[i[a]].constructor.name===`Object`)){if(r=X_(e[i[a]],t[i[a]],n),!r)break}else if(e[i[a]]!==t[i[a]]){r=!1;break}}else if(e[i[a]]&&!t[i[a]]||!e[i[a]]&&t[i[a]]){r=!1;break}return r}return e===t}function Z_(e={}){let{releaseDelay:t=1e3,onRelease:n}=e,r=new Map,i=new Map;function a(e){let t=i.get(e);t&&(clearTimeout(t),i.delete(e))}function o(e){let t=r.get(e);if(t){try{n?.(e,t.value)}catch{}r.delete(e)}i.delete(e)}function s(e,t){a(e);let n=r.get(e);if(n)return n.refCount++,n.value;let i=t();return r.set(e,{value:i,refCount:1}),i}function c(e){let n=r.get(e);if(n&&(n.refCount--,n.refCount<=0)){let n=setTimeout(()=>{let t=r.get(e);t&&t.refCount<=0?o(e):i.delete(e)},t);i.set(e,n)}}function l(e){return r.get(e)?.value}function u(e){return r.has(e)}function d(e){a(e),o(e)}function f(){for(let e of i.keys())a(e);for(let e of r.keys())o(e)}function p(e){return r.get(e)?.refCount??0}function m(e){for(let[t,n]of r)e(n.value,t)}return{acquire:s,release:c,get:l,has:u,forceRelease:d,clear:f,getRefCount:p,forEachValue:m}}function Q_(){let e=De(Ly);if(!e)throw Error(`[camera.ui] useCameraUi() called without CameraUiPlugin installed. Make sure to call app.use(createCameraUiPlugin({ ... })) before using this composable.`);return e}function $_(e,t){return`cui_${e.replace(/ /g,`_`).toLowerCase()}_${t.replace(/ /g,`_`).toLowerCase()}`}var ev=class{static coreManagerNamespaces(){return{coreManagerSubject:`coreManager.subscriber`,coreManagerRpc:`coreManager.rpc`}}static deviceManagerNamespaces(){return{deviceManagerSubject:`deviceManager.subscriber`,deviceManagerRpc:`deviceManager.rpc`}}static discoveryManagerNamespaces(){return{discoveryManagerSubject:`discoveryManager.subscriber`,discoveryManagerRpc:`discoveryManager.rpc`}}static pluginNamespaces(e){return{pluginDeviceManagerSubject:`plugin.${e}.deviceManager.subscriber`,pluginChildRpc:`plugin.${e}.child.rpc`,pluginChild:`plugin.${e}.child`,pluginStorageRpc:`plugin.${e}.storage.rpc`}}static cameraNamespaces(e){return{cameraSubject:`camera.${e}.subscriber`,cameraControllerRpc:`camera.${e}.controller.rpc`}}static frameWorkerNamespaces(e){return{frameWorkerChildRpc:`camera.${e}.frameWorker.child.rpc`,frameWorkerChild:`camera.${e}.frameWorker.child`}}static pluginCameraNamespaces(e,t){return{cameraInterfacesRpc:`plugin.${e}.camera.${t}.cameraInterfaces.rpc`,cameraStorageRpc:`plugin.${e}.camera.${t}.cameraStorage.rpc`,cameraImplRpc:`plugin.${e}.camera.${t}.impl.rpc`}}static pluginSensorNamespaces(e,t,n){return{sensorStorageRpc:`plugin.${e}.camera.${t}.sensor.${n}.storage.rpc`}}static sensorControllerNamespaces(e){return{sensorSubject:`camera.${e}.sensors.subject`,sensorRpc:`camera.${e}.sensors.rpc`,sensorWriteSubject:`camera.${e}.sensors.writes`}}static sensorEventNamespaces(e,t){return{sensorSubject:`camera.${e}.sensor.${t}.subject`}}static sensorProviderNamespaces(e,t,n){return{sensorRpc:`plugin.${e}.camera.${t}.sensor.${n}.rpc`}}static frameWorkerDetectionNamespaces(e){return{detectionRpc:`camera.${e}.frameWorker.detection.rpc`}}static detectionEventNamespaces(e){return{detectionEventSubject:`camera.${e}.events.subject`}}static sensorControllerRpc(e){return`camera.${e}.sensors.controller.rpc`}static terminalManagerNamespaces(){return{terminalManagerSubject:`terminalManager.subscriber`,terminalManagerRpc:`terminalManager.rpc`}}static downloadManagerNamespaces(){return{downloadManagerRpc:`downloadManager.rpc`}}static notificationManagerNamespaces(){return{notificationsPublishSubject:`notifications.publish`}}static workerAgentRpc(e){return`worker.${e}.rpc`}static workerHeartbeat(){return`workers.heartbeat`}static workerDisconnect(){return`workers.disconnect`}},tv=3,nv=3e4;async function rv(e,t,n={}){let r=n.maxRetries??tv,i=n.awaitConnect??!0,a=n.connectTimeoutMs??nv,o=n.retryDelayMs??iv,s=n.shouldRetry??av,c=n.signal,l;for(let n=0;n<=r;n++){if(c?.aborted)throw cv();let u=e.value;if(!u){if(!i)throw Error(`rpc: not connected`);u=await ov(e,a,c)}try{return await t(u)}catch(e){if(l=e,n>=r||!s(e,n))throw e;await sv(o(n),c)}}throw l??Error(`rpc: max retries exceeded`)}function iv(e){return Math.min(100*2**e,1e3)}function av(e){if(!(e instanceof Error))return!1;let t=e.message.toLowerCase();return!!(t.includes(`not connected`)||t.includes(`connection closed`)||t.includes(`no responders`)||t.includes(`connection refused`)||t.includes(`socket`)||t.includes(`timeout`))}async function ov(e,t,n){return e.value?e.value:new Promise((r,i)=>{let a=setTimeout(()=>{s(),n?.removeEventListener(`abort`,o),i(Error(`rpc: connect timeout`))},t),o=()=>{clearTimeout(a),s(),i(cv())};n?.addEventListener(`abort`,o,{once:!0});let s=z(e,e=>{e&&(clearTimeout(a),s(),n?.removeEventListener(`abort`,o),r(e))})})}async function sv(e,t){return new Promise((n,r)=>{if(t?.aborted){r(cv());return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(cv())};t?.addEventListener(`abort`,a,{once:!0})})}function cv(){if(typeof DOMException<`u`)return new DOMException(`Aborted`,`AbortError`);let e=Error(`Aborted`);return e.name=`AbortError`,e}var lv=5e3,uv=new Map,dv=new Map,fv=new Map;function pv(e){fv.get(e)?.forEach(e=>e())}function mv(e){setTimeout(()=>URL.revokeObjectURL(e),lv)}function hv(e,t){let n=dv.get(e);n&&(mv(n),dv.delete(e)),uv.set(e,t),pv(e)}function gv(e){return uv.get(e)}function _v(e){let t=uv.get(e);if(!t)return;let n=dv.get(e);return n||(n=URL.createObjectURL(new Blob([t],{type:`image/jpeg`})),dv.set(e,n)),n}function vv(){for(let e of dv.values())URL.revokeObjectURL(e);dv.clear(),uv.clear()}function yv(e){let{isConnected:t}=Q_(),n=xv(),r=W(),i=s(!1),a=s(!1),o=H(()=>{if(!r.value)return;let t=G(e);return _v(typeof t==`string`?t:t._id)});function c(e){fv.has(e)||fv.set(e,new Set);let t=()=>{r.value=uv.get(e)};return fv.get(e).add(t),()=>{fv.get(e)?.delete(t)}}let l;async function u(e){if(!t.value||!e)return;let o=uv.get(e);if(o){r.value=o,a.value=!0;return}i.value=!0;try{let t=await n.getCamera(e);if(t){let n=await t.fetchSnapshot();n&&(hv(e,n),r.value=n)}}catch{}finally{i.value=!1,a.value=!0}}function d(e){return typeof e==`object`&&e?.disabled===!0}async function f(){let o=G(e),s=typeof o==`string`?o:o._id;if(!(!s||!t.value)&&!d(o)){i.value=!0;try{let e=await n.getCamera(s);if(e){let t=await e.fetchSnapshot(void 0,!0);t&&(hv(s,t),r.value=t)}}catch{}finally{i.value=!1,a.value=!0}}}return z([t,()=>G(e),()=>d(G(e))],async([e,t,n])=>{l?.(),l=void 0;let i=typeof t==`string`?t:t._id;e&&i&&!n?(l=c(i),await u(i)):i?(r.value=uv.get(i),a.value=!0):r.value=void 0},{immediate:!0}),xc(()=>{l?.()}),{snapshot:r,snapshotSrc:o,isLoading:H(()=>i.value||!a.value),refresh:f}}async function bv(e,t){let n=ev.cameraNamespaces(t._id),r=ev.sensorControllerNamespaces(t._id),i=`rpc`in e&&`value`in e.rpc?e:void 0,a=i?i.rpc:W(e),o,c,l=W(t),u=s(!1),d=s(!1),f=H(()=>gv(t._id)),p=s(!1),m=s({}),h=H(()=>l.value.name),g=H(()=>l.value.room),_=H(()=>l.value.nativeId),v=H(()=>l.value.disabled),y=H(()=>l.value.detectionSettings?.snooze??!1),b=H(()=>l.value.isCloud),x=H(()=>JSON.parse(JSON.stringify(l.value.sources)).map(e=>({...e,snapshot:async t=>ee(e._id,t),probeStream:async(t,n=!1)=>te(e._id,t,n)}))),S=H(()=>x.value.find(e=>e.role===`high-resolution`)),C=H(()=>x.value.find(e=>e.role===`mid-resolution`)),w=H(()=>x.value.find(e=>e.role===`low-resolution`)),T=H(()=>S.value??C.value??w.value),E=H(()=>x.value.find(e=>e.role===`snapshot`)??x.value.find(e=>e.useForSnapshot)),D=H(()=>{let e=new Set;for(let t of Object.values(m.value))e.add(t.type);return e}),O=H(()=>Array.from(D.value)),k=H(()=>D.value.has(m_.Light)),A=H(()=>D.value.has(m_.Siren)),j=H(()=>D.value.has(m_.Doorbell)),M=H(()=>D.value.has(m_.Battery)),N=H(()=>D.value.has(m_.Audio)),P=H(()=>D.value.has(m_.Motion)),F=H(()=>D.value.has(m_.Object)),I=H(()=>D.value.has(m_.PTZ));async function ee(e,r){p.value=!0;try{let i=await rv(a,t=>t.createProxy(n.cameraControllerRpc).snapshot(e,r));if(i&&i.byteLength>0)return hv(t._id,i),i}finally{p.value=!1}}async function te(e,t,r=!1){return rv(a,i=>i.createProxy(n.cameraControllerRpc).probeStream(e,t,r))}async function L(e){return rv(a,t=>t.createProxy(n.cameraControllerRpc).streamUrl(e))}async function R(){let e=await rv(a,e=>e.createProxy(n.cameraControllerRpc).refreshStates());l.value=e.camera,u.value=e.cameraState,d.value=e.frameWorkerState,m.value=e.sensorStates}async function z(e){switch(e.type){case`removed`:await re();break;case`updated`:l.value=e.data;break;case`cameraState`:u.value=e.data;break;case`frameWorkerState`:d.value=e.data;break;case`snapshot:updated`:hv(t._id,e.data.snapshot);break}}function B(e){if(e.type===`sensor:added`){let t=e.data;m.value={...m.value,[t.sensor.id]:t.state}}else if(e.type===`sensor:removed`){let t=e.data,n={...m.value};delete n[t.sensorId],m.value=n}}async function ne(){o?.(),c?.(),o=await rv(a,e=>e.subscribe(n.cameraSubject,z)),c=await rv(a,e=>e.subscribe(r.sensorSubject,B)),await R()}async function re(){o?.(),o=void 0,c?.(),c=void 0}async function ie(e,t){let n=x.value.find(e=>e.useForSnapshot),r=x.value.find(e=>e.role===`snapshot`),i=e??r?._id??n?._id??w.value?._id??C.value?._id??S.value?._id??T.value?._id;return i?ee(i,t):Promise.resolve(void 0)}async function ae(e,t,n=!1){let r=e??T.value?._id;return r?te(r,t,n):Promise.resolve(void 0)}return await ne(),{id:t._id,name:h,room:g,nativeId:_,disabled:v,snooze:y,isCloud:b,connected:u,frameWorkerConnected:d,sources:x,streamSource:T,snapshotSource:E,highResolutionSource:S,midResolutionSource:C,lowResolutionSource:w,capabilities:O,hasLight:k,hasSiren:A,hasDoorbell:j,hasBattery:M,hasAudioSensor:N,hasMotionSensor:P,hasObjectSensor:F,hasPtz:I,camera:l,snapshot:f,snapshotLoading:p,fetchSnapshot:ie,probeStream:ae,streamUrl:L,refreshStates:R,reconnect:ne,close:re}}function xv(){let e=Q_(),t=ev.deviceManagerNamespaces();async function n(n){let r=await rv(e.rpc,e=>e.createProxy(t.deviceManagerRpc).getCamera(n,`@camera.ui/browser`));if(r)return bv(e,r)}return{getCamera:n}}var Sv=Z_({releaseDelay:1e3,onRelease:(e,t)=>t.close()}),Cv=new Map;function wv(){Sv.clear(),Cv.clear()}function Tv(){Sv.forEachValue(e=>{e.reconnect().catch(()=>{})})}function Ev(e){let{isConnected:t}=Q_(),n=xv(),r=W(),i=s(!1),a=s(!1),o=s(),c;async function l(e){if(!t.value||!e)return;if(c&&c!==e&&(Sv.release(c),r.value=void 0,c=void 0),Sv.has(e)){let t=Sv.acquire(e,()=>{throw Error(`Should not create - already cached`)});c=e,r.value=t,a.value=!0;return}let s=Cv.get(e);if(s){i.value=!0;try{let t=await s;if(t&&Sv.has(e)){let n=Sv.acquire(e,()=>t);c=e,r.value=n}}catch(e){o.value=e instanceof Error?e:Error(String(e))}finally{i.value=!1,a.value=!0}return}i.value=!0,o.value=void 0;let l=n.getCamera(e);Cv.set(e,l);try{let t=await l;t&&(Sv.acquire(e,()=>t),c=e,r.value=t)}catch(e){o.value=e instanceof Error?e:Error(String(e))}finally{Cv.delete(e),i.value=!1,a.value=!0}}async function u(){let t=G(e);t&&(c&&=(Sv.getRefCount(c)<=1?Sv.forceRelease(c):Sv.release(c),r.value=void 0,void 0),await l(t))}return z([t,()=>G(e)],async([e,t])=>{e&&t?await l(t):!e&&c&&(Sv.release(c),r.value=void 0,c=void 0)},{immediate:!0}),xc(()=>{c&&=(Sv.release(c),r.value=void 0,void 0)}),{camera:r,isLoading:H(()=>i.value||!a.value),error:o,refresh:u}}var Dv=Z_({releaseDelay:1e3}),Ov=new Map,kv=new Set;function Av(){Dv.clear(),Ov.clear();for(let e of kv)try{e()}catch{}}function jv(e){let{rpc:t,isConnected:n}=Q_(),r=W(),i=s(),a=s(!1),o=s(!1),c=s(),l;function u(e){if(Dv.has(e))return Dv.acquire(e,()=>{throw Error(`Should not create - already cached`)})}function d(e){Dv.release(e)}async function f(e){if(!n.value||!e)return;l&&l!==e&&(d(l),r.value=void 0,i.value=void 0,l=void 0);let s=u(e);if(s){l=e,r.value=s.proxy,i.value=s.contract,o.value=!0;return}let f=Ov.get(e);if(f){a.value=!0;try{if(await f){let t=u(e);t&&(l=e,r.value=t.proxy,i.value=t.contract)}}catch(e){c.value=e instanceof Error?e:Error(String(e))}finally{a.value=!1,o.value=!0}return}a.value=!0,c.value=void 0;let p=rv(t,async t=>{let n=ev.coreManagerNamespaces(),r=await t.createProxy(n.coreManagerRpc).getPlugin(e);if(!r)throw Error(`Plugin "${e}" not found`);let i=ev.pluginNamespaces(r.id);return{proxy:t.createProxy(i.pluginChildRpc),contract:r.contract}});Ov.set(e,p);try{let t=await p;t&&(Dv.acquire(e,()=>t),l=e,r.value=t.proxy,i.value=t.contract)}catch(e){c.value=e instanceof Error?e:Error(String(e)),r.value=void 0,i.value=void 0}finally{Ov.delete(e),a.value=!1,o.value=!0}}async function p(){let t=G(e);t&&(l&&=(Dv.getRefCount(l)<=1?Dv.forceRelease(l):Dv.release(l),r.value=void 0,i.value=void 0,void 0),await f(t))}let m=()=>{l&&=(r.value=void 0,i.value=void 0,void 0)};return kv.add(m),z([n,()=>G(e),t],async([e,t,n],a)=>{let o=a?.[2];l&&o&&o!==n&&(d(l),r.value=void 0,i.value=void 0,l=void 0),e&&t&&n?await f(t):(!e||!n)&&l&&(d(l),r.value=void 0,i.value=void 0,l=void 0)},{immediate:!0}),xc(()=>{kv.delete(m),l&&=(d(l),r.value=void 0,i.value=void 0,void 0)}),{plugin:r,contract:i,isLoading:H(()=>a.value||!o.value),error:c,refresh:p}}function Mv(e){if(e)return typeof e==`string`?e:e.id}function Nv(e){return t=>t.type===e}var Pv=Nv(m_.Light),Fv=Nv(m_.Siren),Iv=Nv(m_.Battery),Lv=Nv(m_.Doorbell),Rv=Nv(m_.Contact),zv=Nv(m_.Motion),Bv=Nv(m_.Object),Vv=Nv(m_.Audio),Hv=Nv(m_.Face),Uv=Nv(m_.LicensePlate);m_.Classifier,m_.PTZ;var Wv=Nv(m_.Switch),Gv=Nv(m_.Lock),Kv=Nv(m_.SecuritySystem),qv=Nv(m_.Temperature),Jv=Nv(m_.Humidity),Yv=Nv(m_.Occupancy),Xv=Nv(m_.Smoke),Zv=Nv(m_.Leak),Qv=Nv(m_.Garage);function $v(e,t,n,r){let i=s(t.displayName??e.displayName??e.name),a=s(t.capabilities??e.capabilities??[]),o=ye({...t.properties}),c=[];return{id:e.id,type:e.type,name:e.name,displayName:i,pluginId:e.pluginId,capabilities:a,properties:o,getProperty(e){return o[e]},async setProperty(t,i){let a=`plugin.${e.pluginId}.camera.${r}.sensor.${e.id}.rpc`;await rv(n,e=>e.createProxy(a).updateValue(t,i))},async setDisplayName(t){let i=ev.sensorControllerNamespaces(r);await rv(n,n=>n.createProxy(i.sensorRpc).setDisplayName(e.id,t))},hasCapability(e){return a.value.includes(e)},onCapabilitiesChanged(e){return c.push(e),()=>{let t=c.indexOf(e);t!==-1&&c.splice(t,1)}},_notifyCapabilitiesChanged(){for(let e of c)e(a.value)}}}function ey(e,t,n,r){let i=`rpc`in e&&`value`in e.rpc?e:void 0,a=i?i.rpc:W(e),o=W(new Map),c,l=new Map,u=s(!1),d;function f(e,t){let n=o.value.get(e);if(n){if(t.type===`property:changed`){let e=t.data;n.properties[e.property]=e.value}else if(t.type===`sensor:displayName:changed`){let e=t.data;n.displayName.value=e.displayName}else if(t.type===`sensor:capabilities:changed`){let e=t.data;n.capabilities.value=e.capabilities,n._notifyCapabilitiesChanged()}}}async function p(e){if(l.has(e))return;let n=ev.sensorEventNamespaces(t,e),r=await rv(a,t=>t.subscribe(n.sensorSubject,t=>f(e,t)));l.set(e,r)}function m(e){let t=l.get(e);t&&(t(),l.delete(e))}function h(e){if(e.type===`sensor:added`){let n=e.data;if(o.value.has(n.sensor.id))return;let r=$v(n.sensor,n.state,a,t),i=new Map(o.value);i.set(n.sensor.id,r),o.value=i,p(n.sensor.id)}else if(e.type===`sensor:removed`){let t=e.data;m(t.sensorId);let n=new Map(o.value);n.delete(t.sensorId),o.value=n}}async function g(){c?.(),c=void 0;for(let e of l.values())e();l.clear(),o.value=new Map;let e=[];c=await rv(a,t=>t.subscribe(n,t=>{e?e.push(t):h(t)}));let[i,s]=await rv(a,async e=>{let t=e.createProxy(r);return Promise.all([t.getSensors(),t.getSensorStates()])}),d=new Map;for(let e of i){let n=$v(e,s[e.id]??{properties:{},capabilities:[],type:e.type},a,t);d.set(e.id,n)}o.value=d;for(let e of d.keys())await p(e);let f=e;e=void 0;for(let e of f)h(e);u.value=!0}async function _(){if(!u.value)return d||=g().finally(()=>{d=void 0}),d}async function v(){return u.value=!1,d||=g().finally(()=>{d=void 0}),d}function y(){c?.(),c=void 0;for(let e of l.values())e();l.clear(),o.value.clear(),u.value=!1,d=void 0}let b=H(()=>Array.from(o.value.values()));return{sensors:b,isInitialized:H(()=>u.value),getSensor(e){return o.value.get(e)},getSensorsByType(e){return b.value.filter(t=>t.type===e)},hasSensorType(e){return b.value.some(t=>t.type===e)},async setDisplayName(e,t){await rv(a,n=>n.createProxy(r).setDisplayName(e,t))},ensureInitialized:_,reconnect:v,close:y}}var ty=Z_({releaseDelay:1e3,onRelease:(e,t)=>t.manager.close()});function ny(){ty.clear()}function ry(){ty.forEachValue(e=>{e.initPromise=e.manager.reconnect()})}function iy(e,t){return ty.acquire(e,()=>{let n=ev.sensorControllerNamespaces(e);return{manager:ey(t,e,n.sensorSubject,n.sensorRpc)}})}function ay(e){ty.release(e)}function oy(){return{currentCameraId:void 0,cachedManager:void 0}}async function sy(e,t,n,r,i,a){if(!(!t.rpc.value||!n)){e.currentCameraId&&e.currentCameraId!==r&&(ay(e.currentCameraId),e.currentCameraId=void 0,e.cachedManager=void 0),i.value=!0,a.value=void 0;try{let n=iy(r,t);return e.currentCameraId=r,e.cachedManager=n.manager,n.initPromise||=n.manager.ensureInitialized(),await n.initPromise,n.manager}catch(e){a.value=e instanceof Error?e:Error(String(e));return}finally{i.value=!1}}}function cy(e){e.currentCameraId&&(ay(e.currentCameraId),e.currentCameraId=void 0,e.cachedManager=void 0)}function ly(e,t){let n=Q_(),{isConnected:r}=n,i=W([]),a=W(),o=s(!1),c=s(!1),l=s(),u=oy();z([r,()=>Mv(G(e)),()=>G(t)],async([e,t,r])=>{if(e&&t){let s=await sy(u,n,e,t,o,l);a.value=s,i.value=s?.getSensorsByType(r)??[],c.value=!0}else cy(u),i.value=[],a.value=void 0},{immediate:!0});let d=H(()=>{if(!a.value)return[];let e=G(t);return a.value.sensors.value.filter(t=>t.type===e)});return xc(()=>{cy(u),i.value=[]}),{sensors:d,isLoading:H(()=>o.value||!c.value),error:l}}function uy(e){let t=Q_(),{isConnected:n}=t,r=W([]),i=W(),a=s(!1),o=s(!1),c=s(),l=oy();z([n,()=>Mv(G(e))],async([e,n])=>{if(e&&n){let s=await sy(l,t,e,n,a,c);i.value=s,r.value=s?.sensors.value??[],o.value=!0}else cy(l),r.value=[],i.value=void 0},{immediate:!0});let u=H(()=>i.value?.sensors.value??[]);return xc(()=>{cy(l),r.value=[]}),{sensors:u,isLoading:H(()=>a.value||!o.value),error:c}}function dy(e,t){let n=Q_(),{isConnected:r}=n,i=W(),a=W(),o=s(!1),c=s(!1),l=s(),u=oy();return z([r,()=>Mv(G(e))],async([e,r])=>{if(e&&r){let s=await sy(u,n,e,r,o,l);a.value=s,i.value=s?.getSensorsByType(t)[0],c.value=!0}else cy(u),i.value=void 0},{immediate:!0}),z(()=>{if(a.value)return a.value.getSensorsByType(t)[0]?.id},()=>{a.value&&(i.value=a.value.getSensorsByType(t)[0])}),xc(()=>{cy(u),i.value=void 0}),{sensor:i,isLoading:H(()=>o.value||!c.value),error:l}}function fy(e){return dy(e,m_.Motion)}function py(e){return dy(e,m_.Object)}function my(e){return dy(e,m_.Face)}function hy(e){return dy(e,m_.LicensePlate)}function gy(e){return dy(e,m_.PTZ)}function _y(e){let t=Q_(),{isConnected:n}=t,r=W([]),i=W(),a=s(!1),o=s(!1),c=s(),l=oy();z([n,()=>Mv(G(e))],async([e,n])=>{if(e&&n){let s=await sy(l,t,e,n,a,c);i.value=s,r.value=s?.getSensorsByType(m_.Classifier)??[],o.value=!0}else cy(l),r.value=[],i.value=void 0},{immediate:!0});let u=H(()=>i.value?.getSensorsByType(m_.Classifier)??[]);return xc(()=>{cy(l),r.value=[]}),{sensors:u,isLoading:H(()=>a.value||!o.value),error:c}}var vy=new Map;function yy(){vy.clear()}async function by(e,t){let n=vy.get(t);if(n)return n;let r=ev.coreManagerNamespaces(),i=await rv(e,e=>e.createProxy(r.coreManagerRpc).getPlugin(t));if(i)return vy.set(t,i.id),i.id}function xy(e){let t=W(),n=s(!1),r=s();async function i(){n.value=!0,r.value=void 0;try{return t.value=await e.getConfig(),t.value}catch(e){r.value=e instanceof Error?e:Error(String(e));return}finally{n.value=!1}}async function a(t,a){n.value=!0,r.value=void 0;try{await e.setValue(t,a),await i()}catch(e){throw r.value=e instanceof Error?e:Error(String(e)),e}finally{n.value=!1}}async function o(t){n.value=!0,r.value=void 0;try{await e.setConfig(t),await i()}catch(e){throw r.value=e instanceof Error?e:Error(String(e)),e}finally{n.value=!1}}async function c(t,a){n.value=!0,r.value=void 0;try{let n=await e.submitValue(t,a);return(!n?.toast||n.toast.type!==`error`)&&await i(),n}catch(e){throw r.value=e instanceof Error?e:Error(String(e)),e}finally{n.value=!1}}return{proxy:e,config:t,isLoading:n,error:r,getConfig:i,setValue:a,setConfig:o,submitValue:c}}var Sy=Z_({releaseDelay:1e3});function Cy(e){return`plugin:${e}`}function wy(e,t){return`plugin:${e}:camera:${t}`}function Ty(e,t,n){return`plugin:${e}:camera:${t}:sensor:${n}`}function Ey(e,t){return Sy.acquire(e,()=>xy(t()))}function Dy(e){Sy.release(e)}function Oy(){Sy.clear(),yy()}function ky(){return{currentStorageKey:void 0,cachedStorage:void 0}}function Ay(e,t,n){e.currentStorageKey&&=(Dy(e.currentStorageKey),void 0),t.value=!1,e.cachedStorage=void 0,n.value=void 0}function jy(e,t,n,r){async function i(){let i=e.cachedStorage;if(!i)return;let a=await i.getConfig();return e.cachedStorage===i?(t.value=i.config.value,n.value=i.isLoading.value,r.value=i.error.value,a):a}async function a(i,a){let o=e.cachedStorage;if(!o)throw Error(`Storage not connected`);n.value=!0,r.value=void 0;try{await o.setValue(i,a),e.cachedStorage===o&&(t.value=o.config.value)}catch(e){throw r.value=e instanceof Error?e:Error(String(e)),e}finally{n.value=!1}}async function o(i){let a=e.cachedStorage;if(!a)throw Error(`Storage not connected`);n.value=!0,r.value=void 0;try{await a.setConfig(i),e.cachedStorage===a&&(t.value=a.config.value)}catch(e){throw r.value=e instanceof Error?e:Error(String(e)),e}finally{n.value=!1}}async function s(i,a){let o=e.cachedStorage;if(!o)throw Error(`Storage not connected`);n.value=!0,r.value=void 0;try{let n=await o.submitValue(i,a);return e.cachedStorage===o&&(t.value=o.config.value),n}catch(e){throw r.value=e instanceof Error?e:Error(String(e)),e}finally{n.value=!1}}return{getConfig:i,setValue:a,setConfig:o,submitValue:s}}function My(e){let{rpc:t,isConnected:n}=Q_(),r=W(),i=s(!1),a=s(!1),o=s(),c=s(!1),l=ky(),u=jy(l,r,i,o);async function d(e){if(!t.value||!n.value)return!1;try{let n=await by(t,e);if(!n)throw Error(`Plugin "${e}" not found`);let r=Cy(n);return l.currentStorageKey&&l.currentStorageKey!==r&&Dy(l.currentStorageKey),l.currentStorageKey=r,l.cachedStorage=Ey(r,()=>{let e=ev.pluginNamespaces(n);return t.value.createProxy(e.pluginStorageRpc)}),c.value=!0,!0}catch(e){return o.value=e instanceof Error?e:Error(String(e)),c.value=!1,!1}}async function f(){if(!l.cachedStorage){let t=G(e);if(!t||!await d(t))return}return u.getConfig()}return z([n,()=>G(e)],async([e,t])=>{e&&t?(await d(t),u.getConfig()):Ay(l,c,r),a.value=!0},{immediate:!0}),xc(()=>Ay(l,c,r)),{config:r,isLoading:H(()=>i.value||!a.value),error:o,isConnected:c,getConfig:f,setValue:u.setValue,setConfig:u.setConfig,submitValue:u.submitValue}}function Ny(e,t){let{rpc:n,isConnected:r}=Q_(),i=W(),a=s(!1),o=s(!1),c=s(),l=s(!1),u=ky(),d=jy(u,i,a,c);async function f(e,t){if(!n.value||!r.value)return!1;try{let r=await by(n,t);if(!r)throw Error(`Plugin "${t}" not found`);let i=wy(r,e);return u.currentStorageKey&&u.currentStorageKey!==i&&Dy(u.currentStorageKey),u.currentStorageKey=i,u.cachedStorage=Ey(i,()=>{let t=ev.pluginCameraNamespaces(r,e);return n.value.createProxy(t.cameraStorageRpc)}),l.value=!0,!0}catch(e){return c.value=e instanceof Error?e:Error(String(e)),l.value=!1,!1}}async function p(){let n=Mv(G(e)),r=G(t);if(!(!n||!r)&&!(!u.cachedStorage&&!await f(n,r)))return d.getConfig()}return z([r,()=>Mv(G(e)),()=>G(t)],async([e,t,n])=>{e&&t&&n?(await f(t,n),d.getConfig()):Ay(u,l,i),o.value=!0},{immediate:!0}),xc(()=>Ay(u,l,i)),{config:i,isLoading:H(()=>a.value||!o.value),error:c,isConnected:l,getConfig:p,setValue:d.setValue,setConfig:d.setConfig,submitValue:d.submitValue}}function Py(e,t,n){let{rpc:r,isConnected:i}=Q_(),a=W(),o=s(!1),c=s(!1),l=s(),u=s(!1),d=ky(),f=jy(d,a,o,l);function p(e,t,n){if(!r.value||!i.value)return!1;try{let i=Ty(n,e,t);return d.currentStorageKey&&d.currentStorageKey!==i&&Dy(d.currentStorageKey),d.currentStorageKey=i,d.cachedStorage=Ey(i,()=>{let i=ev.pluginSensorNamespaces(n,e,t);return r.value.createProxy(i.sensorStorageRpc)}),u.value=!0,!0}catch(e){return l.value=e instanceof Error?e:Error(String(e)),u.value=!1,!1}}async function m(){let r=Mv(G(e)),i=G(t),a=G(n);if(!(!r||!i||!a)&&!(!d.cachedStorage&&!p(r,i,a)))return f.getConfig()}return z([i,()=>Mv(G(e)),()=>G(t),()=>G(n)],([e,t,n,r])=>{e&&t&&n&&r?(p(t,n,r),f.getConfig()):Ay(d,u,a),c.value=!0},{immediate:!0}),xc(()=>Ay(d,u,a)),{config:a,isLoading:H(()=>o.value||!c.value),error:l,isConnected:u,getConfig:m,setValue:f.setValue,setConfig:f.setConfig,submitValue:f.submitValue}}function Fy(){Av(),wv(),Oy(),ny(),vv()}function Iy(){Av(),Tv(),ry()}var Ly=Symbol(`camera-ui`);function Ry(e){return`rpc`in e&&`isConnected`in e}function zy(e){let{natsTransport:t,target:n,wsTransport:r}=e,i=!1,a=W(t.getClient()??void 0),o=s(t.getClient()?.isConnected??!1),c=s(void 0),l=H(()=>n.value?.endpoint.url),u=H(()=>n.value?.tokens.access),d=H(()=>{let e=n.value;if(e?.tokens.proxySession)return{session:e.tokens.proxySession}}),f=new Map;function p(e,t){let n=f.get(e);n||(n=new Set,f.set(e,n)),n.add(t)}function m(e,t){f.get(e)?.delete(t)}function h(e){let t=f.get(e);if(t)for(let e of t)try{e()}catch(e){console.warn(`[camera.ui] context listener threw:`,e)}}return t.subscribeClient(e=>{let t=o.value;e?(a.value=e,o.value=!0,c.value=void 0,t||(Iy(),i&&h(`reconnected`),i=!0)):(a.value=void 0,o.value=!1,t&&h(`disconnected`))}),t.on(`auth-error`,e=>{c.value=Error(e.message??`auth-error`)}),t.on(`down`,e=>{c.value||=Error(e.reason)}),t.on(`up`,()=>{c.value=void 0}),_e({rpc:a,target:L(n),isConnected:L(o),endpoint:l,token:u,extraProxyQuery:d,error:L(c),wsTransport:r,on:p,off:m})}function By(e){return{install(t){let n=Ry(e)?e:zy(e);t.provide(Ly,n)}}}var Vy={standbyTimeout:5e3,activityTimeout:5e3};function Hy(e){let{initialMode:t=`always-on`,config:n={},onStreamStart:r,onStreamStop:i,isStreamPlaying:a}=e,o={...Vy,...n},c=s(t),l=s(!1),u=s(!1),d,f;function p(){d&&=(clearTimeout(d),void 0)}function m(){f&&=(clearTimeout(f),void 0)}function h(){p(),m()}function g(){l.value||(l.value=!0,i())}function _(){l.value&&(l.value=!1,r())}function v(){switch(h(),c.value){case`always-on`:l.value=!1,a()||r();break;case`standby`:l.value||(a()||r(),y());break;case`activity`:u.value?(l.value=!1,a()||r()):d=setTimeout(()=>{c.value===`activity`&&!u.value&&g()},o.activityTimeout);break}}function y(){m(),f=setTimeout(()=>{c.value===`standby`&&g()},o.standbyTimeout)}function b(e){c.value!==e&&(c.value=e,v())}function x(e){c.value===`activity`&&(e?(u.value=!0,p(),(l.value||!a())&&_()):(u.value=!1,p(),d=setTimeout(()=>{u.value||g()},o.activityTimeout)))}function S(){if(l.value)switch(_(),c.value){case`standby`:y();break;case`activity`:p(),u.value||(d=setTimeout(()=>{g()},o.activityTimeout));break}}function C(){c.value===`standby`&&!l.value&&y()}function w(){h()}return{mode:c,inStandby:l,hasActivity:u,setMode:b,reportActivity:x,resumeFromStandby:S,resetIdleTimer:C,dispose:w}}var Uy=3e4;function Wy(...e){let t=new Date,n=String(t.getHours()).padStart(2,`0`),r=String(t.getMinutes()).padStart(2,`0`),i=String(t.getSeconds()).padStart(2,`0`),a=String(t.getMilliseconds()).padStart(3,`0`);console.log(`[TabVisibility ${n}:${r}:${i}.${a}]`,...e)}var Gy=s(typeof document>`u`?!0:document.visibilityState===`visible`),Ky=null,qy=new Set,Jy=new Set,Yy=new Set,Xy=!1;function Zy(e){Wy(`paused listener fired (delay ${e.delayMs}ms reached)`);try{e.cb()}catch(e){console.error(`[TabVisibility] onTabPaused listener threw:`,e)}}function Qy(e){Wy(`paused listener scheduled in ${e.delayMs}ms`),e.timer=setTimeout(()=>{if(e.timer=null,Gy.value){Wy(`paused listener skipped — tab visible before delay`);return}Zy(e)},e.delayMs)}function $y(){for(let e of Jy)e.timer!==null&&(clearTimeout(e.timer),e.timer=null)}function eb(){Xy||typeof document>`u`||(Xy=!0,document.addEventListener(`visibilitychange`,()=>{let e=document.visibilityState===`visible`;if(!e&&Gy.value){Gy.value=!1,Ky=Date.now(),Wy(`tab → hidden (hidden=${qy.size} paused=${Jy.size})`);for(let e of qy)try{e.cb()}catch(e){console.error(`[TabVisibility] onTabHidden listener threw:`,e)}for(let e of Jy)Qy(e)}else if(e&&!Gy.value){$y();let e=Ky==null?0:Date.now()-Ky;Ky=null,Gy.value=!0,Wy(`tab → visible (hiddenMs=${e}, visible-listeners=${Yy.size})`);for(let{cb:t}of Yy)try{t({hiddenMs:e})}catch(e){console.error(`[TabVisibility] onTabVisible listener threw:`,e)}}}))}function tb(){eb();let e=H(()=>Gy.value);function t(e){let t={cb:e};qy.add(t);let n=()=>{qy.delete(t)};return xc(n),n}function n(e,t={}){let n={cb:e,delayMs:t.delayMs??Uy,timer:null};Jy.add(n);let r=()=>{n.timer!==null&&(clearTimeout(n.timer),n.timer=null),Jy.delete(n)};return xc(r),r}function r(e){let t={cb:e};Yy.add(t);let n=()=>{Yy.delete(t)};return xc(n),n}return{isVisible:e,onTabHidden:t,onTabPaused:n,onTabVisible:r}}var nb={WEBRTC:{RECONNECT_DELAY:1e3,CONNECT_TIMEOUT:1e4,WS_CONNECT_TIMEOUT:5e3,ICE_SERVERS:[{urls:`stun:stun.l.google.com:19302`}]},MSE:{BUFFER_SIZE:2*1024*1024,BUFFER_WINDOW:5},CODECS:{DEFAULT:[`avc1.640029`,`avc1.64002A`,`avc1.640033`,`hvc1.1.6.L153.B0`,`mp4a.40.2`,`mp4a.40.5`,`flac`,`opus`],WEBRTC_VIDEO:[`H264`,`VP8`,`VP9`],WEBRTC_AUDIO:[`opus`,`G722`,`PCMU`,`PCMA`]}};function rb(){return navigator.userAgent.match(/version\/(\d+)/i)}function ib(){let e=[...nb.CODECS.DEFAULT],t=rb();if(t?.[1]){let n=parseInt(t[1],10);if(n<13){let t=e.indexOf(`mp4a.40.2`);t>-1&&e.splice(t)}else if(n<14){let t=e.indexOf(`flac`);t>-1&&e.splice(t)}else{let t=e.indexOf(`opus`);t>-1&&e.splice(t)}}return e}function ab(e,t){return e.filter(e=>t(`video/mp4; codecs="${e}"`)).join(`,`)}function ob(e){return nb.CODECS.WEBRTC_AUDIO.includes(e)}function sb(e){return nb.CODECS.WEBRTC_VIDEO.includes(e)?!0:e===`H265`?cb():!1}function cb(){try{let e=RTCRtpSender?.getCapabilities(`video`)?.codecs;return e?e.some(e=>e.mimeType.toLowerCase().includes(`h265`)||e.mimeType.toLowerCase().includes(`hevc`)):!1}catch{return!1}}function lb(e){let t=e.audio.filter(e=>e.direction===`sendonly`),n=e.video.filter(e=>e.direction===`sendonly`),r=t.length===0||t.some(e=>ob(e.codec)),i=n.length===0||n.some(e=>sb(e.codec)),a=[];return r||a.push(...t.map(e=>e.codec)),i||a.push(...n.map(e=>e.codec)),{compatible:r&&i,audioCompatible:r,videoCompatible:i,incompatibleCodecs:a}}function ub(){return`ManagedMediaSource`in window}function db(){if(ub())return window.ManagedMediaSource;if(`MediaSource`in window)return window.MediaSource}function fb(e,t){return new Promise((n,r)=>{if(t.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new DOMException(`Aborted`,`AbortError`))},{once:!0})})}function pb(e){let{videoElement:t,onReady:n,onFirstData:r,onError:i,signal:a}=e,o=null,s=null,c=!1,l=!1,u=new Uint8Array(nb.MSE.BUFFER_SIZE),d=0,f=[],p=ib();function m(){if(a.aborted)return;let e=db();if(!e){i(Error(`MediaSource not supported`));return}o=new e;let n=ub(),r=t.src;return o.addEventListener(`sourceopen`,()=>{a.aborted||!n&&r&&r.startsWith(`blob:`)&&r!==t.src&&URL.revokeObjectURL(r)},{once:!0}),n?(t.disableRemotePlayback=!0,t.srcObject=o):(t.src=URL.createObjectURL(o),t.srcObject=null),ab(p,e.isTypeSupported.bind(e))}function h(e){if(a.aborted||!o)return;if(o.readyState!==`open`){o.addEventListener(`sourceopen`,()=>{a.aborted||h(e)},{once:!0});return}d=0,u=new Uint8Array(nb.MSE.BUFFER_SIZE);let t=db();if(t&&!t.isTypeSupported(e)){i(Error(`MIME type not supported: ${e}`));return}try{if(s=o.addSourceBuffer(e),s.mode=`segments`,s.addEventListener(`updateend`,g),c=!0,f.length>0){for(let e of f)_(e);f.length=0}n()}catch(e){i(e instanceof Error?e:Error(String(e)))}}function g(){if(!(a.aborted||!s||!o)){if(!s.updating&&d>0)try{let e=u.slice(0,d);s.appendBuffer(e),d=0}catch{}if(!s.updating&&s.buffered?.length){let e=s.buffered.end(s.buffered.length-1),n=e-nb.MSE.BUFFER_WINDOW,i=s.buffered.start(0);if(l||(l=!0,r()),n>i)try{s.remove(i,n),o.setLiveSeekableRange(n,e)}catch{}t.currentTime<n&&(t.currentTime=n);let a=e-t.currentTime;a>1?t.playbackRate=1.1:a<.1?t.playbackRate=.9:t.playbackRate=1}}}function _(e){if(!a.aborted){if(!s){f.push(e);return}if(o?.readyState===`closed`){i(Error(`MediaSource closed`));return}if(s.updating||d>0){let t=new Uint8Array(e);u.set(t,d),d+=t.byteLength}else try{s.appendBuffer(e)}catch{}}}function v(){if(s){if(s.removeEventListener(`updateend`,g),o?.readyState===`open`)try{o.removeSourceBuffer(s)}catch{}s=null}if(o?.readyState===`open`)try{o.endOfStream()}catch{}o=null,c=!1,l=!1,d=0,f.length=0}return a.addEventListener(`abort`,v,{once:!0}),{get mediaSource(){return o},get sourceBuffer(){return s},get isReady(){return c},setup:m,initializeBuffer:h,appendBuffer:_,close:v}}async function mb(e){try{await e.play()}catch{e.muted||(e.muted=!0,await mb(e))}}function hb(e,t,n){let r=new RTCPeerConnection({bundlePolicy:`max-bundle`,iceServers:[...nb.WEBRTC.ICE_SERVERS]});return r.onicecandidate=r=>{if(e.aborted||n&&r.candidate?.protocol===`udp`)return;let i=r.candidate?.toJSON().candidate??``;i&&t(i)},r}async function gb(e,t,n){t.aborted||!e||await e.setRemoteDescription({type:`answer`,sdp:n})}async function _b(e,t,n,r){t.aborted||!e||r&&n.includes(` udp `)||await e.addIceCandidate({candidate:n,sdpMid:`0`})}async function vb(e,t,n){if(!(t.aborted||!e))try{await e.sender.replaceTrack(n)}catch{}}function yb(e){e.micTransceiver&&=(e.micTransceiver.sender.replaceTrack(null).catch(()=>{}),null),e.pc&&=(e.pc.getTransceivers().forEach(e=>e.sender?.track?.stop()),e.pc.close(),null),e.isConnected=!1}function bb(e){let{mode:t,onConnected:n,onDisconnected:r,onFailed:i,onCandidate:a,signal:o}=e,s={pc:null,micTransceiver:null,isConnected:!1},c=t===`webrtc/tcp`;function l(){let e=hb(o,a,c);return e.onconnectionstatechange=()=>{if(o.aborted)return;let t=e.connectionState;t===`connected`?(s.isConnected=!0,n(new MediaStream(e.getTransceivers().filter(e=>e.currentDirection===`recvonly`).map(e=>e.receiver.track)))):t===`failed`?(s.isConnected=!1,i()):t===`disconnected`&&(s.isConnected=!1,r())},e.addTransceiver(`video`,{direction:`recvonly`}),e.addTransceiver(`audio`,{direction:`recvonly`}),s.micTransceiver=e.addTransceiver(`audio`,{direction:`sendonly`}),e}async function u(){if(o.aborted)return;s.pc=l();let e=await s.pc.createOffer();return await s.pc.setLocalDescription(e),e.sdp}function d(){yb(s)}return o.addEventListener(`abort`,d,{once:!0}),{get pc(){return s.pc},get micTransceiver(){return s.micTransceiver},get isConnected(){return s.isConnected},createOffer:u,handleAnswer:e=>gb(s.pc,o,e),handleCandidate:e=>_b(s.pc,o,e,c),setMicrophoneTrack:e=>vb(s.micTransceiver,o,e),close:d}}function xb(e){let{onConnected:t,onDisconnected:n,onCandidate:r,signal:i}=e,a={pc:null,micTransceiver:null,isConnected:!1};function o(){let e=hb(i,r,!1);return e.onconnectionstatechange=()=>{if(i.aborted)return;let r=e.connectionState;r===`connected`?(a.isConnected=!0,t()):(r===`disconnected`||r===`failed`)&&(a.isConnected=!1,n())},a.micTransceiver=e.addTransceiver(`audio`,{direction:`sendonly`}),e}async function s(){if(i.aborted)return;a.pc=o();let e=await a.pc.createOffer();return await a.pc.setLocalDescription(e),e.sdp}function c(){yb(a)}return i.addEventListener(`abort`,c,{once:!0}),{get isConnected(){return a.isConnected},createOffer:s,handleAnswer:e=>gb(a.pc,i,e),handleCandidate:e=>_b(a.pc,i,e,!1),setMicrophoneTrack:e=>vb(a.micTransceiver,i,e),close:c}}async function Sb(e,t){switch(t.type){case`webrtc/answer`:await e.handleAnswer(t.value);break;case`webrtc/candidate`:t.value&&await e.handleCandidate(t.value);break}}function Cb(...e){let t=new Date,n=String(t.getHours()).padStart(2,`0`),r=String(t.getMinutes()).padStart(2,`0`),i=String(t.getSeconds()).padStart(2,`0`),a=String(t.getMilliseconds()).padStart(3,`0`);console.log(`[StreamConnection ${n}:${r}:${i}.${a}]`,...e)}var wb=class{status;activeMode;requestedMode;activeResolution;requestedResolution;source;hasVideo;hasAudio;hasBackchannel;isPlaying;error;probeInfo;muted;paused;nativeWidth;nativeHeight;options;connectionGeneration=0;abortController=new AbortController;offTabVisible;offTabPaused;wasPausedByVisibility=!1;wsTransport;wsHandle;webrtcHandler;mseHandler;firstFrameCallbackId;backchannelHandler;pendingMicTrack=null;lastMediaStream=null;stopWatchers=[];mseMonitorInterval;onVideoPauseBound;onVideoPlayBound;onVideoResizeBound;camera;videoElement;containerElement;target;isReady;effectiveMode;startWsConnectTimeout;stopWsConnectTimeout;startConnectTimeout;stopConnectTimeout;startReconnectTimeout;stopReconnectTimeout;constructor(e){this.options=e;let t=Q_();if(!t.wsTransport)throw Error("[camera.ui] StreamConnection requires a wsTransport on CameraUiContext — pass `wsTransport` to createCameraUiPlugin.");this.target=t.target,this.wsTransport=t.wsTransport;let{autoStart:n=!0}=e;this.status=s(`idle`),this.activeMode=s(`webrtc`),this.activeResolution=s(`low-resolution`),this.source=W(),this.hasVideo=s(!1),this.hasAudio=s(!1),this.hasBackchannel=s(!1),this.isPlaying=s(!1),this.error=s(),this.probeInfo=W(),this.muted=s(!0),this.paused=s(!1),this.nativeWidth=s(0),this.nativeHeight=s(0),this.requestedMode=s(G(e.mode)??`auto`),this.requestedResolution=s(G(e.resolution)??`high-resolution`),this.camera=H(()=>G(e.camera)),this.videoElement=H(()=>G(e.videoElement)),this.containerElement=H(()=>G(e.containerElement)),this.isReady=H(()=>!!this.camera.value&&!!this.videoElement.value&&!!this.target.value),this.effectiveMode=H(()=>this.requestedMode.value===`auto`?this.activeMode.value:this.requestedMode.value);let{onTabPaused:r,onTabVisible:i}=tb(),{start:a,stop:o}=fl(()=>{this.wsHandle?.readyState===WebSocket.CONNECTING&&(this.disconnectWebSocket(),!this.abortController.signal.aborted&&this.status.value!==`closed`&&this.restart())},nb.WEBRTC.WS_CONNECT_TIMEOUT,{immediate:!1});this.startWsConnectTimeout=a,this.stopWsConnectTimeout=o;let{start:c,stop:l}=fl(()=>{this.webrtcHandler&&!this.webrtcHandler.isConnected&&(this.requestedMode.value===`auto`?this.mseHandler?.isReady?(this.activeMode.value=`mse`,this.status.value=`connected`):(this.activeMode.value=`mse`,this.startMSE()):this.restart())},nb.WEBRTC.CONNECT_TIMEOUT,{immediate:!1});this.startConnectTimeout=c,this.stopConnectTimeout=l;let{start:u,stop:d}=fl(()=>{this.abortController.signal.aborted||this.restart()},nb.WEBRTC.RECONNECT_DELAY,{immediate:!1});this.startReconnectTimeout=u,this.stopReconnectTimeout=d,this.setupWatchers(),this.offTabPaused=r(()=>{if(Cb(`onTabPaused fired — status=${this.status.value}, isReady=${this.isReady.value}, target=${!!this.target.value}`),this.status.value===`idle`||this.status.value===`closed`){Cb(`onTabPaused — already in ${this.status.value}, skipping stop()`);return}this.wasPausedByVisibility=!0,this.stop(),Cb(`onTabPaused — stop() done, wasPausedByVisibility=true`)}),this.offTabVisible=i(()=>{if(Cb(`onTabVisible fired — wasPausedByVisibility=${this.wasPausedByVisibility}, status=${this.status.value}, isReady=${this.isReady.value}, target=${!!this.target.value}`),!this.wasPausedByVisibility){Cb(`onTabVisible — not paused by visibility, no-op`);return}this.wasPausedByVisibility=!1,this.startWhenReady()}),n&&gl(this.isReady,()=>{(this.status.value===`idle`||this.status.value===`closed`)&&this.start()},{immediate:!0})}async start(){if(Cb(`start() called — status=${this.status.value}, isReady=${this.isReady.value}`),this.status.value!==`idle`&&this.status.value!==`closed`){Cb(`start() — skipped, status is ${this.status.value}`);return}if(!this.isReady.value){Cb(`start() — skipped, isReady=false`);return}this.cleanup(),this.abortController=new AbortController;let e=++this.connectionGeneration;this.status.value=`connecting`,this.error.value=void 0,this.isPlaying.value=!1;try{if(!this.initializeSource()){Cb(`start() — no streaming source available`),this.error.value=Error(`No streaming source available`),this.status.value=`error`;return}if(await this.probeStream(),e!==this.connectionGeneration){Cb(`start() — generation stale after probe, aborting`);return}this.initializeSource(),Cb(`start() — connecting WebSocket`),this.connectWebSocket()}catch(t){if(e!==this.connectionGeneration)return;Cb(`start() — error:`,t),this.error.value=t instanceof Error?t:Error(String(t)),this.status.value=`error`}}stop(){if(this.status.value===`closed`){Cb(`stop() — already closed, no-op`);return}Cb(`stop() — was ${this.status.value}, transitioning to closed`),++this.connectionGeneration,this.status.value=`closed`,this.cleanup()}async setMode(e){this.requestedMode.value!==e&&(this.requestedMode.value=e,this.activeMode.value=e===`auto`?`webrtc`:e,this.status.value===`connected`&&await this.restart())}async setResolution(e){if(this.requestedResolution.value===e)return;this.requestedResolution.value=e;let t=this.getSourceForResolution(e);t&&t.source._id!==this.source.value?._id&&(this.source.value=t.source,this.activeResolution.value=t.effectiveResolution,this.status.value===`connected`&&await this.restart())}async setMicrophone(e){if(this.webrtcHandler){await this.webrtcHandler.setMicrophoneTrack(e);return}this.activeMode.value===`mse`&&this.hasBackchannel.value&&(this.pendingMicTrack=e,e&&!this.backchannelHandler?await this.startBackchannel():!e&&this.backchannelHandler?this.closeBackchannel():this.backchannelHandler?.isConnected&&await this.backchannelHandler.setMicrophoneTrack(e))}setMuted(e){this.muted.value=e;let t=this.videoElement.value;t&&(t.muted=e)}async play(){this.paused.value=!1;let e=this.videoElement.value;if(e)try{await e.play()}catch{if(!e.muted){e.muted=!0,this.muted.value=!0;try{await e.play()}catch{}}}}pause(){this.paused.value=!0;let e=this.videoElement.value;e&&e.pause()}destroy(){for(let e of this.stopWatchers)e();this.stopWatchers=[],this.offTabVisible?.(),this.offTabVisible=void 0,this.offTabPaused?.(),this.offTabPaused=void 0,this.stop()}async restart(){this.status.value=`reconnecting`,this.isPlaying.value=!1,this.cleanup(),this.abortController=new AbortController;let e=++this.connectionGeneration;try{await fb(1e3,this.abortController.signal)}catch{return}if(e===this.connectionGeneration){if(!this.isReady.value){this.status.value=`idle`;return}try{if(!this.initializeSource()){this.error.value=Error(`No streaming source available`),this.status.value=`error`;return}this.connectWebSocket()}catch(t){if(e!==this.connectionGeneration)return;this.error.value=t instanceof Error?t:Error(String(t)),this.status.value=`error`}}}startWhenReady(){if(this.isReady.value){Cb(`startWhenReady — already ready, calling start() now`),this.start();return}Cb(`startWhenReady — not ready (camera=${!!this.camera.value}, video=${!!this.videoElement.value}, target=${!!this.target.value}), watching isReady`);let e=z(this.isReady,t=>{t&&(Cb(`startWhenReady — isReady → true, calling start()`),e(),this.start())});this.stopWatchers.push(e)}setupWatchers(){let e=z(()=>this.target.value?.endpoint.url??null,(e,t)=>{!e||!t||e===t||this.status.value===`idle`||this.status.value===`closed`||this.restart()});this.stopWatchers.push(e);let t=z(()=>G(this.options.mode),e=>{e!==void 0&&e!==this.requestedMode.value&&this.setMode(e)});this.stopWatchers.push(t);let n=z(()=>G(this.options.resolution),e=>{e!==void 0&&e!==this.requestedResolution.value&&this.setResolution(e)});this.stopWatchers.push(n);let r=z(this.videoElement,(e,t)=>{t&&(this.onVideoPauseBound&&t.removeEventListener(`pause`,this.onVideoPauseBound),this.onVideoPlayBound&&t.removeEventListener(`play`,this.onVideoPlayBound),this.onVideoResizeBound&&t.removeEventListener(`resize`,this.onVideoResizeBound)),e&&(this.onVideoPauseBound=()=>{this.paused.value||e.play().catch(()=>{})},this.onVideoPlayBound=()=>{this.paused.value=!1},this.onVideoResizeBound=()=>{e.videoWidth>0&&e.videoHeight>0&&(this.nativeWidth.value=e.videoWidth,this.nativeHeight.value=e.videoHeight)},e.addEventListener(`pause`,this.onVideoPauseBound),e.addEventListener(`play`,this.onVideoPlayBound),e.addEventListener(`resize`,this.onVideoResizeBound),e.videoWidth>0&&e.videoHeight>0&&(this.nativeWidth.value=e.videoWidth,this.nativeHeight.value=e.videoHeight))},{immediate:!0});this.stopWatchers.push(r);let i=z(this.activeMode,e=>{this.stopMseMonitor(),e===`mse`&&(this.mseMonitorInterval=setInterval(()=>this.monitorMseBuffer(),1e3))},{immediate:!0});this.stopWatchers.push(i);let a=z([this.camera,this.videoElement,()=>this.target.value],([e,t,n],[r,i])=>{if(e!==r)this.status.value===`connected`&&e&&t&&n&&this.restart();else if(t!==i&&t){if(t.srcObject instanceof MediaStream){let e=t.srcObject;if(e.active&&e.getTracks().some(e=>e.readyState===`live`)){mb(t),this.lastMediaStream=e;return}}if(this.status.value===`connected`&&this.activeMode.value!==`mse`){let e=this.lastMediaStream;e?.active&&e.getTracks().some(e=>e.readyState===`live`)?(t.srcObject=e,mb(t)):this.restart()}else if(this.status.value===`connected`&&this.activeMode.value===`mse`)this.restart();else if(this.status.value===`connecting`||this.status.value===`reconnecting`){let e=z(()=>this.isPlaying.value,t=>{let n=this.videoElement.value;t&&n?.srcObject instanceof MediaStream?(mb(n),e()):t&&n&&!n.srcObject&&this.lastMediaStream?.active&&(n.srcObject=this.lastMediaStream,mb(n),e())},{immediate:!0});this.stopWatchers.push(e)}}});this.stopWatchers.push(a)}getSourceForResolution(e){let t=this.camera.value;if(!t)return;let n=[`high-resolution`,`mid-resolution`,`low-resolution`],r=t.sources.value.find(t=>t.role===e);if(r)return{source:r,effectiveResolution:e};let i=n.indexOf(e);for(let e=i;e<n.length;e++){let r=t.sources.value.find(t=>t.role===n[e]);if(r)return{source:r,effectiveResolution:n[e]}}let a=t.streamSource.value;if(a)return{source:a,effectiveResolution:a.role??`low-resolution`}}initializeSource(){let e=this.getSourceForResolution(this.requestedResolution.value);return e?(this.source.value=e.source,this.activeResolution.value=e.effectiveResolution,!0):!1}async probeStream(){let e=this.camera.value;if(!(!e||!this.source.value||this.abortController.signal.aborted))try{let t=await e.probeStream(this.source.value._id,{video:!0,audio:[`pcma`,`opus`],microphone:!0});return t&&!this.abortController.signal.aborted&&(this.probeInfo.value=t,this.hasBackchannel.value=t.audio.some(e=>e.direction===`recvonly`),this.hasAudio.value=t.audio.filter(e=>e.direction===`sendonly`).length>0,this.hasVideo.value=t.video.filter(e=>e.direction===`sendonly`).length>0),t}catch{return}}connectWebSocket(){this.disconnectWebSocket();let e=this.camera.value;if(this.abortController.signal.aborted||!e||!this.source.value||!this.target.value)return;let t=this.source.value.name??this.source.value.role??this.source.value._id,n=$_(e.name.value,t);this.startWsConnectTimeout(),this.wsHandle=this.wsTransport.open({path:`/api/go2rtc`,query:{src:n},binaryType:`arraybuffer`}),this.wsHandle.on(`open`,()=>this.handleWsOpen()),this.wsHandle.on(`close`,()=>this.handleWsClose()),this.wsHandle.on(`message`,e=>this.handleWsMessage(e)),this.wsHandle.on(`error`,()=>{})}disconnectWebSocket(){this.stopWsConnectTimeout(),this.wsHandle&&=(this.wsHandle.dispose(),void 0)}sendWsMessage(e){this.wsHandle?.readyState===WebSocket.OPEN&&this.wsHandle.send(JSON.stringify(e))}handleWsOpen(){if(this.abortController.signal.aborted)return;this.stopWsConnectTimeout(),this.status.value=`connecting`;let e=this.effectiveMode.value;e===`webrtc`||e===`webrtc/tcp`?this.startWebRTC(e):e===`mse`?this.startMSE():this.requestedMode.value===`auto`&&this.startAutoMode()}handleWsClose(){this.status.value!==`closed`&&!this.abortController.signal.aborted&&this.startReconnectTimeout()}handleWsMessage(e){if(!this.abortController.signal.aborted)if(typeof e.data==`string`){let t=JSON.parse(e.data);this.handleMessage(t)}else this.mseHandler&&(this.mseHandler.appendBuffer(e.data),this.handleFirstFrame())}handleMessage(e){switch(e.type){case`webrtc/answer`:case`webrtc/candidate`:this.webrtcHandler?Sb(this.webrtcHandler,e):this.backchannelHandler&&Sb(this.backchannelHandler,e);break;case`mse`:this.mseHandler&&typeof e.value==`string`&&this.mseHandler.initializeBuffer(e.value);break;case`error`:this.requestedMode.value!==`auto`&&(this.error.value=Error(e.value),this.status.value=`error`);break}}async startWebRTC(e){if(this.abortController.signal.aborted)return;this.startConnectTimeout(),this.webrtcHandler=bb({mode:e,signal:this.abortController.signal,onConnected:e=>this.handleWebRTCConnected(e),onDisconnected:()=>this.handleWebRTCDisconnected(),onFailed:()=>this.handleWebRTCFailed(),onCandidate:e=>this.sendWsMessage({type:`webrtc/candidate`,value:e})});let t=await this.webrtcHandler.createOffer();t&&!this.abortController.signal.aborted&&this.sendWsMessage({type:`webrtc/offer`,value:t})}handleWebRTCConnected(e){if(this.abortController.signal.aborted)return;let t=this.videoElement.value;t&&(this.stopConnectTimeout(),this.activeMode.value=this.requestedMode.value===`auto`?`webrtc`:this.requestedMode.value,this.lastMediaStream=e,t.srcObject=e,t.muted=this.muted.value,mb(t),this.status.value=`connected`,this.handleFirstFrameWebRTC(e),this.requestedMode.value===`auto`&&this.mseHandler&&(this.mseHandler.close(),this.mseHandler=void 0))}handleWebRTCDisconnected(){this.status.value!==`closed`&&!this.abortController.signal.aborted&&(this.status.value=`reconnecting`,this.requestedMode.value===`auto`&&this.mseHandler?.isReady?(this.activeMode.value=`mse`,this.status.value=`connected`):this.restart())}handleWebRTCFailed(){this.abortController.signal.aborted||(this.stopConnectTimeout(),this.requestedMode.value===`auto`?(this.activeMode.value=`mse`,this.mseHandler?.isReady?this.status.value=`connected`:this.startMSE()):(this.error.value=Error(`WebRTC connection failed`),this.status.value=`error`))}startMSE(){let e=this.videoElement.value;if(this.abortController.signal.aborted||!e)return;this.mseHandler=pb({videoElement:e,signal:this.abortController.signal,onReady:()=>this.handleMSEReady(),onFirstData:()=>this.handleMSEFirstData(),onError:e=>{this.requestedMode.value!==`auto`&&(this.error.value=e,this.status.value=`error`)}});let t=this.mseHandler.setup();t&&this.sendWsMessage({type:`mse`,value:t})}handleMSEReady(){this.abortController.signal.aborted||this.requestedMode.value===`auto`&&this.webrtcHandler?.isConnected||(this.activeMode.value=`mse`,this.status.value=`connected`)}handleMSEFirstData(){if(this.abortController.signal.aborted)return;let e=this.videoElement.value;e&&mb(e)}async startAutoMode(){if(this.abortController.signal.aborted)return;let e=this.probeInfo.value??await this.probeStream();if(e&&!lb(e).compatible){this.activeMode.value=`mse`,this.startMSE();return}this.startMSE(),this.startWebRTC(`webrtc`)}handleFirstFrame(){!this.isPlaying.value&&!this.abortController.signal.aborted&&(this.isPlaying.value=!0)}monitorMseBuffer(){let e=this.videoElement.value;if(!(!e||this.activeMode.value!==`mse`||!this.isPlaying.value)&&e.buffered.length>0){let t=e.buffered.end(e.buffered.length-1);t-e.currentTime>1&&(e.currentTime=t)}}stopMseMonitor(){this.mseMonitorInterval!==void 0&&(clearInterval(this.mseMonitorInterval),this.mseMonitorInterval=void 0)}handleFirstFrameWebRTC(e){let t=this.videoElement.value;if(this.isPlaying.value||this.abortController.signal.aborted||!t)return;if(!e.getVideoTracks()[0]){this.handleFirstFrame();return}let n=t;if(typeof n.requestVideoFrameCallback==`function`)this.firstFrameCallbackId=n.requestVideoFrameCallback(()=>{this.abortController.signal.aborted||this.handleFirstFrame()});else{let e=()=>{this.abortController.signal.aborted||(t.readyState>=2&&t.videoWidth>0?this.handleFirstFrame():this.firstFrameCallbackId=requestAnimationFrame(e))};this.firstFrameCallbackId=requestAnimationFrame(e)}}cleanup(){this.abortController.abort(),this.stopConnectTimeout(),this.stopWsConnectTimeout(),this.stopReconnectTimeout(),this.stopMseMonitor();let e=this.videoElement.value;e&&(this.onVideoPauseBound&&e.removeEventListener(`pause`,this.onVideoPauseBound),this.onVideoPlayBound&&e.removeEventListener(`play`,this.onVideoPlayBound),this.onVideoResizeBound&&e.removeEventListener(`resize`,this.onVideoResizeBound)),this.lastMediaStream=null,this.webrtcHandler?.close(),this.webrtcHandler=void 0,this.mseHandler?.close(),this.mseHandler=void 0,this.closeBackchannel(),this.disconnectWebSocket();let t=this.videoElement.value;this.firstFrameCallbackId!==void 0&&(t&&`cancelVideoFrameCallback`in t?t.cancelVideoFrameCallback(this.firstFrameCallbackId):cancelAnimationFrame(this.firstFrameCallbackId),this.firstFrameCallbackId=void 0),t&&(t.style.display=``,t.pause(),t.srcObject=null,t.removeAttribute(`src`),t.load())}async startBackchannel(){if(this.abortController.signal.aborted||!this.wsHandle||this.wsHandle.readyState!==WebSocket.OPEN)return;this.backchannelHandler=xb({signal:this.abortController.signal,onCandidate:e=>this.sendWsMessage({type:`webrtc/candidate`,value:e}),onConnected:async()=>{this.pendingMicTrack&&this.backchannelHandler&&await this.backchannelHandler.setMicrophoneTrack(this.pendingMicTrack)},onDisconnected:()=>{this.backchannelHandler=void 0}});let e=await this.backchannelHandler.createOffer();e&&!this.abortController.signal.aborted&&this.sendWsMessage({type:`webrtc/offer`,value:e})}closeBackchannel(){this.backchannelHandler?.close(),this.backchannelHandler=void 0,this.pendingMicTrack=null}};function Tb(e){return new wb(e)}var Eb=new class{streams=new Map;releaseTimers=new Map;releaseDelay;DEFAULT_RELEASE_DELAY=2e3;constructor(e={}){this.releaseDelay=e.releaseDelay??this.DEFAULT_RELEASE_DELAY}has(e){return this.streams.has(e)}get(e){return this.streams.get(e)}acquire(e,t){this.cancelRelease(e);let n=this.streams.get(e);if(n)return n.refCount++,t&&n.consumerContainerRefs.add(t),n}register(e,t,n,r,i,a){this.cancelRelease(e);let o={stream:t,videoElementRef:n,cameraDeviceRef:r,containerElementRef:i,consumerContainerRefs:new Set([i]),sharedVideoElement:a,mediaStream:null,refCount:1};return this.streams.set(e,o),o}updateContainerElement(e,t){let n=this.streams.get(e);n&&(n.containerElementRef.value=t)}updateSharedVideoElement(e,t){let n=this.streams.get(e);n&&(n.sharedVideoElement=t)}updateMediaStream(e,t){let n=this.streams.get(e);n&&(n.mediaStream=t)}release(e,t,n){let r=this.streams.get(e);if(r){if(r.refCount--,n){r.consumerContainerRefs.delete(n);let e=r.sharedVideoElement,t=n.value,i=e?.parentElement??null;if(r.refCount>0&&e&&(i===t||i===null||!i.isConnected)){let n=this.pickVisibleConsumer(r,t);n&&(r.containerElementRef=n.ref,e.parentElement!==n.el&&(n.el.appendChild(e),e.play().catch(()=>{})))}}if(r.refCount<=0){let t=setTimeout(()=>{this.doRelease(e)},this.releaseDelay);this.releaseTimers.set(e,t)}}}forceRelease(e){this.cancelRelease(e),this.doRelease(e)}clear(){for(let e of this.releaseTimers.values())clearTimeout(e);this.releaseTimers.clear();for(let[e,t]of this.streams)t.stream.stop(),this.streams.delete(e)}getDebugInfo(){return Array.from(this.streams.entries()).map(([e,t])=>({cameraName:e,refCount:t.refCount,mode:t.stream.activeMode.value,resolution:t.stream.activeResolution.value}))}pickVisibleConsumer(e,t){let n;for(let r of e.consumerContainerRefs){let e=r.value;if(!(!e||e===t||!e.isConnected)){if(e.checkVisibility?.()??e.offsetParent!==null)return{ref:r,el:e};n??={ref:r,el:e}}}return n}cancelRelease(e){let t=this.releaseTimers.get(e);t&&(clearTimeout(t),this.releaseTimers.delete(e))}doRelease(e){let t=this.streams.get(e);t&&(t.refCount<=0&&(t.stream.stop(),this.streams.delete(e)),this.releaseTimers.delete(e))}},Db=new WeakMap,Ob=[],kb=W(null);function Ab(){kb.value=Ob[Ob.length-1]??null}function jb(){return H(()=>kb.value)}function Mb(e,t={}){let n=t.mode??`fit`,r=s(!1),i=W(null);z(()=>G(e),e=>{i.value=e??null},{immediate:!0});function a(e){e.key===`Escape`&&r.value&&c()}async function o(){let e=i.value;if(!e||r.value)return;let t=document.createElement(`div`);t.className=`cui-fullscreen cui-fullscreen-${n}`,Nb(t,n);let o={wrapper:t,parent:e.parentElement,next:e.nextSibling,bodyOverflow:document.body.style.overflow,htmlOverflow:document.documentElement.style.overflow};Db.set(e,o),e.setAttribute(`data-cui-fullscreen`,n),document.body.appendChild(t),t.appendChild(e),document.body.style.overflow=`hidden`,document.documentElement.style.overflow=`hidden`,document.addEventListener(`keydown`,a),Ob.push(t),Ab(),r.value=!0}async function c(){let e=i.value;if(!e||!r.value)return;let t=Db.get(e);if(!t)return;Db.delete(e),e.removeAttribute(`data-cui-fullscreen`),t.parent&&(t.next&&t.next.parentNode===t.parent?t.parent.insertBefore(e,t.next):t.parent.appendChild(e)),t.wrapper.remove(),document.body.style.overflow=t.bodyOverflow,document.documentElement.style.overflow=t.htmlOverflow,document.removeEventListener(`keydown`,a);let n=Ob.indexOf(t.wrapper);n!==-1&&Ob.splice(n,1),Ab(),r.value=!1}async function l(){r.value?await c():await o()}return xc(()=>{r.value&&i.value&&c(),document.removeEventListener(`keydown`,a)}),{isFullscreen:H(()=>r.value),isSupported:H(()=>!0),enter:o,exit:c,toggle:l}}function Nb(e,t){let n={position:`fixed`,top:`0`,right:`0`,bottom:`0`,left:`0`,zIndex:`2147483647`,margin:`0`,background:`black`,paddingTop:`env(safe-area-inset-top)`,paddingRight:`env(safe-area-inset-right)`,paddingBottom:`env(safe-area-inset-bottom)`,paddingLeft:`env(safe-area-inset-left)`,boxSizing:`border-box`};t===`fit`?Object.assign(e.style,n,{display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`}):Object.assign(e.style,n,{display:`block`,overflowY:`auto`,overflowX:`hidden`,WebkitOverflowScrolling:`touch`,overscrollBehavior:`contain`})}var Pb=75,Fb=500,Ib=0,Lb=0;function Rb(){let e=performance.now();e-Lb>Fb&&(Ib=0);let t=Ib*Pb;return Ib++,Lb=e,t}function zb(e){return!e||!e.isConnected?!1:e.checkVisibility?.()??e.offsetParent!==null}function Bb(e){let{activityConfig:t,autoStart:n=!0,isolated:r=!1}=e,i=()=>G(n),a=e.startDelay??Rb(),o=[],{isConnected:c}=Q_(),l=H(()=>G(e.camera)),u=H(()=>typeof l.value==`string`),d=H(()=>{let e=l.value;return typeof e==`string`?e:e.name.value}),{camera:f,isLoading:p}=Ev(d),m=H(()=>u.value?f.value:l.value),h,g,_=W(),v=W(),y=W(),b=W(),x=W(),S=W(),C=s(!1),w=s(!1),T=s(!1),E=s(0),D=s(0),O=s(!1),k=s(a<=0);a>0&&(h=setTimeout(()=>{k.value=!0},a)),z(m,e=>{S.value=e},{immediate:!0});let A=H(()=>S.value?.disabled.value===!0),j=H(()=>x.value?.status.value??`idle`),M=H(()=>x.value?.isPlaying.value??!1),N=H(()=>x.value?.activeMode.value??`webrtc`),P=H(()=>x.value?.activeResolution.value??`low-resolution`),F=H(()=>x.value?.hasAudio.value??!1),I=H(()=>x.value?.hasBackchannel.value??!1),ee=H(()=>x.value?.error.value),te=H(()=>j.value===`reconnecting`),L=H(()=>p.value||!M.value&&j.value!==`error`),R=H(()=>F.value&&j.value===`connected`),B=H(()=>!!(typeof navigator<`u`&&navigator.mediaDevices)&&I.value),ne=H(()=>x.value?.muted.value??!0),re=H(()=>x.value?.paused.value??!1),ie=H(()=>typeof document<`u`&&document.pictureInPictureEnabled&&!!y.value),ae=H(()=>y.value),oe=H(()=>v.value??_.value),se=Hy({initialMode:G(e.activityMode)??`always-on`,config:t,onStreamStart:()=>{A.value||x.value?.start()},onStreamStop:()=>x.value?.stop(),isStreamPlaying:()=>M.value}),{isFullscreen:ce,toggle:le}=Mb(oe);function ue(){return g=Tb({camera:S,videoElement:b,containerElement:_,mode:H(()=>G(e.mode)??`auto`),resolution:H(()=>G(e.resolution)??`high-resolution`),autoStart:!1}),g}let de=ue();function fe(){let e=document.createElement(`video`);return e.autoplay=!0,e.playsInline=!0,e.muted=!0,e.disablePictureInPicture=!1,e.preload=`auto`,e.style.position=`absolute`,e.style.width=`100%`,e.style.height=`100%`,e.style.inset=`0`,e.style.objectFit=`fill`,e}function pe(e,t){e.parentElement&&e.parentElement!==t&&e.parentElement.removeChild(e),e.parentElement!==t&&t.appendChild(e)}function me(){if(r)return;let e=_.value,t=y.value;if(!e||!t||t.parentElement===e||!zb(e)||zb(t.parentElement))return;pe(t,e),t.play().catch(()=>{});let n=d.value,i=n?Eb.get(n):void 0;i&&(i.containerElementRef=_)}function he(){O.value=!0}function V(){O.value=!1}function ge(){if(w.value)return;let e=_.value,t=m.value;if(!e||!t||!c.value)return;w.value=!0,C.value=!1,x.value=de;let n=fe();y.value=n,b.value=n,i()&&k.value&&se.mode.value===`always-on`&&!A.value&&de.start()}function _e(){if(w.value)return;if(r){ge();return}let e=_.value,t=d.value,n=m.value;if(!e||!t||!c.value)return;let a=Eb.acquire(t,_);if(a){w.value=!0,C.value=!0,x.value=a.stream,n&&a.cameraDeviceRef&&(a.cameraDeviceRef.value=n);let r=a.sharedVideoElement;r||(r=fe(),a.sharedVideoElement=r,Eb.updateSharedVideoElement(t,r)),a.mediaStream?.active&&(r.srcObject=a.mediaStream),e&&(a.containerElementRef=_),y.value=r,a.videoElementRef.value=r,be(a.stream,r,t),i()&&k.value&&!A.value&&(a.stream.activeMode.value===`mse`?r.play().catch(()=>{}):ve(a,r,t))}else if(n){w.value=!0,C.value=!1,x.value=de;let e=fe();y.value=e,b.value=e,Eb.register(t,de,b,S,_,e),i()&&k.value&&se.mode.value===`always-on`&&!A.value&&de.start();let n=z(()=>de.isPlaying.value,n=>{n&&e.srcObject instanceof MediaStream&&Eb.updateMediaStream(t,e.srcObject)},{immediate:!0});o.push(n);let r=z(()=>de.status.value,n=>{n===`connected`&&e.srcObject instanceof MediaStream&&Eb.updateMediaStream(t,e.srcObject)});o.push(r)}}function ve(e,t,n){if(!e)return;let r=e.stream,i=r.activeMode.value,a=r.status.value,o=e.mediaStream?.active&&e.mediaStream.getTracks().some(e=>e.readyState===`live`);i===`mse`?(Eb.updateMediaStream(n,null),r.restart()):o&&e.mediaStream?(t.srcObject=e.mediaStream,t.play().catch(()=>{})):a===`idle`||a===`closed`?(r.start(),ye(r,t,n)):(a===`connected`&&r.restart(),ye(r,t,n))}function ye(e,t,n){let r=z([()=>e.isPlaying.value,()=>e.status.value],([e,i])=>{if(i===`connected`||e){let e=Eb.get(n)?.mediaStream;e?.active&&e.getTracks().some(e=>e.readyState===`live`)?(t.srcObject=e,t.play().catch(()=>{}),r()):t.srcObject instanceof MediaStream&&(Eb.updateMediaStream(n,t.srcObject),t.play().catch(()=>{}),r())}},{immediate:!0});o.push(r)}function be(e,t,n){let r=e.status.value!==`connected`,i=z(()=>e.status.value,e=>{e===`reconnecting`||e===`connecting`?r=!0:e===`connected`&&r&&(r=!1,setTimeout(()=>{t.srcObject instanceof MediaStream&&(Eb.updateMediaStream(n,t.srcObject),t.play().catch(()=>{}))},100))},{immediate:!0});o.push(i);let a=z(()=>e.isPlaying.value,r=>{r&&e.activeMode.value!==`mse`&&t.srcObject instanceof MediaStream&&(Eb.updateMediaStream(n,t.srcObject),t.play().catch(()=>{}))},{immediate:!0});o.push(a)}async function xe(){A.value||(se.inStandby.value?se.resumeFromStandby():await x.value?.start())}function Se(){x.value?.stop()}async function Ce(){await x.value?.restart()}function we(){A.value||se.resumeFromStandby()}async function Te(e){let t=d.value;t&&Eb.updateMediaStream(t,null),await x.value?.setMode(e)}async function Ee(e){await x.value?.setResolution(e)}async function De(e){await x.value?.setMicrophone(e)}function Oe(e){se.setMode(e)}function ke(e){se.reportActivity(e)}function Ae(e){x.value?.setMuted(e);let t=y.value;t&&(t.muted=e)}async function je(){await x.value?.play()}function Me(){x.value?.pause()}function Ne(){document.pictureInPictureElement?document.exitPictureInPicture():document.pictureInPictureEnabled&&y.value&&y.value.requestPictureInPicture()}function U(){let e=y.value;if(!e||e.videoWidth===0)return null;let t=document.createElement(`canvas`);return t.width=e.videoWidth,t.height=e.videoHeight,t.getContext(`2d`)?.drawImage(e,0,0),t.toDataURL(`image/png`)}function Pe(){if(T.value)return;T.value=!0,h&&=(clearTimeout(h),void 0),x.value?.setMuted(!0);let e=y.value;e&&(e.muted=!0);for(let e of o)e();if(o.length=0,r)g?.stop();else{let e=d.value,t=y.value;e&&w.value&&Eb.release(e,t,_)}se.dispose()}function Fe(t){let n=G(e.canvasStyle),r=G(e.canvasClass);if(n)if(typeof n==`string`)t.style.cssText+=`;`+n;else if(Array.isArray(n))for(let e of n)typeof e==`string`?t.style.cssText+=`;`+e:e&&Object.assign(t.style,e);else Object.assign(t.style,n);if(r)if(typeof r==`string`)t.className=r;else if(Array.isArray(r))t.className=r.filter(Boolean).join(` `);else for(let[e,n]of Object.entries(r))t.classList.toggle(e,!!n)}if(!r&&typeof IntersectionObserver<`u`){let e,t=z(_,t=>{e?.disconnect(),e=void 0,t&&(e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&me()}),e.observe(t))},{immediate:!0});o.push(()=>{t(),e?.disconnect()})}if(e.canvasStyle!==void 0||e.canvasClass!==void 0){let e,t=z(_,t=>{if(e?.(),e=void 0,!t)return;Array.from(t.querySelectorAll(`canvas`)).forEach(e=>{Fe(e)});let n=new MutationObserver(e=>{for(let t of e)Array.from(t.addedNodes).forEach(e=>{e instanceof HTMLCanvasElement?Fe(e):e instanceof HTMLElement&&Array.from(e.querySelectorAll(`canvas`)).forEach(e=>Fe(e))})});n.observe(t,{childList:!0,subtree:!0}),e=()=>n.disconnect()},{immediate:!0});o.push(()=>{t(),e?.()})}if(e.videoStyle!==void 0||e.videoClass!==void 0){let t=z([y,()=>G(e.videoStyle),()=>G(e.videoClass)],([e,t,n])=>{if(e){if(t)if(typeof t==`string`)e.style.cssText+=`;`+t;else if(Array.isArray(t))for(let n of t)typeof n==`string`?e.style.cssText+=`;`+n:n&&Object.assign(e.style,n);else Object.assign(e.style,t);if(n)if(typeof n==`string`)e.className=n;else if(Array.isArray(n))e.className=n.filter(Boolean).join(` `);else for(let[t,r]of Object.entries(n))e.classList.toggle(t,r)}},{immediate:!0});o.push(t)}let Ie=z([()=>x.value?.nativeWidth.value,()=>x.value?.nativeHeight.value],([e,t])=>{e&&e>0&&(E.value=e),t&&t>0&&(D.value=t)});o.push(Ie);let Le=z(y,(e,t)=>{t&&(t.removeEventListener(`enterpictureinpicture`,he),t.removeEventListener(`leavepictureinpicture`,V)),e&&(e.addEventListener(`enterpictureinpicture`,he),e.addEventListener(`leavepictureinpicture`,V))},{immediate:!0});return o.push(Le),z([_,y],([e,t])=>{e&&t&&pe(t,e)},{immediate:!0}),z(()=>G(e.activityMode),e=>{e&&e!==se.mode.value&&se.setMode(e)}),z([_,m,c,k],()=>{w.value?k.value&&i()&&!M.value&&j.value===`idle`&&!A.value&&x.value?.start():_e()},{immediate:!0}),z(A,(e,t)=>{w.value&&(!t&&e?x.value?.stop():t&&!e&&i()&&x.value?.restart())}),lt(Pe),xc(Pe),{status:j,isPlaying:M,activeMode:N,activeResolution:P,hasAudio:F,hasBackchannel:I,error:ee,isReconnecting:te,activityMode:se.mode,inStandby:se.inStandby,hasActivity:se.hasActivity,isBusy:L,hasSound:R,hasIntercom:B,videoElement:y,containerElement:_,fullscreenElement:v,renderElement:ae,stream:x,muted:ne,paused:re,nativeWidth:E,nativeHeight:D,isPip:O,supportsPip:ie,isFullscreen:ce,start:xe,stop:Se,restart:Ce,resumeFromStandby:we,setMode:Te,setResolution:Ee,setMicrophone:De,setActivityMode:Oe,reportActivity:ke,setMuted:Ae,play:je,pause:Me,togglePip:Ne,isCameraDisabled:A,toggleFullscreen:le,captureScreenshot:U}}function Vb(){let e=Q_(),t=ev.coreManagerNamespaces(),n=e=>e.createProxy(t.coreManagerRpc);return{getFFmpegPath:()=>rv(e.rpc,e=>n(e).getFFmpegPath()),getServerAddresses:()=>rv(e.rpc,e=>n(e).getServerAddresses()),getPluginsByInterface:t=>rv(e.rpc,e=>n(e).getPluginsByInterface(t)),getCloudServerId:()=>rv(e.rpc,e=>n(e).getCloudServerId())}}var Hb=1500,Ub=3e4,Wb=new Map;function Gb(e){let t=Q_(),n=s({status:`disconnected`}),r=s(null),i=null,a=n=>rv(t.rpc,async r=>{let i=await by(t.rpc,e);if(!i)throw Error(`Plugin "${e}" not found`);return n(r.createProxy(ev.pluginNamespaces(i).pluginChildRpc))});async function o(){n.value=await a(e=>e.getOAuthState()),r.value||=await a(e=>e.getOAuthMetadata())}function c(e){i&&clearInterval(i),i=setInterval(()=>{o().catch(()=>void 0)},e)}return z(()=>n.value.status,e=>{c(e===`awaiting_user`||e===`polling`?Hb:Ub)},{immediate:!0}),o().catch(()=>void 0),{state:n,metadata:r,call:a,refresh:o}}function Kb(e){Wb.has(e)||Wb.set(e,Gb(e));let{state:t,metadata:n,call:r,refresh:i}=Wb.get(e);async function a(e){t.value=await r(t=>t.startDeviceFlow(e))}async function o(e){t.value=await r(t=>t.startAuthCodeFlow(e))}async function s(){(t.value.status===`awaiting_user`||t.value.status===`polling`)&&await r(e=>e.cancelDeviceFlow?.()??e.cancelAuthCodeFlow?.()??Promise.resolve()),await i()}async function c(){await r(e=>e.disconnect()),await i()}return{state:t,metadata:n,startDeviceFlow:a,startAuthCodeFlow:o,cancel:s,disconnect:c,refresh:i}}function qb(){let e=Q_(),{rpc:t,isConnected:n}=e,r=ev.terminalManagerNamespaces(),i=W(),a=s(!1),o=s(!1),c=s(),l=s({cols:80,rows:24}),u,d,f=0,p=e=>e.createProxy(r.terminalManagerRpc);async function m(e){if(!(o.value||a.value)){o.value=!0,c.value=void 0,d=e;try{let n=await rv(t,t=>p(t).createSession({cols:e?.cols??80,rows:e?.rows??24,cwd:e?.cwd,shell:e?.shell,env:e?.env}));i.value=n.sessionId,l.value=n.dimensions,a.value=!0,u=new AbortController;let r=++f;h(n.sessionId,e,r)}catch(t){c.value=t instanceof Error?t:Error(String(t)),e?.onError?.(c.value)}finally{o.value=!1}}}async function h(e,n,r){try{let i=t.value;if(!i)return;for await(let t of p(i).generateOutput(e)){if(r!==f||u?.signal.aborted)break;n?.onData?.(t)}}catch(e){r===f&&!u?.signal.aborted&&(c.value=e instanceof Error?e:Error(String(e)),n?.onError?.(c.value))}finally{r===f&&!u?.signal.aborted&&(a.value=!1,n?.onClose?.())}}async function g(e){if(!(!i.value||!a.value))try{await rv(t,t=>p(t).writeInput(i.value,e))}catch(e){c.value=e instanceof Error?e:Error(String(e)),d?.onError?.(c.value)}}async function _(e){if(!(!i.value||!a.value))try{await rv(t,t=>p(t).resize(i.value,e)),l.value=e}catch(e){c.value=e instanceof Error?e:Error(String(e)),d?.onError?.(c.value)}}async function v(){if(u?.abort(),f++,i.value)try{await rv(t,e=>p(e).closeSession(i.value),{awaitConnect:!1,maxRetries:0})}catch{}i.value=void 0,a.value=!1,d=void 0}function y(){if(!i.value&&!a.value)return;let e=d;u?.abort(),f++,i.value=void 0,a.value=!1,d=void 0,e?.onClose?.(),e&&m(e)}return e.on(`reconnected`,y),xc(()=>{e.off(`reconnected`,y),v()}),{sessionId:L(i),isConnected:L(a),isConnecting:L(o),isClientConnected:L(n),error:L(c),dimensions:L(l),connect:m,write:g,resize:_,close:v}}var Jb=Fm.extend({name:`skeleton`,style:`
|
|
1016
|
-
.p-skeleton {
|
|
1017
|
-
display: block;
|
|
1018
|
-
overflow: hidden;
|
|
1019
|
-
background: dt('skeleton.background');
|
|
1020
|
-
border-radius: dt('skeleton.border.radius');
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
.p-skeleton::after {
|
|
1024
|
-
content: '';
|
|
1025
|
-
animation: p-skeleton-animation 1.2s infinite;
|
|
1026
|
-
height: 100%;
|
|
1027
|
-
left: 0;
|
|
1028
|
-
position: absolute;
|
|
1029
|
-
right: 0;
|
|
1030
|
-
top: 0;
|
|
1031
|
-
transform: translateX(-100%);
|
|
1032
|
-
z-index: 1;
|
|
1033
|
-
background: linear-gradient(90deg, rgba(255, 255, 255, 0), dt('skeleton.animation.background'), rgba(255, 255, 255, 0));
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
[dir='rtl'] .p-skeleton::after {
|
|
1037
|
-
animation-name: p-skeleton-animation-rtl;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
.p-skeleton-circle {
|
|
1041
|
-
border-radius: 50%;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
.p-skeleton-animation-none::after {
|
|
1045
|
-
animation: none;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
@keyframes p-skeleton-animation {
|
|
1049
|
-
from {
|
|
1050
|
-
transform: translateX(-100%);
|
|
1051
|
-
}
|
|
1052
|
-
to {
|
|
1053
|
-
transform: translateX(100%);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
@keyframes p-skeleton-animation-rtl {
|
|
1058
|
-
from {
|
|
1059
|
-
transform: translateX(100%);
|
|
1060
|
-
}
|
|
1061
|
-
to {
|
|
1062
|
-
transform: translateX(-100%);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
`,classes:{root:function(e){var t=e.props;return[`p-skeleton p-component`,{"p-skeleton-circle":t.shape===`circle`,"p-skeleton-animation-none":t.animation===`none`}]}},inlineStyles:{root:{position:`relative`}}}),Yb={name:`BaseSkeleton`,extends:Qm,props:{shape:{type:String,default:`rectangle`},size:{type:String,default:null},width:{type:String,default:`100%`},height:{type:String,default:`1rem`},borderRadius:{type:String,default:null},animation:{type:String,default:`wave`}},style:Jb,provide:function(){return{$pcSkeleton:this,$parentInstance:this}}};function Xb(e){"@babel/helpers - typeof";return Xb=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Xb(e)}function Zb(e,t,n){return(t=Qb(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qb(e){var t=$b(e,`string`);return Xb(t)==`symbol`?t:t+``}function $b(e,t){if(Xb(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Xb(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var ex={name:`Skeleton`,extends:Yb,inheritAttrs:!1,computed:{containerStyle:function(){return this.size?{width:this.size,height:this.size,borderRadius:this.borderRadius}:{width:this.width,height:this.height,borderRadius:this.borderRadius}},dataP:function(){return Nd(Zb({},this.shape,this.shape))}}},tx=[`data-p`];function nx(e,t,n,r,i,a){return q(),c(`div`,U({class:e.cx(`root`),style:[e.sx(`root`),a.containerStyle],"aria-hidden":`true`},e.ptmi(`root`),{"data-p":a.dataP}),null,16,tx)}ex.render=nx;var rx={name:`Card`,extends:{name:`BaseCard`,extends:Qm,style:Fm.extend({name:`card`,style:`
|
|
1066
|
-
.p-card {
|
|
1067
|
-
background: dt('card.background');
|
|
1068
|
-
color: dt('card.color');
|
|
1069
|
-
box-shadow: dt('card.shadow');
|
|
1070
|
-
border-radius: dt('card.border.radius');
|
|
1071
|
-
display: flex;
|
|
1072
|
-
flex-direction: column;
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
.p-card-caption {
|
|
1076
|
-
display: flex;
|
|
1077
|
-
flex-direction: column;
|
|
1078
|
-
gap: dt('card.caption.gap');
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
.p-card-body {
|
|
1082
|
-
padding: dt('card.body.padding');
|
|
1083
|
-
display: flex;
|
|
1084
|
-
flex-direction: column;
|
|
1085
|
-
gap: dt('card.body.gap');
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
.p-card-title {
|
|
1089
|
-
font-size: dt('card.title.font.size');
|
|
1090
|
-
font-weight: dt('card.title.font.weight');
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
.p-card-subtitle {
|
|
1094
|
-
color: dt('card.subtitle.color');
|
|
1095
|
-
}
|
|
1096
|
-
`,classes:{root:`p-card p-component`,header:`p-card-header`,body:`p-card-body`,caption:`p-card-caption`,title:`p-card-title`,subtitle:`p-card-subtitle`,content:`p-card-content`,footer:`p-card-footer`}}),provide:function(){return{$pcCard:this,$parentInstance:this}}},inheritAttrs:!1};function ix(e,t,n,r,i,a){return q(),c(`div`,U({class:e.cx(`root`)},e.ptmi(`root`)),[e.$slots.header?(q(),c(`div`,U({key:0,class:e.cx(`header`)},e.ptm(`header`)),[m(e.$slots,`header`)],16)):R(``,!0),V(`div`,U({class:e.cx(`body`)},e.ptm(`body`)),[e.$slots.title||e.$slots.subtitle?(q(),c(`div`,U({key:0,class:e.cx(`caption`)},e.ptm(`caption`)),[e.$slots.title?(q(),c(`div`,U({key:0,class:e.cx(`title`)},e.ptm(`title`)),[m(e.$slots,`title`)],16)):R(``,!0),e.$slots.subtitle?(q(),c(`div`,U({key:1,class:e.cx(`subtitle`)},e.ptm(`subtitle`)),[m(e.$slots,`subtitle`)],16)):R(``,!0)],16)):R(``,!0),V(`div`,U({class:e.cx(`content`)},e.ptm(`content`)),[m(e.$slots,`content`)],16),e.$slots.footer?(q(),c(`div`,U({key:1,class:e.cx(`footer`)},e.ptm(`footer`)),[m(e.$slots,`footer`)],16)):R(``,!0)],16)],16)}rx.render=ix;var ax={name:`CalendarIcon`,extends:oh};function ox(e){return ux(e)||lx(e)||cx(e)||sx()}function sx(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1097
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cx(e,t){if(e){if(typeof e==`string`)return dx(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dx(e,t):void 0}}function lx(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function ux(e){if(Array.isArray(e))return dx(e)}function dx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function fx(e,t,n,r,i,a){return q(),c(`svg`,U({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),ox(t[0]||=[V(`path`,{d:`M10.7838 1.51351H9.83783V0.567568C9.83783 0.417039 9.77804 0.272676 9.6716 0.166237C9.56516 0.0597971 9.42079 0 9.27027 0C9.11974 0 8.97538 0.0597971 8.86894 0.166237C8.7625 0.272676 8.7027 0.417039 8.7027 0.567568V1.51351H5.29729V0.567568C5.29729 0.417039 5.2375 0.272676 5.13106 0.166237C5.02462 0.0597971 4.88025 0 4.72973 0C4.5792 0 4.43484 0.0597971 4.3284 0.166237C4.22196 0.272676 4.16216 0.417039 4.16216 0.567568V1.51351H3.21621C2.66428 1.51351 2.13494 1.73277 1.74467 2.12305C1.35439 2.51333 1.13513 3.04266 1.13513 3.59459V11.9189C1.13513 12.4709 1.35439 13.0002 1.74467 13.3905C2.13494 13.7807 2.66428 14 3.21621 14H10.7838C11.3357 14 11.865 13.7807 12.2553 13.3905C12.6456 13.0002 12.8649 12.4709 12.8649 11.9189V3.59459C12.8649 3.04266 12.6456 2.51333 12.2553 2.12305C11.865 1.73277 11.3357 1.51351 10.7838 1.51351ZM3.21621 2.64865H4.16216V3.59459C4.16216 3.74512 4.22196 3.88949 4.3284 3.99593C4.43484 4.10237 4.5792 4.16216 4.72973 4.16216C4.88025 4.16216 5.02462 4.10237 5.13106 3.99593C5.2375 3.88949 5.29729 3.74512 5.29729 3.59459V2.64865H8.7027V3.59459C8.7027 3.74512 8.7625 3.88949 8.86894 3.99593C8.97538 4.10237 9.11974 4.16216 9.27027 4.16216C9.42079 4.16216 9.56516 4.10237 9.6716 3.99593C9.77804 3.88949 9.83783 3.74512 9.83783 3.59459V2.64865H10.7838C11.0347 2.64865 11.2753 2.74831 11.4527 2.92571C11.6301 3.10311 11.7297 3.34371 11.7297 3.59459V5.67568H2.27027V3.59459C2.27027 3.34371 2.36993 3.10311 2.54733 2.92571C2.72473 2.74831 2.96533 2.64865 3.21621 2.64865ZM10.7838 12.8649H3.21621C2.96533 12.8649 2.72473 12.7652 2.54733 12.5878C2.36993 12.4104 2.27027 12.1698 2.27027 11.9189V6.81081H11.7297V11.9189C11.7297 12.1698 11.6301 12.4104 11.4527 12.5878C11.2753 12.7652 11.0347 12.8649 10.7838 12.8649Z`,fill:`currentColor`},null,-1)]),16)}ax.render=fx;var px={name:`ChevronDownIcon`,extends:oh};function mx(e){return vx(e)||_x(e)||gx(e)||hx()}function hx(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1098
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gx(e,t){if(e){if(typeof e==`string`)return yx(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yx(e,t):void 0}}function _x(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function vx(e){if(Array.isArray(e))return yx(e)}function yx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bx(e,t,n,r,i,a){return q(),c(`svg`,U({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),mx(t[0]||=[V(`path`,{d:`M7.01744 10.398C6.91269 10.3985 6.8089 10.378 6.71215 10.3379C6.61541 10.2977 6.52766 10.2386 6.45405 10.1641L1.13907 4.84913C1.03306 4.69404 0.985221 4.5065 1.00399 4.31958C1.02276 4.13266 1.10693 3.95838 1.24166 3.82747C1.37639 3.69655 1.55301 3.61742 1.74039 3.60402C1.92777 3.59062 2.11386 3.64382 2.26584 3.75424L7.01744 8.47394L11.769 3.75424C11.9189 3.65709 12.097 3.61306 12.2748 3.62921C12.4527 3.64535 12.6199 3.72073 12.7498 3.84328C12.8797 3.96582 12.9647 4.12842 12.9912 4.30502C13.0177 4.48162 12.9841 4.662 12.8958 4.81724L7.58083 10.1322C7.50996 10.2125 7.42344 10.2775 7.32656 10.3232C7.22968 10.3689 7.12449 10.3944 7.01744 10.398Z`,fill:`currentColor`},null,-1)]),16)}px.render=bx;var xx={name:`ChevronLeftIcon`,extends:oh};function Sx(e){return Ex(e)||Tx(e)||wx(e)||Cx()}function Cx(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1099
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wx(e,t){if(e){if(typeof e==`string`)return Dx(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dx(e,t):void 0}}function Tx(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Ex(e){if(Array.isArray(e))return Dx(e)}function Dx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ox(e,t,n,r,i,a){return q(),c(`svg`,U({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),Sx(t[0]||=[V(`path`,{d:`M9.61296 13C9.50997 13.0005 9.40792 12.9804 9.3128 12.9409C9.21767 12.9014 9.13139 12.8433 9.05902 12.7701L3.83313 7.54416C3.68634 7.39718 3.60388 7.19795 3.60388 6.99022C3.60388 6.78249 3.68634 6.58325 3.83313 6.43628L9.05902 1.21039C9.20762 1.07192 9.40416 0.996539 9.60724 1.00012C9.81032 1.00371 10.0041 1.08597 10.1477 1.22959C10.2913 1.37322 10.3736 1.56698 10.3772 1.77005C10.3808 1.97313 10.3054 2.16968 10.1669 2.31827L5.49496 6.99022L10.1669 11.6622C10.3137 11.8091 10.3962 12.0084 10.3962 12.2161C10.3962 12.4238 10.3137 12.6231 10.1669 12.7701C10.0945 12.8433 10.0083 12.9014 9.91313 12.9409C9.81801 12.9804 9.71596 13.0005 9.61296 13Z`,fill:`currentColor`},null,-1)]),16)}xx.render=Ox;var kx={name:`ChevronRightIcon`,extends:oh};function Ax(e){return Px(e)||Nx(e)||Mx(e)||jx()}function jx(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1100
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mx(e,t){if(e){if(typeof e==`string`)return Fx(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fx(e,t):void 0}}function Nx(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Px(e){if(Array.isArray(e))return Fx(e)}function Fx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ix(e,t,n,r,i,a){return q(),c(`svg`,U({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),Ax(t[0]||=[V(`path`,{d:`M4.38708 13C4.28408 13.0005 4.18203 12.9804 4.08691 12.9409C3.99178 12.9014 3.9055 12.8433 3.83313 12.7701C3.68634 12.6231 3.60388 12.4238 3.60388 12.2161C3.60388 12.0084 3.68634 11.8091 3.83313 11.6622L8.50507 6.99022L3.83313 2.31827C3.69467 2.16968 3.61928 1.97313 3.62287 1.77005C3.62645 1.56698 3.70872 1.37322 3.85234 1.22959C3.99596 1.08597 4.18972 1.00371 4.3928 1.00012C4.59588 0.996539 4.79242 1.07192 4.94102 1.21039L10.1669 6.43628C10.3137 6.58325 10.3962 6.78249 10.3962 6.99022C10.3962 7.19795 10.3137 7.39718 10.1669 7.54416L4.94102 12.7701C4.86865 12.8433 4.78237 12.9014 4.68724 12.9409C4.59212 12.9804 4.49007 13.0005 4.38708 13Z`,fill:`currentColor`},null,-1)]),16)}kx.render=Ix;var Lx={name:`ChevronUpIcon`,extends:oh};function Rx(e){return Hx(e)||Vx(e)||Bx(e)||zx()}function zx(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1101
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bx(e,t){if(e){if(typeof e==`string`)return Ux(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ux(e,t):void 0}}function Vx(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Hx(e){if(Array.isArray(e))return Ux(e)}function Ux(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Wx(e,t,n,r,i,a){return q(),c(`svg`,U({width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},e.pti()),Rx(t[0]||=[V(`path`,{d:`M12.2097 10.4113C12.1057 10.4118 12.0027 10.3915 11.9067 10.3516C11.8107 10.3118 11.7237 10.2532 11.6506 10.1792L6.93602 5.46461L2.22139 10.1476C2.07272 10.244 1.89599 10.2877 1.71953 10.2717C1.54307 10.2556 1.3771 10.1808 1.24822 10.0593C1.11933 9.93766 1.035 9.77633 1.00874 9.6011C0.982477 9.42587 1.0158 9.2469 1.10338 9.09287L6.37701 3.81923C6.52533 3.6711 6.72639 3.58789 6.93602 3.58789C7.14565 3.58789 7.3467 3.6711 7.49502 3.81923L12.7687 9.09287C12.9168 9.24119 13 9.44225 13 9.65187C13 9.8615 12.9168 10.0626 12.7687 10.2109C12.616 10.3487 12.4151 10.4207 12.2097 10.4113Z`,fill:`currentColor`},null,-1)]),16)}Lx.render=Wx;var Gx={name:`BaseEditableHolder`,extends:Qm,emits:[`update:modelValue`,`value-change`],props:{modelValue:{type:null,default:void 0},defaultValue:{type:null,default:void 0},name:{type:String,default:void 0},invalid:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},formControl:{type:Object,default:void 0}},inject:{$parentInstance:{default:void 0},$pcForm:{default:void 0},$pcFormField:{default:void 0}},data:function(){return{d_value:this.defaultValue===void 0?this.modelValue:this.defaultValue}},watch:{modelValue:{deep:!0,handler:function(e){this.d_value=e}},defaultValue:function(e){this.d_value=e},$formName:{immediate:!0,handler:function(e){var t,n;this.formField=((t=this.$pcForm)==null||(n=t.register)==null?void 0:n.call(t,e,this.$formControl))||{}}},$formControl:{immediate:!0,handler:function(e){var t,n;this.formField=((t=this.$pcForm)==null||(n=t.register)==null?void 0:n.call(t,this.$formName,e))||{}}},$formDefaultValue:{immediate:!0,handler:function(e){this.d_value!==e&&(this.d_value=e)}},$formValue:{immediate:!1,handler:function(e){var t;(t=this.$pcForm)!=null&&t.getFieldState(this.$formName)&&e!==this.d_value&&(this.d_value=e)}}},formField:{},methods:{writeValue:function(e,t){var n,r;this.controlled&&(this.d_value=e,this.$emit(`update:modelValue`,e)),this.$emit(`value-change`,e),(n=(r=this.formField).onChange)==null||n.call(r,{originalEvent:t,value:e})},findNonEmpty:function(){return[...arguments].find(qf)}},computed:{$filled:function(){return qf(this.d_value)},$invalid:function(){var e,t;return!this.$formNovalidate&&this.findNonEmpty(this.invalid,(e=this.$pcFormField)==null||(e=e.$field)==null?void 0:e.invalid,(t=this.$pcForm)==null||(t=t.getFieldState(this.$formName))==null?void 0:t.invalid)},$formName:function(){return this.$formNovalidate?void 0:this.name||this.$formControl?.name},$formControl:function(){return this.formControl||this.$pcFormField?.formControl},$formNovalidate:function(){return this.$formControl?.novalidate},$formDefaultValue:function(){var e;return this.findNonEmpty(this.d_value,this.$pcFormField?.initialValue,(e=this.$pcForm)==null||(e=e.initialValues)==null?void 0:e[this.$formName])},$formValue:function(){var e,t;return this.findNonEmpty((e=this.$pcFormField)==null||(e=e.$field)==null?void 0:e.value,(t=this.$pcForm)==null||(t=t.getFieldState(this.$formName))==null?void 0:t.value)},controlled:function(){return this.$inProps.hasOwnProperty(`modelValue`)||!this.$inProps.hasOwnProperty(`modelValue`)&&!this.$inProps.hasOwnProperty(`defaultValue`)},filled:function(){return this.$filled}}},Kx={name:`BaseInput`,extends:Gx,props:{size:{type:String,default:null},fluid:{type:Boolean,default:null},variant:{type:String,default:null}},inject:{$parentInstance:{default:void 0},$pcFluid:{default:void 0}},computed:{$variant:function(){return this.variant??(this.$primevue.config.inputStyle||this.$primevue.config.inputVariant)},$fluid:function(){return this.fluid??!!this.$pcFluid},hasFluid:function(){return this.$fluid}}},qx={name:`BaseInputText`,extends:Kx,style:Fm.extend({name:`inputtext`,style:`
|
|
1102
|
-
.p-inputtext {
|
|
1103
|
-
font-family: inherit;
|
|
1104
|
-
font-feature-settings: inherit;
|
|
1105
|
-
font-size: 1rem;
|
|
1106
|
-
color: dt('inputtext.color');
|
|
1107
|
-
background: dt('inputtext.background');
|
|
1108
|
-
padding-block: dt('inputtext.padding.y');
|
|
1109
|
-
padding-inline: dt('inputtext.padding.x');
|
|
1110
|
-
border: 1px solid dt('inputtext.border.color');
|
|
1111
|
-
transition:
|
|
1112
|
-
background dt('inputtext.transition.duration'),
|
|
1113
|
-
color dt('inputtext.transition.duration'),
|
|
1114
|
-
border-color dt('inputtext.transition.duration'),
|
|
1115
|
-
outline-color dt('inputtext.transition.duration'),
|
|
1116
|
-
box-shadow dt('inputtext.transition.duration');
|
|
1117
|
-
appearance: none;
|
|
1118
|
-
border-radius: dt('inputtext.border.radius');
|
|
1119
|
-
outline-color: transparent;
|
|
1120
|
-
box-shadow: dt('inputtext.shadow');
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
.p-inputtext:enabled:hover {
|
|
1124
|
-
border-color: dt('inputtext.hover.border.color');
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
.p-inputtext:enabled:focus {
|
|
1128
|
-
border-color: dt('inputtext.focus.border.color');
|
|
1129
|
-
box-shadow: dt('inputtext.focus.ring.shadow');
|
|
1130
|
-
outline: dt('inputtext.focus.ring.width') dt('inputtext.focus.ring.style') dt('inputtext.focus.ring.color');
|
|
1131
|
-
outline-offset: dt('inputtext.focus.ring.offset');
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
.p-inputtext.p-invalid {
|
|
1135
|
-
border-color: dt('inputtext.invalid.border.color');
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
.p-inputtext.p-variant-filled {
|
|
1139
|
-
background: dt('inputtext.filled.background');
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
.p-inputtext.p-variant-filled:enabled:hover {
|
|
1143
|
-
background: dt('inputtext.filled.hover.background');
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
.p-inputtext.p-variant-filled:enabled:focus {
|
|
1147
|
-
background: dt('inputtext.filled.focus.background');
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
.p-inputtext:disabled {
|
|
1151
|
-
opacity: 1;
|
|
1152
|
-
background: dt('inputtext.disabled.background');
|
|
1153
|
-
color: dt('inputtext.disabled.color');
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
.p-inputtext::placeholder {
|
|
1157
|
-
color: dt('inputtext.placeholder.color');
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
.p-inputtext.p-invalid::placeholder {
|
|
1161
|
-
color: dt('inputtext.invalid.placeholder.color');
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
.p-inputtext-sm {
|
|
1165
|
-
font-size: dt('inputtext.sm.font.size');
|
|
1166
|
-
padding-block: dt('inputtext.sm.padding.y');
|
|
1167
|
-
padding-inline: dt('inputtext.sm.padding.x');
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
.p-inputtext-lg {
|
|
1171
|
-
font-size: dt('inputtext.lg.font.size');
|
|
1172
|
-
padding-block: dt('inputtext.lg.padding.y');
|
|
1173
|
-
padding-inline: dt('inputtext.lg.padding.x');
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
.p-inputtext-fluid {
|
|
1177
|
-
width: 100%;
|
|
1178
|
-
}
|
|
1179
|
-
`,classes:{root:function(e){var t=e.instance,n=e.props;return[`p-inputtext p-component`,{"p-filled":t.$filled,"p-inputtext-sm p-inputfield-sm":n.size===`small`,"p-inputtext-lg p-inputfield-lg":n.size===`large`,"p-invalid":t.$invalid,"p-variant-filled":t.$variant===`filled`,"p-inputtext-fluid":t.$fluid}]}}}),provide:function(){return{$pcInputText:this,$parentInstance:this}}};function Jx(e){"@babel/helpers - typeof";return Jx=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Jx(e)}function Yx(e,t,n){return(t=Xx(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xx(e){var t=Zx(e,`string`);return Jx(t)==`symbol`?t:t+``}function Zx(e,t){if(Jx(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Jx(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Qx={name:`InputText`,extends:qx,inheritAttrs:!1,methods:{onInput:function(e){this.writeValue(e.target.value,e)}},computed:{attrs:function(){return U(this.ptmi(`root`,{context:{filled:this.$filled,disabled:this.disabled}}),this.formField)},dataP:function(){return Nd(Yx({invalid:this.$invalid,fluid:this.$fluid,filled:this.$variant===`filled`},this.size,this.size))}}},$x=[`value`,`name`,`disabled`,`aria-invalid`,`data-p`];function eS(e,t,n,r,i,a){return q(),c(`input`,U({type:`text`,class:e.cx(`root`),value:e.d_value,name:e.name,disabled:e.disabled,"aria-invalid":e.$invalid||void 0,"data-p":a.dataP,onInput:t[0]||=function(){return a.onInput&&a.onInput.apply(a,arguments)}},a.attrs),null,16,$x)}Qx.render=eS;var tS=Ff(),nS=Fm.extend({name:`datepicker`,style:`
|
|
1180
|
-
.p-datepicker {
|
|
1181
|
-
display: inline-flex;
|
|
1182
|
-
max-width: 100%;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
.p-datepicker:has(.p-datepicker-dropdown) .p-datepicker-input {
|
|
1186
|
-
border-start-end-radius: 0;
|
|
1187
|
-
border-end-end-radius: 0;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
.p-datepicker-input {
|
|
1191
|
-
flex: 1 1 auto;
|
|
1192
|
-
width: 1%;
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
.p-datepicker-dropdown {
|
|
1196
|
-
cursor: pointer;
|
|
1197
|
-
display: inline-flex;
|
|
1198
|
-
user-select: none;
|
|
1199
|
-
align-items: center;
|
|
1200
|
-
justify-content: center;
|
|
1201
|
-
overflow: hidden;
|
|
1202
|
-
position: relative;
|
|
1203
|
-
width: dt('datepicker.dropdown.width');
|
|
1204
|
-
border-start-end-radius: dt('datepicker.dropdown.border.radius');
|
|
1205
|
-
border-end-end-radius: dt('datepicker.dropdown.border.radius');
|
|
1206
|
-
background: dt('datepicker.dropdown.background');
|
|
1207
|
-
border: 1px solid dt('datepicker.dropdown.border.color');
|
|
1208
|
-
border-inline-start: 0 none;
|
|
1209
|
-
color: dt('datepicker.dropdown.color');
|
|
1210
|
-
transition:
|
|
1211
|
-
background dt('datepicker.transition.duration'),
|
|
1212
|
-
color dt('datepicker.transition.duration'),
|
|
1213
|
-
border-color dt('datepicker.transition.duration'),
|
|
1214
|
-
outline-color dt('datepicker.transition.duration');
|
|
1215
|
-
outline-color: transparent;
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
.p-datepicker-dropdown:not(:disabled):hover {
|
|
1219
|
-
background: dt('datepicker.dropdown.hover.background');
|
|
1220
|
-
border-color: dt('datepicker.dropdown.hover.border.color');
|
|
1221
|
-
color: dt('datepicker.dropdown.hover.color');
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
.p-datepicker-dropdown:not(:disabled):active {
|
|
1225
|
-
background: dt('datepicker.dropdown.active.background');
|
|
1226
|
-
border-color: dt('datepicker.dropdown.active.border.color');
|
|
1227
|
-
color: dt('datepicker.dropdown.active.color');
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
.p-datepicker-dropdown:focus-visible {
|
|
1231
|
-
box-shadow: dt('datepicker.dropdown.focus.ring.shadow');
|
|
1232
|
-
outline: dt('datepicker.dropdown.focus.ring.width') dt('datepicker.dropdown.focus.ring.style') dt('datepicker.dropdown.focus.ring.color');
|
|
1233
|
-
outline-offset: dt('datepicker.dropdown.focus.ring.offset');
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
.p-datepicker:has(.p-datepicker-input-icon-container) {
|
|
1237
|
-
position: relative;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
.p-datepicker:has(.p-datepicker-input-icon-container) .p-datepicker-input {
|
|
1241
|
-
padding-inline-end: calc((dt('form.field.padding.x') * 2) + dt('icon.size'));
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
.p-datepicker-input-icon-container {
|
|
1245
|
-
cursor: pointer;
|
|
1246
|
-
position: absolute;
|
|
1247
|
-
top: 50%;
|
|
1248
|
-
inset-inline-end: dt('form.field.padding.x');
|
|
1249
|
-
margin-block-start: calc(-1 * (dt('icon.size') / 2));
|
|
1250
|
-
color: dt('datepicker.input.icon.color');
|
|
1251
|
-
line-height: 1;
|
|
1252
|
-
z-index: 1;
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
.p-datepicker:has(.p-datepicker-input:disabled) .p-datepicker-input-icon-container {
|
|
1256
|
-
cursor: default;
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
.p-datepicker-fluid {
|
|
1260
|
-
display: flex;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
.p-datepicker .p-datepicker-panel {
|
|
1264
|
-
min-width: 100%;
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
.p-datepicker-panel {
|
|
1268
|
-
width: auto;
|
|
1269
|
-
padding: dt('datepicker.panel.padding');
|
|
1270
|
-
background: dt('datepicker.panel.background');
|
|
1271
|
-
color: dt('datepicker.panel.color');
|
|
1272
|
-
border: 1px solid dt('datepicker.panel.border.color');
|
|
1273
|
-
border-radius: dt('datepicker.panel.border.radius');
|
|
1274
|
-
box-shadow: dt('datepicker.panel.shadow');
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
.p-datepicker-panel-inline {
|
|
1278
|
-
display: inline-block;
|
|
1279
|
-
overflow-x: auto;
|
|
1280
|
-
box-shadow: none;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
.p-datepicker-header {
|
|
1284
|
-
display: flex;
|
|
1285
|
-
align-items: center;
|
|
1286
|
-
justify-content: space-between;
|
|
1287
|
-
padding: dt('datepicker.header.padding');
|
|
1288
|
-
background: dt('datepicker.header.background');
|
|
1289
|
-
color: dt('datepicker.header.color');
|
|
1290
|
-
border-block-end: 1px solid dt('datepicker.header.border.color');
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
.p-datepicker-next-button:dir(rtl) {
|
|
1294
|
-
order: -1;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
.p-datepicker-prev-button:dir(rtl) {
|
|
1298
|
-
order: 1;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
.p-datepicker-title {
|
|
1302
|
-
display: flex;
|
|
1303
|
-
align-items: center;
|
|
1304
|
-
justify-content: space-between;
|
|
1305
|
-
gap: dt('datepicker.title.gap');
|
|
1306
|
-
font-weight: dt('datepicker.title.font.weight');
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
.p-datepicker-select-year,
|
|
1310
|
-
.p-datepicker-select-month {
|
|
1311
|
-
border: none;
|
|
1312
|
-
background: transparent;
|
|
1313
|
-
margin: 0;
|
|
1314
|
-
cursor: pointer;
|
|
1315
|
-
font-weight: inherit;
|
|
1316
|
-
transition:
|
|
1317
|
-
background dt('datepicker.transition.duration'),
|
|
1318
|
-
color dt('datepicker.transition.duration'),
|
|
1319
|
-
border-color dt('datepicker.transition.duration'),
|
|
1320
|
-
outline-color dt('datepicker.transition.duration'),
|
|
1321
|
-
box-shadow dt('datepicker.transition.duration');
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
.p-datepicker-select-month {
|
|
1325
|
-
padding: dt('datepicker.select.month.padding');
|
|
1326
|
-
color: dt('datepicker.select.month.color');
|
|
1327
|
-
border-radius: dt('datepicker.select.month.border.radius');
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
.p-datepicker-select-year {
|
|
1331
|
-
padding: dt('datepicker.select.year.padding');
|
|
1332
|
-
color: dt('datepicker.select.year.color');
|
|
1333
|
-
border-radius: dt('datepicker.select.year.border.radius');
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
.p-datepicker-select-month:enabled:hover {
|
|
1337
|
-
background: dt('datepicker.select.month.hover.background');
|
|
1338
|
-
color: dt('datepicker.select.month.hover.color');
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
.p-datepicker-select-year:enabled:hover {
|
|
1342
|
-
background: dt('datepicker.select.year.hover.background');
|
|
1343
|
-
color: dt('datepicker.select.year.hover.color');
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
.p-datepicker-select-month:focus-visible,
|
|
1347
|
-
.p-datepicker-select-year:focus-visible {
|
|
1348
|
-
box-shadow: dt('datepicker.date.focus.ring.shadow');
|
|
1349
|
-
outline: dt('datepicker.date.focus.ring.width') dt('datepicker.date.focus.ring.style') dt('datepicker.date.focus.ring.color');
|
|
1350
|
-
outline-offset: dt('datepicker.date.focus.ring.offset');
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
.p-datepicker-calendar-container {
|
|
1354
|
-
display: flex;
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
.p-datepicker-calendar-container .p-datepicker-calendar {
|
|
1358
|
-
flex: 1 1 auto;
|
|
1359
|
-
border-inline-start: 1px solid dt('datepicker.group.border.color');
|
|
1360
|
-
padding-inline-end: dt('datepicker.group.gap');
|
|
1361
|
-
padding-inline-start: dt('datepicker.group.gap');
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
.p-datepicker-calendar-container .p-datepicker-calendar:first-child {
|
|
1365
|
-
padding-inline-start: 0;
|
|
1366
|
-
border-inline-start: 0 none;
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
.p-datepicker-calendar-container .p-datepicker-calendar:last-child {
|
|
1370
|
-
padding-inline-end: 0;
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
.p-datepicker-day-view {
|
|
1374
|
-
width: 100%;
|
|
1375
|
-
border-collapse: collapse;
|
|
1376
|
-
font-size: 1rem;
|
|
1377
|
-
margin: dt('datepicker.day.view.margin');
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
.p-datepicker-weekday-cell {
|
|
1381
|
-
padding: dt('datepicker.week.day.padding');
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
.p-datepicker-weekday {
|
|
1385
|
-
font-weight: dt('datepicker.week.day.font.weight');
|
|
1386
|
-
color: dt('datepicker.week.day.color');
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
.p-datepicker-day-cell {
|
|
1390
|
-
padding: dt('datepicker.date.padding');
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
.p-datepicker-day {
|
|
1394
|
-
display: flex;
|
|
1395
|
-
justify-content: center;
|
|
1396
|
-
align-items: center;
|
|
1397
|
-
cursor: pointer;
|
|
1398
|
-
margin: 0 auto;
|
|
1399
|
-
overflow: hidden;
|
|
1400
|
-
position: relative;
|
|
1401
|
-
width: dt('datepicker.date.width');
|
|
1402
|
-
height: dt('datepicker.date.height');
|
|
1403
|
-
border-radius: dt('datepicker.date.border.radius');
|
|
1404
|
-
transition:
|
|
1405
|
-
background dt('datepicker.transition.duration'),
|
|
1406
|
-
color dt('datepicker.transition.duration'),
|
|
1407
|
-
border-color dt('datepicker.transition.duration'),
|
|
1408
|
-
box-shadow dt('datepicker.transition.duration'),
|
|
1409
|
-
outline-color dt('datepicker.transition.duration');
|
|
1410
|
-
border: 1px solid transparent;
|
|
1411
|
-
outline-color: transparent;
|
|
1412
|
-
color: dt('datepicker.date.color');
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
.p-datepicker-day:not(.p-datepicker-day-selected):not(.p-disabled):hover {
|
|
1416
|
-
background: dt('datepicker.date.hover.background');
|
|
1417
|
-
color: dt('datepicker.date.hover.color');
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
.p-datepicker-day:focus-visible {
|
|
1421
|
-
box-shadow: dt('datepicker.date.focus.ring.shadow');
|
|
1422
|
-
outline: dt('datepicker.date.focus.ring.width') dt('datepicker.date.focus.ring.style') dt('datepicker.date.focus.ring.color');
|
|
1423
|
-
outline-offset: dt('datepicker.date.focus.ring.offset');
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
.p-datepicker-day-selected {
|
|
1427
|
-
background: dt('datepicker.date.selected.background');
|
|
1428
|
-
color: dt('datepicker.date.selected.color');
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
.p-datepicker-day-selected-range {
|
|
1432
|
-
background: dt('datepicker.date.range.selected.background');
|
|
1433
|
-
color: dt('datepicker.date.range.selected.color');
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
.p-datepicker-today > .p-datepicker-day {
|
|
1437
|
-
background: dt('datepicker.today.background');
|
|
1438
|
-
color: dt('datepicker.today.color');
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
.p-datepicker-today > .p-datepicker-day-selected {
|
|
1442
|
-
background: dt('datepicker.date.selected.background');
|
|
1443
|
-
color: dt('datepicker.date.selected.color');
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
.p-datepicker-today > .p-datepicker-day-selected-range {
|
|
1447
|
-
background: dt('datepicker.date.range.selected.background');
|
|
1448
|
-
color: dt('datepicker.date.range.selected.color');
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
.p-datepicker-weeknumber {
|
|
1452
|
-
text-align: center;
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
.p-datepicker-month-view {
|
|
1456
|
-
margin: dt('datepicker.month.view.margin');
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
.p-datepicker-month {
|
|
1460
|
-
width: 33.3%;
|
|
1461
|
-
display: inline-flex;
|
|
1462
|
-
align-items: center;
|
|
1463
|
-
justify-content: center;
|
|
1464
|
-
cursor: pointer;
|
|
1465
|
-
overflow: hidden;
|
|
1466
|
-
position: relative;
|
|
1467
|
-
padding: dt('datepicker.month.padding');
|
|
1468
|
-
transition:
|
|
1469
|
-
background dt('datepicker.transition.duration'),
|
|
1470
|
-
color dt('datepicker.transition.duration'),
|
|
1471
|
-
border-color dt('datepicker.transition.duration'),
|
|
1472
|
-
box-shadow dt('datepicker.transition.duration'),
|
|
1473
|
-
outline-color dt('datepicker.transition.duration');
|
|
1474
|
-
border-radius: dt('datepicker.month.border.radius');
|
|
1475
|
-
outline-color: transparent;
|
|
1476
|
-
color: dt('datepicker.date.color');
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
.p-datepicker-month:not(.p-disabled):not(.p-datepicker-month-selected):hover {
|
|
1480
|
-
color: dt('datepicker.date.hover.color');
|
|
1481
|
-
background: dt('datepicker.date.hover.background');
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
.p-datepicker-month-selected {
|
|
1485
|
-
color: dt('datepicker.date.selected.color');
|
|
1486
|
-
background: dt('datepicker.date.selected.background');
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
.p-datepicker-month:not(.p-disabled):focus-visible {
|
|
1490
|
-
box-shadow: dt('datepicker.date.focus.ring.shadow');
|
|
1491
|
-
outline: dt('datepicker.date.focus.ring.width') dt('datepicker.date.focus.ring.style') dt('datepicker.date.focus.ring.color');
|
|
1492
|
-
outline-offset: dt('datepicker.date.focus.ring.offset');
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
.p-datepicker-year-view {
|
|
1496
|
-
margin: dt('datepicker.year.view.margin');
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
.p-datepicker-year {
|
|
1500
|
-
width: 50%;
|
|
1501
|
-
display: inline-flex;
|
|
1502
|
-
align-items: center;
|
|
1503
|
-
justify-content: center;
|
|
1504
|
-
cursor: pointer;
|
|
1505
|
-
overflow: hidden;
|
|
1506
|
-
position: relative;
|
|
1507
|
-
padding: dt('datepicker.year.padding');
|
|
1508
|
-
transition:
|
|
1509
|
-
background dt('datepicker.transition.duration'),
|
|
1510
|
-
color dt('datepicker.transition.duration'),
|
|
1511
|
-
border-color dt('datepicker.transition.duration'),
|
|
1512
|
-
box-shadow dt('datepicker.transition.duration'),
|
|
1513
|
-
outline-color dt('datepicker.transition.duration');
|
|
1514
|
-
border-radius: dt('datepicker.year.border.radius');
|
|
1515
|
-
outline-color: transparent;
|
|
1516
|
-
color: dt('datepicker.date.color');
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
.p-datepicker-year:not(.p-disabled):not(.p-datepicker-year-selected):hover {
|
|
1520
|
-
color: dt('datepicker.date.hover.color');
|
|
1521
|
-
background: dt('datepicker.date.hover.background');
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
.p-datepicker-year-selected {
|
|
1525
|
-
color: dt('datepicker.date.selected.color');
|
|
1526
|
-
background: dt('datepicker.date.selected.background');
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
.p-datepicker-year:not(.p-disabled):focus-visible {
|
|
1530
|
-
box-shadow: dt('datepicker.date.focus.ring.shadow');
|
|
1531
|
-
outline: dt('datepicker.date.focus.ring.width') dt('datepicker.date.focus.ring.style') dt('datepicker.date.focus.ring.color');
|
|
1532
|
-
outline-offset: dt('datepicker.date.focus.ring.offset');
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
.p-datepicker-buttonbar {
|
|
1536
|
-
display: flex;
|
|
1537
|
-
justify-content: space-between;
|
|
1538
|
-
align-items: center;
|
|
1539
|
-
padding: dt('datepicker.buttonbar.padding');
|
|
1540
|
-
border-block-start: 1px solid dt('datepicker.buttonbar.border.color');
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
.p-datepicker-buttonbar .p-button {
|
|
1544
|
-
width: auto;
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
.p-datepicker-time-picker {
|
|
1548
|
-
display: flex;
|
|
1549
|
-
justify-content: center;
|
|
1550
|
-
align-items: center;
|
|
1551
|
-
border-block-start: 1px solid dt('datepicker.time.picker.border.color');
|
|
1552
|
-
padding: 0;
|
|
1553
|
-
gap: dt('datepicker.time.picker.gap');
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
.p-datepicker-calendar-container + .p-datepicker-time-picker {
|
|
1557
|
-
padding: dt('datepicker.time.picker.padding');
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
.p-datepicker-time-picker > div {
|
|
1561
|
-
display: flex;
|
|
1562
|
-
align-items: center;
|
|
1563
|
-
flex-direction: column;
|
|
1564
|
-
gap: dt('datepicker.time.picker.button.gap');
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
.p-datepicker-time-picker span {
|
|
1568
|
-
font-size: 1rem;
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
.p-datepicker-timeonly .p-datepicker-time-picker {
|
|
1572
|
-
border-block-start: 0 none;
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
.p-datepicker-time-picker:dir(rtl) {
|
|
1576
|
-
flex-direction: row-reverse;
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
.p-datepicker:has(.p-inputtext-sm) .p-datepicker-dropdown {
|
|
1580
|
-
width: dt('datepicker.dropdown.sm.width');
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
.p-datepicker:has(.p-inputtext-sm) .p-datepicker-dropdown .p-icon,
|
|
1584
|
-
.p-datepicker:has(.p-inputtext-sm) .p-datepicker-input-icon {
|
|
1585
|
-
font-size: dt('form.field.sm.font.size');
|
|
1586
|
-
width: dt('form.field.sm.font.size');
|
|
1587
|
-
height: dt('form.field.sm.font.size');
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
.p-datepicker:has(.p-inputtext-lg) .p-datepicker-dropdown {
|
|
1591
|
-
width: dt('datepicker.dropdown.lg.width');
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
.p-datepicker:has(.p-inputtext-lg) .p-datepicker-dropdown .p-icon,
|
|
1595
|
-
.p-datepicker:has(.p-inputtext-lg) .p-datepicker-input-icon {
|
|
1596
|
-
font-size: dt('form.field.lg.font.size');
|
|
1597
|
-
width: dt('form.field.lg.font.size');
|
|
1598
|
-
height: dt('form.field.lg.font.size');
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
.p-datepicker-clear-icon {
|
|
1602
|
-
position: absolute;
|
|
1603
|
-
top: 50%;
|
|
1604
|
-
margin-top: -0.5rem;
|
|
1605
|
-
cursor: pointer;
|
|
1606
|
-
color: dt('form.field.icon.color');
|
|
1607
|
-
inset-inline-end: dt('form.field.padding.x');
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
.p-datepicker:has(.p-datepicker-dropdown) .p-datepicker-clear-icon {
|
|
1611
|
-
inset-inline-end: calc(dt('datepicker.dropdown.width') + dt('form.field.padding.x'));
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
|
-
.p-datepicker:has(.p-datepicker-input-icon-container) .p-datepicker-clear-icon {
|
|
1615
|
-
inset-inline-end: calc((dt('form.field.padding.x') * 2) + dt('icon.size'));
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
.p-datepicker:has(.p-datepicker-clear-icon) .p-datepicker-input {
|
|
1619
|
-
padding-inline-end: calc((dt('form.field.padding.x') * 2) + dt('icon.size'));
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
.p-datepicker:has(.p-datepicker-input-icon-container):has(.p-datepicker-clear-icon) .p-datepicker-input {
|
|
1623
|
-
padding-inline-end: calc((dt('form.field.padding.x') * 3) + calc(dt('icon.size') * 2));
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
.p-inputgroup .p-datepicker-dropdown {
|
|
1627
|
-
border-radius: 0;
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
.p-inputgroup > .p-datepicker:last-child:has(.p-datepicker-dropdown) > .p-datepicker-input {
|
|
1631
|
-
border-start-end-radius: 0;
|
|
1632
|
-
border-end-end-radius: 0;
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
.p-inputgroup > .p-datepicker:last-child .p-datepicker-dropdown {
|
|
1636
|
-
border-start-end-radius: dt('datepicker.dropdown.border.radius');
|
|
1637
|
-
border-end-end-radius: dt('datepicker.dropdown.border.radius');
|
|
1638
|
-
}
|
|
1639
|
-
`,classes:{root:function(e){var t=e.instance,n=e.state;return[`p-datepicker p-component p-inputwrapper`,{"p-invalid":t.$invalid,"p-inputwrapper-filled":t.$filled,"p-inputwrapper-focus":n.focused||n.overlayVisible,"p-focus":n.focused||n.overlayVisible,"p-datepicker-fluid":t.$fluid}]},pcInputText:`p-datepicker-input`,clearIcon:`p-datepicker-clear-icon`,dropdown:`p-datepicker-dropdown`,inputIconContainer:`p-datepicker-input-icon-container`,inputIcon:`p-datepicker-input-icon`,panel:function(e){var t=e.props;return[`p-datepicker-panel p-component`,{"p-datepicker-panel-inline":t.inline,"p-disabled":t.disabled,"p-datepicker-timeonly":t.timeOnly}]},calendarContainer:`p-datepicker-calendar-container`,calendar:`p-datepicker-calendar`,header:`p-datepicker-header`,pcPrevButton:`p-datepicker-prev-button`,title:`p-datepicker-title`,selectMonth:`p-datepicker-select-month`,selectYear:`p-datepicker-select-year`,decade:`p-datepicker-decade`,pcNextButton:`p-datepicker-next-button`,dayView:`p-datepicker-day-view`,weekHeader:`p-datepicker-weekheader p-disabled`,weekNumber:`p-datepicker-weeknumber`,weekLabelContainer:`p-datepicker-weeklabel-container p-disabled`,weekDayCell:`p-datepicker-weekday-cell`,weekDay:`p-datepicker-weekday`,dayCell:function(e){var t=e.date;return[`p-datepicker-day-cell`,{"p-datepicker-other-month":t.otherMonth,"p-datepicker-today":t.today}]},day:function(e){var t=e.instance,n=e.props,r=e.state,i=e.date,a=``;if(t.isRangeSelection()&&t.isSelected(i)&&i.selectable){var o=typeof r.rawValue[0]==`string`?t.parseValue(r.rawValue[0])[0]:r.rawValue[0],s=typeof r.rawValue[1]==`string`?t.parseValue(r.rawValue[1])[0]:r.rawValue[1];a=t.isDateEquals(o,i)||t.isDateEquals(s,i)?`p-datepicker-day-selected`:`p-datepicker-day-selected-range`}return[`p-datepicker-day`,{"p-datepicker-day-selected":!t.isRangeSelection()&&t.isSelected(i)&&i.selectable,"p-disabled":n.disabled||!i.selectable},a]},monthView:`p-datepicker-month-view`,month:function(e){var t=e.instance,n=e.props,r=e.month,i=e.index;return[`p-datepicker-month`,{"p-datepicker-month-selected":t.isMonthSelected(i),"p-disabled":n.disabled||!r.selectable}]},yearView:`p-datepicker-year-view`,year:function(e){var t=e.instance,n=e.props,r=e.year;return[`p-datepicker-year`,{"p-datepicker-year-selected":t.isYearSelected(r.value),"p-disabled":n.disabled||!r.selectable}]},timePicker:`p-datepicker-time-picker`,hourPicker:`p-datepicker-hour-picker`,pcIncrementButton:`p-datepicker-increment-button`,pcDecrementButton:`p-datepicker-decrement-button`,separator:`p-datepicker-separator`,minutePicker:`p-datepicker-minute-picker`,secondPicker:`p-datepicker-second-picker`,ampmPicker:`p-datepicker-ampm-picker`,buttonbar:`p-datepicker-buttonbar`,pcTodayButton:`p-datepicker-today-button`,pcClearButton:`p-datepicker-clear-button`},inlineStyles:{root:function(e){var t=e.props;return{position:t.appendTo===`self`||t.showClear?`relative`:void 0}}}}),rS={name:`BaseDatePicker`,extends:Kx,props:{selectionMode:{type:String,default:`single`},dateFormat:{type:String,default:null},updateModelType:{type:String,default:`date`},inline:{type:Boolean,default:!1},showOtherMonths:{type:Boolean,default:!0},selectOtherMonths:{type:Boolean,default:!1},showIcon:{type:Boolean,default:!1},iconDisplay:{type:String,default:`button`},icon:{type:String,default:void 0},prevIcon:{type:String,default:void 0},nextIcon:{type:String,default:void 0},incrementIcon:{type:String,default:void 0},decrementIcon:{type:String,default:void 0},numberOfMonths:{type:Number,default:1},responsiveOptions:Array,breakpoint:{type:String,default:`769px`},view:{type:String,default:`date`},minDate:{type:Date,value:null},maxDate:{type:Date,value:null},disabledDates:{type:Array,value:null},disabledDays:{type:Array,value:null},maxDateCount:{type:Number,value:null},showOnFocus:{type:Boolean,default:!0},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},showButtonBar:{type:Boolean,default:!1},shortYearCutoff:{type:String,default:`+10`},showTime:{type:Boolean,default:!1},timeOnly:{type:Boolean,default:!1},hourFormat:{type:String,default:`24`},stepHour:{type:Number,default:1},stepMinute:{type:Number,default:1},stepSecond:{type:Number,default:1},showSeconds:{type:Boolean,default:!1},hideOnDateTimeSelect:{type:Boolean,default:!1},hideOnRangeSelection:{type:Boolean,default:!1},timeSeparator:{type:String,default:`:`},showWeek:{type:Boolean,default:!1},manualInput:{type:Boolean,default:!0},showClear:{type:Boolean,default:!1},appendTo:{type:[String,Object],default:`body`},readonly:{type:Boolean,default:!1},placeholder:{type:String,default:null},required:{type:Boolean,default:null},inputId:{type:String,default:null},inputClass:{type:[String,Object],default:null},inputStyle:{type:Object,default:null},panelClass:{type:[String,Object],default:null},panelStyle:{type:Object,default:null},todayButtonProps:{type:Object,default:function(){return{severity:`secondary`,text:!0,size:`small`}}},clearButtonProps:{type:Object,default:function(){return{severity:`secondary`,text:!0,size:`small`}}},navigatorButtonProps:{type:Object,default:function(){return{severity:`secondary`,text:!0,rounded:!0}}},timepickerButtonProps:{type:Object,default:function(){return{severity:`secondary`,text:!0,rounded:!0}}},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:nS,provide:function(){return{$pcDatePicker:this,$parentInstance:this}}};function iS(e,t,n){return(t=aS(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aS(e){var t=oS(e,`string`);return sS(t)==`symbol`?t:t+``}function oS(e,t){if(sS(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sS(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function sS(e){"@babel/helpers - typeof";return sS=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},sS(e)}function cS(e){return dS(e)||uS(e)||pS(e)||lS()}function lS(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1640
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uS(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function dS(e){if(Array.isArray(e))return mS(e)}function fS(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=pS(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1641
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function pS(e,t){if(e){if(typeof e==`string`)return mS(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mS(e,t):void 0}}function mS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var hS={name:`DatePicker`,extends:rS,inheritAttrs:!1,emits:[`show`,`hide`,`input`,`month-change`,`year-change`,`date-select`,`today-click`,`clear-click`,`focus`,`blur`,`keydown`],inject:{$pcFluid:{default:null}},navigationState:null,timePickerChange:!1,scrollHandler:null,outsideClickListener:null,resizeListener:null,matchMediaListener:null,matchMediaOrientationListener:null,overlay:null,input:null,previousButton:null,nextButton:null,timePickerTimer:null,preventFocus:!1,typeUpdate:!1,data:function(){return{currentMonth:null,currentYear:null,currentHour:null,currentMinute:null,currentSecond:null,pm:null,focused:!1,overlayVisible:!1,currentView:this.view,query:null,queryMatches:!1,queryOrientation:null,focusedDateIndex:0,rawValue:null}},watch:{modelValue:{immediate:!0,handler:function(e){var t;this.rawValue=typeof e==`string`?this.safeParse(e):e,this.updateCurrentMetaData(),!this.typeUpdate&&!this.inline&&this.input&&(this.input.value=this.formatValue(this.rawValue)),this.typeUpdate=!1,(t=this.$refs.clearIcon)!=null&&(t=t.$el)!=null&&t.style&&(this.$refs.clearIcon.$el.style.display=Hf(e)?`none`:`block`)}},showTime:function(){this.updateCurrentMetaData()},minDate:function(){this.updateCurrentMetaData()},maxDate:function(){this.updateCurrentMetaData()},months:function(){this.overlay&&(this.focused||(this.inline&&(this.preventFocus=!0),setTimeout(this.updateFocus,0)))},numberOfMonths:function(){this.destroyResponsiveStyleElement(),this.createResponsiveStyle()},responsiveOptions:function(){this.destroyResponsiveStyleElement(),this.createResponsiveStyle()},currentView:function(){var e=this;Promise.resolve(null).then(function(){return e.alignOverlay()})},view:function(e){this.currentView=e}},created:function(){this.updateCurrentMetaData()},mounted:function(){if(this.createResponsiveStyle(),this.bindMatchMediaListener(),this.bindMatchMediaOrientationListener(),this.inline)this.disabled||(this.preventFocus=!0,this.initFocusableCell());else{var e;this.input.value=this.inputFieldValue,(e=this.$refs.clearIcon)!=null&&(e=e.$el)!=null&&e.style&&(this.$refs.clearIcon.$el.style.display=this.$filled?`block`:`none`)}},updated:function(){this.overlay&&(this.preventFocus=!0,setTimeout(this.updateFocus,0)),this.input&&this.selectionStart!=null&&this.selectionEnd!=null&&(this.input.selectionStart=this.selectionStart,this.input.selectionEnd=this.selectionEnd,this.selectionStart=null,this.selectionEnd=null)},beforeUnmount:function(){this.timePickerTimer&&clearTimeout(this.timePickerTimer),this.destroyResponsiveStyleElement(),this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindMatchMediaListener(),this.unbindMatchMediaOrientationListener(),this.scrollHandler&&=(this.scrollHandler.destroy(),null),this.overlay&&this.autoZIndex&&Sp.clear(this.overlay),this.overlay=null},methods:{isSelected:function(e){if(this.rawValue){if(this.isSingleSelection())return this.isDateEquals(this.parseValueForComparison(this.rawValue),e);if(this.isMultipleSelection()){var t=!1,n=fS(this.rawValue),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;if(t=this.isDateEquals(this.parseValueForComparison(i),e),t)break}}catch(e){n.e(e)}finally{n.f()}return t}else if(this.isRangeSelection()){var a=this.parseValueForComparison(this.rawValue[0]);if(this.rawValue[1]){var o=this.parseValueForComparison(this.rawValue[1]);return this.isDateEquals(a,e)||this.isDateEquals(o,e)||this.isDateBetween(a,o,e)}else return this.isDateEquals(a,e)}}return!1},isMonthSelected:function(e){var t=this;if(this.isMultipleSelection())return this.rawValue?.some(function(n){var r=t.parseValueForComparison(n);return r.getMonth()===e&&r.getFullYear()===t.currentYear});if(this.isRangeSelection()){var n,r,i=(n=this.rawValue)!=null&&n[0]?this.parseValueForComparison(this.rawValue[0]):null,a=(r=this.rawValue)!=null&&r[1]?this.parseValueForComparison(this.rawValue[1]):null;if(a){var o=new Date(this.currentYear,e,1),s=new Date(i.getFullYear(),i.getMonth(),1),c=new Date(a.getFullYear(),a.getMonth(),1);return o>=s&&o<=c}else return i?.getFullYear()===this.currentYear&&i?.getMonth()===e}else return this.rawValue?.getMonth()===e&&this.rawValue?.getFullYear()===this.currentYear},isYearSelected:function(e){var t=this;if(this.isMultipleSelection())return this.rawValue?.some(function(n){return t.parseValueForComparison(n).getFullYear()===e});if(this.isRangeSelection()){var n,r,i=(n=this.rawValue)!=null&&n[0]?this.parseValueForComparison(this.rawValue[0]):null,a=(r=this.rawValue)!=null&&r[1]?this.parseValueForComparison(this.rawValue[1]):null,o=i?i.getFullYear():null,s=a?a.getFullYear():null;return o===e||s===e||o<e&&s>e}else return this.rawValue?.getFullYear()===e},isDateEquals:function(e,t){return e?e.getDate()===t.day&&e.getMonth()===t.month&&e.getFullYear()===t.year:!1},isDateBetween:function(e,t,n){var r=!1,i=this.parseValueForComparison(e),a=this.parseValueForComparison(t);if(i&&a){var o=new Date(n.year,n.month,n.day);return i.getTime()<=o.getTime()&&a.getTime()>=o.getTime()}return r},getFirstDayOfMonthIndex:function(e,t){var n=new Date;n.setDate(1),n.setMonth(e),n.setFullYear(t);var r=n.getDay()+this.sundayIndex;return r>=7?r-7:r},getDaysCountInMonth:function(e,t){return 32-this.daylightSavingAdjust(new Date(t,e,32)).getDate()},getDaysCountInPrevMonth:function(e,t){var n=this.getPreviousMonthAndYear(e,t);return this.getDaysCountInMonth(n.month,n.year)},getPreviousMonthAndYear:function(e,t){var n,r;return e===0?(n=11,r=t-1):(n=e-1,r=t),{month:n,year:r}},getNextMonthAndYear:function(e,t){var n,r;return e===11?(n=0,r=t+1):(n=e+1,r=t),{month:n,year:r}},daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},isToday:function(e,t,n,r){return e.getDate()===t&&e.getMonth()===n&&e.getFullYear()===r},isSelectable:function(e,t,n,r){var i=!0,a=!0,o=!0,s=!0;return r&&!this.selectOtherMonths?!1:(this.minDate&&(this.minDate.getFullYear()>n||this.minDate.getFullYear()===n&&(this.minDate.getMonth()>t||this.minDate.getMonth()===t&&this.minDate.getDate()>e))&&(i=!1),this.maxDate&&(this.maxDate.getFullYear()<n||this.maxDate.getFullYear()===n&&(this.maxDate.getMonth()<t||this.maxDate.getMonth()===t&&this.maxDate.getDate()<e))&&(a=!1),this.disabledDates&&(o=!this.isDateDisabled(e,t,n)),this.disabledDays&&(s=!this.isDayDisabled(e,t,n)),i&&a&&o&&s)},onOverlayEnter:function(e){Xd(e,this.inline?void 0:{position:`absolute`,top:`0`}),this.autoZIndex&&Sp.set(`overlay`,e,this.baseZIndex||this.$primevue.config.zIndex.overlay),this.$attrSelector&&e.setAttribute(this.$attrSelector,``),this.alignOverlay(),this.$emit(`show`)},onOverlayEnterComplete:function(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener()},onOverlayAfterLeave:function(e){this.autoZIndex&&Sp.clear(e)},onOverlayLeave:function(){this.currentView=this.view,this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit(`hide`),this.overlay=null},onPrevButtonClick:function(e){this.navigationState={backward:!0,button:!0},this.navBackward(e)},onNextButtonClick:function(e){this.navigationState={backward:!1,button:!0},this.navForward(e)},navBackward:function(e){e.preventDefault(),this.isEnabled()&&(this.currentView===`month`?(this.decrementYear(),this.$emit(`year-change`,{month:this.currentMonth,year:this.currentYear})):this.currentView===`year`?this.decrementDecade():e.shiftKey?this.decrementYear():(this.currentMonth===0?(this.currentMonth=11,this.decrementYear()):this.currentMonth--,this.$emit(`month-change`,{month:this.currentMonth+1,year:this.currentYear})))},navForward:function(e){e.preventDefault(),this.isEnabled()&&(this.currentView===`month`?(this.incrementYear(),this.$emit(`year-change`,{month:this.currentMonth,year:this.currentYear})):this.currentView===`year`?this.incrementDecade():e.shiftKey?this.incrementYear():(this.currentMonth===11?(this.currentMonth=0,this.incrementYear()):this.currentMonth++,this.$emit(`month-change`,{month:this.currentMonth+1,year:this.currentYear})))},decrementYear:function(){this.currentYear--},decrementDecade:function(){this.currentYear-=10},incrementYear:function(){this.currentYear++},incrementDecade:function(){this.currentYear+=10},switchToMonthView:function(e){this.currentView=`month`,setTimeout(this.updateFocus,0),e.preventDefault()},switchToYearView:function(e){this.currentView=`year`,setTimeout(this.updateFocus,0),e.preventDefault()},isEnabled:function(){return!this.disabled&&!this.readonly},updateCurrentTimeMeta:function(e){var t=e.getHours();this.hourFormat===`12`&&(this.pm=t>11,t>=12&&(t=t==12?12:t-12)),this.currentHour=Math.floor(t/this.stepHour)*this.stepHour,this.currentMinute=Math.floor(e.getMinutes()/this.stepMinute)*this.stepMinute,this.currentSecond=Math.floor(e.getSeconds()/this.stepSecond)*this.stepSecond},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.overlayVisible&&e.isOutsideClicked(t)&&(e.overlayVisible=!1)},document.addEventListener(`mousedown`,this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&=(document.removeEventListener(`mousedown`,this.outsideClickListener),null)},bindScrollListener:function(){var e=this;this.scrollHandler||=new Sg(this.$refs.container,function(){e.overlayVisible&&=!1}),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.overlayVisible&&!Nf()&&(e.overlayVisible=!1)},window.addEventListener(`resize`,this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&=(window.removeEventListener(`resize`,this.resizeListener),null)},bindMatchMediaListener:function(){var e=this;if(!this.matchMediaListener){var t=matchMedia(`(max-width: ${this.breakpoint})`);this.query=t,this.queryMatches=t.matches,this.matchMediaListener=function(){e.queryMatches=t.matches,e.mobileActive=!1},this.query.addEventListener(`change`,this.matchMediaListener)}},unbindMatchMediaListener:function(){this.matchMediaListener&&=(this.query.removeEventListener(`change`,this.matchMediaListener),null)},bindMatchMediaOrientationListener:function(){var e=this;if(!this.matchMediaOrientationListener){var t=matchMedia(`(orientation: portrait)`);this.queryOrientation=t,this.matchMediaOrientationListener=function(){e.alignOverlay()},this.queryOrientation.addEventListener(`change`,this.matchMediaOrientationListener)}},unbindMatchMediaOrientationListener:function(){this.matchMediaOrientationListener&&=(this.queryOrientation.removeEventListener(`change`,this.matchMediaOrientationListener),this.queryOrientation=null,null)},isOutsideClicked:function(e){var t=e.composedPath();return!(this.$el.isSameNode(e.target)||this.isNavIconClicked(e)||t.includes(this.$el)||t.includes(this.overlay))},isNavIconClicked:function(e){return this.previousButton&&(this.previousButton.isSameNode(e.target)||this.previousButton.contains(e.target))||this.nextButton&&(this.nextButton.isSameNode(e.target)||this.nextButton.contains(e.target))},alignOverlay:function(){this.overlay&&(this.appendTo===`self`||this.inline?Qd(this.overlay,this.$el):(this.view===`date`?(this.overlay.style.width=Zd(this.overlay)+`px`,this.overlay.style.minWidth=Zd(this.$el)+`px`):this.overlay.style.width=Zd(this.$el)+`px`,Yd(this.overlay,this.$el)))},onButtonClick:function(){this.isEnabled()&&(this.overlayVisible?this.overlayVisible=!1:(this.input.focus(),this.overlayVisible=!0))},isDateDisabled:function(e,t,n){if(this.disabledDates){var r=fS(this.disabledDates),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;if(a.getFullYear()===n&&a.getMonth()===t&&a.getDate()===e)return!0}}catch(e){r.e(e)}finally{r.f()}}return!1},isDayDisabled:function(e,t,n){if(this.disabledDays){var r=new Date(n,t,e).getDay();return this.disabledDays.indexOf(r)!==-1}return!1},onMonthDropdownChange:function(e){this.currentMonth=parseInt(e),this.$emit(`month-change`,{month:this.currentMonth+1,year:this.currentYear})},onYearDropdownChange:function(e){this.currentYear=parseInt(e),this.$emit(`year-change`,{month:this.currentMonth,year:this.currentYear})},onDateSelect:function(e,t){var n=this;if(!(this.disabled||!t.selectable)){if(sf(this.overlay,`table td span:not([data-p-disabled="true"])`).forEach(function(e){return e.tabIndex=-1}),e&&e.currentTarget.focus(),this.isMultipleSelection()&&this.isSelected(t)){var r=this.rawValue.filter(function(e){return!n.isDateEquals(n.parseValueForComparison(e),t)});this.updateModel(r)}else this.shouldSelectDate(t)&&(t.otherMonth?(this.currentMonth=t.month,this.currentYear=t.year,this.selectDate(t)):this.selectDate(t));this.isSingleSelection()&&(!this.showTime||this.hideOnDateTimeSelect)&&(this.input&&this.input.focus(),setTimeout(function(){n.overlayVisible=!1},150))}},selectDate:function(e){var t=this,n=new Date(e.year,e.month,e.day);this.showTime&&(this.hourFormat===`12`&&this.currentHour!==12&&this.pm?n.setHours(this.currentHour+12):n.setHours(this.currentHour),n.setMinutes(this.currentMinute),n.setSeconds(this.showSeconds?this.currentSecond:0)),this.minDate&&this.minDate>n&&(n=this.minDate,this.currentHour=n.getHours(),this.currentMinute=n.getMinutes(),this.currentSecond=n.getSeconds()),this.maxDate&&this.maxDate<n&&(n=this.maxDate,this.currentHour=n.getHours(),this.currentMinute=n.getMinutes(),this.currentSecond=n.getSeconds());var r=null;if(this.isSingleSelection())r=n;else if(this.isMultipleSelection())r=this.rawValue?[].concat(cS(this.rawValue),[n]):[n];else if(this.isRangeSelection())if(this.rawValue&&this.rawValue.length){var i=this.parseValueForComparison(this.rawValue[0]),a=this.rawValue[1];!a&&n.getTime()>=i.getTime()?(a=n,this.focusedDateIndex=1):(i=n,a=null,this.focusedDateIndex=0),r=[i,a]}else r=[n,null],this.focusedDateIndex=0;r!==null&&this.updateModel(r),this.isRangeSelection()&&this.hideOnRangeSelection&&r[1]!==null&&setTimeout(function(){t.overlayVisible=!1},150),this.$emit(`date-select`,n)},updateModel:function(e){var t=this;if(this.rawValue=e,this.updateModelType===`date`)if(this.isSingleSelection())this.writeValue(e);else{var n=null;Array.isArray(e)&&(n=e.map(function(e){return t.parseValueForComparison(e)})),this.writeValue(n)}else if(this.updateModelType==`string`){if(this.isSingleSelection())this.writeValue(this.formatDateTime(e));else if(this.isMultipleSelection()){var r=null;Array.isArray(e)&&(r=e.map(function(e){return t.formatDateTime(e)})),this.writeValue(r)}else if(this.isRangeSelection()){var i=null;Array.isArray(e)&&(i=e.map(function(e){return e==null?null:typeof e==`string`?e:t.formatDateTime(e)})),this.writeValue(i)}}},shouldSelectDate:function(){return this.isMultipleSelection()?this.maxDateCount==null?!0:this.maxDateCount>(this.rawValue?this.rawValue.length:0):!0},isSingleSelection:function(){return this.selectionMode===`single`},isRangeSelection:function(){return this.selectionMode===`range`},isMultipleSelection:function(){return this.selectionMode===`multiple`},formatValue:function(e){if(typeof e==`string`)return this.dateFormat?isNaN(new Date(e))?e:this.formatDate(new Date(e),this.dateFormat):e;var t=``;if(e)try{if(this.isSingleSelection())t=this.formatDateTime(e);else if(this.isMultipleSelection())for(var n=0;n<e.length;n++){var r=typeof e[n]==`string`?this.formatDateTime(this.parseValueForComparison(e[n])):this.formatDateTime(e[n]);t+=r,n!==e.length-1&&(t+=`, `)}else if(this.isRangeSelection()&&e&&e.length){var i=this.parseValueForComparison(e[0]),a=this.parseValueForComparison(e[1]);t=this.formatDateTime(i),a&&(t+=` - `+this.formatDateTime(a))}}catch{t=e}return t},formatDateTime:function(e){var t=null;return sp(e)&&qf(e)?this.timeOnly?t=this.formatTime(e):(t=this.formatDate(e,this.datePattern),this.showTime&&(t+=` `+this.formatTime(e))):this.updateModelType===`string`&&(t=e),t},formatDate:function(e,t){if(!e)return``;var n,r=function(e){var r=n+1<t.length&&t.charAt(n+1)===e;return r&&n++,r},i=function(e,t,n){var i=``+t;if(r(e))for(;i.length<n;)i=`0`+i;return i},a=function(e,t,n,i){return r(e)?i[t]:n[t]},o=``,s=!1;if(e)for(n=0;n<t.length;n++)if(s)t.charAt(n)===`'`&&!r(`'`)?s=!1:o+=t.charAt(n);else switch(t.charAt(n)){case`d`:o+=i(`d`,e.getDate(),2);break;case`D`:o+=a(`D`,e.getDay(),this.$primevue.config.locale.dayNamesShort,this.$primevue.config.locale.dayNames);break;case`o`:o+=i(`o`,Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case`m`:o+=i(`m`,e.getMonth()+1,2);break;case`M`:o+=a(`M`,e.getMonth(),this.$primevue.config.locale.monthNamesShort,this.$primevue.config.locale.monthNames);break;case`y`:o+=r(`y`)?e.getFullYear():(e.getFullYear()%100<10?`0`:``)+e.getFullYear()%100;break;case`@`:o+=e.getTime();break;case`!`:o+=e.getTime()*1e4+this.ticksTo1970;break;case`'`:r(`'`)?o+=`'`:s=!0;break;default:o+=t.charAt(n)}return o},formatTime:function(e){if(!e)return``;var t=``,n=e.getHours(),r=e.getMinutes(),i=e.getSeconds();return this.hourFormat===`12`&&n>11&&n!==12&&(n-=12),this.hourFormat===`12`?t+=n===0?12:n<10?`0`+n:n:t+=n<10?`0`+n:n,t+=`:`,t+=r<10?`0`+r:r,this.showSeconds&&(t+=`:`,t+=i<10?`0`+i:i),this.hourFormat===`12`&&(t+=e.getHours()>11?` ${this.$primevue.config.locale.pm}`:` ${this.$primevue.config.locale.am}`),t},onTodayButtonClick:function(e){var t=new Date,n={day:t.getDate(),month:t.getMonth(),year:t.getFullYear(),otherMonth:t.getMonth()!==this.currentMonth||t.getFullYear()!==this.currentYear,today:!0,selectable:!0};this.onDateSelect(null,n),this.$emit(`today-click`,t),e.preventDefault()},onClearButtonClick:function(e){this.updateModel(null),this.overlayVisible=!1,this.$emit(`clear-click`,e),e.preventDefault()},onTimePickerElementMouseDown:function(e,t,n){this.isEnabled()&&(this.repeat(e,null,t,n),e.preventDefault())},onTimePickerElementMouseUp:function(e){this.isEnabled()&&(this.clearTimePickerTimer(),this.updateModelTime(),e.preventDefault())},onTimePickerElementMouseLeave:function(){this.clearTimePickerTimer()},onTimePickerElementKeyDown:function(e,t,n){switch(e.code){case`Enter`:case`NumpadEnter`:case`Space`:this.isEnabled()&&(this.repeat(e,null,t,n),e.preventDefault());break}},onTimePickerElementKeyUp:function(e){switch(e.code){case`Enter`:case`NumpadEnter`:case`Space`:this.isEnabled()&&(this.clearTimePickerTimer(),this.updateModelTime(),e.preventDefault());break}},repeat:function(e,t,n,r){var i=this,a=t||500;switch(this.clearTimePickerTimer(),this.timePickerTimer=setTimeout(function(){i.repeat(e,100,n,r)},a),n){case 0:r===1?this.incrementHour(e):this.decrementHour(e);break;case 1:r===1?this.incrementMinute(e):this.decrementMinute(e);break;case 2:r===1?this.incrementSecond(e):this.decrementSecond(e);break}},convertTo24Hour:function(e,t){return this.hourFormat==`12`?e===12?t?12:0:t?e+12:e:e},validateTime:function(e,t,n,r){var i=this.viewDate,a=this.convertTo24Hour(e,r);this.isRangeSelection()&&(i=this.rawValue?this.rawValue[1]||this.rawValue[0]:i),this.isMultipleSelection()&&(i=this.rawValue?this.rawValue[this.rawValue.length-1]:i);var o=i?i.toDateString():null;return!(this.minDate&&o&&this.minDate.toDateString()===o&&(this.minDate.getHours()>a||this.minDate.getHours()===a&&(this.minDate.getMinutes()>t||this.minDate.getMinutes()===t&&this.minDate.getSeconds()>n))||this.maxDate&&o&&this.maxDate.toDateString()===o&&(this.maxDate.getHours()<a||this.maxDate.getHours()===a&&(this.maxDate.getMinutes()<t||this.maxDate.getMinutes()===t&&this.maxDate.getSeconds()<n)))},incrementHour:function(e){var t=this.currentHour,n=this.currentHour+Number(this.stepHour),r=this.pm;this.hourFormat==`24`?n=n>=24?n-24:n:this.hourFormat==`12`&&(t<12&&n>11&&(r=!this.pm),n=n>=13?n-12:n),this.validateTime(n,this.currentMinute,this.currentSecond,r)&&(this.currentHour=n,this.pm=r),e.preventDefault()},decrementHour:function(e){var t=this.currentHour-this.stepHour,n=this.pm;this.hourFormat==`24`?t=t<0?24+t:t:this.hourFormat==`12`&&(this.currentHour===12&&(n=!this.pm),t=t<=0?12+t:t),this.validateTime(t,this.currentMinute,this.currentSecond,n)&&(this.currentHour=t,this.pm=n),e.preventDefault()},incrementMinute:function(e){var t=this.currentMinute+Number(this.stepMinute);this.validateTime(this.currentHour,t,this.currentSecond,this.pm)&&(this.currentMinute=t>59?t-60:t),e.preventDefault()},decrementMinute:function(e){var t=this.currentMinute-this.stepMinute;t=t<0?60+t:t,this.validateTime(this.currentHour,t,this.currentSecond,this.pm)&&(this.currentMinute=t),e.preventDefault()},incrementSecond:function(e){var t=this.currentSecond+Number(this.stepSecond);this.validateTime(this.currentHour,this.currentMinute,t,this.pm)&&(this.currentSecond=t>59?t-60:t),e.preventDefault()},decrementSecond:function(e){var t=this.currentSecond-this.stepSecond;t=t<0?60+t:t,this.validateTime(this.currentHour,this.currentMinute,t,this.pm)&&(this.currentSecond=t),e.preventDefault()},updateModelTime:function(){var e=this;this.timePickerChange=!0;var t=this.viewDate;this.isRangeSelection()&&(t=this.rawValue?this.rawValue[this.focusedDateIndex]||this.rawValue[0]:t),this.isMultipleSelection()&&(t=this.rawValue?this.rawValue[this.rawValue.length-1]:t),t=t?new Date(t.getTime()):new Date,this.hourFormat==`12`?this.currentHour===12?t.setHours(this.pm?12:0):t.setHours(this.pm?this.currentHour+12:this.currentHour):t.setHours(this.currentHour),t.setMinutes(this.currentMinute),t.setSeconds(this.currentSecond),this.isRangeSelection()&&(t=this.rawValue&&this.focusedDateIndex===1&&this.rawValue[1]?[this.rawValue[0],t]:this.rawValue&&this.focusedDateIndex===0?[t,this.rawValue[1]]:[t,null]),this.isMultipleSelection()&&(t=this.rawValue?[].concat(cS(this.rawValue.slice(0,-1)),[t]):[t]),this.updateModel(t),this.$emit(`date-select`,t),setTimeout(function(){return e.timePickerChange=!1},0)},toggleAMPM:function(e){!this.validateTime(this.currentHour,this.currentMinute,this.currentSecond,!this.pm)&&(this.maxDate||this.minDate)||(this.pm=!this.pm,this.updateModelTime(),e.preventDefault())},clearTimePickerTimer:function(){this.timePickerTimer&&clearInterval(this.timePickerTimer)},onMonthSelect:function(e,t){t.month;var n=t.index;this.view===`month`?this.onDateSelect(e,{year:this.currentYear,month:n,day:1,selectable:!0}):(this.currentMonth=n,this.currentView=`date`,this.$emit(`month-change`,{month:this.currentMonth+1,year:this.currentYear})),setTimeout(this.updateFocus,0)},onYearSelect:function(e,t){this.view===`year`?this.onDateSelect(e,{year:t.value,month:0,day:1,selectable:!0}):(this.currentYear=t.value,this.currentView=`month`,this.$emit(`year-change`,{month:this.currentMonth,year:this.currentYear})),setTimeout(this.updateFocus,0)},updateCurrentMetaData:function(){var e=this.viewDate;if(this.currentMonth=e.getMonth(),this.currentYear=e.getFullYear(),this.showTime||this.timeOnly){var t=e;this.isRangeSelection()&&this.rawValue&&this.rawValue[this.focusedDateIndex]&&(t=this.rawValue[this.focusedDateIndex]),this.updateCurrentTimeMeta(t)}},isValidSelection:function(e){var t=this;if(e==null)return!0;var n=!0;return this.isSingleSelection()?this.isSelectable(e.getDate(),e.getMonth(),e.getFullYear(),!1)||(n=!1):e.every(function(e){return t.isSelectable(e.getDate(),e.getMonth(),e.getFullYear(),!1)})&&this.isRangeSelection()&&(n=e.length>1&&e[1]>=e[0]),n},parseValue:function(e){if(!e||e.trim().length===0)return null;var t;if(this.isSingleSelection())t=this.parseDateTime(e);else if(this.isMultipleSelection()){var n=e.split(`,`);t=[];var r=fS(n),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;t.push(this.parseDateTime(a.trim()))}}catch(e){r.e(e)}finally{r.f()}}else if(this.isRangeSelection()){var o=e.split(` - `);t=[];for(var s=0;s<o.length;s++)t[s]=this.parseDateTime(o[s].trim())}return t},safeParse:function(e){try{return this.parseValue(e)}catch{var t=new Date(e);return isNaN(t.getTime())?null:this.isSingleSelection()?t:[t]}},parseValueForComparison:function(e){if(typeof e==`string`){var t=this.parseValue(e);return this.isSingleSelection()?t:t[0]}return e},parseDateTime:function(e){var t,n=`${this.$primevue.config.locale.am}|${this.$primevue.config.locale.pm}|am|pm`,r=e.match(RegExp(`(?:(.+?) )?(\\d{2}:\\d{2}(?::\\d{2})?)(?:\\s+(${n}))?`,`i`));if(this.timeOnly)t=new Date,this.populateTime(t,r[2],r[3]);else{var i=this.datePattern;this.showTime?(t=this.parseDate(r[1],i),this.populateTime(t,r[2],r[3])):t=this.parseDate(e,i)}return t},populateTime:function(e,t,n){if(this.hourFormat==`12`&&!n)throw`Invalid Time`;this.pm=n.toLowerCase()===this.$primevue.config.locale.pm.toLowerCase()||n.toLowerCase()===`pm`;var r=this.parseTime(t);e.setHours(r.hour),e.setMinutes(r.minute),e.setSeconds(r.second)},parseTime:function(e){var t=e.split(`:`),n=this.showSeconds?3:2,r=/^[0-9][0-9]$/;if(t.length!==n||!t[0].match(r)||!t[1].match(r)||this.showSeconds&&!t[2].match(r))throw`Invalid time`;var i=parseInt(t[0]),a=parseInt(t[1]),o=this.showSeconds?parseInt(t[2]):null;if(isNaN(i)||isNaN(a)||i>23||a>59||this.hourFormat==`12`&&i>12||this.showSeconds&&(isNaN(o)||o>59))throw`Invalid time`;return this.hourFormat==`12`&&i!==12&&this.pm?i+=12:this.hourFormat==`12`&&i==12&&!this.pm&&(i=0),{hour:i,minute:a,second:o}},parseDate:function(e,t){if(t==null||e==null)throw`Invalid arguments`;if(e=sS(e)===`object`?e.toString():e+``,e===``)return null;var n,r,i,a=0,o=typeof this.shortYearCutoff==`string`?new Date().getFullYear()%100+parseInt(this.shortYearCutoff,10):this.shortYearCutoff,s=-1,c=-1,l=-1,u=-1,d=!1,f,p=function(e){var r=n+1<t.length&&t.charAt(n+1)===e;return r&&n++,r},m=function(t){var n=p(t),r=t===`@`?14:t===`!`?20:t===`y`&&n?4:t===`o`?3:2,i=RegExp(`^\\d{`+(t===`y`?r:1)+`,`+r+`}`),o=e.substring(a).match(i);if(!o)throw`Missing number at position `+a;return a+=o[0].length,parseInt(o[0],10)},h=function(t,n,r){for(var i=-1,o=p(t)?r:n,s=[],c=0;c<o.length;c++)s.push([c,o[c]]);s.sort(function(e,t){return-(e[1].length-t[1].length)});for(var l=0;l<s.length;l++){var u=s[l][1];if(e.substr(a,u.length).toLowerCase()===u.toLowerCase()){i=s[l][0],a+=u.length;break}}if(i!==-1)return i+1;throw`Unknown name at position `+a},g=function(){if(e.charAt(a)!==t.charAt(n))throw`Unexpected literal at position `+a;a++};for(this.currentView===`month`&&(l=1),this.currentView===`year`&&(l=1,c=1),n=0;n<t.length;n++)if(d)t.charAt(n)===`'`&&!p(`'`)?d=!1:g();else switch(t.charAt(n)){case`d`:l=m(`d`);break;case`D`:h(`D`,this.$primevue.config.locale.dayNamesShort,this.$primevue.config.locale.dayNames);break;case`o`:u=m(`o`);break;case`m`:c=m(`m`);break;case`M`:c=h(`M`,this.$primevue.config.locale.monthNamesShort,this.$primevue.config.locale.monthNames);break;case`y`:s=m(`y`);break;case`@`:f=new Date(m(`@`)),s=f.getFullYear(),c=f.getMonth()+1,l=f.getDate();break;case`!`:f=new Date((m(`!`)-this.ticksTo1970)/1e4),s=f.getFullYear(),c=f.getMonth()+1,l=f.getDate();break;case`'`:p(`'`)?g():d=!0;break;default:g()}if(a<e.length&&(i=e.substr(a),!/^\s+/.test(i)))throw`Extra/unparsed characters found in date: `+i;if(s===-1?s=new Date().getFullYear():s<100&&(s+=new Date().getFullYear()-new Date().getFullYear()%100+(s<=o?0:-100)),u>-1){c=1,l=u;do{if(r=this.getDaysCountInMonth(c-1,s),l<=r)break;c++,l-=r}while(!0)}if(f=this.daylightSavingAdjust(new Date(s,c-1,l)),f.getFullYear()!==s||f.getMonth()+1!==c||f.getDate()!==l)throw`Invalid date`;return f},getWeekNumber:function(e){var t=new Date(e.getTime());t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t.getTime())/864e5)/7)+1},onDateCellKeydown:function(e,t,n){e.preventDefault();var r=e.currentTarget,i=r.parentElement,a=gf(i);switch(e.code){case`ArrowDown`:if(r.tabIndex=`-1`,i.parentElement.nextElementSibling){var o=gf(i.parentElement),s=Array.from(i.parentElement.parentElement.children).slice(o+1).find(function(e){var t=e.children[a].children[0];return!uf(t,`data-p-disabled`)});if(s){var c=s.children[a].children[0];c.tabIndex=`0`,c.focus()}else this.navigationState={backward:!1},this.navForward(e)}else this.navigationState={backward:!1},this.navForward(e);e.preventDefault();break;case`ArrowUp`:if(r.tabIndex=`-1`,e.altKey)this.overlayVisible=!1,this.focused=!0;else if(i.parentElement.previousElementSibling){var l=gf(i.parentElement),u=Array.from(i.parentElement.parentElement.children).slice(0,l).reverse().find(function(e){var t=e.children[a].children[0];return!uf(t,`data-p-disabled`)});if(u){var d=u.children[a].children[0];d.tabIndex=`0`,d.focus()}else this.navigationState={backward:!0},this.navBackward(e)}else this.navigationState={backward:!0},this.navBackward(e);e.preventDefault();break;case`ArrowLeft`:if(r.tabIndex=`-1`,i.previousElementSibling){var f=Array.from(i.parentElement.children).slice(0,a).reverse().find(function(e){var t=e.children[0];return!uf(t,`data-p-disabled`)});if(f){var p=f.children[0];p.tabIndex=`0`,p.focus()}else this.navigateToMonth(e,!0,n)}else this.navigateToMonth(e,!0,n);e.preventDefault();break;case`ArrowRight`:if(r.tabIndex=`-1`,i.nextElementSibling){var m=Array.from(i.parentElement.children).slice(a+1).find(function(e){var t=e.children[0];return!uf(t,`data-p-disabled`)});if(m){var h=m.children[0];h.tabIndex=`0`,h.focus()}else this.navigateToMonth(e,!1,n)}else this.navigateToMonth(e,!1,n);e.preventDefault();break;case`Enter`:case`NumpadEnter`:case`Space`:this.onDateSelect(e,t),e.preventDefault();break;case`Escape`:this.overlayVisible=!1,e.preventDefault();break;case`Tab`:this.inline||this.trapFocus(e);break;case`Home`:r.tabIndex=`-1`;var g=i.parentElement.children[0].children[0];uf(g,`data-p-disabled`)?this.navigateToMonth(e,!0,n):(g.tabIndex=`0`,g.focus()),e.preventDefault();break;case`End`:r.tabIndex=`-1`;var _=i.parentElement,v=_.children[_.children.length-1].children[0];uf(v,`data-p-disabled`)?this.navigateToMonth(e,!1,n):(v.tabIndex=`0`,v.focus()),e.preventDefault();break;case`PageUp`:r.tabIndex=`-1`,e.shiftKey?(this.navigationState={backward:!0},this.navBackward(e)):this.navigateToMonth(e,!0,n),e.preventDefault();break;case`PageDown`:r.tabIndex=`-1`,e.shiftKey?(this.navigationState={backward:!1},this.navForward(e)):this.navigateToMonth(e,!1,n),e.preventDefault();break}},navigateToMonth:function(e,t,n){if(t)if(this.numberOfMonths===1||n===0)this.navigationState={backward:!0},this.navBackward(e);else{var r=this.overlay.children[n-1],i=sf(r,`table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])`),a=i[i.length-1];a.tabIndex=`0`,a.focus()}else if(this.numberOfMonths===1||n===this.numberOfMonths-1)this.navigationState={backward:!1},this.navForward(e);else{var o=this.overlay.children[n+1],s=cf(o,`table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])`);s.tabIndex=`0`,s.focus()}},onMonthCellKeydown:function(e,t){var n=e.currentTarget;switch(e.code){case`ArrowUp`:case`ArrowDown`:n.tabIndex=`-1`;var r=n.parentElement.children,i=gf(n),a=r[e.code===`ArrowDown`?i+3:i-3];a&&(a.tabIndex=`0`,a.focus()),e.preventDefault();break;case`ArrowLeft`:n.tabIndex=`-1`;var o=n.previousElementSibling;o?(o.tabIndex=`0`,o.focus()):(this.navigationState={backward:!0},this.navBackward(e)),e.preventDefault();break;case`ArrowRight`:n.tabIndex=`-1`;var s=n.nextElementSibling;s?(s.tabIndex=`0`,s.focus()):(this.navigationState={backward:!1},this.navForward(e)),e.preventDefault();break;case`PageUp`:if(e.shiftKey)return;this.navigationState={backward:!0},this.navBackward(e);break;case`PageDown`:if(e.shiftKey)return;this.navigationState={backward:!1},this.navForward(e);break;case`Enter`:case`NumpadEnter`:case`Space`:this.onMonthSelect(e,t),e.preventDefault();break;case`Escape`:this.overlayVisible=!1,e.preventDefault();break;case`Tab`:this.trapFocus(e);break}},onYearCellKeydown:function(e,t){var n=e.currentTarget;switch(e.code){case`ArrowUp`:case`ArrowDown`:n.tabIndex=`-1`;var r=n.parentElement.children,i=gf(n),a=r[e.code===`ArrowDown`?i+2:i-2];a&&(a.tabIndex=`0`,a.focus()),e.preventDefault();break;case`ArrowLeft`:n.tabIndex=`-1`;var o=n.previousElementSibling;o?(o.tabIndex=`0`,o.focus()):(this.navigationState={backward:!0},this.navBackward(e)),e.preventDefault();break;case`ArrowRight`:n.tabIndex=`-1`;var s=n.nextElementSibling;s?(s.tabIndex=`0`,s.focus()):(this.navigationState={backward:!1},this.navForward(e)),e.preventDefault();break;case`PageUp`:if(e.shiftKey)return;this.navigationState={backward:!0},this.navBackward(e);break;case`PageDown`:if(e.shiftKey)return;this.navigationState={backward:!1},this.navForward(e);break;case`Enter`:case`NumpadEnter`:case`Space`:this.onYearSelect(e,t),e.preventDefault();break;case`Escape`:this.overlayVisible=!1,e.preventDefault();break;case`Tab`:this.trapFocus(e);break}},updateFocus:function(){var e;if(this.navigationState){if(this.navigationState.button)this.initFocusableCell(),this.navigationState.backward?this.previousButton&&this.previousButton.focus():this.nextButton&&this.nextButton.focus();else{if(this.navigationState.backward){var t=this.currentView===`month`?sf(this.overlay,`[data-pc-section="monthview"] [data-pc-section="month"]:not([data-p-disabled="true"])`):this.currentView===`year`?sf(this.overlay,`[data-pc-section="yearview"] [data-pc-section="year"]:not([data-p-disabled="true"])`):sf(this.overlay,`table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])`);t&&t.length>0&&(e=t[t.length-1])}else e=this.currentView===`month`?cf(this.overlay,`[data-pc-section="monthview"] [data-pc-section="month"]:not([data-p-disabled="true"])`):this.currentView===`year`?cf(this.overlay,`[data-pc-section="yearview"] [data-pc-section="year"]:not([data-p-disabled="true"])`):cf(this.overlay,`table td span:not([data-p-disabled="true"]):not([data-p-ink="true"])`);e&&(e.tabIndex=`0`,e.focus())}this.navigationState=null}else this.initFocusableCell()},initFocusableCell:function(){var e;if(this.currentView===`month`){var t=sf(this.overlay,`[data-pc-section="monthview"] [data-pc-section="month"]`),n=cf(this.overlay,`[data-pc-section="monthview"] [data-pc-section="month"][data-p-selected="true"]`);t.forEach(function(e){return e.tabIndex=-1}),e=n||t[0]}else if(this.currentView===`year`){var r=sf(this.overlay,`[data-pc-section="yearview"] [data-pc-section="year"]`),i=cf(this.overlay,`[data-pc-section="yearview"] [data-pc-section="year"][data-p-selected="true"]`);r.forEach(function(e){return e.tabIndex=-1}),e=i||r[0]}else e=cf(this.overlay,`span[data-p-selected="true"]`),!e&&(e=cf(this.overlay,`td[data-p-today="true"] span:not([data-p-disabled="true"]):not([data-p-ink="true"])`)||cf(this.overlay,`.p-datepicker-calendar td span:not([data-p-disabled="true"]):not([data-p-ink="true"])`));e&&(e.tabIndex=`0`,!this.preventFocus&&this.overlay&&!this.overlay.contains(document.activeElement)&&e.focus(),this.preventFocus=!1)},trapFocus:function(e){e.preventDefault();var t=df(this.overlay);if(t&&t.length>0)if(!document.activeElement)t[0].focus();else{var n=t.indexOf(document.activeElement);if(e.shiftKey)n===-1||n===0?t[t.length-1].focus():t[n-1].focus();else if(n===-1)if(this.timeOnly)t[0].focus();else{var r=t.findIndex(function(e){return e.tagName===`SPAN`});r===-1&&(r=t.findIndex(function(e){return e.tagName===`BUTTON`})),r===-1?t[0].focus():t[r].focus()}else n===t.length-1?t[0].focus():t[n+1].focus()}},onContainerButtonKeydown:function(e){switch(e.code){case`Tab`:this.trapFocus(e);break;case`Escape`:this.overlayVisible=!1,e.preventDefault();break}this.$emit(`keydown`,e)},onInput:function(e){try{var t;this.selectionStart=this.input.selectionStart,this.selectionEnd=this.input.selectionEnd,(t=this.$refs.clearIcon)!=null&&(t=t.$el)!=null&&t.style&&(this.$refs.clearIcon.$el.style.display=Hf(e.target.value)?`none`:`block`);var n=this.parseValue(e.target.value);this.isValidSelection(n)&&(this.typeUpdate=!0,this.updateModel(this.updateModelType===`string`?this.formatValue(n):n),this.updateCurrentMetaData())}catch{}this.$emit(`input`,e)},onInputClick:function(){this.showOnFocus&&this.isEnabled()&&!this.overlayVisible&&(this.overlayVisible=!0)},onFocus:function(e){this.showOnFocus&&this.isEnabled()&&(this.overlayVisible=!0),this.focused=!0,this.$emit(`focus`,e)},onBlur:function(e){var t,n,r;this.$emit(`blur`,{originalEvent:e,value:e.target.value}),(t=(n=this.formField).onBlur)==null||t.call(n),this.focused=!1,e.target.value=this.formatValue(this.rawValue),(r=this.$refs.clearIcon)!=null&&(r=r.$el)!=null&&r.style&&(this.$refs.clearIcon.$el.style.display=Hf(e.target.value)?`none`:`block`)},onKeyDown:function(e){if(e.code===`ArrowDown`&&this.overlay)this.trapFocus(e);else if(e.code===`ArrowDown`&&!this.overlay)this.overlayVisible=!0;else if(e.code===`Escape`)this.overlayVisible&&(this.overlayVisible=!1,e.preventDefault(),e.stopPropagation());else if(e.code===`Tab`)this.overlay&&df(this.overlay).forEach(function(e){return e.tabIndex=`-1`}),this.overlayVisible&&=!1;else if(e.code===`Enter`){if(this.manualInput&&e.target.value!==null&&e.target.value?.trim()!==``)try{var t=this.parseValue(e.target.value);this.isValidSelection(t)&&(this.overlayVisible=!1)}catch{}this.$emit(`keydown`,e)}},overlayRef:function(e){this.overlay=e},inputRef:function(e){this.input=e?e.$el:void 0},previousButtonRef:function(e){this.previousButton=e?e.$el:void 0},nextButtonRef:function(e){this.nextButton=e?e.$el:void 0},getMonthName:function(e){return this.$primevue.config.locale.monthNames[e]},getYear:function(e){return this.currentView===`month`?this.currentYear:e.year},onClearClick:function(){this.updateModel(null),this.overlayVisible=!1},onOverlayClick:function(e){e.stopPropagation(),this.inline||tS.emit(`overlay-click`,{originalEvent:e,target:this.$el})},onOverlayKeyDown:function(e){switch(e.code){case`Escape`:this.inline||(this.input.focus(),this.overlayVisible=!1,e.stopPropagation());break}},onOverlayMouseUp:function(e){this.onOverlayClick(e)},createResponsiveStyle:function(){if(this.numberOfMonths>1&&this.responsiveOptions&&!this.isUnstyled){if(!this.responsiveStyleElement){var e;this.responsiveStyleElement=document.createElement(`style`),this.responsiveStyleElement.type=`text/css`,Pf(this.responsiveStyleElement,`nonce`,(e=this.$primevue)==null||(e=e.config)==null||(e=e.csp)==null?void 0:e.nonce),document.body.appendChild(this.responsiveStyleElement)}var t=``;if(this.responsiveOptions)for(var n=up(),r=cS(this.responsiveOptions).filter(function(e){return!!(e.breakpoint&&e.numMonths)}).sort(function(e,t){return-1*n(e.breakpoint,t.breakpoint)}),i=0;i<r.length;i++){for(var a=r[i],o=a.breakpoint,s=a.numMonths,c=`
|
|
1642
|
-
.p-datepicker-panel[${this.$attrSelector}] .p-datepicker-calendar:nth-child(${s}) .p-datepicker-next-button {
|
|
1643
|
-
display: inline-flex;
|
|
1644
|
-
}
|
|
1645
|
-
`,l=s;l<this.numberOfMonths;l++)c+=`
|
|
1646
|
-
.p-datepicker-panel[${this.$attrSelector}] .p-datepicker-calendar:nth-child(${l+1}) {
|
|
1647
|
-
display: none;
|
|
1648
|
-
}
|
|
1649
|
-
`;t+=`
|
|
1650
|
-
@media screen and (max-width: ${o}) {
|
|
1651
|
-
${c}
|
|
1652
|
-
}
|
|
1653
|
-
`}this.responsiveStyleElement.innerHTML=t}},destroyResponsiveStyleElement:function(){this.responsiveStyleElement&&=(this.responsiveStyleElement.remove(),null)},dayDataP:function(e){return Nd({today:e.today,"other-month":e.otherMonth,selected:this.isSelected(e),disabled:!e.selectable})}},computed:{viewDate:function(){var e=this.rawValue;if(e&&Array.isArray(e))if(this.isRangeSelection())if(e.length===0)e=null;else if(e.length===1)e=e[0];else{var t=this.parseValueForComparison(e[0]),n=new Date(t.getFullYear(),t.getMonth()+this.numberOfMonths,1);if(!e[1]||e[1]<n)e=e[0];else{var r=this.parseValueForComparison(e[1]);e=new Date(r.getFullYear(),r.getMonth()-this.numberOfMonths+1,1)}}else this.isMultipleSelection()&&(e=e[e.length-1]);if(e&&typeof e!=`string`)return e;var i=new Date;return this.maxDate&&this.maxDate<i?this.maxDate:this.minDate&&this.minDate>i?this.minDate:i},inputFieldValue:function(){return this.formatValue(this.rawValue)},months:function(){for(var e=[],t=0;t<this.numberOfMonths;t++){var n=this.currentMonth+t,r=this.currentYear;n>11&&(n=n%11-1,r+=1);for(var i=[],a=this.getFirstDayOfMonthIndex(n,r),o=this.getDaysCountInMonth(n,r),s=this.getDaysCountInPrevMonth(n,r),c=1,l=new Date,u=[],d=Math.ceil((o+a)/7),f=0;f<d;f++){var p=[];if(f==0){for(var m=s-a+1;m<=s;m++){var h=this.getPreviousMonthAndYear(n,r);p.push({day:m,month:h.month,year:h.year,otherMonth:!0,today:this.isToday(l,m,h.month,h.year),selectable:this.isSelectable(m,h.month,h.year,!0)})}for(var g=7-p.length,_=0;_<g;_++)p.push({day:c,month:n,year:r,today:this.isToday(l,c,n,r),selectable:this.isSelectable(c,n,r,!1)}),c++}else for(var v=0;v<7;v++){if(c>o){var y=this.getNextMonthAndYear(n,r);p.push({day:c-o,month:y.month,year:y.year,otherMonth:!0,today:this.isToday(l,c-o,y.month,y.year),selectable:this.isSelectable(c-o,y.month,y.year,!0)})}else p.push({day:c,month:n,year:r,today:this.isToday(l,c,n,r),selectable:this.isSelectable(c,n,r,!1)});c++}this.showWeek&&u.push(this.getWeekNumber(new Date(p[0].year,p[0].month,p[0].day))),i.push(p)}e.push({month:n,year:r,dates:i,weekNumbers:u})}return e},weekDays:function(){for(var e=[],t=this.$primevue.config.locale.firstDayOfWeek,n=0;n<7;n++)e.push(this.$primevue.config.locale.dayNamesMin[t]),t=t==6?0:++t;return e},ticksTo1970:function(){return 719162*24*60*60*1e7},sundayIndex:function(){return this.$primevue.config.locale.firstDayOfWeek>0?7-this.$primevue.config.locale.firstDayOfWeek:0},datePattern:function(){return this.dateFormat||this.$primevue.config.locale.dateFormat},monthPickerValues:function(){for(var e=this,t=[],n=function(t){if(e.minDate){var n=e.minDate.getMonth(),r=e.minDate.getFullYear();if(e.currentYear<r||e.currentYear===r&&t<n)return!1}if(e.maxDate){var i=e.maxDate.getMonth(),a=e.maxDate.getFullYear();if(e.currentYear>a||e.currentYear===a&&t>i)return!1}return!0},r=0;r<=11;r++)t.push({value:this.$primevue.config.locale.monthNamesShort[r],selectable:n(r)});return t},yearPickerValues:function(){for(var e=this,t=[],n=this.currentYear-this.currentYear%10,r=function(t){return!(e.minDate&&e.minDate.getFullYear()>t||e.maxDate&&e.maxDate.getFullYear()<t)},i=0;i<10;i++)t.push({value:n+i,selectable:r(n+i)});return t},formattedCurrentHour:function(){return this.currentHour==0&&this.hourFormat==`12`?this.currentHour+12:this.currentHour<10?`0`+this.currentHour:this.currentHour},formattedCurrentMinute:function(){return this.currentMinute<10?`0`+this.currentMinute:this.currentMinute},formattedCurrentSecond:function(){return this.currentSecond<10?`0`+this.currentSecond:this.currentSecond},todayLabel:function(){return this.$primevue.config.locale.today},clearLabel:function(){return this.$primevue.config.locale.clear},weekHeaderLabel:function(){return this.$primevue.config.locale.weekHeader},monthNames:function(){return this.$primevue.config.locale.monthNames},switchViewButtonDisabled:function(){return this.numberOfMonths>1||this.disabled},isClearIconVisible:function(){return this.showClear&&this.rawValue!=null&&!this.disabled},panelId:function(){return this.$id+`_panel`},containerDataP:function(){return Nd({fluid:this.$fluid})},panelDataP:function(){return Nd(iS({inline:this.inline},`portal-`+this.appendTo,`portal-`+this.appendTo))},inputIconDataP:function(){return Nd(iS({},this.size,this.size))},timePickerDataP:function(){return Nd({"time-only":this.timeOnly})},hourIncrementCallbacks:function(){var e=this;return{mousedown:function(t){return e.onTimePickerElementMouseDown(t,0,1)},mouseup:function(t){return e.onTimePickerElementMouseUp(t)},mouseleave:function(){return e.onTimePickerElementMouseLeave()},keydown:function(t){return e.onTimePickerElementKeyDown(t,0,1)},keyup:function(t){return e.onTimePickerElementKeyUp(t)}}},hourDecrementCallbacks:function(){var e=this;return{mousedown:function(t){return e.onTimePickerElementMouseDown(t,0,-1)},mouseup:function(t){return e.onTimePickerElementMouseUp(t)},mouseleave:function(){return e.onTimePickerElementMouseLeave()},keydown:function(t){return e.onTimePickerElementKeyDown(t,0,-1)},keyup:function(t){return e.onTimePickerElementKeyUp(t)}}},minuteIncrementCallbacks:function(){var e=this;return{mousedown:function(t){return e.onTimePickerElementMouseDown(t,1,1)},mouseup:function(t){return e.onTimePickerElementMouseUp(t)},mouseleave:function(){return e.onTimePickerElementMouseLeave()},keydown:function(t){return e.onTimePickerElementKeyDown(t,1,1)},keyup:function(t){return e.onTimePickerElementKeyUp(t)}}},minuteDecrementCallbacks:function(){var e=this;return{mousedown:function(t){return e.onTimePickerElementMouseDown(t,1,-1)},mouseup:function(t){return e.onTimePickerElementMouseUp(t)},mouseleave:function(){return e.onTimePickerElementMouseLeave()},keydown:function(t){return e.onTimePickerElementKeyDown(t,1,-1)},keyup:function(t){return e.onTimePickerElementKeyUp(t)}}},secondIncrementCallbacks:function(){var e=this;return{mousedown:function(t){return e.onTimePickerElementMouseDown(t,2,1)},mouseup:function(t){return e.onTimePickerElementMouseUp(t)},mouseleave:function(){return e.onTimePickerElementMouseLeave()},keydown:function(t){return e.onTimePickerElementKeyDown(t,2,1)},keyup:function(t){return e.onTimePickerElementKeyUp(t)}}},secondDecrementCallbacks:function(){var e=this;return{mousedown:function(t){return e.onTimePickerElementMouseDown(t,2,-1)},mouseup:function(t){return e.onTimePickerElementMouseUp(t)},mouseleave:function(){return e.onTimePickerElementMouseLeave()},keydown:function(t){return e.onTimePickerElementKeyDown(t,2,-1)},keyup:function(t){return e.onTimePickerElementKeyUp(t)}}}},components:{InputText:Qx,Button:cg,Portal:t_,CalendarIcon:ax,ChevronLeftIcon:xx,ChevronRightIcon:kx,ChevronUpIcon:Lx,ChevronDownIcon:px,TimesIcon:Rg},directives:{ripple:Xh}},gS=[`id`,`data-p`],_S=[`disabled`,`aria-label`,`aria-expanded`,`aria-controls`],vS=[`data-p`],yS=[`id`,`role`,`aria-modal`,`aria-label`,`data-p`],bS=[`disabled`,`aria-label`],xS=[`disabled`,`aria-label`],SS=[`disabled`,`aria-label`],CS=[`disabled`,`aria-label`],wS=[`data-p-disabled`],TS=[`abbr`],ES=[`data-p-disabled`],DS=[`aria-label`,`data-p-today`,`data-p-other-month`],OS=[`onClick`,`onKeydown`,`aria-selected`,`aria-disabled`,`data-p`],kS=[`onClick`,`onKeydown`,`data-p-disabled`,`data-p-selected`],AS=[`onClick`,`onKeydown`,`data-p-disabled`,`data-p-selected`],jS=[`data-p`];function MS(e,t,n,r,i,a){var o=F(`InputText`),s=F(`TimesIcon`),u=F(`Button`),d=F(`Portal`),f=ze(`ripple`);return q(),c(`span`,U({ref:`container`,id:e.$id,class:e.cx(`root`),style:e.sx(`root`),"data-p":a.containerDataP},e.ptmi(`root`)),[e.inline?R(``,!0):(q(),be(o,{key:0,ref:a.inputRef,id:e.inputId,role:`combobox`,class:Te([e.inputClass,e.cx(`pcInputText`)]),style:it(e.inputStyle),defaultValue:a.inputFieldValue,placeholder:e.placeholder,name:e.name,size:e.size,invalid:e.invalid,variant:e.variant,fluid:e.fluid,required:e.required,unstyled:e.unstyled,autocomplete:`off`,"aria-autocomplete":`none`,"aria-haspopup":`dialog`,"aria-expanded":i.overlayVisible,"aria-controls":i.overlayVisible?a.panelId:void 0,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,inputmode:`none`,disabled:e.disabled,readonly:!e.manualInput||e.readonly,tabindex:0,onInput:a.onInput,onClick:a.onInputClick,onFocus:a.onFocus,onBlur:a.onBlur,onKeydown:a.onKeyDown,"data-p-has-dropdown":e.showIcon&&e.iconDisplay===`button`&&!e.inline,"data-p-has-e-icon":e.showIcon&&e.iconDisplay===`input`&&!e.inline,pt:e.ptm(`pcInputText`)},null,8,`id.class.style.defaultValue.placeholder.name.size.invalid.variant.fluid.required.unstyled.aria-expanded.aria-controls.aria-labelledby.aria-label.disabled.readonly.onInput.onClick.onFocus.onBlur.onKeydown.data-p-has-dropdown.data-p-has-e-icon.pt`.split(`.`))),e.showClear&&!e.inline?m(e.$slots,`clearicon`,{key:1,class:Te(e.cx(`clearIcon`)),clearCallback:a.onClearClick},function(){return[Fe(s,U({ref:`clearIcon`,class:[e.cx(`clearIcon`)],onClick:a.onClearClick},e.ptm(`clearIcon`)),null,16,[`class`,`onClick`])]}):R(``,!0),e.showIcon&&e.iconDisplay===`button`&&!e.inline?m(e.$slots,`dropdownbutton`,{key:2,toggleCallback:a.onButtonClick},function(){return[V(`button`,U({class:e.cx(`dropdown`),disabled:e.disabled,onClick:t[0]||=function(){return a.onButtonClick&&a.onButtonClick.apply(a,arguments)},type:`button`,"aria-label":e.$primevue.config.locale.chooseDate,"aria-haspopup":`dialog`,"aria-expanded":i.overlayVisible,"aria-controls":a.panelId},e.ptm(`dropdown`)),[m(e.$slots,`dropdownicon`,{class:Te(e.icon)},function(){return[(q(),be(l(e.icon?`span`:`CalendarIcon`),U({class:e.icon},e.ptm(`dropdownIcon`)),null,16,[`class`]))]})],16,_S)]}):e.showIcon&&e.iconDisplay===`input`&&!e.inline?(q(),c(x,{key:3},[e.$slots.inputicon||e.showIcon?(q(),c(`span`,U({key:0,class:e.cx(`inputIconContainer`),"data-p":a.inputIconDataP},e.ptm(`inputIconContainer`)),[m(e.$slots,`inputicon`,{class:Te(e.cx(`inputIcon`)),clickCallback:a.onButtonClick},function(){return[(q(),be(l(e.icon?`i`:`CalendarIcon`),U({class:[e.icon,e.cx(`inputIcon`)],onClick:a.onButtonClick},e.ptm(`inputicon`)),null,16,[`class`,`onClick`]))]})],16,vS)):R(``,!0)],64)):R(``,!0),Fe(d,{appendTo:e.appendTo,disabled:e.inline},{default:ue(function(){return[Fe(B,U({name:`p-anchored-overlay`,onEnter:t[58]||=function(e){return a.onOverlayEnter(e)},onAfterEnter:a.onOverlayEnterComplete,onAfterLeave:a.onOverlayAfterLeave,onLeave:a.onOverlayLeave},e.ptm(`transition`)),{default:ue(function(){return[e.inline||i.overlayVisible?(q(),c(`div`,U({key:0,ref:a.overlayRef,id:a.panelId,class:[e.cx(`panel`),e.panelClass],style:e.panelStyle,role:e.inline?null:`dialog`,"aria-modal":e.inline?null:`true`,"aria-label":e.$primevue.config.locale.chooseDate,onClick:t[55]||=function(){return a.onOverlayClick&&a.onOverlayClick.apply(a,arguments)},onKeydown:t[56]||=function(){return a.onOverlayKeyDown&&a.onOverlayKeyDown.apply(a,arguments)},onMouseup:t[57]||=function(){return a.onOverlayMouseUp&&a.onOverlayMouseUp.apply(a,arguments)},"data-p":a.panelDataP},e.ptm(`panel`)),[e.timeOnly?R(``,!0):(q(),c(x,{key:0},[V(`div`,U({class:e.cx(`calendarContainer`)},e.ptm(`calendarContainer`)),[(q(!0),c(x,null,g(a.months,function(n,r){return q(),c(`div`,U({key:n.month+n.year,class:e.cx(`calendar`)},{ref_for:!0},e.ptm(`calendar`)),[V(`div`,U({class:e.cx(`header`)},{ref_for:!0},e.ptm(`header`)),[m(e.$slots,`header`),m(e.$slots,`prevbutton`,{actionCallback:function(e){return a.onPrevButtonClick(e)},keydownCallback:function(e){return a.onContainerButtonKeydown(e)}},function(){return[C(Fe(u,U({ref_for:!0,ref:a.previousButtonRef,class:e.cx(`pcPrevButton`),disabled:e.disabled,"aria-label":i.currentView===`year`?e.$primevue.config.locale.prevDecade:i.currentView===`month`?e.$primevue.config.locale.prevYear:e.$primevue.config.locale.prevMonth,unstyled:e.unstyled,onClick:a.onPrevButtonClick,onKeydown:a.onContainerButtonKeydown},{ref_for:!0},e.navigatorButtonProps,{pt:e.ptm(`pcPrevButton`),"data-pc-group-section":`navigator`}),{icon:ue(function(t){return[m(e.$slots,`previcon`,{},function(){return[(q(),be(l(e.prevIcon?`span`:`ChevronLeftIcon`),U({class:[e.prevIcon,t.class]},{ref_for:!0},e.ptm(`pcPrevButton`).icon),null,16,[`class`]))]})]}),_:3},16,[`class`,`disabled`,`aria-label`,`unstyled`,`onClick`,`onKeydown`,`pt`]),[[w,r===0]])]}),V(`div`,U({class:e.cx(`title`)},{ref_for:!0},e.ptm(`title`)),[e.$primevue.config.locale.showMonthAfterYear?(q(),c(x,{key:0},[i.currentView===`year`?R(``,!0):(q(),c(`button`,U({key:0,type:`button`,onClick:t[1]||=function(){return a.switchToYearView&&a.switchToYearView.apply(a,arguments)},onKeydown:t[2]||=function(){return a.onContainerButtonKeydown&&a.onContainerButtonKeydown.apply(a,arguments)},class:e.cx(`selectYear`),disabled:a.switchViewButtonDisabled,"aria-label":e.$primevue.config.locale.chooseYear},{ref_for:!0},e.ptm(`selectYear`),{"data-pc-group-section":`view`}),Oe(a.getYear(n)),17,bS)),i.currentView===`date`?(q(),c(`button`,U({key:1,type:`button`,onClick:t[3]||=function(){return a.switchToMonthView&&a.switchToMonthView.apply(a,arguments)},onKeydown:t[4]||=function(){return a.onContainerButtonKeydown&&a.onContainerButtonKeydown.apply(a,arguments)},class:e.cx(`selectMonth`),disabled:a.switchViewButtonDisabled,"aria-label":e.$primevue.config.locale.chooseMonth},{ref_for:!0},e.ptm(`selectMonth`),{"data-pc-group-section":`view`}),Oe(a.getMonthName(n.month)),17,xS)):R(``,!0)],64)):(q(),c(x,{key:1},[i.currentView===`date`?(q(),c(`button`,U({key:0,type:`button`,onClick:t[5]||=function(){return a.switchToMonthView&&a.switchToMonthView.apply(a,arguments)},onKeydown:t[6]||=function(){return a.onContainerButtonKeydown&&a.onContainerButtonKeydown.apply(a,arguments)},class:e.cx(`selectMonth`),disabled:a.switchViewButtonDisabled,"aria-label":e.$primevue.config.locale.chooseMonth},{ref_for:!0},e.ptm(`selectMonth`),{"data-pc-group-section":`view`}),Oe(a.getMonthName(n.month)),17,SS)):R(``,!0),i.currentView===`year`?R(``,!0):(q(),c(`button`,U({key:1,type:`button`,onClick:t[7]||=function(){return a.switchToYearView&&a.switchToYearView.apply(a,arguments)},onKeydown:t[8]||=function(){return a.onContainerButtonKeydown&&a.onContainerButtonKeydown.apply(a,arguments)},class:e.cx(`selectYear`),disabled:a.switchViewButtonDisabled,"aria-label":e.$primevue.config.locale.chooseYear},{ref_for:!0},e.ptm(`selectYear`),{"data-pc-group-section":`view`}),Oe(a.getYear(n)),17,CS))],64)),i.currentView===`year`?(q(),c(`span`,U({key:2,class:e.cx(`decade`)},{ref_for:!0},e.ptm(`decade`)),[m(e.$slots,`decade`,{years:a.yearPickerValues},function(){return[Ye(Oe(a.yearPickerValues[0].value)+` - `+Oe(a.yearPickerValues[a.yearPickerValues.length-1].value),1)]})],16)):R(``,!0)],16),m(e.$slots,`nextbutton`,{actionCallback:function(e){return a.onNextButtonClick(e)},keydownCallback:function(e){return a.onContainerButtonKeydown(e)}},function(){return[C(Fe(u,U({ref_for:!0,ref:a.nextButtonRef,class:e.cx(`pcNextButton`),disabled:e.disabled,"aria-label":i.currentView===`year`?e.$primevue.config.locale.nextDecade:i.currentView===`month`?e.$primevue.config.locale.nextYear:e.$primevue.config.locale.nextMonth,unstyled:e.unstyled,onClick:a.onNextButtonClick,onKeydown:a.onContainerButtonKeydown},{ref_for:!0},e.navigatorButtonProps,{pt:e.ptm(`pcNextButton`),"data-pc-group-section":`navigator`}),{icon:ue(function(t){return[m(e.$slots,`nexticon`,{},function(){return[(q(),be(l(e.nextIcon?`span`:`ChevronRightIcon`),U({class:[e.nextIcon,t.class]},{ref_for:!0},e.ptm(`pcNextButton`).icon),null,16,[`class`]))]})]}),_:3},16,[`class`,`disabled`,`aria-label`,`unstyled`,`onClick`,`onKeydown`,`pt`]),[[w,e.numberOfMonths===1?!0:r===e.numberOfMonths-1]])]})],16),i.currentView===`date`?(q(),c(`table`,U({key:0,class:e.cx(`dayView`),role:`grid`},{ref_for:!0},e.ptm(`dayView`)),[V(`thead`,U({ref_for:!0},e.ptm(`tableHeader`)),[V(`tr`,U({ref_for:!0},e.ptm(`tableHeaderRow`)),[e.showWeek?(q(),c(`th`,U({key:0,scope:`col`,class:e.cx(`weekHeader`)},{ref_for:!0},e.ptm(`weekHeader`,{context:{disabled:e.showWeek}}),{"data-p-disabled":e.showWeek,"data-pc-group-section":`tableheadercell`}),[m(e.$slots,`weekheaderlabel`,{},function(){return[V(`span`,U({ref_for:!0},e.ptm(`weekHeaderLabel`,{context:{disabled:e.showWeek}}),{"data-pc-group-section":`tableheadercelllabel`}),Oe(a.weekHeaderLabel),17)]})],16,wS)):R(``,!0),(q(!0),c(x,null,g(a.weekDays,function(t){return q(),c(`th`,U({key:t,scope:`col`,abbr:t},{ref_for:!0},e.ptm(`tableHeaderCell`),{"data-pc-group-section":`tableheadercell`,class:e.cx(`weekDayCell`)}),[V(`span`,U({class:e.cx(`weekDay`)},{ref_for:!0},e.ptm(`weekDay`),{"data-pc-group-section":`tableheadercelllabel`}),Oe(t),17)],16,TS)}),128))],16)],16),V(`tbody`,U({ref_for:!0},e.ptm(`tableBody`)),[(q(!0),c(x,null,g(n.dates,function(t,i){return q(),c(`tr`,U({key:t[0].day+``+t[0].month},{ref_for:!0},e.ptm(`tableBodyRow`)),[e.showWeek?(q(),c(`td`,U({key:0,class:e.cx(`weekNumber`)},{ref_for:!0},e.ptm(`weekNumber`),{"data-pc-group-section":`tablebodycell`}),[V(`span`,U({class:e.cx(`weekLabelContainer`)},{ref_for:!0},e.ptm(`weekLabelContainer`,{context:{disabled:e.showWeek}}),{"data-p-disabled":e.showWeek,"data-pc-group-section":`tablebodycelllabel`}),[m(e.$slots,`weeklabel`,{weekNumber:n.weekNumbers[i]},function(){return[n.weekNumbers[i]<10?(q(),c(`span`,U({key:0,style:{visibility:`hidden`}},{ref_for:!0},e.ptm(`weekLabel`)),`0`,16)):R(``,!0),Ye(` `+Oe(n.weekNumbers[i]),1)]})],16,ES)],16)):R(``,!0),(q(!0),c(x,null,g(t,function(t){return q(),c(`td`,U({key:t.day+``+t.month,"aria-label":t.day,class:e.cx(`dayCell`,{date:t})},{ref_for:!0},e.ptm(`dayCell`,{context:{date:t,today:t.today,otherMonth:t.otherMonth,selected:a.isSelected(t),disabled:!t.selectable}}),{"data-p-today":t.today,"data-p-other-month":t.otherMonth,"data-pc-group-section":`tablebodycell`}),[e.showOtherMonths||!t.otherMonth?C((q(),c(`span`,U({key:0,class:e.cx(`day`,{date:t}),onClick:function(e){return a.onDateSelect(e,t)},draggable:`false`,onKeydown:function(e){return a.onDateCellKeydown(e,t,r)},"aria-selected":a.isSelected(t),"aria-disabled":!t.selectable},{ref_for:!0},e.ptm(`day`,{context:{date:t,today:t.today,otherMonth:t.otherMonth,selected:a.isSelected(t),disabled:!t.selectable}}),{"data-p":a.dayDataP(t),"data-pc-group-section":`tablebodycelllabel`}),[m(e.$slots,`date`,{date:t},function(){return[Ye(Oe(t.day),1)]})],16,OS)),[[f]]):R(``,!0),a.isSelected(t)?(q(),c(`div`,U({key:1,class:`p-hidden-accessible`,"aria-live":`polite`},{ref_for:!0},e.ptm(`hiddenSelectedDay`),{"data-p-hidden-accessible":!0}),Oe(t.day),17)):R(``,!0)],16,DS)}),128))],16)}),128))],16)],16)):R(``,!0)],16)}),128))],16),i.currentView===`month`?(q(),c(`div`,U({key:0,class:e.cx(`monthView`)},e.ptm(`monthView`)),[(q(!0),c(x,null,g(a.monthPickerValues,function(t,n){return C((q(),c(`span`,U({key:t,onClick:function(e){return a.onMonthSelect(e,{month:t,index:n})},onKeydown:function(e){return a.onMonthCellKeydown(e,{month:t,index:n})},class:e.cx(`month`,{month:t,index:n})},{ref_for:!0},e.ptm(`month`,{context:{month:t,monthIndex:n,selected:a.isMonthSelected(n),disabled:!t.selectable}}),{"data-p-disabled":!t.selectable,"data-p-selected":a.isMonthSelected(n)}),[Ye(Oe(t.value)+` `,1),a.isMonthSelected(n)?(q(),c(`div`,U({key:0,class:`p-hidden-accessible`,"aria-live":`polite`},{ref_for:!0},e.ptm(`hiddenMonth`),{"data-p-hidden-accessible":!0}),Oe(t.value),17)):R(``,!0)],16,kS)),[[f]])}),128))],16)):R(``,!0),i.currentView===`year`?(q(),c(`div`,U({key:1,class:e.cx(`yearView`)},e.ptm(`yearView`)),[(q(!0),c(x,null,g(a.yearPickerValues,function(t){return C((q(),c(`span`,U({key:t.value,onClick:function(e){return a.onYearSelect(e,t)},onKeydown:function(e){return a.onYearCellKeydown(e,t)},class:e.cx(`year`,{year:t})},{ref_for:!0},e.ptm(`year`,{context:{year:t,selected:a.isYearSelected(t.value),disabled:!t.selectable}}),{"data-p-disabled":!t.selectable,"data-p-selected":a.isYearSelected(t.value)}),[Ye(Oe(t.value)+` `,1),a.isYearSelected(t.value)?(q(),c(`div`,U({key:0,class:`p-hidden-accessible`,"aria-live":`polite`},{ref_for:!0},e.ptm(`hiddenYear`),{"data-p-hidden-accessible":!0}),Oe(t.value),17)):R(``,!0)],16,AS)),[[f]])}),128))],16)):R(``,!0)],64)),(e.showTime||e.timeOnly)&&i.currentView===`date`?(q(),c(`div`,U({key:1,class:e.cx(`timePicker`),"data-p":a.timePickerDataP},e.ptm(`timePicker`)),[V(`div`,U({class:e.cx(`hourPicker`)},e.ptm(`hourPicker`),{"data-pc-group-section":`timepickerContainer`}),[m(e.$slots,`hourincrementbutton`,{callbacks:a.hourIncrementCallbacks},function(){return[Fe(u,U({class:e.cx(`pcIncrementButton`),"aria-label":e.$primevue.config.locale.nextHour,unstyled:e.unstyled,onMousedown:t[9]||=function(e){return a.onTimePickerElementMouseDown(e,0,1)},onMouseup:t[10]||=function(e){return a.onTimePickerElementMouseUp(e)},onKeydown:[a.onContainerButtonKeydown,t[12]||=ce(function(e){return a.onTimePickerElementMouseDown(e,0,1)},[`enter`]),t[13]||=ce(function(e){return a.onTimePickerElementMouseDown(e,0,1)},[`space`])],onMouseleave:t[11]||=function(e){return a.onTimePickerElementMouseLeave()},onKeyup:[t[14]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`enter`]),t[15]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`space`])]},e.timepickerButtonProps,{pt:e.ptm(`pcIncrementButton`),"data-pc-group-section":`timepickerbutton`}),{icon:ue(function(t){return[m(e.$slots,`incrementicon`,{},function(){return[(q(),be(l(e.incrementIcon?`span`:`ChevronUpIcon`),U({class:[e.incrementIcon,t.class]},e.ptm(`pcIncrementButton`).icon,{"data-pc-group-section":`timepickerlabel`}),null,16,[`class`]))]})]}),_:3},16,[`class`,`aria-label`,`unstyled`,`onKeydown`,`pt`])]}),V(`span`,U(e.ptm(`hour`),{"data-pc-group-section":`timepickerlabel`}),Oe(a.formattedCurrentHour),17),m(e.$slots,`hourdecrementbutton`,{callbacks:a.hourDecrementCallbacks},function(){return[Fe(u,U({class:e.cx(`pcDecrementButton`),"aria-label":e.$primevue.config.locale.prevHour,unstyled:e.unstyled,onMousedown:t[16]||=function(e){return a.onTimePickerElementMouseDown(e,0,-1)},onMouseup:t[17]||=function(e){return a.onTimePickerElementMouseUp(e)},onKeydown:[a.onContainerButtonKeydown,t[19]||=ce(function(e){return a.onTimePickerElementMouseDown(e,0,-1)},[`enter`]),t[20]||=ce(function(e){return a.onTimePickerElementMouseDown(e,0,-1)},[`space`])],onMouseleave:t[18]||=function(e){return a.onTimePickerElementMouseLeave()},onKeyup:[t[21]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`enter`]),t[22]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`space`])]},e.timepickerButtonProps,{pt:e.ptm(`pcDecrementButton`),"data-pc-group-section":`timepickerbutton`}),{icon:ue(function(t){return[m(e.$slots,`decrementicon`,{},function(){return[(q(),be(l(e.decrementIcon?`span`:`ChevronDownIcon`),U({class:[e.decrementIcon,t.class]},e.ptm(`pcDecrementButton`).icon,{"data-pc-group-section":`timepickerlabel`}),null,16,[`class`]))]})]}),_:3},16,[`class`,`aria-label`,`unstyled`,`onKeydown`,`pt`])]})],16),V(`div`,U(e.ptm(`separatorContainer`),{"data-pc-group-section":`timepickerContainer`}),[V(`span`,U(e.ptm(`separator`),{"data-pc-group-section":`timepickerlabel`}),Oe(e.timeSeparator),17)],16),V(`div`,U({class:e.cx(`minutePicker`)},e.ptm(`minutePicker`),{"data-pc-group-section":`timepickerContainer`}),[m(e.$slots,`minuteincrementbutton`,{callbacks:a.minuteIncrementCallbacks},function(){return[Fe(u,U({class:e.cx(`pcIncrementButton`),"aria-label":e.$primevue.config.locale.nextMinute,disabled:e.disabled,unstyled:e.unstyled,onMousedown:t[23]||=function(e){return a.onTimePickerElementMouseDown(e,1,1)},onMouseup:t[24]||=function(e){return a.onTimePickerElementMouseUp(e)},onKeydown:[a.onContainerButtonKeydown,t[26]||=ce(function(e){return a.onTimePickerElementMouseDown(e,1,1)},[`enter`]),t[27]||=ce(function(e){return a.onTimePickerElementMouseDown(e,1,1)},[`space`])],onMouseleave:t[25]||=function(e){return a.onTimePickerElementMouseLeave()},onKeyup:[t[28]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`enter`]),t[29]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`space`])]},e.timepickerButtonProps,{pt:e.ptm(`pcIncrementButton`),"data-pc-group-section":`timepickerbutton`}),{icon:ue(function(t){return[m(e.$slots,`incrementicon`,{},function(){return[(q(),be(l(e.incrementIcon?`span`:`ChevronUpIcon`),U({class:[e.incrementIcon,t.class]},e.ptm(`pcIncrementButton`).icon,{"data-pc-group-section":`timepickerlabel`}),null,16,[`class`]))]})]}),_:3},16,[`class`,`aria-label`,`disabled`,`unstyled`,`onKeydown`,`pt`])]}),V(`span`,U(e.ptm(`minute`),{"data-pc-group-section":`timepickerlabel`}),Oe(a.formattedCurrentMinute),17),m(e.$slots,`minutedecrementbutton`,{callbacks:a.minuteDecrementCallbacks},function(){return[Fe(u,U({class:e.cx(`pcDecrementButton`),"aria-label":e.$primevue.config.locale.prevMinute,disabled:e.disabled,unstyled:e.unstyled,onMousedown:t[30]||=function(e){return a.onTimePickerElementMouseDown(e,1,-1)},onMouseup:t[31]||=function(e){return a.onTimePickerElementMouseUp(e)},onKeydown:[a.onContainerButtonKeydown,t[33]||=ce(function(e){return a.onTimePickerElementMouseDown(e,1,-1)},[`enter`]),t[34]||=ce(function(e){return a.onTimePickerElementMouseDown(e,1,-1)},[`space`])],onMouseleave:t[32]||=function(e){return a.onTimePickerElementMouseLeave()},onKeyup:[t[35]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`enter`]),t[36]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`space`])]},e.timepickerButtonProps,{pt:e.ptm(`pcDecrementButton`),"data-pc-group-section":`timepickerbutton`}),{icon:ue(function(t){return[m(e.$slots,`decrementicon`,{},function(){return[(q(),be(l(e.decrementIcon?`span`:`ChevronDownIcon`),U({class:[e.decrementIcon,t.class]},e.ptm(`pcDecrementButton`).icon,{"data-pc-group-section":`timepickerlabel`}),null,16,[`class`]))]})]}),_:3},16,[`class`,`aria-label`,`disabled`,`unstyled`,`onKeydown`,`pt`])]})],16),e.showSeconds?(q(),c(`div`,U({key:0,class:e.cx(`separatorContainer`)},e.ptm(`separatorContainer`),{"data-pc-group-section":`timepickerContainer`}),[V(`span`,U(e.ptm(`separator`),{"data-pc-group-section":`timepickerlabel`}),Oe(e.timeSeparator),17)],16)):R(``,!0),e.showSeconds?(q(),c(`div`,U({key:1,class:e.cx(`secondPicker`)},e.ptm(`secondPicker`),{"data-pc-group-section":`timepickerContainer`}),[m(e.$slots,`secondincrementbutton`,{callbacks:a.secondIncrementCallbacks},function(){return[Fe(u,U({class:e.cx(`pcIncrementButton`),"aria-label":e.$primevue.config.locale.nextSecond,disabled:e.disabled,unstyled:e.unstyled,onMousedown:t[37]||=function(e){return a.onTimePickerElementMouseDown(e,2,1)},onMouseup:t[38]||=function(e){return a.onTimePickerElementMouseUp(e)},onKeydown:[a.onContainerButtonKeydown,t[40]||=ce(function(e){return a.onTimePickerElementMouseDown(e,2,1)},[`enter`]),t[41]||=ce(function(e){return a.onTimePickerElementMouseDown(e,2,1)},[`space`])],onMouseleave:t[39]||=function(e){return a.onTimePickerElementMouseLeave()},onKeyup:[t[42]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`enter`]),t[43]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`space`])]},e.timepickerButtonProps,{pt:e.ptm(`pcIncrementButton`),"data-pc-group-section":`timepickerbutton`}),{icon:ue(function(t){return[m(e.$slots,`incrementicon`,{},function(){return[(q(),be(l(e.incrementIcon?`span`:`ChevronUpIcon`),U({class:[e.incrementIcon,t.class]},e.ptm(`pcIncrementButton`).icon,{"data-pc-group-section":`timepickerlabel`}),null,16,[`class`]))]})]}),_:3},16,[`class`,`aria-label`,`disabled`,`unstyled`,`onKeydown`,`pt`])]}),V(`span`,U(e.ptm(`second`),{"data-pc-group-section":`timepickerlabel`}),Oe(a.formattedCurrentSecond),17),m(e.$slots,`seconddecrementbutton`,{callbacks:a.secondDecrementCallbacks},function(){return[Fe(u,U({class:e.cx(`pcDecrementButton`),"aria-label":e.$primevue.config.locale.prevSecond,disabled:e.disabled,unstyled:e.unstyled,onMousedown:t[44]||=function(e){return a.onTimePickerElementMouseDown(e,2,-1)},onMouseup:t[45]||=function(e){return a.onTimePickerElementMouseUp(e)},onKeydown:[a.onContainerButtonKeydown,t[47]||=ce(function(e){return a.onTimePickerElementMouseDown(e,2,-1)},[`enter`]),t[48]||=ce(function(e){return a.onTimePickerElementMouseDown(e,2,-1)},[`space`])],onMouseleave:t[46]||=function(e){return a.onTimePickerElementMouseLeave()},onKeyup:[t[49]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`enter`]),t[50]||=ce(function(e){return a.onTimePickerElementMouseUp(e)},[`space`])]},e.timepickerButtonProps,{pt:e.ptm(`pcDecrementButton`),"data-pc-group-section":`timepickerbutton`}),{icon:ue(function(t){return[m(e.$slots,`decrementicon`,{},function(){return[(q(),be(l(e.decrementIcon?`span`:`ChevronDownIcon`),U({class:[e.decrementIcon,t.class]},e.ptm(`pcDecrementButton`).icon,{"data-pc-group-section":`timepickerlabel`}),null,16,[`class`]))]})]}),_:3},16,[`class`,`aria-label`,`disabled`,`unstyled`,`onKeydown`,`pt`])]})],16)):R(``,!0),e.hourFormat==`12`?(q(),c(`div`,U({key:2,class:e.cx(`separatorContainer`)},e.ptm(`separatorContainer`),{"data-pc-group-section":`timepickerContainer`}),[V(`span`,U(e.ptm(`separator`),{"data-pc-group-section":`timepickerlabel`}),Oe(e.timeSeparator),17)],16)):R(``,!0),e.hourFormat==`12`?(q(),c(`div`,U({key:3,class:e.cx(`ampmPicker`)},e.ptm(`ampmPicker`)),[m(e.$slots,`ampmincrementbutton`,{toggleCallback:function(e){return a.toggleAMPM(e)},keydownCallback:function(e){return a.onContainerButtonKeydown(e)}},function(){return[Fe(u,U({class:e.cx(`pcIncrementButton`),"aria-label":e.$primevue.config.locale.am,disabled:e.disabled,unstyled:e.unstyled,onClick:t[51]||=function(e){return a.toggleAMPM(e)},onKeydown:a.onContainerButtonKeydown},e.timepickerButtonProps,{pt:e.ptm(`pcIncrementButton`),"data-pc-group-section":`timepickerbutton`}),{icon:ue(function(t){return[m(e.$slots,`incrementicon`,{class:Te(e.cx(`incrementIcon`))},function(){return[(q(),be(l(e.incrementIcon?`span`:`ChevronUpIcon`),U({class:[e.cx(`incrementIcon`),t.class]},e.ptm(`pcIncrementButton`).icon,{"data-pc-group-section":`timepickerlabel`}),null,16,[`class`]))]})]}),_:3},16,[`class`,`aria-label`,`disabled`,`unstyled`,`onKeydown`,`pt`])]}),V(`span`,U(e.ptm(`ampm`),{"data-pc-group-section":`timepickerlabel`}),Oe(i.pm?e.$primevue.config.locale.pm:e.$primevue.config.locale.am),17),m(e.$slots,`ampmdecrementbutton`,{toggleCallback:function(e){return a.toggleAMPM(e)},keydownCallback:function(e){return a.onContainerButtonKeydown(e)}},function(){return[Fe(u,U({class:e.cx(`pcDecrementButton`),"aria-label":e.$primevue.config.locale.pm,disabled:e.disabled,onClick:t[52]||=function(e){return a.toggleAMPM(e)},onKeydown:a.onContainerButtonKeydown},e.timepickerButtonProps,{pt:e.ptm(`pcDecrementButton`),"data-pc-group-section":`timepickerbutton`}),{icon:ue(function(t){return[m(e.$slots,`decrementicon`,{class:Te(e.cx(`decrementIcon`))},function(){return[(q(),be(l(e.decrementIcon?`span`:`ChevronDownIcon`),U({class:[e.cx(`decrementIcon`),t.class]},e.ptm(`pcDecrementButton`).icon,{"data-pc-group-section":`timepickerlabel`}),null,16,[`class`]))]})]}),_:3},16,[`class`,`aria-label`,`disabled`,`onKeydown`,`pt`])]})],16)):R(``,!0)],16,jS)):R(``,!0),e.showButtonBar?(q(),c(`div`,U({key:2,class:e.cx(`buttonbar`)},e.ptm(`buttonbar`)),[m(e.$slots,`buttonbar`,{todayCallback:function(e){return a.onTodayButtonClick(e)},clearCallback:function(e){return a.onClearButtonClick(e)}},function(){return[m(e.$slots,`todaybutton`,{actionCallback:function(e){return a.onTodayButtonClick(e)},keydownCallback:function(e){return a.onContainerButtonKeydown(e)}},function(){return[Fe(u,U({label:a.todayLabel,onClick:t[53]||=function(e){return a.onTodayButtonClick(e)},class:e.cx(`pcTodayButton`),unstyled:e.unstyled,onKeydown:a.onContainerButtonKeydown},e.todayButtonProps,{pt:e.ptm(`pcTodayButton`),"data-pc-group-section":`button`}),null,16,[`label`,`class`,`unstyled`,`onKeydown`,`pt`])]}),m(e.$slots,`clearbutton`,{actionCallback:function(e){return a.onClearButtonClick(e)},keydownCallback:function(e){return a.onContainerButtonKeydown(e)}},function(){return[Fe(u,U({label:a.clearLabel,onClick:t[54]||=function(e){return a.onClearButtonClick(e)},class:e.cx(`pcClearButton`),unstyled:e.unstyled,onKeydown:a.onContainerButtonKeydown},e.clearButtonProps,{pt:e.ptm(`pcClearButton`),"data-pc-group-section":`button`}),null,16,[`label`,`class`,`unstyled`,`onKeydown`,`pt`])]})]})],16)):R(``,!0),m(e.$slots,`footer`)],16,yS)):R(``,!0)]}),_:3},16,[`onAfterEnter`,`onAfterLeave`,`onLeave`])]}),_:3},8,[`appendTo`,`disabled`])],16,gS)}hS.render=MS;var NS=Fm.extend({name:`popover`,style:`
|
|
1654
|
-
.p-popover {
|
|
1655
|
-
margin-block-start: dt('popover.gutter');
|
|
1656
|
-
background: dt('popover.background');
|
|
1657
|
-
color: dt('popover.color');
|
|
1658
|
-
border: 1px solid dt('popover.border.color');
|
|
1659
|
-
border-radius: dt('popover.border.radius');
|
|
1660
|
-
box-shadow: dt('popover.shadow');
|
|
1661
|
-
will-change: transform;
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
.p-popover-content {
|
|
1665
|
-
padding: dt('popover.content.padding');
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
.p-popover-flipped {
|
|
1669
|
-
margin-block-start: calc(dt('popover.gutter') * -1);
|
|
1670
|
-
margin-block-end: dt('popover.gutter');
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
.p-popover:after,
|
|
1674
|
-
.p-popover:before {
|
|
1675
|
-
bottom: 100%;
|
|
1676
|
-
left: calc(dt('popover.arrow.offset') + dt('popover.arrow.left'));
|
|
1677
|
-
content: ' ';
|
|
1678
|
-
height: 0;
|
|
1679
|
-
width: 0;
|
|
1680
|
-
position: absolute;
|
|
1681
|
-
pointer-events: none;
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
.p-popover:after {
|
|
1685
|
-
border-width: calc(dt('popover.gutter') - 2px);
|
|
1686
|
-
margin-left: calc(-1 * (dt('popover.gutter') - 2px));
|
|
1687
|
-
border-style: solid;
|
|
1688
|
-
border-color: transparent;
|
|
1689
|
-
border-bottom-color: dt('popover.background');
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
.p-popover:before {
|
|
1693
|
-
border-width: dt('popover.gutter');
|
|
1694
|
-
margin-left: calc(-1 * dt('popover.gutter'));
|
|
1695
|
-
border-style: solid;
|
|
1696
|
-
border-color: transparent;
|
|
1697
|
-
border-bottom-color: dt('popover.border.color');
|
|
1698
|
-
}
|
|
1699
|
-
|
|
1700
|
-
.p-popover-flipped:after,
|
|
1701
|
-
.p-popover-flipped:before {
|
|
1702
|
-
bottom: auto;
|
|
1703
|
-
top: 100%;
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
.p-popover.p-popover-flipped:after {
|
|
1707
|
-
border-bottom-color: transparent;
|
|
1708
|
-
border-top-color: dt('popover.background');
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
.p-popover.p-popover-flipped:before {
|
|
1712
|
-
border-bottom-color: transparent;
|
|
1713
|
-
border-top-color: dt('popover.border.color');
|
|
1714
|
-
}
|
|
1715
|
-
`,classes:{root:`p-popover p-component`,content:`p-popover-content`}}),PS={name:`Popover`,extends:{name:`BasePopover`,extends:Qm,props:{dismissable:{type:Boolean,default:!0},appendTo:{type:[String,Object],default:`body`},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},breakpoints:{type:Object,default:null},closeOnEscape:{type:Boolean,default:!0}},style:NS,provide:function(){return{$pcPopover:this,$parentInstance:this}}},inheritAttrs:!1,emits:[`show`,`hide`],data:function(){return{visible:!1}},watch:{dismissable:{immediate:!0,handler:function(e){e?this.bindOutsideClickListener():this.unbindOutsideClickListener()}}},selfClick:!1,target:null,eventTarget:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,styleElement:null,overlayEventListener:null,documentKeydownListener:null,contentResizeObserver:null,beforeUnmount:function(){this.dismissable&&this.unbindOutsideClickListener(),this.scrollHandler&&=(this.scrollHandler.destroy(),null),this.destroyStyle(),this.unbindResizeListener(),this.unbindContentResizeListener(),this.target=null,this.container&&this.autoZIndex&&Sp.clear(this.container),this.overlayEventListener&&=(tS.off(`overlay-click`,this.overlayEventListener),null),this.container=null},mounted:function(){this.breakpoints&&this.createStyle()},methods:{toggle:function(e,t){this.visible?this.hide():this.show(e,t)},show:function(e,t){this.visible=!0,this.eventTarget=e.currentTarget,this.target=t||e.currentTarget},hide:function(){this.visible=!1},onContentClick:function(){this.selfClick=!0},onEnter:function(e){var t=this;Xd(e,{position:`absolute`,top:`0`}),this.alignOverlay(),this.dismissable&&this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&Sp.set(`overlay`,e,this.baseZIndex||this.$primevue.config.zIndex.overlay),this.overlayEventListener=function(e){t.container.contains(e.target)&&(t.selfClick=!0)},this.bindContentResizeListener(),this.focus(),tS.on(`overlay-click`,this.overlayEventListener),this.$emit(`show`),this.closeOnEscape&&this.bindDocumentKeyDownListener()},onLeave:function(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.unbindDocumentKeyDownListener(),this.unbindContentResizeListener(),tS.off(`overlay-click`,this.overlayEventListener),this.overlayEventListener=null,this.$emit(`hide`)},onAfterLeave:function(e){this.autoZIndex&&Sp.clear(e)},alignOverlay:function(){Yd(this.container,this.target,!1);var e=yf(this.container),t=yf(this.target),n=0;e.left<t.left&&(n=t.left-e.left),this.container.style.setProperty(Jp(`popover.arrow.left`).name,`${n}px`),e.top<t.top&&(this.container.setAttribute(`data-p-popover-flipped`,`true`),!this.isUnstyled&&Fd(this.container,`p-popover-flipped`))},onContentKeydown:function(e){e.code===`Escape`&&this.closeOnEscape&&(this.hide(),lf(this.target))},onButtonKeydown:function(e){switch(e.code){case`ArrowDown`:case`ArrowUp`:case`ArrowLeft`:case`ArrowRight`:e.preventDefault()}},focus:function(){var e=this.container.querySelector(`[autofocus]`);e&&e.focus()},onKeyDown:function(e){e.code===`Escape`&&this.closeOnEscape&&(this.visible=!1)},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeyDown.bind(this),window.document.addEventListener(`keydown`,this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&=(window.document.removeEventListener(`keydown`,this.documentKeydownListener),null)},bindOutsideClickListener:function(){var e=this;!this.outsideClickListener&&Af()&&(this.outsideClickListener=function(t){e.visible&&!e.selfClick&&!e.isTargetClicked(t)&&(e.visible=!1),e.selfClick=!1},document.addEventListener(`click`,this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener(`click`,this.outsideClickListener),this.outsideClickListener=null,this.selfClick=!1)},bindScrollListener:function(){var e=this;this.scrollHandler||=new Sg(this.target,function(){e.visible&&=!1}),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.visible&&!Nf()&&(e.visible=!1)},window.addEventListener(`resize`,this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&=(window.removeEventListener(`resize`,this.resizeListener),null)},bindContentResizeListener:function(){var e=this;this.contentResizeObserver||(this.contentResizeObserver=new ResizeObserver(function(){e.visible&&e.alignOverlay()}),this.contentResizeObserver.observe(this.container))},unbindContentResizeListener:function(){this.contentResizeObserver&&=(this.contentResizeObserver.disconnect(),null)},isTargetClicked:function(e){return this.eventTarget&&(this.eventTarget===e.target||this.eventTarget.contains(e.target))},containerRef:function(e){this.container=e},createStyle:function(){if(!this.styleElement&&!this.isUnstyled){var e;this.styleElement=document.createElement(`style`),this.styleElement.type=`text/css`,Pf(this.styleElement,`nonce`,(e=this.$primevue)==null||(e=e.config)==null||(e=e.csp)==null?void 0:e.nonce),document.head.appendChild(this.styleElement);var t=``;for(var n in this.breakpoints)t+=`
|
|
1716
|
-
@media screen and (max-width: ${n}) {
|
|
1717
|
-
.p-popover[${this.$attrSelector}] {
|
|
1718
|
-
width: ${this.breakpoints[n]} !important;
|
|
1719
|
-
}
|
|
1720
|
-
}
|
|
1721
|
-
`;this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&=(document.head.removeChild(this.styleElement),null)},onOverlayClick:function(e){tS.emit(`overlay-click`,{originalEvent:e,target:this.target})}},directives:{focustrap:e_,ripple:Xh},components:{Portal:t_}},FS=[`aria-modal`];function IS(e,t,n,r,i,a){var o=F(`Portal`),s=ze(`focustrap`);return q(),be(o,{appendTo:e.appendTo},{default:ue(function(){return[Fe(B,U({name:`p-anchored-overlay`,onEnter:a.onEnter,onLeave:a.onLeave,onAfterLeave:a.onAfterLeave},e.ptm(`transition`)),{default:ue(function(){return[i.visible?C((q(),c(`div`,U({key:0,ref:a.containerRef,role:`dialog`,"aria-modal":i.visible,onClick:t[3]||=function(){return a.onOverlayClick&&a.onOverlayClick.apply(a,arguments)},class:e.cx(`root`)},e.ptmi(`root`)),[e.$slots.container?m(e.$slots,`container`,{key:0,closeCallback:a.hide,keydownCallback:function(e){return a.onButtonKeydown(e)}}):(q(),c(`div`,U({key:1,class:e.cx(`content`),onClick:t[0]||=function(){return a.onContentClick&&a.onContentClick.apply(a,arguments)},onMousedown:t[1]||=function(){return a.onContentClick&&a.onContentClick.apply(a,arguments)},onKeydown:t[2]||=function(){return a.onContentKeydown&&a.onContentKeydown.apply(a,arguments)}},e.ptm(`content`)),[m(e.$slots,`default`)],16))],16,FS)),[[s]]):R(``,!0)]}),_:3},16,[`onEnter`,`onLeave`,`onAfterLeave`])]}),_:3},8,[`appendTo`])}PS.render=IS;var LS=Fm.extend({name:`togglebutton`,style:`
|
|
1722
|
-
.p-togglebutton {
|
|
1723
|
-
display: inline-flex;
|
|
1724
|
-
cursor: pointer;
|
|
1725
|
-
user-select: none;
|
|
1726
|
-
overflow: hidden;
|
|
1727
|
-
position: relative;
|
|
1728
|
-
color: dt('togglebutton.color');
|
|
1729
|
-
background: dt('togglebutton.background');
|
|
1730
|
-
border: 1px solid dt('togglebutton.border.color');
|
|
1731
|
-
padding: dt('togglebutton.padding');
|
|
1732
|
-
font-size: 1rem;
|
|
1733
|
-
font-family: inherit;
|
|
1734
|
-
font-feature-settings: inherit;
|
|
1735
|
-
transition:
|
|
1736
|
-
background dt('togglebutton.transition.duration'),
|
|
1737
|
-
color dt('togglebutton.transition.duration'),
|
|
1738
|
-
border-color dt('togglebutton.transition.duration'),
|
|
1739
|
-
outline-color dt('togglebutton.transition.duration'),
|
|
1740
|
-
box-shadow dt('togglebutton.transition.duration');
|
|
1741
|
-
border-radius: dt('togglebutton.border.radius');
|
|
1742
|
-
outline-color: transparent;
|
|
1743
|
-
font-weight: dt('togglebutton.font.weight');
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
.p-togglebutton-content {
|
|
1747
|
-
display: inline-flex;
|
|
1748
|
-
flex: 1 1 auto;
|
|
1749
|
-
align-items: center;
|
|
1750
|
-
justify-content: center;
|
|
1751
|
-
gap: dt('togglebutton.gap');
|
|
1752
|
-
padding: dt('togglebutton.content.padding');
|
|
1753
|
-
background: transparent;
|
|
1754
|
-
border-radius: dt('togglebutton.content.border.radius');
|
|
1755
|
-
transition:
|
|
1756
|
-
background dt('togglebutton.transition.duration'),
|
|
1757
|
-
color dt('togglebutton.transition.duration'),
|
|
1758
|
-
border-color dt('togglebutton.transition.duration'),
|
|
1759
|
-
outline-color dt('togglebutton.transition.duration'),
|
|
1760
|
-
box-shadow dt('togglebutton.transition.duration');
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
.p-togglebutton:not(:disabled):not(.p-togglebutton-checked):hover {
|
|
1764
|
-
background: dt('togglebutton.hover.background');
|
|
1765
|
-
color: dt('togglebutton.hover.color');
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
.p-togglebutton.p-togglebutton-checked {
|
|
1769
|
-
background: dt('togglebutton.checked.background');
|
|
1770
|
-
border-color: dt('togglebutton.checked.border.color');
|
|
1771
|
-
color: dt('togglebutton.checked.color');
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
.p-togglebutton-checked .p-togglebutton-content {
|
|
1775
|
-
background: dt('togglebutton.content.checked.background');
|
|
1776
|
-
box-shadow: dt('togglebutton.content.checked.shadow');
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
.p-togglebutton:focus-visible {
|
|
1780
|
-
box-shadow: dt('togglebutton.focus.ring.shadow');
|
|
1781
|
-
outline: dt('togglebutton.focus.ring.width') dt('togglebutton.focus.ring.style') dt('togglebutton.focus.ring.color');
|
|
1782
|
-
outline-offset: dt('togglebutton.focus.ring.offset');
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
.p-togglebutton.p-invalid {
|
|
1786
|
-
border-color: dt('togglebutton.invalid.border.color');
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
.p-togglebutton:disabled {
|
|
1790
|
-
opacity: 1;
|
|
1791
|
-
cursor: default;
|
|
1792
|
-
background: dt('togglebutton.disabled.background');
|
|
1793
|
-
border-color: dt('togglebutton.disabled.border.color');
|
|
1794
|
-
color: dt('togglebutton.disabled.color');
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
.p-togglebutton-label,
|
|
1798
|
-
.p-togglebutton-icon {
|
|
1799
|
-
position: relative;
|
|
1800
|
-
transition: none;
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
.p-togglebutton-icon {
|
|
1804
|
-
color: dt('togglebutton.icon.color');
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
.p-togglebutton:not(:disabled):not(.p-togglebutton-checked):hover .p-togglebutton-icon {
|
|
1808
|
-
color: dt('togglebutton.icon.hover.color');
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
.p-togglebutton.p-togglebutton-checked .p-togglebutton-icon {
|
|
1812
|
-
color: dt('togglebutton.icon.checked.color');
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
.p-togglebutton:disabled .p-togglebutton-icon {
|
|
1816
|
-
color: dt('togglebutton.icon.disabled.color');
|
|
1817
|
-
}
|
|
1818
|
-
|
|
1819
|
-
.p-togglebutton-sm {
|
|
1820
|
-
padding: dt('togglebutton.sm.padding');
|
|
1821
|
-
font-size: dt('togglebutton.sm.font.size');
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
.p-togglebutton-sm .p-togglebutton-content {
|
|
1825
|
-
padding: dt('togglebutton.content.sm.padding');
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
.p-togglebutton-lg {
|
|
1829
|
-
padding: dt('togglebutton.lg.padding');
|
|
1830
|
-
font-size: dt('togglebutton.lg.font.size');
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
.p-togglebutton-lg .p-togglebutton-content {
|
|
1834
|
-
padding: dt('togglebutton.content.lg.padding');
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
.p-togglebutton-fluid {
|
|
1838
|
-
width: 100%;
|
|
1839
|
-
}
|
|
1840
|
-
`,classes:{root:function(e){var t=e.instance,n=e.props;return[`p-togglebutton p-component`,{"p-togglebutton-checked":t.active,"p-invalid":t.$invalid,"p-togglebutton-fluid":n.fluid,"p-togglebutton-sm p-inputfield-sm":n.size===`small`,"p-togglebutton-lg p-inputfield-lg":n.size===`large`}]},content:`p-togglebutton-content`,icon:`p-togglebutton-icon`,label:`p-togglebutton-label`}}),RS={name:`BaseToggleButton`,extends:Gx,props:{onIcon:String,offIcon:String,onLabel:{type:String,default:`Yes`},offLabel:{type:String,default:`No`},readonly:{type:Boolean,default:!1},tabindex:{type:Number,default:null},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null},size:{type:String,default:null},fluid:{type:Boolean,default:null}},style:LS,provide:function(){return{$pcToggleButton:this,$parentInstance:this}}};function zS(e){"@babel/helpers - typeof";return zS=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},zS(e)}function BS(e,t,n){return(t=VS(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function VS(e){var t=HS(e,`string`);return zS(t)==`symbol`?t:t+``}function HS(e,t){if(zS(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(zS(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var US={name:`ToggleButton`,extends:RS,inheritAttrs:!1,emits:[`change`],methods:{getPTOptions:function(e){return(e===`root`?this.ptmi:this.ptm)(e,{context:{active:this.active,disabled:this.disabled}})},onChange:function(e){!this.disabled&&!this.readonly&&(this.writeValue(!this.d_value,e),this.$emit(`change`,e))},onBlur:function(e){var t,n;(t=(n=this.formField).onBlur)==null||t.call(n,e)}},computed:{active:function(){return this.d_value===!0},hasLabel:function(){return qf(this.onLabel)&&qf(this.offLabel)},label:function(){return this.hasLabel?this.d_value?this.onLabel:this.offLabel:`\xA0`},dataP:function(){return Nd(BS({checked:this.active,invalid:this.$invalid},this.size,this.size))}},directives:{ripple:Xh}},WS=[`tabindex`,`disabled`,`aria-pressed`,`aria-label`,`aria-labelledby`,`data-p-checked`,`data-p-disabled`,`data-p`],GS=[`data-p`];function KS(e,t,n,r,i,a){var o=ze(`ripple`);return C((q(),c(`button`,U({type:`button`,class:e.cx(`root`),tabindex:e.tabindex,disabled:e.disabled,"aria-pressed":e.d_value,onClick:t[0]||=function(){return a.onChange&&a.onChange.apply(a,arguments)},onBlur:t[1]||=function(){return a.onBlur&&a.onBlur.apply(a,arguments)}},a.getPTOptions(`root`),{"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"data-p-checked":a.active,"data-p-disabled":e.disabled,"data-p":a.dataP}),[V(`span`,U({class:e.cx(`content`)},a.getPTOptions(`content`),{"data-p":a.dataP}),[m(e.$slots,`default`,{},function(){return[m(e.$slots,`icon`,{value:e.d_value,class:Te(e.cx(`icon`))},function(){return[e.onIcon||e.offIcon?(q(),c(`span`,U({key:0,class:[e.cx(`icon`),e.d_value?e.onIcon:e.offIcon]},a.getPTOptions(`icon`)),null,16)):R(``,!0)]}),V(`span`,U({class:e.cx(`label`)},a.getPTOptions(`label`)),Oe(a.label),17)]})],16,GS)],16,WS)),[[o]])}US.render=KS;var qS=Fm.extend({name:`selectbutton`,style:`
|
|
1841
|
-
.p-selectbutton {
|
|
1842
|
-
display: inline-flex;
|
|
1843
|
-
user-select: none;
|
|
1844
|
-
vertical-align: bottom;
|
|
1845
|
-
outline-color: transparent;
|
|
1846
|
-
border-radius: dt('selectbutton.border.radius');
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
.p-selectbutton .p-togglebutton {
|
|
1850
|
-
border-radius: 0;
|
|
1851
|
-
border-width: 1px 1px 1px 0;
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
.p-selectbutton .p-togglebutton:focus-visible {
|
|
1855
|
-
position: relative;
|
|
1856
|
-
z-index: 1;
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
.p-selectbutton .p-togglebutton:first-child {
|
|
1860
|
-
border-inline-start-width: 1px;
|
|
1861
|
-
border-start-start-radius: dt('selectbutton.border.radius');
|
|
1862
|
-
border-end-start-radius: dt('selectbutton.border.radius');
|
|
1863
|
-
}
|
|
1864
|
-
|
|
1865
|
-
.p-selectbutton .p-togglebutton:last-child {
|
|
1866
|
-
border-start-end-radius: dt('selectbutton.border.radius');
|
|
1867
|
-
border-end-end-radius: dt('selectbutton.border.radius');
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
|
-
.p-selectbutton.p-invalid {
|
|
1871
|
-
outline: 1px solid dt('selectbutton.invalid.border.color');
|
|
1872
|
-
outline-offset: 0;
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
.p-selectbutton-fluid {
|
|
1876
|
-
width: 100%;
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
.p-selectbutton-fluid .p-togglebutton {
|
|
1880
|
-
flex: 1 1 0;
|
|
1881
|
-
}
|
|
1882
|
-
`,classes:{root:function(e){var t=e.props;return[`p-selectbutton p-component`,{"p-invalid":e.instance.$invalid,"p-selectbutton-fluid":t.fluid}]}}}),JS={name:`BaseSelectButton`,extends:Gx,props:{options:Array,optionLabel:null,optionValue:null,optionDisabled:null,multiple:Boolean,allowEmpty:{type:Boolean,default:!0},dataKey:null,ariaLabelledby:{type:String,default:null},size:{type:String,default:null},fluid:{type:Boolean,default:null}},style:qS,provide:function(){return{$pcSelectButton:this,$parentInstance:this}}};function YS(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=QS(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1883
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function XS(e){return eC(e)||$S(e)||QS(e)||ZS()}function ZS(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1884
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QS(e,t){if(e){if(typeof e==`string`)return tC(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tC(e,t):void 0}}function $S(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function eC(e){if(Array.isArray(e))return tC(e)}function tC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var nC={name:`SelectButton`,extends:JS,inheritAttrs:!1,emits:[`change`],methods:{getOptionLabel:function(e){return this.optionLabel?Jf(e,this.optionLabel):e},getOptionValue:function(e){return this.optionValue?Jf(e,this.optionValue):e},getOptionRenderKey:function(e){return this.dataKey?Jf(e,this.dataKey):this.getOptionLabel(e)},isOptionDisabled:function(e){return this.optionDisabled?Jf(e,this.optionDisabled):!1},isOptionReadonly:function(e){if(this.allowEmpty)return!1;var t=this.isSelected(e);return this.multiple?t&&this.d_value.length===1:t},onOptionSelect:function(e,t,n){var r=this;if(!(this.disabled||this.isOptionDisabled(t)||this.isOptionReadonly(t))){var i=this.isSelected(t),a=this.getOptionValue(t),o;if(this.multiple)if(i){if(o=this.d_value.filter(function(e){return!Yf(e,a,r.equalityKey)}),!this.allowEmpty&&o.length===0)return}else o=this.d_value?[].concat(XS(this.d_value),[a]):[a];else{if(i&&!this.allowEmpty)return;o=i?null:a}this.writeValue(o,e),this.$emit(`change`,{originalEvent:e,value:o})}},isSelected:function(e){var t=!1,n=this.getOptionValue(e);if(this.multiple){if(this.d_value){var r=YS(this.d_value),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;if(Yf(a,n,this.equalityKey)){t=!0;break}}}catch(e){r.e(e)}finally{r.f()}}}else t=Yf(this.d_value,n,this.equalityKey);return t}},computed:{equalityKey:function(){return this.optionValue?null:this.dataKey},dataP:function(){return Nd({invalid:this.$invalid})}},directives:{ripple:Xh},components:{ToggleButton:US}},rC=[`aria-labelledby`,`data-p`];function iC(e,t,n,r,i,a){var o=F(`ToggleButton`);return q(),c(`div`,U({class:e.cx(`root`),role:`group`,"aria-labelledby":e.ariaLabelledby},e.ptmi(`root`),{"data-p":a.dataP}),[(q(!0),c(x,null,g(e.options,function(t,n){return q(),be(o,{key:a.getOptionRenderKey(t),modelValue:a.isSelected(t),onLabel:a.getOptionLabel(t),offLabel:a.getOptionLabel(t),disabled:e.disabled||a.isOptionDisabled(t),unstyled:e.unstyled,size:e.size,readonly:a.isOptionReadonly(t),onChange:function(e){return a.onOptionSelect(e,t,n)},pt:e.ptm(`pcToggleButton`)},et({_:2},[e.$slots.option?{name:`default`,fn:ue(function(){return[m(e.$slots,`option`,{option:t,index:n},function(){return[V(`span`,U({ref_for:!0},e.ptm(`pcToggleButton`).label),Oe(a.getOptionLabel(t)),17)]})]}),key:`0`}:void 0]),1032,[`modelValue`,`onLabel`,`offLabel`,`disabled`,`unstyled`,`size`,`readonly`,`onChange`,`pt`])}),128))],16,rC)}nC.render=iC;var aC=Fm.extend({name:`slider`,style:`
|
|
1885
|
-
.p-slider {
|
|
1886
|
-
display: block;
|
|
1887
|
-
position: relative;
|
|
1888
|
-
background: dt('slider.track.background');
|
|
1889
|
-
border-radius: dt('slider.track.border.radius');
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
.p-slider-handle {
|
|
1893
|
-
cursor: grab;
|
|
1894
|
-
touch-action: none;
|
|
1895
|
-
user-select: none;
|
|
1896
|
-
display: flex;
|
|
1897
|
-
justify-content: center;
|
|
1898
|
-
align-items: center;
|
|
1899
|
-
height: dt('slider.handle.height');
|
|
1900
|
-
width: dt('slider.handle.width');
|
|
1901
|
-
background: dt('slider.handle.background');
|
|
1902
|
-
border-radius: dt('slider.handle.border.radius');
|
|
1903
|
-
transition:
|
|
1904
|
-
background dt('slider.transition.duration'),
|
|
1905
|
-
color dt('slider.transition.duration'),
|
|
1906
|
-
border-color dt('slider.transition.duration'),
|
|
1907
|
-
box-shadow dt('slider.transition.duration'),
|
|
1908
|
-
outline-color dt('slider.transition.duration');
|
|
1909
|
-
outline-color: transparent;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
.p-slider-handle::before {
|
|
1913
|
-
content: '';
|
|
1914
|
-
width: dt('slider.handle.content.width');
|
|
1915
|
-
height: dt('slider.handle.content.height');
|
|
1916
|
-
display: block;
|
|
1917
|
-
background: dt('slider.handle.content.background');
|
|
1918
|
-
border-radius: dt('slider.handle.content.border.radius');
|
|
1919
|
-
box-shadow: dt('slider.handle.content.shadow');
|
|
1920
|
-
transition: background dt('slider.transition.duration');
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
.p-slider:not(.p-disabled) .p-slider-handle:hover {
|
|
1924
|
-
background: dt('slider.handle.hover.background');
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
|
-
.p-slider:not(.p-disabled) .p-slider-handle:hover::before {
|
|
1928
|
-
background: dt('slider.handle.content.hover.background');
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
.p-slider-handle:focus-visible {
|
|
1932
|
-
box-shadow: dt('slider.handle.focus.ring.shadow');
|
|
1933
|
-
outline: dt('slider.handle.focus.ring.width') dt('slider.handle.focus.ring.style') dt('slider.handle.focus.ring.color');
|
|
1934
|
-
outline-offset: dt('slider.handle.focus.ring.offset');
|
|
1935
|
-
}
|
|
1936
|
-
|
|
1937
|
-
.p-slider-range {
|
|
1938
|
-
display: block;
|
|
1939
|
-
background: dt('slider.range.background');
|
|
1940
|
-
border-radius: dt('slider.track.border.radius');
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
|
-
.p-slider.p-slider-horizontal {
|
|
1944
|
-
height: dt('slider.track.size');
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
.p-slider-horizontal .p-slider-range {
|
|
1948
|
-
inset-block-start: 0;
|
|
1949
|
-
inset-inline-start: 0;
|
|
1950
|
-
height: 100%;
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
|
-
.p-slider-horizontal .p-slider-handle {
|
|
1954
|
-
inset-block-start: 50%;
|
|
1955
|
-
margin-block-start: calc(-1 * calc(dt('slider.handle.height') / 2));
|
|
1956
|
-
margin-inline-start: calc(-1 * calc(dt('slider.handle.width') / 2));
|
|
1957
|
-
}
|
|
1958
|
-
|
|
1959
|
-
.p-slider-vertical {
|
|
1960
|
-
min-height: 100px;
|
|
1961
|
-
width: dt('slider.track.size');
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
.p-slider-vertical .p-slider-handle {
|
|
1965
|
-
inset-inline-start: 50%;
|
|
1966
|
-
margin-inline-start: calc(-1 * calc(dt('slider.handle.width') / 2));
|
|
1967
|
-
margin-block-end: calc(-1 * calc(dt('slider.handle.height') / 2));
|
|
1968
|
-
}
|
|
1969
|
-
|
|
1970
|
-
.p-slider-vertical .p-slider-range {
|
|
1971
|
-
inset-block-end: 0;
|
|
1972
|
-
inset-inline-start: 0;
|
|
1973
|
-
width: 100%;
|
|
1974
|
-
}
|
|
1975
|
-
`,classes:{root:function(e){var t=e.instance,n=e.props;return[`p-slider p-component`,{"p-disabled":n.disabled,"p-invalid":t.$invalid,"p-slider-horizontal":n.orientation===`horizontal`,"p-slider-vertical":n.orientation===`vertical`}]},range:`p-slider-range`,handle:`p-slider-handle`},inlineStyles:{handle:{position:`absolute`},range:{position:`absolute`}}}),oC={name:`BaseSlider`,extends:Gx,props:{min:{type:Number,default:0},max:{type:Number,default:100},orientation:{type:String,default:`horizontal`},step:{type:Number,default:null},range:{type:Boolean,default:!1},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:aC,provide:function(){return{$pcSlider:this,$parentInstance:this}}};function sC(e){"@babel/helpers - typeof";return sC=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},sC(e)}function cC(e,t,n){return(t=lC(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lC(e){var t=uC(e,`string`);return sC(t)==`symbol`?t:t+``}function uC(e,t){if(sC(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sC(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function dC(e){return hC(e)||mC(e)||pC(e)||fC()}function fC(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1976
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pC(e,t){if(e){if(typeof e==`string`)return gC(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gC(e,t):void 0}}function mC(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function hC(e){if(Array.isArray(e))return gC(e)}function gC(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var _C={name:`Slider`,extends:oC,inheritAttrs:!1,emits:[`change`,`slideend`],dragging:!1,handleIndex:null,initX:null,initY:null,barWidth:null,barHeight:null,dragListener:null,dragEndListener:null,beforeUnmount:function(){this.unbindDragListeners()},methods:{updateDomData:function(){var e=this.$el.getBoundingClientRect();this.initX=e.left+Kd(),this.initY=e.top+qd(),this.barWidth=this.$el.offsetWidth,this.barHeight=this.$el.offsetHeight},setValue:function(e){var t,n=e.touches?e.touches[0].pageX:e.pageX,r=e.touches?e.touches[0].pageY:e.pageY;t=this.orientation===`horizontal`?Jd(this.$el)?(this.initX+this.barWidth-n)*100/this.barWidth:(n-this.initX)*100/this.barWidth:(this.initY+this.barHeight-r)*100/this.barHeight;var i=(this.max-this.min)*(t/100)+this.min;if(this.step){var a=this.range?this.value[this.handleIndex]:this.value,o=i-a;o<0?i=a+Math.ceil(i/this.step-a/this.step)*this.step:o>0&&(i=a+Math.floor(i/this.step-a/this.step)*this.step)}else i=Math.floor(i);this.updateModel(e,i)},updateModel:function(e,t){var n=Math.round(t*100)/100,r;this.range?(r=this.value?dC(this.value):[],this.handleIndex==0?(n<this.min?n=this.min:n>=this.max&&(n=this.max),r[0]=n):(n>this.max?n=this.max:n<=this.min&&(n=this.min),r[1]=n)):(n<this.min?n=this.min:n>this.max&&(n=this.max),r=n),this.writeValue(r,e),this.$emit(`change`,r)},onDragStart:function(e,t){this.disabled||(this.$el.setAttribute(`data-p-sliding`,!0),this.dragging=!0,this.updateDomData(),this.range&&this.value[0]===this.max?this.handleIndex=0:this.handleIndex=t,e.currentTarget.focus())},onDrag:function(e){this.dragging&&this.setValue(e)},onDragEnd:function(e){this.dragging&&(this.dragging=!1,this.$el.setAttribute(`data-p-sliding`,!1),this.$emit(`slideend`,{originalEvent:e,value:this.value}))},onBarClick:function(e){this.disabled||uf(e.target,`data-pc-section`)!==`handle`&&(this.updateDomData(),this.setValue(e))},onMouseDown:function(e,t){this.bindDragListeners(),this.onDragStart(e,t)},onKeyDown:function(e,t){switch(this.handleIndex=t,e.code){case`ArrowDown`:case`ArrowLeft`:this.decrementValue(e,t),e.preventDefault();break;case`ArrowUp`:case`ArrowRight`:this.incrementValue(e,t),e.preventDefault();break;case`PageDown`:this.decrementValue(e,t,!0),e.preventDefault();break;case`PageUp`:this.incrementValue(e,t,!0),e.preventDefault();break;case`Home`:this.updateModel(e,this.min),e.preventDefault();break;case`End`:this.updateModel(e,this.max),e.preventDefault();break}},onBlur:function(e,t){var n,r;(n=(r=this.formField).onBlur)==null||n.call(r,e)},decrementValue:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=this.range?this.step?this.value[t]-this.step:this.value[t]-1:this.step?this.value-this.step:!this.step&&n?this.value-10:this.value-1;this.updateModel(e,r),e.preventDefault()},incrementValue:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=this.range?this.step?this.value[t]+this.step:this.value[t]+1:this.step?this.value+this.step:!this.step&&n?this.value+10:this.value+1;this.updateModel(e,r),e.preventDefault()},bindDragListeners:function(){this.dragListener||(this.dragListener=this.onDrag.bind(this),document.addEventListener(`mousemove`,this.dragListener)),this.dragEndListener||(this.dragEndListener=this.onDragEnd.bind(this),document.addEventListener(`mouseup`,this.dragEndListener))},unbindDragListeners:function(){this.dragListener&&=(document.removeEventListener(`mousemove`,this.dragListener),null),this.dragEndListener&&=(document.removeEventListener(`mouseup`,this.dragEndListener),null)},rangeStyle:function(){if(this.range){var e=this.rangeEndPosition>this.rangeStartPosition?this.rangeEndPosition-this.rangeStartPosition:this.rangeStartPosition-this.rangeEndPosition,t=this.rangeEndPosition>this.rangeStartPosition?this.rangeStartPosition:this.rangeEndPosition;return this.horizontal?{"inset-inline-start":t+`%`,width:e+`%`}:{bottom:t+`%`,height:e+`%`}}else if(this.horizontal)return{width:this.handlePosition+`%`};else return{height:this.handlePosition+`%`}},handleStyle:function(){return this.horizontal?{"inset-inline-start":this.handlePosition+`%`}:{bottom:this.handlePosition+`%`}},rangeStartHandleStyle:function(){return this.horizontal?{"inset-inline-start":this.rangeStartPosition+`%`}:{bottom:this.rangeStartPosition+`%`}},rangeEndHandleStyle:function(){return this.horizontal?{"inset-inline-start":this.rangeEndPosition+`%`}:{bottom:this.rangeEndPosition+`%`}}},computed:{value:function(){return this.range?[this.d_value?.[0]??this.min,this.d_value?.[1]??this.max]:this.d_value??this.min},horizontal:function(){return this.orientation===`horizontal`},vertical:function(){return this.orientation===`vertical`},handlePosition:function(){return this.value<this.min?0:this.value>this.max?100:(this.value-this.min)*100/(this.max-this.min)},rangeStartPosition:function(){return this.value&&this.value[0]!==void 0?this.value[0]<this.min?0:(this.value[0]-this.min)*100/(this.max-this.min):0},rangeEndPosition:function(){return this.value&&this.value.length===2&&this.value[1]!==void 0?this.value[1]>this.max?100:(this.value[1]-this.min)*100/(this.max-this.min):100},dataP:function(){return Nd(cC({},this.orientation,this.orientation))}}},vC=[`data-p`],yC=[`data-p`],bC=[`tabindex`,`aria-valuemin`,`aria-valuenow`,`aria-valuemax`,`aria-labelledby`,`aria-label`,`aria-orientation`,`data-p`],xC=[`tabindex`,`aria-valuemin`,`aria-valuenow`,`aria-valuemax`,`aria-labelledby`,`aria-label`,`aria-orientation`,`data-p`],SC=[`tabindex`,`aria-valuemin`,`aria-valuenow`,`aria-valuemax`,`aria-labelledby`,`aria-label`,`aria-orientation`,`data-p`];function CC(e,t,n,r,i,a){return q(),c(`div`,U({class:e.cx(`root`),onClick:t[18]||=function(){return a.onBarClick&&a.onBarClick.apply(a,arguments)}},e.ptmi(`root`),{"data-p-sliding":!1,"data-p":a.dataP}),[V(`span`,U({class:e.cx(`range`),style:[e.sx(`range`),a.rangeStyle()]},e.ptm(`range`),{"data-p":a.dataP}),null,16,yC),e.range?R(``,!0):(q(),c(`span`,U({key:0,class:e.cx(`handle`),style:[e.sx(`handle`),a.handleStyle()],onTouchstartPassive:t[0]||=function(e){return a.onDragStart(e)},onTouchmovePassive:t[1]||=function(e){return a.onDrag(e)},onTouchend:t[2]||=function(e){return a.onDragEnd(e)},onMousedown:t[3]||=function(e){return a.onMouseDown(e)},onKeydown:t[4]||=function(e){return a.onKeyDown(e)},onBlur:t[5]||=function(e){return a.onBlur(e)},tabindex:e.tabindex,role:`slider`,"aria-valuemin":e.min,"aria-valuenow":e.d_value,"aria-valuemax":e.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":e.orientation},e.ptm(`handle`),{"data-p":a.dataP}),null,16,bC)),e.range?(q(),c(`span`,U({key:1,class:e.cx(`handle`),style:[e.sx(`handle`),a.rangeStartHandleStyle()],onTouchstartPassive:t[6]||=function(e){return a.onDragStart(e,0)},onTouchmovePassive:t[7]||=function(e){return a.onDrag(e)},onTouchend:t[8]||=function(e){return a.onDragEnd(e)},onMousedown:t[9]||=function(e){return a.onMouseDown(e,0)},onKeydown:t[10]||=function(e){return a.onKeyDown(e,0)},onBlur:t[11]||=function(e){return a.onBlur(e,0)},tabindex:e.tabindex,role:`slider`,"aria-valuemin":e.min,"aria-valuenow":e.d_value?e.d_value[0]:null,"aria-valuemax":e.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":e.orientation},e.ptm(`startHandler`),{"data-p":a.dataP}),null,16,xC)):R(``,!0),e.range?(q(),c(`span`,U({key:2,class:e.cx(`handle`),style:[e.sx(`handle`),a.rangeEndHandleStyle()],onTouchstartPassive:t[12]||=function(e){return a.onDragStart(e,1)},onTouchmovePassive:t[13]||=function(e){return a.onDrag(e)},onTouchend:t[14]||=function(e){return a.onDragEnd(e)},onMousedown:t[15]||=function(e){return a.onMouseDown(e,1)},onKeydown:t[16]||=function(e){return a.onKeyDown(e,1)},onBlur:t[17]||=function(e){return a.onBlur(e,1)},tabindex:e.tabindex,role:`slider`,"aria-valuemin":e.min,"aria-valuenow":e.d_value?e.d_value[1]:null,"aria-valuemax":e.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":e.orientation},e.ptm(`endHandler`),{"data-p":a.dataP}),null,16,SC)):R(``,!0)],16,vC)}_C.render=CC;var wC=Symbol(`camera-ui-nvr`);function TC(){let e=De(wC);if(!e)throw Error(`useNvrCtx(): NVR plugin not installed — call app.use(createNvrPlugin({ ... })) first`);return e}function EC(e){let{natsTransport:t,target:n,wsTransport:r,workerBridge:i,workerRegistry:a}=e;function o(e){a.has(e)||(a.add(e),i.syncHost(e))}function s(e){a.delete(e);try{e.postMessage({type:`nvr-destroy`})}catch{}}function c(){for(let e of a)try{e.postMessage({type:`nvr-force-reconnect`})}catch{}}function l(e){for(let t of a)try{t.postMessage({type:`nvr-suspend`,keepNats:e.keepNats})}catch{}}function u(){for(let e of a)try{e.postMessage({type:`nvr-resume`})}catch{}}return{natsTransport:t,target:n,wsTransport:r,registerWorker:o,unregisterWorker:s,forceReconnectAll:c,suspendAll:l,resumeAll:u}}function DC(e){return{install(t){t.provide(wC,EC(e))}}}var OC=`__other__`,kC={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function AC(e,t){return q(),c(`svg`,kC,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2-2a2 2 0 0 1-2-2a2 2 0 0 1-2 2m0-12a2 2 0 0 1 2 2a2 2 0 0 1 2-2a2 2 0 0 1-2-2a2 2 0 0 1-2 2M9 18a6 6 0 0 1 6-6a6 6 0 0 1-6-6a6 6 0 0 1-6 6a6 6 0 0 1 6 6`},null,-1)]])}var jC=_e({name:`tabler-sparkles`,render:AC}),MC={viewBox:`0 0 20 20`,width:`1.2em`,height:`1.2em`};function NC(e,t){return q(),c(`svg`,MC,[...t[0]||=[V(`path`,{fill:`currentColor`,"fill-rule":`evenodd`,d:`M14.707 12.707a1 1 0 0 1-1.414 0L10 9.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1 0 1.414`,"clip-rule":`evenodd`},null,-1)]])}var PC=_e({name:`heroicons-solid-chevron-up`,render:NC}),FC={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function IC(e,t){return q(),c(`svg`,FC,[...t[0]||=[V(`path`,{fill:`currentColor`,d:`M7.46 13.655q-.23-.23-.23-.54t.23-.539t.54-.23t.54.23t.23.54t-.23.539t-.54.23t-.54-.23m4 0q-.23-.23-.23-.54t.23-.539t.54-.23t.54.23t.23.54t-.23.539t-.54.23t-.54-.23m4 0q-.23-.23-.23-.54t.23-.539t.54-.23t.54.23t.23.54t-.23.539t-.54.23t-.54-.23M5.617 21q-.691 0-1.153-.462T4 19.385V6.615q0-.69.463-1.152T5.616 5h1.769V3.308q0-.233.153-.386t.385-.153t.386.153t.153.386V5h7.154V3.27q0-.214.143-.358t.357-.143t.356.143t.144.357V5h1.769q.69 0 1.153.463T20 6.616v12.769q0 .69-.462 1.153T18.384 21zm0-1h12.769q.23 0 .423-.192t.192-.424v-8.768H5v8.769q0 .23.192.423t.423.192M5 9.615h14v-3q0-.23-.192-.423T18.384 6H5.616q-.231 0-.424.192T5 6.616zm0 0V6z`},null,-1)]])}var LC=_e({name:`material-symbols-light-date-range-outline-rounded`,render:IC}),RC={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function zC(e,t){return q(),c(`svg`,RC,[...t[0]||=[V(`path`,{fill:`currentColor`,d:`M9 11.75A1.25 1.25 0 0 0 7.75 13A1.25 1.25 0 0 0 9 14.25A1.25 1.25 0 0 0 10.25 13A1.25 1.25 0 0 0 9 11.75m6 0A1.25 1.25 0 0 0 13.75 13A1.25 1.25 0 0 0 15 14.25A1.25 1.25 0 0 0 16.25 13A1.25 1.25 0 0 0 15 11.75M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 18a8 8 0 0 1-8-8a4 4 0 0 1 0-.86a10.05 10.05 0 0 0 5.26-5.37A9.99 9.99 0 0 0 17.42 10c.76 0 1.51-.09 2.25-.26c1.25 4.26-1.17 8.69-5.41 9.93c-.76.22-1.5.33-2.26.33M0 2a2 2 0 0 1 2-2h4v2H2v4H0zm24 20a2 2 0 0 1-2 2h-4v-2h4v-4h2zM2 24a2 2 0 0 1-2-2v-4h2v4h4v2zM22 0a2 2 0 0 1 2 2v4h-2V2h-4V0z`},null,-1)]])}var BC=_e({name:`mdi-face-recognition`,render:zC}),VC={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function HC(e,t){return q(),c(`svg`,VC,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3 12h4l3 8l4-16l3 8h4`},null,-1)]])}var UC=_e({name:`tabler-activity`,render:HC}),WC={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function GC(e,t){return q(),c(`svg`,WC,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M10 5a2 2 0 0 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3H4a4 4 0 0 0 2-3v-3a7 7 0 0 1 4-6M9 17v1a3 3 0 0 0 6 0v-1m6-10.273A11.05 11.05 0 0 0 18.206 3M3 6.727A11.05 11.05 0 0 1 5.792 3`},null,-1)]])}var KC=_e({name:`tabler-bell-ringing`,render:GC}),qC={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function JC(e,t){return q(),c(`svg`,qC,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3 12h1m8-9v1m8 8h1M5.6 5.6l.7.7m12.1-.7l-.7.7M9 16a5 5 0 1 1 6 0a3.5 3.5 0 0 0-1 3a2 2 0 0 1-4 0a3.5 3.5 0 0 0-1-3m.7 1h4.6`},null,-1)]])}var YC=_e({name:`tabler-bulb`,render:JC}),XC={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function ZC(e,t){return q(),c(`svg`,XC,[...t[0]||=[V(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[V(`path`,{d:`M5 17a2 2 0 1 0 4 0a2 2 0 1 0-4 0m10 0a2 2 0 1 0 4 0a2 2 0 1 0-4 0`}),V(`path`,{d:`M5 17H3v-6l2-5h9l4 5h1a2 2 0 0 1 2 2v4h-2m-4 0H9m-6-6h15m-6 0V6`})],-1)]])}var QC=_e({name:`tabler-car`,render:ZC}),$C={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function ew(e,t){return q(),c(`svg`,$C,[...t[0]||=[V(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[V(`path`,{d:`M11 5h2m6 7q-1 8-5 8h-4q-4 0-5-8`}),V(`path`,{d:`M11 16q0 1 1 1c1 0 1-.333 1-1zm1 2v2m-2-9v.01m4-.01v.01M5 4l6 .97l-6.238 6.688a1.02 1.02 0 0 1-1.41.111a.95.95 0 0 1-.327-.954zm14 0l-6 .97l6.238 6.688c.358.408.989.458 1.41.111a.95.95 0 0 0 .327-.954z`})],-1)]])}var tw=_e({name:`tabler-dog`,render:ew}),nw={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function rw(e,t){return q(),c(`svg`,nw,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M14 12v.01M3 21h18M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`},null,-1)]])}var iw=_e({name:`tabler-door`,render:rw}),aw={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function ow(e,t){return q(),c(`svg`,aw,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 21H6a3 3 0 0 1-3-3v-1h10v2a2 2 0 0 0 4 0V5a2 2 0 1 1 2 2h-2m2-4H8a3 3 0 0 0-3 3v11M9 7h4m-4 4h4`},null,-1)]])}var sw=_e({name:`tabler-license`,render:ow}),cw={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function lw(e,t){return q(),c(`svg`,cw,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`m12 3l8 4.5v9L12 21l-8-4.5v-9zm0 9l8-4.5M12 12v9m0-9L4 7.5m12-2.25l-8 4.5`},null,-1)]])}var uw=_e({name:`tabler-package`,render:lw}),dw={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function fw(e,t){return q(),c(`svg`,dw,[...t[0]||=[V(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[V(`path`,{d:`M12 3a12 12 0 0 0 8.5 3A12 12 0 0 1 12 21A12 12 0 0 1 3.5 6A12 12 0 0 0 12 3`}),V(`path`,{d:`M11 11a1 1 0 1 0 2 0a1 1 0 1 0-2 0m1 1v2.5`})],-1)]])}var pw=_e({name:`tabler-shield-lock`,render:fw}),mw={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function hw(e,t){return q(),c(`svg`,mw,[...t[0]||=[V(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[V(`path`,{d:`M18 8a3 3 0 0 1 0 6m-8-6v11a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-5`}),V(`path`,{d:`m12 8l4.524-3.77A.9.9 0 0 1 18 4.922v12.156a.9.9 0 0 1-1.476.692L12 14H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z`})],-1)]])}var gw=_e({name:`tabler-speakerphone`,render:hw}),_w={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function vw(e,t){return q(),c(`svg`,_w,[...t[0]||=[V(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[V(`path`,{d:`M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0-2 0`}),V(`path`,{d:`M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592-5.592a2.41 2.41 0 0 0 0-3.408l-7.71-7.71A2 2 0 0 0 11.172 3H6a3 3 0 0 0-3 3`})],-1)]])}var yw=_e({name:`tabler-tag`,render:vw}),bw={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function xw(e,t){return q(),c(`svg`,bw,[...t[0]||=[V(`g`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`},[V(`path`,{d:`M6 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0`}),V(`path`,{d:`M2 12a6 6 0 0 1 6-6h8a6 6 0 0 1 6 6a6 6 0 0 1-6 6H8a6 6 0 0 1-6-6`})],-1)]])}var Sw=_e({name:`tabler-toggle-left`,render:xw}),Cw={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function ww(e,t){return q(),c(`svg`,Cw,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2`},null,-1)]])}var Tw=_e({name:`tabler-user`,render:ww}),Ew={viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`};function Dw(e,t){return q(),c(`svg`,Ew,[...t[0]||=[V(`path`,{fill:`none`,stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M15 8a5 5 0 0 1 0 8m2.7-11a9 9 0 0 1 0 14M6 15H4a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h2l3.5-4.5A.8.8 0 0 1 11 5v14a.8.8 0 0 1-1.5.5z`},null,-1)]])}var Ow=_e({name:`tabler-volume`,render:Dw}),kw;function Aw(){return kw||=[...w_,`person`,`vehicle`,`animal`,`package`,`contact`,`doorbell`,`switch`,`light`,`siren`,`security_system`,`audio`,`motion`],kw}function jw(e){for(let t of Aw())if(e.types.includes(t))return t;return e.types[0]??`motion`}function Mw(e){let t=0;for(let n of e.segments)for(let e of n.detections)e.score>t&&(t=e.score);for(let n of e.triggers)n.score!=null&&n.score>t&&(t=n.score);return t}function Nw(e){for(let t of e.segments){for(let e of w_){let n=t.attributes.find(t=>t.type===e);if(n)return n.label}if(t.attributes.length>0)return t.attributes[0].label}}var Pw=new WeakMap;function Fw(e){if(!e||e.length===0)return;let t=Pw.get(e);return t||(t=URL.createObjectURL(new Blob([e],{type:`image/jpeg`})),Pw.set(e,t)),t}function Iw(e){if(!e)return;let t=e=>{if(!e)return;let t=Pw.get(e);t&&(URL.revokeObjectURL(t),Pw.delete(e))};if(t(e.event),e.scenes)for(let n of Object.values(e.scenes))t(n);if(e.detections)for(let n of Object.values(e.detections))t(n);if(e.attributes)for(let n of Object.values(e.attributes))t(n)}var Lw=new Set([`motion`,`audio`]),Rw;function zw(){return Rw||=C_.filter(e=>!Lw.has(e)),Rw}function Bw(e,t){let n=jw(t),r=Nw(t);if(e.attributes){let t=Object.entries(e.attributes);for(let e of w_){let n=t.find(([t])=>{let n=t.indexOf(`:`);if(n<0)return!1;let r=t.substring(0,n);return r===e||e===`license_plate`&&r===`plate`});if(n){let t=n[0].indexOf(`:`);return{url:Fw(n[1]),type:e,label:n[0].substring(t+1)}}}if(t.length>0){let[e,n]=t[0],r=e.indexOf(`:`),i=r>=0?e.substring(0,r):e,a=r>=0?e.substring(r+1):``;return{url:Fw(n),type:i,label:a}}}if(e.scenes){let t=Object.keys(e.scenes).sort((e,t)=>Number(e)-Number(t));if(t.length>0){let i=Fw(e.scenes[t[0]]);if(i)return{url:i,type:n,label:r}}}if(e.detections){for(let t of zw())for(let[n,r]of Object.entries(e.detections))if(n.endsWith(`:${t}`))return{url:Fw(r),type:t};let t=Object.entries(e.detections);if(t.length>0){let[e,n]=t[0],r=e.includes(`:`)?e.split(`:`).slice(1).join(`:`):e;return{url:Fw(n),type:r}}}if(e.event){let t=Fw(e.event);if(t)return{url:t,type:n,label:r}}return{type:n,label:r}}var Vw=new Map,Hw=2e3,Uw=new Map,Ww=500,Gw=s(0),Kw=s(new Set),qw=new Map,Jw,Yw=0,Xw,Zw=5e3,Qw,$w=!1,eT=new Set,tT=null,nT=0,rT=new Map,iT=new Map;function aT(e,t){let n=iT.get(e);for(let r of t){if(n?.has(r))continue;let t=rT.get(r);t||(t=new Set,rT.set(r,t)),t.add(e)}if(n)for(let r of n){if(t.has(r))continue;let n=rT.get(r);n&&(n.delete(e),n.size===0&&rT.delete(r))}iT.set(e,new Set(t))}function oT(e){let t=iT.get(e);if(t){for(let n of t){let t=rT.get(n);t&&(t.delete(e),t.size===0&&rT.delete(n))}iT.delete(e)}}function sT(e,t){let n={},r=!1,i=String(t);e.thumbnail&&(n.scenes={[i]:e.thumbnail},r=!0);for(let i of e.detections??[])i.thumbnail&&i.label&&(n.detections||={},n.detections[`${t}:${i.label}`]=i.thumbnail,r=!0);for(let t of e.attributes??[])t.thumbnail&&t.label&&(n.attributes||={},n.attributes[`${t.type}:${t.label}`]=t.thumbnail,r=!0);return r?n:null}function cT(e,t){let n=Uw.get(e);if(n){let r={...n};if(t.scenes){if(n.scenes)for(let e of Object.keys(t.scenes)){let t=n.scenes[e];t&&Iw({scenes:{[e]:t}})}r.scenes={...n.scenes,...t.scenes}}if(t.detections){if(n.detections)for(let e of Object.keys(t.detections)){let t=n.detections[e];t&&Iw({detections:{[e]:t}})}r.detections={...n.detections,...t.detections}}if(t.attributes){if(n.attributes)for(let e of Object.keys(t.attributes)){let t=n.attributes[e];t&&Iw({attributes:{[e]:t}})}r.attributes={...n.attributes,...t.attributes}}Uw.set(e,r);return}if(Uw.size>=Ww){let e=Uw.keys().next().value;if(e!==void 0){let t=Uw.get(e);t&&Iw(t),Uw.delete(e)}}Uw.set(e,t)}function lT(e){if(Kw.value.size>0&&!Kw.value.has(e.data.cameraId))return;let{type:t,data:n}=e,r=Vw.get(n.id);if(t===`start`){Vw.set(n.id,{...n,segments:[]}),Gw.value++;return}if(t===`update`){r&&(r.lastUpdate=n.lastUpdate,r.triggers=n.triggers,r.expectedEndTime=n.expectedEndTime),Gw.value++;return}if(t===`end`){r?(r.state=n.state,r.endTime=n.endTime,r.lastUpdate=n.lastUpdate,r.segments=[]):Vw.set(n.id,{...n}),Gw.value++;return}if(r?.state===`ended`)return;let i=n.segments?.[0];if(!i)return;let a=n.segmentIndex??0,o=sT(i,a);o&&cT(n.id,o);let s=r??{...n,segments:[]};r||Vw.set(n.id,s),s.types=n.types,s.triggers=n.triggers,s.lastUpdate=n.lastUpdate;let c={...i,thumbnail:void 0,detections:i.detections?.map(e=>({...e,thumbnail:void 0})),attributes:i.attributes?.map(e=>({...e,thumbnail:void 0}))};(t===`segment-start`||t===`segment-update`||t===`segment-end`)&&(s.segments[a]=c),Gw.value++}function uT(){Xw&&=(clearTimeout(Xw),void 0),Jw?.(),Jw=void 0,Yw=0,eT.clear(),tT=null,Vw.clear();for(let e of Uw.values())Iw(e);Uw.clear(),qw.clear(),rT.clear(),iT.clear(),Kw.value=new Set,Gw.value=0,nT++}async function dT(){if(Xw&&=(clearTimeout(Xw),void 0),Jw)return;let e=Qw?.value;if(e)try{Jw=await e.subscribe(`camera.*.events.subject`,e=>{lT(e);for(let t of eT)t(e)})}catch(e){console.warn(`[useEventStore] NATS subscription failed:`,e)}}function fT(){Jw?.(),Jw=void 0}function pT(e=`@camera.ui/camera-ui-nvr`){let{rpc:t,isConnected:n,on:r}=Q_(),{plugin:i}=jv(e);Qw=t,$w||($w=!0,r(`reconnected`,()=>{Yw>0&&(fT(),dT())}));let a=nT,o=Symbol(`eventStoreInstance`);Yw++;let s=z(n,e=>{a===nT&&e&&Yw>0&&!Jw&&dT()},{immediate:!0});function c(e){return Vw.get(e)}function l(e){let t=!1;for(let n of e){let e=Vw.get(n.id);(!e||n.lastUpdate>=e.lastUpdate)&&(Vw.set(n.id,n),t=!0)}if(Vw.size>Hw){let e=Vw.size-Hw,t=[];for(let e of Vw.values())rT.has(e.id)||t.push({id:e.id,startTime:e.startTime});if(t.length>0){t.sort((e,t)=>e.startTime-t.startTime);let n=Math.min(e,t.length);for(let e=0;e<n;e++)Vw.delete(t[e].id)}}t&&Gw.value++}async function u(e,t,n){let r=Uw.get(e);if(r)return r;let a=qw.get(e);if(a)return a;let o=(async()=>{let r=i.value;if(!r)return null;try{let i=await r.getEventThumbnails(t,n,e);if(i)return cT(e,i),i}catch(t){console.warn(`[useEventStore] Failed to load thumbnails for event`,e,t)}return null})();qw.set(e,o);try{return await o}finally{qw.delete(e)}}function d(e){return Uw.get(e)}function f(e){return eT.add(e),()=>{eT.delete(e)}}async function p(){if(tT)return tT;tT=(async()=>{let e=i.value;if(e)try{let t=await e.getManagedCameraIds();Kw.value=new Set(t)}catch{}})();try{await tT}finally{tT=null}}function m(e){a===nT&&aT(o,e)}function h(){s(),a===nT&&(oT(o),Yw--,Yw<=0&&(Yw=0,Xw&&clearTimeout(Xw),Xw=setTimeout(()=>{Yw<=0&&fT(),Xw=void 0},Zw)))}return{storeVersion:Gw,managedCameraIds:Kw,getEvent:c,upsertEvents:l,loadThumbnails:u,getCachedThumbnails:d,onNatsMessage:f,refreshManagedCameraIds:p,pinEvents:m,dispose:h}}var mT=3,hT=6,gT=600*1e3,_T=7200*1e3,vT=150,yT=3600*1e3;function bT(e,t,n){let r=String(t);if(e.scenes?.[r]){let t=Fw(e.scenes[r]);if(t)return t}if(e.detections)for(let r of n){let n=`${t}:${r}`;if(e.detections[n]){let t=Fw(e.detections[n]);if(t)return t}}}function xT(e){let t=[],n=e.state===`active`,r=n?Date.now():e.endTime??e.lastUpdate,i=Math.max((r-e.startTime)/1e3,+!!n);if(i>0){let r=e.triggers.map(e=>e.type),a=[...new Set(r)];t.push({id:`${e.id}:trigger`,timestamp:e.startTime,duration:i,types:a.length>0?a:[`motion`],isActive:n||void 0,expectedEndMs:e.expectedEndTime})}for(let i=0;i<e.segments.length;i++){let a=e.segments[i];if(!a)continue;let o=i===e.segments.length-1,s=((n&&o&&r-a.lastSeen<=1e4?r:a.lastSeen)-a.firstSeen)/1e3,c=[];for(let e of a.detections)c.includes(e.label)||c.push(e.label);for(let e of a.attributes)c.includes(e.type)||c.push(e.type);if(c.length===0)continue;let l;if(l=Fw(a.thumbnail),!l){for(let e of a.detections)if(l=Fw(e.thumbnail),l)break}t.push({id:`${e.id}:seg:${i}`,timestamp:a.firstSeen,duration:Math.max(s,1),types:c,thumbnail:l,description:a.description})}return t}function ST(e,t){let n=new Map,r=e=>`${e.cameraId??``}|${e.startTime}-${e.endTime}`;for(let t of e)n.set(r(t),t);for(let e of t)n.set(r(e),e);return[...n.values()].sort((e,t)=>t.startTime-e.startTime)}function CT(e,t){let n=new Map;for(let t of e)n.set(t.id,t);let r=!1;for(let e of t){let t=n.get(e.id);t?t.thumbnail&&!e.thumbnail?(t.duration!==e.duration||t.types.length!==e.types.length)&&(n.set(e.id,{...e,thumbnail:t.thumbnail}),r=!0):(e.thumbnail!==t.thumbnail||e.duration!==t.duration||e.types.length!==t.types.length)&&(n.set(e.id,e),r=!0):(n.set(e.id,e),r=!0)}return r?[...n.values()].sort((e,t)=>t.timestamp-e.timestamp):e}function wT(e,t){if(t.length===0)return e;let n=new Map;for(let t of e)n.set(t.id,t);let r=!1;for(let e of t)n.has(e.id)||(n.set(e.id,e),r=!0);return r?[...n.values()].sort((e,t)=>t.timestamp-e.timestamp):e}function TT(e){let{cameraIds:t,currentTimeMs:n,timeMsPerPx:r,viewportPx:i,initialTimestamp:a}=e,{plugin:o,isLoading:c}=jv(`@camera.ui/camera-ui-nvr`),l=pT(`@camera.ui/camera-ui-nvr`),u=W([]),d=W([]),f=W([]),p=s(!1),m=s(!1),h=s(0),g=s(0),_=null,v,y=new Set,b=new Map,x=1e3;function S(e){if(b.has(e))return;let t=setInterval(()=>{let t=d.value,n=t.findIndex(t=>t.id===e);if(n<0){w(e);return}let r=t[n],i=(Date.now()-r.timestamp)/1e3;if(i>r.duration+10){w(e);return}let a=[...t];a[n]={...r,duration:i},d.value=a},x);b.set(e,t)}function C(e){if(b.has(e))return;let t=setInterval(()=>{let t=d.value,n=t.findIndex(t=>t.id===e);if(n<0){w(e);return}let r=t[n],i=Date.now(),a=r.expectedEndMs;if(a&&i>=a){let i=(a-r.timestamp)/1e3,o=[...t];o[n]={...r,duration:i},d.value=o,w(e);return}let o=(i-r.timestamp)/1e3,s=[...t];s[n]={...r,duration:o},d.value=s},x);b.set(e,t)}function w(e){let t=b.get(e);t&&(clearInterval(t),b.delete(e))}function T(e){let t=`${e}:`;for(let[e,n]of b)e.startsWith(t)&&(clearInterval(n),b.delete(e))}function E(){for(let[,e]of b)clearInterval(e);b.clear()}async function D(e){let t=e.filter(e=>e.segments.length>0);if(t.length===0)return;let n=!1,r=new Map(d.value.map(e=>[e.id,e])),i=[];for(let e of t){let t=l.getCachedThumbnails(e.id);if(t)for(let i=0;i<e.segments.length;i++){let a=`${e.id}:seg:${i}`,o=r.get(a);if(o&&!o.thumbnail){let e=bT(t,i,o.types);e&&(r.set(a,{...o,thumbnail:e}),n=!0)}}else y.has(e.id)||i.push(e)}if(n&&(d.value=[...r.values()].sort((e,t)=>t.timestamp-e.timestamp)),i.length===0)return;let a=await Promise.allSettled(i.map(async e=>(y.add(e.id),{event:e,thumbs:await l.loadThumbnails(e.id,e.cameraId,e.startTime)})));n=!1;let o=new Map(d.value.map(e=>[e.id,e]));for(let e of a){if(e.status!==`fulfilled`||!e.value.thumbs)continue;let{event:t,thumbs:r}=e.value;for(let e=0;e<t.segments.length;e++){let i=`${t.id}:seg:${e}`,a=o.get(i);if(a&&!a.thumbnail){let t=bT(r,e,a.types);t&&(o.set(i,{...a,thumbnail:t}),n=!0)}}}n&&(d.value=[...o.values()].sort((e,t)=>t.timestamp-e.timestamp))}async function O(e,n){let r=o.value;if(!r)return;let i=t.value.filter(e=>l.managedCameraIds.value.has(e));if(i.length===0||(n=Math.min(n,Date.now()),e>=n))return;p.value=!0;let a=[];try{let t=(async()=>{try{let t=(await r.getCameraEvents(i,{startMs:Math.floor(e),endMs:Math.ceil(n),limit:200})).events??[];a.push(...t),l.upsertEvents(t);let o=t.flatMap(e=>xT(e));return d.value=CT(d.value,o),!0}catch(e){return console.warn(`[timeline] Failed to load events:`,e),!1}})(),o=(async()=>{let t=await Promise.all(i.map(async t=>{try{return{ok:!0,segs:(await r.getRecordingSegments(t,e,n)??[]).map(e=>({...e,cameraId:t}))}}catch(e){return console.warn(`[timeline] Failed to load recordings for ${t}:`,e),{ok:!1,segs:[]}}})),a=t.flatMap(e=>e.segs);return u.value=ST(u.value,a),t.some(e=>e.ok)})(),s=(async()=>{try{let t=await r.getSystemEvents(i,{startMs:Math.floor(e),endMs:Math.ceil(n),limit:200});f.value=wT(f.value,t.events??[])}catch(e){console.warn(`[timeline] Failed to load system events:`,e)}})(),[c,p]=await Promise.all([t,o,s]);if(!c&&!p)return;h.value===0&&g.value===0?(h.value=e,g.value=n):(h.value=Math.min(h.value,e),g.value=Math.max(g.value,n))}catch(e){console.warn(`[timeline] Failed to load events:`,e)}finally{p.value=!1,m.value=!0}a.length>0&&D(a);for(let e of a)if(e.state===`active`&&(C(`${e.id}:trigger`),e.segments.length>0)){let t=e.segments[e.segments.length-1];e.lastUpdate-t.lastSeen<=1e4&&S(`${e.id}:seg:${e.segments.length-1}`)}}function k(e,t){let n=()=>O(e,t).finally(()=>{_=null});_=_?_.then(n):n()}function A(){return i.value*r.value}function j(){let e=A();return e<=0?_T:Math.min(_T,Math.max(gT,e*mT))}function M(){let e=A();return e<=0?_T*2:Math.min(_T*2,Math.max(gT*2,e*hT))}function N(e){let t=M(),n=e-t,r=e+t,i=u.value.filter(e=>e.endTime>=n&&e.startTime<=r);i.length!==u.value.length&&(u.value=i);let a=d.value.filter(e=>e.timestamp+e.duration*1e3>=n&&e.timestamp<=r);a.length!==d.value.length&&(d.value=a);let o=f.value.filter(e=>(e.duration?e.timestamp+e.duration:e.timestamp)>=n&&e.timestamp<=r);o.length!==f.value.length&&(f.value=o),h.value<n&&(h.value=n),g.value>r&&(g.value=r)}function P(){if(h.value===0&&g.value===0)return;let e=n.value,t=j(),r=A()/2,i=e-r-t,a=Math.min(e+r+t,Date.now()),o=6e4;h.value-i>o&&k(i,h.value),a-g.value>o&&k(g.value,a),N(e)}function F(e){let n=t.value;if(n.length===0||!n.includes(e.data.cameraId))return;let r=xT(l.getEvent(e.data.id)??e.data),i=l.getCachedThumbnails(e.data.id);if(i)for(let e of r){if(!e.id.includes(`:seg:`)||e.thumbnail)continue;let t=e.id.split(`:seg:`)[1],n=bT(i,t==null?0:parseInt(t,10),e.types);n&&(e.thumbnail=n)}d.value=CT(d.value,r);let a=e.type,o=e.data.id;if(a===`start`)C(`${o}:trigger`);else if(a===`update`)C(`${o}:trigger`);else if(a===`segment-start`)S(`${o}:seg:${e.data.segmentIndex??0}`);else if(a===`segment-update`){let t=`${o}:seg:${e.data.segmentIndex??0}`;w(t),S(t)}else a===`segment-end`?w(`${o}:seg:${e.data.segmentIndex??0}`):a===`end`&&T(o)}function I(){v||=l.onNatsMessage(F)}function ee(){v?.(),v=void 0,E()}I();let te=s(new Set),L=new Map,R=s(Date.now());dl(()=>{te.value.size>0&&(R.value=Date.now())},1e3);function B(){return Date.now()-n.value<6e4}async function ne(e){let t=o.value;if(t)try{let n=await t.onRecordingState(e,e=>{if(e.state===`recording`)te.value=new Set([...te.value,e.cameraId]);else{let t=new Set(te.value);t.delete(e.cameraId),te.value=t,g.value>0&&k(g.value,Date.now())}});L.set(e,n)}catch(t){console.warn(`[timeline] Failed to subscribe to recording state for ${e}:`,t)}}function re(){for(let[,e]of L)e();L.clear(),te.value=new Set}let ie;async function ae(){if(ie)return;let e=o.value;if(e)try{ie=await e.onSystemEvent(e=>{e.cameraId&&!t.value.includes(e.cameraId)||(f.value=wT(f.value,[e]))})}catch(e){console.warn(`[timeline] Failed to subscribe to system events:`,e)}}function oe(){ie?.(),ie=void 0}let se=H(()=>{let e=u.value;if(e.length===0)return e;let t=R.value,n=te.value,r=new Map;for(let t of e){let e=t.cameraId??`__unknown__`,n=r.get(e);(!n||t.endTime>n.endTime)&&r.set(e,t)}let i=new Map;for(let[e,a]of r){let r=e!==`__unknown__`&&n.has(e),o=t-a.endTime<12e4;(r||o)&&a.endTime<t&&i.set(a,{...a,endTime:t})}return i.size===0?e:e.map(e=>i.get(e)??e)});dl(()=>{if(g.value===0||!B())return;let e=Date.now();e-g.value<3e5&&k(g.value,e)},6e4);let ce;z([()=>t.value.join(`,`),()=>o.value],async([e,n])=>{let r=ce!==e;if(ce=e,re(),oe(),r&&(u.value=[],d.value=[],f.value=[],h.value=0,g.value=0),!(t.value.length===0||!n)){if(await l.refreshManagedCameraIds(),r||h.value===0&&g.value===0){let e=Date.now(),t=a?.value??e,n=Math.max(j(),yT);k(t-n,Math.min(t+n,e))}for(let e of t.value)l.managedCameraIds.value.has(e)&&ne(e);ae()}},{immediate:!0}),z(c,e=>{!e&&!o.value&&(m.value=!0)}),hl(n,P,{throttle:vT});let{on:le,off:ue}=Q_(),{onTabVisible:de}=tb();de(({hiddenMs:e})=>{te.value.size>0&&(R.value=Date.now()),e>=3e4&&g.value>0&&B()&&k(g.value,Date.now())});async function fe(){re();for(let e of t.value)l.managedCameraIds.value.has(e)&&await ne(e)}let pe=()=>{E(),g.value>0&&k(h.value,Date.now()),fe(),oe(),ae()};return le(`reconnected`,pe),xc(()=>{ue(`reconnected`,pe),ee(),re(),oe(),l.dispose()}),{recordings:se,events:d,systemEvents:f,isLoading:H(()=>p.value||!m.value)}}var ET=new Map,DT=6e4;function OT(e,t){let n=t?JSON.stringify(t):``;return e.slice().sort().join(`,`)+`|`+n}function kT(e){let t=ET.get(e);if(t){if(Date.now()-t.savedAt>DT){ET.delete(e);return}return t}}function AT(e,t,n){ET.set(e,{eventIds:t,hasMore:n,savedAt:Date.now()})}function jT(){ET.clear()}function MT(e={}){let{availableCameraIds:t,cameraIds:n,realtime:r=!0,pageSize:i=40,pluginName:a=`@camera.ui/camera-ui-nvr`,filter:o}=e,{plugin:c,error:l,isLoading:u}=jv(a),d=pT(a),f=s(new Set),p=s(!1),m=s(!0),h=s(!0),g=s(!1),_,v=H(()=>n?G(n):[]),y=H(()=>t?G(t):[]),b=H(()=>o?G(o)??{}:{}),x=H(()=>{let e=v.value;return(e.length>0?e:y.value).filter(e=>d.managedCameraIds.value.has(e))});function S(e){return!(b.value.hasDetections&&!e.types?.some(e=>e!==`motion`&&e!==`audio`))}let C=H(()=>{d.storeVersion.value;let e=f.value,t=v.value,n=[];for(let r of e){let e=d.getEvent(r);!e||!S(e)||t.length>0&&!t.includes(e.cameraId)||n.push({...e})}return n.sort((e,t)=>t.startTime-e.startTime),n});function w(e){if(e.type===`segment-update`&&f.value.has(e.data.id)||!d.managedCameraIds.value.has(e.data.cameraId))return;let t=v.value;if(t.length>0&&!t.includes(e.data.cameraId)||!S(e.data))return;let n=new Set(f.value);n.has(e.data.id)||(n.add(e.data.id),f.value=n)}function T(){_||=d.onNatsMessage(w)}function E(){_?.(),_=void 0}async function D(){if(p.value||!h.value)return;let e=c.value;if(!e)return;let t=x.value;p.value=!0;try{let n;for(let e of f.value){let t=d.getEvent(e);t&&(n===void 0||t.startTime<n)&&(n=t.startTime)}let r={...b.value,limit:i,before:n},a;a=t.length>0?await e.getCameraEvents(t,r):await e.getEvents(r);let o=a.events??[];h.value=a.hasMore,d.upsertEvents(o);let s=f.value,c=o.filter(e=>!s.has(e.id)&&S(e));if(c.length>0){let e=new Set(f.value);for(let t of c)e.add(t.id);f.value=e}else o.length>0&&(h.value=!1)}catch(e){console.warn(`[useDetectionEvents] Failed to load historical events:`,e)}finally{p.value=!1,m.value=!1}}async function O(){f.value=new Set,h.value=!0,m.value=!0,await D()}async function k(e,t){let n=d.getCachedThumbnails(e);if(n)return n;let r=d.getEvent(e);return r?d.loadThumbnails(e,r.cameraId,t):null}function A(){T()}function j(){E()}r&&T(),z([u,l],([e,t])=>{!e&&(t||!c.value)&&f.value.size===0&&(m.value=!1,h.value=!1)}),z(f,e=>{d.pinEvents(e)},{immediate:!0}),z([()=>c.value,y],async([e])=>{e&&(await d.refreshManagedCameraIds(),g.value=!0)},{immediate:!0});let M=(()=>{let e=!1,t=globalThis.requestIdleCallback;return()=>{if(e)return;e=!0;function n(){e=!1,D()}typeof t==`function`?t(n,{timeout:250}):setTimeout(n,0)}})(),N=null;z([()=>c.value,x,g],([e,t,n])=>{if(!e)return;let r=t.slice().sort().join(`,`),i=N!==null&&N!==r;if(N=r,t.length===0){let e=v.value.length===0&&d.managedCameraIds.value.size>0&&y.value.length===0;n&&!e&&(h.value=!1,m.value=!1);return}if(i&&f.value.size>0&&(f.value=new Set,h.value=!0,m.value=!0),f.value.size===0){h.value=!0;let e=kT(OT(t,b.value));if(e){let t=e.eventIds.filter(e=>d.getEvent(e));if(t.length>0){f.value=new Set(t),h.value=e.hasMore,m.value=!1;return}}M()}},{immediate:!0}),z(b,()=>{(f.value.size>0||!m.value)&&O()},{deep:!0});let{on:P,off:F}=Q_(),I=!1;async function ee(){let e=c.value;if(!e){I=!0;return}if(I=!1,p.value)return;let t=x.value,n={...b.value,limit:i};p.value=!0;try{let r=t.length>0?await e.getCameraEvents(t,n):await e.getEvents(n),i=r.events??[];d.upsertEvents(i);let a=new Set(f.value),o=!1;for(let e of i)!a.has(e.id)&&S(e)&&(a.add(e.id),o=!0);o&&(f.value=a),r.hasMore&&(h.value=!0)}catch(e){console.warn(`[useDetectionEvents] reconnect refresh failed:`,e)}finally{p.value=!1}}function te(){ee()}return P(`reconnected`,te),z(()=>c.value,e=>{e&&I&&ee()}),xc(()=>{F(`reconnected`,te),E(),d.dispose();let e=OT(x.value,b.value);e&&f.value.size>0&&AT(e,[...f.value],h.value)}),{events:C,isLoading:H(()=>p.value||m.value),hasMore:h,loadMore:D,reset:O,start:A,stop:j,loadThumbnails:k,getCachedThumbnails:d.getCachedThumbnails,thumbnailCache:new Map}}var NT='(function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);function f(e,t){return e===t?!0:!(!e||!t||e.endpoint.url!==t.endpoint.url||e.endpoint.mode!==t.endpoint.mode||e.tokens.access!==t.tokens.access||(e.tokens.proxySession??null)!==(t.tokens.proxySession??null))}function p(e,t){return e===t?!1:!e||!t?!0:e.endpoint.url!==t.endpoint.url||e.endpoint.mode!==t.endpoint.mode}var m=class{listeners=new Map;on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>{n.delete(t)}}emit(e,t){let n=this.listeners.get(e);if(n)for(let e of[...n])e(t)}clear(){this.listeners.clear()}};function h(...e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;let n=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++)n.set(e[t],r),r+=e[t].length;return n}function g(...e){let t=[];for(let n=0;n<e.length;n++)t.push(y.encode(e[n]));return t.length===0?v:t.length===1?t[0]:h(...t)}function _(e){return!e||e.length===0?``:b.decode(e)}var v,y,b,x=o((()=>{v=new Uint8Array,y=new TextEncoder,b=new TextDecoder})),S,C,w,T,E,D,O,k,A,j,M,N,P,F,I=o((()=>{S=class extends Error{constructor(e,t){super(`illegal subject: \'${e}\'`,t),this.name=`InvalidSubjectError`}},C=class e extends Error{constructor(e,t){super(e,t),this.name=`InvalidArgumentError`}static format(t,n,r){return Array.isArray(n)&&n.length>1&&(n=n[0]),Array.isArray(t)?(t=t.map(e=>`\'${e}\'`),t=t.join(`,`)):t=`\'${t}\'`,new e(`${t} ${n}`,r)}},w=class extends Error{constructor(e,t){super(e,t),this.name=`InvalidOperationError`}},T=class e extends Error{constructor(e,t){super(e,t),this.name=`UserAuthenticationExpiredError`}static parse(t){return t.toLowerCase().indexOf(`user authentication expired`)===-1?null:new e(t)}},E=class e extends Error{constructor(e,t){super(e,t),this.name=`AuthorizationError`}static parse(t){let n=[`authorization violation`,`account authentication expired`,`authentication timeout`],r=t.toLowerCase();for(let i=0;i<n.length;i++)if(r.indexOf(n[i])!==-1)return new e(t);return null}},D=class extends Error{constructor(){super(`closed connection`),this.name=`ClosedConnectionError`}},O=class extends Error{constructor(){super(`connection draining`),this.name=`DrainingConnectionError`}},k=class extends Error{constructor(e,t){super(e,t),this.name=`ConnectionError`}},A=class extends Error{constructor(e,t){super(e,t),this.name=`ProtocolError`}},j=class extends Error{constructor(e=``,t){super(e,t),this.name=`RequestError`}isNoResponders(){return this.cause instanceof N}},M=class extends Error{constructor(e){super(`timeout`,e),this.name=`TimeoutError`}},N=class extends Error{subject;constructor(e,t){super(`no responders: \'${e}\'`,t),this.subject=e,this.name=`NoResponders`}},P=class e extends Error{operation;subject;queue;constructor(e,t,n,r,i){super(e,i),this.name=`PermissionViolationError`,this.operation=t,this.subject=n,this.queue=r}static parse(t){if((t?t.toLowerCase():``).indexOf(`permissions violation`)===-1)return null;let n=`publish`,r=``,i,a=t.match(/(Publish|Subscription) to "(\\S+)"/);if(a&&(n=a[1].toLowerCase(),r=a[2],n===`subscription`)){let e=t.match(/using queue "(\\S+)"/);e&&(i=e[1])}return new e(t,n,r,i)}},F={AuthorizationError:E,ClosedConnectionError:D,ConnectionError:k,DrainingConnectionError:O,InvalidArgumentError:C,InvalidOperationError:w,InvalidSubjectError:S,NoRespondersError:N,PermissionViolationError:P,ProtocolError:A,RequestError:j,TimeoutError:M,UserAuthenticationExpiredError:T}}));function L(e,...t){for(let n=0;n<t.length;n++){let r=t[n];Object.keys(r).forEach(function(t){e[t]=r[t]})}return e}function R(e){return b.decode(e).replace(/\\n/g,`␊`).replace(/\\r/g,`␍`)}function z(e,t=!0){let n=t?new M:null,r,i,a=new Promise((t,a)=>{r={cancel:()=>{i&&clearTimeout(i)}},i=setTimeout(()=>{a(n===null?new M:n)},e)});return Object.assign(a,r)}function B(e=0){let t,n=new Promise(n=>{let r=setTimeout(()=>{n()},e);t={cancel:()=>{r&&(clearTimeout(r),n())}}});return Object.assign(n,t)}async function V(e,t=1e3){let n=H(),r=setTimeout(()=>{n.reject(new M)},t);try{return await Promise.race([e,n])}finally{clearTimeout(r)}}function H(){let e={},t=new Promise((t,n)=>{e={resolve:t,reject:n}});return Object.assign(t,e)}function ee(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e}async function U(e){let t=[];for await(let n of e)t.push(n);return t}function W(e){return e===0?0:Math.floor(e/2+Math.random()*e)}function te(e=[0,250,250,500,500,3e3,5e3]){Array.isArray(e)||(e=[0,250,250,500,500,3e3,5e3]);let t=e.length-1;return{backoff(n){return W(n>t?e[t]:e[n])}}}function G(e){return e*1e6}function ne(e){return Math.floor(e/1e6)}function re(){let e=Math.floor(Math.random()*ce),t=e%62,n=se[t];e=(e-t)/62,t=e%62;let r=se[t];e=(e-t)/62,t=e%62;let i=se[t];e=(e-t)/62,t=e%62;let a=se[t];e=(e-t)/62,t=e%62;let o=se[t];e=(e-t)/62,t=e%62;let s=se[t];e=(e-t)/62,t=e%62;let c=se[t];e=(e-t)/62;let l=se[e];return String.fromCharCode(n,r,i,a,o,s,c,l)}var ie,ae,oe,se,ce,le=o((()=>{x(),I(),ie=class{timers;measures;constructor(){this.timers=new Map,this.measures=new Map}mark(e){this.timers.set(e,performance.now())}measure(e,t,n){let r=this.timers.get(t);if(r===void 0)throw Error(`${t} is not defined`);let i=this.timers.get(n);if(i===void 0)throw Error(`${n} is not defined`);this.measures.set(e,i-r)}getEntries(){let e=[];return this.measures.forEach((t,n)=>{e.push({name:n,duration:t})}),e}},ae=class{max;current;waiting;constructor(e=1){this.max=e,this.current=0,this.waiting=[]}lock(){if(this.current++,this.current<=this.max)return Promise.resolve();let e=H();return this.waiting.push(e),e}unlock(){this.current--,this.waiting.pop()?.resolve()}},oe=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,se=new Uint8Array(62);for(let e=0;e<62;e++)se[e]=oe.charCodeAt(e);ce=0xc694446f0100})),ue=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.nuid=e.NuidImpl=void 0;let t=new Uint8Array(62);for(let e=0;e<62;e++)t[e]=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`.charCodeAt(e);let n=4294967296,r=BigInt(62)**BigInt(10),i=Number(r/(1n<<32n)),a=Number(r%(1n<<32n));function o(e){for(let t=0;t<e.length;t++)e[t]=Math.floor(Math.random()*256)}function s(e){globalThis?.crypto?.getRandomValues?globalThis.crypto.getRandomValues(e):o(e)}var c=class{buf;cbuf;seqHi;seqLo;inc;inited;constructor(){this.buf=new Uint8Array(22),this.cbuf=new Uint8Array(12),this.inited=!1}init(){this.inited=!0,this.setPre(),this.initSeqAndInc(),this.fillSeq()}initSeqAndInc(){let e=0;do this.seqHi=Math.floor(Math.random()*(i+1)),this.seqLo=Math.floor(Math.random()*n);while(e++<8&&this.seqHi===i&&this.seqLo>=a);this.seqHi===i&&this.seqLo>=a&&(this.seqLo=0),this.inc=Math.random()*300+33|0}setPre(){s(this.cbuf);for(let e=0;e<12;e++)this.buf[e]=t[this.cbuf[e]%62]}fillSeq(){let e=this.seqHi,r=this.seqLo;for(let i=21;i>=12;i--){let a=Math.floor(e/62),o=(e-a*62)*n+r,s=Math.floor(o/62),c=o-s*62;this.buf[i]=t[c],e=a,r=s}}next(){this.inited||this.init(),this.seqLo+=this.inc,this.seqLo>=n&&(this.seqLo-=n,this.seqHi+=1),(this.seqHi>i||this.seqHi===i&&this.seqLo>=a)&&(this.setPre(),this.initSeqAndInc()),this.fillSeq();let e=this.buf;return String.fromCharCode(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15],e[16],e[17],e[18],e[19],e[20],e[21])}reset(){this.init()}};e.NuidImpl=c,e.nuid=new c})),de=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.nuid=e.Nuid=void 0;let t=ue();e.Nuid=t.NuidImpl,e.nuid=t.nuid})),fe,pe=o((()=>{fe=de()}));function me(e){let t=e[Symbol.asyncIterator]();return{async next(){let e=await t.next();return e.done?Promise.resolve(null):Promise.resolve(e.value)}}}function he(e=``){if(e||=`_INBOX`,typeof e!=`string`)throw TypeError(`prefix must be a string`);return e.split(`.`).forEach(t=>{if(t===`*`||t===`>`)throw C.format(`prefix`,`cannot have wildcards (\'${e}\')`)}),`${e}.${fe.nuid.next()}`}var ge,_e,ve,ye=o((()=>{pe(),I(),ge={Exact:`exact`,CanonicalMIME:`canonical`,IgnoreCase:`insensitive`},_e=4222,ve=`127.0.0.1`})),be,xe=o((()=>{x(),be=class{buffers;byteLength;constructor(){this.buffers=[],this.byteLength=0}static concat(...e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;let n=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++)n.set(e[t],r),r+=e[t].length;return n}static fromAscii(e){return e||=``,y.encode(e)}static toAscii(e){return b.decode(e)}reset(){this.buffers.length=0,this.byteLength=0}pack(){if(this.buffers.length>1){let e=new Uint8Array(this.byteLength),t=0;for(let n=0;n<this.buffers.length;n++)e.set(this.buffers[n],t),t+=this.buffers[n].length;this.buffers.length=0,this.buffers.push(e)}}shift(){if(this.buffers.length){let e=this.buffers.shift();if(e)return this.byteLength-=e.length,e}return new Uint8Array}drain(e){if(this.buffers.length){this.pack();let t=this.buffers.pop();if(t){let n=this.byteLength;(e===void 0||e>n)&&(e=n);let r=t.subarray(0,e);return n>e&&this.buffers.push(t.subarray(e)),this.byteLength=n-e,r}}return new Uint8Array}fill(e,...t){e&&(this.buffers.push(e),this.byteLength+=e.length);for(let e=0;e<t.length;e++)t[e]&&t[e].length&&(this.buffers.push(t[e]),this.byteLength+=t[e].length)}peek(){return this.buffers.length?(this.pack(),this.buffers[0]):new Uint8Array}size(){return this.byteLength}length(){return this.buffers.length}}}));function Se(e){ke=e}function Ce(){return ke!==void 0&&ke.defaultPort!==void 0?ke.defaultPort:_e}function we(){return ke!==void 0&&ke.urlParseFn?ke.urlParseFn:void 0}function Te(){if(!ke||typeof ke.factory!=`function`)throw Error(`transport fn is not set`);return ke.factory()}function Ee(){return ke!==void 0&&ke.dnsResolveFn?ke.dnsResolveFn:void 0}function De(e){for(let t=0;t<e.length;t++){let n=t+1;if(e.byteLength>n&&e[t]===je&&e[n]===Me)return n+1}return 0}function Oe(e){let t=De(e);if(t>0){let n=new Uint8Array(e).slice(0,t);return b.decode(n)}return``}var ke,Ae,je,Me,Ne=o((()=>{x(),ye(),xe(),Ae=be.fromAscii(`\\r\n`),je=new Uint8Array(Ae)[0],Me=new Uint8Array(Ae)[1]}));function Pe(e,t,n,r){let i=new Uint8Array(He);return[0,0,0,0,0,0,0,0,0,0,255,255].forEach((e,t)=>{i[t]=e}),i[12]=e,i[13]=t,i[14]=n,i[15]=r,i}function Fe(e){return Ie(e)!==void 0}function Ie(e){for(let t=0;t<e.length;t++)switch(e[t]){case`.`:return Le(e);case`:`:return Re(e)}}function Le(e){let t=new Uint8Array(Ve);for(let n=0;n<Ve;n++){if(e.length===0)return;if(n>0){if(e[0]!==`.`)return;e=e.substring(1)}let{n:r,c:i,ok:a}=ze(e);if(!a||r>255)return;e=e.substring(i),t[n]=r}return Pe(t[0],t[1],t[2],t[3])}function Re(e){let t=new Uint8Array(He),n=-1;if(e.length>=2&&e[0]===`:`&&e[1]===`:`&&(n=0,e=e.substring(2),e.length===0))return t;let r=0;for(;r<He;){let{n:i,c:a,ok:o}=Be(e);if(!o||i>65535)return;if(a<e.length&&e[a]===`.`){if(n<0&&r!=He-Ve||r+Ve>He)return;let i=Le(e);if(i===void 0)return;t[r]=i[12],t[r+1]=i[13],t[r+2]=i[14],t[r+3]=i[15],e=``,r+=Ve;break}if(t[r]=i>>8,t[r+1]=i,r+=2,e=e.substring(a),e.length===0)break;if(e[0]!==`:`||e.length==1)return;if(e=e.substring(1),e[0]===`:`){if(n>=0)return;if(n=r,e=e.substring(1),e.length===0)break}}if(e.length===0){if(r<He){if(n<0)return;let e=He-r;for(let i=r-1;i>=n;i--)t[i+e]=t[i];for(let r=n+e-1;r>=n;r--)t[r]=0}else if(n>=0)return;return t}}function ze(e){let t=0,n=0;for(t=0;t<e.length&&Ue<=e.charCodeAt(t)&&e.charCodeAt(t)<=We;t++)if(n=n*10+(e.charCodeAt(t)-Ue),n>=Ye)return{n:Ye,c:t,ok:!1};return t===0?{n:0,c:0,ok:!1}:{n,c:t,ok:!0}}function Be(e){let t=0,n=0;for(n=0;n<e.length;n++){if(Ue<=e.charCodeAt(n)&&e.charCodeAt(n)<=We)t*=16,t+=e.charCodeAt(n)-Ue;else if(qe<=e.charCodeAt(n)&&e.charCodeAt(n)<=Je)t*=16,t+=e.charCodeAt(n)-qe+10;else if(Ge<=e.charCodeAt(n)&&e.charCodeAt(n)<=Ke)t*=16,t+=e.charCodeAt(n)-Ge+10;else break;if(t>=Ye)return{n:0,c:n,ok:!1}}return n===0?{n:0,c:n,ok:!1}:{n:t,c:n,ok:!0}}var Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe=o((()=>{Ve=4,He=16,Ue=48,We=57,Ge=65,Ke=70,qe=97,Je=102,Ye=16777215}));function Ze(e){return e.indexOf(`[`)!==-1||e.indexOf(`::`)!==-1?!1:e.indexOf(`.`)!==-1||e.split(`:`).length<=2}function Qe(e){return!Ze(e)}function $e(e){let t=e.toUpperCase().indexOf(`::FFFF:`);if(t!==-1&&e.indexOf(`.`)!==-1){let n=e.substring(t+7);return n=n.replace(`[`,``),n.replace(`]`,``)}return e}function et(e){e=e.trim(),e.match(/^(.*:\\/\\/)(.*)/m)&&(e=e.replace(/^(.*:\\/\\/)(.*)/gm,`$2`)),e=$e(e),Qe(e)&&e.indexOf(`[`)===-1&&(e=`[${e}]`);let t=Qe(e)?e.match(/(]:)(\\d+)/):e.match(/(:)(\\d+)/),n=t&&t.length===3&&t[1]&&t[2]?parseInt(t[2]):_e,r=new URL(`${n===80?`https`:`http`}://${e}`);r.port=`${n}`;let i=r.hostname;return i.charAt(0)===`[`&&(i=i.substring(1,i.length-1)),{listen:r.host,hostname:i,port:n}}var tt,nt,rt=o((()=>{Ne(),le(),Xe(),ye(),I(),tt=class e{src;listen;hostname;port;didConnect;reconnects;lastConnect;gossiped;tlsName;resolves;constructor(e,t=!1){this.src=e,this.tlsName=``;let n=et(e);this.listen=n.listen,this.hostname=n.hostname,this.port=n.port,this.didConnect=!1,this.reconnects=0,this.lastConnect=0,this.gossiped=t}toString(){return this.listen}async resolve(t){if(!t.fn||t.resolve===!1)return[this];let n=[];if(Fe(this.hostname))return[this];{let r=await t.fn(this.hostname);t.debug&&console.log(`resolve ${this.hostname} = ${r.join(`,`)}`);for(let t of r){let r=this.port===80?`https`:`http`,i=new URL(`${r}://${Qe(t)?`[`+t+`]`:t}`);i.port=`${this.port}`;let a=new e(i.host,!1);a.tlsName=this.hostname,n.push(a)}}return t.randomize&&ee(n),this.resolves=n,n}},nt=class e{firstSelect;servers;currentServer;tlsName;randomize;constructor(e={}){this.firstSelect=!0,this.servers=[],this.tlsName=``,this.randomize=e.randomize||!1}setServers(e){if(!Array.isArray(e)||e.length===0)throw C.format(`servers`,`cannot be empty`);let t=we(),n=new Map;for(let e of this.servers)n.set(e.listen,e);let r=[];for(let i of e){i=t?t(i):i;let{listen:e}=et(i),a=n.get(e);a?(a.gossiped=!1,a.src!==i&&(a.src=i),r.push(a)):r.push(new tt(i))}this.randomize&&ee(r),this.servers=r,(this.currentServer===void 0||!r.includes(this.currentServer))&&(this.currentServer=r[0],this.firstSelect=!0)}clear(){this.servers.length=0}updateTLSName(){let e=this.getCurrentServer();Fe(e.hostname)||(this.tlsName=e.hostname,this.servers.forEach(e=>{e.gossiped&&(e.tlsName=this.tlsName)}))}getCurrentServer(){return this.currentServer}addServer(e,t=!1){let n=we();e=n?n(e):e;let r=new tt(e,t);Fe(r.hostname)&&(r.tlsName=this.tlsName),this.servers.push(r)}selectServer(){if(this.firstSelect)return this.firstSelect=!1,this.currentServer;let e=this.servers.shift();return e&&(this.servers.push(e),this.currentServer=e),e}removeCurrentServer(){this.removeServer(this.currentServer)}removeServer(e){if(e){let t=this.servers.indexOf(e);this.servers.splice(t,1)}}snapshot(){return e.freezeAll(this.servers)}snapshotForHandler(){let t=this.currentServer;if(!t)return this.snapshot();let n=this.servers.indexOf(t);return n<=0?this.snapshot():e.freezeAll([t,...this.servers.slice(0,n),...this.servers.slice(n+1)])}static freezeAll(e){return e.map(e=>Object.freeze({hostname:e.hostname,port:e.port,listen:e.listen,src:e.src,tlsName:e.tlsName,reconnects:e.reconnects,lastConnect:e.lastConnect,gossiped:e.gossiped,didConnect:e.didConnect}))}find(e){return this.servers.find(t=>t.listen===e.listen)}setCurrent(e){this.currentServer=e}length(){return this.servers.length}next(){return this.servers.length?this.servers[0]:void 0}getServers(){return this.servers}update(e,t){let n=[],r=[],i=we(),a=new Map;e.connect_urls&&e.connect_urls.length>0&&e.connect_urls.forEach(e=>{e=i?i(e,t):e;let n=new tt(e,!0);a.set(e,n)});let o=[];if(this.servers.forEach((e,t)=>{let n=e.listen;e.gossiped&&this.currentServer.listen!==n&&a.get(n)===void 0&&o.push(t),a.delete(n)}),o.reverse(),o.forEach(e=>{let t=this.servers.splice(e,1);r=r.concat(t[0].listen)}),a.forEach((e,t)=>{this.servers.push(e),n.push(t)}),this.randomize&&n.length>0){let e=this.currentServer,t=this.servers.filter(t=>t!==e);ee(t),this.servers=e?[e,...t]:t}return{added:n,deleted:r}}}})),it,at=o((()=>{le(),I(),it=class{inflight;processed;received;noIterator;iterClosed;done;signal;yields;filtered;pendingFiltered;ctx;_data;err;time;profile;yielding;didBreak;constructor(){this.inflight=0,this.filtered=0,this.pendingFiltered=0,this.processed=0,this.received=0,this.noIterator=!1,this.done=!1,this.signal=H(),this.yields=[],this.iterClosed=H(),this.time=0,this.yielding=!1,this.didBreak=!1,this.profile=!1}[Symbol.asyncIterator](){return this.iterate()}push(e){if(!this.done){if(this.didBreak){if(typeof e==`function`){let t=e;try{t()}catch{}}return}typeof e==`function`&&this.pendingFiltered++,this.yields.push(e),this.signal.resolve()}}async*iterate(){if(this.noIterator)throw new w(`iterator cannot be used when a callback is registered`);if(this.yielding)throw new w(`iterator is already yielding`);this.yielding=!0;try{for(;;){if(this.yields.length===0&&await this.signal,this.err)throw this.err;let e=this.yields;this.inflight=e.length,this.yields=[];for(let t=0;t<e.length;t++){if(typeof e[t]==`function`){this.pendingFiltered--;let n=e[t];try{n()}catch(e){throw e}if(this.err)throw this.err;continue}this.processed++,this.inflight--;let n=this.profile?Date.now():0;yield e[t],this.time=this.profile?Date.now()-n:0}if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=H())}}finally{this.didBreak=!0,this.stop()}}stop(e){this.done||(this.err=e,this.done=!0,this.signal.resolve(),this.iterClosed.resolve(e))}getProcessed(){return this.noIterator?this.received:this.processed}getPending(){return this.yields.length+this.inflight-this.pendingFiltered}getReceived(){return this.received-this.filtered}}})),ot,st=o((()=>{ye(),I(),ot=class{baseInbox;reqs;constructor(){this.reqs=new Map}size(){return this.reqs.size}init(e){return this.baseInbox=`${he(e)}.`,this.baseInbox}add(e){isNaN(e.received)||(e.received=0),this.reqs.set(e.token,e)}get(e){return this.reqs.get(e)}cancel(e){this.reqs.delete(e.token)}getToken(e){let t=e.subject||``;return t.indexOf(this.baseInbox)===0?t.substring(this.baseInbox.length):null}all(){return Array.from(this.reqs.values())}handleError(e,t){if(e)return this.all().forEach(e=>{e.resolver(t,{})}),!0;if(t.operation===`publish`){let e=this.all().find(e=>e.requestSubject===t.subject);if(e)return e.resolver(t,{}),!0}return!1}dispatcher(){return(e,t)=>{let n=this.getToken(t);if(n){let r=this.get(n);r&&(e===null&&(e=t?.data?.length===0&&t.headers?.code===503?new N(r.requestSubject):null),r.resolver(e,t))}}}close(){let e=new j(`connection closed`);this.reqs.forEach(t=>{t.resolver(e,{})})}}})),ct,lt=o((()=>{le(),ct=class{ph;interval;maxOut;timeout;timer;pendings;constructor(e,t,n,r=0){this.ph=e,this.interval=t,this.maxOut=n,this.timeout=r,this.pendings=[]}start(){this.cancel(),this._schedule()}cancel(e){this.timer&&=(clearTimeout(this.timer),void 0),this._reset(),e&&this.ph.disconnect()}_schedule(){this.timer=setTimeout(()=>{if(this.ph.dispatchStatus({type:`ping`,pendingPings:this.pendings.length+1}),this.pendings.length===this.maxOut){this.cancel(!0);return}let e=H(),t;this.timeout>0&&(t=setTimeout(()=>{t=void 0,this.cancel(!0)},this.timeout));let n=()=>{t!==void 0&&(clearTimeout(t),t=void 0)};this.ph.flush(e).then(()=>{n(),this._reset()}).catch(()=>{n(),this.cancel()}),this.pendings.push(e),this._schedule()},this.interval)}_reset(){this.pendings=this.pendings.filter(e=>(e.resolve(),!1))}}}));function ut(e,t=`Assertion failed.`){if(!e)throw new mt(t)}function dt(e,t,n=0){let r=t.byteLength-n;return e.byteLength>r&&(e=e.subarray(0,r)),t.set(e,n),e.byteLength}function ft(e){let t=new _t;return t.readFrom(e),t.bytes()}function pt(e,t){let n=0;for(;n<t.length;)n+=e.write(t.subarray(n))}var mt,ht,gt,_t,vt=o((()=>{x(),mt=class extends Error{constructor(e){super(e),this.name=`AssertionError`}},ht=32*1024,gt=2**32-2,_t=class{_buf;_off;constructor(e){if(this._off=0,e==null){this._buf=new Uint8Array;return}this._buf=new Uint8Array(e)}bytes(e={copy:!0}){return e.copy===!1?this._buf.subarray(this._off):this._buf.slice(this._off)}empty(){return this._buf.byteLength<=this._off}get length(){return this._buf.byteLength-this._off}get capacity(){return this._buf.buffer.byteLength}truncate(e){if(e===0){this.reset();return}if(e<0||e>this.length)throw Error(`bytes.Buffer: truncation out of range`);this._reslice(this._off+e)}reset(){this._reslice(0),this._off=0}_tryGrowByReslice(e){let t=this._buf.byteLength;return e<=this.capacity-t?(this._reslice(t+e),t):-1}_reslice(e){ut(e<=this._buf.buffer.byteLength),this._buf=new Uint8Array(this._buf.buffer,0,e)}readByte(){let e=new Uint8Array(1);return this.read(e)?e[0]:null}read(e){if(this.empty())return this.reset(),e.byteLength===0?0:null;let t=dt(this._buf.subarray(this._off),e);return this._off+=t,t}writeByte(e){return this.write(Uint8Array.of(e))}writeString(e){return this.write(y.encode(e))}write(e){let t=this._grow(e.byteLength);return dt(e,this._buf,t)}_grow(e){let t=this.length;t===0&&this._off!==0&&this.reset();let n=this._tryGrowByReslice(e);if(n>=0)return n;let r=this.capacity;if(e<=Math.floor(r/2)-t)dt(this._buf.subarray(this._off),this._buf);else if(r+e>gt)throw Error(`The buffer cannot be grown beyond the maximum size.`);else{let t=new Uint8Array(Math.min(2*r+e,gt));dt(this._buf.subarray(this._off),t),this._buf=t}return this._off=0,this._reslice(Math.min(t+e,gt)),t}grow(e){if(e<0)throw Error(`Buffer._grow: negative count`);let t=this._grow(e);this._reslice(t)}readFrom(e){let t=0,n=new Uint8Array(ht);for(;;){let r=this.capacity-this.length<ht,i=r?n:new Uint8Array(this._buf.buffer,this.length),a=e.read(i);if(a===null)return t;r?this.write(i.subarray(0,a)):this._reslice(this.length+a),t+=a}}}}));function yt(e){let t,n=``;switch(e.kind){case xt.MSG:t=`MSG`;break;case xt.OK:t=`OK`;break;case xt.ERR:t=`ERR`,n=b.decode(e.data);break;case xt.PING:t=`PING`;break;case xt.PONG:t=`PONG`;break;case xt.INFO:t=`INFO`,n=b.decode(e.data)}return`${t}: ${n}`}function bt(){let e={};return e.sid=-1,e.hdr=-1,e.size=-1,e}var xt,St,Ct,wt,Tt,K,q,Et=o((()=>{vt(),x(),xt={OK:0,ERR:1,MSG:2,INFO:3,PING:4,PONG:5},St=48,Ct=57,wt=64*1024*1024,Tt=class{dispatcher;state;as;drop;hdr;ma;argBuf;msgBuf;constructor(e){this.dispatcher=e,this.state=K.OP_START,this.as=0,this.drop=0,this.hdr=0}parse(e){let t;for(t=0;t<e.length;t++){let n=e[t];switch(this.state){case K.OP_START:switch(n){case q.M:case q.m:this.state=K.OP_M,this.hdr=-1,this.ma=bt();break;case q.H:case q.h:this.state=K.OP_H,this.hdr=0,this.ma=bt();break;case q.P:case q.p:this.state=K.OP_P;break;case q.PLUS:this.state=K.OP_PLUS;break;case q.MINUS:this.state=K.OP_MINUS;break;case q.I:case q.i:this.state=K.OP_I;break;default:throw this.fail(e.subarray(t))}break;case K.OP_H:switch(n){case q.M:case q.m:this.state=K.OP_M;break;default:throw this.fail(e.subarray(t))}break;case K.OP_M:switch(n){case q.S:case q.s:this.state=K.OP_MS;break;default:throw this.fail(e.subarray(t))}break;case K.OP_MS:switch(n){case q.G:case q.g:this.state=K.OP_MSG;break;default:throw this.fail(e.subarray(t))}break;case K.OP_MSG:switch(n){case q.SPACE:case q.TAB:this.state=K.OP_MSG_SPC;break;default:throw this.fail(e.subarray(t))}break;case K.OP_MSG_SPC:switch(n){case q.SPACE:case q.TAB:continue;default:this.state=K.MSG_ARG,this.as=t}break;case K.MSG_ARG:switch(n){case q.CR:this.drop=1;break;case q.NL:{let n=this.argBuf?this.argBuf.bytes():e.subarray(this.as,t-this.drop);this.processMsgArgs(n),this.drop=0,this.as=t+1,this.state=K.MSG_PAYLOAD,t=this.as+this.ma.size-1;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;case K.MSG_PAYLOAD:if(this.msgBuf)if(this.msgBuf.length>=this.ma.size){let e=this.msgBuf.bytes({copy:!1});this.dispatcher.push({kind:xt.MSG,msg:this.ma,data:e}),this.argBuf=void 0,this.msgBuf=void 0,this.state=K.MSG_END}else{let r=this.ma.size-this.msgBuf.length,i=e.length-t;i<r&&(r=i),r>0?(this.msgBuf.write(e.subarray(t,t+r)),t=t+r-1):this.msgBuf.writeByte(n)}else t-this.as>=this.ma.size&&(this.dispatcher.push({kind:xt.MSG,msg:this.ma,data:e.subarray(this.as,t)}),this.argBuf=void 0,this.msgBuf=void 0,this.state=K.MSG_END);break;case K.MSG_END:switch(n){case q.NL:this.drop=0,this.as=t+1,this.state=K.OP_START;break;default:continue}break;case K.OP_PLUS:switch(n){case q.O:case q.o:this.state=K.OP_PLUS_O;break;default:throw this.fail(e.subarray(t))}break;case K.OP_PLUS_O:switch(n){case q.K:case q.k:this.state=K.OP_PLUS_OK;break;default:throw this.fail(e.subarray(t))}break;case K.OP_PLUS_OK:switch(n){case q.NL:this.dispatcher.push({kind:xt.OK}),this.drop=0,this.state=K.OP_START;break}break;case K.OP_MINUS:switch(n){case q.E:case q.e:this.state=K.OP_MINUS_E;break;default:throw this.fail(e.subarray(t))}break;case K.OP_MINUS_E:switch(n){case q.R:case q.r:this.state=K.OP_MINUS_ER;break;default:throw this.fail(e.subarray(t))}break;case K.OP_MINUS_ER:switch(n){case q.R:case q.r:this.state=K.OP_MINUS_ERR;break;default:throw this.fail(e.subarray(t))}break;case K.OP_MINUS_ERR:switch(n){case q.SPACE:case q.TAB:this.state=K.OP_MINUS_ERR_SPC;break;default:throw this.fail(e.subarray(t))}break;case K.OP_MINUS_ERR_SPC:switch(n){case q.SPACE:case q.TAB:continue;default:this.state=K.MINUS_ERR_ARG,this.as=t}break;case K.MINUS_ERR_ARG:switch(n){case q.CR:this.drop=1;break;case q.NL:{let n;this.argBuf?(n=this.argBuf.bytes(),this.argBuf=void 0):n=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:xt.ERR,data:n}),this.drop=0,this.as=t+1,this.state=K.OP_START;break}default:this.argBuf&&this.argBuf.write(Uint8Array.of(n))}break;case K.OP_P:switch(n){case q.I:case q.i:this.state=K.OP_PI;break;case q.O:case q.o:this.state=K.OP_PO;break;default:throw this.fail(e.subarray(t))}break;case K.OP_PO:switch(n){case q.N:case q.n:this.state=K.OP_PON;break;default:throw this.fail(e.subarray(t))}break;case K.OP_PON:switch(n){case q.G:case q.g:this.state=K.OP_PONG;break;default:throw this.fail(e.subarray(t))}break;case K.OP_PONG:switch(n){case q.NL:this.dispatcher.push({kind:xt.PONG}),this.drop=0,this.state=K.OP_START;break}break;case K.OP_PI:switch(n){case q.N:case q.n:this.state=K.OP_PIN;break;default:throw this.fail(e.subarray(t))}break;case K.OP_PIN:switch(n){case q.G:case q.g:this.state=K.OP_PING;break;default:throw this.fail(e.subarray(t))}break;case K.OP_PING:switch(n){case q.NL:this.dispatcher.push({kind:xt.PING}),this.drop=0,this.state=K.OP_START;break}break;case K.OP_I:switch(n){case q.N:case q.n:this.state=K.OP_IN;break;default:throw this.fail(e.subarray(t))}break;case K.OP_IN:switch(n){case q.F:case q.f:this.state=K.OP_INF;break;default:throw this.fail(e.subarray(t))}break;case K.OP_INF:switch(n){case q.O:case q.o:this.state=K.OP_INFO;break;default:throw this.fail(e.subarray(t))}break;case K.OP_INFO:switch(n){case q.SPACE:case q.TAB:this.state=K.OP_INFO_SPC;break;default:throw this.fail(e.subarray(t))}break;case K.OP_INFO_SPC:switch(n){case q.SPACE:case q.TAB:continue;default:this.state=K.INFO_ARG,this.as=t}break;case K.INFO_ARG:switch(n){case q.CR:this.drop=1;break;case q.NL:{let n;this.argBuf?(n=this.argBuf.bytes(),this.argBuf=void 0):n=e.subarray(this.as,t-this.drop),this.dispatcher.push({kind:xt.INFO,data:n}),this.drop=0,this.as=t+1,this.state=K.OP_START;break}default:this.argBuf&&this.argBuf.writeByte(n)}break;default:throw this.fail(e.subarray(t))}}(this.state===K.MSG_ARG||this.state===K.MINUS_ERR_ARG||this.state===K.INFO_ARG)&&!this.argBuf&&(this.argBuf=new _t(e.subarray(this.as,t-this.drop))),this.state===K.MSG_PAYLOAD&&!this.msgBuf&&(this.argBuf||this.cloneMsgArg(),this.msgBuf=new _t(e.subarray(this.as)))}cloneMsgArg(){let e=this.ma.subject.length,t=this.ma.reply?this.ma.reply.length:0,n=new Uint8Array(e+t);n.set(this.ma.subject),this.ma.reply&&n.set(this.ma.reply,e),this.argBuf=new _t(n),this.ma.subject=n.subarray(0,e),this.ma.reply&&(this.ma.reply=n.subarray(e))}processMsgArgs(e){if(this.hdr>=0)return this.processHeaderMsgArgs(e);let t=[],n=-1;for(let r=0;r<e.length;r++)switch(e[r]){case q.SPACE:case q.TAB:case q.CR:case q.NL:n>=0&&(t.push(e.subarray(n,r)),n=-1);break;default:n<0&&(n=r)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 3:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.size=this.protoParseInt(t[2],wt);break;case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.size=this.protoParseInt(t[3],wt);break;default:throw this.fail(e,`processMsgArgs Parse Error`)}if(this.ma.sid<0)throw this.fail(e,`processMsgArgs Bad or Missing Sid Error`);if(this.ma.size<0)throw this.fail(e,`processMsgArgs Bad or Missing Size Error`)}fail(e,t=``){return t=t?`${t} [${this.state}]`:`parse error [${this.state}]`,Error(`${t}: ${b.decode(e)}`)}processHeaderMsgArgs(e){let t=[],n=-1;for(let r=0;r<e.length;r++)switch(e[r]){case q.SPACE:case q.TAB:case q.CR:case q.NL:n>=0&&(t.push(e.subarray(n,r)),n=-1);break;default:n<0&&(n=r)}switch(n>=0&&t.push(e.subarray(n)),t.length){case 4:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=void 0,this.ma.hdr=this.protoParseInt(t[2],wt),this.ma.size=this.protoParseInt(t[3],wt);break;case 5:this.ma.subject=t[0],this.ma.sid=this.protoParseInt(t[1]),this.ma.reply=t[2],this.ma.hdr=this.protoParseInt(t[3],wt),this.ma.size=this.protoParseInt(t[4],wt);break;default:throw this.fail(e,`processHeaderMsgArgs Parse Error`)}if(this.ma.sid<0)throw this.fail(e,`processHeaderMsgArgs Bad or Missing Sid Error`);if(this.ma.hdr<0||this.ma.hdr>this.ma.size)throw this.fail(e,`processHeaderMsgArgs Bad or Missing Header Size Error`);if(this.ma.size<0)throw this.fail(e,`processHeaderMsgArgs Bad or Missing Size Error`)}protoParseInt(e,t){if(e.length===0||e.length>15)return-1;let n=0;for(let t=0;t<e.length;t++){if(e[t]<St||e[t]>Ct)return-1;n=n*10+(e[t]-St)}return t!==void 0&&n>t?-1:n}},K={OP_START:0,OP_PLUS:1,OP_PLUS_O:2,OP_PLUS_OK:3,OP_MINUS:4,OP_MINUS_E:5,OP_MINUS_ER:6,OP_MINUS_ERR:7,OP_MINUS_ERR_SPC:8,MINUS_ERR_ARG:9,OP_M:10,OP_MS:11,OP_MSG:12,OP_MSG_SPC:13,MSG_ARG:14,MSG_PAYLOAD:15,MSG_END:16,OP_H:17,OP_P:18,OP_PI:19,OP_PIN:20,OP_PING:21,OP_PO:22,OP_PON:23,OP_PONG:24,OP_I:25,OP_IN:26,OP_INF:27,OP_INFO:28,OP_INFO_SPC:29,INFO_ARG:30},q={CR:13,E:69,e:101,F:70,f:102,G:71,g:103,H:72,h:104,I:73,i:105,K:75,k:107,M:77,m:109,MINUS:45,N:78,n:110,NL:10,O:79,o:111,P:80,p:112,PLUS:43,R:82,r:114,S:83,s:115,SPACE:32,TAB:9}}));function Dt(e){let t=!0,n=Array(e.length);for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i===58||i<33||i>126)throw C.format(`header`,`\'${e[r]}\' is not a valid character in a header name`);t&&97<=i&&i<=122?i-=32:!t&&65<=i&&i<=90&&(i+=32),n[r]=i,t=i==45}return String.fromCharCode(...n)}function Ot(e=0,t=``){if(e===0&&t!==``)throw C.format(`code`,`is required`);if(e>0&&t===``)throw C.format(`description`,`is required`);return new At(e,t)}var kt,At,jt=o((()=>{x(),ye(),I(),kt=`NATS/1.0`,At=class e{_code;headers;_description;constructor(e=0,t=``){this._code=e,this._description=t,this.headers=new Map}[Symbol.iterator](){return this.headers.entries()}size(){return this.headers.size}equals(e){if(e&&this.headers.size===e.headers.size&&this._code===e._code){for(let[t,n]of this.headers){let r=e.values(t);if(n.length!==r.length)return!1;let i=[...n].sort(),a=[...r].sort();for(let e=0;e<i.length;e++)if(i[e]!==a[e])return!1}return!0}return!1}static decode(t){let n=new e,r=b.decode(t).split(`\\r\n`),i=r[0];if(i!==kt){let e=i.replace(kt,``).trim();if(e.length>0){n._code=parseInt(e,10),isNaN(n._code)&&(n._code=0);let t=n._code.toString();e=e.replace(t,``),n._description=e.trim()}}return r.length>=1&&r.slice(1).map(e=>{if(e){let t=e.indexOf(`:`);if(t>-1){let r=e.slice(0,t),i=e.slice(t+1).trim();n.append(r,i)}}}),n}toString(){if(this.headers.size===0&&this._code===0)return``;let e=kt;this._code>0&&this._description!==``&&(e+=` ${this._code} ${this._description}`);for(let[t,n]of this.headers)for(let r=0;r<n.length;r++)e=`${e}\\r\\n${t}: ${n[r]}`;return`${e}\\r\\n\\r\\n`}encode(){return y.encode(this.toString())}static validHeaderValue(e){if(/[\\r\\n]/.test(e))throw C.format(`header`,`values cannot contain \\\\r or \\\\n`);return e.trim()}keys(){let e=[];for(let t of this.headers.keys())e.push(t);return e}findKeys(e,t=ge.Exact){let n=this.keys();switch(t){case ge.Exact:return n.filter(t=>t===e);case ge.CanonicalMIME:return e=Dt(e),n.filter(t=>t===e);default:{let t=e.toLowerCase();return n.filter(e=>t===e.toLowerCase())}}}get(e,t=ge.Exact){let n=this.findKeys(e,t);if(n.length){let e=this.headers.get(n[0]);if(e)return Array.isArray(e)?e[0]:e}return``}last(e,t=ge.Exact){let n=this.findKeys(e,t);if(n.length){let e=this.headers.get(n[0]);if(e)return Array.isArray(e)?e[e.length-1]:e}return``}has(e,t=ge.Exact){return this.findKeys(e,t).length>0}set(e,t,n=ge.Exact){this.delete(e,n),this.append(e,t,n)}append(t,n,r=ge.Exact){let i=Dt(t);r===ge.CanonicalMIME&&(t=i);let a=this.findKeys(t,r);t=a.length>0?a[0]:t;let o=e.validHeaderValue(n),s=this.headers.get(t);s||(s=[],this.headers.set(t,s)),s.push(o)}values(e,t=ge.Exact){let n=[];return this.findKeys(e,t).forEach(e=>{let t=this.headers.get(e);t&&n.push(...t)}),n}delete(e,t=ge.Exact){this.findKeys(e,t).forEach(e=>{this.headers.delete(e)})}get hasError(){return this._code>=300}get status(){return`${this._code} ${this._description}`.trim()}toRecord(){let e={};return this.keys().forEach(t=>{e[t]=this.values(t)}),e}get code(){return this._code}get description(){return this._description}static fromRecord(t){let n=new e;for(let e in t){let r=t[e];n.headers.set(e,Array.isArray(r)?r:[`${r}`])}return n}}})),Mt,Nt=o((()=>{jt(),x(),Mt=class{_headers;_msg;_rdata;_reply;_subject;publisher;constructor(e,t,n){this._msg=e,this._rdata=t,this.publisher=n}get subject(){return this._subject||=b.decode(this._msg.subject),this._subject}get reply(){return this._reply||=b.decode(this._msg.reply),this._reply}get sid(){return this._msg.sid}get headers(){if(this._msg.hdr>-1&&!this._headers){let e=this._rdata.subarray(0,this._msg.hdr);this._headers=At.decode(e)}return this._headers}get data(){return this._rdata?this._msg.hdr>-1?this._rdata.subarray(this._msg.hdr):this._rdata:new Uint8Array}respond(e=v,t){return this.reply?(this.publisher.publish(this.reply,e,t),!0):!1}size(){let e=this._msg.subject.length,t=this._msg.reply?.length||0,n=this._msg.size===-1?0:this._msg.size;return e+t+n}json(e){return JSON.parse(this.string(),e)}string(){return b.decode(this.data)}requestInfo(){let e=this.headers?.get(`Nats-Request-Info`);return e?JSON.parse(e,function(e,t){return(e===`start`||e===`stop`)&&t!==``?new Date(Date.parse(t)):t}):null}}}));function Pt(e=``){let t=e.match(/(\\d+).(\\d+).(\\d+)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),micro:parseInt(t[3])};throw Error(`\'${e}\' is not a semver value`)}function Ft(e,t){return e.major<t.major?-1:e.major>t.major?1:e.minor<t.minor?-1:e.minor>t.minor?1:e.micro<t.micro?-1:+(e.micro>t.micro)}var It,Lt,Rt=o((()=>{It={JS_KV:`js_kv`,JS_OBJECTSTORE:`js_objectstore`,JS_PULL_MAX_BYTES:`js_pull_max_bytes`,JS_NEW_CONSUMER_CREATE_API:`js_new_consumer_create`,JS_ALLOW_DIRECT:`js_allow_direct`,JS_MULTIPLE_CONSUMER_FILTER:`js_multiple_consumer_filter`,JS_SIMPLIFICATION:`js_simplification`,JS_STREAM_CONSUMER_METADATA:`js_stream_consumer_metadata`,JS_CONSUMER_FILTER_SUBJECTS:`js_consumer_filter_subjects`,JS_STREAM_FIRST_SEQ:`js_stream_first_seq`,JS_STREAM_SUBJECT_TRANSFORM:`js_stream_subject_transform`,JS_STREAM_SOURCE_SUBJECT_TRANSFORM:`js_stream_source_subject_transform`,JS_STREAM_COMPRESSION:`js_stream_compression`,JS_DEFAULT_CONSUMER_LIMITS:`js_default_consumer_limits`,JS_BATCH_DIRECT_GET:`js_batch_direct_get`,JS_PRIORITY_GROUPS:`js_priority_groups`,JS_CONSUMER_RESET:`js_consumer_reset`},Lt=class{server;features;disabled;constructor(e){this.features=new Map,this.disabled=[],this.update(e)}resetDisabled(){this.disabled.length=0,this.update(this.server)}disable(e){this.disabled.push(e),this.update(this.server)}isDisabled(e){return this.disabled.indexOf(e)!==-1}update(e){typeof e==`string`&&(e=Pt(e)),this.server=e,this.set(It.JS_KV,`2.6.2`),this.set(It.JS_OBJECTSTORE,`2.6.3`),this.set(It.JS_PULL_MAX_BYTES,`2.8.3`),this.set(It.JS_NEW_CONSUMER_CREATE_API,`2.9.0`),this.set(It.JS_ALLOW_DIRECT,`2.9.0`),this.set(It.JS_MULTIPLE_CONSUMER_FILTER,`2.10.0`),this.set(It.JS_SIMPLIFICATION,`2.9.4`),this.set(It.JS_STREAM_CONSUMER_METADATA,`2.10.0`),this.set(It.JS_CONSUMER_FILTER_SUBJECTS,`2.10.0`),this.set(It.JS_STREAM_FIRST_SEQ,`2.10.0`),this.set(It.JS_STREAM_SUBJECT_TRANSFORM,`2.10.0`),this.set(It.JS_STREAM_SOURCE_SUBJECT_TRANSFORM,`2.10.0`),this.set(It.JS_STREAM_COMPRESSION,`2.10.0`),this.set(It.JS_DEFAULT_CONSUMER_LIMITS,`2.10.0`),this.set(It.JS_BATCH_DIRECT_GET,`2.11.0`),this.set(It.JS_PRIORITY_GROUPS,`2.11.0`),this.set(It.JS_CONSUMER_RESET,`2.14.0`),this.disabled.forEach(e=>{this.features.delete(e)})}set(e,t){this.features.set(e,{min:t,ok:Ft(this.server,Pt(t))>=0})}get(e){return this.features.get(e)||{min:`unknown`,ok:!1}}supports(e){return this.get(e)?.ok||!1}require(e){return typeof e==`string`&&(e=Pt(e)),Ft(this.server,e)>=0}}})),zt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.crc16=void 0;let t=new Uint16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);e.crc16=class e{static checksum(e){let n=0;for(let r=0;r<e.byteLength;r++){let i=e[r];n=n<<8&65535^t[(n>>8^i)&255]}return n}static validate(t,n){return e.checksum(t)==n}}})),Bt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.base32=void 0;let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`;e.base32=class{static encode(e){let n=0,r=0,i=new Uint8Array(e),a=new Uint8Array(e.byteLength*2),o=0;for(let e=0;e<i.byteLength;e++)for(r=r<<8|i[e],n+=8;n>=5;){let e=r>>>n-5&31;a[o++]=t.charAt(e).charCodeAt(0),n-=5}if(n>0){let e=r<<5-n&31;a[o++]=t.charAt(e).charCodeAt(0)}return a.slice(0,o)}static decode(e){let n=0,r=0,i=0,a=new Uint8Array(e),o=new Uint8Array(a.byteLength*5/8|0);for(let e=0;e<a.byteLength;e++){let s=String.fromCharCode(a[e]),c=t.indexOf(s);if(c===-1)throw Error(`Illegal Base32 character: `+a[e]);r=r<<5|c,n+=5,n>=8&&(o[i++]=r>>>n-8&255,n-=8)}return o.slice(0,i)}}})),Vt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Codec=void 0;let t=zt(),n=Jt(),r=Bt();e.Codec=class e{static encode(t,r){if(!r||!(r instanceof Uint8Array))throw new n.NKeysError(n.NKeysErrorCode.SerializationError);if(!n.Prefixes.isValidPrefix(t))throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);return e._encode(!1,t,r)}static encodeSeed(t,r){if(!r)throw new n.NKeysError(n.NKeysErrorCode.ApiError);if(!n.Prefixes.isValidPublicPrefix(t))throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);if(r.byteLength!==32)throw new n.NKeysError(n.NKeysErrorCode.InvalidSeedLen);return e._encode(!0,t,r)}static decode(t,r){if(!n.Prefixes.isValidPrefix(t))throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);let i=e._decode(r);if(i[0]!==t)throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);return i.slice(1)}static decodeSeed(t){let r=e._decode(t),i=e._decodePrefix(r);if(i[0]!=n.Prefix.Seed)throw new n.NKeysError(n.NKeysErrorCode.InvalidSeed);if(!n.Prefixes.isValidPublicPrefix(i[1]))throw new n.NKeysError(n.NKeysErrorCode.InvalidPrefixByte);return{buf:r.slice(2),prefix:i[1]}}static _encode(i,a,o){let s=i?2:1,c=o.byteLength,l=s+c+2,u=s+c,d=new Uint8Array(l);if(i){let t=e._encodePrefix(n.Prefix.Seed,a);d.set(t)}else d[0]=a;d.set(o,s);let f=t.crc16.checksum(d.slice(0,u));return new DataView(d.buffer).setUint16(u,f,!0),r.base32.encode(d)}static _decode(e){if(e.byteLength<4)throw new n.NKeysError(n.NKeysErrorCode.InvalidEncoding);let i;try{i=r.base32.decode(e)}catch(e){throw new n.NKeysError(n.NKeysErrorCode.InvalidEncoding,{cause:e})}let a=i.byteLength-2,o=new DataView(i.buffer).getUint16(a,!0),s=i.slice(0,a);if(!t.crc16.validate(s,o))throw new n.NKeysError(n.NKeysErrorCode.InvalidChecksum);return s}static _encodePrefix(e,t){let n=e|t>>5,r=(t&31)<<3;return new Uint8Array([n,r])}static _decodePrefix(e){let t=e[0]&248,n=(e[0]&7)<<5|(e[1]&248)>>3;return new Uint8Array([t,n])}}})),Ht=s(((e,t)=>{t.exports={}})),Ut=s(((e,t)=>{(function(e){"use strict";var t=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t<e.length;t++)n[t]=e[t];return n},n=function(){throw Error(`no PRNG`)},r=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var a=t(),o=t([1]),s=t([56129,1]),c=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),d=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function p(e,t,n,r){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=r&255}function m(e,t,n,r,i){var a,o=0;for(a=0;a<i;a++)o|=e[t+a]^n[r+a];return(1&o-1>>>8)-1}function h(e,t,n,r){return m(e,t,n,r,16)}function g(e,t,n,r){return m(e,t,n,r,32)}function _(e,t,n,r){for(var i=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,a=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,s=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,l=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,u=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,d=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,f=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,p=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,h=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,g=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,_=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,v=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,y=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,b=i,x=a,S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,j=h,M=g,N=_,P=v,F=y,I,L=0;L<20;L+=2)I=b+M|0,w^=I<<7|I>>>25,I=w+b|0,O^=I<<9|I>>>23,I=O+w|0,M^=I<<13|I>>>19,I=M+O|0,b^=I<<18|I>>>14,I=T+x|0,k^=I<<7|I>>>25,I=k+T|0,N^=I<<9|I>>>23,I=N+k|0,x^=I<<13|I>>>19,I=x+N|0,T^=I<<18|I>>>14,I=A+E|0,P^=I<<7|I>>>25,I=P+A|0,S^=I<<9|I>>>23,I=S+P|0,E^=I<<13|I>>>19,I=E+S|0,A^=I<<18|I>>>14,I=F+j|0,C^=I<<7|I>>>25,I=C+F|0,D^=I<<9|I>>>23,I=D+C|0,j^=I<<13|I>>>19,I=j+D|0,F^=I<<18|I>>>14,I=b+C|0,x^=I<<7|I>>>25,I=x+b|0,S^=I<<9|I>>>23,I=S+x|0,C^=I<<13|I>>>19,I=C+S|0,b^=I<<18|I>>>14,I=T+w|0,E^=I<<7|I>>>25,I=E+T|0,D^=I<<9|I>>>23,I=D+E|0,w^=I<<13|I>>>19,I=w+D|0,T^=I<<18|I>>>14,I=A+k|0,j^=I<<7|I>>>25,I=j+A|0,O^=I<<9|I>>>23,I=O+j|0,k^=I<<13|I>>>19,I=k+O|0,A^=I<<18|I>>>14,I=F+P|0,M^=I<<7|I>>>25,I=M+F|0,N^=I<<9|I>>>23,I=N+M|0,P^=I<<13|I>>>19,I=P+N|0,F^=I<<18|I>>>14;b=b+i|0,x=x+a|0,S=S+o|0,C=C+s|0,w=w+c|0,T=T+l|0,E=E+u|0,D=D+d|0,O=O+f|0,k=k+p|0,A=A+m|0,j=j+h|0,M=M+g|0,N=N+_|0,P=P+v|0,F=F+y|0,e[0]=b>>>0&255,e[1]=b>>>8&255,e[2]=b>>>16&255,e[3]=b>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=C>>>0&255,e[13]=C>>>8&255,e[14]=C>>>16&255,e[15]=C>>>24&255,e[16]=w>>>0&255,e[17]=w>>>8&255,e[18]=w>>>16&255,e[19]=w>>>24&255,e[20]=T>>>0&255,e[21]=T>>>8&255,e[22]=T>>>16&255,e[23]=T>>>24&255,e[24]=E>>>0&255,e[25]=E>>>8&255,e[26]=E>>>16&255,e[27]=E>>>24&255,e[28]=D>>>0&255,e[29]=D>>>8&255,e[30]=D>>>16&255,e[31]=D>>>24&255,e[32]=O>>>0&255,e[33]=O>>>8&255,e[34]=O>>>16&255,e[35]=O>>>24&255,e[36]=k>>>0&255,e[37]=k>>>8&255,e[38]=k>>>16&255,e[39]=k>>>24&255,e[40]=A>>>0&255,e[41]=A>>>8&255,e[42]=A>>>16&255,e[43]=A>>>24&255,e[44]=j>>>0&255,e[45]=j>>>8&255,e[46]=j>>>16&255,e[47]=j>>>24&255,e[48]=M>>>0&255,e[49]=M>>>8&255,e[50]=M>>>16&255,e[51]=M>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}function v(e,t,n,r){for(var i=r[0]&255|(r[1]&255)<<8|(r[2]&255)<<16|(r[3]&255)<<24,a=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,o=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,s=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,c=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,l=r[4]&255|(r[5]&255)<<8|(r[6]&255)<<16|(r[7]&255)<<24,u=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,d=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,f=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,p=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,m=r[8]&255|(r[9]&255)<<8|(r[10]&255)<<16|(r[11]&255)<<24,h=n[16]&255|(n[17]&255)<<8|(n[18]&255)<<16|(n[19]&255)<<24,g=n[20]&255|(n[21]&255)<<8|(n[22]&255)<<16|(n[23]&255)<<24,_=n[24]&255|(n[25]&255)<<8|(n[26]&255)<<16|(n[27]&255)<<24,v=n[28]&255|(n[29]&255)<<8|(n[30]&255)<<16|(n[31]&255)<<24,y=r[12]&255|(r[13]&255)<<8|(r[14]&255)<<16|(r[15]&255)<<24,b=i,x=a,S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,j=h,M=g,N=_,P=v,F=y,I,L=0;L<20;L+=2)I=b+M|0,w^=I<<7|I>>>25,I=w+b|0,O^=I<<9|I>>>23,I=O+w|0,M^=I<<13|I>>>19,I=M+O|0,b^=I<<18|I>>>14,I=T+x|0,k^=I<<7|I>>>25,I=k+T|0,N^=I<<9|I>>>23,I=N+k|0,x^=I<<13|I>>>19,I=x+N|0,T^=I<<18|I>>>14,I=A+E|0,P^=I<<7|I>>>25,I=P+A|0,S^=I<<9|I>>>23,I=S+P|0,E^=I<<13|I>>>19,I=E+S|0,A^=I<<18|I>>>14,I=F+j|0,C^=I<<7|I>>>25,I=C+F|0,D^=I<<9|I>>>23,I=D+C|0,j^=I<<13|I>>>19,I=j+D|0,F^=I<<18|I>>>14,I=b+C|0,x^=I<<7|I>>>25,I=x+b|0,S^=I<<9|I>>>23,I=S+x|0,C^=I<<13|I>>>19,I=C+S|0,b^=I<<18|I>>>14,I=T+w|0,E^=I<<7|I>>>25,I=E+T|0,D^=I<<9|I>>>23,I=D+E|0,w^=I<<13|I>>>19,I=w+D|0,T^=I<<18|I>>>14,I=A+k|0,j^=I<<7|I>>>25,I=j+A|0,O^=I<<9|I>>>23,I=O+j|0,k^=I<<13|I>>>19,I=k+O|0,A^=I<<18|I>>>14,I=F+P|0,M^=I<<7|I>>>25,I=M+F|0,N^=I<<9|I>>>23,I=N+M|0,P^=I<<13|I>>>19,I=P+N|0,F^=I<<18|I>>>14;e[0]=b>>>0&255,e[1]=b>>>8&255,e[2]=b>>>16&255,e[3]=b>>>24&255,e[4]=T>>>0&255,e[5]=T>>>8&255,e[6]=T>>>16&255,e[7]=T>>>24&255,e[8]=A>>>0&255,e[9]=A>>>8&255,e[10]=A>>>16&255,e[11]=A>>>24&255,e[12]=F>>>0&255,e[13]=F>>>8&255,e[14]=F>>>16&255,e[15]=F>>>24&255,e[16]=E>>>0&255,e[17]=E>>>8&255,e[18]=E>>>16&255,e[19]=E>>>24&255,e[20]=D>>>0&255,e[21]=D>>>8&255,e[22]=D>>>16&255,e[23]=D>>>24&255,e[24]=O>>>0&255,e[25]=O>>>8&255,e[26]=O>>>16&255,e[27]=O>>>24&255,e[28]=k>>>0&255,e[29]=k>>>8&255,e[30]=k>>>16&255,e[31]=k>>>24&255}function y(e,t,n,r){_(e,t,n,r)}function b(e,t,n,r){v(e,t,n,r)}var x=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function S(e,t,n,r,i,a,o){var s=new Uint8Array(16),c=new Uint8Array(64),l,u;for(u=0;u<16;u++)s[u]=0;for(u=0;u<8;u++)s[u]=a[u];for(;i>=64;){for(y(c,s,o,x),u=0;u<64;u++)e[t+u]=n[r+u]^c[u];for(l=1,u=8;u<16;u++)l=l+(s[u]&255)|0,s[u]=l&255,l>>>=8;i-=64,t+=64,r+=64}if(i>0)for(y(c,s,o,x),u=0;u<i;u++)e[t+u]=n[r+u]^c[u];return 0}function C(e,t,n,r,i){var a=new Uint8Array(16),o=new Uint8Array(64),s,c;for(c=0;c<16;c++)a[c]=0;for(c=0;c<8;c++)a[c]=r[c];for(;n>=64;){for(y(o,a,i,x),c=0;c<64;c++)e[t+c]=o[c];for(s=1,c=8;c<16;c++)s=s+(a[c]&255)|0,a[c]=s&255,s>>>=8;n-=64,t+=64}if(n>0)for(y(o,a,i,x),c=0;c<n;c++)e[t+c]=o[c];return 0}function w(e,t,n,r,i){var a=new Uint8Array(32);b(a,r,i,x);for(var o=new Uint8Array(8),s=0;s<8;s++)o[s]=r[s+16];return C(e,t,n,o,a)}function T(e,t,n,r,i,a,o){var s=new Uint8Array(32);b(s,a,o,x);for(var c=new Uint8Array(8),l=0;l<8;l++)c[l]=a[l+16];return S(e,t,n,r,i,c,s)}var E=function(e){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var t=e[0]&255|(e[1]&255)<<8,n,r,i,a,o,s,c;this.r[0]=t&8191,n=e[2]&255|(e[3]&255)<<8,this.r[1]=(t>>>13|n<<3)&8191,r=e[4]&255|(e[5]&255)<<8,this.r[2]=(n>>>10|r<<6)&7939,i=e[6]&255|(e[7]&255)<<8,this.r[3]=(r>>>7|i<<9)&8191,a=e[8]&255|(e[9]&255)<<8,this.r[4]=(i>>>4|a<<12)&255,this.r[5]=a>>>1&8190,o=e[10]&255|(e[11]&255)<<8,this.r[6]=(a>>>14|o<<2)&8191,s=e[12]&255|(e[13]&255)<<8,this.r[7]=(o>>>11|s<<5)&8065,c=e[14]&255|(e[15]&255)<<8,this.r[8]=(s>>>8|c<<8)&8191,this.r[9]=c>>>5&127,this.pad[0]=e[16]&255|(e[17]&255)<<8,this.pad[1]=e[18]&255|(e[19]&255)<<8,this.pad[2]=e[20]&255|(e[21]&255)<<8,this.pad[3]=e[22]&255|(e[23]&255)<<8,this.pad[4]=e[24]&255|(e[25]&255)<<8,this.pad[5]=e[26]&255|(e[27]&255)<<8,this.pad[6]=e[28]&255|(e[29]&255)<<8,this.pad[7]=e[30]&255|(e[31]&255)<<8};E.prototype.blocks=function(e,t,n){for(var r=this.fin?0:2048,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C=this.h[0],w=this.h[1],T=this.h[2],E=this.h[3],D=this.h[4],O=this.h[5],k=this.h[6],A=this.h[7],j=this.h[8],M=this.h[9],N=this.r[0],P=this.r[1],F=this.r[2],I=this.r[3],L=this.r[4],R=this.r[5],z=this.r[6],B=this.r[7],V=this.r[8],H=this.r[9];n>=16;)i=e[t+0]&255|(e[t+1]&255)<<8,C+=i&8191,a=e[t+2]&255|(e[t+3]&255)<<8,w+=(i>>>13|a<<3)&8191,o=e[t+4]&255|(e[t+5]&255)<<8,T+=(a>>>10|o<<6)&8191,s=e[t+6]&255|(e[t+7]&255)<<8,E+=(o>>>7|s<<9)&8191,c=e[t+8]&255|(e[t+9]&255)<<8,D+=(s>>>4|c<<12)&8191,O+=c>>>1&8191,l=e[t+10]&255|(e[t+11]&255)<<8,k+=(c>>>14|l<<2)&8191,u=e[t+12]&255|(e[t+13]&255)<<8,A+=(l>>>11|u<<5)&8191,d=e[t+14]&255|(e[t+15]&255)<<8,j+=(u>>>8|d<<8)&8191,M+=d>>>5|r,f=0,p=f,p+=C*N,p+=5*H*w,p+=5*V*T,p+=5*B*E,p+=5*z*D,f=p>>>13,p&=8191,p+=5*R*O,p+=5*L*k,p+=5*I*A,p+=5*F*j,p+=5*P*M,f+=p>>>13,p&=8191,m=f,m+=C*P,m+=w*N,m+=5*H*T,m+=5*V*E,m+=5*B*D,f=m>>>13,m&=8191,m+=5*z*O,m+=5*R*k,m+=5*L*A,m+=5*I*j,m+=5*F*M,f+=m>>>13,m&=8191,h=f,h+=C*F,h+=w*P,h+=T*N,h+=5*H*E,h+=5*V*D,f=h>>>13,h&=8191,h+=5*B*O,h+=5*z*k,h+=5*R*A,h+=5*L*j,h+=5*I*M,f+=h>>>13,h&=8191,g=f,g+=C*I,g+=w*F,g+=T*P,g+=E*N,g+=5*H*D,f=g>>>13,g&=8191,g+=5*V*O,g+=5*B*k,g+=5*z*A,g+=5*R*j,g+=5*L*M,f+=g>>>13,g&=8191,_=f,_+=C*L,_+=w*I,_+=T*F,_+=E*P,_+=D*N,f=_>>>13,_&=8191,_+=5*H*O,_+=5*V*k,_+=5*B*A,_+=5*z*j,_+=5*R*M,f+=_>>>13,_&=8191,v=f,v+=C*R,v+=w*L,v+=T*I,v+=E*F,v+=D*P,f=v>>>13,v&=8191,v+=O*N,v+=5*H*k,v+=5*V*A,v+=5*B*j,v+=5*z*M,f+=v>>>13,v&=8191,y=f,y+=C*z,y+=w*R,y+=T*L,y+=E*I,y+=D*F,f=y>>>13,y&=8191,y+=O*P,y+=k*N,y+=5*H*A,y+=5*V*j,y+=5*B*M,f+=y>>>13,y&=8191,b=f,b+=C*B,b+=w*z,b+=T*R,b+=E*L,b+=D*I,f=b>>>13,b&=8191,b+=O*F,b+=k*P,b+=A*N,b+=5*H*j,b+=5*V*M,f+=b>>>13,b&=8191,x=f,x+=C*V,x+=w*B,x+=T*z,x+=E*R,x+=D*L,f=x>>>13,x&=8191,x+=O*I,x+=k*F,x+=A*P,x+=j*N,x+=5*H*M,f+=x>>>13,x&=8191,S=f,S+=C*H,S+=w*V,S+=T*B,S+=E*z,S+=D*R,f=S>>>13,S&=8191,S+=O*L,S+=k*I,S+=A*F,S+=j*P,S+=M*N,f+=S>>>13,S&=8191,f=(f<<2)+f|0,f=f+p|0,p=f&8191,f>>>=13,m+=f,C=p,w=m,T=h,E=g,D=_,O=v,k=y,A=b,j=x,M=S,t+=16,n-=16;this.h[0]=C,this.h[1]=w,this.h[2]=T,this.h[3]=E,this.h[4]=D,this.h[5]=O,this.h[6]=k,this.h[7]=A,this.h[8]=j,this.h[9]=M},E.prototype.finish=function(e,t){var n=new Uint16Array(10),r,i,a,o;if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=r*5,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,n[0]=this.h[0]+5,r=n[0]>>>13,n[0]&=8191,o=1;o<10;o++)n[o]=this.h[o]+r,r=n[o]>>>13,n[o]&=8191;for(n[9]-=8192,i=(r^1)-1,o=0;o<10;o++)n[o]&=i;for(i=~i,o=0;o<10;o++)this.h[o]=this.h[o]&i|n[o];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,a=this.h[0]+this.pad[0],this.h[0]=a&65535,o=1;o<8;o++)a=(this.h[o]+this.pad[o]|0)+(a>>>16)|0,this.h[o]=a&65535;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},E.prototype.update=function(e,t,n){var r,i;if(this.leftover){for(i=16-this.leftover,i>n&&(i=n),r=0;r<i;r++)this.buffer[this.leftover+r]=e[t+r];if(n-=i,t+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(i=n-n%16,this.blocks(e,t,i),t+=i,n-=i),n){for(r=0;r<n;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=n}};function D(e,t,n,r,i,a){var o=new E(a);return o.update(n,r,i),o.finish(e,t),0}function O(e,t,n,r,i,a){var o=new Uint8Array(16);return D(o,0,n,r,i,a),h(e,t,o,0)}function k(e,t,n,r,i){var a;if(n<32)return-1;for(T(e,0,t,0,n,r,i),D(e,16,e,32,n-32,e),a=0;a<16;a++)e[a]=0;return 0}function A(e,t,n,r,i){var a,o=new Uint8Array(32);if(n<32||(w(o,0,32,r,i),O(t,16,t,32,n-32,o)!==0))return-1;for(T(e,0,t,0,n,r,i),a=0;a<32;a++)e[a]=0;return 0}function j(e,t){var n;for(n=0;n<16;n++)e[n]=t[n]|0}function M(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-r*65536;e[0]+=r-1+37*(r-1)}function N(e,t,n){for(var r,i=~(n-1),a=0;a<16;a++)r=i&(e[a]^t[a]),e[a]^=r,t[a]^=r}function P(e,n){var r,i,a,o=t(),s=t();for(r=0;r<16;r++)s[r]=n[r];for(M(s),M(s),M(s),i=0;i<2;i++){for(o[0]=s[0]-65517,r=1;r<15;r++)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),a=o[15]>>16&1,o[14]&=65535,N(s,o,1-a)}for(r=0;r<16;r++)e[2*r]=s[r]&255,e[2*r+1]=s[r]>>8}function F(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return P(n,e),P(r,t),g(n,0,r,0)}function I(e){var t=new Uint8Array(32);return P(t,e),t[0]&1}function L(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function R(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function z(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function B(e,t,n){var r,i,a=0,o=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=0,S=0,C=0,w=0,T=0,E=0,D=0,O=0,k=0,A=0,j=0,M=0,N=0,P=0,F=0,I=n[0],L=n[1],R=n[2],z=n[3],B=n[4],V=n[5],H=n[6],ee=n[7],U=n[8],W=n[9],te=n[10],G=n[11],ne=n[12],re=n[13],ie=n[14],ae=n[15];r=t[0],a+=r*I,o+=r*L,s+=r*R,c+=r*z,l+=r*B,u+=r*V,d+=r*H,f+=r*ee,p+=r*U,m+=r*W,h+=r*te,g+=r*G,_+=r*ne,v+=r*re,y+=r*ie,b+=r*ae,r=t[1],o+=r*I,s+=r*L,c+=r*R,l+=r*z,u+=r*B,d+=r*V,f+=r*H,p+=r*ee,m+=r*U,h+=r*W,g+=r*te,_+=r*G,v+=r*ne,y+=r*re,b+=r*ie,x+=r*ae,r=t[2],s+=r*I,c+=r*L,l+=r*R,u+=r*z,d+=r*B,f+=r*V,p+=r*H,m+=r*ee,h+=r*U,g+=r*W,_+=r*te,v+=r*G,y+=r*ne,b+=r*re,x+=r*ie,S+=r*ae,r=t[3],c+=r*I,l+=r*L,u+=r*R,d+=r*z,f+=r*B,p+=r*V,m+=r*H,h+=r*ee,g+=r*U,_+=r*W,v+=r*te,y+=r*G,b+=r*ne,x+=r*re,S+=r*ie,C+=r*ae,r=t[4],l+=r*I,u+=r*L,d+=r*R,f+=r*z,p+=r*B,m+=r*V,h+=r*H,g+=r*ee,_+=r*U,v+=r*W,y+=r*te,b+=r*G,x+=r*ne,S+=r*re,C+=r*ie,w+=r*ae,r=t[5],u+=r*I,d+=r*L,f+=r*R,p+=r*z,m+=r*B,h+=r*V,g+=r*H,_+=r*ee,v+=r*U,y+=r*W,b+=r*te,x+=r*G,S+=r*ne,C+=r*re,w+=r*ie,T+=r*ae,r=t[6],d+=r*I,f+=r*L,p+=r*R,m+=r*z,h+=r*B,g+=r*V,_+=r*H,v+=r*ee,y+=r*U,b+=r*W,x+=r*te,S+=r*G,C+=r*ne,w+=r*re,T+=r*ie,E+=r*ae,r=t[7],f+=r*I,p+=r*L,m+=r*R,h+=r*z,g+=r*B,_+=r*V,v+=r*H,y+=r*ee,b+=r*U,x+=r*W,S+=r*te,C+=r*G,w+=r*ne,T+=r*re,E+=r*ie,D+=r*ae,r=t[8],p+=r*I,m+=r*L,h+=r*R,g+=r*z,_+=r*B,v+=r*V,y+=r*H,b+=r*ee,x+=r*U,S+=r*W,C+=r*te,w+=r*G,T+=r*ne,E+=r*re,D+=r*ie,O+=r*ae,r=t[9],m+=r*I,h+=r*L,g+=r*R,_+=r*z,v+=r*B,y+=r*V,b+=r*H,x+=r*ee,S+=r*U,C+=r*W,w+=r*te,T+=r*G,E+=r*ne,D+=r*re,O+=r*ie,k+=r*ae,r=t[10],h+=r*I,g+=r*L,_+=r*R,v+=r*z,y+=r*B,b+=r*V,x+=r*H,S+=r*ee,C+=r*U,w+=r*W,T+=r*te,E+=r*G,D+=r*ne,O+=r*re,k+=r*ie,A+=r*ae,r=t[11],g+=r*I,_+=r*L,v+=r*R,y+=r*z,b+=r*B,x+=r*V,S+=r*H,C+=r*ee,w+=r*U,T+=r*W,E+=r*te,D+=r*G,O+=r*ne,k+=r*re,A+=r*ie,j+=r*ae,r=t[12],_+=r*I,v+=r*L,y+=r*R,b+=r*z,x+=r*B,S+=r*V,C+=r*H,w+=r*ee,T+=r*U,E+=r*W,D+=r*te,O+=r*G,k+=r*ne,A+=r*re,j+=r*ie,M+=r*ae,r=t[13],v+=r*I,y+=r*L,b+=r*R,x+=r*z,S+=r*B,C+=r*V,w+=r*H,T+=r*ee,E+=r*U,D+=r*W,O+=r*te,k+=r*G,A+=r*ne,j+=r*re,M+=r*ie,N+=r*ae,r=t[14],y+=r*I,b+=r*L,x+=r*R,S+=r*z,C+=r*B,w+=r*V,T+=r*H,E+=r*ee,D+=r*U,O+=r*W,k+=r*te,A+=r*G,j+=r*ne,M+=r*re,N+=r*ie,P+=r*ae,r=t[15],b+=r*I,x+=r*L,S+=r*R,C+=r*z,w+=r*B,T+=r*V,E+=r*H,D+=r*ee,O+=r*U,k+=r*W,A+=r*te,j+=r*G,M+=r*ne,N+=r*re,P+=r*ie,F+=r*ae,a+=38*x,o+=38*S,s+=38*C,c+=38*w,l+=38*T,u+=38*E,d+=38*D,f+=38*O,p+=38*k,m+=38*A,h+=38*j,g+=38*M,_+=38*N,v+=38*P,y+=38*F,i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),i=1,r=a+i+65535,i=Math.floor(r/65536),a=r-i*65536,r=o+i+65535,i=Math.floor(r/65536),o=r-i*65536,r=s+i+65535,i=Math.floor(r/65536),s=r-i*65536,r=c+i+65535,i=Math.floor(r/65536),c=r-i*65536,r=l+i+65535,i=Math.floor(r/65536),l=r-i*65536,r=u+i+65535,i=Math.floor(r/65536),u=r-i*65536,r=d+i+65535,i=Math.floor(r/65536),d=r-i*65536,r=f+i+65535,i=Math.floor(r/65536),f=r-i*65536,r=p+i+65535,i=Math.floor(r/65536),p=r-i*65536,r=m+i+65535,i=Math.floor(r/65536),m=r-i*65536,r=h+i+65535,i=Math.floor(r/65536),h=r-i*65536,r=g+i+65535,i=Math.floor(r/65536),g=r-i*65536,r=_+i+65535,i=Math.floor(r/65536),_=r-i*65536,r=v+i+65535,i=Math.floor(r/65536),v=r-i*65536,r=y+i+65535,i=Math.floor(r/65536),y=r-i*65536,r=b+i+65535,i=Math.floor(r/65536),b=r-i*65536,a+=i-1+37*(i-1),e[0]=a,e[1]=o,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=m,e[10]=h,e[11]=g,e[12]=_,e[13]=v,e[14]=y,e[15]=b}function V(e,t){B(e,t,t)}function H(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=253;i>=0;i--)V(r,r),i!==2&&i!==4&&B(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function ee(e,n){var r=t(),i;for(i=0;i<16;i++)r[i]=n[i];for(i=250;i>=0;i--)V(r,r),i!==1&&B(r,r,n);for(i=0;i<16;i++)e[i]=r[i]}function U(e,n,r){var i=new Uint8Array(32),a=new Float64Array(80),o,c,l=t(),u=t(),d=t(),f=t(),p=t(),m=t();for(c=0;c<31;c++)i[c]=n[c];for(i[31]=n[31]&127|64,i[0]&=248,L(a,r),c=0;c<16;c++)u[c]=a[c],f[c]=l[c]=d[c]=0;for(l[0]=f[0]=1,c=254;c>=0;--c)o=i[c>>>3]>>>(c&7)&1,N(l,u,o),N(d,f,o),R(p,l,d),z(l,l,d),R(d,u,f),z(u,u,f),V(f,p),V(m,l),B(l,d,l),B(d,u,p),R(p,l,d),z(l,l,d),V(u,l),z(d,f,m),B(l,d,s),R(l,l,f),B(d,d,l),B(l,f,m),B(f,u,a),V(u,p),N(l,u,o),N(d,f,o);for(c=0;c<16;c++)a[c+16]=l[c],a[c+32]=d[c],a[c+48]=u[c],a[c+64]=f[c];var h=a.subarray(32),g=a.subarray(16);return H(h,h),B(g,g,h),P(e,g),0}function W(e,t){return U(e,t,i)}function te(e,t){return n(t,32),W(e,t)}function G(e,t,n){var i=new Uint8Array(32);return U(i,n,t),b(e,r,i,x)}var ne=k,re=A;function ie(e,t,n,r,i,a){var o=new Uint8Array(32);return G(o,i,a),ne(e,t,n,r,o)}function ae(e,t,n,r,i,a){var o=new Uint8Array(32);return G(o,i,a),re(e,t,n,r,o)}var oe=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function se(e,t,n,r){for(var i=new Int32Array(16),a=new Int32Array(16),o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=e[0],N=e[1],P=e[2],F=e[3],I=e[4],L=e[5],R=e[6],z=e[7],B=t[0],V=t[1],H=t[2],ee=t[3],U=t[4],W=t[5],te=t[6],G=t[7],ne=0;r>=128;){for(w=0;w<16;w++)T=8*w+ne,i[w]=n[T+0]<<24|n[T+1]<<16|n[T+2]<<8|n[T+3],a[w]=n[T+4]<<24|n[T+5]<<16|n[T+6]<<8|n[T+7];for(w=0;w<80;w++)if(o=M,s=N,c=P,l=F,u=I,d=L,f=R,p=z,m=B,h=V,g=H,_=ee,v=U,y=W,b=te,x=G,E=z,D=G,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=(I>>>14|U<<18)^(I>>>18|U<<14)^(U>>>9|I<<23),D=(U>>>14|I<<18)^(U>>>18|I<<14)^(I>>>9|U<<23),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=I&L^~I&R,D=U&W^~U&te,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=oe[w*2],D=oe[w*2+1],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=i[w%16],D=a[w%16],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,S=A&65535|j<<16,C=O&65535|k<<16,E=S,D=C,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=(M>>>28|B<<4)^(B>>>2|M<<30)^(B>>>7|M<<25),D=(B>>>28|M<<4)^(M>>>2|B<<30)^(M>>>7|B<<25),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,E=M&N^M&P^N&P,D=B&V^B&H^V&H,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,p=A&65535|j<<16,x=O&65535|k<<16,E=l,D=_,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=S,D=C,O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,l=A&65535|j<<16,_=O&65535|k<<16,N=o,P=s,F=c,I=l,L=u,R=d,z=f,M=p,V=m,H=h,ee=g,U=_,W=v,te=y,G=b,B=x,w%16==15)for(T=0;T<16;T++)E=i[T],D=a[T],O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=i[(T+9)%16],D=a[(T+9)%16],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,S=i[(T+1)%16],C=a[(T+1)%16],E=(S>>>1|C<<31)^(S>>>8|C<<24)^S>>>7,D=(C>>>1|S<<31)^(C>>>8|S<<24)^(C>>>7|S<<25),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,S=i[(T+14)%16],C=a[(T+14)%16],E=(S>>>19|C<<13)^(C>>>29|S<<3)^S>>>6,D=(C>>>19|S<<13)^(S>>>29|C<<3)^(C>>>6|S<<26),O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,i[T]=A&65535|j<<16,a[T]=O&65535|k<<16;E=M,D=B,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[0],D=t[0],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[0]=M=A&65535|j<<16,t[0]=B=O&65535|k<<16,E=N,D=V,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[1],D=t[1],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[1]=N=A&65535|j<<16,t[1]=V=O&65535|k<<16,E=P,D=H,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[2],D=t[2],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[2]=P=A&65535|j<<16,t[2]=H=O&65535|k<<16,E=F,D=ee,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[3],D=t[3],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[3]=F=A&65535|j<<16,t[3]=ee=O&65535|k<<16,E=I,D=U,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[4],D=t[4],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[4]=I=A&65535|j<<16,t[4]=U=O&65535|k<<16,E=L,D=W,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[5],D=t[5],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[5]=L=A&65535|j<<16,t[5]=W=O&65535|k<<16,E=R,D=te,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[6],D=t[6],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[6]=R=A&65535|j<<16,t[6]=te=O&65535|k<<16,E=z,D=G,O=D&65535,k=D>>>16,A=E&65535,j=E>>>16,E=e[7],D=t[7],O+=D&65535,k+=D>>>16,A+=E&65535,j+=E>>>16,k+=O>>>16,A+=k>>>16,j+=A>>>16,e[7]=z=A&65535|j<<16,t[7]=G=O&65535|k<<16,ne+=128,r-=128}return r}function ce(e,t,n){var r=new Int32Array(8),i=new Int32Array(8),a=new Uint8Array(256),o,s=n;for(r[0]=1779033703,r[1]=3144134277,r[2]=1013904242,r[3]=2773480762,r[4]=1359893119,r[5]=2600822924,r[6]=528734635,r[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,se(r,i,t,n),n%=128,o=0;o<n;o++)a[o]=t[s-n+o];for(a[n]=128,n=256-128*(n<112),a[n-9]=0,p(a,n-8,s/536870912|0,s<<3),se(r,i,a,n),o=0;o<8;o++)p(e,8*o,r[o],i[o]);return 0}function le(e,n){var r=t(),i=t(),a=t(),o=t(),s=t(),c=t(),u=t(),d=t(),f=t();z(r,e[1],e[0]),z(f,n[1],n[0]),B(r,r,f),R(i,e[0],e[1]),R(f,n[0],n[1]),B(i,i,f),B(a,e[3],n[3]),B(a,a,l),B(o,e[2],n[2]),R(o,o,o),z(s,i,r),z(c,o,a),R(u,o,a),R(d,i,r),B(e[0],s,c),B(e[1],d,u),B(e[2],u,c),B(e[3],s,d)}function ue(e,t,n){var r;for(r=0;r<4;r++)N(e[r],t[r],n)}function de(e,n){var r=t(),i=t(),a=t();H(a,n[2]),B(r,n[0],a),B(i,n[1],a),P(e,i),e[31]^=I(r)<<7}function fe(e,t,n){var r,i;for(j(e[0],a),j(e[1],o),j(e[2],o),j(e[3],a),i=255;i>=0;--i)r=n[i/8|0]>>(i&7)&1,ue(e,t,r),le(t,e),le(e,e),ue(e,t,r)}function pe(e,n){var r=[t(),t(),t(),t()];j(r[0],u),j(r[1],d),j(r[2],o),B(r[3],u,d),fe(e,r,n)}function me(e,r,i){var a=new Uint8Array(64),o=[t(),t(),t(),t()],s;for(i||n(r,32),ce(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64,pe(o,a),de(e,o),s=0;s<32;s++)r[s+32]=e[s];return 0}var he=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ge(e,t){var n,r,i,a;for(r=63;r>=32;--r){for(n=0,i=r-32,a=r-12;i<a;++i)t[i]+=n-16*t[r]*he[i-(r-32)],n=Math.floor((t[i]+128)/256),t[i]-=n*256;t[i]+=n,t[r]=0}for(n=0,i=0;i<32;i++)t[i]+=n-(t[31]>>4)*he[i],n=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=n*he[i];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function _e(e){var t=new Float64Array(64),n;for(n=0;n<64;n++)t[n]=e[n];for(n=0;n<64;n++)e[n]=0;ge(e,t)}function ve(e,n,r,i){var a=new Uint8Array(64),o=new Uint8Array(64),s=new Uint8Array(64),c,l,u=new Float64Array(64),d=[t(),t(),t(),t()];ce(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=r+64;for(c=0;c<r;c++)e[64+c]=n[c];for(c=0;c<32;c++)e[32+c]=a[32+c];for(ce(s,e.subarray(32),r+32),_e(s),pe(d,s),de(e,d),c=32;c<64;c++)e[c]=i[c];for(ce(o,e,r+64),_e(o),c=0;c<64;c++)u[c]=0;for(c=0;c<32;c++)u[c]=s[c];for(c=0;c<32;c++)for(l=0;l<32;l++)u[c+l]+=o[c]*a[l];return ge(e.subarray(32),u),f}function ye(e,n){var r=t(),i=t(),s=t(),l=t(),u=t(),d=t(),p=t();return j(e[2],o),L(e[1],n),V(s,e[1]),B(l,s,c),z(s,s,e[2]),R(l,e[2],l),V(u,l),V(d,u),B(p,d,u),B(r,p,s),B(r,r,l),ee(r,r),B(r,r,s),B(r,r,l),B(r,r,l),B(e[0],r,l),V(i,e[0]),B(i,i,l),F(i,s)&&B(e[0],e[0],f),V(i,e[0]),B(i,i,l),F(i,s)?-1:(I(e[0])===n[31]>>7&&z(e[0],a,e[0]),B(e[3],e[0],e[1]),0)}function be(e,n,r,i){var a,o=new Uint8Array(32),s=new Uint8Array(64),c=[t(),t(),t(),t()],l=[t(),t(),t(),t()];if(r<64||ye(l,i))return-1;for(a=0;a<r;a++)e[a]=n[a];for(a=0;a<32;a++)e[a+32]=i[a];if(ce(s,e,r),_e(s),fe(c,l,s),pe(l,n.subarray(32)),le(c,l),de(o,c),r-=64,g(n,0,o,0)){for(a=0;a<r;a++)e[a]=0;return-1}for(a=0;a<r;a++)e[a]=n[a+64];return r}var xe=32,Se=24,Ce=32,we=16,Te=32,Ee=32,De=32,Oe=32,ke=32,Ae=Se,je=Ce,Me=we,Ne=64,Pe=32,Fe=64,Ie=32,Le=64;e.lowlevel={crypto_core_hsalsa20:b,crypto_stream_xor:T,crypto_stream:w,crypto_stream_salsa20_xor:S,crypto_stream_salsa20:C,crypto_onetimeauth:D,crypto_onetimeauth_verify:O,crypto_verify_16:h,crypto_verify_32:g,crypto_secretbox:k,crypto_secretbox_open:A,crypto_scalarmult:U,crypto_scalarmult_base:W,crypto_box_beforenm:G,crypto_box_afternm:ne,crypto_box:ie,crypto_box_open:ae,crypto_box_keypair:te,crypto_hash:ce,crypto_sign:ve,crypto_sign_keypair:me,crypto_sign_open:be,crypto_secretbox_KEYBYTES:xe,crypto_secretbox_NONCEBYTES:Se,crypto_secretbox_ZEROBYTES:Ce,crypto_secretbox_BOXZEROBYTES:we,crypto_scalarmult_BYTES:Te,crypto_scalarmult_SCALARBYTES:Ee,crypto_box_PUBLICKEYBYTES:De,crypto_box_SECRETKEYBYTES:Oe,crypto_box_BEFORENMBYTES:ke,crypto_box_NONCEBYTES:Ae,crypto_box_ZEROBYTES:je,crypto_box_BOXZEROBYTES:Me,crypto_sign_BYTES:Ne,crypto_sign_PUBLICKEYBYTES:Pe,crypto_sign_SECRETKEYBYTES:Fe,crypto_sign_SEEDBYTES:Ie,crypto_hash_BYTES:Le,gf:t,D:c,L:he,pack25519:P,unpack25519:L,M:B,A:R,S:V,Z:z,pow2523:ee,add:le,set25519:j,modL:ge,scalarmult:fe,scalarbase:pe};function Re(e,t){if(e.length!==xe)throw Error(`bad key size`);if(t.length!==Se)throw Error(`bad nonce size`)}function ze(e,t){if(e.length!==De)throw Error(`bad public key size`);if(t.length!==Oe)throw Error(`bad secret key size`)}function Be(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw TypeError(`unexpected type, use Uint8Array`)}function Ve(e){for(var t=0;t<e.length;t++)e[t]=0}e.randomBytes=function(e){var t=new Uint8Array(e);return n(t,e),t},e.secretbox=function(e,t,n){Be(e,t,n),Re(n,t);for(var r=new Uint8Array(Ce+e.length),i=new Uint8Array(r.length),a=0;a<e.length;a++)r[a+Ce]=e[a];return k(i,r,r.length,t,n),i.subarray(we)},e.secretbox.open=function(e,t,n){Be(e,t,n),Re(n,t);for(var r=new Uint8Array(we+e.length),i=new Uint8Array(r.length),a=0;a<e.length;a++)r[a+we]=e[a];return r.length<32||A(i,r,r.length,t,n)!==0?null:i.subarray(Ce)},e.secretbox.keyLength=xe,e.secretbox.nonceLength=Se,e.secretbox.overheadLength=we,e.scalarMult=function(e,t){if(Be(e,t),e.length!==Ee)throw Error(`bad n size`);if(t.length!==Te)throw Error(`bad p size`);var n=new Uint8Array(Te);return U(n,e,t),n},e.scalarMult.base=function(e){if(Be(e),e.length!==Ee)throw Error(`bad n size`);var t=new Uint8Array(Te);return W(t,e),t},e.scalarMult.scalarLength=Ee,e.scalarMult.groupElementLength=Te,e.box=function(t,n,r,i){var a=e.box.before(r,i);return e.secretbox(t,n,a)},e.box.before=function(e,t){Be(e,t),ze(e,t);var n=new Uint8Array(ke);return G(n,e,t),n},e.box.after=e.secretbox,e.box.open=function(t,n,r,i){var a=e.box.before(r,i);return e.secretbox.open(t,n,a)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(De),t=new Uint8Array(Oe);return te(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(Be(e),e.length!==Oe)throw Error(`bad secret key size`);var t=new Uint8Array(De);return W(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=De,e.box.secretKeyLength=Oe,e.box.sharedKeyLength=ke,e.box.nonceLength=Ae,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(Be(e,t),t.length!==Fe)throw Error(`bad secret key size`);var n=new Uint8Array(Ne+e.length);return ve(n,e,e.length,t),n},e.sign.open=function(e,t){if(Be(e,t),t.length!==Pe)throw Error(`bad public key size`);var n=new Uint8Array(e.length),r=be(n,e,e.length,t);if(r<0)return null;for(var i=new Uint8Array(r),a=0;a<i.length;a++)i[a]=n[a];return i},e.sign.detached=function(t,n){for(var r=e.sign(t,n),i=new Uint8Array(Ne),a=0;a<i.length;a++)i[a]=r[a];return i},e.sign.detached.verify=function(e,t,n){if(Be(e,t,n),t.length!==Ne)throw Error(`bad signature size`);if(n.length!==Pe)throw Error(`bad public key size`);var r=new Uint8Array(Ne+e.length),i=new Uint8Array(Ne+e.length),a;for(a=0;a<Ne;a++)r[a]=t[a];for(a=0;a<e.length;a++)r[a+Ne]=e[a];return be(i,r,r.length,n)>=0},e.sign.keyPair=function(){var e=new Uint8Array(Pe),t=new Uint8Array(Fe);return me(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(Be(e),e.length!==Fe)throw Error(`bad secret key size`);for(var t=new Uint8Array(Pe),n=0;n<t.length;n++)t[n]=e[32+n];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(Be(e),e.length!==Ie)throw Error(`bad seed size`);for(var t=new Uint8Array(Pe),n=new Uint8Array(Fe),r=0;r<32;r++)n[r]=e[r];return me(t,n,!0),{publicKey:t,secretKey:n}},e.sign.publicKeyLength=Pe,e.sign.secretKeyLength=Fe,e.sign.seedLength=Ie,e.sign.signatureLength=Ne,e.hash=function(e){Be(e);var t=new Uint8Array(Le);return ce(t,e,e.length),t},e.hash.hashLength=Le,e.verify=function(e,t){return Be(e,t),e.length===0||t.length===0||e.length!==t.length?!1:m(e,0,t,0,e.length)===0},e.setPRNG=function(e){n=e},(function(){var t=typeof self<`u`?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){var n=65536;e.setPRNG(function(e,r){var i,a=new Uint8Array(r);for(i=0;i<r;i+=n)t.getRandomValues(a.subarray(i,i+Math.min(r-i,n)));for(i=0;i<r;i++)e[i]=a[i];Ve(a)})}else typeof require<`u`&&(t=Ht(),t&&t.randomBytes&&e.setPRNG(function(e,n){var r,i=t.randomBytes(n);for(r=0;r<n;r++)e[r]=i[r];Ve(i)}))})()})(t!==void 0&&t.exports?t.exports:self.nacl=self.nacl||{})})),Wt=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=t(Ut()).default})),Gt=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.KP=void 0;let n=Vt(),r=Jt(),i=t(Wt());e.KP=class{seed;constructor(e){this.seed=e}getRawSeed(){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);return n.Codec.decodeSeed(this.seed).buf}getSeed(){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);return this.seed}getPublicKey(){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let e=n.Codec.decodeSeed(this.seed),t=i.default.sign.keyPair.fromSeed(this.getRawSeed()),a=n.Codec.encode(e.prefix,t.publicKey);return new TextDecoder().decode(a)}getPrivateKey(){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let e=i.default.sign.keyPair.fromSeed(this.getRawSeed());return n.Codec.encode(r.Prefix.Private,e.secretKey)}sign(e){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let t=i.default.sign.keyPair.fromSeed(this.getRawSeed());return i.default.sign.detached(e,t.secretKey)}verify(e,t){if(!this.seed)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let n=i.default.sign.keyPair.fromSeed(this.getRawSeed());return i.default.sign.detached.verify(e,t,n.publicKey)}clear(){this.seed&&=(this.seed.fill(0),void 0)}seal(e,t,n){throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation)}open(e,t){throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation)}}})),Kt=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=void 0;let n=Vt(),r=Jt(),i=t(Wt());e.PublicKey=class{publicKey;constructor(e){this.publicKey=e}getPublicKey(){if(!this.publicKey)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);return new TextDecoder().decode(this.publicKey)}getPrivateKey(){throw this.publicKey?new r.NKeysError(r.NKeysErrorCode.PublicKeyOnly):new r.NKeysError(r.NKeysErrorCode.ClearedPair)}getSeed(){throw this.publicKey?new r.NKeysError(r.NKeysErrorCode.PublicKeyOnly):new r.NKeysError(r.NKeysErrorCode.ClearedPair)}sign(e){throw this.publicKey?new r.NKeysError(r.NKeysErrorCode.CannotSign):new r.NKeysError(r.NKeysErrorCode.ClearedPair)}verify(e,t){if(!this.publicKey)throw new r.NKeysError(r.NKeysErrorCode.ClearedPair);let a=n.Codec._decode(this.publicKey);return i.default.sign.detached.verify(e,t,a.slice(1))}clear(){this.publicKey&&=(this.publicKey.fill(0),void 0)}seal(e,t,n){throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation)}open(e,t){throw new r.NKeysError(r.NKeysErrorCode.InvalidNKeyOperation)}}})),qt=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.CurveKP=e.curveNonceLen=e.curveKeyLen=void 0;let n=Jt(),r=t(Wt()),i=Vt(),a=Jt(),o=Bt(),s=zt();e.curveKeyLen=32,e.curveNonceLen=24;let c=[120,107,118,49];e.CurveKP=class{seed;constructor(e){this.seed=e}clear(){this.seed&&=(this.seed.fill(0),void 0)}getPrivateKey(){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);return i.Codec.encode(a.Prefix.Private,this.seed)}getPublicKey(){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);let e=r.default.scalarMult.base(this.seed),t=i.Codec.encode(a.Prefix.Curve,e);return new TextDecoder().decode(t)}getSeed(){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);return i.Codec.encodeSeed(a.Prefix.Curve,this.seed)}sign(){throw new n.NKeysError(n.NKeysErrorCode.InvalidCurveOperation)}verify(){throw new n.NKeysError(n.NKeysErrorCode.InvalidCurveOperation)}decodePubCurveKey(e){try{let t=o.base32.decode(new TextEncoder().encode(e));if(t.byteLength!==35)throw new n.NKeysError(n.NKeysErrorCode.InvalidCurveKey);if(t[0]!==a.Prefix.Curve)throw new n.NKeysError(n.NKeysErrorCode.InvalidPublicKey);let r=t.byteLength-2,i=new DataView(t.buffer).getUint16(r,!0),c=t.slice(0,r);if(!s.crc16.validate(c,i))throw new n.NKeysError(n.NKeysErrorCode.InvalidChecksum);return c.slice(1)}catch(e){throw new n.NKeysError(n.NKeysErrorCode.InvalidRecipient,{cause:e})}}seal(t,i,a){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);a||=r.default.randomBytes(e.curveNonceLen);let o=this.decodePubCurveKey(i),s=new Uint8Array(c.length+e.curveNonceLen);s.set(c,0),s.set(a,c.length);let l=r.default.box(t,a,o,this.seed),u=new Uint8Array(s.length+l.length);return u.set(s),u.set(l,s.length),u}open(t,i){if(!this.seed)throw new n.NKeysError(n.NKeysErrorCode.ClearedPair);if(t.length<=e.curveNonceLen+c.length)throw new n.NKeysError(n.NKeysErrorCode.InvalidEncrypted);for(let e=0;e<c.length;e++)if(t[e]!==c[e])throw new n.NKeysError(n.NKeysErrorCode.InvalidEncrypted);let a=this.decodePubCurveKey(i);t=t.slice(c.length);let o=t.slice(0,e.curveNonceLen);return t=t.slice(e.curveNonceLen),r.default.box.open(t,o,a,this.seed)}}})),Jt=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.NKeysError=e.NKeysErrorCode=e.Prefixes=e.Prefix=void 0,e.createPair=s,e.createOperator=c,e.createAccount=l,e.createUser=u,e.createCluster=d,e.createServer=f,e.createCurve=p,e.fromPublic=m,e.fromCurveSeed=h,e.fromSeed=g;let n=Gt(),r=Kt(),i=Vt(),a=qt(),o=t(Wt());function s(e){let t=e===_.Curve?a.curveKeyLen:32,r=o.default.randomBytes(t),s=i.Codec.encodeSeed(e,new Uint8Array(r));return e===_.Curve?new a.CurveKP(new Uint8Array(r)):new n.KP(s)}function c(){return s(_.Operator)}function l(){return s(_.Account)}function u(){return s(_.User)}function d(){return s(_.Cluster)}function f(){return s(_.Server)}function p(){return s(_.Curve)}function m(e){let t=new TextEncoder().encode(e),n=i.Codec._decode(t),a=v.parsePrefix(n[0]);if(v.isValidPublicPrefix(a))return new r.PublicKey(t);throw new b(y.InvalidPublicKey)}function h(e){let t=i.Codec.decodeSeed(e);if(t.prefix!==_.Curve)throw new b(y.InvalidCurveSeed);if(t.buf.byteLength!==a.curveKeyLen)throw new b(y.InvalidSeedLen);return new a.CurveKP(t.buf)}function g(e){return i.Codec.decodeSeed(e).prefix===_.Curve?h(e):new n.KP(e)}var _;(function(e){e[e.Unknown=-1]=`Unknown`,e[e.Seed=144]=`Seed`,e[e.Private=120]=`Private`,e[e.Operator=112]=`Operator`,e[e.Server=104]=`Server`,e[e.Cluster=16]=`Cluster`,e[e.Account=0]=`Account`,e[e.User=160]=`User`,e[e.Curve=184]=`Curve`})(_||(e.Prefix=_={}));var v=class{static isValidPublicPrefix(e){return e==_.Server||e==_.Operator||e==_.Cluster||e==_.Account||e==_.User||e==_.Curve}static startsWithValidPrefix(e){let t=e[0];return t==`S`||t==`P`||t==`O`||t==`N`||t==`C`||t==`A`||t==`U`||t==`X`}static isValidPrefix(e){return this.parsePrefix(e)!==_.Unknown}static parsePrefix(e){switch(e){case _.Seed:return _.Seed;case _.Private:return _.Private;case _.Operator:return _.Operator;case _.Server:return _.Server;case _.Cluster:return _.Cluster;case _.Account:return _.Account;case _.User:return _.User;case _.Curve:return _.Curve;default:return _.Unknown}}};e.Prefixes=v;var y;(function(e){e.InvalidPrefixByte=`nkeys: invalid prefix byte`,e.InvalidKey=`nkeys: invalid key`,e.InvalidPublicKey=`nkeys: invalid public key`,e.InvalidSeedLen=`nkeys: invalid seed length`,e.InvalidSeed=`nkeys: invalid seed`,e.InvalidCurveSeed=`nkeys: invalid curve seed`,e.InvalidCurveKey=`nkeys: not a valid curve key`,e.InvalidCurveOperation=`nkeys: curve key is not valid for sign/verify`,e.InvalidNKeyOperation=`keys: only curve key can seal/open`,e.InvalidEncoding=`nkeys: invalid encoded key`,e.InvalidRecipient=`nkeys: not a valid recipient public curve key`,e.InvalidEncrypted=`nkeys: encrypted input is not valid`,e.CannotSign=`nkeys: cannot sign, no private key available`,e.PublicKeyOnly=`nkeys: no seed or private key available`,e.InvalidChecksum=`nkeys: invalid checksum`,e.SerializationError=`nkeys: serialization error`,e.ApiError=`nkeys: api error`,e.ClearedPair=`nkeys: pair is cleared`})(y||(e.NKeysErrorCode=y={}));var b=class extends Error{code;constructor(e,t){super(e,t),this.code=e}};e.NKeysError=b})),Yt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.encode=t,e.decode=n,e.dump=r;function t(e){return btoa(String.fromCharCode(...e))}function n(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function r(e,t){t&&console.log(t);let n=[];for(let t=0;t<e.byteLength;t++){t%8==0&&n.push(`\n`);let r=e[t].toString(16);r.length===1&&(r=`0`+r),n.push(r)}console.log(n.join(` `))}})),Xt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.version=void 0,e.version=`2.0.3`})),Zt=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.version=e.encode=e.decode=e.Prefixes=e.Prefix=e.NKeysErrorCode=e.NKeysError=e.fromSeed=e.fromPublic=e.fromCurveSeed=e.createUser=e.createServer=e.createPair=e.createOperator=e.createCurve=e.createCluster=e.createAccount=void 0;var t=Jt();Object.defineProperty(e,"createAccount",{enumerable:!0,get:function(){return t.createAccount}}),Object.defineProperty(e,"createCluster",{enumerable:!0,get:function(){return t.createCluster}}),Object.defineProperty(e,"createCurve",{enumerable:!0,get:function(){return t.createCurve}}),Object.defineProperty(e,"createOperator",{enumerable:!0,get:function(){return t.createOperator}}),Object.defineProperty(e,"createPair",{enumerable:!0,get:function(){return t.createPair}}),Object.defineProperty(e,"createServer",{enumerable:!0,get:function(){return t.createServer}}),Object.defineProperty(e,"createUser",{enumerable:!0,get:function(){return t.createUser}}),Object.defineProperty(e,"fromCurveSeed",{enumerable:!0,get:function(){return t.fromCurveSeed}}),Object.defineProperty(e,"fromPublic",{enumerable:!0,get:function(){return t.fromPublic}}),Object.defineProperty(e,"fromSeed",{enumerable:!0,get:function(){return t.fromSeed}}),Object.defineProperty(e,"NKeysError",{enumerable:!0,get:function(){return t.NKeysError}}),Object.defineProperty(e,"NKeysErrorCode",{enumerable:!0,get:function(){return t.NKeysErrorCode}}),Object.defineProperty(e,"Prefix",{enumerable:!0,get:function(){return t.Prefix}}),Object.defineProperty(e,"Prefixes",{enumerable:!0,get:function(){return t.Prefixes}});var n=Yt();Object.defineProperty(e,"decode",{enumerable:!0,get:function(){return n.decode}}),Object.defineProperty(e,"encode",{enumerable:!0,get:function(){return n.encode}});var r=Xt();Object.defineProperty(e,"version",{enumerable:!0,get:function(){return r.version}})})),Qt,$t=o((()=>{Qt=u(Zt(),1)}));function en(e){return t=>{let n={};return e.forEach(e=>{let r=e(t)||{};n=Object.assign(n,r)}),n}}function tn(){return()=>{}}function nn(e,t){return()=>({user:typeof e==`function`?e():e,pass:typeof t==`function`?t():t})}function rn(e){return()=>({auth_token:typeof e==`function`?e():e})}function an(e){return t=>{let n=typeof e==`function`?e():e,r=n?Qt.fromSeed(n):void 0,i=r?r.getPublicKey():``,a=y.encode(t||``),o=r!==void 0&&t?r.sign(a):void 0;return{nkey:i,sig:o?Qt.encode(o):``}}}function on(e,t){return n=>{let r=typeof e==`function`?e():e,{nkey:i,sig:a}=an(t)(n);return{jwt:r,nkey:i,sig:a}}}function sn(e){let t=typeof e==`function`?e:()=>e,n=()=>{let e=/\\s*(?:(?:[-]{3,}[^\\n]*[-]{3,}\\n)(.+)(?:\\n\\s*[-]{3,}[^\\n]*[-]{3,}\\n))/gi,n=b.decode(t()),r=e.exec(n);if(!r)throw Error(`unable to parse credentials`);let i=r[1].trim();if(r=e.exec(n),!r)throw Error(`unable to parse credentials`);return{jwt:i,seed:y.encode(r[1].trim())}};return on(()=>{let{jwt:e}=n();return e},()=>{let{seed:e}=n();return e})}var cn=o((()=>{x()}));function ln(){return{maxPingOut:2,maxReconnectAttempts:10,noRandomize:!1,pedantic:!1,pingInterval:gn,reconnect:!0,reconnectJitter:100,reconnectJitterTLS:hn,reconnectTimeWait:_n,tls:void 0,verbose:!1,waitOnFirstConnect:!1,ignoreAuthErrorAbort:!1}}function un(e){if(e){let{servers:t}=e;if(typeof t==`string`&&(t=[t]),t)for(let e=0;e<t.length;e++){let n=t[e].toLowerCase();if(n.startsWith(`ws://`)||n.startsWith(`wss://`))return!0}}return!1}function dn(e){let t=[];return typeof e.authenticator==`function`&&t.push(e.authenticator),Array.isArray(e.authenticator)&&t.push(...e.authenticator),e.token&&t.push(rn(e.token)),e.user&&t.push(nn(e.user,e.pass)),t.length===0?tn():en(t)}function fn(e){let t=`${ve}:${Ce()}`;if(e||={servers:[t]},e.servers=e.servers||[],typeof e.servers==`string`&&(e.servers=[e.servers]),e.servers.length>0&&e.port)throw C.format([`servers`,`port`],`are mutually exclusive`);e.servers.length===0&&e.port&&(e.servers=[`${ve}:${e.port}`]),e.servers&&e.servers.length===0&&(e.servers=[t]);let n=L(ln(),e);if(n.authenticator=dn(n),[`reconnectDelayHandler`,`authenticator`].forEach(e=>{if(n[e]&&typeof n[e]!=`function`)throw TypeError(`\'${e}\' must be a function`)}),n.reconnectDelayHandler||=(e=0)=>{let t=n.reconnectTimeWait??2e3,r=n.reconnectionDelayMax??0,i=n.reconnectionRandomizationFactor??0;if(r>0){let n=Math.min(t*2**Math.max(0,e),r);if(i>0){let e=n*(1-i),t=n*(1+i);n=e+Math.random()*(t-e)}return Math.round(n)}let a=n.tls?n.reconnectJitterTLS:n.reconnectJitter;return a&&=(a++,Math.floor(Math.random()*a)),t+(a??0)},n.inboxPrefix&&he(n.inboxPrefix),n.resolve===void 0&&(n.resolve=typeof Ee()==`function`),n.resolve&&typeof Ee()!=`function`)throw C.format(`resolve`,`is not supported in the current runtime`);return n}function pn(e,t){let{proto:n,tls_required:r,tls_available:i}=e;if((n===void 0||n<1)&&t.noEcho)throw new F.ConnectionError(`server does not support \'noEcho\'`);let a=r||i||!1;if(t.tls&&!a)throw new F.ConnectionError(`server does not support \'tls\'`)}function mn(e,t){if(t)throw C.format(e,`is not supported`)}var hn,gn,_n,vn=o((()=>{le(),Ne(),ye(),cn(),I(),hn=1e3,gn=120*1e3,_n=2*1e3}));function yn(e){return typeof e==`object`&&!!e&&`server`in e&&`delay`in e}function bn(e){let t=e.reason;if(t instanceof Error)return t;if(typeof t==`string`)return Error(t);if(t!=null)try{return Error(String(t))}catch{}return Error(`aborted`)}var xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn=o((()=>{x(),Ne(),le(),xe(),rt(),at(),st(),lt(),Et(),Nt(),Rt(),vn(),I(),xn=1024*32,Sn=/^INFO\\s+([^\\r\\n]+)\\r\\n/i,Cn=g(`PONG\\r\n`),wn=g(`PING\\r\n`),Tn=`client option reconnectToServer handler failed`,En=`returned server is not in the pool`,Dn=class{echo;no_responders;protocol;verbose;pedantic;jwt;nkey;sig;user;pass;auth_token;tls_required;name;lang;version;headers;constructor(e,t,n){this.protocol=1,this.version=e.version,this.lang=e.lang,this.echo=t.noEcho?!1:void 0,this.verbose=t.verbose,this.pedantic=t.pedantic,this.tls_required=t.tls?!0:void 0,this.name=t.name;let r=(t&&typeof t.authenticator==`function`?t.authenticator(n):{})||{};L(this,r)}},On=class{slow;cb;notified;constructor(e,t){this.slow=e,this.cb=t,this.notified=!1}maybeNotify(e){e<=this.slow?this.notified=!1:this.notified||=(this.cb(e),!0)}},kn=class extends it{sid;queue;draining;max;subject;drained;protocol;timer;info;cleanupFn;closed;requestSubject;slow;constructor(e,t,n={}){super(),L(this,n),this.protocol=e,this.subject=t,this.draining=!1,this.noIterator=typeof n.callback==`function`,this.closed=H();let r=!e.options?.noAsyncTraces;n.timeout&&(this.timer=z(n.timeout,r),this.timer.then(()=>{this.timer=void 0}).catch(e=>{this.stop(e),this.noIterator&&this.callback(e,{})})),this.noIterator||this.iterClosed.then(e=>{this.closed.resolve(e),this.unsubscribe()})}setSlowNotificationFn(e,t){if(this.slow=void 0,t){if(this.noIterator)throw Error(`callbacks don\'t support slow notifications`);this.slow=new On(e,t)}}callback(e,t){this.cancelTimeout(),e?this.stop(e):this.push(t),!e&&this.slow&&this.slow.maybeNotify(this.getPending())}close(e){if(!this.isClosed()){this.cancelTimeout();let t=()=>{if(this.stop(),this.cleanupFn)try{this.cleanupFn(this,this.info)}catch{}this.closed.resolve(e)};this.noIterator?t():this.push(t)}}unsubscribe(e){this.protocol.unsubscribe(this,e)}cancelTimeout(){this.timer&&=(this.timer.cancel(),void 0)}drain(){return this.protocol.isClosed()?Promise.reject(new F.ClosedConnectionError):this.isClosed()?Promise.reject(new F.InvalidOperationError(`subscription is already closed`)):(this.drained||=(this.draining=!0,this.protocol.unsub(this),this.protocol.flush(H()).then(()=>{this.protocol.subscriptions.cancel(this)}).catch(()=>{this.protocol.subscriptions.cancel(this)})),this.drained)}async[Symbol.asyncDispose](){if(!(this.protocol.isClosed()||this.isClosed())){if(this.drained){await this.drained;return}await this.drain()}}isDraining(){return this.draining}isClosed(){return this.done}getSubject(){return this.subject}getMax(){return this.max}getID(){return this.sid}},An=class{mux;subs;sidCounter;constructor(){this.sidCounter=0,this.mux=null,this.subs=new Map}size(){return this.subs.size}add(e){return this.sidCounter++,e.sid=this.sidCounter,this.subs.set(e.sid,e),e}setMux(e){return this.mux=e,e}getMux(){return this.mux}get(e){return this.subs.get(e)}resub(e){return this.sidCounter++,this.subs.delete(e.sid),e.sid=this.sidCounter,this.subs.set(e.sid,e),e}all(){return Array.from(this.subs.values())}cancel(e){e&&(e.close(),this.subs.delete(e.sid))}handleError(e){let t=this.all(),n;return e.operation===`subscription`?n=t.find(t=>t.subject===e.subject&&t.queue===e.queue):e.operation===`publish`&&(n=t.find(t=>t.requestSubject===e.subject)),n?(n.callback(e,{}),n.close(e),this.subs.delete(n.sid),n!==this.mux):!1}close(){this.subs.forEach(e=>{e.close()})}},jn=class e{connected;connectedOnce;infoReceived;info;muxSubscriptions;options;outbound;pongs;subscriptions;transport;noMorePublishing;connectError;publisher;_closed;closed;listeners;heartbeats;parser;outMsgs;inMsgs;outBytes;inBytes;pendingLimit;lastError;abortReconnect;whyClosed;servers;server;features;connectPromise;dialDelay;raceTimer;constructor(e,t){this._closed=!1,this.connected=!1,this.connectedOnce=!1,this.infoReceived=!1,this.noMorePublishing=!1,this.abortReconnect=!1,this.listeners=[],this.pendingLimit=xn,this.outMsgs=0,this.inMsgs=0,this.outBytes=0,this.inBytes=0,this.options=e,this.publisher=t,this.subscriptions=new An,this.muxSubscriptions=new ot,this.outbound=new be,this.pongs=[],this.whyClosed=``,this.pendingLimit=e.pendingLimit||this.pendingLimit,this.features=new Lt({major:0,minor:0,micro:0}),this.connectPromise=null,this.dialDelay=null;let n=typeof e.servers==`string`?[e.servers]:e.servers;this.servers=new nt({randomize:!e.noRandomize}),this.servers.setServers(n),this.closed=H(),this.parser=new Tt(this),this.heartbeats=new ct(this,this.options.pingInterval||12e4,this.options.maxPingOut||2,this.options.pingTimeout??0)}resetOutbound(){this.outbound.reset();let e=this.pongs;this.pongs=[];let t=new F.RequestError(`connection disconnected`);t.stack=``,e.forEach(e=>{e.reject(t)}),this.parser=new Tt(this),this.infoReceived=!1}dispatchStatus(e){this.listeners.forEach(t=>{t.push(e)})}prepare(){this.transport&&this.transport.discard(),this.info=void 0,this.resetOutbound();let e=H();return e.catch(()=>{}),this.pongs.unshift(e),this.connectError=t=>{e.reject(t)},this.transport=Te(),this.transport.closed().then(async e=>{if(this.connected=!1,!this.isClosed()){await this.disconnected(this.transport.closeError||this.lastError);return}}),e}disconnect(){this.dispatchStatus({type:`staleConnection`}),this.transport.disconnect()}reconnect(){return this.connected&&(this.dispatchStatus({type:`forceReconnect`}),this.transport.disconnect()),Promise.resolve()}forceReconnect(){return this.dispatchStatus({type:`forceReconnect`}),this.dialDelay?.cancel(),this.raceTimer?.cancel(),this.connected?(this.transport.disconnect(),Promise.resolve()):this.connectPromise===null&&!this._closed?this.dialLoop().then(()=>{this.dispatchStatus({type:`reconnect`,server:this.servers.getCurrentServer().toString()})}).catch(e=>{this.close(e).catch(()=>{})}):Promise.resolve()}async disconnected(e){this.dispatchStatus({type:`disconnect`,server:this.servers.getCurrentServer().toString()}),this.options.reconnect?await this.dialLoop().then(()=>{this.dispatchStatus({type:`reconnect`,server:this.servers.getCurrentServer().toString()}),this.lastError instanceof F.UserAuthenticationExpiredError&&(this.lastError=void 0)}).catch(e=>{this.close(e).catch()}):await this.close(e).catch()}async dial(e){let t=this.prepare();try{this.raceTimer=z(this.options.timeout||2e4);let t=this.transport.connect(e,this.options);await Promise.race([t,this.raceTimer]),(async()=>{try{for await(let e of this.transport)this.parser.parse(e)}catch(e){console.log(`reader closed`,e)}})().then()}catch(e){t.reject(e)}try{await Promise.race([this.raceTimer,t]),this.raceTimer?.cancel(),this.connected=!0,this.connectError=void 0,this.sendSubscriptions(),this.connectedOnce=!0,this.server.didConnect=!0,this.server.reconnects=0,this.flushPending(),this.heartbeats.start()}catch(e){throw this.raceTimer?.cancel(),await this.transport.close(e),e}}async _doDial(e){let{resolve:t}=this.options,n=await e.resolve({fn:Ee(),debug:this.options.debug,randomize:!this.options.noRandomize,resolve:t}),r=null;for(let e of n)try{r=null,this.dispatchStatus({type:`reconnecting`}),await this.dial(e);return}catch(e){r=e}throw r}dialLoop(){return this.connectPromise===null&&(this.connectPromise=this.dodialLoop(),this.connectPromise.then(()=>{}).catch(()=>{}).finally(()=>{this.connectPromise=null})),this.connectPromise}async dodialLoop(){let e;for(;;){this._closed&&this.servers.clear();let t=this.selectServer(),n=this.options.reconnectDelayHandler?this.options.reconnectDelayHandler(t?.reconnects??0):_n,r=n;if(!t||this.abortReconnect)throw e||(this.lastError?this.lastError:new F.ConnectionError(`connection refused`));let i=Date.now();if(t.lastConnect===0||t.lastConnect+n<=i){let n=t,r=0;if(this.options.reconnectToServer)try{let e=this.servers.snapshotForHandler(),i=this.options.reconnectToServer(e,this.info??null),a;if(yn(i)?(a=i.server,r=Number.isFinite(i.delay)&&i.delay>0?Math.floor(i.delay):0):a=i,a!==null){let e=this.servers.find(a);if(!e)throw Error(En);e!==t&&(n=e,this.servers.setCurrent(n),this.server=n)}}catch(e){let t=e instanceof Error?e:Error(String(e));throw new F.ConnectionError(`${Tn}: ${t.message}`,{cause:t})}r>0&&(this.dialDelay=B(r),await this.dialDelay),n.lastConnect=Date.now();try{await this._doDial(n);break}catch(t){if(e=t,!this.connectedOnce){if(this.options.waitOnFirstConnect)continue;this.servers.removeCurrentServer()}n.reconnects++;let r=this.options.maxReconnectAttempts||0;r!==-1&&n.reconnects>=r&&this.servers.removeCurrentServer()}}else r=Math.min(r,t.lastConnect+n-i),this.dialDelay=B(r),await this.dialDelay}}static async connect(t,n){let r=new e(t,n),i=t.signal,a;if(i){if(i.aborted){let e=bn(i);throw r.abortClose(e),e}a=()=>{try{r.abortClose(bn(i))}catch{}},i.addEventListener(`abort`,a,{once:!0})}try{return await r.dialLoop(),r}finally{i&&a&&i.removeEventListener(`abort`,a)}}static toError(e){let t=F.PermissionViolationError.parse(e);return t||(t=F.UserAuthenticationExpiredError.parse(e),t)||(t=F.AuthorizationError.parse(e),t)?t:new F.ProtocolError(e)}processMsg(e,t){if(this.inMsgs++,this.inBytes+=t.length,!this.subscriptions.sidCounter)return;let n=this.subscriptions.get(e.sid);n&&(n.received+=1,n.callback&&n.callback(null,new Mt(e,t,this)),n.max!==void 0&&n.received>=n.max&&n.unsubscribe())}processError(t){let n=_(t);n.startsWith(`\'`)&&n.endsWith(`\'`)&&(n=n.slice(1,n.length-1));let r=e.toError(n);switch(r.constructor){case F.PermissionViolationError:{let e=r,t=this.subscriptions.getMux(),n=t?e.subject===t.subject:!1;this.subscriptions.handleError(e),this.muxSubscriptions.handleError(n,e),n&&this.subscriptions.setMux(null)}}this.dispatchStatus({type:`error`,error:r}),this.handleError(r)}handleError(e){(e instanceof F.UserAuthenticationExpiredError||e instanceof F.AuthorizationError)&&this.handleAuthError(e),e instanceof F.PermissionViolationError||(this.lastError=e)}handleAuthError(e){(this.lastError instanceof F.UserAuthenticationExpiredError||this.lastError instanceof F.AuthorizationError)&&this.options.ignoreAuthErrorAbort===!1&&(this.abortReconnect=!0),this.connectError?this.connectError(e):this.disconnect()}processPing(){this.transport.send(Cn)}processPong(){let e=this.pongs.shift();e&&e.resolve()}processInfo(e){let t=JSON.parse(_(e));this.info=t;let n=this.options&&this.options.ignoreClusterUpdates?void 0:this.servers.update(t,this.transport.isEncrypted());if(!this.infoReceived){this.features.update(Pt(t.version)),this.infoReceived=!0,this.transport.isEncrypted()&&this.servers.updateTLSName();let{version:e,lang:n}=this.transport;try{let r=new Dn({version:e,lang:n},this.options,t.nonce);t.headers&&(r.headers=!0,r.no_responders=!0);let i=JSON.stringify(r);this.transport.send(g(`CONNECT ${i}\\r\n`)),this.transport.send(wn)}catch(e){this.close(e).catch()}}if(n){let{added:e,deleted:t}=n;this.dispatchStatus({type:`update`,added:e,deleted:t})}t.ldm!==void 0&&t.ldm&&this.dispatchStatus({type:`ldm`,server:this.servers.getCurrentServer().toString()})}push(e){switch(e.kind){case xt.MSG:{let{msg:t,data:n}=e;this.processMsg(t,n);break}case xt.OK:break;case xt.ERR:this.processError(e.data);break;case xt.PING:this.processPing();break;case xt.PONG:this.processPong();break;case xt.INFO:this.processInfo(e.data);break}}sendCommand(e,...t){let n=this.outbound.length(),r;r=typeof e==`string`?g(e):e,this.outbound.fill(r,...t),n===0?queueMicrotask(()=>{this.flushPending()}):this.outbound.size()>=this.pendingLimit&&this.flushPending()}publish(e,t=v,n){let r;if(t instanceof Uint8Array)r=t;else if(typeof t==`string`)r=y.encode(t);else throw TypeError(`payload types can be strings or Uint8Array`);let i=r.length;n||={},n.reply=n.reply||``;let a=v,o=0;if(n.headers&&(this.info&&!this.info.headers&&C.format(`headers`,`are not available on this server`),a=n.headers.encode(),o=a.length,i=r.length+o),this.info&&i>this.info.max_payload)throw C.format(`payload`,`max_payload size exceeded`);this.outBytes+=i,this.outMsgs++;let s;n.headers?(s=n.reply?`HPUB ${e} ${n.reply} ${o} ${i}\\r\\n`:`HPUB ${e} ${o} ${i}\\r\\n`,this.sendCommand(s,a,r,Ae)):(s=n.reply?`PUB ${e} ${n.reply} ${i}\\r\\n`:`PUB ${e} ${i}\\r\\n`,this.sendCommand(s,r,Ae))}request(e){return this.initMux(),this.muxSubscriptions.add(e),e}subscribe(e){return this.subscriptions.add(e),this._subunsub(e),e}_sub(e){e.queue?this.sendCommand(`SUB ${e.subject} ${e.queue} ${e.sid}\\r\\n`):this.sendCommand(`SUB ${e.subject} ${e.sid}\\r\\n`)}_subunsub(e){return this._sub(e),e.max&&this.unsubscribe(e,e.max),e}unsubscribe(e,t){this.unsub(e,t),(e.max===void 0||e.received>=e.max)&&this.subscriptions.cancel(e)}unsub(e,t){!e||this.isClosed()||(t?this.sendCommand(`UNSUB ${e.sid} ${t}\\r\\n`):this.sendCommand(`UNSUB ${e.sid}\\r\\n`),e.max=t)}resub(e,t){!e||this.isClosed()||(this.unsub(e),e.subject=t,this.subscriptions.resub(e),this._sub(e))}flush(e){return e||=H(),this.pongs.push(e),this.outbound.fill(wn),this.flushPending(),e}sendSubscriptions(){let e=[];this.subscriptions.all().forEach(t=>{let n=t;n.queue?e.push(`SUB ${n.subject} ${n.queue} ${n.sid}\\r\n`):e.push(`SUB ${n.subject} ${n.sid}\\r\n`)}),e.length&&this.transport.send(g(e.join(``)))}async close(e){if(this._closed)return;this.whyClosed=Error(`close trace`).stack||``,this.heartbeats.cancel(),this.connectError&&=(this.connectError(e),void 0),this.muxSubscriptions.close(),this.subscriptions.close();let t=[];for(let e=0;e<this.listeners.length;e++){let n=this.listeners[e];n&&(n.push({type:`close`}),n.stop(),t.push(n.iterClosed))}t.length&&await Promise.all(t),this._closed=!0,await this.transport.close(e),this.raceTimer?.cancel(),this.dialDelay?.cancel(),this.closed.resolve(e)}abortClose(e){if(!this._closed){this.whyClosed=Error(`abortClose trace`).stack||``,this._closed=!0,this.abortReconnect=!0,this.heartbeats.cancel(),this.connectError&&=(this.connectError(e),void 0),this.muxSubscriptions.close(),this.subscriptions.close();for(let e=0;e<this.listeners.length;e++){let t=this.listeners[e];t&&(t.push({type:`close`}),t.stop())}this.raceTimer?.cancel(),this.dialDelay?.cancel();try{this.transport?.close(e)}catch{}this.closed.resolve(e)}}isClosed(){return this._closed}async drain(){let e=this.subscriptions.all(),t=[];e.forEach(e=>{t.push(e.drain())});try{await Promise.allSettled(t)}catch{}finally{this.noMorePublishing=!0,await this.flush()}return this.close()}flushPending(){if(!(!this.infoReceived||!this.connected)&&this.outbound.size()){let e=this.outbound.drain();this.transport.send(e)}}initMux(){if(!this.subscriptions.getMux()){let e=this.muxSubscriptions.init(this.options.inboxPrefix),t=new kn(this,`${e}*`);t.callback=this.muxSubscriptions.dispatcher(),this.subscriptions.setMux(t),this.subscribe(t)}}selectServer(){let e=this.servers.selectServer();if(e!==void 0)return this.server=e,this.server}getServer(){return this.server}}})),Nn,Pn,Fn,In=o((()=>{le(),I(),Nn=class{token;received;ctx;requestSubject;mux;constructor(e,t,n=!0){this.mux=e,this.requestSubject=t,this.received=0,this.token=re(),n&&(this.ctx=new j)}},Pn=class extends Nn{callback;done;timer;max;opts;constructor(e,t,n={maxWait:1e3}){if(super(e,t),this.opts=n,typeof this.opts.callback!=`function`)throw TypeError(`callback must be a function`);this.callback=this.opts.callback,this.max=typeof n.maxMessages==`number`&&n.maxMessages>0?n.maxMessages:-1,this.done=H(),this.done.then(()=>{this.callback(null,null)}),this.timer=setTimeout(()=>{this.cancel()},n.maxWait)}cancel(e){e&&this.callback(e,null),clearTimeout(this.timer),this.mux.cancel(this),this.done.resolve()}resolver(e,t){e?(this.ctx&&(e.stack+=`\\n\\n${this.ctx.stack}`),this.cancel(e)):(this.callback(null,t),this.opts.strategy===`count`&&(this.max--,this.max===0&&this.cancel()),this.opts.strategy===`stall`&&(clearTimeout(this.timer),this.timer=setTimeout(()=>{this.cancel()},this.opts.stall||300)),this.opts.strategy===`sentinel`&&t&&t.data.length===0&&this.cancel())}},Fn=class extends Nn{deferred;timer;constructor(e,t,n={timeout:1e3},r=!0){super(e,t,r),this.deferred=H(),this.timer=z(n.timeout,r)}resolver(e,t){this.timer&&this.timer.cancel(),e?(e instanceof M||(this.ctx?(this.ctx.message=e.message,this.ctx.cause=e,e=this.ctx):e=new F.RequestError(e.message,{cause:e})),this.deferred.reject(e)):this.deferred.resolve(t),this.cancel()}cancel(e){this.timer&&this.timer.cancel(),this.mux.cancel(this),this.deferred.reject(e||new j(`cancelled`))}}})),Ln,Rn,zn,Bn=o((()=>{le(),Mn(),x(),jt(),Rt(),vn(),at(),In(),ye(),I(),Ln=/[ \\n\\r\\t]/,Rn=class e{options;protocol;draining;closeListeners;constructor(e){this.draining=!1,this.options=fn(e)}static connect(t={}){return new Promise((n,r)=>{let i=new e(t);jn.connect(i.options,i).then(e=>{i.protocol=e,n(i)}).catch(e=>{r(e)})})}closed(){return this.protocol.closed}async close(){await this.protocol.close()}abortClose(e){this.protocol.abortClose(e)}_check(e,t,n){if(this.isClosed())throw new F.ClosedConnectionError;if(t&&this.isDraining()||n&&this.protocol.noMorePublishing)throw new F.DrainingConnectionError;if(e||=``,e.length===0||Ln.test(e))throw new F.InvalidSubjectError(e)}publish(e,t,n){if(this._check(e,!1,!0),n?.reply&&this._check(n.reply,!1,!0),typeof n?.traceOnly==`boolean`){let e=n.headers||Ot();e.set(`Nats-Trace-Only`,`true`),n.headers=e}if(typeof n?.traceDestination==`string`){let e=n.headers||Ot();e.set(`Nats-Trace-Dest`,n.traceDestination),n.headers=e}this.protocol.publish(e,t,n)}publishMessage(e){return this.publish(e.subject,e.data,{reply:e.reply,headers:e.headers})}respondMessage(e){return e.reply?(this.publish(e.reply,e.data,{reply:e.reply,headers:e.headers}),!0):!1}subscribe(e,t={}){this._check(e,!0,!1);let n=new kn(this.protocol,e,t);return typeof t.callback!=`function`&&typeof t.slow==`number`&&n.setSlowNotificationFn(t.slow,e=>{this.protocol.dispatchStatus({type:`slowConsumer`,sub:n,pending:e})}),this.protocol.subscribe(n),n}_resub(e,t,n){this._check(t,!0,!1);let r=e;r.max=n,n&&(r.max=n+r.received),this.protocol.resub(r,t)}requestMany(e,t=v,n={maxWait:1e3,maxMessages:-1}){let r=!this.protocol.options.noAsyncTraces;try{this._check(e,!0,!0)}catch(e){return Promise.reject(e)}if(n.strategy=n.strategy||`timer`,n.maxWait=n.maxWait||1e3,n.maxWait<1)return Promise.reject(C.format(`timeout`,`must be greater than 0`));let i=new it;function a(e){i.push(()=>{i.stop(e)})}function o(e,t){e||t===null?a(e===null?void 0:e):i.push(t)}if(n.noMux){let s=r?Error().stack:null,c=typeof n.maxMessages==`number`&&n.maxMessages>0?n.maxMessages:-1,l=this.subscribe(he(this.options.inboxPrefix),{callback:(t,r)=>{if(r?.data?.length===0&&r?.headers?.status===`503`&&(t=new F.NoRespondersError(e)),t){s&&(t.stack+=`\\n\\n${s}`),u(t);return}o(null,r),n.strategy===`count`&&(c--,c===0&&u()),n.strategy===`stall`&&(h(),m=setTimeout(()=>{u()},300)),n.strategy===`sentinel`&&r&&r.data.length===0&&u()}});l.requestSubject=e,l.closed.then(()=>{a()}).catch(e=>{i.stop(e)});let u=e=>{e&&i.push(()=>{throw e}),h(),l.drain().then(()=>{a()}).catch(e=>{a()})};i.iterClosed.then(()=>{h(),l?.unsubscribe()}).catch(e=>{h(),l?.unsubscribe()});let{headers:d,traceDestination:f,traceOnly:p}=n;try{this.publish(e,t,{reply:l.getSubject(),headers:d,traceDestination:f,traceOnly:p})}catch(e){u(e)}let m=setTimeout(()=>{u()},n.maxWait),h=()=>{m&&clearTimeout(m)}}else{let r=n;r.callback=o,i.iterClosed.then(()=>{a.cancel()}).catch(e=>{a.cancel(e)});let a=new Pn(this.protocol.muxSubscriptions,e,r);this.protocol.request(a);let{headers:s,traceDestination:c,traceOnly:l}=n;try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${a.token}`,headers:s,traceDestination:c,traceOnly:l})}catch(e){a.cancel(e)}}return Promise.resolve(i)}request(e,t,n={timeout:1e3,noMux:!1}){try{this._check(e,!0,!0)}catch(e){return Promise.reject(e)}let r=!this.protocol.options.noAsyncTraces;if(n.timeout=n.timeout||1e3,n.timeout<1)return Promise.reject(C.format(`timeout`,`must be greater than 0`));if(!n.noMux&&n.reply)return Promise.reject(C.format([`reply`,`noMux`],`are mutually exclusive`));if(n.noMux){let i=n.reply?n.reply:he(this.options.inboxPrefix),a=H(),o=r?new F.RequestError(``):null,s=this.subscribe(i,{max:1,timeout:n.timeout,callback:(t,n)=>{n&&n.data?.length===0&&n.headers?.code===503&&(t=new F.NoRespondersError(e)),t?(t instanceof M||(o?(o.message=t.message,o.cause=t,t=o):t=new F.RequestError(t.message,{cause:t})),a.reject(t),s.unsubscribe()):a.resolve(n)}});return s.requestSubject=e,this.protocol.publish(e,t,{reply:i,headers:n.headers}),a}else{let i=new Fn(this.protocol.muxSubscriptions,e,n,r);this.protocol.request(i);let{headers:a,traceDestination:o,traceOnly:s}=n;try{this.publish(e,t,{reply:`${this.protocol.muxSubscriptions.baseInbox}${i.token}`,headers:a,traceDestination:o,traceOnly:s})}catch(e){i.cancel(e)}let c=Promise.race([i.timer,i.deferred]);return c.catch(()=>{i.cancel()}),c}}flush(){return this.isClosed()?Promise.reject(new F.ClosedConnectionError):this.protocol.flush()}drain(){return this.isClosed()?Promise.reject(new F.ClosedConnectionError):this.isDraining()?Promise.reject(new F.DrainingConnectionError):(this.draining=!0,this.protocol.drain())}async[Symbol.asyncDispose](){if(!this.isClosed()){if(this.isDraining()){await this.closed();return}await this.drain()}}isClosed(){return this.protocol.isClosed()}isDraining(){return this.draining}getServer(){let e=this.protocol.getServer();return e?e.listen:``}setServers(e){this.protocol.servers.setServers(e)}getServers(){return this.protocol.servers.snapshot()}status(){let e=new it;return e.iterClosed.then(()=>{let t=this.protocol.listeners.indexOf(e);t>-1&&this.protocol.listeners.splice(t,1)}),this.protocol.listeners.push(e),e}get info(){return this.protocol.isClosed()?void 0:this.protocol.info}async context(){return(await this.request(`$SYS.REQ.USER.INFO`)).json((e,t)=>e===`time`?new Date(Date.parse(t)):t)}stats(){return{inBytes:this.protocol.inBytes,outBytes:this.protocol.outBytes,inMsgs:this.protocol.inMsgs,outMsgs:this.protocol.outMsgs}}getServerVersion(){let e=this.info;return e?Pt(e.version):void 0}async rtt(){if(this.isClosed())throw new F.ClosedConnectionError;if(!this.protocol.connected)throw new F.RequestError(`connection disconnected`);let e=Date.now();return await this.flush(),Date.now()-e}get features(){return this.protocol.features}reconnect(){return this.isClosed()?Promise.reject(new F.ClosedConnectionError):this.isDraining()?Promise.reject(new F.DrainingConnectionError):this.protocol.reconnect()}forceReconnect(){return this.isClosed()?Promise.reject(new F.ClosedConnectionError):this.isDraining()?Promise.reject(new F.DrainingConnectionError):this.protocol.forceReconnect()}addCloseListener(e){this.closeListeners===void 0&&(this.closeListeners=new zn(this.closed())),this.closeListeners.add(e)}removeCloseListener(e){this.closeListeners&&this.closeListeners.remove(e)}},zn=class{listeners;constructor(e){this.listeners=[],e.then(e=>{this.notify(e)})}add(e){this.listeners.push(e)}remove(e){this.listeners=this.listeners.filter(t=>t!==e)}notify(e){this.listeners.forEach(t=>{if(typeof t.connectionClosedCallback==`function`)try{t.connectionClosedCallback(e)}catch{}}),this.listeners=[]}}})),Vn=o((()=>{x()}));function Hn(e,t){return`${Un(e/t)}/sec`}function Un(e,t=!1){let n=t?1e3:1024,r=t?[`k`,`M`,`G`,`T`,`P`,`E`]:[`K`,`M`,`G`,`T`,`P`,`E`],i=t?`iB`:`B`;if(e<n)return`${e.toFixed(2)} ${i}`;let a=parseInt(Math.log(e)/Math.log(n)+``),o=parseInt(a-1+``);return`${(e/n**+a).toFixed(2)} ${r[o]}${i}`}function Wn(e){return e.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g,`,`)}var Gn,Kn,qn=o((()=>{Vn(),pe(),le(),Gn=class{name;duration;date;payload;msgs;lang;version;bytes;asyncRequests;min;max;constructor(e,t){this.name=e,this.duration=t,this.date=Date.now(),this.payload=0,this.msgs=0,this.bytes=0}toString(){let e=this.duration/1e3,t=Math.round(this.msgs/e),n=this.asyncRequests?`asyncRequests`:``,r=``;return this.max&&(r=`${this.min}/${this.max}`),`${this.name}${n?` [asyncRequests]`:``} ${Wn(t)} msgs/sec - [${e.toFixed(2)} secs] ~ ${Hn(this.bytes,e)} ${r}`}toCsv(){return`"${this.name}",${new Date(this.date).toISOString()},${this.lang},${this.version},${this.msgs},${this.payload},${this.bytes},${this.duration},${this.asyncRequests?this.asyncRequests:!1}\\n`}static header(){return`Test,Date,Lang,Version,Count,MsgPayload,Bytes,Millis,Async\n`}},Kn=class{nc;callbacks;msgs;size;subject;asyncRequests;pub;sub;req;rep;perf;payload;constructor(e,t={msgs:1e5,size:128,subject:``,asyncRequests:!1,pub:!1,sub:!1,req:!1,rep:!1}){if(this.nc=e,this.callbacks=t.callbacks||!1,this.msgs=t.msgs||0,this.size=t.size||0,this.subject=t.subject||fe.nuid.next(),this.asyncRequests=t.asyncRequests||!1,this.pub=t.pub||!1,this.sub=t.sub||!1,this.req=t.req||!1,this.rep=t.rep||!1,this.perf=new ie,this.payload=this.size?new Uint8Array(this.size):v,!this.pub&&!this.sub&&!this.req&&!this.rep)throw Error(`no options selected`)}async run(){return this.nc.closed().then(e=>{if(e)throw e}),this.callbacks?await this.runCallbacks():await this.runAsync(),this.processMetrics()}processMetrics(){let{lang:e,version:t}=this.nc.protocol.transport;this.pub&&this.sub&&this.perf.measure(`pubsub`,`pubStart`,`subStop`),this.req&&this.rep&&this.perf.measure(`reqrep`,`reqStart`,`reqStop`);let n=this.perf.getEntries(),r=n.find(e=>e.name===`pubsub`),i=n.find(e=>e.name===`reqrep`),a=n.find(e=>e.name===`req`),o=n.find(e=>e.name===`rep`),s=n.find(e=>e.name===`pub`),c=n.find(e=>e.name===`sub`),l=this.nc.stats(),u=[];if(r){let{name:n,duration:i}=r,a=new Gn(n,i);a.msgs=this.msgs*2,a.bytes=l.inBytes+l.outBytes,a.lang=e,a.version=t,a.payload=this.payload.length,u.push(a)}if(i){let{name:n,duration:r}=i,a=new Gn(n,r);a.msgs=this.msgs*2,a.bytes=l.inBytes+l.outBytes,a.lang=e,a.version=t,a.payload=this.payload.length,u.push(a)}if(s){let{name:n,duration:r}=s,i=new Gn(n,r);i.msgs=this.msgs,i.bytes=l.outBytes,i.lang=e,i.version=t,i.payload=this.payload.length,u.push(i)}if(c){let{name:n,duration:r}=c,i=new Gn(n,r);i.msgs=this.msgs,i.bytes=l.inBytes,i.lang=e,i.version=t,i.payload=this.payload.length,u.push(i)}if(o){let{name:n,duration:r}=o,i=new Gn(n,r);i.msgs=this.msgs,i.bytes=l.inBytes+l.outBytes,i.lang=e,i.version=t,i.payload=this.payload.length,u.push(i)}if(a){let{name:n,duration:r}=a,i=new Gn(n,r);i.msgs=this.msgs,i.bytes=l.inBytes+l.outBytes,i.lang=e,i.version=t,i.payload=this.payload.length,u.push(i)}return u}async runCallbacks(){let e=[];if(this.sub){let t=H();e.push(t);let n=0;this.nc.subscribe(this.subject,{max:this.msgs,callback:()=>{n++,n===1&&this.perf.mark(`subStart`),n===this.msgs&&(this.perf.mark(`subStop`),this.perf.measure(`sub`,`subStart`,`subStop`),t.resolve())}})}if(this.rep){let t=H();e.push(t);let n=0;this.nc.subscribe(this.subject,{max:this.msgs,callback:(e,r)=>{r.respond(this.payload),n++,n===1&&this.perf.mark(`repStart`),n===this.msgs&&(this.perf.mark(`repStop`),this.perf.measure(`rep`,`repStart`,`repStop`),t.resolve())}})}if(this.pub){let t=(async()=>{this.perf.mark(`pubStart`);for(let e=0;e<this.msgs;e++)this.nc.publish(this.subject,this.payload);await this.nc.flush(),this.perf.mark(`pubStop`),this.perf.measure(`pub`,`pubStart`,`pubStop`)})();e.push(t)}if(this.req){let t=(async()=>{if(this.asyncRequests){this.perf.mark(`reqStart`);let e=[];for(let t=0;t<this.msgs;t++)e.push(this.nc.request(this.subject,this.payload,{timeout:2e4}));await Promise.all(e),this.perf.mark(`reqStop`),this.perf.measure(`req`,`reqStart`,`reqStop`)}else{this.perf.mark(`reqStart`);for(let e=0;e<this.msgs;e++)await this.nc.request(this.subject);this.perf.mark(`reqStop`),this.perf.measure(`req`,`reqStart`,`reqStop`)}})();e.push(t)}await Promise.all(e)}async runAsync(){let e=[];if(this.rep){let t=!1,n=this.nc.subscribe(this.subject,{max:this.msgs}),r=(async()=>{for await(let e of n)t||=(this.perf.mark(`repStart`),!0),e.respond(this.payload);await this.nc.flush(),this.perf.mark(`repStop`),this.perf.measure(`rep`,`repStart`,`repStop`)})();e.push(r)}if(this.sub){let t=!1,n=this.nc.subscribe(this.subject,{max:this.msgs}),r=(async()=>{for await(let e of n)t||=(this.perf.mark(`subStart`),!0);this.perf.mark(`subStop`),this.perf.measure(`sub`,`subStart`,`subStop`)})();e.push(r)}if(this.pub){let t=(async()=>{this.perf.mark(`pubStart`);for(let e=0;e<this.msgs;e++)this.nc.publish(this.subject,this.payload);await this.nc.flush(),this.perf.mark(`pubStop`),this.perf.measure(`pub`,`pubStart`,`pubStop`)})();e.push(t)}if(this.req){let t=(async()=>{if(this.asyncRequests){this.perf.mark(`reqStart`);let e=[];for(let t=0;t<this.msgs;t++)e.push(this.nc.request(this.subject,this.payload,{timeout:2e4}));await Promise.all(e),this.perf.mark(`reqStop`),this.perf.measure(`req`,`reqStart`,`reqStop`)}else{this.perf.mark(`reqStart`);for(let e=0;e<this.msgs;e++)await this.nc.request(this.subject);this.perf.mark(`reqStop`),this.perf.measure(`req`,`reqStart`,`reqStop`)}})();e.push(t)}await Promise.all(e)}}})),Jn,Yn=o((()=>{Jn=class{interval;maxOut;cancelAfter;timer;autoCancelTimer;last;missed;count;callback;constructor(e,t,n={maxOut:2}){this.interval=e,this.maxOut=n?.maxOut||2,this.cancelAfter=n?.cancelAfter||0,this.last=Date.now(),this.missed=0,this.count=0,this.callback=t,this._schedule()}cancel(){this.autoCancelTimer&&clearTimeout(this.autoCancelTimer),this.timer&&clearInterval(this.timer),this.timer=0,this.autoCancelTimer=0,this.missed=0}work(){this.last=Date.now(),this.missed=0}_change(e,t=0,n=2){this.interval=e,this.maxOut=n,this.cancelAfter=t,this.restart()}restart(){this.cancel(),this._schedule()}_schedule(){this.cancelAfter>0&&(this.autoCancelTimer=setTimeout(()=>{this.cancel()},this.cancelAfter)),this.timer=setInterval(()=>{if(this.count++,Date.now()-this.last>this.interval&&this.missed++,this.missed>=this.maxOut)try{this.callback(this.missed)===!0&&this.cancel()}catch(e){console.log(e)}},this.interval)}}})),Xn,Zn=o((()=>{Xn=`3.4.0`}));function Qn(e,t){/^(.*:\\/\\/)(.*)/.test(e)||(e=typeof t==`boolean`?`${t===!0?`https`:`http`}://${e}`:`https://${e}`);let n=new URL(e),r=n.protocol.toLowerCase();r===`ws:`&&(t=!1),r===`wss:`&&(t=!0),r!==`https:`&&r!==`http`&&(e=e.replace(/^(.*:\\/\\/)(.*)/gm,`$2`),n=new URL(`http://${e}`));let i,a,o=n.hostname,s=n.pathname,c=n.search||``;switch(r){case`http:`:case`ws:`:case`nats:`:a=n.port||`80`,i=`ws:`;break;case`https:`:case`wss:`:case`tls:`:a=n.port||`443`,i=`wss:`;break;default:a=n.port||t===!0?`443`:`80`,i=t===!0?`wss:`:`ws:`;break}return`${i}//${o}:${a}${s}${c}`}function $n(e={}){return Se({defaultPort:443,urlParseFn:Qn,factory:()=>{if(e.tls)throw C.format(`tls`,`is not configurable on w3c websocket connections`);return new nr}}),Rn.connect(e)}var er,tr,nr,rr=o((()=>{le(),Ne(),vn(),xe(),Mn(),Bn(),Zn(),I(),er=Xn,tr=`nats.ws`,nr=class{version;lang;closeError;connected;done;socket;options;socketClosed;encrypted;peeked;yields;signal;closedNotification;constructor(){this.version=er,this.lang=tr,this.connected=!1,this.done=!1,this.socketClosed=!1,this.encrypted=!1,this.peeked=!1,this.yields=[],this.signal=H(),this.closedNotification=H()}async connect(e,t){let n=H();this.options=t;let r=e.src;if(t.wsFactory){let{socket:n,encrypted:r}=await t.wsFactory(e.src,t);this.socket=n,this.encrypted=r}else this.encrypted=r.indexOf(`wss://`)===0,this.socket=new WebSocket(r);return this.socket.binaryType=`arraybuffer`,this.socket.onopen=()=>{this.done&&this._closed(Error(`aborted`))},this.socket.onmessage=e=>{if(this.done)return;if(this.yields.push(new Uint8Array(e.data)),this.peeked){this.signal.resolve();return}let r=be.concat(...this.yields),i=Oe(r);if(i!==``){let e=Sn.exec(i);if(!e){t.debug&&console.error(`!!!`,R(r)),n.reject(Error(`unexpected response from server`));return}try{pn(JSON.parse(e[1]),this.options),this.peeked=!0,this.connected=!0,this.signal.resolve(),n.resolve()}catch(e){n.reject(e);return}}},this.socket.onclose=e=>{let t;e.code>=4e3&&e.code<=4999?t=Error(e.reason||`close code ${e.code}`):!e.wasClean&&e.reason!==``&&(t=Error(e.reason)),this._closed(t),this._cleanup()},this.socket.onerror=e=>{if(this.done)return;let t=e,r=new F.ConnectionError(t.message);n.reject(r),this._cleanup()},n}_cleanup(){this.socketClosed===!1&&(this.socketClosed=!0,this.socket.onopen=null,this.socket.onmessage=null,this.socket.onerror=null,this.socket.onclose=null,this.closedNotification.resolve(this.closeError))}disconnect(){this._closed(void 0,!0)}async _closed(e,t=!0){if(this.done){try{this.socket.close()}catch{}return}if(this.closeError=e,!e){let e=Date.now();for(;!this.socketClosed&&this.socket.bufferedAmount>0&&!(Date.now()-e>=3e3);)await B(100)}this.done=!0;try{this.socket.close()}catch{}return this._cleanup(),this.closedNotification}get isClosed(){return this.done}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){for(;;){if(this.done)return;this.yields.length===0&&await this.signal;let e=this.yields;this.yields=[];for(let t=0;t<e.length;t++)this.options.debug&&console.info(`> ${R(e[t])}`),yield e[t];if(this.done)break;this.yields.length===0&&(e.length=0,this.yields=e,this.signal=H())}}isEncrypted(){return this.connected&&this.encrypted}send(e){if(!this.done)try{this.socket.send(e.buffer),this.options.debug&&console.info(`< ${R(e)}`);return}catch(t){this.options.debug&&console.error(`!!! ${R(e)}: ${t}`)}}close(e){return this._closed(e,!1)}closed(){return this.closedNotification}discard(){this.socket?.close()}}})),ir=c({AuthorizationError:()=>E,Bench:()=>Kn,ClosedConnectionError:()=>D,Connect:()=>Dn,ConnectionError:()=>k,DEFAULT_MAX_RECONNECT_ATTEMPTS:()=>10,DataBuffer:()=>be,DenoBuffer:()=>_t,DrainingConnectionError:()=>O,Empty:()=>v,Feature:()=>It,Features:()=>Lt,Heartbeat:()=>ct,INFO:()=>Sn,IdleHeartbeatMonitor:()=>Jn,InvalidArgumentError:()=>C,InvalidOperationError:()=>w,InvalidSubjectError:()=>S,Kind:()=>xt,MAX_SIZE:()=>gt,Match:()=>ge,Metric:()=>Gn,MsgHdrsImpl:()=>At,MsgImpl:()=>Mt,MuxSubscription:()=>ot,NatsConnectionImpl:()=>Rn,NoRespondersError:()=>N,Nuid:()=>fe.Nuid,Parser:()=>Tt,PermissionViolationError:()=>P,ProtocolError:()=>A,ProtocolHandler:()=>jn,QueuedIteratorImpl:()=>it,RequestError:()=>j,RequestOne:()=>Fn,Servers:()=>nt,SimpleMutex:()=>ae,State:()=>K,SubscriptionImpl:()=>kn,Subscriptions:()=>An,TD:()=>b,TE:()=>y,TimeoutError:()=>M,UserAuthenticationExpiredError:()=>T,backoff:()=>te,buildAuthenticator:()=>dn,canonicalMIMEHeaderKey:()=>Dt,checkOptions:()=>pn,checkUnsupportedOption:()=>mn,collect:()=>U,compare:()=>Ft,createInbox:()=>he,credsAuthenticator:()=>sn,deadline:()=>V,defaultOptions:()=>ln,deferred:()=>H,delay:()=>B,describe:()=>yt,errors:()=>F,extend:()=>L,extractProtocolMessage:()=>Oe,getResolveFn:()=>Ee,hasWsProtocol:()=>un,headers:()=>Ot,ipV4:()=>Pe,isIP:()=>Fe,isIPV4OrHostname:()=>Ze,jwtAuthenticator:()=>on,millis:()=>ne,nanos:()=>G,nkeyAuthenticator:()=>an,nkeys:()=>Qt,nuid:()=>fe.nuid,parseIP:()=>Ie,parseOptions:()=>fn,parseSemVer:()=>Pt,protoLen:()=>De,readAll:()=>ft,render:()=>R,setTransportFactory:()=>Se,syncIterator:()=>me,timeout:()=>z,tokenAuthenticator:()=>rn,usernamePasswordAuthenticator:()=>nn,writeAll:()=>pt,wsUrlParseFn:()=>Qn,wsconnect:()=>$n}),ar=o((()=>{Bn(),pe(),Nt(),Ne(),Mn(),le(),jt(),lt(),st(),xe(),vn(),In(),cn(),$t(),at(),Et(),vt(),qn(),x(),Xe(),Rt(),Vn(),ye(),Yn(),rt(),rr(),I()}));let or=Symbol.for(`rpc.callbacks`),sr=Symbol.for(`rpc.callbacks.oneway`);function cr(e,t){return Object.defineProperty(e,or,{value:!0,enumerable:!1}),Object.defineProperty(e,sr,{value:t?.oneway??Object.keys(e),enumerable:!1}),e}function lr(e){return!!e&&typeof e==`object`&&e[or]===!0}function ur(e){return e?.[sr]??[]}function dr(e){if(e instanceof Promise)return!0;if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.then==`function`&&typeof t.catch==`function`}function fr(e,t,n=[],r=null){let i=r,a=e=>{i??=new Set(e)},o=e=>{if(e instanceof Uint8Array||e instanceof ArrayBuffer)return e;if(e&&typeof e==`object`&&`__methods`in e){a(e.__methods);let{__methods:t,...n}=e;return Array.isArray(e)?Object.assign([...e],n):n}return e};return new Proxy({},{get(r,a){if(a===`then`||a===`catch`||a===`finally`)return;if(typeof a==`symbol`||a===`toString`)return()=>`[RPCProxy ${t}${n.length?`.`+n.join(`.`):``}]`;if(i&&n.length===0&&!i.has(a))return;let s=[...n,a];return new Proxy(function(){},{apply(n,r,i){let c=`rpc.${t}.${s.join(`.`)}`,l=a.toLowerCase().includes(`pull`),u=i.findIndex(e=>lr(e));if(u!==-1){let t=i[u],n=ur(t),r=i.filter((e,t)=>t!==u);return e.callPullIteratorWithCallback(c,t,n,...r)}let d=i.findIndex(e=>typeof e==`function`);if(d!==-1){let t=i[d],n=i.filter((e,t)=>t!==d);return e.callWithCallback(c,n,t)}return a.toLowerCase().includes(`generate`)?e.callStream(c,...i):l?e.callPullIterator(c,...i):(async()=>o(await e.call(c,...i)))()},get(n,r){if(r===`then`||r===`catch`||r===`finally`){let n=s.join(`.`),i=(async()=>(!e.isConnected&&!e.isClosed&&await e.connect(),o(await e.call(`rpc.${t}.${n}`))))();return i[r].bind(i)}return fr(e,t,s,i)[r]}})}})}function pr(e,t,n,r=[]){return new Proxy({},{get(i,a){if(a===`then`||a===`catch`||a===`finally`)return;if(typeof a==`symbol`||a===`toString`)return()=>`[ServiceProxy ${t.name}${r.length?`.`+r.join(`.`):``}]`;if(a in i)return i[a];let o=[...r,a],s=o.join(`.`),c=t.endpoints.find(e=>{if(e.subject===s)return!0;let t=e.subject.split(`.`);return t[t.length-1]===a&&t.slice(0,-1).join(`.`)===r.join(`.`)});if(c)return new Proxy(function(){},{apply(t,n,r){let i=a.toLowerCase().includes(`pull`),o=r.findIndex(e=>lr(e));if(o!==-1){let t=r[o],n=ur(t),i=r.filter((e,t)=>t!==o);return e.callPullIteratorWithCallback(c.subject,t,n,...i)}let s=r.findIndex(e=>typeof e==`function`);if(s!==-1){let t=r[s],n=r.filter((e,t)=>t!==s);return e.callWithCallback(c.subject,n,t)}return a.toLowerCase().includes(`generate`)?e.callStream(c.subject,...r):i?e.callPullIterator(c.subject,...r):e.call(c.subject,...r)}});let l=s+`.`;if(t.endpoints.some(e=>e.subject.startsWith(l)))return pr(e,t,n,o)}})}function mr(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function hr(e){return new Promise(t=>setTimeout(t,e))}var gr=class{client;channelId;closed=!1;unsubscribe;initialized=!1;handlers=new Map;closeHandlers=new Set;errorHandlers=new Set;subscriptions=[];get isClosed(){return this.closed}get id(){return this.channelId}constructor(e,t){this.client=e,this.channelId=t}async init(){if(this.initialized)return;this.initialized=!0;let e=`channel.${this.channelId}`;this.unsubscribe=await this.client.subscribe(e,async e=>{switch(e.type){case`message`:this.emit(`message`,e.data);break;case`close`:this.handleClose();break;case`error`:this.handleError(Error(e.error??`Channel error`));break}})}async send(e){if(this.closed)throw Error(`Channel is closed`);let t={type:`message`,data:e};await this.client.publish(`channel.${this.channelId}`,t)}async request(e,t=5e3){if(this.closed)throw Error(`Channel is closed`);let n=`channel.${this.channelId}.request`;return this.client.request(n,e,{timeout:t})}async onRequest(e){let t=`channel.${this.channelId}.request`,n=this.client.onRequest(t,e);return this.subscriptions.push(n),n}on(e,t){e===`close`?this.closeHandlers.add(t):e===`error`?this.errorHandlers.add(t):(this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t))}off(e,t){e===`close`?this.closeHandlers.delete(t):e===`error`?this.errorHandlers.delete(t):this.handlers.get(e)?.delete(t)}async close(){if(!this.closed){this.closed=!0;try{await this.client.publish(`channel.${this.channelId}`,{type:`close`})}catch{}await this.cleanup()}}handlerChain=Promise.resolve();runHandler(e,t,n){let r;try{r=e(t)}catch(e){console.error(`Error in ${n}:`,e);return}if(dr(r)){let e=r;this.handlerChain=this.handlerChain.then(()=>e).catch(e=>console.error(`Error in ${n}:`,e))}}emit(e,t){let n=this.handlers.get(e);if(n)for(let e of n)this.runHandler(e,t,`channel handler`)}handleClose(){if(!this.closed){this.closed=!0;for(let e of this.closeHandlers)this.runHandler(()=>e(),void 0,`close handler`);this.cleanup().catch(console.error)}}handleError(e){for(let t of this.errorHandlers)this.runHandler(t,e,`error handler`)}async cleanup(){if(this.handlers.clear(),this.closeHandlers.clear(),this.errorHandlers.clear(),await Promise.allSettled(this.subscriptions.map(e=>e)),this.unsubscribe){try{this.unsubscribe()}catch{}this.unsubscribe=void 0}let e=this._isolatedClient;if(e)try{await e.disconnect()}catch{}}},_r=class extends gr{targetClientId;clientId;remoteClientId;get remoteId(){return this.remoteClientId}constructor(e,t,n){super(e,t),this.targetClientId=n;let r=e.options.name??`client-${Date.now()}`;this.clientId=r.replace(/-(channel|private)-.*$/,``)}async init(){if(this.initialized)return;this.initialized=!0;let e=[this.clientId,this.targetClientId].sort(),t=`channel.private.${this.channelId}.${e.join(`.`)}`;this.unsubscribe=await this.client.subscribe(t,async e=>{if(e.sender!==this.clientId&&e.sender===this.targetClientId&&(!this.remoteClientId&&e.sender&&(this.remoteClientId=e.sender),!(this.remoteClientId&&e.sender!==this.remoteClientId)))switch(e.type){case`message`:if(e.data&&typeof e.data==`object`&&`__handshake`in e.data)return;this.emit(`message`,e.data);break;case`close`:this.handleClose();break;case`error`:this.handleError(Error(e.error??`Channel error`));break}});try{await this.sendRaw({type:`message`,data:{__handshake:!0},sender:this.clientId})}catch{}}async send(e){if(this.closed)throw Error(`Channel is closed`);await this.sendRaw({type:`message`,data:e,sender:this.clientId})}async request(e,t=5e3){if(this.closed)throw Error(`Channel is closed`);let n=[this.clientId,this.targetClientId].sort(),r=`channel.private.${this.channelId}.${n.join(`.`)}.request`;return this.client.request(r,e,{timeout:t})}async onRequest(e){let t=[this.clientId,this.targetClientId].sort(),n=`channel.private.${this.channelId}.${t.join(`.`)}.request`;return this.client.onRequest(n,e)}async close(){if(!this.closed){this.closed=!0;try{await this.sendRaw({type:`close`,sender:this.clientId})}catch{}await this.cleanup()}}isConnectedTo(e){return this.remoteClientId===e}async sendRaw(e){let t=[this.clientId,this.targetClientId].sort(),n=`channel.private.${this.channelId}.${t.join(`.`)}`;await this.client.publish(n,e)}},vr;try{vr=new TextDecoder}catch{}var J,yr,Y=0;let br=[];var xr=br,Sr=0,Cr={},X,wr,Tr=0,Er=0,Dr,Or,kr=[],Z,Ar={useRecords:!1,mapsAsObjects:!0},jr=class{};let Mr=new jr;Mr.name=`MessagePack 0xC1`;var Nr=!1,Pr=2,Fr=class e{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||=0)),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType=`number`)),Object.assign(this,e)}unpack(t,n){if(J)return ui(()=>(di(),this?this.unpack(t,n):e.prototype.unpack.call(Ar,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<`u`?Buffer.from(t):new Uint8Array(t)),typeof n==`object`?(yr=n.end||t.length,Y=n.start||0):(Y=0,yr=n>-1?n:t.length),Sr=0,Er=0,wr=null,xr=br,Dr=null,J=t;try{Z=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw J=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(Cr=this,this.structures)return X=this.structures,Ir(n);(!X||X.length>0)&&(X=[])}else Cr=Ar,(!X||X.length>0)&&(X=[]);return Ir(n)}unpackMultiple(e,t){let n,r=0;try{Nr=!0;let i=e.length,a=this?this.unpack(e,i):pi.unpack(e,i);if(t){if(t(a,r,Y)===!1)return;for(;Y<i;)if(r=Y,t(Ir(),r,Y)===!1)return}else{for(n=[a];Y<i;)r=Y,n.push(Ir());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{Nr=!1,di()}}_mergeStructures(e,t){this._onLoadedStructures&&(e=this._onLoadedStructures(e)),e||=[],Object.isFrozen(e)&&(e=e.map(e=>e.slice(0)));for(let t=0,n=e.length;t<n;t++){let n=e[t];n&&(n.isShared=!0,t>=32&&(n.highByte=t-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||=[])[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function Ir(e){try{if(!Cr.trusted&&!Nr){let e=X.sharedLength||0;e<X.length&&(X.length=e)}let t;if(Cr._readStruct&&J[Y]<64&&J[Y]>=32?(t=Cr._readStruct(J,Y,yr),J=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Y=yr):t=Rr(),Dr&&=(Y=Dr.postBundlePosition,null),Nr&&(X.restoreStructures=null),Y==yr)X&&X.restoreStructures&&Lr(),X=null,J=null,Or&&=null;else if(Y>yr)throw Error(`Unexpected end of MessagePack data`);else if(!Nr){let e;try{e=JSON.stringify(t,(e,t)=>typeof t==`bigint`?`${t}n`:t).slice(0,100)}catch(t){e=`(JSON view not available `+t+`)`}throw Error(`Data read, but end of buffer not reached `+e)}return t}catch(e){throw X&&X.restoreStructures&&Lr(),di(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`)||Y>yr)&&(e.incomplete=!0),e}}function Lr(){for(let e in X.restoreStructures)X[e]=X.restoreStructures[e];X.restoreStructures=null}function Rr(){let e=J[Y++];if(e<160)if(e<128){if(e<64)return e;{let t=X[e&63]||Cr.getStructures&&Hr()[e&63];return t?(t.read||=Br(t,e&63),t.read()):e}}else if(e<144)if(e-=128,Cr.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=ri();e===`__proto__`&&(e=`__proto_`),t[e]=Rr()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(Rr(),Rr());return t}else{e-=144;let t=Array(e);for(let n=0;n<e;n++)t[n]=Rr();return Cr.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(Er>=Y)return wr.slice(Y-Tr,(Y+=t)-Tr);if(Er==0&&yr<140){let e=t<16?Qr(t):Zr(t);if(e!=null)return e}return Ur(t)}else{let t;switch(e){case 192:return null;case 193:return Dr?(t=Rr(),t>0?Dr[1].slice(Dr.position1,Dr.position1+=t):Dr[0].slice(Dr.position0,Dr.position0-=t)):Mr;case 194:return!1;case 195:return!0;case 196:if(t=J[Y++],t===void 0)throw Error(`Unexpected end of buffer`);return ei(t);case 197:return t=Z.getUint16(Y),Y+=2,ei(t);case 198:return t=Z.getUint32(Y),Y+=4,ei(t);case 199:return ti(J[Y++]);case 200:return t=Z.getUint16(Y),Y+=2,ti(t);case 201:return t=Z.getUint32(Y),Y+=4,ti(t);case 202:if(t=Z.getFloat32(Y),Cr.useFloat32>2){let e=fi[(J[Y]&127)<<1|J[Y+1]>>7];return Y+=4,(e*t+(t>0?.5:-.5)>>0)/e}return Y+=4,t;case 203:return t=Z.getFloat64(Y),Y+=8,t;case 204:return J[Y++];case 205:return t=Z.getUint16(Y),Y+=2,t;case 206:return t=Z.getUint32(Y),Y+=4,t;case 207:return Cr.int64AsType===`number`?(t=Z.getUint32(Y)*4294967296,t+=Z.getUint32(Y+4)):Cr.int64AsType===`string`?t=Z.getBigUint64(Y).toString():Cr.int64AsType===`auto`?(t=Z.getBigUint64(Y),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Z.getBigUint64(Y),Y+=8,t;case 208:return Z.getInt8(Y++);case 209:return t=Z.getInt16(Y),Y+=2,t;case 210:return t=Z.getInt32(Y),Y+=4,t;case 211:return Cr.int64AsType===`number`?(t=Z.getInt32(Y)*4294967296,t+=Z.getUint32(Y+4)):Cr.int64AsType===`string`?t=Z.getBigInt64(Y).toString():Cr.int64AsType===`auto`?(t=Z.getBigInt64(Y),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=Z.getBigInt64(Y),Y+=8,t;case 212:if(t=J[Y++],t==114)return ai(J[Y++]&63);{let e=kr[t];if(e)return e.read?(Y++,e.read(Rr())):e.noBuffer?(Y++,e()):e(J.subarray(Y,++Y));throw Error(`Unknown extension `+t)}case 213:return t=J[Y],t==114?(Y++,ai(J[Y++]&63,J[Y++])):ti(2);case 214:return ti(4);case 215:return ti(8);case 216:return ti(16);case 217:return t=J[Y++],Er>=Y?wr.slice(Y-Tr,(Y+=t)-Tr):Wr(t);case 218:return t=Z.getUint16(Y),Y+=2,Er>=Y?wr.slice(Y-Tr,(Y+=t)-Tr):Gr(t);case 219:return t=Z.getUint32(Y),Y+=4,Er>=Y?wr.slice(Y-Tr,(Y+=t)-Tr):Kr(t);case 220:return t=Z.getUint16(Y),Y+=2,Jr(t);case 221:return t=Z.getUint32(Y),Y+=4,Jr(t);case 222:return t=Z.getUint16(Y),Y+=2,Yr(t);case 223:return t=Z.getUint32(Y),Y+=4,Yr(t);default:if(e>=224)return e-256;if(e===void 0){let e=Error(`Unexpected end of MessagePack data`);throw e.incomplete=!0,e}throw Error(`Unknown MessagePack token `+e)}}}let zr=/^[a-zA-Z_$][a-zA-Z\\d_$]*$/;function Br(e,t){function n(){if(n.count++>Pr){let r;try{r=e.read=Function(`r`,`return function(){return `+(Cr.freezeData?`Object.freeze`:``)+`({`+e.map(e=>e===`__proto__`?`__proto_:r()`:zr.test(e)?e+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`})}`)(Rr)}catch{return Pr=1/0,n()}return e.read0=r,e.highByte===0&&(e.read=Vr(t,e.read)),r()}let r={};for(let t=0,n=e.length;t<n;t++){let n=e[t];n===`__proto__`&&(n=`__proto_`),r[n]=Rr()}return Cr.freezeData?Object.freeze(r):r}return n.count=0,e.read0=n,e.highByte===0?Vr(t,n):n}let Vr=(e,t)=>function(){let n=J[Y++];if(n===0)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),i=X[r]||Hr()[r];if(!i)throw Error(`Record id is not defined for `+r);return i.read||=Br(i,e),i.read()};function Hr(){let e=ui(()=>(J=null,Cr.getStructures()));return X=Cr._mergeStructures(e,X)}var Ur=qr,Wr=qr,Gr=qr,Kr=qr;function qr(e){let t;if(e<16&&(t=Qr(e)))return t;if(e>64&&vr)return vr.decode(J.subarray(Y,Y+=e));let n=Y+e,r=[];for(t=``;Y<n;){let e=J[Y++];if(!(e&128))r.push(e);else if((e&224)==192){let t=J[Y++]&63,n=(e&31)<<6|t;n<128?r.push(65533):r.push(n)}else if((e&240)==224){let t=J[Y++]&63,n=J[Y++]&63,i=(e&31)<<12|t<<6|n;i<2048||i>=55296&&i<=57343?r.push(65533):r.push(i)}else if((e&248)==240){let t=J[Y++]&63,n=J[Y++]&63,i=J[Y++]&63,a=(e&7)<<18|t<<12|n<<6|i;a<65536||a>1114111?r.push(65533):a>65535?(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023,r.push(a)):r.push(a)}else r.push(65533);r.length>=4096&&(t+=Xr.apply(String,r),r.length=0)}return r.length>0&&(t+=Xr.apply(String,r)),t}function Jr(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=Rr();return Cr.freezeData?Object.freeze(t):t}function Yr(e){if(Cr.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=ri();e===`__proto__`&&(e=`__proto_`),t[e]=Rr()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(Rr(),Rr());return t}}var Xr=String.fromCharCode;function Zr(e){let t=Y,n=Array(e);for(let r=0;r<e;r++){let e=J[Y++];if((e&128)>0){Y=t;return}n[r]=e}return Xr.apply(String,n)}function Qr(e){if(e<4)if(e<2){if(e===0)return``;{let e=J[Y++];if((e&128)>1){--Y;return}return Xr(e)}}else{let t=J[Y++],n=J[Y++];if((t&128)>0||(n&128)>0){Y-=2;return}if(e<3)return Xr(t,n);let r=J[Y++];if((r&128)>0){Y-=3;return}return Xr(t,n,r)}else{let t=J[Y++],n=J[Y++],r=J[Y++],i=J[Y++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){Y-=4;return}if(e<6){if(e===4)return Xr(t,n,r,i);{let e=J[Y++];if((e&128)>0){Y-=5;return}return Xr(t,n,r,i,e)}}else if(e<8){let a=J[Y++],o=J[Y++];if((a&128)>0||(o&128)>0){Y-=6;return}if(e<7)return Xr(t,n,r,i,a,o);let s=J[Y++];if((s&128)>0){Y-=7;return}return Xr(t,n,r,i,a,o,s)}else{let a=J[Y++],o=J[Y++],s=J[Y++],c=J[Y++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){Y-=8;return}if(e<10){if(e===8)return Xr(t,n,r,i,a,o,s,c);{let e=J[Y++];if((e&128)>0){Y-=9;return}return Xr(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=J[Y++],u=J[Y++];if((l&128)>0||(u&128)>0){Y-=10;return}if(e<11)return Xr(t,n,r,i,a,o,s,c,l,u);let d=J[Y++];if((d&128)>0){Y-=11;return}return Xr(t,n,r,i,a,o,s,c,l,u,d)}else{let l=J[Y++],u=J[Y++],d=J[Y++],f=J[Y++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){Y-=12;return}if(e<14){if(e===12)return Xr(t,n,r,i,a,o,s,c,l,u,d,f);{let e=J[Y++];if((e&128)>0){Y-=13;return}return Xr(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=J[Y++],m=J[Y++];if((p&128)>0||(m&128)>0){Y-=14;return}if(e<15)return Xr(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=J[Y++];if((h&128)>0){Y-=15;return}return Xr(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function $r(){let e=J[Y++],t;if(e<192)t=e-160;else switch(e){case 217:t=J[Y++];break;case 218:t=Z.getUint16(Y),Y+=2;break;case 219:t=Z.getUint32(Y),Y+=4;break;default:throw Error(`Expected string`)}return qr(t)}function ei(e){return Cr.copyBuffers?Uint8Array.prototype.slice.call(J,Y,Y+=e):J.subarray(Y,Y+=e)}function ti(e){let t=J[Y++];if(kr[t]){let n;return kr[t](J.subarray(Y,n=Y+=e),e=>{Y=e;try{return Rr()}finally{Y=n}})}else throw Error(`Unknown extension type `+t)}var ni=Array(4096);function ri(){let e=J[Y++];if(e>=160&&e<192){if(e-=160,Er>=Y)return wr.slice(Y-Tr,(Y+=e)-Tr);if(!(Er==0&&yr<180))return Ur(e)}else return Y--,ii(Rr());let t=(e<<5^(e>1?Z.getUint16(Y):e>0?J[Y]:0))&4095,n=ni[t],r=Y,i=Y+e-3,a,o=0;if(n&&n.bytes==e){for(;r<i;){if(a=Z.getUint32(r),a!=n[o++]){r=1879048192;break}r+=4}for(i+=3;r<i;)if(a=J[r++],a!=n[o++]){r=1879048192;break}if(r===i)return Y=r,n.string;i-=3,r=Y}for(n=[],ni[t]=n,n.bytes=e;r<i;)a=Z.getUint32(r),n.push(a),r+=4;for(i+=3;r<i;)a=J[r++],n.push(a);let s=e<16?Qr(e):Zr(e);return s==null?n.string=Ur(e):n.string=s}function ii(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;if(Cr.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(e=>[`string`,`number`,`boolean`,`bigint`].includes(typeof e)))return e.flat().toString();throw Error(`Invalid property type for record: ${typeof e}`)}let ai=(e,t)=>{let n=Rr().map(ii),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=X[e];return i&&(i.isShared||Nr)&&((X.restoreStructures||=[])[e]=i),X[e]=n,n.read=Br(n,r),(n.read0||n.read)()};kr[0]=()=>{},kr[0].noBuffer=!0,kr[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=BigInt(8),n+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=(e,t)=>{let n=t-e;if(n<=40){let n=r.getBigUint64(e);for(let i=e+8;i<t;i+=8)n<<=BigInt(64),n|=r.getBigUint64(i);return n}let a=e+(n>>4<<3),o=i(e,a),s=i(a,t);return o<<BigInt((t-a)*8)|s};n=n<<BigInt((r.byteLength-t)*8)|i(t,r.byteLength)}return n};let oi={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==`function`?AggregateError:null};kr[101]=()=>{let e=Rr();if(!oi[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return oi[e[0]](e[1],{cause:e[2]})},kr[105]=e=>{if(Cr.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=Z.getUint32(Y-4);Or||=new Map;let n=J[Y],r;r=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&J[Y+1]===115?new Set:{};let i={target:r};Or.set(t,i);let a=Rr();if(i.used)Object.assign(r,a);else return i.target=a;if(r instanceof Map)for(let[e,t]of a.entries())r.set(e,t);if(r instanceof Set)for(let e of Array.from(a))r.add(e);return r},kr[112]=e=>{if(Cr.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=Z.getUint32(Y-4),n=Or.get(t);return n.used=!0,n.target},kr[115]=()=>new Set(Rr());let si=[`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`,`BigInt64`,`BigUint64`].map(e=>e+`Array`),ci=typeof globalThis==`object`?globalThis:window;kr[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,r=si[t];if(!r){if(t===16)return n;if(t===17)return new DataView(n);throw Error(`Could not find typed array for code `+t)}return new ci[r](n)},kr[120]=()=>{let e=Rr();return new RegExp(e[0],e[1])};let li=[];kr[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=Y;return Y+=t-e.length,Dr=li,Dr=[$r(),$r()],Dr.position0=0,Dr.position1=0,Dr.postBundlePosition=Y,Y=n,Rr()},kr[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date(`invalid`);function ui(e){Cr&&Cr._onSaveState&&Cr._onSaveState();let t=yr,n=Y,r=Sr,i=Tr,a=Er,o=wr,s=xr,c=Or,l=Dr,u=new Uint8Array(J.slice(0,yr)),d=X,f=X.slice(0,X.length),p=Cr,m=Nr,h=e();return yr=t,Y=n,Sr=r,Tr=i,Er=a,wr=o,xr=s,Or=c,Dr=l,J=u,Nr=m,X=d,X.splice(0,X.length,...f),Cr=p,Z=new DataView(J.buffer,J.byteOffset,J.byteLength),h}function di(){J=null,Or=null,X=null}let fi=Array(147);for(let e=0;e<256;e++)fi[e]=+(`1e`+Math.floor(45.15-e*.30103));var pi=new Fr({useRecords:!1});pi.unpack,pi.unpackMultiple,pi.unpack;let mi={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};new Uint8Array(new Float32Array(1).buffer,0,4),Fr.SUPPORTS_STRUCT_HOOKS=!0;let hi;try{hi=new TextEncoder}catch{}let gi,_i,vi=typeof Buffer<`u`,yi=vi?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,bi=vi?Buffer:Uint8Array,xi=vi?4294967296:2144337920,Q,Si,Ci,$=0,wi,Ti=null,Ei=/[\\u0080-\\uFFFF]/,Di=Symbol(`record-id`);var Oi=class extends Fr{constructor(e){super(e),this.offset=0;let t,n,r,i,a=bi.prototype.utf8Write?function(e,t){return Q.utf8Write(e,t,Q.byteLength-t)}:hi&&hi.encodeInto?function(e,t){return hi.encodeInto(e,Q.subarray(t)).written}:!1,o=this;e||={};let s=e&&e.sequential,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?32:0,l>8160)throw Error(`Maximum maxSharedStructure is 8160`);e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let u=e.maxOwnStructures;u??=c?32:64,!this.structures&&e.useRecords!=0&&(this.structures=[]);let d=l>32||u+l>64,f=l+64,p=l+u+64;if(p>8256)throw Error(`Maximum maxSharedStructure + maxOwnStructure is 8192`);let m=[],h=0,g=0;this.pack=this.encode=function(e,a){if(Q||(Q=new yi(8192),Ci=Q.dataView||=new DataView(Q.buffer,0,8192),$=0),wi=Q.length-10,wi-$<2048?(Q=new yi(Q.length),Ci=Q.dataView||=new DataView(Q.buffer,0,Q.length),wi=Q.length-10,$=0):$=$+7&2147483640,t=$,a&2048&&($+=a&255),i=o.structuredClone?new Map:null,o.bundleStrings&&typeof e!=`string`?(Ti=[],Ti.size=1/0):Ti=null,r=o.structures,r){r.uninitialized&&(r=o._mergeStructures(o.getStructures()));let e=r.sharedLength||0;if(e>l)throw Error(`Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to `+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||=i[r]=Object.create(null),i=n}i[Di]=t+64}this.lastNamedStructuresLength=e}s||(r.nextId=e+64)}n&&=!1;let c;try{o._writeStruct&&e&&typeof e==`object`?e.constructor===Object?w(e):e.constructor!==Map&&!Array.isArray(e)&&!_i.some(t=>e instanceof t)?w(e.toJSON?e.toJSON():e):y(e):y(e);let n=Ti;if(Ti&&Ni(t,y,0),i&&i.idsToInsert){let e=i.idsToInsert.sort((e,t)=>e.offset>t.offset?1:-1),r=e.length,a=-1;for(;n&&r>0;){let i=e[--r].offset+t;i<n.stringsPosition+t&&a===-1&&(a=0),i>n.position+t?a>=0&&(a+=6):(a>=0&&(Ci.setUint32(n.position+t,Ci.getUint32(n.position+t)+a),a=-1),n=n.previous,r++)}a>=0&&n&&Ci.setUint32(n.position+t,Ci.getUint32(n.position+t)+a),$+=e.length*6,$>wi&&T($),o.offset=$;let s=Mi(Q.subarray(t,$),e);return i=null,s}return o.offset=$,a&512?(Q.start=t,Q.end=$,Q):Q.subarray(t,$)}catch(e){throw c=e,e}finally{if(r&&(_(),n&&o.saveStructures)){let n=r.sharedLength||0,i=Q.subarray(t,$),s=(o._prepareStructures||Pi)(r,o);if(!c)return o.saveStructures(s,s.isCompatible)===!1?(r.uninitialized=!0,o.pack(e,a)):(o.lastNamedStructuresLength=n,Q.length>1073741824&&(Q=null),i)}Q.length>1073741824&&(Q=null),a&1024&&($=t)}};let _=()=>{g<10&&g++;let e=r.sharedLength||0;if(r.length>e&&!s&&(r.length=e),h>1e4)r.transitions=null,g=0,h=0,m.length>0&&(m=[]);else if(m.length>0&&!s){for(let e=0,t=m.length;e<t;e++)m[e][Di]=0;m=[]}},v=e=>{var t=e.length;t<16?Q[$++]=144|t:t<65536?(Q[$++]=220,Q[$++]=t>>8,Q[$++]=t&255):(Q[$++]=221,Ci.setUint32($,t),$+=4);for(let n=0;n<t;n++)y(e[n])},y=e=>{$>wi&&(Q=T($));var n=typeof e,r;if(n===`string`){let n=e.length;if(Ti&&n>=4&&n<4096){if((Ti.size+=n)>21760){let e,n=(Ti[0]?Ti[0].length*3+Ti[1].length:0)+10;$+n>wi&&(Q=T($+n));let r;Ti.position?(r=Ti,Q[$]=200,$+=3,Q[$++]=98,e=$-t,$+=4,Ni(t,y,0),Ci.setUint16(e+t-3,$-t-e)):(Q[$++]=214,Q[$++]=98,e=$-t,$+=4),Ti=[``,``],Ti.previous=r,Ti.size=0,Ti.position=e}let r=Ei.test(e);Ti[+!r]+=e,Q[$++]=193,y(r?-n:n);return}let i;i=n<32?1:n<256?2:n<65536?3:5;let o=n*3;if($+o>wi&&(Q=T($+o)),n<64||!a){let t,a,o,s=$+i;for(t=0;t<n;t++)a=e.charCodeAt(t),a<128?Q[s++]=a:a<2048?(Q[s++]=a>>6|192,Q[s++]=a&63|128):(a&64512)==55296&&((o=e.charCodeAt(t+1))&64512)==56320?(a=65536+((a&1023)<<10)+(o&1023),t++,Q[s++]=a>>18|240,Q[s++]=a>>12&63|128,Q[s++]=a>>6&63|128,Q[s++]=a&63|128):(Q[s++]=a>>12|224,Q[s++]=a>>6&63|128,Q[s++]=a&63|128);r=s-$-i}else r=a(e,$+i);r<32?Q[$++]=160|r:r<256?(i<2&&Q.copyWithin($+2,$+1,$+1+r),Q[$++]=217,Q[$++]=r):r<65536?(i<3&&Q.copyWithin($+3,$+2,$+2+r),Q[$++]=218,Q[$++]=r>>8,Q[$++]=r&255):(i<5&&Q.copyWithin($+5,$+3,$+3+r),Q[$++]=219,Ci.setUint32($,r),$+=4),$+=r}else if(n===`number`)if(e>>>0===e)e<32||e<128&&this.useRecords===!1||e<64&&!this._writeStruct?Q[$++]=e:e<256?(Q[$++]=204,Q[$++]=e):e<65536?(Q[$++]=205,Q[$++]=e>>8,Q[$++]=e&255):(Q[$++]=206,Ci.setUint32($,e),$+=4);else if(e>>0===e)e>=-32?Q[$++]=256+e:e>=-128?(Q[$++]=208,Q[$++]=e+256):e>=-32768?(Q[$++]=209,Ci.setInt16($,e),$+=2):(Q[$++]=210,Ci.setInt32($,e),$+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){Q[$++]=202,Ci.setFloat32($,e);let n;if(t<4||(n=e*fi[(Q[$]&127)<<1|Q[$+1]>>7])>>0===n){$+=4;return}else $--}Q[$++]=203,Ci.setFloat64($,e),$+=8}else if(n===`object`||n===`function`)if(!e)Q[$++]=192;else{if(i){let n=i.get(e);if(n){n.id||=(i.idsToInsert||=[]).push(n),Q[$++]=214,Q[$++]=112,Ci.setUint32($,n.id),$+=4;return}else i.set(e,{offset:$-t})}let a=e.constructor;if(a===Object)C(e);else if(a===Array)v(e);else if(a===Map)if(this.mapAsEmptyObject)Q[$++]=128;else{r=e.size,r<16?Q[$++]=128|r:r<65536?(Q[$++]=222,Q[$++]=r>>8,Q[$++]=r&255):(Q[$++]=223,Ci.setUint32($,r),$+=4);for(let[t,n]of e)y(t),y(n)}else{for(let t=0,n=gi.length;t<n;t++){let n=_i[t];if(e instanceof n){let n=gi[t];if(n.write){n.type&&(Q[$++]=212,Q[$++]=n.type,Q[$++]=0);let t=n.write.call(this,e);t===e?Array.isArray(e)?v(e):C(e):y(t);return}let r=Q,i=Ci,a=$;Q=null;let o;try{o=n.pack.call(this,e,e=>(Q=r,r=null,$+=e,$>wi&&T($),{target:Q,targetView:Ci,position:$-e}),y)}finally{r&&(Q=r,Ci=i,$=a,wi=Q.length-10)}o&&(o.length+$>wi&&T(o.length+$),$=ji(o,Q,$,n.type));return}}if(Array.isArray(e))v(e);else{if(e.toJSON){let t=e.toJSON();if(t!==e)return y(t)}if(n===`function`)return y(this.writeFunction&&this.writeFunction(e));C(e)}}}else if(n===`boolean`)Q[$++]=e?195:194;else if(n===`bigint`){if(e<0x8000000000000000&&e>=-0x8000000000000000)Q[$++]=211,Ci.setBigInt64($,e);else if(e<0x10000000000000000&&e>0)Q[$++]=207,Ci.setBigUint64($,e);else if(this.largeBigIntToFloat)Q[$++]=203,Ci.setFloat64($,Number(e));else if(this.largeBigIntToString)return y(e.toString());else if(this.useBigIntExtension||this.moreTypes){let t=BigInt(e<0?-1:0),n;if(e>>BigInt(65536)===t){let r=BigInt(0x10000000000000000)-BigInt(1),i=[];for(;i.push(e&r),e>>BigInt(63)!==t;)e>>=BigInt(64);n=new Uint8Array(new BigUint64Array(i).buffer),n.reverse()}else{let t=e<0,r=(t?~e:e).toString(16);if(r.length%2?r=`0`+r:parseInt(r.charAt(0),16)>=8&&(r=`00`+r),vi)n=Buffer.from(r,`hex`);else{n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(r.slice(e*2,e*2+2),16)}if(t)for(let e=0;e<n.length;e++)n[e]=~n[e]}n.length+$>wi&&T(n.length+$),$=ji(n,Q,$,66);return}else throw RangeError(e+` was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string`);$+=8}else if(n===`undefined`)this.encodeUndefinedAsNil?Q[$++]=192:(Q[$++]=212,Q[$++]=0,Q[$++]=0);else throw Error(`Unknown type: `+n)},b=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?e=>{let t;if(this.skipValues){t=[];for(let n in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(n))&&!this.skipValues.includes(e[n])&&t.push(n)}else t=Object.keys(e);let n=t.length;n<16?Q[$++]=128|n:n<65536?(Q[$++]=222,Q[$++]=n>>8,Q[$++]=n&255):(Q[$++]=223,Ci.setUint32($,n),$+=4);let r;if(this.coercibleKeyAsNumber)for(let i=0;i<n;i++){r=t[i];let n=Number(r);y(isNaN(n)?r:n),y(e[r])}else for(let i=0;i<n;i++)y(r=t[i]),y(e[r])}:e=>{Q[$++]=222;let n=$-t;$+=2;let r=0;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(y(t),y(e[t]),r++);if(r>65535)throw Error(`Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object`);Q[n+++t]=r>>8,Q[n+t]=r&255},x=this.useRecords===!1?b:e.progressiveRecords&&!d?e=>{let n,i=r.transitions||=Object.create(null),a=$++-t,o;for(let s in e)if(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(s)){if(n=i[s],n)i=n;else{let c=Object.keys(e),l=i;i=r.transitions;let u=0;for(let e=0,t=c.length;e<t;e++){let t=c[e];n=i[t],n||(n=i[t]=Object.create(null),u++),i=n}a+t+1==$?($--,E(i,c,u)):D(i,c,a,u),o=!0,i=l[s]}y(e[s])}if(!o){let n=i[Di];n?Q[a+t]=n:D(i,Object.keys(e),a,0)}}:e=>{let t,n=r.transitions||=Object.create(null),i=0;for(let r in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(r))&&(t=n[r],t||(t=n[r]=Object.create(null),i++),n=t);let a=n[Di];a?a>=96&&d?(Q[$++]=((a-=96)&31)+96,Q[$++]=a>>5):Q[$++]=a:E(n,n.__keys__||Object.keys(e),i);for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&y(e[t])},S=typeof this.useRecords==`function`&&this.useRecords,C=S?e=>{S(e)?x(e):b(e)}:x,w=e=>{let i=o._writeStruct(e,Q,t,$,r,T,(e,t,r)=>{if(r)return n=!0;$=t;let i=Q;return y(e),_(),i===Q?$:{position:$,targetView:Ci,target:Q}});if(i===0)return C(e);$=i},T=e=>{let n;if(e>16777216){if(e-t>xi)throw Error(`Packed buffer would be larger than maximum buffer size`);n=Math.min(xi,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,Q.length-1)>>12)+1<<12;let r=new yi(n);return Ci=r.dataView||=new DataView(r.buffer,0,n),e=Math.min(e,Q.length),Q.copy?Q.copy(r,0,t,e):r.set(Q.slice(t,e)),$-=t,t=0,wi=r.length-10,Q=r},E=(e,t,i)=>{let a=r.nextId;a||=64,a<f&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(a=r.nextOwnId,a<p||(a=f),r.nextOwnId=a+1):(a>=p&&(a=f),r.nextId=a+1);let o=t.highByte=a>=96&&d?a-96>>5:-1;e[Di]=a,e.__keys__=t,r[a-64]=t,a<f?(t.isShared=!0,r.sharedLength=a-63,n=!0,o>=0?(Q[$++]=(a&31)+96,Q[$++]=o):Q[$++]=a):(o>=0?(Q[$++]=213,Q[$++]=114,Q[$++]=(a&31)+96,Q[$++]=o):(Q[$++]=212,Q[$++]=114,Q[$++]=a),i&&(h+=g*i),m.length>=u&&(m.shift()[Di]=0),m.push(e),y(t))},D=(e,n,r,i)=>{let a=Q,o=$,s=wi,c=t;Q=Si,$=0,t=0,Q||(Si=Q=new yi(8192)),wi=Q.length-10,E(e,n,i),Si=Q;let l=$;if(Q=a,$=o,wi=s,t=c,l>1){let e=$+l-1;e>wi&&T(e);let n=r+t;Q.copyWithin(n+l,n+1,$),Q.set(Si.slice(0,l),n),$=e}else Q[r+t]=Si[0]}}useBuffer(e){Q=e,Q.dataView||=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),Ci=Q.dataView,$=0}set position(e){$=e}get position(){return $}clearSharedData(){this.structures&&=[],this.typedStructs&&=[]}};_i=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,jr],gi=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:n,targetView:i,position:a}=t(10);n[a++]=215,n[a++]=255,i.setUint32(a,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:e,targetView:r,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:n,targetView:i,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,i.setUint32(a,e.getMilliseconds()*1e6),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(r)}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=101,r[i++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=120,r[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?ki(e,16,t):Ai(vi?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==bi&&this.moreTypes?ki(e,si.indexOf(n.name),t):Ai(e,t)}},{pack(e,t){this.moreTypes?ki(e,17,t):Ai(vi?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];function ki(e,t,n,r){let i=e.byteLength;if(i+1<256){var{target:a,position:o}=n(4+i);a[o++]=199,a[o++]=i+1}else if(i+1<65536){var{target:a,position:o}=n(5+i);a[o++]=200,a[o++]=i+1>>8,a[o++]=i+1&255}else{var{target:a,position:o,targetView:s}=n(7+i);a[o++]=201,s.setUint32(o,i+1),o+=4}a[o++]=116,a[o++]=t,e.buffer||(e=new Uint8Array(e)),a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function Ai(e,t){let n=e.byteLength;var r,i;if(n<256){var{target:r,position:i}=t(n+2);r[i++]=196,r[i++]=n}else if(n<65536){var{target:r,position:i}=t(n+3);r[i++]=197,r[i++]=n>>8,r[i++]=n&255}else{var{target:r,position:i,targetView:a}=t(n+5);r[i++]=198,a.setUint32(i,n),i+=4}r.set(e,i)}function ji(e,t,n,r){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=i&255):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=i&255)}return t[n++]=r,t.set(e,n),n+=i,n}function Mi(e,t){let n,r=t.length*6,i=e.length-r;for(;n=t.pop();){let t=n.offset,a=n.id;e.copyWithin(t+r,t,i),r-=6;let o=t+r;e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=a&255,i=t}return e}function Ni(e,t,n){if(Ti.length>0){Ci.setUint32(Ti.position+e,$+n-Ti.position-e),Ti.stringsPosition=$-e;let r=Ti;Ti=null,t(r[0]),t(r[1])}}function Pi(e,t){return e.isCompatible=e=>{let n=!e||(t.lastNamedStructuresLength||0)===e.length;return n||t._mergeStructures(e),n},e}Oi.SUPPORTS_STRUCT_HOOKS=!0;let Fi=new Oi({useRecords:!1});Fi.pack,Fi.pack;let{NEVER:Ii,ALWAYS:Li,DECIMAL_ROUND:Ri,DECIMAL_FIT:zi}=mi,Bi=new Oi({useRecords:!1,bundleStrings:!1,int64AsType:`number`}),Vi=new Fr({useRecords:!1,bundleStrings:!1,int64AsType:`number`});function Hi(e){return Bi.pack(e)}function Ui(e){return Vi.unpack(e)}function*Wi(e,t,n){let r=e.length,i=Math.ceil(r/n);for(let a=0;a<i;a++){let o=a*n,s=Math.min(o+n,r),c=e.subarray(o,s);yield{id:t,chunkIndex:a,data:c,isLast:a===i-1}}}var Gi=class{id;buffer;receivedChunks=new Set;totalChunks=0;chunkSize=0;constructor(e,t,n,r){this.id=e,this.totalChunks=n,this.chunkSize=r??Math.ceil(t/n),this.buffer=new Uint8Array(t)}addChunk(e){if(e.id!==this.id)throw Error(`Chunk ID mismatch: expected ${this.id}, got ${e.id}`);let t=e.chunkIndex*this.chunkSize;return this.buffer.set(e.data,t),this.receivedChunks.add(e.chunkIndex),this.isComplete()}isComplete(){return this.receivedChunks.size===this.totalChunks}getData(){if(!this.isComplete())throw Error(`Not all chunks received`);return Ui(this.buffer)}getProgress(){let e=this.receivedChunks.size,t=this.totalChunks;return{received:e,total:t,percentage:t>0?e/t*100:0}}},Ki=class{assemblers=new Map;completedCallbacks=new Map;errorCallbacks=new Map;startReceiving(e,t,n,r,i,a){let o=new Gi(e,i,t,a);this.assemblers.set(e,o),this.completedCallbacks.set(e,n),this.errorCallbacks.set(e,r)}processChunk(e){let t=this.assemblers.get(e.id);if(!t){console.warn(`Received chunk for unknown transfer: ${e.id}`);return}try{if(t.addChunk(e)){let n=t.getData(),r=this.completedCallbacks.get(e.id);this.assemblers.delete(e.id),this.completedCallbacks.delete(e.id),this.errorCallbacks.delete(e.id),r&&r(n)}}catch(t){let n=this.errorCallbacks.get(e.id);this.assemblers.delete(e.id),this.completedCallbacks.delete(e.id),this.errorCallbacks.delete(e.id),n&&n(t)}}cancel(e){let t=this.errorCallbacks.get(e);this.assemblers.delete(e),this.completedCallbacks.delete(e),this.errorCallbacks.delete(e),t&&t(Error(`Transfer cancelled`))}getProgress(e){let t=this.assemblers.get(e);return t?t.getProgress():null}}\n/*! *****************************************************************************\nCopyright (C) Microsoft. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the "License"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\n;s((()=>{var e;(function(e){(function(t){var n=typeof globalThis==`object`?globalThis:typeof global==`object`?global:typeof self==`object`?self:typeof this==`object`?this:s(),r=i(e);n.Reflect!==void 0&&(r=i(n.Reflect,r)),t(r,n),n.Reflect===void 0&&(n.Reflect=e);function i(e,t){return function(n,r){Object.defineProperty(e,n,{configurable:!0,writable:!0,value:r}),t&&t(n,r)}}function a(){try{return Function(`return this;`)()}catch{}}function o(){try{return(0,eval)(`(function() { return this; })()`)}catch{}}function s(){return a()||o()}})(function(e,t){var n=Object.prototype.hasOwnProperty,r=typeof Symbol==`function`,i=r&&Symbol.toPrimitive!==void 0?Symbol.toPrimitive:`@@toPrimitive`,a=r&&Symbol.iterator!==void 0?Symbol.iterator:`@@iterator`,o=typeof Object.create==`function`,s={__proto__:[]}instanceof Array,c=!o&&!s,l={create:o?function(){return ye(Object.create(null))}:s?function(){return ye({__proto__:null})}:function(){return ye({})},has:c?function(e,t){return n.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return n.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},u=Object.getPrototypeOf(Function),d=typeof Map==`function`&&typeof Map.prototype.entries==`function`?Map:ge(),f=typeof Set==`function`&&typeof Set.prototype.entries==`function`?Set:_e(),p=typeof WeakMap==`function`?WeakMap:ve(),m=r?Symbol.for(`@reflect-metadata:registry`):void 0,h=fe(),g=pe(h);function _(e,t,n,r){if(L(n)){if(!te(e)||!ne(t))throw TypeError();return D(e,t)}else{if(!te(e)||!B(t)||!B(r)&&!L(r)&&!R(r))throw TypeError();return R(r)&&(r=void 0),n=W(n),O(e,t,n,r)}}e(`decorate`,_);function v(e,t){function n(n,r){if(!B(n)||!L(r)&&!re(r))throw TypeError();N(e,t,n,r)}return n}e(`metadata`,v);function y(e,t,n,r){if(!B(n))throw TypeError();return L(r)||(r=W(r)),N(e,t,n,r)}e(`defineMetadata`,y);function b(e,t,n){if(!B(t))throw TypeError();return L(n)||(n=W(n)),k(e,t,n)}e(`hasMetadata`,b);function x(e,t,n){if(!B(t))throw TypeError();return L(n)||(n=W(n)),A(e,t,n)}e(`hasOwnMetadata`,x);function S(e,t,n){if(!B(t))throw TypeError();return L(n)||(n=W(n)),j(e,t,n)}e(`getMetadata`,S);function C(e,t,n){if(!B(t))throw TypeError();return L(n)||(n=W(n)),M(e,t,n)}e(`getOwnMetadata`,C);function w(e,t){if(!B(e))throw TypeError();return L(t)||(t=W(t)),P(e,t)}e(`getMetadataKeys`,w);function T(e,t){if(!B(e))throw TypeError();return L(t)||(t=W(t)),F(e,t)}e(`getOwnMetadataKeys`,T);function E(e,t,n){if(!B(t)||(L(n)||(n=W(n)),!B(t)))throw TypeError();L(n)||(n=W(n));var r=he(t,n,!1);return L(r)?!1:r.OrdinaryDeleteMetadata(e,t,n)}e(`deleteMetadata`,E);function D(e,t){for(var n=e.length-1;n>=0;--n){var r=e[n],i=r(t);if(!L(i)&&!R(i)){if(!ne(i))throw TypeError();t=i}}return t}function O(e,t,n,r){for(var i=e.length-1;i>=0;--i){var a=e[i],o=a(t,n,r);if(!L(o)&&!R(o)){if(!B(o))throw TypeError();r=o}}return r}function k(e,t,n){if(A(e,t,n))return!0;var r=ue(t);return R(r)?!1:k(e,r,n)}function A(e,t,n){var r=he(t,n,!1);return L(r)?!1:ee(r.OrdinaryHasOwnMetadata(e,t,n))}function j(e,t,n){if(A(e,t,n))return M(e,t,n);var r=ue(t);if(!R(r))return j(e,r,n)}function M(e,t,n){var r=he(t,n,!1);if(!L(r))return r.OrdinaryGetOwnMetadata(e,t,n)}function N(e,t,n,r){he(n,r,!0).OrdinaryDefineOwnMetadata(e,t,n,r)}function P(e,t){var n=F(e,t),r=ue(e);if(r===null)return n;var i=P(r,t);if(i.length<=0)return n;if(n.length<=0)return i;for(var a=new f,o=[],s=0,c=n;s<c.length;s++){var l=c[s],u=a.has(l);u||(a.add(l),o.push(l))}for(var d=0,p=i;d<p.length;d++){var l=p[d],u=a.has(l);u||(a.add(l),o.push(l))}return o}function F(e,t){var n=he(e,t,!1);return n?n.OrdinaryOwnMetadataKeys(e,t):[]}function I(e){if(e===null)return 1;switch(typeof e){case`undefined`:return 0;case`boolean`:return 2;case`string`:return 3;case`symbol`:return 4;case`number`:return 5;case`object`:return e===null?1:6;default:return 6}}function L(e){return e===void 0}function R(e){return e===null}function z(e){return typeof e==`symbol`}function B(e){return typeof e==`object`?e!==null:typeof e==`function`}function V(e,t){switch(I(e)){case 0:return e;case 1:return e;case 2:return e;case 3:return e;case 4:return e;case 5:return e}var n=t===3?`string`:t===5?`number`:`default`,r=ae(e,i);if(r!==void 0){var a=r.call(e,n);if(B(a))throw TypeError();return a}return H(e,n==="default"?`number`:n)}function H(e,t){if(t===`string`){var n=e.toString;if(G(n)){var r=n.call(e);if(!B(r))return r}var i=e.valueOf;if(G(i)){var r=i.call(e);if(!B(r))return r}}else{var i=e.valueOf;if(G(i)){var r=i.call(e);if(!B(r))return r}var a=e.toString;if(G(a)){var r=a.call(e);if(!B(r))return r}}throw TypeError()}function ee(e){return!!e}function U(e){return``+e}function W(e){var t=V(e,3);return z(t)?t:U(t)}function te(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:Object.prototype.toString.call(e)===`[object Array]`}function G(e){return typeof e==`function`}function ne(e){return typeof e==`function`}function re(e){switch(I(e)){case 3:return!0;case 4:return!0;default:return!1}}function ie(e,t){return e===t||e!==e&&t!==t}function ae(e,t){var n=e[t];if(n!=null){if(!G(n))throw TypeError();return n}}function oe(e){var t=ae(e,a);if(!G(t))throw TypeError();var n=t.call(e);if(!B(n))throw TypeError();return n}function se(e){return e.value}function ce(e){var t=e.next();return t.done?!1:t}function le(e){var t=e.return;t&&t.call(e)}function ue(e){var t=Object.getPrototypeOf(e);if(typeof e!=`function`||e===u||t!==u)return t;var n=e.prototype,r=n&&Object.getPrototypeOf(n);if(r==null||r===Object.prototype)return t;var i=r.constructor;return typeof i!=`function`||i===e?t:i}function de(){var e;!L(m)&&t.Reflect!==void 0&&!(m in t.Reflect)&&typeof t.Reflect.defineMetadata==`function`&&(e=me(t.Reflect));var n,r,i,a=new p,o={registerProvider:s,getProvider:l,setProvider:h};return o;function s(t){if(!Object.isExtensible(o))throw Error(`Cannot add provider to a frozen registry.`);switch(!0){case e===t:break;case L(n):n=t;break;case n===t:break;case L(r):r=t;break;case r===t:break;default:i===void 0&&(i=new f),i.add(t);break}}function c(t,a){if(!L(n)){if(n.isProviderFor(t,a))return n;if(!L(r)){if(r.isProviderFor(t,a))return n;if(!L(i))for(var o=oe(i);;){var s=ce(o);if(!s)return;var c=se(s);if(c.isProviderFor(t,a))return le(o),c}}}if(!L(e)&&e.isProviderFor(t,a))return e}function l(e,t){var n=a.get(e),r;return L(n)||(r=n.get(t)),L(r)?(r=c(e,t),L(r)||(L(n)&&(n=new d,a.set(e,n)),n.set(t,r)),r):r}function u(e){if(L(e))throw TypeError();return n===e||r===e||!L(i)&&i.has(e)}function h(e,t,n){if(!u(n))throw Error(`Metadata provider not registered.`);var r=l(e,t);if(r!==n){if(!L(r))return!1;var i=a.get(e);L(i)&&(i=new d,a.set(e,i)),i.set(t,n)}return!0}}function fe(){var e;return!L(m)&&B(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[m]),L(e)&&(e=de()),!L(m)&&B(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}function pe(e){var t=new p,n={isProviderFor:function(e,n){var r=t.get(e);return L(r)?!1:r.has(n)},OrdinaryDefineOwnMetadata:o,OrdinaryHasOwnMetadata:i,OrdinaryGetOwnMetadata:a,OrdinaryOwnMetadataKeys:s,OrdinaryDeleteMetadata:c};return h.registerProvider(n),n;function r(r,i,a){var o=t.get(r),s=!1;if(L(o)){if(!a)return;o=new d,t.set(r,o),s=!0}var c=o.get(i);if(L(c)){if(!a)return;if(c=new d,o.set(i,c),!e.setProvider(r,i,n))throw o.delete(i),s&&t.delete(r),Error(`Wrong provider for target.`)}return c}function i(e,t,n){var i=r(t,n,!1);return L(i)?!1:ee(i.has(e))}function a(e,t,n){var i=r(t,n,!1);if(!L(i))return i.get(e)}function o(e,t,n,i){r(n,i,!0).set(e,t)}function s(e,t){var n=[],i=r(e,t,!1);if(L(i))return n;for(var a=oe(i.keys()),o=0;;){var s=ce(a);if(!s)return n.length=o,n;var c=se(s);try{n[o]=c}catch(e){try{le(a)}finally{throw e}}o++}}function c(e,n,i){var a=r(n,i,!1);if(L(a)||!a.delete(e))return!1;if(a.size===0){var o=t.get(n);L(o)||(o.delete(i),o.size===0&&t.delete(o))}return!0}}function me(e){var t=e.defineMetadata,n=e.hasOwnMetadata,r=e.getOwnMetadata,i=e.getOwnMetadataKeys,a=e.deleteMetadata,o=new p;return{isProviderFor:function(e,t){var n=o.get(e);return!L(n)&&n.has(t)?!0:i(e,t).length?(L(n)&&(n=new f,o.set(e,n)),n.add(t),!0):!1},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:n,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:i,OrdinaryDeleteMetadata:a}}function he(e,t,n){var r=h.getProvider(e,t);if(!L(r))return r;if(n){if(h.setProvider(e,t,g))return g;throw Error(`Illegal state.`)}}function ge(){var e={},t=[],n=function(){function e(e,t,n){this._index=0,this._keys=e,this._values=t,this._selector=n}return e.prototype[`@@iterator`]=function(){return this},e.prototype[a]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var n=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var r=this._keys.length,i=n+1;i<r;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,ie(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new n(this._keys,this._values,r)},t.prototype.values=function(){return new n(this._keys,this._values,i)},t.prototype.entries=function(){return new n(this._keys,this._values,o)},t.prototype[`@@iterator`]=function(){return this.entries()},t.prototype[a]=function(){return this.entries()},t.prototype._find=function(e,t){if(!ie(this._cacheKey,e)){this._cacheIndex=-1;for(var n=0;n<this._keys.length;n++)if(ie(this._keys[n],e)){this._cacheIndex=n;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function r(e,t){return e}function i(e,t){return t}function o(e,t){return[e,t]}}function _e(){return function(){function e(){this._map=new d}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype[`@@iterator`]=function(){return this.keys()},e.prototype[a]=function(){return this.keys()},e}()}function ve(){var e=16,t=l.create(),r=i();return function(){function e(){this._key=i()}return e.prototype.has=function(e){var t=a(e,!1);return t===void 0?!1:l.has(t,this._key)},e.prototype.get=function(e){var t=a(e,!1);return t===void 0?void 0:l.get(t,this._key)},e.prototype.set=function(e,t){var n=a(e,!0);return n[this._key]=t,this},e.prototype.delete=function(e){var t=a(e,!1);return t===void 0?!1:delete t[this._key]},e.prototype.clear=function(){this._key=i()},e}();function i(){var e;do e=`@@WeakMap@@`+c();while(l.has(t,e));return t[e]=!0,e}function a(e,t){if(!n.call(e,r)){if(!t)return;Object.defineProperty(e,r,{value:l.create()})}return e[r]}function o(e,t){for(var n=0;n<t;++n)e[n]=Math.random()*255|0;return e}function s(e){if(typeof Uint8Array==`function`){var t=new Uint8Array(e);return typeof crypto<`u`?crypto.getRandomValues(t):typeof msCrypto<`u`?msCrypto.getRandomValues(t):o(t,e),t}return o(Array(e),e)}function c(){var t=s(e);t[6]=t[6]&79|64,t[8]=t[8]&191|128;for(var n=``,r=0;r<e;++r){var i=t[r];(r===4||r===6||r===8)&&(n+=`-`),i<16&&(n+=`0`),n+=i.toString(16).toLowerCase()}return n}}function ye(e){return e.__=void 0,delete e.__,e}})})(e||={})}))();let qi=Symbol(`rpc:methods`),Ji=Symbol(`rpc:nested`),Yi=Symbol(`rpc:exposeAll`);function Xi(e,t=[],n={},r=new WeakSet){if(!e||typeof e!=`object`||r.has(e))return n;r.add(e);let i=Object.getOwnPropertyNames(e),a=[],o=Object.getPrototypeOf(e);for(;o&&o!==Object.prototype;)a.push(...Object.getOwnPropertyNames(o)),o=Object.getPrototypeOf(o);let s=[...new Set([...i,...a])];for(let r of s)if(!(r===`constructor`||r.startsWith(`_`)||r.startsWith(`#`)))try{if(e.constructor&&Object.prototype.hasOwnProperty.call(e.constructor,r))continue;let i=Object.getOwnPropertyDescriptor(e,r);if(!i){let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype&&!i;)i=Object.getOwnPropertyDescriptor(t,r),t=Object.getPrototypeOf(t)}if(i&&(i.get||i.set)&&!i.value){let i=e[r];if(typeof i==`function`){let a=[...t,r].join(`.`);n[a]=i.bind(e)}continue}let a=e[r],o=[...t,r].join(`.`);typeof a==`function`&&(n[o]=a.bind(e))}catch{}return n}function Zi(e,t=[],n={},r=new WeakSet){if(r.has(e))return n;r.add(e);let i=e.constructor===Object||e.constructor===void 0,a=Object.getPrototypeOf(e),o=Reflect.hasMetadata(qi,e)||Reflect.hasMetadata(qi,a)||Reflect.hasMetadata(Ji,e)||Reflect.hasMetadata(Ji,a)||Reflect.hasMetadata(Yi,a);if(i&&!o){let i=Object.getOwnPropertyNames(e);for(let a of i)if(!(a===`constructor`||a.startsWith(`_`)))try{let i=e[a],o=[...t,a].join(`.`);typeof i==`function`?n[o]=i.bind(e):typeof i==`object`&&i&&!Array.isArray(i)?Zi(i,[...t,a],n,r):n[o]=async()=>i}catch{}}else{let i=a&&Reflect.getMetadata(Yi,a),o=[...Reflect.getMetadata(qi,e)??[],...(a&&Reflect.getMetadata(qi,a))??[]],s=[...Reflect.getMetadata(Ji,e)??[],...(a&&Reflect.getMetadata(Ji,a))??[]],c=Object.getOwnPropertyNames(e);a&&c.push(...Object.getOwnPropertyNames(a).filter(e=>e!==`constructor`));for(let l of c)if(l!==`constructor`)try{let c=e[l]??a?.[l];if(!c)continue;let u=[...t,l].join(`.`);typeof c==`function`?(i&&!l.startsWith(`_`)||o.includes(l))&&(n[u]=c.bind(e)):o.includes(l)?n[u]=async()=>e[l]:typeof c==`object`&&c&&s.includes(l)&&Zi(c,[...t,l],n,r)}catch{}}return n}var Qi=class e extends Error{code;data;constructor(e,t,n){super(t),this.name=`RPCException`,this.code=e,this.data=n}static fromJSON(t){return new e(t.code,t.message,t.data)}toJSON(){return{code:this.code,message:this.message,data:this.data}}};function $i(e,t,n){return new Qi(e,t,n)}let ea={METHOD_NOT_FOUND:`METHOD_NOT_FOUND`,INVALID_PARAMS:`INVALID_PARAMS`,INTERNAL_ERROR:`INTERNAL_ERROR`,TIMEOUT:`TIMEOUT`,CONNECTION_CLOSED:`CONNECTION_CLOSED`,STREAM_ERROR:`STREAM_ERROR`,PAYLOAD_TOO_LARGE:`PAYLOAD_TOO_LARGE`,NOT_FOUND:`NOT_FOUND`};async function ta(e,t,n,r,i){let a,o=e(...t);if(o&&typeof o.then==`function`){let e=await o;if(e&&typeof e[Symbol.asyncIterator]==`function`)a=e;else if(e&&typeof e[Symbol.iterator]==`function`)a=(async function*(){for(let t of e)yield t})();else throw $i(ea.INTERNAL_ERROR,`Handler must return a generator for stream`)}else if(o&&typeof o[Symbol.asyncIterator]==`function`)a=o;else if(o&&typeof o[Symbol.iterator]==`function`)a=(async function*(){for(let e of o)yield e})();else throw $i(ea.INTERNAL_ERROR,`Handler must return a generator for stream`);let s=!1,c=await i.subscribe(`${n}.cancel`,()=>{s=!0});await hr(0);try{for await(let e of a){if(s||!i.isConnected)break;let t={id:r,type:`data`,data:e};await i.publish(n,t)}if(!s&&i.isConnected){let e={id:r,type:`end`};await i.publish(n,e)}}catch(e){if(!s&&i.isConnected)try{let t={id:r,type:`error`,error:ra(e)};await i.publish(n,t)}catch{}}finally{if(c(),a.return)try{await a.return()}catch{}}}async function na(e,t){return e(...Array.isArray(t)?t:t==null?[]:[t])}function ra(e){return e instanceof Qi?e.toJSON():{code:ea.INTERNAL_ERROR,message:e instanceof Error?e.message:`Internal error`}}async function ia(e,t,n,r){let i,a=e(...t);if(a&&typeof a.then==`function`){let e=await a;if(e&&typeof e[Symbol.asyncIterator]==`function`)i=e;else if(e&&typeof e[Symbol.iterator]==`function`)i=(async function*(){for(let t of e)yield t})();else throw $i(ea.INTERNAL_ERROR,`Handler must return a generator for pull iterator`)}else if(a&&typeof a[Symbol.asyncIterator]==`function`)i=a;else if(a&&typeof a[Symbol.iterator]==`function`)i=(async function*(){for(let e of a)yield e})();else throw $i(ea.INTERNAL_ERROR,`Handler must return a generator for pull iterator`);let o=`_rpc.iterator.${n}.request`,s=`_rpc.iterator.${n}.response`,c=!0,l=await r.subscribe(o,async e=>{if(c)try{if(e.type===`cancel`){c=!1,i.return&&await i.return();let e={id:n,type:`done`};await r.publish(s,e)}else if(e.type===`next`){let{value:e,done:t}=await i.next();if(t){c=!1;let e={id:n,type:`done`};await r.publish(s,e)}else{let t={id:n,type:`value`,value:e};await r.publish(s,t)}}}catch(e){c=!1;let t={id:n,type:`error`,error:ra(e)};await r.publish(s,t)}});return async()=>{if(c=!1,l(),i.return)try{await i.return()}catch{}}}async function aa(e,t,n,r,i,a,o){let s=new Set(a),c={},l=!0;for(let e of i)s.has(e)?c[e]=(...t)=>{if(!l||!o.isConnected)return;let n={method:e,args:t};o.publish(r,n).catch(()=>{})}:c[e]=()=>{throw $i(ea.INTERNAL_ERROR,`Request-reply callback \'${e}\' not supported in v1`)};let u,d=e(...t,c),f=e=>{if(e&&typeof e[Symbol.asyncIterator]==`function`)return e;if(e&&typeof e[Symbol.iterator]==`function`)return(async function*(){for(let t of e)yield t})();throw $i(ea.INTERNAL_ERROR,`Handler must return a generator for pull-callback iterator`)};u=d&&typeof d.then==`function`?f(await d):f(d);let p=`_rpc.iterator.${n}.request`,m=`_rpc.iterator.${n}.response`,h=!0,g=await o.subscribe(p,async e=>{if(h)try{if(e.type===`cancel`){h=!1,l=!1,u.return&&await u.return();let e={id:n,type:`done`};await o.publish(m,e)}else if(e.type===`next`){let{done:e}=await u.next();if(e){h=!1,l=!1;let e={id:n,type:`done`};await o.publish(m,e)}else{let e={id:n,type:`value`};await o.publish(m,e)}}}catch(e){h=!1,l=!1;let t={id:n,type:`error`,error:ra(e)};await o.publish(m,t)}});return async()=>{if(h=!1,l=!1,g(),u.return)try{await u.return()}catch{}}}async function oa(e,t,n,r,i){let a=async e=>{if(!i.isConnected)return;let t={id:r,type:`data`,data:e};await i.publish(n,t)},o;try{let n=e(...t,a);n&&typeof n.then==`function`?o=await n:typeof n==`function`&&(o=n)}catch(e){let t={id:r,type:`error`,error:ra(e)};throw await i.publish(n,t),e}let s=await i.subscribe(`${n}.cancel`,async()=>{o&&await o()});return async()=>{s(),o&&await o()}}var sa=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceVerb=e.ServiceError=e.ServiceErrorCodeHeader=e.ServiceErrorHeader=e.ServiceResponseType=void 0,e.ServiceResponseType={STATS:`io.nats.micro.v1.stats_response`,INFO:`io.nats.micro.v1.info_response`,PING:`io.nats.micro.v1.ping_response`},e.ServiceErrorHeader=`Nats-Service-Error`,e.ServiceErrorCodeHeader=`Nats-Service-Error-Code`,e.ServiceError=class t extends Error{code;constructor(e,t){super(t),this.code=e}static isServiceError(e){return t.toServiceError(e)!==null}static toServiceError(n){let r=n?.headers?.get(e.ServiceErrorCodeHeader)||``;if(r!==``){let i=parseInt(r)||400,a=n?.headers?.get(e.ServiceErrorHeader)||``;return new t(i,a.length?a:r)}return null}},e.ServiceVerb={PING:`PING`,STATS:`STATS`,INFO:`INFO`}})),ca=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceImpl=e.ServiceGroupImpl=e.ServiceMsgImpl=e.ServiceApiPrefix=void 0;let t=(ar(),d(ir)),n=sa();function r(e,t=``){if(t===``)throw Error(`${e} name required`);let n=i(t);if(n.length)throw Error(`invalid ${e} name - ${e} name ${n}`)}function i(e=``){if(!e)throw Error(`name required`);let t=/^[-\\w]+$/g;if(e.match(t)===null){for(let n of e.split(``))if(n.match(t)===null)return`cannot contain \'${n}\'`}return``}e.ServiceApiPrefix=`$SRV`;var a=class{msg;constructor(e){this.msg=e}get data(){return this.msg.data}get sid(){return this.msg.sid}get subject(){return this.msg.subject}get reply(){return this.msg.reply||``}get headers(){return this.msg.headers}respond(e,t){return this.msg.respond(e,t)}respondError(e,r,i,a){return a||={},a.headers=a.headers||(0,t.headers)(),a.headers?.set(n.ServiceErrorCodeHeader,`${e}`),a.headers?.set(n.ServiceErrorHeader,r),this.msg.respond(i,a)}json(e){return this.msg.json(e)}string(){return this.msg.string()}};e.ServiceMsgImpl=a;var o=class e{subject;queue;srv;constructor(t,n=``,r=``){n!==``&&c(`service group`,n);let i=``;if(t instanceof l)this.srv=t,i=``;else if(t instanceof e){let e=t;this.srv=e.srv,r===void 0&&(r=e.queue),i=e.subject}else throw Error(`unknown ServiceGroup type`);this.subject=this.calcSubject(i,n),this.queue=r}calcSubject(e,t=``){return t===``?e:e===``?t:`${e}.${t}`}addEndpoint(e=``,t){t||={subject:e};let n=typeof t==`function`?{handler:t,subject:e}:t;r(`endpoint`,e);let{subject:i,handler:a,metadata:o,queue:c}=n;i||=e,c||=this.queue,s(`endpoint subject`,i),i=this.calcSubject(this.subject,i);let l={name:e,subject:i,queue:c,handler:a,metadata:o};return this.srv._addEndpoint(l)}addGroup(t=``,n){return n===void 0&&(n=this.queue),new e(this,t,n)}};e.ServiceGroupImpl=o;function s(e,t){if(t===``)throw Error(`${e} cannot be empty`);if(t.indexOf(` `)!==-1)throw Error(`${e} cannot contain spaces: \'${t}\'`);let n=t.split(`.`);n.forEach((r,i)=>{if(r===`>`&&i!==n.length-1)throw Error(`${e} cannot have internal \'>\': \'${t}\'`)})}function c(e,t){if(t.indexOf(` `)!==-1)throw Error(`${e} cannot contain spaces: \'${t}\'`);t.split(`.`).forEach(n=>{if(n===`>`)throw Error(`${e} name cannot contain internal \'>\': \'${t}\'`)})}var l=class i{nc;_id;config;handlers;internal;_stopped;_done;started;closeListener;static controlSubject(t,n=``,i=``,a){let o=a??e.ServiceApiPrefix;return n===``&&i===``?`${o}.${t}`:(r(`control subject name`,n),i===``?`${o}.${t}.${n}`:(r(`control subject id`,i),`${o}.${t}.${n}.${i}`))}constructor(e,n={name:``,version:``}){this.nc=e,this.config=Object.assign({},n),this.config.queue===void 0&&(this.config.queue=`q`),n.metadata=Object.freeze(n.metadata||{}),r(`name`,this.config.name),this.config.queue&&r(`queue`,this.config.queue),(0,t.parseSemVer)(this.config.version),this._id=t.nuid.next(),this.internal=[],this._done=(0,t.deferred)(),this._stopped=!1,this.handlers=[],this.started=new Date().toISOString(),this.reset(),this.closeListener={connectionClosedCallback:e=>{this.close(e).catch()}},this.nc.addCloseListener(this.closeListener)}get subjects(){return this.handlers.filter(e=>e.internal===!1).map(e=>e.subject)}get id(){return this._id}get name(){return this.config.name}get description(){return this.config.description??``}get version(){return this.config.version}get metadata(){return this.config.metadata}errorToHeader(e){let r=(0,t.headers)();if(e instanceof n.ServiceError){let t=e;r.set(n.ServiceErrorHeader,t.message),r.set(n.ServiceErrorCodeHeader,`${t.code}`)}else r.set(n.ServiceErrorHeader,e.message),r.set(n.ServiceErrorCodeHeader,`500`);return r}setupHandler(e,n=!1){let r=n?``:e.queue?e.queue:this.config.queue,{name:i,subject:o,handler:s}=e,c=e;c.internal=n,n&&this.internal.push(c),c.stats=new u(i,o,r),c.queue=r;let l=s?(e,n)=>{if(e){this.close(e);return}let r=Date.now();try{s(e,new a(n))}catch(e){c.stats.countError(e),n?.respond(t.Empty,{headers:this.errorToHeader(e)})}finally{c.stats.countLatency(r)}}:void 0;return c.sub=this.nc.subscribe(o,{callback:l,queue:r}),c.sub.closed.then(()=>{this._stopped||this.close(Error(`required subscription ${e.subject} stopped`)).catch()}).catch(t=>{if(!this._stopped){let n=Error(`required subscription ${e.subject} errored: ${t.message}`);n.stack=t.stack,this.close(n).catch()}}),c}info(){return{type:n.ServiceResponseType.INFO,name:this.name,id:this.id,version:this.version,description:this.description,metadata:this.metadata,endpoints:this.endpoints()}}endpoints(){return this.handlers.map(e=>{let{subject:t,metadata:n,name:r,queue:i}=e;return{subject:t,metadata:n,name:r,queue_group:i}})}async stats(){let e=[];for(let t of this.handlers){if(typeof this.config.statsHandler==`function`)try{t.stats.data=await this.config.statsHandler(t)}catch(e){t.stats.countError(e)}e.push(t.stats.stats(t.qi))}return{type:n.ServiceResponseType.STATS,name:this.name,id:this.id,version:this.version,started:this.started,metadata:this.metadata,endpoints:e}}addInternalHandler(e,t){let n=`${e}`.toUpperCase();this._doAddInternalHandler(`${n}-all`,e,t),this._doAddInternalHandler(`${n}-kind`,e,t,this.name),this._doAddInternalHandler(`${n}`,e,t,this.name,this.id)}_doAddInternalHandler(e,t,n,r=``,a=``){let o={};o.name=e,o.subject=i.controlSubject(t,r,a),o.handler=n,this.setupHandler(o,!0)}start(){let e=(e,t)=>e?(this.close(e),Promise.reject(e)):this.stats().then(e=>(t?.respond(JSON.stringify(e)),Promise.resolve())),t=(e,t)=>e?(this.close(e),Promise.reject(e)):(t?.respond(JSON.stringify(this.info())),Promise.resolve()),r=JSON.stringify(this.ping());return this.addInternalHandler(n.ServiceVerb.PING,(e,t)=>e?(this.close(e).then().catch(),Promise.reject(e)):(t.respond(r),Promise.resolve())),this.addInternalHandler(n.ServiceVerb.STATS,e),this.addInternalHandler(n.ServiceVerb.INFO,t),this.handlers.forEach(e=>{let{subject:t}=e;typeof t==`string`&&e.handler!==null&&this.setupHandler(e)}),Promise.resolve(this)}close(e){if(this._stopped)return this._done;this._stopped=!0,this.nc.removeCloseListener(this.closeListener);let t=[];return this.nc.isClosed()||(t=this.handlers.concat(this.internal).map(e=>e.sub.drain())),Promise.allSettled(t).then(()=>{this._done.resolve(e||null)}),this._done}get stopped(){return this._done}get isStopped(){return this._stopped}stop(e){return this.close(e)}ping(){return{type:n.ServiceResponseType.PING,name:this.name,id:this.id,version:this.version,metadata:this.metadata}}reset(){if(this.started=new Date().toISOString(),this.handlers)for(let e of this.handlers)e.stats.reset(e.qi)}addGroup(e,t){return new o(this,e,t)}addEndpoint(e,t){return new o(this).addEndpoint(e,t)}_addEndpoint(e){let n=new t.QueuedIteratorImpl;n.profile=!0,n.noIterator=typeof e.handler==`function`,n.noIterator||(e.handler=(e,t)=>{e?this.stop(e).catch():n.push(new a(t))},n.iterClosed.then(()=>{this.close().catch()}));let r=this.setupHandler(e,!1);return r.sub.closed.then(e=>{e?this.stop(e):n.stop()}),r.qi=n,this.handlers.push(r),n}};e.ServiceImpl=l;var u=class{name;subject;average_processing_time;num_requests;processing_time;num_errors;last_error;data;metadata;queue;constructor(e,t,n=``){this.name=e,this.subject=t,this.average_processing_time=0,this.num_errors=0,this.num_requests=0,this.processing_time=0,this.queue=n}reset(e){this.num_requests=0,this.processing_time=0,this.average_processing_time=0,this.num_errors=0,this.last_error=void 0,this.data=void 0;let t=e;t&&(t.time=0,t.processed=0)}countLatency(e){this.num_requests++,this.processing_time+=(0,t.nanos)(Date.now()-e),this.average_processing_time=Math.round(this.processing_time/this.num_requests)}countError(e){this.num_errors++,this.last_error=e.message}_stats(){let{name:e,subject:t,average_processing_time:n,num_errors:r,num_requests:i,processing_time:a,last_error:o,data:s,queue:c}=this;return{name:e,subject:t,average_processing_time:n,num_errors:r,num_requests:i,processing_time:a,last_error:o,data:s,queue_group:c}}stats(e){let n=e;return n?.noIterator===!1&&(this.processing_time=(0,t.nanos)(n.time),this.num_requests=n.processed,this.average_processing_time=this.processing_time>0&&this.num_requests>0?this.processing_time/this.num_requests:0),this._stats()}}})),la=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceClientImpl=void 0;let t=(ar(),d(ir)),n=ca(),r=sa();e.ServiceClientImpl=class{nc;prefix;opts;constructor(e,t={strategy:`stall`,maxWait:2e3},n){this.nc=e,this.prefix=n,this.opts=t}ping(e=``,t=``){return this.q(r.ServiceVerb.PING,e,t)}stats(e=``,t=``){return this.q(r.ServiceVerb.STATS,e,t)}info(e=``,t=``){return this.q(r.ServiceVerb.INFO,e,t)}async q(e,r=``,i=``){let a=new t.QueuedIteratorImpl,o=n.ServiceImpl.controlSubject(e,r,i,this.prefix),s=await this.nc.requestMany(o,t.Empty,this.opts);return(async()=>{for await(let e of s)try{let t=e.json();a.push(t)}catch(e){a.push(()=>{a.stop(e)})}a.push(()=>{a.stop()})})().catch(e=>{a.stop(e)}),a}}})),ua=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Svcm=e.ServiceVerb=e.ServiceResponseType=e.ServiceErrorHeader=e.ServiceErrorCodeHeader=e.ServiceError=void 0;let t=ca(),n=la();var r=sa();Object.defineProperty(e,"ServiceError",{enumerable:!0,get:function(){return r.ServiceError}}),Object.defineProperty(e,"ServiceErrorCodeHeader",{enumerable:!0,get:function(){return r.ServiceErrorCodeHeader}}),Object.defineProperty(e,"ServiceErrorHeader",{enumerable:!0,get:function(){return r.ServiceErrorHeader}}),Object.defineProperty(e,"ServiceResponseType",{enumerable:!0,get:function(){return r.ServiceResponseType}}),Object.defineProperty(e,"ServiceVerb",{enumerable:!0,get:function(){return r.ServiceVerb}}),e.Svcm=class{nc;constructor(e){this.nc=e}add(e){try{return new t.ServiceImpl(this.nc,e).start()}catch(e){return Promise.reject(e)}}client(e,t){return new n.ServiceClientImpl(this.nc,e,t)}}})),da=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Svcm=e.ServiceVerb=e.ServiceResponseType=e.ServiceErrorHeader=e.ServiceErrorCodeHeader=e.ServiceError=void 0;var t=ua();Object.defineProperty(e,"ServiceError",{enumerable:!0,get:function(){return t.ServiceError}}),Object.defineProperty(e,"ServiceErrorCodeHeader",{enumerable:!0,get:function(){return t.ServiceErrorCodeHeader}}),Object.defineProperty(e,"ServiceErrorHeader",{enumerable:!0,get:function(){return t.ServiceErrorHeader}}),Object.defineProperty(e,"ServiceResponseType",{enumerable:!0,get:function(){return t.ServiceResponseType}}),Object.defineProperty(e,"ServiceVerb",{enumerable:!0,get:function(){return t.ServiceVerb}}),Object.defineProperty(e,"Svcm",{enumerable:!0,get:function(){return t.Svcm}})}))(),fa=class{client;svc;services=[];initialized=!1;constructor(e){this.client=e}init(e){this.initialized||(this.initialized=!0,this.svc=new da.Svcm(e),this.services=[])}async registerHandler(e,t,n){if(!this.svc)throw Error(`RPCService is not initialized. Call init() first.`);let r=new Map,i=this.client,a=this.svc;n?.isolatedConnection&&(i=this.client.createIsolatedClient({...this.client.options,name:`${this.client.options.name}-service-${e.name}`}),a=new da.Svcm(await i.connect()));let o=await a.add(e);this.services.push(o),n?.isolatedConnection&&(o._isolatedClient=i);let s=Zi(t),c=new Map;for(let[e,t]of Object.entries(s)){let n=e.split(`.`),a=n.pop(),s=o;if(n.length>0){let e=n.join(`.`);if(!c.has(e)){let t=o;for(let e of n)t=t.addGroup(e);c.set(e,t)}s=c.get(e)}s.addEndpoint(a,async(e,n)=>{if(e){n.respondError(500,e.message);return}try{let e=n.headers?.get(`x-chunked-transfer`);if(e===`header`){let e=Ui(n.data),t=n.headers?.get(`x-chunk-id`);if(!t||e.transferId!==t){console.error(`Invalid chunk header`);return}i.chunkingManager.startReceiving(e.transferId,e.totalChunks,async e=>{await o(e,n)},e=>{console.error(`Error assembling chunks for ${a}:`,e)},e.totalSize,e.chunkSize)}else if(e===`chunk`){let e=n.headers?.get(`x-chunk-id`),t=parseInt(n.headers?.get(`x-chunk-index`)??`0`);if(!e){console.error(`Chunk missing chunk ID`);return}i.chunkingManager.processChunk({id:e,chunkIndex:t,data:n.data,isLast:!1})}else await o(Ui(n.data),n)}catch(e){console.error(`Error processing message for ${a}:`,e)}async function o(e,n){let a={id:e.id};try{if(e.params?.__stream&&e.params?.__streamSubject){let n=e.params.__streamSubject;await ta(t,e.params.args??[],n,e.id,i)}else if(e.params?.__pullIterator||Array.isArray(e.params)&&e.params[0]?.__pullIterator){let o=e.params?.__pullIterator?e.params:e.params[0],s=o.args??[],c=o.__iteratorId??e.id,l=await ia(t,s,c,i);r.set(c,l),a.result={iteratorId:c};let u=`${n.subject}.reply.${e.id}`;await i.publish(u,a)}else{a.result=await na(t,e.params);let r=`${n.subject}.reply.${e.id}`;await i.publish(r,a)}}catch(t){a.error=ra(t);try{let t=`${n.subject}.reply.${e.id}`;await i.publish(t,a)}catch(e){if(i.isClosed)return;console.error(`Failed to send error response:`,e)}}}})}let l=o;l._pullIteratorCleanups=r;let u=o.stop.bind(o);return o.stop=async e=>(await Promise.allSettled(Array.from(r.values()).map(e=>e())),r.clear(),u(e)),new pa(o)}monitor(){if(!this.svc)throw Error(`RPCService is not initialized. Call init() first.`);return this.svc.client({strategy:`stall`,stall:10,maxWait:2e3})}async stopAll(){await Promise.allSettled(this.services.map(async e=>{await e.stop();let t=e._isolatedClient;t&&await t.disconnect()})),this.services=[]}async stop(e){let t=this.services.find(t=>t.info().name===e);if(t)try{await t.stop();let e=t._isolatedClient;e&&await e.disconnect(),this.services=this.services.filter(e=>e!==t)}catch{}}getAllInfo(){return this.services.map(e=>e.info())}getInfo(e){return this.services.find(t=>t.info().name===e)?.info()}async getAllStats(){return Promise.all(this.services.map(e=>e.stats()))}async getStats(e){return this.services.find(t=>t.info().name===e)?.stats()}},pa=class{natsService;get isStopped(){return this.natsService.isStopped}constructor(e){this.natsService=e}info(){return this.natsService.info()}stats(){return this.natsService.stats()}async stop(e){try{await this.natsService.stop(e)}catch{}}};rr(),ye(),I(),jt();function ma(e){return new ha(e)}var ha=class e{options;service=new fa(this);chunkingManager=new Ki;pullIteratorCleanups=new Map;callbackCleanups=new Map;nc;subscriptions=new Map;_subscriptionMeta=new Map;_maxPayloadSize=1024*1024;connectionPromise;closed=!1;isolatedClients=[];pendingRequests=new Map;streamHandlers=new Map;get isConnected(){return this.nc?.isClosed()===!1}get isClosed(){return this.closed}get maxPayloadSize(){return this._maxPayloadSize}status(){return this.nc?.status()}async flush(e=5e3){if(!this.nc)throw $i(ea.CONNECTION_CLOSED,`Not connected`);let t;try{await Promise.race([this.nc.flush(),new Promise((n,r)=>{t=setTimeout(()=>r($i(ea.TIMEOUT,`flush() timed out after ${e}ms`)),e)})])}finally{t&&clearTimeout(t)}}constructor(e){this.options=e}createIsolatedClient(t){return new e(t)}async connect(e){if(e?.signal?.aborted)throw new DOMException(`Aborted`,`AbortError`);if(this.nc&&!this.nc.isClosed())return this.nc;let t={servers:this.options.servers,user:this.options.auth?.user,pass:this.options.auth?.password,name:this.options.name,reconnect:this.options.reconnect??!0,maxPingOut:this.options.maxPingOut??2,maxReconnectAttempts:this.options.maxReconnectAttempts??-1,reconnectTimeWait:this.options.reconnectTimeWait??2e3,reconnectJitter:this.options.reconnectJitter??100,reconnectJitterTLS:this.options.reconnectJitterTLS??1e3,ignoreAuthErrorAbort:this.options.ignoreAuthErrorAbort??!1,pingInterval:this.options.pingInterval??12e4,pingTimeout:this.options.pingTimeout??0,reconnectionDelayMax:this.options.reconnectionDelayMax??0,reconnectionRandomizationFactor:this.options.reconnectionRandomizationFactor??0,tls:this.options.tls,debug:this.options.debug??!1,noAsyncTraces:!0,waitOnFirstConnect:this.options.waitOnFirstConnect??!0,signal:e?.signal};this.connectionPromise??=$n(t);let n=this.connectionPromise;try{this.nc=await ga(n,e?.signal)}finally{this.connectionPromise=void 0}this.service.init(this.nc);try{let e=this.nc.info;this._maxPayloadSize=e?.max_payload??this.options.maxPayloadSize??1024*1024}catch{this._maxPayloadSize=this.options.maxPayloadSize??1024*1024}if(this._maxPayloadSize-=8192,this._subscriptionMeta.size>0){let e=[...this._subscriptionMeta.values()];this._subscriptionMeta.clear();for(let t of e)await this.subscribe(t.pattern,t.handler,t.options)}return this.nc}async disconnect(){this.closed=!0;for(let[,e]of this.pendingRequests)e.timeout&&clearTimeout(e.timeout),e.reject($i(ea.CONNECTION_CLOSED,`Connection closed`));this.pendingRequests.clear();for(let[,e]of this.streamHandlers)try{e.end()}catch{}this.streamHandlers.clear(),await Promise.allSettled(Array.from(this.pullIteratorCleanups.values()).map(e=>e())),this.pullIteratorCleanups.clear(),await Promise.allSettled(Array.from(this.callbackCleanups.values()).map(e=>e())),this.callbackCleanups.clear();for(let e of this.subscriptions.values())for(let t of e)try{t.unsubscribe()}catch{}if(this.subscriptions.clear(),this._subscriptionMeta.clear(),this.chunkingManager=new Ki,await Promise.allSettled(this.isolatedClients.map(e=>e.disconnect())),this.nc){try{await this.nc.close()}catch{}try{let e=this.options.disconnectTimeout??2e3;await Promise.race([this.nc.closed(),new Promise(t=>setTimeout(t,e))])}catch{}this.nc=void 0}}reconfigure(e){if(this.nc&&!this.nc.isClosed())throw Error(`Cannot reconfigure while connected. Call suspend() first.`);e.servers!==void 0&&(this.options.servers=e.servers),e.auth!==void 0&&(this.options.auth=e.auth);for(let t of this.isolatedClients)t.reconfigure(e)}setServers(e){this.options.servers=e,this.nc&&!this.nc.isClosed()&&this.nc.setServers(e);for(let t of this.isolatedClients)t.setServers(e)}async forceReconnect(){let e=this.nc;if(!(!e||e.isClosed())){try{typeof e.forceReconnect==`function`?await e.forceReconnect():typeof e.reconnect==`function`&&await e.reconnect()}catch{}await Promise.allSettled(this.isolatedClients.map(e=>e.forceReconnect()))}}abortClose(e){this.closed=!0;for(let[,e]of this.pendingRequests)e.timeout&&clearTimeout(e.timeout),e.reject($i(ea.CONNECTION_CLOSED,`Connection closed`));this.pendingRequests.clear();for(let[,e]of this.streamHandlers)try{e.end()}catch{}this.streamHandlers.clear();for(let e of this.pullIteratorCleanups.values())try{e()}catch{}this.pullIteratorCleanups.clear();for(let e of this.callbackCleanups.values())try{e()}catch{}this.callbackCleanups.clear();for(let t of this.isolatedClients)try{t.abortClose(e)}catch{}let t=this.nc;if(t){try{typeof t.abortClose==`function`?t.abortClose(e):t.close().catch(()=>{})}catch{}this.nc=void 0}}async suspend(){for(let[,e]of this.pendingRequests)e.timeout&&clearTimeout(e.timeout),e.reject($i(ea.CONNECTION_CLOSED,`Connection closed`));this.pendingRequests.clear();for(let[,e]of this.streamHandlers)try{e.end()}catch{}this.streamHandlers.clear(),await Promise.allSettled(Array.from(this.pullIteratorCleanups.values()).map(e=>e())),this.pullIteratorCleanups.clear(),await Promise.allSettled(Array.from(this.callbackCleanups.values()).map(e=>e())),this.callbackCleanups.clear();for(let e of this.subscriptions.values())for(let t of e)try{t.unsubscribe()}catch{}if(this.subscriptions.clear(),this.chunkingManager=new Ki,await Promise.allSettled(this.isolatedClients.map(e=>e.suspend())),this.nc){try{await this.nc.close()}catch{}try{let e=this.options.disconnectTimeout??2e3;await Promise.race([this.nc.closed(),new Promise(t=>setTimeout(t,e))])}catch{}this.nc=void 0}this.connectionPromise=void 0}async publish(e,t,n){if(!this.nc)throw Error(`Not connected`);let r=Hi(t);if(r.length<=this._maxPayloadSize){this.nc.publish(e,r,n);return}let i=mr(),a={type:`chunked`,transferId:i,totalChunks:Math.ceil(r.length/this._maxPayloadSize),totalSize:r.length,chunkSize:this._maxPayloadSize},o=n?.headers??Ot();o.set(`x-chunked-transfer`,`header`),o.set(`x-chunk-id`,i),this.nc.publish(e,Hi(a),{headers:o,reply:n?.reply});let s=0;for(let t of Wi(r,i,this._maxPayloadSize)){let r=Ot();r.set(`x-chunked-transfer`,`chunk`),r.set(`x-chunk-id`,i),r.set(`x-chunk-index`,s.toString()),this.nc.publish(e,t.data,{headers:r,reply:n?.reply}),s>0&&s%50==0&&await hr(0),s++}}async subscribe(e,t,n){if(!this.nc)throw Error(`Not connected`);let r=Promise.resolve(),i=n=>{let i;try{i=t(n)}catch(t){console.error(`Error in handler for ${e}:`,t);return}if(dr(i)){let t=i;r=r.then(()=>t).catch(t=>console.error(`Error in handler for ${e}:`,t))}},a=(t,n)=>{if(t){console.error(`Subscription error for ${e}:`,t);return}try{let t=n.headers?.get(`x-chunked-transfer`);if(t===`header`){let t=Ui(n.data),r=n.headers?.get(`x-chunk-id`);if(!r||t.transferId!==r){console.error(`Invalid chunk header`);return}this.chunkingManager.startReceiving(t.transferId,t.totalChunks,e=>{i(e)},t=>{console.error(`Error assembling chunks for ${e}:`,t)},t.totalSize,t.chunkSize)}else if(t===`chunk`){let e=n.headers?.get(`x-chunk-id`),t=parseInt(n.headers?.get(`x-chunk-index`)??`0`);if(!e){console.error(`Chunk missing chunk ID`);return}this.chunkingManager.processChunk({id:e,chunkIndex:t,data:n.data,isLast:!1})}else i(Ui(n.data))}catch(t){console.error(`Error processing message for ${e}:`,t)}},o=this.nc.subscribe(e,{...n?.queue?{queue:n.queue}:{},callback:a});return this.subscriptions.set(e,[o]),this._subscriptionMeta.set(e,{pattern:e,handler:t,options:n}),()=>{try{o.unsubscribe()}catch{}finally{this.subscriptions.delete(e),this._subscriptionMeta.delete(e)}}}async request(e,t,n){return this.withNoResponderRetry(()=>this._requestOnce(e,t,n),n?.noResponderRetry)}async _requestOnce(e,t,n){if(!this.nc)throw Error(`Not connected`);let r=n?.timeout??5e3,i=Hi(t);try{let t=await this.nc.request(e,i,{timeout:r,headers:n?.headers,noMux:!1});if(t.headers?.get(`Nats-Service-Error-Code`)){let e=t.headers.get(`Nats-Service-Error-Code`)||`500`,n=t.headers.get(`Nats-Service-Error`)||`Service error`,r=null;if(t.data)try{r=Ui(t.data)}catch{}throw $i(e,n,r)}let a=Ui(t.data);if(a?.error)throw $i(a.code??ea.INTERNAL_ERROR,a.error??`Unknown error`,a);return a}catch(t){throw t.code===`503`||t.message?.includes(`no responders`)?$i(ea.NOT_FOUND,`No responders available`):t.code===`TIMEOUT`||t.message?.includes(`timeout`)?$i(ea.TIMEOUT,`Request to "${e}" timed out after ${r}ms`):t}}async withNoResponderRetry(e,t){let n=t?.maxRetries??this.options.noResponderRetry?.maxRetries??3,r=t?.delays??this.options.noResponderRetry?.delays??[500,1e3,2e3];for(let t=0;;t++)try{return await e()}catch(e){if(!(e instanceof F.NoRespondersError||e instanceof Qi&&e.code===ea.NOT_FOUND)||t>=n||this.closed)throw e;let i=r[Math.min(t,r.length-1)];await hr(i)}}async call(e,...t){return this.withNoResponderRetry(()=>this._callOnce(e,...t))}async _callOnce(e,...t){if(!this.isConnected&&!this.isClosed&&await this.connect(),!this.nc)throw Error(`Not connected`);let n=mr(),r=this.options.timeout??3e4,i=e.startsWith(`rpc.`)?`rpc.reply.${n}`:`${e}.reply.${n}`;return new Promise(async(a,o)=>{let s,c,l=setTimeout(()=>{this.pendingRequests.has(n)&&(this.pendingRequests.delete(n),o($i(ea.TIMEOUT,`RPC call to "${e}" timed out after ${r}ms`)))},r);this.pendingRequests.set(n,{resolve:a,reject:o,timeout:l});let u=async()=>{if(this.pendingRequests.has(n)){let e=this.pendingRequests.get(n);e?.timeout&&clearTimeout(e.timeout),this.pendingRequests.delete(n)}if(s&&!s.isClosed())try{s.unsubscribe()}catch{}c?.()},d=async e=>{let t=e;if(t.id===n){let e=this.pendingRequests.get(t.id);if(e)if(this.pendingRequests.delete(t.id),e.timeout&&clearTimeout(e.timeout),await u(),t.error)e.reject(Qi.fromJSON(t.error));else{let n=t.result,r=n instanceof Uint8Array||n instanceof ArrayBuffer||typeof Buffer<`u`&&Buffer.isBuffer(n);t.__methods&&typeof n==`object`&&n&&!r&&(n.__methods=t.__methods),e.resolve(n)}}},f=(t,n)=>{n&&n.data?.length===0&&n.headers?.code===503?(o(new F.NoRespondersError(e)),u()):t&&(o(t),u())};try{c=await this.subscribe(i,d);let r=he();s=this.nc.subscribe(r,{max:1,callback:f});let a={id:n,method:`call`,params:t};await this.publish(e,a,{reply:r})}catch(e){await u(),o(e)}})}async*callStream(e,...t){let n=this.options.noResponderRetry?.maxRetries??3,r=this.options.noResponderRetry?.delays??[500,1e3,2e3];for(let i=0;;i++)try{yield*this._callStreamOnce(e,...t);return}catch(e){if(!(e instanceof F.NoRespondersError||e instanceof Qi&&e.code===ea.NOT_FOUND)||i>=n||this.closed)throw e;await hr(r[Math.min(i,r.length-1)])}}_callStreamOnce(e,...t){let n=this,r=!1,i=!1,a=!1,o=!1,s=null,c=``,l=``,u,d,f=[],p=null,m=()=>{let e=p;e&&(p=null,e({value:void 0,done:!0}))},h={push:e=>{if(!o)if(p){let t=p;p=null,t({value:e,done:!1})}else f.push(e)},end:()=>{o=!0,m()},error:e=>{s=e,o=!0,m()}},g=async()=>{if(!a){if(a=!0,n.streamHandlers.delete(c),u&&!u.isClosed())try{u.unsubscribe()}catch{}if(d?.(),!o){o=!0;try{await n.publish(`${l}.cancel`,{id:c})}catch{}}}},_=async e=>{if(e.id!==c)return;let t=n.streamHandlers.get(e.id);if(t)switch(e.type){case`data`:t.push(e.data);break;case`end`:t.end(),await g();break;case`error`:t.error(Qi.fromJSON(e.error)),await g();break}},v=(t,r)=>{r&&r.data?.length===0&&r.headers?.code===503?(n.streamHandlers.get(c)?.error(new F.NoRespondersError(e)),g()):t&&(n.streamHandlers.get(c)?.error(t),g())},y=async()=>{if(!n.isConnected&&!n.isClosed&&await n.connect(),!n.nc)throw Error(`Not connected`);c=mr(),l=`stream.${e}.${c}`,n.streamHandlers.set(c,h),d=await n.subscribe(l,_);let r=he();u=n.nc.subscribe(r,{max:1,callback:v});let i={id:c,method:`stream`,params:{__stream:!0,__streamSubject:l,args:t}};await n.publish(e,i,{reply:r})},b={async next(){if(i)return{value:void 0,done:!0};if(!r){r=!0;try{await y()}catch(e){throw await g(),e}if(i)return await g(),{value:void 0,done:!0}}if(s)throw await g(),s;if(f.length>0)return{value:f.shift(),done:!1};if(o)return await g(),{value:void 0,done:!0};let e=await new Promise((e,t)=>{if(i){e({value:void 0,done:!0});return}if(o){e({value:void 0,done:!0});return}if(s){t(s);return}p=e});if(i)return await g(),{value:void 0,done:!0};if(e.done){if(s)throw await g(),s;return await g(),{value:void 0,done:!0}}return{value:e.value,done:!1}},async return(e){return i?{value:e,done:!0}:(i=!0,m(),r&&await g(),{value:e,done:!0})},async throw(e){throw i?e:(i=!0,m(),r&&await g(),e)},[Symbol.asyncIterator](){return b},async[Symbol.asyncDispose](){await b.return()}};return b}callPullIterator(e,...t){let n=this,r=!1,i=!1,a=!1,o=!1,s=null,c=``,l=``,u=``,d,f=``,p,m=[],h=null,g=()=>{let e=h;e&&(h=null,e({id:c,type:`done`}))},_=async()=>{if(!a){if(a=!0,p?.(),d&&!d.isClosed())try{d.unsubscribe()}catch{}if(!o){o=!0;try{let e={id:c,type:`cancel`};await n.publish(l,e)}catch{}}}},v=async()=>{if(!n.isConnected&&!n.isClosed&&await n.connect(),!n.nc)throw Error(`Not connected`);if(c=mr(),l=`_rpc.iterator.${c}.request`,u=`_rpc.iterator.${c}.response`,(await n.call(e,{__pullIterator:!0,__iteratorId:c,args:t}))?.iteratorId!==c)throw Error(`Failed to initialize pull iterator`);p=await n.subscribe(u,e=>{if(e.type===`error`?(s=Qi.fromJSON(e.error),o=!0):e.type===`done`&&(o=!0),h){let t=h;h=null,t(e)}else m.push(e)}),f=he(),d=n.nc.subscribe(f,{max:1,callback:(t,n)=>{let r=!1;if(n&&n.data?.length===0&&n.headers?.code===503){let t=new F.NoRespondersError(e);r=!0,o=!0,s=$i(`503`,t.message)}else t&&(r=!0,o=!0,s=$i(ea.INTERNAL_ERROR,t.message));if(r){let e={type:`error`,id:c,error:s?s.toJSON():void 0};if(h){let t=h;h=null,t(e)}else m.push(e)}}})},y={async next(){if(i)return{value:void 0,done:!0};if(!r){r=!0;try{await v()}catch(e){throw await _(),e}if(i)return await _(),{value:void 0,done:!0}}let e={id:c,type:`next`};try{await n.publish(l,e,{reply:f})}catch(e){throw await _(),e}let t=await new Promise((e,t)=>{if(i){e({id:c,type:`done`});return}m.length>0?e(m.shift()):o&&s?t(s):o?e({id:c,type:`done`}):h=e});if(i)return await _(),{value:void 0,done:!0};if(t.type===`error`)throw await _(),Qi.fromJSON(t.error);return t.type===`done`?(await _(),{value:void 0,done:!0}):{value:t.value,done:!1}},async return(e){return i?{value:e,done:!0}:(i=!0,g(),r&&await _(),{value:e,done:!0})},async throw(e){throw i?e:(i=!0,g(),r&&await _(),e)},[Symbol.asyncIterator](){return y},async[Symbol.asyncDispose](){await y.return()}};return y}callPullIteratorWithCallback(e,t,n,...r){let i=this,a=!1,o=!1,s=!1,c=!1,l=null,u=``,d=``,f=``,p=``,m,h=``,g,_,v=[],y=null,b=Promise.resolve(),x=()=>{let e=y;e&&(y=null,e({id:u,type:`done`}))},S=async()=>{if(!s){if(s=!0,g?.(),_?.(),m&&!m.isClosed())try{m.unsubscribe()}catch{}if(!c){c=!0;try{let e={id:u,type:`cancel`};await i.publish(d,e)}catch{}}}},C=async()=>{if(!i.isConnected&&!i.isClosed&&await i.connect(),!i.nc)throw Error(`Not connected`);u=mr(),d=`_rpc.iterator.${u}.request`,f=`_rpc.iterator.${u}.response`,p=`_rpc.cb.${u}`;let a=Object.keys(t).filter(e=>typeof t[e]==`function`);g=await i.subscribe(p,e=>{let n=t[e.method];if(!n){console.error(`[rpc] Pull-callback: unknown method \'${e.method}\'`);return}b=b.then(async()=>{try{await n(...e.args??[])}catch(t){console.error(`[rpc] Pull-callback handler \'${e.method}\' threw:`,t)}})});let o={__pullCallback:!0,__iteratorId:u,__callbackSubject:p,__callbackMethods:a,__onewayMethods:n,args:r},s;try{s=await i.call(e,o)}catch(e){throw g?.(),g=void 0,e}if(s?.iteratorId!==u)throw g?.(),g=void 0,Error(`Failed to initialize pull-callback iterator`);_=await i.subscribe(f,e=>{if(e.type===`error`?(l=Qi.fromJSON(e.error),c=!0):e.type===`done`&&(c=!0),y){let t=y;y=null,t(e)}else v.push(e)}),h=he(),m=i.nc.subscribe(h,{max:1,callback:(t,n)=>{let r=!1;if(n&&n.data?.length===0&&n.headers?.code===503){let t=new F.NoRespondersError(e);r=!0,c=!0,l=$i(`503`,t.message)}else t&&(r=!0,c=!0,l=$i(ea.INTERNAL_ERROR,t.message));if(r){let e={type:`error`,id:u,error:l?l.toJSON():void 0};if(y){let t=y;y=null,t(e)}else v.push(e)}}})},w={async next(){if(o)return{value:void 0,done:!0};if(!a){a=!0;try{await C()}catch(e){throw await S(),e}if(o)return await S(),{value:void 0,done:!0}}let e={id:u,type:`next`};try{await i.publish(d,e,{reply:h})}catch(e){throw await S(),e}let t=await new Promise((e,t)=>{if(o){e({id:u,type:`done`});return}v.length>0?e(v.shift()):c&&l?t(l):c?e({id:u,type:`done`}):y=e});if(o)return await S(),{value:void 0,done:!0};if(t.type===`error`)throw await S(),Qi.fromJSON(t.error);return t.type===`done`?(await S(),{value:void 0,done:!0}):(await b,{value:void 0,done:!1})},async return(e){return o?{value:e,done:!0}:(o=!0,x(),a&&await S(),{value:e,done:!0})},async throw(e){throw o?e:(o=!0,x(),a&&await S(),e)},[Symbol.asyncIterator](){return w},async[Symbol.asyncDispose](){await w.return()}};return w}async callWithCallback(e,t,n){if(!this.isConnected&&!this.isClosed&&await this.connect(),!this.nc)throw Error(`Not connected`);let r=mr(),i=`rpc.cb.${r}`,a=await this.subscribe(i,async e=>{if(e.type===`data`)try{await n(e.data)}catch(e){console.error(`[rpc] Callback error:`,e)}else e.type===`error`&&console.error(`[rpc] Callback error:`,e.error)}),o={__callback:!0,__callbackSubject:i,args:t};try{await this.call(e,o)}catch(e){throw a(),e}return()=>{this.publish(`${i}.cancel`,{id:r}).catch(()=>{}),a()}}async registerHandler(e,t,n){if(!this.nc&&!n?.isolatedConnection)throw Error(`Not connected`);let r=this;n?.isolatedConnection&&(r=this.createIsolatedClient({...this.options,name:`${this.options.name}-handler-${e}`}),await r.connect(),this.isolatedClients.push(r));let i=[],a=[],o=n?.withoutDecorators?Xi(t):Zi(t),s=Object.keys(o);for(let[t,c]of Object.entries(o)){let o=`rpc.${e}.${t}`,l=await r.subscribe(o,async e=>{let n={id:e.id,__methods:s};try{if(e.params?.__stream&&e.params?.__streamSubject){let n=e.params.__streamSubject;ta(c,e.params.args??[],n,e.id,r).catch(e=>{console.error(`Stream request error for ${t}:`,e)});return}else if(e.params?.__pullIterator||Array.isArray(e.params)&&e.params[0]?.__pullIterator){let t=e.params?.__pullIterator?e.params:e.params[0],i=t.args??[],o=t.__iteratorId??e.id,s=await ia(c,i,o,r);r.pullIteratorCleanups.set(o,s),a.push(o),n.result={iteratorId:o};let l=`rpc.reply.${e.id}`;await r.publish(l,n)}else if(e.params?.__pullCallback||Array.isArray(e.params)&&e.params[0]?.__pullCallback){let t=e.params?.__pullCallback?e.params:e.params[0],i=t.args??[],o=t.__iteratorId??e.id,s=t.__callbackSubject,l=await aa(c,i,o,s,t.__callbackMethods??[],t.__onewayMethods??[],r);r.pullIteratorCleanups.set(o,l),a.push(o),n.result={iteratorId:o};let u=`rpc.reply.${e.id}`;await r.publish(u,n)}else if(e.params&&typeof e.params==`object`&&!Array.isArray(e.params)&&e.params.__callback&&e.params.__callbackSubject||Array.isArray(e.params)&&e.params.length>0&&typeof e.params[0]==`object`&&e.params[0]?.__callback){let t=Array.isArray(e.params)&&e.params[0]?.__callback?e.params[0]:e.params,i=t.__callbackSubject,a=await oa(c,t.args??[],i,e.id,r);r.callbackCleanups.set(e.id,a),n.result={ok:!0};let o=`rpc.reply.${e.id}`;await r.publish(o,n)}else{n.result=await na(c,e.params);let t=`rpc.reply.${e.id}`;await r.publish(t,n)}}catch(t){n.error=ra(t);try{let t=`rpc.reply.${e.id}`;await r.publish(t,n)}catch(e){if(r.isClosed)return;console.error(`Failed to send error response:`,e)}}},n?.queue?{queue:n.queue}:void 0);i.push(l)}return async()=>{for(let e of i)e();if(await Promise.allSettled(Array.from(r.pullIteratorCleanups.entries()).map(([e,t])=>(r.pullIteratorCleanups.delete(e),t()))),await Promise.allSettled(Array.from(r.callbackCleanups.entries()).map(([e,t])=>(r.callbackCleanups.delete(e),t()))),n?.isolatedConnection){await r.disconnect();let e=this.isolatedClients.indexOf(r);e>=0&&this.isolatedClients.splice(e,1)}}}async onRequest(e,t){if(!this.nc)throw Error(`Not connected`);let n=this.nc.subscribe(e,{callback:(n,r)=>{(async()=>{try{let e=await t(Ui(r.data));if(r.reply){let t=Hi(e);r.respond(t)}}catch(t){if(r.reply){let e=Hi({error:t instanceof Error?t.message:`Internal error`,code:t instanceof Qi?t.code:ea.INTERNAL_ERROR});r.respond(e)}console.error(`Error in request handler for ${e}:`,t)}})()}});return()=>{n.unsubscribe()}}async channel(e,t){let n;t?.isolatedConnection?(n=this.createIsolatedClient({...this.options,name:`${this.options.name}-channel-${e}`}),this.isolatedClients.push(n),await n.connect()):n=this;let r=new gr(n,e);return await r.init(),t?.isolatedConnection&&(r._isolatedClient=n),r}async privateChannel(e,t,n){let r;n?.isolatedConnection?(r=this.createIsolatedClient({...this.options,name:`${this.options.name}-private-${e}`}),this.isolatedClients.push(r),await r.connect()):r=this;let i=new _r(r,e,t);return await i.init(),n?.isolatedConnection&&(i._isolatedClient=r),i}createProxy(e,t){let n;t?.isolatedConnection?(n=this.createIsolatedClient({...this.options,name:`${this.options.name}-proxy-${e}`}),this.isolatedClients.push(n)):n=this;let r=fr(n,e);return t?.isolatedConnection?(r._isolatedClient=n,{proxy:r,close:async()=>{await n.disconnect();let e=this.isolatedClients.indexOf(n);e>=0&&this.isolatedClients.splice(e,1)}}):r}async createServiceProxy(e,t){let n;t?.isolatedConnection?(n=this.createIsolatedClient({...this.options,name:`${this.options.name}-service-${e}`}),this.isolatedClients.push(n),await n.connect()):n=this;let r=n.service.monitor(),i=[];for await(let t of await r.info(e))i.push(t);if(i.length===0){if(t?.isolatedConnection){await n.disconnect();let e=this.isolatedClients.indexOf(n);e>=0&&this.isolatedClients.splice(e,1)}throw Error(`No services found with name: ${e}`)}let a=t?.preferredId?i.find(e=>e.id===t.preferredId)??i[0]:i[0],o=pr(n,a,t?.timeout);return t?.isolatedConnection?(o._isolatedClient=n,{proxy:o,close:async()=>{await n.disconnect();let e=this.isolatedClients.indexOf(n);e>=0&&this.isolatedClients.splice(e,1)}}):o}};function ga(e,t){return t?t.aborted?(e.then(e=>_a(e)).catch(()=>{}),Promise.reject(new DOMException(`Aborted`,`AbortError`))):new Promise((n,r)=>{let i=!1,a=()=>{i||(i=!0,e.then(e=>_a(e)).catch(()=>{}),r(new DOMException(`Aborted`,`AbortError`)))};t.addEventListener(`abort`,a,{once:!0}),e.then(e=>{if(i){_a(e);return}i=!0,t.removeEventListener(`abort`,a),n(e)},e=>{i||(i=!0,t.removeEventListener(`abort`,a),r(e))})}):e}function _a(e){let t=e;try{typeof t.abortClose==`function`?t.abortClose():e.close().catch(()=>{})}catch{}}var va={id:`nats`,kind:`persistent`,phaseGating:!0,graceMs:4e3};function ya(e={}){let t={...va,...e.spec},n=e.proxyPath??`/api/proxy`,r=e.clientName??`@camera.ui/transport/nats`,i=e.natsUser??`secret`,a=e.natsPassword??`secret`,o=e.reconnectTimeWait??1e3,s=e.reconnectionDelayMax??5e3,c=e.reconnectionRandomizationFactor??.5,l=e.timeout??1e4,u=e.pingInterval??25e3,d=e.pingTimeout??2e4,h=e.maxPingOut??1,g=new m,_=new Set,v=null,y=null,b={up:!1},x=null,S=!1;function C(e){let t=new URL(e.endpoint.url),r=t.protocol===`https:`?`wss:`:`ws:`,i=t.port||(t.protocol===`https:`?`443`:`80`),a=new URLSearchParams({token:e.tokens.access});return e.tokens.proxySession&&a.set(`session`,e.tokens.proxySession),[`${r}//${t.hostname}:${i}${n}?${a.toString()}`]}function w(){let e=b.up?v:null;for(let t of[..._])try{t(e)}catch{}}function T(){b.up||(b={up:!0},g.emit(`up`,void 0))}function E(e){!b.up&&b.lastError===e||(b={up:!1,lastError:e},g.emit(`down`,{reason:e}))}function D(){x?.abort(),x=null}function O(e){D();let t=new AbortController;x=t,(async()=>{let n=e.status();if(n)for await(let e of n){if(t.signal.aborted)break;switch(e.type){case`reconnect`:T(),w();break;case`disconnect`:E(`disconnect`),w();break;case`staleConnection`:E(`staleConnection`),w();break;case`error`:k(e);break}}})().catch(()=>{})}function k(e){let t=ba(e.data),n=t.toLowerCase();if(n.includes(`auth`)||n.includes(`401`)||n.includes(`forbidden`)||n.includes(`403`)){g.emit(`auth-error`,{message:t});return}E(t)}async function A(e){if(D(),v){try{v.abortClose()}catch{}v=null,w()}let t=ma({servers:C(e),name:r,auth:{user:i,password:a},reconnect:!0,maxReconnectAttempts:-1,reconnectTimeWait:o,reconnectionDelayMax:s,reconnectionRandomizationFactor:c,timeout:l,pingInterval:u,pingTimeout:d,maxPingOut:h,ignoreAuthErrorAbort:!0});try{await t.connect()}catch(e){try{t.abortClose()}catch{}throw E(e instanceof Error?e.message:String(e)),e}v=t,T(),w(),O(t)}async function j(e){if(S)throw Error(`nats-transport disposed`);if(f(y,e))return;let t=p(y,e);if(y=e,!e){if(D(),v){try{v.abortClose()}catch{}v=null,w()}E(`detached`);return}if(t||!v){await A(e);return}let n=C(e);v.setServers(n)}function M(){return b}function N(e,t){return g.on(e,t)}async function P(){if(S=!0,D(),v){try{v.abortClose()}catch{}v=null,w()}_.clear(),b={up:!1},g.clear()}function F(){return v}function I(e){return _.add(e),e(v),()=>_.delete(e)}async function L(e=5e3){if(!v)throw Error(`nats-transport: no client`);await v.flush(e)}async function R(){v&&await v.forceReconnect()}return{spec:t,apply:j,health:M,on:N,dispose:P,getClient:F,subscribeClient:I,probeAlive:L,forceReconnect:R}}function ba(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function xa(e){let t=e.initial??{kind:`idle`},n=-1,r=new Set,i=new Set,a=!1;function o(e){if(a)return;let o=e.data;if(!o)return;if(o.type===`kernel-revalidate`){for(let e of[...i])try{e()}catch{}return}if(o.type!==`kernel-sync`||o.generation<=n)return;n=o.generation;let s=t;if(t=o.phase,s!==t)for(let e of[...r])try{e(t,s)}catch{}}e.source.addEventListener(`message`,o);function s(e){return e.kind===`online`?e.target:e.kind===`reconnecting`?e.lastTarget:null}return{get phase(){return t},get target(){return s(t)},subscribe(e){return r.add(e),()=>{r.delete(e)}},onRevalidate(e){return i.add(e),()=>{i.delete(e)}},requestSync(){a||e.source.postMessage({type:`kernel-sync-request`})},dispose(){a=!0,e.source.removeEventListener(`message`,o),r.clear(),i.clear()}}}var Sa=class{canvas=null;backend=`2d`;ready=!1;hidden=!1;lastW=0;lastH=0;ctx2d=null;gl=null;glProgram=null;glTexture=null;gpuDevice=null;gpuContext=null;gpuPipeline=null;gpuBindGroupLayout=null;gpuSampler=null;drawCount=0;dropCount=0;drawDurationSumUs=0;drawDurationMaxUs=0;async attachCanvas(e,t=`2d`){this.destroyBackend(),this.canvas=e,this.ready=!1,this.lastW=0,this.lastH=0;let n;n=t===`webgpu`?[`webgpu`,`webgl`,`2d`]:t===`webgl`?[`webgl`,`2d`]:[`2d`];for(let t of n){if(t===`webgpu`&&await this.initWebGPU(e))return this.backend=`webgpu`,this.ready=!0,`webgpu`;if(t===`webgl`&&this.initWebGL2(e))return this.backend=`webgl`,this.ready=!0,`webgl`;if(t===`2d`&&this.init2D(e))return this.backend=`2d`,this.ready=!0,`2d`}return this.backend=`2d`,this.ready=!0,`2d`}getBackend(){return this.backend}show(){this.hidden=!1}hide(){this.hidden=!0}getStats(){let e={backend:this.backend,drawCount:this.drawCount,dropCount:this.dropCount,drawDurationSumUs:this.drawDurationSumUs,drawDurationMaxUs:this.drawDurationMaxUs};return this.drawCount=0,this.dropCount=0,this.drawDurationSumUs=0,this.drawDurationMaxUs=0,e}drawFrame(e){if(!this.canvas||!this.ready||this.hidden){this.dropCount++,e.close();return}let t=e.displayWidth,n=e.displayHeight;if(t===0||n===0){this.dropCount++,e.close();return}let r=performance.now();try{switch(this.backend){case`webgpu`:this.drawWebGPU(e,t,n);break;case`webgl`:this.drawWebGL(e,t,n);break;case`2d`:this.draw2D(e,t,n);break}}catch{this.dropCount++,e.close();return}e.close();let i=(performance.now()-r)*1e3;this.drawCount++,this.drawDurationSumUs+=i,i>this.drawDurationMaxUs&&(this.drawDurationMaxUs=i)}destroy(){this.destroyBackend(),this.canvas=null,this.ready=!1,this.lastW=0,this.lastH=0}init2D(e){let t=e.getContext(`2d`,{alpha:!1,desynchronized:!0});return t?(this.ctx2d=t,!0):!1}draw2D(e,t,n){!this.canvas||!this.ctx2d||((t!==this.lastW||n!==this.lastH)&&(this.canvas.width=t,this.canvas.height=n,this.lastW=t,this.lastH=n),this.ctx2d.drawImage(e,0,0))}initWebGL2(e){try{let t=e.getContext(`webgl2`,{alpha:!1,desynchronized:!0,antialias:!1,powerPreference:`high-performance`});if(!t)return!1;let n=t.createShader(t.VERTEX_SHADER);if(!n)return!1;if(t.shaderSource(n,`#version 300 es\nout vec2 vUV;\nvoid main() {\n float x = float(gl_VertexID & 1) * 2.0;\n float y = float(gl_VertexID & 2);\n vUV = vec2(x, 1.0 - y);\n gl_Position = vec4(vUV * 2.0 - 1.0, 0.0, 1.0);\n vUV.y = 1.0 - vUV.y;\n}`),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))return t.deleteShader(n),!1;let r=t.createShader(t.FRAGMENT_SHADER);if(!r)return t.deleteShader(n),!1;if(t.shaderSource(r,`#version 300 es\nprecision mediump float;\nin vec2 vUV;\nuniform sampler2D uTex;\nout vec4 c;\nvoid main() { c = texture(uTex, vUV); }`),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS))return t.deleteShader(n),t.deleteShader(r),!1;let i=t.createProgram();if(!i)return t.deleteShader(n),t.deleteShader(r),!1;if(t.attachShader(i,n),t.attachShader(i,r),t.linkProgram(i),t.deleteShader(n),t.deleteShader(r),!t.getProgramParameter(i,t.LINK_STATUS))return t.deleteProgram(i),!1;t.useProgram(i);let a=t.createTexture();return a?(t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.uniform1i(t.getUniformLocation(i,`uTex`),0),this.gl=t,this.glProgram=i,this.glTexture=a,!0):(t.deleteProgram(i),!1)}catch{return!1}}drawWebGL(e,t,n){!this.gl||!this.glProgram||!this.glTexture||!this.canvas||((t!==this.lastW||n!==this.lastH)&&(this.canvas.width=t,this.canvas.height=n,this.lastW=t,this.lastH=n,this.gl.viewport(0,0,t,n)),this.gl.bindTexture(this.gl.TEXTURE_2D,this.glTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),this.gl.drawArrays(this.gl.TRIANGLES,0,3))}cleanupWebGL(){if(this.gl){this.glTexture&&this.gl.deleteTexture(this.glTexture),this.glProgram&&this.gl.deleteProgram(this.glProgram);let e=this.gl.getExtension(`WEBGL_lose_context`);e&&e.loseContext()}this.gl=null,this.glProgram=null,this.glTexture=null}async initWebGPU(e){try{if(!(`gpu`in navigator))return!1;let t=await navigator.gpu.requestAdapter({powerPreference:`high-performance`});if(!t)return!1;let n=await t.requestDevice(),r=e.getContext(`webgpu`);if(!r)return!1;let i=navigator.gpu.getPreferredCanvasFormat();r.configure({device:n,format:i,alphaMode:`opaque`});let a=n.createShaderModule({code:`\n@group(0) @binding(0) var mySampler: sampler;\n@group(0) @binding(1) var myTexture: texture_external;\n\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) uv: vec2f,\n};\n\n@vertex fn vs(@builtin(vertex_index) vi: u32) -> VertexOutput {\n var pos = array<vec2f, 3>(\n vec2f(-1.0, -1.0),\n vec2f( 3.0, -1.0),\n vec2f(-1.0, 3.0),\n );\n var out: VertexOutput;\n out.position = vec4f(pos[vi], 0.0, 1.0);\n out.uv = vec2f(out.position.x * 0.5 + 0.5, 1.0 - (out.position.y * 0.5 + 0.5));\n return out;\n}\n\n@fragment fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {\n return textureSampleBaseClampToEdge(myTexture, mySampler, uv);\n}\n`}),o=n.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{type:`filtering`}},{binding:1,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}}]}),s=n.createRenderPipeline({layout:n.createPipelineLayout({bindGroupLayouts:[o]}),vertex:{module:a,entryPoint:`vs`},fragment:{module:a,entryPoint:`fs`,targets:[{format:i}]},primitive:{topology:`triangle-list`}}),c=n.createSampler({magFilter:`linear`,minFilter:`linear`});return this.gpuDevice=n,this.gpuContext=r,this.gpuPipeline=s,this.gpuBindGroupLayout=o,this.gpuSampler=c,n.lost.then(()=>{this.cleanupWebGPU(),this.backend=`2d`,this.canvas&&this.init2D(this.canvas)}),!0}catch{return!1}}drawWebGPU(e,t,n){if(!this.gpuDevice||!this.gpuContext||!this.gpuPipeline||!this.gpuBindGroupLayout||!this.gpuSampler||!this.canvas)return;(t!==this.lastW||n!==this.lastH)&&(this.canvas.width=t,this.canvas.height=n,this.lastW=t,this.lastH=n);let r=this.gpuDevice.importExternalTexture({source:e}),i=this.gpuDevice.createBindGroup({layout:this.gpuBindGroupLayout,entries:[{binding:0,resource:this.gpuSampler},{binding:1,resource:r}]}),a=this.gpuDevice.createCommandEncoder(),o=this.gpuContext.getCurrentTexture().createView(),s=a.beginRenderPass({colorAttachments:[{view:o,loadOp:`clear`,storeOp:`store`,clearValue:{r:0,g:0,b:0,a:1}}]});s.setPipeline(this.gpuPipeline),s.setBindGroup(0,i),s.draw(3),s.end(),this.gpuDevice.queue.submit([a.finish()])}cleanupWebGPU(){try{this.gpuDevice?.destroy()}catch{}this.gpuDevice=null,this.gpuContext=null,this.gpuPipeline=null,this.gpuBindGroupLayout=null,this.gpuSampler=null}destroyBackend(){this.ctx2d=null,this.cleanupWebGL(),this.cleanupWebGPU()}},Ca=class{sessionEpoch=0;decodeStartTsMap=new Map;decodeCount=0;decodeLatencyTotalMs=0;decodeLatencyMaxMs=0;onFrameGapTotalMs=0;onFrameGapMaxMs=0;onFrameLastTime=0;renderTotalMs=0;renderMaxMs=0;logTimer=null;configureReset(){}markDecodeStart(e){}recordFrameOutput(e,t){}startLogger(){}stopLogger(){this.logTimer!==null&&(clearInterval(this.logTimer),this.logTimer=null)}};let wa=[[30,8100],[31,18e3],[32,20480],[40,32768],[41,32768],[42,34816],[50,110400],[51,184320],[52,184320]];function Ta(e,t){let n=Math.ceil(e/16)*Math.ceil(t/16);if(n===0)return null;for(let[e,t]of wa)if(Math.floor(t/n)>=1)return e;return null}function Ea(e,t){return e.length>=11&&e.startsWith(`avc1.`)?e.slice(0,-2)+t.toString(16).padStart(2,`0`):e}function Da(e,t){for(let n=0;n<e.length-8;n++)e[n]===0&&e[n+1]===0&&e[n+2]===0&&e[n+3]===1&&(e[n+4]&31)==7&&(e[n+7]=t)}function Oa(e,t,n){let r=null,i=e;if(e.startsWith(`avc1.`)&&t&&n){let a=parseInt(e.slice(-2),16),o=Math.ceil(t/16)*Math.ceil(n/16),s=wa.find(([e])=>e>=a);if(s&&o>0&&Math.floor(s[1]/o)>2){let o=Ta(t,n);o&&o<a&&(r=o,i=Ea(e,o))}}return{decoderCodec:i,h264PatchLevel:r}}var ka=class{cb;renderer;ownsRenderer;decoder=null;hasKeyframe=!1;h264PatchLevel=null;currentCodecString=``;currentWidth=0;currentHeight=0;firstFrameSent=!1;lastRenderedTs=0;perf=new Ca;constructor(e={},t){this.cb=e,t?(this.renderer=t,this.ownsRenderer=!1):(this.renderer=new Sa,this.ownsRenderer=!0)}attachCanvas(e){this.renderer.attachCanvas(e)}show(){this.renderer.show()}hide(){this.renderer.hide()}configure(e,t,n,r){if(this.firstFrameSent=!1,this.lastRenderedTs=0,e===this.currentCodecString&&t===this.currentWidth&&n===this.currentHeight&&this.decoder){`${e}${t}${n}`;return}this.closeDecoder(),this.perf.configureReset(),this.currentCodecString=e,this.currentWidth=t,this.currentHeight=n,this.hasKeyframe=!1;let i=Oa(e,t,n),a=i.decoderCodec;this.h264PatchLevel=i.h264PatchLevel;let o=t&&n?Math.ceil(t/16)*Math.ceil(n/16):0,s=`${a} (sps=${this.h264PatchLevel??`none`})`,c=r??!0;`${this.perf.sessionEpoch}${e}${t}${n}${o}${s}${c}`;let l={codec:a,optimizeForLatency:c};t&&n&&(l.codedWidth=t,l.codedHeight=n);try{this.decoder=new VideoDecoder({output:e=>this.onFrame(e),error:e=>{console.error(`[VideoPipeline] ✗ decoder error: ${e.message} | codec=${this.currentCodecString} dims=${this.currentWidth}x${this.currentHeight}`),this.cb.onError?.(e.message,!0);try{this.decoder?.close()}catch{}this.decoder=null,this.hasKeyframe=!1}}),this.decoder.configure(l)}catch(r){let i=r.message;console.error(`[VideoPipeline] ✗ decoder.configure() threw: ${i} | codec=${e} dims=${t}x${n} decoderCodec=${a}`),this.cb.onError?.(i,!0),this.decoder=null}}resetDecoder(){this.currentCodecString&&(this.closeDecoder(),this.configure(this.currentCodecString,this.currentWidth,this.currentHeight))}decode(e,t,n,r){if(!this.decoder&&t&&this.currentCodecString&&this.configure(this.currentCodecString,this.currentWidth,this.currentHeight),!this.decoder||!this.hasKeyframe&&!t)return;t&&(this.hasKeyframe=!0);let i=r??0,a=i>0?new Uint8Array(e,i):new Uint8Array(e);t&&this.h264PatchLevel!==null&&Da(a,this.h264PatchLevel);try{this.decoder.decode(new EncodedVideoChunk({type:t?`key`:`delta`,timestamp:n,data:a}))}catch(e){this.cb.onError?.(e.message,!1)}}decodeChain(e,t){if(this.decoder){for(let t of e){let e=new Uint8Array(t.data);if(t.keyframe&&(this.hasKeyframe=!0,this.h264PatchLevel!==null&&Da(e,this.h264PatchLevel)),this.hasKeyframe)try{this.decoder.decode(new EncodedVideoChunk({type:t.keyframe?`key`:`delta`,timestamp:t.ts,data:e}))}catch(e){this.cb.onError?.(e.message,!1)}}this.decoder.state===`configured`&&this.decoder.flush().catch(()=>{})}}destroy(){this.closeDecoder(),this.ownsRenderer&&this.renderer.destroy(),this.perf.stopLogger()}async flushAndDestroy(){if(this.decoder&&this.decoder.state===`configured`)try{await this.decoder.flush()}catch{}this.destroy()}drawFrame(e){this.renderer.drawFrame(e)}closeDecoder(){if(this.decoder){let e=this.decoder.decodeQueueSize;`${this.perf.sessionEpoch}${e}`;try{this.decoder.state===`configured`&&this.decoder.close()}catch{}this.decoder=null}}onFrame(e){let t=e.displayWidth,n=e.displayHeight,r=e.timestamp;t>0&&n>0&&(this.currentWidth>0&&this.currentHeight>0&&(t!==this.currentWidth||n!==this.currentHeight)&&console.warn(`[VideoPipeline] ⚠ STALE OUTPUT: frame ${t}x${n} @ ts=${r} does not match current ${this.currentWidth}x${this.currentHeight} — leaked from previous session?`),r<this.lastRenderedTs&&console.warn(`[VideoPipeline] ⚠ DECODER OUT-OF-ORDER: ts=${r} < prev=${this.lastRenderedTs} (delta=${r-this.lastRenderedTs}μs)`),this.lastRenderedTs=r),this.drawFrame(e),this.firstFrameSent||(this.firstFrameSent=!0,this.cb.onFirstFrame?.())}};\n/**\n* @vue/shared v3.5.39\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\nfunction Aa(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}let ja=Object.assign,Ma=Object.prototype.hasOwnProperty,Na=(e,t)=>Ma.call(e,t),Pa=Array.isArray,Fa=e=>Ba(e)===`[object Map]`,Ia=e=>typeof e==`string`,La=e=>typeof e==`symbol`,Ra=e=>typeof e==`object`&&!!e,za=Object.prototype.toString,Ba=e=>za.call(e),Va=e=>Ba(e).slice(8,-1),Ha=e=>Ia(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,Ua=(e,t)=>!Object.is(e,t),Wa=0,Ga,Ka\n/**\n* @vue/reactivity v3.5.39\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\n;function qa(){Wa++}function Ja(){if(--Wa>0)return;if(Ka){let e=Ka;for(Ka=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Ga;){let t=Ga;for(Ga=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}let Ya=!0,Xa=[];function Za(){Xa.push(Ya),Ya=!1}function Qa(){let e=Xa.pop();Ya=e===void 0?!0:e}let $a=0;function eo(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)eo(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}let to=new WeakMap,no=Symbol(``),ro=Symbol(``),io=Symbol(``);function ao(e,t,n,r,i,a){let o=to.get(e);if(!o){$a++;return}let s=e=>{e&&e.trigger()};if(qa(),t===`clear`)o.forEach(s);else{let i=Pa(e),a=i&&Ha(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===io||!La(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(io)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(no)),Fa(e)&&s(o.get(ro)));break;case`delete`:i||(s(o.get(no)),Fa(e)&&s(o.get(ro)));break;case`set`:Fa(e)&&s(o.get(no));break}}Ja()}function oo(e){let t=Go(e);return t===e||Uo(e)?t:t.map(Ko)}function so(e){return e=Go(e),e}function co(e,t){return Ho(e)?qo(Vo(e)?Ko(t):t):Ko(t)}let lo={__proto__:null,[Symbol.iterator](){return uo(this,Symbol.iterator,e=>co(this,e))},concat(...e){return oo(this).concat(...e.map(e=>Pa(e)?oo(e):e))},entries(){return uo(this,`entries`,e=>(e[1]=co(this,e[1]),e))},every(e,t){return po(this,`every`,e,t,void 0,arguments)},filter(e,t){return po(this,`filter`,e,t,e=>e.map(e=>co(this,e)),arguments)},find(e,t){return po(this,`find`,e,t,e=>co(this,e),arguments)},findIndex(e,t){return po(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return po(this,`findLast`,e,t,e=>co(this,e),arguments)},findLastIndex(e,t){return po(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return po(this,`forEach`,e,t,void 0,arguments)},includes(...e){return ho(this,`includes`,e)},indexOf(...e){return ho(this,`indexOf`,e)},join(e){return oo(this).join(e)},lastIndexOf(...e){return ho(this,`lastIndexOf`,e)},map(e,t){return po(this,`map`,e,t,void 0,arguments)},pop(){return go(this,`pop`)},push(...e){return go(this,`push`,e)},reduce(e,...t){return mo(this,`reduce`,e,t)},reduceRight(e,...t){return mo(this,`reduceRight`,e,t)},shift(){return go(this,`shift`)},some(e,t){return po(this,`some`,e,t,void 0,arguments)},splice(...e){return go(this,`splice`,e)},toReversed(){return oo(this).toReversed()},toSorted(e){return oo(this).toSorted(e)},toSpliced(...e){return oo(this).toSpliced(...e)},unshift(...e){return go(this,`unshift`,e)},values(){return uo(this,`values`,e=>co(this,e))}};function uo(e,t,n){let r=so(e),i=r[t]();return r!==e&&!Uo(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}let fo=Array.prototype;function po(e,t,n,r,i,a){let o=so(e),s=o!==e&&!Uo(e),c=o[t];if(c!==fo[t]){let t=c.apply(e,a);return s?Ko(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,co(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function mo(e,t,n,r){let i=so(e),a=i!==e&&!Uo(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=co(e,t)),n.call(this,t,co(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?co(e,c):c}function ho(e,t,n){let r=Go(e),i=r[t](...n);return(i===-1||i===!1)&&Wo(n[0])?(n[0]=Go(n[0]),r[t](...n)):i}function go(e,t,n=[]){Za(),qa();let r=Go(e)[t].apply(e,n);return Ja(),Qa(),r}let _o=Aa(`__proto__,__v_isRef,__isVue`),vo=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(La));function yo(e){return La(e)||(e=String(e)),Go(this).hasOwnProperty(e)}var bo=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Io:Fo:i?Po:No).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=Pa(e);if(!r){let e;if(a&&(e=lo[t]))return e;if(t===`hasOwnProperty`)return yo}let o=Reflect.get(e,t,Jo(e)?e:n);if((La(t)?vo.has(t):_o(t))||i)return o;if(Jo(o)){let e=a&&Ha(t)?o:o.value;return r&&Ra(e)?zo(e):e}return Ra(o)?r?zo(o):Ro(o):o}},xo=class extends bo{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=Pa(e)&&Ha(t);if(!this._isShallow){let e=Ho(i);if(!Uo(n)&&!Ho(n)&&(i=Go(i),n=Go(n)),!a&&Jo(i)&&!Jo(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:Na(e,t),s=Reflect.set(e,t,n,Jo(e)?e:r);return e===Go(r)&&s&&(o?Ua(n,i)&&ao(e,`set`,t,n,i):ao(e,`add`,t,n)),s}deleteProperty(e,t){let n=Na(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&ao(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return!La(t)||vo.has(t),n}ownKeys(e){return Pa(e),Reflect.ownKeys(e)}},So=class extends bo{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}};let Co=new xo,wo=new So,To=e=>e,Eo=e=>Reflect.getPrototypeOf(e);function Do(e,t,n){return function(...r){let i=this.__v_raw,a=Fa(Go(i)),o=e===`entries`||e===Symbol.iterator&&a,s=i[e](...r),c=n?To:t?qo:Ko;return ja(Object.create(s),{next(){let{value:e,done:t}=s.next();return t?{value:e,done:t}:{value:o?[c(e[0]),c(e[1])]:c(e),done:t}}})}}function Oo(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function ko(e,t){let n={get(n){let r=this.__v_raw,i=Go(r),a=Go(n),{has:o}=Eo(i),s=t?To:e?qo:Ko;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){return this.__v_raw.size},has(e){let t=this.__v_raw,n=Go(e);return e===n?t.has(e):t.has(e)||t.has(n)},forEach(n,r){let i=this,a=i.__v_raw,o=t?To:e?qo:Ko;return a.forEach((e,t)=>n.call(r,o(e),o(t),i))}};return ja(n,e?{add:Oo(`add`),set:Oo(`set`),delete:Oo(`delete`),clear:Oo(`clear`)}:{add(e){let n=Go(this),r=Eo(n),i=Go(e),a=!t&&!Uo(e)&&!Ho(e)?i:e;return r.has.call(n,a)||Ua(e,a)&&r.has.call(n,e)||Ua(i,a)&&r.has.call(n,i)||(n.add(a),ao(n,`add`,a,a)),this},set(e,n){!t&&!Uo(n)&&!Ho(n)&&(n=Go(n));let r=Go(this),{has:i,get:a}=Eo(r),o=i.call(r,e);o||=(e=Go(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?Ua(n,s)&&ao(r,`set`,e,n,s):ao(r,`add`,e,n),this},delete(e){let t=Go(this),{has:n,get:r}=Eo(t),i=n.call(t,e);i||=(e=Go(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&ao(t,`delete`,e,void 0,a),o},clear(){let e=Go(this),t=e.size!==0,n=e.clear();return t&&ao(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Do(r,e,t)}),n}function Ao(e,t){let n=ko(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(Na(n,r)&&r in t?n:t,r,i)}let jo={get:Ao(!1,!1)},Mo={get:Ao(!0,!1)},No=new WeakMap,Po=new WeakMap,Fo=new WeakMap,Io=new WeakMap;function Lo(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Ro(e){return Ho(e)?e:Bo(e,!1,Co,jo,No)}function zo(e){return Bo(e,!0,wo,Mo,Fo)}function Bo(e,t,n,r,i){if(!Ra(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=Lo(Va(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Vo(e){return Ho(e)?Vo(e.__v_raw):!!(e&&e.__v_isReactive)}function Ho(e){return!!(e&&e.__v_isReadonly)}function Uo(e){return!!(e&&e.__v_isShallow)}function Wo(e){return e?!!e.__v_raw:!1}function Go(e){let t=e&&e.__v_raw;return t?Go(t):e}let Ko=e=>Ra(e)?Ro(e):e,qo=e=>Ra(e)?zo(e):e;function Jo(e){return e?e.__v_isRef===!0:!1}var Yo;(function(e){e.FINISH_LAUNCHING=`finishLaunching`,e.SHUTDOWN=`shutdown`})(Yo||={});var Xo;(function(e){e.Hub=`hub`,e.SensorProvider=`sensorProvider`,e.CameraController=`cameraController`,e.CameraAndSensorProvider=`cameraAndSensorProvider`})(Xo||={});var Zo;(function(e){e.MotionDetection=`MotionDetection`,e.ObjectDetection=`ObjectDetection`,e.AudioDetection=`AudioDetection`,e.FaceDetection=`FaceDetection`,e.LicensePlateDetection=`LicensePlateDetection`,e.ClassifierDetection=`ClassifierDetection`,e.ClipDetection=`ClipDetection`,e.DiscoveryProvider=`DiscoveryProvider`,e.NVR=`NVR`,e.Notifier=`Notifier`,e.OAuthCapable=`OAuthCapable`,e.OAuthDeviceFlow=`OAuthDeviceFlow`,e.OAuthAuthCodeFlow=`OAuthAuthCodeFlow`,e.OAuthClientCredentials=`OAuthClientCredentials`})(Zo||={});var Qo;(function(e){e.PublishNotifications=`publishNotifications`})(Qo||={});var $o;(function(e){e.Info=`info`,e.Warn=`warn`,e.Error=`error`,e.Critical=`critical`})($o||={});var es;(function(e){e.Motion=`motion`,e.Object=`object`,e.Audio=`audio`,e.Face=`face`,e.LicensePlate=`licensePlate`,e.Classifier=`classifier`,e.Clip=`clip`,e.Contact=`contact`,e.Temperature=`temperature`,e.Humidity=`humidity`,e.Occupancy=`occupancy`,e.Smoke=`smoke`,e.Leak=`leak`,e.Light=`light`,e.Siren=`siren`,e.Switch=`switch`,e.Lock=`lock`,e.PTZ=`ptz`,e.SecuritySystem=`securitySystem`,e.Garage=`garage`,e.Doorbell=`doorbell`,e.Battery=`battery`})(es||={});var ts;(function(e){e.Sensor=`sensor`,e.Control=`control`,e.Trigger=`trigger`,e.Info=`info`})(ts||={});var ns;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Decibels=`decibels`,e.LastTriggered=`lastTriggered`})(ns||={});var rs;(function(e){e.LowBattery=`lowBattery`,e.Charging=`charging`})(rs||={});var is;(function(e){e.Level=`level`,e.Charging=`charging`,e.Low=`low`})(is||={});var as;(function(e){e.NotChargeable=`NOT_CHARGEABLE`,e.NotCharging=`NOT_CHARGING`,e.Charging=`CHARGING`,e.Full=`FULL`})(as||={});var os;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Labels=`labels`})(os||={});var ss;(function(e){e.Detected=`detected`})(ss||={});var cs;(function(e){e.Ring=`ring`})(cs||={});var ls;(function(e){e.Detected=`detected`,e.Detections=`detections`})(ls||={});var us;(function(e){e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e[e.Opening=2]=`Opening`,e[e.Closing=3]=`Closing`,e[e.Stopped=4]=`Stopped`})(us||={});var ds;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`,e.ObstructionDetected=`obstructionDetected`})(ds||={});var fs;(function(e){e.Current=`current`})(fs||={});var ps;(function(e){e.Detected=`detected`})(ps||={});var ms;(function(e){e.Detected=`detected`,e.Detections=`detections`})(ms||={});var hs;(function(e){e.Brightness=`brightness`})(hs||={});var gs;(function(e){e.On=`on`,e.Brightness=`brightness`})(gs||={});var _s;(function(e){e[e.Secured=0]=`Secured`,e[e.Unsecured=1]=`Unsecured`,e[e.Unknown=2]=`Unknown`})(_s||={});var vs;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`})(vs||={});var ys;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Blocked=`blocked`,e.LastTriggered=`lastTriggered`})(ys||={});var bs;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Labels=`labels`})(bs||={});var xs;(function(e){e.Detected=`detected`})(xs||={});var Ss;(function(e){e.Pan=`pan`,e.Tilt=`tilt`,e.Zoom=`zoom`,e.Presets=`presets`,e.Home=`home`})(Ss||={});var Cs;(function(e){e.Position=`position`,e.Moving=`moving`,e.Presets=`presets`,e.Velocity=`velocity`,e.TargetPreset=`targetPreset`})(Cs||={});var ws;(function(e){e[e.StayArm=0]=`StayArm`,e[e.AwayArm=1]=`AwayArm`,e[e.NightArm=2]=`NightArm`,e[e.Disarmed=3]=`Disarmed`,e[e.AlarmTriggered=4]=`AlarmTriggered`})(ws||={});var Ts;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`})(Ts||={});var Es;(function(e){e.Volume=`volume`})(Es||={});var Ds;(function(e){e.Active=`active`,e.Volume=`volume`})(Ds||={});var Os;(function(e){e.Detected=`detected`})(Os||={});var ks;(function(e){e.On=`on`})(ks||={});var As;(function(e){e.Current=`current`})(As||={});function js(e={}){let{releaseDelay:t=1e3,onRelease:n}=e,r=new Map,i=new Map;function a(e){let t=i.get(e);t&&(clearTimeout(t),i.delete(e))}function o(e){let t=r.get(e);if(t){try{n?.(e,t.value)}catch{}r.delete(e)}i.delete(e)}function s(e,t){a(e);let n=r.get(e);if(n)return n.refCount++,n.value;let i=t();return r.set(e,{value:i,refCount:1}),i}function c(e){let n=r.get(e);if(n&&(n.refCount--,n.refCount<=0)){let n=setTimeout(()=>{let t=r.get(e);t&&t.refCount<=0?o(e):i.delete(e)},t);i.set(e,n)}}function l(e){return r.get(e)?.value}function u(e){return r.has(e)}function d(e){a(e),o(e)}function f(){for(let e of i.keys())a(e);for(let e of r.keys())o(e)}function p(e){return r.get(e)?.refCount??0}function m(e){for(let[t,n]of r)e(n.value,t)}return{acquire:s,release:c,get:l,has:u,forceRelease:d,clear:f,getRefCount:p,forEachValue:m}}var Ms=class{static coreManagerNamespaces(){return{coreManagerSubject:`coreManager.subscriber`,coreManagerRpc:`coreManager.rpc`}}static deviceManagerNamespaces(){return{deviceManagerSubject:`deviceManager.subscriber`,deviceManagerRpc:`deviceManager.rpc`}}static discoveryManagerNamespaces(){return{discoveryManagerSubject:`discoveryManager.subscriber`,discoveryManagerRpc:`discoveryManager.rpc`}}static pluginNamespaces(e){return{pluginDeviceManagerSubject:`plugin.${e}.deviceManager.subscriber`,pluginChildRpc:`plugin.${e}.child.rpc`,pluginChild:`plugin.${e}.child`,pluginStorageRpc:`plugin.${e}.storage.rpc`}}static cameraNamespaces(e){return{cameraSubject:`camera.${e}.subscriber`,cameraControllerRpc:`camera.${e}.controller.rpc`}}static frameWorkerNamespaces(e){return{frameWorkerChildRpc:`camera.${e}.frameWorker.child.rpc`,frameWorkerChild:`camera.${e}.frameWorker.child`}}static pluginCameraNamespaces(e,t){return{cameraInterfacesRpc:`plugin.${e}.camera.${t}.cameraInterfaces.rpc`,cameraStorageRpc:`plugin.${e}.camera.${t}.cameraStorage.rpc`,cameraImplRpc:`plugin.${e}.camera.${t}.impl.rpc`}}static pluginSensorNamespaces(e,t,n){return{sensorStorageRpc:`plugin.${e}.camera.${t}.sensor.${n}.storage.rpc`}}static sensorControllerNamespaces(e){return{sensorSubject:`camera.${e}.sensors.subject`,sensorRpc:`camera.${e}.sensors.rpc`,sensorWriteSubject:`camera.${e}.sensors.writes`}}static sensorEventNamespaces(e,t){return{sensorSubject:`camera.${e}.sensor.${t}.subject`}}static sensorProviderNamespaces(e,t,n){return{sensorRpc:`plugin.${e}.camera.${t}.sensor.${n}.rpc`}}static frameWorkerDetectionNamespaces(e){return{detectionRpc:`camera.${e}.frameWorker.detection.rpc`}}static detectionEventNamespaces(e){return{detectionEventSubject:`camera.${e}.events.subject`}}static sensorControllerRpc(e){return`camera.${e}.sensors.controller.rpc`}static terminalManagerNamespaces(){return{terminalManagerSubject:`terminalManager.subscriber`,terminalManagerRpc:`terminalManager.rpc`}}static downloadManagerNamespaces(){return{downloadManagerRpc:`downloadManager.rpc`}}static notificationManagerNamespaces(){return{notificationsPublishSubject:`notifications.publish`}}static workerAgentRpc(e){return`worker.${e}.rpc`}static workerHeartbeat(){return`workers.heartbeat`}static workerDisconnect(){return`workers.disconnect`}};js({releaseDelay:1e3,onRelease:(e,t)=>t.close()}),js({releaseDelay:1e3}),es.Light,es.Siren,es.Battery,es.Doorbell,es.Contact,es.Motion,es.Object,es.Audio,es.Face,es.LicensePlate,es.Classifier,es.PTZ,es.Switch,es.Lock,es.SecuritySystem,es.Temperature,es.Humidity,es.Occupancy,es.Smoke,es.Leak,es.Garage,js({releaseDelay:1e3,onRelease:(e,t)=>t.manager.close()}),js({releaseDelay:1e3}),typeof document>`u`||document.visibilityState,new class{streams=new Map;releaseTimers=new Map;releaseDelay;DEFAULT_RELEASE_DELAY=2e3;constructor(e={}){this.releaseDelay=e.releaseDelay??this.DEFAULT_RELEASE_DELAY}has(e){return this.streams.has(e)}get(e){return this.streams.get(e)}acquire(e,t){this.cancelRelease(e);let n=this.streams.get(e);if(n)return n.refCount++,t&&n.consumerContainerRefs.add(t),n}register(e,t,n,r,i,a){this.cancelRelease(e);let o={stream:t,videoElementRef:n,cameraDeviceRef:r,containerElementRef:i,consumerContainerRefs:new Set([i]),sharedVideoElement:a,mediaStream:null,refCount:1};return this.streams.set(e,o),o}updateContainerElement(e,t){let n=this.streams.get(e);n&&(n.containerElementRef.value=t)}updateSharedVideoElement(e,t){let n=this.streams.get(e);n&&(n.sharedVideoElement=t)}updateMediaStream(e,t){let n=this.streams.get(e);n&&(n.mediaStream=t)}release(e,t,n){let r=this.streams.get(e);if(r){if(r.refCount--,n){r.consumerContainerRefs.delete(n);let e=r.sharedVideoElement,t=n.value,i=e?.parentElement??null;if(r.refCount>0&&e&&(i===t||i===null||!i.isConnected)){let n=this.pickVisibleConsumer(r,t);n&&(r.containerElementRef=n.ref,e.parentElement!==n.el&&(n.el.appendChild(e),e.play().catch(()=>{})))}}if(r.refCount<=0){let t=setTimeout(()=>{this.doRelease(e)},this.releaseDelay);this.releaseTimers.set(e,t)}}}forceRelease(e){this.cancelRelease(e),this.doRelease(e)}clear(){for(let e of this.releaseTimers.values())clearTimeout(e);this.releaseTimers.clear();for(let[e,t]of this.streams)t.stream.stop(),this.streams.delete(e)}getDebugInfo(){return Array.from(this.streams.entries()).map(([e,t])=>({cameraName:e,refCount:t.refCount,mode:t.stream.activeMode.value,resolution:t.stream.activeResolution.value}))}pickVisibleConsumer(e,t){let n;for(let r of e.consumerContainerRefs){let e=r.value;if(!(!e||e===t||!e.isConnected)){if(e.checkVisibility?.()??e.offsetParent!==null)return{ref:r,el:e};n??={ref:r,el:e}}}return n}cancelRelease(e){let t=this.releaseTimers.get(e);t&&(clearTimeout(t),this.releaseTimers.delete(e))}doRelease(e){let t=this.streams.get(e);t&&(t.refCount<=0&&(t.stream.stop(),this.streams.delete(e)),this.releaseTimers.delete(e))}};var Ns=class{wallSource;basePts=0;baseWall=0;rate=1;paused=!0;pausedPts=0;anchored=!1;abort=new AbortController;constructor(e){this.wallSource=e}now(){return this.paused?this.pausedPts:this.basePts+(this.wallSource()-this.baseWall)*1e6*this.rate}ptsToWall(e){return this.baseWall+(e-this.basePts)/1e6/this.rate}get isPaused(){return this.paused}get currentRate(){return this.rate}get isAnchored(){return this.anchored}start(e){this.basePts=e,this.baseWall=this.wallSource(),this.paused=!1,this.pausedPts=0,this.anchored=!0,this.invalidate()}reset(){this.basePts=0,this.baseWall=0,this.rate=1,this.paused=!0,this.pausedPts=0,this.anchored=!1,this.invalidate()}pause(){this.paused||(this.pausedPts=this.now(),this.paused=!0,this.invalidate())}resume(){this.paused&&(this.basePts=this.pausedPts,this.baseWall=this.wallSource(),this.paused=!1,this.invalidate())}setRate(e){if(!(e>0&&Number.isFinite(e)))throw Error(`MediaClock.setRate: rate must be positive finite, got ${e}`);this.rate!==e&&(this.paused||(this.basePts=this.now(),this.baseWall=this.wallSource()),this.rate=e,this.invalidate())}seek(e){this.paused?this.pausedPts=e:(this.basePts=e,this.baseWall=this.wallSource()),this.invalidate()}async waitUntil(e){for(;this.now()<e;){if(this.paused){await this.waitForChange();continue}let t=(this.ptsToWall(e)-this.wallSource())*1e3;if(t<=0)return;await this.sleepOrChange(t)}}invalidate(){let e=this.abort;this.abort=new AbortController,e.abort()}sleepOrChange(e){let t=this.abort.signal;return new Promise(n=>{if(t.aborted){n();return}let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e),i=()=>{clearTimeout(r),n()};t.addEventListener(`abort`,i,{once:!0})})}waitForChange(){let e=this.abort.signal;return e.aborted?Promise.resolve():new Promise(t=>{e.addEventListener(`abort`,()=>t(),{once:!0})})}};function Ps(){return new Ns(()=>performance.now()/1e3)}var Fs=class{promise;resolve;reject;settled=!1;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.settled=!0,e(t)},this.reject=e=>{this.settled=!0,t(e)}})}},Is=class extends Error{constructor(){super(`queue ended`),this.name=`QueueEndedError`}},Ls=class extends Error{constructor(){super(`aborted`),this.name=`QueueAbortError`}},Rs=class{buf;head=0;tail=0;_size=0;constructor(e=16){let t=zs(Math.max(2,e));this.buf=Array(t)}get size(){return this._size}get capacity(){return this.buf.length}push(e){this._size===this.buf.length&&this.grow(),this.buf[this.tail]=e,this.tail=this.tail+1&this.buf.length-1,this._size++}shift(){if(this._size===0)return;let e=this.buf[this.head];return this.buf[this.head]=void 0,this.head=this.head+1&this.buf.length-1,this._size--,e}peek(e=0){if(!(e>=this._size||e<0))return this.buf[this.head+e&this.buf.length-1]}drain(){let e=Array(this._size);for(let t=0;t<this._size;t++)e[t]=this.buf[this.head+t&this.buf.length-1];return this.clear(),e}clear(){this.buf.fill(void 0),this.head=0,this.tail=0,this._size=0}grow(){let e=this.buf.length,t=e*2,n=Array(t);for(let t=0;t<this._size;t++)n[t]=this.buf[this.head+t&e-1];this.buf=n,this.head=0,this.tail=this._size}};function zs(e){return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1}var Bs=class{items;waiters=[];writeWaiters=[];_ended;_endPromise=new Fs;maxSize;overflow;onDrop;constructor(e={}){this.maxSize=e.maxSize,this.overflow=e.overflow??`block`,this.onDrop=e.onDrop,this.items=new Rs(e.initialCapacity??Math.min(this.maxSize??16,64))}get size(){return this.items.size}get ended(){return this._ended!==void 0}get endPromise(){return this._endPromise.promise}get queued(){return{length:this.items.size}}submit(e){if(this._ended)return this.onDrop?.(e),!1;if(this.waiters.length)return this.waiters.shift().resolve(e),!0;if(this.maxSize!==void 0&&this.items.size>=this.maxSize)switch(this.overflow){case`block`:return!1;case`dropOldest`:{let t=this.items.shift();return this.onDrop?.(t),this.items.push(e),!0}case`dropNewest`:return this.onDrop?.(e),!1;case`error`:throw Error(`AsyncQueue: queue full`)}return this.items.push(e),!0}async enqueue(e,t){if(t?.aborted)throw new Ls;if(this._ended)return this.onDrop?.(e),!1;if(this.waiters.length)return this.waiters.shift().resolve(e),!0;if(this.maxSize===void 0||this.items.size<this.maxSize)return this.items.push(e),!0;if(this.overflow!==`block`)return this.submit(e);let n=new Fs,r={item:e,done:n};this.writeWaiters.push(r);let i;t&&(i=()=>{let e=this.writeWaiters.indexOf(r);e!==-1&&(this.writeWaiters.splice(e,1),n.reject(new Ls))},t.addEventListener(`abort`,i));try{return await n.promise,!0}finally{t&&i&&t.removeEventListener(`abort`,i)}}async dequeue(e){if(e?.aborted)throw new Ls;let t=this.items.shift();if((t!==void 0||this.items.size>0)&&t!==void 0)return this.wakeWriter(),t;if(this.items.size===0){if(this._ended)throw this._ended;let t=new Fs;this.waiters.push(t);let n;e&&(n=()=>{let e=this.waiters.indexOf(t);e!==-1&&(this.waiters.splice(e,1),t.reject(new Ls))},e.addEventListener(`abort`,n));try{return await t.promise}finally{e&&n&&e.removeEventListener(`abort`,n)}}return this.dequeue(e)}tryDequeue(){let e=this.items.shift();return e!==void 0&&this.wakeWriter(),e}peek(e=0){return this.items.peek(e)}end(e){if(!this._ended){this._ended=e??new Is;for(let e of this.waiters)e.reject(this._ended);this.waiters.length=0;for(let e of this.writeWaiters)this.onDrop?.(e.item),e.done.reject(this._ended);this.writeWaiters.length=0,this._endPromise.resolve()}}drain(){let e=this.items.drain();for(;this.writeWaiters.length&&(this.maxSize===void 0||this.items.size<this.maxSize);){let e=this.writeWaiters.shift();this.items.push(e.item),e.done.resolve()}return e}clear(){let e=this.items.drain();if(this.onDrop)for(let t of e)this.onDrop(t);for(;this.writeWaiters.length&&(this.maxSize===void 0||this.items.size<this.maxSize);){let e=this.writeWaiters.shift();this.items.push(e.item),e.done.resolve()}}async*[Symbol.asyncIterator](e){try{for(;;)try{yield await this.dequeue(e)}catch(e){if(e instanceof Is)return;throw e}}finally{}}[Symbol.dispose](){this.clear(),this.end()}wakeWriter(){if(!this.writeWaiters.length||this.maxSize!==void 0&&this.items.size>=this.maxSize)return;let e=this.writeWaiters.shift();this.items.push(e.item),e.done.resolve()}};let Vs=3e5;var Hs=class{renderer;cb;clock;videoDecoder=null;audioDecoder=null;decoderReady=!1;audioReady=!1;videoOnly=!0;v=null;waitForKeyframe=!0;firstVideoSeen=!1;firstAudioSeen=!1;lastDecoderEmitWall=0;gen=0;keyframeTs=new Set;constructor(e,t){this.renderer=e,this.cb=t,this.clock=Ps()}start(e,t){this.flushSync(),++this.gen,this.videoOnly=t,this.waitForKeyframe=!0,this.clock.reset(),e!==1&&this.clock.setRate(e),this.v=new Bs({maxSize:32,overflow:`dropOldest`,onDrop:e=>e.close()});let n=this.gen;`${n}${e}${t}`,this.renderLoop(n,this.v)}configure(e){let t=this.gen;this.closeVideoDecoder();let n={codec:e.codecString,optimizeForLatency:!0};e.width&&e.height&&(n.codedWidth=e.width,n.codedHeight=e.height);try{this.videoDecoder=new VideoDecoder({output:e=>{if(t!==this.gen||!this.v){e.close();return}this.v.submit(e)},error:e=>{this.videoDecoder=null,this.decoderReady=!1,this.cb.onError?.(e.message,!0)}}),this.videoDecoder.configure(n),this.decoderReady=!0}catch(e){this.videoDecoder=null,this.decoderReady=!1,this.cb.onError?.(e.message,!0);return}if(this.closeAudioDecoder(),!this.videoOnly&&e.audioCodecString&&e.audioSampleRate)try{this.audioDecoder=new AudioDecoder({output:e=>this.onDecodedAudio(t,e),error:()=>{this.audioDecoder=null,this.audioReady=!1}});let n={codec:e.audioCodecString,sampleRate:e.audioSampleRate,numberOfChannels:e.audioChannels??1};e.audioDescription&&e.audioDescription.length>0&&(n.description=e.audioDescription),this.audioDecoder.configure(n),this.audioReady=!0}catch{this.audioDecoder=null,this.audioReady=!1}}async pushVideo(e){let t=this.gen;if(!(!this.decoderReady||!this.videoDecoder||!this.v)){if(this.waitForKeyframe){if(e.type!==`key`)return;this.waitForKeyframe=!1,`${t}${e.timestamp}`}if(!this.clock.isAnchored)`${e.timestamp}`,this.clock.start(e.timestamp),this.firstVideoSeen=!0;else if(!this.firstVideoSeen){let t=this.clock.now();`${e.timestamp}${t}${e.timestamp-t}`,this.firstVideoSeen=!0}for(;this.gen===t&&e.timestamp-this.clock.now()>Vs;)await this.clock.waitUntil(e.timestamp-Vs);if(t===this.gen){e.type===`key`&&this.keyframeTs.add(e.timestamp);try{this.videoDecoder.decode(e)}catch(e){this.cb.onError?.(e.message,!1)}}}}pushAudio(e){if(!(!this.audioReady||!this.audioDecoder)){this.clock.isAnchored?this.firstAudioSeen||=!0:(`${e.timestamp}`,this.clock.start(e.timestamp),this.firstAudioSeen=!0);try{this.audioDecoder.decode(e)}catch{}}}pause(){this.clock.pause()}resume(){this.clock.resume()}setSpeed(e){e>0&&Number.isFinite(e)&&this.clock.setRate(e)}flush(){this.flushSync()}destroy(){this.flushSync()}flushSync(){++this.gen,this.v?.end(),this.v?.clear(),this.v=null,this.closeVideoDecoder(),this.closeAudioDecoder(),this.waitForKeyframe=!0,this.keyframeTs.clear(),this.firstVideoSeen=!1,this.firstAudioSeen=!1,this.lastDecoderEmitWall=0,this.clock.reset()}closeVideoDecoder(){if(this.videoDecoder){try{this.videoDecoder.state===`configured`&&this.videoDecoder.close()}catch{}this.videoDecoder=null,this.decoderReady=!1}}closeAudioDecoder(){if(this.audioDecoder){try{this.audioDecoder.state===`configured`&&this.audioDecoder.close()}catch{}this.audioDecoder=null,this.audioReady=!1}}async renderLoop(e,t){try{for await(let n of t){if(e!==this.gen){n.close();return}if(await this.clock.waitUntil(n.timestamp+8e4),e!==this.gen){n.close();return}let t=this.keyframeTs.delete(n.timestamp);this.renderer.drawFrame(n),this.cb.onFrameDrained?.(n.timestamp,t)}}catch{}}onDecodedAudio(e,t){if(e!==this.gen){t.close();return}let n=t.sampleRate,r=t.numberOfChannels,i=t.numberOfFrames,a=t.timestamp,o=[];try{for(let e=0;e<r;e++){let n=new Float32Array(i);t.copyTo(n,{planeIndex:e,format:`f32-planar`}),o.push(n)}}catch(e){t.close(),this.cb.onError?.(e.message,!1);return}t.close(),this.cb.onAudioChunk?.({channels:o,sampleRate:n,numberOfFrames:i,pts:a},o.map(e=>e.buffer))}};let Us=`@camera.ui/camera-ui-nvr`,Ws=[`onReady`,`onVideo`,`onAudio`,`onNoData`];function Gs(...e){let t=new Date,n=String(t.getHours()).padStart(2,`0`),r=String(t.getMinutes()).padStart(2,`0`),i=String(t.getSeconds()).padStart(2,`0`),a=String(t.getMilliseconds()).padStart(3,`0`);console.log(`[NvrSession ${n}:${r}:${i}.${a}]`,...e)}function Ks(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):(e instanceof ArrayBuffer,e)}var qs=class{videoPipeline;post;nats;pipeline;cameraId=``;attached=!1;localState=`unconfigured`;lastTarget=null;firstClient=null;firstClientResolve=null;pluginCache=null;sessionId=null;playIter=null;generation=0;lastPlayOpts=null;lastScrubArgs=null;lastFrameTsUs=0;isPaused=!1;timeline=null;timelineFirstFrame=!1;unsubMirror;transportListenerCleanups=[];constructor(e,t,n,r,i){this.videoPipeline=e,this.post=n,this.nats=r,this.pipeline=new Hs(t,{onFrameDrained:(e,t)=>this.post({type:`nvr-frame-drained`,ts:e,keyframe:t,framesSince:1}),onAudioChunk:(e,t)=>this.post({type:`nvr-audio-data`,channels:e.channels,sampleRate:e.sampleRate,numberOfFrames:e.numberOfFrames,pts:e.pts},t),onError:(e,t)=>this.post({type:`nvr-session-error`,message:e,fatal:t})}),this.transportListenerCleanups.push(this.nats.on(`up`,()=>{let e=this.localState===`connecting`;if(Gs(`nats UP (wasReconnecting=${e})`),this.localState=`connected`,e&&this.attached&&!this.isPaused&&this.lastPlayOpts&&this.lastFrameTsUs>0){let e=this.lastPlayOpts;Gs(`auto-resume after nats reconnect: play(tsUs=${this.lastFrameTsUs})`),this.play(this.lastFrameTsUs,e.videoOnly,e.sourceRole,e.speed)}})),this.transportListenerCleanups.push(this.nats.on(`down`,()=>{Gs(`nats DOWN`),this.localState=`connecting`,this.playIter&&this.lastFrameTsUs>0&&this.post({type:`nvr-buffering`,buffering:!0})})),this.firstClient=new Promise(e=>{this.firstClientResolve=e}),this.transportListenerCleanups.push(this.nats.subscribeClient(e=>{e&&this.firstClientResolve&&(this.firstClientResolve(e),this.firstClientResolve=null)})),this.unsubMirror=i.subscribe((e,t)=>{Gs(`mirror update — phase=${e.kind}, target=${i.target?i.target.endpoint.url:`null`}`),this.applyTargetFromMirror(i.target)}),Gs(`ctor — initial mirror.target=${i.target?i.target.endpoint.url:`null`}, phase=${i.phase.kind}`),i.target&&this.applyTargetFromMirror(i.target)}get isRunning(){return this.sessionId!==null||this.playIter!==null}attach(e){if(this.attached){Gs(`attach() — already attached, ignoring (current=${this.cameraId}, new=${e.cameraId})`);return}this.cameraId=e.cameraId,this.attached=!0,Gs(`attach(${e.cameraId})`)}async handleForceReconnect(){if(this.attached)try{await this.nats.forceReconnect()}catch(e){this.post({type:`nvr-session-error`,message:e.message,fatal:!1})}}async handleRevalidate(){if(this.attached&&this.nats.health().up)try{await this.nats.probeAlive(3e3)}catch{try{await this.nats.forceReconnect()}catch(e){this.post({type:`nvr-session-error`,message:e.message,fatal:!1})}}}async handleSuspendPush(e){if(Gs(`suspend push, keepNats=${e.keepNats}, wasPlaying=${this.playIter!==null}`),this.isPaused=!0,this.generation++,await this.stopActiveStream(),this.pipeline.pause(),this.sessionId=null,!e.keepNats){try{await this.nats.apply(null)}catch(e){Gs(`suspend: nats.apply(null) threw: ${e.message}`)}this.localState=`suspended`}}async handleResumePush(){if(Gs(`resume push`),this.isPaused=!1,this.localState===`suspended`&&this.lastTarget)try{await this.nats.apply(this.lastTarget)}catch(e){this.post({type:`nvr-session-error`,message:e.message,fatal:!1});return}if(this.localState=`connected`,this.lastPlayOpts&&!this.playIter){let e=this.lastFrameTsUs>0?this.lastFrameTsUs:0;this.play(e,this.lastPlayOpts.videoOnly,this.lastPlayOpts.sourceRole,this.lastPlayOpts.speed)}}async scrub(e,t,n){let r=++this.generation;if(this.lastScrubArgs={tsUs:e,fine:t,sourceRole:n},this.isPaused=!1,!await this.waitForClient()||r!==this.generation)return;await this.stopActiveStream();let i=await this.tryGetPlugin();if(i&&r===this.generation)try{let a=await i.nvrScrub(this.cameraId,e,t,n);if(r!==this.generation)return;if(a.noData){this.post({type:`nvr-scrub-result`,ts:0,noData:!0});return}if(a.codecString&&this.videoPipeline.configure(a.codecString,a.width??0,a.height??0),t&&a.frames?.length){let e=a.frames.map(e=>({data:Ks(e.frame),keyframe:e.keyframe,ts:e.ts}));this.videoPipeline.decodeChain(e),this.post({type:`nvr-scrub-result`,ts:a.frames[a.frames.length-1].ts,noData:!1})}else a.frame?(this.videoPipeline.decode(Ks(a.frame),!0,a.ts),this.post({type:`nvr-scrub-result`,ts:a.ts,noData:!1})):this.post({type:`nvr-scrub-result`,ts:0,noData:!0})}catch(e){if(r!==this.generation)return;this.post({type:`nvr-session-error`,message:e.message,fatal:!1})}}async play(e,t,n,r){let i=++this.generation;if(Gs(`play enter gen=${i} tsUs=${e} videoOnly=${t}`),!await this.waitForClient()){Gs(`play gen=${i} aborted — client not ready`);return}if(i!==this.generation)return;await this.stopActiveStream(),Gs(`play: stopActiveStream done gen=${i}`),this.lastPlayOpts={videoOnly:t,sourceRole:n,speed:r},this.isPaused=!1,this.pipeline.start(r,t),this.timeline=null,this.timelineFirstFrame=!1,this.timeline?.mark(`play-enter`);let a=await this.tryGetPlugin();if(!a){this.pipeline.flush();return}if(i!==this.generation)return;this.timeline?.mark(`session-ready`);let o=cr({onReady:e=>this.handleReady(i,e),onVideo:e=>this.handleVideo(i,e),onAudio:e=>this.handleAudio(i,e),onNoData:e=>this.handleNoData(i,e)},{oneway:[...Ws]}),s;try{Gs(`play: calling plugin.nvrPlayback gen=${i}`),s=a.nvrPlayback(this.cameraId,e,t,n,o),Gs(`play: nvrPlayback returned iter gen=${i}`)}catch(e){if(Gs(`play: nvrPlayback threw gen=${i}: ${e.message}`),i!==this.generation)return;this.pipeline.flush(),this.post({type:`nvr-session-error`,message:e.message,fatal:!1});return}this.playIter=s,this.timeline?.mark(`rpc-issued`);try{let e=0;for await(let t of s)if(e++,e<=3&&Gs(`play: iter yield #${e} gen=${i}`),i!==this.generation)break;Gs(`play: for-await exited normally gen=${i} yields=${e}`)}catch(e){Gs(`play: for-await threw gen=${i}: ${e.message}`),i===this.generation&&this.post({type:`nvr-session-error`,message:e.message,fatal:!1})}finally{this.playIter===s&&(this.playIter=null),i===this.generation&&(Gs(`play: posting nvr-eof gen=${i}`),this.post({type:`nvr-eof`}))}}async seek(e){Gs(`seek(${e}) — localState=${this.localState}, isPaused=${this.isPaused}`);let t=this.lastPlayOpts;if(!t){Gs(`seek — no lastPlayOpts, skipping`);return}await this.play(e,t.videoOnly,t.sourceRole,t.speed)}async cmd(e,t,n){if(e===`seek`){t!==void 0&&await this.seek(t);return}switch(e){case`pause`:this.isPaused=!0,this.pipeline.pause();break;case`resume`:if(this.isPaused=!1,!this.sessionId&&!this.playIter&&this.lastPlayOpts){let e=this.lastFrameTsUs>0?this.lastFrameTsUs:0;this.play(e,this.lastPlayOpts.videoOnly,this.lastPlayOpts.sourceRole,this.lastPlayOpts.speed);return}this.pipeline.resume();break;case`speed`:n!==void 0&&(this.lastPlayOpts&&(this.lastPlayOpts.speed=n),this.pipeline.setSpeed(n));break}if(this.sessionId){let t=await this.tryGetPlugin();if(!t)return;let r={cmd:e};n!==void 0&&(r.speed=n);try{await t.nvrPlaybackCmd(this.sessionId,r)}catch(e){this.post({type:`nvr-session-error`,message:e.message,fatal:!1})}}}stop(){++this.generation,this.stopActiveStream(),this.pipeline.flush(),this.sessionId=null,this.lastPlayOpts=null,this.lastScrubArgs=null,this.lastFrameTsUs=0,this.isPaused=!1}async destroy(){this.stop(),this.pipeline.destroy(),this.unsubMirror();for(let e of this.transportListenerCleanups)try{e()}catch{}this.transportListenerCleanups.length=0;try{await this.nats.dispose()}catch{}this.pluginCache=null,this.attached=!1}async applyTargetFromMirror(e){if(Gs(`applyTargetFromMirror — target=${e?e.endpoint.url:`null`}, lastTargetUrl=${this.lastTarget?.endpoint.url??`null`}`),e===this.lastTarget){Gs(`applyTargetFromMirror — same reference, skipping`);return}let t=this.lastTarget?.endpoint.url!==e?.endpoint.url;if(this.lastTarget=e,e===null){this.localState=`unconfigured`,this.pluginCache=null;try{await this.nats.apply(null)}catch(e){Gs(`apply(null) threw: ${e.message}`)}return}if(t&&this.attached){let t=this.playIter!==null,n=this.lastPlayOpts,r=this.lastScrubArgs,i=this.lastFrameTsUs>0?this.lastFrameTsUs:n?0:r?.tsUs??0;t&&this.post({type:`nvr-buffering`,buffering:!0}),this.generation++,await this.stopActiveStream(),this.pluginCache=null,this.localState=`connecting`;try{await this.nats.apply(e)}catch(e){this.post({type:`nvr-session-error`,message:e.message,fatal:!1});return}t&&n&&!this.isPaused?this.play(i,n.videoOnly,n.sourceRole,n.speed):r&&!t&&this.scrub(r.tsUs,r.fine,r.sourceRole);return}this.localState=this.localState===`unconfigured`?`connecting`:this.localState;try{await this.nats.apply(e)}catch(e){this.post({type:`nvr-session-error`,message:e.message,fatal:!1})}}async waitForClient(){return this.attached?this.nats.getClient()?!0:this.firstClient&&await this.firstClient===null?!1:this.nats.getClient()!==null:!1}handleReady(e,t){Gs(`handleReady gen=${e} current=${this.generation} sessionId=${t.sessionId}`),e===this.generation&&(this.sessionId=t.sessionId,this.pipeline.configure(t),this.timeline?.mark(`ready-msg`),this.post({type:`nvr-buffering`,buffering:!1}),this.post({type:`nvr-ready`,audio:t.audioCodecString?{sampleRate:t.audioSampleRate??48e3,channels:t.audioChannels??1}:void 0}))}async handleVideo(e,t){if(e!==this.generation)return;if(this.lastFrameTsUs=t.ts,!this.timelineFirstFrame&&this.timeline){this.timelineFirstFrame=!0,this.timeline.mark(`first-video-msg`);let e=this.timeline,t=this.cameraId.slice(0,8);setTimeout(()=>{e.mark(`dump-deferred`),e.dump(`play ${t}`)},2e3)}let n=new EncodedVideoChunk({type:t.keyframe?`key`:`delta`,timestamp:t.ts,data:t.frame});await this.pipeline.pushVideo(n)}handleAudio(e,t){if(e!==this.generation)return;let n=new EncodedAudioChunk({type:`key`,timestamp:t.ts,data:t.frame});this.pipeline.pushAudio(n)}handleNoData(e,t){e===this.generation&&this.post({type:`nvr-no-data`,ts:t.ts})}async stopActiveStream(){let e=this.playIter;if(this.playIter=null,this.sessionId=null,this.pipeline.flush(),!e){Gs(`stopActiveStream: no iter, returning immediately`);return}try{Gs(`stopActiveStream: calling iter.return()`),await e.return(),Gs(`stopActiveStream: iter.return() resolved`)}catch(e){Gs(`stopActiveStream: iter.return() threw: ${e.message}`)}}async tryGetPlugin(){let e=this.nats.getClient();if(!e)return this.post({type:`nvr-session-error`,message:`NATS client not ready`,fatal:!1}),null;if(this.pluginCache?.client===e)return this.pluginCache.proxy;try{let t=Ms.coreManagerNamespaces(),n=await e.createProxy(t.coreManagerRpc).getPlugin(Us);if(!n)throw Error(`Plugin "${Us}" not found on server`);let r=Ms.pluginNamespaces(n.id),i=e.createProxy(r.pluginChildRpc);return this.pluginCache={client:e,proxy:i},i}catch(e){return this.post({type:`nvr-session-error`,message:e.message,fatal:!1}),null}}};let Js=performance.now(),Ys=0;function Xs(e,t){Ys++;let n=performance.now(),r=n-Js;if(r>=2e3){let e=Ys/(r/1e3);e>100&&console.warn(`[NvrWorker] ⚠ high message rate: ${e.toFixed(0)} msg/s (${Ys} in ${(r/1e3).toFixed(1)}s)`),Js=n,Ys=0}t&&t.length>0?self.postMessage(e,t):self.postMessage(e)}let Zs=null,Qs=!1,$s=0;function ec(e,t){if(e.type===`nvr-frame-drained`){if($s++,Qs){Qs=!1;let n={...e,framesSince:$s};$s=0,Xs(n,t);return}if(!Zs||Zs.speed===0)return;let n=performance.now(),r=Math.floor(e.ts/1e3)-(Zs.startMs+(n-Zs.wallStart)*Zs.speed);if(Math.abs(r)>200){let n={...e,framesSince:$s};$s=0,Xs(n,t)}return}Xs(e,t)}let tc=null,nc=xa({source:self}),rc=ya({spec:{id:`nats`,kind:`persistent`,phaseGating:!0,graceMs:2e3}});nc.onRevalidate(()=>{tc?.handleRevalidate().catch(()=>{})});let ic=new Sa,ac=new ka({onError:(e,t)=>{tc?.isRunning&&Xs({type:`nvr-session-error`,message:e,fatal:t})}},ic);self.onmessage=e=>{let t=e.data;switch(t.type){case`canvas`:ic.attachCanvas(t.canvas,t.preferredRenderer??`webgpu`);break;case`show`:ic.show();break;case`hide`:ic.hide();break;case`close`:tc?.destroy().catch(()=>{}).finally(()=>{ac.flushAndDestroy().finally(()=>{ic.destroy(),self.close()})}),tc||ac.flushAndDestroy().finally(()=>{ic.destroy(),self.close()});break;case`nvr-attach`:tc||=new qs(ac,ic,ec,rc,nc),tc.attach({cameraId:t.cameraId});break;case`nvr-force-reconnect`:tc?.handleForceReconnect().catch(()=>{});break;case`nvr-suspend`:tc?.handleSuspendPush({keepNats:t.keepNats}).catch(()=>{});break;case`nvr-resume`:tc?.handleResumePush().catch(()=>{});break;case`nvr-scrub`:tc?.scrub(t.tsUs,t.fine,t.sourceRole).catch(()=>{});break;case`nvr-play`:Qs=!0,tc?.play(t.tsUs,t.videoOnly,t.sourceRole,t.speed).catch(()=>{});break;case`nvr-cmd`:(t.cmd===`seek`||t.cmd===`resume`)&&(Qs=!0),tc?.cmd(t.cmd,t.tsUs,t.speed).catch(()=>{});break;case`nvr-stop`:Qs=!0,tc?.stop();break;case`nvr-destroy`:tc?.destroy().catch(()=>{}).finally(()=>{tc=null,Zs=null});break;case`nvr-set-anchor`:Zs=t.anchor;break}}})();',PT=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,NT],{type:`text/javascript;charset=utf-8`});function FT(e){let t;try{if(t=PT&&(self.URL||self.webkitURL).createObjectURL(PT),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(NT),{name:e?.name})}}var IT=2e3,LT=new Map,RT=new Map,zT=1;function BT(e){let t=RT.get(e);t&&(clearTimeout(t),RT.delete(e))}function VT(e){BT(e);let t=setTimeout(()=>{RT.delete(e);let t=LT.get(e);t&&t.refCount<=0&&JT(e)},IT);RT.set(e,t)}function HT(){let e=document.createElement(`canvas`);return e.style.position=`absolute`,e.style.width=`100%`,e.style.height=`100%`,e.style.inset=`0`,e.style.zIndex=`2`,e.style.objectFit=`fill`,e}function UT(e,t,n=`webgpu`){let r=LT.get(e);if(r)return t&&(r.worker.onmessage=e=>t(e.data)),r;let i=HT();e.appendChild(i);let a=i.transferControlToOffscreen(),o=new FT;o.postMessage({type:`canvas`,canvas:a,preferredRenderer:n},[a]),t&&(o.onmessage=e=>t(e.data));let s={id:zT++,canvas:i,worker:o,hidden:!1,refCount:0};return LT.set(e,s),s}function WT(e){let t=LT.get(e);if(!t)return()=>{};t.refCount++,BT(e);let n=!1;return()=>{n||(n=!0,t.refCount=Math.max(0,t.refCount-1),t.refCount===0&&VT(e))}}function GT(e){return LT.get(e)?.worker}function KT(e){let t=LT.get(e);t&&(t.hidden=!0,t.canvas.style.display=`none`,t.worker.postMessage({type:`hide`}))}function qT(e){let t=LT.get(e);t&&(t.hidden=!1,t.canvas.style.display=``,t.worker.postMessage({type:`show`}))}function JT(e){BT(e);let t=LT.get(e);t&&(t.worker.postMessage({type:`close`}),t.worker.terminate(),t.canvas.remove(),LT.delete(e))}var YT=[[30,8100],[31,18e3],[32,20480],[40,32768],[41,32768],[42,34816],[50,110400],[51,184320],[52,184320]];function XT(e,t){let n=Math.ceil(e/16)*Math.ceil(t/16);if(n===0)return null;for(let[e,t]of YT)if(Math.floor(t/n)>=1)return e;return null}function ZT(e,t){return e.length>=11&&e.startsWith(`avc1.`)?e.slice(0,-2)+t.toString(16).padStart(2,`0`):e}function QT(e,t){for(let n=0;n<e.length-8;n++)e[n]===0&&e[n+1]===0&&e[n+2]===0&&e[n+3]===1&&(e[n+4]&31)==7&&(e[n+7]=t)}var $T=class{wallSource;basePts=0;baseWall=0;rate=1;paused=!0;pausedPts=0;anchored=!1;abort=new AbortController;constructor(e){this.wallSource=e}now(){return this.paused?this.pausedPts:this.basePts+(this.wallSource()-this.baseWall)*1e6*this.rate}ptsToWall(e){return this.baseWall+(e-this.basePts)/1e6/this.rate}get isPaused(){return this.paused}get currentRate(){return this.rate}get isAnchored(){return this.anchored}start(e){this.basePts=e,this.baseWall=this.wallSource(),this.paused=!1,this.pausedPts=0,this.anchored=!0,this.invalidate()}reset(){this.basePts=0,this.baseWall=0,this.rate=1,this.paused=!0,this.pausedPts=0,this.anchored=!1,this.invalidate()}pause(){this.paused||(this.pausedPts=this.now(),this.paused=!0,this.invalidate())}resume(){this.paused&&(this.basePts=this.pausedPts,this.baseWall=this.wallSource(),this.paused=!1,this.invalidate())}setRate(e){if(!(e>0&&Number.isFinite(e)))throw Error(`MediaClock.setRate: rate must be positive finite, got ${e}`);this.rate!==e&&(this.paused||(this.basePts=this.now(),this.baseWall=this.wallSource()),this.rate=e,this.invalidate())}seek(e){this.paused?this.pausedPts=e:(this.basePts=e,this.baseWall=this.wallSource()),this.invalidate()}async waitUntil(e){for(;this.now()<e;){if(this.paused){await this.waitForChange();continue}let t=(this.ptsToWall(e)-this.wallSource())*1e3;if(t<=0)return;await this.sleepOrChange(t)}}invalidate(){let e=this.abort;this.abort=new AbortController,e.abort()}sleepOrChange(e){let t=this.abort.signal;return new Promise(n=>{if(t.aborted){n();return}let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e),i=()=>{clearTimeout(r),n()};t.addEventListener(`abort`,i,{once:!0})})}waitForChange(){let e=this.abort.signal;return e.aborted?Promise.resolve():new Promise(t=>{e.addEventListener(`abort`,()=>t(),{once:!0})})}};function eE(e){return new $T(()=>e.currentTime)}var tE=.005,nE=class{ac=null;gainNode=null;clock=null;muted=!1;pendingSources=new Set;start(e){this.close();try{this.ac=new AudioContext({sampleRate:e}),this.gainNode=this.ac.createGain(),this.gainNode.gain.value=+!this.muted,this.gainNode.connect(this.ac.destination),this.clock=eE(this.ac),this.ac.resume().catch(()=>{})}catch{this.ac=null,this.gainNode=null,this.clock=null}}feed(e){if(!this.ac||!this.gainNode||!this.clock||(this.clock.isAnchored||this.clock.start(e.pts),this.clock.isPaused))return;let t=this.clock.ptsToWall(e.pts)-this.ac.currentTime;if(t<-.2)return;let n=this.ac.createBuffer(e.channels.length,e.numberOfFrames,e.sampleRate);for(let t=0;t<e.channels.length;t++)n.getChannelData(t).set(e.channels[t]);let r=this.ac.createBufferSource();r.buffer=n,r.connect(this.gainNode);let i=this.ac.currentTime+Math.max(tE,t);r.start(i),this.pendingSources.add(r),r.onended=()=>this.pendingSources.delete(r)}setMuted(e){this.muted=e,this.gainNode&&(this.gainNode.gain.value=+!e)}suspend(){this.clock?.pause(),this.ac&&this.ac.state===`running`&&this.ac.suspend()}resume(){this.ac&&this.ac.state===`suspended`&&this.ac.resume().catch(()=>{}),this.clock?.resume()}setRate(e){e>0&&Number.isFinite(e)&&this.clock&&(this.cancelPendingSources(),this.clock.reset(),e!==1&&this.clock.setRate(e))}seek(){this.cancelPendingSources(),this.clock?.reset()}close(){if(this.cancelPendingSources(),this.gainNode){try{this.gainNode.disconnect()}catch{}this.gainNode=null}if(this.ac){try{this.ac.close()}catch{}this.ac=null}this.clock=null}cancelPendingSources(){for(let e of this.pendingSources)try{e.stop(0)}catch{}this.pendingSources.clear()}},rE=Symbol(`NvrPlayback`),iE=Symbol(`NvrPlaybackMap`);function aE(...e){let t=new Date,n=String(t.getHours()).padStart(2,`0`),r=String(t.getMinutes()).padStart(2,`0`),i=String(t.getSeconds()).padStart(2,`0`),a=String(t.getMilliseconds()).padStart(3,`0`);console.log(`[NvrPlayback ${n}:${r}:${i}.${a}]`,...e)}function oE(e){switch(e){case`high-resolution`:return`high`;case`mid-resolution`:return`mid`;case`low-resolution`:return`low`;case void 0:case null:return``;default:return e}}function sE(e,t){let n=t?.managed??!1,r=t?.sourceRole,i=O(r)?r:s(G(r)??``),a=H(()=>oE(i.value));t?.cameraUi??Q_();let o=t?.nvrCtx??TC(),c=s(`idle`),l=s(0),u=s(null),d=s(!1),f=s(!1),p=s(!1),m=s(!1),h=s(!1),g=s(1),_=0,v=s(null);z(v,(e,t)=>{if(t){let e=GT(t);e&&e.postMessage({type:`nvr-stop`}),KT(t)}if(!e)return;let n=w??(c.value===`idle`?void 0:T);n&&(w=void 0,n.kind===`play`?B(n.tsUs,n.videoOnly):n.fine?R(n.tsUs,!0):L(n.tsUs,!0))}),z(c,(e,t)=>{if(e===`idle`&&t!==`idle`){let e=v.value;e&&KT(e)}},{flush:`sync`});let y=H(()=>c.value!==`idle`),b=H(()=>c.value===`play`),x=null,S=!1,C=!1,w,T,E=new AbortController,D=new WeakSet;function k(){return typeof e==`string`?e:G(e)}function A(){let e=u.value;return e?e.startMs+(performance.now()-e.wallStart)*e.speed:0}let j=new Set,M=new WeakSet,N=null,P=null;function F(){let e=v.value;if(!e)return;let t=performance.now(),n=GT(e),r=!1;n||(n=UT(e).worker,r=!0),N!==e&&(P?.(),P=WT(e),N=e);let i=performance.now()-t;return ee(n),j.has(n)||(o.registerWorker(n),j.add(n)),M.has(n)||(n.postMessage({type:`nvr-attach`,cameraId:k()}),M.add(n)),r&&aE(`[Timeline ${k().slice(0,8)}] main.ensureWorker spawn+transfer=${i.toFixed(0)}ms`),n}function I(e){let t=v.value;t&>(t)?.postMessage(e)}function ee(e){D.has(e)||(D.add(e),e.addEventListener(`message`,e=>{te(e.data)},{signal:E.signal}))}z(u,e=>{I({type:`nvr-set-anchor`,anchor:e?{startMs:e.startMs,wallStart:e.wallStart,speed:e.speed}:null})});function te(e){switch(e.type){case`nvr-ready`:e.audio&&(m.value=!0,se(e.audio.sampleRate)),n&&g.value!==1&&I({type:`nvr-cmd`,cmd:`speed`,speed:g.value});break;case`nvr-scrub-result`:p.value=!1,f.value=!1,_=0,e.noData?d.value=!0:(d.value=!1,l.value=e.ts);break;case`nvr-frame-drained`:{let t=Math.floor(e.ts/1e3);!C||u.value?.speed===0?(C=!0,u.value={startMs:t,wallStart:performance.now(),speed:g.value}):u.value&&u.value.speed>0&&t>u.value.startMs+(performance.now()-u.value.wallStart)*u.value.speed+200&&(u.value={startMs:t,wallStart:performance.now(),speed:g.value}),p.value=!1,f.value=!1,d.value&&(_===0||e.ts>=_)&&(d.value=!1,_=0),l.value=e.ts;break}case`nvr-audio-data`:d.value&&(_===0||e.pts>=_)&&(d.value=!1,_=0),x?.feed({channels:e.channels,sampleRate:e.sampleRate,numberOfFrames:e.numberOfFrames,pts:e.pts});break;case`nvr-no-data`:p.value=!1,f.value=!1,d.value=!0,_=e.ts,l.value=e.ts;break;case`nvr-eof`:{p.value=!1,d.value||=!0;let e=u.value?.targetMs??u.value?.startMs??0;u.value={startMs:l.value>0?Math.floor(l.value/1e3):e,wallStart:performance.now(),speed:g.value};break}case`nvr-buffering`:e.buffering?(C&&(u.value={startMs:l.value>0?Math.floor(l.value/1e3):A(),wallStart:performance.now(),speed:0}),p.value=!0,x?.suspend()):(C&&(u.value={startMs:l.value>0?Math.floor(l.value/1e3):A(),wallStart:performance.now(),speed:g.value}),p.value=!1,x?.resume());break;case`nvr-session-error`:e.message.includes(`license verification required`)?(f.value=!0,d.value=!0,p.value=!1):e.fatal&&(p.value=!1,d.value=!0);break}}function L(e,t){if(!t){I({type:`nvr-stop`}),d.value=!0,c.value=`scrub`,u.value=null,w=void 0,T=void 0;return}c.value=`scrub`,u.value=null;let n={kind:`scrub`,tsUs:e,fine:!1},r=F();if(!r){w=n;return}w=void 0,T=n;let i=v.value;i&&qT(i),r.postMessage({type:`nvr-scrub`,tsUs:e,fine:!1,sourceRole:a.value})}function R(e,t){if(!t){L(e,t);return}c.value=`scrub`,u.value=null;let n={kind:`scrub`,tsUs:e,fine:!0},r=F();if(!r){w=n;return}w=void 0,T=n;let i=v.value;i&&qT(i),r.postMessage({type:`nvr-scrub`,tsUs:e,fine:!0,sourceRole:a.value})}function B(e,t){aE(`[Timeline ${k().slice(0,8)}] play() called tsUs=${e} containerBound=${!!v.value}`),C=!1,c.value=`play`,_=0,d.value||(p.value=!0),u.value={startMs:Math.floor(e/1e3),wallStart:performance.now(),speed:0,targetMs:Math.floor(e/1e3)};let n={kind:`play`,tsUs:e,videoOnly:t??!1},r=F();if(!r){aE(`[Timeline ${k().slice(0,8)}] play() — no worker (container not bound), queued as pending`),w=n;return}w=void 0,T=n;let i=v.value;i&&qT(i),aE(`[Timeline ${k().slice(0,8)}] play() — posting nvr-play to worker`),r.postMessage({type:`nvr-play`,tsUs:e,videoOnly:t??!1,sourceRole:a.value,speed:g.value})}z(i,(e,t)=>{if(e===t||c.value!==`play`)return;let n=l.value>0?l.value:(u.value?.startMs??0)*1e3;oe(),n>0&&B(n)});function ne(){I({type:`nvr-cmd`,cmd:`pause`}),u.value={startMs:l.value>0?Math.floor(l.value/1e3):A(),wallStart:performance.now(),speed:0},c.value=`pause`,x?.suspend()}function re(){if(c.value!==`pause`){B(l.value);return}let e=u.value;e&&(u.value={startMs:e.startMs,wallStart:performance.now(),speed:g.value}),c.value=`play`,x?.resume(),I({type:`nvr-cmd`,cmd:`resume`})}function ie(e){p.value=!0,C=!1,u.value={startMs:e/1e3,wallStart:performance.now(),speed:c.value===`play`?g.value:0},x?.seek(),I({type:`nvr-cmd`,cmd:`seek`,tsUs:e})}function ae(e){let t=l.value>0?Math.floor(l.value/1e3):A();g.value=e,u.value={startMs:t,wallStart:performance.now(),speed:c.value===`play`?e:0},x?.setRate(e),I({type:`nvr-cmd`,cmd:`speed`,speed:e}),e===1?h.value=S:h.value=!0}function oe(){I({type:`nvr-stop`});let e=v.value;e&&c.value!==`idle`&&KT(e),c.value=`idle`,p.value=!1,m.value=!1,u.value=null,C=!1,w=void 0,T=void 0,_=0,n||(g.value=1),P?.(),P=null,N=null}function se(e){x?.close(),x=null,x=new nE,x.start(e),x.setMuted(h.value)}z(h,e=>{x?.setMuted(e),g.value===1&&(S=e)});let ce=!1,le=!1,{onTabHidden:ue,onTabPaused:de,onTabVisible:fe}=tb();return ue(()=>{aE(`onTabHidden fired — mode=${c.value}`),c.value===`play`&&(ce=!0,ne(),aE(`onTabHidden — auto-paused, autoPausedForVisibility=true`))}),de(()=>{ce&&(aE(`onTabPaused — escalating to suspend (cancel playIter, free bandwidth)`),le=!0,I({type:`nvr-suspend`,keepNats:!0}))}),fe(()=>{if(aE(`onTabVisible fired — autoPausedForVisibility=${ce}, suspended=${le}, mode=${c.value}`),!ce)return;if(ce=!1,c.value!==`pause`){aE(`onTabVisible — mode is ${c.value}, skipping resume`);return}let e=le;if(le=!1,e){I({type:`nvr-resume`});let e=u.value;e&&(u.value={startMs:e.startMs,wallStart:performance.now(),speed:g.value}),c.value=`play`,x?.resume(),aE(`onTabVisible — nvr-resume sent`)}else{re();let e=l.value;e>0?(aE(`onTabVisible — resume() done, forcing seek(${e}) for fresh keyframe`),ie(e)):aE(`onTabVisible — resume() done, no seek (ts=0)`)}}),xc(()=>{x?.setMuted(!0),I({type:`nvr-stop`}),P?.(),P=null,N=null,E.abort();for(let e of j)o.unregisterWorker(e);j.clear(),x?.close(),x=null}),{mode:c,currentTimestamp:l,playbackAnchor:u,noData:d,licenseRequired:f,loading:p,hasAudio:m,muted:h,containerRef:v,isActive:y,isPlaybackDriving:b,speed:g,sourceRole:i,scrub:L,fineScrub:R,play:B,pause:ne,resume:re,stop:oe,seek:ie,setSpeed:ae}}function cE(e,t){let n=sE(e,t);return ie(rE,n),n}var lE=1e4,uE=100,dE=175;function fE(e){let{nvr:t,type:n,segment:r,timeMsPerPx:i,recordings:a,detectionCards:o,trimState:c,zoomLevel:l,writeMotion:u,getMotionOffset:d,motionBoundaryPx:f,motionMaxOffsetPx:p,dragActive:m,flingActive:h,wheelActive:g}=e;function _(){return f.value}function v(){return d()}function y(e){u(Math.max(0,e))}let b=s((()=>{let e=t?.mode.value,n=t?.currentTimestamp.value??0;if(n>0){let t=Math.floor(n/1e3);if(e===`play`)return{type:`play`,targetMs:t};if(e===`pause`||e===`scrub`)return{type:`pause`,timeMs:t}}return{type:`live`}})());z(b,(e,t)=>{t&&(`${t.type}`,t.type===`scroll`?`${t.resumePlay}`:t.type===`play`?`${t.targetMs}`:t.type===`pause`&&`${t.timeMs}`),`${e.type}`,e.type===`scroll`?`${e.resumePlay}`:e.type===`play`?`${e.targetMs}`:e.type===`pause`&&`${e.timeMs}`},{deep:!0});let x=s(Math.floor(Date.now()/1e3)*1e3),S=s(0),C=null,w=0,T=!1,E=1/0,D=s(0),O=null,k=s(!1),A=!1,j=0,{start:M,stop:N}=fl(e=>{j=performance.now(),be(e)},uE,{immediate:!1}),P=0,{start:F,stop:I}=fl((e,n)=>{P=performance.now(),t.scrub(e*1e3,n)},100,{immediate:!1}),ee=s(!1),te=!1,L=!0,R=0,B=s(null),ne=s(null),re=H(()=>x.value),ie=H(()=>C!==null),ae=H(()=>b.value.type===`play`||b.value.type===`trim`||ie.value?!1:f.value===0),oe=H(()=>m.value||h.value||g.value),se=H(()=>{let e=b.value;if((e.type===`play`||e.type===`trim`&&e.sub===`play`)&&t?.playbackAnchor.value){let e=t.playbackAnchor.value;return e.speed>0?S.value>0?S.value:(t.currentTimestamp.value,e.startMs+(performance.now()-e.wallStart)*e.speed):e.startMs}if(e.type===`pause`)return e.timeMs;if(r.value===`detections`){let e=_(),t=o.value;if(e<=0||t.length===0)return re.value;let n=Math.min(Math.ceil(e/dE)-1,t.length-1),r=e-n*dE,a=Math.min(r/dE,1),s=t[n],c=s.endTimeMs-a*s.duration*1e3,l=t.length*dE;if(e>l){let t=e-l;return s.timestamp-t*i.value}return c}if(B.value!=null)return B.value;if(ne.value!=null)return ne.value;if(ae.value)return re.value;let n=_();return re.value-n*i.value});function ce(){let e=b.value;if(e.type===`play`||e.type===`trim`&&e.sub===`play`||e.type===`pause`)return se.value;if(B.value!=null)return B.value;if(ne.value!=null)return ne.value;if(r.value===`detections`){let e=v(),t=o.value;if(e<=0||t.length===0)return re.value;let n=Math.min(Math.ceil(e/dE)-1,t.length-1),r=e-n*dE,a=Math.min(r/dE,1),s=t[n],c=s.endTimeMs-a*s.duration*1e3,l=t.length*dE;if(e>l){let t=e-l;return s.timestamp-t*i.value}return c}return ae.value?re.value:re.value-v()*i.value}function le(e){return(re.value-e)/i.value}function ue(e){let t=o.value;if(t.length===0)return 0;for(let n=0;n<t.length;n++){let r=t[n];if(e>=r.timestamp&&e<=r.endTimeMs){let t=(r.endTimeMs-e)/(r.duration*1e3);return n*dE+t*dE}}for(let n=0;n<t.length;n++)if(e>t[n].endTimeMs)return n*dE;return t.length*dE}function de(e,t=!1){if(r.value===`detections`){let t=o.value,n=t.findIndex(t=>e<=t.endTimeMs&&e>=t.timestamp);if(n<0&&(n=t.findIndex(t=>t.endTimeMs<=e),n<0&&(n=Math.max(0,t.length-1))),t.length===0)return;let r=t[n],i=Math.max(0,Math.min(1,(r.endTimeMs-e)/(r.duration*1e3))),a=Math.max(0,n*dE+i*dE);D.value=a,y(a),setTimeout(()=>{D.value=0},100);return}let n=Math.max(0,le(e));D.value=n,R=performance.now()+200,y(n),setTimeout(()=>{D.value=0},100)}function fe(){C!==null&&(cancelAnimationFrame(C),C=null),O=null,w=0,E=1/0,S.value=0}z(i,()=>{O=null});function pe(){if(c.trimActive.value&&b.value.type!==`trim`)return;fe(),r.value===`detections`&&(E=v());let e=-1;function n(){if(m.value||h.value||g.value){m.value,h.value,g.value,O=null,ge();return}if(!t){fe();return}let a=t.playbackAnchor.value;if(!a){C=null,S.value=0;return}if(a.speed===0){C=requestAnimationFrame(n);return}a.wallStart!==e&&(e=a.wallStart,w=0);let s=Date.now(),l=a.startMs+(performance.now()-a.wallStart)*a.speed,u=Math.floor(l/1e3)*1e3;if(u!==w&&(S.value=l,w=u),b.value.type===`trim`&&b.value.sub===`play`&&l>=c.trimEndMs.value){t.pause(),C=null,k.value=!1,S.value=0,b.value={type:`trim`,sub:`idle`};return}if(T&&l>s-lE){t.stop(),fe(),me();return}if(r.value===`detections`&&b.value.type===`play`){let e=o.value;if(!(l<b.value.targetMs)&&!e.some(e=>l>=e.timestamp&&l<=e.endTimeMs)){let n=null;for(let t of e)t.timestamp>l&&(!n||t.timestamp<n.timestamp)&&(n=t);if(n){R=performance.now()+400,E=1/0;let e=n.topPx+dE;y(e),E=e,b.value={type:`play`,targetMs:n.timestamp},C=null,t.play(n.timestamp*1e3);return}}}if(r.value!==`detections`){let e=Math.max(0,(x.value-u)/i.value);e!==O&&(R=performance.now()+100,e>D.value&&(D.value=e),y(e),O=e)}if(r.value===`detections`){let e=Math.max(0,ue(l));e<E?E=e:e=E,R=performance.now()+100,e>D.value&&(D.value=e),y(e),O=e}C=requestAnimationFrame(n)}let a=t?.playbackAnchor.value,s=a?Math.min(Date.now(),a.startMs+1740*1e3):Date.now();if(x.value=Math.floor(s/1e3)*1e3,C=requestAnimationFrame(n),w=0,r.value!==`detections`&&a){let e=a.startMs+(performance.now()-a.wallStart)*a.speed,t=Math.floor(e/1e3)*1e3,n=Math.max(0,(x.value-t)/i.value);R=performance.now()+200,n>D.value&&(D.value=n),y(n),O=n}}function me(){fe(),t?.isActive.value&&t.stop(),N(),b.value={type:`live`},x.value=Math.floor(Date.now()/1e3)*1e3,L=!0,v()!==0&&(R=performance.now()+200,y(0))}function he(e){t&&(N(),b.value={type:`play`,targetMs:e},t.play(e*1e3))}function V(){t&&(fe(),b.value={type:`pause`,timeMs:ce()},t.pause())}function ge(){let e=b.value;if(e.type===`trim`)return;if(e.type===`scroll`){e.resumePlay;return}let n=e.type===`play`||e.type===`live`;n&&t?.mode.value===`pause`&&(n=!1),e.type,fe(),t&&(t.playbackAnchor.value=null),b.value={type:`scroll`,resumePlay:n}}function _e(){if(b.value.type,b.value.type===`scroll`&&b.value.resumePlay,b.value.type!==`scroll`){b.value.type;return}if(ye(),ve()){me();return}let e=ce();if(b.value.type===`scroll`&&b.value.resumePlay,N(),b.value.type===`scroll`&&b.value.resumePlay){if(t?.mode.value===`play`&&t.playbackAnchor.value&&t.playbackAnchor.value.speed>0){b.value={type:`play`,targetMs:e};return}he(e)}else be(e),b.value={type:`pause`,timeMs:e}}function ve(){return _()===0}function ye(){let e=v(),t=lE/i.value;if(e<=0){L=!0;return}if(e>=t){L=!1;return}te=!0,y(L?t:0),Me(()=>{te=!1})}z(f,e=>{if(te||performance.now()<R||ie.value||c.trimActive.value)return;let t=lE/i.value;if(e<=0){L=!0;return}if(e>=t){L=!1;return}oe.value||(te=!0,y(L?t:0),Me(()=>{te=!1}))});function be(e){if(!t||e>Date.now()-lE)return;let n=a.value??[],r=n.length===0||n.some(t=>e>=t.startTime&&e<=t.endTime);l.value>=8?t.fineScrub(e*1e3,r):t.scrub(e*1e3,r)}function xe(e){let t=performance.now();if(t-j>=uE){j=t,N(),be(e);return}M(e)}function Se(e){c.trimActive.value||(e.timestamp,R=performance.now()+400,fe(),t&&(N(),b.value={type:`play`,targetMs:e.timestamp},t.play(e.timestamp*1e3)),n.value===`vertical`&&y(e.topPx+dE))}function Ce(e){c.trimActive.value||(R=performance.now()+400,fe(),t&&(N(),b.value={type:`play`,targetMs:e},t.play(e*1e3)))}function we(e,n){if(fe(),t?.isActive.value&&t.stop(),c.activate(e,n),b.value={type:`trim`,sub:`idle`},t){let n=(a.value??[]).some(t=>e>=t.startTime&&e<=t.endTime);t.scrub(e*1e3,n)}}function Te(){fe(),k.value=!1,c.deactivate(),t?.isActive.value&&t.stop(),me(),y(0)}function Ee(e){if(!t)return;let n=performance.now(),r=(a.value??[]).some(t=>e>=t.startTime&&e<=t.endTime);if(n-P>=100){P=n,I(),t.scrub(e*1e3,r);return}F(e,r)}function De(){ee.value=!0,t&&t.mode.value===`play`&&t.pause()}function Oe(){ee.value=!1}function ke(e,t,n){if(ae.value){Me(()=>y(0));return}let r;if(ne.value!=null)r=ne.value;else{let e=v();r=x.value-e*n(t)}ne.value=r;let a=Math.max(0,(x.value-r)/n(e));D.value=a,Me(()=>{y(a),setTimeout(()=>{let e=v(),t=r+e*i.value;x.value=Math.floor(t/1e3)*1e3,ne.value=null,D.value=0},100)})}function Ae(e,n){if(b.value.type,ae.value,R=performance.now()+500,ae.value){e===`timeline`&&(B.value=null,x.value=Math.floor(Date.now()/1e3)*1e3);return}let r=b.value,a;if(r.type===`play`&&t?.playbackAnchor.value){let e=t.playbackAnchor.value;a=e.speed>0?e.startMs+(performance.now()-e.wallStart)*e.speed:e.startMs}else a=r.type===`pause`?r.timeMs:n===`detections`&&B.value!=null?B.value:x.value-v()*i.value;if(r.type===`play`)if(e===`detections`){let e=o.value;if(e.some(e=>a>=e.timestamp&&a<=e.endTimeMs))b.value={type:`play`,targetMs:a};else{let t=a;for(let n of e)n.timestamp>a&&(t===a||n.timestamp<t)&&(t=n.timestamp);((t-a)/1e3).toFixed(1),b.value={type:`play`,targetMs:t}}}else b.value={type:`play`,targetMs:a};if(e===`detections`){if(o.value.length===0)return;let e=Math.max(0,ue(a));E=e,O=null,D.value=e,Me(()=>{y(e),setTimeout(()=>{D.value=0},200)})}else e===`timeline`&&(O=null,Me(()=>{de(a),setTimeout(()=>{let e=v(),t=a+e*i.value;x.value=Math.floor(t/1e3)*1e3,B.value=null},150)}))}if(t){z(t.isPlaybackDriving,(e,t)=>{t&&!e&&(S.value=0)});let e=60*1e3;function n(e,t=!1){let n=e+9e5;t&&(n=Math.min(n,Date.now()));let r=Math.floor(n/1e3)*1e3,a=(r-e)/i.value;x.value=r,y(a),R=performance.now()+150}z(f,t=>{if(ee.value)return;let r=p.value;if(r<=0)return;let i=se.value;i<=0||(t>=r-100?n(i):c.trimActive.value&&t<=100&&x.value<Date.now()-e&&n(i,!0))}),z(se,t=>{t<=0||c.trimActive.value||t>x.value+e&&n(t)}),z(()=>t.playbackAnchor.value,e=>{if(e&&(e.speed,e.startMs),b.value.type,e&&e.speed>0){let t=b.value;t.type!==`play`&&t.type!==`trim`&&(b.value={type:`play`,targetMs:e.targetMs??e.startMs},R=performance.now()+500),C===null&&pe()}else if(e&&e.speed===0){if(e.targetMs!=null&&(T=(e.targetMs??e.startMs)<=Date.now()-lE),C===null){if(e.targetMs!=null){let t=b.value;t.type!==`play`&&t.type!==`trim`&&(e.targetMs,b.value={type:`play`,targetMs:e.targetMs},R=performance.now()+500)}c.trimActive.value||de(e.startMs)}}else fe()},{immediate:!0});let r=0;z(se,e=>{if(c.trimActive.value||!t.noData.value||t.mode.value!==`play`)return;let n=performance.now();n-r<2e3||a.value.some(t=>e>=t.startTime&&e<=t.endTime)&&(r=n,t.play(e*1e3))}),z(()=>t.mode.value,(e,n)=>{if(!(!c.trimActive.value||A))if(e===`play`&&n!==`play`){if(ee.value){t.pause();return}A=!0,t.play(c.trimStartMs.value*1e3),k.value=!0,b.value={type:`trim`,sub:`play`},pe(),A=!1}else e!==`play`&&n===`play`&&(k.value=!1,fe(),b.value.type===`trim`&&(b.value={type:`trim`,sub:`idle`}))}),z(c.trimActive,e=>{if(e)fe();else{let e=t.playbackAnchor.value;e&&e.speed>0&&pe()}}),z(ae,e=>{if(e&&(x.value=Math.floor(Date.now()/1e3)*1e3,t.isActive.value)){if(c.trimActive.value||ie.value)return;t.stop()}}),z(se,e=>{t&&(c.trimActive.value||performance.now()<R||ie.value&&!m.value||!oe.value||ae.value||xe(e))});let{start:o,stop:s}=fl(()=>{oe.value||b.value.type===`scroll`&&(v()===0?(N(),t.isActive.value&&t.stop(),b.value={type:`live`}):_e())},150,{immediate:!1});z(oe,e=>{if(t&&!c.trimActive.value&&!(performance.now()<R)){if(e){s(),b.value.type!==`scroll`&&ge();return}b.value.type===`scroll`&&o()}}),lt(()=>{fe()})}return dl(()=>{if(!c.trimActive.value&&!t?.isPlaybackDriving.value&&t?.mode.value!==`pause`&&!oe.value&&(ae.value&&v()===0&&(x.value=Math.floor(Date.now()/1e3)*1e3),r.value===`detections`&&!ae.value&&!oe.value&&!ie.value)){let e=o.value,t=v();if(t>0&&e.length>0){let n=e[Math.min(Math.ceil(t/dE)-1,e.length-1)];y(Math.max(0,t-n.pxPerSecond))}}},1e3,{immediate:!0}),dt(()=>{r.value===`detections`&&(B.value=se.value)}),xc(()=>{fe()}),{mode:b,currentTimeMs:se,getCurrentTimeMs:ce,nowMs:re,isLive:ae,isScrolling:oe,nvrDrivingScroll:ie,trimPlaying:k,enterLive:me,enterPlay:he,enterPause:V,onScrollStart:ge,onScrollStop:_e,onDetectionCardClick:Se,onEventClick:Ce,onTrimActivate:we,onTrimDeactivate:Te,onTrimScrub:Ee,onTrimDragStart:De,onTrimDragEnd:Oe,doScrub:be,scrollToTime:de,handleZoomChange:ke,handleSegmentChange:Ae,pendingScrollPx:D,timeToScrollPx:le,timeToDetectionScrollPx:ue}}var pE=5e3,mE=3e4;function hE(e,t,n){let r=s(!1),i=s(0),a=s(0),o=H(()=>a.value-i.value),c=H(()=>{if(!n?.value?.length)return o.value;let e=i.value,t=a.value,r=0;for(let i of n.value){let n=Math.max(i.startTime,e),a=Math.min(i.endTime,t);n<a&&(r+=a-n)}return r||o.value});function l(n,o){let s=t.value;if(n!=null&&o!=null){let e=Math.min(n,o),t=Math.max(n,o);i.value=e,a.value=Math.min(Math.max(t,e+pE),s)}else{let t=e.value;i.value=t-mE/2,a.value=Math.min(t+mE/2,s)}r.value=!0}function u(){r.value=!1}return{trimActive:r,trimStartMs:i,trimEndMs:a,trimDurationMs:o,trimRecordingDurationMs:c,activate:l,deactivate:u}}var gE={damping:.95,velocityThreshold:.3,velocityStop:.05,overscrollDamping:.5},_E=1e3/60,vE=100,yE=200;function bE(e){let{minOffset:t,maxOffset:n,constants:r}=e,{offsetPx:i,velocity:a}=e;return i+=a,i<t?(i=t-(t-i)*r.overscrollDamping,a*=.5):i>n&&(i=n+(i-n)*r.overscrollDamping,a*=.5),a*=r.damping,Math.abs(a)<r.velocityStop?{offsetPx:SE(i,t,n),velocity:0,done:!0}:{offsetPx:i,velocity:a,done:!1}}function xE(e,t){if(e.length<2)return 0;let n=e[0],r=e[e.length-1],i=r.t-n.t;if(i<=0)return 0;let a=(n.pos-r.pos)/i;return Math.abs(a)<t?0:a*_E}function SE(e,t,n){return Math.max(t,Math.min(n,e))}function CE(e){let{element:t,writeFn:n,readFn:r,maxOffsetPx:i}=e,a={...gE,...e.constants},o=s(!1),c=s(!1),l=s(!1),u=0,d=[],f=null,p=0,m=null,{start:h,stop:g}=fl(()=>{l.value=!1,!o.value&&!c.value&&e.onInteractionEnd&&e.onInteractionEnd()},yE,{immediate:!1});function _(){return(e.orientation?.value??`vertical`)===`vertical`?`y`:`x`}function v(){return e.minOffsetPx?.value??0}function y(e){return _()===`y`?e.clientY:-e.clientX}function b(){f!==null&&(cancelAnimationFrame(f),f=null);let t=c.value;c.value=!1,p=0,t&&e.onInteractionEnd&&!o.value&&e.onInteractionEnd()}function x(n){if(n.pointerType===`mouse`&&n.button!==0)return;let r=t.value;if(!r)return;let i=e.bottomIgnorePx?.value??0;if(i>0&&n.pointerType!==`mouse`&&window.innerHeight-n.clientY<=i)return;let a=o.value||c.value;f!==null&&(cancelAnimationFrame(f),f=null),c.value=!1,p=0,o.value=!0,m=n.pointerId,u=y(n),d=[{pos:u,t:n.timeStamp}],r.setPointerCapture(n.pointerId),!a&&e.onInteractionStart&&e.onInteractionStart()}function S(e){if(!o.value||e.pointerId!==m)return;let t=y(e),a=u-t;for(n(SE(r()+a,v(),i.value)),u=t,d.push({pos:t,t:e.timeStamp});d.length>1&&e.timeStamp-d[0].t>vE;)d.shift()}function C(n){if(!o.value||n.pointerId!==m)return;let r=t.value;r&&r.hasPointerCapture(n.pointerId)&&r.releasePointerCapture(n.pointerId),o.value=!1,m=null;let i=xE(d,a.velocityThreshold);d=[],i===0?e.onInteractionEnd&&e.onInteractionEnd():T(i)}function w(e){C(e)}function T(t){p=t,c.value=!0;function o(){let t=bE({offsetPx:r(),velocity:p,minOffset:v(),maxOffset:i.value,constants:a});if(n(t.offsetPx),p=t.velocity,t.done){f=null,c.value=!1,e.onInteractionEnd&&e.onInteractionEnd();return}f=requestAnimationFrame(o)}f=requestAnimationFrame(o)}function E(t){t.preventDefault();let a=o.value||c.value||l.value;f!==null&&(cancelAnimationFrame(f),f=null),c.value=!1,p=0;let s=_()===`y`?t.deltaY:-t.deltaX;n(SE(r()+s,v(),i.value)),l.value=!0,h(),!a&&e.onInteractionStart&&e.onInteractionStart()}return dt(e=>{let n=t.value;n&&(n.addEventListener(`pointerdown`,x),n.addEventListener(`pointermove`,S),n.addEventListener(`pointerup`,C),n.addEventListener(`pointercancel`,w),n.addEventListener(`wheel`,E,{passive:!1}),e(()=>{n.removeEventListener(`pointerdown`,x),n.removeEventListener(`pointermove`,S),n.removeEventListener(`pointerup`,C),n.removeEventListener(`pointercancel`,w),n.removeEventListener(`wheel`,E),b(),g(),l.value=!1}))}),{dragActive:L(o),flingActive:L(c),wheelActive:L(l),cancelFling:b}}function wE(e,t=`ddd., D. MMM. YY`){return typeof e==`number`&&(e=new Date(e)),ul(e,t).value}function TE(e){e||=new Date;let t=new Date(e);return t.setMilliseconds(0),t}function EE(e){e||=new Date;let t=new Date(e);return t.setSeconds(0,0),t.setMilliseconds(0),t}function DE(e=``){return e.startsWith(`data:`)||e.startsWith(`blob:`)||e.startsWith(`http:`)||e.startsWith(`https:`)?e:e||`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFIGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDktMDlUMTc6NTE6NDIrMDI6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIzLTExLTA1VDE5OjQ1OjU0KzAxOjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIzLTExLTA1VDE5OjQ1OjU0KzAxOjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9InNSR0IgSUVDNjE5NjYtMi4xIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQ4MjQxZmI0LTRhZDktNDA5OC1hMTU0LTc4OWFmMjQzNjkxYiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo0ODI0MWZiNC00YWQ5LTQwOTgtYTE1NC03ODlhZjI0MzY5MWIiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo0ODI0MWZiNC00YWQ5LTQwOTgtYTE1NC03ODlhZjI0MzY5MWIiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjQ4MjQxZmI0LTRhZDktNDA5OC1hMTU0LTc4OWFmMjQzNjkxYiIgc3RFdnQ6d2hlbj0iMjAyMy0wOS0wOVQxNzo1MTo0MiswMjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+a0dRsAAAHudJREFUeJzt3Xt8VOWdP/DP95zJJJPrJJAEwjVck3ARE1AIoGDrBUGr7oJurfXS1m3tb912t/vb9vfrrnnVuvZi91e7trqt68+q2Cq9uKJopYoKSUREEAnhTqoQLiGQG7nMzDnf/SMEA84kmeTMPCfzfN958XpBzpnzfOeQ55PnnDnnPMTMEELoyVBdgBBCHQkAITQmASCExiQAhNCYBIAQGpMAEEJjEgBCaEwCQAiNSQAIoTEJACE0JgEghMYkAITQmASAEBqTABBCYxIAQmhMAkAIjUkACKExCQAhNCYBIITGJACE0JgEgBAakwAQQmMSAEJoTAJACI1JAAihMQkAITQmASCExiQAhNCYBIAQGpMAEEJjEgBCaEwCQAiNSQAIoTEJACE0JgEghMYkAITQmASAEBqTABBCYxIAQmhMAkAIjUkACKExCQAhNCYBIITGJACE0JgEgBAakwAQQmMe1QW4ARGpLkFEaePGjdmGkTyBmTOIkGSb3Gza9rHy8vIjTmyfmZ3YjOuRLm+0LxIA7ldVVZVjk7nKYL6SgYUA8iOs2grwu0zGG2SHnlu4cOGBwbSnS7+QAIAEgJu9/c47JaaNbwO0CuDkKF/OILwJGz9YuHD+a1G9UJN+IQEACQA32rBhm9+b0vUAGF+FA+eqGPgzm/T1xZdeundA62vSLyQAIAHgNpWV784D2b8FMMnhTXcS8O3y8vkP97eiLv1CAgASAG5SVbX5RgY/CyAlZo0QflY+/9JvEpEdaRVd+oV8DChcY1N19a0M/h2i7PyWZUXXEOPeyurNv4juRYlJRgCQEYAbVFdXf9ZmWgcgqa/1gsEgdtXUYNu293H8+DGcPn0azIyMjAyMHDkSJTNmYs6ci5GZmdlvmwT8a3n5/PvDLdOlX0gAQAJAtU2bNhWQ4dkGIC/SOsyM97a8i5deegnt7Wf63J5hGFi4aDGuvvoaJCf3+cGBzQauWTR//vpw7elAAgASAKpVVr3zAoDPRVre0dGBJ598AgcPdH+k3xUIoK29Ax2dXbAsG8wM0zSRnJSEtDQf0nzdRxBZfj/uvPNLGDNmTOTGGR8HAh0lS5cubTvv25r0CzkHIJSqqqq6Bn10/paWFjz26M9x8MABWJaFE42nMeuii/GThx7CzJkzz3VUy7LQ3tmJhsbTOHK8AV2BAJqbmvDYoz/HgQN9XAtEGJec7Ps/Tr+v4UICQChlw/hupGWWZeHpp55EfX09gqEQGptb8YMH/w3///FfYvmya/Ctb34j7OuCwRCONTSirb0DnZ2deOK/foWGhhN91IB7N7z33sghv5lhSAJAKFNZ+e486r6sN6yX1r6Iuro6hEIWTp5uwX8++nP81Y03nFs+qbAw4raZgZOnmnCmvQOBQACrn3k64qcFBKQlBaw7B/9Ohi8JAKEMk317pGXHjh1FZeUmMDNONbfg5//xU1yxZMl562zZurXfNhpPNyMYDOHIkSOorq46933DMDB+/DgUFU1Dbu5IEPi2wb+T4UsCQChDwPJIy9a/9hqYGa1n2vHlL38Jy66++rzlJxoa8P0HHuy3DftsgADAG6+/jkAgAADIzR2JsWMKkJOdjalTJiM5OXlWZWXlhKG8n+FIAkAosWnTe+MBTAy37MyZM/jwwx1gZhimB/d+/Z4Llrfjq/f8LzScPDmgtjo6uxAIBNHa2oJdu2oAdJ9c7AmD5uZmBAIBEHkuH/w7Gp4kAIQioZmRluyu3QVmRmdXAEVFRfD5fOeWnWxsxM23fgGb390SVWtt7R0AgNpduwAAHR2d2FlTi7379mPP3v1gZjDbMwbzToYzeSCIUIJMngwOf/3F/gP7AQDtHZ3Y/O4W/PDHD2HMmDHYu3cf1vz+D2hpaYm6vfbOTuQgE/v37wMAZGVloqS4CESEQCCIbds/gG1ZUwb/joYnCQChBDH5I11q09zUDAAIhkIIBoP42SNDv2w/FOr+BKCtrQ2WZcHj8Zy7AMz0mDAMA5Zl+Yfc0DAjASCUYKZkUPgIaG1tBQDYdsSb9Qal52PAtrY2mKaJ2to98KX60NTUhGAwCAC+PjeQgOQcgFCCDbRHWpaU1H0/kNOXaPdsz+v1wuv1YsyY0RhTMBqjRo06WxTa+nh5QpIRwBBswBLPkfzWYmK6GITpIM4Bsx9EAQIabOBDtrjytob396uu1W0M5pORDgEyMjMAAKZpAgg60h4RwTAMeDwe+Hw+5ORkn7tjcFR+Hurr69HZ2TWwjxUSiARAlBig3+SWXs1EN9dT6/UE5JwbyjIAEMDdfyUAZBBW55ftBtFzlsFPfLF+60fqqncP28Y+ijD+HJU/CrtqapCS7EV7R6cj7aUke7u3ffa3/cmTjcjKzIQv1YfGxlPo7OwCmAf0uLBEIocAUXgmv/TmZ/PLPmCDXgHhDgA5A3xpEZjvMy0ceCa/7LlnC8qKYljmsGAY9gcAwh7kl8zo/jQuNSX6hwLl5ebit6ufxssvvoCS4uJz3089e4dgSUn3tkOhEPbs3Yft23fg448PAwCIjO1RNzjMSQAMwOr8eZNW55euJ9BvAcwawqY8BKxiCx+uzpv7yLMFZVregAIA5eXlpwDsCLds3LjxyMnJgcdjIj01uvNyX7ztVixetBBzLpqNf/jmvQAAj9m9HSLC7IvmRHqpZVmBt6JqLAFIAPRjdV7p1YC9FaDPOrhZD4i/zhb2PTuqVMubUAAARC+E+7ZhGLjyqu5Lf/1ZGTCMgf+Y7t33yemWfXu7/57tzwQRobS0DPn5kaYT4DcXL158esANJQg5B9CH1flzbwH4GQBmjJrwM9MTq/PLygO+jL+7s+5NZw54h4mQgac8Fv4FYfZvaWkZqqoq8fFHHyFvRDaONTQOaJsvrn0Jp06dQlZmJl59bT2yMtOR5ktBSkoKrlm2LOLrCMZTg34jw5g8EQjhP256Nm/ulUz8Mvp5Rp2DXms7jhV/i63OnPYeJqqqNj/H4FXhlrW2tuDhh3+K5qYmdHYF0NB4GlYU1wb4M9Phz8wAEeHOu76E4uKS8CsyPvb7M6bMmDEjcO5bmvQLOQQI49mCspE28VOIX+cHgKsy8vmxOLbnCrZN30OEz/oyMjJx111fQlZWFlKSvSjIzz13LN+XlGQvRueNgD8zA6ZpYtWqWyJ3fgBs8Pd6d36dyAgAnx4BrB5V+hSY1Nwfzrjn1hNbH1XStiJVVe/8iIF/irS8tbUFTz31a9QdOgTg7OO/OjrRFQgiZNlgtrufCehNgi8lGd6zFxJlZWXh1i/chsLCPuYXIbxTPv/ShRfOEaBLv5AAwPkB8JvcuRfbBr8HdaOjMybjoltObB3UpJbD0bp165Kz/DlVAEojrcPM+HDHDrz66it9Pt4LAHw+Hy6/fCkWX3YZvF5vX6u2sW3OXbRo3p5w7elAAgDnB8Dq/NL1Dp/xjxoDz3/h+NabVdYQb5WVlZNBZhX6eDR4j6NH67Fz506cbGhAc3MzbNtCRkYmsrOzMW16ESZPnnz2KsI+WUx806IFC14Mt1CXfiEBgE8CYHXunKkwzD3ovohPJctkTNdpFAAA1dXVpTbTegz8AqvBsgn4Snn5/CciraBLv5CTgL2Z5k1Q3/kBwLSBW1UXEW8LFix4n23jMjA+jmEznQS6pa/OrxMJgF4YtERxCb0pPQxRZdGiS2oCyZ5SENbFYPN7bIvml5dfuiYG2x6WJAB6IeZLVdfQgwnzKjT9/1k6d+7JhQvmLyfQrQCOOLDJdhBVBLo65ixefOkHDmwvYcg5AHSfA/j1iIvGeDyew6pr6c0gq/Bvjm2vU12HSuvWrUvOzB5xJ4G/CsZFUb78CJietKyuhy+77LKGaF6oS7+QS4HPMk2P6x4IadvGdAB1qutQ6dprr+0C8BiAxyort8yEEbqKmBYyUAJgAj55ik8QQD2APQS8w2y8Xl4+b9OFn++L80kA9DB4aqSHVCpDNB3An1SX4RYLF87bCWAngH/v+d7zzz9v5ubmJi1dulSr+yicIgFwFjGNU13DpzBNU12C261atcoCEH7OL9EvLU8yhcOgPuaQVsRg7R5TLeJLAuAsYoxXXcOnMApUlyASmxwCnMORnhShkvtGJS5wbPZVaZ0B72wmnsPAGCIjl5ibGXSUyW6wGdun1L68U3Wdw4F8DIjujwFX55edAJCrupYLJSV5U1cdru5QXYdqH02/vsDqnk34RhDK0O/olY4CvJ4ZvyvcPfdlQkVUnwbo0i8kAACAiJ7NLwvAlSMiY/Ktx7ccVF2FKvtnfm6caYe+BzZuBXiwz2eoBeHH7eRbPaNmzYDu+9elX8g5AACrcy7NgCs7P0AccuOhSVwcKrnub03L2g2mO4bQ+QGgGIwnUu2ODw8VrVjiUHkJQQIAgJ3EI1TXEBFTluoS4q1mxkrvwaIVz4D5MQCpDm56Gghv1BWvuJ+xMlbPeRxWJAAAmEYo1refDhobhl91DfH0XllZUqrd8QJRzO6GJAa+W1fS8ZSEgAQAAIAsw7UBQAytRgAj2gt+BSDy43udwvh8XUn74zFvx+UkAADAsLNVlxCJbegTAHUly+8C+Pa4Nch0x6Hi5V+LW3suJAEAgG1y7TkAsm0tpqw+XHTjCGb6Ufxbpofqpl9XGP923UECAAAI7g0AomTVNcRDwAh9B1Dy/5DKBv97/6slJgkAACC49hCAwdHPkDnM1Jddl0rMKqdIu+EvRcvLFLavjAQAANgxfwjloDEn/gig64y9ErF/EGifmIx/Vtm+KhIAAIjce6LNoLjOTqQEgVaorgHgGw/OvF67i64kAAAwOXqxiaMYlNDXpG5YssTDpP4BqAx4YFth5yhMZBIAAMh2bwAkuglHM0sA+FXXAQDE9HnVNcSbBADcPQJIdIZpzVVdQy+XHJpzg191EfEkAQCAnb3eXETDNuaoLqEXg7qCC1UXEU8SAABIAkAZNthVzz1kGItV1xBPEgDdJABUYbjrKjzmeapLiCcJgG59ziEtYoNRYQCYqLqO8xAmqy4hniQAurlsQgA97J+yeQTcF75ja2asdFtNMSMB0M21+4FcN1uJc7xeT57qGsIwU+yOCaqLiBfX/uDHmWv3A7u4tqGybYxUXUM4puHCSWJiJGF/uKLk4v1ALq5taNiw3TgCADMyVNcQLwn7wxUl1+4HYnZtbUNlMLkzAGBLAAh3sIkS9rl1TO6bhwEASEYA2gmpLiASQuKOAEjNA0AGIlN1AfGSsD9cURrQZBFqJG4AgMmvuoRwCJSuuoZ4Sdwfrui4NgA4gU8CAuxXXUE4TEjYw64LJfAPVxTYvQFgcEL/H/lVFxAWJ3Lons+V02HFGxO7NgBscu/5CQf4VRcQTiKfd7mQBAAAGxxw73N3yFJdQaywS0+22RodAkgAACDmTtf2f9hRTWs9zLjyaczEFFRdQ7xIAACwmFvdesE9Awk5AtiwZIkHx+HKs+0ElgDQCze7dwSQmAFQeDw5l116F6YN954TcpoEAABmblFdQ0ScmMejtpGURy49uCEXfyzsNAkAAAC3uHUEQAk6LwDbnEvuHAAAQJfqAuJFAgAAs4sPAYgS8uEUJlE+u3WnEzWrLiFeJAAAsItHAMyckAHATHmAO/c6MZpU1xAvEgAAijPyGmtajjPceVLKlR+VDRlxnkv7P2Bzk+oS4kWbK576Mio1I2O0L30Lw41f7rxldsgYrnwWAADAMOQQQCs2d07PyE090t7iwlEAu/KxWUPFwASX7ehzyLKbVNcQLzICAGAY3O4hY2aBL3Oz6t/3Yb5GPI/E+yiQgEmqa4ikLSn1hOoa4kUCAAAznQGA4qy8EWBYzAwX/TFOjyx273B5EDYsWeIhwKUP3qTmGTVr2lRXES8SAADsswFggqZOTPNXM2y46Y8dDBSr3kdOGn8sdRK79fCT+KjqEuJJAgCACW7s+fvUzLwJRAgoH/j3+rINu0Tl/nEaGXSR6hoiYcYR1TXEkwQAALL5eM/fDWDclPTcahcM/c/9sW0k1AjAYGOW6hoiMYB61TXEkwQAgKQM41jvf09KH1FkEJ1R/Zu/5wvgGYp2TUwws3tHAIAcAuimYOvadgDnbggyQPmz/QXvqv7N3+vP7IoE+b86ewfgfNV1RER0UHUJ8ZQQP1QOOW8UMNbnn5dieupV//Y/+5Wd5Z84W9WOcdLBomtngtx7ERBZ9l7VNcSTBMA5dF4AMJB+Sc7EAy747Q9mBtnWUlV7xklk0BLVNfTFgLlHdQ3xJAFwzqc//sny+hbmeNN2Kf/9DwYzX69irziNmJaprqEPreP2vCjnAHTETAfCfNtYMKIQcMfFQYt/nJ7v2qHzQByac4MfwGdU19GHveTWWxRjRALgLMOwwwUAPKZZUpQ1apP6y4HYBMxV8d4vTqJA8CYA7r29maDV8B+QADjHBvZFWlaUOWq2lzzHVY8CwHxPPPeJ05jpi6pr6AszalXXEG8SAD0Ms6+zv9mX503dq/w8ALj4R+mjLo/bPnHQX4qWlwFwde0G0VbVNcSbBMBZk3a+eByMiHeBZXp9iyel576jehTAbN8fz/3iFJvoW6pr6E8wEHpPdQ3xJgHQCxF29LW8NGdCodcwG5WOARiLH0zPvyJe+8QJB4qunUXAX6uuo29cN3X/Kw2qq4g3CYBe7H4CgID8z4wu3qV6FADL/kUFJqbEa78MBQNkkPEz197994l3VRegggRAL2RznwEAABke3+Ji/+iNSkcB4One1LbvxGOfDFVdyYo7ACxRXEa/GKTd8B+QADifbWweyGoX+cfPy0tOVzsSsPn/Ppicc02sd8lQHCi6dhoYP1Vdx0AQY4vqGlSQAOhl4t61ewCcHsCqKUtHl2R4TY/K8wGmRXjm/pSswljvl8E4NvuqNJOM38OlMwBfoMvnDUgA6I4ABtOARgEGjHErxsz5yAA6FI4ERoCNVyrS0111hSCjwugIep9mYKbqWgaEqGrUjtfOqC5DBQmAT+F3Brpmipl08Q0T5u4yCF0KrxGcbgTNVyvg98dwp0Slrui9/wfgRtV1DBjbf1JdgioSABcg5rejWd9neMtuGDd3G4G6FI4ELiavvanClz0+VvtloA4VrbgPhHtV1xENgrFedQ2qSABc4IwntRJAVMPBVE/y/BvGz91GhKDCcwIzYIWqK5IyL4nRrunXoZIVFSBUqGp/MAg4OaG2bLvqOlSRALjAjJo1AQBRjQIAIN2TMn/lxPk7UjzmKYUhUACyN1V407+7Mo5zCfwwdWTB3unLHgXjvni16RQmvEaocOlE5bEnARAGMf48mNelGN6ylePLW3O8GftUHQ7YzEk28/3FSWmb/8WTHtNr778FpD3oy/6n68aU/ibJML8ay7ZixubXVJegEjFrdftzWETnT1K1v3j5TBP04WC3x0Bb1YndO/e01Kt/9h3jRRv84wdCHZuc2mSFzzfetujunKTMq1aMK80yyZjm1LbjLJDESQVjd/+x8cIFuvQLCQB8OgAA4FDxdfsBnjyEzdpHOk6//ef6Dy4J2VbqELbjlPdBeJKDeOEBdHwc7YsrgJSAmfoZk/grDCyfk124sXTkpHkEpMeg1vggrC3c9VLYJy3p0i8kABAxAH4A8D8Pdds27I/fPFrTcLDteOlQt+UQBngbs1FN4C0wjJqkIOpr0H58DWAB3Z29Mzl5rMfCJBs0j0DzAb4CQGpqUvKRz4295FCaJ3mR2rfhBP6bwtqXfxt2iSb9QgIA4QPgwIzr5hk2O3aDSFNX+5a1h7dM6bQC2U5tM56IKDBvxOSNc3IK5zAwQnU9DjjjSwrkR7oASJd+IQGA8AHAANUVrzgEYIJT7TDQdKitYcvG4zXzuqyA36ntxhIBXJw1rnpB3rQ8k8wpqutxCjNWT9r90hciL9ejX7j9Fk1lCOCDRL8j5n90cJv+Sem5VxamXd5c13b8zY3Hay/qcOmIwCAKFvvHbZmfO83vIbNcdT1OM4h/o7oGN5ARAMKPAACgbubyYrZoV6zaZaD1WPup96tP7h59oqPFFWfSM7ypjeUjptVOyBg1zXDxBB5D1NCYenTM3K1bg5FW0KVfSAAgcgAAQF3xio0MxPyEV9AK7dp35ljD9pOHJjUH2sbFur3efGZy04zssR+W+Mclp3l8ZYjjRURq0A8La9d+u681dOkXcgjQD2Z+HEQxD4Ak01NSkjkWJZljYdnWnvrO00f3NB9O/0vriWlddsjRW2oNMgKjfNm1M7LHNY1PHZmXbHqnA1jsZBsuZjGsR1UX4RYyAkDfI4D6sutSu9r5CAB/3Ao6n23Z9qGmYNuxkx2twWNdTSmNHS3+tmB7dluoK5fBEa/m9JnelrQk36lsb9qp0anZLfkp2d6s5NTcZMM7EeCkOL4HF+H/Lqx9+YZ+19KkX0gAoO8AAIBDxSt+CuDv41JMdCwArczcbhNbPd80mDxENAJunoRDFaYlhbvXvtXvapr0CwkA9B8A+2YvG+sJmgcgHWqYo82FtWsHdHm2Lv1CbgYagKk7XjkM4mdV1yGGxmZ8X3UNbiMBMFAh44cAtL1tNAFsn7R77cuqi3AbCYABKty7djdAL6iuQwySYX9Ht5l/B0ICIAoW7PsICKmuQ0TtrcKada+qLsKNJACiMKX25Z0M+pXqOkRUGKA+L/rRmVwIFCWPEfiuxd6bAeSorkUMAOGZiTVrB/ykZ93Ix4Do/2PAC9XNuP4fAPwkNtUIB7UaIRSN3/NifbQv1KVfyAhgEM4g+ZF0CtwNYLrqWkQfmP51/J4Xou78OpERAKIfAQDA4Vk3LrDBG5HwN84MW1tPePMWzN36y4h3/PVFl34hAYDBBQAAfDT7pn8DeFjM0quZLiajbMIHv68Z7AZ06RdyCDAEJ5JG3pcfPHklCHNV1yI+QeDvjB1C59eJjAAw+BEAAHw8a+UsMu0tAJKdq0gMFgOvjd0+a9lQJ/vQpV9IAGBoAQAAhy9e+TWAf+FQOWLwDpug0tHb1jQMdUO69AsJAAw9AADgSNmqn4H57xwoRwxOiAhLC7aucWQCFF36hZwDcEjBJP7mkQOYQkTLVNeiJ/r7gq3POTb7kS5kBABnRgAA0LDw+oxgl68SwCxHNigGhvCTgi3PfcvJTerSLyQA4FwAAMDR+bdMhGVvBGisYxsVffnDqC3FK52e4VeXfiEBAGcDAACOl9082TZpA4C4Pt1XQ6+HTOu6cdVrOpzesC79QgIAzgcAANSXf36CYdkbACp0fOMCAFcaPuuavDfXtMVk65r0CwkAxCYAAODYJbcVkmFtgIPTiwkAQCWlBGPW+QEJAK3EKgCA7nMCBpnrASTMvHoqMdM6tNOqUTueDjupp3Pt6NEvJAAQ2wAAgOYFK3MClPw8A5+JaUOJjvHr3EDqV2iQN/hE1ZQm/UICALEPAADgJUs8DYGxDxPRPTFvLPEwgIqRlU/fH6/n+unSLyQAEJ8A6NGw6Pa7AX4EgKYz80SthYA7Rm566o/xbFSXfiEBgPgGAAA0LLpjCRE/DUCuFejbNovNv87f9MTBeDesS7+QAED8AwAATn327iwOBH8E8N1xb9z9bIAeyUlL/9/0yn90qShAl34hAQA1AdDj1GV3XMuExwEarawIF2HggMnGXdlv/9fbSuvQpF9IAEBtAABA61W35QW6PI8S0U1KC1GrgwkPtXe2PhiLK/uipUu/kACA+gDo0XTFl6+wwQ+BcbHqWuKK+CUjZNzrf/vxQ6pL6aFLv5AAgHsCAAC4osJoevvw7QC+D6BAdT0x9gYbxn05f/6l627j1aVfSADAXQHQ49hVt6X5rJR/ZMI3wMhWXY+DmIF1JowHMl//z2rVxUSiS7+QAIA7A6DH2SC4nYm+AWCq6nqGIAjQH5nsB7PX/2q76mL6o0u/kACAuwOgB1dUGK1VR5eD8Q0GlgJwf9Hd6pjp8STTfiLtT788qrqYgdKlX0gAYHgEQG+nPnv3eI9BqwC6GXDlI8lPAPijwbwmbeHoDVTh7MM64kGXfiEBgOEXAL01X33PFAKvArAMwCUAvIpKqWXgDYP5D+lZjW/RmjWWojocoUu/kADA8A6A3vi6u1PbQsZ82OblAC8BYR4An/MtUQDgPQA2guktCnneSn/94ePOt6OOLv1CAgCJEwAX4ooKo7Pq5ATLY08HuITZmE7g6QDy0D29+QiEfzK0DaARwEkADQDqwKg1QHtCBmoy2nMP0psVobi9EQV06RcSAEjcABgIBqh5+df8Pf/OmpffPByP2Z2mS7+QABBCY4bqAoQQ6kgACKExCQAhNCYBIITGJACE0JgEgBAakwAQQmMSAEJoTAJACI1JAAihMQkAITQmASCExiQAhNCYBIAQGpMAEEJjEgBCaEwCQAiNSQAIoTEJACE0JgEghMYkAITQmASAEBqTABBCYxIAQmhMAkAIjUkACKExCQAhNCYBIITGJACE0JgEgBAakwAQQmMSAEJoTAJACI1JAAihMQkAITQmASCExiQAhNCYBIAQGpMAEEJjEgBCaEwCQAiNSQAIoTEJACE0JgEghMYkAITQmASAEBqTABBCYxIAQmjsfwBz/E2JBPfGuwAAAABJRU5ErkJggg==`}var OE=[`src`,`alt`,`width`,`height`],kE=[`src`,`alt`,`width`,`height`],AE=We({__name:`CuiImage`,props:{src:{},alt:{default:`Image`},width:{default:`100%`},height:{default:`100%`},imageStyle:{type:[Boolean,null,String,Object,Array]},imageClass:{type:[Boolean,null,String,Object,Array]},imageContainerClass:{type:[Boolean,null,String,Object,Array]},imageContainerStyle:{type:[Boolean,null,String,Object,Array]}},setup(e){let{src:t,width:n,height:r,imageStyle:i,imageClass:a,imageContainerClass:o,imageContainerStyle:l}=Se(e),u=s(!1),d=s(!1),f=H(()=>!!t.value&&!u.value&&!d.value),p=H(()=>t.value?DE(t.value):void 0),m=H(()=>DE());function h(){u.value=!0,d.value=!1}function g(){u.value=!1,d.value=!0}function _(e){return e?typeof e==`number`?`${e}px`:e:`auto`}return z(t,()=>{u.value=!1,d.value=!1}),(s,u)=>(q(),c(`div`,{class:Te([`w-full h-full flex items-center justify-center relative`,K(o)]),style:it(K(l))},[C(Fe(K(pg),{"stroke-width":`6`,class:`absolute w-[50%] h-[50%] max-w-[30px] max-h-[30px]`},null,512),[[w,K(f)]]),C(V(`img`,{src:K(p),alt:e.alt,width:_(K(n)),height:_(K(r)),style:it([K(i),{width:_(K(n)),height:_(K(r))}]),class:Te(K(a)),decoding:`async`,onLoad:h,onError:g},null,46,OE),[[w,!K(f)&&!K(d)&&K(t)]]),K(d)||!K(t)?(q(),c(`img`,{key:0,src:K(m),alt:e.alt,width:K(n),height:K(r),class:`object-contain h-full`,decoding:`async`},null,8,kE)):R(``,!0)],6))}}),jE={class:`text-[10px] font-medium text-white/80 leading-none truncate`},ME={class:`text-[10px] font-medium text-white/80 leading-none shrink-0`},NE={class:`text-[10px] font-medium text-white/80 leading-none truncate`},PE=24,FE=5e3,IE=50,LE=3,RE=We({__name:`CuiTimelineTrimHandles`,props:{nowMs:{},timeMsPerPx:{},futureOffset:{},viewportHeight:{},contentHeight:{},viewportElement:{},startMs:{},endMs:{},readMotion:{type:Function},writeMotion:{type:Function},recordingDurationMs:{}},emits:[`update:startMs`,`update:endMs`,`scrub`,`drag-start`,`drag-end`],setup(e,{emit:t}){let n=e,r=t,i=s(null),a=s(0),o=s(0),l=s(0),u=0,d=null,f=0;function p(e){return Math.round((n.nowMs-e)/n.timeMsPerPx+n.futureOffset)}let m=H(()=>p(n.endMs)-PE),h=H(()=>p(n.startMs)),g=H(()=>Math.max(0,h.value-m.value-PE));function _(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`}function v(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${String(r).padStart(2,`0`)}m ${String(i).padStart(2,`0`)}s`:r>0?`${r}m ${String(i).padStart(2,`0`)}s`:`${i}s`}function y(){let e=f-a.value,t=n.readMotion(),s=(e+(t-u))*n.timeMsPerPx,c=n.nowMs;if(i.value===`start`){let e=o.value-s,i=n.endMs-FE,a=c-(n.viewportHeight-PE-n.futureOffset+t)*n.timeMsPerPx,l=Math.max(Math.min(e,i),a);r(`update:startMs`,l),r(`scrub`,l)}else if(i.value===`end`){let e=l.value-s,t=n.startMs+FE,i=Math.min(Math.max(e,t),c);r(`update:endMs`,i),r(`scrub`,i)}}function b(e,t){i.value=t,a.value=e.clientY,f=e.clientY,o.value=n.startMs,l.value=n.endMs,u=n.readMotion(),e.target.setPointerCapture?.(e.pointerId),r(`scrub`,t===`start`?n.startMs:n.endMs),r(`drag-start`),window.addEventListener(`pointermove`,x),window.addEventListener(`pointerup`,S),C()}function x(e){f=e.clientY,y()}function S(){i.value=null,w(),r(`drag-end`),window.removeEventListener(`pointermove`,x),window.removeEventListener(`pointerup`,S)}function C(){w();function e(){let t=n.viewportElement;if(!t||!i.value)return;let r=t.getBoundingClientRect(),a=f-r.top,o=n.readMotion();a<IE&&o>0?(n.writeMotion(Math.max(0,o-LE)),y()):a>n.viewportHeight-IE&&(n.writeMotion(o+LE),y()),d=requestAnimationFrame(e)}d=requestAnimationFrame(e)}function w(){d!==null&&(cancelAnimationFrame(d),d=null)}return lt(()=>{w(),window.removeEventListener(`pointermove`,x),window.removeEventListener(`pointerup`,S)}),(t,r)=>(q(),c(`div`,{class:`absolute left-0 right-0 top-0 z-15 pointer-events-none`,style:it({height:`${e.contentHeight}px`})},[V(`div`,{class:`absolute left-0 right-0 top-0 bg-black/50`,style:it({height:`${Math.max(0,K(m))}px`})},null,4),V(`div`,{class:`absolute left-0 right-0 flex items-center justify-between bg-sky-500 rounded-t cursor-ns-resize pointer-events-auto select-none touch-none px-2`,style:it({top:`${K(m)}px`,height:`${PE}px`}),onPointerdown:r[0]||=pe(e=>b(e,`end`),[`stop`,`prevent`])},[V(`span`,jE,`End: `+Oe(_(n.endMs)),1),r[2]||=V(`div`,{class:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-[3px] rounded-full bg-white/50`},null,-1),V(`span`,ME,Oe(v(n.recordingDurationMs??n.endMs-n.startMs)),1)],36),V(`div`,{class:`absolute left-0 right-0 pointer-events-none`,style:it({top:`${K(m)+PE}px`,height:`${K(g)}px`})},[...r[3]||=[V(`div`,{class:`absolute left-0 top-0 bottom-0 w-[3.5px] bg-sky-500`},null,-1),V(`div`,{class:`absolute right-0 top-0 bottom-0 w-[3.5px] bg-sky-500`},null,-1)]],4),V(`div`,{class:`absolute left-0 right-0 flex items-center bg-sky-500 rounded-b cursor-ns-resize pointer-events-auto select-none touch-none px-2`,style:it({top:`${K(h)}px`,height:`${PE}px`}),onPointerdown:r[1]||=pe(e=>b(e,`start`),[`stop`,`prevent`])},[V(`span`,NE,`Start: `+Oe(_(n.startMs)),1),r[4]||=V(`div`,{class:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-[3px] rounded-full bg-white/50`},null,-1)],36),V(`div`,{class:`absolute left-0 right-0 bg-black/50`,style:it({top:`${K(h)+PE}px`,bottom:0})},null,4)],4))}}),zE=new Set([`motion`,`audio`,`contact`,`doorbell`,`switch`,`light`,`siren`,`security_system`,`line-crossing`]),BE=function(e){return e[e.HEIGHT=8]=`HEIGHT`,e[e.WIDTH=150]=`WIDTH`,e}({}),VE={key:0,class:`w-full h-full flex items-center justify-center`},HE={key:1,class:`w-full h-full flex flex-col`},UE={key:0,class:`p-2 flex flex-col gap-2 border-b-[1px] border-color`},WE={key:0,class:`flex flex-row gap-6 items-center w-full`},GE={key:1,class:`w-full pr-3`},KE={class:`flex gap-2 items-center justify-between absolute z-21 left-0 w-full px-[calc(16px+0.5rem)] pointer-events-none top-2 h-[50px]`},qE={class:`h-full flex flex-1 items-center justify-start gap-2`},JE={key:0,class:`text-[0.65rem] font-medium px-2 py-1 rounded-full shadow-md`,style:{background:`color-mix(in srgb, var(--p-sky-500), transparent 20%)`,color:`white`}},YE={class:`h-full flex flex-1 items-center justify-center`},XE={class:`flex flex-1 items-center justify-end`},ZE={key:1,class:`flex gap-2 items-end justify-between absolute z-21 bottom-safe-offset-2 left-0 w-full px-[calc(16px+0.5rem)] pointer-events-none`},QE={class:`flex flex-1 items-end justify-start h-[50px]`},$E={class:`flex flex-1 items-end justify-end`},eD={key:0,class:`text-xs font-semibold`},tD=[`dir`],nD=[`data-future-tick`],rD=[`width`],iD=[`width`,`height`,`rx`,`ry`],aD={class:`absolute pl-6 h-full w-full items-center flex`},oD={key:0,class:`text-xs leading-none w-[60px]`},sD={key:1,class:`flex flex-col items-center justify-end h-full`},cD={class:`absolute bottom-0 pb-6 h-full w-full items-center justify-end flex flex-col`},lD={key:0,class:`text-xs leading-none h-[12px]`},uD=[`height`],dD=[`width`,`height`,`rx`,`ry`],fD={key:0,class:`text-xs truncate opacity-80 px-1`},pD={key:0,class:`text-xs truncate opacity-80 writing-mode-vertical px-1 !text-white`},mD={class:`flex items-center gap-1.5 shrink-0 px-2`},hD=[`title`],gD=[`onClick`],_D={class:`rounded-md bg-black overflow-hidden`,style:{border:`1px solid var(--timeline-event-thumb-border)`,"box-shadow":`var(--timeline-event-thumb-shadow)`,"aspect-ratio":`16/9`}},vD=[`data-tooltip-title`,`data-tooltip-text`],yD=[`onClick`],bD={class:`rounded-md bg-black overflow-hidden`,style:{border:`1px solid var(--timeline-event-thumb-border)`,"box-shadow":`var(--timeline-event-thumb-shadow)`,width:`64px`,height:`36px`}},xD=[`data-tooltip-title`,`data-tooltip-text`],SD={class:`flex flex-col items-center gap-1.5 shrink-0 py-2`},CD=[`title`],wD=[`onClick`],TD={class:`flex flex-row gap-3 p-3 h-full`},ED={class:`flex flex-col gap-0.5 shrink-0 w-[100px] justify-center`},DD={class:`text-sm font-medium text-color truncate`},OD={class:`text-sm text-muted-color`},kD={class:`text-xs text-muted-color`},AD={class:`flex gap-1.5 mt-1`},jD=[`title`],MD={class:`flex-1 min-w-0 relative`},ND={class:`w-full h-full rounded-md overflow-hidden bg-black`},PD=[`data-tooltip-title`,`data-tooltip-text`],FD={class:`relative flex flex-col items-center`},ID={key:0,class:`absolute -bottom-0.5 w-1 h-1 rounded-full bg-red-500`},LD=200,RD=175,zD=2,BD=70,VD=1800*1e3,HD=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})(We({__name:`CuiTimeline`,props:{type:{default:`vertical`},flatCard:{type:Boolean},showDate:{type:Boolean,default:!0},showZoom:{type:Boolean,default:!0},showSegments:{type:Boolean,default:!0},transparent:{type:Boolean,default:!1},overlayClass:{type:[Boolean,null,String,Object,Array]},overlayStyle:{type:[Boolean,null,String,Object,Array]},cardClass:{type:[Boolean,null,String,Object,Array],default:`h-full`},cardStyle:{type:[Boolean,null,String,Object,Array]},darkMode:{type:Boolean},hideOverlay:{type:Boolean},tickColor:{},cameraIds:{},initialTimestamp:{},localeSettings:{},trimMode:{type:Boolean},defaultState:{type:Boolean},loading:{type:Boolean,default:!1},ignoreBottomSafeArea:{type:Boolean},mdBreakpoint:{type:Boolean,default:!1}},emits:[`date-change`,`scroll`,`scrolling`,`trim-change`],setup(e,{expose:t,emit:n}){let r=e,i=n,{t:a,locale:o}=xd(),u=De(rE,void 0),d=pT(),{type:f,flatCard:p,showDate:h,showZoom:_,showSegments:v,transparent:y,overlayClass:b,overlayStyle:S,darkMode:E,hideOverlay:D,cardClass:k,cardStyle:A,tickColor:j,cameraIds:M,initialTimestamp:N,localeSettings:P,trimMode:F,loading:I,ignoreBottomSafeArea:ee}=Se(r),te=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],L=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],re=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],ie=T(`timelineRef`),ae=T(`viewportRef`),oe=T(`datePickerRef`),se=T(`dateLabelEl`),ce=T(`timeLabelEl`),le=s(`timeline`),de=s(!1),fe=s(4),me=s(TE()),he=s([{key:`timeline`,label:a(`views.camera.timeline`)},{key:`detections`,label:a(`views.camera.detections`)}]),ge=nu(ie),_e=H(()=>fe.value===8);function ve(){fe.value<8&&(fe.value=Math.min(8,fe.value+zD))}function xe(){fe.value>0&&(fe.value=Math.max(0,fe.value-zD))}let Ce=T(`motionLayerRef`),we=0,Ee=W(0),ke=0;function Ae(){return we}let je=new Map,Ne=new Set;function U(e,t){t?je.set(e,t):je.delete(e)}function Pe(e){let t=Et.value.events,n=new Set;for(let r of t)r.showThumbnail&&Math.abs(r.topPx-e-LD)<40&&n.add(r.id);for(let e of n)if(!Ne.has(e)){let t=je.get(e);t&&(t.classList.add(`scale-110`),t.classList.add(`timeline-thumb-active`))}for(let e of Ne)if(!n.has(e)){let t=je.get(e);t&&(t.classList.remove(`scale-110`),t.classList.remove(`timeline-thumb-active`))}Ne=n}function Ie(e){let t=Ce.value;if(!t)return;let n=Math.round(e);t.style.transform=f.value===`vertical`?`translate3d(0, ${-n}px, 0)`:`translate3d(${n}px, 0, 0)`}function Le(e){let t=Re.value,n=Math.max(0,Math.min(e,t));if(n===we)return;we=n,Ie(n),Pe(n);let r=We.value,i=Math.floor(n/r);i!==ke&&(ke=i,Ee.value=i*r)}let Re=H(()=>{let e=f.value===`vertical`?ge.height.value:ge.width.value,t=le.value===`detections`?St.value:xt.value;return Math.max(0,t-e)}),ze=s(0);function Be(){if(typeof document>`u`)return 0;let e=document.createElement(`div`);e.style.cssText=`position:fixed;visibility:hidden;pointer-events:none;padding-bottom:env(safe-area-inset-bottom)`,document.body.appendChild(e);let t=parseFloat(getComputedStyle(e).paddingBottom)||0;return e.remove(),t}function Ve(){ze.value=ee.value?Be()+BD:0}z(ee,Ve,{immediate:!0}),Cl(window,`resize`,Ve),Cl(window,`orientationchange`,Ve);let He=CE({element:ae,writeFn:Le,readFn:Ae,maxOffsetPx:Re,orientation:f,bottomIgnorePx:ze}),{dragActive:Ue}=He,We=H(()=>BE.HEIGHT+fe.value),G=[{zoom:0,labelTick:5,bigTick:5,duration:600*1e3},{zoom:2,labelTick:15,bigTick:5,duration:900*1e3},{zoom:4,labelTick:16,bigTick:4,duration:120*1e3},{zoom:6,labelTick:15,bigTick:5,duration:60*1e3},{zoom:8,labelTick:30,bigTick:10,duration:30*1e3}];function Ge(e){let t=G.find(t=>t.zoom===e)??G[0],n=BE.HEIGHT+e;return t.duration/t.labelTick/n}let Ke=H(()=>{let e=G.find(e=>e.zoom===fe.value)??G[0],t=e.labelTick,n=e.bigTick,r=e.duration,i=r/t;return{bigTickInterval:n,labelInterval:t,duration:r,timeMsPerTick:i,timeMsPerPx:i/We.value,pxPerSecond:We.value/(r/1e3/t)}}),qe=s(Date.now()),Je=TT({cameraIds:H(()=>M.value??[]),currentTimeMs:qe,timeMsPerPx:H(()=>Ke.value.timeMsPerPx),viewportPx:H(()=>f.value===`vertical`?ge.height.value:ge.width.value),initialTimestamp:N}),Xe=MT({availableCameraIds:H(()=>M.value??[]),cameraIds:H(()=>M.value??[]),realtime:!0,pageSize:40,filter:{state:`ended`,hasDetections:!0}}),Ze=H(()=>Je.recordings.value),Qe=H(()=>Je.events.value),$e=H(()=>Je.systemEvents.value),et=ye(new Map),tt=new Set,nt=H(()=>{let e=[],t=0;for(let n of Xe.events.value){if(n.state!==`ended`)continue;let r=n.endTime??n.lastUpdate,i=Math.max((r-n.startTime)/1e3,1),a=n.types??[],o=[...new Set(a)];e.push({id:n.id,timestamp:n.startTime,endTimeMs:r,duration:i,types:a,thumbnail:et.get(n.id),topPx:t*RD,pxPerSecond:RD/i,displayTypes:o.slice(0,2),extraCount:Math.max(0,o.length-2),description:n.segments?.find(e=>e?.description)?.description}),t++}return e}),rt=hE(H(()=>qe.value),H(()=>Date.now()),Ze),{trimActive:at,trimStartMs:ot,trimEndMs:st,trimDurationMs:ct,trimRecordingDurationMs:lt}=rt,ut=fE({nvr:u,type:f,segment:le,timeMsPerPx:H(()=>Ke.value.timeMsPerPx),recordings:Ze,detectionCards:nt,trimState:rt,zoomLevel:fe,writeMotion:Le,getMotionOffset:Ae,motionBoundaryPx:Ee,motionMaxOffsetPx:Re,dragActive:He.dragActive,flingActive:He.flingActive,wheelActive:He.wheelActive}),{currentTimeMs:ft,nowMs:pt,isLive:mt,isScrolling:ht,trimPlaying:gt}=ut;dt(()=>{qe.value=ft.value}),dt(()=>{let e=ft.value,t=se.value,n=ce.value;t&&(t.textContent=wE(e,`ddd., D. MMM. YY`)),n&&(n.textContent=wE(e,`HH:mm:ss`))});let _t=H(()=>{let e=ft.value;if(e)for(let t of Qe.value){let n=t.timestamp,r=n+t.duration*1e3;if(e<n||e>r)continue;let i=t.id.replace(/:(trigger|seg:\d+)$/,``),a=d.getEvent(i);if(a)return{id:a.id,cameraId:a.cameraId,startMs:a.startTime,endMs:a.endTime??a.lastUpdate??Date.now()}}}),vt=H(()=>{let e=ft.value;if(e)for(let t of Qe.value){let n=t.timestamp,r=n+t.duration*1e3;if(!(e<n||e>r)&&t.description)return t.description}}),yt=H(()=>LD*Ke.value.timeMsPerPx),bt=H(()=>{let e=Math.ceil((VD+yt.value)/Ke.value.timeMsPerTick),t=f.value===`vertical`?ge.height.value:ge.width.value,n=Math.ceil(t*2/We.value);return Math.max(e,n)}),xt=H(()=>bt.value*We.value),St=H(()=>{let e=f.value===`vertical`?ge.height.value:ge.width.value;return nt.value.length*RD+e}),Ct=s(!1);ne(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ct.value=!0})})});let wt=H(()=>{let e=pt.value,t=Ke.value;return Ot(e,t,n=>Math.round((e-n)/t.timeMsPerPx+LD),bt.value,yt.value)}),Tt={ticks:[],recordings:[],events:[],motionEvents:[],detectionEvents:[],systemEvents:[]},Et=H(()=>{let e=wt.value;if(!Ct.value)return{...Tt,ticks:e};let t=pt.value,n=Ke.value,r=Ze.value??[],i=Qe.value??[],a=$e.value??[],o=e=>Math.round((t-e)/n.timeMsPerPx+LD),s=r.map(e=>{let t=o(e.endTime);return{topPx:t,heightPx:o(e.startTime)-t}}),c=80*n.timeMsPerPx,l=i.map(e=>{let n=e.types.every(e=>zE.has(e)),r=n&&e.isActive?Math.max(e.timestamp+e.duration*1e3,t):e.timestamp+e.duration*1e3,i=o(e.timestamp),a=o(r),s=Math.max(i-a,8),c=a+s/2,l=e.types.slice(0,2),u=Math.max(0,e.types.length-2),d=e.timestamp+e.duration*500;return{...e,topPx:c,barTopPx:a,durationPx:s,displayTypes:l,extraCount:u,showThumbnail:!1,isTriggerOnly:n,midMs:d}}),u=[...l].filter(e=>!e.isTriggerOnly).sort((e,t)=>t.midMs-e.midMs),d=1/0;for(let e of u)d-e.midMs>=c&&(e.showThumbnail=!0,d=e.midMs);let f=l;return{ticks:e,recordings:s,events:f,motionEvents:f.filter(e=>e.isTriggerOnly),detectionEvents:f.filter(e=>!e.isTriggerOnly),systemEvents:a.map(e=>{let t=e.duration?e.timestamp+e.duration:e.timestamp,n=o(e.timestamp),r=o(t);return{...e,topPx:n,endPx:r,heightPx:Math.max(n-r,2)}})}}),Dt=H(()=>{let e=Et.value.ticks;if(e.length===0)return e;let t=Ee.value,n=f.value===`vertical`?ge.height.value:ge.width.value,r=n>0?n:1e3,i=2*We.value,a=t-i,o=t+r+i;return e.filter(e=>e.position>=a&&e.position<=o)});z(()=>Et.value.events,()=>{Ne=new Set,Pe(we)},{flush:`post`});function Ot(e,t,n,r,i){let a=t.timeMsPerTick,o=e+i,s=o-r*a,c=Math.ceil(s/a),l=Math.floor(o/a),u=[];for(let r=l;r>=c;r--){let i=r*a,o=n(i),s=i>e,c=r%t.labelInterval===0,l=r%t.bigTickInterval===0,d=new Date(i),f=`${String(d.getHours()).padStart(2,`0`)}:${String(d.getMinutes()).padStart(2,`0`)}`;fe.value>=4&&(f+=`:${String(d.getSeconds()).padStart(2,`0`)}`),u.push({index:r,time:f,timestamp:i,position:o,isLabelTick:c,isMediumTick:l,isFutureTick:s})}return u}let kt={motion:UC,person:Tw,face:BC,vehicle:QC,animal:tw,package:uw,audio:Ow,license_plate:sw,contact:iw,doorbell:KC,switch:Sw,light:YC,siren:gw,security_system:pw},At=yw,jt=H(()=>{let e=Ee.value,t=ge.height.value,n=RD*2;return nt.value.filter(r=>{let i=r.topPx+LD;return i+RD>=e-n&&i<=e+t+n})});z(jt,e=>{for(let t of e){if(et.has(t.id)||tt.has(t.id))continue;let e=Xe.events.value.find(e=>e.id===t.id);if(!e)continue;let n=d.getCachedThumbnails(t.id);if(n){let r=Bw(n,e);if(r.url){et.set(t.id,r.url);continue}}tt.add(t.id),Xe.loadThumbnails(t.id,e.startTime).then(n=>{if(tt.delete(t.id),n){let r=Bw(n,e);r.url&&et.set(t.id,r.url)}})}}),z([Ee,Re],([e,t])=>{le.value!==`detections`||!Xe.hasMore.value||t-e<300&&Xe.loadMore()}),z([H(()=>le.value===`detections`&&nt.value.length<Math.ceil((f.value===`vertical`?ge.height.value:ge.width.value)/RD)+2&&Xe.hasMore.value),()=>Xe.isLoading.value],([e,t])=>{e&&!t&&Xe.loadMore()});let Mt;z(()=>nt.value,e=>{if(le.value!==`detections`||e.length===0){Mt=e[0]?.id;return}let t=Mt,n=e[0]?.id;if(Mt=n,t&&n&&t!==n&&!mt.value){let n=e.findIndex(e=>e.id===t);n>0&&Le(Ae()+n*RD)}});let{plugin:Nt}=jv(`@camera.ui/camera-ui-nvr`),Pt=s(new Map),Ft=new Set;async function It(e,t){let n=`${e}-${t}`;if(Pt.value.has(n)||Ft.has(n))return;Ft.add(n);let r=Nt.value;if(!r){Ft.delete(n);return}try{let i=M.value??[],a=await Promise.all(i.map(n=>r.getRecordingDays(n,e,t+1).catch(()=>[]))),o=new Set(a.flat());Pt.value.set(n,o),Pt.value=new Map(Pt.value)}finally{Ft.delete(n)}}function Lt(e,t,n){let r=`${e}-${t}`,i=Pt.value.get(r);if(!i)return It(e,t),!1;let a=`${e}-${String(t+1).padStart(2,`0`)}-${String(n).padStart(2,`0`)}`;return i.has(a)}let Rt=H(()=>{let e={body:{class:`w-full h-full p-0 overflow-hidden`},content:{class:`h-full`},root:{class:{},style:{}}};if(typeof k.value==`string`?e.root.class={...e.root.class,[k.value]:!0}:typeof k.value==`object`&&(e.root.class={...e.root.class,...k.value}),typeof A.value==`string`){let t=A.value.split(`;`).map(e=>e.trim()).filter(e=>e.length>0).map(e=>{let[t,n]=e.split(`:`).map(e=>e.trim());return[t,n]}),n=Object.fromEntries(t);e.root.style={...e.root.style,...n}}else typeof A.value==`object`&&(e.root.style={...e.root.style,...A.value});return p.value&&(e.root.class={...e.root.class,"!rounded-none !border-0":!0}),e}),zt=H(()=>{let e=me.value.getDay(),t=me.value.getMonth();return`${P.value?.dayNames?.[e]??te[e]}, ${P.value?.monthNames?.[t]??L[t]} ${wE(me.value,`YY`)}`}),Bt=H(()=>{let e=me.value.getMonth(),t=P.value?.monthNamesShort?.[e]??re[e];return`${wE(me.value,`D`)}. ${t}`}),Vt=H(()=>{if(de.value)return EE()});function Ht(e){let t=new Date(e),n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()),i=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=Math.floor((r.getTime()-i.getTime())/(1e3*60*60*24));if(o===0)return a(`components.timeline.today`);if(o===1)return a(`components.timeline.yesterday`);if(o<7){let e=t.getDay();return P.value?.dayNames?.[e]??te[e]}let s=t.getMonth(),c=P.value?.monthNamesShort?.[s]??re[s];return`${t.getDate()}. ${c}`}function Ut(e){let t=Math.round(e);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}function Wt(e){switch(e){case`info`:return`bg-[var(--timeline-sys-info-bg)] border-[var(--timeline-sys-info-border)]`;case`success`:return`bg-[var(--timeline-sys-success-bg)] border-[var(--timeline-sys-success-border)]`;case`warning`:return`bg-[var(--timeline-sys-warning-bg)] border-[var(--timeline-sys-warning-border)]`;case`error`:return`bg-[var(--timeline-sys-error-bg)] border-[var(--timeline-sys-error-border)]`;default:return`bg-[var(--timeline-sys-info-bg)] border-[var(--timeline-sys-info-border)]`}}function Gt(e){switch(e){case`info`:return`border-[var(--timeline-sys-info-border)]`;case`success`:return`border-[var(--timeline-sys-success-border)]`;case`warning`:return`border-[var(--timeline-sys-warning-border)]`;case`error`:return`border-[var(--timeline-sys-error-border)]`;default:return`border-[var(--timeline-sys-info-border)]`}}function Kt(e){switch(e){case`info`:return`--timeline-sys-info-bg`;case`success`:return`--timeline-sys-success-bg`;case`warning`:return`--timeline-sys-warning-bg`;case`error`:return`--timeline-sys-error-bg`;default:return`--timeline-sys-info-bg`}}function qt(e){ut.onEventClick(e)}function Jt(){at.value||(ut.enterLive(),me.value=EE(new Date(pt.value))),Me(()=>{ut.scrollToTime(pt.value)})}let Yt=!1;function Xt(e){if(e.getTime()>Date.now()){oe.value?.hide();return}Yt=!0,me.value=e,Me(()=>{oe.value?.hide(),setTimeout(()=>{Yt=!1},400)})}z(fe,(e,t)=>{ut.handleZoomChange(e,t,Ge)}),z(le,(e,t)=>{ut.handleSegmentChange(e,t)}),z(F,(e,t)=>{if(e){let e=ge.height.value*Ke.value.timeMsPerPx,t=Math.max(5e3/2,e*.15),n=ut.getCurrentTimeMs();ut.onTrimActivate(n-t,n+t)}else t&&ut.onTrimDeactivate()}),z([ot,st],([e,t])=>{at.value&&i(`trim-change`,{startMs:e,endMs:t})}),z(me,e=>{let t=EE(e),n=EE(new Date(pt.value));if(t.getTime()>=n.getTime()){Le(0);return}ut.scrollToTime(e.getTime()),Me(()=>{ut.enterPlay(e.getTime())})}),dt(()=>{mt.value&&!de.value&&!Yt&&(me.value=EE(new Date(pt.value)))}),z(f,()=>{ut.scrollToTime(ut.getCurrentTimeMs())}),z(ht,(e,t)=>{if(t&&!e&&fe.value>=6&&!mt.value){let e=We.value,t=Ae(),n=Math.round(t/e)*e;Math.abs(n-t)>.5&&Le(n)}}),z(Ee,e=>{i(`scroll`,e)},{immediate:!0}),dt(()=>{i(`scrolling`,ht.value)}),dt(()=>{i(`date-change`,mt.value?`live`:new Date(ft.value))}),z(P,()=>{P.value?.locale&&(o.value=P.value.locale)},{immediate:!0,deep:!0});let Zt=!1;return z([()=>N.value,()=>f.value===`vertical`?ge.height.value:ge.width.value],([e,t])=>{Zt||!e||t<=0||(Zt=!0,Me(()=>ut.scrollToTime(e)))},{immediate:!0}),z(Ce,e=>{e&&Ie(we)}),xc(()=>{d.dispose()}),t({scrollToTime:ut.scrollToTime,scrollToEvent:qt,trimActive:at,trimStartMs:ot,trimEndMs:st,trimDurationMs:ct,trimRecordingDurationMs:lt,zoomLevel:fe,zoomIn:ve,zoomOut:xe,currentEvent:_t,currentEventDescription:vt,isLive:mt}),(t,n)=>{let r=pg,i=LC,o=PC,s=ex,u=jC;return q(),c(`div`,{class:Te({"dark-mode":K(E)})},[Fe(K(rx),{class:Te([`cui-card`,{"!bg-transparent !border-0":K(y)}]),pt:K(Rt)},{content:ue(()=>[K(I)?(q(),c(`div`,VE,[Fe(r,{class:`w-[32px] h-[32px]`,"stroke-width":`4`})])):(q(),c(`div`,HE,[K(f)===`vertical`&&(K(h)&&!e.mdBreakpoint||K(_)&&!e.mdBreakpoint||K(v))?(q(),c(`div`,UE,[K(h)&&!e.mdBreakpoint||K(_)&&!e.mdBreakpoint?(q(),c(`div`,WE,[K(h)&&!e.mdBreakpoint?(q(),be(K(cg),{key:0,text:``,disabled:K(ht),severity:`secondary`,label:K(zt),class:`cui-button-small shrink-0 pointer-events-auto`,onClick:n[0]||=e=>K(oe)?.toggle(e)},{icon:ue(()=>[Fe(i)]),_:1},8,[`disabled`,`label`])):R(``,!0),K(_)&&!e.mdBreakpoint?(q(),c(`div`,GE,[Fe(K(_C),{modelValue:K(fe),"onUpdate:modelValue":n[1]||=e=>O(fe)?fe.value=e:null,disabled:K(le)!==`timeline`,step:2,max:8,min:0,class:`flex-1 pointer-events-auto`},null,8,[`modelValue`,`disabled`])])):R(``,!0)])):R(``,!0),K(v)?(q(),be(K(nC),{key:1,modelValue:K(le),"onUpdate:modelValue":n[2]||=e=>O(le)?le.value=e:null,options:K(he),"option-label":`label`,"option-value":`key`,pt:{pcToggleButton:{root:{class:`w-full`}}},"allow-empty":!1,disabled:K(at),class:`flex justify-stretch pointer-events-auto`},null,8,[`modelValue`,`options`,`disabled`])):R(``,!0)])):R(``,!0),V(`div`,{ref_key:`timelineRef`,ref:ie,class:`w-full h-full relative pointer-events-auto`,style:it({background:K(y)?void 0:`var(--card-background)`})},[!K(D)&&!K(at)?(q(),c(`div`,{key:0,class:Te([`absolute w-full h-full pointer-events-none z-10 timeline-overlay-vertical`,[K(b)]]),style:it([K(S)])},null,6)):R(``,!0),V(`div`,KE,[V(`div`,qE,[K(h)&&K(f)===`horizontal`?(q(),be(K(cg),{key:0,rounded:``,severity:`secondary`,disabled:K(ht),class:`cui-button-small shadow-md pointer-events-auto shrink-0`,onClick:n[3]||=e=>K(oe)?.toggle(e)},{icon:ue(()=>[Fe(i,{width:`100%`,height:`100%`})]),_:1},8,[`disabled`])):R(``,!0),Fe(B,{name:`fade`},{default:ue(()=>[K(_e)?(q(),c(`span`,JE,Oe(K(a)(`components.timeline.fine_scrubbing`)),1)):R(``,!0)]),_:1})]),V(`div`,YE,[Fe(B,{name:`fade`},{default:ue(()=>[!K(mt)&&K(f)===`vertical`?(q(),be(K(cg),{key:0,rounded:``,disabled:K(ht),class:`cui-icon-md shadow-md pointer-events-auto`,onClick:Jt},{icon:ue(()=>[Fe(o,{width:`100%`,height:`100%`})]),_:1},8,[`disabled`])):R(``,!0)]),_:1})]),V(`div`,XE,[Fe(B,{name:`fade`},{default:ue(()=>[K(mt)?R(``,!0):(q(),c(x,{key:0},[K(f)===`vertical`?(q(),be(K(cg),{key:0,fluid:``,severity:`secondary`,class:`flex items-center justify-center cui-button-small shadow-md align-middle p-2 !text-xs`},{default:ue(()=>[V(`span`,{ref_key:`dateLabelEl`,ref:se},null,512)]),_:1})):(q(),be(K(cg),{key:1,rounded:``,disabled:K(ht),class:`cui-icon-md shadow-md pointer-events-auto rotate-90`,onClick:Jt},{icon:ue(()=>[Fe(o,{width:`100%`,height:`100%`})]),_:1},8,[`disabled`]))],64))]),_:1})])]),K(f)===`vertical`?(q(),c(`div`,ZE,[V(`div`,QE,[K(h)&&e.mdBreakpoint?(q(),be(K(cg),{key:0,severity:`secondary`,disabled:K(ht),label:K(Bt),class:`cui-button-small shadow-md pointer-events-auto`,onClick:n[4]||=e=>K(oe)?.toggle(e)},{icon:ue(()=>[Fe(i)]),_:1},8,[`disabled`,`label`])):R(``,!0)]),n[15]||=V(`div`,{class:`flex flex-1 items-end justify-center h-[50px]`},null,-1),V(`div`,$E,[m(t.$slots,`bottom-right`,{},void 0,!0)])])):R(``,!0),C(V(`div`,{class:Te([`absolute z-20 pointer-events-none`,{"bg-primary-500":K(mt)&&K(f)===`vertical`,"bg-sky-500":!K(mt)&&K(f)===`vertical`,"bg-gradient-to-t from-primary-500 to-transparent":K(mt)&&K(f)===`horizontal`,"bg-gradient-to-t from-sky-500 to-transparent":!K(mt)&&K(f)===`horizontal`,"h-[2px] w-full":K(f)===`vertical`,"w-[2px] h-full":K(f)===`horizontal`}]),style:it(K(f)===`vertical`?{top:`${LD}px`}:{right:`${LD}px`})},[V(`span`,{class:Te([`absolute rounded-xl text-white text-xs inline-flex items-center justify-center p-2`,{"bg-primary-500":K(mt),"bg-sky-500":!K(mt),"left-[calc(16px+0.25rem)] h-[32px] w-[60px] -top-[16px]":K(f)===`vertical`,"bottom-[calc(12px+0.25rem)] w-[60px] h-[32px] -left-[30px]":K(f)===`horizontal`}])},[K(mt)?(q(),c(`span`,eD,Oe(K(a)(`components.timeline.live`)),1)):(q(),c(`span`,{key:1,ref_key:`timeLabelEl`,ref:ce,class:`text-xs font-semibold`},null,512))],2)],6),[[w,!K(at)||K(gt)]]),V(`div`,{ref_key:`viewportRef`,ref:ae,class:Te([`w-full h-full relative overflow-hidden overscroll-none`,{"select-none":K(Ue)}]),style:it({touchAction:`none`,cursor:K(le)===`detections`?void 0:K(Ue)?`grabbing`:`grab`}),dir:K(f)===`horizontal`?`rtl`:`ltr`},[K(le)===`timeline`?(q(),c(`div`,{ref_key:`motionLayerRef`,ref:Ce,key:K(fe),class:Te([`absolute inset-0`,{"h-full":K(f)===`horizontal`}]),style:{"will-change":`transform`},dir:`ltr`},[(q(!0),c(x,null,g(K(Dt),e=>(q(),c(`div`,{key:`tick-${e.timestamp}-${K(fe)}`,class:Te([`absolute text-muted-color select-none`,{"w-full flex h-[2px]":K(f)===`vertical`,"h-full flex flex-col w-[2px]":K(f)===`horizontal`}]),style:it({[K(f)===`vertical`?`top`:`right`]:`${e.position}px`,color:K(j)}),"data-future-tick":e.isFutureTick},[K(f)===`vertical`?(q(),c(x,{key:0},[(q(),c(`svg`,{width:e.isLabelTick?16:e.isMediumTick?8:4,height:`2`,class:Te([`ml-1`,{"opacity-50":!e.isLabelTick}]),preserveAspectRatio:`xMidYMid meet`},[V(`rect`,{x:`0`,y:`0`,width:e.isLabelTick?16:e.isMediumTick?8:4,height:e.isLabelTick?2:1,fill:`currentColor`,rx:e.isLabelTick?1.5:.5,ry:e.isLabelTick?1.5:.5},null,8,iD)],10,rD)),V(`div`,aD,[e.isLabelTick?(q(),c(`span`,oD,Oe(e.time),1)):R(``,!0)])],64)):(q(),c(`div`,sD,[V(`div`,cD,[e.isLabelTick?(q(),c(`span`,lD,Oe(e.time),1)):R(``,!0)]),(q(),c(`svg`,{width:`2`,height:e.isLabelTick?16:e.isMediumTick?8:4,class:Te([`mb-1`,{"opacity-50":!e.isLabelTick}]),preserveAspectRatio:`xMidYMid meet`},[V(`rect`,{x:`0`,y:`0`,width:e.isLabelTick?2:1,height:e.isLabelTick?16:e.isMediumTick?8:4,fill:`currentColor`,rx:e.isLabelTick?1.5:.5,ry:e.isLabelTick?1.5:.5},null,8,dD)],10,uD))]))],14,nD))),128)),K(f)===`vertical`?(q(),c(`div`,{key:0,class:`absolute top-0 w-[8px] rounded-sm pointer-events-none`,style:it({left:`calc(16px + 0.25rem + 60px + 2rem)`,height:`${K(xt)}px`,background:`var(--timeline-track-background)`})},null,4)):R(``,!0),K(f)===`horizontal`?(q(),c(`div`,{key:1,class:`absolute right-0 h-[8px] rounded-sm pointer-events-none`,style:it({bottom:`calc(16px + 0.25rem + 12px + 2rem)`,width:`${K(xt)}px`,background:`var(--timeline-track-background)`})},null,4)):R(``,!0),K(f)===`vertical`&&K(Et).systemEvents.length?(q(),c(`div`,{key:2,class:`absolute top-0 left-0 right-0 pointer-events-none z-1`,style:it({height:`${K(xt)}px`})},[(q(!0),c(x,null,g(K(Et).systemEvents,e=>(q(),c(`div`,{key:`sys-v-${e.id}`,class:Te([`absolute left-0 right-0 flex items-center justify-center border-l-2 overflow-hidden`,Wt(e.severity)]),style:it({top:`${e.endPx}px`,height:`${e.heightPx}px`})},[e.heightPx>16?(q(),c(`span`,fD,Oe(e.message),1)):R(``,!0)],6))),128))],4)):R(``,!0),K(f)===`horizontal`&&K(Et).systemEvents.length?(q(),c(`div`,{key:3,class:`absolute right-0 top-0 bottom-0 pointer-events-none z-1`,style:it({width:`${K(xt)}px`})},[(q(!0),c(x,null,g(K(Et).systemEvents,e=>(q(),c(`div`,{key:`sys-h-${e.id}`,class:Te([`absolute top-0 bottom-0 flex items-center justify-center border-b-2 overflow-hidden`,Gt(e.severity)]),style:it({right:`${e.endPx}px`,width:`${e.heightPx}px`,background:`linear-gradient(to top, var(${Kt(e.severity)}), transparent)`})},[e.heightPx>16?(q(),c(`span`,pD,Oe(e.message),1)):R(``,!0)],6))),128))],4)):R(``,!0),K(f)===`vertical`&&K(Qe)?.length?(q(),c(`div`,{key:4,class:`absolute top-0 right-0 pointer-events-none z-2`,style:it({left:`calc(16px + 0.25rem + 60px + 2rem)`,height:`${K(xt)}px`})},[(q(!0),c(x,null,g(K(Et).events,e=>C((q(),c(`div`,{key:`line-v-${e.id}`,class:`absolute left-0 right-0 flex items-center -translate-y-1/2`,style:it({top:`${e.topPx}px`})},[n[16]||=V(`div`,{class:`flex-1 h-[1px]`,style:{background:`var(--timeline-event-line)`}},null,-1),V(`div`,mD,[(q(!0),c(x,null,g(e.displayTypes,(e,t)=>(q(),be(l(kt[e]??K(At)),{key:`icon-${t}`,class:`w-4.5 h-4.5 shrink-0`,style:{color:`var(--timeline-event-icon)`}}))),128)),e.extraCount>0?(q(),c(`span`,{key:0,class:`text-xs shrink-0 opacity-60`,style:{color:`var(--timeline-event-icon)`},title:e.types.join(`, `)},`+`+Oe(e.extraCount),9,hD)):R(``,!0)]),n[17]||=V(`div`,{class:`flex-1 h-[1px]`,style:{background:`var(--timeline-event-line)`}},null,-1),V(`div`,{ref_for:!0,ref:t=>U(e.id,t),class:`shrink-0 mr-5 relative pointer-events-auto cursor-pointer transition-transform duration-300 hover:scale-110`,onPointerdown:n[6]||=pe(()=>{},[`stop`]),onClick:t=>qt(e.timestamp)},[V(`div`,_D,[e.thumbnail?(q(),be(AE,{key:0,src:e.thumbnail,width:`128px`,height:`72px`,"image-style":{objectFit:`cover`},"image-container-class":`w-full h-full`},null,8,[`src`])):(q(),be(s,{key:1,width:`128px`,height:`72px`}))]),e.description?(q(),c(`button`,{key:0,type:`button`,class:`desc-sparkle-btn absolute top-1 right-1 z-[2]`,"data-tooltip-title":e.description.title||void 0,"data-tooltip-text":e.description.description||void 0,onPointerdown:n[5]||=pe(()=>{},[`stop`])},[Fe(u,{class:`w-2.5 h-2.5 text-white`})],40,vD)):R(``,!0)],40,gD)],4)),[[w,e.showThumbnail]])),128))],4)):R(``,!0),K(f)===`horizontal`&&K(Qe)?.length?(q(),c(`div`,{key:5,class:`absolute right-0 top-0 pointer-events-none z-2`,style:it({bottom:`calc(16px + 0.25rem + 12px + 2rem)`,width:`${K(xt)}px`})},[(q(!0),c(x,null,g(K(Et).events,e=>C((q(),c(`div`,{key:`line-h-${e.id}`,class:`absolute top-0 bottom-0 flex flex-col items-center translate-x-1/2`,style:it({right:`${e.topPx}px`})},[V(`div`,{ref_for:!0,ref:t=>U(e.id,t),class:`shrink-0 mt-5 pointer-events-auto cursor-pointer relative transition-all duration-300 timeline-thumb-h`,onPointerdown:n[8]||=pe(()=>{},[`stop`]),onClick:t=>qt(e.timestamp)},[V(`div`,bD,[e.thumbnail?(q(),be(AE,{key:0,src:e.thumbnail,width:`64px`,height:`36px`,"image-style":{objectFit:`cover`},"image-container-class":`w-full h-full`},null,8,[`src`])):(q(),be(s,{key:1,width:`64px`,height:`36px`}))]),e.description?(q(),c(`button`,{key:0,type:`button`,class:`desc-sparkle-btn absolute top-0.5 right-0.5 z-[2]`,"data-tooltip-title":e.description.title||void 0,"data-tooltip-text":e.description.description||void 0,onPointerdown:n[7]||=pe(()=>{},[`stop`])},[Fe(u,{class:`w-2 h-2 text-white`})],40,xD)):R(``,!0)],40,yD),n[18]||=V(`div`,{class:`flex-1 w-[1px]`,style:{background:`var(--timeline-event-line)`}},null,-1),V(`div`,SD,[(q(!0),c(x,null,g(e.displayTypes,(e,t)=>(q(),be(l(kt[e]??K(At)),{key:`icon-h-${t}`,class:`w-4.5 h-4.5 shrink-0`,style:{color:`var(--timeline-event-icon)`}}))),128)),e.extraCount>0?(q(),c(`span`,{key:0,class:`text-xs shrink-0 opacity-60`,style:{color:`var(--timeline-event-icon)`},title:e.types.join(`, `)},`+`+Oe(e.extraCount),9,CD)):R(``,!0)]),n[19]||=V(`div`,{class:`flex-1 w-[1px]`,style:{background:`var(--timeline-event-line)`}},null,-1)],4)),[[w,e.showThumbnail]])),128))],4)):R(``,!0),K(f)===`vertical`&&K(Ze)?.length?(q(),c(`div`,{key:6,class:`absolute top-0 pointer-events-none z-3`,style:it({left:`calc(16px + 0.25rem + 60px + 2rem)`,height:`${K(xt)}px`})},[(q(!0),c(x,null,g(K(Et).recordings,(e,t)=>(q(),c(`div`,{key:t,class:`absolute w-[8px] rounded-sm`,style:it({top:`${e.topPx}px`,height:`${e.heightPx}px`,background:`var(--timeline-recording-bar)`})},null,4))),128))],4)):R(``,!0),K(f)===`horizontal`&&K(Ze)?.length?(q(),c(`div`,{key:7,class:`absolute right-0 h-[8px] pointer-events-none z-3`,style:it({bottom:`calc(16px + 0.25rem + 12px + 2rem)`,width:`${K(xt)}px`})},[(q(!0),c(x,null,g(K(Et).recordings,(e,t)=>(q(),c(`div`,{key:t,class:`absolute h-full rounded-sm`,style:it({right:`${e.topPx}px`,width:`${e.heightPx}px`,background:`var(--timeline-recording-bar)`})},null,4))),128))],4)):R(``,!0),K(f)===`vertical`&&K(Qe)?.length?(q(),c(`div`,{key:8,class:`absolute top-0 pointer-events-none z-4`,style:it({left:`calc(16px + 0.25rem + 60px + 2rem)`,height:`${K(xt)}px`})},[(q(!0),c(x,null,g(K(Et).motionEvents,e=>(q(),c(`div`,{key:`bar-motion-v-${e.id}`,class:`absolute w-[4px] ml-[2px] rounded-full`,style:it({top:`${e.barTopPx}px`,height:`${e.durationPx}px`,background:`var(--timeline-event-bar)`})},null,4))),128)),(q(!0),c(x,null,g(K(Et).detectionEvents,e=>(q(),c(`div`,{key:`bar-det-v-${e.id}`,class:`absolute w-[8px] rounded-full`,style:it({top:`${e.barTopPx}px`,height:`${e.durationPx}px`,background:`var(--timeline-event-bar)`})},null,4))),128))],4)):R(``,!0),K(f)===`horizontal`&&K(Qe)?.length?(q(),c(`div`,{key:9,class:`absolute right-0 h-[8px] pointer-events-none z-4`,style:it({bottom:`calc(16px + 0.25rem + 12px + 2rem)`,width:`${K(xt)}px`})},[(q(!0),c(x,null,g(K(Et).motionEvents,e=>(q(),c(`div`,{key:`bar-motion-h-${e.id}`,class:`absolute h-[4px] mt-[2px] rounded-full`,style:it({right:`${e.barTopPx}px`,width:`${e.durationPx}px`,background:`var(--timeline-event-bar)`})},null,4))),128)),(q(!0),c(x,null,g(K(Et).detectionEvents,e=>(q(),c(`div`,{key:`bar-det-h-${e.id}`,class:`absolute h-full rounded-full`,style:it({right:`${e.barTopPx}px`,width:`${e.durationPx}px`,background:`var(--timeline-event-bar)`})},null,4))),128))],4)):R(``,!0),K(at)&&K(f)===`vertical`?(q(),be(RE,{key:10,"now-ms":K(pt),"time-ms-per-px":K(Ke).timeMsPerPx,"future-offset":LD,"viewport-height":K(ge).height.value,"content-height":K(xt),"viewport-element":K(ae),"read-motion":Ae,"write-motion":Le,"recording-duration-ms":K(lt),"start-ms":K(ot),"onUpdate:startMs":n[9]||=e=>O(ot)?ot.value=e:null,"end-ms":K(st),"onUpdate:endMs":n[10]||=e=>O(st)?st.value=e:null,onScrub:K(ut).onTrimScrub,onDragStart:K(ut).onTrimDragStart,onDragEnd:K(ut).onTrimDragEnd},null,8,[`now-ms`,`time-ms-per-px`,`viewport-height`,`content-height`,`viewport-element`,`recording-duration-ms`,`start-ms`,`end-ms`,`onScrub`,`onDragStart`,`onDragEnd`])):R(``,!0)],2)):K(le)===`detections`?(q(),c(`div`,{key:1,ref_key:`motionLayerRef`,ref:Ce,class:`absolute inset-0`,style:{"will-change":`transform`},dir:`ltr`},[(q(!0),c(x,null,g(K(jt),e=>(q(),c(`div`,{key:`det-${e.id}`,class:`absolute w-full border-b-[1px] border-color cursor-pointer`,style:it({top:`${e.topPx+LD}px`,height:`${RD}px`}),onClick:t=>K(ut).onDetectionCardClick(e)},[V(`div`,TD,[V(`div`,ED,[V(`span`,DD,Oe(Ht(e.timestamp)),1),V(`span`,OD,Oe(K(wE)(e.timestamp,`HH:mm`)),1),V(`span`,kD,Oe(Ut(e.duration)),1),V(`div`,AD,[(q(!0),c(x,null,g(e.displayTypes,e=>(q(),be(l(kt[e]??K(At)),{key:e,class:`w-4 h-4 shrink-0`,style:{color:`var(--timeline-event-icon)`}}))),128)),e.extraCount>0?(q(),c(`span`,{key:0,class:`text-xs shrink-0 opacity-60`,style:{color:`var(--timeline-event-icon)`},title:[...new Set(e.types)].join(`, `)},`+`+Oe(e.extraCount),9,jD)):R(``,!0)])]),V(`div`,MD,[V(`div`,ND,[e.thumbnail?(q(),be(AE,{key:0,src:e.thumbnail,width:`100%`,"image-style":{objectFit:`cover`,width:`100%`,height:`100%`},"image-container-class":`w-full h-full`},null,8,[`src`])):(q(),be(s,{key:1,width:`100%`,height:`100%`}))]),e.description?(q(),c(`button`,{key:0,type:`button`,class:`desc-sparkle-btn absolute top-1.5 right-1.5 z-[2]`,"data-tooltip-title":e.description.title||void 0,"data-tooltip-text":e.description.description||void 0,onPointerdown:n[11]||=pe(()=>{},[`stop`])},[Fe(u,{class:`w-3 h-3 text-white`})],40,PD)):R(``,!0)])])],12,wD))),128))],512)):R(``,!0)],14,tD)],4)]))]),_:3},8,[`class`,`pt`]),Fe(K(PS),{ref_key:`datePickerRef`,ref:oe,class:`border-none`,pt:{content:{class:`p-0`}},onShow:n[13]||=e=>de.value=!0,onHide:n[14]||=e=>de.value=!1},{default:ue(()=>[Fe(K(hS),{inline:``,"model-value":K(me),"hour-format":`12`,"show-time":``,"max-date":K(Vt),"clear-button-props":{class:`hidden`},class:`hover:text-primary active:text-primary focus:text-primary text-muted-color`,updateModelType:`date`,"input-class":{"p-0":e.mdBreakpoint},pt:{pcInputText:{root:{class:`text-sm !text-color`}},inputIconContainer:{class:`transition-all text-current`}},onDateSelect:n[12]||=e=>Xt(e)},{date:ue(({date:e})=>[V(`span`,FD,[Ye(Oe(e.day)+` `,1),Lt(e.year,e.month,e.day)?(q(),c(`span`,ID)):R(``,!0)])]),_:1},8,[`model-value`,`max-date`,`input-class`])]),_:1},512)],2)}}}),[[`__scopeId`,`data-v-19286ac4`]]),UD=Symbol(`EventHoverPreview`);function WD(e){let t=e?.cacheSize??20,n=e?.hoverDelay??400,r=e?.frameInterval??300,{plugin:i}=jv(`@camera.ui/camera-ui-nvr`),a=new Map,o=[],c=0,l=null,u=null,d=s(!1),{start:f,stop:p}=fl((e,t,n,r,i,a)=>{a===c&&b(e,t,n,r,i,a)},n,{immediate:!1});function m(){for(;o.length>t;){let e=o.shift(),t=a.get(e);if(t){for(let e of t)e.close();a.delete(e)}}}function h(e){let t=o.indexOf(e);t!==-1&&o.splice(t,1),o.push(e)}function g(){l!==null&&(cancelAnimationFrame(l),l=null)}function _(){p()}function v(e,t,n){let i=e.getContext(`2d`);if(!i||t.length===0)return;let a=0,o=0;function s(u){if(!(n!==c||!i)){if(u-o>=r){let n=t[a];e.width=n.width,e.height=n.height,i.drawImage(n,0,0),a=(a+1)%t.length,o=u}l=requestAnimationFrame(s)}}l=requestAnimationFrame(s)}async function y(e){if(!e.frames?.length||!e.codecString)return[];let t=e.codecString,n=null;if(t.startsWith(`avc1.`)&&e.width&&e.height){let r=parseInt(t.slice(-2),16),i=Math.ceil(e.width/16)*Math.ceil(e.height/16),a=YT.find(([e])=>e>=r);if(a&&i>0&&Math.floor(a[1]/i)>2){let i=XT(e.width,e.height);i&&i<r&&(n=i,t=ZT(t,i))}}let r={codec:t,optimizeForLatency:!0};e.width&&e.height&&(r.codedWidth=e.width,r.codedHeight=e.height);let i=[];return new Promise(t=>{let a=0,o=!1,s=new VideoDecoder({output:async e=>{try{let t=await createImageBitmap(e);i.push(t)}finally{if(e.close(),a--,o&&a===0){try{s.close()}catch{}t(i)}}},error:()=>{try{s.close()}catch{}t(i)}});s.configure(r);for(let t of e.frames){let e=t.frame instanceof Uint8Array?t.frame:new Uint8Array(t.frame);(e.byteOffset!==0||e.buffer.byteLength!==e.byteLength)&&(e=new Uint8Array(e)),n!==null&&QT(e,n),a++,s.decode(new EncodedVideoChunk({type:`key`,timestamp:t.ts,data:e}))}o=!0,s.flush().catch(()=>{}).finally(()=>{if(a===0){try{s.close()}catch{}t(i)}})})}function b(e,t,n,r,o,s){let l=i.value;l&&(d.value=!0,l.nvrPreviewFrames(t,r*1e3,o*1e3,12).then(async t=>{if(s!==c)return;if(t.noData||!t.frames?.length){d.value=!1;return}let r=await y(t);if(s!==c){for(let e of r)e.close();d.value=!1;return}if(r.length===0){d.value=!1;return}a.set(n,r),h(n),m(),d.value=!1,s===c&&u===e&&v(e,r,s)}).catch(()=>{s===c&&(d.value=!1)}))}function x(e,t,n,r,i){if(!i||i-r<3e3||typeof VideoDecoder>`u`)return;g(),_(),u=e;let o=++c,s=a.get(n);if(s&&s.length>0){h(n),v(e,s,o);return}f(e,t,n,r,i,o)}function S(){++c,g(),_(),d.value=!1,u=null}function C(){S();for(let[,e]of a)for(let t of e)t.close();a.clear(),o.length=0}return{onHoverStart:x,onHoverEnd:S,isLoading:d,dispose:C}}function GD(e=`@camera.ui/camera-ui-nvr`){let{isConnected:t}=Q_(),{plugin:n,isLoading:r}=jv(e),i=s([]),a=s([]),o=s(!1),c=s(!1);function l(){return n.value}async function u(e=!1){let t=l();if(t){e||(o.value=!0);try{let[e,n]=await Promise.all([t.listKnownFaces(),t.getUnknownFaces(100)]);i.value=e??[],a.value=n??[]}catch{}finally{o.value=!1,c.value=!0}}}let d=H(()=>{let e=new Map,t=[];for(let n of a.value)if(n.clusterId&&n.clusterId!==`excluded`){let t=e.get(n.clusterId);t||(t=[],e.set(n.clusterId,t)),t.push(n)}else t.push(n);let n=[];for(let[t,r]of e){let e=r.reduce((e,t)=>(e.confidence??0)>=(t.confidence??0)?e:t);n.push({clusterId:t,faces:r,bestThumbnail:e.thumbnail?Fw(e.thumbnail):void 0})}return n.sort((e,t)=>t.faces.length-e.faces.length),{clusters:n,ungrouped:t}});return z([t,r],([e,t])=>{e&&!t&&n.value?u():!t&&!n.value&&(c.value=!0)},{immediate:!0}),{knownFaces:i,unknownFaces:a,clusteredUnknowns:d,isLoading:H(()=>o.value||!c.value),refresh:u,getFaceImages:async e=>await l()?.getFaceImages?.(e)??[],removeFaceImage:async(e,t)=>{await l()?.removeFaceImage?.(e,t)},enrollFace:async(e,t,n)=>{await l()?.enrollFace?.(e,t,n)},enrollFromEvent:async(e,t)=>{a.value=a.value.filter(e=>e.id!==t),await l()?.enrollFromEvent?.(e,t),await u(!0)},enrollCluster:async(e,t)=>{let n=new Set(t);a.value=a.value.filter(e=>!n.has(e.id)),await l()?.enrollCluster?.(e,t),await u(!0)},rescanFaces:async()=>{let e=await l()?.rescanFaces?.()??0;return e>0&&(jT(),uT()),e},deleteFace:async e=>{i.value=i.value.filter(t=>t.name!==e),await l()?.deleteFace?.(e),await u(!0)},deleteUnknownFace:async e=>{a.value=a.value.filter(t=>t.id!==e),await l()?.deleteUnknownFace?.(e),await u(!0)},deleteAllUnknownFaces:async()=>{a.value=[],await l()?.deleteAllUnknownFaces?.(),await u(!0)},deleteUnknownFacesByCluster:async e=>{a.value=a.value.filter(t=>t.clusterId!==e),await l()?.deleteUnknownFacesByCluster?.(e),await u(!0)},deleteUngroupedUnknownFaces:async()=>{a.value=a.value.filter(e=>e.clusterId&&e.clusterId!==`excluded`),await l()?.deleteUngroupedUnknownFaces?.(),await u(!0)},removeFromCluster:async e=>{let t=a.value.find(t=>t.id===e);t&&(t.clusterId=`excluded`),await l()?.removeFromCluster?.(e),await u(!0)}}}function KD(e,t){let n=t?.sourceRole,r=Q_(),i=TC(),a=W(new Map),o=new Map,c=[],l=s(`idle`),u=s(0),d=s(null),f=s(1),p=s(!0),m=!0,h=s(null),g=H(()=>{let e=a.value;return e.size===0?!1:[...e.values()].every(e=>e.noData.value)}),_=H(()=>{let e=a.value;return e.size===0?!1:[...e.values()].some(e=>e.licenseRequired.value)}),v=H(()=>{let e=a.value;return e.size===0?!1:[...e.values()].some(e=>e.hasAudio.value)}),y=H(()=>{let e=a.value;return e.size===0?!1:[...e.values()].some(e=>e.loading.value)}),b=H(()=>l.value!==`idle`),x=H(()=>l.value===`play`);function S(){let e=d.value;return e?e.startMs+(performance.now()-e.wallStart)*e.speed:0}function C(e,t){l.value=`scrub`,d.value=null,u.value=e;for(let n of a.value.values())n.scrub(e,t)}function w(e,t){l.value=`scrub`,d.value=null,u.value=e;for(let n of a.value.values())n.fineScrub(e,t)}function T(e,t){l.value=`play`,u.value=e,d.value={startMs:Math.floor(e/1e3),wallStart:performance.now(),speed:f.value,targetMs:Math.floor(e/1e3)};for(let n of a.value.values())n.speed.value=f.value,n.play(e,t)}function E(){d.value={startMs:S(),wallStart:performance.now(),speed:0},l.value=`pause`;for(let e of a.value.values())e.pause()}function D(){let e=d.value;e&&(d.value={startMs:e.startMs,wallStart:performance.now(),speed:f.value}),l.value=`play`;for(let e of a.value.values())e.resume()}function O(){for(let e of a.value.values())e.stop();l.value=`idle`,d.value=null,f.value=1,u.value=0}function k(e){d.value={startMs:e/1e3,wallStart:performance.now(),speed:l.value===`play`?f.value:0},u.value=e;for(let t of a.value.values())t.seek(e)}function A(e){let t=S();if(f.value=e,d.value={startMs:t,wallStart:performance.now(),speed:l.value===`play`?e:0},e!==1){p.value=!0;for(let t of a.value.values())t.speed.value=e,t.muted.value=!0,t.setSpeed(e)}else{p.value=m;for(let t of a.value.values())t.speed.value=e,t.setSpeed(e)}}let{resume:j,pause:M}=dl(()=>{if(l.value!==`play`)return;let e=u.value||Math.floor(S()*1e3);for(let t of a.value.values())t.noData.value&&(t.speed.value=f.value,t.play(e));for(let e of a.value.values())if(!e.noData.value&&e.currentTimestamp.value>0){u.value=e.currentTimestamp.value;break}},2e3,{immediate:!1});function N(){for(let e of c)e();c.length=0;for(let[,e]of a.value){let t=z(e.noData,(t,n)=>{if(l.value===`play`&&(n&&!t&&e.currentTimestamp.value>0&&(u.value=e.currentTimestamp.value),!n&&t)){let t=u.value||Math.floor(S()*1e3);e.speed.value=f.value,e.play(t)}});c.push(t)}}z(e,(e,t)=>{let s=new Set(e),c=new Set(t??[]),l=new Map(a.value);for(let e of c)if(!s.has(e)){let t=l.get(e);t&&t.stop(),l.delete(e);let n=o.get(e);n&&(n(),o.delete(e))}for(let e of s)if(!l.has(e)){let t=fe(),a=t.run(()=>sE(e,{managed:!0,sourceRole:n,cameraUi:r,nvrCtx:i}));l.set(e,a),o.set(e,()=>t.stop())}a.value=l},{immediate:!0}),z(a,()=>{N()},{immediate:!0}),z(l,e=>{e===`play`?j():M()}),z(p,e=>{f.value===1&&(m=e)}),xc(()=>{for(let e of c)e();c.length=0;for(let e of a.value.values())e.stop();for(let e of o.values())e();o.clear()});let P={mode:l,currentTimestamp:u,playbackAnchor:d,noData:g,licenseRequired:_,loading:y,hasAudio:v,muted:p,containerRef:h,isActive:b,isPlaybackDriving:x,speed:f,sourceRole:s(``),scrub:C,fineScrub:w,play:T,pause:E,resume:D,stop:O,seek:k,setSpeed:A};return ie(rE,P),ie(iE,a),{master:P,controllers:a}}function qD(e=`@camera.ui/camera-ui-nvr`){let{plugin:t,isLoading:n}=jv(e),r=Vb(),i=s([]),a=s(!1),o=s(!1),c=s(!1);function l(){return t.value}let u=H(()=>c.value&&!n.value);async function d(){try{c.value=(await r.getPluginsByInterface(s_.ClipDetection)).length>0}catch{c.value=!1}}async function f(e,t=50,n=.2){let r=e.trim();if(!r){i.value=[],o.value=!1;return}let s=l();if(s){a.value=!0;try{i.value=await s.searchEventsByText(r,t,n)??[],o.value=!0}catch(e){console.error(`Semantic search failed:`,e)}finally{a.value=!1}}}function p(){i.value=[],o.value=!1}return z(t,e=>{e&&d()},{immediate:!0}),{results:i,isSearching:a,hasSearched:o,isAvailable:u,search:f,clear:p}}var JD=6e4;function YD(){let{isConnected:e}=Q_(),{plugin:t,isLoading:n}=jv(`@camera.ui/camera-ui-nvr`),r=s(),i=s(!1),a=s(!1);async function o(){let e=t.value;if(e){i.value=!0;try{r.value=await e.getStorageStats()}catch{}finally{i.value=!1,a.value=!0}}}let{pause:c,resume:l}=dl(o,JD,{immediate:!1});return z([e,n],([e,n])=>{e&&!n&&t.value?(o(),l()):(c(),!n&&!t.value&&(a.value=!0))},{immediate:!0}),xc(()=>c()),{stats:r,isLoading:H(()=>i.value||!a.value),refresh:o}}var XD;(function(e){e.FINISH_LAUNCHING=`finishLaunching`,e.SHUTDOWN=`shutdown`})(XD||={});var ZD;(function(e){e.Hub=`hub`,e.SensorProvider=`sensorProvider`,e.CameraController=`cameraController`,e.CameraAndSensorProvider=`cameraAndSensorProvider`})(ZD||={});var QD;(function(e){e.MotionDetection=`MotionDetection`,e.ObjectDetection=`ObjectDetection`,e.AudioDetection=`AudioDetection`,e.FaceDetection=`FaceDetection`,e.LicensePlateDetection=`LicensePlateDetection`,e.ClassifierDetection=`ClassifierDetection`,e.ClipDetection=`ClipDetection`,e.DiscoveryProvider=`DiscoveryProvider`,e.NVR=`NVR`,e.Notifier=`Notifier`,e.OAuthCapable=`OAuthCapable`,e.OAuthDeviceFlow=`OAuthDeviceFlow`,e.OAuthAuthCodeFlow=`OAuthAuthCodeFlow`,e.OAuthClientCredentials=`OAuthClientCredentials`})(QD||={});var $D;(function(e){e.PublishNotifications=`publishNotifications`})($D||={});var eO;(function(e){e.Info=`info`,e.Warn=`warn`,e.Error=`error`,e.Critical=`critical`})(eO||={});var tO;(function(e){e.Motion=`motion`,e.Object=`object`,e.Audio=`audio`,e.Face=`face`,e.LicensePlate=`licensePlate`,e.Classifier=`classifier`,e.Clip=`clip`,e.Contact=`contact`,e.Temperature=`temperature`,e.Humidity=`humidity`,e.Occupancy=`occupancy`,e.Smoke=`smoke`,e.Leak=`leak`,e.Light=`light`,e.Siren=`siren`,e.Switch=`switch`,e.Lock=`lock`,e.PTZ=`ptz`,e.SecuritySystem=`securitySystem`,e.Garage=`garage`,e.Doorbell=`doorbell`,e.Battery=`battery`})(tO||={});var nO;(function(e){e.Sensor=`sensor`,e.Control=`control`,e.Trigger=`trigger`,e.Info=`info`})(nO||={});var rO;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Decibels=`decibels`,e.LastTriggered=`lastTriggered`})(rO||={});var iO;(function(e){e.LowBattery=`lowBattery`,e.Charging=`charging`})(iO||={});var aO;(function(e){e.Level=`level`,e.Charging=`charging`,e.Low=`low`})(aO||={});var oO;(function(e){e.NotChargeable=`NOT_CHARGEABLE`,e.NotCharging=`NOT_CHARGING`,e.Charging=`CHARGING`,e.Full=`FULL`})(oO||={});var sO;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Labels=`labels`})(sO||={});var cO;(function(e){e.Detected=`detected`})(cO||={});var lO;(function(e){e.Ring=`ring`})(lO||={});var uO;(function(e){e.Detected=`detected`,e.Detections=`detections`})(uO||={});var dO;(function(e){e[e.Open=0]=`Open`,e[e.Closed=1]=`Closed`,e[e.Opening=2]=`Opening`,e[e.Closing=3]=`Closing`,e[e.Stopped=4]=`Stopped`})(dO||={});var fO;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`,e.ObstructionDetected=`obstructionDetected`})(fO||={});var pO;(function(e){e.Current=`current`})(pO||={});var mO;(function(e){e.Detected=`detected`})(mO||={});var hO;(function(e){e.Detected=`detected`,e.Detections=`detections`})(hO||={});var gO;(function(e){e.Brightness=`brightness`})(gO||={});var _O;(function(e){e.On=`on`,e.Brightness=`brightness`})(_O||={});var vO;(function(e){e[e.Secured=0]=`Secured`,e[e.Unsecured=1]=`Unsecured`,e[e.Unknown=2]=`Unknown`})(vO||={});var yO;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`})(yO||={});var bO;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Blocked=`blocked`,e.LastTriggered=`lastTriggered`})(bO||={});var xO;(function(e){e.Detected=`detected`,e.Detections=`detections`,e.Labels=`labels`})(xO||={});var SO;(function(e){e.Detected=`detected`})(SO||={});var CO;(function(e){e.Pan=`pan`,e.Tilt=`tilt`,e.Zoom=`zoom`,e.Presets=`presets`,e.Home=`home`})(CO||={});var wO;(function(e){e.Position=`position`,e.Moving=`moving`,e.Presets=`presets`,e.Velocity=`velocity`,e.TargetPreset=`targetPreset`})(wO||={});var TO;(function(e){e[e.StayArm=0]=`StayArm`,e[e.AwayArm=1]=`AwayArm`,e[e.NightArm=2]=`NightArm`,e[e.Disarmed=3]=`Disarmed`,e[e.AlarmTriggered=4]=`AlarmTriggered`})(TO||={});var EO;(function(e){e.CurrentState=`currentState`,e.TargetState=`targetState`})(EO||={});var DO;(function(e){e.Volume=`volume`})(DO||={});var OO;(function(e){e.Active=`active`,e.Volume=`volume`})(OO||={});var kO;(function(e){e.Detected=`detected`})(kO||={});var AO;(function(e){e.On=`on`})(AO||={});var jO;(function(e){e.Current=`current`})(jO||={});var MO={};MO.NODE_ENV,MO.CAMERA_UI_RUNMODE,MO.CAMERA_UI_RUNMODE,MO.CAMERA_UI_RUNMODE;function NO(e,t,n=!1){if(e===t)return!0;if((e===void 0||t===void 0||e===null||t===null)&&(e||t))return!1;let r=e?.constructor.name,i=t?.constructor.name;if(r!==i)return!1;if(r===`Array`&&i===`Array`){if(e.length!==t.length)return!1;if(n){let r=[...t];return e.every(e=>{let t=r.findIndex(t=>NO(e,t,n));return t===-1?!1:(r.splice(t,1),!0)})}else{let r=!0;for(let i=0;i<e.length;i++)if(!NO(e[i],t[i],n)){r=!1;break}return r}}if(r===`Object`&&i===`Object`){let r=!0,i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let a=0;a<i.length;a++)if(e[i[a]]&&t[i[a]]){if(e[i[a]]===t[i[a]])continue;if(e[i[a]]&&(e[i[a]].constructor.name===`Array`||e[i[a]].constructor.name===`Object`)){if(r=NO(e[i[a]],t[i[a]],n),!r)break}else if(e[i[a]]!==t[i[a]]){r=!1;break}}else if(e[i[a]]&&!t[i[a]]||!e[i[a]]&&t[i[a]]){r=!1;break}return r}return e===t}export{hS as $,$s as $i,rm as $n,Vd as $r,Y_ as $t,qD as A,pu as Ai,u_ as An,hf as Ar,Fy as At,DC as B,Au as Bi,Lg as Bn,ef as Br,Kb as Bt,iO as C,iu as Ci,b_ as Cn,Df as Cr,Bv as Ct,tO as D,ru as Di,m_ as Dn,mf as Dr,Xv as Dt,nO as E,uu as Ei,h_ as En,kf as Er,Fv as Et,GD as F,vu as Fi,t_ as Fn,Bd as Fr,_y as Ft,pT as G,Qc as Gi,wh as Gn,vf as Gr,Py as Gt,UD as H,bc as Hi,cg as Hn,af as Hr,gy as Ht,KD as I,lu as Ii,e_ as In,uf as Ir,Mb as It,OC as J,dl as Ji,oh as Jn,Of as Jr,yv as Jt,TC as K,xc as Ki,xh as Kn,sf as Kr,uy as Kt,Mw as L,Cu as Li,Rg as Ln,Pd as Lr,my as Lt,YD as M,hu as Mi,l_ as Mn,_f as Mr,Ny as Mt,WD as N,yu as Ni,s_ as Nn,wf as Nr,Bb as Nt,uT as O,du as Oi,p_ as On,gf as Or,Wv as Ot,Bw as P,$l as Pi,i_ as Pn,Sf as Pr,Q_ as Pt,PS as Q,nc as Qi,am as Qn,lf as Qr,J_ as Qt,sE as R,wu as Ri,Sg as Rn,Tf as Rr,hy as Rt,sO as S,nu as Si,y_ as Sn,qd as Sr,zv as St,rO as T,Cl as Ti,g_ as Tn,Yd as Tr,Kv as Tt,Fw as U,Wc as Ui,Xh as Un,Jd as Ur,jv as Ut,jT as V,Mu as Vi,pg as Vn,pf as Vr,py as Vt,iE as W,Yc as Wi,Lh as Wn,Fd as Wr,My as Wt,_C as X,pc as Xi,Fm as Xn,zd as Xr,jb as Xt,MT as Y,fl as Yi,Qm as Yn,Pf as Yr,qb as Yt,nC as Z,sc as Zi,im as Zn,df as Zr,X_ as Zt,pO as _,Pl as _i,E_ as _n,Hf as _r,Jv as _t,DO as a,jt as aa,nf as ai,V_ as an,Jp as ar,kx as at,lO as b,eu as bi,C_ as bn,qf as br,Pv as bt,wO as c,Ut as ca,ff as ci,R_ as cn,hp as cr,rx as ct,bO as d,Xt as da,bd as di,F_ as dn,tp as dr,Vv as dt,Qt as ea,Mf as ei,q_ as en,Pp as er,tS as et,yO as f,xt as fa,xd as fi,N_ as fn,up as fr,Iv as ft,mO as g,jl as gi,O_ as gn,Yf as gr,Qv as gt,hO as h,Pt as ha,Tl as hi,k_ as hn,ep as hr,Hv as ht,kO as i,Ot as ia,Ef as ii,H_ as in,Np as ir,Lx as it,rE as j,mu as ji,f_ as jn,yf as jr,Ev as jt,HD as k,Rl as ki,d_ as kn,Qd as kr,qv as kt,SO as l,qt as la,cf as li,L_ as ln,fp as lr,ex as lt,_O as m,Ft as ma,vl as mi,A_ as mn,gp as mr,Lv as mt,jO as n,Tt as na,of as ni,G_ as nn,nm as nr,Kx as nt,OO as o,Lt as oa,Ld as oi,z_ as on,Sp as or,xx as ot,gO as p,kt as pa,_l as pi,j_ as pn,mp as pr,Rv as pt,jw as q,Xc as qi,sh as qn,Nf as qr,ly as qt,AO as r,Et as ra,Kd as ri,W_ as rn,om as rr,Gx as rt,EO as s,zt as sa,Zd as si,B_ as sn,bp as sr,px as st,NO as t,Ct as ta,Wd as ti,K_ as tn,tm as tr,Qx as tt,xO as u,Yt as ua,Nd as ui,I_ as un,lp as ur,By as ut,fO as v,Bl as vi,T_ as vn,Jf as vr,Zv as vt,aO as w,ou as wi,__ as wn,bf as wr,Yv as wt,cO as x,tu as xi,S_ as xn,Ff as xr,Gv as xt,uO as y,Ql as yi,w_ as yn,Xf as yr,Uv as yt,cE as z,Tu as zi,Ig as zn,Xd as zr,fy as zt};
|