@syncular/console 0.0.5-42 → 0.0.6-45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,11 +14,11 @@ Event: ${Gi(e)}`),!0;if(VD(e,t.denyUrls))return Ce&&be.warn(`Event dropped due t
|
|
|
14
14
|
Event: ${Gi(e)}.
|
|
15
15
|
Url: ${yh(e)}`),!0;if(!KD(e,t.allowUrls))return Ce&&be.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
16
16
|
Event: ${Gi(e)}.
|
|
17
|
-
Url: ${yh(e)}`),!0}return!1}function HD(e,t){return t?.length?KR(e).some(n=>Go(n,t)):!1}function qD(e,t){if(!t?.length)return!1;const n=e.transaction;return n?Go(n,t):!1}function VD(e,t){if(!t?.length)return!1;const n=yh(e);return n?Go(n,t):!1}function KD(e,t){if(!t?.length)return!0;const n=yh(e);return n?Go(n,t):!0}function GD(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function yh(e){try{const n=[...e.exception?.values??[]].reverse().find(s=>s.mechanism?.parent_id===void 0&&s.stacktrace?.frames?.length)?.stacktrace?.frames;return n?GD(n):null}catch{return Ce&&be.error(`Cannot extract url for event ${Gi(e)}`),null}}function ZD(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function YD(e,t,n,s,i,a){if(!i.exception?.values||!a||!Qs(a.originalException,Error))return;const l=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;l&&(i.exception.values=ev(e,t,s,a.originalException,n,i.exception.values,l,0))}function ev(e,t,n,s,i,a,l,f){if(a.length>=n+1)return a;let d=[...a];if(Qs(s[i],Error)){Qw(l,f,s);const p=e(t,s[i]),g=d.length;Ww(p,i,g,f),d=ev(e,t,n,s[i],i,[p,...d],p,g)}return t1(s)&&s.errors.forEach((p,g)=>{if(Qs(p,Error)){Qw(l,f,s);const y=e(t,p),b=d.length;Ww(y,`errors[${g}]`,b,f),d=ev(e,t,n,p,i,[y,...d],y,b)}}),d}function t1(e){return Array.isArray(e.errors)}function Qw(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...t1(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Ww(e,t,n,s){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:s}}function XD(e){const t="console";ci(t,e),li(t,QD)}function QD(){"console"in ct&&kM.forEach(function(e){e in ct.console&&gr(ct.console,e,function(t){return hh[e]=t,function(...n){Hr("console",{args:n,level:e}),hh[e]?.apply(ct.console,n)}})})}function WD(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const JD="Dedupe",e2=(()=>{let e;return{name:JD,processEvent(t){if(t.type)return t;try{if(n2(t,e))return Ce&&be.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),t2=e2;function n2(e,t){return t?!!(r2(e,t)||s2(e,t)):!1}function r2(e,t){const n=e.message,s=t.message;return!(!n&&!s||n&&!s||!n&&s||n!==s||!r1(e,t)||!n1(e,t))}function s2(e,t){const n=Jw(t),s=Jw(e);return!(!n||!s||n.type!==s.type||n.value!==s.value||!r1(e,t)||!n1(e,t))}function n1(e,t){let n=uw(e),s=uw(t);if(!n&&!s)return!0;if(n&&!s||!n&&s||(n=n,s=s,s.length!==n.length))return!1;for(let i=0;i<s.length;i++){const a=s[i],l=n[i];if(a.filename!==l.filename||a.lineno!==l.lineno||a.colno!==l.colno||a.function!==l.function)return!1}return!0}function r1(e,t){let n=e.fingerprint,s=t.fingerprint;if(!n&&!s)return!0;if(n&&!s||!n&&s)return!1;n=n,s=s;try{return n.join("")===s.join("")}catch{return!1}}function Jw(e){return e.exception?.values?.[0]}const o2="ConversationId",i2=(()=>({name:o2,setup(e){e.on("spanStart",t=>{const n=bt().getScopeData(),s=ss().getScopeData(),i=n.conversationId||s.conversationId;i&&t.setAttribute(dI,i)})}})),a2=i2;function c2(e,t,n,s,i){if(!e.fetchData)return;const{method:a,url:l}=e.fetchData,f=rs()&&t(l);if(e.endTimestamp&&f){const x=e.fetchData.__span;if(!x)return;const S=s[x];S&&(f2(S,e),l2(S,e,i),delete s[x]);return}const{spanOrigin:d="auto.http.browser",propagateTraceparent:p=!1}=typeof i=="object"?i:{spanOrigin:i},g=!!Xn(),y=f&&g?Gc(h2(l,a,d)):new ei;if(e.fetchData.__span=y.spanContext().spanId,s[y.spanContext().spanId]=y,n(e.fetchData.url)){const x=e.args[0],S={...e.args[1]||{}},w=u2(x,S,rs()&&g?y:void 0,p);w&&(e.args[1]=S,S.headers=w)}const b=gt();if(b){const x={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};b.emit("beforeOutgoingRequestSpan",y,x)}return y}function l2(e,t,n){(typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0)?.(e,{headers:t.response?.headers,error:t.error})}function u2(e,t,n,s){const i=e1({span:n,propagateTraceparent:s}),a=i["sentry-trace"],l=i.baggage,f=i.traceparent;if(!a)return;const d=t.headers||(Hv(e)?e.headers:void 0);if(d)if(d2(d)){const p=new Headers(d);if(p.get("sentry-trace")||p.set("sentry-trace",a),s&&f&&!p.get("traceparent")&&p.set("traceparent",f),l){const g=p.get("baggage");g?_d(g)||p.set("baggage",`${g},${l}`):p.set("baggage",l)}return p}else if(Array.isArray(d)){const p=[...d];d.find(y=>y[0]==="sentry-trace")||p.push(["sentry-trace",a]),s&&f&&!d.find(y=>y[0]==="traceparent")&&p.push(["traceparent",f]);const g=d.find(y=>y[0]==="baggage"&&_d(y[1]));return l&&!g&&p.push(["baggage",l]),p}else{const p="sentry-trace"in d?d["sentry-trace"]:void 0,g="traceparent"in d?d.traceparent:void 0,y="baggage"in d?d.baggage:void 0,b=y?Array.isArray(y)?[...y]:[y]:[],x=y&&(Array.isArray(y)?y.find(w=>_d(w)):_d(y));l&&!x&&b.push(l);const S={...d,"sentry-trace":p??a,baggage:b.length>0?b.join(","):void 0};return s&&f&&!g&&(S.traceparent=f),S}else return{...i}}function f2(e,t){if(t.response){hR(e,t.response.status);const n=t.response?.headers?.get("content-length");if(n){const s=parseInt(n);s>0&&e.setAttribute("http.response_content_length",s)}}else t.error&&e.setStatus({code:hn,message:"internal_error"});e.end()}function _d(e){return e.split(",").some(t=>t.trim().startsWith(Yv))}function d2(e){return typeof Headers<"u"&&Qs(e,Headers)}function h2(e,t,n){if(e.startsWith("data:")){const a=Zo(e);return{name:`${t} ${a}`,attributes:eE(e,void 0,t,n)}}const s=WR(e),i=s?RD(s):e;return{name:`${t} ${i}`,attributes:eE(e,s,t,n)}}function eE(e,t,n,s){const i={url:Zo(e),type:"fetch","http.method":n,[mn]:s,[eo]:"http.client"};return t&&(QR(t)||(i["http.url"]=Zo(t.href),i["server.address"]=t.host),t.search&&(i["http.query"]=t.search),t.hash&&(i["http.fragment"]=t.hash)),i}function Zc(e,t,n,s,i){eD({level:e,message:t,attributes:n,severityNumber:i},s)}function p2(e,t,{scope:n}={}){Zc("trace",e,t,n)}function m2(e,t,{scope:n}={}){Zc("debug",e,t,n)}function g2(e,t,{scope:n}={}){Zc("info",e,t,n)}function y2(e,t,{scope:n}={}){Zc("warn",e,t,n)}function v2(e,t,{scope:n}={}){Zc("error",e,t,n)}function b2(e,t,{scope:n}={}){Zc("fatal",e,t,n)}const x2=Object.freeze(Object.defineProperty({__proto__:null,debug:m2,error:v2,fatal:b2,fmt:AD,info:g2,trace:p2,warn:y2},Symbol.toStringTag,{value:"Module"}));function lb(e,t,n,s){aD({type:e,name:t,value:n,unit:s?.unit,attributes:s?.attributes},{scope:s?.scope})}function tE(e,t=1,n){lb("counter",e,t,n)}function nE(e,t,n){lb("gauge",e,t,n)}function rE(e,t,n){lb("distribution",e,t,n)}function s1(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const vu=ct;function S2(){return"history"in vu&&!!vu.history}function _2(){if(!("fetch"in vu))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function tv(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function w2(){if(typeof EdgeRuntime=="string")return!0;if(!_2())return!1;if(tv(vu.fetch))return!0;let e=!1;const t=vu.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=tv(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){Ce&&be.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}function o1(e,t){const n="fetch";ci(n,e),li(n,()=>i1(void 0,t))}function E2(e){const t="fetch-body-resolved";ci(t,e),li(t,()=>i1(C2))}function i1(e,t=!1){t&&!w2()||gr(ct,"fetch",function(n){return function(...s){const i=new Error,{method:a,url:l}=R2(s),f={args:s,fetchData:{method:a,url:l},startTimestamp:cn()*1e3,virtualError:i,headers:N2(s)};return e||Hr("fetch",{...f}),n.apply(ct,s).then(async d=>(e?e(d):Hr("fetch",{...f,endTimestamp:cn()*1e3,response:d}),d),d=>{Hr("fetch",{...f,endTimestamp:cn()*1e3,error:d}),Jh(d)&&d.stack===void 0&&(d.stack=i.stack,Yn(d,"framesToPop",1));const g=gt()?.getOptions().enhanceFetchErrorMessages??"always";if(g!==!1&&d instanceof TypeError&&(d.message==="Failed to fetch"||d.message==="Load failed"||d.message==="NetworkError when attempting to fetch resource."))try{const x=new URL(f.fetchData.url).host;g==="always"?d.message=`${d.message} (${x})`:Yn(d,"__sentry_fetch_url_host__",x)}catch{}throw d})}})}async function T2(e,t){if(e?.body){const n=e.body,s=n.getReader(),i=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let a=!0;for(;a;){let l;try{l=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:f}=await s.read();clearTimeout(l),f&&(t(),a=!1)}catch{a=!1}finally{clearTimeout(l)}}clearTimeout(i),s.releaseLock(),n.cancel().then(null,()=>{})}}function C2(e){let t;try{t=e.clone()}catch{return}T2(t,()=>{Hr("fetch-body-resolved",{endTimestamp:cn()*1e3,response:e})})}function eh(e,t){return!!e&&typeof e=="object"&&!!e[t]}function sE(e){return typeof e=="string"?e:e?eh(e,"url")?e.url:e.toString?e.toString():"":""}function R2(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,s]=e;return{url:sE(n),method:eh(s,"method")?String(s.method).toUpperCase():Hv(n)&&eh(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:sE(t),method:eh(t,"method")?String(t.method).toUpperCase():"GET"}}function N2(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Hv(t))return new Headers(t.headers)}catch{}}function j2(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function A2(){return"npm"}function k2(){return!j2()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function O2(){return typeof window<"u"&&(!k2()||M2())}function M2(){return ct.process?.type==="renderer"}const st=ct;let nv=0;function a1(){return nv>0}function I2(){nv++,setTimeout(()=>{nv--})}function kc(e,t={}){function n(i){return typeof i=="function"}if(!n(e))return e;try{const i=e.__sentry_wrapped__;if(i)return typeof i=="function"?i:e;if(Vv(e))return e}catch{return e}const s=function(...i){try{const a=i.map(l=>kc(l,t));return e.apply(this,a)}catch(a){throw I2(),Ou(l=>{l.addEventProcessor(f=>(t.mechanism&&(Vy(f,void 0),Cc(f,t.mechanism)),f.extra={...f.extra,arguments:i},f)),DR(a)}),a}};try{for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}catch{}aR(s,e),Yn(e,"__sentry_wrapped__",s);try{Object.getOwnPropertyDescriptor(s,"name").configurable&&Object.defineProperty(s,"name",{get(){return e.name}})}catch{}return s}function ub(){const e=Nu(),{referrer:t}=st.document||{},{userAgent:n}=st.navigator||{},s={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:s}}function fb(e,t){const n=db(e,t),s={type:U2(t),value:$2(t)};return n.length&&(s.stacktrace={frames:n}),s.type===void 0&&s.value===""&&(s.value="Unrecoverable error caught"),s}function P2(e,t,n,s){const a=gt()?.getOptions().normalizeDepth,l=V2(t),f={__serialized__:NR(t,a)};if(l)return{exception:{values:[fb(e,l)]},extra:f};const d={exception:{values:[{type:tp(t)?t.constructor.name:s?"UnhandledRejection":"Error",value:H2(t,{isUnhandledRejection:s})}]},extra:f};if(n){const p=db(e,n);p.length&&(d.exception.values[0].stacktrace={frames:p})}return d}function Vg(e,t){return{exception:{values:[fb(e,t)]}}}function db(e,t){const n=t.stacktrace||t.stack||"",s=z2(t),i=L2(t);try{return e(n,s,i)}catch{}return[]}const D2=/Minified React error #\d+;/i;function z2(e){return e&&D2.test(e.message)?1:0}function L2(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function c1(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function U2(e){const t=e?.name;return!t&&c1(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function $2(e){const t=e?.message;return c1(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?Gw(t.error):Gw(e):"No error message"}function B2(e,t,n,s){const i=n?.syntheticException||void 0,a=hb(e,t,i,s);return Cc(a),a.level="error",n?.event_id&&(a.event_id=n.event_id),Pu(a)}function F2(e,t,n="info",s,i){const a=s?.syntheticException||void 0,l=rv(e,t,a,i);return l.level=n,s?.event_id&&(l.event_id=s.event_id),Pu(l)}function hb(e,t,n,s,i){let a;if(sR(t)&&t.error)return Vg(e,t.error);if(dw(t)||FM(t)){const l=t;if("stack"in t)a=Vg(e,t);else{const f=l.name||(dw(l)?"DOMError":"DOMException"),d=l.message?`${f}: ${l.message}`:f;a=rv(e,d,n,s),Vy(a,d)}return"code"in l&&(a.tags={...a.tags,"DOMException.code":`${l.code}`}),a}return Jh(t)?Vg(e,t):pu(t)||tp(t)?(a=P2(e,t,n,i),Cc(a,{synthetic:!0}),a):(a=rv(e,t,n,s),Vy(a,`${t}`),Cc(a,{synthetic:!0}),a)}function rv(e,t,n,s){const i={};if(s&&n){const a=db(e,n);a.length&&(i.exception={values:[{value:t,stacktrace:{frames:a}}]}),Cc(i,{synthetic:!0})}if(ep(t)){const{__sentry_template_string__:a,__sentry_template_values__:l}=t;return i.logentry={message:a,params:l},i}return i.message=t,i}function H2(e,{isUnhandledRejection:t}){const n=ZM(e),s=t?"promise rejection":"exception";return sR(e)?`Event \`ErrorEvent\` captured as ${s} with message \`${e.message}\``:tp(e)?`Event \`${q2(e)}\` (type=${e.type}) captured as ${s}`:`Object captured as ${s} with keys: ${n}`}function q2(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function V2(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}class K2 extends vD{constructor(t){const n=G2(t),s=st.SENTRY_SDK_SOURCE||A2();JR(n,"browser",["browser"],s),n._metadata?.sdk&&(n._metadata.sdk.settings={infer_ip:n.sendDefaultPii?"auto":"never",...n._metadata.sdk.settings}),super(n);const{sendDefaultPii:i,sendClientReports:a,enableLogs:l,_experiments:f,enableMetrics:d}=this._options,p=d??f?.enableMetrics??!0;st.document&&(a||l||p)&&st.document.addEventListener("visibilitychange",()=>{st.document.visibilityState==="hidden"&&(a&&this._flushOutcomes(),l&&rb(this),p&&ob(this))}),i&&this.on("beforeSendSession",kD)}eventFromException(t,n){return B2(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",s){return F2(this._options.stackParser,t,n,s,this._options.attachStacktrace)}_prepareEvent(t,n,s,i){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,s,i)}}function G2(e){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:st.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const Du=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ge=ct,Z2=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",zu=(e,t,n,s)=>{let i,a;return l=>{t.value>=0&&(l||s)&&(a=t.value-(i??0),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=Z2(t.value,n),e(t)))}},Lu=(e=!0)=>{const t=Ge.performance?.getEntriesByType?.("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t},Yc=()=>Lu()?.activationStart??0;function Yo(e,t,n){Ge.document&&Ge.addEventListener(e,t,n)}function vh(e,t,n){Ge.document&&Ge.removeEventListener(e,t,n)}let mc=-1;const l1=new Set,Y2=()=>Ge.document?.visibilityState==="hidden"&&!Ge.document?.prerendering?0:1/0,th=e=>{if(X2(e)&&mc>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(const t of l1)t();isFinite(mc)||(mc=e.type==="visibilitychange"?e.timeStamp:0,vh("prerenderingchange",th,!0))}},Uu=()=>{if(Ge.document&&mc<0){const e=Yc();mc=(Ge.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(n=>n.name==="hidden"&&n.startTime>e)[0]?.startTime)??Y2(),Yo("visibilitychange",th,!0),Yo("pagehide",th,!0),Yo("prerenderingchange",th,!0)}return{get firstHiddenTime(){return mc},onHidden(e){l1.add(e)}}};function X2(e){return e.type==="pagehide"||Ge.document?.visibilityState==="hidden"}const Q2=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,$u=(e,t=-1)=>{const n=Lu();let s="navigate";return n&&(Ge.document?.prerendering||Yc()>0?s="prerender":Ge.document?.wasDiscarded?s="restore":n.type&&(s=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:Q2(),navigationType:s}},Kg=new WeakMap;function pb(e,t){try{return Kg.get(e)||Kg.set(e,new t),Kg.get(e)}catch{return new t}}class bh{constructor(){bh.prototype.__init.call(this),bh.prototype.__init2.call(this)}__init(){this._sessionValue=0}__init2(){this._sessionEntries=[]}_processEntry(t){if(t.hadRecentInput)return;const n=this._sessionEntries[0],s=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&n&&s&&t.startTime-s.startTime<1e3&&t.startTime-n.startTime<5e3?(this._sessionValue+=t.value,this._sessionEntries.push(t)):(this._sessionValue=t.value,this._sessionEntries=[t]),this._onAfterProcessingUnexpectedShift?.(t)}}const Xc=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const s=new PerformanceObserver(i=>{Promise.resolve().then(()=>{t(i.getEntries())})});return s.observe({type:e,buffered:!0,...n}),s}}catch{}},mb=e=>{let t=!1;return()=>{t||(e(),t=!0)}},rp=e=>{Ge.document?.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},W2=[1800,3e3],J2=(e,t={})=>{rp(()=>{const n=Uu(),s=$u("FCP");let i;const l=Xc("paint",f=>{for(const d of f)d.name==="first-contentful-paint"&&(l.disconnect(),d.startTime<n.firstHiddenTime&&(s.value=Math.max(d.startTime-Yc(),0),s.entries.push(d),i(!0)))});l&&(i=zu(e,s,W2,t.reportAllChanges))})},ez=[.1,.25],tz=(e,t={})=>{J2(mb(()=>{const n=$u("CLS",0);let s;const i=Uu(),a=pb(t,bh),l=d=>{for(const p of d)a._processEntry(p);a._sessionValue>n.value&&(n.value=a._sessionValue,n.entries=a._sessionEntries,s())},f=Xc("layout-shift",l);f&&(s=zu(e,n,ez,t.reportAllChanges),i.onHidden(()=>{l(f.takeRecords()),s(!0)}),Ge?.setTimeout?.(s))}))};let u1=0,Gg=1/0,wd=0;const nz=e=>{e.forEach(t=>{t.interactionId&&(Gg=Math.min(Gg,t.interactionId),wd=Math.max(wd,t.interactionId),u1=wd?(wd-Gg)/7+1:0)})};let sv;const f1=()=>sv?u1:performance.interactionCount||0,rz=()=>{"interactionCount"in performance||sv||(sv=Xc("event",nz,{type:"event",buffered:!0,durationThreshold:0}))},Zg=10;let d1=0;const sz=()=>f1()-d1;class xh{constructor(){xh.prototype.__init.call(this),xh.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){d1=f1(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const t=Math.min(this._longestInteractionList.length-1,Math.floor(sz()/50));return this._longestInteractionList[t]}_processEntry(t){if(this._onBeforeProcessingEntry?.(t),!(t.interactionId||t.entryType==="first-input"))return;const n=this._longestInteractionList.at(-1);let s=this._longestInteractionMap.get(t.interactionId);if(s||this._longestInteractionList.length<Zg||t.duration>n._latency){if(s?t.duration>s._latency?(s.entries=[t],s._latency=t.duration):t.duration===s._latency&&t.startTime===s.entries[0].startTime&&s.entries.push(t):(s={id:t.interactionId,entries:[t],_latency:t.duration},this._longestInteractionMap.set(s.id,s),this._longestInteractionList.push(s)),this._longestInteractionList.sort((i,a)=>a._latency-i._latency),this._longestInteractionList.length>Zg){const i=this._longestInteractionList.splice(Zg);for(const a of i)this._longestInteractionMap.delete(a.id)}this._onAfterProcessingINPCandidate?.(s)}}}const h1=e=>{const t=Ge.requestIdleCallback||Ge.setTimeout;Ge.document?.visibilityState==="hidden"?e():(e=mb(e),Yo("visibilitychange",e,{once:!0,capture:!0}),Yo("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),vh("visibilitychange",e,{capture:!0}),vh("pagehide",e,{capture:!0})}))},oz=[200,500],iz=40,az=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const n=Uu();rp(()=>{rz();const s=$u("INP");let i;const a=pb(t,xh),l=d=>{h1(()=>{for(const g of d)a._processEntry(g);const p=a._estimateP98LongestInteraction();p&&p._latency!==s.value&&(s.value=p._latency,s.entries=p.entries,i())})},f=Xc("event",l,{durationThreshold:t.durationThreshold??iz});i=zu(e,s,oz,t.reportAllChanges),f&&(f.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{l(f.takeRecords()),i(!0)}))})};class cz{_processEntry(t){this._onBeforeProcessingEntry?.(t)}}const lz=[2500,4e3],uz=(e,t={})=>{rp(()=>{const n=Uu(),s=$u("LCP");let i;const a=pb(t,cz),l=d=>{t.reportAllChanges||(d=d.slice(-1));for(const p of d)a._processEntry(p),p.startTime<n.firstHiddenTime&&(s.value=Math.max(p.startTime-Yc(),0),s.entries=[p],i())},f=Xc("largest-contentful-paint",l);if(f){i=zu(e,s,lz,t.reportAllChanges);const d=mb(()=>{l(f.takeRecords()),f.disconnect(),i(!0)}),p=g=>{g.isTrusted&&(h1(d),vh(g.type,p,{capture:!0}))};for(const g of["keydown","click","visibilitychange"])Yo(g,p,{capture:!0})}})},fz=[800,1800],ov=e=>{Ge.document?.prerendering?rp(()=>ov(e)):Ge.document?.readyState!=="complete"?addEventListener("load",()=>ov(e),!0):setTimeout(e)},dz=(e,t={})=>{const n=$u("TTFB"),s=zu(e,n,fz,t.reportAllChanges);ov(()=>{const i=Lu();i&&(n.value=Math.max(i.responseStart-Yc(),0),n.entries=[i],s(!0))})},au={},Sh={};let p1,m1,g1,y1;function v1(e,t=!1){return sp("cls",e,mz,p1,t)}function b1(e,t=!1){return sp("lcp",e,gz,m1,t)}function hz(e){return sp("ttfb",e,yz,g1)}function pz(e){return sp("inp",e,vz,y1)}function Oc(e,t){return x1(e,t),Sh[e]||(bz(e),Sh[e]=!0),S1(e,t)}function Bu(e,t){const n=au[e];if(n?.length)for(const s of n)try{s(t)}catch(i){Du&&be.error(`Error while triggering instrumentation handler.
|
|
17
|
+
Url: ${yh(e)}`),!0}return!1}function HD(e,t){return t?.length?KR(e).some(n=>Go(n,t)):!1}function qD(e,t){if(!t?.length)return!1;const n=e.transaction;return n?Go(n,t):!1}function VD(e,t){if(!t?.length)return!1;const n=yh(e);return n?Go(n,t):!1}function KD(e,t){if(!t?.length)return!0;const n=yh(e);return n?Go(n,t):!0}function GD(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function yh(e){try{const n=[...e.exception?.values??[]].reverse().find(s=>s.mechanism?.parent_id===void 0&&s.stacktrace?.frames?.length)?.stacktrace?.frames;return n?GD(n):null}catch{return Ce&&be.error(`Cannot extract url for event ${Gi(e)}`),null}}function ZD(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function YD(e,t,n,s,i,a){if(!i.exception?.values||!a||!Qs(a.originalException,Error))return;const l=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;l&&(i.exception.values=ev(e,t,s,a.originalException,n,i.exception.values,l,0))}function ev(e,t,n,s,i,a,l,f){if(a.length>=n+1)return a;let d=[...a];if(Qs(s[i],Error)){Qw(l,f,s);const p=e(t,s[i]),g=d.length;Ww(p,i,g,f),d=ev(e,t,n,s[i],i,[p,...d],p,g)}return t1(s)&&s.errors.forEach((p,g)=>{if(Qs(p,Error)){Qw(l,f,s);const y=e(t,p),b=d.length;Ww(y,`errors[${g}]`,b,f),d=ev(e,t,n,p,i,[y,...d],y,b)}}),d}function t1(e){return Array.isArray(e.errors)}function Qw(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...t1(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Ww(e,t,n,s){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:s}}function XD(e){const t="console";ci(t,e),li(t,QD)}function QD(){"console"in ct&&kM.forEach(function(e){e in ct.console&&gr(ct.console,e,function(t){return hh[e]=t,function(...n){Hr("console",{args:n,level:e}),hh[e]?.apply(ct.console,n)}})})}function WD(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const JD="Dedupe",ez=(()=>{let e;return{name:JD,processEvent(t){if(t.type)return t;try{if(nz(t,e))return Ce&&be.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),tz=ez;function nz(e,t){return t?!!(rz(e,t)||sz(e,t)):!1}function rz(e,t){const n=e.message,s=t.message;return!(!n&&!s||n&&!s||!n&&s||n!==s||!r1(e,t)||!n1(e,t))}function sz(e,t){const n=Jw(t),s=Jw(e);return!(!n||!s||n.type!==s.type||n.value!==s.value||!r1(e,t)||!n1(e,t))}function n1(e,t){let n=uw(e),s=uw(t);if(!n&&!s)return!0;if(n&&!s||!n&&s||(n=n,s=s,s.length!==n.length))return!1;for(let i=0;i<s.length;i++){const a=s[i],l=n[i];if(a.filename!==l.filename||a.lineno!==l.lineno||a.colno!==l.colno||a.function!==l.function)return!1}return!0}function r1(e,t){let n=e.fingerprint,s=t.fingerprint;if(!n&&!s)return!0;if(n&&!s||!n&&s)return!1;n=n,s=s;try{return n.join("")===s.join("")}catch{return!1}}function Jw(e){return e.exception?.values?.[0]}const oz="ConversationId",iz=(()=>({name:oz,setup(e){e.on("spanStart",t=>{const n=bt().getScopeData(),s=ss().getScopeData(),i=n.conversationId||s.conversationId;i&&t.setAttribute(dI,i)})}})),az=iz;function cz(e,t,n,s,i){if(!e.fetchData)return;const{method:a,url:l}=e.fetchData,f=rs()&&t(l);if(e.endTimestamp&&f){const x=e.fetchData.__span;if(!x)return;const S=s[x];S&&(fz(S,e),lz(S,e,i),delete s[x]);return}const{spanOrigin:d="auto.http.browser",propagateTraceparent:p=!1}=typeof i=="object"?i:{spanOrigin:i},g=!!Xn(),y=f&&g?Gc(hz(l,a,d)):new ei;if(e.fetchData.__span=y.spanContext().spanId,s[y.spanContext().spanId]=y,n(e.fetchData.url)){const x=e.args[0],S={...e.args[1]||{}},w=uz(x,S,rs()&&g?y:void 0,p);w&&(e.args[1]=S,S.headers=w)}const b=gt();if(b){const x={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};b.emit("beforeOutgoingRequestSpan",y,x)}return y}function lz(e,t,n){(typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0)?.(e,{headers:t.response?.headers,error:t.error})}function uz(e,t,n,s){const i=e1({span:n,propagateTraceparent:s}),a=i["sentry-trace"],l=i.baggage,f=i.traceparent;if(!a)return;const d=t.headers||(Hv(e)?e.headers:void 0);if(d)if(dz(d)){const p=new Headers(d);if(p.get("sentry-trace")||p.set("sentry-trace",a),s&&f&&!p.get("traceparent")&&p.set("traceparent",f),l){const g=p.get("baggage");g?_d(g)||p.set("baggage",`${g},${l}`):p.set("baggage",l)}return p}else if(Array.isArray(d)){const p=[...d];d.find(y=>y[0]==="sentry-trace")||p.push(["sentry-trace",a]),s&&f&&!d.find(y=>y[0]==="traceparent")&&p.push(["traceparent",f]);const g=d.find(y=>y[0]==="baggage"&&_d(y[1]));return l&&!g&&p.push(["baggage",l]),p}else{const p="sentry-trace"in d?d["sentry-trace"]:void 0,g="traceparent"in d?d.traceparent:void 0,y="baggage"in d?d.baggage:void 0,b=y?Array.isArray(y)?[...y]:[y]:[],x=y&&(Array.isArray(y)?y.find(w=>_d(w)):_d(y));l&&!x&&b.push(l);const S={...d,"sentry-trace":p??a,baggage:b.length>0?b.join(","):void 0};return s&&f&&!g&&(S.traceparent=f),S}else return{...i}}function fz(e,t){if(t.response){hR(e,t.response.status);const n=t.response?.headers?.get("content-length");if(n){const s=parseInt(n);s>0&&e.setAttribute("http.response_content_length",s)}}else t.error&&e.setStatus({code:hn,message:"internal_error"});e.end()}function _d(e){return e.split(",").some(t=>t.trim().startsWith(Yv))}function dz(e){return typeof Headers<"u"&&Qs(e,Headers)}function hz(e,t,n){if(e.startsWith("data:")){const a=Zo(e);return{name:`${t} ${a}`,attributes:eE(e,void 0,t,n)}}const s=WR(e),i=s?RD(s):e;return{name:`${t} ${i}`,attributes:eE(e,s,t,n)}}function eE(e,t,n,s){const i={url:Zo(e),type:"fetch","http.method":n,[mn]:s,[eo]:"http.client"};return t&&(QR(t)||(i["http.url"]=Zo(t.href),i["server.address"]=t.host),t.search&&(i["http.query"]=t.search),t.hash&&(i["http.fragment"]=t.hash)),i}function Zc(e,t,n,s,i){eD({level:e,message:t,attributes:n,severityNumber:i},s)}function pz(e,t,{scope:n}={}){Zc("trace",e,t,n)}function mz(e,t,{scope:n}={}){Zc("debug",e,t,n)}function gz(e,t,{scope:n}={}){Zc("info",e,t,n)}function yz(e,t,{scope:n}={}){Zc("warn",e,t,n)}function vz(e,t,{scope:n}={}){Zc("error",e,t,n)}function bz(e,t,{scope:n}={}){Zc("fatal",e,t,n)}const xz=Object.freeze(Object.defineProperty({__proto__:null,debug:mz,error:vz,fatal:bz,fmt:AD,info:gz,trace:pz,warn:yz},Symbol.toStringTag,{value:"Module"}));function lb(e,t,n,s){aD({type:e,name:t,value:n,unit:s?.unit,attributes:s?.attributes},{scope:s?.scope})}function tE(e,t=1,n){lb("counter",e,t,n)}function nE(e,t,n){lb("gauge",e,t,n)}function rE(e,t,n){lb("distribution",e,t,n)}function s1(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const vu=ct;function Sz(){return"history"in vu&&!!vu.history}function _z(){if(!("fetch"in vu))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function tv(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function wz(){if(typeof EdgeRuntime=="string")return!0;if(!_z())return!1;if(tv(vu.fetch))return!0;let e=!1;const t=vu.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=tv(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){Ce&&be.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}function o1(e,t){const n="fetch";ci(n,e),li(n,()=>i1(void 0,t))}function Ez(e){const t="fetch-body-resolved";ci(t,e),li(t,()=>i1(Cz))}function i1(e,t=!1){t&&!wz()||gr(ct,"fetch",function(n){return function(...s){const i=new Error,{method:a,url:l}=Rz(s),f={args:s,fetchData:{method:a,url:l},startTimestamp:cn()*1e3,virtualError:i,headers:Nz(s)};return e||Hr("fetch",{...f}),n.apply(ct,s).then(async d=>(e?e(d):Hr("fetch",{...f,endTimestamp:cn()*1e3,response:d}),d),d=>{Hr("fetch",{...f,endTimestamp:cn()*1e3,error:d}),Jh(d)&&d.stack===void 0&&(d.stack=i.stack,Yn(d,"framesToPop",1));const g=gt()?.getOptions().enhanceFetchErrorMessages??"always";if(g!==!1&&d instanceof TypeError&&(d.message==="Failed to fetch"||d.message==="Load failed"||d.message==="NetworkError when attempting to fetch resource."))try{const x=new URL(f.fetchData.url).host;g==="always"?d.message=`${d.message} (${x})`:Yn(d,"__sentry_fetch_url_host__",x)}catch{}throw d})}})}async function Tz(e,t){if(e?.body){const n=e.body,s=n.getReader(),i=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let a=!0;for(;a;){let l;try{l=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:f}=await s.read();clearTimeout(l),f&&(t(),a=!1)}catch{a=!1}finally{clearTimeout(l)}}clearTimeout(i),s.releaseLock(),n.cancel().then(null,()=>{})}}function Cz(e){let t;try{t=e.clone()}catch{return}Tz(t,()=>{Hr("fetch-body-resolved",{endTimestamp:cn()*1e3,response:e})})}function eh(e,t){return!!e&&typeof e=="object"&&!!e[t]}function sE(e){return typeof e=="string"?e:e?eh(e,"url")?e.url:e.toString?e.toString():"":""}function Rz(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,s]=e;return{url:sE(n),method:eh(s,"method")?String(s.method).toUpperCase():Hv(n)&&eh(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:sE(t),method:eh(t,"method")?String(t.method).toUpperCase():"GET"}}function Nz(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Hv(t))return new Headers(t.headers)}catch{}}function jz(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function Az(){return"npm"}function kz(){return!jz()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Oz(){return typeof window<"u"&&(!kz()||Mz())}function Mz(){return ct.process?.type==="renderer"}const st=ct;let nv=0;function a1(){return nv>0}function Iz(){nv++,setTimeout(()=>{nv--})}function kc(e,t={}){function n(i){return typeof i=="function"}if(!n(e))return e;try{const i=e.__sentry_wrapped__;if(i)return typeof i=="function"?i:e;if(Vv(e))return e}catch{return e}const s=function(...i){try{const a=i.map(l=>kc(l,t));return e.apply(this,a)}catch(a){throw Iz(),Ou(l=>{l.addEventProcessor(f=>(t.mechanism&&(Vy(f,void 0),Cc(f,t.mechanism)),f.extra={...f.extra,arguments:i},f)),DR(a)}),a}};try{for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}catch{}aR(s,e),Yn(e,"__sentry_wrapped__",s);try{Object.getOwnPropertyDescriptor(s,"name").configurable&&Object.defineProperty(s,"name",{get(){return e.name}})}catch{}return s}function ub(){const e=Nu(),{referrer:t}=st.document||{},{userAgent:n}=st.navigator||{},s={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:s}}function fb(e,t){const n=db(e,t),s={type:Uz(t),value:$z(t)};return n.length&&(s.stacktrace={frames:n}),s.type===void 0&&s.value===""&&(s.value="Unrecoverable error caught"),s}function Pz(e,t,n,s){const a=gt()?.getOptions().normalizeDepth,l=Vz(t),f={__serialized__:NR(t,a)};if(l)return{exception:{values:[fb(e,l)]},extra:f};const d={exception:{values:[{type:tp(t)?t.constructor.name:s?"UnhandledRejection":"Error",value:Hz(t,{isUnhandledRejection:s})}]},extra:f};if(n){const p=db(e,n);p.length&&(d.exception.values[0].stacktrace={frames:p})}return d}function Vg(e,t){return{exception:{values:[fb(e,t)]}}}function db(e,t){const n=t.stacktrace||t.stack||"",s=zz(t),i=Lz(t);try{return e(n,s,i)}catch{}return[]}const Dz=/Minified React error #\d+;/i;function zz(e){return e&&Dz.test(e.message)?1:0}function Lz(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function c1(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function Uz(e){const t=e?.name;return!t&&c1(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function $z(e){const t=e?.message;return c1(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?Gw(t.error):Gw(e):"No error message"}function Bz(e,t,n,s){const i=n?.syntheticException||void 0,a=hb(e,t,i,s);return Cc(a),a.level="error",n?.event_id&&(a.event_id=n.event_id),Pu(a)}function Fz(e,t,n="info",s,i){const a=s?.syntheticException||void 0,l=rv(e,t,a,i);return l.level=n,s?.event_id&&(l.event_id=s.event_id),Pu(l)}function hb(e,t,n,s,i){let a;if(sR(t)&&t.error)return Vg(e,t.error);if(dw(t)||FM(t)){const l=t;if("stack"in t)a=Vg(e,t);else{const f=l.name||(dw(l)?"DOMError":"DOMException"),d=l.message?`${f}: ${l.message}`:f;a=rv(e,d,n,s),Vy(a,d)}return"code"in l&&(a.tags={...a.tags,"DOMException.code":`${l.code}`}),a}return Jh(t)?Vg(e,t):pu(t)||tp(t)?(a=Pz(e,t,n,i),Cc(a,{synthetic:!0}),a):(a=rv(e,t,n,s),Vy(a,`${t}`),Cc(a,{synthetic:!0}),a)}function rv(e,t,n,s){const i={};if(s&&n){const a=db(e,n);a.length&&(i.exception={values:[{value:t,stacktrace:{frames:a}}]}),Cc(i,{synthetic:!0})}if(ep(t)){const{__sentry_template_string__:a,__sentry_template_values__:l}=t;return i.logentry={message:a,params:l},i}return i.message=t,i}function Hz(e,{isUnhandledRejection:t}){const n=ZM(e),s=t?"promise rejection":"exception";return sR(e)?`Event \`ErrorEvent\` captured as ${s} with message \`${e.message}\``:tp(e)?`Event \`${qz(e)}\` (type=${e.type}) captured as ${s}`:`Object captured as ${s} with keys: ${n}`}function qz(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Vz(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}class Kz extends vD{constructor(t){const n=Gz(t),s=st.SENTRY_SDK_SOURCE||Az();JR(n,"browser",["browser"],s),n._metadata?.sdk&&(n._metadata.sdk.settings={infer_ip:n.sendDefaultPii?"auto":"never",...n._metadata.sdk.settings}),super(n);const{sendDefaultPii:i,sendClientReports:a,enableLogs:l,_experiments:f,enableMetrics:d}=this._options,p=d??f?.enableMetrics??!0;st.document&&(a||l||p)&&st.document.addEventListener("visibilitychange",()=>{st.document.visibilityState==="hidden"&&(a&&this._flushOutcomes(),l&&rb(this),p&&ob(this))}),i&&this.on("beforeSendSession",kD)}eventFromException(t,n){return Bz(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",s){return Fz(this._options.stackParser,t,n,s,this._options.attachStacktrace)}_prepareEvent(t,n,s,i){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,s,i)}}function Gz(e){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:st.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const Du=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ge=ct,Zz=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",zu=(e,t,n,s)=>{let i,a;return l=>{t.value>=0&&(l||s)&&(a=t.value-(i??0),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=Zz(t.value,n),e(t)))}},Lu=(e=!0)=>{const t=Ge.performance?.getEntriesByType?.("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t},Yc=()=>Lu()?.activationStart??0;function Yo(e,t,n){Ge.document&&Ge.addEventListener(e,t,n)}function vh(e,t,n){Ge.document&&Ge.removeEventListener(e,t,n)}let mc=-1;const l1=new Set,Yz=()=>Ge.document?.visibilityState==="hidden"&&!Ge.document?.prerendering?0:1/0,th=e=>{if(Xz(e)&&mc>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(const t of l1)t();isFinite(mc)||(mc=e.type==="visibilitychange"?e.timeStamp:0,vh("prerenderingchange",th,!0))}},Uu=()=>{if(Ge.document&&mc<0){const e=Yc();mc=(Ge.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(n=>n.name==="hidden"&&n.startTime>e)[0]?.startTime)??Yz(),Yo("visibilitychange",th,!0),Yo("pagehide",th,!0),Yo("prerenderingchange",th,!0)}return{get firstHiddenTime(){return mc},onHidden(e){l1.add(e)}}};function Xz(e){return e.type==="pagehide"||Ge.document?.visibilityState==="hidden"}const Qz=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,$u=(e,t=-1)=>{const n=Lu();let s="navigate";return n&&(Ge.document?.prerendering||Yc()>0?s="prerender":Ge.document?.wasDiscarded?s="restore":n.type&&(s=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:Qz(),navigationType:s}},Kg=new WeakMap;function pb(e,t){try{return Kg.get(e)||Kg.set(e,new t),Kg.get(e)}catch{return new t}}class bh{constructor(){bh.prototype.__init.call(this),bh.prototype.__init2.call(this)}__init(){this._sessionValue=0}__init2(){this._sessionEntries=[]}_processEntry(t){if(t.hadRecentInput)return;const n=this._sessionEntries[0],s=this._sessionEntries[this._sessionEntries.length-1];this._sessionValue&&n&&s&&t.startTime-s.startTime<1e3&&t.startTime-n.startTime<5e3?(this._sessionValue+=t.value,this._sessionEntries.push(t)):(this._sessionValue=t.value,this._sessionEntries=[t]),this._onAfterProcessingUnexpectedShift?.(t)}}const Xc=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const s=new PerformanceObserver(i=>{Promise.resolve().then(()=>{t(i.getEntries())})});return s.observe({type:e,buffered:!0,...n}),s}}catch{}},mb=e=>{let t=!1;return()=>{t||(e(),t=!0)}},rp=e=>{Ge.document?.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},Wz=[1800,3e3],Jz=(e,t={})=>{rp(()=>{const n=Uu(),s=$u("FCP");let i;const l=Xc("paint",f=>{for(const d of f)d.name==="first-contentful-paint"&&(l.disconnect(),d.startTime<n.firstHiddenTime&&(s.value=Math.max(d.startTime-Yc(),0),s.entries.push(d),i(!0)))});l&&(i=zu(e,s,Wz,t.reportAllChanges))})},e2=[.1,.25],t2=(e,t={})=>{Jz(mb(()=>{const n=$u("CLS",0);let s;const i=Uu(),a=pb(t,bh),l=d=>{for(const p of d)a._processEntry(p);a._sessionValue>n.value&&(n.value=a._sessionValue,n.entries=a._sessionEntries,s())},f=Xc("layout-shift",l);f&&(s=zu(e,n,e2,t.reportAllChanges),i.onHidden(()=>{l(f.takeRecords()),s(!0)}),Ge?.setTimeout?.(s))}))};let u1=0,Gg=1/0,wd=0;const n2=e=>{e.forEach(t=>{t.interactionId&&(Gg=Math.min(Gg,t.interactionId),wd=Math.max(wd,t.interactionId),u1=wd?(wd-Gg)/7+1:0)})};let sv;const f1=()=>sv?u1:performance.interactionCount||0,r2=()=>{"interactionCount"in performance||sv||(sv=Xc("event",n2,{type:"event",buffered:!0,durationThreshold:0}))},Zg=10;let d1=0;const s2=()=>f1()-d1;class xh{constructor(){xh.prototype.__init.call(this),xh.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){d1=f1(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const t=Math.min(this._longestInteractionList.length-1,Math.floor(s2()/50));return this._longestInteractionList[t]}_processEntry(t){if(this._onBeforeProcessingEntry?.(t),!(t.interactionId||t.entryType==="first-input"))return;const n=this._longestInteractionList.at(-1);let s=this._longestInteractionMap.get(t.interactionId);if(s||this._longestInteractionList.length<Zg||t.duration>n._latency){if(s?t.duration>s._latency?(s.entries=[t],s._latency=t.duration):t.duration===s._latency&&t.startTime===s.entries[0].startTime&&s.entries.push(t):(s={id:t.interactionId,entries:[t],_latency:t.duration},this._longestInteractionMap.set(s.id,s),this._longestInteractionList.push(s)),this._longestInteractionList.sort((i,a)=>a._latency-i._latency),this._longestInteractionList.length>Zg){const i=this._longestInteractionList.splice(Zg);for(const a of i)this._longestInteractionMap.delete(a.id)}this._onAfterProcessingINPCandidate?.(s)}}}const h1=e=>{const t=Ge.requestIdleCallback||Ge.setTimeout;Ge.document?.visibilityState==="hidden"?e():(e=mb(e),Yo("visibilitychange",e,{once:!0,capture:!0}),Yo("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),vh("visibilitychange",e,{capture:!0}),vh("pagehide",e,{capture:!0})}))},o2=[200,500],i2=40,a2=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const n=Uu();rp(()=>{r2();const s=$u("INP");let i;const a=pb(t,xh),l=d=>{h1(()=>{for(const g of d)a._processEntry(g);const p=a._estimateP98LongestInteraction();p&&p._latency!==s.value&&(s.value=p._latency,s.entries=p.entries,i())})},f=Xc("event",l,{durationThreshold:t.durationThreshold??i2});i=zu(e,s,o2,t.reportAllChanges),f&&(f.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{l(f.takeRecords()),i(!0)}))})};class c2{_processEntry(t){this._onBeforeProcessingEntry?.(t)}}const l2=[2500,4e3],u2=(e,t={})=>{rp(()=>{const n=Uu(),s=$u("LCP");let i;const a=pb(t,c2),l=d=>{t.reportAllChanges||(d=d.slice(-1));for(const p of d)a._processEntry(p),p.startTime<n.firstHiddenTime&&(s.value=Math.max(p.startTime-Yc(),0),s.entries=[p],i())},f=Xc("largest-contentful-paint",l);if(f){i=zu(e,s,l2,t.reportAllChanges);const d=mb(()=>{l(f.takeRecords()),f.disconnect(),i(!0)}),p=g=>{g.isTrusted&&(h1(d),vh(g.type,p,{capture:!0}))};for(const g of["keydown","click","visibilitychange"])Yo(g,p,{capture:!0})}})},f2=[800,1800],ov=e=>{Ge.document?.prerendering?rp(()=>ov(e)):Ge.document?.readyState!=="complete"?addEventListener("load",()=>ov(e),!0):setTimeout(e)},d2=(e,t={})=>{const n=$u("TTFB"),s=zu(e,n,f2,t.reportAllChanges);ov(()=>{const i=Lu();i&&(n.value=Math.max(i.responseStart-Yc(),0),n.entries=[i],s(!0))})},au={},Sh={};let p1,m1,g1,y1;function v1(e,t=!1){return sp("cls",e,m2,p1,t)}function b1(e,t=!1){return sp("lcp",e,g2,m1,t)}function h2(e){return sp("ttfb",e,y2,g1)}function p2(e){return sp("inp",e,v2,y1)}function Oc(e,t){return x1(e,t),Sh[e]||(b2(e),Sh[e]=!0),S1(e,t)}function Bu(e,t){const n=au[e];if(n?.length)for(const s of n)try{s(t)}catch(i){Du&&be.error(`Error while triggering instrumentation handler.
|
|
18
18
|
Type: ${e}
|
|
19
19
|
Name: ${Xs(s)}
|
|
20
|
-
Error:`,i)}}function mz(){return tz(e=>{Bu("cls",{metric:e}),p1=e},{reportAllChanges:!0})}function gz(){return uz(e=>{Bu("lcp",{metric:e}),m1=e},{reportAllChanges:!0})}function yz(){return dz(e=>{Bu("ttfb",{metric:e}),g1=e})}function vz(){return az(e=>{Bu("inp",{metric:e}),y1=e})}function sp(e,t,n,s,i=!1){x1(e,t);let a;return Sh[e]||(a=n(),Sh[e]=!0),s&&t({metric:s}),S1(e,t,i?a:void 0)}function bz(e){const t={};e==="event"&&(t.durationThreshold=0),Xc(e,n=>{Bu(e,{entries:n})},t)}function x1(e,t){au[e]=au[e]||[],au[e].push(t)}function S1(e,t,n){return()=>{n&&n();const s=au[e];if(!s)return;const i=s.indexOf(t);i!==-1&&s.splice(i,1)}}function xz(e){return"duration"in e}const Sz=e=>{const t=n=>{(n.type==="pagehide"||Ge.document?.visibilityState==="hidden")&&e(n)};Yo("visibilitychange",t,{capture:!0,once:!0}),Yo("pagehide",t,{capture:!0,once:!0})};function Yg(e){return typeof e=="number"&&isFinite(e)}function ti(e,t,n,{...s}){const i=mt(e).start_timestamp;return i&&i>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),Jv(e,()=>{const a=Gc({startTime:t,...s});return a&&a.end(n),a})}function gb(e){const t=gt();if(!t)return;const{name:n,transaction:s,attributes:i,startTime:a}=e,{release:l,environment:f,sendDefaultPii:d}=t.getOptions(),g=t.getIntegrationByName("Replay")?.getReplayId(),y=bt(),b=y.getUser(),x=b!==void 0?b.email||b.id||b.ip_address:void 0;let S;try{S=y.getScopeData().contexts.profile.profile_id}catch{}const w={release:l,environment:f,user:x||void 0,profile_id:S||void 0,replay_id:g||void 0,transaction:s,"user_agent.original":Ge.navigator?.userAgent,"client.address":d?"{{auto}}":void 0,...i};return Gc({name:n,attributes:w,startTime:a,experimental:{standalone:!0}})}function Fu(){return Ge.addEventListener&&Ge.performance}function Xt(e){return e/1e3}function _z(e){let t="unknown",n="unknown",s="";for(const i of e){if(i==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(i))){t=s==="h"?"http":s,n=e.split(s)[1];break}s+=i}return s===e&&(t=s),{name:t,version:n}}function _1(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function w1(e,t){let n,s=!1;function i(f){!s&&n&&t(f,n),s=!0}Sz(()=>{i("pagehide")});const a=e.on("beforeStartNavigationSpan",(f,d)=>{d?.isRedirect||(i("navigation"),a(),l())}),l=e.on("afterStartPageLoadSpan",f=>{n=f.spanContext().spanId,l()})}function wz(e){let t=0,n;if(!_1("layout-shift"))return;const s=v1(({metric:i})=>{const a=i.entries[i.entries.length-1];a&&(t=i.value,n=a)},!0);w1(e,(i,a)=>{Ez(t,n,a,i),s()})}function Ez(e,t,n,s){Du&&be.log(`Sending CLS span (${e})`);const i=t?Xt((Sr()||0)+t.startTime):cn(),a=bt().getScopeData().transactionName,l=t?Vr(t.sources[0]?.node):"Layout shift",f={[mn]:"auto.http.browser.cls",[eo]:"ui.webvital.cls",[Vc]:0,"sentry.pageload.span_id":n,"sentry.report_event":s};t?.sources&&t.sources.forEach((p,g)=>{f[`cls.source.${g+1}`]=Vr(p.node)});const d=gb({name:l,transaction:a,attributes:f,startTime:i});d&&(d.addEvent("cls",{[Mu]:"",[Iu]:e}),d.end(i))}function Tz(e){let t=0,n;if(!_1("largest-contentful-paint"))return;const s=b1(({metric:i})=>{const a=i.entries[i.entries.length-1];a&&(t=i.value,n=a)},!0);w1(e,(i,a)=>{Cz(t,n,a,i),s()})}function Cz(e,t,n,s){Du&&be.log(`Sending LCP span (${e})`);const i=Xt((Sr()||0)+(t?.startTime||0)),a=bt().getScopeData().transactionName,l=t?Vr(t.element):"Largest contentful paint",f={[mn]:"auto.http.browser.lcp",[eo]:"ui.webvital.lcp",[Vc]:0,"sentry.pageload.span_id":n,"sentry.report_event":s};t&&(t.element&&(f["lcp.element"]=Vr(t.element)),t.id&&(f["lcp.id"]=t.id),t.url&&(f["lcp.url"]=t.url),t.loadTime!=null&&(f["lcp.loadTime"]=t.loadTime),t.renderTime!=null&&(f["lcp.renderTime"]=t.renderTime),t.size!=null&&(f["lcp.size"]=t.size));const d=gb({name:l,transaction:a,attributes:f,startTime:i});d&&(d.addEvent("lcp",{[Mu]:"millisecond",[Iu]:e}),d.end(i))}function Pr(e){return e&&((Sr()||performance.timeOrigin)+e)/1e3}function E1(e){const t={};if(e.nextHopProtocol!=null){const{name:n,version:s}=_z(e.nextHopProtocol);t["network.protocol.version"]=s,t["network.protocol.name"]=n}return Sr()||Fu()?.timeOrigin?Rz({...t,"http.request.redirect_start":Pr(e.redirectStart),"http.request.redirect_end":Pr(e.redirectEnd),"http.request.worker_start":Pr(e.workerStart),"http.request.fetch_start":Pr(e.fetchStart),"http.request.domain_lookup_start":Pr(e.domainLookupStart),"http.request.domain_lookup_end":Pr(e.domainLookupEnd),"http.request.connect_start":Pr(e.connectStart),"http.request.secure_connection_start":Pr(e.secureConnectionStart),"http.request.connection_end":Pr(e.connectEnd),"http.request.request_start":Pr(e.requestStart),"http.request.response_start":Pr(e.responseStart),"http.request.response_end":Pr(e.responseEnd),"http.request.time_to_first_byte":e.responseStart!=null?e.responseStart/1e3:void 0}):t}function Rz(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}const Nz=2147483647;let oE=0,ts={},Kn,_h;function jz({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){const s=Fu();if(s&&Sr()){s.mark&&Ge.performance.mark("sentry-tracing-init");const i=t?Tz(n):Iz(),a=Pz(),l=e?wz(n):Mz();return()=>{i?.(),a(),l?.()}}return()=>{}}function Az(){Oc("longtask",({entries:e})=>{const t=Xn();if(!t)return;const{op:n,start_timestamp:s}=mt(t);for(const i of e){const a=Xt(Sr()+i.startTime),l=Xt(i.duration);n==="navigation"&&s&&a<s||ti(t,a,a+l,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[mn]:"auto.ui.browser.metrics"}})}})}function kz(){new PerformanceObserver(t=>{const n=Xn();if(n)for(const s of t.getEntries()){if(!s.scripts[0])continue;const i=Xt(Sr()+s.startTime),{start_timestamp:a,op:l}=mt(n);if(l==="navigation"&&a&&i<a)continue;const f=Xt(s.duration),d={[mn]:"auto.ui.browser.metrics"},p=s.scripts[0],{invoker:g,invokerType:y,sourceURL:b,sourceFunctionName:x,sourceCharPosition:S}=p;d["browser.script.invoker"]=g,d["browser.script.invoker_type"]=y,b&&(d["code.filepath"]=b),x&&(d["code.function"]=x),S!==-1&&(d["browser.script.source_char_position"]=S),ti(n,i,i+f,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:d})}}).observe({type:"long-animation-frame",buffered:!0})}function Oz(){Oc("event",({entries:e})=>{const t=Xn();if(t){for(const n of e)if(n.name==="click"){const s=Xt(Sr()+n.startTime),i=Xt(n.duration),a={name:Vr(n.target),op:`ui.interaction.${n.name}`,startTime:s,attributes:{[mn]:"auto.ui.browser.metrics"}},l=iR(n.target);l&&(a.attributes["ui.component_name"]=l),ti(t,s,s+i,a)}}})}function Mz(){return v1(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ts.cls={value:e.value,unit:""},_h=t)},!0)}function Iz(){return b1(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ts.lcp={value:e.value,unit:"millisecond"},Kn=t)},!0)}function Pz(){return hz(({metric:e})=>{e.entries[e.entries.length-1]&&(ts.ttfb={value:e.value,unit:"millisecond"})})}function Dz(e,t){const n=Fu(),s=Sr();if(!n?.getEntries||!s)return;const i=Xt(s),a=n.getEntries(),{op:l,start_timestamp:f}=mt(e);a.slice(oE).forEach(d=>{const p=Xt(d.startTime),g=Xt(Math.max(0,d.duration));if(!(l==="navigation"&&f&&i+p<f))switch(d.entryType){case"navigation":{$z(e,d,i);break}case"mark":case"paint":case"measure":{Lz(e,d,p,g,i,t.ignorePerformanceApiSpans);const y=Uu(),b=d.startTime<y.firstHiddenTime;d.name==="first-paint"&&b&&(ts.fp={value:d.startTime,unit:"millisecond"}),d.name==="first-contentful-paint"&&b&&(ts.fcp={value:d.startTime,unit:"millisecond"});break}case"resource":{Hz(e,d,d.name,p,g,i,t.ignoreResourceSpans);break}}}),oE=Math.max(a.length-1,0),qz(e),l==="pageload"&&(Gz(ts),t.recordClsOnPageloadSpan||delete ts.cls,t.recordLcpOnPageloadSpan||delete ts.lcp,Object.entries(ts).forEach(([d,p])=>{cP(d,p.value,p.unit)}),e.setAttribute("performance.timeOrigin",i),e.setAttribute("performance.activationStart",Yc()),Vz(e,t)),Kn=void 0,_h=void 0,ts={}}function zz(e){if(e?.entryType==="measure")try{return e.detail.devtools.track==="Components ⚛"}catch{return}}function Lz(e,t,n,s,i,a){if(zz(t)||["mark","measure"].includes(t.entryType)&&Go(t.name,a))return;const l=Lu(!1),f=Xt(l?l.requestStart:0),d=i+Math.max(n,f),p=i+n,g=p+s,y={[mn]:"auto.resource.browser.metrics"};d!==p&&(y["sentry.browser.measure_happened_before_request"]=!0,y["sentry.browser.measure_start_time"]=d),Uz(y,t),d<=g&&ti(e,d,g,{name:t.name,op:t.entryType,attributes:y})}function Uz(e,t){try{const n=t.detail;if(!n)return;if(typeof n=="object"){for(const[s,i]of Object.entries(n))if(i&&Tc(i))e[`sentry.browser.measure.detail.${s}`]=i;else if(i!==void 0)try{e[`sentry.browser.measure.detail.${s}`]=JSON.stringify(i)}catch{}return}if(Tc(n)){e["sentry.browser.measure.detail"]=n;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function $z(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(s=>{Ed(e,t,s,n)}),Ed(e,t,"secureConnection",n,"TLS/SSL"),Ed(e,t,"fetch",n,"cache"),Ed(e,t,"domainLookup",n,"DNS"),Fz(e,t,n)}function Ed(e,t,n,s,i=n){const a=Bz(n),l=t[a],f=t[`${n}Start`];!f||!l||ti(e,s+Xt(f),s+Xt(l),{op:`browser.${i}`,name:t.name,attributes:{[mn]:"auto.ui.browser.metrics",...n==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function Bz(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function Fz(e,t,n){const s=n+Xt(t.requestStart),i=n+Xt(t.responseEnd),a=n+Xt(t.responseStart);t.responseEnd&&(ti(e,s,i,{op:"browser.request",name:t.name,attributes:{[mn]:"auto.ui.browser.metrics"}}),ti(e,a,i,{op:"browser.response",name:t.name,attributes:{[mn]:"auto.ui.browser.metrics"}}))}function Hz(e,t,n,s,i,a,l){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;const f=t.initiatorType?`resource.${t.initiatorType}`:"resource.other";if(l?.includes(f))return;const d={[mn]:"auto.resource.browser.metrics"},p=na(n);p.protocol&&(d["url.scheme"]=p.protocol.split(":").pop()),p.host&&(d["server.address"]=p.host),d["url.same_origin"]=n.includes(Ge.location.origin),Kz(t,d,[["responseStatus","http.response.status_code"],["transferSize","http.response_transfer_size"],["encodedBodySize","http.response_content_length"],["decodedBodySize","http.decoded_response_content_length"],["renderBlockingStatus","resource.render_blocking_status"],["deliveryType","http.response_delivery_type"]]);const g={...d,...E1(t)},y=a+s,b=y+i;ti(e,y,b,{name:n.replace(Ge.location.origin,""),op:f,attributes:g})}function qz(e){const t=Ge.navigator;if(!t)return;const n=t.connection;n&&(n.effectiveType&&e.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&e.setAttribute("connectionType",n.type),Yg(n.rtt)&&(ts["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Yg(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),Yg(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}function Vz(e,t){Kn&&t.recordLcpOnPageloadSpan&&(Kn.element&&e.setAttribute("lcp.element",Vr(Kn.element)),Kn.id&&e.setAttribute("lcp.id",Kn.id),Kn.url&&e.setAttribute("lcp.url",Kn.url.trim().slice(0,200)),Kn.loadTime!=null&&e.setAttribute("lcp.loadTime",Kn.loadTime),Kn.renderTime!=null&&e.setAttribute("lcp.renderTime",Kn.renderTime),e.setAttribute("lcp.size",Kn.size)),_h?.sources&&t.recordClsOnPageloadSpan&&_h.sources.forEach((n,s)=>e.setAttribute(`cls.source.${s+1}`,Vr(n.node)))}function Kz(e,t,n){n.forEach(([s,i])=>{const a=e[s];a!=null&&(typeof a=="number"&&a<Nz||typeof a=="string")&&(t[i]=a)})}function Gz(e){const t=Lu(!1);if(!t)return;const{responseStart:n,requestStart:s}=t;s<=n&&(e["ttfb.requestTime"]={value:n-s,unit:"millisecond"})}function Zz(){return Fu()&&Sr()?Oc("element",Yz):()=>{}}const Yz=({entries:e})=>{const t=Xn(),n=t?Dn(t):void 0,s=n?mt(n).description:bt().getScopeData().transactionName;e.forEach(i=>{const a=i;if(!a.identifier)return;const l=a.name,f=a.renderTime,d=a.loadTime,[p,g]=d?[Xt(d),"load-time"]:f?[Xt(f),"render-time"]:[cn(),"entry-emission"],y=l==="image-paint"?Xt(Math.max(0,(f??0)-(d??0))):0,b={[mn]:"auto.ui.browser.elementtiming",[eo]:"ui.elementtiming",[ys]:"component","sentry.span_start_time_source":g,"sentry.transaction_name":s,"element.id":a.id,"element.type":a.element?.tagName?.toLowerCase()||"unknown","element.size":a.naturalWidth&&a.naturalHeight?`${a.naturalWidth}x${a.naturalHeight}`:void 0,"element.render_time":f,"element.load_time":d,"element.url":a.url||void 0,"element.identifier":a.identifier,"element.paint_type":l};kR({name:`element[${a.identifier}]`,attributes:b,startTime:p,onlyIfParent:!0},x=>{x.end(p+y)})})},Xz=1e3;let iE,iv,av;function Qz(e){ci("dom",e),li("dom",Wz)}function Wz(){if(!Ge.document)return;const e=Hr.bind(null,"dom"),t=aE(e,!0);Ge.document.addEventListener("click",t,!1),Ge.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{const i=Ge[n]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(gr(i,"addEventListener",function(a){return function(l,f,d){if(l==="click"||l=="keypress")try{const p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},g=p[l]=p[l]||{refCount:0};if(!g.handler){const y=aE(e);g.handler=y,a.call(this,l,y,d)}g.refCount++}catch{}return a.call(this,l,f,d)}}),gr(i,"removeEventListener",function(a){return function(l,f,d){if(l==="click"||l=="keypress")try{const p=this.__sentry_instrumentation_handlers__||{},g=p[l];g&&(g.refCount--,g.refCount<=0&&(a.call(this,l,g.handler,d),g.handler=void 0,delete p[l]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,l,f,d)}}))})}function Jz(e){if(e.type!==iv)return!1;try{if(!e.target||e.target._sentryId!==av)return!1}catch{}return!0}function eL(e,t){return e!=="keypress"?!1:t?.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function aE(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const s=tL(n);if(eL(n.type,s))return;Yn(n,"_sentryCaptured",!0),s&&!s._sentryId&&Yn(s,"_sentryId",qr());const i=n.type==="keypress"?"input":n.type;Jz(n)||(e({event:n,name:i,global:t}),iv=n.type,av=s?s._sentryId:void 0),clearTimeout(iE),iE=Ge.setTimeout(()=>{av=void 0,iv=void 0},Xz)}}function tL(e){try{return e.target}catch{return null}}let Td;function yb(e){const t="history";ci(t,e),li(t,nL)}function nL(){if(Ge.addEventListener("popstate",()=>{const t=Ge.location.href,n=Td;if(Td=t,n===t)return;Hr("history",{from:n,to:t})}),!S2())return;function e(t){return function(...n){const s=n.length>2?n[2]:void 0;if(s){const i=Td,a=rL(String(s));if(Td=a,i===a)return t.apply(this,n);Hr("history",{from:i,to:a})}return t.apply(this,n)}}gr(Ge.history,"pushState",e),gr(Ge.history,"replaceState",e)}function rL(e){try{return new URL(e,Ge.location.origin).toString()}catch{return e}}const nh={};function sL(e){const t=nh[e];if(t)return t;let n=Ge[e];if(tv(n))return nh[e]=n.bind(Ge);const s=Ge.document;if(s&&typeof s.createElement=="function")try{const i=s.createElement("iframe");i.hidden=!0,s.head.appendChild(i);const a=i.contentWindow;a?.[e]&&(n=a[e]),s.head.removeChild(i)}catch(i){Du&&be.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,i)}return n&&(nh[e]=n.bind(Ge))}function oL(e){nh[e]=void 0}const uc="__sentry_xhr_v3__";function T1(e){ci("xhr",e),li("xhr",iL)}function iL(){if(!Ge.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,s){const i=new Error,a=cn()*1e3,l=Gs(s[0])?s[0].toUpperCase():void 0,f=aL(s[1]);if(!l||!f)return t.apply(n,s);n[uc]={method:l,url:f,request_headers:{}},l==="POST"&&f.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const d=()=>{const p=n[uc];if(p&&n.readyState===4){try{p.status_code=n.status}catch{}const g={endTimestamp:cn()*1e3,startTimestamp:a,xhr:n,virtualError:i};Hr("xhr",g)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(p,g,y){return d(),p.apply(g,y)}}):n.addEventListener("readystatechange",d),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(p,g,y){const[b,x]=y,S=g[uc];return S&&Gs(b)&&Gs(x)&&(S.request_headers[b.toLowerCase()]=x),p.apply(g,y)}}),t.apply(n,s)}}),e.send=new Proxy(e.send,{apply(t,n,s){const i=n[uc];if(!i)return t.apply(n,s);s[0]!==void 0&&(i.body=s[0]);const a={startTimestamp:cn()*1e3,xhr:n};return Hr("xhr",a),t.apply(n,s)}})}function aL(e){if(Gs(e))return e;try{return e.toString()}catch{}}function cL(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return Du&&be.error(n,"Failed to get xhr response headers",e),{}}return t?t.split(`\r
|
|
21
|
-
`).reduce((n,s)=>{const[i,a]=s.split(": ");return a&&(n[i.toLowerCase()]=a),n},{}):{}}const Xg=[],rh=new Map,cc=new Map,lL=60;function uL(){if(Fu()&&Sr()){const t=fL();return()=>{t()}}return()=>{}}const cv={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function fL(){return pz(dL)}const dL=({metric:e})=>{if(e.value==null)return;const t=Xt(e.value);if(t>lL)return;const n=e.entries.find(S=>S.duration===e.value&&cv[S.name]);if(!n)return;const{interactionId:s}=n,i=cv[n.name],a=Xt(Sr()+n.startTime),l=Xn(),f=l?Dn(l):void 0,d=s!=null?rh.get(s):void 0,p=d?.span||f,g=p?mt(p).description:bt().getScopeData().transactionName,y=d?.elementName||Vr(n.target),b={[mn]:"auto.http.browser.inp",[eo]:`ui.interaction.${i}`,[Vc]:n.duration},x=gb({name:y,transaction:g,attributes:b,startTime:a});x&&(x.addEvent("inp",{[Mu]:"millisecond",[Iu]:e.value}),x.end(a+t))};function hL(){const e=Object.keys(cv);O2()&&e.forEach(i=>{Ge.addEventListener(i,t,{capture:!0,passive:!0})});function t(i){const a=i.target;if(!a)return;const l=Vr(a),f=Math.round(i.timeStamp);if(cc.set(f,l),cc.size>50){const d=cc.keys().next().value;d!==void 0&&cc.delete(d)}}function n(i){const a=Math.round(i.startTime);let l=cc.get(a);if(!l)for(let f=-5;f<=5;f++){const d=cc.get(a+f);if(d){l=d;break}}return l||"<unknown>"}const s=({entries:i})=>{const a=Xn(),l=a&&Dn(a);i.forEach(f=>{if(!xz(f))return;const d=f.interactionId;if(d==null||rh.has(d))return;const p=f.target?Vr(f.target):n(f);if(Xg.length>10){const g=Xg.shift();rh.delete(g)}Xg.push(d),rh.set(d,{span:l,elementName:p})})};Oc("event",s),Oc("first-input",s)}const pL=40;function mL(e,t=sL("fetch")){let n=0,s=0;async function i(a){const l=a.body.length;n+=l,s++;const f={body:a.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&s<15,...e.fetchOptions};try{const d=await t(e.url,f);return{statusCode:d.status,headers:{"x-sentry-rate-limits":d.headers.get("X-Sentry-Rate-Limits"),"retry-after":d.headers.get("Retry-After")}}}catch(d){throw oL("fetch"),d}finally{n-=l,s--}}return hD(e,i,cb(e.bufferSize||pL))}const Kr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,gL=30,yL=50;function lv(e,t,n,s){const i={filename:e,function:t==="<anonymous>"?oa:t,in_app:!0};return n!==void 0&&(i.lineno=n),s!==void 0&&(i.colno=s),i}const vL=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,bL=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xL=/\((\S*)(?::(\d+))(?::(\d+))\)/,SL=/at (.+?) ?\(data:(.+?),/,_L=e=>{const t=e.match(SL);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=vL.exec(e);if(n){const[,i,a,l]=n;return lv(i,oa,+a,+l)}const s=bL.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const f=xL.exec(s[2]);f&&(s[2]=f[1],s[3]=f[2],s[4]=f[3])}const[a,l]=C1(s[1]||oa,s[2]);return lv(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},wL=[gL,_L],EL=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,TL=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,CL=e=>{const t=EL.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const a=TL.exec(t[3]);a&&(t[1]=t[1]||"eval",t[3]=a[1],t[4]=a[2],t[5]="")}let s=t[3],i=t[1]||oa;return[i,s]=C1(i,s),lv(s,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},RL=[yL,CL],NL=[wL,RL],jL=JC(...NL),C1=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return n||s?[e.indexOf("@")!==-1?e.split("@")[0]:oa,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Cd=1024,AL="Breadcrumbs",kL=((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:AL,setup(n){t.console&&XD(PL(n)),t.dom&&Qz(IL(n,t.dom)),t.xhr&&T1(DL(n)),t.fetch&&o1(zL(n)),t.history&&yb(LL(n)),t.sentry&&n.on("beforeSendEvent",ML(n))}}}),OL=kL;function ML(e){return function(n){gt()===e&&ia({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Gi(n)},{event:n})}}function IL(e,t){return function(s){if(gt()!==e)return;let i,a,l=typeof t=="object"?t.serializeAttribute:void 0,f=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;f&&f>Cd&&(Kr&&be.warn(`\`dom.maxStringLength\` cannot exceed ${Cd}, but a value of ${f} was configured. Sentry will use ${Cd} instead.`),f=Cd),typeof l=="string"&&(l=[l]);try{const p=s.event,g=UL(p)?p.target:p;i=Vr(g,{keyAttrs:l,maxStringLength:f}),a=iR(g)}catch{i="<unknown>"}if(i.length===0)return;const d={category:`ui.${s.name}`,message:i};a&&(d.data={"ui.component_name":a}),ia(d,{event:s.event,name:s.name,global:s.global})}}function PL(e){return function(n){if(gt()!==e)return;const s={category:"console",data:{arguments:n.args,logger:"console"},level:WD(n.level),message:mw(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)s.message=`Assertion failed: ${mw(n.args.slice(1)," ")||"console.assert"}`,s.data.arguments=n.args.slice(1);else return;ia(s,{input:n.args,level:n.level})}}function DL(e){return function(n){if(gt()!==e)return;const{startTimestamp:s,endTimestamp:i}=n,a=n.xhr[uc];if(!s||!i||!a)return;const{method:l,url:f,status_code:d,body:p}=a,g={method:l,url:f,status_code:d},y={xhr:n.xhr,input:p,startTimestamp:s,endTimestamp:i},b={category:"xhr",data:g,type:"http",level:s1(d)};e.emit("beforeOutgoingRequestBreadcrumb",b,y),ia(b,y)}}function zL(e){return function(n){if(gt()!==e)return;const{startTimestamp:s,endTimestamp:i}=n;if(i&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const a=n.fetchData,l={data:n.error,input:n.args,startTimestamp:s,endTimestamp:i},f={category:"fetch",data:a,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",f,l),ia(f,l)}else{const a=n.response,l={...n.fetchData,status_code:a?.status};n.fetchData.request_body_size,n.fetchData.response_body_size,a?.status;const f={input:n.args,response:a,startTimestamp:s,endTimestamp:i},d={category:"fetch",data:l,type:"http",level:s1(l.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",d,f),ia(d,f)}}}function LL(e){return function(n){if(gt()!==e)return;let s=n.from,i=n.to;const a=na(st.location.href);let l=s?na(s):void 0;const f=na(i);l?.path||(l=a),a.protocol===f.protocol&&a.host===f.host&&(i=f.relative),a.protocol===l.protocol&&a.host===l.host&&(s=l.relative),ia({category:"navigation",data:{from:s,to:i}})}}function UL(e){return!!e&&!!e.target}const $L=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],BL="BrowserApiErrors",FL=((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:BL,setupOnce(){t.setTimeout&&gr(st,"setTimeout",cE),t.setInterval&&gr(st,"setInterval",cE),t.requestAnimationFrame&&gr(st,"requestAnimationFrame",qL),t.XMLHttpRequest&&"XMLHttpRequest"in st&&gr(XMLHttpRequest.prototype,"send",VL);const n=t.eventTarget;n&&(Array.isArray(n)?n:$L).forEach(i=>KL(i,t))}}}),HL=FL;function cE(e){return function(...t){const n=t[0];return t[0]=kc(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Xs(e)}`}}),e.apply(this,t)}}function qL(e){return function(t){return e.apply(this,[kc(t,{mechanism:{data:{handler:Xs(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function VL(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&gr(n,i,function(a){const l={mechanism:{data:{handler:Xs(a)},handled:!1,type:`auto.browser.browserapierrors.xhr.${i}`}},f=Vv(a);return f&&(l.mechanism.data.handler=Xs(f)),kc(a,l)})}),e.apply(this,t)}}function KL(e,t){const s=st[e]?.prototype;s?.hasOwnProperty?.("addEventListener")&&(gr(s,"addEventListener",function(i){return function(a,l,f){try{GL(l)&&(l.handleEvent=kc(l.handleEvent,{mechanism:{data:{handler:Xs(l),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&ZL(this,a,l),i.apply(this,[a,kc(l,{mechanism:{data:{handler:Xs(l),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),f])}}),gr(s,"removeEventListener",function(i){return function(a,l,f){try{const d=l.__sentry_wrapped__;d&&i.call(this,a,d,f)}catch{}return i.call(this,a,l,f)}}))}function GL(e){return typeof e.handleEvent=="function"}function ZL(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const YL=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof st.document>"u"){Kr&&be.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Dw({ignoreDuration:!0}),zw(),t==="route"&&yb(({from:n,to:s})=>{n!==void 0&&n!==s&&(Dw({ignoreDuration:!0}),zw())})}}},XL="CultureContext",QL=(()=>({name:XL,preprocessEvent(e){const t=JL();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})}})),WL=QL;function JL(){try{const e=st.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}const e4="GlobalHandlers",t4=((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:e4,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(r4(n),lE("onerror")),t.onunhandledrejection&&(s4(n),lE("onunhandledrejection"))}}}),n4=t4;function r4(e){tR(t=>{const{stackParser:n,attachStacktrace:s}=R1();if(gt()!==e||a1())return;const{msg:i,url:a,line:l,column:f,error:d}=t,p=a4(hb(n,d||i,void 0,s,!1),a,l,f);p.level="error",zR(p,{originalException:d,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function s4(e){nR(t=>{const{stackParser:n,attachStacktrace:s}=R1();if(gt()!==e||a1())return;const i=o4(t),a=Tc(i)?i4(i):hb(n,i,void 0,s,!0);a.level="error",zR(a,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function o4(e){if(Tc(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function i4(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function a4(e,t,n,s){const i=e.exception=e.exception||{},a=i.values=i.values||[],l=a[0]=a[0]||{},f=l.stacktrace=l.stacktrace||{},d=f.frames=f.frames||[],p=s,g=n,y=c4(t)??Nu();return d.length===0&&d.push({colno:p,filename:y,function:oa,in_app:!0,lineno:g}),e}function lE(e){Kr&&be.log(`Global Handler attached: ${e}`)}function R1(){return gt()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function c4(e){if(!(!Gs(e)||e.length===0))return e.startsWith("data:")?`<${Zo(e,!1)}>`:e}const l4=()=>({name:"HttpContext",preprocessEvent(e){if(!st.navigator&&!st.location&&!st.document)return;const t=ub(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}}),u4="cause",f4=5,d4="LinkedErrors",h4=((e={})=>{const t=e.limit||f4,n=e.key||u4;return{name:d4,preprocessEvent(s,i,a){const l=a.getOptions();YD(fb,l.stackParser,n,t,s,i)}}}),p4=h4;function m4(){return g4()?(Kr&&pa(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function g4(){if(typeof st.window>"u")return!1;const e=st;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;const n=Nu(),s=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(st===st.top&&s.some(a=>n.startsWith(`${a}://`)))}function y4(e){return[BD(),zD(),a2(),HL(),OL(),n4(),p4(),t2(),l4(),WL(),YL()]}function v4(e={}){const t=!e.skipBrowserExtensionCheck&&m4();let n=e.defaultIntegrations==null?y4():e.defaultIntegrations;const s={...e,enabled:t?!1:e.enabled,stackParser:LM(e.stackParser||jL),integrations:qP({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||mL};return ED(K2,s)}function b4(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function N1(e){try{return new URL(e,st.location.origin).href}catch{return}}function x4(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function j1(e){try{return new Headers(e)}catch{return}}const uE=new WeakMap,Qg=new Map,A1={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function S4(e,t){const{traceFetch:n,traceXHR:s,trackFetchStreamPerformance:i,shouldCreateSpanForRequest:a,enableHTTPTimings:l,tracePropagationTargets:f,onRequestSpanStart:d,onRequestSpanEnd:p}={...A1,...t},g=typeof a=="function"?a:S=>!0,y=S=>_4(S,f),b={},x=e.getOptions().propagateTraceparent;n&&(e.addEventProcessor(S=>(S.type==="transaction"&&S.spans&&S.spans.forEach(w=>{if(w.op==="http.client"){const T=Qg.get(w.span_id);T&&(w.timestamp=T/1e3,Qg.delete(w.span_id))}}),S)),i&&E2(S=>{if(S.response){const w=uE.get(S.response);w&&S.endTimestamp&&Qg.set(w,S.endTimestamp)}}),o1(S=>{const w=c2(S,g,y,b,{propagateTraceparent:x,onRequestSpanEnd:p});if(S.response&&S.fetchData.__span&&uE.set(S.response,S.fetchData.__span),w){const T=N1(S.fetchData.url),C=T?na(T).host:void 0;w.setAttributes({"http.url":T?Zo(T):void 0,"server.address":C}),l&&fE(w),d?.(w,{headers:S.headers})}})),s&&T1(S=>{const w=w4(S,g,y,b,x,p);w&&(l&&fE(w),d?.(w,{headers:j1(S.xhr.__sentry_xhr_v3__?.request_headers)}))})}function fE(e){const{url:t}=mt(e).data;if(!t||typeof t!="string")return;const n=Oc("resource",({entries:s})=>{s.forEach(i=>{x4(i)&&i.name.endsWith(t)&&(e.setAttributes(E1(i)),setTimeout(n))})})}function _4(e,t){const n=Nu();if(n){let s,i;try{s=new URL(e,n),i=new URL(n).origin}catch{return!1}const a=s.origin===i;return t?Go(s.toString(),t)||a&&Go(s.pathname,t):a}else{const s=!!e.match(/^\/(?!\/)/);return t?Go(e,t):s}}function w4(e,t,n,s,i,a){const l=e.xhr,f=l?.[uc];if(!l||l.__sentry_own_request__||!f)return;const{url:d,method:p}=f,g=rs()&&t(d);if(e.endTimestamp&&g){const C=l.__sentry_xhr_span_id__;if(!C)return;const O=s[C];O&&f.status_code!==void 0&&(hR(O,f.status_code),O.end(),a?.(O,{headers:j1(cL(l)),error:e.error}),delete s[C]);return}const y=N1(d),b=na(y||d),x=Zo(ND(d)),S=!!Xn(),w=g&&S?Gc({name:`${p} ${x}`,attributes:{url:Zo(d),type:"xhr","http.method":p,"http.url":y?Zo(y):void 0,"server.address":b?.host,[mn]:"auto.http.browser",[eo]:"http.client",...b?.search&&{"http.query":b?.search},...b?.hash&&{"http.fragment":b?.hash}}}):new ei;l.__sentry_xhr_span_id__=w.spanContext().spanId,s[l.__sentry_xhr_span_id__]=w,n(d)&&E4(l,rs()&&S?w:void 0,i);const T=gt();return T&&T.emit("beforeOutgoingRequestSpan",w,e),w}function E4(e,t,n){const{"sentry-trace":s,baggage:i,traceparent:a}=e1({span:t,propagateTraceparent:n});s&&T4(e,s,i,a)}function T4(e,t,n,s){const i=e.__sentry_xhr_v3__?.request_headers;if(!(i?.["sentry-trace"]||!e.setRequestHeader))try{if(e.setRequestHeader("sentry-trace",t),s&&!i?.traceparent&&e.setRequestHeader("traceparent",s),n){const a=i?.baggage;(!a||!b4(a))&&e.setRequestHeader("baggage",n)}}catch{}}function C4(){st.document?st.document.addEventListener("visibilitychange",()=>{const e=Xn();if(!e)return;const t=Dn(e);if(st.document.hidden&&t){const n="cancelled",{op:s,status:i}=mt(t);Kr&&be.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${s}`),i||t.setStatus({code:hn,message:n}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):Kr&&be.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const R4=3600,k1="sentry_previous_trace",N4="sentry.previous_trace";function j4(e,{linkPreviousTrace:t,consistentTraceSampling:n}){const s=t==="session-storage";let i=s?O4():void 0;e.on("spanStart",l=>{if(Dn(l)!==l)return;const f=bt().getPropagationContext();i=A4(i,l,f),s&&k4(i)});let a=!0;n&&e.on("beforeSampling",l=>{if(!i)return;const f=bt(),d=f.getPropagationContext();if(a&&d.parentSpanId){a=!1;return}f.setPropagationContext({...d,dsc:{...d.dsc,sample_rate:String(i.sampleRate),sampled:String(uv(i.spanContext))},sampleRand:i.sampleRand}),l.parentSampled=uv(i.spanContext),l.parentSampleRate=i.sampleRate,l.spanAttributes={...l.spanAttributes,[dR]:i.sampleRate}})}function A4(e,t,n){const s=mt(t);function i(){try{return Number(n.dsc?.sample_rate)??Number(s.data?.[Kv])}catch{return 0}}const a={spanContext:t.spanContext(),startTimestamp:s.start_timestamp,sampleRate:i(),sampleRand:n.sampleRand};if(!e)return a;const l=e.spanContext;return l.traceId===s.trace_id?e:(Date.now()/1e3-e.startTimestamp<=R4&&(Kr&&be.log(`Adding previous_trace \`${JSON.stringify(l)}\` link to span \`${JSON.stringify({op:s.op,...t.spanContext()})}\``),t.addLink({context:l,attributes:{[fI]:"previous_trace"}}),t.setAttribute(N4,`${l.traceId}-${l.spanId}-${uv(l)?1:0}`)),a)}function k4(e){try{st.sessionStorage.setItem(k1,JSON.stringify(e))}catch(t){Kr&&be.warn("Could not store previous trace in sessionStorage",t)}}function O4(){try{const e=st.sessionStorage?.getItem(k1);return JSON.parse(e)}catch{return}}function uv(e){return e.traceFlags===1}const M4="BrowserTracing",I4={...Wd,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,enableElementTiming:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...A1},P4=((e={})=>{const t={name:void 0,source:void 0},n=st.document,{enableInp:s,enableElementTiming:i,enableLongTask:a,enableLongAnimationFrame:l,_experiments:{enableInteractions:f,enableStandaloneClsSpans:d,enableStandaloneLcpSpans:p},beforeStartSpan:g,idleTimeout:y,finalTimeout:b,childSpanTimeout:x,markBackgroundSpan:S,traceFetch:w,traceXHR:T,trackFetchStreamPerformance:C,shouldCreateSpanForRequest:O,enableHTTPTimings:j,ignoreResourceSpans:R,ignorePerformanceApiSpans:I,instrumentPageLoad:z,instrumentNavigation:N,detectRedirects:A,linkPreviousTrace:D,consistentTraceSampling:Q,enableReportPageLoaded:B,onRequestSpanStart:U,onRequestSpanEnd:Z}={...I4,...e};let K,ee,P;function G(q,V,L=!0){const M=V.op==="pageload",H=V.name,W=g?g(V):V,Y=W.attributes||{};if(H!==W.name&&(Y[ys]="custom",W.attributes=Y),!L){const fe=ma();Gc({...W,startTime:fe}).end(fe);return}t.name=W.name,t.source=Y[ys];const ae=PR(W,{idleTimeout:y,finalTimeout:b,childSpanTimeout:x,disableAutoFinish:M,beforeSpanEnd:fe=>{K?.(),Dz(fe,{recordClsOnPageloadSpan:!d,recordLcpOnPageloadSpan:!p,ignoreResourceSpans:R,ignorePerformanceApiSpans:I}),pE(q,void 0);const Se=bt(),pe=Se.getPropagationContext();Se.setPropagationContext({...pe,traceId:ae.spanContext().traceId,sampled:ui(ae),dsc:to(fe)}),M&&(P=void 0)},trimIdleSpanEndTimestamp:!B});M&&B&&(P=ae),pE(q,ae);function se(){n&&["interactive","complete"].includes(n.readyState)&&q.emit("idleSpanEnableAutoFinish",ae)}M&&!B&&n&&(n.addEventListener("readystatechange",()=>{se()}),se())}return{name:M4,setup(q){if($I(),K=jz({recordClsStandaloneSpans:d||!1,recordLcpStandaloneSpans:p||!1,client:q}),s&&uL(),i&&Zz(),l&&ct.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?kz():a&&Az(),f&&Oz(),A&&n){const L=()=>{ee=cn()};addEventListener("click",L,{capture:!0}),addEventListener("keydown",L,{capture:!0,passive:!0})}function V(){const L=bu(q);L&&!mt(L).timestamp&&(Kr&&be.log(`[Tracing] Finishing current active span with op: ${mt(L).op}`),L.setAttribute(mu,"cancelled"),L.end())}q.on("startNavigationSpan",(L,M)=>{if(gt()!==q)return;if(M?.isRedirect){Kr&&be.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),G(q,{op:"navigation.redirect",...L},!1);return}ee=void 0,V(),ss().setPropagationContext({traceId:Ws(),sampleRand:Math.random(),propagationSpanId:rs()?void 0:Zs()});const H=bt();H.setPropagationContext({traceId:Ws(),sampleRand:Math.random(),propagationSpanId:rs()?void 0:Zs()}),H.setSDKProcessingMetadata({normalizedRequest:void 0}),G(q,{op:"navigation",...L,parentSpan:null,forceTransaction:!0})}),q.on("startPageLoadSpan",(L,M={})=>{if(gt()!==q)return;V();const H=M.sentryTrace||dE("sentry-trace")||hE("sentry-trace"),W=M.baggage||dE("baggage")||hE("baggage"),Y=OI(H,W),ae=bt();ae.setPropagationContext(Y),rs()||(ae.getPropagationContext().propagationSpanId=Zs()),ae.setSDKProcessingMetadata({normalizedRequest:ub()}),G(q,{op:"pageload",...L})}),q.on("endPageloadSpan",()=>{B&&P&&(P.setAttribute(mu,"reportPageLoaded"),P.end())})},afterAllSetup(q){let V=Nu();if(D!=="off"&&j4(q,{linkPreviousTrace:D,consistentTraceSampling:Q}),st.location){if(z){const L=Sr();D4(q,{name:st.location.pathname,startTime:L?L/1e3:void 0,attributes:{[ys]:"url",[mn]:"auto.pageload.browser"}})}N&&yb(({to:L,from:M})=>{if(M===void 0&&V?.indexOf(L)!==-1){V=void 0;return}V=void 0;const H=WR(L),W=bu(q),Y=W&&A&&U4(W,ee);z4(q,{name:H?.pathname||st.location.pathname,attributes:{[ys]:"url",[mn]:"auto.navigation.browser"}},{url:L,isRedirect:Y})})}S&&C4(),f&&L4(q,y,b,x,t),s&&hL(),S4(q,{traceFetch:w,traceXHR:T,trackFetchStreamPerformance:C,tracePropagationTargets:q.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:O,enableHTTPTimings:j,onRequestSpanStart:U,onRequestSpanEnd:Z})}}});function D4(e,t,n){e.emit("startPageLoadSpan",t,n),bt().setTransactionName(t.name);const s=bu(e);return s&&e.emit("afterStartPageLoadSpan",s),s}function z4(e,t,n){const{url:s,isRedirect:i}=n||{};e.emit("beforeStartNavigationSpan",t,{isRedirect:i}),e.emit("startNavigationSpan",t,{isRedirect:i});const a=bt();return a.setTransactionName(t.name),s&&!i&&a.setSDKProcessingMetadata({normalizedRequest:{...ub(),url:s}}),bu(e)}function dE(e){return st.document?.querySelector(`meta[name=${e}]`)?.getAttribute("content")||void 0}function hE(e){return st.performance?.getEntriesByType?.("navigation")[0]?.serverTiming?.find(s=>s.name===e)?.description}function L4(e,t,n,s,i){const a=st.document;let l;const f=()=>{const d="ui.action.click",p=bu(e);if(p){const g=mt(p).op;if(["navigation","pageload"].includes(g)){Kr&&be.warn(`[Tracing] Did not create ${d} span because a pageload or navigation span is in progress.`);return}}if(l&&(l.setAttribute(mu,"interactionInterrupted"),l.end(),l=void 0),!i.name){Kr&&be.warn(`[Tracing] Did not create ${d} transaction because _latestRouteName is missing.`);return}l=PR({name:i.name,op:d,attributes:{[ys]:i.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:s})};a&&addEventListener("click",f,{capture:!0})}const O1="_sentry_idleSpan";function bu(e){return e[O1]}function pE(e,t){Yn(e,O1,t)}const mE=1.5;function U4(e,t){const n=mt(e),s=ma(),i=n.start_timestamp;return!(s-i>mE||t&&s-t<=mE)}function M1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wg={exports:{}},Ke={};var gE;function $4(){if(gE)return Ke;gE=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,T={};function C(M,H,W){this.props=M,this.context=H,this.refs=T,this.updater=W||S}C.prototype.isReactComponent={},C.prototype.setState=function(M,H){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,H,"setState")},C.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function O(){}O.prototype=C.prototype;function j(M,H,W){this.props=M,this.context=H,this.refs=T,this.updater=W||S}var R=j.prototype=new O;R.constructor=j,w(R,C.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function z(){}var N={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function D(M,H,W){var Y=W.ref;return{$$typeof:e,type:M,key:H,ref:Y!==void 0?Y:null,props:W}}function Q(M,H){return D(M.type,H,M.props)}function B(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function U(M){var H={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(W){return H[W]})}var Z=/\/+/g;function K(M,H){return typeof M=="object"&&M!==null&&M.key!=null?U(""+M.key):H.toString(36)}function ee(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(z,z):(M.status="pending",M.then(function(H){M.status==="pending"&&(M.status="fulfilled",M.value=H)},function(H){M.status==="pending"&&(M.status="rejected",M.reason=H)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function P(M,H,W,Y,ae){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var fe=!1;if(M===null)fe=!0;else switch(se){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(M.$$typeof){case e:case t:fe=!0;break;case g:return fe=M._init,P(fe(M._payload),H,W,Y,ae)}}if(fe)return ae=ae(M),fe=Y===""?"."+K(M,0):Y,I(ae)?(W="",fe!=null&&(W=fe.replace(Z,"$&/")+"/"),P(ae,H,W,"",function(Me){return Me})):ae!=null&&(B(ae)&&(ae=Q(ae,W+(ae.key==null||M&&M.key===ae.key?"":(""+ae.key).replace(Z,"$&/")+"/")+fe)),H.push(ae)),1;fe=0;var Se=Y===""?".":Y+":";if(I(M))for(var pe=0;pe<M.length;pe++)Y=M[pe],se=Se+K(Y,pe),fe+=P(Y,H,W,se,ae);else if(pe=x(M),typeof pe=="function")for(M=pe.call(M),pe=0;!(Y=M.next()).done;)Y=Y.value,se=Se+K(Y,pe++),fe+=P(Y,H,W,se,ae);else if(se==="object"){if(typeof M.then=="function")return P(ee(M),H,W,Y,ae);throw H=String(M),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return fe}function G(M,H,W){if(M==null)return M;var Y=[],ae=0;return P(M,Y,"","",function(se){return H.call(W,se,ae++)}),Y}function q(M){if(M._status===-1){var H=M._result;H=H(),H.then(function(W){(M._status===0||M._status===-1)&&(M._status=1,M._result=W)},function(W){(M._status===0||M._status===-1)&&(M._status=2,M._result=W)}),M._status===-1&&(M._status=0,M._result=H)}if(M._status===1)return M._result.default;throw M._result}var V=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},L={map:G,forEach:function(M,H,W){G(M,function(){H.apply(this,arguments)},W)},count:function(M){var H=0;return G(M,function(){H++}),H},toArray:function(M){return G(M,function(H){return H})||[]},only:function(M){if(!B(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return Ke.Activity=y,Ke.Children=L,Ke.Component=C,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=j,Ke.StrictMode=s,Ke.Suspense=d,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(M){return N.H.useMemoCache(M)}},Ke.cache=function(M){return function(){return M.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(M,H,W){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var Y=w({},M.props),ae=M.key;if(H!=null)for(se in H.key!==void 0&&(ae=""+H.key),H)!A.call(H,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&H.ref===void 0||(Y[se]=H[se]);var se=arguments.length-2;if(se===1)Y.children=W;else if(1<se){for(var fe=Array(se),Se=0;Se<se;Se++)fe[Se]=arguments[Se+2];Y.children=fe}return D(M.type,ae,Y)},Ke.createContext=function(M){return M={$$typeof:l,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:a,_context:M},M},Ke.createElement=function(M,H,W){var Y,ae={},se=null;if(H!=null)for(Y in H.key!==void 0&&(se=""+H.key),H)A.call(H,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(ae[Y]=H[Y]);var fe=arguments.length-2;if(fe===1)ae.children=W;else if(1<fe){for(var Se=Array(fe),pe=0;pe<fe;pe++)Se[pe]=arguments[pe+2];ae.children=Se}if(M&&M.defaultProps)for(Y in fe=M.defaultProps,fe)ae[Y]===void 0&&(ae[Y]=fe[Y]);return D(M,se,ae)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(M){return{$$typeof:f,render:M}},Ke.isValidElement=B,Ke.lazy=function(M){return{$$typeof:g,_payload:{_status:-1,_result:M},_init:q}},Ke.memo=function(M,H){return{$$typeof:p,type:M,compare:H===void 0?null:H}},Ke.startTransition=function(M){var H=N.T,W={};N.T=W;try{var Y=M(),ae=N.S;ae!==null&&ae(W,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(z,V)}catch(se){V(se)}finally{H!==null&&W.types!==null&&(H.types=W.types),N.T=H}},Ke.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Ke.use=function(M){return N.H.use(M)},Ke.useActionState=function(M,H,W){return N.H.useActionState(M,H,W)},Ke.useCallback=function(M,H){return N.H.useCallback(M,H)},Ke.useContext=function(M){return N.H.useContext(M)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(M,H){return N.H.useDeferredValue(M,H)},Ke.useEffect=function(M,H){return N.H.useEffect(M,H)},Ke.useEffectEvent=function(M){return N.H.useEffectEvent(M)},Ke.useId=function(){return N.H.useId()},Ke.useImperativeHandle=function(M,H,W){return N.H.useImperativeHandle(M,H,W)},Ke.useInsertionEffect=function(M,H){return N.H.useInsertionEffect(M,H)},Ke.useLayoutEffect=function(M,H){return N.H.useLayoutEffect(M,H)},Ke.useMemo=function(M,H){return N.H.useMemo(M,H)},Ke.useOptimistic=function(M,H){return N.H.useOptimistic(M,H)},Ke.useReducer=function(M,H,W){return N.H.useReducer(M,H,W)},Ke.useRef=function(M){return N.H.useRef(M)},Ke.useState=function(M){return N.H.useState(M)},Ke.useSyncExternalStore=function(M,H,W){return N.H.useSyncExternalStore(M,H,W)},Ke.useTransition=function(){return N.H.useTransition()},Ke.version="19.2.4",Ke}var yE;function Hu(){return yE||(yE=1,Wg.exports=$4()),Wg.exports}var _=Hu();const Mc=M1(_),I1=AM({__proto__:null,default:Mc},[_]);function B4(e){const t={...e};return JR(t,"react"),DP("react",{version:_.version}),v4(t)}function ue(e,t,n){function s(f,d){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:d,constr:l,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,d);const p=l.prototype,g=Object.keys(p);for(let y=0;y<g.length;y++){const b=g[y];b in f||(f[b]=p[b].bind(f))}}const i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function l(f){var d;const p=n?.Parent?new a:this;s(p,f),(d=p._zod).deferred??(d.deferred=[]);for(const g of p._zod.deferred)g();return p}return Object.defineProperty(l,"init",{value:s}),Object.defineProperty(l,Symbol.hasInstance,{value:f=>n?.Parent&&f instanceof n.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class gc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class P1 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const D1={};function ni(e){return D1}function z1(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,i])=>t.indexOf(+s)===-1).map(([s,i])=>i)}function fv(e,t){return typeof t=="bigint"?t.toString():t}function vb(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function bb(e){return e==null}function xb(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function F4(e,t){const n=(e.toString().split(".")[1]||"").length,s=t.toString();let i=(s.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(s)){const d=s.match(/\d?e-(\d?)/);d?.[1]&&(i=Number.parseInt(d[1]))}const a=n>i?n:i,l=Number.parseInt(e.toFixed(a).replace(".","")),f=Number.parseInt(t.toFixed(a).replace(".",""));return l%f/10**a}const vE=Symbol("evaluating");function wt(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==vE)return s===void 0&&(s=vE,s=n()),s},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function ya(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fi(...e){const t={};for(const n of e){const s=Object.getOwnPropertyDescriptors(n);Object.assign(t,s)}return Object.defineProperties({},t)}function bE(e){return JSON.stringify(e)}function H4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const L1="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function wh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const q4=vb(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ic(e){if(wh(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(wh(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function U1(e){return Ic(e)?{...e}:Array.isArray(e)?[...e]:e}const V4=new Set(["string","number","symbol"]);function Pc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function di(e,t,n){const s=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(s._zod.parent=e),s}function De(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function K4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const G4={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Z4(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const a=fi(e._zod.def,{get shape(){const l={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(l[f]=n.shape[f])}return ya(this,"shape",l),l},checks:[]});return di(e,a)}function Y4(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=fi(e._zod.def,{get shape(){const l={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete l[f]}return ya(this,"shape",l),l},checks:[]});return di(e,a)}function X4(e,t){if(!Ic(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const a=e._zod.def.shape;for(const l in t)if(Object.getOwnPropertyDescriptor(a,l)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=fi(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return ya(this,"shape",a),a}});return di(e,i)}function Q4(e,t){if(!Ic(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=fi(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return ya(this,"shape",s),s}});return di(e,n)}function W4(e,t){const n=fi(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return ya(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return di(e,n)}function J4(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const l=fi(t._zod.def,{get shape(){const f=t._zod.def.shape,d={...f};if(n)for(const p in n){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(d[p]=e?new e({type:"optional",innerType:f[p]}):f[p])}else for(const p in f)d[p]=e?new e({type:"optional",innerType:f[p]}):f[p];return ya(this,"shape",d),d},checks:[]});return di(t,l)}function e5(e,t,n){const s=fi(t._zod.def,{get shape(){const i=t._zod.def.shape,a={...i};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(a[l]=new e({type:"nonoptional",innerType:i[l]}))}else for(const l in i)a[l]=new e({type:"nonoptional",innerType:i[l]});return ya(this,"shape",a),a}});return di(t,s)}function fc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function dc(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}function Rd(e){return typeof e=="string"?e:e?.message}function ri(e,t,n){const s={...e,path:e.path??[]};if(!e.message){const i=Rd(e.inst?._zod.def?.error?.(e))??Rd(t?.error?.(e))??Rd(n.customError?.(e))??Rd(n.localeError?.(e))??"Invalid input";s.message=i}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function Sb(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function xu(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}const $1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,fv,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},B1=ue("$ZodError",$1),F1=ue("$ZodError",$1,{Parent:Error});function t5(e,t=n=>n.message){const n={},s=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):s.push(t(i));return{formErrors:s,fieldErrors:n}}function n5(e,t=n=>n.message){const n={_errors:[]},s=i=>{for(const a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(l=>s({issues:l}));else if(a.code==="invalid_key")s({issues:a.issues});else if(a.code==="invalid_element")s({issues:a.issues});else if(a.path.length===0)n._errors.push(t(a));else{let l=n,f=0;for(;f<a.path.length;){const d=a.path[f];f===a.path.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(a))):l[d]=l[d]||{_errors:[]},l=l[d],f++}}};return s(e),n}const _b=e=>(t,n,s,i)=>{const a=s?Object.assign(s,{async:!1}):{async:!1},l=t._zod.run({value:n,issues:[]},a);if(l instanceof Promise)throw new gc;if(l.issues.length){const f=new(i?.Err??e)(l.issues.map(d=>ri(d,a,ni())));throw L1(f,i?.callee),f}return l.value},wb=e=>async(t,n,s,i)=>{const a=s?Object.assign(s,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},a);if(l instanceof Promise&&(l=await l),l.issues.length){const f=new(i?.Err??e)(l.issues.map(d=>ri(d,a,ni())));throw L1(f,i?.callee),f}return l.value},op=e=>(t,n,s)=>{const i=s?{...s,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new gc;return a.issues.length?{success:!1,error:new(e??B1)(a.issues.map(l=>ri(l,i,ni())))}:{success:!0,data:a.value}},r5=op(F1),ip=e=>async(t,n,s)=>{const i=s?Object.assign(s,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(l=>ri(l,i,ni())))}:{success:!0,data:a.value}},s5=ip(F1),o5=e=>(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return _b(e)(t,n,i)},i5=e=>(t,n,s)=>_b(e)(t,n,s),a5=e=>async(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return wb(e)(t,n,i)},c5=e=>async(t,n,s)=>wb(e)(t,n,s),l5=e=>(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return op(e)(t,n,i)},u5=e=>(t,n,s)=>op(e)(t,n,s),f5=e=>async(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return ip(e)(t,n,i)},d5=e=>async(t,n,s)=>ip(e)(t,n,s),h5=/^[cC][^\s-]{8,}$/,p5=/^[0-9a-z]+$/,m5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,g5=/^[0-9a-vA-V]{20}$/,y5=/^[A-Za-z0-9]{27}$/,v5=/^[a-zA-Z0-9_-]{21}$/,b5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,x5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xE=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,S5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function w5(){return new RegExp(_5,"u")}const E5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,T5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,C5=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,R5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,N5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,H1=/^[A-Za-z0-9_-]*$/,j5=/^\+[1-9]\d{6,14}$/,q1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",A5=new RegExp(`^${q1}$`);function V1(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function k5(e){return new RegExp(`^${V1(e)}$`)}function O5(e){const t=V1({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${q1}T(?:${s})$`)}const M5=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},I5=/^-?\d+$/,K1=/^-?\d+(?:\.\d+)?$/,P5=/^(?:true|false)$/i,D5=/^[^A-Z]*$/,z5=/^[^a-z]*$/,Qn=ue("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),G1={number:"number",bigint:"bigint",object:"date"},Z1=ue("$ZodCheckLessThan",(e,t)=>{Qn.init(e,t);const n=G1[typeof t.value];e._zod.onattach.push(s=>{const i=s._zod.bag,a=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Y1=ue("$ZodCheckGreaterThan",(e,t)=>{Qn.init(e,t);const n=G1[typeof t.value];e._zod.onattach.push(s=>{const i=s._zod.bag,a=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),L5=ue("$ZodCheckMultipleOf",(e,t)=>{Qn.init(e,t),e._zod.onattach.push(n=>{var s;(s=n._zod.bag).multipleOf??(s.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):F4(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),U5=ue("$ZodCheckNumberFormat",(e,t)=>{Qn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),s=n?"int":"number",[i,a]=G4[t.format];e._zod.onattach.push(l=>{const f=l._zod.bag;f.format=t.format,f.minimum=i,f.maximum=a,n&&(f.pattern=I5)}),e._zod.check=l=>{const f=l.value;if(n){if(!Number.isInteger(f)){l.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?l.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):l.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort});return}}f<i&&l.issues.push({origin:"number",input:f,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),f>a&&l.issues.push({origin:"number",input:f,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),$5=ue("$ZodCheckMaxLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!bb(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const i=s.value;if(i.length<=t.maximum)return;const l=Sb(i);s.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),B5=ue("$ZodCheckMinLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!bb(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const i=s.value;if(i.length>=t.minimum)return;const l=Sb(i);s.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),F5=ue("$ZodCheckLengthEquals",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!bb(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=s=>{const i=s.value,a=i.length;if(a===t.length)return;const l=Sb(i),f=a>t.length;s.issues.push({origin:l,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),ap=ue("$ZodCheckStringFormat",(e,t)=>{var n,s;Qn.init(e,t),e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),H5=ue("$ZodCheckRegex",(e,t)=>{ap.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),q5=ue("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=D5),ap.init(e,t)}),V5=ue("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=z5),ap.init(e,t)}),K5=ue("$ZodCheckIncludes",(e,t)=>{Qn.init(e,t);const n=Pc(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(i=>{const a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(s)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),G5=ue("$ZodCheckStartsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`^${Pc(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),Z5=ue("$ZodCheckEndsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`.*${Pc(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),Y5=ue("$ZodCheckOverwrite",(e,t)=>{Qn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class X5{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const s=t.split(`
|
|
20
|
+
Error:`,i)}}function m2(){return t2(e=>{Bu("cls",{metric:e}),p1=e},{reportAllChanges:!0})}function g2(){return u2(e=>{Bu("lcp",{metric:e}),m1=e},{reportAllChanges:!0})}function y2(){return d2(e=>{Bu("ttfb",{metric:e}),g1=e})}function v2(){return a2(e=>{Bu("inp",{metric:e}),y1=e})}function sp(e,t,n,s,i=!1){x1(e,t);let a;return Sh[e]||(a=n(),Sh[e]=!0),s&&t({metric:s}),S1(e,t,i?a:void 0)}function b2(e){const t={};e==="event"&&(t.durationThreshold=0),Xc(e,n=>{Bu(e,{entries:n})},t)}function x1(e,t){au[e]=au[e]||[],au[e].push(t)}function S1(e,t,n){return()=>{n&&n();const s=au[e];if(!s)return;const i=s.indexOf(t);i!==-1&&s.splice(i,1)}}function x2(e){return"duration"in e}const S2=e=>{const t=n=>{(n.type==="pagehide"||Ge.document?.visibilityState==="hidden")&&e(n)};Yo("visibilitychange",t,{capture:!0,once:!0}),Yo("pagehide",t,{capture:!0,once:!0})};function Yg(e){return typeof e=="number"&&isFinite(e)}function ti(e,t,n,{...s}){const i=mt(e).start_timestamp;return i&&i>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),Jv(e,()=>{const a=Gc({startTime:t,...s});return a&&a.end(n),a})}function gb(e){const t=gt();if(!t)return;const{name:n,transaction:s,attributes:i,startTime:a}=e,{release:l,environment:f,sendDefaultPii:d}=t.getOptions(),g=t.getIntegrationByName("Replay")?.getReplayId(),y=bt(),b=y.getUser(),x=b!==void 0?b.email||b.id||b.ip_address:void 0;let S;try{S=y.getScopeData().contexts.profile.profile_id}catch{}const w={release:l,environment:f,user:x||void 0,profile_id:S||void 0,replay_id:g||void 0,transaction:s,"user_agent.original":Ge.navigator?.userAgent,"client.address":d?"{{auto}}":void 0,...i};return Gc({name:n,attributes:w,startTime:a,experimental:{standalone:!0}})}function Fu(){return Ge.addEventListener&&Ge.performance}function Xt(e){return e/1e3}function _2(e){let t="unknown",n="unknown",s="";for(const i of e){if(i==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(i))){t=s==="h"?"http":s,n=e.split(s)[1];break}s+=i}return s===e&&(t=s),{name:t,version:n}}function _1(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function w1(e,t){let n,s=!1;function i(f){!s&&n&&t(f,n),s=!0}S2(()=>{i("pagehide")});const a=e.on("beforeStartNavigationSpan",(f,d)=>{d?.isRedirect||(i("navigation"),a(),l())}),l=e.on("afterStartPageLoadSpan",f=>{n=f.spanContext().spanId,l()})}function w2(e){let t=0,n;if(!_1("layout-shift"))return;const s=v1(({metric:i})=>{const a=i.entries[i.entries.length-1];a&&(t=i.value,n=a)},!0);w1(e,(i,a)=>{E2(t,n,a,i),s()})}function E2(e,t,n,s){Du&&be.log(`Sending CLS span (${e})`);const i=t?Xt((Sr()||0)+t.startTime):cn(),a=bt().getScopeData().transactionName,l=t?Vr(t.sources[0]?.node):"Layout shift",f={[mn]:"auto.http.browser.cls",[eo]:"ui.webvital.cls",[Vc]:0,"sentry.pageload.span_id":n,"sentry.report_event":s};t?.sources&&t.sources.forEach((p,g)=>{f[`cls.source.${g+1}`]=Vr(p.node)});const d=gb({name:l,transaction:a,attributes:f,startTime:i});d&&(d.addEvent("cls",{[Mu]:"",[Iu]:e}),d.end(i))}function T2(e){let t=0,n;if(!_1("largest-contentful-paint"))return;const s=b1(({metric:i})=>{const a=i.entries[i.entries.length-1];a&&(t=i.value,n=a)},!0);w1(e,(i,a)=>{C2(t,n,a,i),s()})}function C2(e,t,n,s){Du&&be.log(`Sending LCP span (${e})`);const i=Xt((Sr()||0)+(t?.startTime||0)),a=bt().getScopeData().transactionName,l=t?Vr(t.element):"Largest contentful paint",f={[mn]:"auto.http.browser.lcp",[eo]:"ui.webvital.lcp",[Vc]:0,"sentry.pageload.span_id":n,"sentry.report_event":s};t&&(t.element&&(f["lcp.element"]=Vr(t.element)),t.id&&(f["lcp.id"]=t.id),t.url&&(f["lcp.url"]=t.url),t.loadTime!=null&&(f["lcp.loadTime"]=t.loadTime),t.renderTime!=null&&(f["lcp.renderTime"]=t.renderTime),t.size!=null&&(f["lcp.size"]=t.size));const d=gb({name:l,transaction:a,attributes:f,startTime:i});d&&(d.addEvent("lcp",{[Mu]:"millisecond",[Iu]:e}),d.end(i))}function Pr(e){return e&&((Sr()||performance.timeOrigin)+e)/1e3}function E1(e){const t={};if(e.nextHopProtocol!=null){const{name:n,version:s}=_2(e.nextHopProtocol);t["network.protocol.version"]=s,t["network.protocol.name"]=n}return Sr()||Fu()?.timeOrigin?R2({...t,"http.request.redirect_start":Pr(e.redirectStart),"http.request.redirect_end":Pr(e.redirectEnd),"http.request.worker_start":Pr(e.workerStart),"http.request.fetch_start":Pr(e.fetchStart),"http.request.domain_lookup_start":Pr(e.domainLookupStart),"http.request.domain_lookup_end":Pr(e.domainLookupEnd),"http.request.connect_start":Pr(e.connectStart),"http.request.secure_connection_start":Pr(e.secureConnectionStart),"http.request.connection_end":Pr(e.connectEnd),"http.request.request_start":Pr(e.requestStart),"http.request.response_start":Pr(e.responseStart),"http.request.response_end":Pr(e.responseEnd),"http.request.time_to_first_byte":e.responseStart!=null?e.responseStart/1e3:void 0}):t}function R2(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}const N2=2147483647;let oE=0,ts={},Kn,_h;function j2({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){const s=Fu();if(s&&Sr()){s.mark&&Ge.performance.mark("sentry-tracing-init");const i=t?T2(n):I2(),a=P2(),l=e?w2(n):M2();return()=>{i?.(),a(),l?.()}}return()=>{}}function A2(){Oc("longtask",({entries:e})=>{const t=Xn();if(!t)return;const{op:n,start_timestamp:s}=mt(t);for(const i of e){const a=Xt(Sr()+i.startTime),l=Xt(i.duration);n==="navigation"&&s&&a<s||ti(t,a,a+l,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[mn]:"auto.ui.browser.metrics"}})}})}function k2(){new PerformanceObserver(t=>{const n=Xn();if(n)for(const s of t.getEntries()){if(!s.scripts[0])continue;const i=Xt(Sr()+s.startTime),{start_timestamp:a,op:l}=mt(n);if(l==="navigation"&&a&&i<a)continue;const f=Xt(s.duration),d={[mn]:"auto.ui.browser.metrics"},p=s.scripts[0],{invoker:g,invokerType:y,sourceURL:b,sourceFunctionName:x,sourceCharPosition:S}=p;d["browser.script.invoker"]=g,d["browser.script.invoker_type"]=y,b&&(d["code.filepath"]=b),x&&(d["code.function"]=x),S!==-1&&(d["browser.script.source_char_position"]=S),ti(n,i,i+f,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:d})}}).observe({type:"long-animation-frame",buffered:!0})}function O2(){Oc("event",({entries:e})=>{const t=Xn();if(t){for(const n of e)if(n.name==="click"){const s=Xt(Sr()+n.startTime),i=Xt(n.duration),a={name:Vr(n.target),op:`ui.interaction.${n.name}`,startTime:s,attributes:{[mn]:"auto.ui.browser.metrics"}},l=iR(n.target);l&&(a.attributes["ui.component_name"]=l),ti(t,s,s+i,a)}}})}function M2(){return v1(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ts.cls={value:e.value,unit:""},_h=t)},!0)}function I2(){return b1(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ts.lcp={value:e.value,unit:"millisecond"},Kn=t)},!0)}function P2(){return h2(({metric:e})=>{e.entries[e.entries.length-1]&&(ts.ttfb={value:e.value,unit:"millisecond"})})}function D2(e,t){const n=Fu(),s=Sr();if(!n?.getEntries||!s)return;const i=Xt(s),a=n.getEntries(),{op:l,start_timestamp:f}=mt(e);a.slice(oE).forEach(d=>{const p=Xt(d.startTime),g=Xt(Math.max(0,d.duration));if(!(l==="navigation"&&f&&i+p<f))switch(d.entryType){case"navigation":{$2(e,d,i);break}case"mark":case"paint":case"measure":{L2(e,d,p,g,i,t.ignorePerformanceApiSpans);const y=Uu(),b=d.startTime<y.firstHiddenTime;d.name==="first-paint"&&b&&(ts.fp={value:d.startTime,unit:"millisecond"}),d.name==="first-contentful-paint"&&b&&(ts.fcp={value:d.startTime,unit:"millisecond"});break}case"resource":{H2(e,d,d.name,p,g,i,t.ignoreResourceSpans);break}}}),oE=Math.max(a.length-1,0),q2(e),l==="pageload"&&(G2(ts),t.recordClsOnPageloadSpan||delete ts.cls,t.recordLcpOnPageloadSpan||delete ts.lcp,Object.entries(ts).forEach(([d,p])=>{cP(d,p.value,p.unit)}),e.setAttribute("performance.timeOrigin",i),e.setAttribute("performance.activationStart",Yc()),V2(e,t)),Kn=void 0,_h=void 0,ts={}}function z2(e){if(e?.entryType==="measure")try{return e.detail.devtools.track==="Components ⚛"}catch{return}}function L2(e,t,n,s,i,a){if(z2(t)||["mark","measure"].includes(t.entryType)&&Go(t.name,a))return;const l=Lu(!1),f=Xt(l?l.requestStart:0),d=i+Math.max(n,f),p=i+n,g=p+s,y={[mn]:"auto.resource.browser.metrics"};d!==p&&(y["sentry.browser.measure_happened_before_request"]=!0,y["sentry.browser.measure_start_time"]=d),U2(y,t),d<=g&&ti(e,d,g,{name:t.name,op:t.entryType,attributes:y})}function U2(e,t){try{const n=t.detail;if(!n)return;if(typeof n=="object"){for(const[s,i]of Object.entries(n))if(i&&Tc(i))e[`sentry.browser.measure.detail.${s}`]=i;else if(i!==void 0)try{e[`sentry.browser.measure.detail.${s}`]=JSON.stringify(i)}catch{}return}if(Tc(n)){e["sentry.browser.measure.detail"]=n;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function $2(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(s=>{Ed(e,t,s,n)}),Ed(e,t,"secureConnection",n,"TLS/SSL"),Ed(e,t,"fetch",n,"cache"),Ed(e,t,"domainLookup",n,"DNS"),F2(e,t,n)}function Ed(e,t,n,s,i=n){const a=B2(n),l=t[a],f=t[`${n}Start`];!f||!l||ti(e,s+Xt(f),s+Xt(l),{op:`browser.${i}`,name:t.name,attributes:{[mn]:"auto.ui.browser.metrics",...n==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function B2(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function F2(e,t,n){const s=n+Xt(t.requestStart),i=n+Xt(t.responseEnd),a=n+Xt(t.responseStart);t.responseEnd&&(ti(e,s,i,{op:"browser.request",name:t.name,attributes:{[mn]:"auto.ui.browser.metrics"}}),ti(e,a,i,{op:"browser.response",name:t.name,attributes:{[mn]:"auto.ui.browser.metrics"}}))}function H2(e,t,n,s,i,a,l){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;const f=t.initiatorType?`resource.${t.initiatorType}`:"resource.other";if(l?.includes(f))return;const d={[mn]:"auto.resource.browser.metrics"},p=na(n);p.protocol&&(d["url.scheme"]=p.protocol.split(":").pop()),p.host&&(d["server.address"]=p.host),d["url.same_origin"]=n.includes(Ge.location.origin),K2(t,d,[["responseStatus","http.response.status_code"],["transferSize","http.response_transfer_size"],["encodedBodySize","http.response_content_length"],["decodedBodySize","http.decoded_response_content_length"],["renderBlockingStatus","resource.render_blocking_status"],["deliveryType","http.response_delivery_type"]]);const g={...d,...E1(t)},y=a+s,b=y+i;ti(e,y,b,{name:n.replace(Ge.location.origin,""),op:f,attributes:g})}function q2(e){const t=Ge.navigator;if(!t)return;const n=t.connection;n&&(n.effectiveType&&e.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&e.setAttribute("connectionType",n.type),Yg(n.rtt)&&(ts["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Yg(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),Yg(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}function V2(e,t){Kn&&t.recordLcpOnPageloadSpan&&(Kn.element&&e.setAttribute("lcp.element",Vr(Kn.element)),Kn.id&&e.setAttribute("lcp.id",Kn.id),Kn.url&&e.setAttribute("lcp.url",Kn.url.trim().slice(0,200)),Kn.loadTime!=null&&e.setAttribute("lcp.loadTime",Kn.loadTime),Kn.renderTime!=null&&e.setAttribute("lcp.renderTime",Kn.renderTime),e.setAttribute("lcp.size",Kn.size)),_h?.sources&&t.recordClsOnPageloadSpan&&_h.sources.forEach((n,s)=>e.setAttribute(`cls.source.${s+1}`,Vr(n.node)))}function K2(e,t,n){n.forEach(([s,i])=>{const a=e[s];a!=null&&(typeof a=="number"&&a<N2||typeof a=="string")&&(t[i]=a)})}function G2(e){const t=Lu(!1);if(!t)return;const{responseStart:n,requestStart:s}=t;s<=n&&(e["ttfb.requestTime"]={value:n-s,unit:"millisecond"})}function Z2(){return Fu()&&Sr()?Oc("element",Y2):()=>{}}const Y2=({entries:e})=>{const t=Xn(),n=t?Dn(t):void 0,s=n?mt(n).description:bt().getScopeData().transactionName;e.forEach(i=>{const a=i;if(!a.identifier)return;const l=a.name,f=a.renderTime,d=a.loadTime,[p,g]=d?[Xt(d),"load-time"]:f?[Xt(f),"render-time"]:[cn(),"entry-emission"],y=l==="image-paint"?Xt(Math.max(0,(f??0)-(d??0))):0,b={[mn]:"auto.ui.browser.elementtiming",[eo]:"ui.elementtiming",[ys]:"component","sentry.span_start_time_source":g,"sentry.transaction_name":s,"element.id":a.id,"element.type":a.element?.tagName?.toLowerCase()||"unknown","element.size":a.naturalWidth&&a.naturalHeight?`${a.naturalWidth}x${a.naturalHeight}`:void 0,"element.render_time":f,"element.load_time":d,"element.url":a.url||void 0,"element.identifier":a.identifier,"element.paint_type":l};kR({name:`element[${a.identifier}]`,attributes:b,startTime:p,onlyIfParent:!0},x=>{x.end(p+y)})})},X2=1e3;let iE,iv,av;function Q2(e){ci("dom",e),li("dom",W2)}function W2(){if(!Ge.document)return;const e=Hr.bind(null,"dom"),t=aE(e,!0);Ge.document.addEventListener("click",t,!1),Ge.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{const i=Ge[n]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(gr(i,"addEventListener",function(a){return function(l,f,d){if(l==="click"||l=="keypress")try{const p=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},g=p[l]=p[l]||{refCount:0};if(!g.handler){const y=aE(e);g.handler=y,a.call(this,l,y,d)}g.refCount++}catch{}return a.call(this,l,f,d)}}),gr(i,"removeEventListener",function(a){return function(l,f,d){if(l==="click"||l=="keypress")try{const p=this.__sentry_instrumentation_handlers__||{},g=p[l];g&&(g.refCount--,g.refCount<=0&&(a.call(this,l,g.handler,d),g.handler=void 0,delete p[l]),Object.keys(p).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,l,f,d)}}))})}function J2(e){if(e.type!==iv)return!1;try{if(!e.target||e.target._sentryId!==av)return!1}catch{}return!0}function eL(e,t){return e!=="keypress"?!1:t?.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function aE(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const s=tL(n);if(eL(n.type,s))return;Yn(n,"_sentryCaptured",!0),s&&!s._sentryId&&Yn(s,"_sentryId",qr());const i=n.type==="keypress"?"input":n.type;J2(n)||(e({event:n,name:i,global:t}),iv=n.type,av=s?s._sentryId:void 0),clearTimeout(iE),iE=Ge.setTimeout(()=>{av=void 0,iv=void 0},X2)}}function tL(e){try{return e.target}catch{return null}}let Td;function yb(e){const t="history";ci(t,e),li(t,nL)}function nL(){if(Ge.addEventListener("popstate",()=>{const t=Ge.location.href,n=Td;if(Td=t,n===t)return;Hr("history",{from:n,to:t})}),!Sz())return;function e(t){return function(...n){const s=n.length>2?n[2]:void 0;if(s){const i=Td,a=rL(String(s));if(Td=a,i===a)return t.apply(this,n);Hr("history",{from:i,to:a})}return t.apply(this,n)}}gr(Ge.history,"pushState",e),gr(Ge.history,"replaceState",e)}function rL(e){try{return new URL(e,Ge.location.origin).toString()}catch{return e}}const nh={};function sL(e){const t=nh[e];if(t)return t;let n=Ge[e];if(tv(n))return nh[e]=n.bind(Ge);const s=Ge.document;if(s&&typeof s.createElement=="function")try{const i=s.createElement("iframe");i.hidden=!0,s.head.appendChild(i);const a=i.contentWindow;a?.[e]&&(n=a[e]),s.head.removeChild(i)}catch(i){Du&&be.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,i)}return n&&(nh[e]=n.bind(Ge))}function oL(e){nh[e]=void 0}const uc="__sentry_xhr_v3__";function T1(e){ci("xhr",e),li("xhr",iL)}function iL(){if(!Ge.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,s){const i=new Error,a=cn()*1e3,l=Gs(s[0])?s[0].toUpperCase():void 0,f=aL(s[1]);if(!l||!f)return t.apply(n,s);n[uc]={method:l,url:f,request_headers:{}},l==="POST"&&f.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const d=()=>{const p=n[uc];if(p&&n.readyState===4){try{p.status_code=n.status}catch{}const g={endTimestamp:cn()*1e3,startTimestamp:a,xhr:n,virtualError:i};Hr("xhr",g)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(p,g,y){return d(),p.apply(g,y)}}):n.addEventListener("readystatechange",d),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(p,g,y){const[b,x]=y,S=g[uc];return S&&Gs(b)&&Gs(x)&&(S.request_headers[b.toLowerCase()]=x),p.apply(g,y)}}),t.apply(n,s)}}),e.send=new Proxy(e.send,{apply(t,n,s){const i=n[uc];if(!i)return t.apply(n,s);s[0]!==void 0&&(i.body=s[0]);const a={startTimestamp:cn()*1e3,xhr:n};return Hr("xhr",a),t.apply(n,s)}})}function aL(e){if(Gs(e))return e;try{return e.toString()}catch{}}function cL(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return Du&&be.error(n,"Failed to get xhr response headers",e),{}}return t?t.split(`\r
|
|
21
|
+
`).reduce((n,s)=>{const[i,a]=s.split(": ");return a&&(n[i.toLowerCase()]=a),n},{}):{}}const Xg=[],rh=new Map,cc=new Map,lL=60;function uL(){if(Fu()&&Sr()){const t=fL();return()=>{t()}}return()=>{}}const cv={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function fL(){return p2(dL)}const dL=({metric:e})=>{if(e.value==null)return;const t=Xt(e.value);if(t>lL)return;const n=e.entries.find(S=>S.duration===e.value&&cv[S.name]);if(!n)return;const{interactionId:s}=n,i=cv[n.name],a=Xt(Sr()+n.startTime),l=Xn(),f=l?Dn(l):void 0,d=s!=null?rh.get(s):void 0,p=d?.span||f,g=p?mt(p).description:bt().getScopeData().transactionName,y=d?.elementName||Vr(n.target),b={[mn]:"auto.http.browser.inp",[eo]:`ui.interaction.${i}`,[Vc]:n.duration},x=gb({name:y,transaction:g,attributes:b,startTime:a});x&&(x.addEvent("inp",{[Mu]:"millisecond",[Iu]:e.value}),x.end(a+t))};function hL(){const e=Object.keys(cv);Oz()&&e.forEach(i=>{Ge.addEventListener(i,t,{capture:!0,passive:!0})});function t(i){const a=i.target;if(!a)return;const l=Vr(a),f=Math.round(i.timeStamp);if(cc.set(f,l),cc.size>50){const d=cc.keys().next().value;d!==void 0&&cc.delete(d)}}function n(i){const a=Math.round(i.startTime);let l=cc.get(a);if(!l)for(let f=-5;f<=5;f++){const d=cc.get(a+f);if(d){l=d;break}}return l||"<unknown>"}const s=({entries:i})=>{const a=Xn(),l=a&&Dn(a);i.forEach(f=>{if(!x2(f))return;const d=f.interactionId;if(d==null||rh.has(d))return;const p=f.target?Vr(f.target):n(f);if(Xg.length>10){const g=Xg.shift();rh.delete(g)}Xg.push(d),rh.set(d,{span:l,elementName:p})})};Oc("event",s),Oc("first-input",s)}const pL=40;function mL(e,t=sL("fetch")){let n=0,s=0;async function i(a){const l=a.body.length;n+=l,s++;const f={body:a.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:n<=6e4&&s<15,...e.fetchOptions};try{const d=await t(e.url,f);return{statusCode:d.status,headers:{"x-sentry-rate-limits":d.headers.get("X-Sentry-Rate-Limits"),"retry-after":d.headers.get("Retry-After")}}}catch(d){throw oL("fetch"),d}finally{n-=l,s--}}return hD(e,i,cb(e.bufferSize||pL))}const Kr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,gL=30,yL=50;function lv(e,t,n,s){const i={filename:e,function:t==="<anonymous>"?oa:t,in_app:!0};return n!==void 0&&(i.lineno=n),s!==void 0&&(i.colno=s),i}const vL=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,bL=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xL=/\((\S*)(?::(\d+))(?::(\d+))\)/,SL=/at (.+?) ?\(data:(.+?),/,_L=e=>{const t=e.match(SL);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=vL.exec(e);if(n){const[,i,a,l]=n;return lv(i,oa,+a,+l)}const s=bL.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const f=xL.exec(s[2]);f&&(s[2]=f[1],s[3]=f[2],s[4]=f[3])}const[a,l]=C1(s[1]||oa,s[2]);return lv(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},wL=[gL,_L],EL=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,TL=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,CL=e=>{const t=EL.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const a=TL.exec(t[3]);a&&(t[1]=t[1]||"eval",t[3]=a[1],t[4]=a[2],t[5]="")}let s=t[3],i=t[1]||oa;return[i,s]=C1(i,s),lv(s,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},RL=[yL,CL],NL=[wL,RL],jL=JC(...NL),C1=(e,t)=>{const n=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return n||s?[e.indexOf("@")!==-1?e.split("@")[0]:oa,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Cd=1024,AL="Breadcrumbs",kL=((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:AL,setup(n){t.console&&XD(PL(n)),t.dom&&Q2(IL(n,t.dom)),t.xhr&&T1(DL(n)),t.fetch&&o1(zL(n)),t.history&&yb(LL(n)),t.sentry&&n.on("beforeSendEvent",ML(n))}}}),OL=kL;function ML(e){return function(n){gt()===e&&ia({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Gi(n)},{event:n})}}function IL(e,t){return function(s){if(gt()!==e)return;let i,a,l=typeof t=="object"?t.serializeAttribute:void 0,f=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;f&&f>Cd&&(Kr&&be.warn(`\`dom.maxStringLength\` cannot exceed ${Cd}, but a value of ${f} was configured. Sentry will use ${Cd} instead.`),f=Cd),typeof l=="string"&&(l=[l]);try{const p=s.event,g=UL(p)?p.target:p;i=Vr(g,{keyAttrs:l,maxStringLength:f}),a=iR(g)}catch{i="<unknown>"}if(i.length===0)return;const d={category:`ui.${s.name}`,message:i};a&&(d.data={"ui.component_name":a}),ia(d,{event:s.event,name:s.name,global:s.global})}}function PL(e){return function(n){if(gt()!==e)return;const s={category:"console",data:{arguments:n.args,logger:"console"},level:WD(n.level),message:mw(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)s.message=`Assertion failed: ${mw(n.args.slice(1)," ")||"console.assert"}`,s.data.arguments=n.args.slice(1);else return;ia(s,{input:n.args,level:n.level})}}function DL(e){return function(n){if(gt()!==e)return;const{startTimestamp:s,endTimestamp:i}=n,a=n.xhr[uc];if(!s||!i||!a)return;const{method:l,url:f,status_code:d,body:p}=a,g={method:l,url:f,status_code:d},y={xhr:n.xhr,input:p,startTimestamp:s,endTimestamp:i},b={category:"xhr",data:g,type:"http",level:s1(d)};e.emit("beforeOutgoingRequestBreadcrumb",b,y),ia(b,y)}}function zL(e){return function(n){if(gt()!==e)return;const{startTimestamp:s,endTimestamp:i}=n;if(i&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const a=n.fetchData,l={data:n.error,input:n.args,startTimestamp:s,endTimestamp:i},f={category:"fetch",data:a,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",f,l),ia(f,l)}else{const a=n.response,l={...n.fetchData,status_code:a?.status};n.fetchData.request_body_size,n.fetchData.response_body_size,a?.status;const f={input:n.args,response:a,startTimestamp:s,endTimestamp:i},d={category:"fetch",data:l,type:"http",level:s1(l.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",d,f),ia(d,f)}}}function LL(e){return function(n){if(gt()!==e)return;let s=n.from,i=n.to;const a=na(st.location.href);let l=s?na(s):void 0;const f=na(i);l?.path||(l=a),a.protocol===f.protocol&&a.host===f.host&&(i=f.relative),a.protocol===l.protocol&&a.host===l.host&&(s=l.relative),ia({category:"navigation",data:{from:s,to:i}})}}function UL(e){return!!e&&!!e.target}const $L=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],BL="BrowserApiErrors",FL=((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:BL,setupOnce(){t.setTimeout&&gr(st,"setTimeout",cE),t.setInterval&&gr(st,"setInterval",cE),t.requestAnimationFrame&&gr(st,"requestAnimationFrame",qL),t.XMLHttpRequest&&"XMLHttpRequest"in st&&gr(XMLHttpRequest.prototype,"send",VL);const n=t.eventTarget;n&&(Array.isArray(n)?n:$L).forEach(i=>KL(i,t))}}}),HL=FL;function cE(e){return function(...t){const n=t[0];return t[0]=kc(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Xs(e)}`}}),e.apply(this,t)}}function qL(e){return function(t){return e.apply(this,[kc(t,{mechanism:{data:{handler:Xs(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function VL(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&gr(n,i,function(a){const l={mechanism:{data:{handler:Xs(a)},handled:!1,type:`auto.browser.browserapierrors.xhr.${i}`}},f=Vv(a);return f&&(l.mechanism.data.handler=Xs(f)),kc(a,l)})}),e.apply(this,t)}}function KL(e,t){const s=st[e]?.prototype;s?.hasOwnProperty?.("addEventListener")&&(gr(s,"addEventListener",function(i){return function(a,l,f){try{GL(l)&&(l.handleEvent=kc(l.handleEvent,{mechanism:{data:{handler:Xs(l),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&ZL(this,a,l),i.apply(this,[a,kc(l,{mechanism:{data:{handler:Xs(l),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),f])}}),gr(s,"removeEventListener",function(i){return function(a,l,f){try{const d=l.__sentry_wrapped__;d&&i.call(this,a,d,f)}catch{}return i.call(this,a,l,f)}}))}function GL(e){return typeof e.handleEvent=="function"}function ZL(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const YL=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof st.document>"u"){Kr&&be.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Dw({ignoreDuration:!0}),zw(),t==="route"&&yb(({from:n,to:s})=>{n!==void 0&&n!==s&&(Dw({ignoreDuration:!0}),zw())})}}},XL="CultureContext",QL=(()=>({name:XL,preprocessEvent(e){const t=JL();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})}})),WL=QL;function JL(){try{const e=st.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}const e4="GlobalHandlers",t4=((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:e4,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(r4(n),lE("onerror")),t.onunhandledrejection&&(s4(n),lE("onunhandledrejection"))}}}),n4=t4;function r4(e){tR(t=>{const{stackParser:n,attachStacktrace:s}=R1();if(gt()!==e||a1())return;const{msg:i,url:a,line:l,column:f,error:d}=t,p=a4(hb(n,d||i,void 0,s,!1),a,l,f);p.level="error",zR(p,{originalException:d,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function s4(e){nR(t=>{const{stackParser:n,attachStacktrace:s}=R1();if(gt()!==e||a1())return;const i=o4(t),a=Tc(i)?i4(i):hb(n,i,void 0,s,!0);a.level="error",zR(a,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function o4(e){if(Tc(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}function i4(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function a4(e,t,n,s){const i=e.exception=e.exception||{},a=i.values=i.values||[],l=a[0]=a[0]||{},f=l.stacktrace=l.stacktrace||{},d=f.frames=f.frames||[],p=s,g=n,y=c4(t)??Nu();return d.length===0&&d.push({colno:p,filename:y,function:oa,in_app:!0,lineno:g}),e}function lE(e){Kr&&be.log(`Global Handler attached: ${e}`)}function R1(){return gt()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function c4(e){if(!(!Gs(e)||e.length===0))return e.startsWith("data:")?`<${Zo(e,!1)}>`:e}const l4=()=>({name:"HttpContext",preprocessEvent(e){if(!st.navigator&&!st.location&&!st.document)return;const t=ub(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}}),u4="cause",f4=5,d4="LinkedErrors",h4=((e={})=>{const t=e.limit||f4,n=e.key||u4;return{name:d4,preprocessEvent(s,i,a){const l=a.getOptions();YD(fb,l.stackParser,n,t,s,i)}}}),p4=h4;function m4(){return g4()?(Kr&&pa(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function g4(){if(typeof st.window>"u")return!1;const e=st;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;const n=Nu(),s=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(st===st.top&&s.some(a=>n.startsWith(`${a}://`)))}function y4(e){return[BD(),zD(),az(),HL(),OL(),n4(),p4(),tz(),l4(),WL(),YL()]}function v4(e={}){const t=!e.skipBrowserExtensionCheck&&m4();let n=e.defaultIntegrations==null?y4():e.defaultIntegrations;const s={...e,enabled:t?!1:e.enabled,stackParser:LM(e.stackParser||jL),integrations:qP({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||mL};return ED(Kz,s)}function b4(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function N1(e){try{return new URL(e,st.location.origin).href}catch{return}}function x4(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function j1(e){try{return new Headers(e)}catch{return}}const uE=new WeakMap,Qg=new Map,A1={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function S4(e,t){const{traceFetch:n,traceXHR:s,trackFetchStreamPerformance:i,shouldCreateSpanForRequest:a,enableHTTPTimings:l,tracePropagationTargets:f,onRequestSpanStart:d,onRequestSpanEnd:p}={...A1,...t},g=typeof a=="function"?a:S=>!0,y=S=>_4(S,f),b={},x=e.getOptions().propagateTraceparent;n&&(e.addEventProcessor(S=>(S.type==="transaction"&&S.spans&&S.spans.forEach(w=>{if(w.op==="http.client"){const T=Qg.get(w.span_id);T&&(w.timestamp=T/1e3,Qg.delete(w.span_id))}}),S)),i&&Ez(S=>{if(S.response){const w=uE.get(S.response);w&&S.endTimestamp&&Qg.set(w,S.endTimestamp)}}),o1(S=>{const w=cz(S,g,y,b,{propagateTraceparent:x,onRequestSpanEnd:p});if(S.response&&S.fetchData.__span&&uE.set(S.response,S.fetchData.__span),w){const T=N1(S.fetchData.url),C=T?na(T).host:void 0;w.setAttributes({"http.url":T?Zo(T):void 0,"server.address":C}),l&&fE(w),d?.(w,{headers:S.headers})}})),s&&T1(S=>{const w=w4(S,g,y,b,x,p);w&&(l&&fE(w),d?.(w,{headers:j1(S.xhr.__sentry_xhr_v3__?.request_headers)}))})}function fE(e){const{url:t}=mt(e).data;if(!t||typeof t!="string")return;const n=Oc("resource",({entries:s})=>{s.forEach(i=>{x4(i)&&i.name.endsWith(t)&&(e.setAttributes(E1(i)),setTimeout(n))})})}function _4(e,t){const n=Nu();if(n){let s,i;try{s=new URL(e,n),i=new URL(n).origin}catch{return!1}const a=s.origin===i;return t?Go(s.toString(),t)||a&&Go(s.pathname,t):a}else{const s=!!e.match(/^\/(?!\/)/);return t?Go(e,t):s}}function w4(e,t,n,s,i,a){const l=e.xhr,f=l?.[uc];if(!l||l.__sentry_own_request__||!f)return;const{url:d,method:p}=f,g=rs()&&t(d);if(e.endTimestamp&&g){const C=l.__sentry_xhr_span_id__;if(!C)return;const O=s[C];O&&f.status_code!==void 0&&(hR(O,f.status_code),O.end(),a?.(O,{headers:j1(cL(l)),error:e.error}),delete s[C]);return}const y=N1(d),b=na(y||d),x=Zo(ND(d)),S=!!Xn(),w=g&&S?Gc({name:`${p} ${x}`,attributes:{url:Zo(d),type:"xhr","http.method":p,"http.url":y?Zo(y):void 0,"server.address":b?.host,[mn]:"auto.http.browser",[eo]:"http.client",...b?.search&&{"http.query":b?.search},...b?.hash&&{"http.fragment":b?.hash}}}):new ei;l.__sentry_xhr_span_id__=w.spanContext().spanId,s[l.__sentry_xhr_span_id__]=w,n(d)&&E4(l,rs()&&S?w:void 0,i);const T=gt();return T&&T.emit("beforeOutgoingRequestSpan",w,e),w}function E4(e,t,n){const{"sentry-trace":s,baggage:i,traceparent:a}=e1({span:t,propagateTraceparent:n});s&&T4(e,s,i,a)}function T4(e,t,n,s){const i=e.__sentry_xhr_v3__?.request_headers;if(!(i?.["sentry-trace"]||!e.setRequestHeader))try{if(e.setRequestHeader("sentry-trace",t),s&&!i?.traceparent&&e.setRequestHeader("traceparent",s),n){const a=i?.baggage;(!a||!b4(a))&&e.setRequestHeader("baggage",n)}}catch{}}function C4(){st.document?st.document.addEventListener("visibilitychange",()=>{const e=Xn();if(!e)return;const t=Dn(e);if(st.document.hidden&&t){const n="cancelled",{op:s,status:i}=mt(t);Kr&&be.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${s}`),i||t.setStatus({code:hn,message:n}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):Kr&&be.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const R4=3600,k1="sentry_previous_trace",N4="sentry.previous_trace";function j4(e,{linkPreviousTrace:t,consistentTraceSampling:n}){const s=t==="session-storage";let i=s?O4():void 0;e.on("spanStart",l=>{if(Dn(l)!==l)return;const f=bt().getPropagationContext();i=A4(i,l,f),s&&k4(i)});let a=!0;n&&e.on("beforeSampling",l=>{if(!i)return;const f=bt(),d=f.getPropagationContext();if(a&&d.parentSpanId){a=!1;return}f.setPropagationContext({...d,dsc:{...d.dsc,sample_rate:String(i.sampleRate),sampled:String(uv(i.spanContext))},sampleRand:i.sampleRand}),l.parentSampled=uv(i.spanContext),l.parentSampleRate=i.sampleRate,l.spanAttributes={...l.spanAttributes,[dR]:i.sampleRate}})}function A4(e,t,n){const s=mt(t);function i(){try{return Number(n.dsc?.sample_rate)??Number(s.data?.[Kv])}catch{return 0}}const a={spanContext:t.spanContext(),startTimestamp:s.start_timestamp,sampleRate:i(),sampleRand:n.sampleRand};if(!e)return a;const l=e.spanContext;return l.traceId===s.trace_id?e:(Date.now()/1e3-e.startTimestamp<=R4&&(Kr&&be.log(`Adding previous_trace \`${JSON.stringify(l)}\` link to span \`${JSON.stringify({op:s.op,...t.spanContext()})}\``),t.addLink({context:l,attributes:{[fI]:"previous_trace"}}),t.setAttribute(N4,`${l.traceId}-${l.spanId}-${uv(l)?1:0}`)),a)}function k4(e){try{st.sessionStorage.setItem(k1,JSON.stringify(e))}catch(t){Kr&&be.warn("Could not store previous trace in sessionStorage",t)}}function O4(){try{const e=st.sessionStorage?.getItem(k1);return JSON.parse(e)}catch{return}}function uv(e){return e.traceFlags===1}const M4="BrowserTracing",I4={...Wd,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,enableElementTiming:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...A1},P4=((e={})=>{const t={name:void 0,source:void 0},n=st.document,{enableInp:s,enableElementTiming:i,enableLongTask:a,enableLongAnimationFrame:l,_experiments:{enableInteractions:f,enableStandaloneClsSpans:d,enableStandaloneLcpSpans:p},beforeStartSpan:g,idleTimeout:y,finalTimeout:b,childSpanTimeout:x,markBackgroundSpan:S,traceFetch:w,traceXHR:T,trackFetchStreamPerformance:C,shouldCreateSpanForRequest:O,enableHTTPTimings:j,ignoreResourceSpans:R,ignorePerformanceApiSpans:I,instrumentPageLoad:z,instrumentNavigation:N,detectRedirects:A,linkPreviousTrace:D,consistentTraceSampling:Q,enableReportPageLoaded:B,onRequestSpanStart:U,onRequestSpanEnd:Z}={...I4,...e};let K,ee,P;function G(q,V,L=!0){const M=V.op==="pageload",H=V.name,W=g?g(V):V,Y=W.attributes||{};if(H!==W.name&&(Y[ys]="custom",W.attributes=Y),!L){const fe=ma();Gc({...W,startTime:fe}).end(fe);return}t.name=W.name,t.source=Y[ys];const ae=PR(W,{idleTimeout:y,finalTimeout:b,childSpanTimeout:x,disableAutoFinish:M,beforeSpanEnd:fe=>{K?.(),D2(fe,{recordClsOnPageloadSpan:!d,recordLcpOnPageloadSpan:!p,ignoreResourceSpans:R,ignorePerformanceApiSpans:I}),pE(q,void 0);const Se=bt(),pe=Se.getPropagationContext();Se.setPropagationContext({...pe,traceId:ae.spanContext().traceId,sampled:ui(ae),dsc:to(fe)}),M&&(P=void 0)},trimIdleSpanEndTimestamp:!B});M&&B&&(P=ae),pE(q,ae);function se(){n&&["interactive","complete"].includes(n.readyState)&&q.emit("idleSpanEnableAutoFinish",ae)}M&&!B&&n&&(n.addEventListener("readystatechange",()=>{se()}),se())}return{name:M4,setup(q){if($I(),K=j2({recordClsStandaloneSpans:d||!1,recordLcpStandaloneSpans:p||!1,client:q}),s&&uL(),i&&Z2(),l&&ct.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?k2():a&&A2(),f&&O2(),A&&n){const L=()=>{ee=cn()};addEventListener("click",L,{capture:!0}),addEventListener("keydown",L,{capture:!0,passive:!0})}function V(){const L=bu(q);L&&!mt(L).timestamp&&(Kr&&be.log(`[Tracing] Finishing current active span with op: ${mt(L).op}`),L.setAttribute(mu,"cancelled"),L.end())}q.on("startNavigationSpan",(L,M)=>{if(gt()!==q)return;if(M?.isRedirect){Kr&&be.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),G(q,{op:"navigation.redirect",...L},!1);return}ee=void 0,V(),ss().setPropagationContext({traceId:Ws(),sampleRand:Math.random(),propagationSpanId:rs()?void 0:Zs()});const H=bt();H.setPropagationContext({traceId:Ws(),sampleRand:Math.random(),propagationSpanId:rs()?void 0:Zs()}),H.setSDKProcessingMetadata({normalizedRequest:void 0}),G(q,{op:"navigation",...L,parentSpan:null,forceTransaction:!0})}),q.on("startPageLoadSpan",(L,M={})=>{if(gt()!==q)return;V();const H=M.sentryTrace||dE("sentry-trace")||hE("sentry-trace"),W=M.baggage||dE("baggage")||hE("baggage"),Y=OI(H,W),ae=bt();ae.setPropagationContext(Y),rs()||(ae.getPropagationContext().propagationSpanId=Zs()),ae.setSDKProcessingMetadata({normalizedRequest:ub()}),G(q,{op:"pageload",...L})}),q.on("endPageloadSpan",()=>{B&&P&&(P.setAttribute(mu,"reportPageLoaded"),P.end())})},afterAllSetup(q){let V=Nu();if(D!=="off"&&j4(q,{linkPreviousTrace:D,consistentTraceSampling:Q}),st.location){if(z){const L=Sr();D4(q,{name:st.location.pathname,startTime:L?L/1e3:void 0,attributes:{[ys]:"url",[mn]:"auto.pageload.browser"}})}N&&yb(({to:L,from:M})=>{if(M===void 0&&V?.indexOf(L)!==-1){V=void 0;return}V=void 0;const H=WR(L),W=bu(q),Y=W&&A&&U4(W,ee);z4(q,{name:H?.pathname||st.location.pathname,attributes:{[ys]:"url",[mn]:"auto.navigation.browser"}},{url:L,isRedirect:Y})})}S&&C4(),f&&L4(q,y,b,x,t),s&&hL(),S4(q,{traceFetch:w,traceXHR:T,trackFetchStreamPerformance:C,tracePropagationTargets:q.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:O,enableHTTPTimings:j,onRequestSpanStart:U,onRequestSpanEnd:Z})}}});function D4(e,t,n){e.emit("startPageLoadSpan",t,n),bt().setTransactionName(t.name);const s=bu(e);return s&&e.emit("afterStartPageLoadSpan",s),s}function z4(e,t,n){const{url:s,isRedirect:i}=n||{};e.emit("beforeStartNavigationSpan",t,{isRedirect:i}),e.emit("startNavigationSpan",t,{isRedirect:i});const a=bt();return a.setTransactionName(t.name),s&&!i&&a.setSDKProcessingMetadata({normalizedRequest:{...ub(),url:s}}),bu(e)}function dE(e){return st.document?.querySelector(`meta[name=${e}]`)?.getAttribute("content")||void 0}function hE(e){return st.performance?.getEntriesByType?.("navigation")[0]?.serverTiming?.find(s=>s.name===e)?.description}function L4(e,t,n,s,i){const a=st.document;let l;const f=()=>{const d="ui.action.click",p=bu(e);if(p){const g=mt(p).op;if(["navigation","pageload"].includes(g)){Kr&&be.warn(`[Tracing] Did not create ${d} span because a pageload or navigation span is in progress.`);return}}if(l&&(l.setAttribute(mu,"interactionInterrupted"),l.end(),l=void 0),!i.name){Kr&&be.warn(`[Tracing] Did not create ${d} transaction because _latestRouteName is missing.`);return}l=PR({name:i.name,op:d,attributes:{[ys]:i.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:s})};a&&addEventListener("click",f,{capture:!0})}const O1="_sentry_idleSpan";function bu(e){return e[O1]}function pE(e,t){Yn(e,O1,t)}const mE=1.5;function U4(e,t){const n=mt(e),s=ma(),i=n.start_timestamp;return!(s-i>mE||t&&s-t<=mE)}function M1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wg={exports:{}},Ke={};var gE;function $4(){if(gE)return Ke;gE=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,T={};function C(M,H,W){this.props=M,this.context=H,this.refs=T,this.updater=W||S}C.prototype.isReactComponent={},C.prototype.setState=function(M,H){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,H,"setState")},C.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function O(){}O.prototype=C.prototype;function j(M,H,W){this.props=M,this.context=H,this.refs=T,this.updater=W||S}var R=j.prototype=new O;R.constructor=j,w(R,C.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function z(){}var N={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function D(M,H,W){var Y=W.ref;return{$$typeof:e,type:M,key:H,ref:Y!==void 0?Y:null,props:W}}function Q(M,H){return D(M.type,H,M.props)}function B(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function U(M){var H={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(W){return H[W]})}var Z=/\/+/g;function K(M,H){return typeof M=="object"&&M!==null&&M.key!=null?U(""+M.key):H.toString(36)}function ee(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(z,z):(M.status="pending",M.then(function(H){M.status==="pending"&&(M.status="fulfilled",M.value=H)},function(H){M.status==="pending"&&(M.status="rejected",M.reason=H)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function P(M,H,W,Y,ae){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var fe=!1;if(M===null)fe=!0;else switch(se){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(M.$$typeof){case e:case t:fe=!0;break;case g:return fe=M._init,P(fe(M._payload),H,W,Y,ae)}}if(fe)return ae=ae(M),fe=Y===""?"."+K(M,0):Y,I(ae)?(W="",fe!=null&&(W=fe.replace(Z,"$&/")+"/"),P(ae,H,W,"",function(Me){return Me})):ae!=null&&(B(ae)&&(ae=Q(ae,W+(ae.key==null||M&&M.key===ae.key?"":(""+ae.key).replace(Z,"$&/")+"/")+fe)),H.push(ae)),1;fe=0;var Se=Y===""?".":Y+":";if(I(M))for(var pe=0;pe<M.length;pe++)Y=M[pe],se=Se+K(Y,pe),fe+=P(Y,H,W,se,ae);else if(pe=x(M),typeof pe=="function")for(M=pe.call(M),pe=0;!(Y=M.next()).done;)Y=Y.value,se=Se+K(Y,pe++),fe+=P(Y,H,W,se,ae);else if(se==="object"){if(typeof M.then=="function")return P(ee(M),H,W,Y,ae);throw H=String(M),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return fe}function G(M,H,W){if(M==null)return M;var Y=[],ae=0;return P(M,Y,"","",function(se){return H.call(W,se,ae++)}),Y}function q(M){if(M._status===-1){var H=M._result;H=H(),H.then(function(W){(M._status===0||M._status===-1)&&(M._status=1,M._result=W)},function(W){(M._status===0||M._status===-1)&&(M._status=2,M._result=W)}),M._status===-1&&(M._status=0,M._result=H)}if(M._status===1)return M._result.default;throw M._result}var V=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},L={map:G,forEach:function(M,H,W){G(M,function(){H.apply(this,arguments)},W)},count:function(M){var H=0;return G(M,function(){H++}),H},toArray:function(M){return G(M,function(H){return H})||[]},only:function(M){if(!B(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return Ke.Activity=y,Ke.Children=L,Ke.Component=C,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=j,Ke.StrictMode=s,Ke.Suspense=d,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(M){return N.H.useMemoCache(M)}},Ke.cache=function(M){return function(){return M.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(M,H,W){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var Y=w({},M.props),ae=M.key;if(H!=null)for(se in H.key!==void 0&&(ae=""+H.key),H)!A.call(H,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&H.ref===void 0||(Y[se]=H[se]);var se=arguments.length-2;if(se===1)Y.children=W;else if(1<se){for(var fe=Array(se),Se=0;Se<se;Se++)fe[Se]=arguments[Se+2];Y.children=fe}return D(M.type,ae,Y)},Ke.createContext=function(M){return M={$$typeof:l,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:a,_context:M},M},Ke.createElement=function(M,H,W){var Y,ae={},se=null;if(H!=null)for(Y in H.key!==void 0&&(se=""+H.key),H)A.call(H,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(ae[Y]=H[Y]);var fe=arguments.length-2;if(fe===1)ae.children=W;else if(1<fe){for(var Se=Array(fe),pe=0;pe<fe;pe++)Se[pe]=arguments[pe+2];ae.children=Se}if(M&&M.defaultProps)for(Y in fe=M.defaultProps,fe)ae[Y]===void 0&&(ae[Y]=fe[Y]);return D(M,se,ae)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(M){return{$$typeof:f,render:M}},Ke.isValidElement=B,Ke.lazy=function(M){return{$$typeof:g,_payload:{_status:-1,_result:M},_init:q}},Ke.memo=function(M,H){return{$$typeof:p,type:M,compare:H===void 0?null:H}},Ke.startTransition=function(M){var H=N.T,W={};N.T=W;try{var Y=M(),ae=N.S;ae!==null&&ae(W,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(z,V)}catch(se){V(se)}finally{H!==null&&W.types!==null&&(H.types=W.types),N.T=H}},Ke.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Ke.use=function(M){return N.H.use(M)},Ke.useActionState=function(M,H,W){return N.H.useActionState(M,H,W)},Ke.useCallback=function(M,H){return N.H.useCallback(M,H)},Ke.useContext=function(M){return N.H.useContext(M)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(M,H){return N.H.useDeferredValue(M,H)},Ke.useEffect=function(M,H){return N.H.useEffect(M,H)},Ke.useEffectEvent=function(M){return N.H.useEffectEvent(M)},Ke.useId=function(){return N.H.useId()},Ke.useImperativeHandle=function(M,H,W){return N.H.useImperativeHandle(M,H,W)},Ke.useInsertionEffect=function(M,H){return N.H.useInsertionEffect(M,H)},Ke.useLayoutEffect=function(M,H){return N.H.useLayoutEffect(M,H)},Ke.useMemo=function(M,H){return N.H.useMemo(M,H)},Ke.useOptimistic=function(M,H){return N.H.useOptimistic(M,H)},Ke.useReducer=function(M,H,W){return N.H.useReducer(M,H,W)},Ke.useRef=function(M){return N.H.useRef(M)},Ke.useState=function(M){return N.H.useState(M)},Ke.useSyncExternalStore=function(M,H,W){return N.H.useSyncExternalStore(M,H,W)},Ke.useTransition=function(){return N.H.useTransition()},Ke.version="19.2.4",Ke}var yE;function Hu(){return yE||(yE=1,Wg.exports=$4()),Wg.exports}var _=Hu();const Mc=M1(_),I1=AM({__proto__:null,default:Mc},[_]);function B4(e){const t={...e};return JR(t,"react"),DP("react",{version:_.version}),v4(t)}function ue(e,t,n){function s(f,d){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:d,constr:l,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,d);const p=l.prototype,g=Object.keys(p);for(let y=0;y<g.length;y++){const b=g[y];b in f||(f[b]=p[b].bind(f))}}const i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function l(f){var d;const p=n?.Parent?new a:this;s(p,f),(d=p._zod).deferred??(d.deferred=[]);for(const g of p._zod.deferred)g();return p}return Object.defineProperty(l,"init",{value:s}),Object.defineProperty(l,Symbol.hasInstance,{value:f=>n?.Parent&&f instanceof n.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class gc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class P1 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const D1={};function ni(e){return D1}function z1(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,i])=>t.indexOf(+s)===-1).map(([s,i])=>i)}function fv(e,t){return typeof t=="bigint"?t.toString():t}function vb(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function bb(e){return e==null}function xb(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function F4(e,t){const n=(e.toString().split(".")[1]||"").length,s=t.toString();let i=(s.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(s)){const d=s.match(/\d?e-(\d?)/);d?.[1]&&(i=Number.parseInt(d[1]))}const a=n>i?n:i,l=Number.parseInt(e.toFixed(a).replace(".","")),f=Number.parseInt(t.toFixed(a).replace(".",""));return l%f/10**a}const vE=Symbol("evaluating");function wt(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==vE)return s===void 0&&(s=vE,s=n()),s},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function ya(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fi(...e){const t={};for(const n of e){const s=Object.getOwnPropertyDescriptors(n);Object.assign(t,s)}return Object.defineProperties({},t)}function bE(e){return JSON.stringify(e)}function H4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const L1="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function wh(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const q4=vb(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ic(e){if(wh(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(wh(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function U1(e){return Ic(e)?{...e}:Array.isArray(e)?[...e]:e}const V4=new Set(["string","number","symbol"]);function Pc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function di(e,t,n){const s=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(s._zod.parent=e),s}function De(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function K4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const G4={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Z4(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const a=fi(e._zod.def,{get shape(){const l={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(l[f]=n.shape[f])}return ya(this,"shape",l),l},checks:[]});return di(e,a)}function Y4(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=fi(e._zod.def,{get shape(){const l={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete l[f]}return ya(this,"shape",l),l},checks:[]});return di(e,a)}function X4(e,t){if(!Ic(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const a=e._zod.def.shape;for(const l in t)if(Object.getOwnPropertyDescriptor(a,l)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=fi(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return ya(this,"shape",a),a}});return di(e,i)}function Q4(e,t){if(!Ic(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=fi(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return ya(this,"shape",s),s}});return di(e,n)}function W4(e,t){const n=fi(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return ya(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return di(e,n)}function J4(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const l=fi(t._zod.def,{get shape(){const f=t._zod.def.shape,d={...f};if(n)for(const p in n){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(d[p]=e?new e({type:"optional",innerType:f[p]}):f[p])}else for(const p in f)d[p]=e?new e({type:"optional",innerType:f[p]}):f[p];return ya(this,"shape",d),d},checks:[]});return di(t,l)}function e5(e,t,n){const s=fi(t._zod.def,{get shape(){const i=t._zod.def.shape,a={...i};if(n)for(const l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(a[l]=new e({type:"nonoptional",innerType:i[l]}))}else for(const l in i)a[l]=new e({type:"nonoptional",innerType:i[l]});return ya(this,"shape",a),a}});return di(t,s)}function fc(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function dc(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}function Rd(e){return typeof e=="string"?e:e?.message}function ri(e,t,n){const s={...e,path:e.path??[]};if(!e.message){const i=Rd(e.inst?._zod.def?.error?.(e))??Rd(t?.error?.(e))??Rd(n.customError?.(e))??Rd(n.localeError?.(e))??"Invalid input";s.message=i}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function Sb(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function xu(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}const $1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,fv,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},B1=ue("$ZodError",$1),F1=ue("$ZodError",$1,{Parent:Error});function t5(e,t=n=>n.message){const n={},s=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):s.push(t(i));return{formErrors:s,fieldErrors:n}}function n5(e,t=n=>n.message){const n={_errors:[]},s=i=>{for(const a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(l=>s({issues:l}));else if(a.code==="invalid_key")s({issues:a.issues});else if(a.code==="invalid_element")s({issues:a.issues});else if(a.path.length===0)n._errors.push(t(a));else{let l=n,f=0;for(;f<a.path.length;){const d=a.path[f];f===a.path.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(a))):l[d]=l[d]||{_errors:[]},l=l[d],f++}}};return s(e),n}const _b=e=>(t,n,s,i)=>{const a=s?Object.assign(s,{async:!1}):{async:!1},l=t._zod.run({value:n,issues:[]},a);if(l instanceof Promise)throw new gc;if(l.issues.length){const f=new(i?.Err??e)(l.issues.map(d=>ri(d,a,ni())));throw L1(f,i?.callee),f}return l.value},wb=e=>async(t,n,s,i)=>{const a=s?Object.assign(s,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},a);if(l instanceof Promise&&(l=await l),l.issues.length){const f=new(i?.Err??e)(l.issues.map(d=>ri(d,a,ni())));throw L1(f,i?.callee),f}return l.value},op=e=>(t,n,s)=>{const i=s?{...s,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new gc;return a.issues.length?{success:!1,error:new(e??B1)(a.issues.map(l=>ri(l,i,ni())))}:{success:!0,data:a.value}},r5=op(F1),ip=e=>async(t,n,s)=>{const i=s?Object.assign(s,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(l=>ri(l,i,ni())))}:{success:!0,data:a.value}},s5=ip(F1),o5=e=>(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return _b(e)(t,n,i)},i5=e=>(t,n,s)=>_b(e)(t,n,s),a5=e=>async(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return wb(e)(t,n,i)},c5=e=>async(t,n,s)=>wb(e)(t,n,s),l5=e=>(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return op(e)(t,n,i)},u5=e=>(t,n,s)=>op(e)(t,n,s),f5=e=>async(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return ip(e)(t,n,i)},d5=e=>async(t,n,s)=>ip(e)(t,n,s),h5=/^[cC][^\s-]{8,}$/,p5=/^[0-9a-z]+$/,m5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,g5=/^[0-9a-vA-V]{20}$/,y5=/^[A-Za-z0-9]{27}$/,v5=/^[a-zA-Z0-9_-]{21}$/,b5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,x5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xE=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,S5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function w5(){return new RegExp(_5,"u")}const E5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,T5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,C5=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,R5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,N5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,H1=/^[A-Za-z0-9_-]*$/,j5=/^\+[1-9]\d{6,14}$/,q1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",A5=new RegExp(`^${q1}$`);function V1(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function k5(e){return new RegExp(`^${V1(e)}$`)}function O5(e){const t=V1({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${q1}T(?:${s})$`)}const M5=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},I5=/^-?\d+$/,K1=/^-?\d+(?:\.\d+)?$/,P5=/^(?:true|false)$/i,D5=/^[^A-Z]*$/,z5=/^[^a-z]*$/,Qn=ue("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),G1={number:"number",bigint:"bigint",object:"date"},Z1=ue("$ZodCheckLessThan",(e,t)=>{Qn.init(e,t);const n=G1[typeof t.value];e._zod.onattach.push(s=>{const i=s._zod.bag,a=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Y1=ue("$ZodCheckGreaterThan",(e,t)=>{Qn.init(e,t);const n=G1[typeof t.value];e._zod.onattach.push(s=>{const i=s._zod.bag,a=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),L5=ue("$ZodCheckMultipleOf",(e,t)=>{Qn.init(e,t),e._zod.onattach.push(n=>{var s;(s=n._zod.bag).multipleOf??(s.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):F4(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),U5=ue("$ZodCheckNumberFormat",(e,t)=>{Qn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),s=n?"int":"number",[i,a]=G4[t.format];e._zod.onattach.push(l=>{const f=l._zod.bag;f.format=t.format,f.minimum=i,f.maximum=a,n&&(f.pattern=I5)}),e._zod.check=l=>{const f=l.value;if(n){if(!Number.isInteger(f)){l.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?l.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):l.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort});return}}f<i&&l.issues.push({origin:"number",input:f,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),f>a&&l.issues.push({origin:"number",input:f,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),$5=ue("$ZodCheckMaxLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!bb(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const i=s.value;if(i.length<=t.maximum)return;const l=Sb(i);s.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),B5=ue("$ZodCheckMinLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!bb(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const i=s.value;if(i.length>=t.minimum)return;const l=Sb(i);s.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),F5=ue("$ZodCheckLengthEquals",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!bb(i)&&i.length!==void 0}),e._zod.onattach.push(s=>{const i=s._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=s=>{const i=s.value,a=i.length;if(a===t.length)return;const l=Sb(i),f=a>t.length;s.issues.push({origin:l,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),ap=ue("$ZodCheckStringFormat",(e,t)=>{var n,s;Qn.init(e,t),e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),H5=ue("$ZodCheckRegex",(e,t)=>{ap.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),q5=ue("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=D5),ap.init(e,t)}),V5=ue("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=z5),ap.init(e,t)}),K5=ue("$ZodCheckIncludes",(e,t)=>{Qn.init(e,t);const n=Pc(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(i=>{const a=i._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(s)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),G5=ue("$ZodCheckStartsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`^${Pc(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),Z5=ue("$ZodCheckEndsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`.*${Pc(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),Y5=ue("$ZodCheckOverwrite",(e,t)=>{Qn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class X5{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const s=t.split(`
|
|
22
22
|
`).filter(l=>l),i=Math.min(...s.map(l=>l.length-l.trimStart().length)),a=s.map(l=>l.slice(i)).map(l=>" ".repeat(this.indent*2)+l);for(const l of a)this.content.push(l)}compile(){const t=Function,n=this?.args,i=[...(this?.content??[""]).map(a=>` ${a}`)];return new t(...n,i.join(`
|
|
23
23
|
`))}}const Q5={major:4,minor:3,patch:6},Ft=ue("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Q5;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const i of s)for(const a of i._zod.onattach)a(e);if(s.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(l,f,d)=>{let p=fc(l),g;for(const y of f){if(y._zod.def.when){if(!y._zod.def.when(l))continue}else if(p)continue;const b=l.issues.length,x=y._zod.check(l);if(x instanceof Promise&&d?.async===!1)throw new gc;if(g||x instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await x,l.issues.length!==b&&(p||(p=fc(l,b)))});else{if(l.issues.length===b)continue;p||(p=fc(l,b))}}return g?g.then(()=>l):l},a=(l,f,d)=>{if(fc(l))return l.aborted=!0,l;const p=i(f,s,d);if(p instanceof Promise){if(d.async===!1)throw new gc;return p.then(g=>e._zod.parse(g,d))}return e._zod.parse(p,d)};e._zod.run=(l,f)=>{if(f.skipChecks)return e._zod.parse(l,f);if(f.direction==="backward"){const p=e._zod.parse({value:l.value,issues:[]},{...f,skipChecks:!0});return p instanceof Promise?p.then(g=>a(g,l,f)):a(p,l,f)}const d=e._zod.parse(l,f);if(d instanceof Promise){if(f.async===!1)throw new gc;return d.then(p=>i(p,s,f))}return i(d,s,f)}}wt(e,"~standard",()=>({validate:i=>{try{const a=r5(e,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return s5(e,i).then(l=>l.success?{value:l.data}:{issues:l.error?.issues})}},vendor:"zod",version:1}))}),Eb=ue("$ZodString",(e,t)=>{Ft.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??M5(e._zod.bag),e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Bt=ue("$ZodStringFormat",(e,t)=>{ap.init(e,t),Eb.init(e,t)}),W5=ue("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=x5),Bt.init(e,t)}),J5=ue("$ZodUUID",(e,t)=>{if(t.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(s===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=xE(s))}else t.pattern??(t.pattern=xE());Bt.init(e,t)}),eU=ue("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=S5),Bt.init(e,t)}),tU=ue("$ZodURL",(e,t)=>{Bt.init(e,t),e._zod.check=n=>{try{const s=n.value.trim(),i=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),nU=ue("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=w5()),Bt.init(e,t)}),rU=ue("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=v5),Bt.init(e,t)}),sU=ue("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=h5),Bt.init(e,t)}),oU=ue("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=p5),Bt.init(e,t)}),iU=ue("$ZodULID",(e,t)=>{t.pattern??(t.pattern=m5),Bt.init(e,t)}),aU=ue("$ZodXID",(e,t)=>{t.pattern??(t.pattern=g5),Bt.init(e,t)}),cU=ue("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=y5),Bt.init(e,t)}),lU=ue("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=O5(t)),Bt.init(e,t)}),uU=ue("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=A5),Bt.init(e,t)}),fU=ue("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=k5(t)),Bt.init(e,t)}),dU=ue("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=b5),Bt.init(e,t)}),hU=ue("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=E5),Bt.init(e,t),e._zod.bag.format="ipv4"}),pU=ue("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=T5),Bt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),mU=ue("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=C5),Bt.init(e,t)}),gU=ue("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=R5),Bt.init(e,t),e._zod.check=n=>{const s=n.value.split("/");try{if(s.length!==2)throw new Error;const[i,a]=s;if(!a)throw new Error;const l=Number(a);if(`${l}`!==a)throw new Error;if(l<0||l>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function X1(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const yU=ue("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=N5),Bt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{X1(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function vU(e){if(!H1.test(e))return!1;const t=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return X1(n)}const bU=ue("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=H1),Bt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{vU(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),xU=ue("$ZodE164",(e,t)=>{t.pattern??(t.pattern=j5),Bt.init(e,t)});function SU(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[s]=n;if(!s)return!1;const i=JSON.parse(atob(s));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const _U=ue("$ZodJWT",(e,t)=>{Bt.init(e,t),e._zod.check=n=>{SU(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Q1=ue("$ZodNumber",(e,t)=>{Ft.init(e,t),e._zod.pattern=e._zod.bag.pattern??K1,e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...a?{received:a}:{}}),n}}),wU=ue("$ZodNumberFormat",(e,t)=>{U5.init(e,t),Q1.init(e,t)}),EU=ue("$ZodBoolean",(e,t)=>{Ft.init(e,t),e._zod.pattern=P5,e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=!!n.value}catch{}const i=n.value;return typeof i=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),TU=ue("$ZodUnknown",(e,t)=>{Ft.init(e,t),e._zod.parse=n=>n}),CU=ue("$ZodNever",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,s)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function SE(e,t,n){e.issues.length&&t.issues.push(...dc(n,e.issues)),t.value[n]=e.value}const RU=ue("$ZodArray",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,s)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const a=[];for(let l=0;l<i.length;l++){const f=i[l],d=t.element._zod.run({value:f,issues:[]},s);d instanceof Promise?a.push(d.then(p=>SE(p,n,l))):SE(d,n,l)}return a.length?Promise.all(a).then(()=>n):n}});function Eh(e,t,n,s,i){if(e.issues.length){if(i&&!(n in s))return;t.issues.push(...dc(n,e.issues))}e.value===void 0?n in s&&(t.value[n]=void 0):t.value[n]=e.value}function W1(e){const t=Object.keys(e.shape);for(const s of t)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const n=K4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function J1(e,t,n,s,i,a){const l=[],f=i.keySet,d=i.catchall._zod,p=d.def.type,g=d.optout==="optional";for(const y in t){if(f.has(y))continue;if(p==="never"){l.push(y);continue}const b=d.run({value:t[y],issues:[]},s);b instanceof Promise?e.push(b.then(x=>Eh(x,n,y,t,g))):Eh(b,n,y,t,g)}return l.length&&n.issues.push({code:"unrecognized_keys",keys:l,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const NU=ue("$ZodObject",(e,t)=>{if(Ft.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...f};return Object.defineProperty(t,"shape",{value:d}),d}})}const s=vb(()=>W1(t));wt(e._zod,"propValues",()=>{const f=t.shape,d={};for(const p in f){const g=f[p]._zod;if(g.values){d[p]??(d[p]=new Set);for(const y of g.values)d[p].add(y)}}return d});const i=wh,a=t.catchall;let l;e._zod.parse=(f,d)=>{l??(l=s.value);const p=f.value;if(!i(p))return f.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),f;f.value={};const g=[],y=l.shape;for(const b of l.keys){const x=y[b],S=x._zod.optout==="optional",w=x._zod.run({value:p[b],issues:[]},d);w instanceof Promise?g.push(w.then(T=>Eh(T,f,b,p,S))):Eh(w,f,b,p,S)}return a?J1(g,p,f,d,s.value,e):g.length?Promise.all(g).then(()=>f):f}}),jU=ue("$ZodObjectJIT",(e,t)=>{NU.init(e,t);const n=e._zod.parse,s=vb(()=>W1(t)),i=b=>{const x=new X5(["shape","payload","ctx"]),S=s.value,w=j=>{const R=bE(j);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};x.write("const input = payload.value;");const T=Object.create(null);let C=0;for(const j of S.keys)T[j]=`key_${C++}`;x.write("const newResult = {};");for(const j of S.keys){const R=T[j],I=bE(j),N=b[j]?._zod?.optout==="optional";x.write(`const ${R} = ${w(j)};`),N?x.write(`
|
|
24
24
|
if (${R}.issues.length) {
|
|
@@ -56,7 +56,7 @@ Error:`,i)}}function mz(){return tz(e=>{Bu("cls",{metric:e}),p1=e},{reportAllCha
|
|
|
56
56
|
|
|
57
57
|
`)}x.write("payload.value = newResult;"),x.write("return payload;");const O=x.compile();return(j,R)=>O(b,j,R)};let a;const l=wh,f=!D1.jitless,p=f&&q4.value,g=t.catchall;let y;e._zod.parse=(b,x)=>{y??(y=s.value);const S=b.value;return l(S)?f&&p&&x?.async===!1&&x.jitless!==!0?(a||(a=i(t.shape)),b=a(b,x),g?J1([],S,b,x,y,e):b):n(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),b)}});function _E(e,t,n,s){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;const i=e.filter(a=>!fc(a));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(a=>a.issues.map(l=>ri(l,s,ni())))}),t)}const AU=ue("$ZodUnion",(e,t)=>{Ft.init(e,t),wt(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),wt(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),wt(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),wt(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){const i=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${i.map(a=>xb(a.source)).join("|")})$`)}});const n=t.options.length===1,s=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return s(i,a);let l=!1;const f=[];for(const d of t.options){const p=d._zod.run({value:i.value,issues:[]},a);if(p instanceof Promise)f.push(p),l=!0;else{if(p.issues.length===0)return p;f.push(p)}}return l?Promise.all(f).then(d=>_E(d,i,e,a)):_E(f,i,e,a)}}),kU=ue("$ZodIntersection",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,s)=>{const i=n.value,a=t.left._zod.run({value:i,issues:[]},s),l=t.right._zod.run({value:i,issues:[]},s);return a instanceof Promise||l instanceof Promise?Promise.all([a,l]).then(([d,p])=>wE(n,d,p)):wE(n,a,l)}});function dv(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ic(e)&&Ic(t)){const n=Object.keys(t),s=Object.keys(e).filter(a=>n.indexOf(a)!==-1),i={...e,...t};for(const a of s){const l=dv(e[a],t[a]);if(!l.valid)return{valid:!1,mergeErrorPath:[a,...l.mergeErrorPath]};i[a]=l.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let s=0;s<e.length;s++){const i=e[s],a=t[s],l=dv(i,a);if(!l.valid)return{valid:!1,mergeErrorPath:[s,...l.mergeErrorPath]};n.push(l.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function wE(e,t,n){const s=new Map;let i;for(const f of t.issues)if(f.code==="unrecognized_keys"){i??(i=f);for(const d of f.keys)s.has(d)||s.set(d,{}),s.get(d).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const d of f.keys)s.has(d)||s.set(d,{}),s.get(d).r=!0;else e.issues.push(f);const a=[...s].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(a.length&&i&&e.issues.push({...i,keys:a}),fc(e))return e;const l=dv(t.value,n.value);if(!l.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`);return e.value=l.data,e}const OU=ue("$ZodRecord",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,s)=>{const i=n.value;if(!Ic(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const a=[],l=t.keyType._zod.values;if(l){n.value={};const f=new Set;for(const p of l)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){f.add(typeof p=="number"?p.toString():p);const g=t.valueType._zod.run({value:i[p],issues:[]},s);g instanceof Promise?a.push(g.then(y=>{y.issues.length&&n.issues.push(...dc(p,y.issues)),n.value[p]=y.value})):(g.issues.length&&n.issues.push(...dc(p,g.issues)),n.value[p]=g.value)}let d;for(const p in i)f.has(p)||(d=d??[],d.push(p));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:d})}else{n.value={};for(const f of Reflect.ownKeys(i)){if(f==="__proto__")continue;let d=t.keyType._zod.run({value:f,issues:[]},s);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&K1.test(f)&&d.issues.length){const y=t.keyType._zod.run({value:Number(f),issues:[]},s);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");y.issues.length===0&&(d=y)}if(d.issues.length){t.mode==="loose"?n.value[f]=i[f]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(y=>ri(y,s,ni())),input:f,path:[f],inst:e});continue}const g=t.valueType._zod.run({value:i[f],issues:[]},s);g instanceof Promise?a.push(g.then(y=>{y.issues.length&&n.issues.push(...dc(f,y.issues)),n.value[d.value]=y.value})):(g.issues.length&&n.issues.push(...dc(f,g.issues)),n.value[d.value]=g.value)}}return a.length?Promise.all(a).then(()=>n):n}}),MU=ue("$ZodEnum",(e,t)=>{Ft.init(e,t);const n=z1(t.entries),s=new Set(n);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.filter(i=>V4.has(typeof i)).map(i=>typeof i=="string"?Pc(i):i.toString()).join("|")})$`),e._zod.parse=(i,a)=>{const l=i.value;return s.has(l)||i.issues.push({code:"invalid_value",values:n,input:l,inst:e}),i}}),IU=ue("$ZodLiteral",(e,t)=>{if(Ft.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(s=>typeof s=="string"?Pc(s):s?Pc(s.toString()):String(s)).join("|")})$`),e._zod.parse=(s,i)=>{const a=s.value;return n.has(a)||s.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),s}}),PU=ue("$ZodTransform",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new P1(e.constructor.name);const i=t.transform(n.value,n);if(s.async)return(i instanceof Promise?i:Promise.resolve(i)).then(l=>(n.value=l,n));if(i instanceof Promise)throw new gc;return n.value=i,n}});function EE(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const eN=ue("$ZodOptional",(e,t)=>{Ft.init(e,t),e._zod.optin="optional",e._zod.optout="optional",wt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),wt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${xb(n.source)})?$`):void 0}),e._zod.parse=(n,s)=>{if(t.innerType._zod.optin==="optional"){const i=t.innerType._zod.run(n,s);return i instanceof Promise?i.then(a=>EE(a,n.value)):EE(i,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,s)}}),DU=ue("$ZodExactOptional",(e,t)=>{eN.init(e,t),wt(e._zod,"values",()=>t.innerType._zod.values),wt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,s)=>t.innerType._zod.run(n,s)}),zU=ue("$ZodNullable",(e,t)=>{Ft.init(e,t),wt(e._zod,"optin",()=>t.innerType._zod.optin),wt(e._zod,"optout",()=>t.innerType._zod.optout),wt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${xb(n.source)}|null)$`):void 0}),wt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,s)=>n.value===null?n:t.innerType._zod.run(n,s)}),LU=ue("$ZodDefault",(e,t)=>{Ft.init(e,t),e._zod.optin="optional",wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,s);return i instanceof Promise?i.then(a=>TE(a,t)):TE(i,t)}});function TE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const UU=ue("$ZodPrefault",(e,t)=>{Ft.init(e,t),e._zod.optin="optional",wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>(s.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,s))}),$U=ue("$ZodNonOptional",(e,t)=>{Ft.init(e,t),wt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(s=>s!==void 0)):void 0}),e._zod.parse=(n,s)=>{const i=t.innerType._zod.run(n,s);return i instanceof Promise?i.then(a=>CE(a,e)):CE(i,e)}});function CE(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const BU=ue("$ZodCatch",(e,t)=>{Ft.init(e,t),wt(e._zod,"optin",()=>t.innerType._zod.optin),wt(e._zod,"optout",()=>t.innerType._zod.optout),wt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const i=t.innerType._zod.run(n,s);return i instanceof Promise?i.then(a=>(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(l=>ri(l,s,ni()))},input:n.value}),n.issues=[]),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>ri(a,s,ni()))},input:n.value}),n.issues=[]),n)}}),FU=ue("$ZodPipe",(e,t)=>{Ft.init(e,t),wt(e._zod,"values",()=>t.in._zod.values),wt(e._zod,"optin",()=>t.in._zod.optin),wt(e._zod,"optout",()=>t.out._zod.optout),wt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,s)=>{if(s.direction==="backward"){const a=t.out._zod.run(n,s);return a instanceof Promise?a.then(l=>Nd(l,t.in,s)):Nd(a,t.in,s)}const i=t.in._zod.run(n,s);return i instanceof Promise?i.then(a=>Nd(a,t.out,s)):Nd(i,t.out,s)}});function Nd(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const HU=ue("$ZodReadonly",(e,t)=>{Ft.init(e,t),wt(e._zod,"propValues",()=>t.innerType._zod.propValues),wt(e._zod,"values",()=>t.innerType._zod.values),wt(e._zod,"optin",()=>t.innerType?._zod?.optin),wt(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const i=t.innerType._zod.run(n,s);return i instanceof Promise?i.then(RE):RE(i)}});function RE(e){return e.value=Object.freeze(e.value),e}const qU=ue("$ZodCustom",(e,t)=>{Qn.init(e,t),Ft.init(e,t),e._zod.parse=(n,s)=>n,e._zod.check=n=>{const s=n.value,i=t.fn(s);if(i instanceof Promise)return i.then(a=>NE(a,n,s,e));NE(i,n,s,e)}});function NE(e,t,n,s){if(!e){const i={code:"custom",input:n,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(i.params=s._zod.def.params),t.issues.push(xu(i))}}var jE;class VU{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const s=n[0];return this._map.set(t,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const s={...this.get(n)??{}};delete s.id;const i={...s,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function KU(){return new VU}(jE=globalThis).__zod_globalRegistry??(jE.__zod_globalRegistry=KU());const ou=globalThis.__zod_globalRegistry;function GU(e,t){return new e({type:"string",...De(t)})}function ZU(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...De(t)})}function AE(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...De(t)})}function YU(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...De(t)})}function XU(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...De(t)})}function QU(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...De(t)})}function WU(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...De(t)})}function JU(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...De(t)})}function e3(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...De(t)})}function t3(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...De(t)})}function n3(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...De(t)})}function r3(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...De(t)})}function s3(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...De(t)})}function o3(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...De(t)})}function i3(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...De(t)})}function a3(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...De(t)})}function c3(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...De(t)})}function l3(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...De(t)})}function u3(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...De(t)})}function f3(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...De(t)})}function d3(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...De(t)})}function h3(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...De(t)})}function p3(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...De(t)})}function m3(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...De(t)})}function g3(e,t){return new e({type:"string",format:"date",check:"string_format",...De(t)})}function y3(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...De(t)})}function v3(e,t){return new e({type:"string",format:"duration",check:"string_format",...De(t)})}function b3(e,t){return new e({type:"number",checks:[],...De(t)})}function x3(e,t){return new e({type:"number",coerce:!0,checks:[],...De(t)})}function S3(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...De(t)})}function _3(e,t){return new e({type:"boolean",...De(t)})}function w3(e){return new e({type:"unknown"})}function E3(e,t){return new e({type:"never",...De(t)})}function kE(e,t){return new Z1({check:"less_than",...De(t),value:e,inclusive:!1})}function Jg(e,t){return new Z1({check:"less_than",...De(t),value:e,inclusive:!0})}function OE(e,t){return new Y1({check:"greater_than",...De(t),value:e,inclusive:!1})}function ey(e,t){return new Y1({check:"greater_than",...De(t),value:e,inclusive:!0})}function ME(e,t){return new L5({check:"multiple_of",...De(t),value:e})}function tN(e,t){return new $5({check:"max_length",...De(t),maximum:e})}function Th(e,t){return new B5({check:"min_length",...De(t),minimum:e})}function nN(e,t){return new F5({check:"length_equals",...De(t),length:e})}function T3(e,t){return new H5({check:"string_format",format:"regex",...De(t),pattern:e})}function C3(e){return new q5({check:"string_format",format:"lowercase",...De(e)})}function R3(e){return new V5({check:"string_format",format:"uppercase",...De(e)})}function N3(e,t){return new K5({check:"string_format",format:"includes",...De(t),includes:e})}function j3(e,t){return new G5({check:"string_format",format:"starts_with",...De(t),prefix:e})}function A3(e,t){return new Z5({check:"string_format",format:"ends_with",...De(t),suffix:e})}function Qc(e){return new Y5({check:"overwrite",tx:e})}function k3(e){return Qc(t=>t.normalize(e))}function O3(){return Qc(e=>e.trim())}function M3(){return Qc(e=>e.toLowerCase())}function I3(){return Qc(e=>e.toUpperCase())}function P3(){return Qc(e=>H4(e))}function D3(e,t,n){return new e({type:"array",element:t,...De(n)})}function z3(e,t,n){return new e({type:"custom",check:"custom",fn:t,...De(n)})}function L3(e){const t=U3(n=>(n.addIssue=s=>{if(typeof s=="string")n.issues.push(xu(s,n.value,t._zod.def));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(xu(i))}},e(n.value,n)));return t}function U3(e,t){const n=new Qn({check:"custom",...De(t)});return n._zod.check=e,n}function rN(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ou,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ln(e,t,n={path:[],schemaPath:[]}){var s;const i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const l={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,l);const f=e._zod.toJSONSchema?.();if(f)l.schema=f;else{const g={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,l.schema,g);else{const b=l.schema,x=t.processors[i.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);x(e,t,b,g)}const y=e._zod.parent;y&&(l.ref||(l.ref=y),ln(y,t,g),t.seen.get(y).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(l.schema,d),t.io==="input"&&On(e)&&(delete l.schema.examples,delete l.schema.default),t.io==="input"&&l.schema._prefault&&((s=l.schema).default??(s.default=l.schema._prefault)),delete l.schema._prefault,t.seen.get(e).schema}function sN(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const l of e.seen.entries()){const f=e.metadataRegistry.get(l[0])?.id;if(f){const d=s.get(f);if(d&&d!==l[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(f,l[0])}}const i=l=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=e.external.registry.get(l[0])?.id,b=e.external.uri??(S=>S);if(y)return{ref:b(y)};const x=l[1].defId??l[1].schema.id??`schema${e.counter++}`;return l[1].defId=x,{defId:x,ref:`${b("__shared")}#/${f}/${x}`}}if(l[1]===n)return{ref:"#"};const p=`#/${f}/`,g=l[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:p+g}},a=l=>{if(l[1].schema.$ref)return;const f=l[1],{ref:d,defId:p}=i(l);f.def={...f.schema},p&&(f.defId=p);const g=f.schema;for(const y in g)delete g[y];g.$ref=d};if(e.cycles==="throw")for(const l of e.seen.entries()){const f=l[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
|
|
58
58
|
|
|
59
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const f=l[1];if(t===l[0]){a(l);continue}if(e.external){const p=e.external.registry.get(l[0])?.id;if(t!==l[0]&&p){a(l);continue}}if(e.metadataRegistry.get(l[0])?.id){a(l);continue}if(f.cycle){a(l);continue}if(f.count>1&&e.reused==="ref"){a(l);continue}}}function oN(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=l=>{const f=e.seen.get(l);if(f.ref===null)return;const d=f.def??f.schema,p={...d},g=f.ref;if(f.ref=null,g){s(g);const b=e.seen.get(g),x=b.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(x)):Object.assign(d,x),Object.assign(d,p),l._zod.parent===g)for(const w in d)w==="$ref"||w==="allOf"||w in p||delete d[w];if(x.$ref&&b.def)for(const w in d)w==="$ref"||w==="allOf"||w in b.def&&JSON.stringify(d[w])===JSON.stringify(b.def[w])&&delete d[w]}const y=l._zod.parent;if(y&&y!==g){s(y);const b=e.seen.get(y);if(b?.schema.$ref&&(d.$ref=b.schema.$ref,b.def))for(const x in d)x==="$ref"||x==="allOf"||x in b.def&&JSON.stringify(d[x])===JSON.stringify(b.def[x])&&delete d[x]}e.override({zodSchema:l,jsonSchema:d,path:f.path??[]})};for(const l of[...e.seen.entries()].reverse())s(l[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const l=e.external.registry.get(t)?.id;if(!l)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(l)}Object.assign(i,n.def??n.schema);const a=e.external?.defs??{};for(const l of e.seen.entries()){const f=l[1];f.def&&f.defId&&(a[f.defId]=f.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?i.$defs=a:i.definitions=a);try{const l=JSON.parse(JSON.stringify(i));return Object.defineProperty(l,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ch(t,"input",e.processors),output:Ch(t,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function On(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return On(s.element,n);if(s.type==="set")return On(s.valueType,n);if(s.type==="lazy")return On(s.getter(),n);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return On(s.innerType,n);if(s.type==="intersection")return On(s.left,n)||On(s.right,n);if(s.type==="record"||s.type==="map")return On(s.keyType,n)||On(s.valueType,n);if(s.type==="pipe")return On(s.in,n)||On(s.out,n);if(s.type==="object"){for(const i in s.shape)if(On(s.shape[i],n))return!0;return!1}if(s.type==="union"){for(const i of s.options)if(On(i,n))return!0;return!1}if(s.type==="tuple"){for(const i of s.items)if(On(i,n))return!0;return!!(s.rest&&On(s.rest,n))}return!1}const $3=(e,t={})=>n=>{const s=rN({...n,processors:t});return ln(e,s),sN(s,e),oN(s,e)},Ch=(e,t,n={})=>s=>{const{libraryOptions:i,target:a}=s??{},l=rN({...i??{},target:a,io:t,processors:n});return ln(e,l),sN(l,e),oN(l,e)},B3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},F3=(e,t,n,s)=>{const i=n;i.type="string";const{minimum:a,maximum:l,format:f,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof a=="number"&&(i.minLength=a),typeof l=="number"&&(i.maxLength=l),f&&(i.format=B3[f]??f,i.format===""&&delete i.format,f==="time"&&delete i.format),p&&(i.contentEncoding=p),d&&d.size>0){const g=[...d];g.length===1?i.pattern=g[0].source:g.length>1&&(i.allOf=[...g.map(y=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},H3=(e,t,n,s)=>{const i=n,{minimum:a,maximum:l,format:f,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:g}=e._zod.bag;typeof f=="string"&&f.includes("int")?i.type="integer":i.type="number",typeof g=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=g,i.exclusiveMinimum=!0):i.exclusiveMinimum=g),typeof a=="number"&&(i.minimum=a,typeof g=="number"&&t.target!=="draft-04"&&(g>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=p,i.exclusiveMaximum=!0):i.exclusiveMaximum=p),typeof l=="number"&&(i.maximum=l,typeof p=="number"&&t.target!=="draft-04"&&(p<=l?delete i.maximum:delete i.exclusiveMaximum)),typeof d=="number"&&(i.multipleOf=d)},q3=(e,t,n,s)=>{n.type="boolean"},V3=(e,t,n,s)=>{n.not={}},K3=(e,t,n,s)=>{},G3=(e,t,n,s)=>{const i=e._zod.def,a=z1(i.entries);a.every(l=>typeof l=="number")&&(n.type="number"),a.every(l=>typeof l=="string")&&(n.type="string"),n.enum=a},Z3=(e,t,n,s)=>{const i=e._zod.def,a=[];for(const l of i.values)if(l===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof l=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(l))}else a.push(l);if(a.length!==0)if(a.length===1){const l=a[0];n.type=l===null?"null":typeof l,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[l]:n.const=l}else a.every(l=>typeof l=="number")&&(n.type="number"),a.every(l=>typeof l=="string")&&(n.type="string"),a.every(l=>typeof l=="boolean")&&(n.type="boolean"),a.every(l=>l===null)&&(n.type="null"),n.enum=a},Y3=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},X3=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Q3=(e,t,n,s)=>{const i=n,a=e._zod.def,{minimum:l,maximum:f}=e._zod.bag;typeof l=="number"&&(i.minItems=l),typeof f=="number"&&(i.maxItems=f),i.type="array",i.items=ln(a.element,t,{...s,path:[...s.path,"items"]})},W3=(e,t,n,s)=>{const i=n,a=e._zod.def;i.type="object",i.properties={};const l=a.shape;for(const p in l)i.properties[p]=ln(l[p],t,{...s,path:[...s.path,"properties",p]});const f=new Set(Object.keys(l)),d=new Set([...f].filter(p=>{const g=a.shape[p]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));d.size>0&&(i.required=Array.from(d)),a.catchall?._zod.def.type==="never"?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ln(a.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},J3=(e,t,n,s)=>{const i=e._zod.def,a=i.inclusive===!1,l=i.options.map((f,d)=>ln(f,t,{...s,path:[...s.path,a?"oneOf":"anyOf",d]}));a?n.oneOf=l:n.anyOf=l},e$=(e,t,n,s)=>{const i=e._zod.def,a=ln(i.left,t,{...s,path:[...s.path,"allOf",0]}),l=ln(i.right,t,{...s,path:[...s.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,d=[...f(a)?a.allOf:[a],...f(l)?l.allOf:[l]];n.allOf=d},t$=(e,t,n,s)=>{const i=n,a=e._zod.def;i.type="object";const l=a.keyType,d=l._zod.bag?.patterns;if(a.mode==="loose"&&d&&d.size>0){const g=ln(a.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});i.patternProperties={};for(const y of d)i.patternProperties[y.source]=g}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=ln(a.keyType,t,{...s,path:[...s.path,"propertyNames"]})),i.additionalProperties=ln(a.valueType,t,{...s,path:[...s.path,"additionalProperties"]});const p=l._zod.values;if(p){const g=[...p].filter(y=>typeof y=="string"||typeof y=="number");g.length>0&&(i.required=g)}},n$=(e,t,n,s)=>{const i=e._zod.def,a=ln(i.innerType,t,s),l=t.seen.get(e);t.target==="openapi-3.0"?(l.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},r$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType},s$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},o$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},i$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType;let l;try{l=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=l},a$=(e,t,n,s)=>{const i=e._zod.def,a=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;ln(a,t,s);const l=t.seen.get(e);l.ref=a},c$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},iN=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType},l$=ue("ZodISODateTime",(e,t)=>{lU.init(e,t),qt.init(e,t)});function u$(e){return m3(l$,e)}const f$=ue("ZodISODate",(e,t)=>{uU.init(e,t),qt.init(e,t)});function d$(e){return g3(f$,e)}const h$=ue("ZodISOTime",(e,t)=>{fU.init(e,t),qt.init(e,t)});function p$(e){return y3(h$,e)}const m$=ue("ZodISODuration",(e,t)=>{dU.init(e,t),qt.init(e,t)});function g$(e){return v3(m$,e)}const y$=(e,t)=>{B1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>n5(e,n)},flatten:{value:n=>t5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,fv,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,fv,2)}},isEmpty:{get(){return e.issues.length===0}}})},Zr=ue("ZodError",y$,{Parent:Error}),v$=_b(Zr),b$=wb(Zr),x$=op(Zr),S$=ip(Zr),_$=o5(Zr),w$=i5(Zr),E$=a5(Zr),T$=c5(Zr),C$=l5(Zr),R$=u5(Zr),N$=f5(Zr),j$=d5(Zr),Ht=ue("ZodType",(e,t)=>(Ft.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ch(e,"input"),output:Ch(e,"output")}}),e.toJSONSchema=$3(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(fi(t,{checks:[...t.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(n,s)=>di(e,n,s),e.brand=()=>e,e.register=((n,s)=>(n.add(e,s),e)),e.parse=(n,s)=>v$(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>x$(e,n,s),e.parseAsync=async(n,s)=>b$(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>S$(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>_$(e,n,s),e.decode=(n,s)=>w$(e,n,s),e.encodeAsync=async(n,s)=>E$(e,n,s),e.decodeAsync=async(n,s)=>T$(e,n,s),e.safeEncode=(n,s)=>C$(e,n,s),e.safeDecode=(n,s)=>R$(e,n,s),e.safeEncodeAsync=async(n,s)=>N$(e,n,s),e.safeDecodeAsync=async(n,s)=>j$(e,n,s),e.refine=(n,s)=>e.check(_B(n,s)),e.superRefine=n=>e.check(wB(n)),e.overwrite=n=>e.check(Qc(n)),e.optional=()=>DE(e),e.exactOptional=()=>lB(e),e.nullable=()=>zE(e),e.nullish=()=>DE(zE(e)),e.nonoptional=n=>mB(e,n),e.array=()=>Gr(e),e.or=n=>Cb([e,n]),e.and=n=>rB(e,n),e.transform=n=>LE(e,aB(n)),e.default=n=>dB(e,n),e.prefault=n=>pB(e,n),e.catch=n=>yB(e,n),e.pipe=n=>LE(e,n),e.readonly=()=>xB(e),e.describe=n=>{const s=e.clone();return ou.add(s,{description:n}),s},Object.defineProperty(e,"description",{get(){return ou.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return ou.get(e);const s=e.clone();return ou.add(s,n[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),aN=ue("_ZodString",(e,t)=>{Eb.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>F3(e,s,i);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...s)=>e.check(T3(...s)),e.includes=(...s)=>e.check(N3(...s)),e.startsWith=(...s)=>e.check(j3(...s)),e.endsWith=(...s)=>e.check(A3(...s)),e.min=(...s)=>e.check(Th(...s)),e.max=(...s)=>e.check(tN(...s)),e.length=(...s)=>e.check(nN(...s)),e.nonempty=(...s)=>e.check(Th(1,...s)),e.lowercase=s=>e.check(C3(s)),e.uppercase=s=>e.check(R3(s)),e.trim=()=>e.check(O3()),e.normalize=(...s)=>e.check(k3(...s)),e.toLowerCase=()=>e.check(M3()),e.toUpperCase=()=>e.check(I3()),e.slugify=()=>e.check(P3())}),A$=ue("ZodString",(e,t)=>{Eb.init(e,t),aN.init(e,t),e.email=n=>e.check(ZU(k$,n)),e.url=n=>e.check(JU(O$,n)),e.jwt=n=>e.check(p3(G$,n)),e.emoji=n=>e.check(e3(M$,n)),e.guid=n=>e.check(AE(IE,n)),e.uuid=n=>e.check(YU(jd,n)),e.uuidv4=n=>e.check(XU(jd,n)),e.uuidv6=n=>e.check(QU(jd,n)),e.uuidv7=n=>e.check(WU(jd,n)),e.nanoid=n=>e.check(t3(I$,n)),e.guid=n=>e.check(AE(IE,n)),e.cuid=n=>e.check(n3(P$,n)),e.cuid2=n=>e.check(r3(D$,n)),e.ulid=n=>e.check(s3(z$,n)),e.base64=n=>e.check(f3(q$,n)),e.base64url=n=>e.check(d3(V$,n)),e.xid=n=>e.check(o3(L$,n)),e.ksuid=n=>e.check(i3(U$,n)),e.ipv4=n=>e.check(a3($$,n)),e.ipv6=n=>e.check(c3(B$,n)),e.cidrv4=n=>e.check(l3(F$,n)),e.cidrv6=n=>e.check(u3(H$,n)),e.e164=n=>e.check(h3(K$,n)),e.datetime=n=>e.check(u$(n)),e.date=n=>e.check(d$(n)),e.time=n=>e.check(p$(n)),e.duration=n=>e.check(g$(n))});function Fe(e){return GU(A$,e)}const qt=ue("ZodStringFormat",(e,t)=>{Bt.init(e,t),aN.init(e,t)}),k$=ue("ZodEmail",(e,t)=>{eU.init(e,t),qt.init(e,t)}),IE=ue("ZodGUID",(e,t)=>{W5.init(e,t),qt.init(e,t)}),jd=ue("ZodUUID",(e,t)=>{J5.init(e,t),qt.init(e,t)}),O$=ue("ZodURL",(e,t)=>{tU.init(e,t),qt.init(e,t)}),M$=ue("ZodEmoji",(e,t)=>{nU.init(e,t),qt.init(e,t)}),I$=ue("ZodNanoID",(e,t)=>{rU.init(e,t),qt.init(e,t)}),P$=ue("ZodCUID",(e,t)=>{sU.init(e,t),qt.init(e,t)}),D$=ue("ZodCUID2",(e,t)=>{oU.init(e,t),qt.init(e,t)}),z$=ue("ZodULID",(e,t)=>{iU.init(e,t),qt.init(e,t)}),L$=ue("ZodXID",(e,t)=>{aU.init(e,t),qt.init(e,t)}),U$=ue("ZodKSUID",(e,t)=>{cU.init(e,t),qt.init(e,t)}),$$=ue("ZodIPv4",(e,t)=>{hU.init(e,t),qt.init(e,t)}),B$=ue("ZodIPv6",(e,t)=>{pU.init(e,t),qt.init(e,t)}),F$=ue("ZodCIDRv4",(e,t)=>{mU.init(e,t),qt.init(e,t)}),H$=ue("ZodCIDRv6",(e,t)=>{gU.init(e,t),qt.init(e,t)}),q$=ue("ZodBase64",(e,t)=>{yU.init(e,t),qt.init(e,t)}),V$=ue("ZodBase64URL",(e,t)=>{bU.init(e,t),qt.init(e,t)}),K$=ue("ZodE164",(e,t)=>{xU.init(e,t),qt.init(e,t)}),G$=ue("ZodJWT",(e,t)=>{_U.init(e,t),qt.init(e,t)}),Tb=ue("ZodNumber",(e,t)=>{Q1.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>H3(e,s,i),e.gt=(s,i)=>e.check(OE(s,i)),e.gte=(s,i)=>e.check(ey(s,i)),e.min=(s,i)=>e.check(ey(s,i)),e.lt=(s,i)=>e.check(kE(s,i)),e.lte=(s,i)=>e.check(Jg(s,i)),e.max=(s,i)=>e.check(Jg(s,i)),e.int=s=>e.check(PE(s)),e.safe=s=>e.check(PE(s)),e.positive=s=>e.check(OE(0,s)),e.nonnegative=s=>e.check(ey(0,s)),e.negative=s=>e.check(kE(0,s)),e.nonpositive=s=>e.check(Jg(0,s)),e.multipleOf=(s,i)=>e.check(ME(s,i)),e.step=(s,i)=>e.check(ME(s,i)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function tn(e){return b3(Tb,e)}const Z$=ue("ZodNumberFormat",(e,t)=>{wU.init(e,t),Tb.init(e,t)});function PE(e){return S3(Z$,e)}const Y$=ue("ZodBoolean",(e,t)=>{EU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>q3(e,n,s)});function no(e){return _3(Y$,e)}const X$=ue("ZodUnknown",(e,t)=>{TU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>K3()});function aa(){return w3(X$)}const Q$=ue("ZodNever",(e,t)=>{CU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>V3(e,n,s)});function W$(e){return E3(Q$,e)}const J$=ue("ZodArray",(e,t)=>{RU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Q3(e,n,s,i),e.element=t.element,e.min=(n,s)=>e.check(Th(n,s)),e.nonempty=n=>e.check(Th(1,n)),e.max=(n,s)=>e.check(tN(n,s)),e.length=(n,s)=>e.check(nN(n,s)),e.unwrap=()=>e.element});function Gr(e,t){return D3(J$,e,t)}const eB=ue("ZodObject",(e,t)=>{jU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>W3(e,n,s,i),wt(e,"shape",()=>t.shape),e.keyof=()=>Vu(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:aa()}),e.loose=()=>e.clone({...e._zod.def,catchall:aa()}),e.strict=()=>e.clone({...e._zod.def,catchall:W$()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>X4(e,n),e.safeExtend=n=>Q4(e,n),e.merge=n=>W4(e,n),e.pick=n=>Z4(e,n),e.omit=n=>Y4(e,n),e.partial=(...n)=>J4(cN,e,n[0]),e.required=(...n)=>e5(lN,e,n[0])});function At(e,t){const n={type:"object",shape:e??{},...De(t)};return new eB(n)}const tB=ue("ZodUnion",(e,t)=>{AU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>J3(e,n,s,i),e.options=t.options});function Cb(e,t){return new tB({type:"union",options:e,...De(t)})}const nB=ue("ZodIntersection",(e,t)=>{kU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>e$(e,n,s,i)});function rB(e,t){return new nB({type:"intersection",left:e,right:t})}const sB=ue("ZodRecord",(e,t)=>{OU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>t$(e,n,s,i),e.keyType=t.keyType,e.valueType=t.valueType});function qu(e,t,n){return new sB({type:"record",keyType:e,valueType:t,...De(n)})}const hv=ue("ZodEnum",(e,t)=>{MU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>G3(e,s,i),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(s,i)=>{const a={};for(const l of s)if(n.has(l))a[l]=t.entries[l];else throw new Error(`Key ${l} not found in enum`);return new hv({...t,checks:[],...De(i),entries:a})},e.exclude=(s,i)=>{const a={...t.entries};for(const l of s)if(n.has(l))delete a[l];else throw new Error(`Key ${l} not found in enum`);return new hv({...t,checks:[],...De(i),entries:a})}});function Vu(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new hv({type:"enum",entries:n,...De(t)})}const oB=ue("ZodLiteral",(e,t)=>{IU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Z3(e,n,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function si(e,t){return new oB({type:"literal",values:Array.isArray(e)?e:[e],...De(t)})}const iB=ue("ZodTransform",(e,t)=>{PU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>X3(e,n),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new P1(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(xu(a,n.value,t));else{const l=a;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=n.value),l.inst??(l.inst=e),n.issues.push(xu(l))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(a=>(n.value=a,n)):(n.value=i,n)}});function aB(e){return new iB({type:"transform",transform:e})}const cN=ue("ZodOptional",(e,t)=>{eN.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>iN(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function DE(e){return new cN({type:"optional",innerType:e})}const cB=ue("ZodExactOptional",(e,t)=>{DU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>iN(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function lB(e){return new cB({type:"optional",innerType:e})}const uB=ue("ZodNullable",(e,t)=>{zU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>n$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function zE(e){return new uB({type:"nullable",innerType:e})}const fB=ue("ZodDefault",(e,t)=>{LU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>s$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dB(e,t){return new fB({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():U1(t)}})}const hB=ue("ZodPrefault",(e,t)=>{UU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>o$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function pB(e,t){return new hB({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():U1(t)}})}const lN=ue("ZodNonOptional",(e,t)=>{$U.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>r$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function mB(e,t){return new lN({type:"nonoptional",innerType:e,...De(t)})}const gB=ue("ZodCatch",(e,t)=>{BU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>i$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yB(e,t){return new gB({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vB=ue("ZodPipe",(e,t)=>{FU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>a$(e,n,s,i),e.in=t.in,e.out=t.out});function LE(e,t){return new vB({type:"pipe",in:e,out:t})}const bB=ue("ZodReadonly",(e,t)=>{HU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>c$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function xB(e){return new bB({type:"readonly",innerType:e})}const SB=ue("ZodCustom",(e,t)=>{qU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Y3(e,n)});function _B(e,t={}){return z3(SB,e,t)}function wB(e){return L3(e)}function UE(e){return x3(Tb,e)}At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i,"Invalid blob hash format"),size:tn().int().min(0),mimeType:Fe().min(1),encrypted:no().optional(),keyId:Fe().optional()});const uN=At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i),size:tn().int().min(0),mimeType:Fe().min(1),createdAt:Fe(),expiresAt:Fe().optional(),uploadComplete:no()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i,"Invalid blob hash format"),size:tn().int().min(0),mimeType:Fe().min(1)});At({exists:no(),uploadId:Fe().optional(),uploadUrl:Fe().url().optional(),uploadMethod:Vu(["PUT","POST"]).optional(),uploadHeaders:qu(Fe(),Fe()).optional(),chunkSize:tn().int().optional()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i)});At({ok:no(),metadata:uN.optional(),error:Fe().optional()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i)});At({url:Fe().url(),expiresAt:Fe(),metadata:uN});At({error:Fe(),message:Fe().optional(),code:Fe().optional()});At({limit:UE().int().min(1).max(100).default(50),offset:UE().int().min(0).default(0)});const EB="json-row-frame-v1",TB="gzip",fN=Vu(["upsert","delete"]),CB=qu(Fe(),Fe()),dN=qu(Fe(),Cb([Fe(),Gr(Fe())])),RB=At({table:Fe(),row_id:Fe(),op:fN,payload:qu(Fe(),aa()).nullable(),base_version:tn().int().nullable().optional()}),NB=At({clientId:Fe().min(1),clientCommitId:Fe().min(1),operations:Gr(RB).min(1),schemaVersion:tn().int().min(1)}),jB=At({opIndex:tn().int(),status:si("applied")}),AB=At({opIndex:tn().int(),status:si("conflict"),message:Fe(),server_version:tn().int(),server_row:aa()}),kB=At({opIndex:tn().int(),status:si("error"),error:Fe(),code:Fe().optional(),retriable:no().optional()}),OB=Cb([jB,AB,kB]),MB=At({ok:si(!0),status:Vu(["applied","cached","rejected"]),commitSeq:tn().int().optional(),results:Gr(OB)}),hN=At({asOfCommitSeq:tn().int(),tables:Gr(Fe()),tableIndex:tn().int(),rowCursor:Fe().nullable()}),IB=At({id:Fe().min(1),table:Fe().min(1),scopes:dN,params:qu(Fe(),aa()).optional(),cursor:tn().int(),bootstrapState:hN.nullable().optional()}),PB=At({clientId:Fe().min(1),limitCommits:tn().int().min(1),limitSnapshotRows:tn().int().min(1).optional(),maxSnapshotPages:tn().int().min(1).optional(),dedupeRows:no().optional(),subscriptions:Gr(IB)}),DB=At({table:Fe(),row_id:Fe(),op:fN,row_json:aa().nullable(),row_version:tn().int().nullable(),scopes:CB}),zB=At({commitSeq:tn().int(),createdAt:Fe(),actorId:Fe(),changes:Gr(DB)}),LB=At({id:Fe(),byteLength:tn().int(),sha256:Fe(),encoding:si(EB),compression:si(TB)}),UB=At({table:Fe(),rows:Gr(aa()),chunks:Gr(LB).optional(),isFirstPage:no(),isLastPage:no()}),$B=At({id:Fe(),status:Vu(["active","revoked"]),scopes:dN,bootstrap:no(),bootstrapState:hN.nullable().optional(),nextCursor:tn().int(),commits:Gr(zB),snapshots:Gr(UB).optional()}),BB=At({ok:si(!0),subscriptions:Gr($B)});At({clientId:Fe().min(1),push:NB.omit({clientId:!0}).optional(),pull:PB.omit({clientId:!0}).optional()});At({ok:si(!0),push:MB.optional(),pull:BB.optional()});new TextEncoder;const FB={setAttribute(){},setAttributes(){},setStatus(){}};function HB(e){return e.level?e.level:e.error?"error":"info"}function ty(e,t){if(!e)return null;switch(t){case"trace":return e.trace??e.debug??e.info??null;case"debug":return e.debug??e.info??null;case"info":return e.info??null;case"warn":return e.warn??e.info??null;case"error":return e.error??e.warn??e.info??null;case"fatal":return e.fatal??e.error??e.warn??e.info??null;default:return e.info??null}}function qB(e){return{setAttribute(t,n){e.setAttribute?.(t,n)},setAttributes(t){if(e.setAttributes){e.setAttributes(t);return}for(const[n,s]of Object.entries(t))e.setAttribute?.(n,s)},setStatus(t){e.setStatus?.(t)}}}function VB(e){if(typeof e=="string")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="boolean")return e;if(typeof e=="bigint"){const t=Number(e);return Number.isFinite(t)?t:e.toString()}if(e instanceof Date)return e.toISOString();if(e!=null){if(Array.isArray(e)||typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}function $E(e){const t={};for(const[n,s]of Object.entries(e)){const i=VB(s);i!==void 0&&(t[n]=i)}return Object.keys(t).length>0?t:null}function KB(e){return{startSpan(t,n){return e.startSpan?e.startSpan(t,s=>n(qB(s))):n(FB)}}}function GB(e){return{count(t,n,s){e.metrics?.count?.(t,n??1,s)},gauge(t,n,s){e.metrics?.gauge?.(t,n,s)},distribution(t,n,s){e.metrics?.distribution?.(t,n,s)}}}function ZB(e){return{log(t){const n=HB(t),{event:s,...i}=t,a=ty(e.logger,n);if(!a)return;const l=$E(i);if(!l){a(s);return}a(s,l)},tracer:KB(e),metrics:GB(e),captureException(t,n){if(e.captureException?.(t),!n)return;const s=ty(e.logger,"error")??ty(e.logger,"info");if(!s)return;const i=$E(n);if(!i){s("sync.exception.context");return}s("sync.exception.context",i)}}}function YB(e){if(e?.attributes)return{attributes:e.attributes}}function BE(e){if(!e)return;const t=!!e.attributes,n=!!e.unit;if(!(!t&&!n))return{attributes:e.attributes,unit:e.unit}}function XB(){return ZB({logger:x2,startSpan(e,t){return kR(e,n=>t({setAttribute(s,i){n.setAttribute(s,i)},setAttributes(s){n.setAttributes(s)},setStatus(s){n.setStatus({code:s==="ok"?1:2})}}))},metrics:{count(e,t,n){const s=YB(n);if(s){tE(e,t,s);return}tE(e,t)},gauge(e,t,n){const s=BE(n);if(s){nE(e,t,s);return}nE(e,t)},distribution(e,t,n){const s=BE(n);if(s){rE(e,t,s);return}rE(e,t)}},captureException(e){DR(e)}})}function QB(){return XB()}function WB(e){const t=JB(e);return B4(t),QB()}function JB(e){const t=e.integrations;if(typeof t=="function")return e;const n=t??[];return n.some(i=>i.name==="BrowserTracing")?e:{...e,integrations:[P4(),...n]}}var ny={exports:{}},Yl={};var FE;function e6(){if(FE)return Yl;FE=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,i,a){var l=null;if(a!==void 0&&(l=""+a),i.key!==void 0&&(l=""+i.key),"key"in i){a={};for(var f in i)f!=="key"&&(a[f]=i[f])}else a=i;return i=a.ref,{$$typeof:e,type:s,key:l,ref:i!==void 0?i:null,props:a}}return Yl.Fragment=t,Yl.jsx=n,Yl.jsxs=n,Yl}var HE;function t6(){return HE||(HE=1,ny.exports=e6()),ny.exports}var h=t6(),ry={exports:{}},Xl={},sy={exports:{}},oy={};var qE;function n6(){return qE||(qE=1,(function(e){function t(P,G){var q=P.length;P.push(G);e:for(;0<q;){var V=q-1>>>1,L=P[V];if(0<i(L,G))P[V]=G,P[q]=L,q=V;else break e}}function n(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var G=P[0],q=P.pop();if(q!==G){P[0]=q;e:for(var V=0,L=P.length,M=L>>>1;V<M;){var H=2*(V+1)-1,W=P[H],Y=H+1,ae=P[Y];if(0>i(W,q))Y<L&&0>i(ae,W)?(P[V]=ae,P[Y]=q,V=Y):(P[V]=W,P[H]=q,V=H);else if(Y<L&&0>i(ae,q))P[V]=ae,P[Y]=q,V=Y;else break e}}return G}function i(P,G){var q=P.sortIndex-G.sortIndex;return q!==0?q:P.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,f=l.now();e.unstable_now=function(){return l.now()-f}}var d=[],p=[],g=1,y=null,b=3,x=!1,S=!1,w=!1,T=!1,C=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function R(P){for(var G=n(p);G!==null;){if(G.callback===null)s(p);else if(G.startTime<=P)s(p),G.sortIndex=G.expirationTime,t(d,G);else break;G=n(p)}}function I(P){if(w=!1,R(P),!S)if(n(d)!==null)S=!0,z||(z=!0,U());else{var G=n(p);G!==null&&ee(I,G.startTime-P)}}var z=!1,N=-1,A=5,D=-1;function Q(){return T?!0:!(e.unstable_now()-D<A)}function B(){if(T=!1,z){var P=e.unstable_now();D=P;var G=!0;try{e:{S=!1,w&&(w=!1,O(N),N=-1),x=!0;var q=b;try{t:{for(R(P),y=n(d);y!==null&&!(y.expirationTime>P&&Q());){var V=y.callback;if(typeof V=="function"){y.callback=null,b=y.priorityLevel;var L=V(y.expirationTime<=P);if(P=e.unstable_now(),typeof L=="function"){y.callback=L,R(P),G=!0;break t}y===n(d)&&s(d),R(P)}else s(d);y=n(d)}if(y!==null)G=!0;else{var M=n(p);M!==null&&ee(I,M.startTime-P),G=!1}}break e}finally{y=null,b=q,x=!1}G=void 0}}finally{G?U():z=!1}}}var U;if(typeof j=="function")U=function(){j(B)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,K=Z.port2;Z.port1.onmessage=B,U=function(){K.postMessage(null)}}else U=function(){C(B,0)};function ee(P,G){N=C(function(){P(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(P){switch(b){case 1:case 2:case 3:var G=3;break;default:G=b}var q=b;b=G;try{return P()}finally{b=q}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(P,G){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var q=b;b=P;try{return G()}finally{b=q}},e.unstable_scheduleCallback=function(P,G,q){var V=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?V+q:V):q=V,P){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=q+L,P={id:g++,callback:G,priorityLevel:P,startTime:q,expirationTime:L,sortIndex:-1},q>V?(P.sortIndex=q,t(p,P),n(d)===null&&P===n(p)&&(w?(O(N),N=-1):w=!0,ee(I,q-V))):(P.sortIndex=L,t(d,P),S||x||(S=!0,z||(z=!0,U()))),P},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(P){var G=b;return function(){var q=b;b=G;try{return P.apply(this,arguments)}finally{b=q}}}})(oy)),oy}var VE;function r6(){return VE||(VE=1,sy.exports=n6()),sy.exports}var iy={exports:{}},Rn={};var KE;function s6(){if(KE)return Rn;KE=1;var e=Hu();function t(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function a(d,p,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:y==null?null:""+y,children:d,containerInfo:p,implementation:g}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Rn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Rn.createPortal=function(d,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return a(d,p,null,g)},Rn.flushSync=function(d){var p=l.T,g=s.p;try{if(l.T=null,s.p=2,d)return d()}finally{l.T=p,s.p=g,s.d.f()}},Rn.preconnect=function(d,p){typeof d=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(d,p))},Rn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},Rn.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var g=p.as,y=f(g,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?s.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:x}):g==="script"&&s.d.X(d,{crossOrigin:y,integrity:b,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Rn.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=f(p.as,p.crossOrigin);s.d.M(d,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(d)},Rn.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,y=f(g,p.crossOrigin);s.d.L(d,g,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Rn.preloadModule=function(d,p){if(typeof d=="string")if(p){var g=f(p.as,p.crossOrigin);s.d.m(d,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(d)},Rn.requestFormReset=function(d){s.d.r(d)},Rn.unstable_batchedUpdates=function(d,p){return d(p)},Rn.useFormState=function(d,p,g){return l.H.useFormState(d,p,g)},Rn.useFormStatus=function(){return l.H.useHostTransitionStatus()},Rn.version="19.2.4",Rn}var GE;function pN(){if(GE)return iy.exports;GE=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),iy.exports=s6(),iy.exports}var ZE;function o6(){if(ZE)return Xl;ZE=1;var e=r6(),t=Hu(),n=pN();function s(r){var o="https://react.dev/errors/"+r;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function a(r){var o=r,c=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(c=o.return),r=o.return;while(r)}return o.tag===3?c:null}function l(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function f(r){if(r.tag===31){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function d(r){if(a(r)!==r)throw Error(s(188))}function p(r){var o=r.alternate;if(!o){if(o=a(r),o===null)throw Error(s(188));return o!==r?null:r}for(var c=r,u=o;;){var m=c.return;if(m===null)break;var v=m.alternate;if(v===null){if(u=m.return,u!==null){c=u;continue}break}if(m.child===v.child){for(v=m.child;v;){if(v===c)return d(m),r;if(v===u)return d(m),o;v=v.sibling}throw Error(s(188))}if(c.return!==u.return)c=m,u=v;else{for(var E=!1,k=m.child;k;){if(k===c){E=!0,c=m,u=v;break}if(k===u){E=!0,u=m,c=v;break}k=k.sibling}if(!E){for(k=v.child;k;){if(k===c){E=!0,c=v,u=m;break}if(k===u){E=!0,u=v,c=m;break}k=k.sibling}if(!E)throw Error(s(189))}}if(c.alternate!==u)throw Error(s(190))}if(c.tag!==3)throw Error(s(188));return c.stateNode.current===c?r:o}function g(r){var o=r.tag;if(o===5||o===26||o===27||o===6)return r;for(r=r.child;r!==null;){if(o=g(r),o!==null)return o;r=r.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),j=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function U(r){return r===null||typeof r!="object"?null:(r=B&&r[B]||r["@@iterator"],typeof r=="function"?r:null)}var Z=Symbol.for("react.client.reference");function K(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Z?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case w:return"Fragment";case C:return"Profiler";case T:return"StrictMode";case I:return"Suspense";case z:return"SuspenseList";case D:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case j:return r.displayName||"Context";case O:return(r._context.displayName||"Context")+".Consumer";case R:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case N:return o=r.displayName||null,o!==null?o:K(r.type)||"Memo";case A:o=r._payload,r=r._init;try{return K(r(o))}catch{}}return null}var ee=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q={pending:!1,data:null,method:null,action:null},V=[],L=-1;function M(r){return{current:r}}function H(r){0>L||(r.current=V[L],V[L]=null,L--)}function W(r,o){L++,V[L]=r.current,r.current=o}var Y=M(null),ae=M(null),se=M(null),fe=M(null);function Se(r,o){switch(W(se,o),W(ae,r),W(Y,null),o.nodeType){case 9:case 11:r=(r=o.documentElement)&&(r=r.namespaceURI)?k_(r):0;break;default:if(r=o.tagName,o=o.namespaceURI)o=k_(o),r=O_(o,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}H(Y),W(Y,r)}function pe(){H(Y),H(ae),H(se)}function Me(r){r.memoizedState!==null&&W(fe,r);var o=Y.current,c=O_(o,r.type);o!==c&&(W(ae,r),W(Y,c))}function _e(r){ae.current===r&&(H(Y),H(ae)),fe.current===r&&(H(fe),ql._currentValue=q)}var re,he;function ie(r){if(re===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);re=o&&o[1]||"",he=-1<c.stack.indexOf(`
|
|
59
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const f=l[1];if(t===l[0]){a(l);continue}if(e.external){const p=e.external.registry.get(l[0])?.id;if(t!==l[0]&&p){a(l);continue}}if(e.metadataRegistry.get(l[0])?.id){a(l);continue}if(f.cycle){a(l);continue}if(f.count>1&&e.reused==="ref"){a(l);continue}}}function oN(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=l=>{const f=e.seen.get(l);if(f.ref===null)return;const d=f.def??f.schema,p={...d},g=f.ref;if(f.ref=null,g){s(g);const b=e.seen.get(g),x=b.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(x)):Object.assign(d,x),Object.assign(d,p),l._zod.parent===g)for(const w in d)w==="$ref"||w==="allOf"||w in p||delete d[w];if(x.$ref&&b.def)for(const w in d)w==="$ref"||w==="allOf"||w in b.def&&JSON.stringify(d[w])===JSON.stringify(b.def[w])&&delete d[w]}const y=l._zod.parent;if(y&&y!==g){s(y);const b=e.seen.get(y);if(b?.schema.$ref&&(d.$ref=b.schema.$ref,b.def))for(const x in d)x==="$ref"||x==="allOf"||x in b.def&&JSON.stringify(d[x])===JSON.stringify(b.def[x])&&delete d[x]}e.override({zodSchema:l,jsonSchema:d,path:f.path??[]})};for(const l of[...e.seen.entries()].reverse())s(l[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const l=e.external.registry.get(t)?.id;if(!l)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(l)}Object.assign(i,n.def??n.schema);const a=e.external?.defs??{};for(const l of e.seen.entries()){const f=l[1];f.def&&f.defId&&(a[f.defId]=f.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?i.$defs=a:i.definitions=a);try{const l=JSON.parse(JSON.stringify(i));return Object.defineProperty(l,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ch(t,"input",e.processors),output:Ch(t,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function On(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return On(s.element,n);if(s.type==="set")return On(s.valueType,n);if(s.type==="lazy")return On(s.getter(),n);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return On(s.innerType,n);if(s.type==="intersection")return On(s.left,n)||On(s.right,n);if(s.type==="record"||s.type==="map")return On(s.keyType,n)||On(s.valueType,n);if(s.type==="pipe")return On(s.in,n)||On(s.out,n);if(s.type==="object"){for(const i in s.shape)if(On(s.shape[i],n))return!0;return!1}if(s.type==="union"){for(const i of s.options)if(On(i,n))return!0;return!1}if(s.type==="tuple"){for(const i of s.items)if(On(i,n))return!0;return!!(s.rest&&On(s.rest,n))}return!1}const $3=(e,t={})=>n=>{const s=rN({...n,processors:t});return ln(e,s),sN(s,e),oN(s,e)},Ch=(e,t,n={})=>s=>{const{libraryOptions:i,target:a}=s??{},l=rN({...i??{},target:a,io:t,processors:n});return ln(e,l),sN(l,e),oN(l,e)},B3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},F3=(e,t,n,s)=>{const i=n;i.type="string";const{minimum:a,maximum:l,format:f,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof a=="number"&&(i.minLength=a),typeof l=="number"&&(i.maxLength=l),f&&(i.format=B3[f]??f,i.format===""&&delete i.format,f==="time"&&delete i.format),p&&(i.contentEncoding=p),d&&d.size>0){const g=[...d];g.length===1?i.pattern=g[0].source:g.length>1&&(i.allOf=[...g.map(y=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},H3=(e,t,n,s)=>{const i=n,{minimum:a,maximum:l,format:f,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:g}=e._zod.bag;typeof f=="string"&&f.includes("int")?i.type="integer":i.type="number",typeof g=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=g,i.exclusiveMinimum=!0):i.exclusiveMinimum=g),typeof a=="number"&&(i.minimum=a,typeof g=="number"&&t.target!=="draft-04"&&(g>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=p,i.exclusiveMaximum=!0):i.exclusiveMaximum=p),typeof l=="number"&&(i.maximum=l,typeof p=="number"&&t.target!=="draft-04"&&(p<=l?delete i.maximum:delete i.exclusiveMaximum)),typeof d=="number"&&(i.multipleOf=d)},q3=(e,t,n,s)=>{n.type="boolean"},V3=(e,t,n,s)=>{n.not={}},K3=(e,t,n,s)=>{},G3=(e,t,n,s)=>{const i=e._zod.def,a=z1(i.entries);a.every(l=>typeof l=="number")&&(n.type="number"),a.every(l=>typeof l=="string")&&(n.type="string"),n.enum=a},Z3=(e,t,n,s)=>{const i=e._zod.def,a=[];for(const l of i.values)if(l===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof l=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(l))}else a.push(l);if(a.length!==0)if(a.length===1){const l=a[0];n.type=l===null?"null":typeof l,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[l]:n.const=l}else a.every(l=>typeof l=="number")&&(n.type="number"),a.every(l=>typeof l=="string")&&(n.type="string"),a.every(l=>typeof l=="boolean")&&(n.type="boolean"),a.every(l=>l===null)&&(n.type="null"),n.enum=a},Y3=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},X3=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Q3=(e,t,n,s)=>{const i=n,a=e._zod.def,{minimum:l,maximum:f}=e._zod.bag;typeof l=="number"&&(i.minItems=l),typeof f=="number"&&(i.maxItems=f),i.type="array",i.items=ln(a.element,t,{...s,path:[...s.path,"items"]})},W3=(e,t,n,s)=>{const i=n,a=e._zod.def;i.type="object",i.properties={};const l=a.shape;for(const p in l)i.properties[p]=ln(l[p],t,{...s,path:[...s.path,"properties",p]});const f=new Set(Object.keys(l)),d=new Set([...f].filter(p=>{const g=a.shape[p]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));d.size>0&&(i.required=Array.from(d)),a.catchall?._zod.def.type==="never"?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ln(a.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},J3=(e,t,n,s)=>{const i=e._zod.def,a=i.inclusive===!1,l=i.options.map((f,d)=>ln(f,t,{...s,path:[...s.path,a?"oneOf":"anyOf",d]}));a?n.oneOf=l:n.anyOf=l},e$=(e,t,n,s)=>{const i=e._zod.def,a=ln(i.left,t,{...s,path:[...s.path,"allOf",0]}),l=ln(i.right,t,{...s,path:[...s.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,d=[...f(a)?a.allOf:[a],...f(l)?l.allOf:[l]];n.allOf=d},t$=(e,t,n,s)=>{const i=n,a=e._zod.def;i.type="object";const l=a.keyType,d=l._zod.bag?.patterns;if(a.mode==="loose"&&d&&d.size>0){const g=ln(a.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});i.patternProperties={};for(const y of d)i.patternProperties[y.source]=g}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=ln(a.keyType,t,{...s,path:[...s.path,"propertyNames"]})),i.additionalProperties=ln(a.valueType,t,{...s,path:[...s.path,"additionalProperties"]});const p=l._zod.values;if(p){const g=[...p].filter(y=>typeof y=="string"||typeof y=="number");g.length>0&&(i.required=g)}},n$=(e,t,n,s)=>{const i=e._zod.def,a=ln(i.innerType,t,s),l=t.seen.get(e);t.target==="openapi-3.0"?(l.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},r$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType},s$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},o$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},i$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType;let l;try{l=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=l},a$=(e,t,n,s)=>{const i=e._zod.def,a=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;ln(a,t,s);const l=t.seen.get(e);l.ref=a},c$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},iN=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType},l$=ue("ZodISODateTime",(e,t)=>{lU.init(e,t),qt.init(e,t)});function u$(e){return m3(l$,e)}const f$=ue("ZodISODate",(e,t)=>{uU.init(e,t),qt.init(e,t)});function d$(e){return g3(f$,e)}const h$=ue("ZodISOTime",(e,t)=>{fU.init(e,t),qt.init(e,t)});function p$(e){return y3(h$,e)}const m$=ue("ZodISODuration",(e,t)=>{dU.init(e,t),qt.init(e,t)});function g$(e){return v3(m$,e)}const y$=(e,t)=>{B1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>n5(e,n)},flatten:{value:n=>t5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,fv,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,fv,2)}},isEmpty:{get(){return e.issues.length===0}}})},Zr=ue("ZodError",y$,{Parent:Error}),v$=_b(Zr),b$=wb(Zr),x$=op(Zr),S$=ip(Zr),_$=o5(Zr),w$=i5(Zr),E$=a5(Zr),T$=c5(Zr),C$=l5(Zr),R$=u5(Zr),N$=f5(Zr),j$=d5(Zr),Ht=ue("ZodType",(e,t)=>(Ft.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ch(e,"input"),output:Ch(e,"output")}}),e.toJSONSchema=$3(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(fi(t,{checks:[...t.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(n,s)=>di(e,n,s),e.brand=()=>e,e.register=((n,s)=>(n.add(e,s),e)),e.parse=(n,s)=>v$(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>x$(e,n,s),e.parseAsync=async(n,s)=>b$(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>S$(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>_$(e,n,s),e.decode=(n,s)=>w$(e,n,s),e.encodeAsync=async(n,s)=>E$(e,n,s),e.decodeAsync=async(n,s)=>T$(e,n,s),e.safeEncode=(n,s)=>C$(e,n,s),e.safeDecode=(n,s)=>R$(e,n,s),e.safeEncodeAsync=async(n,s)=>N$(e,n,s),e.safeDecodeAsync=async(n,s)=>j$(e,n,s),e.refine=(n,s)=>e.check(_B(n,s)),e.superRefine=n=>e.check(wB(n)),e.overwrite=n=>e.check(Qc(n)),e.optional=()=>DE(e),e.exactOptional=()=>lB(e),e.nullable=()=>zE(e),e.nullish=()=>DE(zE(e)),e.nonoptional=n=>mB(e,n),e.array=()=>Gr(e),e.or=n=>Cb([e,n]),e.and=n=>rB(e,n),e.transform=n=>LE(e,aB(n)),e.default=n=>dB(e,n),e.prefault=n=>pB(e,n),e.catch=n=>yB(e,n),e.pipe=n=>LE(e,n),e.readonly=()=>xB(e),e.describe=n=>{const s=e.clone();return ou.add(s,{description:n}),s},Object.defineProperty(e,"description",{get(){return ou.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return ou.get(e);const s=e.clone();return ou.add(s,n[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),aN=ue("_ZodString",(e,t)=>{Eb.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>F3(e,s,i);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...s)=>e.check(T3(...s)),e.includes=(...s)=>e.check(N3(...s)),e.startsWith=(...s)=>e.check(j3(...s)),e.endsWith=(...s)=>e.check(A3(...s)),e.min=(...s)=>e.check(Th(...s)),e.max=(...s)=>e.check(tN(...s)),e.length=(...s)=>e.check(nN(...s)),e.nonempty=(...s)=>e.check(Th(1,...s)),e.lowercase=s=>e.check(C3(s)),e.uppercase=s=>e.check(R3(s)),e.trim=()=>e.check(O3()),e.normalize=(...s)=>e.check(k3(...s)),e.toLowerCase=()=>e.check(M3()),e.toUpperCase=()=>e.check(I3()),e.slugify=()=>e.check(P3())}),A$=ue("ZodString",(e,t)=>{Eb.init(e,t),aN.init(e,t),e.email=n=>e.check(ZU(k$,n)),e.url=n=>e.check(JU(O$,n)),e.jwt=n=>e.check(p3(G$,n)),e.emoji=n=>e.check(e3(M$,n)),e.guid=n=>e.check(AE(IE,n)),e.uuid=n=>e.check(YU(jd,n)),e.uuidv4=n=>e.check(XU(jd,n)),e.uuidv6=n=>e.check(QU(jd,n)),e.uuidv7=n=>e.check(WU(jd,n)),e.nanoid=n=>e.check(t3(I$,n)),e.guid=n=>e.check(AE(IE,n)),e.cuid=n=>e.check(n3(P$,n)),e.cuid2=n=>e.check(r3(D$,n)),e.ulid=n=>e.check(s3(z$,n)),e.base64=n=>e.check(f3(q$,n)),e.base64url=n=>e.check(d3(V$,n)),e.xid=n=>e.check(o3(L$,n)),e.ksuid=n=>e.check(i3(U$,n)),e.ipv4=n=>e.check(a3($$,n)),e.ipv6=n=>e.check(c3(B$,n)),e.cidrv4=n=>e.check(l3(F$,n)),e.cidrv6=n=>e.check(u3(H$,n)),e.e164=n=>e.check(h3(K$,n)),e.datetime=n=>e.check(u$(n)),e.date=n=>e.check(d$(n)),e.time=n=>e.check(p$(n)),e.duration=n=>e.check(g$(n))});function Fe(e){return GU(A$,e)}const qt=ue("ZodStringFormat",(e,t)=>{Bt.init(e,t),aN.init(e,t)}),k$=ue("ZodEmail",(e,t)=>{eU.init(e,t),qt.init(e,t)}),IE=ue("ZodGUID",(e,t)=>{W5.init(e,t),qt.init(e,t)}),jd=ue("ZodUUID",(e,t)=>{J5.init(e,t),qt.init(e,t)}),O$=ue("ZodURL",(e,t)=>{tU.init(e,t),qt.init(e,t)}),M$=ue("ZodEmoji",(e,t)=>{nU.init(e,t),qt.init(e,t)}),I$=ue("ZodNanoID",(e,t)=>{rU.init(e,t),qt.init(e,t)}),P$=ue("ZodCUID",(e,t)=>{sU.init(e,t),qt.init(e,t)}),D$=ue("ZodCUID2",(e,t)=>{oU.init(e,t),qt.init(e,t)}),z$=ue("ZodULID",(e,t)=>{iU.init(e,t),qt.init(e,t)}),L$=ue("ZodXID",(e,t)=>{aU.init(e,t),qt.init(e,t)}),U$=ue("ZodKSUID",(e,t)=>{cU.init(e,t),qt.init(e,t)}),$$=ue("ZodIPv4",(e,t)=>{hU.init(e,t),qt.init(e,t)}),B$=ue("ZodIPv6",(e,t)=>{pU.init(e,t),qt.init(e,t)}),F$=ue("ZodCIDRv4",(e,t)=>{mU.init(e,t),qt.init(e,t)}),H$=ue("ZodCIDRv6",(e,t)=>{gU.init(e,t),qt.init(e,t)}),q$=ue("ZodBase64",(e,t)=>{yU.init(e,t),qt.init(e,t)}),V$=ue("ZodBase64URL",(e,t)=>{bU.init(e,t),qt.init(e,t)}),K$=ue("ZodE164",(e,t)=>{xU.init(e,t),qt.init(e,t)}),G$=ue("ZodJWT",(e,t)=>{_U.init(e,t),qt.init(e,t)}),Tb=ue("ZodNumber",(e,t)=>{Q1.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>H3(e,s,i),e.gt=(s,i)=>e.check(OE(s,i)),e.gte=(s,i)=>e.check(ey(s,i)),e.min=(s,i)=>e.check(ey(s,i)),e.lt=(s,i)=>e.check(kE(s,i)),e.lte=(s,i)=>e.check(Jg(s,i)),e.max=(s,i)=>e.check(Jg(s,i)),e.int=s=>e.check(PE(s)),e.safe=s=>e.check(PE(s)),e.positive=s=>e.check(OE(0,s)),e.nonnegative=s=>e.check(ey(0,s)),e.negative=s=>e.check(kE(0,s)),e.nonpositive=s=>e.check(Jg(0,s)),e.multipleOf=(s,i)=>e.check(ME(s,i)),e.step=(s,i)=>e.check(ME(s,i)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function tn(e){return b3(Tb,e)}const Z$=ue("ZodNumberFormat",(e,t)=>{wU.init(e,t),Tb.init(e,t)});function PE(e){return S3(Z$,e)}const Y$=ue("ZodBoolean",(e,t)=>{EU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>q3(e,n,s)});function no(e){return _3(Y$,e)}const X$=ue("ZodUnknown",(e,t)=>{TU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>K3()});function aa(){return w3(X$)}const Q$=ue("ZodNever",(e,t)=>{CU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>V3(e,n,s)});function W$(e){return E3(Q$,e)}const J$=ue("ZodArray",(e,t)=>{RU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Q3(e,n,s,i),e.element=t.element,e.min=(n,s)=>e.check(Th(n,s)),e.nonempty=n=>e.check(Th(1,n)),e.max=(n,s)=>e.check(tN(n,s)),e.length=(n,s)=>e.check(nN(n,s)),e.unwrap=()=>e.element});function Gr(e,t){return D3(J$,e,t)}const eB=ue("ZodObject",(e,t)=>{jU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>W3(e,n,s,i),wt(e,"shape",()=>t.shape),e.keyof=()=>Vu(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:aa()}),e.loose=()=>e.clone({...e._zod.def,catchall:aa()}),e.strict=()=>e.clone({...e._zod.def,catchall:W$()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>X4(e,n),e.safeExtend=n=>Q4(e,n),e.merge=n=>W4(e,n),e.pick=n=>Z4(e,n),e.omit=n=>Y4(e,n),e.partial=(...n)=>J4(cN,e,n[0]),e.required=(...n)=>e5(lN,e,n[0])});function At(e,t){const n={type:"object",shape:e??{},...De(t)};return new eB(n)}const tB=ue("ZodUnion",(e,t)=>{AU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>J3(e,n,s,i),e.options=t.options});function Cb(e,t){return new tB({type:"union",options:e,...De(t)})}const nB=ue("ZodIntersection",(e,t)=>{kU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>e$(e,n,s,i)});function rB(e,t){return new nB({type:"intersection",left:e,right:t})}const sB=ue("ZodRecord",(e,t)=>{OU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>t$(e,n,s,i),e.keyType=t.keyType,e.valueType=t.valueType});function qu(e,t,n){return new sB({type:"record",keyType:e,valueType:t,...De(n)})}const hv=ue("ZodEnum",(e,t)=>{MU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>G3(e,s,i),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(s,i)=>{const a={};for(const l of s)if(n.has(l))a[l]=t.entries[l];else throw new Error(`Key ${l} not found in enum`);return new hv({...t,checks:[],...De(i),entries:a})},e.exclude=(s,i)=>{const a={...t.entries};for(const l of s)if(n.has(l))delete a[l];else throw new Error(`Key ${l} not found in enum`);return new hv({...t,checks:[],...De(i),entries:a})}});function Vu(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new hv({type:"enum",entries:n,...De(t)})}const oB=ue("ZodLiteral",(e,t)=>{IU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Z3(e,n,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function si(e,t){return new oB({type:"literal",values:Array.isArray(e)?e:[e],...De(t)})}const iB=ue("ZodTransform",(e,t)=>{PU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>X3(e,n),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new P1(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(xu(a,n.value,t));else{const l=a;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=n.value),l.inst??(l.inst=e),n.issues.push(xu(l))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(a=>(n.value=a,n)):(n.value=i,n)}});function aB(e){return new iB({type:"transform",transform:e})}const cN=ue("ZodOptional",(e,t)=>{eN.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>iN(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function DE(e){return new cN({type:"optional",innerType:e})}const cB=ue("ZodExactOptional",(e,t)=>{DU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>iN(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function lB(e){return new cB({type:"optional",innerType:e})}const uB=ue("ZodNullable",(e,t)=>{zU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>n$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function zE(e){return new uB({type:"nullable",innerType:e})}const fB=ue("ZodDefault",(e,t)=>{LU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>s$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function dB(e,t){return new fB({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():U1(t)}})}const hB=ue("ZodPrefault",(e,t)=>{UU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>o$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function pB(e,t){return new hB({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():U1(t)}})}const lN=ue("ZodNonOptional",(e,t)=>{$U.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>r$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function mB(e,t){return new lN({type:"nonoptional",innerType:e,...De(t)})}const gB=ue("ZodCatch",(e,t)=>{BU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>i$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yB(e,t){return new gB({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vB=ue("ZodPipe",(e,t)=>{FU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>a$(e,n,s,i),e.in=t.in,e.out=t.out});function LE(e,t){return new vB({type:"pipe",in:e,out:t})}const bB=ue("ZodReadonly",(e,t)=>{HU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>c$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function xB(e){return new bB({type:"readonly",innerType:e})}const SB=ue("ZodCustom",(e,t)=>{qU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Y3(e,n)});function _B(e,t={}){return z3(SB,e,t)}function wB(e){return L3(e)}function UE(e){return x3(Tb,e)}At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i,"Invalid blob hash format"),size:tn().int().min(0),mimeType:Fe().min(1),encrypted:no().optional(),keyId:Fe().optional()});const uN=At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i),size:tn().int().min(0),mimeType:Fe().min(1),createdAt:Fe(),expiresAt:Fe().optional(),uploadComplete:no()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i,"Invalid blob hash format"),size:tn().int().min(0),mimeType:Fe().min(1)});At({exists:no(),uploadId:Fe().optional(),uploadUrl:Fe().url().optional(),uploadMethod:Vu(["PUT","POST"]).optional(),uploadHeaders:qu(Fe(),Fe()).optional(),chunkSize:tn().int().optional()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i)});At({ok:no(),metadata:uN.optional(),error:Fe().optional()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i)});At({url:Fe().url(),expiresAt:Fe(),metadata:uN});At({error:Fe(),message:Fe().optional(),code:Fe().optional()});At({limit:UE().int().min(1).max(100).default(50),offset:UE().int().min(0).default(0)});const EB="json-row-frame-v1",TB="gzip",fN=Vu(["upsert","delete"]),CB=qu(Fe(),Fe()),dN=qu(Fe(),Cb([Fe(),Gr(Fe())])),RB=At({table:Fe(),row_id:Fe(),op:fN,payload:qu(Fe(),aa()).nullable(),base_version:tn().int().nullable().optional()}),NB=At({clientId:Fe().min(1),clientCommitId:Fe().min(1),operations:Gr(RB).min(1),schemaVersion:tn().int().min(1)}),jB=At({opIndex:tn().int(),status:si("applied")}),AB=At({opIndex:tn().int(),status:si("conflict"),message:Fe(),server_version:tn().int(),server_row:aa()}),kB=At({opIndex:tn().int(),status:si("error"),error:Fe(),code:Fe().optional(),retriable:no().optional()}),OB=Cb([jB,AB,kB]),MB=At({ok:si(!0),status:Vu(["applied","cached","rejected"]),commitSeq:tn().int().optional(),results:Gr(OB)}),hN=At({asOfCommitSeq:tn().int(),tables:Gr(Fe()),tableIndex:tn().int(),rowCursor:Fe().nullable()}),IB=At({id:Fe().min(1),table:Fe().min(1),scopes:dN,params:qu(Fe(),aa()).optional(),cursor:tn().int(),bootstrapState:hN.nullable().optional()}),PB=At({clientId:Fe().min(1),limitCommits:tn().int().min(1),limitSnapshotRows:tn().int().min(1).optional(),maxSnapshotPages:tn().int().min(1).optional(),dedupeRows:no().optional(),subscriptions:Gr(IB)}),DB=At({table:Fe(),row_id:Fe(),op:fN,row_json:aa().nullable(),row_version:tn().int().nullable(),scopes:CB}),zB=At({commitSeq:tn().int(),createdAt:Fe(),actorId:Fe(),changes:Gr(DB)}),LB=At({id:Fe(),byteLength:tn().int(),sha256:Fe(),encoding:si(EB),compression:si(TB)}),UB=At({table:Fe(),rows:Gr(aa()),chunks:Gr(LB).optional(),isFirstPage:no(),isLastPage:no()}),$B=At({id:Fe(),status:Vu(["active","revoked"]),scopes:dN,bootstrap:no(),bootstrapState:hN.nullable().optional(),nextCursor:tn().int(),commits:Gr(zB),snapshots:Gr(UB).optional()}),BB=At({ok:si(!0),subscriptions:Gr($B)});At({clientId:Fe().min(1),push:NB.omit({clientId:!0}).optional(),pull:PB.omit({clientId:!0}).optional()});At({ok:si(!0),push:MB.optional(),pull:BB.optional()});new TextEncoder;const FB={setAttribute(){},setAttributes(){},setStatus(){}};function HB(e){return e.level?e.level:e.error?"error":"info"}function ty(e,t){if(!e)return null;switch(t){case"trace":return e.trace??e.debug??e.info??null;case"debug":return e.debug??e.info??null;case"info":return e.info??null;case"warn":return e.warn??e.info??null;case"error":return e.error??e.warn??e.info??null;case"fatal":return e.fatal??e.error??e.warn??e.info??null;default:return e.info??null}}function qB(e){return{setAttribute(t,n){e.setAttribute?.(t,n)},setAttributes(t){if(e.setAttributes){e.setAttributes(t);return}for(const[n,s]of Object.entries(t))e.setAttribute?.(n,s)},setStatus(t){e.setStatus?.(t)}}}function VB(e){if(typeof e=="string")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e=="boolean")return e;if(typeof e=="bigint"){const t=Number(e);return Number.isFinite(t)?t:e.toString()}if(e instanceof Date)return e.toISOString();if(e!=null){if(Array.isArray(e)||typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}function $E(e){const t={};for(const[n,s]of Object.entries(e)){const i=VB(s);i!==void 0&&(t[n]=i)}return Object.keys(t).length>0?t:null}function KB(e){return{startSpan(t,n){return e.startSpan?e.startSpan(t,s=>n(qB(s))):n(FB)}}}function GB(e){return{count(t,n,s){e.metrics?.count?.(t,n??1,s)},gauge(t,n,s){e.metrics?.gauge?.(t,n,s)},distribution(t,n,s){e.metrics?.distribution?.(t,n,s)}}}function ZB(e){return{log(t){const n=HB(t),{event:s,...i}=t,a=ty(e.logger,n);if(!a)return;const l=$E(i);if(!l){a(s);return}a(s,l)},tracer:KB(e),metrics:GB(e),captureException(t,n){if(e.captureException?.(t),!n)return;const s=ty(e.logger,"error")??ty(e.logger,"info");if(!s)return;const i=$E(n);if(!i){s("sync.exception.context");return}s("sync.exception.context",i)}}}function YB(e){if(e?.attributes)return{attributes:e.attributes}}function BE(e){if(!e)return;const t=!!e.attributes,n=!!e.unit;if(!(!t&&!n))return{attributes:e.attributes,unit:e.unit}}function XB(){return ZB({logger:xz,startSpan(e,t){return kR(e,n=>t({setAttribute(s,i){n.setAttribute(s,i)},setAttributes(s){n.setAttributes(s)},setStatus(s){n.setStatus({code:s==="ok"?1:2})}}))},metrics:{count(e,t,n){const s=YB(n);if(s){tE(e,t,s);return}tE(e,t)},gauge(e,t,n){const s=BE(n);if(s){nE(e,t,s);return}nE(e,t)},distribution(e,t,n){const s=BE(n);if(s){rE(e,t,s);return}rE(e,t)}},captureException(e){DR(e)}})}function QB(){return XB()}function WB(e){const t=JB(e);return B4(t),QB()}function JB(e){const t=e.integrations;if(typeof t=="function")return e;const n=t??[];return n.some(i=>i.name==="BrowserTracing")?e:{...e,integrations:[P4(),...n]}}var ny={exports:{}},Yl={};var FE;function e6(){if(FE)return Yl;FE=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(s,i,a){var l=null;if(a!==void 0&&(l=""+a),i.key!==void 0&&(l=""+i.key),"key"in i){a={};for(var f in i)f!=="key"&&(a[f]=i[f])}else a=i;return i=a.ref,{$$typeof:e,type:s,key:l,ref:i!==void 0?i:null,props:a}}return Yl.Fragment=t,Yl.jsx=n,Yl.jsxs=n,Yl}var HE;function t6(){return HE||(HE=1,ny.exports=e6()),ny.exports}var h=t6(),ry={exports:{}},Xl={},sy={exports:{}},oy={};var qE;function n6(){return qE||(qE=1,(function(e){function t(P,G){var q=P.length;P.push(G);e:for(;0<q;){var V=q-1>>>1,L=P[V];if(0<i(L,G))P[V]=G,P[q]=L,q=V;else break e}}function n(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var G=P[0],q=P.pop();if(q!==G){P[0]=q;e:for(var V=0,L=P.length,M=L>>>1;V<M;){var H=2*(V+1)-1,W=P[H],Y=H+1,ae=P[Y];if(0>i(W,q))Y<L&&0>i(ae,W)?(P[V]=ae,P[Y]=q,V=Y):(P[V]=W,P[H]=q,V=H);else if(Y<L&&0>i(ae,q))P[V]=ae,P[Y]=q,V=Y;else break e}}return G}function i(P,G){var q=P.sortIndex-G.sortIndex;return q!==0?q:P.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var l=Date,f=l.now();e.unstable_now=function(){return l.now()-f}}var d=[],p=[],g=1,y=null,b=3,x=!1,S=!1,w=!1,T=!1,C=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function R(P){for(var G=n(p);G!==null;){if(G.callback===null)s(p);else if(G.startTime<=P)s(p),G.sortIndex=G.expirationTime,t(d,G);else break;G=n(p)}}function I(P){if(w=!1,R(P),!S)if(n(d)!==null)S=!0,z||(z=!0,U());else{var G=n(p);G!==null&&ee(I,G.startTime-P)}}var z=!1,N=-1,A=5,D=-1;function Q(){return T?!0:!(e.unstable_now()-D<A)}function B(){if(T=!1,z){var P=e.unstable_now();D=P;var G=!0;try{e:{S=!1,w&&(w=!1,O(N),N=-1),x=!0;var q=b;try{t:{for(R(P),y=n(d);y!==null&&!(y.expirationTime>P&&Q());){var V=y.callback;if(typeof V=="function"){y.callback=null,b=y.priorityLevel;var L=V(y.expirationTime<=P);if(P=e.unstable_now(),typeof L=="function"){y.callback=L,R(P),G=!0;break t}y===n(d)&&s(d),R(P)}else s(d);y=n(d)}if(y!==null)G=!0;else{var M=n(p);M!==null&&ee(I,M.startTime-P),G=!1}}break e}finally{y=null,b=q,x=!1}G=void 0}}finally{G?U():z=!1}}}var U;if(typeof j=="function")U=function(){j(B)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,K=Z.port2;Z.port1.onmessage=B,U=function(){K.postMessage(null)}}else U=function(){C(B,0)};function ee(P,G){N=C(function(){P(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(P){switch(b){case 1:case 2:case 3:var G=3;break;default:G=b}var q=b;b=G;try{return P()}finally{b=q}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(P,G){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var q=b;b=P;try{return G()}finally{b=q}},e.unstable_scheduleCallback=function(P,G,q){var V=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?V+q:V):q=V,P){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=q+L,P={id:g++,callback:G,priorityLevel:P,startTime:q,expirationTime:L,sortIndex:-1},q>V?(P.sortIndex=q,t(p,P),n(d)===null&&P===n(p)&&(w?(O(N),N=-1):w=!0,ee(I,q-V))):(P.sortIndex=L,t(d,P),S||x||(S=!0,z||(z=!0,U()))),P},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(P){var G=b;return function(){var q=b;b=G;try{return P.apply(this,arguments)}finally{b=q}}}})(oy)),oy}var VE;function r6(){return VE||(VE=1,sy.exports=n6()),sy.exports}var iy={exports:{}},Rn={};var KE;function s6(){if(KE)return Rn;KE=1;var e=Hu();function t(d){var p="https://react.dev/errors/"+d;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function a(d,p,g){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:y==null?null:""+y,children:d,containerInfo:p,implementation:g}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(d,p){if(d==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Rn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Rn.createPortal=function(d,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return a(d,p,null,g)},Rn.flushSync=function(d){var p=l.T,g=s.p;try{if(l.T=null,s.p=2,d)return d()}finally{l.T=p,s.p=g,s.d.f()}},Rn.preconnect=function(d,p){typeof d=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(d,p))},Rn.prefetchDNS=function(d){typeof d=="string"&&s.d.D(d)},Rn.preinit=function(d,p){if(typeof d=="string"&&p&&typeof p.as=="string"){var g=p.as,y=f(g,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?s.d.S(d,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:x}):g==="script"&&s.d.X(d,{crossOrigin:y,integrity:b,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Rn.preinitModule=function(d,p){if(typeof d=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=f(p.as,p.crossOrigin);s.d.M(d,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(d)},Rn.preload=function(d,p){if(typeof d=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,y=f(g,p.crossOrigin);s.d.L(d,g,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Rn.preloadModule=function(d,p){if(typeof d=="string")if(p){var g=f(p.as,p.crossOrigin);s.d.m(d,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(d)},Rn.requestFormReset=function(d){s.d.r(d)},Rn.unstable_batchedUpdates=function(d,p){return d(p)},Rn.useFormState=function(d,p,g){return l.H.useFormState(d,p,g)},Rn.useFormStatus=function(){return l.H.useHostTransitionStatus()},Rn.version="19.2.4",Rn}var GE;function pN(){if(GE)return iy.exports;GE=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),iy.exports=s6(),iy.exports}var ZE;function o6(){if(ZE)return Xl;ZE=1;var e=r6(),t=Hu(),n=pN();function s(r){var o="https://react.dev/errors/"+r;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function a(r){var o=r,c=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(c=o.return),r=o.return;while(r)}return o.tag===3?c:null}function l(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function f(r){if(r.tag===31){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function d(r){if(a(r)!==r)throw Error(s(188))}function p(r){var o=r.alternate;if(!o){if(o=a(r),o===null)throw Error(s(188));return o!==r?null:r}for(var c=r,u=o;;){var m=c.return;if(m===null)break;var v=m.alternate;if(v===null){if(u=m.return,u!==null){c=u;continue}break}if(m.child===v.child){for(v=m.child;v;){if(v===c)return d(m),r;if(v===u)return d(m),o;v=v.sibling}throw Error(s(188))}if(c.return!==u.return)c=m,u=v;else{for(var E=!1,k=m.child;k;){if(k===c){E=!0,c=m,u=v;break}if(k===u){E=!0,u=m,c=v;break}k=k.sibling}if(!E){for(k=v.child;k;){if(k===c){E=!0,c=v,u=m;break}if(k===u){E=!0,u=v,c=m;break}k=k.sibling}if(!E)throw Error(s(189))}}if(c.alternate!==u)throw Error(s(190))}if(c.tag!==3)throw Error(s(188));return c.stateNode.current===c?r:o}function g(r){var o=r.tag;if(o===5||o===26||o===27||o===6)return r;for(r=r.child;r!==null;){if(o=g(r),o!==null)return o;r=r.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),j=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function U(r){return r===null||typeof r!="object"?null:(r=B&&r[B]||r["@@iterator"],typeof r=="function"?r:null)}var Z=Symbol.for("react.client.reference");function K(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Z?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case w:return"Fragment";case C:return"Profiler";case T:return"StrictMode";case I:return"Suspense";case z:return"SuspenseList";case D:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case j:return r.displayName||"Context";case O:return(r._context.displayName||"Context")+".Consumer";case R:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case N:return o=r.displayName||null,o!==null?o:K(r.type)||"Memo";case A:o=r._payload,r=r._init;try{return K(r(o))}catch{}}return null}var ee=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q={pending:!1,data:null,method:null,action:null},V=[],L=-1;function M(r){return{current:r}}function H(r){0>L||(r.current=V[L],V[L]=null,L--)}function W(r,o){L++,V[L]=r.current,r.current=o}var Y=M(null),ae=M(null),se=M(null),fe=M(null);function Se(r,o){switch(W(se,o),W(ae,r),W(Y,null),o.nodeType){case 9:case 11:r=(r=o.documentElement)&&(r=r.namespaceURI)?k_(r):0;break;default:if(r=o.tagName,o=o.namespaceURI)o=k_(o),r=O_(o,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}H(Y),W(Y,r)}function pe(){H(Y),H(ae),H(se)}function Me(r){r.memoizedState!==null&&W(fe,r);var o=Y.current,c=O_(o,r.type);o!==c&&(W(ae,r),W(Y,c))}function _e(r){ae.current===r&&(H(Y),H(ae)),fe.current===r&&(H(fe),ql._currentValue=q)}var re,he;function ie(r){if(re===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);re=o&&o[1]||"",he=-1<c.stack.indexOf(`
|
|
60
60
|
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
61
61
|
`+re+r+he}var we=!1;function ye(r,o){if(!r||we)return"";we=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(o){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(oe){var ne=oe}Reflect.construct(r,[],de)}else{try{de.call()}catch(oe){ne=oe}r.call(de.prototype)}}else{try{throw Error()}catch(oe){ne=oe}(de=r())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(oe){if(oe&&ne&&typeof oe.stack=="string")return[oe.stack,ne.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=u.DetermineComponentFrameRoot(),E=v[0],k=v[1];if(E&&k){var $=E.split(`
|
|
62
62
|
`),te=k.split(`
|
|
@@ -83,4 +83,4 @@ ${a}
|
|
|
83
83
|
${l.right}px ${l.bottom}px,
|
|
84
84
|
${l.right}px ${l.top}px,
|
|
85
85
|
${l.left}px ${l.top}px
|
|
86
|
-
)`}return h.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:a}})});function Qh(e,t){e&&Object.assign(e.style,t)}const OG={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},MG={position:"fixed"},IG=_.forwardRef(function(t,n){const{anchor:s,positionMethod:i="absolute",className:a,render:l,side:f="bottom",align:d="center",sideOffset:p=0,alignOffset:g=0,collisionBoundary:y="clipping-ancestors",collisionPadding:b,arrowPadding:x=5,sticky:S=!1,disableAnchorTracking:w,alignItemWithTrigger:T=!0,collisionAvoidance:C=Z9,...O}=t,{store:j,listRef:R,labelsRef:I,alignItemWithTriggerActiveRef:z,selectedItemTextRef:N,valuesRef:A,initialValueRef:D,popupRef:Q,setValue:B}=Wu(),U=$A(),Z=at(j,it.open),K=at(j,it.mounted),ee=at(j,it.modal),P=at(j,it.value),G=at(j,it.openMethod),q=at(j,it.positionerElement),V=at(j,it.triggerElement),L=at(j,it.isItemEqualToValue),M=at(j,it.transitionStatus),H=_.useRef(null),W=_.useRef(null),[Y,ae]=_.useState(T),se=K&&Y&&G!=="touch";!K&&Y!==T&&ae(T),Le(()=>{K||(it.scrollUpArrowVisible(j.state)&&j.set("scrollUpArrowVisible",!1),it.scrollDownArrowVisible(j.state)&&j.set("scrollDownArrowVisible",!1))},[j,K]),_.useImperativeHandle(z,()=>se),BA((se||ee)&&Z&&G!=="touch",V);const fe=DA({anchor:s,floatingRootContext:U,positionMethod:i,mounted:K,side:f,sideOffset:p,align:d,alignOffset:g,arrowPadding:x,collisionBoundary:y,collisionPadding:b,sticky:S,disableAnchorTracking:w??se,collisionAvoidance:C,keepMounted:!0}),Se=se?"none":fe.side,pe=se?MG:fe.positionerStyles,Me=_.useMemo(()=>{const xe={};return Z||(xe.pointerEvents="none"),{role:"presentation",hidden:!K,style:{...pe,...xe}}},[Z,K,pe]),_e={open:Z,side:Se,align:fe.align,anchorHidden:fe.anchorHidden},re=ke(xe=>{j.set("positionerElement",xe)}),he=zt("div",t,{ref:[n,re],state:_e,stateAttributesMapping:nl,props:[Me,Np(M),O]}),ie=_.useRef(0),we=ke(xe=>{if(xe.size===0&&ie.current===0||A.current.length===0)return;const ve=ie.current;if(ie.current=xe.size,xe.size===ve)return;const Ie=Yt(ii);if(ve!==0&&!j.state.multiple&&P!==null&&zy(A.current,P,L)===-1){const Ee=D.current,Qe=Ee!=null&&zy(A.current,Ee,L)!==-1?Ee:null;B(Qe,Ie),Qe===null&&(j.set("selectedIndex",null),N.current=null)}if(ve!==0&&j.state.multiple&&Array.isArray(P)){const Ue=Ve=>zy(A.current,Ve,L)!==-1,Ee=P.filter(Ve=>Ue(Ve));(Ee.length!==P.length||Ee.some(Ve=>!cG(P,Ve,L)))&&(B(Ee,Ie),Ee.length===0&&(j.set("selectedIndex",null),N.current=null))}if(Z&&se){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ue={height:""};Qh(q,Ue),Qh(Q.current,Ue)}}),ye=_.useMemo(()=>({...fe,side:Se,alignItemWithTriggerActive:se,setControlledAlignItemWithTrigger:ae,scrollUpArrowRef:H,scrollDownArrowRef:W}),[fe,Se,se,ae]);return h.jsx(HA,{elementsRef:R,labelsRef:I,onMapChange:we,children:h.jsxs(qA.Provider,{value:ye,children:[K&&ee&&h.jsx(VA,{inert:fx(!Z),cutout:V}),he]})})});function KA(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const Vd="base-ui-disable-scrollbar",PC={className:Vd,getElement(e){return h.jsx("style",{nonce:e,href:Vd,precedence:"base-ui:low",children:`.${Vd}{scrollbar-width:none}.${Vd}::-webkit-scrollbar{display:none}`})}},PG=_.createContext(void 0);function GA(e){return _.useContext(PG)}const wc="ArrowUp",Wi="ArrowDown",Ru="ArrowLeft",Ec="ArrowRight",Ju="Home",ef="End",ZA=new Set([Ru,Ec]),DG=new Set([Ru,Ec,Ju,ef]),YA=new Set([wc,Wi]),zG=new Set([wc,Wi,Ju,ef]),XA=new Set([...ZA,...YA]),LG=new Set([...XA,Ju,ef]),QA=new Set([wc,Wi,Ru,Ec,Ju,ef]),UG="Shift",$G="Control",BG="Alt",FG="Meta",HG=new Set([UG,$G,BG,FG]);function qG(e){return Zt(e)&&e.tagName==="INPUT"}function DC(e){return!!(qG(e)&&e.selectionStart!=null||Zt(e)&&e.tagName==="TEXTAREA")}function zC(e,t,n,s){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop;const l=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(l&&s!=="vertical"){const d=LC(e,t,"left"),p=Kd(e),g=Kd(t);n==="ltr"&&(d+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-p.scrollPaddingRight?i=d+t.offsetWidth+g.scrollMarginRight-e.clientWidth+p.scrollPaddingRight:d-g.scrollMarginLeft<e.scrollLeft+p.scrollPaddingLeft&&(i=d-g.scrollMarginLeft-p.scrollPaddingLeft)),n==="rtl"&&(d-g.scrollMarginRight<e.scrollLeft+p.scrollPaddingLeft?i=d-g.scrollMarginLeft-p.scrollPaddingLeft:d+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-p.scrollPaddingRight&&(i=d+t.offsetWidth+g.scrollMarginRight-e.clientWidth+p.scrollPaddingRight))}if(f&&s!=="horizontal"){const d=LC(e,t,"top"),p=Kd(e),g=Kd(t);d-g.scrollMarginTop<e.scrollTop+p.scrollPaddingTop?a=d-g.scrollMarginTop-p.scrollPaddingTop:d+t.offsetHeight+g.scrollMarginBottom>e.scrollTop+e.clientHeight-p.scrollPaddingBottom&&(a=d+t.offsetHeight+g.scrollMarginBottom-e.clientHeight+p.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:"auto"})}function LC(e,t,n){const s=n==="left"?"offsetLeft":"offsetTop";let i=0;for(;t.offsetParent&&(i+=t[s],t.offsetParent!==e);)t=t.offsetParent;return i}function Kd(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}function Ly(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const VG=_.createContext(void 0),KG={disableStyleElements:!1};function GG(){return _.useContext(VG)??KG}const Vi=1,ZG={...nl,...ba},YG=_.forwardRef(function(t,n){const{render:s,className:i,finalFocus:a,...l}=t,{store:f,popupRef:d,onOpenChangeComplete:p,setOpen:g,valueRef:y,selectedItemTextRef:b,keyboardActiveRef:x,multiple:S,handleScrollArrowVisibility:w,scrollHandlerRef:T,highlightItemOnHover:C}=Wu(),{side:O,align:j,alignItemWithTriggerActive:R,setControlledAlignItemWithTrigger:I,scrollDownArrowRef:z,scrollUpArrowRef:N}=kG(),A=GA()!=null,D=$A(),{nonce:Q,disableStyleElements:B}=GG(),U=ns(),Z=at(f,it.id),K=at(f,it.open),ee=at(f,it.mounted),P=at(f,it.popupProps),G=at(f,it.transitionStatus),q=at(f,it.triggerElement),V=at(f,it.positionerElement),L=at(f,it.listElement),M=_.useRef(0),H=_.useRef(!1),W=_.useRef(0),Y=_.useRef(!1),ae=_.useRef({}),se=ox(),fe=ke(_e=>{if(!V||!d.current||!Y.current)return;if(H.current||!R){w();return}const re=V.style.top==="0px",he=V.style.bottom==="0px",ie=V.getBoundingClientRect().height,we=Rt(V),ye=getComputedStyle(V),xe=parseFloat(ye.marginTop),ve=parseFloat(ye.marginBottom),Ie=UC(getComputedStyle(d.current)),Ue=Math.min(we.documentElement.clientHeight-xe-ve,Ie),Ee=_e.scrollTop,Ve=$C(_e);let Qe=0,Be=null,We=!1,He=!1;const me=qe=>{V.style.height=`${qe}px`},Te=(qe,ht)=>{const lt=Ly(qe,0,Ue-ie);lt>0&&me(ie+lt),_e.scrollTop=ht,Ue-(ie+lt)<=Vi&&(H.current=!0),w()};if(re){const qe=Ve-Ee,ht=ie+qe,lt=Math.min(ht,Ue);if(Qe=lt,qe<=Vi){Te(qe,Ve);return}Ue-lt>Vi?He=!0:We=!0}else if(he){const qe=Ee,ht=ie+qe,lt=Math.min(ht,Ue),wr=ht-Ue;if(Qe=lt,qe<=Vi){Te(qe,0);return}Ue-lt>Vi?Be=0:(We=!0,Ee<Ve&&(Be=Ee-(qe-wr)))}if(Qe=Math.ceil(Qe),Qe!==0&&me(Qe),He||Be!=null){const qe=$C(_e),ht=He?qe:Ly(Be,0,qe);Math.abs(_e.scrollTop-ht)>Vi&&(_e.scrollTop=ht)}(We||Qe>=Ue-Vi)&&(H.current=!0),w()});_.useImperativeHandle(T,()=>fe,[fe]),xa({open:K,ref:d,onComplete(){K&&p?.(!0)}});const Se={open:K,transitionStatus:G,side:O,align:j};Le(()=>{!V||!d.current||Object.keys(ae.current).length||(ae.current={top:V.style.top||"0",left:V.style.left||"0",right:V.style.right,height:V.style.height,bottom:V.style.bottom,minHeight:V.style.minHeight,maxHeight:V.style.maxHeight,marginTop:V.style.marginTop,marginBottom:V.style.marginBottom})},[d,V]),Le(()=>{K||R||(Y.current=!1,H.current=!1,M.current=0,W.current=0,Qh(V,ae.current))},[K,R,V,d]),Le(()=>{const _e=d.current;if(!(!K||!q||!V||!_e||f.state.transitionStatus==="ending")){if(!R){Y.current=!0,se.request(w),_e.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const re=XG(_e);_e.style.removeProperty("--transform-origin");try{const he=getComputedStyle(V),ie=getComputedStyle(_e),we=Rt(q),ye=un(V),xe=q.getBoundingClientRect(),ve=V.getBoundingClientRect(),Ie=xe.left,Ue=xe.height,Ee=L||_e,Ve=Ee.scrollHeight,Qe=parseFloat(ie.borderBottomWidth),Be=parseFloat(he.marginTop)||10,We=parseFloat(he.marginBottom)||10,He=parseFloat(he.minHeight)||100,me=UC(ie),Te=5,qe=5,ht=20,lt=we.documentElement.clientHeight-Be-We,wr=we.documentElement.clientWidth,Er=lt-xe.bottom+Ue,Qt=b.current,ut=y.current;let xt,ot=0,Wt=0;if(Qt&&ut){const tr=ut.getBoundingClientRect();xt=Qt.getBoundingClientRect();const cs=tr.left-Ie,fo=xt.left-ve.left,ho=tr.top-xe.top+tr.height/2,nr=xt.top-ve.top+xt.height/2;ot=cs-fo,Wt=nr-ho}const yn=Er+Wt+We+Qe;let kt=Math.min(lt,yn);const Cn=lt-Be-We,er=yn-kt,An=Math.max(Te,Ie+ot),is=wr-qe,as=Math.max(0,An+ve.width-is);V.style.left=`${An-as}px`,V.style.height=`${kt}px`,V.style.maxHeight="auto",V.style.marginTop=`${Be}px`,V.style.marginBottom=`${We}px`,_e.style.height="100%";const _a=Ee.scrollHeight-Ee.clientHeight,wi=er>=_a;wi&&(kt=Math.min(lt,ve.height)-(er-_a));const Ei=xe.top<ht||xe.bottom>lt-ht||kt<Math.min(Ve,He),_s=(ye.visualViewport?.scale??1)!==1&&tx;if(Ei||_s){Y.current=!0,Qh(V,ae.current),hi.flushSync(()=>I(!1));return}if(wi){const tr=Math.max(0,lt-yn);V.style.top=ve.height>=Cn?"0":`${tr}px`,V.style.height=`${kt}px`,Ee.scrollTop=Ee.scrollHeight-Ee.clientHeight,M.current=Math.max(He,kt)}else V.style.bottom="0",M.current=Math.max(He,kt),Ee.scrollTop=er;if(xt){const tr=ve.top,cs=ve.height,fo=xt.top+xt.height/2,ho=cs>0?(fo-tr)/cs*100:50,nr=Ly(ho,0,100);_e.style.setProperty("--transform-origin",`50% ${nr}%`)}(M.current===lt||kt>=me)&&(H.current=!0),w(),setTimeout(()=>{Y.current=!0})}finally{re()}})}},[f,K,V,q,y,b,d,w,R,I,se,z,N,L]),_.useEffect(()=>{if(!R||!V||!K)return;const _e=un(V);function re(he){g(!1,Yt(bV,he))}return _e.addEventListener("resize",re),()=>{_e.removeEventListener("resize",re)}},[g,R,V,K]);const pe={...L?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":S||void 0,id:`${Z}-list`},onKeyDown(_e){x.current=!0,A&&QA.has(_e.key)&&_e.stopPropagation()},onMouseMove(){x.current=!1},onPointerLeave(_e){if(!C||KA(_e)||_e.pointerType==="touch")return;const re=_e.currentTarget;U.start(0,()=>{f.set("activeIndex",null),re.focus({preventScroll:!0})})},onScroll(_e){L||fe(_e.currentTarget)},...R&&{style:L?{height:"100%"}:OG}},Me=zt("div",t,{ref:[n,d],state:Se,stateAttributesMapping:ZG,props:[P,pe,Np(G),{className:!L&&R?PC.className:void 0},l]});return h.jsxs(_.Fragment,{children:[!B&&PC.getElement(Q),h.jsx(_A,{context:D,modal:!1,disabled:!ee,returnFocus:a,restoreFocus:!0,children:Me})]})});function UC(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function $C(e){return Math.max(0,e.scrollHeight-e.clientHeight)}const BC=[["transform","none"],["scale","1"],["translate","0 0"]];function XG(e){const{style:t}=e,n={};for(const[s,i]of BC)n[s]=t.getPropertyValue(s),t.setProperty(s,i,"important");return()=>{for(const[s]of BC){const i=n[s];i?t.setProperty(s,i):t.removeProperty(s)}}}let WA=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function dx(e={}){const{label:t,metadata:n,textRef:s,indexGuessBehavior:i,index:a}=e,{register:l,unregister:f,subscribeMapChange:d,elementsRef:p,labelsRef:g,nextIndexRef:y}=RG(),b=_.useRef(-1),[x,S]=_.useState(a??(i===WA.GuessFromOrder?()=>{if(b.current===-1){const C=y.current;y.current+=1,b.current=C}return b.current}:-1)),w=_.useRef(null),T=_.useCallback(C=>{if(w.current=C,x!==-1&&C!==null&&(p.current[x]=C,g)){const O=t!==void 0;g.current[x]=O?t:s?.current?.textContent??C.textContent}},[x,p,g,t,s]);return Le(()=>{if(a!=null)return;const C=w.current;if(C)return l(C,n),()=>{f(C)}},[a,l,f,n]),Le(()=>{if(a==null)return d(C=>{const O=w.current?C.get(w.current)?.index:null;O!=null&&S(O)})},[a,d,S]),_.useMemo(()=>({ref:T,index:x}),[x,T])}const QG=_.createContext(void 0),WG=_.memo(_.forwardRef(function(t,n){const{render:s,className:i,value:a=null,label:l,disabled:f=!1,nativeButton:d=!1,...p}=t,g=_.useRef(null),y=dx({label:l,textRef:g,indexGuessBehavior:WA.GuessFromOrder}),{store:b,getItemProps:x,setOpen:S,setValue:w,selectionRef:T,typingRef:C,valuesRef:O,keyboardActiveRef:j,multiple:R,highlightItemOnHover:I}=Wu(),z=ns(),N=at(b,it.isActive,y.index),A=at(b,it.isSelected,y.index,a),D=at(b,it.isSelectedByFocus,y.index),Q=at(b,it.isItemEqualToValue),B=y.index,U=B!==-1,Z=_.useRef(null),K=Jo(B);Le(()=>{if(!U)return;const se=O.current;return se[B]=a,()=>{delete se[B]}},[U,B,a,O]),Le(()=>{if(!U)return;const se=b.state.value;let fe=se;R&&Array.isArray(se)&&se.length>0&&(fe=se[se.length-1]),fe!==void 0&&$c(a,fe,Q)&&b.set("selectedIndex",B)},[U,B,R,Q,b,a]);const ee={disabled:f,selected:A,highlighted:N},P=x({active:N,selected:A});P.onFocus=void 0,P.id=void 0;const G=_.useRef(null),q=_.useRef("mouse"),V=_.useRef(!1),{getButtonProps:L,buttonRef:M}=Jc({disabled:f,focusableWhenDisabled:!0,native:d});function H(se){const fe=b.state.value;if(R){const Se=Array.isArray(fe)?fe:[],pe=A?lG(Se,a,Q):[...Se,a];w(pe,Yt(Cy,se))}else w(a,Yt(Cy,se)),S(!1,Yt(Cy,se))}const W={role:"option","aria-selected":A,tabIndex:N?0:-1,onFocus(){b.set("activeIndex",B)},onMouseEnter(){!j.current&&b.state.selectedIndex===null&&I&&b.set("activeIndex",B)},onMouseMove(){I&&b.set("activeIndex",B)},onMouseLeave(se){!I||j.current||KA(se)||z.start(0,()=>{b.state.activeIndex===B&&b.set("activeIndex",null)})},onTouchStart(){T.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(se){G.current=se.key,b.set("activeIndex",B)},onClick(se){V.current=!1,!(se.type==="keydown"&&G.current===null)&&(f||G.current===" "&&C.current||q.current!=="touch"&&!N||(G.current=null,H(se.nativeEvent)))},onPointerEnter(se){q.current=se.pointerType},onPointerDown(se){q.current=se.pointerType,V.current=!0},onMouseUp(se){if(f)return;if(V.current){V.current=!1;return}const fe=!T.current.allowSelectedMouseUp&&A,Se=!T.current.allowUnselectedMouseUp&&!A;fe||Se||q.current!=="touch"&&!N||H(se.nativeEvent)}},Y=zt("div",t,{ref:[M,n,y.ref,Z],state:ee,props:[P,W,p,L]}),ae=_.useMemo(()=>({selected:A,indexRef:K,textRef:g,selectedByFocus:D,hasRegistered:U}),[A,K,g,D,U]);return h.jsx(QG.Provider,{value:ae,children:Y})})),JG=_.forwardRef(({className:e,children:t,...n},s)=>h.jsx(vG,{ref:s,className:ge("inline-flex items-center justify-between bg-surface border border-border rounded-md px-3 py-1.5 font-mono text-[12px] text-foreground cursor-pointer hover:border-border-bright transition",e),...n,children:t}));JG.displayName="SelectTrigger";const eZ=_.forwardRef(({className:e,portalProps:t,positionerProps:n,...s},i)=>h.jsx(xG,{...t,children:h.jsx(IG,{...n,children:h.jsx(YG,{ref:i,className:ge("bg-panel border border-border rounded-md py-1 shadow-lg z-50",e),...s})})}));eZ.displayName="SelectContent";const tZ=_.forwardRef(({className:e,...t},n)=>h.jsx(WG,{ref:n,className:ge("font-mono text-[11px] px-3 py-1.5 text-neutral-400 cursor-pointer hover:bg-white/[0.03] hover:text-white data-[highlighted]:bg-white/[0.03] data-[highlighted]:text-white outline-none",e),...t}));tZ.displayName="SelectItem";const nZ=_.forwardRef(({className:e,...t},n)=>h.jsx("textarea",{ref:n,className:ge("bg-surface border border-border rounded-md px-3 py-2 font-mono text-[12px] text-foreground outline-none w-full transition focus:border-flow placeholder:text-neutral-600 resize-none min-h-[80px]",e),...t}));nZ.displayName="Textarea";const JA=_.createContext(void 0);function rZ(e=!0){const t=_.useContext(JA);if(t===void 0&&!e)throw new Error(gn(7));return t}function ek(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:s}=Aj(),{ref:i,index:a}=dx(e),l=n===a,f=_.useRef(null),d=so(i,f);return{compositeProps:_.useMemo(()=>({tabIndex:l?0:-1,onFocus(){s(a)},onMouseMove(){const g=f.current;if(!t||!g)return;const y=g.hasAttribute("disabled")||g.ariaDisabled==="true";!l&&!y&&g.focus()}}),[l,s,a,t]),compositeRef:d,index:a}}function sZ(e){const{render:t,className:n,state:s=an,props:i=Eu,refs:a=Eu,metadata:l,stateAttributesMapping:f,tag:d="div",...p}=e,{compositeProps:g,compositeRef:y}=ek({metadata:l});return zt(d,e,{state:s,ref:[...a,y],props:[g,...i,p],stateAttributesMapping:f})}const oZ=_.forwardRef(function(t,n){const{className:s,defaultPressed:i=!1,disabled:a=!1,form:l,onPressedChange:f,pressed:d,render:p,type:g,value:y,nativeButton:b=!0,...x}=t,S=br(y||void 0),w=rZ(),T=w?.value??[],C=w?void 0:i,O=(a||w?.disabled)??!1,[j,R]=pp({controlled:w?S!==void 0&&T.indexOf(S)>-1:d,default:C,name:"Toggle",state:"pressed"}),I=ke((U,Z)=>{S&&w?.setGroupValue?.(S,U,Z),f?.(U,Z)}),{getButtonProps:z,buttonRef:N}=Jc({disabled:O,native:b}),A={disabled:O,pressed:j},D=[N,n],Q=[{"aria-pressed":j,onClick(U){const Z=!j,K=Yt(ii,U.nativeEvent);I(Z,K),!K.isCanceled&&R(Z)}},x,z],B=zt("button",t,{enabled:!w,state:A,ref:D,props:Q});return w?h.jsx(sZ,{tag:"button",render:p,className:s,state:A,refs:D,props:Q}):B}),Dr=_.forwardRef(({className:e,...t},n)=>h.jsx(oZ,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 border border-transparent rounded-sm px-2.5 py-1 cursor-pointer transition-all hover:text-neutral-300 data-[pressed]:text-white data-[pressed]:border-border-bright data-[pressed]:bg-white/[0.03]",e),...t}));Dr.displayName="Toggle";function iZ(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const tk="data-composite-item-active",aZ=[];function cZ(e){const{itemSizes:t,cols:n=1,loopFocus:s=!0,dense:i=!1,orientation:a="both",direction:l,highlightedIndex:f,onHighlightedIndexChange:d,rootRef:p,enableHomeAndEndKeys:g=!1,stopEventPropagation:y=!1,disabledIndices:b,modifierKeys:x=aZ}=e,[S,w]=_.useState(0),T=n>1,C=_.useRef(null),O=so(C,p),j=_.useRef([]),R=_.useRef(!1),I=f??S,z=ke((D,Q=!1)=>{if((d??w)(D),Q){const B=j.current[D];zC(C.current,B,l,a)}}),N=ke(D=>{if(D.size===0||R.current)return;R.current=!0;const Q=Array.from(D.keys()),B=Q.find(Z=>Z?.hasAttribute(tk))??null,U=B?Q.indexOf(B):-1;U!==-1&&z(U),zC(C.current,B,l,a)}),A=_.useMemo(()=>({"aria-orientation":a==="both"?void 0:a,ref:O,onFocus(D){!C.current||!DC(D.target)||D.target.setSelectionRange(0,D.target.value.length??0)},onKeyDown(D){const Q=g?LG:XA;if(!Q.has(D.key)||lZ(D,x)||!C.current)return;const U=l==="rtl",Z=U?Ru:Ec,K={horizontal:Z,vertical:Wi,both:Z}[a],ee=U?Ec:Ru,P={horizontal:ee,vertical:wc,both:ee}[a];if(DC(D.target)&&!iZ(D.target)){const W=D.target.selectionStart,Y=D.target.selectionEnd,ae=D.target.value??"";if(W==null||D.shiftKey||W!==Y||D.key!==P&&W<ae.length||D.key!==K&&W>0)return}let G=I;const q=w8(j,b),V=E8(j,b);if(T){const W=t||Array.from({length:j.current.length},()=>({width:1,height:1})),Y=C8(W,n,i),ae=Y.findIndex(fe=>fe!=null&&!fu(j,fe,b)),se=Y.reduce((fe,Se,pe)=>Se!=null&&!fu(j,Se,b)?pe:fe,-1);G=Y[T8({current:Y.map(fe=>fe?j.current[fe]:null)},{event:D,orientation:a,loopFocus:s,cols:n,disabledIndices:N8([...b||j.current.map((fe,Se)=>fu(j,Se)?Se:void 0),void 0],Y),minIndex:ae,maxIndex:se,prevIndex:R8(I>V?q:I,W,Y,n,D.key===Wi?"bl":D.key===Ec?"tr":"tl"),rtl:U})]}const L={horizontal:[Z],vertical:[Wi],both:[Z,Wi]}[a],M={horizontal:[ee],vertical:[wc],both:[ee,wc]}[a],H=T?Q:{horizontal:g?DG:ZA,vertical:g?zG:YA,both:Q}[a];g&&(D.key===Ju?G=q:D.key===ef&&(G=V)),G===I&&(L.includes(D.key)||M.includes(D.key))&&(s&&G===V&&L.includes(D.key)?G=q:s&&G===q&&M.includes(D.key)?G=V:G=fr(j,{startingIndex:G,decrement:M.includes(D.key),disabledIndices:b})),G!==I&&!ch(j,G)&&(y&&D.stopPropagation(),H.has(D.key)&&D.preventDefault(),z(G,!0),queueMicrotask(()=>{j.current[G]?.focus()}))}}),[n,i,l,b,j,g,I,T,t,s,O,x,z,a,y]);return _.useMemo(()=>({props:A,highlightedIndex:I,onHighlightedIndexChange:z,elementsRef:j,disabledIndices:b,onMapChange:N,relayKeyboardEvent:A.onKeyDown}),[A,I,z,j,b,N])}function lZ(e,t){for(const n of HG.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function nk(e){const{render:t,className:n,refs:s=Eu,props:i=Eu,state:a=an,stateAttributesMapping:l,highlightedIndex:f,onHighlightedIndexChange:d,orientation:p,dense:g,itemSizes:y,loopFocus:b,cols:x,enableHomeAndEndKeys:S,onMapChange:w,stopEventPropagation:T=!0,rootRef:C,disabledIndices:O,modifierKeys:j,highlightItemOnHover:R=!1,tag:I="div",...z}=e,N=IA(),{props:A,highlightedIndex:D,onHighlightedIndexChange:Q,elementsRef:B,onMapChange:U,relayKeyboardEvent:Z}=cZ({itemSizes:y,cols:x,loopFocus:b,dense:g,orientation:p,highlightedIndex:f,onHighlightedIndexChange:d,rootRef:C,stopEventPropagation:T,enableHomeAndEndKeys:S,direction:N,disabledIndices:O,modifierKeys:j}),K=zt(I,e,{state:a,ref:s,props:[A,...i,z],stateAttributesMapping:l}),ee=_.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:Q,highlightItemOnHover:R,relayKeyboardEvent:Z}),[D,Q,R,Z]);return h.jsx(jj.Provider,{value:ee,children:h.jsx(HA,{elementsRef:B,onMapChange:P=>{w?.(P),U(P)},children:K})})}let uZ=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const FC={multiple(e){return e?{[uZ.multiple]:""}:null}},fZ=_.forwardRef(function(t,n){const{defaultValue:s,disabled:i=!1,loopFocus:a=!0,onValueChange:l,orientation:f="horizontal",multiple:d=!1,value:p,className:g,render:y,...b}=t,x=GA(),S=_.useMemo(()=>{if(p===void 0)return s??[]},[p,s]),w=_.useMemo(()=>p!==void 0||s!==void 0,[p,s]),T=(x?.disabled??!1)||i,[C,O]=pp({controlled:p,default:S,name:"ToggleGroup",state:"value"}),j=ke((A,D,Q)=>{let B;if(d?(B=C.slice(),D?B.push(A):B.splice(C.indexOf(A),1)):B=D?[A]:[],Array.isArray(B)){if(l?.(B,Q),Q.isCanceled)return;O(B)}}),R={disabled:T,multiple:d,orientation:f},I=_.useMemo(()=>({disabled:T,orientation:f,setGroupValue:j,value:C,isValueInitialized:w}),[T,f,j,C,w]),z={role:"group"},N=zt("div",t,{enabled:!!x,state:R,ref:n,props:[z,b],stateAttributesMapping:FC});return h.jsx(JA.Provider,{value:I,children:x?N:h.jsx(nk,{render:y,className:g,state:R,refs:[n],props:[z,b],stateAttributesMapping:FC,loopFocus:a,enableHomeAndEndKeys:!0})})}),dh=_.forwardRef(({className:e,...t},n)=>h.jsx(fZ,{ref:n,className:ge("flex items-center gap-0.5",e),...t}));dh.displayName="ToggleGroup";function rk({active:e,onClick:t,children:n,className:s}){return h.jsxs("button",{type:"button",onClick:t,className:ge("font-mono text-[10px] tracking-[1.5px] uppercase bg-transparent border-none px-3.5 py-1 cursor-pointer relative transition-colors",e?"text-white":"text-neutral-500 hover:text-neutral-300",s),children:[n,e&&h.jsx("span",{className:"absolute -bottom-2.5 left-1/2 -translate-x-1/2 w-4 h-0.5 bg-flow rounded-sm shadow-[0_0_8px_rgba(59,130,246,0.5)]"})]})}function dZ({items:e,activeId:t,onItemChange:n,renderItem:s,className:i}){return h.jsx("div",{className:ge("flex items-center gap-0.5",i),children:e.map(a=>{const l=a.id===t,f=()=>n?.(a.id);return s?h.jsx("span",{children:s(a,{active:l,onClick:f})},a.id):h.jsx(rk,{active:l,onClick:f,children:a.label},a.id)})})}const hZ=gi("rounded-full inline-block flex-shrink-0",{variants:{color:{healthy:"bg-healthy",syncing:"bg-syncing",offline:"bg-offline",flow:"bg-flow",relay:"bg-relay",encrypt:"bg-encrypt",muted:"bg-neutral-500"},size:{sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"},glow:{true:"",false:""}},defaultVariants:{color:"healthy",size:"sm",glow:!1}}),pZ={healthy:"0 0 6px #22c55e",syncing:"0 0 6px #f59e0b",offline:"0 0 6px #ef4444",flow:"0 0 6px #3b82f6",relay:"0 0 6px #8b5cf6",encrypt:"0 0 6px #f472b6",muted:"none"};function mZ({color:e,size:t,glow:n,pulse:s,className:i}){return h.jsx("span",{className:ge(hZ({color:e,size:t,glow:n}),s&&"dot-pulse",i),style:n?{boxShadow:pZ[e??"healthy"]}:void 0})}const gZ="0.0.5-42",yZ={version:gZ},vZ=yZ.version;function bZ({label:e,className:t}){return h.jsxs("div",{className:ge("flex items-center gap-3",t),children:[h.jsx(mZ,{color:"healthy",size:"md",glow:!0}),h.jsx("span",{className:"font-display font-bold text-white text-sm tracking-tight",children:"syncular"}),e&&h.jsx("span",{className:"font-mono text-[9px] text-neutral-600 uppercase tracking-widest",children:e}),h.jsxs("span",{className:"font-mono text-[9px] text-neutral-600 tracking-wider",children:["v",vZ]})]})}function xZ({brand:e,center:t,right:n,className:s}){return h.jsxs("nav",{className:ge("fixed top-0 left-0 right-0 z-100 h-[42px] border-b border-border bg-surface/88 backdrop-blur-lg flex items-center justify-between px-5",s),children:[h.jsx("div",{className:"flex items-center gap-3",children:e}),h.jsx("div",{className:"flex items-center gap-0.5",children:t}),h.jsx("div",{className:"flex items-center gap-2",children:n})]})}const SZ=gi("border rounded-lg p-3 font-mono text-[11px]",{variants:{variant:{default:"border-border bg-panel",destructive:"border-offline/20 bg-offline/5 text-offline"}},defaultVariants:{variant:"default"}}),In=_.forwardRef(({className:e,variant:t,...n},s)=>h.jsx("div",{ref:s,role:"alert",className:ge(SZ({variant:t,className:e})),...n}));In.displayName="Alert";const tf=_.forwardRef(({className:e,...t},n)=>h.jsx("h5",{ref:n,className:ge("font-medium text-white mb-1",e),...t}));tf.displayName="AlertTitle";const Pn=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("text-neutral-400",e),...t}));Pn.displayName="AlertDescription";const sk=_.createContext(void 0);function rl(e){const t=_.useContext(sk);if(e===!1&&t===void 0)throw new Error(gn(27));return t}const _Z={...nl,...ba},hx=_.forwardRef(function(t,n){const{render:s,className:i,forceRender:a=!1,...l}=t,{store:f}=rl(),d=f.useState("open"),p=f.useState("nested"),g=f.useState("mounted"),y=f.useState("transitionStatus");return zt("div",t,{state:{open:d,transitionStatus:y},ref:[f.context.backdropRef,n],stateAttributesMapping:_Z,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:a||!p})}),ok=_.forwardRef(function(t,n){const{render:s,className:i,id:a,...l}=t,{store:f}=rl(),d=br(a);return f.useSyncedValueWithCleanup("descriptionElementId",d),zt("p",t,{ref:n,props:[{id:d},l]})});let wZ=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),EZ=(function(e){return e[e.open=Qi.open]="open",e[e.closed=Qi.closed]="closed",e[e.startingStyle=Qi.startingStyle]="startingStyle",e[e.endingStyle=Qi.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const ik=_.createContext(void 0);function TZ(){const e=_.useContext(ik);if(e===void 0)throw new Error(gn(26));return e}const CZ={...nl,...ba,nestedDialogOpen(e){return e?{[EZ.nestedDialogOpen]:""}:null}},ak=_.forwardRef(function(t,n){const{className:s,finalFocus:i,initialFocus:a,render:l,...f}=t,{store:d}=rl(),p=d.useState("descriptionElementId"),g=d.useState("disablePointerDismissal"),y=d.useState("floatingRootContext"),b=d.useState("popupProps"),x=d.useState("modal"),S=d.useState("mounted"),w=d.useState("nested"),T=d.useState("nestedOpenDialogCount"),C=d.useState("open"),O=d.useState("openMethod"),j=d.useState("titleElementId"),R=d.useState("transitionStatus"),I=d.useState("role");TZ(),xa({open:C,ref:d.context.popupRef,onComplete(){C&&d.context.onOpenChangeComplete?.(!0)}});function z(B){return B==="touch"?d.context.popupRef.current:!0}const N=a===void 0?z:a,A=T>0,Q=zt("div",t,{state:{open:C,nested:w,transitionStatus:R,nestedDialogOpen:A},props:[b,{"aria-labelledby":j??void 0,"aria-describedby":p??void 0,role:I,tabIndex:-1,hidden:!S,onKeyDown(B){QA.has(B.key)&&B.stopPropagation()},style:{[wZ.nestedDialogs]:T}},f],ref:[n,d.context.popupRef,d.useStateSetter("popupElement")],stateAttributesMapping:CZ});return h.jsx(_A,{context:y,openInteractionType:O,disabled:!S,closeOnFocusOut:!g,initialFocus:N,returnFocus:i,modal:x!==!1,restoreFocus:"popup",children:Q})}),ck=_.forwardRef(function(t,n){const{keepMounted:s=!1,...i}=t,{store:a}=rl(),l=a.useState("mounted"),f=a.useState("modal"),d=a.useState("open");return l||s?h.jsx(ik.Provider,{value:s,children:h.jsxs(SA,{ref:n,...i,children:[l&&f===!0&&h.jsx(VA,{ref:a.context.internalBackdropRef,inert:fx(!d)}),t.children]})}):null});function RZ(e){const{store:t,parentContext:n,actionsRef:s}=e,i=t.useState("open"),a=t.useState("disablePointerDismissal"),l=t.useState("modal"),f=t.useState("popupElement"),{openMethod:d,triggerProps:p,reset:g}=pG(i);s7(t);const{forceUnmount:y}=o7(i,t,()=>{g()}),b=ke(Q=>{const B=Yt(Q);return B.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},B}),x=_.useCallback(()=>{t.setOpen(!1,b(vV))},[t,b]);_.useImperativeHandle(s,()=>({unmount:y,close:x}),[y,x]);const S=f7({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,T]=_.useState(0),C=w===0,O=x7(S),j=KK(S,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(Q){if(!t.context.outsidePressEnabledRef.current||"button"in Q&&Q.button!==0||"touches"in Q&&Q.touches.length!==1)return!1;const B=Ur(Q);if(C&&!a){const U=B;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===U||t.context.backdropRef.current===U||Ot(U,f)&&!U?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});BA(i&&l===!0,f);const{getReferenceProps:R,getFloatingProps:I,getTriggerProps:z}=v7([O,j]);t.useContextCallback("onNestedDialogOpen",Q=>{T(Q+1)}),t.useContextCallback("onNestedDialogClose",()=>{T(0)}),_.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(w),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,w]);const N=_.useMemo(()=>R(p),[R,p]),A=_.useMemo(()=>z(p),[z,p]),D=_.useMemo(()=>I(),[I]);t.useSyncedValues({openMethod:d,activeTriggerProps:N,inactiveTriggerProps:A,popupProps:D,floatingRootContext:S,nestedOpenDialogCount:w})}const NZ={...c7,modal:Pe(e=>e.modal),nested:Pe(e=>e.nested),nestedOpenDialogCount:Pe(e=>e.nestedOpenDialogCount),disablePointerDismissal:Pe(e=>e.disablePointerDismissal),openMethod:Pe(e=>e.openMethod),descriptionElementId:Pe(e=>e.descriptionElementId),titleElementId:Pe(e=>e.titleElementId),viewportElement:Pe(e=>e.viewportElement),role:Pe(e=>e.role)};class jZ extends kA{constructor(t){super(AZ(t),{popupRef:_.createRef(),backdropRef:_.createRef(),internalBackdropRef:_.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new lx,onOpenChange:void 0,onOpenChangeComplete:void 0},NZ)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const s={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",s);const i={open:t},a=n.trigger?.id??null;(a||t)&&(i.activeTriggerId=a,i.activeTriggerElement=n.trigger??null),this.update(i)}}function AZ(e={}){return{...a7(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function kZ(e){const{children:t,open:n,defaultOpen:s=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:l=!1,modal:f=!0,actionsRef:d,handle:p,triggerId:g,defaultTriggerId:y=null}=e,b=rl(!0),x=!!b,S=zn(()=>p?.store??new jZ({open:s,openProp:n,activeTriggerId:y,triggerIdProp:g,modal:f,disablePointerDismissal:l,nested:x})).current;ZV(()=>{n===void 0&&S.state.open===!1&&s===!0&&S.update({open:!0,activeTriggerId:y})}),S.useControlledProp("openProp",n),S.useControlledProp("triggerIdProp",g),S.useSyncedValues({disablePointerDismissal:l,nested:x,modal:f}),S.useContextCallback("onOpenChange",i),S.useContextCallback("onOpenChangeComplete",a);const w=S.useState("payload");RZ({store:S,actionsRef:d,parentContext:b?.store.context});const T=_.useMemo(()=>({store:S}),[S]);return h.jsx(sk.Provider,{value:T,children:typeof t=="function"?t({payload:w}):t})}const lk=_.forwardRef(function(t,n){const{render:s,className:i,id:a,...l}=t,{store:f}=rl(),d=br(a);return f.useSyncedValueWithCleanup("titleElementId",d),zt("h2",t,{ref:n,props:[{id:d},l]})}),$r=kZ,OZ=_.forwardRef(({className:e,...t},n)=>h.jsx(hx,{ref:n,className:ge("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",e),...t}));OZ.displayName="DialogOverlay";const hr=_.forwardRef(({className:e,children:t,...n},s)=>h.jsxs(ck,{children:[h.jsx(hx,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),h.jsx(ak,{ref:s,className:ge("fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-panel border border-border rounded-lg shadow-lg max-w-lg w-full p-0",e),...n,children:t})]}));hr.displayName="DialogContent";const pr=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-b border-border",e),...t}));pr.displayName="DialogHeader";const Nn=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-t border-border flex justify-end gap-2",e),...t}));Nn.displayName="DialogFooter";const mr=_.forwardRef(({className:e,...t},n)=>h.jsx(lk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 uppercase tracking-widest",e),...t}));mr.displayName="DialogTitle";const MZ=_.forwardRef(({className:e,...t},n)=>h.jsx(ok,{ref:n,className:ge("font-mono text-[10px] text-neutral-500",e),...t}));MZ.displayName="DialogDescription";const px=_.forwardRef(({className:e,page:t,totalPages:n,totalItems:s,onPageChange:i,...a},l)=>h.jsxs("div",{ref:l,className:ge("px-5 py-2.5 border-t border-border flex items-center justify-between",e),...a,children:[h.jsxs("span",{className:"font-mono text-[10px] text-neutral-600",children:[s," items · Page ",t," of ",n]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(Ne,{size:"sm",variant:"default",disabled:t<=1,onClick:()=>i(t-1),children:"Prev"}),h.jsx(Ne,{size:"sm",variant:"default",disabled:t>=n,onClick:()=>i(t+1),children:"Next"})]})]}));px.displayName="Pagination";const IZ=_.forwardRef(({className:e,orientation:t="horizontal",...n},s)=>h.jsx("hr",{ref:s,"aria-orientation":t==="vertical"?"vertical":void 0,className:ge("border-none m-0",t==="horizontal"?"h-px w-full bg-border":"w-px h-4 bg-border",e),...n}));IZ.displayName="Separator";const PZ=gi("fixed z-50 bg-panel shadow-lg overflow-auto",{variants:{side:{top:"top-0 left-0 w-full h-[400px] border-b border-border",right:"right-0 top-0 h-full w-[400px] border-l border-border",bottom:"bottom-0 left-0 w-full h-[400px] border-t border-border",left:"left-0 top-0 h-full w-[400px] border-r border-border"}},defaultVariants:{side:"right"}}),DZ=_.forwardRef(({className:e,side:t,children:n,...s},i)=>h.jsxs(ck,{children:[h.jsx(hx,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),h.jsx(ak,{ref:i,className:ge(PZ({side:t,className:e})),...s,children:n})]}));DZ.displayName="SheetContent";const zZ=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-b border-border",e),...t}));zZ.displayName="SheetHeader";const LZ=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-t border-border flex justify-end gap-2",e),...t}));LZ.displayName="SheetFooter";const UZ=_.forwardRef(({className:e,...t},n)=>h.jsx(lk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 uppercase tracking-widest",e),...t}));UZ.displayName="SheetTitle";const $Z=_.forwardRef(({className:e,...t},n)=>h.jsx(ok,{ref:n,className:ge("text-sm text-neutral-400",e),...t}));$Z.displayName="SheetDescription";const BZ=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("rounded-md bg-neutral-800 animate-pulse",e),...t}));BZ.displayName="Skeleton";const FZ=_.createContext(void 0);function mx(){const e=_.useContext(FZ);if(e===void 0)throw new Error(gn(64));return e}let HZ=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const uk={tabActivationDirection:e=>({[HZ.activationDirection]:e})},fk=_.createContext(void 0);function qZ(){const e=_.useContext(fk);if(e===void 0)throw new Error(gn(65));return e}const VZ=_.forwardRef(function(t,n){const{className:s,disabled:i=!1,render:a,value:l,id:f,nativeButton:d=!0,...p}=t,{value:g,getTabPanelIdByValue:y,orientation:b}=mx(),{activateOnFocus:x,highlightedTabIndex:S,onTabActivation:w,setHighlightedTabIndex:T,tabsListElement:C}=qZ(),O=br(f),j=_.useMemo(()=>({disabled:i,id:O,value:l}),[i,O,l]),{compositeProps:R,compositeRef:I,index:z}=ek({metadata:j}),N=l===g,A=_.useRef(!1);Le(()=>{if(A.current){A.current=!1;return}if(!(N&&z>-1&&S!==z))return;const V=C;if(V!=null){const L=Fo(Rt(V));if(L&&Ot(V,L))return}i||T(z)},[N,z,S,T,i,C]);const{getButtonProps:D,buttonRef:Q}=Jc({disabled:i,native:d,focusableWhenDisabled:!0}),B=y(l),U=_.useRef(!1),Z=_.useRef(!1);function K(V){N||i||w(l,Yt(ii,V.nativeEvent,void 0,{activationDirection:"none"}))}function ee(V){N||(z>-1&&!i&&T(z),!i&&x&&(!U.current||U.current&&Z.current)&&w(l,Yt(ii,V.nativeEvent,void 0,{activationDirection:"none"})))}function P(V){if(N||i)return;U.current=!0;function L(){U.current=!1,Z.current=!1}(!V.button||V.button===0)&&(Z.current=!0,Rt(V.currentTarget).addEventListener("pointerup",L,{once:!0}))}return zt("button",t,{state:{disabled:i,active:N,orientation:b},ref:[n,Q,I],props:[R,{role:"tab","aria-controls":B,"aria-selected":N,id:O,onClick:K,onFocus:ee,onPointerDown:P,[tk]:N?"":void 0,onKeyDownCapture(){A.current=!0}},p,D]})});let KZ=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const GZ={...uk,...ba},ZZ=_.forwardRef(function(t,n){const{className:s,value:i,render:a,keepMounted:l=!1,...f}=t,{value:d,getTabIdByPanelValue:p,orientation:g,tabActivationDirection:y,registerMountedTabPanel:b,unregisterMountedTabPanel:x}=mx(),S=br(),w=_.useMemo(()=>({id:S,value:i}),[S,i]),{ref:T,index:C}=dx({metadata:w}),O=i===d,{mounted:j,transitionStatus:R,setMounted:I}=Rp(O),z=!j,N=p(i),A={hidden:z,orientation:g,tabActivationDirection:y,transitionStatus:R},D=_.useRef(null),Q=zt("div",t,{state:A,ref:[n,T,D],props:[{"aria-labelledby":N,hidden:z,id:S,role:"tabpanel",tabIndex:O?0:-1,inert:fx(!O),[KZ.index]:C},f],stateAttributesMapping:GZ});return xa({open:O,ref:D,onComplete(){O||I(!1)}}),Le(()=>{if(!(z&&!l)&&S!=null)return b(i,S),()=>{x(i,S)}},[z,l,i,S,b,x]),l||j?Q:null}),YZ=_.forwardRef(function(t,n){const{activateOnFocus:s=!1,className:i,loopFocus:a=!0,render:l,...f}=t,{getTabElementBySelectedValue:d,onValueChange:p,orientation:g,value:y,setTabMap:b,tabActivationDirection:x}=mx(),[S,w]=_.useState(0),[T,C]=_.useState(null),O=XZ(y,g,T,d),j=ke((N,A)=>{if(N!==y){const D=O(N);A.activationDirection=D,p(N,A)}}),R={orientation:g,tabActivationDirection:x},I={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},z=_.useMemo(()=>({activateOnFocus:s,highlightedTabIndex:S,onTabActivation:j,setHighlightedTabIndex:w,tabsListElement:T,value:y}),[s,S,j,w,T,y]);return h.jsx(fk.Provider,{value:z,children:h.jsx(nk,{render:l,className:i,state:R,refs:[n,C],props:[I,f],stateAttributesMapping:uk,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:a,orientation:g,onHighlightedIndexChange:w,onMapChange:b,disabledIndices:Eu})})});function HC(e,t){const{left:n,top:s}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect(),l=n-i,f=s-a;return{left:l,top:f}}function XZ(e,t,n,s){const[i,a]=_.useState(null);return Le(()=>{if(e==null||n==null){a(null);return}const l=s(e);if(l==null){a(null);return}const{left:f,top:d}=HC(l,n);a(t==="horizontal"?f:d)},[t,s,n,e]),_.useCallback(l=>{if(l===e)return"none";if(l==null)return a(null),"none";if(l!=null&&n!=null){const f=s(l);if(f!=null){const{left:d,top:p}=HC(f,n);if(i==null)return a(t==="horizontal"?d:p),"none";if(t==="horizontal"){if(d<i)return a(d),"left";if(d>i)return a(d),"right"}else{if(p<i)return a(p),"up";if(p>i)return a(p),"down"}}}return"none"},[s,t,i,n,e])}const QZ=_.forwardRef(({className:e,...t},n)=>h.jsx(YZ,{ref:n,className:ge("flex items-center gap-0.5",e),...t}));QZ.displayName="TabsList";const WZ=gi("inline-flex items-center justify-center cursor-pointer transition-all outline-none",{variants:{variant:{default:"font-mono text-[10px] text-neutral-500 border border-transparent rounded-sm px-2.5 py-1 hover:text-neutral-300 data-[selected]:text-white data-[selected]:border-border-bright data-[selected]:bg-white/[0.03]",pills:"font-mono text-[10px] text-neutral-500 border border-transparent rounded-full px-3 py-1 hover:text-neutral-300 data-[selected]:text-white data-[selected]:border-border-bright data-[selected]:bg-white/[0.03]"}},defaultVariants:{variant:"default"}}),JZ=_.forwardRef(({className:e,variant:t,...n},s)=>h.jsx(VZ,{ref:s,className:ge(WZ({variant:t,className:e})),...n}));JZ.displayName="TabsTrigger";const eY=_.forwardRef(({className:e,...t},n)=>h.jsx(ZZ,{ref:n,className:ge("outline-none",e),...t}));eY.displayName="TabsContent";const tY=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("font-mono text-[11px] text-neutral-300",e),...t}));tY.displayName="Text";const nY=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("font-mono text-[10px] text-neutral-500",e),...t}));nY.displayName="TextMuted";const rY=_.forwardRef(({className:e,...t},n)=>h.jsx("code",{ref:n,className:ge("font-mono text-[11px] text-white",e),...t}));rY.displayName="TextCode";const sY=_.forwardRef(({className:e,...t},n)=>h.jsx("span",{ref:n,className:ge("font-mono text-[9px] uppercase tracking-wider text-neutral-500",e),...t}));sY.displayName="TextLabel";const oY=_.forwardRef(({className:e,...t},n)=>h.jsx("pre",{ref:n,className:ge("font-mono text-[11px] text-neutral-300 p-3 rounded border border-border bg-panel-alt overflow-x-auto",e),...t}));oY.displayName="CodeBlock";const dk=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const iY=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const aY=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const qC=e=>{const t=aY(e);return t.charAt(0).toUpperCase()+t.slice(1)};var cY={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const lY=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const uY=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:a,iconNode:l,...f},d)=>_.createElement("svg",{ref:d,...cY,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:dk("lucide",i),...!a&&!lY(f)&&{"aria-hidden":"true"},...f},[...l.map(([p,g])=>_.createElement(p,g)),...Array.isArray(a)?a:[a]]));const fY=(e,t)=>{const n=_.forwardRef(({className:s,...i},a)=>_.createElement(uY,{ref:a,iconNode:t,className:dk(`lucide-${iY(qC(e))}`,`lucide-${e}`,s),...i}));return n.displayName=qC(e),n};const dY=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],hY=fY("settings",dY),pY="console:instance-id";function Lt(){const[e,t]=pi(pY,""),n=e.trim();return _.useMemo(()=>({instanceId:n.length>0?n:void 0,rawInstanceId:e,setInstanceId:t,clearInstanceId:()=>t("")}),[n,e,t])}const Jn={stats:e=>["console","stats",e],timeseries:e=>["console","stats","timeseries",e],latency:e=>["console","stats","latency",e],commits:e=>["console","commits",e],commitDetail:(e,t,n)=>["console","commit-detail",e,t,n],timeline:e=>["console","timeline",e],clients:e=>["console","clients",e],eventDetail:(e,t,n)=>["console","event-detail",e,t,n],eventPayload:(e,t,n)=>["console","event-payload",e,t,n],handlers:e=>["console","handlers",e],prunePreview:e=>["console","prune","preview",e],operations:e=>["console","operations",e],apiKeys:e=>["console","api-keys",e],storage:e=>["console","storage",e]};function _i(e,t){return e===0?!1:e??t}function nf(e,t){return t?{...e,instanceId:t}:e}function Sa(e){return encodeURIComponent(String(e))}function Ln(e,t,n){const s=e.endsWith("/")?e.slice(0,-1):e,i=n?.toString();return`${s}${t}${i?`?${i}`:""}`}function rf(e={}){const t=Vt(),{instanceId:n}=Lt(),s=e.instanceId??n,i=nf(e.partitionId?{partitionId:e.partitionId}:{},s);return Wn({queryKey:Jn.stats({partitionId:e.partitionId,instanceId:s}),queryFn:()=>{if(!t)throw new Error("Not connected");return Ku(t.GET("/console/stats",{params:{query:i}}))},enabled:!!t,refetchInterval:_i(e.refetchIntervalMs,5e3)})}function mY(e={},t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=e.instanceId??i;return Wn({queryKey:Jn.timeseries({...e,instanceId:a}),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");const l=new URLSearchParams;e.interval&&l.set("interval",e.interval),e.range&&l.set("range",e.range),e.partitionId&&l.set("partitionId",e.partitionId),a&&l.set("instanceId",a);const f=await fetch(`${s.serverUrl}/console/stats/timeseries?${l}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!f.ok)throw new Error("Failed to fetch timeseries stats");return f.json()},enabled:(t.enabled??!0)&&!!n&&!!s,refetchInterval:_i(t.refetchIntervalMs,3e4)})}function gY(e={},t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=e.instanceId??i;return Wn({queryKey:Jn.latency({...e,instanceId:a}),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");const l=new URLSearchParams;e.range&&l.set("range",e.range),e.partitionId&&l.set("partitionId",e.partitionId),a&&l.set("instanceId",a);const f=await fetch(`${s.serverUrl}/console/stats/latency?${l}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!f.ok)throw new Error("Failed to fetch latency stats");return f.json()},enabled:(t.enabled??!0)&&!!n&&!!s,refetchInterval:_i(t.refetchIntervalMs,3e4)})}function yY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=nf({limit:e.limit,offset:e.offset,partitionId:e.partitionId},i);return Wn({queryKey:Jn.commits({...e,instanceId:i}),queryFn:()=>{if(!n)throw new Error("Not connected");return Ku(n.GET("/console/commits",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:_i(t.refetchIntervalMs,1e4)})}function vY(e,t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=t.instanceId??i;return Wn({queryKey:Jn.commitDetail(e,t.partitionId,a),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");if(e===void 0)throw new Error("Commit sequence is required");const l=new URLSearchParams;t.partitionId&&l.set("partitionId",t.partitionId),a&&l.set("instanceId",a);const f=l.toString(),d=await fetch(`${s.serverUrl}/console/commits/${Sa(e)}${f?`?${f}`:""}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!d.ok)throw new Error("Failed to fetch commit detail");return d.json()},enabled:(t.enabled??!0)&&e!==void 0&&!!n})}function bY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=nf({limit:e.limit,offset:e.offset,partitionId:e.partitionId,view:e.view,eventType:e.eventType,actorId:e.actorId,clientId:e.clientId,requestId:e.requestId,traceId:e.traceId,table:e.table,outcome:e.outcome,search:e.search,from:e.from,to:e.to},i);return Wn({queryKey:Jn.timeline({...e,instanceId:i}),queryFn:()=>{if(!n)throw new Error("Not connected");return Ku(n.GET("/console/timeline",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:_i(t.refetchIntervalMs,1e4)})}function hk(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=nf({limit:e.limit,offset:e.offset,partitionId:e.partitionId},i);return Wn({queryKey:Jn.clients({...e,instanceId:i}),queryFn:()=>{if(!n)throw new Error("Not connected");return Ku(n.GET("/console/clients",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:_i(t.refetchIntervalMs,1e4)})}function xY(e,t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=t.instanceId??i;return Wn({queryKey:Jn.eventDetail(e,t.partitionId,a),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");if(e===void 0)throw new Error("Event id is required");const l=new URLSearchParams;t.partitionId&&l.set("partitionId",t.partitionId),a&&l.set("instanceId",a);const f=l.toString(),d=await fetch(`${s.serverUrl}/console/events/${Sa(e)}${f?`?${f}`:""}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!d.ok)throw new Error("Failed to fetch event detail");return d.json()},enabled:(t.enabled??!0)&&e!==void 0&&!!n})}function SY(e,t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=t.instanceId??i;return Wn({queryKey:Jn.eventPayload(e,t.partitionId,a),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");if(e===void 0)throw new Error("Event id is required");const l=new URLSearchParams;t.partitionId&&l.set("partitionId",t.partitionId),a&&l.set("instanceId",a);const f=l.toString(),d=await fetch(`${s.serverUrl}/console/events/${Sa(e)}/payload${f?`?${f}`:""}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!d.ok)throw new Error("Failed to fetch event payload");return d.json()},enabled:(t.enabled??!0)&&e!==void 0&&!!n})}function _Y(e={}){const t=Vt(),{config:n}=Dt(),{instanceId:s}=Lt(),i=e.instanceId??s;return Wn({queryKey:Jn.handlers(i),queryFn:async()=>{if(!t||!n)throw new Error("Not connected");const a=new URLSearchParams;i&&a.set("instanceId",i);const l=await fetch(Ln(n.serverUrl,"/console/handlers",a),{headers:{Authorization:`Bearer ${n.token}`}});if(!l.ok)throw new Error("Failed to fetch handlers");return l.json()},enabled:!!t&&!!n})}function wY(e={}){const t=Vt(),{config:n}=Dt(),{instanceId:s}=Lt(),i=e.instanceId??s;return Wn({queryKey:Jn.prunePreview(i),queryFn:async()=>{if(!t||!n)throw new Error("Not connected");const a=new URLSearchParams;i&&a.set("instanceId",i);const l=await fetch(Ln(n.serverUrl,"/console/prune/preview",a),{method:"POST",headers:{Authorization:`Bearer ${n.token}`}});if(!l.ok)throw new Error("Failed to fetch prune preview");return l.json()},enabled:!!t&&!!n&&(e.enabled??!0)})}function EY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=nf({limit:e.limit,offset:e.offset,operationType:e.operationType,partitionId:e.partitionId},i);return Wn({queryKey:Jn.operations({...e,instanceId:i}),queryFn:()=>{if(!n)throw new Error("Not connected");return Ku(n.GET("/console/operations",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:_i(t.refetchIntervalMs,1e4)})}function TY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async({clientId:i,partitionId:a,instanceId:l})=>{if(!e||!t)throw new Error("Not connected");const f=l??n,d=new URLSearchParams;a&&d.set("partitionId",a),f&&d.set("instanceId",f);const p=await fetch(Ln(t.serverUrl,`/console/clients/${Sa(i)}`,d),{method:"DELETE",headers:{Authorization:`Bearer ${t.token}`}});if(!p.ok)throw new Error("Failed to evict client");return p.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","clients"]}),s.invalidateQueries({queryKey:["console","stats"]}),s.invalidateQueries({queryKey:["console","operations"]})}})}function CY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async()=>{if(!e||!t)throw new Error("Not connected");const i=new URLSearchParams;n&&i.set("instanceId",n);const a=await fetch(Ln(t.serverUrl,"/console/prune",i),{method:"POST",headers:{Authorization:`Bearer ${t.token}`}});if(!a.ok)throw new Error("Failed to prune");return a.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","stats"]}),s.invalidateQueries({queryKey:["console","commits"]}),s.invalidateQueries({queryKey:["console","timeline"]}),s.invalidateQueries({queryKey:["console","prune","preview"]}),s.invalidateQueries({queryKey:["console","operations"]})}})}function RY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async()=>{if(!e||!t)throw new Error("Not connected");const i=new URLSearchParams;n&&i.set("instanceId",n);const a=await fetch(Ln(t.serverUrl,"/console/compact",i),{method:"POST",headers:{Authorization:`Bearer ${t.token}`}});if(!a.ok)throw new Error("Failed to compact");return a.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","stats"]}),s.invalidateQueries({queryKey:["console","operations"]})}})}function NY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=i.instanceId??n,l=new URLSearchParams;a&&l.set("instanceId",a);const f=await fetch(Ln(t.serverUrl,"/console/notify-data-change",l),{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify({tables:i.tables,partitionId:i.partitionId})});if(!f.ok)throw new Error("Failed to notify data change");return f.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","stats"]}),s.invalidateQueries({queryKey:["console","commits"]}),s.invalidateQueries({queryKey:["console","timeline"]}),s.invalidateQueries({queryKey:["console","operations"]})}})}function jY(e={}){const t=Vt(),{config:n}=Dt(),{instanceId:s}=Lt(),i=e.instanceId??s;return Wn({queryKey:Jn.apiKeys({...e,instanceId:i}),queryFn:async()=>{if(!t||!n)throw new Error("Not connected");const a=new URLSearchParams;e.limit!==void 0&&a.set("limit",String(e.limit)),e.offset!==void 0&&a.set("offset",String(e.offset)),e.type&&a.set("type",e.type),e.status&&a.set("status",e.status),e.expiresWithinDays!==void 0&&a.set("expiresWithinDays",String(e.expiresWithinDays)),i&&a.set("instanceId",i);const l=await fetch(Ln(n.serverUrl,"/console/api-keys",a),{headers:{Authorization:`Bearer ${n.token}`}});if(!l.ok)throw new Error("Failed to fetch API keys");return l.json()},enabled:!!t&&!!n})}function AY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,"/console/api-keys",a),{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok)throw new Error("Failed to create API key");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function kY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,`/console/api-keys/${Sa(i)}`,a),{method:"DELETE",headers:{Authorization:`Bearer ${t.token}`}});if(!l.ok)throw new Error("Failed to revoke API key");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function OY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,"/console/api-keys/bulk-revoke",a),{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok)throw new Error("Failed to bulk revoke API keys");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function MY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,`/console/api-keys/${Sa(i)}/rotate`,a),{method:"POST",headers:{Authorization:`Bearer ${t.token}`}});if(!l.ok)throw new Error("Failed to rotate API key");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function IY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,`/console/api-keys/${Sa(i)}/rotate/stage`,a),{method:"POST",headers:{Authorization:`Bearer ${t.token}`}});if(!l.ok)throw new Error("Failed to stage-rotate API key");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function PY(e={}){const{config:t}=Dt();return Wn({queryKey:Jn.storage({prefix:e.prefix,cursor:e.cursor,limit:e.limit}),queryFn:async()=>{if(!t)throw new Error("Not connected");const n=new URLSearchParams;e.prefix&&n.set("prefix",e.prefix),e.cursor&&n.set("cursor",e.cursor),e.limit&&n.set("limit",String(e.limit));const s=await fetch(Ln(t.serverUrl,"/console/storage",n),{method:"GET",headers:{Authorization:`Bearer ${t.token}`}});if(!s.ok)throw new Error("Failed to list blobs");return s.json()},enabled:!!t,refetchInterval:_i(e.refetchIntervalMs,3e4)})}function DY(){const{config:e}=Dt(),t=_r();return os({mutationFn:async n=>{if(!e)throw new Error("Not connected");const s=encodeURIComponent(n),i=await fetch(Ln(e.serverUrl,`/console/storage/${s}`,new URLSearchParams),{method:"DELETE",headers:{Authorization:`Bearer ${e.token}`}});if(!i.ok)throw new Error("Failed to delete blob");return i.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["console","storage"]})}})}function zY(){const{config:e}=Dt();return async t=>{if(!e)throw new Error("Not connected");const n=encodeURIComponent(t),s=await fetch(Ln(e.serverUrl,`/console/storage/${n}/download`,new URLSearchParams),{method:"GET",headers:{Authorization:`Bearer ${e.token}`}});if(!s.ok)throw new Error("Failed to download blob");const i=await s.blob(),a=URL.createObjectURL(i),l=document.createElement("a");l.href=a,l.download=t.split("/").pop()||t,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}}const LY="console:partition-id";function sf(){const[e,t]=pi(LY,""),n=e.trim();return _.useMemo(()=>({partitionId:n.length>0?n:void 0,rawPartitionId:e,setPartitionId:t,clearPartitionId:()=>t("")}),[n,e,t])}const VC={refreshInterval:5,timeFormat:"relative",showSparklines:!0,pageSize:20};function of(){const[e,t]=pi("console:preferences",VC);return{preferences:e,setPreferences:t,updatePreference:(i,a)=>{t(l=>({...l,[i]:a}))},resetPreferences:()=>{t(VC)}}}const UY=[{value:5,label:"5 seconds"},{value:10,label:"10 seconds"},{value:30,label:"30 seconds"},{value:60,label:"1 minute"},{value:0,label:"Manual only"}],$Y=[{value:10,label:"10"},{value:20,label:"20"},{value:50,label:"50"},{value:100,label:"100"}],gx="syncular-console-root";function BY(e){e.classList.add(gx)}const FY=[{suffix:"",label:"Command"},{suffix:"/stream",label:"Stream"},{suffix:"/fleet",label:"Fleet"},{suffix:"/ops",label:"Ops"},{suffix:"/storage",label:"Storage"},{suffix:"/config",label:"Config"}];function HY(e){const t=e?.trim()??"";return!t||t==="/"?"":(t.startsWith("/")?t:`/${t}`).replace(/\/+$/g,"")}function Uy(e,t){return e?t?`${e}${t}`:e:t||"/"}function qY({basePath:e}){const{connect:t,config:n,isConnected:s,isConnecting:i}=Dt(),{preferences:a}=of(),{instanceId:l,rawInstanceId:f,setInstanceId:d,clearInstanceId:p}=Lt(),{partitionId:g,rawPartitionId:y,setPartitionId:b,clearPartitionId:x}=sf(),S=vr({select:N=>N.location.pathname}),{data:w}=rf({refetchIntervalMs:a.refreshInterval*1e3,partitionId:g,instanceId:l}),T=HY(e),C=_.useMemo(()=>FY.map(N=>({...N,id:Uy(T,N.suffix)})),[T]),O=Uy(T,""),j=Uy(T,"/config"),R=i?"connecting":s?"connected":n?"disconnected":"not-configured",I=C.find(N=>N.suffix===""?S===O||S===`${O}/`:S.startsWith(N.id))?.id??O,z=w?[{label:"HEAD",value:`#${w.maxCommitSeq}`},{label:"COMMITS",value:`${w.commitCount}`},{label:"CHANGES",value:`${w.changeCount}`},{label:"CLIENTS",value:`${w.activeClientCount}/${w.clientCount}`}]:[];return h.jsxs("div",{className:`${gx} h-screen bg-background text-foreground flex flex-col`,children:[h.jsx(xZ,{brand:h.jsx(bc,{to:O,children:h.jsx(bZ,{label:"console"})}),center:h.jsx(dZ,{items:C,activeId:I,renderItem:(N,{active:A})=>h.jsx(bc,{to:N.id,children:h.jsx(rk,{active:A,children:N.label})},N.id)}),right:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"font-mono text-[9px] text-neutral-500 uppercase tracking-wide",children:"Instance"}),h.jsx(Gn,{variant:"mono",value:f,onChange:N=>d(N.target.value),onBlur:N=>d(N.target.value.trim()),placeholder:"all",className:"h-7 w-[110px] px-2 py-1"}),l?h.jsx(Ne,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:p,children:"All"}):null]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"font-mono text-[9px] text-neutral-500 uppercase tracking-wide",children:"Partition"}),h.jsx(Gn,{variant:"mono",value:y,onChange:N=>b(N.target.value),onBlur:N=>b(N.target.value.trim()),placeholder:"all",className:"h-7 w-[110px] px-2 py-1"}),g?h.jsx(Ne,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:x,children:"All"}):null]}),h.jsx(RV,{state:R}),h.jsx(bc,{to:j,children:h.jsx(Ne,{variant:S===j?"secondary":"ghost",size:"icon",children:h.jsx(hY,{})})})]})}),h.jsx("main",{className:"flex-1 overflow-auto pt-[42px] pb-[32px]",children:h.jsx("div",{className:"min-h-full",children:s||S===j?h.jsx("div",{style:{animation:"pageIn 0.3s ease-out"},children:h.jsx(YN,{})},S):h.jsx(VY,{configPath:j,hasSavedConfig:!!n,isConnecting:i,onConnect:()=>{t()}})})}),s&&h.jsx(Bj,{isLive:s,metrics:z,uptime:"--"})]})}function VY({configPath:e,hasSavedConfig:t,isConnecting:n,onConnect:s}){return h.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[h.jsx("p",{className:"mb-4 text-foreground-muted",children:"Not connected to a @syncular server"}),h.jsxs("div",{className:"flex items-center gap-2",children:[t&&h.jsx(Ne,{variant:"default",onClick:s,disabled:n,children:n?"Connecting...":"Connect"}),h.jsx(bc,{to:e,children:h.jsx(Ne,{variant:"link",children:"Configure connection"})})]})]})}const uo=NH({component:qY});function KY(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("swServer")==="1"}function GY(e={}){const{maxEvents:t=100,enabled:n=!0,staleAfterMs:s=65e3,replayLimit:i=100,partitionId:a,instanceId:l}=e,{config:f,isConnected:d}=Dt(),{instanceId:p}=Lt(),g=l??p,[y,b]=_.useState([]),[x,S]=_.useState(!1),[w,T]=_.useState("disconnected"),[C,O]=_.useState(null),j=_.useRef(null),R=_.useRef(null),I=_.useRef(null),z=_.useRef(0),N=_.useRef(0),A=_.useRef(null),D=_.useRef(null),Q=_.useCallback(()=>{b([]),A.current=null,D.current=null},[]);return _.useEffect(()=>{if(!n||!d||!f?.serverUrl||!f?.token)return;let B=!1;const U=Number.isFinite(i)?Math.max(1,Math.min(500,Math.floor(i))):100;if(KY()||typeof WebSocket>"u"){T("connecting"),S(!1);let V=null,L=!1;const M=async()=>{if(!(B||L)){L=!0;try{const H=new URL(f.serverUrl,window.location.origin),W=H.pathname.endsWith("/")?H.pathname.slice(0,-1):H.pathname;H.pathname=`${W}/console/events`,H.search="",H.searchParams.set("limit",String(U)),H.searchParams.set("offset","0"),a&&H.searchParams.set("partitionId",a);const Y=await fetch(H.toString(),{headers:{Authorization:`Bearer ${f.token}`}});if(!Y.ok)throw new Error(`Live event polling failed (${Y.status})`);const ae=await Y.json(),fe=(Array.isArray(ae.items)?ae.items:[]).filter(Me=>g?Me.instanceId===g:!0).sort((Me,_e)=>Me.eventId-_e.eventId),Se=D.current??-1,pe=fe.filter(Me=>Me.eventId>Se);if(pe.length>0){const Me=pe.map(re=>({type:re.eventType,timestamp:re.createdAt,data:re})).reverse();b(re=>[...Me,...re].slice(0,t));const _e=pe[pe.length-1];D.current=_e.eventId,A.current=_e.createdAt}else if(fe.length>0){const Me=fe[fe.length-1];D.current=Math.max(D.current??-1,Me.eventId),A.current=Me.createdAt}O(null),S(!0),T("connected")}catch(H){B||(S(!1),T("disconnected"),O(H instanceof Error?H:new Error("Live event polling failed")))}finally{L=!1}}};return M(),V=setInterval(()=>{M()},2e3),()=>{B=!0,V&&clearInterval(V),S(!1),T("disconnected")}}const K=()=>{R.current&&(clearTimeout(R.current),R.current=null)},ee=()=>{I.current&&(clearInterval(I.current),I.current=null)},P=()=>{if(B||R.current)return;z.current+=1;const V=Math.min(3e4,1e3*2**Math.max(0,z.current-1)),L=Math.floor(V*.2*Math.random()),M=V+L;R.current=setTimeout(()=>{R.current=null,B||q()},M)},G=()=>{N.current=Date.now(),S(!0),T("connected")},q=()=>{if(B)return;T("connecting"),K();const V=(()=>{const M=new URL(f.serverUrl,window.location.origin);M.protocol=M.protocol==="https:"?"wss:":"ws:";const H=M.pathname.endsWith("/")?M.pathname.slice(0,-1):M.pathname;return M.pathname=`${H}/console/events/live`,M.search="",M.searchParams.set("token",f.token),A.current&&M.searchParams.set("since",A.current),M.searchParams.set("replayLimit",String(U)),a&&M.searchParams.set("partitionId",a),g&&M.searchParams.set("instanceId",g),M.toString()})(),L=new WebSocket(V);j.current=L,L.onopen=()=>{if(B){L.close();return}z.current=0,G(),O(null),ee(),I.current=setInterval(()=>{const M=j.current;if(!M||M.readyState!==WebSocket.OPEN)return;const H=N.current;!H||Date.now()-H<=s||(S(!1),T("stale"),M.close())},1e3)},L.onclose=()=>{B||(S(!1),T("disconnected"),ee(),P())},L.onerror=()=>{B||O(new Error("WebSocket connection failed"))},L.onmessage=M=>{try{const H=JSON.parse(M.data),W=H.type;if(G(),W==="connected"||W==="heartbeat")return;const Y={type:W,timestamp:H.timestamp||new Date().toISOString(),data:H};if(a&&Y.data.partitionId!==a||g&&Y.data.instanceId!==g)return;const ae=Date.parse(A.current??""),se=Date.parse(Y.timestamp);Number.isFinite(se)&&(!Number.isFinite(ae)||se>ae)&&(A.current=Y.timestamp),b(fe=>[Y,...fe].slice(0,t))}catch{}}};return q(),()=>{B=!0,K(),ee(),j.current&&(j.current.close(),j.current=null),S(!1),T("disconnected")}},[n,d,f?.serverUrl,f?.token,t,a,g,i,s]),{events:y,isConnected:x,connectionState:w,error:C,clearEvents:Q}}function ZY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async()=>{if(!e||!t)throw new Error("Not connected");const i=new URLSearchParams;n&&i.set("instanceId",n);const a=i.toString(),l=await fetch(`${t.serverUrl}/console/events${a?`?${a}`:""}`,{method:"DELETE",headers:{Authorization:`Bearer ${t.token}`}});if(!l.ok)throw new Error("Failed to clear events");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","events"]})}})}const YY=_.createContext(null);function pk(){const[e,t]=pi("console:time-range","24h");return{range:e,setRange:t}}const XY=[{hint:"ios",type:"mobile"},{hint:"android",type:"mobile"},{hint:"mobile",type:"mobile"},{hint:"tablet",type:"tablet"},{hint:"desktop",type:"desktop"},{hint:"mac",type:"desktop"},{hint:"windows",type:"desktop"},{hint:"linux",type:"desktop"},{hint:"browser",type:"browser"},{hint:"web",type:"browser"},{hint:"server",type:"server"},{hint:"api",type:"server"},{hint:"iot",type:"iot"},{hint:"sensor",type:"iot"}];function QY(e){const t=e.toLowerCase();for(const n of XY)if(t.includes(n.hint))return n.type;return"client"}function WY(e){const t=e.toLowerCase();return t.includes("pglite")?"PGlite":t.includes("sqlite")||t.includes("wa-sqlite")?"SQLite":t.includes("postgres")||t.includes("pg")?"PostgreSQL":"unknown"}function JY(e,t){return typeof e.lagCommitCount=="number"?Math.max(0,e.lagCommitCount):t?Math.max(0,t.maxCommitSeq-e.cursor):0}function eX(e,t){return e.activityState==="stale"?"offline":t>0?"syncing":"online"}function tX(e,t){return e.length<=16?e:`${e.slice(0,12)}-${t+1}`}function nX(e,t,n={}){const s=n.maxNodes??10;return e.slice(0,s).map((i,a)=>{const l=JY(i,t),f=eX(i,l);return{id:tX(i.clientId,a),type:QY(i.clientId),status:f,cursor:Math.max(0,i.cursor),actor:i.actorId,mode:i.connectionMode,dialect:WY(i.clientId),scopes:Object.keys(i.effectiveScopes||{}),lastSeen:i.updatedAt}})}const rX={enabled:!1,thresholds:{p90Latency:500,errorRate:5,clientLag:100}};function KC(e,t="relative"){if(t==="absolute")return new Date(e).toLocaleString();const n=new Date(e),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3);return a<60?`${a}s ago`:a<3600?`${Math.floor(a/60)}m ago`:a<86400?`${Math.floor(a/3600)}h ago`:`${Math.floor(a/86400)}d ago`}function sX(e){const t=e.length>1&&e.endsWith("/")?e.slice(0,-1):e;return t==="/console"||t.startsWith("/console/")?"/console/stream":"/stream"}function oX(){const e=dp(),t=_.useMemo(()=>typeof window>"u"?"/stream":sX(window.location.pathname),[]),n=pk(),{range:s}=n,{preferences:i}=of(),{partitionId:a}=sf(),l=i.refreshInterval*1e3,[f]=pi("console:alert-config",rX),[d,p]=_.useState("1h"),{data:g}=rf({refetchIntervalMs:l,partitionId:a}),{data:y}=mY({range:s,partitionId:a},{refetchIntervalMs:l}),{data:b}=gY({range:s,partitionId:a},{refetchIntervalMs:l}),{data:x}=yY({limit:5,partitionId:a},{refetchIntervalMs:l}),{data:S}=hk({limit:12,offset:0,partitionId:a},{refetchIntervalMs:l}),{events:w,isConnected:T}=GY({maxEvents:8,partitionId:a}),C=_.useMemo(()=>{const U=y?.buckets??[];let Z=0,K=0;for(const P of U)Z+=P.pushCount+P.pullCount,K+=P.errorCount;const ee=Z>0?K/Z*100:0;return{totalEvents:Z,errorRate:ee}},[y?.buckets]),O=_.useMemo(()=>S?.items?nX(S.items,g,{maxNodes:12}):[],[S?.items,g]),j=O.filter(U=>U.status!=="offline").length,R=O.filter(U=>U.status==="offline").length,I=_.useMemo(()=>g?[{label:"Ops (Range)",value:C.totalEvents,color:"flow"},{label:"P50 Latency",value:b?.push?.p50??0,unit:"ms",color:"healthy"},{label:"Error Rate",value:`${C.errorRate.toFixed(1)}%`,color:C.errorRate>0?"offline":"muted"},{label:"Active Clients",value:g.activeClientCount,color:"syncing"},{label:"Pending",value:g.maxActiveClientCursor!==null&&g.maxCommitSeq>0?g.maxCommitSeq-(g.minActiveClientCursor??0):0,color:"relay"}]:[],[g,b,C.errorRate,C.totalEvents]),z=_.useMemo(()=>w.map(U=>({type:U.type.toUpperCase(),actor:U.data?.actorId??"",table:(U.data?.tables??[])[0]??"",time:KC(U.timestamp,i.timeFormat)})),[w,i.timeFormat]),N=_.useMemo(()=>{const U=y?.buckets;if(!U?.length)return[];const Z=Math.max(...U.map(K=>Math.max(K.pushCount,K.pullCount)),1);return U.map(K=>({pushPercent:Z>0?K.pushCount/Z*100:0,pullPercent:Z>0?K.pullCount/Z*100:0}))},[y?.buckets]),A=_.useMemo(()=>{if(!b)return[];const U=Math.max(b.push.p50,b.push.p90,b.push.p99,b.pull.p50,b.pull.p90,b.pull.p99,1);return[{label:"P50",pushMs:b.push.p50,pullMs:b.pull.p50,pushBarPercent:b.push.p50/U*100,pullBarPercent:b.pull.p50/U*100},{label:"P90",pushMs:b.push.p90,pullMs:b.pull.p90,pushBarPercent:b.push.p90/U*100,pullBarPercent:b.pull.p90/U*100},{label:"P99",pushMs:b.push.p99,pullMs:b.pull.p99,pushBarPercent:b.push.p99/U*100,pullBarPercent:b.pull.p99/U*100}]},[b]),D=_.useMemo(()=>x?.items?x.items.map(U=>({seq:U.commitSeq,actor:U.actorId,changes:U.changeCount,tables:(U.affectedTables??[]).join(", "),time:KC(U.createdAt,i.timeFormat)})):[],[x?.items,i.timeFormat]),Q=_.useMemo(()=>Math.max(0,100-C.errorRate),[C.errorRate]),B=_.useMemo(()=>{if(!f.enabled||!g)return[];const U=[];return b?.push?.p90&&b.push.p90>f.thresholds.p90Latency&&U.push(`P90 push latency (${b.push.p90}ms) exceeds threshold (${f.thresholds.p90Latency}ms)`),g.minActiveClientCursor!==null&&g.maxCommitSeq-g.minActiveClientCursor>f.thresholds.clientLag&&U.push(`Client lag (${g.maxCommitSeq-g.minActiveClientCursor}) exceeds threshold (${f.thresholds.clientLag})`),C.errorRate>f.thresholds.errorRate&&U.push(`Error rate (${C.errorRate.toFixed(1)}%) exceeds threshold (${f.thresholds.errorRate}%)`),U},[f,g,b,C.errorRate]);return g?h.jsx(YY.Provider,{value:n,children:h.jsxs("div",{className:"flex flex-col",children:[B.length>0&&h.jsx("div",{className:"px-6 pb-4",children:h.jsxs(In,{variant:"destructive",children:[h.jsx(tf,{children:"Threshold Exceeded"}),h.jsx(Pn,{children:B.map((U,Z)=>h.jsx("span",{className:"block",children:U},Z))})]})}),h.jsx(zA,{clients:O,totalNodes:O.length+2,onlineCount:j,offlineCount:R,relayClientIds:[]}),h.jsx(Gj,{items:I}),h.jsxs("div",{className:"flex",children:[h.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[h.jsx("div",{className:"border-b border-border border-r border-border",children:h.jsx(Sj,{bars:N,activeRange:d,onRangeChange:p})}),h.jsx("div",{className:"border-b border-border border-r border-border",children:h.jsx(Zj,{buckets:A,successRate:Q})}),h.jsx("div",{className:"border-r border-border",children:h.jsx(Fj,{commits:D,onViewAll:()=>e({href:t})})})]}),h.jsx(Yj,{entries:z,isConnected:T,maxVisible:20,maxHeight:"calc(100vh - 200px)"})]})]})}):h.jsx("div",{className:"flex items-center justify-center py-24",children:h.jsx(Pt,{size:"lg"})})}function iX(){return h.jsx(oX,{})}function aX({children:e}){return h.jsxs("div",{className:"space-y-4 px-5 py-5",children:[h.jsx(cX,{}),h.jsx(hX,{}),h.jsx(pX,{}),e]})}function cX(){const{clearError:e,config:t,connect:n,disconnect:s,error:i,isConnected:a,isConnecting:l}=Dt(),[f,d]=_.useState(t?.serverUrl??"/api"),[p,g]=_.useState(t?.token??""),[y,b]=_.useState(null),[x,S]=_.useState(!1),[w,T]=_.useState(null),[C,O]=pi("console:disconnect-clear-saved-config",!1);_.useEffect(()=>{const N=new URLSearchParams(window.location.search),A=N.get("token"),D=N.get("server");A&&(g(A),window.history.replaceState({},"",window.location.pathname)),D&&d(D)},[]),_.useEffect(()=>{t?.serverUrl&&d(t.serverUrl),t?.token&&g(t.token)},[t?.serverUrl,t?.token]),_.useEffect(()=>{T(null)},[]);const j=async()=>{e(),b(null);const N=await n({serverUrl:f.trim(),token:p.trim()},{persistOverride:!0});T(N?"Connected successfully and configuration saved.":"Failed to connect with the provided settings.")},R=()=>{s({clearSavedConfig:C}),C&&(d("/api"),g("")),T(C?"Disconnected and saved credentials cleared.":"Disconnected."),b(null)},I=async()=>{S(!0),b(null),T(null);const N=performance.now();try{const A=f.trim(),D=p.trim();if(!A||!D)throw new Error("Missing server URL or token");if(!(await fetch(`${A}/console/stats`,{headers:{Authorization:`Bearer ${D}`}})).ok)throw new Error("Failed to connect");b(Math.round(performance.now()-N))}catch{b(-1)}finally{S(!1)}},z=i??w??(y!==null?y<0?"Connection failed":`Connection successful (${y}ms latency)`:void 0);return h.jsx(Hj,{isConnected:a,isConnecting:l,isTestingConnection:x,serverUrl:f,onServerUrlChange:d,consoleToken:p,onConsoleTokenChange:g,onSaveAndConnect:j,onDisconnect:R,onTestConnection:I,statusMessage:z,children:h.jsx("div",{className:"px-5 pb-5 -mt-2",children:h.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] text-neutral-400",children:"Clear saved credentials on disconnect"}),h.jsx("p",{className:"font-mono text-[9px] text-neutral-500",children:"Removes stored server URL and token from this browser."})]}),h.jsx(Sp,{checked:C,onCheckedChange:O})]})})})}const lX=1440*60*1e3;function GC(e){const t=e.trim();if(!t)return null;const n=Number.parseInt(t,10);return!Number.isInteger(n)||n<=0?null:n}function $y(e){if(!e)return"Never";const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():"Invalid date"}function uX(e){return e.length===0?"all scopes":e.length<=2?e.join(", "):`${e.slice(0,2).join(", ")} +${e.length-2}`}function fX(e,t){if(e.revokedAt)return"revoked";if(!e.expiresAt)return"active";const n=Date.parse(e.expiresAt);if(!Number.isFinite(n))return"active";const s=Date.now();return n<=s?"expired":n<=s+t*lX?"expiring":"active"}function dX(e){return e==="revoked"?"destructive":e==="expired"?"offline":e==="expiring"?"syncing":"healthy"}function hX(){const[e,t]=_.useState("all"),[n,s]=_.useState("all"),[i,a]=_.useState("14"),[l,f]=_.useState(!1),[d,p]=_.useState(!1),[g,y]=_.useState(""),[b,x]=_.useState("relay"),[S,w]=_.useState(""),[T,C]=_.useState(""),[O,j]=_.useState(""),[R,I]=_.useState(null),[z,N]=_.useState([]),[A,D]=_.useState(null),[Q,B]=_.useState(null),[U,Z]=_.useState(null),[K,ee]=_.useState(null),[P,G]=_.useState(null),[q,V]=_.useState(null),[L,M]=_.useState(null),H=_.useMemo(()=>GC(i),[i]),W=H??14,Y=_.useMemo(()=>GC(O),[O]),ae=O.trim().length>0,se=!ae||Y!==null,fe=_.useMemo(()=>({type:e==="all"?void 0:e,status:n==="all"?void 0:n,expiresWithinDays:n==="expiring"?W:void 0}),[e,n,W]),{data:Se,isLoading:pe,error:Me}=jY(fe),_e=AY(),re=OY(),he=kY(),ie=MY(),we=IY();_.useEffect(()=>{const me=new Set((Se?.items??[]).map(Te=>Te.keyId));N(Te=>Te.filter(qe=>me.has(qe)))},[Se?.items]);const ye=async()=>{try{const me=T.split(",").map(qe=>qe.trim()).filter(qe=>qe.length>0),Te=await _e.mutateAsync({name:g,keyType:b,actorId:S||void 0,scopeKeys:me.length>0?me:void 0,expiresInDays:ae?Y??void 0:void 0});I(Te.secretKey),y(""),w(""),C(""),j("")}catch{}},xe=me=>{navigator.clipboard.writeText(me),B(me),setTimeout(()=>B(null),2e3)},ve=async()=>{if(U)try{await he.mutateAsync(U)}finally{Z(null)}},Ie=async()=>{if(z.length!==0)try{const me=await re.mutateAsync({keyIds:z});D(me),N([])}catch{}},Ue=async()=>{if(K)try{const me=await we.mutateAsync(K.keyId);G({oldKeyId:K.keyId,oldKeyName:K.name,secretKey:me.secretKey})}catch{}},Ee=async()=>{if(P)try{await he.mutateAsync(P.oldKeyId)}finally{G(null),ee(null)}},Ve=async()=>{if(q)try{const me=await ie.mutateAsync(q);M(me.secretKey)}finally{V(null)}};if(pe)return h.jsx("div",{className:"flex h-[200px] items-center justify-center",children:h.jsx(Pt,{size:"lg"})});if(Me)return h.jsx("div",{className:"flex h-[200px] items-center justify-center",children:h.jsxs("p",{className:"text-danger",children:["Failed to load API keys: ",Me.message]})});const Qe=(Se?.items??[]).filter(me=>me.revokedAt===null).map(me=>me.keyId),Be=Qe.length>0&&Qe.every(me=>z.includes(me)),We=z.length>0,He=(Se?.items??[]).filter(me=>z.includes(me.keyId)).map(me=>me.name);return h.jsxs(h.Fragment,{children:[h.jsxs(Wb,{title:"API Keys",description:"Issue, rotate, revoke, and audit key lifecycle state.",actions:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(Ne,{size:"sm",variant:"destructive",onClick:()=>p(!0),disabled:z.length===0,children:["Revoke Selected (",z.length,")"]}),h.jsx(Ne,{size:"sm",onClick:()=>f(!0),children:"Create Key"})]}),children:[h.jsxs("div",{className:"mb-4 grid gap-3 lg:grid-cols-3",children:[h.jsxs(ps,{children:[h.jsx(es,{children:"Type filter"}),h.jsxs(dh,{value:[e],multiple:!1,onValueChange:me=>{const Te=me.find(qe=>typeof qe=="string");(Te==="all"||Te==="relay"||Te==="proxy"||Te==="admin")&&t(Te)},children:[h.jsx(Dr,{value:"all",children:"all"}),h.jsx(Dr,{value:"relay",children:"relay"}),h.jsx(Dr,{value:"proxy",children:"proxy"}),h.jsx(Dr,{value:"admin",children:"admin"})]})]}),h.jsxs(ps,{children:[h.jsx(es,{children:"Status filter"}),h.jsxs(dh,{value:[n],multiple:!1,onValueChange:me=>{const Te=me.find(qe=>typeof qe=="string");(Te==="all"||Te==="active"||Te==="revoked"||Te==="expiring")&&s(Te)},children:[h.jsx(Dr,{value:"all",children:"all"}),h.jsx(Dr,{value:"active",children:"active"}),h.jsx(Dr,{value:"revoked",children:"revoked"}),h.jsx(Dr,{value:"expiring",children:"expiring"})]})]}),h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-expiring-window",children:"Expiring window (days)"}),h.jsx(pc,{children:"Used when status filter is set to expiring."}),h.jsx(Gn,{id:"api-key-expiring-window",placeholder:"14",value:i,inputMode:"numeric",onChange:me=>a(me.target.value)}),H===null&&i.trim().length>0?h.jsx("p",{className:"font-mono text-[10px] text-offline",children:"Enter a positive whole number."}):null]})]}),Se?.items.length===0?h.jsx(Qb,{message:"No API keys match the current filters."}):h.jsxs(Zu,{children:[h.jsx(Yu,{children:h.jsxs(io,{children:[h.jsx(yt,{children:h.jsx(Uv,{checked:Be,indeterminate:!Be&&We&&Qe.length>0,onCheckedChange:me=>{N(me?Qe:[])},"aria-label":"Select all active keys"})}),h.jsx(yt,{children:"NAME"}),h.jsx(yt,{children:"TYPE"}),h.jsx(yt,{children:"KEY PREFIX"}),h.jsx(yt,{children:"ACTOR"}),h.jsx(yt,{children:"SCOPES"}),h.jsx(yt,{children:"CREATED"}),h.jsx(yt,{children:"LAST USED"}),h.jsx(yt,{children:"EXPIRES"}),h.jsx(yt,{children:"STATUS"}),h.jsx(yt,{children:"ACTIONS"})]})}),h.jsx(Xu,{children:(Se?.items??[]).map(me=>{const Te=fX(me,W);return h.jsxs(io,{children:[h.jsx(vt,{children:h.jsx(Uv,{checked:z.includes(me.keyId),onCheckedChange:qe=>{N(ht=>qe?[...new Set([...ht,me.keyId])]:ht.filter(lt=>lt!==me.keyId))},"aria-label":`Select ${me.name}`,disabled:me.revokedAt!==null})}),h.jsx(vt,{className:"font-medium",children:me.name}),h.jsx(vt,{children:h.jsx(xn,{variant:me.keyType==="admin"?"flow":me.keyType==="proxy"?"ghost":"relay",children:me.keyType})}),h.jsx(vt,{children:h.jsxs("code",{className:"font-mono text-[11px]",children:[me.keyPrefix,"..."]})}),h.jsx(vt,{className:"text-neutral-500",children:me.actorId??"-"}),h.jsx(vt,{className:"max-w-[220px] text-neutral-500",children:h.jsx("code",{className:"font-mono text-[10px]",children:uX(me.scopeKeys)})}),h.jsx(vt,{className:"text-neutral-500",children:$y(me.createdAt)}),h.jsx(vt,{className:"text-neutral-500",children:$y(me.lastUsedAt)}),h.jsx(vt,{className:"text-neutral-500",children:$y(me.expiresAt)}),h.jsx(vt,{children:h.jsx(xn,{variant:dX(Te),children:Te})}),h.jsx(vt,{children:h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>ee(me),disabled:me.revokedAt!==null,children:"Stage"}),h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>V(me.keyId),disabled:me.revokedAt!==null,children:"Rotate"}),h.jsx(Ne,{variant:"destructive",size:"sm",onClick:()=>Z(me.keyId),disabled:me.revokedAt!==null,children:"Revoke"})]})})]},me.keyId)})})]})]}),h.jsx($r,{open:l,onOpenChange:f,children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Create API Key"})}),R?h.jsx(ZC,{copiedKeyId:Q,onClose:()=>{I(null),f(!1)},onCopy:xe,secretKey:R,warning:"Copy this key now. You will not be able to view it again."}):h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-name",children:"Name"}),h.jsx(Gn,{id:"api-key-name",placeholder:"Backend Relay Key",value:g,onChange:me=>y(me.target.value)})]}),h.jsxs(ps,{children:[h.jsx(es,{children:"Key type"}),h.jsxs(dh,{value:[b],multiple:!1,onValueChange:me=>{const Te=me.find(qe=>typeof qe=="string");(Te==="relay"||Te==="proxy"||Te==="admin")&&x(Te)},children:[h.jsx(Dr,{value:"relay",children:"relay"}),h.jsx(Dr,{value:"proxy",children:"proxy"}),h.jsx(Dr,{value:"admin",children:"admin"})]})]}),h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-actor-id",children:"Actor ID (optional)"}),h.jsx(pc,{children:"Pin this key to a fixed actor ID"}),h.jsx(Gn,{id:"api-key-actor-id",placeholder:"actor-123",value:S,onChange:me=>w(me.target.value)})]}),h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-scope-keys",children:"Scope keys (optional)"}),h.jsx(pc,{children:"Comma-separated list of allowed scope keys"}),h.jsx(Gn,{id:"api-key-scope-keys",placeholder:"scope-a, scope-b",value:T,onChange:me=>C(me.target.value)})]}),h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-expires-days",children:"Expires in days (optional)"}),h.jsx(pc,{children:"Leave empty to keep the key non-expiring."}),h.jsx(Gn,{id:"api-key-expires-days",placeholder:"30",value:O,inputMode:"numeric",onChange:me=>j(me.target.value)}),se?null:h.jsx("p",{className:"font-mono text-[10px] text-offline",children:"Enter a positive whole number."})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>f(!1),children:"Cancel"}),h.jsx(Ne,{variant:"primary",onClick:ye,disabled:_e.isPending||!g||!se,children:_e.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Creating..."]}):"Create"})]})]})]})}),h.jsx($r,{open:d,onOpenChange:me=>{p(me),me||D(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Bulk Revoke API Keys"})}),A?h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-3",children:[h.jsx(In,{variant:"destructive",children:h.jsxs(Pn,{children:["Requested ",A.requestedCount," keys. Revoked"," ",A.revokedCount,", already revoked"," ",A.alreadyRevokedCount,", not found"," ",A.notFoundCount,"."]})}),h.jsx(Nn,{children:h.jsx(Ne,{variant:"primary",onClick:()=>{p(!1),D(null)},children:"Done"})})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-3",children:[h.jsx(In,{variant:"destructive",children:h.jsx(Pn,{children:"This revokes selected keys immediately and cannot be undone."})}),h.jsxs("p",{className:"font-mono text-[10px] text-neutral-500",children:["Selected keys: ",He.slice(0,5).join(", "),He.length>5?` +${He.length-5} more`:""]})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>p(!1),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",onClick:Ie,disabled:re.isPending||z.length===0,children:re.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking..."]}):"Revoke Selected"})]})]})]})}),h.jsx($r,{open:K!==null||P!==null,onOpenChange:()=>{ee(null),G(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Stage Rotate API Key"})}),P?h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsx(In,{variant:"default",children:h.jsxs(Pn,{children:["Replacement key created for ",P.oldKeyName,". The old key is still active until you revoke it."]})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"flex-1 rounded-md border border-border bg-surface p-3 font-mono text-[11px] text-white break-all",children:P.secretKey}),h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>xe(P.secretKey),children:Q===P.secretKey?"Copied":"Copy"})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>{G(null),ee(null)},children:"Keep Old Key Active"}),h.jsx(Ne,{variant:"destructive",onClick:Ee,disabled:he.isPending,children:he.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking Old Key..."]}):"Finalize and Revoke Old Key"})]})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"px-5 py-4",children:h.jsx("p",{className:"font-mono text-[10px] text-neutral-500",children:"Staged rotation creates a replacement key now and keeps the current key active until you explicitly revoke it."})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>ee(null),children:"Cancel"}),h.jsx(Ne,{variant:"primary",onClick:Ue,disabled:we.isPending||!K,children:we.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Staging..."]}):"Create Replacement Key"})]})]})]})}),h.jsx($r,{open:U!==null,onOpenChange:()=>Z(null),children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Revoke API Key"})}),h.jsx("div",{className:"px-5 py-4",children:h.jsx(In,{variant:"destructive",children:h.jsx(Pn,{children:"Revoking a key immediately invalidates it for all requests."})})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>Z(null),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",onClick:ve,disabled:he.isPending,children:he.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking..."]}):"Revoke"})]})]})}),h.jsx($r,{open:q!==null||L!==null,onOpenChange:()=>{V(null),M(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Rotate API Key"})}),L?h.jsx(ZC,{copiedKeyId:Q,onClose:()=>M(null),onCopy:xe,secretKey:L,warning:"The previous key has been invalidated. Store this replacement securely."}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"px-5 py-4",children:h.jsx("p",{className:"font-mono text-[10px] text-neutral-500",children:"Rotating a key invalidates the previous secret immediately."})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>V(null),children:"Cancel"}),h.jsx(Ne,{variant:"primary",onClick:Ve,disabled:ie.isPending,children:ie.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Rotating..."]}):"Rotate"})]})]})]})})]})}function pX(){const{preferences:e,updatePreference:t,resetPreferences:n}=of(),s=[{type:"filter",label:"Auto-refresh interval",options:UY.map(i=>({id:`${i.value}`,label:i.label})),activeId:`${e.refreshInterval}`,onActiveChange:i=>t("refreshInterval",Number.parseInt(i,10))},{type:"filter",label:"Items per page",options:$Y.map(i=>({id:`${i.value}`,label:i.label})),activeId:`${e.pageSize}`,onActiveChange:i=>t("pageSize",Number.parseInt(i,10))},{type:"filter",label:"Time format",options:[{id:"relative",label:"Relative"},{id:"absolute",label:"Absolute"}],activeId:e.timeFormat,onActiveChange:i=>t("timeFormat",i)},{type:"toggle",label:"Show sparklines",description:"Display mini trend charts in dashboard metric cards",checked:e.showSparklines,onCheckedChange:i=>t("showSparklines",i)}];return h.jsx(Xj,{rows:s,onResetDefaults:n})}function ZC({copiedKeyId:e,onClose:t,onCopy:n,secretKey:s,warning:i}){return h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsx(In,{variant:"destructive",children:h.jsx(Pn,{children:i})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"flex-1 rounded-md border border-border bg-surface p-3 font-mono text-[11px] text-white break-all",children:s}),h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>n(s),children:e===s?"Copied":"Copy"})]}),h.jsx(Nn,{children:h.jsx(Ne,{variant:"primary",onClick:t,children:"Done"})})]})}function mX(e){const t=e.toLowerCase();return t.includes("mobile")||t.includes("ios")||t.includes("android")?"mobile":t.includes("tablet")?"tablet":t.includes("desktop")||t.includes("laptop")?"desktop":t.includes("edge")?"edge":t.includes("iot")?"iot":"desktop"}function gX(e){const t=e.toLowerCase();return t.includes("pglite")?"PGlite":t.includes("wa-sqlite")||t.includes("sqlite")?"SQLite":t.includes("postgres")||t.includes("pg")?"PostgreSQL":"unknown"}function yX(e,t){if(t==="absolute")return new Date(e).toLocaleString();try{const n=new Date(e),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),l=Math.floor(a/60),f=Math.floor(l/60),d=Math.floor(f/24);return a<60?"just now":l<60?`${l}m ago`:f<24?`${f}h ago`:`${d}d ago`}catch{return e}}function vX(e,t,n){return{id:e.clientId,type:mX(e.clientId),status:e.activityState==="stale"?"offline":e.activityState==="idle"?"syncing":"online",cursor:e.cursor,actor:e.actorId,mode:e.connectionMode==="realtime"?"realtime":"polling",dialect:gX(e.clientId),scopes:Object.keys(e.effectiveScopes??{}),lastSeen:yX(e.updatedAt,n)}}function bX({emptyState:e}={}){const[t,n]=_.useState(1),[s,i]=_.useState(null),{preferences:a}=of(),{partitionId:l}=sf(),f=a.pageSize,d=a.refreshInterval*1e3,{data:p,isLoading:g}=rf({refetchIntervalMs:d,partitionId:l}),{data:y,isLoading:b,error:x}=hk({limit:f,offset:(t-1)*f,partitionId:l},{refetchIntervalMs:d}),S=TY(),w=Math.ceil((y?.total??0)/f),T=p?.maxCommitSeq??0;_.useEffect(()=>{n(1)},[]);const C=async()=>{if(s)try{await S.mutateAsync({clientId:s,partitionId:l})}finally{i(null)}};if(b||g)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})});if(x)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsxs("p",{className:"text-danger",children:["Failed to load clients: ",x.message]})});const O=(y?.items??[]).map(j=>vX(j,T,a.timeFormat));return h.jsxs("div",{className:"flex flex-col gap-5 px-5 py-5",children:[O.length>0&&h.jsx(Wj,{clients:O,headSeq:T}),O.length===0?e??h.jsx(FV,{children:h.jsx(Qb,{message:"No clients yet"})}):h.jsx(Vj,{clients:O,headSeq:T,onEvict:j=>{const R=y?.items.find(I=>I.clientId===j);i(R?.clientId??j)}}),w>1&&h.jsx(px,{page:t,totalPages:w,totalItems:y?.total??0,onPageChange:n}),h.jsx($r,{open:s!==null,onOpenChange:()=>i(null),children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Evict Client"})}),h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsxs("p",{className:"font-mono text-[11px] text-neutral-300",children:["Are you sure you want to evict client"," ",h.jsxs("span",{className:"font-mono text-white",children:[s?.slice(0,12),"..."]}),"?"]}),h.jsx("p",{className:"font-mono text-[10px] text-neutral-500",children:"This will force the client to re-bootstrap on their next sync."})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>i(null),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",onClick:C,disabled:S.isPending,children:S.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Evicting..."]}):"Evict"})]})]})})]})}const xX={latencyThresholdMs:1e3,errorRateThreshold:5,clientLagThreshold:50,enabled:!1};function SX(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}function _X(e){const t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);return Array.from(new Set(t))}function wX(e){switch(e){case"notify_data_change":return"Notify";case"evict_client":return"Evict";case"compact":return"Compact";default:return"Prune"}}function YC(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function EX(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function TX(e){const t=YC(e.requestPayload),n=YC(e.resultPayload);if(e.operationType==="notify_data_change"){const a=EX(t?.tables),l=n?.commitSeq;return`${a.length} table${a.length===1?"":"s"} -> commit #${typeof l=="number"?l:"?"}`}if(e.operationType==="evict_client"){const a=n?.evicted===!0?"evicted":"not found";return`client ${e.targetClientId??"?"} ${a}`}if(e.operationType==="compact")return`${typeof n?.deletedChanges=="number"?n.deletedChanges:0} changes removed`;const s=typeof n?.deletedCommits=="number"?n.deletedCommits:0,i=typeof t?.watermarkCommitSeq=="number"?` at #${t.watermarkCommitSeq}`:"";return`${s} commits removed${i}`}function CX(e){const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function RX(){const{partitionId:e}=sf();return h.jsxs("div",{className:"flex flex-col gap-4 px-5 py-5",children:[h.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[h.jsx(NX,{}),h.jsx(MX,{})]}),h.jsxs("div",{className:"grid gap-4 xl:grid-cols-3",children:[h.jsx(jX,{partitionId:e}),h.jsx(AX,{partitionId:e}),h.jsx(kX,{partitionId:e})]}),h.jsx(OX,{partitionId:e})]})}function NX(){const{data:e,isLoading:t,error:n}=_Y();if(t)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})});if(n)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsxs("p",{className:"text-danger",children:["Failed to load handlers: ",n.message]})});const s=(e?.items??[]).map(i=>({table:i.table,dependsOn:i.dependsOn?.join(", ")??null,chunkTtl:i.snapshotChunkTtlMs?SX(i.snapshotChunkTtlMs):"default"}));return h.jsx(Kj,{handlers:s,tableCount:e?.items.length??0})}function jX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState(null),{data:a,isLoading:l}=rf({partitionId:e}),{data:f,isLoading:d,refetch:p}=wY({enabled:!1}),g=CY(),y=async()=>{n(!0),i(null),await p()},b=async()=>{const S=await g.mutateAsync();i(S.deletedCommits)};if(l)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})});const x=[{label:"Total commits",value:a?.commitCount??0},{label:"Commit range",value:`${a?.minCommitSeq??0} - ${a?.maxCommitSeq??0}`},{label:"Min active cursor",value:a?.minActiveClientCursor??"N/A",tone:"syncing"}];return h.jsxs(h.Fragment,{children:[h.jsx(_p,{title:"Prune",description:"Delete commits that all clients have already synced. Pruning removes commits older than the oldest active client cursor.",dotColor:"syncing",stats:x,actionLabel:"Preview Prune",actionVariant:"destructive",onAction:y}),h.jsx($r,{open:t,onOpenChange:n,children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Prune Old Commits"})}),h.jsx("div",{className:"px-5 py-4 flex flex-col gap-4",children:s!==null?h.jsxs(In,{variant:"default",children:[h.jsx(tf,{children:"Pruning Complete"}),h.jsxs(Pn,{children:["Successfully deleted ",h.jsx("strong",{children:s})," commits."]})]}):d?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx(Pt,{size:"sm"})}):f?h.jsxs(h.Fragment,{children:[h.jsx(In,{variant:f.commitsToDelete>0?"destructive":"default",children:h.jsx(Pn,{children:f.commitsToDelete>0?h.jsxs(h.Fragment,{children:["This will delete"," ",h.jsx("strong",{children:f.commitsToDelete})," commits up to sequence"," ",h.jsxs("code",{className:"font-mono",children:["#",f.watermarkCommitSeq]}),"."]}):"No commits are eligible for pruning."})}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("div",{className:"flex justify-between font-mono text-[11px]",children:[h.jsx("span",{className:"text-neutral-500",children:"Watermark commit seq:"}),h.jsxs("span",{className:"text-white",children:["#",f.watermarkCommitSeq]})]}),h.jsxs("div",{className:"flex justify-between font-mono text-[11px] items-center",children:[h.jsx("span",{className:"text-neutral-500",children:"Commits to delete:"}),h.jsx(xn,{variant:f.commitsToDelete>0?"offline":"ghost",children:f.commitsToDelete})]})]})]}):null}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>n(!1),children:s!==null?"Close":"Cancel"}),s===null&&h.jsx(Ne,{variant:"destructive",onClick:b,disabled:g.isPending||d||(f?.commitsToDelete??0)===0,children:g.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Pruning..."]}):"Prune Now"})]})]})})]})}function AX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState(null),{data:a,isLoading:l}=rf({partitionId:e}),f=RY(),d=()=>{n(!0),i(null)},p=async()=>{const y=await f.mutateAsync();i(y.deletedChanges)};if(l)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})});const g=[{label:"Total changes",value:a?.changeCount??0},{label:"Total commits",value:a?.commitCount??0}];return h.jsxs(h.Fragment,{children:[h.jsx(_p,{title:"Compact",description:"Merge old changes to reduce storage space. Compaction merges multiple changes to the same row into a single change.",dotColor:"flow",stats:g,actionLabel:"Run Compaction",actionVariant:"primary",onAction:d}),h.jsx($r,{open:t,onOpenChange:n,children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Compact Changes"})}),h.jsx("div",{className:"px-5 py-4 flex flex-col gap-4",children:s!==null?h.jsxs(In,{variant:"default",children:[h.jsx(tf,{children:"Compaction Complete"}),h.jsxs(Pn,{children:["Successfully removed ",h.jsx("strong",{children:s})," redundant changes."]})]}):h.jsx(In,{variant:"default",children:h.jsx(Pn,{children:"Compaction will merge multiple changes to the same row, keeping only the most recent version. This is safe and can be run at any time."})})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>n(!1),children:s!==null?"Close":"Cancel"}),s===null&&h.jsx(Ne,{variant:"primary",onClick:p,disabled:f.isPending,children:f.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Compacting..."]}):"Compact Now"})]})]})})]})}function kX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState("tasks"),[a,l]=_.useState(e??""),[f,d]=_.useState(null),[p,g]=_.useState(null),y=NY(),b=_X(s),x=[{label:"Next tables",value:b.length,tone:"syncing"},{label:"Last commit seq",value:f?`#${f.commitSeq}`:"—",tone:"syncing"},{label:"Last chunks cleared",value:f?.deletedChunks??"—"}],S=()=>{n(!0),g(null)},w=async()=>{if(b.length===0){g("Provide at least one table name.");return}g(null);const T=await y.mutateAsync({tables:b,partitionId:a.trim()||void 0});d(T)};return h.jsxs(h.Fragment,{children:[h.jsx(_p,{title:"Notify Data Change",description:"Create a synthetic commit after external imports or direct DB writes so clients re-bootstrap for affected tables.",dotColor:"healthy",stats:x,actionLabel:"Notify Clients",actionVariant:"primary",onAction:S}),h.jsx($r,{open:t,onOpenChange:n,children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Notify External Data Change"})}),h.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[f?h.jsxs(In,{variant:"default",children:[h.jsx(tf,{children:"Notification Sent"}),h.jsxs(Pn,{children:["Created synthetic commit"," ",h.jsxs("strong",{children:["#",f.commitSeq]})," for"," ",h.jsx("strong",{children:f.tables.length})," table",f.tables.length===1?"":"s"," and cleared"," ",h.jsx("strong",{children:f.deletedChunks})," cached chunk",f.deletedChunks===1?"":"s","."]})]}):h.jsx(In,{variant:"default",children:h.jsx(Pn,{children:"Use this when data changed outside Syncular push flow. It invalidates cached snapshot chunks and forces clients to pull fresh data."})}),p?h.jsx(In,{variant:"destructive",children:h.jsx(Pn,{children:p})}):null,h.jsxs(ps,{children:[h.jsx(es,{children:"Tables (comma-separated)"}),h.jsx(Gn,{value:s,onChange:T=>i(T.target.value),placeholder:"tasks, notes",disabled:y.isPending}),h.jsx(pc,{children:"Enter one or more table names affected by the external change."})]}),h.jsxs(ps,{children:[h.jsx(es,{children:"Partition ID (optional)"}),h.jsx(Gn,{value:a,onChange:T=>l(T.target.value),placeholder:"default",disabled:y.isPending})]})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>n(!1),children:f?"Close":"Cancel"}),f?null:h.jsx(Ne,{variant:"primary",onClick:w,disabled:y.isPending,children:y.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Notifying..."]}):"Notify Data Change"})]})]})})]})}function OX({partitionId:e}){const[t,n]=_.useState("all"),{data:s,isLoading:i,error:a}=EY({limit:20,offset:0,operationType:t==="all"?void 0:t,partitionId:e},{refetchIntervalMs:5e3});return h.jsx(Wb,{title:"Operation Audit",description:"Recent prune/compact/notify/evict actions with actor and result context.",actions:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Ne,{variant:t==="all"?"default":"ghost",size:"sm",onClick:()=>n("all"),children:"All"}),h.jsx(Ne,{variant:t==="prune"?"default":"ghost",size:"sm",onClick:()=>n("prune"),children:"Prune"}),h.jsx(Ne,{variant:t==="compact"?"default":"ghost",size:"sm",onClick:()=>n("compact"),children:"Compact"}),h.jsx(Ne,{variant:t==="notify_data_change"?"default":"ghost",size:"sm",onClick:()=>n("notify_data_change"),children:"Notify"}),h.jsx(Ne,{variant:t==="evict_client"?"default":"ghost",size:"sm",onClick:()=>n("evict_client"),children:"Evict"})]}),contentClassName:"pt-2",children:i?h.jsx("div",{className:"flex items-center justify-center py-10",children:h.jsx(Pt,{size:"lg"})}):a?h.jsx(In,{variant:"destructive",children:h.jsxs(Pn,{children:["Failed to load operation audit events: ",a.message]})}):(s?.items.length??0)===0?h.jsx("div",{className:"px-2 py-8 text-sm text-neutral-500",children:"No operation events found for this filter."}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs(Zu,{children:[h.jsx(Yu,{children:h.jsxs(io,{children:[h.jsx(yt,{children:"Time"}),h.jsx(yt,{children:"Type"}),h.jsx(yt,{children:"User"}),h.jsx(yt,{children:"Target"}),h.jsx(yt,{children:"Result"})]})}),h.jsx(Xu,{children:(s?.items??[]).map((l,f)=>h.jsxs(io,{children:[h.jsx(vt,{className:"whitespace-nowrap text-xs text-neutral-400",children:CX(l.createdAt)}),h.jsx(vt,{children:h.jsx(xn,{variant:"ghost",children:wX(l.operationType)})}),h.jsx(vt,{className:"font-mono text-xs",children:l.consoleUserId??"system"}),h.jsx(vt,{className:"font-mono text-xs",children:l.targetClientId??l.partitionId??(l.operationType==="notify_data_change"?"partition default":"global")}),h.jsx(vt,{className:"font-mono text-xs text-neutral-300",children:TX(l)})]},`${l.operationId}:${l.createdAt}:${f}`))})]})})})}function MX(){const[e,t]=pi("console:alert-config",xX),n={p90Latency:e.latencyThresholdMs,errorRate:e.errorRateThreshold,clientLag:e.clientLagThreshold},s=a=>{t(l=>({...l,latencyThresholdMs:a.p90Latency,errorRateThreshold:a.errorRate,clientLagThreshold:a.clientLag}))},i=a=>{t(l=>({...l,enabled:a}))};return h.jsx($j,{enabled:e.enabled,onEnabledChange:i,thresholds:n,onThresholdsChange:s})}function IX(e){if(e===0)return"0 B";const t=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**n).toFixed(n===0?0:1)} ${t[n]}`}function PX(e){const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function DX(){const[e,t]=_.useState(""),[n,s]=_.useState(void 0),[i,a]=_.useState(void 0),[l,f]=_.useState([]),[d,p]=_.useState(null),{data:g,isLoading:y,error:b}=PY({prefix:n,cursor:i,limit:100}),x=DY(),S=zY();function w(){const I=e.trim();s(I.length>0?I:void 0),a(void 0),f([])}function T(){t(""),s(void 0),a(void 0),f([])}function C(){g?.cursor&&(f(I=>[...I,i??""]),a(g.cursor))}function O(){f(I=>{const z=[...I],N=z.pop();return a(N&&N.length>0?N:void 0),z})}function j(){d&&x.mutate(d,{onSuccess:()=>p(null)})}if(y)return h.jsx("div",{className:"flex flex-col gap-4 px-5 py-5",children:h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})})});if(b)return h.jsx("div",{className:"flex flex-col gap-4 px-5 py-5",children:h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsxs("p",{className:"text-danger font-mono text-[11px]",children:["Failed to load storage items: ",b.message]})})});const R=g?.items??[];return h.jsxs("div",{className:"flex flex-col gap-4 px-5 py-5",children:[h.jsx(Wb,{title:"Storage",actions:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Gn,{placeholder:"Prefix filter...",value:e,onChange:I=>t(I.target.value),onKeyDown:I=>{I.key==="Enter"&&w()},className:"h-7 w-48 text-xs"}),h.jsx(Ne,{variant:"default",size:"sm",onClick:w,children:"Filter"}),n&&h.jsx(Ne,{variant:"ghost",size:"sm",onClick:T,children:"Clear"})]}),children:R.length===0?h.jsx(Qb,{message:n?`No storage items matching prefix "${n}".`:"No storage items found."}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"overflow-x-auto",children:h.jsxs(Zu,{children:[h.jsx(Yu,{children:h.jsxs(io,{children:[h.jsx(yt,{children:"Key"}),h.jsx(yt,{children:"Size"}),h.jsx(yt,{children:"Type"}),h.jsx(yt,{children:"Uploaded"}),h.jsx(yt,{children:"Actions"})]})}),h.jsx(Xu,{children:R.map(I=>h.jsxs(io,{children:[h.jsx(vt,{className:"font-mono text-xs max-w-[320px]",title:I.key,children:I.key}),h.jsx(vt,{className:"font-mono text-xs text-neutral-400 whitespace-nowrap",children:IX(I.size)}),h.jsx(vt,{children:I.httpMetadata?.contentType?h.jsx(xn,{variant:"ghost",children:I.httpMetadata.contentType}):h.jsx("span",{className:"text-neutral-500 text-xs",children:"--"})}),h.jsx(vt,{className:"whitespace-nowrap text-xs text-neutral-400",children:PX(I.uploaded)}),h.jsx(vt,{children:h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(Ne,{variant:"ghost",size:"sm",onClick:()=>{S(I.key)},children:"Download"}),h.jsx(Ne,{variant:"ghost",size:"sm",onClick:()=>p(I.key),children:"Delete"})]})})]},I.key))})]})}),h.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[h.jsx(Ne,{variant:"ghost",size:"sm",disabled:l.length===0,onClick:O,children:"Previous"}),h.jsx(Ne,{variant:"ghost",size:"sm",disabled:!g?.truncated,onClick:C,children:"Next"})]})]})}),h.jsx($r,{open:d!==null,onOpenChange:()=>p(null),children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Delete Storage Item"})}),h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsxs("p",{className:"font-mono text-[11px] text-neutral-300",children:["Are you sure you want to delete"," ",h.jsx("span",{className:"font-mono text-white",children:d}),"?"]}),h.jsx("p",{className:"font-mono text-[10px] text-neutral-500",children:"This action cannot be undone."})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>p(null),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",onClick:j,disabled:x.isPending,children:x.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"})," Deleting..."]}):"Delete"})]})]})})]})}const zX={};function su(e,t){if(t==="absolute")return new Date(e).toLocaleString();const n=new Date(e),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function LX(e){const t=e.split(/\s+/).map(i=>i.trim()).filter(i=>i.length>0),n={},s=[];for(const i of t){const[a="",...l]=i.split(":"),f=l.join(":").trim(),d=a.toLowerCase();if(!f){s.push(i);continue}if(d==="actor"){n.actorId=f;continue}if(d==="client"){n.clientId=f;continue}if(d==="table"){n.table=f;continue}if(d==="request"){n.requestId=f;continue}if(d==="trace"){n.traceId=f;continue}s.push(i)}return s.length>0&&(n.search=s.join(" ")),n}function UX(e){return e==="1h"?3600*1e3:e==="6h"?360*60*1e3:e==="24h"?1440*60*1e3:e==="7d"?10080*60*1e3:720*60*60*1e3}function Gd(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function $X(e,t){return e?`#${e.federatedCommitId??(t?`${t}:${e.commitSeq}`:String(e.commitSeq))}`:"#?"}function BX(e,t){return e?`E${e.federatedEventId??(t?`${t}:${e.eventId}`:e.eventId)}`:"E?"}function FX(e,t,n){return!e||!t?null:e.replaceAll("{traceId}",encodeURIComponent(t)).replaceAll("{spanId}",encodeURIComponent(n??""))}function yx({initialSelectedEntryId:e}={}){const{preferences:t}=of(),{partitionId:n}=sf(),{range:s,setRange:i}=pk(),a=t.pageSize,l=t.refreshInterval*1e3,f=zX?.VITE_CONSOLE_TRACE_URL_TEMPLATE,[d,p]=_.useState(()=>e?.startsWith("#")?"commits":e?.startsWith("E")?"events":"all"),[g,y]=_.useState("all"),[b,x]=_.useState("all"),[S,w]=_.useState(""),[T,C]=_.useState(1),[O,j]=_.useState(!1),[R,I]=_.useState(e??null),z=_.useRef(!1),N=_.useMemo(()=>LX(S),[S]),A=_.useMemo(()=>new Date(Date.now()-UX(s)).toISOString(),[s]),{data:D,isLoading:Q,refetch:B}=bY({limit:a,offset:(T-1)*a,...n?{partitionId:n}:{},view:d,...d!=="commits"&&g!=="all"?{eventType:g}:{},...d!=="commits"&&b!=="all"?{outcome:b}:{},...N.actorId?{actorId:N.actorId}:{},...N.clientId?{clientId:N.clientId}:{},...N.requestId?{requestId:N.requestId}:{},...N.traceId?{traceId:N.traceId}:{},...N.table?{table:N.table}:{},...N.search?{search:N.search}:{},from:A},{refetchIntervalMs:l}),U=ZY(),Z=R?.startsWith("#")?R.slice(1):void 0,K=R?.startsWith("E")?R.slice(1):void 0,ee=Z&&Z!=="?"?Z:void 0,P=K&&K!=="?"?K:void 0,{data:G,isLoading:q,error:V}=vY(ee,{enabled:ee!==void 0,partitionId:n}),{data:L,isLoading:M,error:H}=xY(P,{enabled:P!==void 0,partitionId:n}),{data:W,isLoading:Y,error:ae}=SY(P,{enabled:P!==void 0&&!!L?.payloadRef,partitionId:n}),se=_.useMemo(()=>FX(f,L?.traceId??null,L?.spanId??null),[L?.spanId,L?.traceId]);_.useEffect(()=>{C(1)},[]),_.useEffect(()=>{C(1)},[]),_.useEffect(()=>{e&&I(e)},[e]),_.useEffect(()=>{if(!z.current){z.current=!0;return}I(null)},[]),_.useEffect(()=>{C(1),I(null)},[]);const Se=_.useMemo(()=>(D?.items??[]).map(we=>{const ye=we.instanceId??we.commit?.instanceId??we.event?.instanceId,xe=ye?`[${ye}] `:"";if(we.type==="commit"&&we.commit){const Ie=we.commit;return{type:"commit",id:$X(Ie,ye),outcome:"--",duration:"--",actor:Ie.actorId,client:Ie.clientId,detail:`${xe}${Ie.changeCount} chg | ${(Ie.affectedTables??[]).join(", ")}`,time:su(we.timestamp,t.timeFormat)}}const ve=we.event;return ve?{type:ve.eventType,id:BX(ve,ye),outcome:ve.outcome,duration:`${ve.durationMs}ms`,actor:ve.actorId,client:ve.clientId,detail:`${xe}${(ve.tables??[]).join(", ")||"--"}`,time:su(we.timestamp,t.timeFormat)}:{type:"pull",id:"E?",outcome:"unknown",duration:"--",actor:"",client:"",detail:"--",time:su(we.timestamp,t.timeFormat)}}),[t.timeFormat,D?.items]),pe=D?.total??0,Me=Math.max(1,Math.ceil(pe/a)),_e=Q,re=[{label:"",options:[{id:"all",label:"All"},{id:"commits",label:"Commits"},{id:"events",label:"Events"}],activeId:d,onActiveChange:ie=>{p(ie),ie==="commits"&&(y("all"),x("all")),C(1)}},{label:"Time",options:[{id:"1h",label:"1h"},{id:"6h",label:"6h"},{id:"24h",label:"24h"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}],activeId:s,onActiveChange:ie=>{i(ie),C(1)}},{label:"Type",options:[{id:"all",label:"All"},{id:"push",label:"Push"},{id:"pull",label:"Pull"}],activeId:g,onActiveChange:ie=>{y(ie),C(1)}},{label:"Outcome",options:[{id:"all",label:"All"},{id:"applied",label:"Applied"},{id:"error",label:"Error"},{id:"rejected",label:"Rejected"}],activeId:b,onActiveChange:ie=>{x(ie),C(1)}}];function he(){U.mutate(void 0,{onSuccess:()=>{j(!1),B()}})}return h.jsxs("div",{className:"flex flex-col h-full",children:[_e&&Se.length===0?h.jsx("div",{className:"flex items-center justify-center py-24",children:h.jsx(Pt,{size:"lg"})}):h.jsx(Qj,{entries:Se,selectedEntryId:R,onEntryClick:ie=>I(ie.id),filterBar:h.jsx(qj,{groups:re,searchValue:S,searchPlaceholder:"Use actor:, client:, table:, request:, trace: or free text...",onSearchChange:w,actions:h.jsxs(h.Fragment,{children:[h.jsx(Ne,{size:"sm",variant:"ghost",onClick:()=>{B()},children:"Refresh"}),h.jsx(Ne,{size:"sm",variant:"ghost",children:"Export"}),h.jsx(Ne,{size:"sm",variant:"destructive",onClick:()=>j(!0),children:"Clear"})]})}),pagination:h.jsx(px,{page:T,totalPages:Me,totalItems:pe,onPageChange:C})}),h.jsx($r,{open:R!==null,onOpenChange:ie=>{ie||I(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:ee!==void 0?`Commit #${ee}`:P!==void 0?`Event E${P}`:"Entry details"})}),h.jsx("div",{className:"px-5 py-4 space-y-3 max-h-[70vh] overflow-y-auto",children:q||M?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx(Pt,{size:"sm"})}):V||H?h.jsx("p",{className:"font-mono text-[11px] text-offline",children:"Failed to load details."}):G?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid grid-cols-2 gap-3 font-mono text-[11px]",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Actor"}),h.jsx("div",{className:"text-neutral-100",children:G.actorId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Client"}),h.jsx("div",{className:"text-neutral-100",children:G.clientId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Instance"}),h.jsx("div",{className:"text-neutral-100",children:G.instanceId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Created"}),h.jsx("div",{className:"text-neutral-100",children:su(G.createdAt,t.timeFormat)})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Changes"}),h.jsx("div",{className:"text-neutral-100",children:G.changeCount})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Affected Tables"}),h.jsx("p",{className:"font-mono text-[11px] text-neutral-200",children:G.affectedTables.join(", ")||"--"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500",children:"Changes"}),G.changes.length===0?h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No changes recorded."}):G.changes.map(ie=>h.jsxs("div",{className:"rounded-md border border-border p-3 space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between font-mono text-[11px]",children:[h.jsxs("span",{className:"text-neutral-300",children:[ie.table," | ",ie.op]}),h.jsxs("span",{className:"text-neutral-500",children:["#",ie.changeId]})]}),h.jsxs("div",{className:"font-mono text-[11px] text-neutral-400",children:["rowId: ",ie.rowId,ie.rowVersion!==null?` | version: ${ie.rowVersion}`:""]}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Gd(ie.rowJson)})]},ie.changeId))]})]}):L?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid grid-cols-2 gap-3 font-mono text-[11px]",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Type"}),h.jsx("div",{className:"text-neutral-100",children:L.eventType})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Path"}),h.jsx("div",{className:"text-neutral-100",children:L.syncPath})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Instance"}),h.jsx("div",{className:"text-neutral-100",children:L.instanceId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Outcome"}),h.jsx("div",{className:"text-neutral-100",children:L.outcome})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Response Status"}),h.jsx("div",{className:"text-neutral-100",children:L.responseStatus})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Actor"}),h.jsx("div",{className:"text-neutral-100",children:L.actorId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Client"}),h.jsx("div",{className:"text-neutral-100",children:L.clientId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Status"}),h.jsx("div",{className:"text-neutral-100",children:L.statusCode})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Transport"}),h.jsx("div",{className:"text-neutral-100",children:L.transportPath})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Duration"}),h.jsxs("div",{className:"text-neutral-100",children:[L.durationMs,"ms"]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Request ID"}),h.jsx("div",{className:"text-neutral-100",children:L.requestId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Trace ID"}),h.jsx("div",{className:"text-neutral-100",children:L.traceId??"--"}),se&&h.jsx("a",{href:se,target:"_blank",rel:"noreferrer",className:"font-mono text-[10px] text-flow underline underline-offset-4",children:"Open external trace"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Span ID"}),h.jsx("div",{className:"text-neutral-100",children:L.spanId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Commit Seq"}),h.jsx("div",{className:"text-neutral-100",children:L.commitSeq??"--"}),L.commitSeq!==null&&h.jsx(Ne,{variant:"ghost",size:"sm",onClick:()=>I(`#${L.instanceId?`${L.instanceId}:`:""}${L.commitSeq}`),children:"Open linked commit"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Subscription Count"}),h.jsx("div",{className:"text-neutral-100",children:L.subscriptionCount??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Error Code"}),h.jsx("div",{className:"text-neutral-100",children:L.errorCode??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Payload Ref"}),h.jsx("div",{className:"text-neutral-100",children:L.payloadRef??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Created"}),h.jsx("div",{className:"text-neutral-100",children:su(L.createdAt,t.timeFormat)})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Tables"}),h.jsx("p",{className:"font-mono text-[11px] text-neutral-200",children:L.tables.join(", ")||"--"})]}),L.scopesSummary&&h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Scopes Summary"}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Gd(L.scopesSummary)})]}),L.payloadRef&&h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Payload Snapshot"}),Y?h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Pt,{size:"sm"}),h.jsx("span",{className:"font-mono text-[11px] text-neutral-400",children:"Loading payload snapshot..."})]}):ae?h.jsx("p",{className:"font-mono text-[11px] text-offline",children:"Failed to load payload snapshot."}):W?h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500",children:"Request"}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Gd(W.requestPayload)}),h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500",children:"Response"}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Gd(W.responsePayload)})]}):h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No payload snapshot available."})]}),L.errorMessage&&h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Error"}),h.jsx("p",{className:"font-mono text-[11px] text-offline",children:L.errorMessage})]})]}):h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No details available for this row."})}),h.jsx(Nn,{children:h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>I(null),children:"Close"})})]})}),h.jsx($r,{open:O,onOpenChange:ie=>{ie||j(!1)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Clear all events"})}),h.jsx("div",{className:"p-4",children:h.jsx("span",{className:"font-mono text-[11px] text-neutral-400",children:"This will permanently delete all request events. Commits are not affected. Are you sure?"})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>j(!1),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",size:"sm",onClick:he,disabled:U.isPending,children:U.isPending?"Clearing...":"Clear all"})]})]})})]})}const HX=co({getParentRoute:()=>uo,path:"/config",component:aX}),qX=co({getParentRoute:()=>uo,path:"/fleet",component:bX}),VX=co({getParentRoute:()=>uo,path:"/",component:iX});function KX(){const{seq:e}=mk.useParams();return h.jsx(yx,{initialSelectedEntryId:`#${e}`})}const mk=co({getParentRoute:()=>uo,path:"/investigate/commit/$seq",component:KX});function GX(){const{id:e}=gk.useParams();return h.jsx(yx,{initialSelectedEntryId:`E${e}`})}const gk=co({getParentRoute:()=>uo,path:"/investigate/event/$id",component:GX}),ZX=co({getParentRoute:()=>uo,path:"/ops",component:RX}),YX=co({getParentRoute:()=>uo,path:"/storage",component:DX}),XX=co({getParentRoute:()=>uo,path:"/stream",component:yx}),yk=uo.addChildren([VX,XX,mk,gk,qX,ZX,YX,HX]),QX="syncular-console-basepath",WX="syncular-console-server-url",JX="syncular-console-token";function eQ(e){if(!e)return;const t=e.trim();return t.length>0?t:void 0}function $v(e){const t=globalThis.document;if(!t)return;const n=t.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return eQ(n)}function vk(e){return!e||e==="/"?"/":(e.startsWith("/")?e:`/${e}`).replace(/\/+$/g,"")||"/"}function tQ(){return vk($v(QX))}function nQ(){const e=$v(WX),t=$v(JX);return!e||!t?null:{serverUrl:e,token:t}}XN({routeTree:yk,basepath:"/"});function rQ(){return new k6({defaultOptions:{queries:{staleTime:5e3,retry:1}}})}function sQ(e){return vk(e??tQ())}function oQ(e){const[t]=_.useState(()=>rQ()),n=_.useMemo(()=>XN({routeTree:yk,basepath:sQ(e.basePath)}),[e.basePath]),s=e.defaultConfig===void 0?nQ():e.defaultConfig;return h.jsx(O6,{client:t,children:h.jsx(QH,{defaultConfig:s,children:h.jsx(LH,{router:n})})})}function iQ(e){return h.jsx("div",{className:gx,children:h.jsx(oQ,{...e})})}function aQ(e){const t=document.querySelector(e);if(!t)throw new Error(`Unable to mount console: ${e} not found`);return t}function cQ(e,t={}){const n=aQ(e);BY(n);const s=a6.createRoot(n),i=h.jsx(iQ,{basePath:t.basePath,defaultConfig:t.defaultConfig});return t.strictMode===!1?(s.render(i),s):(s.render(h.jsx(_.StrictMode,{children:i})),s)}var lQ={};const uQ="syncular-sentry-dsn",fQ="syncular-sentry-environment",dQ="syncular-sentry-release";function hu(e){if(!e)return;const t=e.trim();return t.length>0?t:void 0}function By(e){if(typeof document>"u")return;const t=document.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return hu(t)}function Fy(e){if(!(typeof process>"u"))return hu(lQ[e])}function Hy(e){for(const t of e)if(t)return t}function hQ(){const e=Hy([hu(globalThis.__SYNCULAR_SENTRY_DSN__),By(uQ),Fy("SYNCULAR_SENTRY_DSN")]);if(!e)return null;const t=Hy([hu(globalThis.__SYNCULAR_SENTRY_ENVIRONMENT__),By(fQ),Fy("SYNCULAR_SENTRY_ENVIRONMENT")]),n=Hy([hu(globalThis.__SYNCULAR_SENTRY_RELEASE__),By(dQ),Fy("SYNCULAR_SENTRY_RELEASE")]);return{dsn:e,environment:t,release:n,enableLogs:!0,tracesSampleRate:.2,tracePropagationTargets:[/^https?:\/\/.*\/api\/.*/]}}const XC=hQ();XC&&WB(XC);cQ("#root");
|
|
86
|
+
)`}return h.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:a}})});function Qh(e,t){e&&Object.assign(e.style,t)}const OG={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},MG={position:"fixed"},IG=_.forwardRef(function(t,n){const{anchor:s,positionMethod:i="absolute",className:a,render:l,side:f="bottom",align:d="center",sideOffset:p=0,alignOffset:g=0,collisionBoundary:y="clipping-ancestors",collisionPadding:b,arrowPadding:x=5,sticky:S=!1,disableAnchorTracking:w,alignItemWithTrigger:T=!0,collisionAvoidance:C=Z9,...O}=t,{store:j,listRef:R,labelsRef:I,alignItemWithTriggerActiveRef:z,selectedItemTextRef:N,valuesRef:A,initialValueRef:D,popupRef:Q,setValue:B}=Wu(),U=$A(),Z=at(j,it.open),K=at(j,it.mounted),ee=at(j,it.modal),P=at(j,it.value),G=at(j,it.openMethod),q=at(j,it.positionerElement),V=at(j,it.triggerElement),L=at(j,it.isItemEqualToValue),M=at(j,it.transitionStatus),H=_.useRef(null),W=_.useRef(null),[Y,ae]=_.useState(T),se=K&&Y&&G!=="touch";!K&&Y!==T&&ae(T),Le(()=>{K||(it.scrollUpArrowVisible(j.state)&&j.set("scrollUpArrowVisible",!1),it.scrollDownArrowVisible(j.state)&&j.set("scrollDownArrowVisible",!1))},[j,K]),_.useImperativeHandle(z,()=>se),BA((se||ee)&&Z&&G!=="touch",V);const fe=DA({anchor:s,floatingRootContext:U,positionMethod:i,mounted:K,side:f,sideOffset:p,align:d,alignOffset:g,arrowPadding:x,collisionBoundary:y,collisionPadding:b,sticky:S,disableAnchorTracking:w??se,collisionAvoidance:C,keepMounted:!0}),Se=se?"none":fe.side,pe=se?MG:fe.positionerStyles,Me=_.useMemo(()=>{const xe={};return Z||(xe.pointerEvents="none"),{role:"presentation",hidden:!K,style:{...pe,...xe}}},[Z,K,pe]),_e={open:Z,side:Se,align:fe.align,anchorHidden:fe.anchorHidden},re=ke(xe=>{j.set("positionerElement",xe)}),he=zt("div",t,{ref:[n,re],state:_e,stateAttributesMapping:nl,props:[Me,Np(M),O]}),ie=_.useRef(0),we=ke(xe=>{if(xe.size===0&&ie.current===0||A.current.length===0)return;const ve=ie.current;if(ie.current=xe.size,xe.size===ve)return;const Ie=Yt(ii);if(ve!==0&&!j.state.multiple&&P!==null&&zy(A.current,P,L)===-1){const Ee=D.current,Qe=Ee!=null&&zy(A.current,Ee,L)!==-1?Ee:null;B(Qe,Ie),Qe===null&&(j.set("selectedIndex",null),N.current=null)}if(ve!==0&&j.state.multiple&&Array.isArray(P)){const Ue=Ve=>zy(A.current,Ve,L)!==-1,Ee=P.filter(Ve=>Ue(Ve));(Ee.length!==P.length||Ee.some(Ve=>!cG(P,Ve,L)))&&(B(Ee,Ie),Ee.length===0&&(j.set("selectedIndex",null),N.current=null))}if(Z&&se){j.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ue={height:""};Qh(q,Ue),Qh(Q.current,Ue)}}),ye=_.useMemo(()=>({...fe,side:Se,alignItemWithTriggerActive:se,setControlledAlignItemWithTrigger:ae,scrollUpArrowRef:H,scrollDownArrowRef:W}),[fe,Se,se,ae]);return h.jsx(HA,{elementsRef:R,labelsRef:I,onMapChange:we,children:h.jsxs(qA.Provider,{value:ye,children:[K&&ee&&h.jsx(VA,{inert:fx(!Z),cutout:V}),he]})})});function KA(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const Vd="base-ui-disable-scrollbar",PC={className:Vd,getElement(e){return h.jsx("style",{nonce:e,href:Vd,precedence:"base-ui:low",children:`.${Vd}{scrollbar-width:none}.${Vd}::-webkit-scrollbar{display:none}`})}},PG=_.createContext(void 0);function GA(e){return _.useContext(PG)}const wc="ArrowUp",Wi="ArrowDown",Ru="ArrowLeft",Ec="ArrowRight",Ju="Home",ef="End",ZA=new Set([Ru,Ec]),DG=new Set([Ru,Ec,Ju,ef]),YA=new Set([wc,Wi]),zG=new Set([wc,Wi,Ju,ef]),XA=new Set([...ZA,...YA]),LG=new Set([...XA,Ju,ef]),QA=new Set([wc,Wi,Ru,Ec,Ju,ef]),UG="Shift",$G="Control",BG="Alt",FG="Meta",HG=new Set([UG,$G,BG,FG]);function qG(e){return Zt(e)&&e.tagName==="INPUT"}function DC(e){return!!(qG(e)&&e.selectionStart!=null||Zt(e)&&e.tagName==="TEXTAREA")}function zC(e,t,n,s){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop;const l=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(l&&s!=="vertical"){const d=LC(e,t,"left"),p=Kd(e),g=Kd(t);n==="ltr"&&(d+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-p.scrollPaddingRight?i=d+t.offsetWidth+g.scrollMarginRight-e.clientWidth+p.scrollPaddingRight:d-g.scrollMarginLeft<e.scrollLeft+p.scrollPaddingLeft&&(i=d-g.scrollMarginLeft-p.scrollPaddingLeft)),n==="rtl"&&(d-g.scrollMarginRight<e.scrollLeft+p.scrollPaddingLeft?i=d-g.scrollMarginLeft-p.scrollPaddingLeft:d+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-p.scrollPaddingRight&&(i=d+t.offsetWidth+g.scrollMarginRight-e.clientWidth+p.scrollPaddingRight))}if(f&&s!=="horizontal"){const d=LC(e,t,"top"),p=Kd(e),g=Kd(t);d-g.scrollMarginTop<e.scrollTop+p.scrollPaddingTop?a=d-g.scrollMarginTop-p.scrollPaddingTop:d+t.offsetHeight+g.scrollMarginBottom>e.scrollTop+e.clientHeight-p.scrollPaddingBottom&&(a=d+t.offsetHeight+g.scrollMarginBottom-e.clientHeight+p.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:"auto"})}function LC(e,t,n){const s=n==="left"?"offsetLeft":"offsetTop";let i=0;for(;t.offsetParent&&(i+=t[s],t.offsetParent!==e);)t=t.offsetParent;return i}function Kd(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}function Ly(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const VG=_.createContext(void 0),KG={disableStyleElements:!1};function GG(){return _.useContext(VG)??KG}const Vi=1,ZG={...nl,...ba},YG=_.forwardRef(function(t,n){const{render:s,className:i,finalFocus:a,...l}=t,{store:f,popupRef:d,onOpenChangeComplete:p,setOpen:g,valueRef:y,selectedItemTextRef:b,keyboardActiveRef:x,multiple:S,handleScrollArrowVisibility:w,scrollHandlerRef:T,highlightItemOnHover:C}=Wu(),{side:O,align:j,alignItemWithTriggerActive:R,setControlledAlignItemWithTrigger:I,scrollDownArrowRef:z,scrollUpArrowRef:N}=kG(),A=GA()!=null,D=$A(),{nonce:Q,disableStyleElements:B}=GG(),U=ns(),Z=at(f,it.id),K=at(f,it.open),ee=at(f,it.mounted),P=at(f,it.popupProps),G=at(f,it.transitionStatus),q=at(f,it.triggerElement),V=at(f,it.positionerElement),L=at(f,it.listElement),M=_.useRef(0),H=_.useRef(!1),W=_.useRef(0),Y=_.useRef(!1),ae=_.useRef({}),se=ox(),fe=ke(_e=>{if(!V||!d.current||!Y.current)return;if(H.current||!R){w();return}const re=V.style.top==="0px",he=V.style.bottom==="0px",ie=V.getBoundingClientRect().height,we=Rt(V),ye=getComputedStyle(V),xe=parseFloat(ye.marginTop),ve=parseFloat(ye.marginBottom),Ie=UC(getComputedStyle(d.current)),Ue=Math.min(we.documentElement.clientHeight-xe-ve,Ie),Ee=_e.scrollTop,Ve=$C(_e);let Qe=0,Be=null,We=!1,He=!1;const me=qe=>{V.style.height=`${qe}px`},Te=(qe,ht)=>{const lt=Ly(qe,0,Ue-ie);lt>0&&me(ie+lt),_e.scrollTop=ht,Ue-(ie+lt)<=Vi&&(H.current=!0),w()};if(re){const qe=Ve-Ee,ht=ie+qe,lt=Math.min(ht,Ue);if(Qe=lt,qe<=Vi){Te(qe,Ve);return}Ue-lt>Vi?He=!0:We=!0}else if(he){const qe=Ee,ht=ie+qe,lt=Math.min(ht,Ue),wr=ht-Ue;if(Qe=lt,qe<=Vi){Te(qe,0);return}Ue-lt>Vi?Be=0:(We=!0,Ee<Ve&&(Be=Ee-(qe-wr)))}if(Qe=Math.ceil(Qe),Qe!==0&&me(Qe),He||Be!=null){const qe=$C(_e),ht=He?qe:Ly(Be,0,qe);Math.abs(_e.scrollTop-ht)>Vi&&(_e.scrollTop=ht)}(We||Qe>=Ue-Vi)&&(H.current=!0),w()});_.useImperativeHandle(T,()=>fe,[fe]),xa({open:K,ref:d,onComplete(){K&&p?.(!0)}});const Se={open:K,transitionStatus:G,side:O,align:j};Le(()=>{!V||!d.current||Object.keys(ae.current).length||(ae.current={top:V.style.top||"0",left:V.style.left||"0",right:V.style.right,height:V.style.height,bottom:V.style.bottom,minHeight:V.style.minHeight,maxHeight:V.style.maxHeight,marginTop:V.style.marginTop,marginBottom:V.style.marginBottom})},[d,V]),Le(()=>{K||R||(Y.current=!1,H.current=!1,M.current=0,W.current=0,Qh(V,ae.current))},[K,R,V,d]),Le(()=>{const _e=d.current;if(!(!K||!q||!V||!_e||f.state.transitionStatus==="ending")){if(!R){Y.current=!0,se.request(w),_e.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const re=XG(_e);_e.style.removeProperty("--transform-origin");try{const he=getComputedStyle(V),ie=getComputedStyle(_e),we=Rt(q),ye=un(V),xe=q.getBoundingClientRect(),ve=V.getBoundingClientRect(),Ie=xe.left,Ue=xe.height,Ee=L||_e,Ve=Ee.scrollHeight,Qe=parseFloat(ie.borderBottomWidth),Be=parseFloat(he.marginTop)||10,We=parseFloat(he.marginBottom)||10,He=parseFloat(he.minHeight)||100,me=UC(ie),Te=5,qe=5,ht=20,lt=we.documentElement.clientHeight-Be-We,wr=we.documentElement.clientWidth,Er=lt-xe.bottom+Ue,Qt=b.current,ut=y.current;let xt,ot=0,Wt=0;if(Qt&&ut){const tr=ut.getBoundingClientRect();xt=Qt.getBoundingClientRect();const cs=tr.left-Ie,fo=xt.left-ve.left,ho=tr.top-xe.top+tr.height/2,nr=xt.top-ve.top+xt.height/2;ot=cs-fo,Wt=nr-ho}const yn=Er+Wt+We+Qe;let kt=Math.min(lt,yn);const Cn=lt-Be-We,er=yn-kt,An=Math.max(Te,Ie+ot),is=wr-qe,as=Math.max(0,An+ve.width-is);V.style.left=`${An-as}px`,V.style.height=`${kt}px`,V.style.maxHeight="auto",V.style.marginTop=`${Be}px`,V.style.marginBottom=`${We}px`,_e.style.height="100%";const _a=Ee.scrollHeight-Ee.clientHeight,wi=er>=_a;wi&&(kt=Math.min(lt,ve.height)-(er-_a));const Ei=xe.top<ht||xe.bottom>lt-ht||kt<Math.min(Ve,He),_s=(ye.visualViewport?.scale??1)!==1&&tx;if(Ei||_s){Y.current=!0,Qh(V,ae.current),hi.flushSync(()=>I(!1));return}if(wi){const tr=Math.max(0,lt-yn);V.style.top=ve.height>=Cn?"0":`${tr}px`,V.style.height=`${kt}px`,Ee.scrollTop=Ee.scrollHeight-Ee.clientHeight,M.current=Math.max(He,kt)}else V.style.bottom="0",M.current=Math.max(He,kt),Ee.scrollTop=er;if(xt){const tr=ve.top,cs=ve.height,fo=xt.top+xt.height/2,ho=cs>0?(fo-tr)/cs*100:50,nr=Ly(ho,0,100);_e.style.setProperty("--transform-origin",`50% ${nr}%`)}(M.current===lt||kt>=me)&&(H.current=!0),w(),setTimeout(()=>{Y.current=!0})}finally{re()}})}},[f,K,V,q,y,b,d,w,R,I,se,z,N,L]),_.useEffect(()=>{if(!R||!V||!K)return;const _e=un(V);function re(he){g(!1,Yt(bV,he))}return _e.addEventListener("resize",re),()=>{_e.removeEventListener("resize",re)}},[g,R,V,K]);const pe={...L?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":S||void 0,id:`${Z}-list`},onKeyDown(_e){x.current=!0,A&&QA.has(_e.key)&&_e.stopPropagation()},onMouseMove(){x.current=!1},onPointerLeave(_e){if(!C||KA(_e)||_e.pointerType==="touch")return;const re=_e.currentTarget;U.start(0,()=>{f.set("activeIndex",null),re.focus({preventScroll:!0})})},onScroll(_e){L||fe(_e.currentTarget)},...R&&{style:L?{height:"100%"}:OG}},Me=zt("div",t,{ref:[n,d],state:Se,stateAttributesMapping:ZG,props:[P,pe,Np(G),{className:!L&&R?PC.className:void 0},l]});return h.jsxs(_.Fragment,{children:[!B&&PC.getElement(Q),h.jsx(_A,{context:D,modal:!1,disabled:!ee,returnFocus:a,restoreFocus:!0,children:Me})]})});function UC(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function $C(e){return Math.max(0,e.scrollHeight-e.clientHeight)}const BC=[["transform","none"],["scale","1"],["translate","0 0"]];function XG(e){const{style:t}=e,n={};for(const[s,i]of BC)n[s]=t.getPropertyValue(s),t.setProperty(s,i,"important");return()=>{for(const[s]of BC){const i=n[s];i?t.setProperty(s,i):t.removeProperty(s)}}}let WA=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function dx(e={}){const{label:t,metadata:n,textRef:s,indexGuessBehavior:i,index:a}=e,{register:l,unregister:f,subscribeMapChange:d,elementsRef:p,labelsRef:g,nextIndexRef:y}=RG(),b=_.useRef(-1),[x,S]=_.useState(a??(i===WA.GuessFromOrder?()=>{if(b.current===-1){const C=y.current;y.current+=1,b.current=C}return b.current}:-1)),w=_.useRef(null),T=_.useCallback(C=>{if(w.current=C,x!==-1&&C!==null&&(p.current[x]=C,g)){const O=t!==void 0;g.current[x]=O?t:s?.current?.textContent??C.textContent}},[x,p,g,t,s]);return Le(()=>{if(a!=null)return;const C=w.current;if(C)return l(C,n),()=>{f(C)}},[a,l,f,n]),Le(()=>{if(a==null)return d(C=>{const O=w.current?C.get(w.current)?.index:null;O!=null&&S(O)})},[a,d,S]),_.useMemo(()=>({ref:T,index:x}),[x,T])}const QG=_.createContext(void 0),WG=_.memo(_.forwardRef(function(t,n){const{render:s,className:i,value:a=null,label:l,disabled:f=!1,nativeButton:d=!1,...p}=t,g=_.useRef(null),y=dx({label:l,textRef:g,indexGuessBehavior:WA.GuessFromOrder}),{store:b,getItemProps:x,setOpen:S,setValue:w,selectionRef:T,typingRef:C,valuesRef:O,keyboardActiveRef:j,multiple:R,highlightItemOnHover:I}=Wu(),z=ns(),N=at(b,it.isActive,y.index),A=at(b,it.isSelected,y.index,a),D=at(b,it.isSelectedByFocus,y.index),Q=at(b,it.isItemEqualToValue),B=y.index,U=B!==-1,Z=_.useRef(null),K=Jo(B);Le(()=>{if(!U)return;const se=O.current;return se[B]=a,()=>{delete se[B]}},[U,B,a,O]),Le(()=>{if(!U)return;const se=b.state.value;let fe=se;R&&Array.isArray(se)&&se.length>0&&(fe=se[se.length-1]),fe!==void 0&&$c(a,fe,Q)&&b.set("selectedIndex",B)},[U,B,R,Q,b,a]);const ee={disabled:f,selected:A,highlighted:N},P=x({active:N,selected:A});P.onFocus=void 0,P.id=void 0;const G=_.useRef(null),q=_.useRef("mouse"),V=_.useRef(!1),{getButtonProps:L,buttonRef:M}=Jc({disabled:f,focusableWhenDisabled:!0,native:d});function H(se){const fe=b.state.value;if(R){const Se=Array.isArray(fe)?fe:[],pe=A?lG(Se,a,Q):[...Se,a];w(pe,Yt(Cy,se))}else w(a,Yt(Cy,se)),S(!1,Yt(Cy,se))}const W={role:"option","aria-selected":A,tabIndex:N?0:-1,onFocus(){b.set("activeIndex",B)},onMouseEnter(){!j.current&&b.state.selectedIndex===null&&I&&b.set("activeIndex",B)},onMouseMove(){I&&b.set("activeIndex",B)},onMouseLeave(se){!I||j.current||KA(se)||z.start(0,()=>{b.state.activeIndex===B&&b.set("activeIndex",null)})},onTouchStart(){T.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(se){G.current=se.key,b.set("activeIndex",B)},onClick(se){V.current=!1,!(se.type==="keydown"&&G.current===null)&&(f||G.current===" "&&C.current||q.current!=="touch"&&!N||(G.current=null,H(se.nativeEvent)))},onPointerEnter(se){q.current=se.pointerType},onPointerDown(se){q.current=se.pointerType,V.current=!0},onMouseUp(se){if(f)return;if(V.current){V.current=!1;return}const fe=!T.current.allowSelectedMouseUp&&A,Se=!T.current.allowUnselectedMouseUp&&!A;fe||Se||q.current!=="touch"&&!N||H(se.nativeEvent)}},Y=zt("div",t,{ref:[M,n,y.ref,Z],state:ee,props:[P,W,p,L]}),ae=_.useMemo(()=>({selected:A,indexRef:K,textRef:g,selectedByFocus:D,hasRegistered:U}),[A,K,g,D,U]);return h.jsx(QG.Provider,{value:ae,children:Y})})),JG=_.forwardRef(({className:e,children:t,...n},s)=>h.jsx(vG,{ref:s,className:ge("inline-flex items-center justify-between bg-surface border border-border rounded-md px-3 py-1.5 font-mono text-[12px] text-foreground cursor-pointer hover:border-border-bright transition",e),...n,children:t}));JG.displayName="SelectTrigger";const eZ=_.forwardRef(({className:e,portalProps:t,positionerProps:n,...s},i)=>h.jsx(xG,{...t,children:h.jsx(IG,{...n,children:h.jsx(YG,{ref:i,className:ge("bg-panel border border-border rounded-md py-1 shadow-lg z-50",e),...s})})}));eZ.displayName="SelectContent";const tZ=_.forwardRef(({className:e,...t},n)=>h.jsx(WG,{ref:n,className:ge("font-mono text-[11px] px-3 py-1.5 text-neutral-400 cursor-pointer hover:bg-white/[0.03] hover:text-white data-[highlighted]:bg-white/[0.03] data-[highlighted]:text-white outline-none",e),...t}));tZ.displayName="SelectItem";const nZ=_.forwardRef(({className:e,...t},n)=>h.jsx("textarea",{ref:n,className:ge("bg-surface border border-border rounded-md px-3 py-2 font-mono text-[12px] text-foreground outline-none w-full transition focus:border-flow placeholder:text-neutral-600 resize-none min-h-[80px]",e),...t}));nZ.displayName="Textarea";const JA=_.createContext(void 0);function rZ(e=!0){const t=_.useContext(JA);if(t===void 0&&!e)throw new Error(gn(7));return t}function ek(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:s}=Aj(),{ref:i,index:a}=dx(e),l=n===a,f=_.useRef(null),d=so(i,f);return{compositeProps:_.useMemo(()=>({tabIndex:l?0:-1,onFocus(){s(a)},onMouseMove(){const g=f.current;if(!t||!g)return;const y=g.hasAttribute("disabled")||g.ariaDisabled==="true";!l&&!y&&g.focus()}}),[l,s,a,t]),compositeRef:d,index:a}}function sZ(e){const{render:t,className:n,state:s=an,props:i=Eu,refs:a=Eu,metadata:l,stateAttributesMapping:f,tag:d="div",...p}=e,{compositeProps:g,compositeRef:y}=ek({metadata:l});return zt(d,e,{state:s,ref:[...a,y],props:[g,...i,p],stateAttributesMapping:f})}const oZ=_.forwardRef(function(t,n){const{className:s,defaultPressed:i=!1,disabled:a=!1,form:l,onPressedChange:f,pressed:d,render:p,type:g,value:y,nativeButton:b=!0,...x}=t,S=br(y||void 0),w=rZ(),T=w?.value??[],C=w?void 0:i,O=(a||w?.disabled)??!1,[j,R]=pp({controlled:w?S!==void 0&&T.indexOf(S)>-1:d,default:C,name:"Toggle",state:"pressed"}),I=ke((U,Z)=>{S&&w?.setGroupValue?.(S,U,Z),f?.(U,Z)}),{getButtonProps:z,buttonRef:N}=Jc({disabled:O,native:b}),A={disabled:O,pressed:j},D=[N,n],Q=[{"aria-pressed":j,onClick(U){const Z=!j,K=Yt(ii,U.nativeEvent);I(Z,K),!K.isCanceled&&R(Z)}},x,z],B=zt("button",t,{enabled:!w,state:A,ref:D,props:Q});return w?h.jsx(sZ,{tag:"button",render:p,className:s,state:A,refs:D,props:Q}):B}),Dr=_.forwardRef(({className:e,...t},n)=>h.jsx(oZ,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 border border-transparent rounded-sm px-2.5 py-1 cursor-pointer transition-all hover:text-neutral-300 data-[pressed]:text-white data-[pressed]:border-border-bright data-[pressed]:bg-white/[0.03]",e),...t}));Dr.displayName="Toggle";function iZ(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const tk="data-composite-item-active",aZ=[];function cZ(e){const{itemSizes:t,cols:n=1,loopFocus:s=!0,dense:i=!1,orientation:a="both",direction:l,highlightedIndex:f,onHighlightedIndexChange:d,rootRef:p,enableHomeAndEndKeys:g=!1,stopEventPropagation:y=!1,disabledIndices:b,modifierKeys:x=aZ}=e,[S,w]=_.useState(0),T=n>1,C=_.useRef(null),O=so(C,p),j=_.useRef([]),R=_.useRef(!1),I=f??S,z=ke((D,Q=!1)=>{if((d??w)(D),Q){const B=j.current[D];zC(C.current,B,l,a)}}),N=ke(D=>{if(D.size===0||R.current)return;R.current=!0;const Q=Array.from(D.keys()),B=Q.find(Z=>Z?.hasAttribute(tk))??null,U=B?Q.indexOf(B):-1;U!==-1&&z(U),zC(C.current,B,l,a)}),A=_.useMemo(()=>({"aria-orientation":a==="both"?void 0:a,ref:O,onFocus(D){!C.current||!DC(D.target)||D.target.setSelectionRange(0,D.target.value.length??0)},onKeyDown(D){const Q=g?LG:XA;if(!Q.has(D.key)||lZ(D,x)||!C.current)return;const U=l==="rtl",Z=U?Ru:Ec,K={horizontal:Z,vertical:Wi,both:Z}[a],ee=U?Ec:Ru,P={horizontal:ee,vertical:wc,both:ee}[a];if(DC(D.target)&&!iZ(D.target)){const W=D.target.selectionStart,Y=D.target.selectionEnd,ae=D.target.value??"";if(W==null||D.shiftKey||W!==Y||D.key!==P&&W<ae.length||D.key!==K&&W>0)return}let G=I;const q=w8(j,b),V=E8(j,b);if(T){const W=t||Array.from({length:j.current.length},()=>({width:1,height:1})),Y=C8(W,n,i),ae=Y.findIndex(fe=>fe!=null&&!fu(j,fe,b)),se=Y.reduce((fe,Se,pe)=>Se!=null&&!fu(j,Se,b)?pe:fe,-1);G=Y[T8({current:Y.map(fe=>fe?j.current[fe]:null)},{event:D,orientation:a,loopFocus:s,cols:n,disabledIndices:N8([...b||j.current.map((fe,Se)=>fu(j,Se)?Se:void 0),void 0],Y),minIndex:ae,maxIndex:se,prevIndex:R8(I>V?q:I,W,Y,n,D.key===Wi?"bl":D.key===Ec?"tr":"tl"),rtl:U})]}const L={horizontal:[Z],vertical:[Wi],both:[Z,Wi]}[a],M={horizontal:[ee],vertical:[wc],both:[ee,wc]}[a],H=T?Q:{horizontal:g?DG:ZA,vertical:g?zG:YA,both:Q}[a];g&&(D.key===Ju?G=q:D.key===ef&&(G=V)),G===I&&(L.includes(D.key)||M.includes(D.key))&&(s&&G===V&&L.includes(D.key)?G=q:s&&G===q&&M.includes(D.key)?G=V:G=fr(j,{startingIndex:G,decrement:M.includes(D.key),disabledIndices:b})),G!==I&&!ch(j,G)&&(y&&D.stopPropagation(),H.has(D.key)&&D.preventDefault(),z(G,!0),queueMicrotask(()=>{j.current[G]?.focus()}))}}),[n,i,l,b,j,g,I,T,t,s,O,x,z,a,y]);return _.useMemo(()=>({props:A,highlightedIndex:I,onHighlightedIndexChange:z,elementsRef:j,disabledIndices:b,onMapChange:N,relayKeyboardEvent:A.onKeyDown}),[A,I,z,j,b,N])}function lZ(e,t){for(const n of HG.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function nk(e){const{render:t,className:n,refs:s=Eu,props:i=Eu,state:a=an,stateAttributesMapping:l,highlightedIndex:f,onHighlightedIndexChange:d,orientation:p,dense:g,itemSizes:y,loopFocus:b,cols:x,enableHomeAndEndKeys:S,onMapChange:w,stopEventPropagation:T=!0,rootRef:C,disabledIndices:O,modifierKeys:j,highlightItemOnHover:R=!1,tag:I="div",...z}=e,N=IA(),{props:A,highlightedIndex:D,onHighlightedIndexChange:Q,elementsRef:B,onMapChange:U,relayKeyboardEvent:Z}=cZ({itemSizes:y,cols:x,loopFocus:b,dense:g,orientation:p,highlightedIndex:f,onHighlightedIndexChange:d,rootRef:C,stopEventPropagation:T,enableHomeAndEndKeys:S,direction:N,disabledIndices:O,modifierKeys:j}),K=zt(I,e,{state:a,ref:s,props:[A,...i,z],stateAttributesMapping:l}),ee=_.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:Q,highlightItemOnHover:R,relayKeyboardEvent:Z}),[D,Q,R,Z]);return h.jsx(jj.Provider,{value:ee,children:h.jsx(HA,{elementsRef:B,onMapChange:P=>{w?.(P),U(P)},children:K})})}let uZ=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const FC={multiple(e){return e?{[uZ.multiple]:""}:null}},fZ=_.forwardRef(function(t,n){const{defaultValue:s,disabled:i=!1,loopFocus:a=!0,onValueChange:l,orientation:f="horizontal",multiple:d=!1,value:p,className:g,render:y,...b}=t,x=GA(),S=_.useMemo(()=>{if(p===void 0)return s??[]},[p,s]),w=_.useMemo(()=>p!==void 0||s!==void 0,[p,s]),T=(x?.disabled??!1)||i,[C,O]=pp({controlled:p,default:S,name:"ToggleGroup",state:"value"}),j=ke((A,D,Q)=>{let B;if(d?(B=C.slice(),D?B.push(A):B.splice(C.indexOf(A),1)):B=D?[A]:[],Array.isArray(B)){if(l?.(B,Q),Q.isCanceled)return;O(B)}}),R={disabled:T,multiple:d,orientation:f},I=_.useMemo(()=>({disabled:T,orientation:f,setGroupValue:j,value:C,isValueInitialized:w}),[T,f,j,C,w]),z={role:"group"},N=zt("div",t,{enabled:!!x,state:R,ref:n,props:[z,b],stateAttributesMapping:FC});return h.jsx(JA.Provider,{value:I,children:x?N:h.jsx(nk,{render:y,className:g,state:R,refs:[n],props:[z,b],stateAttributesMapping:FC,loopFocus:a,enableHomeAndEndKeys:!0})})}),dh=_.forwardRef(({className:e,...t},n)=>h.jsx(fZ,{ref:n,className:ge("flex items-center gap-0.5",e),...t}));dh.displayName="ToggleGroup";function rk({active:e,onClick:t,children:n,className:s}){return h.jsxs("button",{type:"button",onClick:t,className:ge("font-mono text-[10px] tracking-[1.5px] uppercase bg-transparent border-none px-3.5 py-1 cursor-pointer relative transition-colors",e?"text-white":"text-neutral-500 hover:text-neutral-300",s),children:[n,e&&h.jsx("span",{className:"absolute -bottom-2.5 left-1/2 -translate-x-1/2 w-4 h-0.5 bg-flow rounded-sm shadow-[0_0_8px_rgba(59,130,246,0.5)]"})]})}function dZ({items:e,activeId:t,onItemChange:n,renderItem:s,className:i}){return h.jsx("div",{className:ge("flex items-center gap-0.5",i),children:e.map(a=>{const l=a.id===t,f=()=>n?.(a.id);return s?h.jsx("span",{children:s(a,{active:l,onClick:f})},a.id):h.jsx(rk,{active:l,onClick:f,children:a.label},a.id)})})}const hZ=gi("rounded-full inline-block flex-shrink-0",{variants:{color:{healthy:"bg-healthy",syncing:"bg-syncing",offline:"bg-offline",flow:"bg-flow",relay:"bg-relay",encrypt:"bg-encrypt",muted:"bg-neutral-500"},size:{sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"},glow:{true:"",false:""}},defaultVariants:{color:"healthy",size:"sm",glow:!1}}),pZ={healthy:"0 0 6px #22c55e",syncing:"0 0 6px #f59e0b",offline:"0 0 6px #ef4444",flow:"0 0 6px #3b82f6",relay:"0 0 6px #8b5cf6",encrypt:"0 0 6px #f472b6",muted:"none"};function mZ({color:e,size:t,glow:n,pulse:s,className:i}){return h.jsx("span",{className:ge(hZ({color:e,size:t,glow:n}),s&&"dot-pulse",i),style:n?{boxShadow:pZ[e??"healthy"]}:void 0})}const gZ="0.0.6-45",yZ={version:gZ},vZ=yZ.version;function bZ({label:e,className:t}){return h.jsxs("div",{className:ge("flex items-center gap-3",t),children:[h.jsx(mZ,{color:"healthy",size:"md",glow:!0}),h.jsx("span",{className:"font-display font-bold text-white text-sm tracking-tight",children:"syncular"}),e&&h.jsx("span",{className:"font-mono text-[9px] text-neutral-600 uppercase tracking-widest",children:e}),h.jsxs("span",{className:"font-mono text-[9px] text-neutral-600 tracking-wider",children:["v",vZ]})]})}function xZ({brand:e,center:t,right:n,className:s}){return h.jsxs("nav",{className:ge("fixed top-0 left-0 right-0 z-100 h-[42px] border-b border-border bg-surface/88 backdrop-blur-lg flex items-center justify-between px-5",s),children:[h.jsx("div",{className:"flex items-center gap-3",children:e}),h.jsx("div",{className:"flex items-center gap-0.5",children:t}),h.jsx("div",{className:"flex items-center gap-2",children:n})]})}const SZ=gi("border rounded-lg p-3 font-mono text-[11px]",{variants:{variant:{default:"border-border bg-panel",destructive:"border-offline/20 bg-offline/5 text-offline"}},defaultVariants:{variant:"default"}}),In=_.forwardRef(({className:e,variant:t,...n},s)=>h.jsx("div",{ref:s,role:"alert",className:ge(SZ({variant:t,className:e})),...n}));In.displayName="Alert";const tf=_.forwardRef(({className:e,...t},n)=>h.jsx("h5",{ref:n,className:ge("font-medium text-white mb-1",e),...t}));tf.displayName="AlertTitle";const Pn=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("text-neutral-400",e),...t}));Pn.displayName="AlertDescription";const sk=_.createContext(void 0);function rl(e){const t=_.useContext(sk);if(e===!1&&t===void 0)throw new Error(gn(27));return t}const _Z={...nl,...ba},hx=_.forwardRef(function(t,n){const{render:s,className:i,forceRender:a=!1,...l}=t,{store:f}=rl(),d=f.useState("open"),p=f.useState("nested"),g=f.useState("mounted"),y=f.useState("transitionStatus");return zt("div",t,{state:{open:d,transitionStatus:y},ref:[f.context.backdropRef,n],stateAttributesMapping:_Z,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:a||!p})}),ok=_.forwardRef(function(t,n){const{render:s,className:i,id:a,...l}=t,{store:f}=rl(),d=br(a);return f.useSyncedValueWithCleanup("descriptionElementId",d),zt("p",t,{ref:n,props:[{id:d},l]})});let wZ=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),EZ=(function(e){return e[e.open=Qi.open]="open",e[e.closed=Qi.closed]="closed",e[e.startingStyle=Qi.startingStyle]="startingStyle",e[e.endingStyle=Qi.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const ik=_.createContext(void 0);function TZ(){const e=_.useContext(ik);if(e===void 0)throw new Error(gn(26));return e}const CZ={...nl,...ba,nestedDialogOpen(e){return e?{[EZ.nestedDialogOpen]:""}:null}},ak=_.forwardRef(function(t,n){const{className:s,finalFocus:i,initialFocus:a,render:l,...f}=t,{store:d}=rl(),p=d.useState("descriptionElementId"),g=d.useState("disablePointerDismissal"),y=d.useState("floatingRootContext"),b=d.useState("popupProps"),x=d.useState("modal"),S=d.useState("mounted"),w=d.useState("nested"),T=d.useState("nestedOpenDialogCount"),C=d.useState("open"),O=d.useState("openMethod"),j=d.useState("titleElementId"),R=d.useState("transitionStatus"),I=d.useState("role");TZ(),xa({open:C,ref:d.context.popupRef,onComplete(){C&&d.context.onOpenChangeComplete?.(!0)}});function z(B){return B==="touch"?d.context.popupRef.current:!0}const N=a===void 0?z:a,A=T>0,Q=zt("div",t,{state:{open:C,nested:w,transitionStatus:R,nestedDialogOpen:A},props:[b,{"aria-labelledby":j??void 0,"aria-describedby":p??void 0,role:I,tabIndex:-1,hidden:!S,onKeyDown(B){QA.has(B.key)&&B.stopPropagation()},style:{[wZ.nestedDialogs]:T}},f],ref:[n,d.context.popupRef,d.useStateSetter("popupElement")],stateAttributesMapping:CZ});return h.jsx(_A,{context:y,openInteractionType:O,disabled:!S,closeOnFocusOut:!g,initialFocus:N,returnFocus:i,modal:x!==!1,restoreFocus:"popup",children:Q})}),ck=_.forwardRef(function(t,n){const{keepMounted:s=!1,...i}=t,{store:a}=rl(),l=a.useState("mounted"),f=a.useState("modal"),d=a.useState("open");return l||s?h.jsx(ik.Provider,{value:s,children:h.jsxs(SA,{ref:n,...i,children:[l&&f===!0&&h.jsx(VA,{ref:a.context.internalBackdropRef,inert:fx(!d)}),t.children]})}):null});function RZ(e){const{store:t,parentContext:n,actionsRef:s}=e,i=t.useState("open"),a=t.useState("disablePointerDismissal"),l=t.useState("modal"),f=t.useState("popupElement"),{openMethod:d,triggerProps:p,reset:g}=pG(i);s7(t);const{forceUnmount:y}=o7(i,t,()=>{g()}),b=ke(Q=>{const B=Yt(Q);return B.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},B}),x=_.useCallback(()=>{t.setOpen(!1,b(vV))},[t,b]);_.useImperativeHandle(s,()=>({unmount:y,close:x}),[y,x]);const S=f7({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,T]=_.useState(0),C=w===0,O=x7(S),j=KK(S,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(Q){if(!t.context.outsidePressEnabledRef.current||"button"in Q&&Q.button!==0||"touches"in Q&&Q.touches.length!==1)return!1;const B=Ur(Q);if(C&&!a){const U=B;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===U||t.context.backdropRef.current===U||Ot(U,f)&&!U?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});BA(i&&l===!0,f);const{getReferenceProps:R,getFloatingProps:I,getTriggerProps:z}=v7([O,j]);t.useContextCallback("onNestedDialogOpen",Q=>{T(Q+1)}),t.useContextCallback("onNestedDialogClose",()=>{T(0)}),_.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(w),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,w]);const N=_.useMemo(()=>R(p),[R,p]),A=_.useMemo(()=>z(p),[z,p]),D=_.useMemo(()=>I(),[I]);t.useSyncedValues({openMethod:d,activeTriggerProps:N,inactiveTriggerProps:A,popupProps:D,floatingRootContext:S,nestedOpenDialogCount:w})}const NZ={...c7,modal:Pe(e=>e.modal),nested:Pe(e=>e.nested),nestedOpenDialogCount:Pe(e=>e.nestedOpenDialogCount),disablePointerDismissal:Pe(e=>e.disablePointerDismissal),openMethod:Pe(e=>e.openMethod),descriptionElementId:Pe(e=>e.descriptionElementId),titleElementId:Pe(e=>e.titleElementId),viewportElement:Pe(e=>e.viewportElement),role:Pe(e=>e.role)};class jZ extends kA{constructor(t){super(AZ(t),{popupRef:_.createRef(),backdropRef:_.createRef(),internalBackdropRef:_.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new lx,onOpenChange:void 0,onOpenChangeComplete:void 0},NZ)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const s={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",s);const i={open:t},a=n.trigger?.id??null;(a||t)&&(i.activeTriggerId=a,i.activeTriggerElement=n.trigger??null),this.update(i)}}function AZ(e={}){return{...a7(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function kZ(e){const{children:t,open:n,defaultOpen:s=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:l=!1,modal:f=!0,actionsRef:d,handle:p,triggerId:g,defaultTriggerId:y=null}=e,b=rl(!0),x=!!b,S=zn(()=>p?.store??new jZ({open:s,openProp:n,activeTriggerId:y,triggerIdProp:g,modal:f,disablePointerDismissal:l,nested:x})).current;ZV(()=>{n===void 0&&S.state.open===!1&&s===!0&&S.update({open:!0,activeTriggerId:y})}),S.useControlledProp("openProp",n),S.useControlledProp("triggerIdProp",g),S.useSyncedValues({disablePointerDismissal:l,nested:x,modal:f}),S.useContextCallback("onOpenChange",i),S.useContextCallback("onOpenChangeComplete",a);const w=S.useState("payload");RZ({store:S,actionsRef:d,parentContext:b?.store.context});const T=_.useMemo(()=>({store:S}),[S]);return h.jsx(sk.Provider,{value:T,children:typeof t=="function"?t({payload:w}):t})}const lk=_.forwardRef(function(t,n){const{render:s,className:i,id:a,...l}=t,{store:f}=rl(),d=br(a);return f.useSyncedValueWithCleanup("titleElementId",d),zt("h2",t,{ref:n,props:[{id:d},l]})}),$r=kZ,OZ=_.forwardRef(({className:e,...t},n)=>h.jsx(hx,{ref:n,className:ge("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",e),...t}));OZ.displayName="DialogOverlay";const hr=_.forwardRef(({className:e,children:t,...n},s)=>h.jsxs(ck,{children:[h.jsx(hx,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),h.jsx(ak,{ref:s,className:ge("fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-panel border border-border rounded-lg shadow-lg max-w-lg w-full p-0",e),...n,children:t})]}));hr.displayName="DialogContent";const pr=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-b border-border",e),...t}));pr.displayName="DialogHeader";const Nn=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-t border-border flex justify-end gap-2",e),...t}));Nn.displayName="DialogFooter";const mr=_.forwardRef(({className:e,...t},n)=>h.jsx(lk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 uppercase tracking-widest",e),...t}));mr.displayName="DialogTitle";const MZ=_.forwardRef(({className:e,...t},n)=>h.jsx(ok,{ref:n,className:ge("font-mono text-[10px] text-neutral-500",e),...t}));MZ.displayName="DialogDescription";const px=_.forwardRef(({className:e,page:t,totalPages:n,totalItems:s,onPageChange:i,...a},l)=>h.jsxs("div",{ref:l,className:ge("px-5 py-2.5 border-t border-border flex items-center justify-between",e),...a,children:[h.jsxs("span",{className:"font-mono text-[10px] text-neutral-600",children:[s," items · Page ",t," of ",n]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(Ne,{size:"sm",variant:"default",disabled:t<=1,onClick:()=>i(t-1),children:"Prev"}),h.jsx(Ne,{size:"sm",variant:"default",disabled:t>=n,onClick:()=>i(t+1),children:"Next"})]})]}));px.displayName="Pagination";const IZ=_.forwardRef(({className:e,orientation:t="horizontal",...n},s)=>h.jsx("hr",{ref:s,"aria-orientation":t==="vertical"?"vertical":void 0,className:ge("border-none m-0",t==="horizontal"?"h-px w-full bg-border":"w-px h-4 bg-border",e),...n}));IZ.displayName="Separator";const PZ=gi("fixed z-50 bg-panel shadow-lg overflow-auto",{variants:{side:{top:"top-0 left-0 w-full h-[400px] border-b border-border",right:"right-0 top-0 h-full w-[400px] border-l border-border",bottom:"bottom-0 left-0 w-full h-[400px] border-t border-border",left:"left-0 top-0 h-full w-[400px] border-r border-border"}},defaultVariants:{side:"right"}}),DZ=_.forwardRef(({className:e,side:t,children:n,...s},i)=>h.jsxs(ck,{children:[h.jsx(hx,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),h.jsx(ak,{ref:i,className:ge(PZ({side:t,className:e})),...s,children:n})]}));DZ.displayName="SheetContent";const zZ=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-b border-border",e),...t}));zZ.displayName="SheetHeader";const LZ=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-t border-border flex justify-end gap-2",e),...t}));LZ.displayName="SheetFooter";const UZ=_.forwardRef(({className:e,...t},n)=>h.jsx(lk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 uppercase tracking-widest",e),...t}));UZ.displayName="SheetTitle";const $Z=_.forwardRef(({className:e,...t},n)=>h.jsx(ok,{ref:n,className:ge("text-sm text-neutral-400",e),...t}));$Z.displayName="SheetDescription";const BZ=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("rounded-md bg-neutral-800 animate-pulse",e),...t}));BZ.displayName="Skeleton";const FZ=_.createContext(void 0);function mx(){const e=_.useContext(FZ);if(e===void 0)throw new Error(gn(64));return e}let HZ=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const uk={tabActivationDirection:e=>({[HZ.activationDirection]:e})},fk=_.createContext(void 0);function qZ(){const e=_.useContext(fk);if(e===void 0)throw new Error(gn(65));return e}const VZ=_.forwardRef(function(t,n){const{className:s,disabled:i=!1,render:a,value:l,id:f,nativeButton:d=!0,...p}=t,{value:g,getTabPanelIdByValue:y,orientation:b}=mx(),{activateOnFocus:x,highlightedTabIndex:S,onTabActivation:w,setHighlightedTabIndex:T,tabsListElement:C}=qZ(),O=br(f),j=_.useMemo(()=>({disabled:i,id:O,value:l}),[i,O,l]),{compositeProps:R,compositeRef:I,index:z}=ek({metadata:j}),N=l===g,A=_.useRef(!1);Le(()=>{if(A.current){A.current=!1;return}if(!(N&&z>-1&&S!==z))return;const V=C;if(V!=null){const L=Fo(Rt(V));if(L&&Ot(V,L))return}i||T(z)},[N,z,S,T,i,C]);const{getButtonProps:D,buttonRef:Q}=Jc({disabled:i,native:d,focusableWhenDisabled:!0}),B=y(l),U=_.useRef(!1),Z=_.useRef(!1);function K(V){N||i||w(l,Yt(ii,V.nativeEvent,void 0,{activationDirection:"none"}))}function ee(V){N||(z>-1&&!i&&T(z),!i&&x&&(!U.current||U.current&&Z.current)&&w(l,Yt(ii,V.nativeEvent,void 0,{activationDirection:"none"})))}function P(V){if(N||i)return;U.current=!0;function L(){U.current=!1,Z.current=!1}(!V.button||V.button===0)&&(Z.current=!0,Rt(V.currentTarget).addEventListener("pointerup",L,{once:!0}))}return zt("button",t,{state:{disabled:i,active:N,orientation:b},ref:[n,Q,I],props:[R,{role:"tab","aria-controls":B,"aria-selected":N,id:O,onClick:K,onFocus:ee,onPointerDown:P,[tk]:N?"":void 0,onKeyDownCapture(){A.current=!0}},p,D]})});let KZ=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const GZ={...uk,...ba},ZZ=_.forwardRef(function(t,n){const{className:s,value:i,render:a,keepMounted:l=!1,...f}=t,{value:d,getTabIdByPanelValue:p,orientation:g,tabActivationDirection:y,registerMountedTabPanel:b,unregisterMountedTabPanel:x}=mx(),S=br(),w=_.useMemo(()=>({id:S,value:i}),[S,i]),{ref:T,index:C}=dx({metadata:w}),O=i===d,{mounted:j,transitionStatus:R,setMounted:I}=Rp(O),z=!j,N=p(i),A={hidden:z,orientation:g,tabActivationDirection:y,transitionStatus:R},D=_.useRef(null),Q=zt("div",t,{state:A,ref:[n,T,D],props:[{"aria-labelledby":N,hidden:z,id:S,role:"tabpanel",tabIndex:O?0:-1,inert:fx(!O),[KZ.index]:C},f],stateAttributesMapping:GZ});return xa({open:O,ref:D,onComplete(){O||I(!1)}}),Le(()=>{if(!(z&&!l)&&S!=null)return b(i,S),()=>{x(i,S)}},[z,l,i,S,b,x]),l||j?Q:null}),YZ=_.forwardRef(function(t,n){const{activateOnFocus:s=!1,className:i,loopFocus:a=!0,render:l,...f}=t,{getTabElementBySelectedValue:d,onValueChange:p,orientation:g,value:y,setTabMap:b,tabActivationDirection:x}=mx(),[S,w]=_.useState(0),[T,C]=_.useState(null),O=XZ(y,g,T,d),j=ke((N,A)=>{if(N!==y){const D=O(N);A.activationDirection=D,p(N,A)}}),R={orientation:g,tabActivationDirection:x},I={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},z=_.useMemo(()=>({activateOnFocus:s,highlightedTabIndex:S,onTabActivation:j,setHighlightedTabIndex:w,tabsListElement:T,value:y}),[s,S,j,w,T,y]);return h.jsx(fk.Provider,{value:z,children:h.jsx(nk,{render:l,className:i,state:R,refs:[n,C],props:[I,f],stateAttributesMapping:uk,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:a,orientation:g,onHighlightedIndexChange:w,onMapChange:b,disabledIndices:Eu})})});function HC(e,t){const{left:n,top:s}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect(),l=n-i,f=s-a;return{left:l,top:f}}function XZ(e,t,n,s){const[i,a]=_.useState(null);return Le(()=>{if(e==null||n==null){a(null);return}const l=s(e);if(l==null){a(null);return}const{left:f,top:d}=HC(l,n);a(t==="horizontal"?f:d)},[t,s,n,e]),_.useCallback(l=>{if(l===e)return"none";if(l==null)return a(null),"none";if(l!=null&&n!=null){const f=s(l);if(f!=null){const{left:d,top:p}=HC(f,n);if(i==null)return a(t==="horizontal"?d:p),"none";if(t==="horizontal"){if(d<i)return a(d),"left";if(d>i)return a(d),"right"}else{if(p<i)return a(p),"up";if(p>i)return a(p),"down"}}}return"none"},[s,t,i,n,e])}const QZ=_.forwardRef(({className:e,...t},n)=>h.jsx(YZ,{ref:n,className:ge("flex items-center gap-0.5",e),...t}));QZ.displayName="TabsList";const WZ=gi("inline-flex items-center justify-center cursor-pointer transition-all outline-none",{variants:{variant:{default:"font-mono text-[10px] text-neutral-500 border border-transparent rounded-sm px-2.5 py-1 hover:text-neutral-300 data-[selected]:text-white data-[selected]:border-border-bright data-[selected]:bg-white/[0.03]",pills:"font-mono text-[10px] text-neutral-500 border border-transparent rounded-full px-3 py-1 hover:text-neutral-300 data-[selected]:text-white data-[selected]:border-border-bright data-[selected]:bg-white/[0.03]"}},defaultVariants:{variant:"default"}}),JZ=_.forwardRef(({className:e,variant:t,...n},s)=>h.jsx(VZ,{ref:s,className:ge(WZ({variant:t,className:e})),...n}));JZ.displayName="TabsTrigger";const eY=_.forwardRef(({className:e,...t},n)=>h.jsx(ZZ,{ref:n,className:ge("outline-none",e),...t}));eY.displayName="TabsContent";const tY=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("font-mono text-[11px] text-neutral-300",e),...t}));tY.displayName="Text";const nY=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("font-mono text-[10px] text-neutral-500",e),...t}));nY.displayName="TextMuted";const rY=_.forwardRef(({className:e,...t},n)=>h.jsx("code",{ref:n,className:ge("font-mono text-[11px] text-white",e),...t}));rY.displayName="TextCode";const sY=_.forwardRef(({className:e,...t},n)=>h.jsx("span",{ref:n,className:ge("font-mono text-[9px] uppercase tracking-wider text-neutral-500",e),...t}));sY.displayName="TextLabel";const oY=_.forwardRef(({className:e,...t},n)=>h.jsx("pre",{ref:n,className:ge("font-mono text-[11px] text-neutral-300 p-3 rounded border border-border bg-panel-alt overflow-x-auto",e),...t}));oY.displayName="CodeBlock";const dk=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const iY=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const aY=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const qC=e=>{const t=aY(e);return t.charAt(0).toUpperCase()+t.slice(1)};var cY={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const lY=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const uY=_.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:a,iconNode:l,...f},d)=>_.createElement("svg",{ref:d,...cY,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:dk("lucide",i),...!a&&!lY(f)&&{"aria-hidden":"true"},...f},[...l.map(([p,g])=>_.createElement(p,g)),...Array.isArray(a)?a:[a]]));const fY=(e,t)=>{const n=_.forwardRef(({className:s,...i},a)=>_.createElement(uY,{ref:a,iconNode:t,className:dk(`lucide-${iY(qC(e))}`,`lucide-${e}`,s),...i}));return n.displayName=qC(e),n};const dY=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],hY=fY("settings",dY),pY="console:instance-id";function Lt(){const[e,t]=pi(pY,""),n=e.trim();return _.useMemo(()=>({instanceId:n.length>0?n:void 0,rawInstanceId:e,setInstanceId:t,clearInstanceId:()=>t("")}),[n,e,t])}const Jn={stats:e=>["console","stats",e],timeseries:e=>["console","stats","timeseries",e],latency:e=>["console","stats","latency",e],commits:e=>["console","commits",e],commitDetail:(e,t,n)=>["console","commit-detail",e,t,n],timeline:e=>["console","timeline",e],clients:e=>["console","clients",e],eventDetail:(e,t,n)=>["console","event-detail",e,t,n],eventPayload:(e,t,n)=>["console","event-payload",e,t,n],handlers:e=>["console","handlers",e],prunePreview:e=>["console","prune","preview",e],operations:e=>["console","operations",e],apiKeys:e=>["console","api-keys",e],storage:e=>["console","storage",e]};function _i(e,t){return e===0?!1:e??t}function nf(e,t){return t?{...e,instanceId:t}:e}function Sa(e){return encodeURIComponent(String(e))}function Ln(e,t,n){const s=e.endsWith("/")?e.slice(0,-1):e,i=n?.toString();return`${s}${t}${i?`?${i}`:""}`}function rf(e={}){const t=Vt(),{instanceId:n}=Lt(),s=e.instanceId??n,i=nf(e.partitionId?{partitionId:e.partitionId}:{},s);return Wn({queryKey:Jn.stats({partitionId:e.partitionId,instanceId:s}),queryFn:()=>{if(!t)throw new Error("Not connected");return Ku(t.GET("/console/stats",{params:{query:i}}))},enabled:!!t,refetchInterval:_i(e.refetchIntervalMs,5e3)})}function mY(e={},t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=e.instanceId??i;return Wn({queryKey:Jn.timeseries({...e,instanceId:a}),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");const l=new URLSearchParams;e.interval&&l.set("interval",e.interval),e.range&&l.set("range",e.range),e.partitionId&&l.set("partitionId",e.partitionId),a&&l.set("instanceId",a);const f=await fetch(`${s.serverUrl}/console/stats/timeseries?${l}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!f.ok)throw new Error("Failed to fetch timeseries stats");return f.json()},enabled:(t.enabled??!0)&&!!n&&!!s,refetchInterval:_i(t.refetchIntervalMs,3e4)})}function gY(e={},t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=e.instanceId??i;return Wn({queryKey:Jn.latency({...e,instanceId:a}),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");const l=new URLSearchParams;e.range&&l.set("range",e.range),e.partitionId&&l.set("partitionId",e.partitionId),a&&l.set("instanceId",a);const f=await fetch(`${s.serverUrl}/console/stats/latency?${l}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!f.ok)throw new Error("Failed to fetch latency stats");return f.json()},enabled:(t.enabled??!0)&&!!n&&!!s,refetchInterval:_i(t.refetchIntervalMs,3e4)})}function yY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=nf({limit:e.limit,offset:e.offset,partitionId:e.partitionId},i);return Wn({queryKey:Jn.commits({...e,instanceId:i}),queryFn:()=>{if(!n)throw new Error("Not connected");return Ku(n.GET("/console/commits",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:_i(t.refetchIntervalMs,1e4)})}function vY(e,t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=t.instanceId??i;return Wn({queryKey:Jn.commitDetail(e,t.partitionId,a),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");if(e===void 0)throw new Error("Commit sequence is required");const l=new URLSearchParams;t.partitionId&&l.set("partitionId",t.partitionId),a&&l.set("instanceId",a);const f=l.toString(),d=await fetch(`${s.serverUrl}/console/commits/${Sa(e)}${f?`?${f}`:""}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!d.ok)throw new Error("Failed to fetch commit detail");return d.json()},enabled:(t.enabled??!0)&&e!==void 0&&!!n})}function bY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=nf({limit:e.limit,offset:e.offset,partitionId:e.partitionId,view:e.view,eventType:e.eventType,actorId:e.actorId,clientId:e.clientId,requestId:e.requestId,traceId:e.traceId,table:e.table,outcome:e.outcome,search:e.search,from:e.from,to:e.to},i);return Wn({queryKey:Jn.timeline({...e,instanceId:i}),queryFn:()=>{if(!n)throw new Error("Not connected");return Ku(n.GET("/console/timeline",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:_i(t.refetchIntervalMs,1e4)})}function hk(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=nf({limit:e.limit,offset:e.offset,partitionId:e.partitionId},i);return Wn({queryKey:Jn.clients({...e,instanceId:i}),queryFn:()=>{if(!n)throw new Error("Not connected");return Ku(n.GET("/console/clients",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:_i(t.refetchIntervalMs,1e4)})}function xY(e,t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=t.instanceId??i;return Wn({queryKey:Jn.eventDetail(e,t.partitionId,a),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");if(e===void 0)throw new Error("Event id is required");const l=new URLSearchParams;t.partitionId&&l.set("partitionId",t.partitionId),a&&l.set("instanceId",a);const f=l.toString(),d=await fetch(`${s.serverUrl}/console/events/${Sa(e)}${f?`?${f}`:""}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!d.ok)throw new Error("Failed to fetch event detail");return d.json()},enabled:(t.enabled??!0)&&e!==void 0&&!!n})}function SY(e,t={}){const n=Vt(),{config:s}=Dt(),{instanceId:i}=Lt(),a=t.instanceId??i;return Wn({queryKey:Jn.eventPayload(e,t.partitionId,a),queryFn:async()=>{if(!n||!s)throw new Error("Not connected");if(e===void 0)throw new Error("Event id is required");const l=new URLSearchParams;t.partitionId&&l.set("partitionId",t.partitionId),a&&l.set("instanceId",a);const f=l.toString(),d=await fetch(`${s.serverUrl}/console/events/${Sa(e)}/payload${f?`?${f}`:""}`,{headers:{Authorization:`Bearer ${s.token}`}});if(!d.ok)throw new Error("Failed to fetch event payload");return d.json()},enabled:(t.enabled??!0)&&e!==void 0&&!!n})}function _Y(e={}){const t=Vt(),{config:n}=Dt(),{instanceId:s}=Lt(),i=e.instanceId??s;return Wn({queryKey:Jn.handlers(i),queryFn:async()=>{if(!t||!n)throw new Error("Not connected");const a=new URLSearchParams;i&&a.set("instanceId",i);const l=await fetch(Ln(n.serverUrl,"/console/handlers",a),{headers:{Authorization:`Bearer ${n.token}`}});if(!l.ok)throw new Error("Failed to fetch handlers");return l.json()},enabled:!!t&&!!n})}function wY(e={}){const t=Vt(),{config:n}=Dt(),{instanceId:s}=Lt(),i=e.instanceId??s;return Wn({queryKey:Jn.prunePreview(i),queryFn:async()=>{if(!t||!n)throw new Error("Not connected");const a=new URLSearchParams;i&&a.set("instanceId",i);const l=await fetch(Ln(n.serverUrl,"/console/prune/preview",a),{method:"POST",headers:{Authorization:`Bearer ${n.token}`}});if(!l.ok)throw new Error("Failed to fetch prune preview");return l.json()},enabled:!!t&&!!n&&(e.enabled??!0)})}function EY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=nf({limit:e.limit,offset:e.offset,operationType:e.operationType,partitionId:e.partitionId},i);return Wn({queryKey:Jn.operations({...e,instanceId:i}),queryFn:()=>{if(!n)throw new Error("Not connected");return Ku(n.GET("/console/operations",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:_i(t.refetchIntervalMs,1e4)})}function TY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async({clientId:i,partitionId:a,instanceId:l})=>{if(!e||!t)throw new Error("Not connected");const f=l??n,d=new URLSearchParams;a&&d.set("partitionId",a),f&&d.set("instanceId",f);const p=await fetch(Ln(t.serverUrl,`/console/clients/${Sa(i)}`,d),{method:"DELETE",headers:{Authorization:`Bearer ${t.token}`}});if(!p.ok)throw new Error("Failed to evict client");return p.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","clients"]}),s.invalidateQueries({queryKey:["console","stats"]}),s.invalidateQueries({queryKey:["console","operations"]})}})}function CY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async()=>{if(!e||!t)throw new Error("Not connected");const i=new URLSearchParams;n&&i.set("instanceId",n);const a=await fetch(Ln(t.serverUrl,"/console/prune",i),{method:"POST",headers:{Authorization:`Bearer ${t.token}`}});if(!a.ok)throw new Error("Failed to prune");return a.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","stats"]}),s.invalidateQueries({queryKey:["console","commits"]}),s.invalidateQueries({queryKey:["console","timeline"]}),s.invalidateQueries({queryKey:["console","prune","preview"]}),s.invalidateQueries({queryKey:["console","operations"]})}})}function RY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async()=>{if(!e||!t)throw new Error("Not connected");const i=new URLSearchParams;n&&i.set("instanceId",n);const a=await fetch(Ln(t.serverUrl,"/console/compact",i),{method:"POST",headers:{Authorization:`Bearer ${t.token}`}});if(!a.ok)throw new Error("Failed to compact");return a.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","stats"]}),s.invalidateQueries({queryKey:["console","operations"]})}})}function NY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=i.instanceId??n,l=new URLSearchParams;a&&l.set("instanceId",a);const f=await fetch(Ln(t.serverUrl,"/console/notify-data-change",l),{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify({tables:i.tables,partitionId:i.partitionId})});if(!f.ok)throw new Error("Failed to notify data change");return f.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","stats"]}),s.invalidateQueries({queryKey:["console","commits"]}),s.invalidateQueries({queryKey:["console","timeline"]}),s.invalidateQueries({queryKey:["console","operations"]})}})}function jY(e={}){const t=Vt(),{config:n}=Dt(),{instanceId:s}=Lt(),i=e.instanceId??s;return Wn({queryKey:Jn.apiKeys({...e,instanceId:i}),queryFn:async()=>{if(!t||!n)throw new Error("Not connected");const a=new URLSearchParams;e.limit!==void 0&&a.set("limit",String(e.limit)),e.offset!==void 0&&a.set("offset",String(e.offset)),e.type&&a.set("type",e.type),e.status&&a.set("status",e.status),e.expiresWithinDays!==void 0&&a.set("expiresWithinDays",String(e.expiresWithinDays)),i&&a.set("instanceId",i);const l=await fetch(Ln(n.serverUrl,"/console/api-keys",a),{headers:{Authorization:`Bearer ${n.token}`}});if(!l.ok)throw new Error("Failed to fetch API keys");return l.json()},enabled:!!t&&!!n})}function AY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,"/console/api-keys",a),{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok)throw new Error("Failed to create API key");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function kY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,`/console/api-keys/${Sa(i)}`,a),{method:"DELETE",headers:{Authorization:`Bearer ${t.token}`}});if(!l.ok)throw new Error("Failed to revoke API key");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function OY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,"/console/api-keys/bulk-revoke",a),{method:"POST",headers:{Authorization:`Bearer ${t.token}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!l.ok)throw new Error("Failed to bulk revoke API keys");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function MY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,`/console/api-keys/${Sa(i)}/rotate`,a),{method:"POST",headers:{Authorization:`Bearer ${t.token}`}});if(!l.ok)throw new Error("Failed to rotate API key");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function IY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async i=>{if(!e||!t)throw new Error("Not connected");const a=new URLSearchParams;n&&a.set("instanceId",n);const l=await fetch(Ln(t.serverUrl,`/console/api-keys/${Sa(i)}/rotate/stage`,a),{method:"POST",headers:{Authorization:`Bearer ${t.token}`}});if(!l.ok)throw new Error("Failed to stage-rotate API key");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","api-keys"]})}})}function PY(e={}){const{config:t}=Dt();return Wn({queryKey:Jn.storage({prefix:e.prefix,cursor:e.cursor,limit:e.limit}),queryFn:async()=>{if(!t)throw new Error("Not connected");const n=new URLSearchParams;e.prefix&&n.set("prefix",e.prefix),e.cursor&&n.set("cursor",e.cursor),e.limit&&n.set("limit",String(e.limit));const s=await fetch(Ln(t.serverUrl,"/console/storage",n),{method:"GET",headers:{Authorization:`Bearer ${t.token}`}});if(!s.ok)throw new Error("Failed to list blobs");return s.json()},enabled:!!t,refetchInterval:_i(e.refetchIntervalMs,3e4)})}function DY(){const{config:e}=Dt(),t=_r();return os({mutationFn:async n=>{if(!e)throw new Error("Not connected");const s=encodeURIComponent(n),i=await fetch(Ln(e.serverUrl,`/console/storage/${s}`,new URLSearchParams),{method:"DELETE",headers:{Authorization:`Bearer ${e.token}`}});if(!i.ok)throw new Error("Failed to delete blob");return i.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["console","storage"]})}})}function zY(){const{config:e}=Dt();return async t=>{if(!e)throw new Error("Not connected");const n=encodeURIComponent(t),s=await fetch(Ln(e.serverUrl,`/console/storage/${n}/download`,new URLSearchParams),{method:"GET",headers:{Authorization:`Bearer ${e.token}`}});if(!s.ok)throw new Error("Failed to download blob");const i=await s.blob(),a=URL.createObjectURL(i),l=document.createElement("a");l.href=a,l.download=t.split("/").pop()||t,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(a)}}const LY="console:partition-id";function sf(){const[e,t]=pi(LY,""),n=e.trim();return _.useMemo(()=>({partitionId:n.length>0?n:void 0,rawPartitionId:e,setPartitionId:t,clearPartitionId:()=>t("")}),[n,e,t])}const VC={refreshInterval:5,timeFormat:"relative",showSparklines:!0,pageSize:20};function of(){const[e,t]=pi("console:preferences",VC);return{preferences:e,setPreferences:t,updatePreference:(i,a)=>{t(l=>({...l,[i]:a}))},resetPreferences:()=>{t(VC)}}}const UY=[{value:5,label:"5 seconds"},{value:10,label:"10 seconds"},{value:30,label:"30 seconds"},{value:60,label:"1 minute"},{value:0,label:"Manual only"}],$Y=[{value:10,label:"10"},{value:20,label:"20"},{value:50,label:"50"},{value:100,label:"100"}],gx="syncular-console-root";function BY(e){e.classList.add(gx)}const FY=[{suffix:"",label:"Command"},{suffix:"/stream",label:"Stream"},{suffix:"/fleet",label:"Fleet"},{suffix:"/ops",label:"Ops"},{suffix:"/storage",label:"Storage"},{suffix:"/config",label:"Config"}];function HY(e){const t=e?.trim()??"";return!t||t==="/"?"":(t.startsWith("/")?t:`/${t}`).replace(/\/+$/g,"")}function Uy(e,t){return e?t?`${e}${t}`:e:t||"/"}function qY({basePath:e}){const{connect:t,config:n,isConnected:s,isConnecting:i}=Dt(),{preferences:a}=of(),{instanceId:l,rawInstanceId:f,setInstanceId:d,clearInstanceId:p}=Lt(),{partitionId:g,rawPartitionId:y,setPartitionId:b,clearPartitionId:x}=sf(),S=vr({select:N=>N.location.pathname}),{data:w}=rf({refetchIntervalMs:a.refreshInterval*1e3,partitionId:g,instanceId:l}),T=HY(e),C=_.useMemo(()=>FY.map(N=>({...N,id:Uy(T,N.suffix)})),[T]),O=Uy(T,""),j=Uy(T,"/config"),R=i?"connecting":s?"connected":n?"disconnected":"not-configured",I=C.find(N=>N.suffix===""?S===O||S===`${O}/`:S.startsWith(N.id))?.id??O,z=w?[{label:"HEAD",value:`#${w.maxCommitSeq}`},{label:"COMMITS",value:`${w.commitCount}`},{label:"CHANGES",value:`${w.changeCount}`},{label:"CLIENTS",value:`${w.activeClientCount}/${w.clientCount}`}]:[];return h.jsxs("div",{className:`${gx} h-screen bg-background text-foreground flex flex-col`,children:[h.jsx(xZ,{brand:h.jsx(bc,{to:O,children:h.jsx(bZ,{label:"console"})}),center:h.jsx(dZ,{items:C,activeId:I,renderItem:(N,{active:A})=>h.jsx(bc,{to:N.id,children:h.jsx(rk,{active:A,children:N.label})},N.id)}),right:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"font-mono text-[9px] text-neutral-500 uppercase tracking-wide",children:"Instance"}),h.jsx(Gn,{variant:"mono",value:f,onChange:N=>d(N.target.value),onBlur:N=>d(N.target.value.trim()),placeholder:"all",className:"h-7 w-[110px] px-2 py-1"}),l?h.jsx(Ne,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:p,children:"All"}):null]}),h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("span",{className:"font-mono text-[9px] text-neutral-500 uppercase tracking-wide",children:"Partition"}),h.jsx(Gn,{variant:"mono",value:y,onChange:N=>b(N.target.value),onBlur:N=>b(N.target.value.trim()),placeholder:"all",className:"h-7 w-[110px] px-2 py-1"}),g?h.jsx(Ne,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:x,children:"All"}):null]}),h.jsx(RV,{state:R}),h.jsx(bc,{to:j,children:h.jsx(Ne,{variant:S===j?"secondary":"ghost",size:"icon",children:h.jsx(hY,{})})})]})}),h.jsx("main",{className:"flex-1 overflow-auto pt-[42px] pb-[32px]",children:h.jsx("div",{className:"min-h-full",children:s||S===j?h.jsx("div",{style:{animation:"pageIn 0.3s ease-out"},children:h.jsx(YN,{})},S):h.jsx(VY,{configPath:j,hasSavedConfig:!!n,isConnecting:i,onConnect:()=>{t()}})})}),s&&h.jsx(Bj,{isLive:s,metrics:z,uptime:"--"})]})}function VY({configPath:e,hasSavedConfig:t,isConnecting:n,onConnect:s}){return h.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[h.jsx("p",{className:"mb-4 text-foreground-muted",children:"Not connected to a @syncular server"}),h.jsxs("div",{className:"flex items-center gap-2",children:[t&&h.jsx(Ne,{variant:"default",onClick:s,disabled:n,children:n?"Connecting...":"Connect"}),h.jsx(bc,{to:e,children:h.jsx(Ne,{variant:"link",children:"Configure connection"})})]})]})}const uo=NH({component:qY});function KY(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("swServer")==="1"}function GY(e={}){const{maxEvents:t=100,enabled:n=!0,staleAfterMs:s=65e3,replayLimit:i=100,partitionId:a,instanceId:l}=e,{config:f,isConnected:d}=Dt(),{instanceId:p}=Lt(),g=l??p,[y,b]=_.useState([]),[x,S]=_.useState(!1),[w,T]=_.useState("disconnected"),[C,O]=_.useState(null),j=_.useRef(null),R=_.useRef(null),I=_.useRef(null),z=_.useRef(0),N=_.useRef(0),A=_.useRef(null),D=_.useRef(null),Q=_.useCallback(()=>{b([]),A.current=null,D.current=null},[]);return _.useEffect(()=>{if(!n||!d||!f?.serverUrl||!f?.token)return;let B=!1;const U=Number.isFinite(i)?Math.max(1,Math.min(500,Math.floor(i))):100;if(KY()||typeof WebSocket>"u"){T("connecting"),S(!1);let V=null,L=!1;const M=async()=>{if(!(B||L)){L=!0;try{const H=new URL(f.serverUrl,window.location.origin),W=H.pathname.endsWith("/")?H.pathname.slice(0,-1):H.pathname;H.pathname=`${W}/console/events`,H.search="",H.searchParams.set("limit",String(U)),H.searchParams.set("offset","0"),a&&H.searchParams.set("partitionId",a);const Y=await fetch(H.toString(),{headers:{Authorization:`Bearer ${f.token}`}});if(!Y.ok)throw new Error(`Live event polling failed (${Y.status})`);const ae=await Y.json(),fe=(Array.isArray(ae.items)?ae.items:[]).filter(Me=>g?Me.instanceId===g:!0).sort((Me,_e)=>Me.eventId-_e.eventId),Se=D.current??-1,pe=fe.filter(Me=>Me.eventId>Se);if(pe.length>0){const Me=pe.map(re=>({type:re.eventType,timestamp:re.createdAt,data:re})).reverse();b(re=>[...Me,...re].slice(0,t));const _e=pe[pe.length-1];D.current=_e.eventId,A.current=_e.createdAt}else if(fe.length>0){const Me=fe[fe.length-1];D.current=Math.max(D.current??-1,Me.eventId),A.current=Me.createdAt}O(null),S(!0),T("connected")}catch(H){B||(S(!1),T("disconnected"),O(H instanceof Error?H:new Error("Live event polling failed")))}finally{L=!1}}};return M(),V=setInterval(()=>{M()},2e3),()=>{B=!0,V&&clearInterval(V),S(!1),T("disconnected")}}const K=()=>{R.current&&(clearTimeout(R.current),R.current=null)},ee=()=>{I.current&&(clearInterval(I.current),I.current=null)},P=()=>{if(B||R.current)return;z.current+=1;const V=Math.min(3e4,1e3*2**Math.max(0,z.current-1)),L=Math.floor(V*.2*Math.random()),M=V+L;R.current=setTimeout(()=>{R.current=null,B||q()},M)},G=()=>{N.current=Date.now(),S(!0),T("connected")},q=()=>{if(B)return;T("connecting"),K();const V=(()=>{const M=new URL(f.serverUrl,window.location.origin);M.protocol=M.protocol==="https:"?"wss:":"ws:";const H=M.pathname.endsWith("/")?M.pathname.slice(0,-1):M.pathname;return M.pathname=`${H}/console/events/live`,M.search="",M.searchParams.set("token",f.token),A.current&&M.searchParams.set("since",A.current),M.searchParams.set("replayLimit",String(U)),a&&M.searchParams.set("partitionId",a),g&&M.searchParams.set("instanceId",g),M.toString()})(),L=new WebSocket(V);j.current=L,L.onopen=()=>{if(B){L.close();return}z.current=0,G(),O(null),ee(),I.current=setInterval(()=>{const M=j.current;if(!M||M.readyState!==WebSocket.OPEN)return;const H=N.current;!H||Date.now()-H<=s||(S(!1),T("stale"),M.close())},1e3)},L.onclose=()=>{B||(S(!1),T("disconnected"),ee(),P())},L.onerror=()=>{B||O(new Error("WebSocket connection failed"))},L.onmessage=M=>{try{const H=JSON.parse(M.data),W=H.type;if(G(),W==="connected"||W==="heartbeat")return;const Y={type:W,timestamp:H.timestamp||new Date().toISOString(),data:H};if(a&&Y.data.partitionId!==a||g&&Y.data.instanceId!==g)return;const ae=Date.parse(A.current??""),se=Date.parse(Y.timestamp);Number.isFinite(se)&&(!Number.isFinite(ae)||se>ae)&&(A.current=Y.timestamp),b(fe=>[Y,...fe].slice(0,t))}catch{}}};return q(),()=>{B=!0,K(),ee(),j.current&&(j.current.close(),j.current=null),S(!1),T("disconnected")}},[n,d,f?.serverUrl,f?.token,t,a,g,i,s]),{events:y,isConnected:x,connectionState:w,error:C,clearEvents:Q}}function ZY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return os({mutationFn:async()=>{if(!e||!t)throw new Error("Not connected");const i=new URLSearchParams;n&&i.set("instanceId",n);const a=i.toString(),l=await fetch(`${t.serverUrl}/console/events${a?`?${a}`:""}`,{method:"DELETE",headers:{Authorization:`Bearer ${t.token}`}});if(!l.ok)throw new Error("Failed to clear events");return l.json()},onSuccess:()=>{s.invalidateQueries({queryKey:["console","events"]})}})}const YY=_.createContext(null);function pk(){const[e,t]=pi("console:time-range","24h");return{range:e,setRange:t}}const XY=[{hint:"ios",type:"mobile"},{hint:"android",type:"mobile"},{hint:"mobile",type:"mobile"},{hint:"tablet",type:"tablet"},{hint:"desktop",type:"desktop"},{hint:"mac",type:"desktop"},{hint:"windows",type:"desktop"},{hint:"linux",type:"desktop"},{hint:"browser",type:"browser"},{hint:"web",type:"browser"},{hint:"server",type:"server"},{hint:"api",type:"server"},{hint:"iot",type:"iot"},{hint:"sensor",type:"iot"}];function QY(e){const t=e.toLowerCase();for(const n of XY)if(t.includes(n.hint))return n.type;return"client"}function WY(e){const t=e.toLowerCase();return t.includes("pglite")?"PGlite":t.includes("sqlite")||t.includes("wa-sqlite")?"SQLite":t.includes("postgres")||t.includes("pg")?"PostgreSQL":"unknown"}function JY(e,t){return typeof e.lagCommitCount=="number"?Math.max(0,e.lagCommitCount):t?Math.max(0,t.maxCommitSeq-e.cursor):0}function eX(e,t){return e.activityState==="stale"?"offline":t>0?"syncing":"online"}function tX(e,t){return e.length<=16?e:`${e.slice(0,12)}-${t+1}`}function nX(e,t,n={}){const s=n.maxNodes??10;return e.slice(0,s).map((i,a)=>{const l=JY(i,t),f=eX(i,l);return{id:tX(i.clientId,a),type:QY(i.clientId),status:f,cursor:Math.max(0,i.cursor),actor:i.actorId,mode:i.connectionMode,dialect:WY(i.clientId),scopes:Object.keys(i.effectiveScopes||{}),lastSeen:i.updatedAt}})}const rX={enabled:!1,thresholds:{p90Latency:500,errorRate:5,clientLag:100}};function KC(e,t="relative"){if(t==="absolute")return new Date(e).toLocaleString();const n=new Date(e),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3);return a<60?`${a}s ago`:a<3600?`${Math.floor(a/60)}m ago`:a<86400?`${Math.floor(a/3600)}h ago`:`${Math.floor(a/86400)}d ago`}function sX(e){const t=e.length>1&&e.endsWith("/")?e.slice(0,-1):e;return t==="/console"||t.startsWith("/console/")?"/console/stream":"/stream"}function oX(){const e=dp(),t=_.useMemo(()=>typeof window>"u"?"/stream":sX(window.location.pathname),[]),n=pk(),{range:s}=n,{preferences:i}=of(),{partitionId:a}=sf(),l=i.refreshInterval*1e3,[f]=pi("console:alert-config",rX),[d,p]=_.useState("1h"),{data:g}=rf({refetchIntervalMs:l,partitionId:a}),{data:y}=mY({range:s,partitionId:a},{refetchIntervalMs:l}),{data:b}=gY({range:s,partitionId:a},{refetchIntervalMs:l}),{data:x}=yY({limit:5,partitionId:a},{refetchIntervalMs:l}),{data:S}=hk({limit:12,offset:0,partitionId:a},{refetchIntervalMs:l}),{events:w,isConnected:T}=GY({maxEvents:8,partitionId:a}),C=_.useMemo(()=>{const U=y?.buckets??[];let Z=0,K=0;for(const P of U)Z+=P.pushCount+P.pullCount,K+=P.errorCount;const ee=Z>0?K/Z*100:0;return{totalEvents:Z,errorRate:ee}},[y?.buckets]),O=_.useMemo(()=>S?.items?nX(S.items,g,{maxNodes:12}):[],[S?.items,g]),j=O.filter(U=>U.status!=="offline").length,R=O.filter(U=>U.status==="offline").length,I=_.useMemo(()=>g?[{label:"Ops (Range)",value:C.totalEvents,color:"flow"},{label:"P50 Latency",value:b?.push?.p50??0,unit:"ms",color:"healthy"},{label:"Error Rate",value:`${C.errorRate.toFixed(1)}%`,color:C.errorRate>0?"offline":"muted"},{label:"Active Clients",value:g.activeClientCount,color:"syncing"},{label:"Pending",value:g.maxActiveClientCursor!==null&&g.maxCommitSeq>0?g.maxCommitSeq-(g.minActiveClientCursor??0):0,color:"relay"}]:[],[g,b,C.errorRate,C.totalEvents]),z=_.useMemo(()=>w.map(U=>({type:U.type.toUpperCase(),actor:U.data?.actorId??"",table:(U.data?.tables??[])[0]??"",time:KC(U.timestamp,i.timeFormat)})),[w,i.timeFormat]),N=_.useMemo(()=>{const U=y?.buckets;if(!U?.length)return[];const Z=Math.max(...U.map(K=>Math.max(K.pushCount,K.pullCount)),1);return U.map(K=>({pushPercent:Z>0?K.pushCount/Z*100:0,pullPercent:Z>0?K.pullCount/Z*100:0}))},[y?.buckets]),A=_.useMemo(()=>{if(!b)return[];const U=Math.max(b.push.p50,b.push.p90,b.push.p99,b.pull.p50,b.pull.p90,b.pull.p99,1);return[{label:"P50",pushMs:b.push.p50,pullMs:b.pull.p50,pushBarPercent:b.push.p50/U*100,pullBarPercent:b.pull.p50/U*100},{label:"P90",pushMs:b.push.p90,pullMs:b.pull.p90,pushBarPercent:b.push.p90/U*100,pullBarPercent:b.pull.p90/U*100},{label:"P99",pushMs:b.push.p99,pullMs:b.pull.p99,pushBarPercent:b.push.p99/U*100,pullBarPercent:b.pull.p99/U*100}]},[b]),D=_.useMemo(()=>x?.items?x.items.map(U=>({seq:U.commitSeq,actor:U.actorId,changes:U.changeCount,tables:(U.affectedTables??[]).join(", "),time:KC(U.createdAt,i.timeFormat)})):[],[x?.items,i.timeFormat]),Q=_.useMemo(()=>Math.max(0,100-C.errorRate),[C.errorRate]),B=_.useMemo(()=>{if(!f.enabled||!g)return[];const U=[];return b?.push?.p90&&b.push.p90>f.thresholds.p90Latency&&U.push(`P90 push latency (${b.push.p90}ms) exceeds threshold (${f.thresholds.p90Latency}ms)`),g.minActiveClientCursor!==null&&g.maxCommitSeq-g.minActiveClientCursor>f.thresholds.clientLag&&U.push(`Client lag (${g.maxCommitSeq-g.minActiveClientCursor}) exceeds threshold (${f.thresholds.clientLag})`),C.errorRate>f.thresholds.errorRate&&U.push(`Error rate (${C.errorRate.toFixed(1)}%) exceeds threshold (${f.thresholds.errorRate}%)`),U},[f,g,b,C.errorRate]);return g?h.jsx(YY.Provider,{value:n,children:h.jsxs("div",{className:"flex flex-col",children:[B.length>0&&h.jsx("div",{className:"px-6 pb-4",children:h.jsxs(In,{variant:"destructive",children:[h.jsx(tf,{children:"Threshold Exceeded"}),h.jsx(Pn,{children:B.map((U,Z)=>h.jsx("span",{className:"block",children:U},Z))})]})}),h.jsx(zA,{clients:O,totalNodes:O.length+2,onlineCount:j,offlineCount:R,relayClientIds:[]}),h.jsx(Gj,{items:I}),h.jsxs("div",{className:"flex",children:[h.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[h.jsx("div",{className:"border-b border-border border-r border-border",children:h.jsx(Sj,{bars:N,activeRange:d,onRangeChange:p})}),h.jsx("div",{className:"border-b border-border border-r border-border",children:h.jsx(Zj,{buckets:A,successRate:Q})}),h.jsx("div",{className:"border-r border-border",children:h.jsx(Fj,{commits:D,onViewAll:()=>e({href:t})})})]}),h.jsx(Yj,{entries:z,isConnected:T,maxVisible:20,maxHeight:"calc(100vh - 200px)"})]})]})}):h.jsx("div",{className:"flex items-center justify-center py-24",children:h.jsx(Pt,{size:"lg"})})}function iX(){return h.jsx(oX,{})}function aX({children:e}){return h.jsxs("div",{className:"space-y-4 px-5 py-5",children:[h.jsx(cX,{}),h.jsx(hX,{}),h.jsx(pX,{}),e]})}function cX(){const{clearError:e,config:t,connect:n,disconnect:s,error:i,isConnected:a,isConnecting:l}=Dt(),[f,d]=_.useState(t?.serverUrl??"/api"),[p,g]=_.useState(t?.token??""),[y,b]=_.useState(null),[x,S]=_.useState(!1),[w,T]=_.useState(null),[C,O]=pi("console:disconnect-clear-saved-config",!1);_.useEffect(()=>{const N=new URLSearchParams(window.location.search),A=N.get("token"),D=N.get("server");A&&(g(A),window.history.replaceState({},"",window.location.pathname)),D&&d(D)},[]),_.useEffect(()=>{t?.serverUrl&&d(t.serverUrl),t?.token&&g(t.token)},[t?.serverUrl,t?.token]),_.useEffect(()=>{T(null)},[]);const j=async()=>{e(),b(null);const N=await n({serverUrl:f.trim(),token:p.trim()},{persistOverride:!0});T(N?"Connected successfully and configuration saved.":"Failed to connect with the provided settings.")},R=()=>{s({clearSavedConfig:C}),C&&(d("/api"),g("")),T(C?"Disconnected and saved credentials cleared.":"Disconnected."),b(null)},I=async()=>{S(!0),b(null),T(null);const N=performance.now();try{const A=f.trim(),D=p.trim();if(!A||!D)throw new Error("Missing server URL or token");if(!(await fetch(`${A}/console/stats`,{headers:{Authorization:`Bearer ${D}`}})).ok)throw new Error("Failed to connect");b(Math.round(performance.now()-N))}catch{b(-1)}finally{S(!1)}},z=i??w??(y!==null?y<0?"Connection failed":`Connection successful (${y}ms latency)`:void 0);return h.jsx(Hj,{isConnected:a,isConnecting:l,isTestingConnection:x,serverUrl:f,onServerUrlChange:d,consoleToken:p,onConsoleTokenChange:g,onSaveAndConnect:j,onDisconnect:R,onTestConnection:I,statusMessage:z,children:h.jsx("div",{className:"px-5 pb-5 -mt-2",children:h.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] text-neutral-400",children:"Clear saved credentials on disconnect"}),h.jsx("p",{className:"font-mono text-[9px] text-neutral-500",children:"Removes stored server URL and token from this browser."})]}),h.jsx(Sp,{checked:C,onCheckedChange:O})]})})})}const lX=1440*60*1e3;function GC(e){const t=e.trim();if(!t)return null;const n=Number.parseInt(t,10);return!Number.isInteger(n)||n<=0?null:n}function $y(e){if(!e)return"Never";const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():"Invalid date"}function uX(e){return e.length===0?"all scopes":e.length<=2?e.join(", "):`${e.slice(0,2).join(", ")} +${e.length-2}`}function fX(e,t){if(e.revokedAt)return"revoked";if(!e.expiresAt)return"active";const n=Date.parse(e.expiresAt);if(!Number.isFinite(n))return"active";const s=Date.now();return n<=s?"expired":n<=s+t*lX?"expiring":"active"}function dX(e){return e==="revoked"?"destructive":e==="expired"?"offline":e==="expiring"?"syncing":"healthy"}function hX(){const[e,t]=_.useState("all"),[n,s]=_.useState("all"),[i,a]=_.useState("14"),[l,f]=_.useState(!1),[d,p]=_.useState(!1),[g,y]=_.useState(""),[b,x]=_.useState("relay"),[S,w]=_.useState(""),[T,C]=_.useState(""),[O,j]=_.useState(""),[R,I]=_.useState(null),[z,N]=_.useState([]),[A,D]=_.useState(null),[Q,B]=_.useState(null),[U,Z]=_.useState(null),[K,ee]=_.useState(null),[P,G]=_.useState(null),[q,V]=_.useState(null),[L,M]=_.useState(null),H=_.useMemo(()=>GC(i),[i]),W=H??14,Y=_.useMemo(()=>GC(O),[O]),ae=O.trim().length>0,se=!ae||Y!==null,fe=_.useMemo(()=>({type:e==="all"?void 0:e,status:n==="all"?void 0:n,expiresWithinDays:n==="expiring"?W:void 0}),[e,n,W]),{data:Se,isLoading:pe,error:Me}=jY(fe),_e=AY(),re=OY(),he=kY(),ie=MY(),we=IY();_.useEffect(()=>{const me=new Set((Se?.items??[]).map(Te=>Te.keyId));N(Te=>Te.filter(qe=>me.has(qe)))},[Se?.items]);const ye=async()=>{try{const me=T.split(",").map(qe=>qe.trim()).filter(qe=>qe.length>0),Te=await _e.mutateAsync({name:g,keyType:b,actorId:S||void 0,scopeKeys:me.length>0?me:void 0,expiresInDays:ae?Y??void 0:void 0});I(Te.secretKey),y(""),w(""),C(""),j("")}catch{}},xe=me=>{navigator.clipboard.writeText(me),B(me),setTimeout(()=>B(null),2e3)},ve=async()=>{if(U)try{await he.mutateAsync(U)}finally{Z(null)}},Ie=async()=>{if(z.length!==0)try{const me=await re.mutateAsync({keyIds:z});D(me),N([])}catch{}},Ue=async()=>{if(K)try{const me=await we.mutateAsync(K.keyId);G({oldKeyId:K.keyId,oldKeyName:K.name,secretKey:me.secretKey})}catch{}},Ee=async()=>{if(P)try{await he.mutateAsync(P.oldKeyId)}finally{G(null),ee(null)}},Ve=async()=>{if(q)try{const me=await ie.mutateAsync(q);M(me.secretKey)}finally{V(null)}};if(pe)return h.jsx("div",{className:"flex h-[200px] items-center justify-center",children:h.jsx(Pt,{size:"lg"})});if(Me)return h.jsx("div",{className:"flex h-[200px] items-center justify-center",children:h.jsxs("p",{className:"text-danger",children:["Failed to load API keys: ",Me.message]})});const Qe=(Se?.items??[]).filter(me=>me.revokedAt===null).map(me=>me.keyId),Be=Qe.length>0&&Qe.every(me=>z.includes(me)),We=z.length>0,He=(Se?.items??[]).filter(me=>z.includes(me.keyId)).map(me=>me.name);return h.jsxs(h.Fragment,{children:[h.jsxs(Wb,{title:"API Keys",description:"Issue, rotate, revoke, and audit key lifecycle state.",actions:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(Ne,{size:"sm",variant:"destructive",onClick:()=>p(!0),disabled:z.length===0,children:["Revoke Selected (",z.length,")"]}),h.jsx(Ne,{size:"sm",onClick:()=>f(!0),children:"Create Key"})]}),children:[h.jsxs("div",{className:"mb-4 grid gap-3 lg:grid-cols-3",children:[h.jsxs(ps,{children:[h.jsx(es,{children:"Type filter"}),h.jsxs(dh,{value:[e],multiple:!1,onValueChange:me=>{const Te=me.find(qe=>typeof qe=="string");(Te==="all"||Te==="relay"||Te==="proxy"||Te==="admin")&&t(Te)},children:[h.jsx(Dr,{value:"all",children:"all"}),h.jsx(Dr,{value:"relay",children:"relay"}),h.jsx(Dr,{value:"proxy",children:"proxy"}),h.jsx(Dr,{value:"admin",children:"admin"})]})]}),h.jsxs(ps,{children:[h.jsx(es,{children:"Status filter"}),h.jsxs(dh,{value:[n],multiple:!1,onValueChange:me=>{const Te=me.find(qe=>typeof qe=="string");(Te==="all"||Te==="active"||Te==="revoked"||Te==="expiring")&&s(Te)},children:[h.jsx(Dr,{value:"all",children:"all"}),h.jsx(Dr,{value:"active",children:"active"}),h.jsx(Dr,{value:"revoked",children:"revoked"}),h.jsx(Dr,{value:"expiring",children:"expiring"})]})]}),h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-expiring-window",children:"Expiring window (days)"}),h.jsx(pc,{children:"Used when status filter is set to expiring."}),h.jsx(Gn,{id:"api-key-expiring-window",placeholder:"14",value:i,inputMode:"numeric",onChange:me=>a(me.target.value)}),H===null&&i.trim().length>0?h.jsx("p",{className:"font-mono text-[10px] text-offline",children:"Enter a positive whole number."}):null]})]}),Se?.items.length===0?h.jsx(Qb,{message:"No API keys match the current filters."}):h.jsxs(Zu,{children:[h.jsx(Yu,{children:h.jsxs(io,{children:[h.jsx(yt,{children:h.jsx(Uv,{checked:Be,indeterminate:!Be&&We&&Qe.length>0,onCheckedChange:me=>{N(me?Qe:[])},"aria-label":"Select all active keys"})}),h.jsx(yt,{children:"NAME"}),h.jsx(yt,{children:"TYPE"}),h.jsx(yt,{children:"KEY PREFIX"}),h.jsx(yt,{children:"ACTOR"}),h.jsx(yt,{children:"SCOPES"}),h.jsx(yt,{children:"CREATED"}),h.jsx(yt,{children:"LAST USED"}),h.jsx(yt,{children:"EXPIRES"}),h.jsx(yt,{children:"STATUS"}),h.jsx(yt,{children:"ACTIONS"})]})}),h.jsx(Xu,{children:(Se?.items??[]).map(me=>{const Te=fX(me,W);return h.jsxs(io,{children:[h.jsx(vt,{children:h.jsx(Uv,{checked:z.includes(me.keyId),onCheckedChange:qe=>{N(ht=>qe?[...new Set([...ht,me.keyId])]:ht.filter(lt=>lt!==me.keyId))},"aria-label":`Select ${me.name}`,disabled:me.revokedAt!==null})}),h.jsx(vt,{className:"font-medium",children:me.name}),h.jsx(vt,{children:h.jsx(xn,{variant:me.keyType==="admin"?"flow":me.keyType==="proxy"?"ghost":"relay",children:me.keyType})}),h.jsx(vt,{children:h.jsxs("code",{className:"font-mono text-[11px]",children:[me.keyPrefix,"..."]})}),h.jsx(vt,{className:"text-neutral-500",children:me.actorId??"-"}),h.jsx(vt,{className:"max-w-[220px] text-neutral-500",children:h.jsx("code",{className:"font-mono text-[10px]",children:uX(me.scopeKeys)})}),h.jsx(vt,{className:"text-neutral-500",children:$y(me.createdAt)}),h.jsx(vt,{className:"text-neutral-500",children:$y(me.lastUsedAt)}),h.jsx(vt,{className:"text-neutral-500",children:$y(me.expiresAt)}),h.jsx(vt,{children:h.jsx(xn,{variant:dX(Te),children:Te})}),h.jsx(vt,{children:h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>ee(me),disabled:me.revokedAt!==null,children:"Stage"}),h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>V(me.keyId),disabled:me.revokedAt!==null,children:"Rotate"}),h.jsx(Ne,{variant:"destructive",size:"sm",onClick:()=>Z(me.keyId),disabled:me.revokedAt!==null,children:"Revoke"})]})})]},me.keyId)})})]})]}),h.jsx($r,{open:l,onOpenChange:f,children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Create API Key"})}),R?h.jsx(ZC,{copiedKeyId:Q,onClose:()=>{I(null),f(!1)},onCopy:xe,secretKey:R,warning:"Copy this key now. You will not be able to view it again."}):h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-name",children:"Name"}),h.jsx(Gn,{id:"api-key-name",placeholder:"Backend Relay Key",value:g,onChange:me=>y(me.target.value)})]}),h.jsxs(ps,{children:[h.jsx(es,{children:"Key type"}),h.jsxs(dh,{value:[b],multiple:!1,onValueChange:me=>{const Te=me.find(qe=>typeof qe=="string");(Te==="relay"||Te==="proxy"||Te==="admin")&&x(Te)},children:[h.jsx(Dr,{value:"relay",children:"relay"}),h.jsx(Dr,{value:"proxy",children:"proxy"}),h.jsx(Dr,{value:"admin",children:"admin"})]})]}),h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-actor-id",children:"Actor ID (optional)"}),h.jsx(pc,{children:"Pin this key to a fixed actor ID"}),h.jsx(Gn,{id:"api-key-actor-id",placeholder:"actor-123",value:S,onChange:me=>w(me.target.value)})]}),h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-scope-keys",children:"Scope keys (optional)"}),h.jsx(pc,{children:"Comma-separated list of allowed scope keys"}),h.jsx(Gn,{id:"api-key-scope-keys",placeholder:"scope-a, scope-b",value:T,onChange:me=>C(me.target.value)})]}),h.jsxs(ps,{children:[h.jsx(es,{htmlFor:"api-key-expires-days",children:"Expires in days (optional)"}),h.jsx(pc,{children:"Leave empty to keep the key non-expiring."}),h.jsx(Gn,{id:"api-key-expires-days",placeholder:"30",value:O,inputMode:"numeric",onChange:me=>j(me.target.value)}),se?null:h.jsx("p",{className:"font-mono text-[10px] text-offline",children:"Enter a positive whole number."})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>f(!1),children:"Cancel"}),h.jsx(Ne,{variant:"primary",onClick:ye,disabled:_e.isPending||!g||!se,children:_e.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Creating..."]}):"Create"})]})]})]})}),h.jsx($r,{open:d,onOpenChange:me=>{p(me),me||D(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Bulk Revoke API Keys"})}),A?h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-3",children:[h.jsx(In,{variant:"destructive",children:h.jsxs(Pn,{children:["Requested ",A.requestedCount," keys. Revoked"," ",A.revokedCount,", already revoked"," ",A.alreadyRevokedCount,", not found"," ",A.notFoundCount,"."]})}),h.jsx(Nn,{children:h.jsx(Ne,{variant:"primary",onClick:()=>{p(!1),D(null)},children:"Done"})})]}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-3",children:[h.jsx(In,{variant:"destructive",children:h.jsx(Pn,{children:"This revokes selected keys immediately and cannot be undone."})}),h.jsxs("p",{className:"font-mono text-[10px] text-neutral-500",children:["Selected keys: ",He.slice(0,5).join(", "),He.length>5?` +${He.length-5} more`:""]})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>p(!1),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",onClick:Ie,disabled:re.isPending||z.length===0,children:re.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking..."]}):"Revoke Selected"})]})]})]})}),h.jsx($r,{open:K!==null||P!==null,onOpenChange:()=>{ee(null),G(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Stage Rotate API Key"})}),P?h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsx(In,{variant:"default",children:h.jsxs(Pn,{children:["Replacement key created for ",P.oldKeyName,". The old key is still active until you revoke it."]})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"flex-1 rounded-md border border-border bg-surface p-3 font-mono text-[11px] text-white break-all",children:P.secretKey}),h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>xe(P.secretKey),children:Q===P.secretKey?"Copied":"Copy"})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>{G(null),ee(null)},children:"Keep Old Key Active"}),h.jsx(Ne,{variant:"destructive",onClick:Ee,disabled:he.isPending,children:he.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking Old Key..."]}):"Finalize and Revoke Old Key"})]})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"px-5 py-4",children:h.jsx("p",{className:"font-mono text-[10px] text-neutral-500",children:"Staged rotation creates a replacement key now and keeps the current key active until you explicitly revoke it."})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>ee(null),children:"Cancel"}),h.jsx(Ne,{variant:"primary",onClick:Ue,disabled:we.isPending||!K,children:we.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Staging..."]}):"Create Replacement Key"})]})]})]})}),h.jsx($r,{open:U!==null,onOpenChange:()=>Z(null),children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Revoke API Key"})}),h.jsx("div",{className:"px-5 py-4",children:h.jsx(In,{variant:"destructive",children:h.jsx(Pn,{children:"Revoking a key immediately invalidates it for all requests."})})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>Z(null),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",onClick:ve,disabled:he.isPending,children:he.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking..."]}):"Revoke"})]})]})}),h.jsx($r,{open:q!==null||L!==null,onOpenChange:()=>{V(null),M(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Rotate API Key"})}),L?h.jsx(ZC,{copiedKeyId:Q,onClose:()=>M(null),onCopy:xe,secretKey:L,warning:"The previous key has been invalidated. Store this replacement securely."}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"px-5 py-4",children:h.jsx("p",{className:"font-mono text-[10px] text-neutral-500",children:"Rotating a key invalidates the previous secret immediately."})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>V(null),children:"Cancel"}),h.jsx(Ne,{variant:"primary",onClick:Ve,disabled:ie.isPending,children:ie.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Rotating..."]}):"Rotate"})]})]})]})})]})}function pX(){const{preferences:e,updatePreference:t,resetPreferences:n}=of(),s=[{type:"filter",label:"Auto-refresh interval",options:UY.map(i=>({id:`${i.value}`,label:i.label})),activeId:`${e.refreshInterval}`,onActiveChange:i=>t("refreshInterval",Number.parseInt(i,10))},{type:"filter",label:"Items per page",options:$Y.map(i=>({id:`${i.value}`,label:i.label})),activeId:`${e.pageSize}`,onActiveChange:i=>t("pageSize",Number.parseInt(i,10))},{type:"filter",label:"Time format",options:[{id:"relative",label:"Relative"},{id:"absolute",label:"Absolute"}],activeId:e.timeFormat,onActiveChange:i=>t("timeFormat",i)},{type:"toggle",label:"Show sparklines",description:"Display mini trend charts in dashboard metric cards",checked:e.showSparklines,onCheckedChange:i=>t("showSparklines",i)}];return h.jsx(Xj,{rows:s,onResetDefaults:n})}function ZC({copiedKeyId:e,onClose:t,onCopy:n,secretKey:s,warning:i}){return h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsx(In,{variant:"destructive",children:h.jsx(Pn,{children:i})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"flex-1 rounded-md border border-border bg-surface p-3 font-mono text-[11px] text-white break-all",children:s}),h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>n(s),children:e===s?"Copied":"Copy"})]}),h.jsx(Nn,{children:h.jsx(Ne,{variant:"primary",onClick:t,children:"Done"})})]})}function mX(e){const t=e.toLowerCase();return t.includes("mobile")||t.includes("ios")||t.includes("android")?"mobile":t.includes("tablet")?"tablet":t.includes("desktop")||t.includes("laptop")?"desktop":t.includes("edge")?"edge":t.includes("iot")?"iot":"desktop"}function gX(e){const t=e.toLowerCase();return t.includes("pglite")?"PGlite":t.includes("wa-sqlite")||t.includes("sqlite")?"SQLite":t.includes("postgres")||t.includes("pg")?"PostgreSQL":"unknown"}function yX(e,t){if(t==="absolute")return new Date(e).toLocaleString();try{const n=new Date(e),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),l=Math.floor(a/60),f=Math.floor(l/60),d=Math.floor(f/24);return a<60?"just now":l<60?`${l}m ago`:f<24?`${f}h ago`:`${d}d ago`}catch{return e}}function vX(e,t,n){return{id:e.clientId,type:mX(e.clientId),status:e.activityState==="stale"?"offline":e.activityState==="idle"?"syncing":"online",cursor:e.cursor,actor:e.actorId,mode:e.connectionMode==="realtime"?"realtime":"polling",dialect:gX(e.clientId),scopes:Object.keys(e.effectiveScopes??{}),lastSeen:yX(e.updatedAt,n)}}function bX({emptyState:e}={}){const[t,n]=_.useState(1),[s,i]=_.useState(null),{preferences:a}=of(),{partitionId:l}=sf(),f=a.pageSize,d=a.refreshInterval*1e3,{data:p,isLoading:g}=rf({refetchIntervalMs:d,partitionId:l}),{data:y,isLoading:b,error:x}=hk({limit:f,offset:(t-1)*f,partitionId:l},{refetchIntervalMs:d}),S=TY(),w=Math.ceil((y?.total??0)/f),T=p?.maxCommitSeq??0;_.useEffect(()=>{n(1)},[]);const C=async()=>{if(s)try{await S.mutateAsync({clientId:s,partitionId:l})}finally{i(null)}};if(b||g)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})});if(x)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsxs("p",{className:"text-danger",children:["Failed to load clients: ",x.message]})});const O=(y?.items??[]).map(j=>vX(j,T,a.timeFormat));return h.jsxs("div",{className:"flex flex-col gap-5 px-5 py-5",children:[O.length>0&&h.jsx(Wj,{clients:O,headSeq:T}),O.length===0?e??h.jsx(FV,{children:h.jsx(Qb,{message:"No clients yet"})}):h.jsx(Vj,{clients:O,headSeq:T,onEvict:j=>{const R=y?.items.find(I=>I.clientId===j);i(R?.clientId??j)}}),w>1&&h.jsx(px,{page:t,totalPages:w,totalItems:y?.total??0,onPageChange:n}),h.jsx($r,{open:s!==null,onOpenChange:()=>i(null),children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Evict Client"})}),h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsxs("p",{className:"font-mono text-[11px] text-neutral-300",children:["Are you sure you want to evict client"," ",h.jsxs("span",{className:"font-mono text-white",children:[s?.slice(0,12),"..."]}),"?"]}),h.jsx("p",{className:"font-mono text-[10px] text-neutral-500",children:"This will force the client to re-bootstrap on their next sync."})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>i(null),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",onClick:C,disabled:S.isPending,children:S.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Evicting..."]}):"Evict"})]})]})})]})}const xX={latencyThresholdMs:1e3,errorRateThreshold:5,clientLagThreshold:50,enabled:!1};function SX(e){return e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:e<36e5?`${Math.round(e/6e4)}m`:`${Math.round(e/36e5)}h`}function _X(e){const t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);return Array.from(new Set(t))}function wX(e){switch(e){case"notify_data_change":return"Notify";case"evict_client":return"Evict";case"compact":return"Compact";default:return"Prune"}}function YC(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function EX(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function TX(e){const t=YC(e.requestPayload),n=YC(e.resultPayload);if(e.operationType==="notify_data_change"){const a=EX(t?.tables),l=n?.commitSeq;return`${a.length} table${a.length===1?"":"s"} -> commit #${typeof l=="number"?l:"?"}`}if(e.operationType==="evict_client"){const a=n?.evicted===!0?"evicted":"not found";return`client ${e.targetClientId??"?"} ${a}`}if(e.operationType==="compact")return`${typeof n?.deletedChanges=="number"?n.deletedChanges:0} changes removed`;const s=typeof n?.deletedCommits=="number"?n.deletedCommits:0,i=typeof t?.watermarkCommitSeq=="number"?` at #${t.watermarkCommitSeq}`:"";return`${s} commits removed${i}`}function CX(e){const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function RX(){const{partitionId:e}=sf();return h.jsxs("div",{className:"flex flex-col gap-4 px-5 py-5",children:[h.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[h.jsx(NX,{}),h.jsx(MX,{})]}),h.jsxs("div",{className:"grid gap-4 xl:grid-cols-3",children:[h.jsx(jX,{partitionId:e}),h.jsx(AX,{partitionId:e}),h.jsx(kX,{partitionId:e})]}),h.jsx(OX,{partitionId:e})]})}function NX(){const{data:e,isLoading:t,error:n}=_Y();if(t)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})});if(n)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsxs("p",{className:"text-danger",children:["Failed to load handlers: ",n.message]})});const s=(e?.items??[]).map(i=>({table:i.table,dependsOn:i.dependsOn?.join(", ")??null,chunkTtl:i.snapshotChunkTtlMs?SX(i.snapshotChunkTtlMs):"default"}));return h.jsx(Kj,{handlers:s,tableCount:e?.items.length??0})}function jX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState(null),{data:a,isLoading:l}=rf({partitionId:e}),{data:f,isLoading:d,refetch:p}=wY({enabled:!1}),g=CY(),y=async()=>{n(!0),i(null),await p()},b=async()=>{const S=await g.mutateAsync();i(S.deletedCommits)};if(l)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})});const x=[{label:"Total commits",value:a?.commitCount??0},{label:"Commit range",value:`${a?.minCommitSeq??0} - ${a?.maxCommitSeq??0}`},{label:"Min active cursor",value:a?.minActiveClientCursor??"N/A",tone:"syncing"}];return h.jsxs(h.Fragment,{children:[h.jsx(_p,{title:"Prune",description:"Delete commits that all clients have already synced. Pruning removes commits older than the oldest active client cursor.",dotColor:"syncing",stats:x,actionLabel:"Preview Prune",actionVariant:"destructive",onAction:y}),h.jsx($r,{open:t,onOpenChange:n,children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Prune Old Commits"})}),h.jsx("div",{className:"px-5 py-4 flex flex-col gap-4",children:s!==null?h.jsxs(In,{variant:"default",children:[h.jsx(tf,{children:"Pruning Complete"}),h.jsxs(Pn,{children:["Successfully deleted ",h.jsx("strong",{children:s})," commits."]})]}):d?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx(Pt,{size:"sm"})}):f?h.jsxs(h.Fragment,{children:[h.jsx(In,{variant:f.commitsToDelete>0?"destructive":"default",children:h.jsx(Pn,{children:f.commitsToDelete>0?h.jsxs(h.Fragment,{children:["This will delete"," ",h.jsx("strong",{children:f.commitsToDelete})," commits up to sequence"," ",h.jsxs("code",{className:"font-mono",children:["#",f.watermarkCommitSeq]}),"."]}):"No commits are eligible for pruning."})}),h.jsxs("div",{className:"flex flex-col gap-2",children:[h.jsxs("div",{className:"flex justify-between font-mono text-[11px]",children:[h.jsx("span",{className:"text-neutral-500",children:"Watermark commit seq:"}),h.jsxs("span",{className:"text-white",children:["#",f.watermarkCommitSeq]})]}),h.jsxs("div",{className:"flex justify-between font-mono text-[11px] items-center",children:[h.jsx("span",{className:"text-neutral-500",children:"Commits to delete:"}),h.jsx(xn,{variant:f.commitsToDelete>0?"offline":"ghost",children:f.commitsToDelete})]})]})]}):null}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>n(!1),children:s!==null?"Close":"Cancel"}),s===null&&h.jsx(Ne,{variant:"destructive",onClick:b,disabled:g.isPending||d||(f?.commitsToDelete??0)===0,children:g.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Pruning..."]}):"Prune Now"})]})]})})]})}function AX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState(null),{data:a,isLoading:l}=rf({partitionId:e}),f=RY(),d=()=>{n(!0),i(null)},p=async()=>{const y=await f.mutateAsync();i(y.deletedChanges)};if(l)return h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})});const g=[{label:"Total changes",value:a?.changeCount??0},{label:"Total commits",value:a?.commitCount??0}];return h.jsxs(h.Fragment,{children:[h.jsx(_p,{title:"Compact",description:"Merge old changes to reduce storage space. Compaction merges multiple changes to the same row into a single change.",dotColor:"flow",stats:g,actionLabel:"Run Compaction",actionVariant:"primary",onAction:d}),h.jsx($r,{open:t,onOpenChange:n,children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Compact Changes"})}),h.jsx("div",{className:"px-5 py-4 flex flex-col gap-4",children:s!==null?h.jsxs(In,{variant:"default",children:[h.jsx(tf,{children:"Compaction Complete"}),h.jsxs(Pn,{children:["Successfully removed ",h.jsx("strong",{children:s})," redundant changes."]})]}):h.jsx(In,{variant:"default",children:h.jsx(Pn,{children:"Compaction will merge multiple changes to the same row, keeping only the most recent version. This is safe and can be run at any time."})})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>n(!1),children:s!==null?"Close":"Cancel"}),s===null&&h.jsx(Ne,{variant:"primary",onClick:p,disabled:f.isPending,children:f.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Compacting..."]}):"Compact Now"})]})]})})]})}function kX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState("tasks"),[a,l]=_.useState(e??""),[f,d]=_.useState(null),[p,g]=_.useState(null),y=NY(),b=_X(s),x=[{label:"Next tables",value:b.length,tone:"syncing"},{label:"Last commit seq",value:f?`#${f.commitSeq}`:"—",tone:"syncing"},{label:"Last chunks cleared",value:f?.deletedChunks??"—"}],S=()=>{n(!0),g(null)},w=async()=>{if(b.length===0){g("Provide at least one table name.");return}g(null);const T=await y.mutateAsync({tables:b,partitionId:a.trim()||void 0});d(T)};return h.jsxs(h.Fragment,{children:[h.jsx(_p,{title:"Notify Data Change",description:"Create a synthetic commit after external imports or direct DB writes so clients re-bootstrap for affected tables.",dotColor:"healthy",stats:x,actionLabel:"Notify Clients",actionVariant:"primary",onAction:S}),h.jsx($r,{open:t,onOpenChange:n,children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Notify External Data Change"})}),h.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[f?h.jsxs(In,{variant:"default",children:[h.jsx(tf,{children:"Notification Sent"}),h.jsxs(Pn,{children:["Created synthetic commit"," ",h.jsxs("strong",{children:["#",f.commitSeq]})," for"," ",h.jsx("strong",{children:f.tables.length})," table",f.tables.length===1?"":"s"," and cleared"," ",h.jsx("strong",{children:f.deletedChunks})," cached chunk",f.deletedChunks===1?"":"s","."]})]}):h.jsx(In,{variant:"default",children:h.jsx(Pn,{children:"Use this when data changed outside Syncular push flow. It invalidates cached snapshot chunks and forces clients to pull fresh data."})}),p?h.jsx(In,{variant:"destructive",children:h.jsx(Pn,{children:p})}):null,h.jsxs(ps,{children:[h.jsx(es,{children:"Tables (comma-separated)"}),h.jsx(Gn,{value:s,onChange:T=>i(T.target.value),placeholder:"tasks, notes",disabled:y.isPending}),h.jsx(pc,{children:"Enter one or more table names affected by the external change."})]}),h.jsxs(ps,{children:[h.jsx(es,{children:"Partition ID (optional)"}),h.jsx(Gn,{value:a,onChange:T=>l(T.target.value),placeholder:"default",disabled:y.isPending})]})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>n(!1),children:f?"Close":"Cancel"}),f?null:h.jsx(Ne,{variant:"primary",onClick:w,disabled:y.isPending,children:y.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Notifying..."]}):"Notify Data Change"})]})]})})]})}function OX({partitionId:e}){const[t,n]=_.useState("all"),{data:s,isLoading:i,error:a}=EY({limit:20,offset:0,operationType:t==="all"?void 0:t,partitionId:e},{refetchIntervalMs:5e3});return h.jsx(Wb,{title:"Operation Audit",description:"Recent prune/compact/notify/evict actions with actor and result context.",actions:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Ne,{variant:t==="all"?"default":"ghost",size:"sm",onClick:()=>n("all"),children:"All"}),h.jsx(Ne,{variant:t==="prune"?"default":"ghost",size:"sm",onClick:()=>n("prune"),children:"Prune"}),h.jsx(Ne,{variant:t==="compact"?"default":"ghost",size:"sm",onClick:()=>n("compact"),children:"Compact"}),h.jsx(Ne,{variant:t==="notify_data_change"?"default":"ghost",size:"sm",onClick:()=>n("notify_data_change"),children:"Notify"}),h.jsx(Ne,{variant:t==="evict_client"?"default":"ghost",size:"sm",onClick:()=>n("evict_client"),children:"Evict"})]}),contentClassName:"pt-2",children:i?h.jsx("div",{className:"flex items-center justify-center py-10",children:h.jsx(Pt,{size:"lg"})}):a?h.jsx(In,{variant:"destructive",children:h.jsxs(Pn,{children:["Failed to load operation audit events: ",a.message]})}):(s?.items.length??0)===0?h.jsx("div",{className:"px-2 py-8 text-sm text-neutral-500",children:"No operation events found for this filter."}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs(Zu,{children:[h.jsx(Yu,{children:h.jsxs(io,{children:[h.jsx(yt,{children:"Time"}),h.jsx(yt,{children:"Type"}),h.jsx(yt,{children:"User"}),h.jsx(yt,{children:"Target"}),h.jsx(yt,{children:"Result"})]})}),h.jsx(Xu,{children:(s?.items??[]).map((l,f)=>h.jsxs(io,{children:[h.jsx(vt,{className:"whitespace-nowrap text-xs text-neutral-400",children:CX(l.createdAt)}),h.jsx(vt,{children:h.jsx(xn,{variant:"ghost",children:wX(l.operationType)})}),h.jsx(vt,{className:"font-mono text-xs",children:l.consoleUserId??"system"}),h.jsx(vt,{className:"font-mono text-xs",children:l.targetClientId??l.partitionId??(l.operationType==="notify_data_change"?"partition default":"global")}),h.jsx(vt,{className:"font-mono text-xs text-neutral-300",children:TX(l)})]},`${l.operationId}:${l.createdAt}:${f}`))})]})})})}function MX(){const[e,t]=pi("console:alert-config",xX),n={p90Latency:e.latencyThresholdMs,errorRate:e.errorRateThreshold,clientLag:e.clientLagThreshold},s=a=>{t(l=>({...l,latencyThresholdMs:a.p90Latency,errorRateThreshold:a.errorRate,clientLagThreshold:a.clientLag}))},i=a=>{t(l=>({...l,enabled:a}))};return h.jsx($j,{enabled:e.enabled,onEnabledChange:i,thresholds:n,onThresholdsChange:s})}function IX(e){if(e===0)return"0 B";const t=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(e)/Math.log(1024));return`${(e/1024**n).toFixed(n===0?0:1)} ${t[n]}`}function PX(e){const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function DX(){const[e,t]=_.useState(""),[n,s]=_.useState(void 0),[i,a]=_.useState(void 0),[l,f]=_.useState([]),[d,p]=_.useState(null),{data:g,isLoading:y,error:b}=PY({prefix:n,cursor:i,limit:100}),x=DY(),S=zY();function w(){const I=e.trim();s(I.length>0?I:void 0),a(void 0),f([])}function T(){t(""),s(void 0),a(void 0),f([])}function C(){g?.cursor&&(f(I=>[...I,i??""]),a(g.cursor))}function O(){f(I=>{const z=[...I],N=z.pop();return a(N&&N.length>0?N:void 0),z})}function j(){d&&x.mutate(d,{onSuccess:()=>p(null)})}if(y)return h.jsx("div",{className:"flex flex-col gap-4 px-5 py-5",children:h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsx(Pt,{size:"lg"})})});if(b)return h.jsx("div",{className:"flex flex-col gap-4 px-5 py-5",children:h.jsx("div",{className:"flex items-center justify-center h-[200px]",children:h.jsxs("p",{className:"text-danger font-mono text-[11px]",children:["Failed to load storage items: ",b.message]})})});const R=g?.items??[];return h.jsxs("div",{className:"flex flex-col gap-4 px-5 py-5",children:[h.jsx(Wb,{title:"Storage",actions:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Gn,{placeholder:"Prefix filter...",value:e,onChange:I=>t(I.target.value),onKeyDown:I=>{I.key==="Enter"&&w()},className:"h-7 w-48 text-xs"}),h.jsx(Ne,{variant:"default",size:"sm",onClick:w,children:"Filter"}),n&&h.jsx(Ne,{variant:"ghost",size:"sm",onClick:T,children:"Clear"})]}),children:R.length===0?h.jsx(Qb,{message:n?`No storage items matching prefix "${n}".`:"No storage items found."}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"overflow-x-auto",children:h.jsxs(Zu,{children:[h.jsx(Yu,{children:h.jsxs(io,{children:[h.jsx(yt,{children:"Key"}),h.jsx(yt,{children:"Size"}),h.jsx(yt,{children:"Type"}),h.jsx(yt,{children:"Uploaded"}),h.jsx(yt,{children:"Actions"})]})}),h.jsx(Xu,{children:R.map(I=>h.jsxs(io,{children:[h.jsx(vt,{className:"font-mono text-xs max-w-[320px]",title:I.key,children:I.key}),h.jsx(vt,{className:"font-mono text-xs text-neutral-400 whitespace-nowrap",children:IX(I.size)}),h.jsx(vt,{children:I.httpMetadata?.contentType?h.jsx(xn,{variant:"ghost",children:I.httpMetadata.contentType}):h.jsx("span",{className:"text-neutral-500 text-xs",children:"--"})}),h.jsx(vt,{className:"whitespace-nowrap text-xs text-neutral-400",children:PX(I.uploaded)}),h.jsx(vt,{children:h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(Ne,{variant:"ghost",size:"sm",onClick:()=>{S(I.key)},children:"Download"}),h.jsx(Ne,{variant:"ghost",size:"sm",onClick:()=>p(I.key),children:"Delete"})]})})]},I.key))})]})}),h.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[h.jsx(Ne,{variant:"ghost",size:"sm",disabled:l.length===0,onClick:O,children:"Previous"}),h.jsx(Ne,{variant:"ghost",size:"sm",disabled:!g?.truncated,onClick:C,children:"Next"})]})]})}),h.jsx($r,{open:d!==null,onOpenChange:()=>p(null),children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Delete Storage Item"})}),h.jsxs("div",{className:"px-5 py-4 flex flex-col gap-4",children:[h.jsxs("p",{className:"font-mono text-[11px] text-neutral-300",children:["Are you sure you want to delete"," ",h.jsx("span",{className:"font-mono text-white",children:d}),"?"]}),h.jsx("p",{className:"font-mono text-[10px] text-neutral-500",children:"This action cannot be undone."})]}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",onClick:()=>p(null),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",onClick:j,disabled:x.isPending,children:x.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"})," Deleting..."]}):"Delete"})]})]})})]})}const zX={};function su(e,t){if(t==="absolute")return new Date(e).toLocaleString();const n=new Date(e),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3);return a<60?`${a}s`:a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function LX(e){const t=e.split(/\s+/).map(i=>i.trim()).filter(i=>i.length>0),n={},s=[];for(const i of t){const[a="",...l]=i.split(":"),f=l.join(":").trim(),d=a.toLowerCase();if(!f){s.push(i);continue}if(d==="actor"){n.actorId=f;continue}if(d==="client"){n.clientId=f;continue}if(d==="table"){n.table=f;continue}if(d==="request"){n.requestId=f;continue}if(d==="trace"){n.traceId=f;continue}s.push(i)}return s.length>0&&(n.search=s.join(" ")),n}function UX(e){return e==="1h"?3600*1e3:e==="6h"?360*60*1e3:e==="24h"?1440*60*1e3:e==="7d"?10080*60*1e3:720*60*60*1e3}function Gd(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function $X(e,t){return e?`#${e.federatedCommitId??(t?`${t}:${e.commitSeq}`:String(e.commitSeq))}`:"#?"}function BX(e,t){return e?`E${e.federatedEventId??(t?`${t}:${e.eventId}`:e.eventId)}`:"E?"}function FX(e,t,n){return!e||!t?null:e.replaceAll("{traceId}",encodeURIComponent(t)).replaceAll("{spanId}",encodeURIComponent(n??""))}function yx({initialSelectedEntryId:e}={}){const{preferences:t}=of(),{partitionId:n}=sf(),{range:s,setRange:i}=pk(),a=t.pageSize,l=t.refreshInterval*1e3,f=zX?.VITE_CONSOLE_TRACE_URL_TEMPLATE,[d,p]=_.useState(()=>e?.startsWith("#")?"commits":e?.startsWith("E")?"events":"all"),[g,y]=_.useState("all"),[b,x]=_.useState("all"),[S,w]=_.useState(""),[T,C]=_.useState(1),[O,j]=_.useState(!1),[R,I]=_.useState(e??null),z=_.useRef(!1),N=_.useMemo(()=>LX(S),[S]),A=_.useMemo(()=>new Date(Date.now()-UX(s)).toISOString(),[s]),{data:D,isLoading:Q,refetch:B}=bY({limit:a,offset:(T-1)*a,...n?{partitionId:n}:{},view:d,...d!=="commits"&&g!=="all"?{eventType:g}:{},...d!=="commits"&&b!=="all"?{outcome:b}:{},...N.actorId?{actorId:N.actorId}:{},...N.clientId?{clientId:N.clientId}:{},...N.requestId?{requestId:N.requestId}:{},...N.traceId?{traceId:N.traceId}:{},...N.table?{table:N.table}:{},...N.search?{search:N.search}:{},from:A},{refetchIntervalMs:l}),U=ZY(),Z=R?.startsWith("#")?R.slice(1):void 0,K=R?.startsWith("E")?R.slice(1):void 0,ee=Z&&Z!=="?"?Z:void 0,P=K&&K!=="?"?K:void 0,{data:G,isLoading:q,error:V}=vY(ee,{enabled:ee!==void 0,partitionId:n}),{data:L,isLoading:M,error:H}=xY(P,{enabled:P!==void 0,partitionId:n}),{data:W,isLoading:Y,error:ae}=SY(P,{enabled:P!==void 0&&!!L?.payloadRef,partitionId:n}),se=_.useMemo(()=>FX(f,L?.traceId??null,L?.spanId??null),[L?.spanId,L?.traceId]);_.useEffect(()=>{C(1)},[]),_.useEffect(()=>{C(1)},[]),_.useEffect(()=>{e&&I(e)},[e]),_.useEffect(()=>{if(!z.current){z.current=!0;return}I(null)},[]),_.useEffect(()=>{C(1),I(null)},[]);const Se=_.useMemo(()=>(D?.items??[]).map(we=>{const ye=we.instanceId??we.commit?.instanceId??we.event?.instanceId,xe=ye?`[${ye}] `:"";if(we.type==="commit"&&we.commit){const Ie=we.commit;return{type:"commit",id:$X(Ie,ye),outcome:"--",duration:"--",actor:Ie.actorId,client:Ie.clientId,detail:`${xe}${Ie.changeCount} chg | ${(Ie.affectedTables??[]).join(", ")}`,time:su(we.timestamp,t.timeFormat)}}const ve=we.event;return ve?{type:ve.eventType,id:BX(ve,ye),outcome:ve.outcome,duration:`${ve.durationMs}ms`,actor:ve.actorId,client:ve.clientId,detail:`${xe}${(ve.tables??[]).join(", ")||"--"}`,time:su(we.timestamp,t.timeFormat)}:{type:"pull",id:"E?",outcome:"unknown",duration:"--",actor:"",client:"",detail:"--",time:su(we.timestamp,t.timeFormat)}}),[t.timeFormat,D?.items]),pe=D?.total??0,Me=Math.max(1,Math.ceil(pe/a)),_e=Q,re=[{label:"",options:[{id:"all",label:"All"},{id:"commits",label:"Commits"},{id:"events",label:"Events"}],activeId:d,onActiveChange:ie=>{p(ie),ie==="commits"&&(y("all"),x("all")),C(1)}},{label:"Time",options:[{id:"1h",label:"1h"},{id:"6h",label:"6h"},{id:"24h",label:"24h"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}],activeId:s,onActiveChange:ie=>{i(ie),C(1)}},{label:"Type",options:[{id:"all",label:"All"},{id:"push",label:"Push"},{id:"pull",label:"Pull"}],activeId:g,onActiveChange:ie=>{y(ie),C(1)}},{label:"Outcome",options:[{id:"all",label:"All"},{id:"applied",label:"Applied"},{id:"error",label:"Error"},{id:"rejected",label:"Rejected"}],activeId:b,onActiveChange:ie=>{x(ie),C(1)}}];function he(){U.mutate(void 0,{onSuccess:()=>{j(!1),B()}})}return h.jsxs("div",{className:"flex flex-col h-full",children:[_e&&Se.length===0?h.jsx("div",{className:"flex items-center justify-center py-24",children:h.jsx(Pt,{size:"lg"})}):h.jsx(Qj,{entries:Se,selectedEntryId:R,onEntryClick:ie=>I(ie.id),filterBar:h.jsx(qj,{groups:re,searchValue:S,searchPlaceholder:"Use actor:, client:, table:, request:, trace: or free text...",onSearchChange:w,actions:h.jsxs(h.Fragment,{children:[h.jsx(Ne,{size:"sm",variant:"ghost",onClick:()=>{B()},children:"Refresh"}),h.jsx(Ne,{size:"sm",variant:"ghost",children:"Export"}),h.jsx(Ne,{size:"sm",variant:"destructive",onClick:()=>j(!0),children:"Clear"})]})}),pagination:h.jsx(px,{page:T,totalPages:Me,totalItems:pe,onPageChange:C})}),h.jsx($r,{open:R!==null,onOpenChange:ie=>{ie||I(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:ee!==void 0?`Commit #${ee}`:P!==void 0?`Event E${P}`:"Entry details"})}),h.jsx("div",{className:"px-5 py-4 space-y-3 max-h-[70vh] overflow-y-auto",children:q||M?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx(Pt,{size:"sm"})}):V||H?h.jsx("p",{className:"font-mono text-[11px] text-offline",children:"Failed to load details."}):G?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid grid-cols-2 gap-3 font-mono text-[11px]",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Actor"}),h.jsx("div",{className:"text-neutral-100",children:G.actorId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Client"}),h.jsx("div",{className:"text-neutral-100",children:G.clientId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Instance"}),h.jsx("div",{className:"text-neutral-100",children:G.instanceId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Created"}),h.jsx("div",{className:"text-neutral-100",children:su(G.createdAt,t.timeFormat)})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Changes"}),h.jsx("div",{className:"text-neutral-100",children:G.changeCount})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Affected Tables"}),h.jsx("p",{className:"font-mono text-[11px] text-neutral-200",children:G.affectedTables.join(", ")||"--"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500",children:"Changes"}),G.changes.length===0?h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No changes recorded."}):G.changes.map(ie=>h.jsxs("div",{className:"rounded-md border border-border p-3 space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between font-mono text-[11px]",children:[h.jsxs("span",{className:"text-neutral-300",children:[ie.table," | ",ie.op]}),h.jsxs("span",{className:"text-neutral-500",children:["#",ie.changeId]})]}),h.jsxs("div",{className:"font-mono text-[11px] text-neutral-400",children:["rowId: ",ie.rowId,ie.rowVersion!==null?` | version: ${ie.rowVersion}`:""]}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Gd(ie.rowJson)})]},ie.changeId))]})]}):L?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"grid grid-cols-2 gap-3 font-mono text-[11px]",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Type"}),h.jsx("div",{className:"text-neutral-100",children:L.eventType})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Path"}),h.jsx("div",{className:"text-neutral-100",children:L.syncPath})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Instance"}),h.jsx("div",{className:"text-neutral-100",children:L.instanceId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Outcome"}),h.jsx("div",{className:"text-neutral-100",children:L.outcome})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Response Status"}),h.jsx("div",{className:"text-neutral-100",children:L.responseStatus})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Actor"}),h.jsx("div",{className:"text-neutral-100",children:L.actorId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Client"}),h.jsx("div",{className:"text-neutral-100",children:L.clientId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Status"}),h.jsx("div",{className:"text-neutral-100",children:L.statusCode})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Transport"}),h.jsx("div",{className:"text-neutral-100",children:L.transportPath})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Duration"}),h.jsxs("div",{className:"text-neutral-100",children:[L.durationMs,"ms"]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Request ID"}),h.jsx("div",{className:"text-neutral-100",children:L.requestId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Trace ID"}),h.jsx("div",{className:"text-neutral-100",children:L.traceId??"--"}),se&&h.jsx("a",{href:se,target:"_blank",rel:"noreferrer",className:"font-mono text-[10px] text-flow underline underline-offset-4",children:"Open external trace"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Span ID"}),h.jsx("div",{className:"text-neutral-100",children:L.spanId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Commit Seq"}),h.jsx("div",{className:"text-neutral-100",children:L.commitSeq??"--"}),L.commitSeq!==null&&h.jsx(Ne,{variant:"ghost",size:"sm",onClick:()=>I(`#${L.instanceId?`${L.instanceId}:`:""}${L.commitSeq}`),children:"Open linked commit"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Subscription Count"}),h.jsx("div",{className:"text-neutral-100",children:L.subscriptionCount??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Error Code"}),h.jsx("div",{className:"text-neutral-100",children:L.errorCode??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Payload Ref"}),h.jsx("div",{className:"text-neutral-100",children:L.payloadRef??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Created"}),h.jsx("div",{className:"text-neutral-100",children:su(L.createdAt,t.timeFormat)})]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Tables"}),h.jsx("p",{className:"font-mono text-[11px] text-neutral-200",children:L.tables.join(", ")||"--"})]}),L.scopesSummary&&h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Scopes Summary"}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Gd(L.scopesSummary)})]}),L.payloadRef&&h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Payload Snapshot"}),Y?h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Pt,{size:"sm"}),h.jsx("span",{className:"font-mono text-[11px] text-neutral-400",children:"Loading payload snapshot..."})]}):ae?h.jsx("p",{className:"font-mono text-[11px] text-offline",children:"Failed to load payload snapshot."}):W?h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500",children:"Request"}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Gd(W.requestPayload)}),h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500",children:"Response"}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Gd(W.responsePayload)})]}):h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No payload snapshot available."})]}),L.errorMessage&&h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Error"}),h.jsx("p",{className:"font-mono text-[11px] text-offline",children:L.errorMessage})]})]}):h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No details available for this row."})}),h.jsx(Nn,{children:h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>I(null),children:"Close"})})]})}),h.jsx($r,{open:O,onOpenChange:ie=>{ie||j(!1)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Clear all events"})}),h.jsx("div",{className:"p-4",children:h.jsx("span",{className:"font-mono text-[11px] text-neutral-400",children:"This will permanently delete all request events. Commits are not affected. Are you sure?"})}),h.jsxs(Nn,{children:[h.jsx(Ne,{variant:"default",size:"sm",onClick:()=>j(!1),children:"Cancel"}),h.jsx(Ne,{variant:"destructive",size:"sm",onClick:he,disabled:U.isPending,children:U.isPending?"Clearing...":"Clear all"})]})]})})]})}const HX=co({getParentRoute:()=>uo,path:"/config",component:aX}),qX=co({getParentRoute:()=>uo,path:"/fleet",component:bX}),VX=co({getParentRoute:()=>uo,path:"/",component:iX});function KX(){const{seq:e}=mk.useParams();return h.jsx(yx,{initialSelectedEntryId:`#${e}`})}const mk=co({getParentRoute:()=>uo,path:"/investigate/commit/$seq",component:KX});function GX(){const{id:e}=gk.useParams();return h.jsx(yx,{initialSelectedEntryId:`E${e}`})}const gk=co({getParentRoute:()=>uo,path:"/investigate/event/$id",component:GX}),ZX=co({getParentRoute:()=>uo,path:"/ops",component:RX}),YX=co({getParentRoute:()=>uo,path:"/storage",component:DX}),XX=co({getParentRoute:()=>uo,path:"/stream",component:yx}),yk=uo.addChildren([VX,XX,mk,gk,qX,ZX,YX,HX]),QX="syncular-console-basepath",WX="syncular-console-server-url",JX="syncular-console-token";function eQ(e){if(!e)return;const t=e.trim();return t.length>0?t:void 0}function $v(e){const t=globalThis.document;if(!t)return;const n=t.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return eQ(n)}function vk(e){return!e||e==="/"?"/":(e.startsWith("/")?e:`/${e}`).replace(/\/+$/g,"")||"/"}function tQ(){return vk($v(QX))}function nQ(){const e=$v(WX),t=$v(JX);return!e||!t?null:{serverUrl:e,token:t}}XN({routeTree:yk,basepath:"/"});function rQ(){return new k6({defaultOptions:{queries:{staleTime:5e3,retry:1}}})}function sQ(e){return vk(e??tQ())}function oQ(e){const[t]=_.useState(()=>rQ()),n=_.useMemo(()=>XN({routeTree:yk,basepath:sQ(e.basePath)}),[e.basePath]),s=e.defaultConfig===void 0?nQ():e.defaultConfig;return h.jsx(O6,{client:t,children:h.jsx(QH,{defaultConfig:s,children:h.jsx(LH,{router:n})})})}function iQ(e){return h.jsx("div",{className:gx,children:h.jsx(oQ,{...e})})}function aQ(e){const t=document.querySelector(e);if(!t)throw new Error(`Unable to mount console: ${e} not found`);return t}function cQ(e,t={}){const n=aQ(e);BY(n);const s=a6.createRoot(n),i=h.jsx(iQ,{basePath:t.basePath,defaultConfig:t.defaultConfig});return t.strictMode===!1?(s.render(i),s):(s.render(h.jsx(_.StrictMode,{children:i})),s)}var lQ={};const uQ="syncular-sentry-dsn",fQ="syncular-sentry-environment",dQ="syncular-sentry-release";function hu(e){if(!e)return;const t=e.trim();return t.length>0?t:void 0}function By(e){if(typeof document>"u")return;const t=document.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return hu(t)}function Fy(e){if(!(typeof process>"u"))return hu(lQ[e])}function Hy(e){for(const t of e)if(t)return t}function hQ(){const e=Hy([hu(globalThis.__SYNCULAR_SENTRY_DSN__),By(uQ),Fy("SYNCULAR_SENTRY_DSN")]);if(!e)return null;const t=Hy([hu(globalThis.__SYNCULAR_SENTRY_ENVIRONMENT__),By(fQ),Fy("SYNCULAR_SENTRY_ENVIRONMENT")]),n=Hy([hu(globalThis.__SYNCULAR_SENTRY_RELEASE__),By(dQ),Fy("SYNCULAR_SENTRY_RELEASE")]);return{dsn:e,environment:t,release:n,enableLogs:!0,tracesSampleRate:.2,tracePropagationTargets:[/^https?:\/\/.*\/api\/.*/]}}const XC=hQ();XC&&WB(XC);cQ("#root");
|