diff --git a/fastapi_wss/src/a2a_wss.py b/fastapi_wss/src/a2a_wss.py index 6fb3fbc..020e2a5 100644 --- a/fastapi_wss/src/a2a_wss.py +++ b/fastapi_wss/src/a2a_wss.py @@ -835,7 +835,12 @@ async def forward_audio(websocket): logger.info(f"已连接到 ASR 服务: {TARGET_WS_URL}") # 发送 ASR 配置(双通道模式,PCM 音频格式) - config = {"mode": "2pass", "chunk_size": [10, 10, 10], "wav_format": "pcm"} + config = { + "mode": "2pass", + "chunk_size": [5, 10, 5], + "chunk_interval": 5, + "wav_format": "pcm", + } await target_ws.send(json.dumps(config)) logger.debug(f"发送 ASR 配置: {config}") diff --git a/speakr/src/api/asr_ws.py b/speakr/src/api/asr_ws.py index a9ec40c..c9cf6ac 100644 --- a/speakr/src/api/asr_ws.py +++ b/speakr/src/api/asr_ws.py @@ -56,10 +56,10 @@ def _hotwords_payload(logger, scene=SCENE_CG): def _asr_init_payload(mode, hotwords): return { - 'chunk_size': [10, 10, 10], + 'chunk_size': [5, 10, 5], 'wav_name': 'h5', 'is_speaking': True, - 'chunk_interval': 10, + 'chunk_interval': 5, 'itn': True, 'mode': mode, 'hotwords': hotwords, @@ -82,9 +82,10 @@ def live_asr_proxy(client_ws): hotwords = _hotwords_payload(logger, scene) upstream_open = threading.Event() - upstream_closed = threading.Event() - stop_requested = threading.Event() - upstream_holder = {'ws': None} + upstream_closed = threading.Event() + stop_requested = threading.Event() + upstream_holder = {'ws': None} + upstream_message_count = {'value': 0} def on_open(upstream): upstream_holder['ws'] = upstream @@ -92,11 +93,45 @@ def live_asr_proxy(client_ws): upstream_open.set() _send_json(client_ws, {'type': 'state', 'state': 'connected', 'mode': mode, 'scene': scene}) - def on_message(_upstream, message): - try: - client_ws.send(message) - except Exception: - upstream_closed.set() + def on_message(_upstream, message): + upstream_message_count['value'] += 1 + outbound_message = message + if upstream_message_count['value'] <= 20: + try: + payload = json.loads(message) + if payload.get('mode') == 'online': + payload['mode'] = '2pass-online' + outbound_message = json.dumps(payload, ensure_ascii=False) + elif payload.get('mode') == 'offline': + payload['mode'] = '2pass-offline' + outbound_message = json.dumps(payload, ensure_ascii=False) + logger.info( + 'Realtime ASR upstream message #%s: mode=%s text=%r', + upstream_message_count['value'], + payload.get('mode'), + (payload.get('text') or '')[:80], + ) + except Exception: + logger.info( + 'Realtime ASR upstream message #%s: %r', + upstream_message_count['value'], + str(message)[:160], + ) + else: + try: + payload = json.loads(message) + if payload.get('mode') == 'online': + payload['mode'] = '2pass-online' + outbound_message = json.dumps(payload, ensure_ascii=False) + elif payload.get('mode') == 'offline': + payload['mode'] = '2pass-offline' + outbound_message = json.dumps(payload, ensure_ascii=False) + except Exception: + outbound_message = message + try: + client_ws.send(outbound_message) + except Exception: + upstream_closed.set() def on_error(_upstream, error): logger.warning('FunASR WebSocket 错误:%s', error) diff --git a/speakr/static/vite/index/assets/index.js b/speakr/static/vite/index/assets/index.js index 72e856b..daecfac 100644 --- a/speakr/static/vite/index/assets/index.js +++ b/speakr/static/vite/index/assets/index.js @@ -33,14 +33,14 @@ * vue v3.5.22 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/const gh=Object.create(null);function Zg(e,t){if(!Ee(e))if(e.nodeType)e=e.innerHTML;else return Mt;const n=vw(e,t),s=gh[n];if(s)return s;if(e[0]==="#"){const l=document.querySelector(e);e=l?l.innerHTML:""}const i=Me({hoistStatic:!0,onError:void 0,onWarn:Mt},t);!i.isCustomElement&&typeof customElements<"u"&&(i.isCustomElement=l=>!!customElements.get(l));const{code:r}=I_(e,i),o=new Function("Vue",r)(B0);return o._rc=!0,gh[n]=o}Au(Zg);const N_=Object.freeze(Object.defineProperty({__proto__:null,BaseTransition:iu,BaseTransitionPropsValidators:Ha,Comment:at,DeprecationTypes:jm,EffectScope:Ia,ErrorCodes:tp,ErrorTypeStrings:Pm,Fragment:wt,KeepAlive:Cp,ReactiveEffect:_i,Static:hs,Suspense:mm,Teleport:hp,Text:qn,TrackOpTypes:Qh,Transition:Wm,TransitionGroup:tg,TriggerOpTypes:Yh,VueElement:Gr,assertNumber:ep,callWithAsyncErrorHandling:on,callWithErrorHandling:qs,camelize:Ge,capitalize:vs,cloneVNode:_n,compatUtils:Bm,compile:Zg,computed:zn,createApp:Sa,createBlock:Mr,createCommentVNode:Em,createElementBlock:wm,createElementVNode:Ka,createHydrationRenderer:bu,createPropsRestProxy:Kp,createRenderer:wu,createSSRApp:Bu,createSlots:Ip,createStaticVNode:_m,createTextVNode:Ja,createVNode:Je,customRef:tu,defineAsyncComponent:Ep,defineComponent:Ua,defineCustomElement:Pu,defineEmits:Fp,defineExpose:Dp,defineModel:jp,defineOptions:$p,defineProps:Lp,defineSSRCustomElement:Qm,defineSlots:Bp,devtools:Lm,effect:Oh,effectScope:Eh,getCurrentInstance:Wt,getCurrentScope:Jc,getCurrentWatcher:Xh,getTransitionRawChildren:Ur,guardReactiveProps:ku,h:Mu,handleError:ys,hasInjectionContext:Yp,hydrate:cg,hydrateOnIdle:wp,hydrateOnInteraction:_p,hydrateOnMediaQuery:Tp,hydrateOnVisible:bp,initCustomFormatter:Om,initDirectivesForSSR:dg,inject:bi,isMemoSame:Ou,isProxy:jr,isReactive:Wn,isReadonly:An,isRef:pt,isRuntimeOnly:Rm,isShallow:Yt,isVNode:On,markRaw:Zc,mergeDefaults:qp,mergeModels:zp,mergeProps:Ru,nextTick:Ss,normalizeClass:Di,normalizeProps:wh,normalizeStyle:Fi,onActivated:ou,onBeforeMount:lu,onBeforeUnmount:qr,onBeforeUpdate:Wa,onDeactivated:au,onErrorCaptured:du,onMounted:$i,onRenderTracked:fu,onRenderTriggered:uu,onScopeDispose:Ch,onServerPrefetch:cu,onUnmounted:zr,onUpdated:Wr,onWatcherCleanup:nu,openBlock:Ci,popScopeId:ap,provide:vu,proxyRefs:Da,pushScopeId:op,queuePostFlushCb:Ei,reactive:Br,readonly:Cr,ref:de,registerRuntimeCompiler:Au,render:$u,renderList:Op,renderSlot:Np,resolveComponent:xp,resolveDirective:Mp,resolveDynamicComponent:Ap,resolveFilter:$m,resolveTransitionHooks:Bs,setBlockTracking:ki,setDevtoolsHook:Fm,setTransitionHooks:Mn,shallowReactive:Xc,shallowReadonly:Vh,shallowRef:eu,ssrContextKey:_u,ssrUtils:Dm,stop:Ih,toDisplayString:Kc,toHandlerKey:Ps,toHandlers:Pp,toRaw:Pe,toRef:Jh,toRefs:Kh,toValue:zh,transformVNodeArgs:bm,triggerRef:qh,unref:Hr,useAttrs:Vp,useCssModule:Xm,useCssVars:Gm,useHost:Lu,useId:yp,useModel:dm,useSSRContext:Eu,useShadowRoot:Ym,useSlots:Up,useTemplateRef:Sp,useTransitionState:ja,vModelCheckbox:Ga,vModelDynamic:Du,vModelRadio:Qa,vModelSelect:Fu,vModelText:Or,vShow:Nu,version:Iu,warn:Nm,watch:wn,watchEffect:cm,watchPostEffect:um,watchSyncEffect:Cu,withAsyncContext:Jp,withCtx:Ba,withDefaults:Hp,withDirectives:cp,withKeys:rg,withMemo:Im,withModifiers:ig,withScopeId:lp},Symbol.toStringTag,{value:"Module"}));class P_{constructor(){var t;this.token=(t=document.querySelector('meta[name="csrf-token"]'))==null?void 0:t.getAttribute("content"),this.refreshPromise=null,this.setupFetchInterceptor()}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){try{console.log("Refreshing CSRF token...");const n=await(window.originalFetch||fetch)("/api/csrf-token",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`Failed to refresh CSRF token: ${n.status} ${n.statusText}`);const s=n.headers.get("content-type");if(!s||!s.includes("application/json")){const r=await n.text();throw new Error(`Expected JSON response but got ${s}. Response: ${r.substring(0,200)}`)}const i=await n.json();if(i.csrf_token){this.token=i.csrf_token;const r=document.querySelector('meta[name="csrf-token"]');return r&&r.setAttribute("content",this.token),window.app&&window.app.csrfToken!==void 0&&(window.app.csrfToken=this.token),console.log("CSRF token refreshed successfully"),this.token}else throw new Error("No CSRF token in response")}catch(t){throw console.error("Failed to refresh CSRF token:",t),t}}setupFetchInterceptor(){window.originalFetch||(window.originalFetch=window.fetch);const t=window.originalFetch,n=this;window.fetch=async function(s,i={}){if(s.includes("/api/csrf-token"))return t(s,i);const r={...i};(s.startsWith("/api/")||s.startsWith("/upload")||s.startsWith("/save")||s.startsWith("/recording/")||s.startsWith("/chat")||s.startsWith("/speakers"))&&(r.headers={"X-CSRFToken":n.token,...r.headers});let o=await t(s,r);if((o.status===400||o.status===403)&&(s.startsWith("/api/")||s.startsWith("/upload")||s.startsWith("/save")||s.startsWith("/recording/")||s.startsWith("/chat")||s.startsWith("/speakers")))try{const l=o.clone();let c=!1;try{const f=(await l.json()).error||"";c=f.toLowerCase().includes("csrf")||f.toLowerCase().includes("token")}catch{const f=await o.clone().text();c=f.toLowerCase().includes("csrf")||f.toLowerCase().includes("token")||f.includes("{window.csrfManager=new P_,setInterval(()=>{window.csrfManager&&(console.log("Performing periodic CSRF token refresh..."),window.csrfManager.manualRefresh())},45*60*1e3)});class L_{constructor(){this.translations={},this.currentLocale="en",this.fallbackLocale="en",this.loadedLocales=new Set}async init(t="en"){const n=localStorage.getItem("preferredLanguage"),s=navigator.language.split("-")[0];this.currentLocale=n||t||s||"en",await this.loadLocale(this.currentLocale),this.currentLocale!==this.fallbackLocale&&await this.loadLocale(this.fallbackLocale)}async loadLocale(t){if(!this.loadedLocales.has(t))try{const n=await fetch(`/tool/speakr/static/locales/${t}.json`);if(!n.ok)throw new Error(`Failed to load locale: ${t}`);const s=await n.json();this.translations[t]=s,this.loadedLocales.add(t),console.log(`Loaded locale: ${t}`)}catch(n){console.error(`Error loading locale ${t}:`,n),t!==this.fallbackLocale&&(console.log(`Failed to load ${t}, will use ${this.fallbackLocale} as fallback`),await this.loadLocale(this.fallbackLocale))}}async setLocale(t){await this.loadLocale(t),this.currentLocale=t,localStorage.setItem("preferredLanguage",t),window.dispatchEvent(new CustomEvent("localeChanged",{detail:{locale:t}}))}getLocale(){return this.currentLocale}getAvailableLocales(){return[{code:"en",name:"English",nativeName:"English"},{code:"es",name:"Spanish",nativeName:"Español"},{code:"fr",name:"French",nativeName:"Français"},{code:"zh",name:"Chinese",nativeName:"中文"}]}t(t,n={},s=null){const i=s||this.currentLocale;let r=this.getNestedTranslation(i,t);return!r&&i!==this.fallbackLocale&&(r=this.getNestedTranslation(this.fallbackLocale,t)),r?this.interpolate(r,n):(console.warn(`Translation not found for key: ${t}`),t)}getNestedTranslation(t,n){if(!this.translations[t])return null;const s=n.split(".");let i=this.translations[t];for(const r of s)if(i&&typeof i=="object"&&r in i)i=i[r];else return null;return typeof i=="string"?i:null}interpolate(t,n){return t.replace(/\{\{(\w+)\}\}/g,(s,i)=>n.hasOwnProperty(i)?n[i]:s)}tc(t,n,s={}){const i=n===1?t:`${t}Plural`;return this.t(i,{...s,count:n})}formatDate(t,n={}){const s=t instanceof Date?t:new Date(t);return new Intl.DateTimeFormat(this.currentLocale,n).format(s)}formatNumber(t,n={}){return new Intl.NumberFormat(this.currentLocale,n).format(t)}formatFileSize(t){const n=["bytes","kilobytes","megabytes","gigabytes"],s=[1,1024,1048576,1073741824];let i=0;for(let o=s.length-1;o>=0;o--)if(t>=s[o]){i=o;break}const r=Math.round(t/s[i]*10)/10;return this.t(`fileSize.${n[i]}`,{count:r})}formatDuration(t){if(t<60)return this.tc("duration.seconds",Math.round(t),{count:Math.round(t)});if(t<3600){const n=Math.round(t/60);return this.tc("duration.minutes",n,{count:n})}else{const n=Math.round(t/3600*10)/10;return this.tc("duration.hours",n,{count:n})}}formatRelativeTime(t){const n=t instanceof Date?t:new Date(t),i=Math.floor((new Date-n)/1e3);if(i<60)return this.t("time.justNow");if(i<3600){const r=Math.floor(i/60);return r===1?this.t("time.minuteAgo"):this.t("time.minutesAgo",{count:r})}else if(i<86400){const r=Math.floor(i/3600);return r===1?this.t("time.hourAgo"):this.t("time.hoursAgo",{count:r})}else if(i<604800){const r=Math.floor(i/86400);return r===1?this.t("time.dayAgo"):this.t("time.daysAgo",{count:r})}else if(i<2592e3){const r=Math.floor(i/604800);return r===1?this.t("time.weekAgo"):this.t("time.weeksAgo",{count:r})}else if(i<31536e3){const r=Math.floor(i/2592e3);return r===1?this.t("time.monthAgo"):this.t("time.monthsAgo",{count:r})}else{const r=Math.floor(i/31536e3);return r===1?this.t("time.yearAgo"):this.t("time.yearsAgo",{count:r})}}}const F_=new L_;typeof window<"u"&&(window.i18n=F_,window.i18n.t||(window.i18n.t=function(e,t){return console.warn("i18n.t called before initialization, returning key:",e),e}));const af=typeof window<"u"?window:globalThis,Oc=af.Recorder,dr=af.EasyMDE,ev=af.marked;function D_(){const e=[];Oc||e.push("Recorder"),dr||e.push("EasyMDE"),ev||e.push("marked"),e.length>0&&console.error(`Missing index vendor globals: ${e.join(", ")}`)}function $_(e,t="cg"){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/tool/speakr/ws/asr/live?mode=${encodeURIComponent(e||"online")}&scene=${encodeURIComponent(t||"cg")}`}function Ic(e){var t,n=e.msgHandle,s=e.stateHandle,i=e.getScene||(()=>"cg");let r="offline";var o=[],l=!1,c=1e3,h=500,f=0,u=null,m=null;function v(){if(o.length<=c)return!1;const C=o.length-c;return console.warn(`⚠️ 发送队列超过最大限制 (${c}),丢弃最旧的 ${C} 个数据包`),o=o.slice(-c),!0}function w(C){o.push(C),v(),o.length>h&&console.warn(`⚠️ WebSocket发送队列堆积: ${o.length} 个数据包待发送`)}this.wsStart=function(C){t&&t.close(),C==="offline"||C&&C!=="online"?r="offline":r="online";var V=$_(r,i());if(V.match(/wss:\S*|ws:\S*/))console.log("Uri"+V);else return alert("请检查wss地址正确性"),0;return"WebSocket"in window?(t=new WebSocket(V),t.onopen=function(F){M(F)},t.onclose=function(F){console.log("onclose ws!"),S()},t.onmessage=function(F){_(F)},t.onerror=function(F){x(F)},1):(alert("当前浏览器不支持 WebSocket"),0)};function b(){m&&(clearTimeout(m),m=null),u&&(u(),u=null)}function H(){if(t!=null){try{t.close()}catch(C){console.warn("Failed to close WebSocket",C)}t=void 0}o=[],l=!1}this.wsStop=function(){if(t!=null){console.log("stop ws!");try{t.readyState===1&&t.send(JSON.stringify({type:"stop",is_speaking:!1}))}catch(C){console.warn("Failed to send WebSocket stop frame",C)}}b(),H()},this.wsFinish=function(C=3e3){return t==null||t.readyState>=2?(b(),Promise.resolve()):(o=[],l=!1,new Promise(V=>{u=V,m=setTimeout(()=>{b()},C);try{t.readyState===1&&t.send(JSON.stringify({type:"stop",is_speaking:!1}))}catch(F){console.warn("Failed to send WebSocket finish frame",F),b()}}))};function P(){if(l||o.length===0||!t||t.readyState!==1)return;l=!0;const C=o.shift();try{t.send(C),l=!1,o.length>h&&console.warn(`⚠️ WebSocket发送队列堆积: ${o.length} 个数据包待发送`),o.length>0&&setTimeout(()=>P(),0)}catch(V){console.error("❌ WebSocket发送失败,数据已放回队列:",V),o.unshift(C),l=!1,v()}}this.wsSend=function(C){if(t==null)return w(C),!0;if(t.readyState===1){if(o.length>0)return w(C),P(),!0;try{return t.send(C),!0}catch(F){return console.error("❌ WebSocket直接发送失败,加入队列:",F),w(C),P(),!0}}else{if(t.readyState===0)return w(C),!0;var V=Date.now();return V-f>5e3&&(console.warn("⚠️ WebSocket未连接,数据无法发送 (state:",t.readyState,")"),f=V),!1}},this.getQueueStatus=function(){return{length:o.length,isSending:l,readyState:t?t.readyState:-1}};function M(C){console.log(C,"e"),console.log("WebSocket connected to backend ASR proxy"),s(0),o.length>0&&(console.log(`Processing ${o.length} queued audio chunks`),P())}function S(C){b(),t=void 0,s(1)}function _(C){n(C);try{const V=JSON.parse(C.data);(V&&V.type==="state"&&V.state==="closed"||V&&(V.mode==="2pass-offline"||V.mode==="offline-speaker"))&&b()}catch{}}function x(C){console.log(C),s(2)}}typeof window<"u"&&(window.WebSocketConnectMethod=Ic);const tc=960,B_=2e4,nc=16e3*5;function fi(){}function j_(e,t){const n=new Int16Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function H_(){const e=window.AudioContext||window.webkitAudioContext;return new e}class U_{constructor({getMicStream:t,getSystemStream:n,getPausedTranscription:s,setPausedTranscription:i,getShowSpeaker:r,getConfigWords:o,getScene:l=()=>"cg",getLastTimer:c,setLastTimer:h,onMainTextChange:f=fi,onPreviewTextChange:u=fi,onOfflineTextChange:m=fi,onActiveChange:v=fi,onPendingCorrectionCountChange:w=fi,onError:b=fi,fetchImpl:H=window.fetch.bind(window),correctUrl:P="/tool/speakr/api/asr/correct",sourceKind:M="mixed"}){this.getMicStream=t,this.getSystemStream=n,this.getPausedTranscription=s,this.setPausedTranscription=i,this.getShowSpeaker=r,this.getConfigWords=o,this.getScene=l,this.getLastTimer=c,this.setLastTimer=h,this.onMainTextChange=f,this.onPreviewTextChange=u,this.onOfflineTextChange=m,this.onActiveChange=v,this.onPendingCorrectionCountChange=w,this.onError=b,this.fetchImpl=H,this.correctUrl=P,this.sourceKind=M,this.wsOnline=null,this.wsOffline=null,this.recOnline=null,this.recOffline=null,this.audioContextOnline=null,this.audioContextOffline=null,this.sampleBufOnline=new Int16Array,this.sampleBufOffline=new Int16Array,this.segmentList=[],this.segmentRenderStartIndex=0,this.pendingSentenceQueue=[],this.pendingSentenceSequence=0,this.pendingCorrectionCount=0,this.recText="",this.recTextOnline="",this.offlineSentenceHandoffText="",this.lastOnlineTimestamp=null,this.liveTranscriptionEpoch=0,this.realtimeTimestampBarrierMs=-1,this.realtimeEditCarryover=null,this.editModeBufferStartIndex=0,this.active=!1,this.disposed=!1,this.createSockets()}createSockets(){this.wsOnline=new Ic({msgHandle:t=>this.handleOnlineMessage(t),stateHandle:t=>this.handleOnlineState(t),getScene:()=>this.getScene()}),this.wsOffline=new Ic({msgHandle:t=>this.handleOfflineMessage(t),stateHandle:t=>this.handleOfflineState(t),getScene:()=>this.getScene()})}start(){var s,i;this.disposed=!1;const t=((s=this.wsOnline)==null?void 0:s.wsStart())===1,n=((i=this.wsOffline)==null?void 0:i.wsStart("offline"))===1;return this.setActive(t||n),t||n?1:0}stop(){var t,n;this.setActive(!1),(t=this.wsOnline)==null||t.wsStop(),(n=this.wsOffline)==null||n.wsStop(),this.closeRecorders()}async finish(t=3e3){var s,i;this.setActive(!1),this.closeRecorders();const n=[];this.wsOnline&&typeof this.wsOnline.wsFinish=="function"?n.push(this.wsOnline.wsFinish(t)):(s=this.wsOnline)==null||s.wsStop(),this.wsOffline&&typeof this.wsOffline.wsFinish=="function"?n.push(this.wsOffline.wsFinish(t)):(i=this.wsOffline)==null||i.wsStop(),n.length>0&&await Promise.allSettled(n)}dispose(){this.disposed=!0,this.stop(),this.wsOnline=null,this.wsOffline=null}isActive(){return this.active}setActive(t){this.active=t,this.onActiveChange(t)}setPendingCorrectionCount(t){this.pendingCorrectionCount=Math.max(0,t),this.onPendingCorrectionCountChange(this.pendingCorrectionCount)}getPendingCorrectionCount(){return this.pendingCorrectionCount}async waitForCorrections(t=8e3,n=200){const s=Date.now();for(;this.pendingCorrectionCount>0&&Date.now()-ssetTimeout(i,n));return this.pendingCorrectionCount}startNewEpoch({barrierTimestampMs:t=null,clearTimestampBarrier:n=!1,clearEditCarryover:s=!0}={}){this.liveTranscriptionEpoch+=1,s&&(this.realtimeEditCarryover=null),n?this.realtimeTimestampBarrierMs=-1:Number.isFinite(t)&&(this.realtimeTimestampBarrierMs=Math.max(this.realtimeTimestampBarrierMs,t)),this.clearRealtimePipeline({preserveTimestampBarrier:!n})}resetTranscript({clearTimestampBarrier:t=!1}={}){this.segmentList=[],this.segmentRenderStartIndex=0,this.setPendingCorrectionCount(0),this.startNewEpoch({clearTimestampBarrier:t})}prepareForResume(){this.segmentRenderStartIndex=this.segmentList.length,this.editModeBufferStartIndex=this.segmentList.length,this.sampleBufOnline=new Int16Array,this.sampleBufOffline=new Int16Array,this.recText="",this.recTextOnline="",this.offlineSentenceHandoffText="",this.pendingSentenceQueue=[],this.pendingSentenceSequence=0,this.lastOnlineTimestamp=null,this.onPreviewTextChange(""),this.onOfflineTextChange(""),this.liveTranscriptionEpoch+=1,this.renderFullText(),this.syncRealtimePreview()}enterEditMode(t){this.editModeBufferStartIndex=this.segmentList.length;const n=this.getLatestRealtimeTimestamp();this.startNewEpoch({barrierTimestampMs:n,clearEditCarryover:!1}),this.realtimeEditCarryover=this.buildRealtimeEditCarryover(t)}applyEditedText(t){this.setPausedTranscription(t),this.segmentRenderStartIndex=this.editModeBufferStartIndex,this.recText="",this.recTextOnline="",this.offlineSentenceHandoffText="",this.onPreviewTextChange(""),this.onOfflineTextChange(""),this.onMainTextChange(t),this.renderFullText()}ensureRecorders(){}closeRecorders(){if(this.recOnline){try{this.recOnline.close()}catch(t){console.warn("Failed to close online Recorder:",t)}this.recOnline=null}if(this.recOffline){try{this.recOffline.close()}catch(t){console.warn("Failed to close offline Recorder:",t)}this.recOffline=null}this.closeAudioContexts()}closeAudioContexts(){if(this.audioContextOnline){try{this.audioContextOnline.close()}catch{}this.audioContextOnline=null}if(this.audioContextOffline){try{this.audioContextOffline.close()}catch{}this.audioContextOffline=null}}handleOnlineState(t){t===0?this.openMixedStream("online"):t===2&&this.stop()}handleOfflineState(t){t===0?this.openMixedStream("offline"):t===2&&this.stop()}async openMixedStream(t){try{const n=t==="online"?await this.getMicrophoneInfo():null;n&&console.log("Current microphone:",n.name,n);const s=this.getMicStream(),i=this.getSystemStream(),r=s&&s.getAudioTracks().length>0,o=i&&i.getAudioTracks().length>0;if(this.sourceKind==="mic"&&!r)throw new Error("No microphone stream is available for realtime ASR.");if(this.sourceKind==="system"&&!o)throw new Error("No system audio stream is available for realtime ASR.");if(this.sourceKind==="mixed"&&!r&&!o)throw new Error("No audio stream is available for realtime ASR.");if(t==="online"&&this.audioContextOnline)try{this.audioContextOnline.close()}catch{}if(t==="offline"&&this.audioContextOffline)try{this.audioContextOffline.close()}catch{}const l=H_();t==="online"?this.audioContextOnline=l:this.audioContextOffline=l;const c=l.createMediaStreamDestination();(this.sourceKind==="mixed"||this.sourceKind==="mic")&&r&&l.createMediaStreamSource(s).connect(c),(this.sourceKind==="mixed"||this.sourceKind==="system")&&o?l.createMediaStreamSource(i).connect(c):this.sourceKind==="mixed"&&!r&&console.log("No system audio detected for realtime ASR.");const h=t==="online"?this.recOnline:this.recOffline;if(h)try{h.close()}catch{}const f=Oc({type:"pcm",bitRate:16,sampleRate:16e3,sourceStream:c.stream,onProcess:(...u)=>this.processRecorderFrame(t,...u)});t==="online"?this.recOnline=f:this.recOffline=f,f.open(()=>{f.start()},u=>{console.error("Recorder permission denied:",u),this.onError(u)})}catch(n){console.error("Failed to initialize realtime ASR recorder:",n),this.onError(n)}}processRecorderFrame(t,n,s,i,r){if(!this.active||this.disposed||!n||n.length===0)return;const o=n[n.length-1],l=Oc.SampleData([o],r,16e3).data,c=t==="online",h=c?this.wsOnline:this.wsOffline,f=c?"Online":"Offline";let u=c?this.sampleBufOnline:this.sampleBufOffline;if(u=j_(u,l),u.length>nc){const m=u.length-nc;console.warn(`[${f}] Dropping excess realtime ASR audio buffer: ${m} samples`),u=u.slice(-nc)}for(;u.length>=tc;){const m=u.slice(0,tc);if(!(h==null?void 0:h.wsSend(m)))break;u=u.slice(tc)}u.length>B_&&console.warn(`[${f}] Realtime ASR audio buffer is high: ${u.length} samples (${(u.length/16e3).toFixed(2)}s)`),c?this.sampleBufOnline=u:this.sampleBufOffline=u}async getMicrophoneInfo(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return console.warn("Browser does not support enumerating audio devices."),null;const n=(await navigator.mediaDevices.enumerateDevices()).filter(i=>i.kind==="audioinput"),s=n.find(i=>i.deviceId==="default")||n[0];return{name:(s==null?void 0:s.label)||"Unknown microphone",deviceId:(s==null?void 0:s.deviceId)||"",all:n.map(i=>({name:i.label,deviceId:i.deviceId}))}}clearRealtimePipeline({preserveTimestampBarrier:t=!1}={}){this.sampleBufOnline=new Int16Array,this.sampleBufOffline=new Int16Array,this.recText="",this.recTextOnline="",this.offlineSentenceHandoffText="",this.pendingSentenceQueue=[],this.pendingSentenceSequence=0,this.lastOnlineTimestamp=null,this.onPreviewTextChange(""),this.onOfflineTextChange(""),t||(this.realtimeTimestampBarrierMs=-1),this.syncRealtimePreview()}extractTimestampMs(t){if(!t)return null;try{const n=typeof t=="string"?JSON.parse(t):t;if(!Array.isArray(n)||n.length===0)return null;const s=n[n.length-1];if(!Array.isArray(s)||s.length===0)return null;const i=s.length>1?Number(s[1]):Number(s[0]);return Number.isFinite(i)?i:null}catch{return null}}getLatestRealtimeTimestamp(){const t=this.segmentList.reduce((i,r)=>Number.isFinite(r==null?void 0:r.timestampMs)?Math.max(i,r.timestampMs):i,-1),n=this.pendingSentenceQueue.reduce((i,r)=>Number.isFinite(r.timestampMs)?Math.max(i,r.timestampMs):i,-1),s=Number.isFinite(this.lastOnlineTimestamp)?this.lastOnlineTimestamp:-1;return Math.max(t,n,s)}getRealtimeCarryoverTail(t,n=160){return(t||"").slice(-n)}buildRealtimeEditCarryover(t){const n=this.getRealtimeCarryoverTail(t);return n.length<4?null:{tailText:n}}trimOfflineTextWithCarryover(t){const n=t||"";if(!this.realtimeEditCarryover||!n)return n;const s=this.realtimeEditCarryover.tailText||"",i=4,r=Math.min(80,s.length,n.length);for(let o=r;o>=i;o--){const l=s.slice(-o),c=n.lastIndexOf(l);if(c===-1)continue;const h=n.slice(c+l.length);return this.realtimeEditCarryover.tailText=this.getRealtimeCarryoverTail(s+h),h}return this.realtimeEditCarryover=null,n}isStaleRealtimeMessage(t,n){return n!==this.liveTranscriptionEpoch?!0:Number.isFinite(t)&&this.realtimeTimestampBarrierMs>=0&&t<=this.realtimeTimestampBarrierMs}getPendingSentencePreviewText(){return this.pendingSentenceQueue.filter(t=>t.epoch===this.liveTranscriptionEpoch).map(t=>t.correctedText||t.rawText).join("")}syncRealtimePreview(){const t=this._deduplicateConsecutivePunctuation(this.getPendingSentencePreviewText()+this.offlineSentenceHandoffText+this.recTextOnline);this.onPreviewTextChange(t)}findPendingSentenceBySource(t,n,s){const i=t||"",r=n||"";return this.pendingSentenceQueue.find(o=>o.epoch===s&&o.sourceText===i&&o.timestamp===r)||this.segmentList.find(o=>o.epoch===s&&o.sourceText===i&&o.timestamp===r)||null}ensurePendingSentence(t,n,s){const i=this.extractTimestampMs(n);if(this.isStaleRealtimeMessage(i,s))return null;const r=this.findPendingSentenceBySource(t,n,s);if(r)return r;const o=this.trimOfflineTextWithCarryover(t||"");if(!o)return this.syncRealtimePreview(),null;const l={id:this.pendingSentenceSequence++,sourceText:t||"",rawText:o,timestamp:n||"",timestampMs:i,correctedText:"",processed:!1,correctionRequested:!1,epoch:s},c=this.pendingSentenceQueue.findIndex(h=>h.timestampMs>i);return c===-1?this.pendingSentenceQueue.push(l):this.pendingSentenceQueue.splice(c,0,l),this.syncRealtimePreview(),l}flushProcessedPendingSentences(){var n,s;let t=!1;for(;this.pendingSentenceQueue.length>0;){if(this.pendingSentenceQueue[0].epoch!==this.liveTranscriptionEpoch){this.pendingSentenceQueue.shift();continue}if(!this.pendingSentenceQueue[0].processed)break;const i=this.pendingSentenceQueue.shift(),o={text:i.correctedText||i.rawText||"",sourceText:i.sourceText,timestamp:i.timestamp,timestampMs:i.timestampMs,speaker:null,processed:!0,epoch:i.epoch},l=this.segmentList.findIndex(h=>h.timestampMs>o.timestampMs);l===-1?this.segmentList.push(o):this.segmentList.splice(l,0,o);const c=this.segmentList.indexOf(o);if(c>0){const u=(n=(this.segmentList[c-1].text||"").match(/[。!?.!?]+$/))==null?void 0:n[0],m=(s=o.text.match(/^[,。!?、;:,.!?;:]+/))==null?void 0:s[0];u&&m&&(o.text=o.text.replace(/^[,。!?、;:,.!?;:]+/,""))}t=!0}t?this.renderFullText():this.syncRealtimePreview()}finalizePendingSentence(t,n,s){const i=this.pendingSentenceQueue.find(o=>o.id===t&&o.epoch===s);if(!i)return;let r=n||i.rawText||"";r=this._deduplicateEndingPunctuation(r),i.correctedText=r,i.processed=!0,i.correctionRequested=!1,this.flushProcessedPendingSentences()}async _requestCorrection(t){const n=t.epoch;try{const s=await this.fetchImpl(this.correctUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t.rawText,scene:this.getScene()})});if(!s.ok)throw new Error("ASR correction failed");const r=(await s.json()).corrected_text||t.rawText;this.finalizePendingSentence(t.id,r,n)}catch(s){this.finalizePendingSentence(t.id,t.rawText,n),console.error("ASR correction failed:",s)}finally{this.setPendingCorrectionCount(this.pendingCorrectionCount-1)}}async finalizeRemainingSentences(t=8e3){const n=this.pendingSentenceQueue.filter(r=>r.epoch===this.liveTranscriptionEpoch&&!r.correctionRequested&&!r.processed);for(const r of n)r.correctionRequested=!0,this.setPendingCorrectionCount(this.pendingCorrectionCount+1),this._requestCorrection(r);const s=(this.recTextOnline||"")+(this.offlineSentenceHandoffText||"");if(s.trim()){const r=this.liveTranscriptionEpoch,o=this.getLatestRealtimeTimestamp()||Date.now(),l={id:this.pendingSentenceSequence++,sourceText:s,rawText:s,timestamp:"",timestampMs:o,correctedText:"",processed:!1,correctionRequested:!0,epoch:r};this.pendingSentenceQueue.push(l),this.setPendingCorrectionCount(this.pendingCorrectionCount+1),this._requestCorrection(l)}await this.waitForCorrections(t);const i=this.pendingSentenceQueue.filter(r=>r.epoch===this.liveTranscriptionEpoch&&!r.processed);for(const r of i)this.finalizePendingSentence(r.id,r.rawText,r.epoch),this.setPendingCorrectionCount(Math.max(0,this.pendingCorrectionCount-1));this.flushProcessedPendingSentences(),this.recTextOnline="",this.offlineSentenceHandoffText="",this.renderFullText(),this.syncRealtimePreview()}_deduplicateEndingPunctuation(t){var i;if(!t)return t;const n=/[。!?.!?]+$/,s=((i=t.match(n))==null?void 0:i[0])||"";if(s.length>=2){const r=s.slice(-1);return t.replace(n,r)}return t}_deduplicateConsecutivePunctuation(t){if(!t)return t;let n=t.replace(/([。!?.!?,、;:,;:])\s*\n\s*[。!?.!?,、;:,;:]/g,`$1 +**/const gh=Object.create(null);function Zg(e,t){if(!Ee(e))if(e.nodeType)e=e.innerHTML;else return Mt;const n=vw(e,t),s=gh[n];if(s)return s;if(e[0]==="#"){const l=document.querySelector(e);e=l?l.innerHTML:""}const i=Me({hoistStatic:!0,onError:void 0,onWarn:Mt},t);!i.isCustomElement&&typeof customElements<"u"&&(i.isCustomElement=l=>!!customElements.get(l));const{code:r}=I_(e,i),o=new Function("Vue",r)(B0);return o._rc=!0,gh[n]=o}Au(Zg);const N_=Object.freeze(Object.defineProperty({__proto__:null,BaseTransition:iu,BaseTransitionPropsValidators:Ha,Comment:at,DeprecationTypes:jm,EffectScope:Ia,ErrorCodes:tp,ErrorTypeStrings:Pm,Fragment:wt,KeepAlive:Cp,ReactiveEffect:_i,Static:hs,Suspense:mm,Teleport:hp,Text:qn,TrackOpTypes:Qh,Transition:Wm,TransitionGroup:tg,TriggerOpTypes:Yh,VueElement:Gr,assertNumber:ep,callWithAsyncErrorHandling:on,callWithErrorHandling:qs,camelize:Ge,capitalize:vs,cloneVNode:_n,compatUtils:Bm,compile:Zg,computed:zn,createApp:Sa,createBlock:Mr,createCommentVNode:Em,createElementBlock:wm,createElementVNode:Ka,createHydrationRenderer:bu,createPropsRestProxy:Kp,createRenderer:wu,createSSRApp:Bu,createSlots:Ip,createStaticVNode:_m,createTextVNode:Ja,createVNode:Je,customRef:tu,defineAsyncComponent:Ep,defineComponent:Ua,defineCustomElement:Pu,defineEmits:Fp,defineExpose:Dp,defineModel:jp,defineOptions:$p,defineProps:Lp,defineSSRCustomElement:Qm,defineSlots:Bp,devtools:Lm,effect:Oh,effectScope:Eh,getCurrentInstance:Wt,getCurrentScope:Jc,getCurrentWatcher:Xh,getTransitionRawChildren:Ur,guardReactiveProps:ku,h:Mu,handleError:ys,hasInjectionContext:Yp,hydrate:cg,hydrateOnIdle:wp,hydrateOnInteraction:_p,hydrateOnMediaQuery:Tp,hydrateOnVisible:bp,initCustomFormatter:Om,initDirectivesForSSR:dg,inject:bi,isMemoSame:Ou,isProxy:jr,isReactive:Wn,isReadonly:An,isRef:pt,isRuntimeOnly:Rm,isShallow:Yt,isVNode:On,markRaw:Zc,mergeDefaults:qp,mergeModels:zp,mergeProps:Ru,nextTick:Ss,normalizeClass:Di,normalizeProps:wh,normalizeStyle:Fi,onActivated:ou,onBeforeMount:lu,onBeforeUnmount:qr,onBeforeUpdate:Wa,onDeactivated:au,onErrorCaptured:du,onMounted:$i,onRenderTracked:fu,onRenderTriggered:uu,onScopeDispose:Ch,onServerPrefetch:cu,onUnmounted:zr,onUpdated:Wr,onWatcherCleanup:nu,openBlock:Ci,popScopeId:ap,provide:vu,proxyRefs:Da,pushScopeId:op,queuePostFlushCb:Ei,reactive:Br,readonly:Cr,ref:de,registerRuntimeCompiler:Au,render:$u,renderList:Op,renderSlot:Np,resolveComponent:xp,resolveDirective:Mp,resolveDynamicComponent:Ap,resolveFilter:$m,resolveTransitionHooks:Bs,setBlockTracking:ki,setDevtoolsHook:Fm,setTransitionHooks:Mn,shallowReactive:Xc,shallowReadonly:Vh,shallowRef:eu,ssrContextKey:_u,ssrUtils:Dm,stop:Ih,toDisplayString:Kc,toHandlerKey:Ps,toHandlers:Pp,toRaw:Pe,toRef:Jh,toRefs:Kh,toValue:zh,transformVNodeArgs:bm,triggerRef:qh,unref:Hr,useAttrs:Vp,useCssModule:Xm,useCssVars:Gm,useHost:Lu,useId:yp,useModel:dm,useSSRContext:Eu,useShadowRoot:Ym,useSlots:Up,useTemplateRef:Sp,useTransitionState:ja,vModelCheckbox:Ga,vModelDynamic:Du,vModelRadio:Qa,vModelSelect:Fu,vModelText:Or,vShow:Nu,version:Iu,warn:Nm,watch:wn,watchEffect:cm,watchPostEffect:um,watchSyncEffect:Cu,withAsyncContext:Jp,withCtx:Ba,withDefaults:Hp,withDirectives:cp,withKeys:rg,withMemo:Im,withModifiers:ig,withScopeId:lp},Symbol.toStringTag,{value:"Module"}));class P_{constructor(){var t;this.token=(t=document.querySelector('meta[name="csrf-token"]'))==null?void 0:t.getAttribute("content"),this.refreshPromise=null,this.setupFetchInterceptor()}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async performTokenRefresh(){try{console.log("Refreshing CSRF token...");const n=await(window.originalFetch||fetch)("/api/csrf-token",{method:"GET",credentials:"same-origin",headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`Failed to refresh CSRF token: ${n.status} ${n.statusText}`);const s=n.headers.get("content-type");if(!s||!s.includes("application/json")){const r=await n.text();throw new Error(`Expected JSON response but got ${s}. Response: ${r.substring(0,200)}`)}const i=await n.json();if(i.csrf_token){this.token=i.csrf_token;const r=document.querySelector('meta[name="csrf-token"]');return r&&r.setAttribute("content",this.token),window.app&&window.app.csrfToken!==void 0&&(window.app.csrfToken=this.token),console.log("CSRF token refreshed successfully"),this.token}else throw new Error("No CSRF token in response")}catch(t){throw console.error("Failed to refresh CSRF token:",t),t}}setupFetchInterceptor(){window.originalFetch||(window.originalFetch=window.fetch);const t=window.originalFetch,n=this;window.fetch=async function(s,i={}){if(s.includes("/api/csrf-token"))return t(s,i);const r={...i};(s.startsWith("/api/")||s.startsWith("/upload")||s.startsWith("/save")||s.startsWith("/recording/")||s.startsWith("/chat")||s.startsWith("/speakers"))&&(r.headers={"X-CSRFToken":n.token,...r.headers});let o=await t(s,r);if((o.status===400||o.status===403)&&(s.startsWith("/api/")||s.startsWith("/upload")||s.startsWith("/save")||s.startsWith("/recording/")||s.startsWith("/chat")||s.startsWith("/speakers")))try{const l=o.clone();let c=!1;try{const f=(await l.json()).error||"";c=f.toLowerCase().includes("csrf")||f.toLowerCase().includes("token")}catch{const f=await o.clone().text();c=f.toLowerCase().includes("csrf")||f.toLowerCase().includes("token")||f.includes("{window.csrfManager=new P_,setInterval(()=>{window.csrfManager&&(console.log("Performing periodic CSRF token refresh..."),window.csrfManager.manualRefresh())},45*60*1e3)});class L_{constructor(){this.translations={},this.currentLocale="en",this.fallbackLocale="en",this.loadedLocales=new Set}async init(t="en"){const n=localStorage.getItem("preferredLanguage"),s=navigator.language.split("-")[0];this.currentLocale=n||t||s||"en",await this.loadLocale(this.currentLocale),this.currentLocale!==this.fallbackLocale&&await this.loadLocale(this.fallbackLocale)}async loadLocale(t){if(!this.loadedLocales.has(t))try{const n=await fetch(`/tool/speakr/static/locales/${t}.json`);if(!n.ok)throw new Error(`Failed to load locale: ${t}`);const s=await n.json();this.translations[t]=s,this.loadedLocales.add(t),console.log(`Loaded locale: ${t}`)}catch(n){console.error(`Error loading locale ${t}:`,n),t!==this.fallbackLocale&&(console.log(`Failed to load ${t}, will use ${this.fallbackLocale} as fallback`),await this.loadLocale(this.fallbackLocale))}}async setLocale(t){await this.loadLocale(t),this.currentLocale=t,localStorage.setItem("preferredLanguage",t),window.dispatchEvent(new CustomEvent("localeChanged",{detail:{locale:t}}))}getLocale(){return this.currentLocale}getAvailableLocales(){return[{code:"en",name:"English",nativeName:"English"},{code:"es",name:"Spanish",nativeName:"Español"},{code:"fr",name:"French",nativeName:"Français"},{code:"zh",name:"Chinese",nativeName:"中文"}]}t(t,n={},s=null){const i=s||this.currentLocale;let r=this.getNestedTranslation(i,t);return!r&&i!==this.fallbackLocale&&(r=this.getNestedTranslation(this.fallbackLocale,t)),r?this.interpolate(r,n):(console.warn(`Translation not found for key: ${t}`),t)}getNestedTranslation(t,n){if(!this.translations[t])return null;const s=n.split(".");let i=this.translations[t];for(const r of s)if(i&&typeof i=="object"&&r in i)i=i[r];else return null;return typeof i=="string"?i:null}interpolate(t,n){return t.replace(/\{\{(\w+)\}\}/g,(s,i)=>n.hasOwnProperty(i)?n[i]:s)}tc(t,n,s={}){const i=n===1?t:`${t}Plural`;return this.t(i,{...s,count:n})}formatDate(t,n={}){const s=t instanceof Date?t:new Date(t);return new Intl.DateTimeFormat(this.currentLocale,n).format(s)}formatNumber(t,n={}){return new Intl.NumberFormat(this.currentLocale,n).format(t)}formatFileSize(t){const n=["bytes","kilobytes","megabytes","gigabytes"],s=[1,1024,1048576,1073741824];let i=0;for(let o=s.length-1;o>=0;o--)if(t>=s[o]){i=o;break}const r=Math.round(t/s[i]*10)/10;return this.t(`fileSize.${n[i]}`,{count:r})}formatDuration(t){if(t<60)return this.tc("duration.seconds",Math.round(t),{count:Math.round(t)});if(t<3600){const n=Math.round(t/60);return this.tc("duration.minutes",n,{count:n})}else{const n=Math.round(t/3600*10)/10;return this.tc("duration.hours",n,{count:n})}}formatRelativeTime(t){const n=t instanceof Date?t:new Date(t),i=Math.floor((new Date-n)/1e3);if(i<60)return this.t("time.justNow");if(i<3600){const r=Math.floor(i/60);return r===1?this.t("time.minuteAgo"):this.t("time.minutesAgo",{count:r})}else if(i<86400){const r=Math.floor(i/3600);return r===1?this.t("time.hourAgo"):this.t("time.hoursAgo",{count:r})}else if(i<604800){const r=Math.floor(i/86400);return r===1?this.t("time.dayAgo"):this.t("time.daysAgo",{count:r})}else if(i<2592e3){const r=Math.floor(i/604800);return r===1?this.t("time.weekAgo"):this.t("time.weeksAgo",{count:r})}else if(i<31536e3){const r=Math.floor(i/2592e3);return r===1?this.t("time.monthAgo"):this.t("time.monthsAgo",{count:r})}else{const r=Math.floor(i/31536e3);return r===1?this.t("time.yearAgo"):this.t("time.yearsAgo",{count:r})}}}const F_=new L_;typeof window<"u"&&(window.i18n=F_,window.i18n.t||(window.i18n.t=function(e,t){return console.warn("i18n.t called before initialization, returning key:",e),e}));const af=typeof window<"u"?window:globalThis,Oc=af.Recorder,dr=af.EasyMDE,ev=af.marked;function D_(){const e=[];Oc||e.push("Recorder"),dr||e.push("EasyMDE"),ev||e.push("marked"),e.length>0&&console.error(`Missing index vendor globals: ${e.join(", ")}`)}function $_(e,t="cg"){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/tool/speakr/ws/asr/live?mode=${encodeURIComponent(e||"online")}&scene=${encodeURIComponent(t||"cg")}`}function Ic(e){var t,n=e.msgHandle,s=e.stateHandle,i=e.getScene||(()=>"cg");let r="offline";var o=[],l=!1,c=1e3,h=500,f=0,u=null,m=null;function v(){if(o.length<=c)return!1;const C=o.length-c;return console.warn(`⚠️ 发送队列超过最大限制 (${c}),丢弃最旧的 ${C} 个数据包`),o=o.slice(-c),!0}function w(C){o.push(C),v(),o.length>h&&console.warn(`⚠️ WebSocket发送队列堆积: ${o.length} 个数据包待发送`)}this.wsStart=function(C){t&&t.close(),C==="2pass"?r="2pass":C==="offline"||C&&C!=="online"?r="offline":r="online";var V=$_(r,i());if(V.match(/wss:\S*|ws:\S*/))console.log("Uri"+V);else return alert("请检查wss地址正确性"),0;return"WebSocket"in window?(t=new WebSocket(V),t.onopen=function(F){M(F)},t.onclose=function(F){console.log("onclose ws!"),S()},t.onmessage=function(F){_(F)},t.onerror=function(F){x(F)},1):(alert("当前浏览器不支持 WebSocket"),0)};function b(){m&&(clearTimeout(m),m=null),u&&(u(),u=null)}function H(){if(t!=null){try{t.close()}catch(C){console.warn("Failed to close WebSocket",C)}t=void 0}o=[],l=!1}this.wsStop=function(){if(t!=null){console.log("stop ws!");try{t.readyState===1&&t.send(JSON.stringify({type:"stop",is_speaking:!1}))}catch(C){console.warn("Failed to send WebSocket stop frame",C)}}b(),H()},this.wsFinish=function(C=3e3){return t==null||t.readyState>=2?(b(),Promise.resolve()):(o=[],l=!1,new Promise(V=>{u=V,m=setTimeout(()=>{b()},C);try{t.readyState===1&&t.send(JSON.stringify({type:"stop",is_speaking:!1}))}catch(F){console.warn("Failed to send WebSocket finish frame",F),b()}}))};function P(){if(l||o.length===0||!t||t.readyState!==1)return;l=!0;const C=o.shift();try{t.send(C),l=!1,o.length>h&&console.warn(`⚠️ WebSocket发送队列堆积: ${o.length} 个数据包待发送`),o.length>0&&setTimeout(()=>P(),0)}catch(V){console.error("❌ WebSocket发送失败,数据已放回队列:",V),o.unshift(C),l=!1,v()}}this.wsSend=function(C){if(t==null)return w(C),!0;if(t.readyState===1){if(o.length>0)return w(C),P(),!0;try{return t.send(C),!0}catch(F){return console.error("❌ WebSocket直接发送失败,加入队列:",F),w(C),P(),!0}}else{if(t.readyState===0)return w(C),!0;var V=Date.now();return V-f>5e3&&(console.warn("⚠️ WebSocket未连接,数据无法发送 (state:",t.readyState,")"),f=V),!1}},this.getQueueStatus=function(){return{length:o.length,isSending:l,readyState:t?t.readyState:-1}};function M(C){console.log(C,"e"),console.log("WebSocket connected to backend ASR proxy"),s(0),o.length>0&&(console.log(`Processing ${o.length} queued audio chunks`),P())}function S(C){b(),t=void 0,s(1)}function _(C){n(C);try{const V=JSON.parse(C.data);(V&&V.type==="state"&&V.state==="closed"||V&&(V.mode==="2pass-offline"||V.mode==="offline-speaker"))&&b()}catch{}}function x(C){console.log(C),s(2)}}typeof window<"u"&&(window.WebSocketConnectMethod=Ic);const tc=960,B_=2e4,nc=16e3*5;function fi(){}function j_(e,t){const n=new Int16Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function H_(){const e=window.AudioContext||window.webkitAudioContext;return new e}class U_{constructor({getMicStream:t,getSystemStream:n,getPausedTranscription:s,setPausedTranscription:i,getShowSpeaker:r,getConfigWords:o,getScene:l=()=>"cg",getLastTimer:c,setLastTimer:h,onMainTextChange:f=fi,onPreviewTextChange:u=fi,onOfflineTextChange:m=fi,onActiveChange:v=fi,onPendingCorrectionCountChange:w=fi,onError:b=fi,fetchImpl:H=window.fetch.bind(window),correctUrl:P="/tool/speakr/api/asr/correct",sourceKind:M="mixed"}){this.getMicStream=t,this.getSystemStream=n,this.getPausedTranscription=s,this.setPausedTranscription=i,this.getShowSpeaker=r,this.getConfigWords=o,this.getScene=l,this.getLastTimer=c,this.setLastTimer=h,this.onMainTextChange=f,this.onPreviewTextChange=u,this.onOfflineTextChange=m,this.onActiveChange=v,this.onPendingCorrectionCountChange=w,this.onError=b,this.fetchImpl=H,this.correctUrl=P,this.sourceKind=M,this.wsOnline=null,this.wsOffline=null,this.recOnline=null,this.recOffline=null,this.audioContextOnline=null,this.audioContextOffline=null,this.sampleBufOnline=new Int16Array,this.sampleBufOffline=new Int16Array,this.segmentList=[],this.segmentRenderStartIndex=0,this.pendingSentenceQueue=[],this.pendingSentenceSequence=0,this.pendingCorrectionCount=0,this.recText="",this.recTextOnline="",this.offlineSentenceHandoffText="",this.lastOnlineTimestamp=null,this.liveTranscriptionEpoch=0,this.realtimeTimestampBarrierMs=-1,this.realtimeEditCarryover=null,this.editModeBufferStartIndex=0,this.active=!1,this.disposed=!1,this.createSockets()}createSockets(){this.wsOnline=new Ic({msgHandle:t=>this.handleOnlineMessage(t),stateHandle:t=>this.handleOnlineState(t),getScene:()=>this.getScene()}),this.wsOffline=new Ic({msgHandle:t=>this.handleOfflineMessage(t),stateHandle:t=>this.handleOfflineState(t),getScene:()=>this.getScene()})}start(){var n;this.disposed=!1;const t=((n=this.wsOnline)==null?void 0:n.wsStart("2pass"))===1;return this.setActive(t),t?1:0}stop(){var t,n;this.setActive(!1),(t=this.wsOnline)==null||t.wsStop(),(n=this.wsOffline)==null||n.wsStop(),this.closeRecorders()}async finish(t=3e3){var s,i;this.setActive(!1),this.closeRecorders();const n=[];this.wsOnline&&typeof this.wsOnline.wsFinish=="function"?n.push(this.wsOnline.wsFinish(t)):(s=this.wsOnline)==null||s.wsStop(),this.wsOffline&&typeof this.wsOffline.wsFinish=="function"?n.push(this.wsOffline.wsFinish(t)):(i=this.wsOffline)==null||i.wsStop(),n.length>0&&await Promise.allSettled(n)}dispose(){this.disposed=!0,this.stop(),this.wsOnline=null,this.wsOffline=null}isActive(){return this.active}setActive(t){this.active=t,this.onActiveChange(t)}setPendingCorrectionCount(t){this.pendingCorrectionCount=Math.max(0,t),this.onPendingCorrectionCountChange(this.pendingCorrectionCount)}getPendingCorrectionCount(){return this.pendingCorrectionCount}async waitForCorrections(t=8e3,n=200){const s=Date.now();for(;this.pendingCorrectionCount>0&&Date.now()-ssetTimeout(i,n));return this.pendingCorrectionCount}startNewEpoch({barrierTimestampMs:t=null,clearTimestampBarrier:n=!1,clearEditCarryover:s=!0}={}){this.liveTranscriptionEpoch+=1,s&&(this.realtimeEditCarryover=null),n?this.realtimeTimestampBarrierMs=-1:Number.isFinite(t)&&(this.realtimeTimestampBarrierMs=Math.max(this.realtimeTimestampBarrierMs,t)),this.clearRealtimePipeline({preserveTimestampBarrier:!n})}resetTranscript({clearTimestampBarrier:t=!1}={}){this.segmentList=[],this.segmentRenderStartIndex=0,this.setPendingCorrectionCount(0),this.startNewEpoch({clearTimestampBarrier:t})}prepareForResume(){this.segmentRenderStartIndex=this.segmentList.length,this.editModeBufferStartIndex=this.segmentList.length,this.sampleBufOnline=new Int16Array,this.sampleBufOffline=new Int16Array,this.recText="",this.recTextOnline="",this.offlineSentenceHandoffText="",this.pendingSentenceQueue=[],this.pendingSentenceSequence=0,this.lastOnlineTimestamp=null,this.onPreviewTextChange(""),this.onOfflineTextChange(""),this.liveTranscriptionEpoch+=1,this.renderFullText(),this.syncRealtimePreview()}enterEditMode(t){this.editModeBufferStartIndex=this.segmentList.length;const n=this.getLatestRealtimeTimestamp();this.startNewEpoch({barrierTimestampMs:n,clearEditCarryover:!1}),this.realtimeEditCarryover=this.buildRealtimeEditCarryover(t)}applyEditedText(t){this.setPausedTranscription(t),this.segmentRenderStartIndex=this.editModeBufferStartIndex,this.recText="",this.recTextOnline="",this.offlineSentenceHandoffText="",this.onPreviewTextChange(""),this.onOfflineTextChange(""),this.onMainTextChange(t),this.renderFullText()}ensureRecorders(){}closeRecorders(){if(this.recOnline){try{this.recOnline.close()}catch(t){console.warn("Failed to close online Recorder:",t)}this.recOnline=null}if(this.recOffline){try{this.recOffline.close()}catch(t){console.warn("Failed to close offline Recorder:",t)}this.recOffline=null}this.closeAudioContexts()}closeAudioContexts(){if(this.audioContextOnline){try{this.audioContextOnline.close()}catch{}this.audioContextOnline=null}if(this.audioContextOffline){try{this.audioContextOffline.close()}catch{}this.audioContextOffline=null}}handleOnlineState(t){t===0?this.openMixedStream("online"):t===2&&this.stop()}handleOfflineState(t){t===0?this.openMixedStream("offline"):t===2&&this.stop()}async openMixedStream(t){try{const n=t==="online"?await this.getMicrophoneInfo():null;n&&console.log("Current microphone:",n.name,n);const s=this.getMicStream(),i=this.getSystemStream(),r=s&&s.getAudioTracks().length>0,o=i&&i.getAudioTracks().length>0;if(this.sourceKind==="mic"&&!r)throw new Error("No microphone stream is available for realtime ASR.");if(this.sourceKind==="system"&&!o)throw new Error("No system audio stream is available for realtime ASR.");if(this.sourceKind==="mixed"&&!r&&!o)throw new Error("No audio stream is available for realtime ASR.");if(t==="online"&&this.audioContextOnline)try{this.audioContextOnline.close()}catch{}if(t==="offline"&&this.audioContextOffline)try{this.audioContextOffline.close()}catch{}const l=H_();t==="online"?this.audioContextOnline=l:this.audioContextOffline=l;const c=l.createMediaStreamDestination();(this.sourceKind==="mixed"||this.sourceKind==="mic")&&r&&l.createMediaStreamSource(s).connect(c),(this.sourceKind==="mixed"||this.sourceKind==="system")&&o?l.createMediaStreamSource(i).connect(c):this.sourceKind==="mixed"&&!r&&console.log("No system audio detected for realtime ASR.");const h=t==="online"?this.recOnline:this.recOffline;if(h)try{h.close()}catch{}const f=Oc({type:"pcm",bitRate:16,sampleRate:16e3,sourceStream:c.stream,onProcess:(...u)=>this.processRecorderFrame(t,...u)});t==="online"?this.recOnline=f:this.recOffline=f,f.open(()=>{f.start()},u=>{console.error("Recorder permission denied:",u),this.onError(u)})}catch(n){console.error("Failed to initialize realtime ASR recorder:",n),this.onError(n)}}processRecorderFrame(t,n,s,i,r){if(!this.active||this.disposed||!n||n.length===0)return;const o=n[n.length-1],l=Oc.SampleData([o],r,16e3).data,c=t==="online",h=c?this.wsOnline:this.wsOffline,f=c?"Online":"Offline";let u=c?this.sampleBufOnline:this.sampleBufOffline;if(u=j_(u,l),u.length>nc){const m=u.length-nc;console.warn(`[${f}] Dropping excess realtime ASR audio buffer: ${m} samples`),u=u.slice(-nc)}for(;u.length>=tc;){const m=u.slice(0,tc);if(!(h==null?void 0:h.wsSend(m)))break;u=u.slice(tc)}u.length>B_&&console.warn(`[${f}] Realtime ASR audio buffer is high: ${u.length} samples (${(u.length/16e3).toFixed(2)}s)`),c?this.sampleBufOnline=u:this.sampleBufOffline=u}async getMicrophoneInfo(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return console.warn("Browser does not support enumerating audio devices."),null;const n=(await navigator.mediaDevices.enumerateDevices()).filter(i=>i.kind==="audioinput"),s=n.find(i=>i.deviceId==="default")||n[0];return{name:(s==null?void 0:s.label)||"Unknown microphone",deviceId:(s==null?void 0:s.deviceId)||"",all:n.map(i=>({name:i.label,deviceId:i.deviceId}))}}clearRealtimePipeline({preserveTimestampBarrier:t=!1}={}){this.sampleBufOnline=new Int16Array,this.sampleBufOffline=new Int16Array,this.recText="",this.recTextOnline="",this.offlineSentenceHandoffText="",this.pendingSentenceQueue=[],this.pendingSentenceSequence=0,this.lastOnlineTimestamp=null,this.onPreviewTextChange(""),this.onOfflineTextChange(""),t||(this.realtimeTimestampBarrierMs=-1),this.syncRealtimePreview()}extractTimestampMs(t){if(!t)return null;try{const n=typeof t=="string"?JSON.parse(t):t;if(!Array.isArray(n)||n.length===0)return null;const s=n[n.length-1];if(!Array.isArray(s)||s.length===0)return null;const i=s.length>1?Number(s[1]):Number(s[0]);return Number.isFinite(i)?i:null}catch{return null}}getLatestRealtimeTimestamp(){const t=this.segmentList.reduce((i,r)=>Number.isFinite(r==null?void 0:r.timestampMs)?Math.max(i,r.timestampMs):i,-1),n=this.pendingSentenceQueue.reduce((i,r)=>Number.isFinite(r.timestampMs)?Math.max(i,r.timestampMs):i,-1),s=Number.isFinite(this.lastOnlineTimestamp)?this.lastOnlineTimestamp:-1;return Math.max(t,n,s)}getRealtimeCarryoverTail(t,n=160){return(t||"").slice(-n)}buildRealtimeEditCarryover(t){const n=this.getRealtimeCarryoverTail(t);return n.length<4?null:{tailText:n}}trimOfflineTextWithCarryover(t){const n=t||"";if(!this.realtimeEditCarryover||!n)return n;const s=this.realtimeEditCarryover.tailText||"",i=4,r=Math.min(80,s.length,n.length);for(let o=r;o>=i;o--){const l=s.slice(-o),c=n.lastIndexOf(l);if(c===-1)continue;const h=n.slice(c+l.length);return this.realtimeEditCarryover.tailText=this.getRealtimeCarryoverTail(s+h),h}return this.realtimeEditCarryover=null,n}isStaleRealtimeMessage(t,n){return n!==this.liveTranscriptionEpoch?!0:Number.isFinite(t)&&this.realtimeTimestampBarrierMs>=0&&t<=this.realtimeTimestampBarrierMs}getPendingSentencePreviewText(){return this.pendingSentenceQueue.filter(t=>t.epoch===this.liveTranscriptionEpoch).map(t=>t.correctedText||t.rawText).join("")}syncRealtimePreview(){const t=this._deduplicateConsecutivePunctuation(this.recTextOnline);this.onPreviewTextChange(t)}findPendingSentenceBySource(t,n,s){const i=t||"",r=n||"";return this.pendingSentenceQueue.find(o=>o.epoch===s&&o.sourceText===i&&o.timestamp===r)||this.segmentList.find(o=>o.epoch===s&&o.sourceText===i&&o.timestamp===r)||null}ensurePendingSentence(t,n,s){const i=this.extractTimestampMs(n);if(this.isStaleRealtimeMessage(i,s))return null;const r=this.findPendingSentenceBySource(t,n,s);if(r)return r;const o=this.trimOfflineTextWithCarryover(t||"");if(!o)return this.syncRealtimePreview(),null;const l={id:this.pendingSentenceSequence++,sourceText:t||"",rawText:o,timestamp:n||"",timestampMs:i,correctedText:"",processed:!1,correctionRequested:!1,epoch:s},c=this.pendingSentenceQueue.findIndex(h=>h.timestampMs>i);return c===-1?this.pendingSentenceQueue.push(l):this.pendingSentenceQueue.splice(c,0,l),this.syncRealtimePreview(),l}flushProcessedPendingSentences(){var n,s;let t=!1;for(;this.pendingSentenceQueue.length>0;){if(this.pendingSentenceQueue[0].epoch!==this.liveTranscriptionEpoch){this.pendingSentenceQueue.shift();continue}if(!this.pendingSentenceQueue[0].processed)break;const i=this.pendingSentenceQueue.shift(),o={text:i.correctedText||i.rawText||"",sourceText:i.sourceText,timestamp:i.timestamp,timestampMs:i.timestampMs,speaker:null,processed:!0,epoch:i.epoch},l=this.segmentList.findIndex(h=>h.timestampMs>o.timestampMs);l===-1?this.segmentList.push(o):this.segmentList.splice(l,0,o);const c=this.segmentList.indexOf(o);if(c>0){const u=(n=(this.segmentList[c-1].text||"").match(/[。!?.!?]+$/))==null?void 0:n[0],m=(s=o.text.match(/^[,。!?、;:,.!?;:]+/))==null?void 0:s[0];u&&m&&(o.text=o.text.replace(/^[,。!?、;:,.!?;:]+/,""))}t=!0}t?this.renderFullText():this.syncRealtimePreview()}finalizePendingSentence(t,n,s){const i=this.pendingSentenceQueue.find(o=>o.id===t&&o.epoch===s);if(!i)return;let r=n||i.rawText||"";r=this._deduplicateEndingPunctuation(r),i.correctedText=r,i.processed=!0,i.correctionRequested=!1,this.flushProcessedPendingSentences()}async _requestCorrection(t){const n=t.epoch;try{const s=await this.fetchImpl(this.correctUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t.rawText,scene:this.getScene()})});if(!s.ok)throw new Error("ASR correction failed");const r=(await s.json()).corrected_text||t.rawText;this.finalizePendingSentence(t.id,r,n)}catch(s){this.finalizePendingSentence(t.id,t.rawText,n),console.error("ASR correction failed:",s)}finally{this.setPendingCorrectionCount(this.pendingCorrectionCount-1)}}async finalizeRemainingSentences(t=8e3){const n=this.pendingSentenceQueue.filter(r=>r.epoch===this.liveTranscriptionEpoch&&!r.correctionRequested&&!r.processed);for(const r of n)r.correctionRequested=!0,this.setPendingCorrectionCount(this.pendingCorrectionCount+1),this._requestCorrection(r);const s=(this.recTextOnline||"")+(this.offlineSentenceHandoffText||"");if(s.trim()){const r=this.liveTranscriptionEpoch,o=this.getLatestRealtimeTimestamp()||Date.now(),l={id:this.pendingSentenceSequence++,sourceText:s,rawText:s,timestamp:"",timestampMs:o,correctedText:"",processed:!1,correctionRequested:!0,epoch:r};this.pendingSentenceQueue.push(l),this.setPendingCorrectionCount(this.pendingCorrectionCount+1),this._requestCorrection(l)}await this.waitForCorrections(t);const i=this.pendingSentenceQueue.filter(r=>r.epoch===this.liveTranscriptionEpoch&&!r.processed);for(const r of i)this.finalizePendingSentence(r.id,r.rawText,r.epoch),this.setPendingCorrectionCount(Math.max(0,this.pendingCorrectionCount-1));this.flushProcessedPendingSentences(),this.recTextOnline="",this.offlineSentenceHandoffText="",this.renderFullText(),this.syncRealtimePreview()}_deduplicateEndingPunctuation(t){var i;if(!t)return t;const n=/[。!?.!?]+$/,s=((i=t.match(n))==null?void 0:i[0])||"";if(s.length>=2){const r=s.slice(-1);return t.replace(n,r)}return t}_deduplicateConsecutivePunctuation(t){if(!t)return t;let n=t.replace(/([。!?.!?,、;:,;:])\s*\n\s*[。!?.!?,、;:,;:]/g,`$1 `);return n=n.replace(/([。!?.!?,、;:,;:])(?:[。!?.!?,、;:,;:])+/g,"$1"),n}handleWithTimestamp(t,n,s,i,r=""){if(!n||t.length<=0)return t;const l=(s||"").split(",").map(v=>v.trim()).filter(v=>v.length>0).map(v=>new RegExp(v)),c=t.match(/[^。!?.!?]+[。!?.!?]?/g)||[],h=JSON.parse(n);let f=0,u="";const m=v=>v.replace(/^[,。!?、;:,\.!?;:]+/,"");for(let v=0;v0&&b-H>i){const P=u.slice(-1)||r,M=/[。!?.!?,、;:,;:]/.test(P),S=m(w),_=/^[,。!?、;:,.!?;:]+/.test(S);u+=(M||_?` `:`。 `)+S}else l.some(M=>M.test(w))||(u+=w);this.setLastTimer(b),f++}return u}getSpeakerBeforeIndex(t){let n=null;for(let s=0;s{this.getShowSpeaker()&&(o.speaker&&o.speaker!==i&&!o.speaker.includes("SPK")||o.speaker&&o.speaker!==i)&&(s+=(s?` `:"")+o.speaker+`: -`,i=o.speaker);const l=this.handleWithTimestamp(o.text,o.timestamp,this.getConfigWords(),6,r);s+=l;const c=l.replace(/\s+$/,"");c.length>0&&(r=c.slice(-1))}),s}renderFullText(){const t=this.segmentRenderStartIndex>0?this.getSpeakerBeforeIndex(this.segmentRenderStartIndex):null,n=this.buildSegmentText(this.segmentList.slice(this.segmentRenderStartIndex),t);this.recText=n;const s=this._deduplicateConsecutivePunctuation(this.getPausedTranscription()+this.recText);this.onMainTextChange(s),this.syncRealtimePreview()}handleOnlineMessage(t){if(this.disposed)return;const n=JSON.parse(t.data),s=""+n.text,i=n.mode,r=n.timestamp,o=this.liveTranscriptionEpoch;if(i==="2pass-online"){const l=this.extractTimestampMs(r);if(this.isStaleRealtimeMessage(l,o)){this.syncRealtimePreview();return}let c=!1;this.lastOnlineTimestamp!==null&&l!==null&&(l-this.lastOnlineTimestamp)/1e3>=3&&/。\s*$/.test(s)&&(c=!0),n.is_full_text?this.recTextOnline=c?s+` +`,i=o.speaker);const l=this.handleWithTimestamp(o.text,o.timestamp,this.getConfigWords(),6,r);s+=l;const c=l.replace(/\s+$/,"");c.length>0&&(r=c.slice(-1))}),s}renderFullText(){const t=this.segmentRenderStartIndex>0?this.getSpeakerBeforeIndex(this.segmentRenderStartIndex):null,n=this.buildSegmentText(this.segmentList.slice(this.segmentRenderStartIndex),t);this.recText=n;const s=this._deduplicateConsecutivePunctuation(this.getPausedTranscription()+this.recText);this.onMainTextChange(s),this.syncRealtimePreview()}handleOnlineMessage(t){if(this.disposed)return;const n=JSON.parse(t.data),s=""+n.text,i=n.mode,r=n.timestamp,o=this.liveTranscriptionEpoch;if(i==="2pass-online"||i==="online"){const l=this.extractTimestampMs(r);if(this.isStaleRealtimeMessage(l,o)){this.syncRealtimePreview();return}let c=!1;this.lastOnlineTimestamp!==null&&l!==null&&(l-this.lastOnlineTimestamp)/1e3>=3&&/。\s*$/.test(s)&&(c=!0),n.is_full_text?this.recTextOnline=c?s+` `:s:this.recTextOnline+=c?s+` -`:s,this.lastOnlineTimestamp=l}else i==="2pass-offline"&&(this.recTextOnline="",this.offlineSentenceHandoffText=s||this.recTextOnline||"",this.recTextOnline="",this.lastOnlineTimestamp=null);this.syncRealtimePreview()}async handleOfflineMessage(t){if(this.disposed)return;const n=JSON.parse(t.data),s=n.mode,i=n.timestamp,r=this.liveTranscriptionEpoch,o=this.extractTimestampMs(i);if(s==="2pass-offline"){if(this.isStaleRealtimeMessage(o,r))return;const l=""+n.text;this.recTextOnline="",this.lastOnlineTimestamp=null;const c=this.ensurePendingSentence(l,i,r);if(this.offlineSentenceHandoffText="",this.syncRealtimePreview(),!c||c.processed||c.correctionRequested)return;c.correctionRequested=!0,this.setPendingCorrectionCount(this.pendingCorrectionCount+1),await this._requestCorrection(c)}else if(s==="offline-speaker"){if(this.isStaleRealtimeMessage(o,r))return;const l=n.segments&&n.segments[0]&&n.segments[0].speaker||"未命名演讲者";let c=-1;for(let h=this.segmentList.length-1;h>=0;h--){const f=this.segmentList[h];if(!(!f||f.epoch!==r)){if(f.speaker===null&&Number.isFinite(o)&&Number.isFinite(f.timestampMs)&&f.timestampMs===o){c=h;break}c===-1&&f.speaker===null&&(c=h)}}c!==-1&&(this.segmentList[c].speaker=l,this.renderFullText())}}}function V_({recordings:e,selectedRecording:t,selectedTab:n,uploadQueue:s,currentlyProcessingFile:i,processingProgress:r,processingMessage:o,progressPopupMinimized:l,progressPopupClosed:c,identifiedSpeakers:h,processedTranscription:f,showToast:u,setGlobalError:m,resetCurrentFileProcessingState:v,speakerMap:w,highlightedSpeaker:b,showSpeakerModal:H,showResetModal:P,showReprocessModal:M,showTextEditorModal:S,showAsrEditorModal:_,editingTranscriptionContent:x,editingSegments:C,availableSpeakers:V,speakerDisplayMap:F,modalSpeakers:R,regenerateSummaryAfterSpeakerUpdate:N,speakerSuggestions:B,loadingSuggestions:A,activeSpeakerInput:K,isAutoIdentifying:re,currentSpeakerGroupIndex:oe,speakerGroups:J,recordingToReset:fe,reprocessType:Z,reprocessRecording:Ae,asrReprocessOptions:ft}){const _e=de(new Map),He=zn(()=>{var E;return(E=f.value)!=null&&E.speakers?f.value.speakers:[]}),ie=zn(()=>Object.values(w.value).some(E=>E.name&&E.name.trim()!=="")),ne=zn(()=>{var Q;if(!((Q=t.value)!=null&&Q.transcription))return"";let E=t.value.transcription;E=E.replace(//g,">"),E=E.replace(/\n/g,"
");const D={};return w.value&&Object.keys(w.value).forEach((te,le)=>{D[te]=w.value[te].color||`speaker-color-${le%8+1}`}),E=E.replace(/\[([^\]]+)\]/g,(te,le)=>{var Ze;const Re=le===b.value,Oe=D[le]||"",qe=`[${((Ze=w.value[le])==null?void 0:Ze.name)||le}]`;return`${qe}`}),E}),he=E=>{const D=e.value.find(Q=>Q.id===E)||t.value;Qe("transcription",D)},Se=E=>{const D=e.value.find(Q=>Q.id===E)||t.value;Qe("summary",D)},Qe=(E,D)=>{Z.value=E,Ae.value=D,M.value=!0},Ye=()=>{M.value=!1,Z.value=null,Ae.value=null},mn=async()=>{if(!Ae.value||!Z.value)return;const E=Ae.value.id,D=Z.value;Ye(),D==="transcription"?await Zt(E,ft.value.language,ft.value.min_speakers,ft.value.max_speakers):D==="summary"&&await In(E)},Zt=async(E,D,Q,te)=>{var le;if(!E){m("No recording ID provided for reprocessing.");return}try{const Re={language:D,min_speakers:Q,max_speakers:te},Oe=await fetch(`/tool/speakr/recording/${E}/reprocess_transcription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Re)}),Xe=await Oe.json();if(!Oe.ok)throw new Error(Xe.error||"Failed to start transcription reprocessing");Xe.recording&&Xe.recording.status!=="PROCESSING"&&(console.warn(`Warning: Reprocess transcription returned unexpected status: ${Xe.recording.status}`),Xe.recording.status="PROCESSING");const qe=e.value.findIndex(Ze=>Ze.id===E);qe!==-1&&(e.value[qe]=Xe.recording),((le=t.value)==null?void 0:le.id)===E&&(t.value=Xe.recording),u("Transcription reprocessing started","fa-sync-alt"),n.value="summary",En(E,"transcription"),g(E)}catch(Re){console.error("Reprocess Transcription Error:",Re),m(`Failed to start transcription reprocessing: ${Re.message}`)}},In=async E=>{var D;if(!E){m("No recording ID provided for reprocessing.");return}try{const Q=await fetch(`/tool/speakr/recording/${E}/reprocess_summary`,{method:"POST",headers:{"Content-Type":"application/json"}}),te=await Q.json();if(!Q.ok)throw new Error(te.error||"Failed to start summary reprocessing");te.recording&&te.recording.status!=="SUMMARIZING"&&(console.warn(`Warning: Reprocess summary returned unexpected status: ${te.recording.status}`),te.recording.status="SUMMARIZING");const le=e.value.findIndex(Re=>Re.id===E);le!==-1&&(e.value[le]=te.recording),((D=t.value)==null?void 0:D.id)===E&&(t.value=te.recording),u("Summary reprocessing started","fa-sync-alt"),n.value="summary",En(E,"summary"),g(E)}catch(Q){console.error("Reprocess Summary Error:",Q),m(`Failed to start summary reprocessing: ${Q.message}`)}},En=(E,D)=>{const Q=e.value.find(le=>le.id===E);if(!Q)return;const te={file:{name:Q.title||`Recording ${E}`,size:Q.file_size||0},status:"pending",recordingId:E,clientId:`reprocess-${D}-${E}-${Date.now()}`,error:null,isReprocessing:!0,reprocessType:D};s.value.unshift(te),l.value=!1,c.value=!1,i.value=te,r.value=10,o.value=D==="transcription"?"Starting transcription reprocessing...":"Starting summary reprocessing..."},g=E=>{_e.value.has(E)&&clearInterval(_e.value.get(E));const D=setInterval(async()=>{var Q,te,le;try{const Re=await fetch(`/tool/speakr/status/${E}`);if(!Re.ok){console.error(`Status check failed for recording ${E}`),I(E);return}const Oe=await Re.json(),Xe=e.value.findIndex(Ze=>Ze.id===E);Xe!==-1&&(e.value[Xe]=Oe),((Q=t.value)==null?void 0:Q.id)===E&&(t.value=Oe);const qe=s.value.find(Ze=>Ze.recordingId===E);qe&&(qe.status=Oe.status,qe.displayName=Oe.title||Oe.original_filename||qe.file.name),qe&&((te=i.value)==null?void 0:te.clientId)===qe.clientId&&T(Oe.status,qe),(Oe.status==="COMPLETED"||Oe.status==="FAILED")&&(console.log(`Reprocessing ${Oe.status.toLowerCase()} for recording ${E}`),I(E),qe&&(qe.status=Oe.status==="COMPLETED"?"completed":"failed",Oe.status==="FAILED"&&(qe.error=Oe.error_message||"Reprocessing failed")),((le=i.value)==null?void 0:le.recordingId)===E&&v(),Oe.status==="COMPLETED"?u("Reprocessing completed successfully","fa-check-circle"):u("Reprocessing failed","fa-exclamation-circle"))}catch(Re){console.error(`Error polling status for recording ${E}:`,Re),I(E)}},3e3);_e.value.set(E,D)},T=(E,D)=>{switch(E){case"PENDING":r.value=20,o.value=`Waiting to start ${D.reprocessType} reprocessing...`;break;case"PROCESSING":r.value=Math.round(Math.min(70,r.value+Math.random()*10)),o.value=D.reprocessType==="transcription"?"Reprocessing transcription...":"Processing audio...";break;case"SUMMARIZING":r.value=Math.round(Math.min(90,r.value+Math.random()*10)),o.value=D.reprocessType==="summary"?"Regenerating summary...":"Generating title and summary...";break;case"COMPLETED":r.value=100,o.value="Reprocessing completed!";break;case"FAILED":r.value=100,o.value="Reprocessing failed.";break;default:r.value=15,o.value="Starting reprocessing..."}},I=E=>{_e.value.has(E)&&(clearInterval(_e.value.get(E)),_e.value.delete(E),console.log(`Stopped reprocessing poll for recording ${E}`))},j=async()=>{var E;if(t.value)try{const D=(E=document.querySelector('meta[name="csrf-token"]'))==null?void 0:E.getAttribute("content"),Q=await fetch(`/tool/speakr/recording/${t.value.id}/generate_summary`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":D}}),te=await Q.json();if(!Q.ok)throw new Error(te.error||"Failed to generate summary");t.value.status="SUMMARIZING";const le=e.value.find(Re=>Re.id===t.value.id);le&&(le.status="SUMMARIZING"),u("Summary generation started","success")}catch(D){console.error("Error generating summary:",D),m(`Failed to generate summary: ${D.message}`)}},U=async E=>{var Q;const D=e.value.find(te=>te.id===E);if(D)try{const te=await fetch(`/tool/speakr/recording/${D.id}/reset_status`,{method:"POST",headers:{"Content-Type":"application/json"}}),le=await te.json();if(!te.ok)throw new Error(le.error||"Failed to reset status");const Re=e.value.findIndex(Oe=>Oe.id===D.id);Re!==-1&&(e.value[Re]=le.recording),((Q=t.value)==null?void 0:Q.id)===D.id&&(t.value=le.recording),u("Recording status has been reset.","fa-check-circle")}catch(te){m(`Failed to reset status: ${te.message}`)}},W=E=>{fe.value=E,P.value=!0},G=()=>{P.value=!1,fe.value=null},z=async()=>{var D;if(!fe.value)return;const E=fe.value.id;G();try{const Q=await fetch(`/tool/speakr/recording/${E}/reset_status`,{method:"POST",headers:{"Content-Type":"application/json"}}),te=await Q.json();if(!Q.ok)throw new Error(te.error||"Failed to reset status");const le=e.value.findIndex(Re=>Re.id===E);le!==-1&&(e.value[le]=te.recording),((D=t.value)==null?void 0:D.id)===E&&(t.value=te.recording),u("Recording status has been reset.","fa-check-circle")}catch(Q){console.error("Reset Status Error:",Q),m(`Failed to reset status: ${Q.message}`)}},q=()=>{f.value.isJson?pe():$()},$=()=>{t.value&&(x.value=t.value.transcription,S.value=!0)},ae=()=>{S.value=!1,x.value=""},Y=async()=>{t.value&&(await ws(x.value),ae())},pe=async()=>{if(t.value)try{const E=JSON.parse(t.value.transcription);C.value=E.map((Re,Oe)=>({...Re,id:Oe,showSuggestions:!1,filteredSpeakers:[]}));const D=[...new Set(E.map(Re=>Re.speaker))],le=(await(await fetch("/tool/speakr/speakers")).json()).map(Re=>Re.name);V.value=[...new Set([...D,...le])].sort(),_.value=!0}catch(E){console.error("Could not parse transcription as JSON for ASR editor:",E),m("This transcription is not in the correct format for the ASR editor.")}},ye=()=>{_.value=!1,C.value=[],V.value=[]},xe=async()=>{const E=JSON.stringify(C.value.map(({id:D,showSuggestions:Q,filteredSpeakers:te,...le})=>le));await ws(E),ye()},Le=(E,D,Q)=>{C.value[E]&&(C.value[E][D]=parseFloat((C.value[E][D]+Q).toFixed(3)))},Ce=E=>{const D=C.value[E];if(D){const Q=D.speaker.toLowerCase();D.filteredSpeakers=V.value.filter(te=>te.toLowerCase().includes(Q))}},_t=E=>{C.value[E]&&(C.value[E].showSuggestions=!0,Ce(E))},We=E=>{C.value[E]&&window.setTimeout(()=>{C.value[E]&&(C.value[E].showSuggestions=!1)},200)},lt=(E,D)=>{C.value[E]&&(C.value[E].speaker=D,C.value[E].showSuggestions=!1)},st=()=>{const E=C.value[C.value.length-1];C.value.push({id:Date.now(),speaker:E?E.speaker:"SPEAKER_00",start_time:E?E.end_time:0,end_time:E?E.end_time+1:1,sentence:""})},gn=E=>{C.value.splice(E,1)},ws=async E=>{if(t.value)try{const D=await fetch(`/tool/speakr/recording/${t.value.id}/update_transcription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({transcription:E})}),Q=await D.json();if(!D.ok)throw new Error(Q.error||"Failed to update transcription");const te=e.value.findIndex(le=>le.id===t.value.id);te!==-1&&(e.value[te]=Q.recording),t.value=Q.recording,u("Transcription updated successfully!","fa-check-circle")}catch(D){console.error("Save Transcription Error:",D),m(`Failed to save transcription: ${D.message}`)}},Ct=async(E,D)=>{if(!E||E.length<2){B.value[D]=[];return}A.value[D]=!0;try{const Q=await fetch(`/tool/speakr/speakers/search?q=${encodeURIComponent(E)}`);if(!Q.ok)throw new Error("Failed to search speakers");const te=await Q.json();B.value[D]=te}catch(Q){console.error("Error searching speakers:",Q),B.value[D]=[]}finally{A.value[D]=!1}},qt=(E,D)=>{w.value[E]&&(w.value[E].name=D.name,B.value[E]=[])},bs=E=>{const D=E.target.closest('input[type="text"]'),Q=E.target.closest(".absolute.z-10");!D&&!Q&&Object.keys(B.value).forEach(te=>{B.value[te]=[]})},Ts=()=>{var Q;w.value={},F.value={};const E=(Q=t.value)==null?void 0:Q.transcription;let D=[];if(E)try{const te=JSON.parse(E);te&&Array.isArray(te)&&(D=[...new Set(te.map(le=>le.speaker).filter(Boolean))])}catch{D=h.value}R.value=D,w.value=D.reduce((te,le,Re)=>(te[le]={name:"",isMe:!1,color:`speaker-color-${Re%8+1}`},F.value[le]=le,te),{}),b.value=null,B.value={},A.value={},re.value=!1,H.value=!0},Bi=()=>{if(H.value=!1,b.value=null,w.value={},B.value={},A.value={},window.speakerModalClickHandler){const E=document.querySelector(".modal-content");E&&E.removeEventListener("click",window.speakerModalClickHandler),delete window.speakerModalClickHandler}},cn=async()=>{if(!t.value)return;const E=Object.entries(w.value).reduce((D,[Q,te])=>(te.name&&te.name.trim()!==""&&(D[Q]=te),D),{});try{const D=await fetch(`/tool/speakr/recording/${t.value.id}/update_speakers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({speaker_map:E,regenerate_summary:N.value})}),Q=await D.json();if(!D.ok)throw new Error(Q.error||"Failed to update speakers");Bi();const te=e.value.findIndex(le=>le.id===t.value.id);te!==-1&&(e.value[te]=Q.recording),t.value=Q.recording,u("Speaker names updated successfully!","fa-check-circle"),N.value&&g(t.value.id)}catch(D){console.error("Save Speaker Names Error:",D),m(`Failed to save speaker names: ${D.message}`)}},Bt=E=>{if(!E)return[];const D=[],Q=document.querySelector("div.speaker-modal-transcript"),te=document.querySelector(".transcription-simple-view, .transcription-with-speakers, .transcription-content"),le=Q||te;if(!le)return[];const Re=le.querySelectorAll(".speaker-segment");if(Re.length>0){let Oe=null,Xe=null;Re.forEach(qe=>{const Ze=qe.querySelector("[data-speaker-id]"),Ks=Ze==null?void 0:Ze.dataset.speakerId;Ks===E&&(Xe!==E?(Oe={startElement:qe,elements:[qe]},D.push(Oe)):Oe&&Oe.elements.push(qe)),Xe=Ks})}else{const Oe=le.querySelectorAll("[data-speaker-id]");let Xe=null;Oe.forEach(qe=>{if(qe.dataset.speakerId===E){const Ze=qe.closest(".speaker-segment")||qe.parentElement;!Xe||!Xe.lastElement||!Ze.previousElementSibling||Ze.previousElementSibling!==Xe.lastElement?(Xe={startElement:Ze,elements:[Ze],lastElement:Ze},D.push(Xe)):(Xe.elements.push(Ze),Xe.lastElement=Ze)}})}return D},vn=async E=>{if(b.value=E,E){if(await Ss(),J.value=Bt(E),oe.value=0,J.value.length>0){const D=J.value[0];D&&D.startElement&&D.startElement.scrollIntoView({behavior:"smooth",block:"center"})}}else J.value=[],oe.value=-1},ji=()=>{if(J.value.length===0)return;oe.value=(oe.value+1)%J.value.length;const E=J.value[oe.value];E&&E.startElement&&E.startElement.scrollIntoView({behavior:"smooth",block:"center"})},zs=()=>{if(J.value.length===0)return;oe.value=oe.value<=0?J.value.length-1:oe.value-1;const E=J.value[oe.value];E&&E.startElement&&E.startElement.scrollIntoView({behavior:"smooth",block:"center"})},il=E=>{K.value=E,b.value!==E&&vn(E)},_s=()=>{setTimeout(()=>{K.value=null,B.value={}},200),Yn()},Yn=()=>{b.value=null};return{showReprocessModal:M,reprocessType:Z,reprocessRecording:Ae,asrReprocessOptions:ft,showTextEditorModal:S,editingTranscriptionContent:x,showAsrEditorModal:_,editingSegments:C,availableSpeakers:V,showSpeakerModal:H,speakerMap:w,speakerDisplayMap:F,modalSpeakers:R,regenerateSummaryAfterSpeakerUpdate:N,speakerSuggestions:B,loadingSuggestions:A,activeSpeakerInput:K,isAutoIdentifying:re,highlightedSpeaker:b,currentSpeakerGroupIndex:oe,speakerGroups:J,recordingToReset:fe,showResetModal:P,identifiedSpeakersInOrder:He,hasSpeakerNames:ie,highlightedTranscript:ne,reprocessTranscription:he,reprocessSummary:Se,confirmReprocess:Qe,cancelReprocess:Ye,executeReprocess:mn,openTranscriptionEditor:q,openTextEditorModal:$,closeTextEditorModal:ae,saveTranscription:Y,openAsrEditorModal:pe,closeAsrEditorModal:ye,saveAsrTranscription:xe,adjustTime:Le,filterSpeakers:Ce,openSpeakerSuggestions:_t,closeSpeakerSuggestions:We,selectSpeaker:lt,addSegment:st,removeSegment:gn,searchSpeakers:Ct,selectSpeakerSuggestion:qt,closeSpeakerSuggestionsOnClick:bs,openSpeakerModal:Ts,closeSpeakerModal:Bi,saveSpeakerNames:cn,highlightSpeakerInTranscript:vn,focusSpeaker:il,blurSpeaker:_s,clearSpeakerHighlight:Yn,navigateToNextSpeakerGroup:ji,navigateToPrevSpeakerGroup:zs,autoIdentifySpeakers:async()=>{if(!t.value){u("No recording selected.","fa-exclamation-circle");return}re.value=!0,u("Starting automatic speaker identification...","fa-magic");try{const E=await fetch(`/tool/speakr/recording/${t.value.id}/auto_identify_speakers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({current_speaker_map:w.value})}),D=await E.json();if(!E.ok)throw new Error(D.error||"Unknown error occurred during auto-identification.");if(D.message){u(D.message,"fa-info-circle");return}let Q=0;for(const te in D.speaker_map){const le=D.speaker_map[te];w.value[te]&&le&&le.trim()!==""&&(w.value[te].name=le,Q++)}Q>0?u(`${Q} speaker(s) identified successfully!`,"fa-check-circle"):u("No speakers could be identified from the context.","fa-info-circle")}catch(E){console.error("Auto Identify Speakers Error:",E),u(`Error: ${E.message}`,"fa-exclamation-circle",5e3)}finally{re.value=!1}},generateSummary:j,resetRecordingStatus:U,confirmReset:W,cancelReset:G,executeReset:z,toggleInbox:async E=>{if(!(!E||!E.id))try{const D=await fetch(`/tool/speakr/recording/${E.id}/toggle_inbox`,{method:"POST",headers:{"Content-Type":"application/json"}}),Q=await D.json();if(!D.ok)throw new Error(Q.error||"Failed to toggle inbox status");E.is_inbox=Q.is_inbox;const te=e.value.findIndex(le=>le.id===E.id);te!==-1&&(e.value[te].is_inbox=Q.is_inbox),u(`Recording ${Q.is_inbox?"moved to inbox":"marked as read"}`)}catch(D){console.error("Toggle Inbox Error:",D),m(`Failed to toggle inbox status: ${D.message}`)}},toggleHighlight:async E=>{if(!(!E||!E.id))try{const D=await fetch(`/tool/speakr/recording/${E.id}/toggle_highlight`,{method:"POST",headers:{"Content-Type":"application/json"}}),Q=await D.json();if(!D.ok)throw new Error(Q.error||"Failed to toggle highlighted status");E.is_highlighted=Q.is_highlighted;const te=e.value.findIndex(le=>le.id===E.id);te!==-1&&(e.value[te].is_highlighted=Q.is_highlighted),u(`Recording ${Q.is_highlighted?"highlighted":"unhighlighted"}`)}catch(D){console.error("Toggle Highlight Error:",D),m(`Failed to toggle highlighted status: ${D.message}`)}},startReprocessingPoll:g,stopReprocessingPoll:I}}const W_=de(!1),tv=de(!1),q_=de(!1),z_=de(!1),os=de(null),tl=de([]),lf=de(null),nl=de(0),rn=de(null),K_=de(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),J_=de(!1),G_=de(!1),Q_=de(""),cf=de(""),Y_=de(!1),X_=de(""),Z_=de(""),eE=de(""),Tt=de(null),hr=de(null),pr=de(null),mr=de(null),tE=de(null),nE=de(null),sE=de(null),ea=de(null),iE=de("microphone"),Pi=de([]);let dt=null,yt=null;const rE=de(0),oE=de(!1),aE=de("optimized"),nv=de(0),lE=de(200),ta=de(null),uf=de(!1),ff=de(null),df=de(0),hf=de(""),cE=de([]),uE=de(!0),pf=de(""),mf=de(""),gf=de(""),sl=de(!1),$r=de(null);function sv(){Pi.value.forEach(e=>{e.getTracks().forEach(t=>t.stop())}),Pi.value=[],Tt.value&&(Tt.value.close().catch(e=>{console.error("Error closing AudioContext:",e)}),Tt.value=null),ea.value&&(cancelAnimationFrame(ea.value),ea.value=null),rn.value&&(clearInterval(rn.value),rn.value=null),ta.value&&(clearInterval(ta.value),ta.value=null)}function iv(){tl.value=[],lf.value=null,cf.value="",Pi.value=[],yt=null,dt=null,ff.value=null,uf.value=!1,df.value=0,hf.value="",pf.value="",mf.value="",gf.value="",nl.value=0,tv.value=!1,rn.value&&(clearInterval(rn.value),rn.value=null)}function Nc(e){yt=e}function na(e){dt=e}function rv(){rn.value&&clearInterval(rn.value),rn.value=setInterval(()=>nl.value++,1e3)}function Pc(){rn.value&&(clearInterval(rn.value),rn.value=null)}function Lc(){tl.value=[],lf.value=null,uf.value=!1,ff.value=null,df.value=0,hf.value="",nl.value=0,cf.value="",pf.value="",mf.value="",gf.value="",sv()}async function Fc(){const e=await navigator.mediaDevices.getUserMedia({audio:!0});return yt=e,Pi.value.push(e),e}async function Dc(){const e=await navigator.mediaDevices.getDisplayMedia({audio:!0,video:!0});if(e.getAudioTracks().length===0)throw e.getVideoTracks().forEach(t=>t.stop()),new Error('System audio permission was not granted. Please ensure you check the "Share system audio" box.');return dt=e,Pi.value.push(e),e}function $c(e,t){Tt.value||(Tt.value=new(window.AudioContext||window.webkitAudioContext));const n=Tt.value.createMediaStreamSource(e),s=Tt.value.createMediaStreamSource(t),i=Tt.value.createMediaStreamDestination();n.connect(i),s.connect(i);const r=i.stream.getAudioTracks()[0];if(!r)throw new Error("Failed to create mixed audio track");return new MediaStream([r])}function Bc(e){const t=e.getAudioTracks();if(t.length===0)throw new Error("System stream has no audio tracks");return new MediaStream(t)}function ov(){return[{mimeType:"audio/webm;codecs=opus",audioBitsPerSecond:32e3,description:"Optimized (32kbps Opus)"},{mimeType:"audio/webm;codecs=opus",audioBitsPerSecond:64e3,description:"Good quality (64kbps Opus)"},{mimeType:"audio/webm",audioBitsPerSecond:64e3,description:"Standard WebM (64kbps)"},{mimeType:"audio/mp4",audioBitsPerSecond:64e3,description:"Standard MP4 (64kbps)"},{mimeType:"audio/webm;codecs=opus",description:"Opus codec (default bitrate)"},{mimeType:"audio/webm",description:"WebM (default bitrate)"}]}function av(){const e=ov();for(const t of e)if(MediaRecorder.isTypeSupported(t.mimeType))return t;return null}function jc(e,t){let n=!1;const s=av();let i=0,r=128e3;for(;!n&&i<5;)try{i++,s&&i===1?(os.value=new MediaRecorder(e,s),r=s.audioBitsPerSecond||64e3):s&&i===2&&s.audioBitsPerSecond?(os.value=new MediaRecorder(e,{mimeType:s.mimeType}),r=128e3):(os.value=new MediaRecorder(e),r=128e3),n=!0}catch(o){if(console.warn(`MediaRecorder creation attempt ${i} failed:`,o),os.value=null,i>=5)throw new Error(`Failed to create MediaRecorder: ${o.message}`)}if(!os.value)throw new Error("Failed to create MediaRecorder with any configuration");return nv.value=r,t&&t(r),os.value.ondataavailable=o=>{tl.value.push(o.data)},os.value}function Hc(e){return Tt.value||(Tt.value=new(window.AudioContext||window.webkitAudioContext)),hr.value=Tt.value.createAnalyser(),hr.value.fftSize=256,Tt.value.createMediaStreamSource(e).connect(hr.value),hr.value}function Uc(e,t){return Tt.value||(Tt.value=new(window.AudioContext||window.webkitAudioContext)),pr.value=Tt.value.createAnalyser(),pr.value.fftSize=256,Tt.value.createMediaStreamSource(e).connect(pr.value),mr.value=Tt.value.createAnalyser(),mr.value.fftSize=256,Tt.value.createMediaStreamSource(t).connect(mr.value),{micAnalyser:pr.value,systemAnalyser:mr.value}}function lv(e){$r.value=e,sl.value=!0}function cv(){const e=$r.value;return $r.value=null,sl.value=!1,e}function uv(){$r.value=null,sl.value=!1}const fE=Object.freeze(Object.defineProperty({__proto__:null,acceptDisclaimer:cv,activeStreams:Pi,actualBitrate:nv,analyser:hr,animationFrameId:ea,asrLanguage:X_,asrMaxSpeakers:eE,asrMinSpeakers:Z_,asrResult:pf,asrResultOffline:gf,asrResultOnline:mf,audioBlobURL:lf,audioChunks:tl,audioContext:Tt,canRecordAudio:K_,canRecordSystemAudio:J_,cancelDisclaimer:uv,cleanupRecording:sv,combineAudioStreams:$c,createAudioOnlyStream:Bc,createMediaRecorderWithFallback:jc,currentDraftId:ff,discardRecordingState:Lc,draftRecordings:cE,draftsExpanded:uE,estimatedFileSize:rE,fileSizeWarningShown:oE,getFirstSupportedRecorderOption:av,getMicrophoneStream:Fc,getRecorderOptionsList:ov,getSystemAudioStream:Dc,initRecordingState:iv,isPaused:uf,isPausingRecording:q_,isRecording:W_,isStoppingRecording:tv,is_final:z_,maxRecordingMB:lE,mediaRecorder:os,micAnalyser:pr,get micStream(){return yt},micVisualizer:nE,pausedDuration:df,pausedTranscription:hf,pendingRecordingMode:$r,recordingInterval:rn,recordingMode:iE,recordingNotes:cf,recordingQuality:aE,recordingTime:nl,setMicStream:Nc,setSystemStream:na,setupDualVisualizer:Uc,setupSingleVisualizer:Hc,showDisclaimer:lv,showRecordingDisclaimerModal:sl,showSystemAudioHelp:Y_,sizeCheckInterval:ta,startRecordingTimer:rv,stopRecordingTimer:Pc,systemAnalyser:mr,systemAudioError:Q_,systemAudioSupported:G_,get systemStream(){return dt},systemVisualizer:sE,visualizer:tE},Symbol.toStringTag,{value:"Module"}));function dE({t:e,filteredRecordings:t,loadRecordings:n,showToast:s,currentPage:i,hasNextPage:r,isLoadingMore:o,searchQuery:l,availableTags:c,draftNameInput:h}){const f=de(!1),u=de(!1),m=de([]),v=de({start:"",end:""}),w=de(""),b=de(""),H=de("created_at"),P=de(null),M=de(""),S=de(null),_=zn(()=>[{value:"today",label:e("sidebar.today")},{value:"yesterday",label:e("sidebar.yesterday")},{value:"thisweek",label:e("sidebar.thisWeek")},{value:"lastweek",label:e("sidebar.lastWeek")},{value:"thismonth",label:e("sidebar.thisMonth")},{value:"lastmonth",label:e("sidebar.lastMonth")}]),x=(ie,ne)=>ie.getFullYear()===ne.getFullYear()&&ie.getMonth()===ne.getMonth()&&ie.getDate()===ne.getDate(),C=ie=>x(ie,new Date),V=ie=>{const ne=new Date;return ne.setDate(ne.getDate()-1),x(ie,ne)},F=ie=>{const ne=new Date,he=new Date(ne),Se=ne.getDay(),Qe=ne.getDate()-Se+(Se===0?-6:1);he.setDate(Qe),he.setHours(0,0,0,0);const Ye=new Date(he);return Ye.setDate(he.getDate()+6),Ye.setHours(23,59,59,999),ie>=he&&ie<=Ye},R=ie=>{const ne=new Date,he=new Date(ne),Se=ne.getDay(),Qe=ne.getDate()-Se+(Se===0?-6:1)-7;he.setDate(Qe),he.setHours(0,0,0,0);const Ye=new Date(he);return Ye.setDate(he.getDate()+6),Ye.setHours(23,59,59,999),ie>=he&&ie<=Ye},N=ie=>{const ne=new Date;return ie.getFullYear()===ne.getFullYear()&&ie.getMonth()===ne.getMonth()},B=ie=>{const ne=new Date,he=new Date(ne.getFullYear(),ne.getMonth()-1,1);return ie.getFullYear()===he.getFullYear()&&ie.getMonth()===he.getMonth()},A=ie=>{const ne=H.value==="meeting_date"?ie.meeting_date:ie.created_at;return ne?new Date(ne):null},K=zn(()=>{const ie=[...t.value].sort((he,Se)=>{const Qe=A(he),Ye=A(Se);return!Qe&&!Ye?0:Qe?Ye?Ye-Qe:-1:1}),ne={today:[],yesterday:[],thisWeek:[],lastWeek:[],thisMonth:[],lastMonth:[],older:[]};return ie.forEach(he=>{const Se=A(he);if(!Se){ne.older.push(he);return}C(Se)?ne.today.push(he):V(Se)?ne.yesterday.push(he):F(Se)?ne.thisWeek.push(he):R(Se)?ne.lastWeek.push(he):N(Se)?ne.thisMonth.push(he):B(Se)?ne.lastMonth.push(he):ne.older.push(he)}),[{title:e("sidebar.today"),items:ne.today},{title:e("sidebar.yesterday"),items:ne.yesterday},{title:e("sidebar.thisWeek"),items:ne.thisWeek},{title:e("sidebar.lastWeek"),items:ne.lastWeek},{title:e("sidebar.thisMonth"),items:ne.thisMonth},{title:e("sidebar.lastMonth"),items:ne.lastMonth},{title:e("sidebar.older"),items:ne.older}].filter(he=>he.items.length>0)}),re=()=>{f.value=!f.value},oe=()=>{let ie=[];if(b.value.trim()&&ie.push(b.value.trim()),m.value.length>0){const ne=m.value.map(he=>{const Se=c.value.find(Qe=>Qe.id===he);return Se?`tag:${Se.name.replace(/\s+/g,"_")}`:""}).filter(Boolean);ie.push(...ne)}return w.value?ie.push(`date:${w.value}`):(v.value.start||v.value.end)&&(v.value.start&&ie.push(`date_from:${v.value.start}`),v.value.end&&ie.push(`date_to:${v.value.end}`)),ie.join(" ")},J=()=>{l.value=oe()},fe=()=>{m.value=[],v.value={start:"",end:""},w.value="",b.value="",l.value=""},Z=ie=>{m.value=[ie.id],J()},Ae=()=>{l.value="",fe()},ft=async()=>{!r.value||o.value||await n(i.value+1,!0,l.value)},_e=ie=>{P.value=ie.id,M.value=ie.name,Ss(()=>{h.value&&h.value[0]?h.value[0].focus():h.value&&h.value.focus()})},He=async ie=>{if(!P.value)return;const ne=M.value.trim();if(P.value=null,!(!ne||ne===ie.name))try{const Se=await(await fetch(`/tool/speakr/api/draft/${ie.id}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ne})})).json();if(Se.success)ie.name=ne,s("重命名成功","fa-check");else throw new Error(Se.error)}catch(he){console.error("Error renaming draft:",he),s(`重命名失败: ${he.message}`,"fa-exclamation-circle")}};return wn(m,()=>{J()},{deep:!0}),wn(w,()=>{J()}),wn(v,()=>{J()},{deep:!0}),wn(b,ie=>{clearTimeout(S.value),S.value=setTimeout(()=>{J()},300)}),{isSidebarCollapsed:f,showAdvancedFilters:u,filterTags:m,filterDateRange:v,filterDatePreset:w,filterTextQuery:b,sortBy:H,editingDraftId:P,editingDraftName:M,datePresetOptions:_,groupedRecordings:K,toggleSidebar:re,buildSearchQuery:oe,applyAdvancedFilters:J,clearAllFilters:fe,filterByTag:Z,clearTagFilter:Ae,loadMoreRecordings:ft,startDraftRename:_e,saveDraftRename:He}}const{createApp:hE,ref:k,reactive:sc,computed:vt,onMounted:pE,watch:Et,nextTick:et}=N_;D_();document.addEventListener("DOMContentLoaded",async()=>{var r;if(window.i18n){const o=document.getElementById("app"),l=(o==null?void 0:o.dataset.userLanguage)||localStorage.getItem("preferredLanguage")||"en";await window.i18n.init(l),console.log("i18n initialized with language:",l)}const e=k((r=document.querySelector('meta[name="csrf-token"]'))==null?void 0:r.getAttribute("content"));"serviceWorker"in navigator&&window.isSecureContext&&window.location.hostname!=="localhost"&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/tool/speakr/static/sw.js").then(o=>{console.log("ServiceWorker registration successful with scope: ",o.scope)}).catch(o=>{console.log("ServiceWorker registration failed: ",o)})});const t=(o,l={})=>!window.i18n||!window.i18n.t?o:window.i18n.t(o,l);let n=null,s=null;const i=hE({setup(){let o=!1,l="";const c=k("upload"),h=k(!1),f=k([]),u=k(null),m=k("summary"),v=k(""),w=k(!0),b=k(null),H=k(1),P=k(25),M=k(0),S=k(0),_=k(!1),x=k(!1),C=k(!1),V=k(null);k(null);const F=k("unknown"),R=k(!1),N=k(!1),B=k(!1),A=k("blue"),K=k(!1),re=k(window.innerWidth),oe=k("transcript"),J=k(!1),fe=k("en"),Z=k("English"),Ae=k([]),ft=k(!1),_e=k([]),He=k(null),ie=k(0),ne=k(""),he=k(!1),Se=k(null),Qe=k(!1),Ye=k(!1),mn=k(250),Zt=k(!0),In=k("size"),En=k(20),g=k("20MB"),T=k(""),I=k(null),{isRecording:j,isStoppingRecording:U,isPausingRecording:W,is_final:G,mediaRecorder:z,audioChunks:q,audioBlobURL:$,recordingTime:ae,recordingInterval:Y,canRecordAudio:pe,canRecordSystemAudio:ye,systemAudioSupported:xe,systemAudioError:Le,recordingNotes:Ce,showSystemAudioHelp:_t,asrLanguage:We,asrMinSpeakers:lt,asrMaxSpeakers:st,audioContext:gn,analyser:ws,micAnalyser:Ct,systemAnalyser:qt,visualizer:bs,micVisualizer:Ts,systemVisualizer:Bi,animationFrameId:cn,recordingMode:Bt,activeStreams:vn,estimatedFileSize:ji,fileSizeWarningShown:zs,recordingQuality:il,actualBitrate:_s,maxRecordingMB:Yn,sizeCheckInterval:Xn,isPaused:jt,currentDraftId:mt,pausedDuration:E,pausedTranscription:D,draftRecordings:Q,draftsExpanded:te,asrResult:le,asrResultOnline:Re,asrResultOffline:Oe,showRecordingDisclaimerModal:Xe}=fE,qe=k(!1),Ze=k(""),Ks=k(""),rl=k(""),yn=k([]),Nn=k([]),ol=k(""),Es=vt(()=>Nn.value.map(a=>yn.value.find(d=>d.id==a)).filter(Boolean)),fv=vt(()=>{const a=Cn.value;return a.includes("#")||a.includes("**")||a.includes("```")||a.includes("* ")||a.includes("- ")}),dv=zn(()=>window.marked.parse(Cn.value||"",{breaks:!0})),hv=vt(()=>{const a=yn.value.filter(p=>!Nn.value.includes(p.id));if(!ol.value)return a;const d=ol.value.toLowerCase();return a.filter(p=>p.name.toLowerCase().includes(d))}),Zr=k(!1),eo=k(!1),al=k(!1),Hi=k(""),to=k(""),pv=k(!1),mv=k(!1),vf=k(!1),ll=k(!1),cl=k(!1),gv=k(!1),vv=k(!1),ct=k(null),yv=k(""),Sv=k([]),wv=k([]),Ui=k(null),Js=sc({share_summary:!0,share_notes:!0}),Gs=k(""),Vi=k(!1),Wi=k([]),ul=k(!1),Qs=k(null),no=k(!1),Ys=k(null),bv=k(null),Tv=k(null),_v=k(null),Ev=k(!1),Cv=k({language:"zh",min_speakers:1,max_speakers:10}),Cs=k({}),kv=k(!1),fl=k({}),xv=k({}),Rv=k(null),Av=k({}),Mv=k([]),Ov=k(-1),Iv=k([]),Xs=k(!1),Zs=k(!1),Ot=k(!1),It=k(!1),so=k(""),io=k(""),ei=k(null),yf=2e3,dl=k(null),it=k(null),hl=k(null),rt=k(null),pl=k(null),Pn=k(null),qi=k("simple"),Nv=k(!1),Pv=k(null),ro=k(!1),ti=k(!1),en=k([]),oo=k(""),ni=k(!1),ks=k(null),ao=k(1),zi=k(60),lo=k(40),co=k(!1),Ki=k(!1),Ji=k(""),Gi=k(""),Zn=k(""),uo=k(""),Sf=k({name:"领导发言稿",fontSize:40}),ml=k(!1),Qi=k(null),Cn=k(""),wf=k(!1),bf=k(!1),gl=k(0),vl=k(0),yl=k("获取链接中..."),Tf=k(""),Yi=k(!1),_f=k(!0),Sl=k((localStorage.getItem("selectedScene")||"cg").toLowerCase()==="yl"?"yl":"cg"),Ln=k(!1),wl=k(""),fo=k(""),ho=k(""),po=k(""),Xi=k(""),Zi=k(""),Ef=k(null),Cf=k(null),bl=k(null),kf=k(66.67),mo=k(!1);let go=null;const si=vt(()=>(le.value||"")+(Oe.value||"")+(Re.value||"")),er=vt(()=>(fo.value||"")+(po.value||"")+(ho.value||"")),Tl=vt(()=>Bt.value==="both"),Lv=vt(()=>{if(!Tl.value)return si.value;const a=si.value||"",d=er.value||"",p=[];return a&&p.push(`[MIC] +`:s,this.lastOnlineTimestamp=l}else if((i==="2pass-offline"||i==="offline")&&s.trim()){const l=this.ensurePendingSentence(s,r,o);l&&!l.processed&&!l.correctionRequested&&(l.correctionRequested=!0,this.setPendingCorrectionCount(this.pendingCorrectionCount+1),this._requestCorrection(l))}this.syncRealtimePreview()}async handleOfflineMessage(t){if(this.disposed)return;const n=JSON.parse(t.data),s=n.mode,i=n.timestamp,r=this.liveTranscriptionEpoch,o=this.extractTimestampMs(i);if(s==="2pass-offline"||s==="offline"){if(this.isStaleRealtimeMessage(o,r))return;const l=""+n.text;if(!l.trim()){this.syncRealtimePreview();return}const c=this.ensurePendingSentence(l,i,r);if(this.offlineSentenceHandoffText="",this.syncRealtimePreview(),!c||c.processed||c.correctionRequested)return;c.correctionRequested=!0,this.setPendingCorrectionCount(this.pendingCorrectionCount+1),await this._requestCorrection(c)}else if(s==="offline-speaker"){if(this.isStaleRealtimeMessage(o,r))return;const l=n.segments&&n.segments[0]&&n.segments[0].speaker||"未命名演讲者";let c=-1;for(let h=this.segmentList.length-1;h>=0;h--){const f=this.segmentList[h];if(!(!f||f.epoch!==r)){if(f.speaker===null&&Number.isFinite(o)&&Number.isFinite(f.timestampMs)&&f.timestampMs===o){c=h;break}c===-1&&f.speaker===null&&(c=h)}}c!==-1&&(this.segmentList[c].speaker=l,this.renderFullText())}}}function V_({recordings:e,selectedRecording:t,selectedTab:n,uploadQueue:s,currentlyProcessingFile:i,processingProgress:r,processingMessage:o,progressPopupMinimized:l,progressPopupClosed:c,identifiedSpeakers:h,processedTranscription:f,showToast:u,setGlobalError:m,resetCurrentFileProcessingState:v,speakerMap:w,highlightedSpeaker:b,showSpeakerModal:H,showResetModal:P,showReprocessModal:M,showTextEditorModal:S,showAsrEditorModal:_,editingTranscriptionContent:x,editingSegments:C,availableSpeakers:V,speakerDisplayMap:F,modalSpeakers:R,regenerateSummaryAfterSpeakerUpdate:N,speakerSuggestions:B,loadingSuggestions:A,activeSpeakerInput:K,isAutoIdentifying:re,currentSpeakerGroupIndex:oe,speakerGroups:J,recordingToReset:fe,reprocessType:Z,reprocessRecording:Ae,asrReprocessOptions:ft}){const _e=de(new Map),He=zn(()=>{var E;return(E=f.value)!=null&&E.speakers?f.value.speakers:[]}),ie=zn(()=>Object.values(w.value).some(E=>E.name&&E.name.trim()!=="")),ne=zn(()=>{var Q;if(!((Q=t.value)!=null&&Q.transcription))return"";let E=t.value.transcription;E=E.replace(//g,">"),E=E.replace(/\n/g,"
");const D={};return w.value&&Object.keys(w.value).forEach((te,le)=>{D[te]=w.value[te].color||`speaker-color-${le%8+1}`}),E=E.replace(/\[([^\]]+)\]/g,(te,le)=>{var Ze;const Re=le===b.value,Oe=D[le]||"",qe=`[${((Ze=w.value[le])==null?void 0:Ze.name)||le}]`;return`${qe}`}),E}),he=E=>{const D=e.value.find(Q=>Q.id===E)||t.value;Qe("transcription",D)},Se=E=>{const D=e.value.find(Q=>Q.id===E)||t.value;Qe("summary",D)},Qe=(E,D)=>{Z.value=E,Ae.value=D,M.value=!0},Ye=()=>{M.value=!1,Z.value=null,Ae.value=null},mn=async()=>{if(!Ae.value||!Z.value)return;const E=Ae.value.id,D=Z.value;Ye(),D==="transcription"?await Zt(E,ft.value.language,ft.value.min_speakers,ft.value.max_speakers):D==="summary"&&await In(E)},Zt=async(E,D,Q,te)=>{var le;if(!E){m("No recording ID provided for reprocessing.");return}try{const Re={language:D,min_speakers:Q,max_speakers:te},Oe=await fetch(`/tool/speakr/recording/${E}/reprocess_transcription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Re)}),Xe=await Oe.json();if(!Oe.ok)throw new Error(Xe.error||"Failed to start transcription reprocessing");Xe.recording&&Xe.recording.status!=="PROCESSING"&&(console.warn(`Warning: Reprocess transcription returned unexpected status: ${Xe.recording.status}`),Xe.recording.status="PROCESSING");const qe=e.value.findIndex(Ze=>Ze.id===E);qe!==-1&&(e.value[qe]=Xe.recording),((le=t.value)==null?void 0:le.id)===E&&(t.value=Xe.recording),u("Transcription reprocessing started","fa-sync-alt"),n.value="summary",En(E,"transcription"),g(E)}catch(Re){console.error("Reprocess Transcription Error:",Re),m(`Failed to start transcription reprocessing: ${Re.message}`)}},In=async E=>{var D;if(!E){m("No recording ID provided for reprocessing.");return}try{const Q=await fetch(`/tool/speakr/recording/${E}/reprocess_summary`,{method:"POST",headers:{"Content-Type":"application/json"}}),te=await Q.json();if(!Q.ok)throw new Error(te.error||"Failed to start summary reprocessing");te.recording&&te.recording.status!=="SUMMARIZING"&&(console.warn(`Warning: Reprocess summary returned unexpected status: ${te.recording.status}`),te.recording.status="SUMMARIZING");const le=e.value.findIndex(Re=>Re.id===E);le!==-1&&(e.value[le]=te.recording),((D=t.value)==null?void 0:D.id)===E&&(t.value=te.recording),u("Summary reprocessing started","fa-sync-alt"),n.value="summary",En(E,"summary"),g(E)}catch(Q){console.error("Reprocess Summary Error:",Q),m(`Failed to start summary reprocessing: ${Q.message}`)}},En=(E,D)=>{const Q=e.value.find(le=>le.id===E);if(!Q)return;const te={file:{name:Q.title||`Recording ${E}`,size:Q.file_size||0},status:"pending",recordingId:E,clientId:`reprocess-${D}-${E}-${Date.now()}`,error:null,isReprocessing:!0,reprocessType:D};s.value.unshift(te),l.value=!1,c.value=!1,i.value=te,r.value=10,o.value=D==="transcription"?"Starting transcription reprocessing...":"Starting summary reprocessing..."},g=E=>{_e.value.has(E)&&clearInterval(_e.value.get(E));const D=setInterval(async()=>{var Q,te,le;try{const Re=await fetch(`/tool/speakr/status/${E}`);if(!Re.ok){console.error(`Status check failed for recording ${E}`),I(E);return}const Oe=await Re.json(),Xe=e.value.findIndex(Ze=>Ze.id===E);Xe!==-1&&(e.value[Xe]=Oe),((Q=t.value)==null?void 0:Q.id)===E&&(t.value=Oe);const qe=s.value.find(Ze=>Ze.recordingId===E);qe&&(qe.status=Oe.status,qe.displayName=Oe.title||Oe.original_filename||qe.file.name),qe&&((te=i.value)==null?void 0:te.clientId)===qe.clientId&&T(Oe.status,qe),(Oe.status==="COMPLETED"||Oe.status==="FAILED")&&(console.log(`Reprocessing ${Oe.status.toLowerCase()} for recording ${E}`),I(E),qe&&(qe.status=Oe.status==="COMPLETED"?"completed":"failed",Oe.status==="FAILED"&&(qe.error=Oe.error_message||"Reprocessing failed")),((le=i.value)==null?void 0:le.recordingId)===E&&v(),Oe.status==="COMPLETED"?u("Reprocessing completed successfully","fa-check-circle"):u("Reprocessing failed","fa-exclamation-circle"))}catch(Re){console.error(`Error polling status for recording ${E}:`,Re),I(E)}},3e3);_e.value.set(E,D)},T=(E,D)=>{switch(E){case"PENDING":r.value=20,o.value=`Waiting to start ${D.reprocessType} reprocessing...`;break;case"PROCESSING":r.value=Math.round(Math.min(70,r.value+Math.random()*10)),o.value=D.reprocessType==="transcription"?"Reprocessing transcription...":"Processing audio...";break;case"SUMMARIZING":r.value=Math.round(Math.min(90,r.value+Math.random()*10)),o.value=D.reprocessType==="summary"?"Regenerating summary...":"Generating title and summary...";break;case"COMPLETED":r.value=100,o.value="Reprocessing completed!";break;case"FAILED":r.value=100,o.value="Reprocessing failed.";break;default:r.value=15,o.value="Starting reprocessing..."}},I=E=>{_e.value.has(E)&&(clearInterval(_e.value.get(E)),_e.value.delete(E),console.log(`Stopped reprocessing poll for recording ${E}`))},j=async()=>{var E;if(t.value)try{const D=(E=document.querySelector('meta[name="csrf-token"]'))==null?void 0:E.getAttribute("content"),Q=await fetch(`/tool/speakr/recording/${t.value.id}/generate_summary`,{method:"POST",headers:{"Content-Type":"application/json","X-CSRFToken":D}}),te=await Q.json();if(!Q.ok)throw new Error(te.error||"Failed to generate summary");t.value.status="SUMMARIZING";const le=e.value.find(Re=>Re.id===t.value.id);le&&(le.status="SUMMARIZING"),u("Summary generation started","success")}catch(D){console.error("Error generating summary:",D),m(`Failed to generate summary: ${D.message}`)}},U=async E=>{var Q;const D=e.value.find(te=>te.id===E);if(D)try{const te=await fetch(`/tool/speakr/recording/${D.id}/reset_status`,{method:"POST",headers:{"Content-Type":"application/json"}}),le=await te.json();if(!te.ok)throw new Error(le.error||"Failed to reset status");const Re=e.value.findIndex(Oe=>Oe.id===D.id);Re!==-1&&(e.value[Re]=le.recording),((Q=t.value)==null?void 0:Q.id)===D.id&&(t.value=le.recording),u("Recording status has been reset.","fa-check-circle")}catch(te){m(`Failed to reset status: ${te.message}`)}},W=E=>{fe.value=E,P.value=!0},G=()=>{P.value=!1,fe.value=null},z=async()=>{var D;if(!fe.value)return;const E=fe.value.id;G();try{const Q=await fetch(`/tool/speakr/recording/${E}/reset_status`,{method:"POST",headers:{"Content-Type":"application/json"}}),te=await Q.json();if(!Q.ok)throw new Error(te.error||"Failed to reset status");const le=e.value.findIndex(Re=>Re.id===E);le!==-1&&(e.value[le]=te.recording),((D=t.value)==null?void 0:D.id)===E&&(t.value=te.recording),u("Recording status has been reset.","fa-check-circle")}catch(Q){console.error("Reset Status Error:",Q),m(`Failed to reset status: ${Q.message}`)}},q=()=>{f.value.isJson?pe():$()},$=()=>{t.value&&(x.value=t.value.transcription,S.value=!0)},ae=()=>{S.value=!1,x.value=""},Y=async()=>{t.value&&(await ws(x.value),ae())},pe=async()=>{if(t.value)try{const E=JSON.parse(t.value.transcription);C.value=E.map((Re,Oe)=>({...Re,id:Oe,showSuggestions:!1,filteredSpeakers:[]}));const D=[...new Set(E.map(Re=>Re.speaker))],le=(await(await fetch("/tool/speakr/speakers")).json()).map(Re=>Re.name);V.value=[...new Set([...D,...le])].sort(),_.value=!0}catch(E){console.error("Could not parse transcription as JSON for ASR editor:",E),m("This transcription is not in the correct format for the ASR editor.")}},ye=()=>{_.value=!1,C.value=[],V.value=[]},xe=async()=>{const E=JSON.stringify(C.value.map(({id:D,showSuggestions:Q,filteredSpeakers:te,...le})=>le));await ws(E),ye()},Le=(E,D,Q)=>{C.value[E]&&(C.value[E][D]=parseFloat((C.value[E][D]+Q).toFixed(3)))},Ce=E=>{const D=C.value[E];if(D){const Q=D.speaker.toLowerCase();D.filteredSpeakers=V.value.filter(te=>te.toLowerCase().includes(Q))}},_t=E=>{C.value[E]&&(C.value[E].showSuggestions=!0,Ce(E))},We=E=>{C.value[E]&&window.setTimeout(()=>{C.value[E]&&(C.value[E].showSuggestions=!1)},200)},lt=(E,D)=>{C.value[E]&&(C.value[E].speaker=D,C.value[E].showSuggestions=!1)},st=()=>{const E=C.value[C.value.length-1];C.value.push({id:Date.now(),speaker:E?E.speaker:"SPEAKER_00",start_time:E?E.end_time:0,end_time:E?E.end_time+1:1,sentence:""})},gn=E=>{C.value.splice(E,1)},ws=async E=>{if(t.value)try{const D=await fetch(`/tool/speakr/recording/${t.value.id}/update_transcription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({transcription:E})}),Q=await D.json();if(!D.ok)throw new Error(Q.error||"Failed to update transcription");const te=e.value.findIndex(le=>le.id===t.value.id);te!==-1&&(e.value[te]=Q.recording),t.value=Q.recording,u("Transcription updated successfully!","fa-check-circle")}catch(D){console.error("Save Transcription Error:",D),m(`Failed to save transcription: ${D.message}`)}},Ct=async(E,D)=>{if(!E||E.length<2){B.value[D]=[];return}A.value[D]=!0;try{const Q=await fetch(`/tool/speakr/speakers/search?q=${encodeURIComponent(E)}`);if(!Q.ok)throw new Error("Failed to search speakers");const te=await Q.json();B.value[D]=te}catch(Q){console.error("Error searching speakers:",Q),B.value[D]=[]}finally{A.value[D]=!1}},qt=(E,D)=>{w.value[E]&&(w.value[E].name=D.name,B.value[E]=[])},bs=E=>{const D=E.target.closest('input[type="text"]'),Q=E.target.closest(".absolute.z-10");!D&&!Q&&Object.keys(B.value).forEach(te=>{B.value[te]=[]})},Ts=()=>{var Q;w.value={},F.value={};const E=(Q=t.value)==null?void 0:Q.transcription;let D=[];if(E)try{const te=JSON.parse(E);te&&Array.isArray(te)&&(D=[...new Set(te.map(le=>le.speaker).filter(Boolean))])}catch{D=h.value}R.value=D,w.value=D.reduce((te,le,Re)=>(te[le]={name:"",isMe:!1,color:`speaker-color-${Re%8+1}`},F.value[le]=le,te),{}),b.value=null,B.value={},A.value={},re.value=!1,H.value=!0},Bi=()=>{if(H.value=!1,b.value=null,w.value={},B.value={},A.value={},window.speakerModalClickHandler){const E=document.querySelector(".modal-content");E&&E.removeEventListener("click",window.speakerModalClickHandler),delete window.speakerModalClickHandler}},cn=async()=>{if(!t.value)return;const E=Object.entries(w.value).reduce((D,[Q,te])=>(te.name&&te.name.trim()!==""&&(D[Q]=te),D),{});try{const D=await fetch(`/tool/speakr/recording/${t.value.id}/update_speakers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({speaker_map:E,regenerate_summary:N.value})}),Q=await D.json();if(!D.ok)throw new Error(Q.error||"Failed to update speakers");Bi();const te=e.value.findIndex(le=>le.id===t.value.id);te!==-1&&(e.value[te]=Q.recording),t.value=Q.recording,u("Speaker names updated successfully!","fa-check-circle"),N.value&&g(t.value.id)}catch(D){console.error("Save Speaker Names Error:",D),m(`Failed to save speaker names: ${D.message}`)}},Bt=E=>{if(!E)return[];const D=[],Q=document.querySelector("div.speaker-modal-transcript"),te=document.querySelector(".transcription-simple-view, .transcription-with-speakers, .transcription-content"),le=Q||te;if(!le)return[];const Re=le.querySelectorAll(".speaker-segment");if(Re.length>0){let Oe=null,Xe=null;Re.forEach(qe=>{const Ze=qe.querySelector("[data-speaker-id]"),Ks=Ze==null?void 0:Ze.dataset.speakerId;Ks===E&&(Xe!==E?(Oe={startElement:qe,elements:[qe]},D.push(Oe)):Oe&&Oe.elements.push(qe)),Xe=Ks})}else{const Oe=le.querySelectorAll("[data-speaker-id]");let Xe=null;Oe.forEach(qe=>{if(qe.dataset.speakerId===E){const Ze=qe.closest(".speaker-segment")||qe.parentElement;!Xe||!Xe.lastElement||!Ze.previousElementSibling||Ze.previousElementSibling!==Xe.lastElement?(Xe={startElement:Ze,elements:[Ze],lastElement:Ze},D.push(Xe)):(Xe.elements.push(Ze),Xe.lastElement=Ze)}})}return D},vn=async E=>{if(b.value=E,E){if(await Ss(),J.value=Bt(E),oe.value=0,J.value.length>0){const D=J.value[0];D&&D.startElement&&D.startElement.scrollIntoView({behavior:"smooth",block:"center"})}}else J.value=[],oe.value=-1},ji=()=>{if(J.value.length===0)return;oe.value=(oe.value+1)%J.value.length;const E=J.value[oe.value];E&&E.startElement&&E.startElement.scrollIntoView({behavior:"smooth",block:"center"})},zs=()=>{if(J.value.length===0)return;oe.value=oe.value<=0?J.value.length-1:oe.value-1;const E=J.value[oe.value];E&&E.startElement&&E.startElement.scrollIntoView({behavior:"smooth",block:"center"})},il=E=>{K.value=E,b.value!==E&&vn(E)},_s=()=>{setTimeout(()=>{K.value=null,B.value={}},200),Yn()},Yn=()=>{b.value=null};return{showReprocessModal:M,reprocessType:Z,reprocessRecording:Ae,asrReprocessOptions:ft,showTextEditorModal:S,editingTranscriptionContent:x,showAsrEditorModal:_,editingSegments:C,availableSpeakers:V,showSpeakerModal:H,speakerMap:w,speakerDisplayMap:F,modalSpeakers:R,regenerateSummaryAfterSpeakerUpdate:N,speakerSuggestions:B,loadingSuggestions:A,activeSpeakerInput:K,isAutoIdentifying:re,highlightedSpeaker:b,currentSpeakerGroupIndex:oe,speakerGroups:J,recordingToReset:fe,showResetModal:P,identifiedSpeakersInOrder:He,hasSpeakerNames:ie,highlightedTranscript:ne,reprocessTranscription:he,reprocessSummary:Se,confirmReprocess:Qe,cancelReprocess:Ye,executeReprocess:mn,openTranscriptionEditor:q,openTextEditorModal:$,closeTextEditorModal:ae,saveTranscription:Y,openAsrEditorModal:pe,closeAsrEditorModal:ye,saveAsrTranscription:xe,adjustTime:Le,filterSpeakers:Ce,openSpeakerSuggestions:_t,closeSpeakerSuggestions:We,selectSpeaker:lt,addSegment:st,removeSegment:gn,searchSpeakers:Ct,selectSpeakerSuggestion:qt,closeSpeakerSuggestionsOnClick:bs,openSpeakerModal:Ts,closeSpeakerModal:Bi,saveSpeakerNames:cn,highlightSpeakerInTranscript:vn,focusSpeaker:il,blurSpeaker:_s,clearSpeakerHighlight:Yn,navigateToNextSpeakerGroup:ji,navigateToPrevSpeakerGroup:zs,autoIdentifySpeakers:async()=>{if(!t.value){u("No recording selected.","fa-exclamation-circle");return}re.value=!0,u("Starting automatic speaker identification...","fa-magic");try{const E=await fetch(`/tool/speakr/recording/${t.value.id}/auto_identify_speakers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({current_speaker_map:w.value})}),D=await E.json();if(!E.ok)throw new Error(D.error||"Unknown error occurred during auto-identification.");if(D.message){u(D.message,"fa-info-circle");return}let Q=0;for(const te in D.speaker_map){const le=D.speaker_map[te];w.value[te]&&le&&le.trim()!==""&&(w.value[te].name=le,Q++)}Q>0?u(`${Q} speaker(s) identified successfully!`,"fa-check-circle"):u("No speakers could be identified from the context.","fa-info-circle")}catch(E){console.error("Auto Identify Speakers Error:",E),u(`Error: ${E.message}`,"fa-exclamation-circle",5e3)}finally{re.value=!1}},generateSummary:j,resetRecordingStatus:U,confirmReset:W,cancelReset:G,executeReset:z,toggleInbox:async E=>{if(!(!E||!E.id))try{const D=await fetch(`/tool/speakr/recording/${E.id}/toggle_inbox`,{method:"POST",headers:{"Content-Type":"application/json"}}),Q=await D.json();if(!D.ok)throw new Error(Q.error||"Failed to toggle inbox status");E.is_inbox=Q.is_inbox;const te=e.value.findIndex(le=>le.id===E.id);te!==-1&&(e.value[te].is_inbox=Q.is_inbox),u(`Recording ${Q.is_inbox?"moved to inbox":"marked as read"}`)}catch(D){console.error("Toggle Inbox Error:",D),m(`Failed to toggle inbox status: ${D.message}`)}},toggleHighlight:async E=>{if(!(!E||!E.id))try{const D=await fetch(`/tool/speakr/recording/${E.id}/toggle_highlight`,{method:"POST",headers:{"Content-Type":"application/json"}}),Q=await D.json();if(!D.ok)throw new Error(Q.error||"Failed to toggle highlighted status");E.is_highlighted=Q.is_highlighted;const te=e.value.findIndex(le=>le.id===E.id);te!==-1&&(e.value[te].is_highlighted=Q.is_highlighted),u(`Recording ${Q.is_highlighted?"highlighted":"unhighlighted"}`)}catch(D){console.error("Toggle Highlight Error:",D),m(`Failed to toggle highlighted status: ${D.message}`)}},startReprocessingPoll:g,stopReprocessingPoll:I}}const W_=de(!1),tv=de(!1),q_=de(!1),z_=de(!1),os=de(null),tl=de([]),lf=de(null),nl=de(0),rn=de(null),K_=de(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),J_=de(!1),G_=de(!1),Q_=de(""),cf=de(""),Y_=de(!1),X_=de(""),Z_=de(""),eE=de(""),Tt=de(null),hr=de(null),pr=de(null),mr=de(null),tE=de(null),nE=de(null),sE=de(null),ea=de(null),iE=de("microphone"),Pi=de([]);let dt=null,yt=null;const rE=de(0),oE=de(!1),aE=de("optimized"),nv=de(0),lE=de(200),ta=de(null),uf=de(!1),ff=de(null),df=de(0),hf=de(""),cE=de([]),uE=de(!0),pf=de(""),mf=de(""),gf=de(""),sl=de(!1),$r=de(null);function sv(){Pi.value.forEach(e=>{e.getTracks().forEach(t=>t.stop())}),Pi.value=[],Tt.value&&(Tt.value.close().catch(e=>{console.error("Error closing AudioContext:",e)}),Tt.value=null),ea.value&&(cancelAnimationFrame(ea.value),ea.value=null),rn.value&&(clearInterval(rn.value),rn.value=null),ta.value&&(clearInterval(ta.value),ta.value=null)}function iv(){tl.value=[],lf.value=null,cf.value="",Pi.value=[],yt=null,dt=null,ff.value=null,uf.value=!1,df.value=0,hf.value="",pf.value="",mf.value="",gf.value="",nl.value=0,tv.value=!1,rn.value&&(clearInterval(rn.value),rn.value=null)}function Nc(e){yt=e}function na(e){dt=e}function rv(){rn.value&&clearInterval(rn.value),rn.value=setInterval(()=>nl.value++,1e3)}function Pc(){rn.value&&(clearInterval(rn.value),rn.value=null)}function Lc(){tl.value=[],lf.value=null,uf.value=!1,ff.value=null,df.value=0,hf.value="",nl.value=0,cf.value="",pf.value="",mf.value="",gf.value="",sv()}async function Fc(){const e=await navigator.mediaDevices.getUserMedia({audio:!0});return yt=e,Pi.value.push(e),e}async function Dc(){const e=await navigator.mediaDevices.getDisplayMedia({audio:!0,video:!0});if(e.getAudioTracks().length===0)throw e.getVideoTracks().forEach(t=>t.stop()),new Error('System audio permission was not granted. Please ensure you check the "Share system audio" box.');return dt=e,Pi.value.push(e),e}function $c(e,t){Tt.value||(Tt.value=new(window.AudioContext||window.webkitAudioContext));const n=Tt.value.createMediaStreamSource(e),s=Tt.value.createMediaStreamSource(t),i=Tt.value.createMediaStreamDestination();n.connect(i),s.connect(i);const r=i.stream.getAudioTracks()[0];if(!r)throw new Error("Failed to create mixed audio track");return new MediaStream([r])}function Bc(e){const t=e.getAudioTracks();if(t.length===0)throw new Error("System stream has no audio tracks");return new MediaStream(t)}function ov(){return[{mimeType:"audio/webm;codecs=opus",audioBitsPerSecond:32e3,description:"Optimized (32kbps Opus)"},{mimeType:"audio/webm;codecs=opus",audioBitsPerSecond:64e3,description:"Good quality (64kbps Opus)"},{mimeType:"audio/webm",audioBitsPerSecond:64e3,description:"Standard WebM (64kbps)"},{mimeType:"audio/mp4",audioBitsPerSecond:64e3,description:"Standard MP4 (64kbps)"},{mimeType:"audio/webm;codecs=opus",description:"Opus codec (default bitrate)"},{mimeType:"audio/webm",description:"WebM (default bitrate)"}]}function av(){const e=ov();for(const t of e)if(MediaRecorder.isTypeSupported(t.mimeType))return t;return null}function jc(e,t){let n=!1;const s=av();let i=0,r=128e3;for(;!n&&i<5;)try{i++,s&&i===1?(os.value=new MediaRecorder(e,s),r=s.audioBitsPerSecond||64e3):s&&i===2&&s.audioBitsPerSecond?(os.value=new MediaRecorder(e,{mimeType:s.mimeType}),r=128e3):(os.value=new MediaRecorder(e),r=128e3),n=!0}catch(o){if(console.warn(`MediaRecorder creation attempt ${i} failed:`,o),os.value=null,i>=5)throw new Error(`Failed to create MediaRecorder: ${o.message}`)}if(!os.value)throw new Error("Failed to create MediaRecorder with any configuration");return nv.value=r,t&&t(r),os.value.ondataavailable=o=>{tl.value.push(o.data)},os.value}function Hc(e){return Tt.value||(Tt.value=new(window.AudioContext||window.webkitAudioContext)),hr.value=Tt.value.createAnalyser(),hr.value.fftSize=256,Tt.value.createMediaStreamSource(e).connect(hr.value),hr.value}function Uc(e,t){return Tt.value||(Tt.value=new(window.AudioContext||window.webkitAudioContext)),pr.value=Tt.value.createAnalyser(),pr.value.fftSize=256,Tt.value.createMediaStreamSource(e).connect(pr.value),mr.value=Tt.value.createAnalyser(),mr.value.fftSize=256,Tt.value.createMediaStreamSource(t).connect(mr.value),{micAnalyser:pr.value,systemAnalyser:mr.value}}function lv(e){$r.value=e,sl.value=!0}function cv(){const e=$r.value;return $r.value=null,sl.value=!1,e}function uv(){$r.value=null,sl.value=!1}const fE=Object.freeze(Object.defineProperty({__proto__:null,acceptDisclaimer:cv,activeStreams:Pi,actualBitrate:nv,analyser:hr,animationFrameId:ea,asrLanguage:X_,asrMaxSpeakers:eE,asrMinSpeakers:Z_,asrResult:pf,asrResultOffline:gf,asrResultOnline:mf,audioBlobURL:lf,audioChunks:tl,audioContext:Tt,canRecordAudio:K_,canRecordSystemAudio:J_,cancelDisclaimer:uv,cleanupRecording:sv,combineAudioStreams:$c,createAudioOnlyStream:Bc,createMediaRecorderWithFallback:jc,currentDraftId:ff,discardRecordingState:Lc,draftRecordings:cE,draftsExpanded:uE,estimatedFileSize:rE,fileSizeWarningShown:oE,getFirstSupportedRecorderOption:av,getMicrophoneStream:Fc,getRecorderOptionsList:ov,getSystemAudioStream:Dc,initRecordingState:iv,isPaused:uf,isPausingRecording:q_,isRecording:W_,isStoppingRecording:tv,is_final:z_,maxRecordingMB:lE,mediaRecorder:os,micAnalyser:pr,get micStream(){return yt},micVisualizer:nE,pausedDuration:df,pausedTranscription:hf,pendingRecordingMode:$r,recordingInterval:rn,recordingMode:iE,recordingNotes:cf,recordingQuality:aE,recordingTime:nl,setMicStream:Nc,setSystemStream:na,setupDualVisualizer:Uc,setupSingleVisualizer:Hc,showDisclaimer:lv,showRecordingDisclaimerModal:sl,showSystemAudioHelp:Y_,sizeCheckInterval:ta,startRecordingTimer:rv,stopRecordingTimer:Pc,systemAnalyser:mr,systemAudioError:Q_,systemAudioSupported:G_,get systemStream(){return dt},systemVisualizer:sE,visualizer:tE},Symbol.toStringTag,{value:"Module"}));function dE({t:e,filteredRecordings:t,loadRecordings:n,showToast:s,currentPage:i,hasNextPage:r,isLoadingMore:o,searchQuery:l,availableTags:c,draftNameInput:h}){const f=de(!1),u=de(!1),m=de([]),v=de({start:"",end:""}),w=de(""),b=de(""),H=de("created_at"),P=de(null),M=de(""),S=de(null),_=zn(()=>[{value:"today",label:e("sidebar.today")},{value:"yesterday",label:e("sidebar.yesterday")},{value:"thisweek",label:e("sidebar.thisWeek")},{value:"lastweek",label:e("sidebar.lastWeek")},{value:"thismonth",label:e("sidebar.thisMonth")},{value:"lastmonth",label:e("sidebar.lastMonth")}]),x=(ie,ne)=>ie.getFullYear()===ne.getFullYear()&&ie.getMonth()===ne.getMonth()&&ie.getDate()===ne.getDate(),C=ie=>x(ie,new Date),V=ie=>{const ne=new Date;return ne.setDate(ne.getDate()-1),x(ie,ne)},F=ie=>{const ne=new Date,he=new Date(ne),Se=ne.getDay(),Qe=ne.getDate()-Se+(Se===0?-6:1);he.setDate(Qe),he.setHours(0,0,0,0);const Ye=new Date(he);return Ye.setDate(he.getDate()+6),Ye.setHours(23,59,59,999),ie>=he&&ie<=Ye},R=ie=>{const ne=new Date,he=new Date(ne),Se=ne.getDay(),Qe=ne.getDate()-Se+(Se===0?-6:1)-7;he.setDate(Qe),he.setHours(0,0,0,0);const Ye=new Date(he);return Ye.setDate(he.getDate()+6),Ye.setHours(23,59,59,999),ie>=he&&ie<=Ye},N=ie=>{const ne=new Date;return ie.getFullYear()===ne.getFullYear()&&ie.getMonth()===ne.getMonth()},B=ie=>{const ne=new Date,he=new Date(ne.getFullYear(),ne.getMonth()-1,1);return ie.getFullYear()===he.getFullYear()&&ie.getMonth()===he.getMonth()},A=ie=>{const ne=H.value==="meeting_date"?ie.meeting_date:ie.created_at;return ne?new Date(ne):null},K=zn(()=>{const ie=[...t.value].sort((he,Se)=>{const Qe=A(he),Ye=A(Se);return!Qe&&!Ye?0:Qe?Ye?Ye-Qe:-1:1}),ne={today:[],yesterday:[],thisWeek:[],lastWeek:[],thisMonth:[],lastMonth:[],older:[]};return ie.forEach(he=>{const Se=A(he);if(!Se){ne.older.push(he);return}C(Se)?ne.today.push(he):V(Se)?ne.yesterday.push(he):F(Se)?ne.thisWeek.push(he):R(Se)?ne.lastWeek.push(he):N(Se)?ne.thisMonth.push(he):B(Se)?ne.lastMonth.push(he):ne.older.push(he)}),[{title:e("sidebar.today"),items:ne.today},{title:e("sidebar.yesterday"),items:ne.yesterday},{title:e("sidebar.thisWeek"),items:ne.thisWeek},{title:e("sidebar.lastWeek"),items:ne.lastWeek},{title:e("sidebar.thisMonth"),items:ne.thisMonth},{title:e("sidebar.lastMonth"),items:ne.lastMonth},{title:e("sidebar.older"),items:ne.older}].filter(he=>he.items.length>0)}),re=()=>{f.value=!f.value},oe=()=>{let ie=[];if(b.value.trim()&&ie.push(b.value.trim()),m.value.length>0){const ne=m.value.map(he=>{const Se=c.value.find(Qe=>Qe.id===he);return Se?`tag:${Se.name.replace(/\s+/g,"_")}`:""}).filter(Boolean);ie.push(...ne)}return w.value?ie.push(`date:${w.value}`):(v.value.start||v.value.end)&&(v.value.start&&ie.push(`date_from:${v.value.start}`),v.value.end&&ie.push(`date_to:${v.value.end}`)),ie.join(" ")},J=()=>{l.value=oe()},fe=()=>{m.value=[],v.value={start:"",end:""},w.value="",b.value="",l.value=""},Z=ie=>{m.value=[ie.id],J()},Ae=()=>{l.value="",fe()},ft=async()=>{!r.value||o.value||await n(i.value+1,!0,l.value)},_e=ie=>{P.value=ie.id,M.value=ie.name,Ss(()=>{h.value&&h.value[0]?h.value[0].focus():h.value&&h.value.focus()})},He=async ie=>{if(!P.value)return;const ne=M.value.trim();if(P.value=null,!(!ne||ne===ie.name))try{const Se=await(await fetch(`/tool/speakr/api/draft/${ie.id}/rename`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ne})})).json();if(Se.success)ie.name=ne,s("重命名成功","fa-check");else throw new Error(Se.error)}catch(he){console.error("Error renaming draft:",he),s(`重命名失败: ${he.message}`,"fa-exclamation-circle")}};return wn(m,()=>{J()},{deep:!0}),wn(w,()=>{J()}),wn(v,()=>{J()},{deep:!0}),wn(b,ie=>{clearTimeout(S.value),S.value=setTimeout(()=>{J()},300)}),{isSidebarCollapsed:f,showAdvancedFilters:u,filterTags:m,filterDateRange:v,filterDatePreset:w,filterTextQuery:b,sortBy:H,editingDraftId:P,editingDraftName:M,datePresetOptions:_,groupedRecordings:K,toggleSidebar:re,buildSearchQuery:oe,applyAdvancedFilters:J,clearAllFilters:fe,filterByTag:Z,clearTagFilter:Ae,loadMoreRecordings:ft,startDraftRename:_e,saveDraftRename:He}}const{createApp:hE,ref:k,reactive:sc,computed:vt,onMounted:pE,watch:Et,nextTick:et}=N_;D_();document.addEventListener("DOMContentLoaded",async()=>{var r;if(window.i18n){const o=document.getElementById("app"),l=(o==null?void 0:o.dataset.userLanguage)||localStorage.getItem("preferredLanguage")||"en";await window.i18n.init(l),console.log("i18n initialized with language:",l)}const e=k((r=document.querySelector('meta[name="csrf-token"]'))==null?void 0:r.getAttribute("content"));"serviceWorker"in navigator&&window.isSecureContext&&window.location.hostname!=="localhost"&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/tool/speakr/static/sw.js").then(o=>{console.log("ServiceWorker registration successful with scope: ",o.scope)}).catch(o=>{console.log("ServiceWorker registration failed: ",o)})});const t=(o,l={})=>!window.i18n||!window.i18n.t?o:window.i18n.t(o,l);let n=null,s=null;const i=hE({setup(){let o=!1,l="";const c=k("upload"),h=k(!1),f=k([]),u=k(null),m=k("summary"),v=k(""),w=k(!0),b=k(null),H=k(1),P=k(25),M=k(0),S=k(0),_=k(!1),x=k(!1),C=k(!1),V=k(null);k(null);const F=k("unknown"),R=k(!1),N=k(!1),B=k(!1),A=k("blue"),K=k(!1),re=k(window.innerWidth),oe=k("transcript"),J=k(!1),fe=k("en"),Z=k("English"),Ae=k([]),ft=k(!1),_e=k([]),He=k(null),ie=k(0),ne=k(""),he=k(!1),Se=k(null),Qe=k(!1),Ye=k(!1),mn=k(250),Zt=k(!0),In=k("size"),En=k(20),g=k("20MB"),T=k(""),I=k(null),{isRecording:j,isStoppingRecording:U,isPausingRecording:W,is_final:G,mediaRecorder:z,audioChunks:q,audioBlobURL:$,recordingTime:ae,recordingInterval:Y,canRecordAudio:pe,canRecordSystemAudio:ye,systemAudioSupported:xe,systemAudioError:Le,recordingNotes:Ce,showSystemAudioHelp:_t,asrLanguage:We,asrMinSpeakers:lt,asrMaxSpeakers:st,audioContext:gn,analyser:ws,micAnalyser:Ct,systemAnalyser:qt,visualizer:bs,micVisualizer:Ts,systemVisualizer:Bi,animationFrameId:cn,recordingMode:Bt,activeStreams:vn,estimatedFileSize:ji,fileSizeWarningShown:zs,recordingQuality:il,actualBitrate:_s,maxRecordingMB:Yn,sizeCheckInterval:Xn,isPaused:jt,currentDraftId:mt,pausedDuration:E,pausedTranscription:D,draftRecordings:Q,draftsExpanded:te,asrResult:le,asrResultOnline:Re,asrResultOffline:Oe,showRecordingDisclaimerModal:Xe}=fE,qe=k(!1),Ze=k(""),Ks=k(""),rl=k(""),yn=k([]),Nn=k([]),ol=k(""),Es=vt(()=>Nn.value.map(a=>yn.value.find(d=>d.id==a)).filter(Boolean)),fv=vt(()=>{const a=Cn.value;return a.includes("#")||a.includes("**")||a.includes("```")||a.includes("* ")||a.includes("- ")}),dv=zn(()=>window.marked.parse(Cn.value||"",{breaks:!0})),hv=vt(()=>{const a=yn.value.filter(p=>!Nn.value.includes(p.id));if(!ol.value)return a;const d=ol.value.toLowerCase();return a.filter(p=>p.name.toLowerCase().includes(d))}),Zr=k(!1),eo=k(!1),al=k(!1),Hi=k(""),to=k(""),pv=k(!1),mv=k(!1),vf=k(!1),ll=k(!1),cl=k(!1),gv=k(!1),vv=k(!1),ct=k(null),yv=k(""),Sv=k([]),wv=k([]),Ui=k(null),Js=sc({share_summary:!0,share_notes:!0}),Gs=k(""),Vi=k(!1),Wi=k([]),ul=k(!1),Qs=k(null),no=k(!1),Ys=k(null),bv=k(null),Tv=k(null),_v=k(null),Ev=k(!1),Cv=k({language:"zh",min_speakers:1,max_speakers:10}),Cs=k({}),kv=k(!1),fl=k({}),xv=k({}),Rv=k(null),Av=k({}),Mv=k([]),Ov=k(-1),Iv=k([]),Xs=k(!1),Zs=k(!1),Ot=k(!1),It=k(!1),so=k(""),io=k(""),ei=k(null),yf=2e3,dl=k(null),it=k(null),hl=k(null),rt=k(null),pl=k(null),Pn=k(null),qi=k("simple"),Nv=k(!1),Pv=k(null),ro=k(!1),ti=k(!1),en=k([]),oo=k(""),ni=k(!1),ks=k(null),ao=k(1),zi=k(60),lo=k(40),co=k(!1),Ki=k(!1),Ji=k(""),Gi=k(""),Zn=k(""),uo=k(""),Sf=k({name:"领导发言稿",fontSize:40}),ml=k(!1),Qi=k(null),Cn=k(""),wf=k(!1),bf=k(!1),gl=k(0),vl=k(0),yl=k("获取链接中..."),Tf=k(""),Yi=k(!1),_f=k(!0),Sl=k((localStorage.getItem("selectedScene")||"cg").toLowerCase()==="yl"?"yl":"cg"),Ln=k(!1),wl=k(""),fo=k(""),ho=k(""),po=k(""),Xi=k(""),Zi=k(""),Ef=k(null),Cf=k(null),bl=k(null),kf=k(66.67),mo=k(!1);let go=null;const si=vt(()=>(le.value||"")+(Oe.value||"")+(Re.value||"")),er=vt(()=>(fo.value||"")+(po.value||"")+(ho.value||"")),Tl=vt(()=>Bt.value==="both"),Lv=vt(()=>{if(!Tl.value)return si.value;const a=si.value||"",d=er.value||"",p=[];return a&&p.push(`[MIC] `+a),d&&p.push(`[SYSTEM] `+d),p.join(` diff --git a/speakr/static/vite/index/assets/index.js.map b/speakr/static/vite/index/assets/index.js.map index 5d30a1e..c6c7de3 100644 --- a/speakr/static/vite/index/assets/index.js.map +++ b/speakr/static/vite/index/assets/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../../../templates/index/node_modules/@vue/shared/dist/shared.esm-bundler.js","../../../../templates/index/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js","../../../../templates/index/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js","../../../../templates/index/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js","../../../../templates/index/node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js","../../../../templates/index/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js","../../../../templates/index/node_modules/vue/dist/vue.esm-bundler.js","../../../../templates/index/src/csrf-refresh.js","../../../../templates/index/src/i18n.js","../../../../templates/index/src/vendor-globals.js","../../../../templates/index/src/asr/wsconnecter.js","../../../../templates/index/src/asr/realtime-asr-pipeline.js","../../../../templates/index/src/composables/useRecordingOperations.js","../../../../templates/index/src/composables/useRecordingState.js","../../../../templates/index/src/composables/useSidebar.js","../../../../templates/index/src/main.js"],"sourcesContent":["/**\n* @vue/shared v3.5.22\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\n// @__NO_SIDE_EFFECTS__\nfunction makeMap(str) {\n const map = /* @__PURE__ */ Object.create(null);\n for (const key of str.split(\",\")) map[key] = 1;\n return (val) => val in map;\n}\n\nconst EMPTY_OBJ = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze({}) : {};\nconst EMPTY_ARR = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze([]) : [];\nconst NOOP = () => {\n};\nconst NO = () => false;\nconst isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter\n(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);\nconst isModelListener = (key) => key.startsWith(\"onUpdate:\");\nconst extend = Object.assign;\nconst remove = (arr, el) => {\n const i = arr.indexOf(el);\n if (i > -1) {\n arr.splice(i, 1);\n }\n};\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nconst hasOwn = (val, key) => hasOwnProperty.call(val, key);\nconst isArray = Array.isArray;\nconst isMap = (val) => toTypeString(val) === \"[object Map]\";\nconst isSet = (val) => toTypeString(val) === \"[object Set]\";\nconst isDate = (val) => toTypeString(val) === \"[object Date]\";\nconst isRegExp = (val) => toTypeString(val) === \"[object RegExp]\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isString = (val) => typeof val === \"string\";\nconst isSymbol = (val) => typeof val === \"symbol\";\nconst isObject = (val) => val !== null && typeof val === \"object\";\nconst isPromise = (val) => {\n return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);\n};\nconst objectToString = Object.prototype.toString;\nconst toTypeString = (value) => objectToString.call(value);\nconst toRawType = (value) => {\n return toTypeString(value).slice(8, -1);\n};\nconst isPlainObject = (val) => toTypeString(val) === \"[object Object]\";\nconst isIntegerKey = (key) => isString(key) && key !== \"NaN\" && key[0] !== \"-\" && \"\" + parseInt(key, 10) === key;\nconst isReservedProp = /* @__PURE__ */ makeMap(\n // the leading comma is intentional so empty string \"\" is also included\n \",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted\"\n);\nconst isBuiltInDirective = /* @__PURE__ */ makeMap(\n \"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo\"\n);\nconst cacheStringFunction = (fn) => {\n const cache = /* @__PURE__ */ Object.create(null);\n return ((str) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n });\n};\nconst camelizeRE = /-\\w/g;\nconst camelize = cacheStringFunction(\n (str) => {\n return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());\n }\n);\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = cacheStringFunction(\n (str) => str.replace(hyphenateRE, \"-$1\").toLowerCase()\n);\nconst capitalize = cacheStringFunction((str) => {\n return str.charAt(0).toUpperCase() + str.slice(1);\n});\nconst toHandlerKey = cacheStringFunction(\n (str) => {\n const s = str ? `on${capitalize(str)}` : ``;\n return s;\n }\n);\nconst hasChanged = (value, oldValue) => !Object.is(value, oldValue);\nconst invokeArrayFns = (fns, ...arg) => {\n for (let i = 0; i < fns.length; i++) {\n fns[i](...arg);\n }\n};\nconst def = (obj, key, value, writable = false) => {\n Object.defineProperty(obj, key, {\n configurable: true,\n enumerable: false,\n writable,\n value\n });\n};\nconst looseToNumber = (val) => {\n const n = parseFloat(val);\n return isNaN(n) ? val : n;\n};\nconst toNumber = (val) => {\n const n = isString(val) ? Number(val) : NaN;\n return isNaN(n) ? val : n;\n};\nlet _globalThis;\nconst getGlobalThis = () => {\n return _globalThis || (_globalThis = typeof globalThis !== \"undefined\" ? globalThis : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : {});\n};\nconst identRE = /^[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*$/;\nfunction genPropsAccessExp(name) {\n return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;\n}\nfunction genCacheKey(source, options) {\n return source + JSON.stringify(\n options,\n (_, val) => typeof val === \"function\" ? val.toString() : val\n );\n}\n\nconst PatchFlags = {\n \"TEXT\": 1,\n \"1\": \"TEXT\",\n \"CLASS\": 2,\n \"2\": \"CLASS\",\n \"STYLE\": 4,\n \"4\": \"STYLE\",\n \"PROPS\": 8,\n \"8\": \"PROPS\",\n \"FULL_PROPS\": 16,\n \"16\": \"FULL_PROPS\",\n \"NEED_HYDRATION\": 32,\n \"32\": \"NEED_HYDRATION\",\n \"STABLE_FRAGMENT\": 64,\n \"64\": \"STABLE_FRAGMENT\",\n \"KEYED_FRAGMENT\": 128,\n \"128\": \"KEYED_FRAGMENT\",\n \"UNKEYED_FRAGMENT\": 256,\n \"256\": \"UNKEYED_FRAGMENT\",\n \"NEED_PATCH\": 512,\n \"512\": \"NEED_PATCH\",\n \"DYNAMIC_SLOTS\": 1024,\n \"1024\": \"DYNAMIC_SLOTS\",\n \"DEV_ROOT_FRAGMENT\": 2048,\n \"2048\": \"DEV_ROOT_FRAGMENT\",\n \"CACHED\": -1,\n \"-1\": \"CACHED\",\n \"BAIL\": -2,\n \"-2\": \"BAIL\"\n};\nconst PatchFlagNames = {\n [1]: `TEXT`,\n [2]: `CLASS`,\n [4]: `STYLE`,\n [8]: `PROPS`,\n [16]: `FULL_PROPS`,\n [32]: `NEED_HYDRATION`,\n [64]: `STABLE_FRAGMENT`,\n [128]: `KEYED_FRAGMENT`,\n [256]: `UNKEYED_FRAGMENT`,\n [512]: `NEED_PATCH`,\n [1024]: `DYNAMIC_SLOTS`,\n [2048]: `DEV_ROOT_FRAGMENT`,\n [-1]: `CACHED`,\n [-2]: `BAIL`\n};\n\nconst ShapeFlags = {\n \"ELEMENT\": 1,\n \"1\": \"ELEMENT\",\n \"FUNCTIONAL_COMPONENT\": 2,\n \"2\": \"FUNCTIONAL_COMPONENT\",\n \"STATEFUL_COMPONENT\": 4,\n \"4\": \"STATEFUL_COMPONENT\",\n \"TEXT_CHILDREN\": 8,\n \"8\": \"TEXT_CHILDREN\",\n \"ARRAY_CHILDREN\": 16,\n \"16\": \"ARRAY_CHILDREN\",\n \"SLOTS_CHILDREN\": 32,\n \"32\": \"SLOTS_CHILDREN\",\n \"TELEPORT\": 64,\n \"64\": \"TELEPORT\",\n \"SUSPENSE\": 128,\n \"128\": \"SUSPENSE\",\n \"COMPONENT_SHOULD_KEEP_ALIVE\": 256,\n \"256\": \"COMPONENT_SHOULD_KEEP_ALIVE\",\n \"COMPONENT_KEPT_ALIVE\": 512,\n \"512\": \"COMPONENT_KEPT_ALIVE\",\n \"COMPONENT\": 6,\n \"6\": \"COMPONENT\"\n};\n\nconst SlotFlags = {\n \"STABLE\": 1,\n \"1\": \"STABLE\",\n \"DYNAMIC\": 2,\n \"2\": \"DYNAMIC\",\n \"FORWARDED\": 3,\n \"3\": \"FORWARDED\"\n};\nconst slotFlagsText = {\n [1]: \"STABLE\",\n [2]: \"DYNAMIC\",\n [3]: \"FORWARDED\"\n};\n\nconst GLOBALS_ALLOWED = \"Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol\";\nconst isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);\nconst isGloballyWhitelisted = isGloballyAllowed;\n\nconst range = 2;\nfunction generateCodeFrame(source, start = 0, end = source.length) {\n start = Math.max(0, Math.min(start, source.length));\n end = Math.max(0, Math.min(end, source.length));\n if (start > end) return \"\";\n let lines = source.split(/(\\r?\\n)/);\n const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);\n lines = lines.filter((_, idx) => idx % 2 === 0);\n let count = 0;\n const res = [];\n for (let i = 0; i < lines.length; i++) {\n count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);\n if (count >= start) {\n for (let j = i - range; j <= i + range || end > count; j++) {\n if (j < 0 || j >= lines.length) continue;\n const line = j + 1;\n res.push(\n `${line}${\" \".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`\n );\n const lineLength = lines[j].length;\n const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;\n if (j === i) {\n const pad = start - (count - (lineLength + newLineSeqLength));\n const length = Math.max(\n 1,\n end > count ? lineLength - pad : end - start\n );\n res.push(` | ` + \" \".repeat(pad) + \"^\".repeat(length));\n } else if (j > i) {\n if (end > count) {\n const length = Math.max(Math.min(end - count, lineLength), 1);\n res.push(` | ` + \"^\".repeat(length));\n }\n count += lineLength + newLineSeqLength;\n }\n }\n break;\n }\n }\n return res.join(\"\\n\");\n}\n\nfunction normalizeStyle(value) {\n if (isArray(value)) {\n const res = {};\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);\n if (normalized) {\n for (const key in normalized) {\n res[key] = normalized[key];\n }\n }\n }\n return res;\n } else if (isString(value) || isObject(value)) {\n return value;\n }\n}\nconst listDelimiterRE = /;(?![^(]*\\))/g;\nconst propertyDelimiterRE = /:([^]+)/;\nconst styleCommentRE = /\\/\\*[^]*?\\*\\//g;\nfunction parseStringStyle(cssText) {\n const ret = {};\n cssText.replace(styleCommentRE, \"\").split(listDelimiterRE).forEach((item) => {\n if (item) {\n const tmp = item.split(propertyDelimiterRE);\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return ret;\n}\nfunction stringifyStyle(styles) {\n if (!styles) return \"\";\n if (isString(styles)) return styles;\n let ret = \"\";\n for (const key in styles) {\n const value = styles[key];\n if (isString(value) || typeof value === \"number\") {\n const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);\n ret += `${normalizedKey}:${value};`;\n }\n }\n return ret;\n}\nfunction normalizeClass(value) {\n let res = \"\";\n if (isString(value)) {\n res = value;\n } else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const normalized = normalizeClass(value[i]);\n if (normalized) {\n res += normalized + \" \";\n }\n }\n } else if (isObject(value)) {\n for (const name in value) {\n if (value[name]) {\n res += name + \" \";\n }\n }\n }\n return res.trim();\n}\nfunction normalizeProps(props) {\n if (!props) return null;\n let { class: klass, style } = props;\n if (klass && !isString(klass)) {\n props.class = normalizeClass(klass);\n }\n if (style) {\n props.style = normalizeStyle(style);\n }\n return props;\n}\n\nconst HTML_TAGS = \"html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot\";\nconst SVG_TAGS = \"svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view\";\nconst MATH_TAGS = \"annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics\";\nconst VOID_TAGS = \"area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr\";\nconst isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);\nconst isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);\nconst isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);\nconst isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);\n\nconst specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;\nconst isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);\nconst isBooleanAttr = /* @__PURE__ */ makeMap(\n specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`\n);\nfunction includeBooleanAttr(value) {\n return !!value || value === \"\";\n}\nconst unsafeAttrCharRE = /[>/=\"'\\u0009\\u000a\\u000c\\u0020]/;\nconst attrValidationCache = {};\nfunction isSSRSafeAttrName(name) {\n if (attrValidationCache.hasOwnProperty(name)) {\n return attrValidationCache[name];\n }\n const isUnsafe = unsafeAttrCharRE.test(name);\n if (isUnsafe) {\n console.error(`unsafe attribute name: ${name}`);\n }\n return attrValidationCache[name] = !isUnsafe;\n}\nconst propsToAttrMap = {\n acceptCharset: \"accept-charset\",\n className: \"class\",\n htmlFor: \"for\",\n httpEquiv: \"http-equiv\"\n};\nconst isKnownHtmlAttr = /* @__PURE__ */ makeMap(\n `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`\n);\nconst isKnownSvgAttr = /* @__PURE__ */ makeMap(\n `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`\n);\nconst isKnownMathMLAttr = /* @__PURE__ */ makeMap(\n `accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`\n);\nfunction isRenderableAttrValue(value) {\n if (value == null) {\n return false;\n }\n const type = typeof value;\n return type === \"string\" || type === \"number\" || type === \"boolean\";\n}\n\nconst escapeRE = /[\"'&<>]/;\nfunction escapeHtml(string) {\n const str = \"\" + string;\n const match = escapeRE.exec(str);\n if (!match) {\n return str;\n }\n let html = \"\";\n let escaped;\n let index;\n let lastIndex = 0;\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34:\n escaped = \""\";\n break;\n case 38:\n escaped = \"&\";\n break;\n case 39:\n escaped = \"'\";\n break;\n case 60:\n escaped = \"<\";\n break;\n case 62:\n escaped = \">\";\n break;\n default:\n continue;\n }\n if (lastIndex !== index) {\n html += str.slice(lastIndex, index);\n }\n lastIndex = index + 1;\n html += escaped;\n }\n return lastIndex !== index ? html + str.slice(lastIndex, index) : html;\n}\nconst commentStripRE = /^-?>||--!>|?@[\\\\\\]^`{|}~]/g;\nfunction getEscapedCssVarName(key, doubleEscape) {\n return key.replace(\n cssVarNameEscapeSymbolsRE,\n (s) => doubleEscape ? s === '\"' ? '\\\\\\\\\\\\\"' : `\\\\\\\\${s}` : `\\\\${s}`\n );\n}\n\nfunction looseCompareArrays(a, b) {\n if (a.length !== b.length) return false;\n let equal = true;\n for (let i = 0; equal && i < a.length; i++) {\n equal = looseEqual(a[i], b[i]);\n }\n return equal;\n}\nfunction looseEqual(a, b) {\n if (a === b) return true;\n let aValidType = isDate(a);\n let bValidType = isDate(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? a.getTime() === b.getTime() : false;\n }\n aValidType = isSymbol(a);\n bValidType = isSymbol(b);\n if (aValidType || bValidType) {\n return a === b;\n }\n aValidType = isArray(a);\n bValidType = isArray(b);\n if (aValidType || bValidType) {\n return aValidType && bValidType ? looseCompareArrays(a, b) : false;\n }\n aValidType = isObject(a);\n bValidType = isObject(b);\n if (aValidType || bValidType) {\n if (!aValidType || !bValidType) {\n return false;\n }\n const aKeysCount = Object.keys(a).length;\n const bKeysCount = Object.keys(b).length;\n if (aKeysCount !== bKeysCount) {\n return false;\n }\n for (const key in a) {\n const aHasKey = a.hasOwnProperty(key);\n const bHasKey = b.hasOwnProperty(key);\n if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {\n return false;\n }\n }\n }\n return String(a) === String(b);\n}\nfunction looseIndexOf(arr, val) {\n return arr.findIndex((item) => looseEqual(item, val));\n}\n\nconst isRef = (val) => {\n return !!(val && val[\"__v_isRef\"] === true);\n};\nconst toDisplayString = (val) => {\n return isString(val) ? val : val == null ? \"\" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);\n};\nconst replacer = (_key, val) => {\n if (isRef(val)) {\n return replacer(_key, val.value);\n } else if (isMap(val)) {\n return {\n [`Map(${val.size})`]: [...val.entries()].reduce(\n (entries, [key, val2], i) => {\n entries[stringifySymbol(key, i) + \" =>\"] = val2;\n return entries;\n },\n {}\n )\n };\n } else if (isSet(val)) {\n return {\n [`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))\n };\n } else if (isSymbol(val)) {\n return stringifySymbol(val);\n } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {\n return String(val);\n }\n return val;\n};\nconst stringifySymbol = (v, i = \"\") => {\n var _a;\n return (\n // Symbol.description in es2019+ so we need to cast here to pass\n // the lib: es2016 check\n isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v\n );\n};\n\nfunction normalizeCssVarValue(value) {\n if (value == null) {\n return \"initial\";\n }\n if (typeof value === \"string\") {\n return value === \"\" ? \" \" : value;\n }\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n console.warn(\n \"[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:\",\n value\n );\n }\n }\n return String(value);\n}\n\nexport { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, PatchFlags, ShapeFlags, SlotFlags, camelize, capitalize, cssVarNameEscapeSymbolsRE, def, escapeHtml, escapeHtmlComment, extend, genCacheKey, genPropsAccessExp, generateCodeFrame, getEscapedCssVarName, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyAllowed, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownMathMLAttr, isKnownSvgAttr, isMap, isMathMLTag, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isRenderableAttrValue, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeCssVarValue, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };\n","/**\n* @vue/reactivity v3.5.22\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\nimport { extend, hasChanged, isArray, isIntegerKey, isSymbol, isMap, hasOwn, makeMap, isObject, capitalize, toRawType, def, isFunction, EMPTY_OBJ, isSet, isPlainObject, remove, NOOP } from '@vue/shared';\n\nfunction warn(msg, ...args) {\n console.warn(`[Vue warn] ${msg}`, ...args);\n}\n\nlet activeEffectScope;\nclass EffectScope {\n constructor(detached = false) {\n this.detached = detached;\n /**\n * @internal\n */\n this._active = true;\n /**\n * @internal track `on` calls, allow `on` call multiple times\n */\n this._on = 0;\n /**\n * @internal\n */\n this.effects = [];\n /**\n * @internal\n */\n this.cleanups = [];\n this._isPaused = false;\n this.parent = activeEffectScope;\n if (!detached && activeEffectScope) {\n this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(\n this\n ) - 1;\n }\n }\n get active() {\n return this._active;\n }\n pause() {\n if (this._active) {\n this._isPaused = true;\n let i, l;\n if (this.scopes) {\n for (i = 0, l = this.scopes.length; i < l; i++) {\n this.scopes[i].pause();\n }\n }\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].pause();\n }\n }\n }\n /**\n * Resumes the effect scope, including all child scopes and effects.\n */\n resume() {\n if (this._active) {\n if (this._isPaused) {\n this._isPaused = false;\n let i, l;\n if (this.scopes) {\n for (i = 0, l = this.scopes.length; i < l; i++) {\n this.scopes[i].resume();\n }\n }\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].resume();\n }\n }\n }\n }\n run(fn) {\n if (this._active) {\n const currentEffectScope = activeEffectScope;\n try {\n activeEffectScope = this;\n return fn();\n } finally {\n activeEffectScope = currentEffectScope;\n }\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(`cannot run an inactive effect scope.`);\n }\n }\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n on() {\n if (++this._on === 1) {\n this.prevScope = activeEffectScope;\n activeEffectScope = this;\n }\n }\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n off() {\n if (this._on > 0 && --this._on === 0) {\n activeEffectScope = this.prevScope;\n this.prevScope = void 0;\n }\n }\n stop(fromParent) {\n if (this._active) {\n this._active = false;\n let i, l;\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].stop();\n }\n this.effects.length = 0;\n for (i = 0, l = this.cleanups.length; i < l; i++) {\n this.cleanups[i]();\n }\n this.cleanups.length = 0;\n if (this.scopes) {\n for (i = 0, l = this.scopes.length; i < l; i++) {\n this.scopes[i].stop(true);\n }\n this.scopes.length = 0;\n }\n if (!this.detached && this.parent && !fromParent) {\n const last = this.parent.scopes.pop();\n if (last && last !== this) {\n this.parent.scopes[this.index] = last;\n last.index = this.index;\n }\n }\n this.parent = void 0;\n }\n }\n}\nfunction effectScope(detached) {\n return new EffectScope(detached);\n}\nfunction getCurrentScope() {\n return activeEffectScope;\n}\nfunction onScopeDispose(fn, failSilently = false) {\n if (activeEffectScope) {\n activeEffectScope.cleanups.push(fn);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onScopeDispose() is called when there is no active effect scope to be associated with.`\n );\n }\n}\n\nlet activeSub;\nconst EffectFlags = {\n \"ACTIVE\": 1,\n \"1\": \"ACTIVE\",\n \"RUNNING\": 2,\n \"2\": \"RUNNING\",\n \"TRACKING\": 4,\n \"4\": \"TRACKING\",\n \"NOTIFIED\": 8,\n \"8\": \"NOTIFIED\",\n \"DIRTY\": 16,\n \"16\": \"DIRTY\",\n \"ALLOW_RECURSE\": 32,\n \"32\": \"ALLOW_RECURSE\",\n \"PAUSED\": 64,\n \"64\": \"PAUSED\",\n \"EVALUATED\": 128,\n \"128\": \"EVALUATED\"\n};\nconst pausedQueueEffects = /* @__PURE__ */ new WeakSet();\nclass ReactiveEffect {\n constructor(fn) {\n this.fn = fn;\n /**\n * @internal\n */\n this.deps = void 0;\n /**\n * @internal\n */\n this.depsTail = void 0;\n /**\n * @internal\n */\n this.flags = 1 | 4;\n /**\n * @internal\n */\n this.next = void 0;\n /**\n * @internal\n */\n this.cleanup = void 0;\n this.scheduler = void 0;\n if (activeEffectScope && activeEffectScope.active) {\n activeEffectScope.effects.push(this);\n }\n }\n pause() {\n this.flags |= 64;\n }\n resume() {\n if (this.flags & 64) {\n this.flags &= -65;\n if (pausedQueueEffects.has(this)) {\n pausedQueueEffects.delete(this);\n this.trigger();\n }\n }\n }\n /**\n * @internal\n */\n notify() {\n if (this.flags & 2 && !(this.flags & 32)) {\n return;\n }\n if (!(this.flags & 8)) {\n batch(this);\n }\n }\n run() {\n if (!(this.flags & 1)) {\n return this.fn();\n }\n this.flags |= 2;\n cleanupEffect(this);\n prepareDeps(this);\n const prevEffect = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = this;\n shouldTrack = true;\n try {\n return this.fn();\n } finally {\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub !== this) {\n warn(\n \"Active effect was not restored correctly - this is likely a Vue internal bug.\"\n );\n }\n cleanupDeps(this);\n activeSub = prevEffect;\n shouldTrack = prevShouldTrack;\n this.flags &= -3;\n }\n }\n stop() {\n if (this.flags & 1) {\n for (let link = this.deps; link; link = link.nextDep) {\n removeSub(link);\n }\n this.deps = this.depsTail = void 0;\n cleanupEffect(this);\n this.onStop && this.onStop();\n this.flags &= -2;\n }\n }\n trigger() {\n if (this.flags & 64) {\n pausedQueueEffects.add(this);\n } else if (this.scheduler) {\n this.scheduler();\n } else {\n this.runIfDirty();\n }\n }\n /**\n * @internal\n */\n runIfDirty() {\n if (isDirty(this)) {\n this.run();\n }\n }\n get dirty() {\n return isDirty(this);\n }\n}\nlet batchDepth = 0;\nlet batchedSub;\nlet batchedComputed;\nfunction batch(sub, isComputed = false) {\n sub.flags |= 8;\n if (isComputed) {\n sub.next = batchedComputed;\n batchedComputed = sub;\n return;\n }\n sub.next = batchedSub;\n batchedSub = sub;\n}\nfunction startBatch() {\n batchDepth++;\n}\nfunction endBatch() {\n if (--batchDepth > 0) {\n return;\n }\n if (batchedComputed) {\n let e = batchedComputed;\n batchedComputed = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n e = next;\n }\n }\n let error;\n while (batchedSub) {\n let e = batchedSub;\n batchedSub = void 0;\n while (e) {\n const next = e.next;\n e.next = void 0;\n e.flags &= -9;\n if (e.flags & 1) {\n try {\n ;\n e.trigger();\n } catch (err) {\n if (!error) error = err;\n }\n }\n e = next;\n }\n }\n if (error) throw error;\n}\nfunction prepareDeps(sub) {\n for (let link = sub.deps; link; link = link.nextDep) {\n link.version = -1;\n link.prevActiveLink = link.dep.activeLink;\n link.dep.activeLink = link;\n }\n}\nfunction cleanupDeps(sub) {\n let head;\n let tail = sub.depsTail;\n let link = tail;\n while (link) {\n const prev = link.prevDep;\n if (link.version === -1) {\n if (link === tail) tail = prev;\n removeSub(link);\n removeDep(link);\n } else {\n head = link;\n }\n link.dep.activeLink = link.prevActiveLink;\n link.prevActiveLink = void 0;\n link = prev;\n }\n sub.deps = head;\n sub.depsTail = tail;\n}\nfunction isDirty(sub) {\n for (let link = sub.deps; link; link = link.nextDep) {\n if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {\n return true;\n }\n }\n if (sub._dirty) {\n return true;\n }\n return false;\n}\nfunction refreshComputed(computed) {\n if (computed.flags & 4 && !(computed.flags & 16)) {\n return;\n }\n computed.flags &= -17;\n if (computed.globalVersion === globalVersion) {\n return;\n }\n computed.globalVersion = globalVersion;\n if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {\n return;\n }\n computed.flags |= 2;\n const dep = computed.dep;\n const prevSub = activeSub;\n const prevShouldTrack = shouldTrack;\n activeSub = computed;\n shouldTrack = true;\n try {\n prepareDeps(computed);\n const value = computed.fn(computed._value);\n if (dep.version === 0 || hasChanged(value, computed._value)) {\n computed.flags |= 128;\n computed._value = value;\n dep.version++;\n }\n } catch (err) {\n dep.version++;\n throw err;\n } finally {\n activeSub = prevSub;\n shouldTrack = prevShouldTrack;\n cleanupDeps(computed);\n computed.flags &= -3;\n }\n}\nfunction removeSub(link, soft = false) {\n const { dep, prevSub, nextSub } = link;\n if (prevSub) {\n prevSub.nextSub = nextSub;\n link.prevSub = void 0;\n }\n if (nextSub) {\n nextSub.prevSub = prevSub;\n link.nextSub = void 0;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && dep.subsHead === link) {\n dep.subsHead = nextSub;\n }\n if (dep.subs === link) {\n dep.subs = prevSub;\n if (!prevSub && dep.computed) {\n dep.computed.flags &= -5;\n for (let l = dep.computed.deps; l; l = l.nextDep) {\n removeSub(l, true);\n }\n }\n }\n if (!soft && !--dep.sc && dep.map) {\n dep.map.delete(dep.key);\n }\n}\nfunction removeDep(link) {\n const { prevDep, nextDep } = link;\n if (prevDep) {\n prevDep.nextDep = nextDep;\n link.prevDep = void 0;\n }\n if (nextDep) {\n nextDep.prevDep = prevDep;\n link.nextDep = void 0;\n }\n}\nfunction effect(fn, options) {\n if (fn.effect instanceof ReactiveEffect) {\n fn = fn.effect.fn;\n }\n const e = new ReactiveEffect(fn);\n if (options) {\n extend(e, options);\n }\n try {\n e.run();\n } catch (err) {\n e.stop();\n throw err;\n }\n const runner = e.run.bind(e);\n runner.effect = e;\n return runner;\n}\nfunction stop(runner) {\n runner.effect.stop();\n}\nlet shouldTrack = true;\nconst trackStack = [];\nfunction pauseTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = false;\n}\nfunction enableTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = true;\n}\nfunction resetTracking() {\n const last = trackStack.pop();\n shouldTrack = last === void 0 ? true : last;\n}\nfunction onEffectCleanup(fn, failSilently = false) {\n if (activeSub instanceof ReactiveEffect) {\n activeSub.cleanup = fn;\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onEffectCleanup() was called when there was no active effect to associate with.`\n );\n }\n}\nfunction cleanupEffect(e) {\n const { cleanup } = e;\n e.cleanup = void 0;\n if (cleanup) {\n const prevSub = activeSub;\n activeSub = void 0;\n try {\n cleanup();\n } finally {\n activeSub = prevSub;\n }\n }\n}\n\nlet globalVersion = 0;\nclass Link {\n constructor(sub, dep) {\n this.sub = sub;\n this.dep = dep;\n this.version = dep.version;\n this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;\n }\n}\nclass Dep {\n // TODO isolatedDeclarations \"__v_skip\"\n constructor(computed) {\n this.computed = computed;\n this.version = 0;\n /**\n * Link between this dep and the current active effect\n */\n this.activeLink = void 0;\n /**\n * Doubly linked list representing the subscribing effects (tail)\n */\n this.subs = void 0;\n /**\n * For object property deps cleanup\n */\n this.map = void 0;\n this.key = void 0;\n /**\n * Subscriber counter\n */\n this.sc = 0;\n /**\n * @internal\n */\n this.__v_skip = true;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.subsHead = void 0;\n }\n }\n track(debugInfo) {\n if (!activeSub || !shouldTrack || activeSub === this.computed) {\n return;\n }\n let link = this.activeLink;\n if (link === void 0 || link.sub !== activeSub) {\n link = this.activeLink = new Link(activeSub, this);\n if (!activeSub.deps) {\n activeSub.deps = activeSub.depsTail = link;\n } else {\n link.prevDep = activeSub.depsTail;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n }\n addSub(link);\n } else if (link.version === -1) {\n link.version = this.version;\n if (link.nextDep) {\n const next = link.nextDep;\n next.prevDep = link.prevDep;\n if (link.prevDep) {\n link.prevDep.nextDep = next;\n }\n link.prevDep = activeSub.depsTail;\n link.nextDep = void 0;\n activeSub.depsTail.nextDep = link;\n activeSub.depsTail = link;\n if (activeSub.deps === link) {\n activeSub.deps = next;\n }\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\") && activeSub.onTrack) {\n activeSub.onTrack(\n extend(\n {\n effect: activeSub\n },\n debugInfo\n )\n );\n }\n return link;\n }\n trigger(debugInfo) {\n this.version++;\n globalVersion++;\n this.notify(debugInfo);\n }\n notify(debugInfo) {\n startBatch();\n try {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n for (let head = this.subsHead; head; head = head.nextSub) {\n if (head.sub.onTrigger && !(head.sub.flags & 8)) {\n head.sub.onTrigger(\n extend(\n {\n effect: head.sub\n },\n debugInfo\n )\n );\n }\n }\n }\n for (let link = this.subs; link; link = link.prevSub) {\n if (link.sub.notify()) {\n ;\n link.sub.dep.notify();\n }\n }\n } finally {\n endBatch();\n }\n }\n}\nfunction addSub(link) {\n link.dep.sc++;\n if (link.sub.flags & 4) {\n const computed = link.dep.computed;\n if (computed && !link.dep.subs) {\n computed.flags |= 4 | 16;\n for (let l = computed.deps; l; l = l.nextDep) {\n addSub(l);\n }\n }\n const currentTail = link.dep.subs;\n if (currentTail !== link) {\n link.prevSub = currentTail;\n if (currentTail) currentTail.nextSub = link;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && link.dep.subsHead === void 0) {\n link.dep.subsHead = link;\n }\n link.dep.subs = link;\n }\n}\nconst targetMap = /* @__PURE__ */ new WeakMap();\nconst ITERATE_KEY = Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Object iterate\" : \"\"\n);\nconst MAP_KEY_ITERATE_KEY = Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Map keys iterate\" : \"\"\n);\nconst ARRAY_ITERATE_KEY = Symbol(\n !!(process.env.NODE_ENV !== \"production\") ? \"Array iterate\" : \"\"\n);\nfunction track(target, type, key) {\n if (shouldTrack && activeSub) {\n let depsMap = targetMap.get(target);\n if (!depsMap) {\n targetMap.set(target, depsMap = /* @__PURE__ */ new Map());\n }\n let dep = depsMap.get(key);\n if (!dep) {\n depsMap.set(key, dep = new Dep());\n dep.map = depsMap;\n dep.key = key;\n }\n if (!!(process.env.NODE_ENV !== \"production\")) {\n dep.track({\n target,\n type,\n key\n });\n } else {\n dep.track();\n }\n }\n}\nfunction trigger(target, type, key, newValue, oldValue, oldTarget) {\n const depsMap = targetMap.get(target);\n if (!depsMap) {\n globalVersion++;\n return;\n }\n const run = (dep) => {\n if (dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n dep.trigger({\n target,\n type,\n key,\n newValue,\n oldValue,\n oldTarget\n });\n } else {\n dep.trigger();\n }\n }\n };\n startBatch();\n if (type === \"clear\") {\n depsMap.forEach(run);\n } else {\n const targetIsArray = isArray(target);\n const isArrayIndex = targetIsArray && isIntegerKey(key);\n if (targetIsArray && key === \"length\") {\n const newLength = Number(newValue);\n depsMap.forEach((dep, key2) => {\n if (key2 === \"length\" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {\n run(dep);\n }\n });\n } else {\n if (key !== void 0 || depsMap.has(void 0)) {\n run(depsMap.get(key));\n }\n if (isArrayIndex) {\n run(depsMap.get(ARRAY_ITERATE_KEY));\n }\n switch (type) {\n case \"add\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) {\n run(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n } else if (isArrayIndex) {\n run(depsMap.get(\"length\"));\n }\n break;\n case \"delete\":\n if (!targetIsArray) {\n run(depsMap.get(ITERATE_KEY));\n if (isMap(target)) {\n run(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n }\n break;\n case \"set\":\n if (isMap(target)) {\n run(depsMap.get(ITERATE_KEY));\n }\n break;\n }\n }\n }\n endBatch();\n}\nfunction getDepFromReactive(object, key) {\n const depMap = targetMap.get(object);\n return depMap && depMap.get(key);\n}\n\nfunction reactiveReadArray(array) {\n const raw = toRaw(array);\n if (raw === array) return raw;\n track(raw, \"iterate\", ARRAY_ITERATE_KEY);\n return isShallow(array) ? raw : raw.map(toReactive);\n}\nfunction shallowReadArray(arr) {\n track(arr = toRaw(arr), \"iterate\", ARRAY_ITERATE_KEY);\n return arr;\n}\nconst arrayInstrumentations = {\n __proto__: null,\n [Symbol.iterator]() {\n return iterator(this, Symbol.iterator, toReactive);\n },\n concat(...args) {\n return reactiveReadArray(this).concat(\n ...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)\n );\n },\n entries() {\n return iterator(this, \"entries\", (value) => {\n value[1] = toReactive(value[1]);\n return value;\n });\n },\n every(fn, thisArg) {\n return apply(this, \"every\", fn, thisArg, void 0, arguments);\n },\n filter(fn, thisArg) {\n return apply(this, \"filter\", fn, thisArg, (v) => v.map(toReactive), arguments);\n },\n find(fn, thisArg) {\n return apply(this, \"find\", fn, thisArg, toReactive, arguments);\n },\n findIndex(fn, thisArg) {\n return apply(this, \"findIndex\", fn, thisArg, void 0, arguments);\n },\n findLast(fn, thisArg) {\n return apply(this, \"findLast\", fn, thisArg, toReactive, arguments);\n },\n findLastIndex(fn, thisArg) {\n return apply(this, \"findLastIndex\", fn, thisArg, void 0, arguments);\n },\n // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement\n forEach(fn, thisArg) {\n return apply(this, \"forEach\", fn, thisArg, void 0, arguments);\n },\n includes(...args) {\n return searchProxy(this, \"includes\", args);\n },\n indexOf(...args) {\n return searchProxy(this, \"indexOf\", args);\n },\n join(separator) {\n return reactiveReadArray(this).join(separator);\n },\n // keys() iterator only reads `length`, no optimization required\n lastIndexOf(...args) {\n return searchProxy(this, \"lastIndexOf\", args);\n },\n map(fn, thisArg) {\n return apply(this, \"map\", fn, thisArg, void 0, arguments);\n },\n pop() {\n return noTracking(this, \"pop\");\n },\n push(...args) {\n return noTracking(this, \"push\", args);\n },\n reduce(fn, ...args) {\n return reduce(this, \"reduce\", fn, args);\n },\n reduceRight(fn, ...args) {\n return reduce(this, \"reduceRight\", fn, args);\n },\n shift() {\n return noTracking(this, \"shift\");\n },\n // slice could use ARRAY_ITERATE but also seems to beg for range tracking\n some(fn, thisArg) {\n return apply(this, \"some\", fn, thisArg, void 0, arguments);\n },\n splice(...args) {\n return noTracking(this, \"splice\", args);\n },\n toReversed() {\n return reactiveReadArray(this).toReversed();\n },\n toSorted(comparer) {\n return reactiveReadArray(this).toSorted(comparer);\n },\n toSpliced(...args) {\n return reactiveReadArray(this).toSpliced(...args);\n },\n unshift(...args) {\n return noTracking(this, \"unshift\", args);\n },\n values() {\n return iterator(this, \"values\", toReactive);\n }\n};\nfunction iterator(self, method, wrapValue) {\n const arr = shallowReadArray(self);\n const iter = arr[method]();\n if (arr !== self && !isShallow(self)) {\n iter._next = iter.next;\n iter.next = () => {\n const result = iter._next();\n if (!result.done) {\n result.value = wrapValue(result.value);\n }\n return result;\n };\n }\n return iter;\n}\nconst arrayProto = Array.prototype;\nfunction apply(self, method, fn, thisArg, wrappedRetFn, args) {\n const arr = shallowReadArray(self);\n const needsWrap = arr !== self && !isShallow(self);\n const methodFn = arr[method];\n if (methodFn !== arrayProto[method]) {\n const result2 = methodFn.apply(self, args);\n return needsWrap ? toReactive(result2) : result2;\n }\n let wrappedFn = fn;\n if (arr !== self) {\n if (needsWrap) {\n wrappedFn = function(item, index) {\n return fn.call(this, toReactive(item), index, self);\n };\n } else if (fn.length > 2) {\n wrappedFn = function(item, index) {\n return fn.call(this, item, index, self);\n };\n }\n }\n const result = methodFn.call(arr, wrappedFn, thisArg);\n return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;\n}\nfunction reduce(self, method, fn, args) {\n const arr = shallowReadArray(self);\n let wrappedFn = fn;\n if (arr !== self) {\n if (!isShallow(self)) {\n wrappedFn = function(acc, item, index) {\n return fn.call(this, acc, toReactive(item), index, self);\n };\n } else if (fn.length > 3) {\n wrappedFn = function(acc, item, index) {\n return fn.call(this, acc, item, index, self);\n };\n }\n }\n return arr[method](wrappedFn, ...args);\n}\nfunction searchProxy(self, method, args) {\n const arr = toRaw(self);\n track(arr, \"iterate\", ARRAY_ITERATE_KEY);\n const res = arr[method](...args);\n if ((res === -1 || res === false) && isProxy(args[0])) {\n args[0] = toRaw(args[0]);\n return arr[method](...args);\n }\n return res;\n}\nfunction noTracking(self, method, args = []) {\n pauseTracking();\n startBatch();\n const res = toRaw(self)[method].apply(self, args);\n endBatch();\n resetTracking();\n return res;\n}\n\nconst isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);\nconst builtInSymbols = new Set(\n /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== \"arguments\" && key !== \"caller\").map((key) => Symbol[key]).filter(isSymbol)\n);\nfunction hasOwnProperty(key) {\n if (!isSymbol(key)) key = String(key);\n const obj = toRaw(this);\n track(obj, \"has\", key);\n return obj.hasOwnProperty(key);\n}\nclass BaseReactiveHandler {\n constructor(_isReadonly = false, _isShallow = false) {\n this._isReadonly = _isReadonly;\n this._isShallow = _isShallow;\n }\n get(target, key, receiver) {\n if (key === \"__v_skip\") return target[\"__v_skip\"];\n const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;\n if (key === \"__v_isReactive\") {\n return !isReadonly2;\n } else if (key === \"__v_isReadonly\") {\n return isReadonly2;\n } else if (key === \"__v_isShallow\") {\n return isShallow2;\n } else if (key === \"__v_raw\") {\n if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype\n // this means the receiver is a user proxy of the reactive proxy\n Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {\n return target;\n }\n return;\n }\n const targetIsArray = isArray(target);\n if (!isReadonly2) {\n let fn;\n if (targetIsArray && (fn = arrayInstrumentations[key])) {\n return fn;\n }\n if (key === \"hasOwnProperty\") {\n return hasOwnProperty;\n }\n }\n const res = Reflect.get(\n target,\n key,\n // if this is a proxy wrapping a ref, return methods using the raw ref\n // as receiver so that we don't have to call `toRaw` on the ref in all\n // its class methods\n isRef(target) ? target : receiver\n );\n if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {\n return res;\n }\n if (!isReadonly2) {\n track(target, \"get\", key);\n }\n if (isShallow2) {\n return res;\n }\n if (isRef(res)) {\n const value = targetIsArray && isIntegerKey(key) ? res : res.value;\n return isReadonly2 && isObject(value) ? readonly(value) : value;\n }\n if (isObject(res)) {\n return isReadonly2 ? readonly(res) : reactive(res);\n }\n return res;\n }\n}\nclass MutableReactiveHandler extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(false, isShallow2);\n }\n set(target, key, value, receiver) {\n let oldValue = target[key];\n if (!this._isShallow) {\n const isOldValueReadonly = isReadonly(oldValue);\n if (!isShallow(value) && !isReadonly(value)) {\n oldValue = toRaw(oldValue);\n value = toRaw(value);\n }\n if (!isArray(target) && isRef(oldValue) && !isRef(value)) {\n if (isOldValueReadonly) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Set operation on key \"${String(key)}\" failed: target is readonly.`,\n target[key]\n );\n }\n return true;\n } else {\n oldValue.value = value;\n return true;\n }\n }\n }\n const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);\n const result = Reflect.set(\n target,\n key,\n value,\n isRef(target) ? target : receiver\n );\n if (target === toRaw(receiver)) {\n if (!hadKey) {\n trigger(target, \"add\", key, value);\n } else if (hasChanged(value, oldValue)) {\n trigger(target, \"set\", key, value, oldValue);\n }\n }\n return result;\n }\n deleteProperty(target, key) {\n const hadKey = hasOwn(target, key);\n const oldValue = target[key];\n const result = Reflect.deleteProperty(target, key);\n if (result && hadKey) {\n trigger(target, \"delete\", key, void 0, oldValue);\n }\n return result;\n }\n has(target, key) {\n const result = Reflect.has(target, key);\n if (!isSymbol(key) || !builtInSymbols.has(key)) {\n track(target, \"has\", key);\n }\n return result;\n }\n ownKeys(target) {\n track(\n target,\n \"iterate\",\n isArray(target) ? \"length\" : ITERATE_KEY\n );\n return Reflect.ownKeys(target);\n }\n}\nclass ReadonlyReactiveHandler extends BaseReactiveHandler {\n constructor(isShallow2 = false) {\n super(true, isShallow2);\n }\n set(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Set operation on key \"${String(key)}\" failed: target is readonly.`,\n target\n );\n }\n return true;\n }\n deleteProperty(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Delete operation on key \"${String(key)}\" failed: target is readonly.`,\n target\n );\n }\n return true;\n }\n}\nconst mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();\nconst readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();\nconst shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);\nconst shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);\n\nconst toShallow = (value) => value;\nconst getProto = (v) => Reflect.getPrototypeOf(v);\nfunction createIterableMethod(method, isReadonly2, isShallow2) {\n return function(...args) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const targetIsMap = isMap(rawTarget);\n const isPair = method === \"entries\" || method === Symbol.iterator && targetIsMap;\n const isKeyOnly = method === \"keys\" && targetIsMap;\n const innerIterator = target[method](...args);\n const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;\n !isReadonly2 && track(\n rawTarget,\n \"iterate\",\n isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY\n );\n return {\n // iterator protocol\n next() {\n const { value, done } = innerIterator.next();\n return done ? { value, done } : {\n value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),\n done\n };\n },\n // iterable protocol\n [Symbol.iterator]() {\n return this;\n }\n };\n };\n}\nfunction createReadonlyMethod(type) {\n return function(...args) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const key = args[0] ? `on key \"${args[0]}\" ` : ``;\n warn(\n `${capitalize(type)} operation ${key}failed: target is readonly.`,\n toRaw(this)\n );\n }\n return type === \"delete\" ? false : type === \"clear\" ? void 0 : this;\n };\n}\nfunction createInstrumentations(readonly, shallow) {\n const instrumentations = {\n get(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const rawKey = toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) {\n track(rawTarget, \"get\", key);\n }\n track(rawTarget, \"get\", rawKey);\n }\n const { has } = getProto(rawTarget);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n if (has.call(rawTarget, key)) {\n return wrap(target.get(key));\n } else if (has.call(rawTarget, rawKey)) {\n return wrap(target.get(rawKey));\n } else if (target !== rawTarget) {\n target.get(key);\n }\n },\n get size() {\n const target = this[\"__v_raw\"];\n !readonly && track(toRaw(target), \"iterate\", ITERATE_KEY);\n return target.size;\n },\n has(key) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const rawKey = toRaw(key);\n if (!readonly) {\n if (hasChanged(key, rawKey)) {\n track(rawTarget, \"has\", key);\n }\n track(rawTarget, \"has\", rawKey);\n }\n return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);\n },\n forEach(callback, thisArg) {\n const observed = this;\n const target = observed[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;\n !readonly && track(rawTarget, \"iterate\", ITERATE_KEY);\n return target.forEach((value, key) => {\n return callback.call(thisArg, wrap(value), wrap(key), observed);\n });\n }\n };\n extend(\n instrumentations,\n readonly ? {\n add: createReadonlyMethod(\"add\"),\n set: createReadonlyMethod(\"set\"),\n delete: createReadonlyMethod(\"delete\"),\n clear: createReadonlyMethod(\"clear\")\n } : {\n add(value) {\n if (!shallow && !isShallow(value) && !isReadonly(value)) {\n value = toRaw(value);\n }\n const target = toRaw(this);\n const proto = getProto(target);\n const hadKey = proto.has.call(target, value);\n if (!hadKey) {\n target.add(value);\n trigger(target, \"add\", value, value);\n }\n return this;\n },\n set(key, value) {\n if (!shallow && !isShallow(value) && !isReadonly(value)) {\n value = toRaw(value);\n }\n const target = toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n checkIdentityKeys(target, has, key);\n }\n const oldValue = get.call(target, key);\n target.set(key, value);\n if (!hadKey) {\n trigger(target, \"add\", key, value);\n } else if (hasChanged(value, oldValue)) {\n trigger(target, \"set\", key, value, oldValue);\n }\n return this;\n },\n delete(key) {\n const target = toRaw(this);\n const { has, get } = getProto(target);\n let hadKey = has.call(target, key);\n if (!hadKey) {\n key = toRaw(key);\n hadKey = has.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n checkIdentityKeys(target, has, key);\n }\n const oldValue = get ? get.call(target, key) : void 0;\n const result = target.delete(key);\n if (hadKey) {\n trigger(target, \"delete\", key, void 0, oldValue);\n }\n return result;\n },\n clear() {\n const target = toRaw(this);\n const hadItems = target.size !== 0;\n const oldTarget = !!(process.env.NODE_ENV !== \"production\") ? isMap(target) ? new Map(target) : new Set(target) : void 0;\n const result = target.clear();\n if (hadItems) {\n trigger(\n target,\n \"clear\",\n void 0,\n void 0,\n oldTarget\n );\n }\n return result;\n }\n }\n );\n const iteratorMethods = [\n \"keys\",\n \"values\",\n \"entries\",\n Symbol.iterator\n ];\n iteratorMethods.forEach((method) => {\n instrumentations[method] = createIterableMethod(method, readonly, shallow);\n });\n return instrumentations;\n}\nfunction createInstrumentationGetter(isReadonly2, shallow) {\n const instrumentations = createInstrumentations(isReadonly2, shallow);\n return (target, key, receiver) => {\n if (key === \"__v_isReactive\") {\n return !isReadonly2;\n } else if (key === \"__v_isReadonly\") {\n return isReadonly2;\n } else if (key === \"__v_raw\") {\n return target;\n }\n return Reflect.get(\n hasOwn(instrumentations, key) && key in target ? instrumentations : target,\n key,\n receiver\n );\n };\n}\nconst mutableCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(false, false)\n};\nconst shallowCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(false, true)\n};\nconst readonlyCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(true, false)\n};\nconst shallowReadonlyCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(true, true)\n};\nfunction checkIdentityKeys(target, has, key) {\n const rawKey = toRaw(key);\n if (rawKey !== key && has.call(target, rawKey)) {\n const type = toRawType(target);\n warn(\n `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`\n );\n }\n}\n\nconst reactiveMap = /* @__PURE__ */ new WeakMap();\nconst shallowReactiveMap = /* @__PURE__ */ new WeakMap();\nconst readonlyMap = /* @__PURE__ */ new WeakMap();\nconst shallowReadonlyMap = /* @__PURE__ */ new WeakMap();\nfunction targetTypeMap(rawType) {\n switch (rawType) {\n case \"Object\":\n case \"Array\":\n return 1 /* COMMON */;\n case \"Map\":\n case \"Set\":\n case \"WeakMap\":\n case \"WeakSet\":\n return 2 /* COLLECTION */;\n default:\n return 0 /* INVALID */;\n }\n}\nfunction getTargetType(value) {\n return value[\"__v_skip\"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));\n}\nfunction reactive(target) {\n if (isReadonly(target)) {\n return target;\n }\n return createReactiveObject(\n target,\n false,\n mutableHandlers,\n mutableCollectionHandlers,\n reactiveMap\n );\n}\nfunction shallowReactive(target) {\n return createReactiveObject(\n target,\n false,\n shallowReactiveHandlers,\n shallowCollectionHandlers,\n shallowReactiveMap\n );\n}\nfunction readonly(target) {\n return createReactiveObject(\n target,\n true,\n readonlyHandlers,\n readonlyCollectionHandlers,\n readonlyMap\n );\n}\nfunction shallowReadonly(target) {\n return createReactiveObject(\n target,\n true,\n shallowReadonlyHandlers,\n shallowReadonlyCollectionHandlers,\n shallowReadonlyMap\n );\n}\nfunction createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {\n if (!isObject(target)) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `value cannot be made ${isReadonly2 ? \"readonly\" : \"reactive\"}: ${String(\n target\n )}`\n );\n }\n return target;\n }\n if (target[\"__v_raw\"] && !(isReadonly2 && target[\"__v_isReactive\"])) {\n return target;\n }\n const targetType = getTargetType(target);\n if (targetType === 0 /* INVALID */) {\n return target;\n }\n const existingProxy = proxyMap.get(target);\n if (existingProxy) {\n return existingProxy;\n }\n const proxy = new Proxy(\n target,\n targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers\n );\n proxyMap.set(target, proxy);\n return proxy;\n}\nfunction isReactive(value) {\n if (isReadonly(value)) {\n return isReactive(value[\"__v_raw\"]);\n }\n return !!(value && value[\"__v_isReactive\"]);\n}\nfunction isReadonly(value) {\n return !!(value && value[\"__v_isReadonly\"]);\n}\nfunction isShallow(value) {\n return !!(value && value[\"__v_isShallow\"]);\n}\nfunction isProxy(value) {\n return value ? !!value[\"__v_raw\"] : false;\n}\nfunction toRaw(observed) {\n const raw = observed && observed[\"__v_raw\"];\n return raw ? toRaw(raw) : observed;\n}\nfunction markRaw(value) {\n if (!hasOwn(value, \"__v_skip\") && Object.isExtensible(value)) {\n def(value, \"__v_skip\", true);\n }\n return value;\n}\nconst toReactive = (value) => isObject(value) ? reactive(value) : value;\nconst toReadonly = (value) => isObject(value) ? readonly(value) : value;\n\nfunction isRef(r) {\n return r ? r[\"__v_isRef\"] === true : false;\n}\nfunction ref(value) {\n return createRef(value, false);\n}\nfunction shallowRef(value) {\n return createRef(value, true);\n}\nfunction createRef(rawValue, shallow) {\n if (isRef(rawValue)) {\n return rawValue;\n }\n return new RefImpl(rawValue, shallow);\n}\nclass RefImpl {\n constructor(value, isShallow2) {\n this.dep = new Dep();\n this[\"__v_isRef\"] = true;\n this[\"__v_isShallow\"] = false;\n this._rawValue = isShallow2 ? value : toRaw(value);\n this._value = isShallow2 ? value : toReactive(value);\n this[\"__v_isShallow\"] = isShallow2;\n }\n get value() {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.dep.track({\n target: this,\n type: \"get\",\n key: \"value\"\n });\n } else {\n this.dep.track();\n }\n return this._value;\n }\n set value(newValue) {\n const oldValue = this._rawValue;\n const useDirectValue = this[\"__v_isShallow\"] || isShallow(newValue) || isReadonly(newValue);\n newValue = useDirectValue ? newValue : toRaw(newValue);\n if (hasChanged(newValue, oldValue)) {\n this._rawValue = newValue;\n this._value = useDirectValue ? newValue : toReactive(newValue);\n if (!!(process.env.NODE_ENV !== \"production\")) {\n this.dep.trigger({\n target: this,\n type: \"set\",\n key: \"value\",\n newValue,\n oldValue\n });\n } else {\n this.dep.trigger();\n }\n }\n }\n}\nfunction triggerRef(ref2) {\n if (ref2.dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n ref2.dep.trigger({\n target: ref2,\n type: \"set\",\n key: \"value\",\n newValue: ref2._value\n });\n } else {\n ref2.dep.trigger();\n }\n }\n}\nfunction unref(ref2) {\n return isRef(ref2) ? ref2.value : ref2;\n}\nfunction toValue(source) {\n return isFunction(source) ? source() : unref(source);\n}\nconst shallowUnwrapHandlers = {\n get: (target, key, receiver) => key === \"__v_raw\" ? target : unref(Reflect.get(target, key, receiver)),\n set: (target, key, value, receiver) => {\n const oldValue = target[key];\n if (isRef(oldValue) && !isRef(value)) {\n oldValue.value = value;\n return true;\n } else {\n return Reflect.set(target, key, value, receiver);\n }\n }\n};\nfunction proxyRefs(objectWithRefs) {\n return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);\n}\nclass CustomRefImpl {\n constructor(factory) {\n this[\"__v_isRef\"] = true;\n this._value = void 0;\n const dep = this.dep = new Dep();\n const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));\n this._get = get;\n this._set = set;\n }\n get value() {\n return this._value = this._get();\n }\n set value(newVal) {\n this._set(newVal);\n }\n}\nfunction customRef(factory) {\n return new CustomRefImpl(factory);\n}\nfunction toRefs(object) {\n if (!!(process.env.NODE_ENV !== \"production\") && !isProxy(object)) {\n warn(`toRefs() expects a reactive object but received a plain one.`);\n }\n const ret = isArray(object) ? new Array(object.length) : {};\n for (const key in object) {\n ret[key] = propertyToRef(object, key);\n }\n return ret;\n}\nclass ObjectRefImpl {\n constructor(_object, _key, _defaultValue) {\n this._object = _object;\n this._key = _key;\n this._defaultValue = _defaultValue;\n this[\"__v_isRef\"] = true;\n this._value = void 0;\n }\n get value() {\n const val = this._object[this._key];\n return this._value = val === void 0 ? this._defaultValue : val;\n }\n set value(newVal) {\n this._object[this._key] = newVal;\n }\n get dep() {\n return getDepFromReactive(toRaw(this._object), this._key);\n }\n}\nclass GetterRefImpl {\n constructor(_getter) {\n this._getter = _getter;\n this[\"__v_isRef\"] = true;\n this[\"__v_isReadonly\"] = true;\n this._value = void 0;\n }\n get value() {\n return this._value = this._getter();\n }\n}\nfunction toRef(source, key, defaultValue) {\n if (isRef(source)) {\n return source;\n } else if (isFunction(source)) {\n return new GetterRefImpl(source);\n } else if (isObject(source) && arguments.length > 1) {\n return propertyToRef(source, key, defaultValue);\n } else {\n return ref(source);\n }\n}\nfunction propertyToRef(source, key, defaultValue) {\n const val = source[key];\n return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);\n}\n\nclass ComputedRefImpl {\n constructor(fn, setter, isSSR) {\n this.fn = fn;\n this.setter = setter;\n /**\n * @internal\n */\n this._value = void 0;\n /**\n * @internal\n */\n this.dep = new Dep(this);\n /**\n * @internal\n */\n this.__v_isRef = true;\n // TODO isolatedDeclarations \"__v_isReadonly\"\n // A computed is also a subscriber that tracks other deps\n /**\n * @internal\n */\n this.deps = void 0;\n /**\n * @internal\n */\n this.depsTail = void 0;\n /**\n * @internal\n */\n this.flags = 16;\n /**\n * @internal\n */\n this.globalVersion = globalVersion - 1;\n /**\n * @internal\n */\n this.next = void 0;\n // for backwards compat\n this.effect = this;\n this[\"__v_isReadonly\"] = !setter;\n this.isSSR = isSSR;\n }\n /**\n * @internal\n */\n notify() {\n this.flags |= 16;\n if (!(this.flags & 8) && // avoid infinite self recursion\n activeSub !== this) {\n batch(this, true);\n return true;\n } else if (!!(process.env.NODE_ENV !== \"production\")) ;\n }\n get value() {\n const link = !!(process.env.NODE_ENV !== \"production\") ? this.dep.track({\n target: this,\n type: \"get\",\n key: \"value\"\n }) : this.dep.track();\n refreshComputed(this);\n if (link) {\n link.version = this.dep.version;\n }\n return this._value;\n }\n set value(newValue) {\n if (this.setter) {\n this.setter(newValue);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\"Write operation failed: computed value is readonly\");\n }\n }\n}\nfunction computed(getterOrOptions, debugOptions, isSSR = false) {\n let getter;\n let setter;\n if (isFunction(getterOrOptions)) {\n getter = getterOrOptions;\n } else {\n getter = getterOrOptions.get;\n setter = getterOrOptions.set;\n }\n const cRef = new ComputedRefImpl(getter, setter, isSSR);\n if (!!(process.env.NODE_ENV !== \"production\") && debugOptions && !isSSR) {\n cRef.onTrack = debugOptions.onTrack;\n cRef.onTrigger = debugOptions.onTrigger;\n }\n return cRef;\n}\n\nconst TrackOpTypes = {\n \"GET\": \"get\",\n \"HAS\": \"has\",\n \"ITERATE\": \"iterate\"\n};\nconst TriggerOpTypes = {\n \"SET\": \"set\",\n \"ADD\": \"add\",\n \"DELETE\": \"delete\",\n \"CLEAR\": \"clear\"\n};\nconst ReactiveFlags = {\n \"SKIP\": \"__v_skip\",\n \"IS_REACTIVE\": \"__v_isReactive\",\n \"IS_READONLY\": \"__v_isReadonly\",\n \"IS_SHALLOW\": \"__v_isShallow\",\n \"RAW\": \"__v_raw\",\n \"IS_REF\": \"__v_isRef\"\n};\n\nconst WatchErrorCodes = {\n \"WATCH_GETTER\": 2,\n \"2\": \"WATCH_GETTER\",\n \"WATCH_CALLBACK\": 3,\n \"3\": \"WATCH_CALLBACK\",\n \"WATCH_CLEANUP\": 4,\n \"4\": \"WATCH_CLEANUP\"\n};\nconst INITIAL_WATCHER_VALUE = {};\nconst cleanupMap = /* @__PURE__ */ new WeakMap();\nlet activeWatcher = void 0;\nfunction getCurrentWatcher() {\n return activeWatcher;\n}\nfunction onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {\n if (owner) {\n let cleanups = cleanupMap.get(owner);\n if (!cleanups) cleanupMap.set(owner, cleanups = []);\n cleanups.push(cleanupFn);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !failSilently) {\n warn(\n `onWatcherCleanup() was called when there was no active watcher to associate with.`\n );\n }\n}\nfunction watch(source, cb, options = EMPTY_OBJ) {\n const { immediate, deep, once, scheduler, augmentJob, call } = options;\n const warnInvalidSource = (s) => {\n (options.onWarn || warn)(\n `Invalid watch source: `,\n s,\n `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`\n );\n };\n const reactiveGetter = (source2) => {\n if (deep) return source2;\n if (isShallow(source2) || deep === false || deep === 0)\n return traverse(source2, 1);\n return traverse(source2);\n };\n let effect;\n let getter;\n let cleanup;\n let boundCleanup;\n let forceTrigger = false;\n let isMultiSource = false;\n if (isRef(source)) {\n getter = () => source.value;\n forceTrigger = isShallow(source);\n } else if (isReactive(source)) {\n getter = () => reactiveGetter(source);\n forceTrigger = true;\n } else if (isArray(source)) {\n isMultiSource = true;\n forceTrigger = source.some((s) => isReactive(s) || isShallow(s));\n getter = () => source.map((s) => {\n if (isRef(s)) {\n return s.value;\n } else if (isReactive(s)) {\n return reactiveGetter(s);\n } else if (isFunction(s)) {\n return call ? call(s, 2) : s();\n } else {\n !!(process.env.NODE_ENV !== \"production\") && warnInvalidSource(s);\n }\n });\n } else if (isFunction(source)) {\n if (cb) {\n getter = call ? () => call(source, 2) : source;\n } else {\n getter = () => {\n if (cleanup) {\n pauseTracking();\n try {\n cleanup();\n } finally {\n resetTracking();\n }\n }\n const currentEffect = activeWatcher;\n activeWatcher = effect;\n try {\n return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);\n } finally {\n activeWatcher = currentEffect;\n }\n };\n }\n } else {\n getter = NOOP;\n !!(process.env.NODE_ENV !== \"production\") && warnInvalidSource(source);\n }\n if (cb && deep) {\n const baseGetter = getter;\n const depth = deep === true ? Infinity : deep;\n getter = () => traverse(baseGetter(), depth);\n }\n const scope = getCurrentScope();\n const watchHandle = () => {\n effect.stop();\n if (scope && scope.active) {\n remove(scope.effects, effect);\n }\n };\n if (once && cb) {\n const _cb = cb;\n cb = (...args) => {\n _cb(...args);\n watchHandle();\n };\n }\n let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;\n const job = (immediateFirstRun) => {\n if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {\n return;\n }\n if (cb) {\n const newValue = effect.run();\n if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {\n if (cleanup) {\n cleanup();\n }\n const currentWatcher = activeWatcher;\n activeWatcher = effect;\n try {\n const args = [\n newValue,\n // pass undefined as the old value when it's changed for the first time\n oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,\n boundCleanup\n ];\n oldValue = newValue;\n call ? call(cb, 3, args) : (\n // @ts-expect-error\n cb(...args)\n );\n } finally {\n activeWatcher = currentWatcher;\n }\n }\n } else {\n effect.run();\n }\n };\n if (augmentJob) {\n augmentJob(job);\n }\n effect = new ReactiveEffect(getter);\n effect.scheduler = scheduler ? () => scheduler(job, false) : job;\n boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);\n cleanup = effect.onStop = () => {\n const cleanups = cleanupMap.get(effect);\n if (cleanups) {\n if (call) {\n call(cleanups, 4);\n } else {\n for (const cleanup2 of cleanups) cleanup2();\n }\n cleanupMap.delete(effect);\n }\n };\n if (!!(process.env.NODE_ENV !== \"production\")) {\n effect.onTrack = options.onTrack;\n effect.onTrigger = options.onTrigger;\n }\n if (cb) {\n if (immediate) {\n job(true);\n } else {\n oldValue = effect.run();\n }\n } else if (scheduler) {\n scheduler(job.bind(null, true), true);\n } else {\n effect.run();\n }\n watchHandle.pause = effect.pause.bind(effect);\n watchHandle.resume = effect.resume.bind(effect);\n watchHandle.stop = watchHandle;\n return watchHandle;\n}\nfunction traverse(value, depth = Infinity, seen) {\n if (depth <= 0 || !isObject(value) || value[\"__v_skip\"]) {\n return value;\n }\n seen = seen || /* @__PURE__ */ new Map();\n if ((seen.get(value) || 0) >= depth) {\n return value;\n }\n seen.set(value, depth);\n depth--;\n if (isRef(value)) {\n traverse(value.value, depth, seen);\n } else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n traverse(value[i], depth, seen);\n }\n } else if (isSet(value) || isMap(value)) {\n value.forEach((v) => {\n traverse(v, depth, seen);\n });\n } else if (isPlainObject(value)) {\n for (const key in value) {\n traverse(value[key], depth, seen);\n }\n for (const key of Object.getOwnPropertySymbols(value)) {\n if (Object.prototype.propertyIsEnumerable.call(value, key)) {\n traverse(value[key], depth, seen);\n }\n }\n }\n return value;\n}\n\nexport { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch };\n","/**\n* @vue/runtime-core v3.5.22\n* (c) 2018-present Yuxi (Evan) You and Vue contributors\n* @license MIT\n**/\nimport { pauseTracking, resetTracking, isRef, toRaw, traverse, shallowRef, readonly, isReactive, ref, isShallow, isReadonly, shallowReadArray, toReadonly, toReactive, shallowReadonly, track, reactive, shallowReactive, trigger, ReactiveEffect, watch as watch$1, customRef, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1 } from '@vue/reactivity';\nexport { EffectScope, ReactiveEffect, TrackOpTypes, TriggerOpTypes, customRef, effect, effectScope, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, onWatcherCleanup, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';\nimport { isString, isFunction, EMPTY_OBJ, isPromise, isArray, NOOP, getGlobalThis, extend, isBuiltInDirective, NO, hasOwn, remove, def, isOn, isReservedProp, normalizeClass, stringifyStyle, normalizeStyle, isKnownSvgAttr, isBooleanAttr, isKnownHtmlAttr, includeBooleanAttr, isRenderableAttrValue, normalizeCssVarValue, getEscapedCssVarName, isObject, isRegExp, invokeArrayFns, toHandlerKey, camelize, capitalize, isSymbol, isGloballyAllowed, EMPTY_ARR, hyphenate, makeMap, toRawType, hasChanged, looseToNumber, isModelListener, toNumber } from '@vue/shared';\nexport { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';\n\nconst stack = [];\nfunction pushWarningContext(vnode) {\n stack.push(vnode);\n}\nfunction popWarningContext() {\n stack.pop();\n}\nlet isWarning = false;\nfunction warn$1(msg, ...args) {\n if (isWarning) return;\n isWarning = true;\n pauseTracking();\n const instance = stack.length ? stack[stack.length - 1].component : null;\n const appWarnHandler = instance && instance.appContext.config.warnHandler;\n const trace = getComponentTrace();\n if (appWarnHandler) {\n callWithErrorHandling(\n appWarnHandler,\n instance,\n 11,\n [\n // eslint-disable-next-line no-restricted-syntax\n msg + args.map((a) => {\n var _a, _b;\n return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);\n }).join(\"\"),\n instance && instance.proxy,\n trace.map(\n ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`\n ).join(\"\\n\"),\n trace\n ]\n );\n } else {\n const warnArgs = [`[Vue warn]: ${msg}`, ...args];\n if (trace.length && // avoid spamming console during tests\n true) {\n warnArgs.push(`\n`, ...formatTrace(trace));\n }\n console.warn(...warnArgs);\n }\n resetTracking();\n isWarning = false;\n}\nfunction getComponentTrace() {\n let currentVNode = stack[stack.length - 1];\n if (!currentVNode) {\n return [];\n }\n const normalizedStack = [];\n while (currentVNode) {\n const last = normalizedStack[0];\n if (last && last.vnode === currentVNode) {\n last.recurseCount++;\n } else {\n normalizedStack.push({\n vnode: currentVNode,\n recurseCount: 0\n });\n }\n const parentInstance = currentVNode.component && currentVNode.component.parent;\n currentVNode = parentInstance && parentInstance.vnode;\n }\n return normalizedStack;\n}\nfunction formatTrace(trace) {\n const logs = [];\n trace.forEach((entry, i) => {\n logs.push(...i === 0 ? [] : [`\n`], ...formatTraceEntry(entry));\n });\n return logs;\n}\nfunction formatTraceEntry({ vnode, recurseCount }) {\n const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;\n const isRoot = vnode.component ? vnode.component.parent == null : false;\n const open = ` at <${formatComponentName(\n vnode.component,\n vnode.type,\n isRoot\n )}`;\n const close = `>` + postfix;\n return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];\n}\nfunction formatProps(props) {\n const res = [];\n const keys = Object.keys(props);\n keys.slice(0, 3).forEach((key) => {\n res.push(...formatProp(key, props[key]));\n });\n if (keys.length > 3) {\n res.push(` ...`);\n }\n return res;\n}\nfunction formatProp(key, value, raw) {\n if (isString(value)) {\n value = JSON.stringify(value);\n return raw ? value : [`${key}=${value}`];\n } else if (typeof value === \"number\" || typeof value === \"boolean\" || value == null) {\n return raw ? value : [`${key}=${value}`];\n } else if (isRef(value)) {\n value = formatProp(key, toRaw(value.value), true);\n return raw ? value : [`${key}=Ref<`, value, `>`];\n } else if (isFunction(value)) {\n return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];\n } else {\n value = toRaw(value);\n return raw ? value : [`${key}=`, value];\n }\n}\nfunction assertNumber(val, type) {\n if (!!!(process.env.NODE_ENV !== \"production\")) return;\n if (val === void 0) {\n return;\n } else if (typeof val !== \"number\") {\n warn$1(`${type} is not a valid number - got ${JSON.stringify(val)}.`);\n } else if (isNaN(val)) {\n warn$1(`${type} is NaN - the duration expression might be incorrect.`);\n }\n}\n\nconst ErrorCodes = {\n \"SETUP_FUNCTION\": 0,\n \"0\": \"SETUP_FUNCTION\",\n \"RENDER_FUNCTION\": 1,\n \"1\": \"RENDER_FUNCTION\",\n \"NATIVE_EVENT_HANDLER\": 5,\n \"5\": \"NATIVE_EVENT_HANDLER\",\n \"COMPONENT_EVENT_HANDLER\": 6,\n \"6\": \"COMPONENT_EVENT_HANDLER\",\n \"VNODE_HOOK\": 7,\n \"7\": \"VNODE_HOOK\",\n \"DIRECTIVE_HOOK\": 8,\n \"8\": \"DIRECTIVE_HOOK\",\n \"TRANSITION_HOOK\": 9,\n \"9\": \"TRANSITION_HOOK\",\n \"APP_ERROR_HANDLER\": 10,\n \"10\": \"APP_ERROR_HANDLER\",\n \"APP_WARN_HANDLER\": 11,\n \"11\": \"APP_WARN_HANDLER\",\n \"FUNCTION_REF\": 12,\n \"12\": \"FUNCTION_REF\",\n \"ASYNC_COMPONENT_LOADER\": 13,\n \"13\": \"ASYNC_COMPONENT_LOADER\",\n \"SCHEDULER\": 14,\n \"14\": \"SCHEDULER\",\n \"COMPONENT_UPDATE\": 15,\n \"15\": \"COMPONENT_UPDATE\",\n \"APP_UNMOUNT_CLEANUP\": 16,\n \"16\": \"APP_UNMOUNT_CLEANUP\"\n};\nconst ErrorTypeStrings$1 = {\n [\"sp\"]: \"serverPrefetch hook\",\n [\"bc\"]: \"beforeCreate hook\",\n [\"c\"]: \"created hook\",\n [\"bm\"]: \"beforeMount hook\",\n [\"m\"]: \"mounted hook\",\n [\"bu\"]: \"beforeUpdate hook\",\n [\"u\"]: \"updated\",\n [\"bum\"]: \"beforeUnmount hook\",\n [\"um\"]: \"unmounted hook\",\n [\"a\"]: \"activated hook\",\n [\"da\"]: \"deactivated hook\",\n [\"ec\"]: \"errorCaptured hook\",\n [\"rtc\"]: \"renderTracked hook\",\n [\"rtg\"]: \"renderTriggered hook\",\n [0]: \"setup function\",\n [1]: \"render function\",\n [2]: \"watcher getter\",\n [3]: \"watcher callback\",\n [4]: \"watcher cleanup function\",\n [5]: \"native event handler\",\n [6]: \"component event handler\",\n [7]: \"vnode hook\",\n [8]: \"directive hook\",\n [9]: \"transition hook\",\n [10]: \"app errorHandler\",\n [11]: \"app warnHandler\",\n [12]: \"ref function\",\n [13]: \"async component loader\",\n [14]: \"scheduler flush\",\n [15]: \"component update\",\n [16]: \"app unmount cleanup function\"\n};\nfunction callWithErrorHandling(fn, instance, type, args) {\n try {\n return args ? fn(...args) : fn();\n } catch (err) {\n handleError(err, instance, type);\n }\n}\nfunction callWithAsyncErrorHandling(fn, instance, type, args) {\n if (isFunction(fn)) {\n const res = callWithErrorHandling(fn, instance, type, args);\n if (res && isPromise(res)) {\n res.catch((err) => {\n handleError(err, instance, type);\n });\n }\n return res;\n }\n if (isArray(fn)) {\n const values = [];\n for (let i = 0; i < fn.length; i++) {\n values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));\n }\n return values;\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(\n `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`\n );\n }\n}\nfunction handleError(err, instance, type, throwInDev = true) {\n const contextVNode = instance ? instance.vnode : null;\n const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;\n if (instance) {\n let cur = instance.parent;\n const exposedInstance = instance.proxy;\n const errorInfo = !!(process.env.NODE_ENV !== \"production\") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;\n while (cur) {\n const errorCapturedHooks = cur.ec;\n if (errorCapturedHooks) {\n for (let i = 0; i < errorCapturedHooks.length; i++) {\n if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {\n return;\n }\n }\n }\n cur = cur.parent;\n }\n if (errorHandler) {\n pauseTracking();\n callWithErrorHandling(errorHandler, null, 10, [\n err,\n exposedInstance,\n errorInfo\n ]);\n resetTracking();\n return;\n }\n }\n logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);\n}\nfunction logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const info = ErrorTypeStrings$1[type];\n if (contextVNode) {\n pushWarningContext(contextVNode);\n }\n warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);\n if (contextVNode) {\n popWarningContext();\n }\n if (throwInDev) {\n throw err;\n } else {\n console.error(err);\n }\n } else if (throwInProd) {\n throw err;\n } else {\n console.error(err);\n }\n}\n\nconst queue = [];\nlet flushIndex = -1;\nconst pendingPostFlushCbs = [];\nlet activePostFlushCbs = null;\nlet postFlushIndex = 0;\nconst resolvedPromise = /* @__PURE__ */ Promise.resolve();\nlet currentFlushPromise = null;\nconst RECURSION_LIMIT = 100;\nfunction nextTick(fn) {\n const p = currentFlushPromise || resolvedPromise;\n return fn ? p.then(this ? fn.bind(this) : fn) : p;\n}\nfunction findInsertionIndex(id) {\n let start = flushIndex + 1;\n let end = queue.length;\n while (start < end) {\n const middle = start + end >>> 1;\n const middleJob = queue[middle];\n const middleJobId = getId(middleJob);\n if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {\n start = middle + 1;\n } else {\n end = middle;\n }\n }\n return start;\n}\nfunction queueJob(job) {\n if (!(job.flags & 1)) {\n const jobId = getId(job);\n const lastJob = queue[queue.length - 1];\n if (!lastJob || // fast path when the job id is larger than the tail\n !(job.flags & 2) && jobId >= getId(lastJob)) {\n queue.push(job);\n } else {\n queue.splice(findInsertionIndex(jobId), 0, job);\n }\n job.flags |= 1;\n queueFlush();\n }\n}\nfunction queueFlush() {\n if (!currentFlushPromise) {\n currentFlushPromise = resolvedPromise.then(flushJobs);\n }\n}\nfunction queuePostFlushCb(cb) {\n if (!isArray(cb)) {\n if (activePostFlushCbs && cb.id === -1) {\n activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);\n } else if (!(cb.flags & 1)) {\n pendingPostFlushCbs.push(cb);\n cb.flags |= 1;\n }\n } else {\n pendingPostFlushCbs.push(...cb);\n }\n queueFlush();\n}\nfunction flushPreFlushCbs(instance, seen, i = flushIndex + 1) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n seen = seen || /* @__PURE__ */ new Map();\n }\n for (; i < queue.length; i++) {\n const cb = queue[i];\n if (cb && cb.flags & 2) {\n if (instance && cb.id !== instance.uid) {\n continue;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && checkRecursiveUpdates(seen, cb)) {\n continue;\n }\n queue.splice(i, 1);\n i--;\n if (cb.flags & 4) {\n cb.flags &= -2;\n }\n cb();\n if (!(cb.flags & 4)) {\n cb.flags &= -2;\n }\n }\n }\n}\nfunction flushPostFlushCbs(seen) {\n if (pendingPostFlushCbs.length) {\n const deduped = [...new Set(pendingPostFlushCbs)].sort(\n (a, b) => getId(a) - getId(b)\n );\n pendingPostFlushCbs.length = 0;\n if (activePostFlushCbs) {\n activePostFlushCbs.push(...deduped);\n return;\n }\n activePostFlushCbs = deduped;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n seen = seen || /* @__PURE__ */ new Map();\n }\n for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {\n const cb = activePostFlushCbs[postFlushIndex];\n if (!!(process.env.NODE_ENV !== \"production\") && checkRecursiveUpdates(seen, cb)) {\n continue;\n }\n if (cb.flags & 4) {\n cb.flags &= -2;\n }\n if (!(cb.flags & 8)) cb();\n cb.flags &= -2;\n }\n activePostFlushCbs = null;\n postFlushIndex = 0;\n }\n}\nconst getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;\nfunction flushJobs(seen) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n seen = seen || /* @__PURE__ */ new Map();\n }\n const check = !!(process.env.NODE_ENV !== \"production\") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;\n try {\n for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {\n const job = queue[flushIndex];\n if (job && !(job.flags & 8)) {\n if (!!(process.env.NODE_ENV !== \"production\") && check(job)) {\n continue;\n }\n if (job.flags & 4) {\n job.flags &= ~1;\n }\n callWithErrorHandling(\n job,\n job.i,\n job.i ? 15 : 14\n );\n if (!(job.flags & 4)) {\n job.flags &= ~1;\n }\n }\n }\n } finally {\n for (; flushIndex < queue.length; flushIndex++) {\n const job = queue[flushIndex];\n if (job) {\n job.flags &= -2;\n }\n }\n flushIndex = -1;\n queue.length = 0;\n flushPostFlushCbs(seen);\n currentFlushPromise = null;\n if (queue.length || pendingPostFlushCbs.length) {\n flushJobs(seen);\n }\n }\n}\nfunction checkRecursiveUpdates(seen, fn) {\n const count = seen.get(fn) || 0;\n if (count > RECURSION_LIMIT) {\n const instance = fn.i;\n const componentName = instance && getComponentName(instance.type);\n handleError(\n `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,\n null,\n 10\n );\n return true;\n }\n seen.set(fn, count + 1);\n return false;\n}\n\nlet isHmrUpdating = false;\nconst hmrDirtyComponents = /* @__PURE__ */ new Map();\nif (!!(process.env.NODE_ENV !== \"production\")) {\n getGlobalThis().__VUE_HMR_RUNTIME__ = {\n createRecord: tryWrap(createRecord),\n rerender: tryWrap(rerender),\n reload: tryWrap(reload)\n };\n}\nconst map = /* @__PURE__ */ new Map();\nfunction registerHMR(instance) {\n const id = instance.type.__hmrId;\n let record = map.get(id);\n if (!record) {\n createRecord(id, instance.type);\n record = map.get(id);\n }\n record.instances.add(instance);\n}\nfunction unregisterHMR(instance) {\n map.get(instance.type.__hmrId).instances.delete(instance);\n}\nfunction createRecord(id, initialDef) {\n if (map.has(id)) {\n return false;\n }\n map.set(id, {\n initialDef: normalizeClassComponent(initialDef),\n instances: /* @__PURE__ */ new Set()\n });\n return true;\n}\nfunction normalizeClassComponent(component) {\n return isClassComponent(component) ? component.__vccOpts : component;\n}\nfunction rerender(id, newRender) {\n const record = map.get(id);\n if (!record) {\n return;\n }\n record.initialDef.render = newRender;\n [...record.instances].forEach((instance) => {\n if (newRender) {\n instance.render = newRender;\n normalizeClassComponent(instance.type).render = newRender;\n }\n instance.renderCache = [];\n isHmrUpdating = true;\n if (!(instance.job.flags & 8)) {\n instance.update();\n }\n isHmrUpdating = false;\n });\n}\nfunction reload(id, newComp) {\n const record = map.get(id);\n if (!record) return;\n newComp = normalizeClassComponent(newComp);\n updateComponentDef(record.initialDef, newComp);\n const instances = [...record.instances];\n for (let i = 0; i < instances.length; i++) {\n const instance = instances[i];\n const oldComp = normalizeClassComponent(instance.type);\n let dirtyInstances = hmrDirtyComponents.get(oldComp);\n if (!dirtyInstances) {\n if (oldComp !== record.initialDef) {\n updateComponentDef(oldComp, newComp);\n }\n hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());\n }\n dirtyInstances.add(instance);\n instance.appContext.propsCache.delete(instance.type);\n instance.appContext.emitsCache.delete(instance.type);\n instance.appContext.optionsCache.delete(instance.type);\n if (instance.ceReload) {\n dirtyInstances.add(instance);\n instance.ceReload(newComp.styles);\n dirtyInstances.delete(instance);\n } else if (instance.parent) {\n queueJob(() => {\n if (!(instance.job.flags & 8)) {\n isHmrUpdating = true;\n instance.parent.update();\n isHmrUpdating = false;\n dirtyInstances.delete(instance);\n }\n });\n } else if (instance.appContext.reload) {\n instance.appContext.reload();\n } else if (typeof window !== \"undefined\") {\n window.location.reload();\n } else {\n console.warn(\n \"[HMR] Root or manually mounted instance modified. Full reload required.\"\n );\n }\n if (instance.root.ce && instance !== instance.root) {\n instance.root.ce._removeChildStyle(oldComp);\n }\n }\n queuePostFlushCb(() => {\n hmrDirtyComponents.clear();\n });\n}\nfunction updateComponentDef(oldComp, newComp) {\n extend(oldComp, newComp);\n for (const key in oldComp) {\n if (key !== \"__file\" && !(key in newComp)) {\n delete oldComp[key];\n }\n }\n}\nfunction tryWrap(fn) {\n return (id, arg) => {\n try {\n return fn(id, arg);\n } catch (e) {\n console.error(e);\n console.warn(\n `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`\n );\n }\n };\n}\n\nlet devtools$1;\nlet buffer = [];\nlet devtoolsNotInstalled = false;\nfunction emit$1(event, ...args) {\n if (devtools$1) {\n devtools$1.emit(event, ...args);\n } else if (!devtoolsNotInstalled) {\n buffer.push({ event, args });\n }\n}\nfunction setDevtoolsHook$1(hook, target) {\n var _a, _b;\n devtools$1 = hook;\n if (devtools$1) {\n devtools$1.enabled = true;\n buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));\n buffer = [];\n } else if (\n // handle late devtools injection - only do this if we are in an actual\n // browser environment to avoid the timer handle stalling test runner exit\n // (#4815)\n typeof window !== \"undefined\" && // some envs mock window but not fully\n window.HTMLElement && // also exclude jsdom\n // eslint-disable-next-line no-restricted-syntax\n !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes(\"jsdom\"))\n ) {\n const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];\n replay.push((newHook) => {\n setDevtoolsHook$1(newHook, target);\n });\n setTimeout(() => {\n if (!devtools$1) {\n target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;\n devtoolsNotInstalled = true;\n buffer = [];\n }\n }, 3e3);\n } else {\n devtoolsNotInstalled = true;\n buffer = [];\n }\n}\nfunction devtoolsInitApp(app, version) {\n emit$1(\"app:init\" /* APP_INIT */, app, version, {\n Fragment,\n Text,\n Comment,\n Static\n });\n}\nfunction devtoolsUnmountApp(app) {\n emit$1(\"app:unmount\" /* APP_UNMOUNT */, app);\n}\nconst devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(\"component:added\" /* COMPONENT_ADDED */);\nconst devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook(\"component:updated\" /* COMPONENT_UPDATED */);\nconst _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(\n \"component:removed\" /* COMPONENT_REMOVED */\n);\nconst devtoolsComponentRemoved = (component) => {\n if (devtools$1 && typeof devtools$1.cleanupBuffer === \"function\" && // remove the component if it wasn't buffered\n !devtools$1.cleanupBuffer(component)) {\n _devtoolsComponentRemoved(component);\n }\n};\n// @__NO_SIDE_EFFECTS__\nfunction createDevtoolsComponentHook(hook) {\n return (component) => {\n emit$1(\n hook,\n component.appContext.app,\n component.uid,\n component.parent ? component.parent.uid : void 0,\n component\n );\n };\n}\nconst devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(\"perf:start\" /* PERFORMANCE_START */);\nconst devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(\"perf:end\" /* PERFORMANCE_END */);\nfunction createDevtoolsPerformanceHook(hook) {\n return (component, type, time) => {\n emit$1(hook, component.appContext.app, component.uid, component, type, time);\n };\n}\nfunction devtoolsComponentEmit(component, event, params) {\n emit$1(\n \"component:emit\" /* COMPONENT_EMIT */,\n component.appContext.app,\n component,\n event,\n params\n );\n}\n\nlet currentRenderingInstance = null;\nlet currentScopeId = null;\nfunction setCurrentRenderingInstance(instance) {\n const prev = currentRenderingInstance;\n currentRenderingInstance = instance;\n currentScopeId = instance && instance.type.__scopeId || null;\n return prev;\n}\nfunction pushScopeId(id) {\n currentScopeId = id;\n}\nfunction popScopeId() {\n currentScopeId = null;\n}\nconst withScopeId = (_id) => withCtx;\nfunction withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {\n if (!ctx) return fn;\n if (fn._n) {\n return fn;\n }\n const renderFnWithContext = (...args) => {\n if (renderFnWithContext._d) {\n setBlockTracking(-1);\n }\n const prevInstance = setCurrentRenderingInstance(ctx);\n let res;\n try {\n res = fn(...args);\n } finally {\n setCurrentRenderingInstance(prevInstance);\n if (renderFnWithContext._d) {\n setBlockTracking(1);\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n devtoolsComponentUpdated(ctx);\n }\n return res;\n };\n renderFnWithContext._n = true;\n renderFnWithContext._c = true;\n renderFnWithContext._d = true;\n return renderFnWithContext;\n}\n\nfunction validateDirectiveName(name) {\n if (isBuiltInDirective(name)) {\n warn$1(\"Do not use built-in directive ids as custom directive id: \" + name);\n }\n}\nfunction withDirectives(vnode, directives) {\n if (currentRenderingInstance === null) {\n !!(process.env.NODE_ENV !== \"production\") && warn$1(`withDirectives can only be used inside render functions.`);\n return vnode;\n }\n const instance = getComponentPublicInstance(currentRenderingInstance);\n const bindings = vnode.dirs || (vnode.dirs = []);\n for (let i = 0; i < directives.length; i++) {\n let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];\n if (dir) {\n if (isFunction(dir)) {\n dir = {\n mounted: dir,\n updated: dir\n };\n }\n if (dir.deep) {\n traverse(value);\n }\n bindings.push({\n dir,\n instance,\n value,\n oldValue: void 0,\n arg,\n modifiers\n });\n }\n }\n return vnode;\n}\nfunction invokeDirectiveHook(vnode, prevVNode, instance, name) {\n const bindings = vnode.dirs;\n const oldBindings = prevVNode && prevVNode.dirs;\n for (let i = 0; i < bindings.length; i++) {\n const binding = bindings[i];\n if (oldBindings) {\n binding.oldValue = oldBindings[i].value;\n }\n let hook = binding.dir[name];\n if (hook) {\n pauseTracking();\n callWithAsyncErrorHandling(hook, instance, 8, [\n vnode.el,\n binding,\n vnode,\n prevVNode\n ]);\n resetTracking();\n }\n }\n}\n\nconst TeleportEndKey = Symbol(\"_vte\");\nconst isTeleport = (type) => type.__isTeleport;\nconst isTeleportDisabled = (props) => props && (props.disabled || props.disabled === \"\");\nconst isTeleportDeferred = (props) => props && (props.defer || props.defer === \"\");\nconst isTargetSVG = (target) => typeof SVGElement !== \"undefined\" && target instanceof SVGElement;\nconst isTargetMathML = (target) => typeof MathMLElement === \"function\" && target instanceof MathMLElement;\nconst resolveTarget = (props, select) => {\n const targetSelector = props && props.to;\n if (isString(targetSelector)) {\n if (!select) {\n !!(process.env.NODE_ENV !== \"production\") && warn$1(\n `Current renderer does not support string target for Teleports. (missing querySelector renderer option)`\n );\n return null;\n } else {\n const target = select(targetSelector);\n if (!!(process.env.NODE_ENV !== \"production\") && !target && !isTeleportDisabled(props)) {\n warn$1(\n `Failed to locate Teleport target with selector \"${targetSelector}\". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`\n );\n }\n return target;\n }\n } else {\n if (!!(process.env.NODE_ENV !== \"production\") && !targetSelector && !isTeleportDisabled(props)) {\n warn$1(`Invalid Teleport target: ${targetSelector}`);\n }\n return targetSelector;\n }\n};\nconst TeleportImpl = {\n name: \"Teleport\",\n __isTeleport: true,\n process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {\n const {\n mc: mountChildren,\n pc: patchChildren,\n pbc: patchBlockChildren,\n o: { insert, querySelector, createText, createComment }\n } = internals;\n const disabled = isTeleportDisabled(n2.props);\n let { shapeFlag, children, dynamicChildren } = n2;\n if (!!(process.env.NODE_ENV !== \"production\") && isHmrUpdating) {\n optimized = false;\n dynamicChildren = null;\n }\n if (n1 == null) {\n const placeholder = n2.el = !!(process.env.NODE_ENV !== \"production\") ? createComment(\"teleport start\") : createText(\"\");\n const mainAnchor = n2.anchor = !!(process.env.NODE_ENV !== \"production\") ? createComment(\"teleport end\") : createText(\"\");\n insert(placeholder, container, anchor);\n insert(mainAnchor, container, anchor);\n const mount = (container2, anchor2) => {\n if (shapeFlag & 16) {\n mountChildren(\n children,\n container2,\n anchor2,\n parentComponent,\n parentSuspense,\n namespace,\n slotScopeIds,\n optimized\n );\n }\n };\n const mountToTarget = () => {\n const target = n2.target = resolveTarget(n2.props, querySelector);\n const targetAnchor = prepareAnchor(target, n2, createText, insert);\n if (target) {\n if (namespace !== \"svg\" && isTargetSVG(target)) {\n namespace = \"svg\";\n } else if (namespace !== \"mathml\" && isTargetMathML(target)) {\n namespace = \"mathml\";\n }\n if (parentComponent && parentComponent.isCE) {\n (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);\n }\n if (!disabled) {\n mount(target, targetAnchor);\n updateCssVars(n2, false);\n }\n } else if (!!(process.env.NODE_ENV !== \"production\") && !disabled) {\n warn$1(\n \"Invalid Teleport target on mount:\",\n target,\n `(${typeof target})`\n );\n }\n };\n if (disabled) {\n mount(container, mainAnchor);\n updateCssVars(n2, true);\n }\n if (isTeleportDeferred(n2.props)) {\n n2.el.__isMounted = false;\n queuePostRenderEffect(() => {\n mountToTarget();\n delete n2.el.__isMounted;\n }, parentSuspense);\n } else {\n mountToTarget();\n }\n } else {\n if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {\n queuePostRenderEffect(() => {\n TeleportImpl.process(\n n1,\n n2,\n container,\n anchor,\n parentComponent,\n parentSuspense,\n namespace,\n slotScopeIds,\n optimized,\n internals\n );\n }, parentSuspense);\n return;\n }\n n2.el = n1.el;\n n2.targetStart = n1.targetStart;\n const mainAnchor = n2.anchor = n1.anchor;\n const target = n2.target = n1.target;\n const targetAnchor = n2.targetAnchor = n1.targetAnchor;\n const wasDisabled = isTeleportDisabled(n1.props);\n const currentContainer = wasDisabled ? container : target;\n const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;\n if (namespace === \"svg\" || isTargetSVG(target)) {\n namespace = \"svg\";\n } else if (namespace === \"mathml\" || isTargetMathML(target)) {\n namespace = \"mathml\";\n }\n if (dynamicChildren) {\n patchBlockChildren(\n n1.dynamicChildren,\n dynamicChildren,\n currentContainer,\n parentComponent,\n parentSuspense,\n namespace,\n slotScopeIds\n );\n traverseStaticChildren(n1, n2, !!!(process.env.NODE_ENV !== \"production\"));\n } else if (!optimized) {\n patchChildren(\n n1,\n n2,\n currentContainer,\n currentAnchor,\n parentComponent,\n parentSuspense,\n namespace,\n slotScopeIds,\n false\n );\n }\n if (disabled) {\n if (!wasDisabled) {\n moveTeleport(\n n2,\n container,\n mainAnchor,\n internals,\n 1\n );\n } else {\n if (n2.props && n1.props && n2.props.to !== n1.props.to) {\n n2.props.to = n1.props.to;\n }\n }\n } else {\n if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {\n const nextTarget = n2.target = resolveTarget(\n n2.props,\n querySelector\n );\n if (nextTarget) {\n moveTeleport(\n n2,\n nextTarget,\n null,\n internals,\n 0\n );\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(\n \"Invalid Teleport target on update:\",\n target,\n `(${typeof target})`\n );\n }\n } else if (wasDisabled) {\n moveTeleport(\n n2,\n target,\n targetAnchor,\n internals,\n 1\n );\n }\n }\n updateCssVars(n2, disabled);\n }\n },\n remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {\n const {\n shapeFlag,\n children,\n anchor,\n targetStart,\n targetAnchor,\n target,\n props\n } = vnode;\n if (target) {\n hostRemove(targetStart);\n hostRemove(targetAnchor);\n }\n doRemove && hostRemove(anchor);\n if (shapeFlag & 16) {\n const shouldRemove = doRemove || !isTeleportDisabled(props);\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n unmount(\n child,\n parentComponent,\n parentSuspense,\n shouldRemove,\n !!child.dynamicChildren\n );\n }\n }\n },\n move: moveTeleport,\n hydrate: hydrateTeleport\n};\nfunction moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {\n if (moveType === 0) {\n insert(vnode.targetAnchor, container, parentAnchor);\n }\n const { el, anchor, shapeFlag, children, props } = vnode;\n const isReorder = moveType === 2;\n if (isReorder) {\n insert(el, container, parentAnchor);\n }\n if (!isReorder || isTeleportDisabled(props)) {\n if (shapeFlag & 16) {\n for (let i = 0; i < children.length; i++) {\n move(\n children[i],\n container,\n parentAnchor,\n 2\n );\n }\n }\n }\n if (isReorder) {\n insert(anchor, container, parentAnchor);\n }\n}\nfunction hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {\n o: { nextSibling, parentNode, querySelector, insert, createText }\n}, hydrateChildren) {\n function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {\n vnode2.anchor = hydrateChildren(\n nextSibling(node2),\n vnode2,\n parentNode(node2),\n parentComponent,\n parentSuspense,\n slotScopeIds,\n optimized\n );\n vnode2.targetStart = targetStart;\n vnode2.targetAnchor = targetAnchor;\n }\n const target = vnode.target = resolveTarget(\n vnode.props,\n querySelector\n );\n const disabled = isTeleportDisabled(vnode.props);\n if (target) {\n const targetNode = target._lpa || target.firstChild;\n if (vnode.shapeFlag & 16) {\n if (disabled) {\n hydrateDisabledTeleport(\n node,\n vnode,\n targetNode,\n targetNode && nextSibling(targetNode)\n );\n } else {\n vnode.anchor = nextSibling(node);\n let targetAnchor = targetNode;\n while (targetAnchor) {\n if (targetAnchor && targetAnchor.nodeType === 8) {\n if (targetAnchor.data === \"teleport start anchor\") {\n vnode.targetStart = targetAnchor;\n } else if (targetAnchor.data === \"teleport anchor\") {\n vnode.targetAnchor = targetAnchor;\n target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);\n break;\n }\n }\n targetAnchor = nextSibling(targetAnchor);\n }\n if (!vnode.targetAnchor) {\n prepareAnchor(target, vnode, createText, insert);\n }\n hydrateChildren(\n targetNode && nextSibling(targetNode),\n vnode,\n target,\n parentComponent,\n parentSuspense,\n slotScopeIds,\n optimized\n );\n }\n }\n updateCssVars(vnode, disabled);\n } else if (disabled) {\n if (vnode.shapeFlag & 16) {\n hydrateDisabledTeleport(node, vnode, node, nextSibling(node));\n }\n }\n return vnode.anchor && nextSibling(vnode.anchor);\n}\nconst Teleport = TeleportImpl;\nfunction updateCssVars(vnode, isDisabled) {\n const ctx = vnode.ctx;\n if (ctx && ctx.ut) {\n let node, anchor;\n if (isDisabled) {\n node = vnode.el;\n anchor = vnode.anchor;\n } else {\n node = vnode.targetStart;\n anchor = vnode.targetAnchor;\n }\n while (node && node !== anchor) {\n if (node.nodeType === 1) node.setAttribute(\"data-v-owner\", ctx.uid);\n node = node.nextSibling;\n }\n ctx.ut();\n }\n}\nfunction prepareAnchor(target, vnode, createText, insert) {\n const targetStart = vnode.targetStart = createText(\"\");\n const targetAnchor = vnode.targetAnchor = createText(\"\");\n targetStart[TeleportEndKey] = targetAnchor;\n if (target) {\n insert(targetStart, target);\n insert(targetAnchor, target);\n }\n return targetAnchor;\n}\n\nconst leaveCbKey = Symbol(\"_leaveCb\");\nconst enterCbKey = Symbol(\"_enterCb\");\nfunction useTransitionState() {\n const state = {\n isMounted: false,\n isLeaving: false,\n isUnmounting: false,\n leavingVNodes: /* @__PURE__ */ new Map()\n };\n onMounted(() => {\n state.isMounted = true;\n });\n onBeforeUnmount(() => {\n state.isUnmounting = true;\n });\n return state;\n}\nconst TransitionHookValidator = [Function, Array];\nconst BaseTransitionPropsValidators = {\n mode: String,\n appear: Boolean,\n persisted: Boolean,\n // enter\n onBeforeEnter: TransitionHookValidator,\n onEnter: TransitionHookValidator,\n onAfterEnter: TransitionHookValidator,\n onEnterCancelled: TransitionHookValidator,\n // leave\n onBeforeLeave: TransitionHookValidator,\n onLeave: TransitionHookValidator,\n onAfterLeave: TransitionHookValidator,\n onLeaveCancelled: TransitionHookValidator,\n // appear\n onBeforeAppear: TransitionHookValidator,\n onAppear: TransitionHookValidator,\n onAfterAppear: TransitionHookValidator,\n onAppearCancelled: TransitionHookValidator\n};\nconst recursiveGetSubtree = (instance) => {\n const subTree = instance.subTree;\n return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;\n};\nconst BaseTransitionImpl = {\n name: `BaseTransition`,\n props: BaseTransitionPropsValidators,\n setup(props, { slots }) {\n const instance = getCurrentInstance();\n const state = useTransitionState();\n return () => {\n const children = slots.default && getTransitionRawChildren(slots.default(), true);\n if (!children || !children.length) {\n return;\n }\n const child = findNonCommentChild(children);\n const rawProps = toRaw(props);\n const { mode } = rawProps;\n if (!!(process.env.NODE_ENV !== \"production\") && mode && mode !== \"in-out\" && mode !== \"out-in\" && mode !== \"default\") {\n warn$1(`invalid mode: ${mode}`);\n }\n if (state.isLeaving) {\n return emptyPlaceholder(child);\n }\n const innerChild = getInnerChild$1(child);\n if (!innerChild) {\n return emptyPlaceholder(child);\n }\n let enterHooks = resolveTransitionHooks(\n innerChild,\n rawProps,\n state,\n instance,\n // #11061, ensure enterHooks is fresh after clone\n (hooks) => enterHooks = hooks\n );\n if (innerChild.type !== Comment) {\n setTransitionHooks(innerChild, enterHooks);\n }\n let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);\n if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {\n let leavingHooks = resolveTransitionHooks(\n oldInnerChild,\n rawProps,\n state,\n instance\n );\n setTransitionHooks(oldInnerChild, leavingHooks);\n if (mode === \"out-in\" && innerChild.type !== Comment) {\n state.isLeaving = true;\n leavingHooks.afterLeave = () => {\n state.isLeaving = false;\n if (!(instance.job.flags & 8)) {\n instance.update();\n }\n delete leavingHooks.afterLeave;\n oldInnerChild = void 0;\n };\n return emptyPlaceholder(child);\n } else if (mode === \"in-out\" && innerChild.type !== Comment) {\n leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {\n const leavingVNodesCache = getLeavingNodesForType(\n state,\n oldInnerChild\n );\n leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;\n el[leaveCbKey] = () => {\n earlyRemove();\n el[leaveCbKey] = void 0;\n delete enterHooks.delayedLeave;\n oldInnerChild = void 0;\n };\n enterHooks.delayedLeave = () => {\n delayedLeave();\n delete enterHooks.delayedLeave;\n oldInnerChild = void 0;\n };\n };\n } else {\n oldInnerChild = void 0;\n }\n } else if (oldInnerChild) {\n oldInnerChild = void 0;\n }\n return child;\n };\n }\n};\nfunction findNonCommentChild(children) {\n let child = children[0];\n if (children.length > 1) {\n let hasFound = false;\n for (const c of children) {\n if (c.type !== Comment) {\n if (!!(process.env.NODE_ENV !== \"production\") && hasFound) {\n warn$1(\n \" can only be used on a single element or component. Use for lists.\"\n );\n break;\n }\n child = c;\n hasFound = true;\n if (!!!(process.env.NODE_ENV !== \"production\")) break;\n }\n }\n }\n return child;\n}\nconst BaseTransition = BaseTransitionImpl;\nfunction getLeavingNodesForType(state, vnode) {\n const { leavingVNodes } = state;\n let leavingVNodesCache = leavingVNodes.get(vnode.type);\n if (!leavingVNodesCache) {\n leavingVNodesCache = /* @__PURE__ */ Object.create(null);\n leavingVNodes.set(vnode.type, leavingVNodesCache);\n }\n return leavingVNodesCache;\n}\nfunction resolveTransitionHooks(vnode, props, state, instance, postClone) {\n const {\n appear,\n mode,\n persisted = false,\n onBeforeEnter,\n onEnter,\n onAfterEnter,\n onEnterCancelled,\n onBeforeLeave,\n onLeave,\n onAfterLeave,\n onLeaveCancelled,\n onBeforeAppear,\n onAppear,\n onAfterAppear,\n onAppearCancelled\n } = props;\n const key = String(vnode.key);\n const leavingVNodesCache = getLeavingNodesForType(state, vnode);\n const callHook = (hook, args) => {\n hook && callWithAsyncErrorHandling(\n hook,\n instance,\n 9,\n args\n );\n };\n const callAsyncHook = (hook, args) => {\n const done = args[1];\n callHook(hook, args);\n if (isArray(hook)) {\n if (hook.every((hook2) => hook2.length <= 1)) done();\n } else if (hook.length <= 1) {\n done();\n }\n };\n const hooks = {\n mode,\n persisted,\n beforeEnter(el) {\n let hook = onBeforeEnter;\n if (!state.isMounted) {\n if (appear) {\n hook = onBeforeAppear || onBeforeEnter;\n } else {\n return;\n }\n }\n if (el[leaveCbKey]) {\n el[leaveCbKey](\n true\n /* cancelled */\n );\n }\n const leavingVNode = leavingVNodesCache[key];\n if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {\n leavingVNode.el[leaveCbKey]();\n }\n callHook(hook, [el]);\n },\n enter(el) {\n let hook = onEnter;\n let afterHook = onAfterEnter;\n let cancelHook = onEnterCancelled;\n if (!state.isMounted) {\n if (appear) {\n hook = onAppear || onEnter;\n afterHook = onAfterAppear || onAfterEnter;\n cancelHook = onAppearCancelled || onEnterCancelled;\n } else {\n return;\n }\n }\n let called = false;\n const done = el[enterCbKey] = (cancelled) => {\n if (called) return;\n called = true;\n if (cancelled) {\n callHook(cancelHook, [el]);\n } else {\n callHook(afterHook, [el]);\n }\n if (hooks.delayedLeave) {\n hooks.delayedLeave();\n }\n el[enterCbKey] = void 0;\n };\n if (hook) {\n callAsyncHook(hook, [el, done]);\n } else {\n done();\n }\n },\n leave(el, remove) {\n const key2 = String(vnode.key);\n if (el[enterCbKey]) {\n el[enterCbKey](\n true\n /* cancelled */\n );\n }\n if (state.isUnmounting) {\n return remove();\n }\n callHook(onBeforeLeave, [el]);\n let called = false;\n const done = el[leaveCbKey] = (cancelled) => {\n if (called) return;\n called = true;\n remove();\n if (cancelled) {\n callHook(onLeaveCancelled, [el]);\n } else {\n callHook(onAfterLeave, [el]);\n }\n el[leaveCbKey] = void 0;\n if (leavingVNodesCache[key2] === vnode) {\n delete leavingVNodesCache[key2];\n }\n };\n leavingVNodesCache[key2] = vnode;\n if (onLeave) {\n callAsyncHook(onLeave, [el, done]);\n } else {\n done();\n }\n },\n clone(vnode2) {\n const hooks2 = resolveTransitionHooks(\n vnode2,\n props,\n state,\n instance,\n postClone\n );\n if (postClone) postClone(hooks2);\n return hooks2;\n }\n };\n return hooks;\n}\nfunction emptyPlaceholder(vnode) {\n if (isKeepAlive(vnode)) {\n vnode = cloneVNode(vnode);\n vnode.children = null;\n return vnode;\n }\n}\nfunction getInnerChild$1(vnode) {\n if (!isKeepAlive(vnode)) {\n if (isTeleport(vnode.type) && vnode.children) {\n return findNonCommentChild(vnode.children);\n }\n return vnode;\n }\n if (vnode.component) {\n return vnode.component.subTree;\n }\n const { shapeFlag, children } = vnode;\n if (children) {\n if (shapeFlag & 16) {\n return children[0];\n }\n if (shapeFlag & 32 && isFunction(children.default)) {\n return children.default();\n }\n }\n}\nfunction setTransitionHooks(vnode, hooks) {\n if (vnode.shapeFlag & 6 && vnode.component) {\n vnode.transition = hooks;\n setTransitionHooks(vnode.component.subTree, hooks);\n } else if (vnode.shapeFlag & 128) {\n vnode.ssContent.transition = hooks.clone(vnode.ssContent);\n vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);\n } else {\n vnode.transition = hooks;\n }\n}\nfunction getTransitionRawChildren(children, keepComment = false, parentKey) {\n let ret = [];\n let keyedFragmentCount = 0;\n for (let i = 0; i < children.length; i++) {\n let child = children[i];\n const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);\n if (child.type === Fragment) {\n if (child.patchFlag & 128) keyedFragmentCount++;\n ret = ret.concat(\n getTransitionRawChildren(child.children, keepComment, key)\n );\n } else if (keepComment || child.type !== Comment) {\n ret.push(key != null ? cloneVNode(child, { key }) : child);\n }\n }\n if (keyedFragmentCount > 1) {\n for (let i = 0; i < ret.length; i++) {\n ret[i].patchFlag = -2;\n }\n }\n return ret;\n}\n\n// @__NO_SIDE_EFFECTS__\nfunction defineComponent(options, extraOptions) {\n return isFunction(options) ? (\n // #8236: extend call and options.name access are considered side-effects\n // by Rollup, so we have to wrap it in a pure-annotated IIFE.\n /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()\n ) : options;\n}\n\nfunction useId() {\n const i = getCurrentInstance();\n if (i) {\n return (i.appContext.config.idPrefix || \"v\") + \"-\" + i.ids[0] + i.ids[1]++;\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(\n `useId() is called when there is no active component instance to be associated with.`\n );\n }\n return \"\";\n}\nfunction markAsyncBoundary(instance) {\n instance.ids = [instance.ids[0] + instance.ids[2]++ + \"-\", 0, 0];\n}\n\nconst knownTemplateRefs = /* @__PURE__ */ new WeakSet();\nfunction useTemplateRef(key) {\n const i = getCurrentInstance();\n const r = shallowRef(null);\n if (i) {\n const refs = i.refs === EMPTY_OBJ ? i.refs = {} : i.refs;\n let desc;\n if (!!(process.env.NODE_ENV !== \"production\") && (desc = Object.getOwnPropertyDescriptor(refs, key)) && !desc.configurable) {\n warn$1(`useTemplateRef('${key}') already exists.`);\n } else {\n Object.defineProperty(refs, key, {\n enumerable: true,\n get: () => r.value,\n set: (val) => r.value = val\n });\n }\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(\n `useTemplateRef() is called when there is no active component instance to be associated with.`\n );\n }\n const ret = !!(process.env.NODE_ENV !== \"production\") ? readonly(r) : r;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n knownTemplateRefs.add(ret);\n }\n return ret;\n}\n\nconst pendingSetRefMap = /* @__PURE__ */ new WeakMap();\nfunction setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {\n if (isArray(rawRef)) {\n rawRef.forEach(\n (r, i) => setRef(\n r,\n oldRawRef && (isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),\n parentSuspense,\n vnode,\n isUnmount\n )\n );\n return;\n }\n if (isAsyncWrapper(vnode) && !isUnmount) {\n if (vnode.shapeFlag & 512 && vnode.type.__asyncResolved && vnode.component.subTree.component) {\n setRef(rawRef, oldRawRef, parentSuspense, vnode.component.subTree);\n }\n return;\n }\n const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;\n const value = isUnmount ? null : refValue;\n const { i: owner, r: ref } = rawRef;\n if (!!(process.env.NODE_ENV !== \"production\") && !owner) {\n warn$1(\n `Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.`\n );\n return;\n }\n const oldRef = oldRawRef && oldRawRef.r;\n const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;\n const setupState = owner.setupState;\n const rawSetupState = toRaw(setupState);\n const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {\n warn$1(\n `Template ref \"${key}\" used on a non-ref value. It will not work in the production build.`\n );\n }\n if (knownTemplateRefs.has(rawSetupState[key])) {\n return false;\n }\n }\n return hasOwn(rawSetupState, key);\n };\n const canSetRef = (ref2) => {\n return !!!(process.env.NODE_ENV !== \"production\") || !knownTemplateRefs.has(ref2);\n };\n if (oldRef != null && oldRef !== ref) {\n invalidatePendingSetRef(oldRawRef);\n if (isString(oldRef)) {\n refs[oldRef] = null;\n if (canSetSetupRef(oldRef)) {\n setupState[oldRef] = null;\n }\n } else if (isRef(oldRef)) {\n if (canSetRef(oldRef)) {\n oldRef.value = null;\n }\n const oldRawRefAtom = oldRawRef;\n if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;\n }\n }\n if (isFunction(ref)) {\n callWithErrorHandling(ref, owner, 12, [value, refs]);\n } else {\n const _isString = isString(ref);\n const _isRef = isRef(ref);\n if (_isString || _isRef) {\n const doSet = () => {\n if (rawRef.f) {\n const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];\n if (isUnmount) {\n isArray(existing) && remove(existing, refValue);\n } else {\n if (!isArray(existing)) {\n if (_isString) {\n refs[ref] = [refValue];\n if (canSetSetupRef(ref)) {\n setupState[ref] = refs[ref];\n }\n } else {\n const newVal = [refValue];\n if (canSetRef(ref)) {\n ref.value = newVal;\n }\n if (rawRef.k) refs[rawRef.k] = newVal;\n }\n } else if (!existing.includes(refValue)) {\n existing.push(refValue);\n }\n }\n } else if (_isString) {\n refs[ref] = value;\n if (canSetSetupRef(ref)) {\n setupState[ref] = value;\n }\n } else if (_isRef) {\n if (canSetRef(ref)) {\n ref.value = value;\n }\n if (rawRef.k) refs[rawRef.k] = value;\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(\"Invalid template ref type:\", ref, `(${typeof ref})`);\n }\n };\n if (value) {\n const job = () => {\n doSet();\n pendingSetRefMap.delete(rawRef);\n };\n job.id = -1;\n pendingSetRefMap.set(rawRef, job);\n queuePostRenderEffect(job, parentSuspense);\n } else {\n invalidatePendingSetRef(rawRef);\n doSet();\n }\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(\"Invalid template ref type:\", ref, `(${typeof ref})`);\n }\n }\n}\nfunction invalidatePendingSetRef(rawRef) {\n const pendingSetRef = pendingSetRefMap.get(rawRef);\n if (pendingSetRef) {\n pendingSetRef.flags |= 8;\n pendingSetRefMap.delete(rawRef);\n }\n}\n\nlet hasLoggedMismatchError = false;\nconst logMismatchError = () => {\n if (hasLoggedMismatchError) {\n return;\n }\n console.error(\"Hydration completed but contains mismatches.\");\n hasLoggedMismatchError = true;\n};\nconst isSVGContainer = (container) => container.namespaceURI.includes(\"svg\") && container.tagName !== \"foreignObject\";\nconst isMathMLContainer = (container) => container.namespaceURI.includes(\"MathML\");\nconst getContainerType = (container) => {\n if (container.nodeType !== 1) return void 0;\n if (isSVGContainer(container)) return \"svg\";\n if (isMathMLContainer(container)) return \"mathml\";\n return void 0;\n};\nconst isComment = (node) => node.nodeType === 8;\nfunction createHydrationFunctions(rendererInternals) {\n const {\n mt: mountComponent,\n p: patch,\n o: {\n patchProp,\n createText,\n nextSibling,\n parentNode,\n remove,\n insert,\n createComment\n }\n } = rendererInternals;\n const hydrate = (vnode, container) => {\n if (!container.hasChildNodes()) {\n (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(\n `Attempting to hydrate existing markup but container is empty. Performing full mount instead.`\n );\n patch(null, vnode, container);\n flushPostFlushCbs();\n container._vnode = vnode;\n return;\n }\n hydrateNode(container.firstChild, vnode, null, null, null);\n flushPostFlushCbs();\n container._vnode = vnode;\n };\n const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => {\n optimized = optimized || !!vnode.dynamicChildren;\n const isFragmentStart = isComment(node) && node.data === \"[\";\n const onMismatch = () => handleMismatch(\n node,\n vnode,\n parentComponent,\n parentSuspense,\n slotScopeIds,\n isFragmentStart\n );\n const { type, ref, shapeFlag, patchFlag } = vnode;\n let domType = node.nodeType;\n vnode.el = node;\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n def(node, \"__vnode\", vnode, true);\n def(node, \"__vueParentComponent\", parentComponent, true);\n }\n if (patchFlag === -2) {\n optimized = false;\n vnode.dynamicChildren = null;\n }\n let nextNode = null;\n switch (type) {\n case Text:\n if (domType !== 3) {\n if (vnode.children === \"\") {\n insert(vnode.el = createText(\"\"), parentNode(node), node);\n nextNode = node;\n } else {\n nextNode = onMismatch();\n }\n } else {\n if (node.data !== vnode.children) {\n (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(\n `Hydration text mismatch in`,\n node.parentNode,\n `\n - rendered on server: ${JSON.stringify(\n node.data\n )}\n - expected on client: ${JSON.stringify(vnode.children)}`\n );\n logMismatchError();\n node.data = vnode.children;\n }\n nextNode = nextSibling(node);\n }\n break;\n case Comment:\n if (isTemplateNode(node)) {\n nextNode = nextSibling(node);\n replaceNode(\n vnode.el = node.content.firstChild,\n node,\n parentComponent\n );\n } else if (domType !== 8 || isFragmentStart) {\n nextNode = onMismatch();\n } else {\n nextNode = nextSibling(node);\n }\n break;\n case Static:\n if (isFragmentStart) {\n node = nextSibling(node);\n domType = node.nodeType;\n }\n if (domType === 1 || domType === 3) {\n nextNode = node;\n const needToAdoptContent = !vnode.children.length;\n for (let i = 0; i < vnode.staticCount; i++) {\n if (needToAdoptContent)\n vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data;\n if (i === vnode.staticCount - 1) {\n vnode.anchor = nextNode;\n }\n nextNode = nextSibling(nextNode);\n }\n return isFragmentStart ? nextSibling(nextNode) : nextNode;\n } else {\n onMismatch();\n }\n break;\n case Fragment:\n if (!isFragmentStart) {\n nextNode = onMismatch();\n } else {\n nextNode = hydrateFragment(\n node,\n vnode,\n parentComponent,\n parentSuspense,\n slotScopeIds,\n optimized\n );\n }\n break;\n default:\n if (shapeFlag & 1) {\n if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {\n nextNode = onMismatch();\n } else {\n nextNode = hydrateElement(\n node,\n vnode,\n parentComponent,\n parentSuspense,\n slotScopeIds,\n optimized\n );\n }\n } else if (shapeFlag & 6) {\n vnode.slotScopeIds = slotScopeIds;\n const container = parentNode(node);\n if (isFragmentStart) {\n nextNode = locateClosingAnchor(node);\n } else if (isComment(node) && node.data === \"teleport start\") {\n nextNode = locateClosingAnchor(node, node.data, \"teleport end\");\n } else {\n nextNode = nextSibling(node);\n }\n mountComponent(\n vnode,\n container,\n null,\n parentComponent,\n parentSuspense,\n getContainerType(container),\n optimized\n );\n if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {\n let subTree;\n if (isFragmentStart) {\n subTree = createVNode(Fragment);\n subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;\n } else {\n subTree = node.nodeType === 3 ? createTextVNode(\"\") : createVNode(\"div\");\n }\n subTree.el = node;\n vnode.component.subTree = subTree;\n }\n } else if (shapeFlag & 64) {\n if (domType !== 8) {\n nextNode = onMismatch();\n } else {\n nextNode = vnode.type.hydrate(\n node,\n vnode,\n parentComponent,\n parentSuspense,\n slotScopeIds,\n optimized,\n rendererInternals,\n hydrateChildren\n );\n }\n } else if (shapeFlag & 128) {\n nextNode = vnode.type.hydrate(\n node,\n vnode,\n parentComponent,\n parentSuspense,\n getContainerType(parentNode(node)),\n slotScopeIds,\n optimized,\n rendererInternals,\n hydrateNode\n );\n } else if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) {\n warn$1(\"Invalid HostVNode type:\", type, `(${typeof type})`);\n }\n }\n if (ref != null) {\n setRef(ref, null, parentSuspense, vnode);\n }\n return nextNode;\n };\n const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {\n optimized = optimized || !!vnode.dynamicChildren;\n const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;\n const forcePatch = type === \"input\" || type === \"option\";\n if (!!(process.env.NODE_ENV !== \"production\") || forcePatch || patchFlag !== -1) {\n if (dirs) {\n invokeDirectiveHook(vnode, null, parentComponent, \"created\");\n }\n let needCallTransitionHooks = false;\n if (isTemplateNode(el)) {\n needCallTransitionHooks = needTransition(\n null,\n // no need check parentSuspense in hydration\n transition\n ) && parentComponent && parentComponent.vnode.props && parentComponent.vnode.props.appear;\n const content = el.content.firstChild;\n if (needCallTransitionHooks) {\n const cls = content.getAttribute(\"class\");\n if (cls) content.$cls = cls;\n transition.beforeEnter(content);\n }\n replaceNode(content, el, parentComponent);\n vnode.el = el = content;\n }\n if (shapeFlag & 16 && // skip if element has innerHTML / textContent\n !(props && (props.innerHTML || props.textContent))) {\n let next = hydrateChildren(\n el.firstChild,\n vnode,\n el,\n parentComponent,\n parentSuspense,\n slotScopeIds,\n optimized\n );\n let hasWarned = false;\n while (next) {\n if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {\n if ((!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {\n warn$1(\n `Hydration children mismatch on`,\n el,\n `\nServer rendered element contains more child nodes than client vdom.`\n );\n hasWarned = true;\n }\n logMismatchError();\n }\n const cur = next;\n next = next.nextSibling;\n remove(cur);\n }\n } else if (shapeFlag & 8) {\n let clientText = vnode.children;\n if (clientText[0] === \"\\n\" && (el.tagName === \"PRE\" || el.tagName === \"TEXTAREA\")) {\n clientText = clientText.slice(1);\n }\n if (el.textContent !== clientText) {\n if (!isMismatchAllowed(el, 0 /* TEXT */)) {\n (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(\n `Hydration text content mismatch on`,\n el,\n `\n - rendered on server: ${el.textContent}\n - expected on client: ${vnode.children}`\n );\n logMismatchError();\n }\n el.textContent = vnode.children;\n }\n }\n if (props) {\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & (16 | 32)) {\n const isCustomElement = el.tagName.includes(\"-\");\n for (const key in props) {\n if ((!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && // #11189 skip if this node has directives that have created hooks\n // as it could have mutated the DOM in any possible way\n !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) {\n logMismatchError();\n }\n if (forcePatch && (key.endsWith(\"value\") || key === \"indeterminate\") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers\n key[0] === \".\" || isCustomElement) {\n patchProp(el, key, null, props[key], void 0, parentComponent);\n }\n }\n } else if (props.onClick) {\n patchProp(\n el,\n \"onClick\",\n null,\n props.onClick,\n void 0,\n parentComponent\n );\n } else if (patchFlag & 4 && isReactive(props.style)) {\n for (const key in props.style) props.style[key];\n }\n }\n let vnodeHooks;\n if (vnodeHooks = props && props.onVnodeBeforeMount) {\n invokeVNodeHook(vnodeHooks, parentComponent, vnode);\n }\n if (dirs) {\n invokeDirectiveHook(vnode, null, parentComponent, \"beforeMount\");\n }\n if ((vnodeHooks = props && props.onVnodeMounted) || dirs || needCallTransitionHooks) {\n queueEffectWithSuspense(() => {\n vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode);\n needCallTransitionHooks && transition.enter(el);\n dirs && invokeDirectiveHook(vnode, null, parentComponent, \"mounted\");\n }, parentSuspense);\n }\n }\n return el.nextSibling;\n };\n const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => {\n optimized = optimized || !!parentVNode.dynamicChildren;\n const children = parentVNode.children;\n const l = children.length;\n let hasWarned = false;\n for (let i = 0; i < l; i++) {\n const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);\n const isText = vnode.type === Text;\n if (node) {\n if (isText && !optimized) {\n if (i + 1 < l && normalizeVNode(children[i + 1]).type === Text) {\n insert(\n createText(\n node.data.slice(vnode.children.length)\n ),\n container,\n nextSibling(node)\n );\n node.data = vnode.children;\n }\n }\n node = hydrateNode(\n node,\n vnode,\n parentComponent,\n parentSuspense,\n slotScopeIds,\n optimized\n );\n } else if (isText && !vnode.children) {\n insert(vnode.el = createText(\"\"), container);\n } else {\n if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {\n if ((!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {\n warn$1(\n `Hydration children mismatch on`,\n container,\n `\nServer rendered element contains fewer child nodes than client vdom.`\n );\n hasWarned = true;\n }\n logMismatchError();\n }\n patch(\n null,\n vnode,\n container,\n null,\n parentComponent,\n parentSuspense,\n getContainerType(container),\n slotScopeIds\n );\n }\n }\n return node;\n };\n const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {\n const { slotScopeIds: fragmentSlotScopeIds } = vnode;\n if (fragmentSlotScopeIds) {\n slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds;\n }\n const container = parentNode(node);\n const next = hydrateChildren(\n nextSibling(node),\n vnode,\n container,\n parentComponent,\n parentSuspense,\n slotScopeIds,\n optimized\n );\n if (next && isComment(next) && next.data === \"]\") {\n return nextSibling(vnode.anchor = next);\n } else {\n logMismatchError();\n insert(vnode.anchor = createComment(`]`), container, next);\n return next;\n }\n };\n const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {\n if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {\n (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(\n `Hydration node mismatch:\n- rendered on server:`,\n node,\n node.nodeType === 3 ? `(text)` : isComment(node) && node.data === \"[\" ? `(start of fragment)` : ``,\n `\n- expected on client:`,\n vnode.type\n );\n logMismatchError();\n }\n vnode.el = null;\n if (isFragment) {\n const end = locateClosingAnchor(node);\n while (true) {\n const next2 = nextSibling(node);\n if (next2 && next2 !== end) {\n remove(next2);\n } else {\n break;\n }\n }\n }\n const next = nextSibling(node);\n const container = parentNode(node);\n remove(node);\n patch(\n null,\n vnode,\n container,\n next,\n parentComponent,\n parentSuspense,\n getContainerType(container),\n slotScopeIds\n );\n if (parentComponent) {\n parentComponent.vnode.el = vnode.el;\n updateHOCHostEl(parentComponent, vnode.el);\n }\n return next;\n };\n const locateClosingAnchor = (node, open = \"[\", close = \"]\") => {\n let match = 0;\n while (node) {\n node = nextSibling(node);\n if (node && isComment(node)) {\n if (node.data === open) match++;\n if (node.data === close) {\n if (match === 0) {\n return nextSibling(node);\n } else {\n match--;\n }\n }\n }\n }\n return node;\n };\n const replaceNode = (newNode, oldNode, parentComponent) => {\n const parentNode2 = oldNode.parentNode;\n if (parentNode2) {\n parentNode2.replaceChild(newNode, oldNode);\n }\n let parent = parentComponent;\n while (parent) {\n if (parent.vnode.el === oldNode) {\n parent.vnode.el = parent.subTree.el = newNode;\n }\n parent = parent.parent;\n }\n };\n const isTemplateNode = (node) => {\n return node.nodeType === 1 && node.tagName === \"TEMPLATE\";\n };\n return [hydrate, hydrateNode];\n}\nfunction propHasMismatch(el, key, clientValue, vnode, instance) {\n let mismatchType;\n let mismatchKey;\n let actual;\n let expected;\n if (key === \"class\") {\n if (el.$cls) {\n actual = el.$cls;\n delete el.$cls;\n } else {\n actual = el.getAttribute(\"class\");\n }\n expected = normalizeClass(clientValue);\n if (!isSetEqual(toClassSet(actual || \"\"), toClassSet(expected))) {\n mismatchType = 2 /* CLASS */;\n mismatchKey = `class`;\n }\n } else if (key === \"style\") {\n actual = el.getAttribute(\"style\") || \"\";\n expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));\n const actualMap = toStyleMap(actual);\n const expectedMap = toStyleMap(expected);\n if (vnode.dirs) {\n for (const { dir, value } of vnode.dirs) {\n if (dir.name === \"show\" && !value) {\n expectedMap.set(\"display\", \"none\");\n }\n }\n }\n if (instance) {\n resolveCssVars(instance, vnode, expectedMap);\n }\n if (!isMapEqual(actualMap, expectedMap)) {\n mismatchType = 3 /* STYLE */;\n mismatchKey = \"style\";\n }\n } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {\n if (isBooleanAttr(key)) {\n actual = el.hasAttribute(key);\n expected = includeBooleanAttr(clientValue);\n } else if (clientValue == null) {\n actual = el.hasAttribute(key);\n expected = false;\n } else {\n if (el.hasAttribute(key)) {\n actual = el.getAttribute(key);\n } else if (key === \"value\" && el.tagName === \"TEXTAREA\") {\n actual = el.value;\n } else {\n actual = false;\n }\n expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;\n }\n if (actual !== expected) {\n mismatchType = 4 /* ATTRIBUTE */;\n mismatchKey = key;\n }\n }\n if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {\n const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}=\"${v}\"`;\n const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;\n const postSegment = `\n - rendered on server: ${format(actual)}\n - expected on client: ${format(expected)}\n Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.\n You should fix the source of the mismatch.`;\n {\n warn$1(preSegment, el, postSegment);\n }\n return true;\n }\n return false;\n}\nfunction toClassSet(str) {\n return new Set(str.trim().split(/\\s+/));\n}\nfunction isSetEqual(a, b) {\n if (a.size !== b.size) {\n return false;\n }\n for (const s of a) {\n if (!b.has(s)) {\n return false;\n }\n }\n return true;\n}\nfunction toStyleMap(str) {\n const styleMap = /* @__PURE__ */ new Map();\n for (const item of str.split(\";\")) {\n let [key, value] = item.split(\":\");\n key = key.trim();\n value = value && value.trim();\n if (key && value) {\n styleMap.set(key, value);\n }\n }\n return styleMap;\n}\nfunction isMapEqual(a, b) {\n if (a.size !== b.size) {\n return false;\n }\n for (const [key, value] of a) {\n if (value !== b.get(key)) {\n return false;\n }\n }\n return true;\n}\nfunction resolveCssVars(instance, vnode, expectedMap) {\n const root = instance.subTree;\n if (instance.getCssVars && (vnode === root || root && root.type === Fragment && root.children.includes(vnode))) {\n const cssVars = instance.getCssVars();\n for (const key in cssVars) {\n const value = normalizeCssVarValue(cssVars[key]);\n expectedMap.set(`--${getEscapedCssVarName(key, false)}`, value);\n }\n }\n if (vnode === root && instance.parent) {\n resolveCssVars(instance.parent, instance.vnode, expectedMap);\n }\n}\nconst allowMismatchAttr = \"data-allow-mismatch\";\nconst MismatchTypeString = {\n [0 /* TEXT */]: \"text\",\n [1 /* CHILDREN */]: \"children\",\n [2 /* CLASS */]: \"class\",\n [3 /* STYLE */]: \"style\",\n [4 /* ATTRIBUTE */]: \"attribute\"\n};\nfunction isMismatchAllowed(el, allowedType) {\n if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {\n while (el && !el.hasAttribute(allowMismatchAttr)) {\n el = el.parentElement;\n }\n }\n const allowedAttr = el && el.getAttribute(allowMismatchAttr);\n if (allowedAttr == null) {\n return false;\n } else if (allowedAttr === \"\") {\n return true;\n } else {\n const list = allowedAttr.split(\",\");\n if (allowedType === 0 /* TEXT */ && list.includes(\"children\")) {\n return true;\n }\n return list.includes(MismatchTypeString[allowedType]);\n }\n}\n\nconst requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));\nconst cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));\nconst hydrateOnIdle = (timeout = 1e4) => (hydrate) => {\n const id = requestIdleCallback(hydrate, { timeout });\n return () => cancelIdleCallback(id);\n};\nfunction elementIsVisibleInViewport(el) {\n const { top, left, bottom, right } = el.getBoundingClientRect();\n const { innerHeight, innerWidth } = window;\n return (top > 0 && top < innerHeight || bottom > 0 && bottom < innerHeight) && (left > 0 && left < innerWidth || right > 0 && right < innerWidth);\n}\nconst hydrateOnVisible = (opts) => (hydrate, forEach) => {\n const ob = new IntersectionObserver((entries) => {\n for (const e of entries) {\n if (!e.isIntersecting) continue;\n ob.disconnect();\n hydrate();\n break;\n }\n }, opts);\n forEach((el) => {\n if (!(el instanceof Element)) return;\n if (elementIsVisibleInViewport(el)) {\n hydrate();\n ob.disconnect();\n return false;\n }\n ob.observe(el);\n });\n return () => ob.disconnect();\n};\nconst hydrateOnMediaQuery = (query) => (hydrate) => {\n if (query) {\n const mql = matchMedia(query);\n if (mql.matches) {\n hydrate();\n } else {\n mql.addEventListener(\"change\", hydrate, { once: true });\n return () => mql.removeEventListener(\"change\", hydrate);\n }\n }\n};\nconst hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {\n if (isString(interactions)) interactions = [interactions];\n let hasHydrated = false;\n const doHydrate = (e) => {\n if (!hasHydrated) {\n hasHydrated = true;\n teardown();\n hydrate();\n e.target.dispatchEvent(new e.constructor(e.type, e));\n }\n };\n const teardown = () => {\n forEach((el) => {\n for (const i of interactions) {\n el.removeEventListener(i, doHydrate);\n }\n });\n };\n forEach((el) => {\n for (const i of interactions) {\n el.addEventListener(i, doHydrate, { once: true });\n }\n });\n return teardown;\n};\nfunction forEachElement(node, cb) {\n if (isComment(node) && node.data === \"[\") {\n let depth = 1;\n let next = node.nextSibling;\n while (next) {\n if (next.nodeType === 1) {\n const result = cb(next);\n if (result === false) {\n break;\n }\n } else if (isComment(next)) {\n if (next.data === \"]\") {\n if (--depth === 0) break;\n } else if (next.data === \"[\") {\n depth++;\n }\n }\n next = next.nextSibling;\n }\n } else {\n cb(node);\n }\n}\n\nconst isAsyncWrapper = (i) => !!i.type.__asyncLoader;\n// @__NO_SIDE_EFFECTS__\nfunction defineAsyncComponent(source) {\n if (isFunction(source)) {\n source = { loader: source };\n }\n const {\n loader,\n loadingComponent,\n errorComponent,\n delay = 200,\n hydrate: hydrateStrategy,\n timeout,\n // undefined = never times out\n suspensible = true,\n onError: userOnError\n } = source;\n let pendingRequest = null;\n let resolvedComp;\n let retries = 0;\n const retry = () => {\n retries++;\n pendingRequest = null;\n return load();\n };\n const load = () => {\n let thisRequest;\n return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {\n err = err instanceof Error ? err : new Error(String(err));\n if (userOnError) {\n return new Promise((resolve, reject) => {\n const userRetry = () => resolve(retry());\n const userFail = () => reject(err);\n userOnError(err, userRetry, userFail, retries + 1);\n });\n } else {\n throw err;\n }\n }).then((comp) => {\n if (thisRequest !== pendingRequest && pendingRequest) {\n return pendingRequest;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && !comp) {\n warn$1(\n `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`\n );\n }\n if (comp && (comp.__esModule || comp[Symbol.toStringTag] === \"Module\")) {\n comp = comp.default;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && comp && !isObject(comp) && !isFunction(comp)) {\n throw new Error(`Invalid async component load result: ${comp}`);\n }\n resolvedComp = comp;\n return comp;\n }));\n };\n return defineComponent({\n name: \"AsyncComponentWrapper\",\n __asyncLoader: load,\n __asyncHydrate(el, instance, hydrate) {\n let patched = false;\n (instance.bu || (instance.bu = [])).push(() => patched = true);\n const performHydrate = () => {\n if (patched) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(\n `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`\n );\n }\n return;\n }\n hydrate();\n };\n const doHydrate = hydrateStrategy ? () => {\n const teardown = hydrateStrategy(\n performHydrate,\n (cb) => forEachElement(el, cb)\n );\n if (teardown) {\n (instance.bum || (instance.bum = [])).push(teardown);\n }\n } : performHydrate;\n if (resolvedComp) {\n doHydrate();\n } else {\n load().then(() => !instance.isUnmounted && doHydrate());\n }\n },\n get __asyncResolved() {\n return resolvedComp;\n },\n setup() {\n const instance = currentInstance;\n markAsyncBoundary(instance);\n if (resolvedComp) {\n return () => createInnerComp(resolvedComp, instance);\n }\n const onError = (err) => {\n pendingRequest = null;\n handleError(\n err,\n instance,\n 13,\n !errorComponent\n );\n };\n if (suspensible && instance.suspense || isInSSRComponentSetup) {\n return load().then((comp) => {\n return () => createInnerComp(comp, instance);\n }).catch((err) => {\n onError(err);\n return () => errorComponent ? createVNode(errorComponent, {\n error: err\n }) : null;\n });\n }\n const loaded = ref(false);\n const error = ref();\n const delayed = ref(!!delay);\n if (delay) {\n setTimeout(() => {\n delayed.value = false;\n }, delay);\n }\n if (timeout != null) {\n setTimeout(() => {\n if (!loaded.value && !error.value) {\n const err = new Error(\n `Async component timed out after ${timeout}ms.`\n );\n onError(err);\n error.value = err;\n }\n }, timeout);\n }\n load().then(() => {\n loaded.value = true;\n if (instance.parent && isKeepAlive(instance.parent.vnode)) {\n instance.parent.update();\n }\n }).catch((err) => {\n onError(err);\n error.value = err;\n });\n return () => {\n if (loaded.value && resolvedComp) {\n return createInnerComp(resolvedComp, instance);\n } else if (error.value && errorComponent) {\n return createVNode(errorComponent, {\n error: error.value\n });\n } else if (loadingComponent && !delayed.value) {\n return createVNode(loadingComponent);\n }\n };\n }\n });\n}\nfunction createInnerComp(comp, parent) {\n const { ref: ref2, props, children, ce } = parent.vnode;\n const vnode = createVNode(comp, props, children);\n vnode.ref = ref2;\n vnode.ce = ce;\n delete parent.vnode.ce;\n return vnode;\n}\n\nconst isKeepAlive = (vnode) => vnode.type.__isKeepAlive;\nconst KeepAliveImpl = {\n name: `KeepAlive`,\n // Marker for special handling inside the renderer. We are not using a ===\n // check directly on KeepAlive in the renderer, because importing it directly\n // would prevent it from being tree-shaken.\n __isKeepAlive: true,\n props: {\n include: [String, RegExp, Array],\n exclude: [String, RegExp, Array],\n max: [String, Number]\n },\n setup(props, { slots }) {\n const instance = getCurrentInstance();\n const sharedContext = instance.ctx;\n if (!sharedContext.renderer) {\n return () => {\n const children = slots.default && slots.default();\n return children && children.length === 1 ? children[0] : children;\n };\n }\n const cache = /* @__PURE__ */ new Map();\n const keys = /* @__PURE__ */ new Set();\n let current = null;\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n instance.__v_cache = cache;\n }\n const parentSuspense = instance.suspense;\n const {\n renderer: {\n p: patch,\n m: move,\n um: _unmount,\n o: { createElement }\n }\n } = sharedContext;\n const storageContainer = createElement(\"div\");\n sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {\n const instance2 = vnode.component;\n move(vnode, container, anchor, 0, parentSuspense);\n patch(\n instance2.vnode,\n vnode,\n container,\n anchor,\n instance2,\n parentSuspense,\n namespace,\n vnode.slotScopeIds,\n optimized\n );\n queuePostRenderEffect(() => {\n instance2.isDeactivated = false;\n if (instance2.a) {\n invokeArrayFns(instance2.a);\n }\n const vnodeHook = vnode.props && vnode.props.onVnodeMounted;\n if (vnodeHook) {\n invokeVNodeHook(vnodeHook, instance2.parent, vnode);\n }\n }, parentSuspense);\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n devtoolsComponentAdded(instance2);\n }\n };\n sharedContext.deactivate = (vnode) => {\n const instance2 = vnode.component;\n invalidateMount(instance2.m);\n invalidateMount(instance2.a);\n move(vnode, storageContainer, null, 1, parentSuspense);\n queuePostRenderEffect(() => {\n if (instance2.da) {\n invokeArrayFns(instance2.da);\n }\n const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;\n if (vnodeHook) {\n invokeVNodeHook(vnodeHook, instance2.parent, vnode);\n }\n instance2.isDeactivated = true;\n }, parentSuspense);\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n devtoolsComponentAdded(instance2);\n }\n if (!!(process.env.NODE_ENV !== \"production\") && true) {\n instance2.__keepAliveStorageContainer = storageContainer;\n }\n };\n function unmount(vnode) {\n resetShapeFlag(vnode);\n _unmount(vnode, instance, parentSuspense, true);\n }\n function pruneCache(filter) {\n cache.forEach((vnode, key) => {\n const name = getComponentName(vnode.type);\n if (name && !filter(name)) {\n pruneCacheEntry(key);\n }\n });\n }\n function pruneCacheEntry(key) {\n const cached = cache.get(key);\n if (cached && (!current || !isSameVNodeType(cached, current))) {\n unmount(cached);\n } else if (current) {\n resetShapeFlag(current);\n }\n cache.delete(key);\n keys.delete(key);\n }\n watch(\n () => [props.include, props.exclude],\n ([include, exclude]) => {\n include && pruneCache((name) => matches(include, name));\n exclude && pruneCache((name) => !matches(exclude, name));\n },\n // prune post-render after `current` has been updated\n { flush: \"post\", deep: true }\n );\n let pendingCacheKey = null;\n const cacheSubtree = () => {\n if (pendingCacheKey != null) {\n if (isSuspense(instance.subTree.type)) {\n queuePostRenderEffect(() => {\n cache.set(pendingCacheKey, getInnerChild(instance.subTree));\n }, instance.subTree.suspense);\n } else {\n cache.set(pendingCacheKey, getInnerChild(instance.subTree));\n }\n }\n };\n onMounted(cacheSubtree);\n onUpdated(cacheSubtree);\n onBeforeUnmount(() => {\n cache.forEach((cached) => {\n const { subTree, suspense } = instance;\n const vnode = getInnerChild(subTree);\n if (cached.type === vnode.type && cached.key === vnode.key) {\n resetShapeFlag(vnode);\n const da = vnode.component.da;\n da && queuePostRenderEffect(da, suspense);\n return;\n }\n unmount(cached);\n });\n });\n return () => {\n pendingCacheKey = null;\n if (!slots.default) {\n return current = null;\n }\n const children = slots.default();\n const rawVNode = children[0];\n if (children.length > 1) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(`KeepAlive should contain exactly one component child.`);\n }\n current = null;\n return children;\n } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {\n current = null;\n return rawVNode;\n }\n let vnode = getInnerChild(rawVNode);\n if (vnode.type === Comment) {\n current = null;\n return vnode;\n }\n const comp = vnode.type;\n const name = getComponentName(\n isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp\n );\n const { include, exclude, max } = props;\n if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {\n vnode.shapeFlag &= -257;\n current = vnode;\n return rawVNode;\n }\n const key = vnode.key == null ? comp : vnode.key;\n const cachedVNode = cache.get(key);\n if (vnode.el) {\n vnode = cloneVNode(vnode);\n if (rawVNode.shapeFlag & 128) {\n rawVNode.ssContent = vnode;\n }\n }\n pendingCacheKey = key;\n if (cachedVNode) {\n vnode.el = cachedVNode.el;\n vnode.component = cachedVNode.component;\n if (vnode.transition) {\n setTransitionHooks(vnode, vnode.transition);\n }\n vnode.shapeFlag |= 512;\n keys.delete(key);\n keys.add(key);\n } else {\n keys.add(key);\n if (max && keys.size > parseInt(max, 10)) {\n pruneCacheEntry(keys.values().next().value);\n }\n }\n vnode.shapeFlag |= 256;\n current = vnode;\n return isSuspense(rawVNode.type) ? rawVNode : vnode;\n };\n }\n};\nconst KeepAlive = KeepAliveImpl;\nfunction matches(pattern, name) {\n if (isArray(pattern)) {\n return pattern.some((p) => matches(p, name));\n } else if (isString(pattern)) {\n return pattern.split(\",\").includes(name);\n } else if (isRegExp(pattern)) {\n pattern.lastIndex = 0;\n return pattern.test(name);\n }\n return false;\n}\nfunction onActivated(hook, target) {\n registerKeepAliveHook(hook, \"a\", target);\n}\nfunction onDeactivated(hook, target) {\n registerKeepAliveHook(hook, \"da\", target);\n}\nfunction registerKeepAliveHook(hook, type, target = currentInstance) {\n const wrappedHook = hook.__wdc || (hook.__wdc = () => {\n let current = target;\n while (current) {\n if (current.isDeactivated) {\n return;\n }\n current = current.parent;\n }\n return hook();\n });\n injectHook(type, wrappedHook, target);\n if (target) {\n let current = target.parent;\n while (current && current.parent) {\n if (isKeepAlive(current.parent.vnode)) {\n injectToKeepAliveRoot(wrappedHook, type, target, current);\n }\n current = current.parent;\n }\n }\n}\nfunction injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {\n const injected = injectHook(\n type,\n hook,\n keepAliveRoot,\n true\n /* prepend */\n );\n onUnmounted(() => {\n remove(keepAliveRoot[type], injected);\n }, target);\n}\nfunction resetShapeFlag(vnode) {\n vnode.shapeFlag &= -257;\n vnode.shapeFlag &= -513;\n}\nfunction getInnerChild(vnode) {\n return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;\n}\n\nfunction injectHook(type, hook, target = currentInstance, prepend = false) {\n if (target) {\n const hooks = target[type] || (target[type] = []);\n const wrappedHook = hook.__weh || (hook.__weh = (...args) => {\n pauseTracking();\n const reset = setCurrentInstance(target);\n const res = callWithAsyncErrorHandling(hook, target, type, args);\n reset();\n resetTracking();\n return res;\n });\n if (prepend) {\n hooks.unshift(wrappedHook);\n } else {\n hooks.push(wrappedHook);\n }\n return wrappedHook;\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, \"\"));\n warn$1(\n `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )\n );\n }\n}\nconst createHook = (lifecycle) => (hook, target = currentInstance) => {\n if (!isInSSRComponentSetup || lifecycle === \"sp\") {\n injectHook(lifecycle, (...args) => hook(...args), target);\n }\n};\nconst onBeforeMount = createHook(\"bm\");\nconst onMounted = createHook(\"m\");\nconst onBeforeUpdate = createHook(\n \"bu\"\n);\nconst onUpdated = createHook(\"u\");\nconst onBeforeUnmount = createHook(\n \"bum\"\n);\nconst onUnmounted = createHook(\"um\");\nconst onServerPrefetch = createHook(\n \"sp\"\n);\nconst onRenderTriggered = createHook(\"rtg\");\nconst onRenderTracked = createHook(\"rtc\");\nfunction onErrorCaptured(hook, target = currentInstance) {\n injectHook(\"ec\", hook, target);\n}\n\nconst COMPONENTS = \"components\";\nconst DIRECTIVES = \"directives\";\nfunction resolveComponent(name, maybeSelfReference) {\n return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;\n}\nconst NULL_DYNAMIC_COMPONENT = Symbol.for(\"v-ndc\");\nfunction resolveDynamicComponent(component) {\n if (isString(component)) {\n return resolveAsset(COMPONENTS, component, false) || component;\n } else {\n return component || NULL_DYNAMIC_COMPONENT;\n }\n}\nfunction resolveDirective(name) {\n return resolveAsset(DIRECTIVES, name);\n}\nfunction resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {\n const instance = currentRenderingInstance || currentInstance;\n if (instance) {\n const Component = instance.type;\n if (type === COMPONENTS) {\n const selfName = getComponentName(\n Component,\n false\n );\n if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {\n return Component;\n }\n }\n const res = (\n // local registration\n // check instance[type] first which is resolved for options API\n resolve(instance[type] || Component[type], name) || // global registration\n resolve(instance.appContext[type], name)\n );\n if (!res && maybeSelfReference) {\n return Component;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && warnMissing && !res) {\n const extra = type === COMPONENTS ? `\nIf this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;\n warn$1(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);\n }\n return res;\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn$1(\n `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`\n );\n }\n}\nfunction resolve(registry, name) {\n return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);\n}\n\nfunction renderList(source, renderItem, cache, index) {\n let ret;\n const cached = cache && cache[index];\n const sourceIsArray = isArray(source);\n if (sourceIsArray || isString(source)) {\n const sourceIsReactiveArray = sourceIsArray && isReactive(source);\n let needsWrap = false;\n let isReadonlySource = false;\n if (sourceIsReactiveArray) {\n needsWrap = !isShallow(source);\n isReadonlySource = isReadonly(source);\n source = shallowReadArray(source);\n }\n ret = new Array(source.length);\n for (let i = 0, l = source.length; i < l; i++) {\n ret[i] = renderItem(\n needsWrap ? isReadonlySource ? toReadonly(toReactive(source[i])) : toReactive(source[i]) : source[i],\n i,\n void 0,\n cached && cached[i]\n );\n }\n } else if (typeof source === \"number\") {\n if (!!(process.env.NODE_ENV !== \"production\") && !Number.isInteger(source)) {\n warn$1(`The v-for range expect an integer value but got ${source}.`);\n }\n ret = new Array(source);\n for (let i = 0; i < source; i++) {\n ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);\n }\n } else if (isObject(source)) {\n if (source[Symbol.iterator]) {\n ret = Array.from(\n source,\n (item, i) => renderItem(item, i, void 0, cached && cached[i])\n );\n } else {\n const keys = Object.keys(source);\n ret = new Array(keys.length);\n for (let i = 0, l = keys.length; i < l; i++) {\n const key = keys[i];\n ret[i] = renderItem(source[key], key, i, cached && cached[i]);\n }\n }\n } else {\n ret = [];\n }\n if (cache) {\n cache[index] = ret;\n }\n return ret;\n}\n\nfunction createSlots(slots, dynamicSlots) {\n for (let i = 0; i < dynamicSlots.length; i++) {\n const slot = dynamicSlots[i];\n if (isArray(slot)) {\n for (let j = 0; j < slot.length; j++) {\n slots[slot[j].name] = slot[j].fn;\n }\n } else if (slot) {\n slots[slot.name] = slot.key ? (...args) => {\n const res = slot.fn(...args);\n if (res) res.key = slot.key;\n return res;\n } : slot.fn;\n }\n }\n return slots;\n}\n\nfunction renderSlot(slots, name, props = {}, fallback, noSlotted) {\n if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {\n const hasProps = Object.keys(props).length > 0;\n if (name !== \"default\") props.name = name;\n return openBlock(), createBlock(\n Fragment,\n null,\n [createVNode(\"slot\", props, fallback && fallback())],\n hasProps ? -2 : 64\n );\n }\n let slot = slots[name];\n if (!!(process.env.NODE_ENV !== \"production\") && slot && slot.length > 1) {\n warn$1(\n `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`\n );\n slot = () => [];\n }\n if (slot && slot._c) {\n slot._d = false;\n }\n openBlock();\n const validSlotContent = slot && ensureValidVNode(slot(props));\n const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch\n // key attached in the `createSlots` helper, respect that\n validSlotContent && validSlotContent.key;\n const rendered = createBlock(\n Fragment,\n {\n key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + // #7256 force differentiate fallback content from actual content\n (!validSlotContent && fallback ? \"_fb\" : \"\")\n },\n validSlotContent || (fallback ? fallback() : []),\n validSlotContent && slots._ === 1 ? 64 : -2\n );\n if (!noSlotted && rendered.scopeId) {\n rendered.slotScopeIds = [rendered.scopeId + \"-s\"];\n }\n if (slot && slot._c) {\n slot._d = true;\n }\n return rendered;\n}\nfunction ensureValidVNode(vnodes) {\n return vnodes.some((child) => {\n if (!isVNode(child)) return true;\n if (child.type === Comment) return false;\n if (child.type === Fragment && !ensureValidVNode(child.children))\n return false;\n return true;\n }) ? vnodes : null;\n}\n\nfunction toHandlers(obj, preserveCaseIfNecessary) {\n const ret = {};\n if (!!(process.env.NODE_ENV !== \"production\") && !isObject(obj)) {\n warn$1(`v-on with no argument expects an object value.`);\n return ret;\n }\n for (const key in obj) {\n ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];\n }\n return ret;\n}\n\nconst getPublicInstance = (i) => {\n if (!i) return null;\n if (isStatefulComponent(i)) return getComponentPublicInstance(i);\n return getPublicInstance(i.parent);\n};\nconst publicPropertiesMap = (\n // Move PURE marker to new line to workaround compiler discarding it\n // due to type annotation\n /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {\n $: (i) => i,\n $el: (i) => i.vnode.el,\n $data: (i) => i.data,\n $props: (i) => !!(process.env.NODE_ENV !== \"production\") ? shallowReadonly(i.props) : i.props,\n $attrs: (i) => !!(process.env.NODE_ENV !== \"production\") ? shallowReadonly(i.attrs) : i.attrs,\n $slots: (i) => !!(process.env.NODE_ENV !== \"production\") ? shallowReadonly(i.slots) : i.slots,\n $refs: (i) => !!(process.env.NODE_ENV !== \"production\") ? shallowReadonly(i.refs) : i.refs,\n $parent: (i) => getPublicInstance(i.parent),\n $root: (i) => getPublicInstance(i.root),\n $host: (i) => i.ce,\n $emit: (i) => i.emit,\n $options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,\n $forceUpdate: (i) => i.f || (i.f = () => {\n queueJob(i.update);\n }),\n $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),\n $watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP\n })\n);\nconst isReservedPrefix = (key) => key === \"_\" || key === \"$\";\nconst hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);\nconst PublicInstanceProxyHandlers = {\n get({ _: instance }, key) {\n if (key === \"__v_skip\") {\n return true;\n }\n const { ctx, setupState, data, props, accessCache, type, appContext } = instance;\n if (!!(process.env.NODE_ENV !== \"production\") && key === \"__isVue\") {\n return true;\n }\n let normalizedProps;\n if (key[0] !== \"$\") {\n const n = accessCache[key];\n if (n !== void 0) {\n switch (n) {\n case 1 /* SETUP */:\n return setupState[key];\n case 2 /* DATA */:\n return data[key];\n case 4 /* CONTEXT */:\n return ctx[key];\n case 3 /* PROPS */:\n return props[key];\n }\n } else if (hasSetupBinding(setupState, key)) {\n accessCache[key] = 1 /* SETUP */;\n return setupState[key];\n } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {\n accessCache[key] = 2 /* DATA */;\n return data[key];\n } else if (\n // only cache other properties when instance has declared (thus stable)\n // props\n (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)\n ) {\n accessCache[key] = 3 /* PROPS */;\n return props[key];\n } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {\n accessCache[key] = 4 /* CONTEXT */;\n return ctx[key];\n } else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {\n accessCache[key] = 0 /* OTHER */;\n }\n }\n const publicGetter = publicPropertiesMap[key];\n let cssModule, globalProperties;\n if (publicGetter) {\n if (key === \"$attrs\") {\n track(instance.attrs, \"get\", \"\");\n !!(process.env.NODE_ENV !== \"production\") && markAttrsAccessed();\n } else if (!!(process.env.NODE_ENV !== \"production\") && key === \"$slots\") {\n track(instance, \"get\", key);\n }\n return publicGetter(instance);\n } else if (\n // css module (injected by vue-loader)\n (cssModule = type.__cssModules) && (cssModule = cssModule[key])\n ) {\n return cssModule;\n } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {\n accessCache[key] = 4 /* CONTEXT */;\n return ctx[key];\n } else if (\n // global properties\n globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)\n ) {\n {\n return globalProperties[key];\n }\n } else if (!!(process.env.NODE_ENV !== \"production\") && currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading\n // to infinite warning loop\n key.indexOf(\"__v\") !== 0)) {\n if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {\n warn$1(\n `Property ${JSON.stringify(\n key\n )} must be accessed via $data because it starts with a reserved character (\"$\" or \"_\") and is not proxied on the render context.`\n );\n } else if (instance === currentRenderingInstance) {\n warn$1(\n `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`\n );\n }\n }\n },\n set({ _: instance }, key, value) {\n const { data, setupState, ctx } = instance;\n if (hasSetupBinding(setupState, key)) {\n setupState[key] = value;\n return true;\n } else if (!!(process.env.NODE_ENV !== \"production\") && setupState.__isScriptSetup && hasOwn(setupState, key)) {\n warn$1(`Cannot mutate