@syncular/console 0.0.6-116 → 0.0.6-122
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.
|
@@ -6,19 +6,19 @@ Error:`,i)}}let Fg=null;function oR(e){const t="error";ci(t,e),li(t,qM)}function
|
|
|
6
6
|
${JSON.stringify(l)}
|
|
7
7
|
`),typeof f=="string"||f instanceof Uint8Array)i(f);else{let d;try{d=JSON.stringify(f)}catch{d=JSON.stringify(Vs(f))}i(d)}}return typeof s=="string"?s:tP(s)}function tP(e){const t=e.reduce((i,a)=>i+a.length,0),n=new Uint8Array(t);let s=0;for(const i of e)n.set(i,s),s+=i.length;return n}function nP(e){return[{type:"span"},e]}function rP(e){const t=typeof e.data=="string"?Jy(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const sP={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function Nw(e){return sP[e]}function MR(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function oP(e,t,n,s){const i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&s&&{dsn:Gc(s)},...i&&{trace:i}}}function iP(e,t){if(!t)return e;const n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function aP(e,t,n,s){const i=MR(n),a={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!s&&t&&{dsn:Gc(t)}},l="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return ma(a,[l])}function cP(e,t,n,s){const i=MR(n),a=e.type&&e.type!=="replay_event"?e.type:"event";iP(e,n?.sdk);const l=oP(e,i,s,t);return delete e.sdkProcessingMetadata,ma(l,[[{type:a},e]])}function lP(e,t){function n(x){return!!x.trace_id&&!!x.public_key}const s=to(e[0]),i=t?.getDsn(),a=t?.getOptions().tunnel,l={sent_at:new Date().toISOString(),...n(s)&&{trace:s},...!!a&&i&&{dsn:Gc(i)}},{beforeSendSpan:f,ignoreSpans:d}=t?.getOptions()||{},p=d?.length?e.filter(x=>!gh(yt(x),d)):e,g=e.length-p.length;g&&t?.recordDroppedEvent("before_send","span",g);const y=f?x=>{const S=yt(x),w=f(S);return w||(Xy(),S)}:yt,b=[];for(const x of p){const S=y(x);S&&b.push(nP(S))}return ma(l,b)}function uP(e){if(!Ce)return;const{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:s}=yt(e),{spanId:i}=e.spanContext(),a=ui(e),l=Dn(e),f=l===e,d=`[Tracing] Starting ${a?"sampled":"unsampled"} ${f?"root ":""}span`,p=[`op: ${n}`,`name: ${t}`,`ID: ${i}`];if(s&&p.push(`parent ID: ${s}`),!f){const{op:g,description:y}=yt(l);p.push(`root ID: ${l.spanContext().spanId}`),g&&p.push(`root op: ${g}`),y&&p.push(`root description: ${y}`)}be.log(`${d}
|
|
8
8
|
${p.join(`
|
|
9
|
-
`)}`)}function fP(e){if(!Ce)return;const{description:t="< unknown name >",op:n="< unknown op >"}=yt(e),{spanId:s}=e.spanContext(),a=Dn(e)===e,l=`[Tracing] Finishing "${n}" ${a?"root ":""}span "${t}" with ID ${s}`;be.log(l)}function dP(e,t,n,s=Xn()){const i=s&&Dn(s);i&&(Ce&&be.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[Lu]:t,[zu]:n}))}function jw(e){if(!e||e.length===0)return;const t={};return e.forEach(n=>{const s=n.attributes||{},i=s[zu],a=s[Lu];typeof i=="string"&&typeof a=="number"&&(t[n.name]={value:a,unit:i})}),t}const Aw=1e3;class sp{constructor(t={}){this._traceId=t.traceId||Ws(),this._spanId=t.spanId||Zs(),this._startTime=t.startTimestamp||cn(),this._links=t.links,this._attributes={},this.setAttributes({[gn]:"manual",[eo]:t.op,...t.attributes}),this._name=t.name,t.parentSpanId&&(this._parentSpanId=t.parentSpanId),"sampled"in t&&(this._sampled=t.sampled),t.endTimestamp&&(this._endTime=t.endTimestamp),this._events=[],this._isStandaloneSpan=t.isStandalone,this._endTime&&this._onSpanEnded()}addLink(t){return this._links?this._links.push(t):this._links=[t],this}addLinks(t){return this._links?this._links.push(...t):this._links=t,this}recordException(t,n){}spanContext(){const{_spanId:t,_traceId:n,_sampled:s}=this;return{spanId:t,traceId:n,traceFlags:s?Jv:TR}}setAttribute(t,n){return n===void 0?delete this._attributes[t]:this._attributes[t]=n,this}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._startTime=Ji(t)}setStatus(t){return this._status=t,this}updateName(t){return this._name=t,this.setAttribute(vs,"custom"),this}end(t){this._endTime||(this._endTime=Ji(t),fP(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[eo],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:NR(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[gn],profile_id:this._attributes[Xv],exclusive_time:this._attributes[Kc],measurements:jw(this._events),is_segment:this._isStandaloneSpan&&Dn(this)===this||void 0,segment_id:this._isStandaloneSpan?Dn(this).spanContext().spanId:void 0,links:RR(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,s){Ce&&be.log("[Tracing] Adding an event to span:",t);const i=kw(n)?n:s||cn(),a=kw(n)?{}:n||{},l={name:t,time:Ji(i),attributes:a};return this._events.push(l),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const t=vt();if(t&&t.emit("spanEnd",this),!(this._isStandaloneSpan||this===Dn(this)))return;if(this._isStandaloneSpan){this._sampled?pP(lP([this],t)):(Ce&&be.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}const s=this._convertSpanToTransaction();s&&(mh(this).scope||bt()).captureEvent(s)}_convertSpanToTransaction(){if(!Ow(yt(this)))return;this._name||(Ce&&be.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:t,isolationScope:n}=mh(this),s=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;const a=Qd(this).filter(g=>g!==this&&!hP(g)).map(g=>yt(g)).filter(Ow),l=this._attributes[vs];delete this._attributes[_w],a.forEach(g=>{delete g.data[_w]});const f={contexts:{trace:LI(this)},spans:a.length>Aw?a.sort((g,y)=>g.start_timestamp-y.start_timestamp).slice(0,Aw):a,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:to(this)},request:s,...l&&{transaction_info:{source:l}}},d=jw(this._events);return d&&Object.keys(d).length&&(Ce&&be.log("[Measurements] Adding measurements to transaction event",JSON.stringify(d,void 0,2)),f.measurements=d),f}}function kw(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function Ow(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function hP(e){return e instanceof sp&&e.isStandaloneSpan()}function pP(e){const t=vt();if(!t)return;const n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function mP(e,t,n=()=>{},s=()=>{}){let i;try{i=e()}catch(a){throw t(a),n(),a}return gP(i,t,n,s)}function gP(e,t,n,s){return qc(e)?e.then(i=>(n(),s(i),i),i=>{throw t(i),n(),i}):(n(),s(e),e)}function yP(e,t,n){if(!ss(e))return[!1];let s,i;typeof e.tracesSampler=="function"?(i=e.tracesSampler({...t,inheritOrSampleWith:f=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):f}),s=!0):t.parentSampled!==void 0?i=t.parentSampled:typeof e.tracesSampleRate<"u"&&(i=e.tracesSampleRate,s=!0);const a=bu(i);if(a===void 0)return Ce&&be.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!a)return Ce&&be.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,a,s];const l=n<a;return l||Ce&&be.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[l,a,s]}const IR="__SENTRY_SUPPRESS_TRACING__";function PR(e,t){const n=rb();if(n.startSpan)return n.startSpan(e,t);const s=zR(e),{forceTransaction:i,parentSpan:a,scope:l}=e,f=l?.clone();return Du(f,()=>bP(a)(()=>{const p=bt(),g=LR(p,a),b=e.onlyIfParent&&!g?new ei:DR({parentSpan:g,spanArguments:s,forceTransaction:i,scope:p});return jc(p,b),mP(()=>t(b),()=>{const{status:x}=yt(b);b.isRecording()&&(!x||x==="ok")&&b.setStatus({code:hn,message:"internal_error"})},()=>{b.end()})}))}function Zc(e){const t=rb();if(t.startInactiveSpan)return t.startInactiveSpan(e);const n=zR(e),{forceTransaction:s,parentSpan:i}=e;return(e.scope?l=>Du(e.scope,l):i!==void 0?l=>nb(i,l):l=>l())(()=>{const l=bt(),f=LR(l,i);return e.onlyIfParent&&!f?new ei:DR({parentSpan:f,spanArguments:n,forceTransaction:s,scope:l})})}function nb(e,t){const n=rb();return n.withActiveSpan?n.withActiveSpan(e,t):Du(s=>(jc(s,e||void 0),t(s)))}function DR({parentSpan:e,spanArguments:t,forceTransaction:n,scope:s}){if(!ss()){const l=new ei;if(n||!e){const f={sampled:"false",sample_rate:"0",transaction:t.name,...to(l)};Wd(l,f)}return l}const i=Zr();let a;if(e&&!n)a=vP(e,s,t),jR(e,a);else if(e){const l=to(e),{traceId:f,spanId:d}=e.spanContext(),p=ui(e);a=Mw({traceId:f,parentSpanId:d,...t},s,p),Wd(a,l)}else{const{traceId:l,dsc:f,parentSpanId:d,sampled:p}={...i.getPropagationContext(),...s.getPropagationContext()};a=Mw({traceId:l,parentSpanId:d,...t},s,p),f&&Wd(a,f)}return uP(a),SI(a,s,i),a}function zR(e){const n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){const s={...n};return s.startTimestamp=Ji(e.startTime),delete s.startTime,s}return n}function rb(){const e=da();return Vc(e)}function Mw(e,t,n){const s=vt(),i=s?.getOptions()||{},{name:a=""}=e,l={spanAttributes:{...e.attributes},spanName:a,parentSampled:n};s?.emit("beforeSampling",l,{decision:!1});const f=l.parentSampled??n,d=l.spanAttributes,p=t.getPropagationContext(),[g,y,b]=t.getScopeData().sdkProcessingMetadata[IR]?[!1]:yP(i,{name:a,parentSampled:f,attributes:d,parentSampleRate:bu(p.dsc?.sample_rate)},p.sampleRand),x=new sp({...e,attributes:{[vs]:"custom",[Yv]:y!==void 0&&b?y:void 0,...d},sampled:g});return!g&&s&&(Ce&&be.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),s.recordDroppedEvent("sample_rate","transaction")),s&&s.emit("spanStart",x),x}function vP(e,t,n){const{spanId:s,traceId:i}=e.spanContext(),a=t.getScopeData().sdkProcessingMetadata[IR]?!1:ui(e),l=a?new sp({...n,parentSpanId:s,traceId:i,sampled:a}):new ei({traceId:i});jR(e,l);const f=vt();return f&&(f.emit("spanStart",l),n.endTimestamp&&f.emit("spanEnd",l)),l}function LR(e,t){if(t)return t;if(t===null)return;const n=Ac(e);if(!n)return;const s=vt();return(s?s.getOptions():{}).parentSpanIsAlwaysRootSpan?Dn(n):n}function bP(e){return e!==void 0?t=>nb(e,t):t=>t()}const Jd={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},xP="heartbeatFailed",SP="idleTimeout",_P="finalTimeout",wP="externalFinish";function UR(e,t={}){const n=new Map;let s=!1,i,a=wP,l=!t.disableAutoFinish;const f=[],{idleTimeout:d=Jd.idleTimeout,finalTimeout:p=Jd.finalTimeout,childSpanTimeout:g=Jd.childSpanTimeout,beforeSpanEnd:y,trimIdleSpanEndTimestamp:b=!0}=t,x=vt();if(!x||!ss()){const j=new ei,A={sample_rate:"0",sampled:"false",...to(j)};return Wd(j,A),j}const S=bt(),w=Xn(),T=EP(e);T.end=new Proxy(T.end,{apply(j,A,P){if(y&&y(T),A instanceof ei)return;const[G,...B]=P,z=G||cn(),Q=Ji(z),Y=Qd(T).filter(U=>U!==T),ee=yt(T);if(!Y.length||!b)return L(Q),Reflect.apply(j,A,[Q,...B]);const D=x.getOptions().ignoreSpans,K=Y?.reduce((U,I)=>{const H=yt(I);return!H.timestamp||D&&gh(H,D)?U:U?Math.max(U,H.timestamp):H.timestamp},void 0),q=ee.start_timestamp,V=Math.min(q?q+p/1e3:1/0,Math.max(q||-1/0,Math.min(Q,K||1/0)));return L(V),Reflect.apply(j,A,[V,...B])}});function C(){i&&(clearTimeout(i),i=void 0)}function k(j){C(),i=setTimeout(()=>{!s&&n.size===0&&l&&(a=SP,T.end(j))},d)}function N(j){i=setTimeout(()=>{!s&&l&&(a=xP,T.end(j))},g)}function R(j){C(),n.set(j,!0);const A=cn();N(A+g/1e3)}function M(j){if(n.has(j)&&n.delete(j),n.size===0){const A=cn();k(A+d/1e3)}}function L(j){s=!0,n.clear(),f.forEach(Y=>Y()),jc(S,w);const A=yt(T),{start_timestamp:P}=A;if(!P)return;A.data[vu]||T.setAttribute(vu,a);const B=A.status;(!B||B==="unknown")&&T.setStatus({code:Qv}),be.log(`[Tracing] Idle span "${A.op}" finished`);const z=Qd(T).filter(Y=>Y!==T);let Q=0;z.forEach(Y=>{Y.isRecording()&&(Y.setStatus({code:hn,message:"cancelled"}),Y.end(j),Ce&&be.log("[Tracing] Cancelling span since span ended early",JSON.stringify(Y,void 0,2)));const ee=yt(Y),{timestamp:D=0,start_timestamp:K=0}=ee,q=K<=j,V=(p+d)/1e3,U=D-K<=V;if(Ce){const I=JSON.stringify(Y,void 0,2);q?U||be.log("[Tracing] Discarding span since it finished after idle span final timeout",I):be.log("[Tracing] Discarding span since it happened after idle span was finished",I)}(!U||!q)&&(HI(T,Y),Q++)}),Q>0&&T.setAttribute("sentry.idle_span_discarded_spans",Q)}return f.push(x.on("spanStart",j=>{if(s||j===T||yt(j).timestamp||j instanceof sp&&j.isStandaloneSpan())return;Qd(T).includes(j)&&R(j.spanContext().spanId)})),f.push(x.on("spanEnd",j=>{s||M(j.spanContext().spanId)})),f.push(x.on("idleSpanEnableAutoFinish",j=>{j===T&&(l=!0,k(),n.size&&N())})),t.disableAutoFinish||k(),setTimeout(()=>{s||(T.setStatus({code:hn,message:"deadline_exceeded"}),a=_P,T.end())},p),T}function EP(e){const t=Zc(e);return jc(bt(),t),Ce&&be.log("[Tracing] Started span is an idle span"),t}const Kg=0,Iw=1,Pw=2;function Uu(e){return new xu(t=>{t(e)})}function sb(e){return new xu((t,n)=>{n(e)})}class xu{constructor(t){this._state=Kg,this._handlers=[],this._runExecutor(t)}then(t,n){return new xu((s,i)=>{this._handlers.push([!1,a=>{if(!t)s(a);else try{s(t(a))}catch(l){i(l)}},a=>{if(!n)i(a);else try{s(n(a))}catch(l){i(l)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new xu((n,s)=>{let i,a;return this.then(l=>{a=!1,i=l,t&&t()},l=>{a=!0,i=l,t&&t()}).then(()=>{if(a){s(i);return}n(i)})})}_executeHandlers(){if(this._state===Kg)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===Iw&&n[1](this._value),this._state===Pw&&n[2](this._value),n[0]=!0)})}_runExecutor(t){const n=(a,l)=>{if(this._state===Kg){if(qc(l)){l.then(s,i);return}this._state=a,this._value=l,this._executeHandlers()}},s=a=>{n(Iw,a)},i=a=>{n(Pw,a)};try{t(s,i)}catch(a){i(a)}}}function TP(e,t,n,s=0){try{const i=ev(t,n,e,s);return qc(i)?i:Uu(i)}catch(i){return sb(i)}}function ev(e,t,n,s){const i=n[s];if(!e||!i)return e;const a=i({...e},t);return Ce&&a===null&&be.log(`Event processor "${i.id||"?"}" dropped event`),qc(a)?a.then(l=>ev(l,t,n,s+1)):ev(a,t,n,s+1)}let Bi,Dw,zw,zo;function CP(e){const t=ct._sentryDebugIds,n=ct._debugIds;if(!t&&!n)return{};const s=t?Object.keys(t):[],i=n?Object.keys(n):[];if(zo&&s.length===Dw&&i.length===zw)return zo;Dw=s.length,zw=i.length,zo={},Bi||(Bi={});const a=(l,f)=>{for(const d of l){const p=f[d],g=Bi?.[d];if(g&&zo&&p)zo[g[0]]=p,Bi&&(Bi[d]=[g[0],p]);else if(p){const y=e(d);for(let b=y.length-1;b>=0;b--){const S=y[b]?.filename;if(S&&zo&&Bi){zo[S]=p,Bi[d]=[S,p];break}}}}};return t&&a(s,t),n&&a(i,n),zo}function RP(e,t){const{fingerprint:n,span:s,breadcrumbs:i,sdkProcessingMetadata:a}=t;NP(e,t),s&&kP(e,s),OP(e,n),jP(e,i),AP(e,a)}function Lw(e,t){const{extra:n,tags:s,attributes:i,user:a,contexts:l,level:f,sdkProcessingMetadata:d,breadcrumbs:p,fingerprint:g,eventProcessors:y,attachments:b,propagationContext:x,transactionName:S,span:w}=t;Wl(e,"extra",n),Wl(e,"tags",s),Wl(e,"attributes",i),Wl(e,"user",a),Wl(e,"contexts",l),e.sdkProcessingMetadata=Pu(e.sdkProcessingMetadata,d,2),f&&(e.level=f),S&&(e.transactionName=S),w&&(e.span=w),p.length&&(e.breadcrumbs=[...e.breadcrumbs,...p]),g.length&&(e.fingerprint=[...e.fingerprint,...g]),y.length&&(e.eventProcessors=[...e.eventProcessors,...y]),b.length&&(e.attachments=[...e.attachments,...b]),e.propagationContext={...e.propagationContext,...x}}function Wl(e,t,n){e[t]=Pu(e[t],n,1)}function op(e,t){const n=pI().getScopeData();return e&&Lw(n,e.getScopeData()),t&&Lw(n,t.getScopeData()),n}function NP(e,t){const{extra:n,tags:s,user:i,contexts:a,level:l,transactionName:f}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(s).length&&(e.tags={...s,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),l&&(e.level=l),f&&e.type!=="transaction"&&(e.transaction=f)}function jP(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function AP(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function kP(e,t){e.contexts={trace:CR(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:to(t),...e.sdkProcessingMetadata};const n=Dn(t),s=yt(n).description;s&&!e.transaction&&e.type==="transaction"&&(e.transaction=s)}function OP(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function MP(e,t,n,s,i,a){const{normalizeDepth:l=3,normalizeMaxBreadth:f=1e3}=e,d={...t,event_id:t.event_id||n.event_id||qr(),timestamp:t.timestamp||pa()},p=n.integrations||e.integrations.map(C=>C.name);IP(d,e),zP(d,p),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&PP(d,e.stackParser);const g=UP(s,n.captureContext);n.mechanism&&Rc(d,n.mechanism);const y=i?i.getEventProcessors():[],b=op(a,g),x=[...n.attachments||[],...b.attachments];x.length&&(n.attachments=x),RP(d,b);const S=[...y,...b.eventProcessors];return(n.data&&n.data.__sentry__===!0?Uu(d):TP(S,d,n)).then(C=>(C&&DP(C),typeof l=="number"&&l>0?LP(C,l,f):C))}function IP(e,t){const{environment:n,release:s,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||eb,!e.release&&s&&(e.release=s),!e.dist&&i&&(e.dist=i);const l=e.request;l?.url&&a&&(l.url=Ky(l.url,a)),a&&e.exception?.values?.forEach(f=>{f.value&&(f.value=Ky(f.value,a))})}function PP(e,t){const n=CP(t);e.exception?.values?.forEach(s=>{s.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=n[i.filename])})})}function DP(e){const t={};if(e.exception?.values?.forEach(s=>{s.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([s,i])=>{n.push({type:"sourcemap",code_file:s,debug_id:i})})}function zP(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function LP(e,t,n){if(!e)return null;const s={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:Vs(i.data,t,n)}}))},...e.user&&{user:Vs(e.user,t,n)},...e.contexts&&{contexts:Vs(e.contexts,t,n)},...e.extra&&{extra:Vs(e.extra,t,n)}};return e.contexts?.trace&&s.contexts&&(s.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(s.contexts.trace.data=Vs(e.contexts.trace.data,t,n))),e.spans&&(s.spans=e.spans.map(i=>({...i,...i.data&&{data:Vs(i.data,t,n)}}))),e.contexts?.flags&&s.contexts&&(s.contexts.flags=Vs(e.contexts.flags,3,n)),s}function UP(e,t){if(!t)return e;const n=e?e.clone():new Js;return n.update(t),n}function $R(e,t){return bt().captureException(e,void 0)}function BR(e,t){return bt().captureEvent(e,t)}function $P(e,t){Zr().setContext(e,t)}function BP(){const e=vt();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Uw(e){const t=Zr(),{user:n}=op(t,bt()),{userAgent:s}=ct.navigator||{},i=sI({user:n,...s&&{userAgent:s},...e}),a=t.getSession();return a?.status==="ok"&&Nc(a,{status:"exited"}),FR(),t.setSession(i),i}function FR(){const e=Zr(),n=bt().getSession()||e.getSession();n&&oI(n),HR(),e.setSession()}function HR(){const e=Zr(),t=vt(),n=e.getSession();n&&t&&t.captureSession(n)}function Gg(e=!1){if(e){FR();return}HR()}const FP="7";function HP(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function qP(e){return`${HP(e)}${e.projectId}/envelope/`}function VP(e,t){const n={sentry_version:FP};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function KP(e,t,n){return t||`${qP(e)}?${VP(e,n)}`}const $w=[];function GP(e){const t={};return e.forEach(n=>{const{name:s}=n,i=t[s];i&&!i.isDefaultInstance&&n.isDefaultInstance||(t[s]=n)}),Object.values(t)}function ZP(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(i=>{i.isDefaultInstance=!0});let s;if(Array.isArray(n))s=[...t,...n];else if(typeof n=="function"){const i=n(t);s=Array.isArray(i)?i:[i]}else s=t;return GP(s)}function YP(e,t){const n={};return t.forEach(s=>{s&&qR(e,s,n)}),n}function Bw(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function qR(e,t,n){if(n[t.name]){Ce&&be.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!$w.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),$w.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){const s=t.preprocessEvent.bind(t);e.on("preprocessEvent",(i,a)=>s(i,a,e))}if(typeof t.processEvent=="function"){const s=t.processEvent.bind(t),i=Object.assign((a,l)=>s(a,l,e),{id:t.name});e.addEventProcessor(i)}Ce&&be.log(`Integration installed: ${t.name}`)}function XP(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function QP(e,t){const{value:n,unit:s}=XP(e)?e:{value:e,unit:void 0},i=WP(n),a=s&&typeof s=="string"?{unit:s}:{};if(i)return{...i,...a};if(!t||t==="skip-undefined"&&n===void 0)return;let l="";try{l=JSON.stringify(n)??""}catch{}return{value:l,type:"string",...a}}function yh(e,t=!1){const n={};for(const[s,i]of Object.entries(e??{})){const a=QP(i,t);a&&(n[s]=a)}return n}function WP(e){const t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}function VR(e,t){return t?Du(t,()=>{const n=Xn(),s=n?CR(n):mR(t);return[n?to(n):tb(e,t),s]}):[void 0,void 0]}const JP={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function eD(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function tD(e,t,n,s){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&s&&(i.dsn=Gc(s)),ma(i,[eD(e)])}const nD=100;function ps(e,t,n,s=!0){n&&(!e[t]||s)&&(e[t]=n)}function rD(e,t){const n=ob(),s=KR(e);s===void 0?n.set(e,[t]):s.length>=nD?(vh(e,s),n.set(e,[t])):n.set(e,[...s,t])}function sD(e,t=bt(),n=rD){const s=t?.getClient()??vt();if(!s){Ce&&be.warn("No client available to capture log.");return}const{release:i,environment:a,enableLogs:l=!1,beforeSendLog:f}=s.getOptions();if(!l){Ce&&be.warn("logging option not enabled, log will not be captured.");return}const[,d]=VR(s,t),p={...e.attributes},{user:{id:g,email:y,username:b},attributes:x={}}=op(Zr(),t);ps(p,"user.id",g,!1),ps(p,"user.email",y,!1),ps(p,"user.name",b,!1),ps(p,"sentry.release",i),ps(p,"sentry.environment",a);const{name:S,version:w}=s.getSdkMetadata()?.sdk??{};ps(p,"sentry.sdk.name",S),ps(p,"sentry.sdk.version",w);const T=s.getIntegrationByName("Replay"),C=T?.getReplayId(!0);ps(p,"sentry.replay_id",C),C&&T?.getRecordingMode()==="buffer"&&ps(p,"sentry._internal.replay_is_buffering",!0);const k=e.message;if(np(k)){const{__sentry_template_string__:B,__sentry_template_values__:z=[]}=k;z?.length&&(p["sentry.message.template"]=B),z.forEach((Q,Y)=>{p[`sentry.message.parameter.${Y}`]=Q})}const N=Ac(t);ps(p,"sentry.trace.parent_span_id",N?.spanContext().spanId);const R={...e,attributes:p};s.emit("beforeCaptureLog",R);const M=f?ha(()=>f(R)):R;if(!M){s.recordDroppedEvent("before_send","log_item",1),Ce&&be.warn("beforeSendLog returned null, log will not be captured.");return}const{level:L,message:j,attributes:A={},severityNumber:P}=M,G={timestamp:cn(),level:L,body:j,trace_id:d?.trace_id,severity_number:P??JP[L],attributes:{...yh(x),...yh(A,!0)}};n(s,G),s.emit("afterCaptureLog",M)}function vh(e,t){const n=t??KR(e)??[];if(n.length===0)return;const s=e.getOptions(),i=tD(n,s._metadata,s.tunnel,e.getDsn());ob().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function KR(e){return ob().get(e)}function ob(){return Fc("clientToLogBufferMap",()=>new WeakMap)}function oD(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function iD(e,t,n,s){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&s&&(i.dsn=Gc(s)),ma(i,[oD(e)])}const aD=1e3;function Fs(e,t,n,s=!0){n&&(s||!(t in e))&&(e[t]=n)}function cD(e,t){const n=ab(),s=GR(e);s===void 0?n.set(e,[t]):s.length>=aD?(ib(e,s),n.set(e,[t])):n.set(e,[...s,t])}function lD(e,t,n){const{release:s,environment:i}=t.getOptions(),a={...e.attributes};Fs(a,"user.id",n.id,!1),Fs(a,"user.email",n.email,!1),Fs(a,"user.name",n.username,!1),Fs(a,"sentry.release",s),Fs(a,"sentry.environment",i);const{name:l,version:f}=t.getSdkMetadata()?.sdk??{};Fs(a,"sentry.sdk.name",l),Fs(a,"sentry.sdk.version",f);const d=t.getIntegrationByName("Replay"),p=d?.getReplayId(!0);return Fs(a,"sentry.replay_id",p),p&&d?.getRecordingMode()==="buffer"&&Fs(a,"sentry._internal.replay_is_buffering",!0),{...e,attributes:a}}function uD(e,t,n,s){const[,i]=VR(t,n),a=Ac(n),l=a?a.spanContext().traceId:i?.trace_id,f=a?a.spanContext().spanId:void 0;return{timestamp:cn(),trace_id:l??"",span_id:f,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...yh(s),...yh(e.attributes,"skip-undefined")}}}function fD(e,t){const n=t?.scope??bt(),s=t?.captureSerializedMetric??cD,i=n?.getClient()??vt();if(!i){Ce&&be.warn("No client available to capture metric.");return}const{_experiments:a,enableMetrics:l,beforeSendMetric:f}=i.getOptions();if(!(l??a?.enableMetrics??!0)){Ce&&be.warn("metrics option not enabled, metric will not be captured.");return}const{user:p,attributes:g}=op(Zr(),n),y=lD(e,i,p);i.emit("processMetric",y);const b=f||a?.beforeSendMetric,x=b?b(y):y;if(!x){Ce&&be.log("`beforeSendMetric` returned `null`, will not send metric.");return}const S=uD(x,i,n,g);Ce&&be.log("[Metric]",S),s(i,S),i.emit("afterCaptureMetric",x)}function ib(e,t){const n=t??GR(e)??[];if(n.length===0)return;const s=e.getOptions(),i=iD(n,s._metadata,s.tunnel,e.getDsn());ab().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function GR(e){return ab().get(e)}function ab(){return Fc("clientToMetricBufferMap",()=>new WeakMap)}function ZR(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}const cb=Symbol.for("SentryBufferFullError");function lb(e=100){const t=new Set;function n(){return t.size<e}function s(l){t.delete(l)}function i(l){if(!n())return sb(cb);const f=l();return t.add(f),f.then(()=>s(f),()=>s(f)),f}function a(l){if(!t.size)return Uu(!0);const f=Promise.allSettled(Array.from(t)).then(()=>!0);if(!l)return f;const d=[f,new Promise(p=>ZR(setTimeout(()=>p(!1),l)))];return Promise.race(d)}return{get $(){return Array.from(t)},add:i,drain:a}}const dD=60*1e3;function hD(e,t=Iu()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const s=Date.parse(`${e}`);return isNaN(s)?dD:s-t}function pD(e,t){return e[t]||e.all||0}function mD(e,t,n=Iu()){return pD(e,t)>n}function gD(e,{statusCode:t,headers:n},s=Iu()){const i={...e},a=n?.["x-sentry-rate-limits"],l=n?.["retry-after"];if(a)for(const f of a.trim().split(",")){const[d,p,,,g]=f.split(":",5),y=parseInt(d,10),b=(isNaN(y)?60:y)*1e3;if(!p)i.all=s+b;else for(const x of p.split(";"))x==="metric_bucket"?(!g||g.split(";").includes("custom"))&&(i[x]=s+b):i[x]=s+b}else l?i.all=s+hD(l,s):t===429&&(i.all=s+60*1e3);return i}const YR=64;function yD(e,t,n=lb(e.bufferSize||YR)){let s={};const i=l=>n.drain(l);function a(l){const f=[];if(Wy(l,(y,b)=>{const x=Nw(b);mD(s,x)?e.recordDroppedEvent("ratelimit_backoff",x):f.push(y)}),f.length===0)return Promise.resolve({});const d=ma(l[0],f),p=y=>{if(JI(d,["client_report"])){Ce&&be.warn(`Dropping client report. Will not send outcomes (reason: ${y}).`);return}Wy(d,(b,x)=>{e.recordDroppedEvent(y,Nw(x))})},g=()=>t({body:eP(d)}).then(y=>y.statusCode===413?(Ce&&be.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),p("send_error"),y):(Ce&&y.statusCode!==void 0&&(y.statusCode<200||y.statusCode>=300)&&be.warn(`Sentry responded with status code ${y.statusCode} to sent event.`),s=gD(s,y),y),y=>{throw p("network_error"),Ce&&be.error("Encountered error running transport request:",y),y});return n.add(g).then(y=>y,y=>{if(y===cb)return Ce&&be.error("Skipped sending event because buffer is full."),p("queue_overflow"),Promise.resolve({});throw y})}return{send:a,flush:i}}function vD(e,t,n){const s=[{type:"client_report"},{timestamp:pa(),discarded_events:e}];return ma(t?{dsn:t}:{},[s])}function XR(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function bD(e){const{trace_id:t,parent_span_id:n,span_id:s,status:i,origin:a,data:l,op:f}=e.contexts?.trace??{};return{data:l??{},description:e.transaction,op:f,parent_span_id:n,span_id:s??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:a,profile_id:l?.[Xv],exclusive_time:l?.[Kc],measurements:e.measurements,is_segment:!0}}function xD(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[Xv]:e.profile_id},...e.exclusive_time&&{[Kc]:e.exclusive_time}}}},measurements:e.measurements}}const Fw="Not capturing exception because it's already been captured.",Hw="Discarded session because of missing or non-string release",QR=Symbol.for("SentryInternalError"),WR=Symbol.for("SentryDoNotSendEventError"),SD=5e3;function eh(e){return{message:e,[QR]:!0}}function Zg(e){return{message:e,[WR]:!0}}function qw(e){return!!e&&typeof e=="object"&&QR in e}function Vw(e){return!!e&&typeof e=="object"&&WR in e}function Kw(e,t,n,s,i){let a=0,l,f=!1;e.on(n,()=>{a=0,clearTimeout(l),f=!1}),e.on(t,d=>{a+=s(d),a>=8e5?i(e):f||(f=!0,l=ZR(setTimeout(()=>{i(e)},SD)))}),e.on("flush",()=>{i(e)})}class _D{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=lb(t.transportOptions?.bufferSize??YR),t.dsn?this._dsn=II(t.dsn):Ce&&be.warn("No DSN provided, client will not send events."),this._dsn){const s=KP(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:s})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&Kw(this,"afterCaptureLog","flushLogs",CD,vh),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Kw(this,"afterCaptureMetric","flushMetrics",TD,ib)}captureException(t,n,s){const i=qr();if(bw(t))return Ce&&be.log(Fw),i;const a={event_id:i,...n};return this._process(()=>this.eventFromException(t,a).then(l=>this._captureEvent(l,a,s)).then(l=>l),"error"),a.event_id}captureMessage(t,n,s,i){const a={event_id:qr(),...s},l=np(t)?t:String(t),f=Cc(t),d=f?this.eventFromMessage(l,n,a):this.eventFromException(t,a);return this._process(()=>d.then(p=>this._captureEvent(p,a,i)),f?"unknown":"error"),a.event_id}captureEvent(t,n,s){const i=qr();if(n?.originalException&&bw(n.originalException))return Ce&&be.log(Fw),i;const a={event_id:i,...n},l=t.sdkProcessingMetadata||{},f=l.capturedSpanScope,d=l.capturedSpanIsolationScope,p=Gw(t.type);return this._process(()=>this._captureEvent(t,a,f||s,d),p),a.event_id}captureSession(t){this.sendSession(t),Nc(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){const n=this._transport;if(!n)return!0;this.emit("flush");const s=await this._isClientDoneProcessing(t),i=await n.flush(t);return s&&i}async close(t){vh(this);const n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){const n=this._integrations[t.name];qR(this,t,this._integrations),n||Bw(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let s=cP(t,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])s=WI(s,rP(i));this.sendEnvelope(s).then(i=>this.emit("afterSendEvent",t,i))}sendSession(t){const{release:n,environment:s=eb}=this._options;if("aggregates"in t){const a=t.attrs||{};if(!a.release&&!n){Ce&&be.warn(Hw);return}a.release=a.release||n,a.environment=a.environment||s,t.attrs=a}else{if(!t.release&&!n){Ce&&be.warn(Hw);return}t.release=t.release||n,t.environment=t.environment||s}this.emit("beforeSendSession",t);const i=aP(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(t,n,s=1){if(this._options.sendClientReports){const i=`${t}:${n}`;Ce&&be.log(`Recording outcome: "${i}"${s>1?` (${s} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+s}}on(t,n){const s=this._hooks[t]=this._hooks[t]||new Set,i=(...a)=>n(...a);return s.add(i),()=>{s.delete(i)}}emit(t,...n){const s=this._hooks[t];s&&s.forEach(i=>i(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return Ce&&be.error("Error while sending envelope:",n),{}}return Ce&&be.error("Transport disabled"),{}}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=YP(this,t),Bw(this,t)}_updateSessionFromEvent(t,n){let s=n.level==="fatal",i=!1;const a=n.exception?.values;if(a){i=!0,s=!1;for(const d of a)if(d.mechanism?.handled===!1){s=!0;break}}const l=t.status==="ok";(l&&t.errors===0||l&&s)&&(Nc(t,{...s&&{status:"crashed"},errors:t.errors||Number(i||s)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(s=>setTimeout(s,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,s,i){const a=this.getOptions(),l=Object.keys(this._integrations);return!n.integrations&&l?.length&&(n.integrations=l),this.emit("preprocessEvent",t,n),t.type||i.setLastEventId(t.event_id||n.event_id),MP(a,t,n,s,this,i).then(f=>{if(f===null)return f;this.emit("postprocessEvent",f,n),f.contexts={trace:mR(s),...f.contexts};const d=tb(this,s);return f.sdkProcessingMetadata={dynamicSamplingContext:d,...f.sdkProcessingMetadata},f})}_captureEvent(t,n={},s=bt(),i=Zr()){return Ce&&tv(t)&&be.log(`Captured error event \`${XR(t)[0]||"<unknown>"}\``),this._processEvent(t,n,s,i).then(a=>a.event_id,a=>{Ce&&(Vw(a)?be.log(a.message):qw(a)?be.warn(a.message):be.warn(a))})}_processEvent(t,n,s,i){const a=this.getOptions(),{sampleRate:l}=a,f=JR(t),d=tv(t),g=`before send for type \`${t.type||"error"}\``,y=typeof l>"u"?void 0:bu(l);if(d&&typeof y=="number"&&Vo()>y)return this.recordDroppedEvent("sample_rate","error"),sb(Zg(`Discarding event because it's not included in the random sample (sampling rate = ${l})`));const b=Gw(t.type);return this._prepareEvent(t,n,s,i).then(x=>{if(x===null)throw this.recordDroppedEvent("event_processor",b),Zg("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return x;const w=ED(this,a,x,n);return wD(w,g)}).then(x=>{if(x===null){if(this.recordDroppedEvent("before_send",b),f){const C=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",C)}throw Zg(`${g} returned \`null\`, will not send event.`)}const S=s.getSession()||i.getSession();if(d&&S&&this._updateSessionFromEvent(S,x),f){const T=x.sdkProcessingMetadata?.spanCountBeforeProcessing||0,C=x.spans?x.spans.length:0,k=T-C;k>0&&this.recordDroppedEvent("before_send","span",k)}const w=x.transaction_info;if(f&&w&&x.transaction!==t.transaction){const T="custom";x.transaction_info={...w,source:T}}return this.sendEvent(x,n),x}).then(null,x=>{throw Vw(x)||qw(x)?x:(this.captureException(x,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:x}),eh(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
10
|
-
Reason: ${x}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(s=>(this._numProcessing--,s),s=>(this._numProcessing--,s===cb&&this.recordDroppedEvent("queue_overflow",n),s))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,s])=>{const[i,a]=n.split(":");return{reason:i,category:a,quantity:s}})}_flushOutcomes(){Ce&&be.log("Flushing outcomes...");const t=this._clearOutcomes();if(t.length===0){Ce&&be.log("No outcomes to send");return}if(!this._dsn){Ce&&be.log("No dsn provided, will not send outcomes");return}Ce&&be.log("Sending outcomes:",t);const n=
|
|
11
|
-
Event: ${Ki(e)}`),!0}else{if(
|
|
12
|
-
Event: ${Ki(e)}`),!0;if(
|
|
13
|
-
Event: ${Ki(e)}`),!0;if(
|
|
9
|
+
`)}`)}function fP(e){if(!Ce)return;const{description:t="< unknown name >",op:n="< unknown op >"}=yt(e),{spanId:s}=e.spanContext(),a=Dn(e)===e,l=`[Tracing] Finishing "${n}" ${a?"root ":""}span "${t}" with ID ${s}`;be.log(l)}function dP(e,t,n,s=Xn()){const i=s&&Dn(s);i&&(Ce&&be.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[Lu]:t,[zu]:n}))}function jw(e){if(!e||e.length===0)return;const t={};return e.forEach(n=>{const s=n.attributes||{},i=s[zu],a=s[Lu];typeof i=="string"&&typeof a=="number"&&(t[n.name]={value:a,unit:i})}),t}const Aw=1e3;class sp{constructor(t={}){this._traceId=t.traceId||Ws(),this._spanId=t.spanId||Zs(),this._startTime=t.startTimestamp||cn(),this._links=t.links,this._attributes={},this.setAttributes({[gn]:"manual",[eo]:t.op,...t.attributes}),this._name=t.name,t.parentSpanId&&(this._parentSpanId=t.parentSpanId),"sampled"in t&&(this._sampled=t.sampled),t.endTimestamp&&(this._endTime=t.endTimestamp),this._events=[],this._isStandaloneSpan=t.isStandalone,this._endTime&&this._onSpanEnded()}addLink(t){return this._links?this._links.push(t):this._links=[t],this}addLinks(t){return this._links?this._links.push(...t):this._links=t,this}recordException(t,n){}spanContext(){const{_spanId:t,_traceId:n,_sampled:s}=this;return{spanId:t,traceId:n,traceFlags:s?Jv:TR}}setAttribute(t,n){return n===void 0?delete this._attributes[t]:this._attributes[t]=n,this}setAttributes(t){return Object.keys(t).forEach(n=>this.setAttribute(n,t[n])),this}updateStartTime(t){this._startTime=Ji(t)}setStatus(t){return this._status=t,this}updateName(t){return this._name=t,this.setAttribute(vs,"custom"),this}end(t){this._endTime||(this._endTime=Ji(t),fP(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[eo],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:NR(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[gn],profile_id:this._attributes[Xv],exclusive_time:this._attributes[Kc],measurements:jw(this._events),is_segment:this._isStandaloneSpan&&Dn(this)===this||void 0,segment_id:this._isStandaloneSpan?Dn(this).spanContext().spanId:void 0,links:RR(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,s){Ce&&be.log("[Tracing] Adding an event to span:",t);const i=kw(n)?n:s||cn(),a=kw(n)?{}:n||{},l={name:t,time:Ji(i),attributes:a};return this._events.push(l),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const t=vt();if(t&&t.emit("spanEnd",this),!(this._isStandaloneSpan||this===Dn(this)))return;if(this._isStandaloneSpan){this._sampled?pP(lP([this],t)):(Ce&&be.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}const s=this._convertSpanToTransaction();s&&(mh(this).scope||bt()).captureEvent(s)}_convertSpanToTransaction(){if(!Ow(yt(this)))return;this._name||(Ce&&be.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:t,isolationScope:n}=mh(this),s=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;const a=Qd(this).filter(g=>g!==this&&!hP(g)).map(g=>yt(g)).filter(Ow),l=this._attributes[vs];delete this._attributes[_w],a.forEach(g=>{delete g.data[_w]});const f={contexts:{trace:LI(this)},spans:a.length>Aw?a.sort((g,y)=>g.start_timestamp-y.start_timestamp).slice(0,Aw):a,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:to(this)},request:s,...l&&{transaction_info:{source:l}}},d=jw(this._events);return d&&Object.keys(d).length&&(Ce&&be.log("[Measurements] Adding measurements to transaction event",JSON.stringify(d,void 0,2)),f.measurements=d),f}}function kw(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function Ow(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function hP(e){return e instanceof sp&&e.isStandaloneSpan()}function pP(e){const t=vt();if(!t)return;const n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function mP(e,t,n=()=>{},s=()=>{}){let i;try{i=e()}catch(a){throw t(a),n(),a}return gP(i,t,n,s)}function gP(e,t,n,s){return qc(e)?e.then(i=>(n(),s(i),i),i=>{throw t(i),n(),i}):(n(),s(e),e)}function yP(e,t,n){if(!ss(e))return[!1];let s,i;typeof e.tracesSampler=="function"?(i=e.tracesSampler({...t,inheritOrSampleWith:f=>typeof t.parentSampleRate=="number"?t.parentSampleRate:typeof t.parentSampled=="boolean"?Number(t.parentSampled):f}),s=!0):t.parentSampled!==void 0?i=t.parentSampled:typeof e.tracesSampleRate<"u"&&(i=e.tracesSampleRate,s=!0);const a=bu(i);if(a===void 0)return Ce&&be.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!a)return Ce&&be.log(`[Tracing] Discarding transaction because ${typeof e.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,a,s];const l=n<a;return l||Ce&&be.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[l,a,s]}const IR="__SENTRY_SUPPRESS_TRACING__";function PR(e,t){const n=rb();if(n.startSpan)return n.startSpan(e,t);const s=zR(e),{forceTransaction:i,parentSpan:a,scope:l}=e,f=l?.clone();return Du(f,()=>bP(a)(()=>{const p=bt(),g=LR(p,a),b=e.onlyIfParent&&!g?new ei:DR({parentSpan:g,spanArguments:s,forceTransaction:i,scope:p});return jc(p,b),mP(()=>t(b),()=>{const{status:x}=yt(b);b.isRecording()&&(!x||x==="ok")&&b.setStatus({code:hn,message:"internal_error"})},()=>{b.end()})}))}function Zc(e){const t=rb();if(t.startInactiveSpan)return t.startInactiveSpan(e);const n=zR(e),{forceTransaction:s,parentSpan:i}=e;return(e.scope?l=>Du(e.scope,l):i!==void 0?l=>nb(i,l):l=>l())(()=>{const l=bt(),f=LR(l,i);return e.onlyIfParent&&!f?new ei:DR({parentSpan:f,spanArguments:n,forceTransaction:s,scope:l})})}function nb(e,t){const n=rb();return n.withActiveSpan?n.withActiveSpan(e,t):Du(s=>(jc(s,e||void 0),t(s)))}function DR({parentSpan:e,spanArguments:t,forceTransaction:n,scope:s}){if(!ss()){const l=new ei;if(n||!e){const f={sampled:"false",sample_rate:"0",transaction:t.name,...to(l)};Wd(l,f)}return l}const i=Zr();let a;if(e&&!n)a=vP(e,s,t),jR(e,a);else if(e){const l=to(e),{traceId:f,spanId:d}=e.spanContext(),p=ui(e);a=Mw({traceId:f,parentSpanId:d,...t},s,p),Wd(a,l)}else{const{traceId:l,dsc:f,parentSpanId:d,sampled:p}={...i.getPropagationContext(),...s.getPropagationContext()};a=Mw({traceId:l,parentSpanId:d,...t},s,p),f&&Wd(a,f)}return uP(a),SI(a,s,i),a}function zR(e){const n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){const s={...n};return s.startTimestamp=Ji(e.startTime),delete s.startTime,s}return n}function rb(){const e=da();return Vc(e)}function Mw(e,t,n){const s=vt(),i=s?.getOptions()||{},{name:a=""}=e,l={spanAttributes:{...e.attributes},spanName:a,parentSampled:n};s?.emit("beforeSampling",l,{decision:!1});const f=l.parentSampled??n,d=l.spanAttributes,p=t.getPropagationContext(),[g,y,b]=t.getScopeData().sdkProcessingMetadata[IR]?[!1]:yP(i,{name:a,parentSampled:f,attributes:d,parentSampleRate:bu(p.dsc?.sample_rate)},p.sampleRand),x=new sp({...e,attributes:{[vs]:"custom",[Yv]:y!==void 0&&b?y:void 0,...d},sampled:g});return!g&&s&&(Ce&&be.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),s.recordDroppedEvent("sample_rate","transaction")),s&&s.emit("spanStart",x),x}function vP(e,t,n){const{spanId:s,traceId:i}=e.spanContext(),a=t.getScopeData().sdkProcessingMetadata[IR]?!1:ui(e),l=a?new sp({...n,parentSpanId:s,traceId:i,sampled:a}):new ei({traceId:i});jR(e,l);const f=vt();return f&&(f.emit("spanStart",l),n.endTimestamp&&f.emit("spanEnd",l)),l}function LR(e,t){if(t)return t;if(t===null)return;const n=Ac(e);if(!n)return;const s=vt();return(s?s.getOptions():{}).parentSpanIsAlwaysRootSpan?Dn(n):n}function bP(e){return e!==void 0?t=>nb(e,t):t=>t()}const Jd={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},xP="heartbeatFailed",SP="idleTimeout",_P="finalTimeout",wP="externalFinish";function UR(e,t={}){const n=new Map;let s=!1,i,a=wP,l=!t.disableAutoFinish;const f=[],{idleTimeout:d=Jd.idleTimeout,finalTimeout:p=Jd.finalTimeout,childSpanTimeout:g=Jd.childSpanTimeout,beforeSpanEnd:y,trimIdleSpanEndTimestamp:b=!0}=t,x=vt();if(!x||!ss()){const j=new ei,A={sample_rate:"0",sampled:"false",...to(j)};return Wd(j,A),j}const S=bt(),w=Xn(),T=EP(e);T.end=new Proxy(T.end,{apply(j,A,P){if(y&&y(T),A instanceof ei)return;const[G,...B]=P,z=G||cn(),Q=Ji(z),Y=Qd(T).filter(U=>U!==T),ee=yt(T);if(!Y.length||!b)return L(Q),Reflect.apply(j,A,[Q,...B]);const D=x.getOptions().ignoreSpans,K=Y?.reduce((U,I)=>{const H=yt(I);return!H.timestamp||D&&gh(H,D)?U:U?Math.max(U,H.timestamp):H.timestamp},void 0),q=ee.start_timestamp,V=Math.min(q?q+p/1e3:1/0,Math.max(q||-1/0,Math.min(Q,K||1/0)));return L(V),Reflect.apply(j,A,[V,...B])}});function C(){i&&(clearTimeout(i),i=void 0)}function k(j){C(),i=setTimeout(()=>{!s&&n.size===0&&l&&(a=SP,T.end(j))},d)}function N(j){i=setTimeout(()=>{!s&&l&&(a=xP,T.end(j))},g)}function R(j){C(),n.set(j,!0);const A=cn();N(A+g/1e3)}function M(j){if(n.has(j)&&n.delete(j),n.size===0){const A=cn();k(A+d/1e3)}}function L(j){s=!0,n.clear(),f.forEach(Y=>Y()),jc(S,w);const A=yt(T),{start_timestamp:P}=A;if(!P)return;A.data[vu]||T.setAttribute(vu,a);const B=A.status;(!B||B==="unknown")&&T.setStatus({code:Qv}),be.log(`[Tracing] Idle span "${A.op}" finished`);const z=Qd(T).filter(Y=>Y!==T);let Q=0;z.forEach(Y=>{Y.isRecording()&&(Y.setStatus({code:hn,message:"cancelled"}),Y.end(j),Ce&&be.log("[Tracing] Cancelling span since span ended early",JSON.stringify(Y,void 0,2)));const ee=yt(Y),{timestamp:D=0,start_timestamp:K=0}=ee,q=K<=j,V=(p+d)/1e3,U=D-K<=V;if(Ce){const I=JSON.stringify(Y,void 0,2);q?U||be.log("[Tracing] Discarding span since it finished after idle span final timeout",I):be.log("[Tracing] Discarding span since it happened after idle span was finished",I)}(!U||!q)&&(HI(T,Y),Q++)}),Q>0&&T.setAttribute("sentry.idle_span_discarded_spans",Q)}return f.push(x.on("spanStart",j=>{if(s||j===T||yt(j).timestamp||j instanceof sp&&j.isStandaloneSpan())return;Qd(T).includes(j)&&R(j.spanContext().spanId)})),f.push(x.on("spanEnd",j=>{s||M(j.spanContext().spanId)})),f.push(x.on("idleSpanEnableAutoFinish",j=>{j===T&&(l=!0,k(),n.size&&N())})),t.disableAutoFinish||k(),setTimeout(()=>{s||(T.setStatus({code:hn,message:"deadline_exceeded"}),a=_P,T.end())},p),T}function EP(e){const t=Zc(e);return jc(bt(),t),Ce&&be.log("[Tracing] Started span is an idle span"),t}const Kg=0,Iw=1,Pw=2;function Uu(e){return new xu(t=>{t(e)})}function sb(e){return new xu((t,n)=>{n(e)})}class xu{constructor(t){this._state=Kg,this._handlers=[],this._runExecutor(t)}then(t,n){return new xu((s,i)=>{this._handlers.push([!1,a=>{if(!t)s(a);else try{s(t(a))}catch(l){i(l)}},a=>{if(!n)i(a);else try{s(n(a))}catch(l){i(l)}}]),this._executeHandlers()})}catch(t){return this.then(n=>n,t)}finally(t){return new xu((n,s)=>{let i,a;return this.then(l=>{a=!1,i=l,t&&t()},l=>{a=!0,i=l,t&&t()}).then(()=>{if(a){s(i);return}n(i)})})}_executeHandlers(){if(this._state===Kg)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===Iw&&n[1](this._value),this._state===Pw&&n[2](this._value),n[0]=!0)})}_runExecutor(t){const n=(a,l)=>{if(this._state===Kg){if(qc(l)){l.then(s,i);return}this._state=a,this._value=l,this._executeHandlers()}},s=a=>{n(Iw,a)},i=a=>{n(Pw,a)};try{t(s,i)}catch(a){i(a)}}}function TP(e,t,n,s=0){try{const i=ev(t,n,e,s);return qc(i)?i:Uu(i)}catch(i){return sb(i)}}function ev(e,t,n,s){const i=n[s];if(!e||!i)return e;const a=i({...e},t);return Ce&&a===null&&be.log(`Event processor "${i.id||"?"}" dropped event`),qc(a)?a.then(l=>ev(l,t,n,s+1)):ev(a,t,n,s+1)}let Bi,Dw,zw,zo;function CP(e){const t=ct._sentryDebugIds,n=ct._debugIds;if(!t&&!n)return{};const s=t?Object.keys(t):[],i=n?Object.keys(n):[];if(zo&&s.length===Dw&&i.length===zw)return zo;Dw=s.length,zw=i.length,zo={},Bi||(Bi={});const a=(l,f)=>{for(const d of l){const p=f[d],g=Bi?.[d];if(g&&zo&&p)zo[g[0]]=p,Bi&&(Bi[d]=[g[0],p]);else if(p){const y=e(d);for(let b=y.length-1;b>=0;b--){const S=y[b]?.filename;if(S&&zo&&Bi){zo[S]=p,Bi[d]=[S,p];break}}}}};return t&&a(s,t),n&&a(i,n),zo}function RP(e,t){const{fingerprint:n,span:s,breadcrumbs:i,sdkProcessingMetadata:a}=t;NP(e,t),s&&kP(e,s),OP(e,n),jP(e,i),AP(e,a)}function Lw(e,t){const{extra:n,tags:s,attributes:i,user:a,contexts:l,level:f,sdkProcessingMetadata:d,breadcrumbs:p,fingerprint:g,eventProcessors:y,attachments:b,propagationContext:x,transactionName:S,span:w}=t;Wl(e,"extra",n),Wl(e,"tags",s),Wl(e,"attributes",i),Wl(e,"user",a),Wl(e,"contexts",l),e.sdkProcessingMetadata=Pu(e.sdkProcessingMetadata,d,2),f&&(e.level=f),S&&(e.transactionName=S),w&&(e.span=w),p.length&&(e.breadcrumbs=[...e.breadcrumbs,...p]),g.length&&(e.fingerprint=[...e.fingerprint,...g]),y.length&&(e.eventProcessors=[...e.eventProcessors,...y]),b.length&&(e.attachments=[...e.attachments,...b]),e.propagationContext={...e.propagationContext,...x}}function Wl(e,t,n){e[t]=Pu(e[t],n,1)}function op(e,t){const n=pI().getScopeData();return e&&Lw(n,e.getScopeData()),t&&Lw(n,t.getScopeData()),n}function NP(e,t){const{extra:n,tags:s,user:i,contexts:a,level:l,transactionName:f}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(s).length&&(e.tags={...s,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),l&&(e.level=l),f&&e.type!=="transaction"&&(e.transaction=f)}function jP(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function AP(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function kP(e,t){e.contexts={trace:CR(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:to(t),...e.sdkProcessingMetadata};const n=Dn(t),s=yt(n).description;s&&!e.transaction&&e.type==="transaction"&&(e.transaction=s)}function OP(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function MP(e,t,n,s,i,a){const{normalizeDepth:l=3,normalizeMaxBreadth:f=1e3}=e,d={...t,event_id:t.event_id||n.event_id||qr(),timestamp:t.timestamp||pa()},p=n.integrations||e.integrations.map(C=>C.name);IP(d,e),zP(d,p),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&PP(d,e.stackParser);const g=UP(s,n.captureContext);n.mechanism&&Rc(d,n.mechanism);const y=i?i.getEventProcessors():[],b=op(a,g),x=[...n.attachments||[],...b.attachments];x.length&&(n.attachments=x),RP(d,b);const S=[...y,...b.eventProcessors];return(n.data&&n.data.__sentry__===!0?Uu(d):TP(S,d,n)).then(C=>(C&&DP(C),typeof l=="number"&&l>0?LP(C,l,f):C))}function IP(e,t){const{environment:n,release:s,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||eb,!e.release&&s&&(e.release=s),!e.dist&&i&&(e.dist=i);const l=e.request;l?.url&&a&&(l.url=Ky(l.url,a)),a&&e.exception?.values?.forEach(f=>{f.value&&(f.value=Ky(f.value,a))})}function PP(e,t){const n=CP(t);e.exception?.values?.forEach(s=>{s.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=n[i.filename])})})}function DP(e){const t={};if(e.exception?.values?.forEach(s=>{s.stacktrace?.frames?.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.entries(t).forEach(([s,i])=>{n.push({type:"sourcemap",code_file:s,debug_id:i})})}function zP(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function LP(e,t,n){if(!e)return null;const s={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:Vs(i.data,t,n)}}))},...e.user&&{user:Vs(e.user,t,n)},...e.contexts&&{contexts:Vs(e.contexts,t,n)},...e.extra&&{extra:Vs(e.extra,t,n)}};return e.contexts?.trace&&s.contexts&&(s.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(s.contexts.trace.data=Vs(e.contexts.trace.data,t,n))),e.spans&&(s.spans=e.spans.map(i=>({...i,...i.data&&{data:Vs(i.data,t,n)}}))),e.contexts?.flags&&s.contexts&&(s.contexts.flags=Vs(e.contexts.flags,3,n)),s}function UP(e,t){if(!t)return e;const n=e?e.clone():new Js;return n.update(t),n}function $R(e,t){return bt().captureException(e,void 0)}function BR(e,t){return bt().captureEvent(e,t)}function $P(e,t){Zr().setContext(e,t)}function BP(){const e=vt();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Uw(e){const t=Zr(),{user:n}=op(t,bt()),{userAgent:s}=ct.navigator||{},i=sI({user:n,...s&&{userAgent:s},...e}),a=t.getSession();return a?.status==="ok"&&Nc(a,{status:"exited"}),FR(),t.setSession(i),i}function FR(){const e=Zr(),n=bt().getSession()||e.getSession();n&&oI(n),HR(),e.setSession()}function HR(){const e=Zr(),t=vt(),n=e.getSession();n&&t&&t.captureSession(n)}function Gg(e=!1){if(e){FR();return}HR()}const FP="7";function HP(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function qP(e){return`${HP(e)}${e.projectId}/envelope/`}function VP(e,t){const n={sentry_version:FP};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function KP(e,t,n){return t||`${qP(e)}?${VP(e,n)}`}const $w=[];function GP(e){const t={};return e.forEach(n=>{const{name:s}=n,i=t[s];i&&!i.isDefaultInstance&&n.isDefaultInstance||(t[s]=n)}),Object.values(t)}function ZP(e){const t=e.defaultIntegrations||[],n=e.integrations;t.forEach(i=>{i.isDefaultInstance=!0});let s;if(Array.isArray(n))s=[...t,...n];else if(typeof n=="function"){const i=n(t);s=Array.isArray(i)?i:[i]}else s=t;return GP(s)}function YP(e,t){const n={};return t.forEach(s=>{s&&qR(e,s,n)}),n}function Bw(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function qR(e,t,n){if(n[t.name]){Ce&&be.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!$w.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),$w.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){const s=t.preprocessEvent.bind(t);e.on("preprocessEvent",(i,a)=>s(i,a,e))}if(typeof t.processEvent=="function"){const s=t.processEvent.bind(t),i=Object.assign((a,l)=>s(a,l,e),{id:t.name});e.addEventProcessor(i)}Ce&&be.log(`Integration installed: ${t.name}`)}function XP(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function QP(e,t){const{value:n,unit:s}=XP(e)?e:{value:e,unit:void 0},i=WP(n),a=s&&typeof s=="string"?{unit:s}:{};if(i)return{...i,...a};if(!t||t==="skip-undefined"&&n===void 0)return;let l="";try{l=JSON.stringify(n)??""}catch{}return{value:l,type:"string",...a}}function yh(e,t=!1){const n={};for(const[s,i]of Object.entries(e??{})){const a=QP(i,t);a&&(n[s]=a)}return n}function WP(e){const t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}function VR(e,t){return t?Du(t,()=>{const n=Xn(),s=n?CR(n):mR(t);return[n?to(n):tb(e,t),s]}):[void 0,void 0]}const JP={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function e2(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function t2(e,t,n,s){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&s&&(i.dsn=Gc(s)),ma(i,[e2(e)])}const n2=100;function ps(e,t,n,s=!0){n&&(!e[t]||s)&&(e[t]=n)}function r2(e,t){const n=ob(),s=KR(e);s===void 0?n.set(e,[t]):s.length>=n2?(vh(e,s),n.set(e,[t])):n.set(e,[...s,t])}function s2(e,t=bt(),n=r2){const s=t?.getClient()??vt();if(!s){Ce&&be.warn("No client available to capture log.");return}const{release:i,environment:a,enableLogs:l=!1,beforeSendLog:f}=s.getOptions();if(!l){Ce&&be.warn("logging option not enabled, log will not be captured.");return}const[,d]=VR(s,t),p={...e.attributes},{user:{id:g,email:y,username:b},attributes:x={}}=op(Zr(),t);ps(p,"user.id",g,!1),ps(p,"user.email",y,!1),ps(p,"user.name",b,!1),ps(p,"sentry.release",i),ps(p,"sentry.environment",a);const{name:S,version:w}=s.getSdkMetadata()?.sdk??{};ps(p,"sentry.sdk.name",S),ps(p,"sentry.sdk.version",w);const T=s.getIntegrationByName("Replay"),C=T?.getReplayId(!0);ps(p,"sentry.replay_id",C),C&&T?.getRecordingMode()==="buffer"&&ps(p,"sentry._internal.replay_is_buffering",!0);const k=e.message;if(np(k)){const{__sentry_template_string__:B,__sentry_template_values__:z=[]}=k;z?.length&&(p["sentry.message.template"]=B),z.forEach((Q,Y)=>{p[`sentry.message.parameter.${Y}`]=Q})}const N=Ac(t);ps(p,"sentry.trace.parent_span_id",N?.spanContext().spanId);const R={...e,attributes:p};s.emit("beforeCaptureLog",R);const M=f?ha(()=>f(R)):R;if(!M){s.recordDroppedEvent("before_send","log_item",1),Ce&&be.warn("beforeSendLog returned null, log will not be captured.");return}const{level:L,message:j,attributes:A={},severityNumber:P}=M,G={timestamp:cn(),level:L,body:j,trace_id:d?.trace_id,severity_number:P??JP[L],attributes:{...yh(x),...yh(A,!0)}};n(s,G),s.emit("afterCaptureLog",M)}function vh(e,t){const n=t??KR(e)??[];if(n.length===0)return;const s=e.getOptions(),i=t2(n,s._metadata,s.tunnel,e.getDsn());ob().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function KR(e){return ob().get(e)}function ob(){return Fc("clientToLogBufferMap",()=>new WeakMap)}function o2(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function i2(e,t,n,s){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&s&&(i.dsn=Gc(s)),ma(i,[o2(e)])}const a2=1e3;function Fs(e,t,n,s=!0){n&&(s||!(t in e))&&(e[t]=n)}function c2(e,t){const n=ab(),s=GR(e);s===void 0?n.set(e,[t]):s.length>=a2?(ib(e,s),n.set(e,[t])):n.set(e,[...s,t])}function l2(e,t,n){const{release:s,environment:i}=t.getOptions(),a={...e.attributes};Fs(a,"user.id",n.id,!1),Fs(a,"user.email",n.email,!1),Fs(a,"user.name",n.username,!1),Fs(a,"sentry.release",s),Fs(a,"sentry.environment",i);const{name:l,version:f}=t.getSdkMetadata()?.sdk??{};Fs(a,"sentry.sdk.name",l),Fs(a,"sentry.sdk.version",f);const d=t.getIntegrationByName("Replay"),p=d?.getReplayId(!0);return Fs(a,"sentry.replay_id",p),p&&d?.getRecordingMode()==="buffer"&&Fs(a,"sentry._internal.replay_is_buffering",!0),{...e,attributes:a}}function u2(e,t,n,s){const[,i]=VR(t,n),a=Ac(n),l=a?a.spanContext().traceId:i?.trace_id,f=a?a.spanContext().spanId:void 0;return{timestamp:cn(),trace_id:l??"",span_id:f,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...yh(s),...yh(e.attributes,"skip-undefined")}}}function f2(e,t){const n=t?.scope??bt(),s=t?.captureSerializedMetric??c2,i=n?.getClient()??vt();if(!i){Ce&&be.warn("No client available to capture metric.");return}const{_experiments:a,enableMetrics:l,beforeSendMetric:f}=i.getOptions();if(!(l??a?.enableMetrics??!0)){Ce&&be.warn("metrics option not enabled, metric will not be captured.");return}const{user:p,attributes:g}=op(Zr(),n),y=l2(e,i,p);i.emit("processMetric",y);const b=f||a?.beforeSendMetric,x=b?b(y):y;if(!x){Ce&&be.log("`beforeSendMetric` returned `null`, will not send metric.");return}const S=u2(x,i,n,g);Ce&&be.log("[Metric]",S),s(i,S),i.emit("afterCaptureMetric",x)}function ib(e,t){const n=t??GR(e)??[];if(n.length===0)return;const s=e.getOptions(),i=i2(n,s._metadata,s.tunnel,e.getDsn());ab().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function GR(e){return ab().get(e)}function ab(){return Fc("clientToMetricBufferMap",()=>new WeakMap)}function ZR(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}const cb=Symbol.for("SentryBufferFullError");function lb(e=100){const t=new Set;function n(){return t.size<e}function s(l){t.delete(l)}function i(l){if(!n())return sb(cb);const f=l();return t.add(f),f.then(()=>s(f),()=>s(f)),f}function a(l){if(!t.size)return Uu(!0);const f=Promise.allSettled(Array.from(t)).then(()=>!0);if(!l)return f;const d=[f,new Promise(p=>ZR(setTimeout(()=>p(!1),l)))];return Promise.race(d)}return{get $(){return Array.from(t)},add:i,drain:a}}const d2=60*1e3;function h2(e,t=Iu()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const s=Date.parse(`${e}`);return isNaN(s)?d2:s-t}function p2(e,t){return e[t]||e.all||0}function m2(e,t,n=Iu()){return p2(e,t)>n}function g2(e,{statusCode:t,headers:n},s=Iu()){const i={...e},a=n?.["x-sentry-rate-limits"],l=n?.["retry-after"];if(a)for(const f of a.trim().split(",")){const[d,p,,,g]=f.split(":",5),y=parseInt(d,10),b=(isNaN(y)?60:y)*1e3;if(!p)i.all=s+b;else for(const x of p.split(";"))x==="metric_bucket"?(!g||g.split(";").includes("custom"))&&(i[x]=s+b):i[x]=s+b}else l?i.all=s+h2(l,s):t===429&&(i.all=s+60*1e3);return i}const YR=64;function y2(e,t,n=lb(e.bufferSize||YR)){let s={};const i=l=>n.drain(l);function a(l){const f=[];if(Wy(l,(y,b)=>{const x=Nw(b);m2(s,x)?e.recordDroppedEvent("ratelimit_backoff",x):f.push(y)}),f.length===0)return Promise.resolve({});const d=ma(l[0],f),p=y=>{if(JI(d,["client_report"])){Ce&&be.warn(`Dropping client report. Will not send outcomes (reason: ${y}).`);return}Wy(d,(b,x)=>{e.recordDroppedEvent(y,Nw(x))})},g=()=>t({body:eP(d)}).then(y=>y.statusCode===413?(Ce&&be.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),p("send_error"),y):(Ce&&y.statusCode!==void 0&&(y.statusCode<200||y.statusCode>=300)&&be.warn(`Sentry responded with status code ${y.statusCode} to sent event.`),s=g2(s,y),y),y=>{throw p("network_error"),Ce&&be.error("Encountered error running transport request:",y),y});return n.add(g).then(y=>y,y=>{if(y===cb)return Ce&&be.error("Skipped sending event because buffer is full."),p("queue_overflow"),Promise.resolve({});throw y})}return{send:a,flush:i}}function v2(e,t,n){const s=[{type:"client_report"},{timestamp:pa(),discarded_events:e}];return ma(t?{dsn:t}:{},[s])}function XR(e){const t=[];e.message&&t.push(e.message);try{const n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function b2(e){const{trace_id:t,parent_span_id:n,span_id:s,status:i,origin:a,data:l,op:f}=e.contexts?.trace??{};return{data:l??{},description:e.transaction,op:f,parent_span_id:n,span_id:s??"",start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??"",origin:a,profile_id:l?.[Xv],exclusive_time:l?.[Kc],measurements:e.measurements,is_segment:!0}}function x2(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[Xv]:e.profile_id},...e.exclusive_time&&{[Kc]:e.exclusive_time}}}},measurements:e.measurements}}const Fw="Not capturing exception because it's already been captured.",Hw="Discarded session because of missing or non-string release",QR=Symbol.for("SentryInternalError"),WR=Symbol.for("SentryDoNotSendEventError"),S2=5e3;function eh(e){return{message:e,[QR]:!0}}function Zg(e){return{message:e,[WR]:!0}}function qw(e){return!!e&&typeof e=="object"&&QR in e}function Vw(e){return!!e&&typeof e=="object"&&WR in e}function Kw(e,t,n,s,i){let a=0,l,f=!1;e.on(n,()=>{a=0,clearTimeout(l),f=!1}),e.on(t,d=>{a+=s(d),a>=8e5?i(e):f||(f=!0,l=ZR(setTimeout(()=>{i(e)},S2)))}),e.on("flush",()=>{i(e)})}class _2{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=lb(t.transportOptions?.bufferSize??YR),t.dsn?this._dsn=II(t.dsn):Ce&&be.warn("No DSN provided, client will not send events."),this._dsn){const s=KP(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:s})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&Kw(this,"afterCaptureLog","flushLogs",C2,vh),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Kw(this,"afterCaptureMetric","flushMetrics",T2,ib)}captureException(t,n,s){const i=qr();if(bw(t))return Ce&&be.log(Fw),i;const a={event_id:i,...n};return this._process(()=>this.eventFromException(t,a).then(l=>this._captureEvent(l,a,s)).then(l=>l),"error"),a.event_id}captureMessage(t,n,s,i){const a={event_id:qr(),...s},l=np(t)?t:String(t),f=Cc(t),d=f?this.eventFromMessage(l,n,a):this.eventFromException(t,a);return this._process(()=>d.then(p=>this._captureEvent(p,a,i)),f?"unknown":"error"),a.event_id}captureEvent(t,n,s){const i=qr();if(n?.originalException&&bw(n.originalException))return Ce&&be.log(Fw),i;const a={event_id:i,...n},l=t.sdkProcessingMetadata||{},f=l.capturedSpanScope,d=l.capturedSpanIsolationScope,p=Gw(t.type);return this._process(()=>this._captureEvent(t,a,f||s,d),p),a.event_id}captureSession(t){this.sendSession(t),Nc(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){const n=this._transport;if(!n)return!0;this.emit("flush");const s=await this._isClientDoneProcessing(t),i=await n.flush(t);return s&&i}async close(t){vh(this);const n=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){const n=this._integrations[t.name];qR(this,t,this._integrations),n||Bw(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let s=cP(t,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])s=WI(s,rP(i));this.sendEnvelope(s).then(i=>this.emit("afterSendEvent",t,i))}sendSession(t){const{release:n,environment:s=eb}=this._options;if("aggregates"in t){const a=t.attrs||{};if(!a.release&&!n){Ce&&be.warn(Hw);return}a.release=a.release||n,a.environment=a.environment||s,t.attrs=a}else{if(!t.release&&!n){Ce&&be.warn(Hw);return}t.release=t.release||n,t.environment=t.environment||s}this.emit("beforeSendSession",t);const i=aP(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(t,n,s=1){if(this._options.sendClientReports){const i=`${t}:${n}`;Ce&&be.log(`Recording outcome: "${i}"${s>1?` (${s} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+s}}on(t,n){const s=this._hooks[t]=this._hooks[t]||new Set,i=(...a)=>n(...a);return s.add(i),()=>{s.delete(i)}}emit(t,...n){const s=this._hooks[t];s&&s.forEach(i=>i(...n))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(n){return Ce&&be.error("Error while sending envelope:",n),{}}return Ce&&be.error("Transport disabled"),{}}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=YP(this,t),Bw(this,t)}_updateSessionFromEvent(t,n){let s=n.level==="fatal",i=!1;const a=n.exception?.values;if(a){i=!0,s=!1;for(const d of a)if(d.mechanism?.handled===!1){s=!0;break}}const l=t.status==="ok";(l&&t.errors===0||l&&s)&&(Nc(t,{...s&&{status:"crashed"},errors:t.errors||Number(i||s)}),this.captureSession(t))}async _isClientDoneProcessing(t){let n=0;for(;!t||n<t;){if(await new Promise(s=>setTimeout(s,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,n,s,i){const a=this.getOptions(),l=Object.keys(this._integrations);return!n.integrations&&l?.length&&(n.integrations=l),this.emit("preprocessEvent",t,n),t.type||i.setLastEventId(t.event_id||n.event_id),MP(a,t,n,s,this,i).then(f=>{if(f===null)return f;this.emit("postprocessEvent",f,n),f.contexts={trace:mR(s),...f.contexts};const d=tb(this,s);return f.sdkProcessingMetadata={dynamicSamplingContext:d,...f.sdkProcessingMetadata},f})}_captureEvent(t,n={},s=bt(),i=Zr()){return Ce&&tv(t)&&be.log(`Captured error event \`${XR(t)[0]||"<unknown>"}\``),this._processEvent(t,n,s,i).then(a=>a.event_id,a=>{Ce&&(Vw(a)?be.log(a.message):qw(a)?be.warn(a.message):be.warn(a))})}_processEvent(t,n,s,i){const a=this.getOptions(),{sampleRate:l}=a,f=JR(t),d=tv(t),g=`before send for type \`${t.type||"error"}\``,y=typeof l>"u"?void 0:bu(l);if(d&&typeof y=="number"&&Vo()>y)return this.recordDroppedEvent("sample_rate","error"),sb(Zg(`Discarding event because it's not included in the random sample (sampling rate = ${l})`));const b=Gw(t.type);return this._prepareEvent(t,n,s,i).then(x=>{if(x===null)throw this.recordDroppedEvent("event_processor",b),Zg("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return x;const w=E2(this,a,x,n);return w2(w,g)}).then(x=>{if(x===null){if(this.recordDroppedEvent("before_send",b),f){const C=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",C)}throw Zg(`${g} returned \`null\`, will not send event.`)}const S=s.getSession()||i.getSession();if(d&&S&&this._updateSessionFromEvent(S,x),f){const T=x.sdkProcessingMetadata?.spanCountBeforeProcessing||0,C=x.spans?x.spans.length:0,k=T-C;k>0&&this.recordDroppedEvent("before_send","span",k)}const w=x.transaction_info;if(f&&w&&x.transaction!==t.transaction){const T="custom";x.transaction_info={...w,source:T}}return this.sendEvent(x,n),x}).then(null,x=>{throw Vw(x)||qw(x)?x:(this.captureException(x,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:x}),eh(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
10
|
+
Reason: ${x}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(s=>(this._numProcessing--,s),s=>(this._numProcessing--,s===cb&&this.recordDroppedEvent("queue_overflow",n),s))}_clearOutcomes(){const t=this._outcomes;return this._outcomes={},Object.entries(t).map(([n,s])=>{const[i,a]=n.split(":");return{reason:i,category:a,quantity:s}})}_flushOutcomes(){Ce&&be.log("Flushing outcomes...");const t=this._clearOutcomes();if(t.length===0){Ce&&be.log("No outcomes to send");return}if(!this._dsn){Ce&&be.log("No dsn provided, will not send outcomes");return}Ce&&be.log("Sending outcomes:",t);const n=v2(t,this._options.tunnel&&Gc(this._dsn));this.sendEnvelope(n)}}function Gw(e){return e==="replay_event"?"replay":e||"error"}function w2(e,t){const n=`${t} must return \`null\` or a valid event.`;if(qc(e))return e.then(s=>{if(!yu(s)&&s!==null)throw eh(n);return s},s=>{throw eh(`${t} rejected with ${s}`)});if(!yu(e)&&e!==null)throw eh(n);return e}function E2(e,t,n,s){const{beforeSend:i,beforeSendTransaction:a,beforeSendSpan:l,ignoreSpans:f}=t;let d=n;if(tv(d)&&i)return i(d,s);if(JR(d)){if(l||f){const p=b2(d);if(f?.length&&gh(p,f))return null;if(l){const g=l(p);g?d=Pu(n,x2(g)):Xy()}if(d.spans){const g=[],y=d.spans;for(const x of y){if(f?.length&&gh(x,f)){VI(y,x);continue}if(l){const S=l(x);S?g.push(S):(Xy(),g.push(x))}else g.push(x)}const b=d.spans.length-g.length;b&&e.recordDroppedEvent("before_send","span",b),d.spans=g}}if(a){if(d.spans){const p=d.spans.length;d.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:p}}return a(d,s)}}return d}function tv(e){return e.type===void 0}function JR(e){return e.type==="transaction"}function T2(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+e1(e.attributes)}function C2(e){let t=0;return e.message&&(t+=e.message.length*2),t+e1(e.attributes)}function e1(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*Zw(n[0]):Cc(n)?t+=Zw(n):t+=100}),t}function Zw(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function R2(e){return tp(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function Yw(e){return R2(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function N2(e,t){t.debug===!0&&(Ce?be.enable():ha(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),bt().update(t.initialScope);const s=new e(t);return j2(s),s.init(),s}function j2(e){bt().setClient(e)}const A2="thismessage:/";function t1(e){return"isRelative"in e}function n1(e,t){const n=e.indexOf("://")<=0&&e.indexOf("//")!==0,s=n?A2:void 0;try{if("canParse"in URL&&!URL.canParse(e,s))return;const i=new URL(e,s);return n?{isRelative:n,pathname:i.pathname,search:i.search,hash:i.hash}:i}catch{}}function k2(e){if(t1(e))return e.pathname;const t=new URL(e);return t.search="",t.hash="",["80","443"].includes(t.port)&&(t.port=""),t.password&&(t.password="%filtered%"),t.username&&(t.username="%filtered%"),t.toString()}function ta(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",s=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:s,relative:t[5]+n+s}}function O2(e){return e.split(/[?#]/,1)[0]}function Go(e,t=!0){if(e.startsWith("data:")){const n=e.match(/^data:([^;,]+)/),s=n?n[1]:"text/plain",i=e.includes(";base64,"),a=e.indexOf(",");let l="";if(t&&a!==-1){const f=e.slice(a+1);l=f.length>10?`${f.slice(0,10)}... [truncated]`:f}return`data:${s}${i?",base64":""}${l?`,${l}`:""}`}return e}function M2(e,...t){const n=new String(String.raw(e,...t));return n.__sentry_template_string__=e.join("\0").replace(/%/g,"%%").replace(/\0/g,"%s"),n.__sentry_template_values__=t,n}const I2=M2;function P2(e){"aggregates"in e?e.attrs?.ip_address===void 0&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):e.ipAddress===void 0&&(e.ipAddress="{{auto}}")}function r1(e,t,n=[t],s="npm"){const i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(a=>({name:`${s}:@sentry/${a}`,version:Wi})),i.version=Wi)}function s1(e={}){const t=e.client||vt();if(!BP()||!t)return{};const n=da(),s=Vc(n);if(s.getTraceData)return s.getTraceData(e);const i=e.scope||bt(),a=e.span||Xn(),l=a?UI(a):D2(i),f=a?to(a):tb(t,i),d=EI(f);if(!_R.test(l))return be.warn("Invalid sentry-trace data. Cannot generate trace data"),{};const g={"sentry-trace":l,baggage:d};return e.propagateTraceparent&&(g.traceparent=a?$I(a):z2(i)),g}function D2(e){const{traceId:t,sampled:n,propagationSpanId:s}=e.getPropagationContext();return wR(t,s,n)}function z2(e){const{traceId:t,sampled:n,propagationSpanId:s}=e.getPropagationContext();return ER(t,s,n)}const L2=100;function oa(e,t){const n=vt(),s=Zr();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:a=L2}=n.getOptions();if(a<=0)return;const f={timestamp:pa(),...e},d=i?ha(()=>i(f,t)):f;d!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",d,t),s.addBreadcrumb(d,a))}let Xw;const U2="FunctionToString",Qw=new WeakMap,$2=(()=>({name:U2,setupOnce(){Xw=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=Zv(this),n=Qw.has(vt())&&t!==void 0?t:this;return Xw.apply(n,e)}}catch{}},setup(e){Qw.set(e,!0)}})),B2=$2,F2=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],H2="EventFilters",q2=(e={})=>{let t;return{name:H2,setup(n){const s=n.getOptions();t=Ww(e,s)},processEvent(n,s,i){if(!t){const a=i.getOptions();t=Ww(e,a)}return K2(n,t)?null:n}}},V2=((e={})=>({...q2(e),name:"InboundFilters"}));function Ww(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:F2],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function K2(e,t){if(e.type){if(e.type==="transaction"&&Z2(e,t.ignoreTransactions))return Ce&&be.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
11
|
+
Event: ${Ki(e)}`),!0}else{if(G2(e,t.ignoreErrors))return Ce&&be.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
12
|
+
Event: ${Ki(e)}`),!0;if(W2(e))return Ce&&be.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
13
|
+
Event: ${Ki(e)}`),!0;if(Y2(e,t.denyUrls))return Ce&&be.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
14
14
|
Event: ${Ki(e)}.
|
|
15
|
-
Url: ${bh(e)}`),!0;if(!
|
|
15
|
+
Url: ${bh(e)}`),!0;if(!X2(e,t.allowUrls))return Ce&&be.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
16
16
|
Event: ${Ki(e)}.
|
|
17
|
-
Url: ${bh(e)}`),!0}return!1}function GD(e,t){return t?.length?XR(e).some(n=>Ko(n,t)):!1}function ZD(e,t){if(!t?.length)return!1;const n=e.transaction;return n?Ko(n,t):!1}function YD(e,t){if(!t?.length)return!1;const n=bh(e);return n?Ko(n,t):!1}function XD(e,t){if(!t?.length)return!0;const n=bh(e);return n?Ko(n,t):!0}function QD(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 bh(e){try{const n=[...e.exception?.values??[]].reverse().find(s=>s.mechanism?.parent_id===void 0&&s.stacktrace?.frames?.length)?.stacktrace?.frames;return n?QD(n):null}catch{return Ce&&be.error(`Cannot extract url for event ${Ki(e)}`),null}}function WD(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function JD(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=nv(e,t,s,a.originalException,n,i.exception.values,l,0))}function nv(e,t,n,s,i,a,l,f){if(a.length>=n+1)return a;let d=[...a];if(Qs(s[i],Error)){Jw(l,f,s);const p=e(t,s[i]),g=d.length;eE(p,i,g,f),d=nv(e,t,n,s[i],i,[p,...d],p,g)}return o1(s)&&s.errors.forEach((p,g)=>{if(Qs(p,Error)){Jw(l,f,s);const y=e(t,p),b=d.length;eE(y,`errors[${g}]`,b,f),d=nv(e,t,n,p,i,[y,...d],y,b)}}),d}function o1(e){return Array.isArray(e.errors)}function Jw(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...o1(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function eE(e,t,n,s){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:s}}function e2(e){const t="console";ci(t,e),li(t,t2)}function t2(){"console"in ct&&PM.forEach(function(e){e in ct.console&&gr(ct.console,e,function(t){return ph[e]=t,function(...n){Hr("console",{args:n,level:e}),ph[e]?.apply(ct.console,n)}})})}function n2(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const r2="Dedupe",s2=(()=>{let e;return{name:r2,processEvent(t){if(t.type)return t;try{if(i2(t,e))return Ce&&be.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),o2=s2;function i2(e,t){return t?!!(a2(e,t)||c2(e,t)):!1}function a2(e,t){const n=e.message,s=t.message;return!(!n&&!s||n&&!s||!n&&s||n!==s||!a1(e,t)||!i1(e,t))}function c2(e,t){const n=tE(t),s=tE(e);return!(!n||!s||n.type!==s.type||n.value!==s.value||!a1(e,t)||!i1(e,t))}function i1(e,t){let n=hw(e),s=hw(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 a1(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 tE(e){return e.exception?.values?.[0]}const l2="ConversationId",u2=(()=>({name:l2,setup(e){e.on("spanStart",t=>{const n=bt().getScopeData(),s=Zr().getScopeData(),i=n.conversationId||s.conversationId;i&&t.setAttribute(gI,i)})}})),f2=u2;function d2(e,t,n,s,i){if(!e.fetchData)return;const{method:a,url:l}=e.fetchData,f=ss()&&t(l);if(e.endTimestamp){const x=e.fetchData.__span;if(!x)return;const S=s[x];S&&(f&&(m2(S,e),h2(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?Zc(y2(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=p2(x,S,ss()&&g?y:void 0,p);w&&(e.args[1]=S,S.headers=w)}const b=vt();if(b){const x={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};b.emit("beforeOutgoingRequestSpan",y,x)}return y}function h2(e,t,n){(typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0)?.(e,{headers:t.response?.headers,error:t.error})}function p2(e,t,n,s){const i=s1({span:n,propagateTraceparent:s}),a=i["sentry-trace"],l=i.baggage,f=i.traceparent;if(!a)return;const d=t.headers||(Kv(e)?e.headers:void 0);if(d)if(g2(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?wd(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"&&wd(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=>wd(w)):wd(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 m2(e,t){if(t.response){yR(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 wd(e){return e.split(",").some(t=>t.trim().startsWith(Wv))}function g2(e){return typeof Headers<"u"&&Qs(e,Headers)}function y2(e,t,n){if(e.startsWith("data:")){const a=Go(e);return{name:`${t} ${a}`,attributes:nE(e,void 0,t,n)}}const s=n1(e),i=s?kD(s):e;return{name:`${t} ${i}`,attributes:nE(e,s,t,n)}}function nE(e,t,n,s){const i={url:Go(e),type:"fetch","http.method":n,[gn]:s,[eo]:"http.client"};return t&&(t1(t)||(i["http.url"]=Go(t.href),i["server.address"]=t.host),t.search&&(i["http.query"]=t.search),t.hash&&(i["http.fragment"]=t.hash)),i}function Yc(e,t,n,s,i){sD({level:e,message:t,attributes:n,severityNumber:i},s)}function v2(e,t,{scope:n}={}){Yc("trace",e,t,n)}function b2(e,t,{scope:n}={}){Yc("debug",e,t,n)}function x2(e,t,{scope:n}={}){Yc("info",e,t,n)}function S2(e,t,{scope:n}={}){Yc("warn",e,t,n)}function _2(e,t,{scope:n}={}){Yc("error",e,t,n)}function w2(e,t,{scope:n}={}){Yc("fatal",e,t,n)}const E2=Object.freeze(Object.defineProperty({__proto__:null,debug:b2,error:_2,fatal:w2,fmt:ID,info:x2,trace:v2,warn:S2},Symbol.toStringTag,{value:"Module"}));function ub(e,t,n,s){fD({type:e,name:t,value:n,unit:s?.unit,attributes:s?.attributes},{scope:s?.scope})}function rE(e,t=1,n){ub("counter",e,t,n)}function sE(e,t,n){ub("gauge",e,t,n)}function oE(e,t,n){ub("distribution",e,t,n)}function c1(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const Su=ct;function T2(){return"history"in Su&&!!Su.history}function C2(){if(!("fetch"in Su))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function rv(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function R2(){if(typeof EdgeRuntime=="string")return!0;if(!C2())return!1;if(rv(Su.fetch))return!0;let e=!1;const t=Su.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=rv(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 l1(e,t){const n="fetch";ci(n,e),li(n,()=>u1(void 0,t))}function N2(e){const t="fetch-body-resolved";ci(t,e),li(t,()=>u1(A2))}function u1(e,t=!1){t&&!R2()||gr(ct,"fetch",function(n){return function(...s){const i=new Error,{method:a,url:l}=k2(s),f={args:s,fetchData:{method:a,url:l},startTimestamp:cn()*1e3,virtualError:i,headers:O2(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}),tp(d)&&d.stack===void 0&&(d.stack=i.stack,Yn(d,"framesToPop",1));const g=vt()?.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 j2(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 A2(e){let t;try{t=e.clone()}catch{return}j2(t,()=>{Hr("fetch-body-resolved",{endTimestamp:cn()*1e3,response:e})})}function th(e,t){return!!e&&typeof e=="object"&&!!e[t]}function iE(e){return typeof e=="string"?e:e?th(e,"url")?e.url:e.toString?e.toString():"":""}function k2(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,s]=e;return{url:iE(n),method:th(s,"method")?String(s.method).toUpperCase():Kv(n)&&th(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:iE(t),method:th(t,"method")?String(t.method).toUpperCase():"GET"}}function O2(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Kv(t))return new Headers(t.headers)}catch{}}function M2(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function I2(){return"npm"}function P2(){return!M2()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function D2(){return typeof window<"u"&&(!P2()||z2())}function z2(){return ct.process?.type==="renderer"}const st=ct;let sv=0;function f1(){return sv>0}function L2(){sv++,setTimeout(()=>{sv--})}function Oc(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(Zv(e))return e}catch{return e}const s=function(...i){try{const a=i.map(l=>Oc(l,t));return e.apply(this,a)}catch(a){throw L2(),Du(l=>{l.addEventProcessor(f=>(t.mechanism&&(Gy(f,void 0),Rc(f,t.mechanism)),f.extra={...f.extra,arguments:i},f)),$R(a)}),a}};try{for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}catch{}fR(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 fb(){const e=Ou(),{referrer:t}=st.document||{},{userAgent:n}=st.navigator||{},s={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:s}}function db(e,t){const n=hb(e,t),s={type:H2(t),value:q2(t)};return n.length&&(s.stacktrace={frames:n}),s.type===void 0&&s.value===""&&(s.value="Unrecoverable error caught"),s}function U2(e,t,n,s){const a=vt()?.getOptions().normalizeDepth,l=Y2(t),f={__serialized__:OR(t,a)};if(l)return{exception:{values:[db(e,l)]},extra:f};const d={exception:{values:[{type:rp(t)?t.constructor.name:s?"UnhandledRejection":"Error",value:G2(t,{isUnhandledRejection:s})}]},extra:f};if(n){const p=hb(e,n);p.length&&(d.exception.values[0].stacktrace={frames:p})}return d}function Yg(e,t){return{exception:{values:[db(e,t)]}}}function hb(e,t){const n=t.stacktrace||t.stack||"",s=B2(t),i=F2(t);try{return e(n,s,i)}catch{}return[]}const $2=/Minified React error #\d+;/i;function B2(e){return e&&$2.test(e.message)?1:0}function F2(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function d1(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function H2(e){const t=e?.name;return!t&&d1(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function q2(e){const t=e?.message;return d1(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?Yw(t.error):Yw(e):"No error message"}function V2(e,t,n,s){const i=n?.syntheticException||void 0,a=pb(e,t,i,s);return Rc(a),a.level="error",n?.event_id&&(a.event_id=n.event_id),Uu(a)}function K2(e,t,n="info",s,i){const a=s?.syntheticException||void 0,l=ov(e,t,a,i);return l.level=n,s?.event_id&&(l.event_id=s.event_id),Uu(l)}function pb(e,t,n,s,i){let a;if(cR(t)&&t.error)return Yg(e,t.error);if(mw(t)||KM(t)){const l=t;if("stack"in t)a=Yg(e,t);else{const f=l.name||(mw(l)?"DOMError":"DOMException"),d=l.message?`${f}: ${l.message}`:f;a=ov(e,d,n,s),Gy(a,d)}return"code"in l&&(a.tags={...a.tags,"DOMException.code":`${l.code}`}),a}return tp(t)?Yg(e,t):yu(t)||rp(t)?(a=U2(e,t,n,i),Rc(a,{synthetic:!0}),a):(a=ov(e,t,n,s),Gy(a,`${t}`),Rc(a,{synthetic:!0}),a)}function ov(e,t,n,s){const i={};if(s&&n){const a=hb(e,n);a.length&&(i.exception={values:[{value:t,stacktrace:{frames:a}}]}),Rc(i,{synthetic:!0})}if(np(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 G2(e,{isUnhandledRejection:t}){const n=WM(e),s=t?"promise rejection":"exception";return cR(e)?`Event \`ErrorEvent\` captured as ${s} with message \`${e.message}\``:rp(e)?`Event \`${Z2(e)}\` (type=${e.type}) captured as ${s}`:`Object captured as ${s} with keys: ${n}`}function Z2(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Y2(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}class X2 extends _D{constructor(t){const n=Q2(t),s=st.SENTRY_SDK_SOURCE||I2();r1(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&&vh(this),p&&ib(this))}),i&&this.on("beforeSendSession",PD)}eventFromException(t,n){return V2(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",s){return K2(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 Q2(e){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:st.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const $u=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ge=ct,W2=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",Bu=(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=W2(t.value,n),e(t)))}},Fu=(e=!0)=>{const t=Ge.performance?.getEntriesByType?.("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t},Xc=()=>Fu()?.activationStart??0;function Zo(e,t,n){Ge.document&&Ge.addEventListener(e,t,n)}function xh(e,t,n){Ge.document&&Ge.removeEventListener(e,t,n)}let gc=-1;const h1=new Set,J2=()=>Ge.document?.visibilityState==="hidden"&&!Ge.document?.prerendering?0:1/0,nh=e=>{if(ez(e)&&gc>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(const t of h1)t();isFinite(gc)||(gc=e.type==="visibilitychange"?e.timeStamp:0,xh("prerenderingchange",nh,!0))}},Hu=()=>{if(Ge.document&&gc<0){const e=Xc();gc=(Ge.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(n=>n.name==="hidden"&&n.startTime>e)[0]?.startTime)??J2(),Zo("visibilitychange",nh,!0),Zo("pagehide",nh,!0),Zo("prerenderingchange",nh,!0)}return{get firstHiddenTime(){return gc},onHidden(e){h1.add(e)}}};function ez(e){return e.type==="pagehide"||Ge.document?.visibilityState==="hidden"}const tz=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,qu=(e,t=-1)=>{const n=Fu();let s="navigate";return n&&(Ge.document?.prerendering||Xc()>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:tz(),navigationType:s}},Xg=new WeakMap;function mb(e,t){try{return Xg.get(e)||Xg.set(e,new t),Xg.get(e)}catch{return new t}}class Sh{constructor(){Sh.prototype.__init.call(this),Sh.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 Qc=(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{}},gb=e=>{let t=!1;return()=>{t||(e(),t=!0)}},ip=e=>{Ge.document?.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},nz=[1800,3e3],rz=(e,t={})=>{ip(()=>{const n=Hu(),s=qu("FCP");let i;const l=Qc("paint",f=>{for(const d of f)d.name==="first-contentful-paint"&&(l.disconnect(),d.startTime<n.firstHiddenTime&&(s.value=Math.max(d.startTime-Xc(),0),s.entries.push(d),i(!0)))});l&&(i=Bu(e,s,nz,t.reportAllChanges))})},sz=[.1,.25],oz=(e,t={})=>{rz(gb(()=>{const n=qu("CLS",0);let s;const i=Hu(),a=mb(t,Sh),l=d=>{for(const p of d)a._processEntry(p);a._sessionValue>n.value&&(n.value=a._sessionValue,n.entries=a._sessionEntries,s())},f=Qc("layout-shift",l);f&&(s=Bu(e,n,sz,t.reportAllChanges),i.onHidden(()=>{l(f.takeRecords()),s(!0)}),Ge?.setTimeout?.(s))}))};let p1=0,Qg=1/0,Ed=0;const iz=e=>{e.forEach(t=>{t.interactionId&&(Qg=Math.min(Qg,t.interactionId),Ed=Math.max(Ed,t.interactionId),p1=Ed?(Ed-Qg)/7+1:0)})};let iv;const m1=()=>iv?p1:performance.interactionCount||0,az=()=>{"interactionCount"in performance||iv||(iv=Qc("event",iz,{type:"event",buffered:!0,durationThreshold:0}))},Wg=10;let g1=0;const cz=()=>m1()-g1;class _h{constructor(){_h.prototype.__init.call(this),_h.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){g1=m1(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const t=Math.min(this._longestInteractionList.length-1,Math.floor(cz()/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<Wg||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>Wg){const i=this._longestInteractionList.splice(Wg);for(const a of i)this._longestInteractionMap.delete(a.id)}this._onAfterProcessingINPCandidate?.(s)}}}const y1=e=>{const t=Ge.requestIdleCallback||Ge.setTimeout;Ge.document?.visibilityState==="hidden"?e():(e=gb(e),Zo("visibilitychange",e,{once:!0,capture:!0}),Zo("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),xh("visibilitychange",e,{capture:!0}),xh("pagehide",e,{capture:!0})}))},lz=[200,500],uz=40,fz=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const n=Hu();ip(()=>{az();const s=qu("INP");let i;const a=mb(t,_h),l=d=>{y1(()=>{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=Qc("event",l,{durationThreshold:t.durationThreshold??uz});i=Bu(e,s,lz,t.reportAllChanges),f&&(f.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{l(f.takeRecords()),i(!0)}))})};class dz{_processEntry(t){this._onBeforeProcessingEntry?.(t)}}const hz=[2500,4e3],pz=(e,t={})=>{ip(()=>{const n=Hu(),s=qu("LCP");let i;const a=mb(t,dz),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-Xc(),0),s.entries=[p],i())},f=Qc("largest-contentful-paint",l);if(f){i=Bu(e,s,hz,t.reportAllChanges);const d=gb(()=>{l(f.takeRecords()),f.disconnect(),i(!0)}),p=g=>{g.isTrusted&&(y1(d),xh(g.type,p,{capture:!0}))};for(const g of["keydown","click","visibilitychange"])Zo(g,p,{capture:!0})}})},mz=[800,1800],av=e=>{Ge.document?.prerendering?ip(()=>av(e)):Ge.document?.readyState!=="complete"?addEventListener("load",()=>av(e),!0):setTimeout(e)},gz=(e,t={})=>{const n=qu("TTFB"),s=Bu(e,n,mz,t.reportAllChanges);av(()=>{const i=Fu();i&&(n.value=Math.max(i.responseStart-Xc(),0),n.entries=[i],s(!0))})},uu={},wh={};let v1,b1,x1,S1;function _1(e,t=!1){return ap("cls",e,bz,v1,t)}function w1(e,t=!1){return ap("lcp",e,xz,b1,t)}function yz(e){return ap("ttfb",e,Sz,x1)}function vz(e){return ap("inp",e,_z,S1)}function Mc(e,t){return E1(e,t),wh[e]||(wz(e),wh[e]=!0),T1(e,t)}function Vu(e,t){const n=uu[e];if(n?.length)for(const s of n)try{s(t)}catch(i){$u&&be.error(`Error while triggering instrumentation handler.
|
|
17
|
+
Url: ${bh(e)}`),!0}return!1}function G2(e,t){return t?.length?XR(e).some(n=>Ko(n,t)):!1}function Z2(e,t){if(!t?.length)return!1;const n=e.transaction;return n?Ko(n,t):!1}function Y2(e,t){if(!t?.length)return!1;const n=bh(e);return n?Ko(n,t):!1}function X2(e,t){if(!t?.length)return!0;const n=bh(e);return n?Ko(n,t):!0}function Q2(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 bh(e){try{const n=[...e.exception?.values??[]].reverse().find(s=>s.mechanism?.parent_id===void 0&&s.stacktrace?.frames?.length)?.stacktrace?.frames;return n?Q2(n):null}catch{return Ce&&be.error(`Cannot extract url for event ${Ki(e)}`),null}}function W2(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function J2(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=nv(e,t,s,a.originalException,n,i.exception.values,l,0))}function nv(e,t,n,s,i,a,l,f){if(a.length>=n+1)return a;let d=[...a];if(Qs(s[i],Error)){Jw(l,f,s);const p=e(t,s[i]),g=d.length;eE(p,i,g,f),d=nv(e,t,n,s[i],i,[p,...d],p,g)}return o1(s)&&s.errors.forEach((p,g)=>{if(Qs(p,Error)){Jw(l,f,s);const y=e(t,p),b=d.length;eE(y,`errors[${g}]`,b,f),d=nv(e,t,n,p,i,[y,...d],y,b)}}),d}function o1(e){return Array.isArray(e.errors)}function Jw(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...o1(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function eE(e,t,n,s){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:s}}function eD(e){const t="console";ci(t,e),li(t,tD)}function tD(){"console"in ct&&PM.forEach(function(e){e in ct.console&&gr(ct.console,e,function(t){return ph[e]=t,function(...n){Hr("console",{args:n,level:e}),ph[e]?.apply(ct.console,n)}})})}function nD(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const rD="Dedupe",sD=(()=>{let e;return{name:rD,processEvent(t){if(t.type)return t;try{if(iD(t,e))return Ce&&be.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),oD=sD;function iD(e,t){return t?!!(aD(e,t)||cD(e,t)):!1}function aD(e,t){const n=e.message,s=t.message;return!(!n&&!s||n&&!s||!n&&s||n!==s||!a1(e,t)||!i1(e,t))}function cD(e,t){const n=tE(t),s=tE(e);return!(!n||!s||n.type!==s.type||n.value!==s.value||!a1(e,t)||!i1(e,t))}function i1(e,t){let n=hw(e),s=hw(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 a1(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 tE(e){return e.exception?.values?.[0]}const lD="ConversationId",uD=(()=>({name:lD,setup(e){e.on("spanStart",t=>{const n=bt().getScopeData(),s=Zr().getScopeData(),i=n.conversationId||s.conversationId;i&&t.setAttribute(gI,i)})}})),fD=uD;function dD(e,t,n,s,i){if(!e.fetchData)return;const{method:a,url:l}=e.fetchData,f=ss()&&t(l);if(e.endTimestamp){const x=e.fetchData.__span;if(!x)return;const S=s[x];S&&(f&&(mD(S,e),hD(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?Zc(yD(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=pD(x,S,ss()&&g?y:void 0,p);w&&(e.args[1]=S,S.headers=w)}const b=vt();if(b){const x={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};b.emit("beforeOutgoingRequestSpan",y,x)}return y}function hD(e,t,n){(typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0)?.(e,{headers:t.response?.headers,error:t.error})}function pD(e,t,n,s){const i=s1({span:n,propagateTraceparent:s}),a=i["sentry-trace"],l=i.baggage,f=i.traceparent;if(!a)return;const d=t.headers||(Kv(e)?e.headers:void 0);if(d)if(gD(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?wd(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"&&wd(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=>wd(w)):wd(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 mD(e,t){if(t.response){yR(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 wd(e){return e.split(",").some(t=>t.trim().startsWith(Wv))}function gD(e){return typeof Headers<"u"&&Qs(e,Headers)}function yD(e,t,n){if(e.startsWith("data:")){const a=Go(e);return{name:`${t} ${a}`,attributes:nE(e,void 0,t,n)}}const s=n1(e),i=s?k2(s):e;return{name:`${t} ${i}`,attributes:nE(e,s,t,n)}}function nE(e,t,n,s){const i={url:Go(e),type:"fetch","http.method":n,[gn]:s,[eo]:"http.client"};return t&&(t1(t)||(i["http.url"]=Go(t.href),i["server.address"]=t.host),t.search&&(i["http.query"]=t.search),t.hash&&(i["http.fragment"]=t.hash)),i}function Yc(e,t,n,s,i){s2({level:e,message:t,attributes:n,severityNumber:i},s)}function vD(e,t,{scope:n}={}){Yc("trace",e,t,n)}function bD(e,t,{scope:n}={}){Yc("debug",e,t,n)}function xD(e,t,{scope:n}={}){Yc("info",e,t,n)}function SD(e,t,{scope:n}={}){Yc("warn",e,t,n)}function _D(e,t,{scope:n}={}){Yc("error",e,t,n)}function wD(e,t,{scope:n}={}){Yc("fatal",e,t,n)}const ED=Object.freeze(Object.defineProperty({__proto__:null,debug:bD,error:_D,fatal:wD,fmt:I2,info:xD,trace:vD,warn:SD},Symbol.toStringTag,{value:"Module"}));function ub(e,t,n,s){f2({type:e,name:t,value:n,unit:s?.unit,attributes:s?.attributes},{scope:s?.scope})}function rE(e,t=1,n){ub("counter",e,t,n)}function sE(e,t,n){ub("gauge",e,t,n)}function oE(e,t,n){ub("distribution",e,t,n)}function c1(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const Su=ct;function TD(){return"history"in Su&&!!Su.history}function CD(){if(!("fetch"in Su))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function rv(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function RD(){if(typeof EdgeRuntime=="string")return!0;if(!CD())return!1;if(rv(Su.fetch))return!0;let e=!1;const t=Su.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=rv(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 l1(e,t){const n="fetch";ci(n,e),li(n,()=>u1(void 0,t))}function ND(e){const t="fetch-body-resolved";ci(t,e),li(t,()=>u1(AD))}function u1(e,t=!1){t&&!RD()||gr(ct,"fetch",function(n){return function(...s){const i=new Error,{method:a,url:l}=kD(s),f={args:s,fetchData:{method:a,url:l},startTimestamp:cn()*1e3,virtualError:i,headers:OD(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}),tp(d)&&d.stack===void 0&&(d.stack=i.stack,Yn(d,"framesToPop",1));const g=vt()?.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 jD(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 AD(e){let t;try{t=e.clone()}catch{return}jD(t,()=>{Hr("fetch-body-resolved",{endTimestamp:cn()*1e3,response:e})})}function th(e,t){return!!e&&typeof e=="object"&&!!e[t]}function iE(e){return typeof e=="string"?e:e?th(e,"url")?e.url:e.toString?e.toString():"":""}function kD(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,s]=e;return{url:iE(n),method:th(s,"method")?String(s.method).toUpperCase():Kv(n)&&th(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:iE(t),method:th(t,"method")?String(t.method).toUpperCase():"GET"}}function OD(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Kv(t))return new Headers(t.headers)}catch{}}function MD(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function ID(){return"npm"}function PD(){return!MD()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function DD(){return typeof window<"u"&&(!PD()||zD())}function zD(){return ct.process?.type==="renderer"}const st=ct;let sv=0;function f1(){return sv>0}function LD(){sv++,setTimeout(()=>{sv--})}function Oc(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(Zv(e))return e}catch{return e}const s=function(...i){try{const a=i.map(l=>Oc(l,t));return e.apply(this,a)}catch(a){throw LD(),Du(l=>{l.addEventProcessor(f=>(t.mechanism&&(Gy(f,void 0),Rc(f,t.mechanism)),f.extra={...f.extra,arguments:i},f)),$R(a)}),a}};try{for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}catch{}fR(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 fb(){const e=Ou(),{referrer:t}=st.document||{},{userAgent:n}=st.navigator||{},s={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:s}}function db(e,t){const n=hb(e,t),s={type:HD(t),value:qD(t)};return n.length&&(s.stacktrace={frames:n}),s.type===void 0&&s.value===""&&(s.value="Unrecoverable error caught"),s}function UD(e,t,n,s){const a=vt()?.getOptions().normalizeDepth,l=YD(t),f={__serialized__:OR(t,a)};if(l)return{exception:{values:[db(e,l)]},extra:f};const d={exception:{values:[{type:rp(t)?t.constructor.name:s?"UnhandledRejection":"Error",value:GD(t,{isUnhandledRejection:s})}]},extra:f};if(n){const p=hb(e,n);p.length&&(d.exception.values[0].stacktrace={frames:p})}return d}function Yg(e,t){return{exception:{values:[db(e,t)]}}}function hb(e,t){const n=t.stacktrace||t.stack||"",s=BD(t),i=FD(t);try{return e(n,s,i)}catch{}return[]}const $D=/Minified React error #\d+;/i;function BD(e){return e&&$D.test(e.message)?1:0}function FD(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function d1(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function HD(e){const t=e?.name;return!t&&d1(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function qD(e){const t=e?.message;return d1(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?Yw(t.error):Yw(e):"No error message"}function VD(e,t,n,s){const i=n?.syntheticException||void 0,a=pb(e,t,i,s);return Rc(a),a.level="error",n?.event_id&&(a.event_id=n.event_id),Uu(a)}function KD(e,t,n="info",s,i){const a=s?.syntheticException||void 0,l=ov(e,t,a,i);return l.level=n,s?.event_id&&(l.event_id=s.event_id),Uu(l)}function pb(e,t,n,s,i){let a;if(cR(t)&&t.error)return Yg(e,t.error);if(mw(t)||KM(t)){const l=t;if("stack"in t)a=Yg(e,t);else{const f=l.name||(mw(l)?"DOMError":"DOMException"),d=l.message?`${f}: ${l.message}`:f;a=ov(e,d,n,s),Gy(a,d)}return"code"in l&&(a.tags={...a.tags,"DOMException.code":`${l.code}`}),a}return tp(t)?Yg(e,t):yu(t)||rp(t)?(a=UD(e,t,n,i),Rc(a,{synthetic:!0}),a):(a=ov(e,t,n,s),Gy(a,`${t}`),Rc(a,{synthetic:!0}),a)}function ov(e,t,n,s){const i={};if(s&&n){const a=hb(e,n);a.length&&(i.exception={values:[{value:t,stacktrace:{frames:a}}]}),Rc(i,{synthetic:!0})}if(np(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 GD(e,{isUnhandledRejection:t}){const n=WM(e),s=t?"promise rejection":"exception";return cR(e)?`Event \`ErrorEvent\` captured as ${s} with message \`${e.message}\``:rp(e)?`Event \`${ZD(e)}\` (type=${e.type}) captured as ${s}`:`Object captured as ${s} with keys: ${n}`}function ZD(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function YD(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}class XD extends _2{constructor(t){const n=QD(t),s=st.SENTRY_SDK_SOURCE||ID();r1(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&&vh(this),p&&ib(this))}),i&&this.on("beforeSendSession",P2)}eventFromException(t,n){return VD(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",s){return KD(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 QD(e){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:st.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const $u=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ge=ct,WD=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",Bu=(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=WD(t.value,n),e(t)))}},Fu=(e=!0)=>{const t=Ge.performance?.getEntriesByType?.("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t},Xc=()=>Fu()?.activationStart??0;function Zo(e,t,n){Ge.document&&Ge.addEventListener(e,t,n)}function xh(e,t,n){Ge.document&&Ge.removeEventListener(e,t,n)}let gc=-1;const h1=new Set,JD=()=>Ge.document?.visibilityState==="hidden"&&!Ge.document?.prerendering?0:1/0,nh=e=>{if(ez(e)&&gc>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(const t of h1)t();isFinite(gc)||(gc=e.type==="visibilitychange"?e.timeStamp:0,xh("prerenderingchange",nh,!0))}},Hu=()=>{if(Ge.document&&gc<0){const e=Xc();gc=(Ge.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(n=>n.name==="hidden"&&n.startTime>e)[0]?.startTime)??JD(),Zo("visibilitychange",nh,!0),Zo("pagehide",nh,!0),Zo("prerenderingchange",nh,!0)}return{get firstHiddenTime(){return gc},onHidden(e){h1.add(e)}}};function ez(e){return e.type==="pagehide"||Ge.document?.visibilityState==="hidden"}const tz=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,qu=(e,t=-1)=>{const n=Fu();let s="navigate";return n&&(Ge.document?.prerendering||Xc()>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:tz(),navigationType:s}},Xg=new WeakMap;function mb(e,t){try{return Xg.get(e)||Xg.set(e,new t),Xg.get(e)}catch{return new t}}class Sh{constructor(){Sh.prototype.__init.call(this),Sh.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 Qc=(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{}},gb=e=>{let t=!1;return()=>{t||(e(),t=!0)}},ip=e=>{Ge.document?.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},nz=[1800,3e3],rz=(e,t={})=>{ip(()=>{const n=Hu(),s=qu("FCP");let i;const l=Qc("paint",f=>{for(const d of f)d.name==="first-contentful-paint"&&(l.disconnect(),d.startTime<n.firstHiddenTime&&(s.value=Math.max(d.startTime-Xc(),0),s.entries.push(d),i(!0)))});l&&(i=Bu(e,s,nz,t.reportAllChanges))})},sz=[.1,.25],oz=(e,t={})=>{rz(gb(()=>{const n=qu("CLS",0);let s;const i=Hu(),a=mb(t,Sh),l=d=>{for(const p of d)a._processEntry(p);a._sessionValue>n.value&&(n.value=a._sessionValue,n.entries=a._sessionEntries,s())},f=Qc("layout-shift",l);f&&(s=Bu(e,n,sz,t.reportAllChanges),i.onHidden(()=>{l(f.takeRecords()),s(!0)}),Ge?.setTimeout?.(s))}))};let p1=0,Qg=1/0,Ed=0;const iz=e=>{e.forEach(t=>{t.interactionId&&(Qg=Math.min(Qg,t.interactionId),Ed=Math.max(Ed,t.interactionId),p1=Ed?(Ed-Qg)/7+1:0)})};let iv;const m1=()=>iv?p1:performance.interactionCount||0,az=()=>{"interactionCount"in performance||iv||(iv=Qc("event",iz,{type:"event",buffered:!0,durationThreshold:0}))},Wg=10;let g1=0;const cz=()=>m1()-g1;class _h{constructor(){_h.prototype.__init.call(this),_h.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){g1=m1(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const t=Math.min(this._longestInteractionList.length-1,Math.floor(cz()/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<Wg||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>Wg){const i=this._longestInteractionList.splice(Wg);for(const a of i)this._longestInteractionMap.delete(a.id)}this._onAfterProcessingINPCandidate?.(s)}}}const y1=e=>{const t=Ge.requestIdleCallback||Ge.setTimeout;Ge.document?.visibilityState==="hidden"?e():(e=gb(e),Zo("visibilitychange",e,{once:!0,capture:!0}),Zo("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),xh("visibilitychange",e,{capture:!0}),xh("pagehide",e,{capture:!0})}))},lz=[200,500],uz=40,fz=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const n=Hu();ip(()=>{az();const s=qu("INP");let i;const a=mb(t,_h),l=d=>{y1(()=>{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=Qc("event",l,{durationThreshold:t.durationThreshold??uz});i=Bu(e,s,lz,t.reportAllChanges),f&&(f.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{l(f.takeRecords()),i(!0)}))})};class dz{_processEntry(t){this._onBeforeProcessingEntry?.(t)}}const hz=[2500,4e3],pz=(e,t={})=>{ip(()=>{const n=Hu(),s=qu("LCP");let i;const a=mb(t,dz),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-Xc(),0),s.entries=[p],i())},f=Qc("largest-contentful-paint",l);if(f){i=Bu(e,s,hz,t.reportAllChanges);const d=gb(()=>{l(f.takeRecords()),f.disconnect(),i(!0)}),p=g=>{g.isTrusted&&(y1(d),xh(g.type,p,{capture:!0}))};for(const g of["keydown","click","visibilitychange"])Zo(g,p,{capture:!0})}})},mz=[800,1800],av=e=>{Ge.document?.prerendering?ip(()=>av(e)):Ge.document?.readyState!=="complete"?addEventListener("load",()=>av(e),!0):setTimeout(e)},gz=(e,t={})=>{const n=qu("TTFB"),s=Bu(e,n,mz,t.reportAllChanges);av(()=>{const i=Fu();i&&(n.value=Math.max(i.responseStart-Xc(),0),n.entries=[i],s(!0))})},uu={},wh={};let v1,b1,x1,S1;function _1(e,t=!1){return ap("cls",e,bz,v1,t)}function w1(e,t=!1){return ap("lcp",e,xz,b1,t)}function yz(e){return ap("ttfb",e,Sz,x1)}function vz(e){return ap("inp",e,_z,S1)}function Mc(e,t){return E1(e,t),wh[e]||(wz(e),wh[e]=!0),T1(e,t)}function Vu(e,t){const n=uu[e];if(n?.length)for(const s of n)try{s(t)}catch(i){$u&&be.error(`Error while triggering instrumentation handler.
|
|
18
18
|
Type: ${e}
|
|
19
19
|
Name: ${Xs(s)}
|
|
20
|
-
Error:`,i)}}function bz(){return oz(e=>{Vu("cls",{metric:e}),v1=e},{reportAllChanges:!0})}function xz(){return pz(e=>{Vu("lcp",{metric:e}),b1=e},{reportAllChanges:!0})}function Sz(){return gz(e=>{Vu("ttfb",{metric:e}),x1=e})}function _z(){return fz(e=>{Vu("inp",{metric:e}),S1=e})}function ap(e,t,n,s,i=!1){E1(e,t);let a;return wh[e]||(a=n(),wh[e]=!0),s&&t({metric:s}),T1(e,t,i?a:void 0)}function wz(e){const t={};e==="event"&&(t.durationThreshold=0),Qc(e,n=>{Vu(e,{entries:n})},t)}function E1(e,t){uu[e]=uu[e]||[],uu[e].push(t)}function T1(e,t,n){return()=>{n&&n();const s=uu[e];if(!s)return;const i=s.indexOf(t);i!==-1&&s.splice(i,1)}}function Ez(e){return"duration"in e}const Tz=e=>{const t=n=>{(n.type==="pagehide"||Ge.document?.visibilityState==="hidden")&&e(n)};Zo("visibilitychange",t,{capture:!0,once:!0}),Zo("pagehide",t,{capture:!0,once:!0})};function Jg(e){return typeof e=="number"&&isFinite(e)}function ti(e,t,n,{...s}){const i=yt(e).start_timestamp;return i&&i>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),nb(e,()=>{const a=Zc({startTime:t,...s});return a&&a.end(n),a})}function yb(e){const t=vt();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 Zc({name:n,attributes:w,startTime:a,experimental:{standalone:!0}})}function Ku(){return Ge.addEventListener&&Ge.performance}function Xt(e){return e/1e3}function Cz(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 C1(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function R1(e,t){let n,s=!1;function i(f){!s&&n&&t(f,n),s=!0}Tz(()=>{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 Rz(e){let t=0,n;if(!C1("layout-shift"))return;const s=_1(({metric:i})=>{const a=i.entries[i.entries.length-1];a&&(t=i.value,n=a)},!0);R1(e,(i,a)=>{Nz(t,n,a,i),s()})}function Nz(e,t,n,s){$u&&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={[gn]:"auto.http.browser.cls",[eo]:"ui.webvital.cls",[Kc]: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=yb({name:l,transaction:a,attributes:f,startTime:i});d&&(d.addEvent("cls",{[zu]:"",[Lu]:e}),d.end(i))}function jz(e){let t=0,n;if(!C1("largest-contentful-paint"))return;const s=w1(({metric:i})=>{const a=i.entries[i.entries.length-1];a&&(t=i.value,n=a)},!0);R1(e,(i,a)=>{Az(t,n,a,i),s()})}function Az(e,t,n,s){$u&&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={[gn]:"auto.http.browser.lcp",[eo]:"ui.webvital.lcp",[Kc]: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=yb({name:l,transaction:a,attributes:f,startTime:i});d&&(d.addEvent("lcp",{[zu]:"millisecond",[Lu]:e}),d.end(i))}function Pr(e){return e&&((Sr()||performance.timeOrigin)+e)/1e3}function N1(e){const t={};if(e.nextHopProtocol!=null){const{name:n,version:s}=Cz(e.nextHopProtocol);t["network.protocol.version"]=s,t["network.protocol.name"]=n}return Sr()||Ku()?.timeOrigin?kz({...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 kz(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}const Oz=2147483647;let aE=0,ns={},Kn,Eh;function Mz({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){const s=Ku();if(s&&Sr()){s.mark&&Ge.performance.mark("sentry-tracing-init");const i=t?jz(n):Lz(),a=Uz(),l=e?Rz(n):zz();return()=>{i?.(),a(),l?.()}}return()=>{}}function Iz(){Mc("longtask",({entries:e})=>{const t=Xn();if(!t)return;const{op:n,start_timestamp:s}=yt(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:{[gn]:"auto.ui.browser.metrics"}})}})}function Pz(){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}=yt(n);if(l==="navigation"&&a&&i<a)continue;const f=Xt(s.duration),d={[gn]:"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 Dz(){Mc("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:{[gn]:"auto.ui.browser.metrics"}},l=uR(n.target);l&&(a.attributes["ui.component_name"]=l),ti(t,s,s+i,a)}}})}function zz(){return _1(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ns.cls={value:e.value,unit:""},Eh=t)},!0)}function Lz(){return w1(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ns.lcp={value:e.value,unit:"millisecond"},Kn=t)},!0)}function Uz(){return yz(({metric:e})=>{e.entries[e.entries.length-1]&&(ns.ttfb={value:e.value,unit:"millisecond"})})}function $z(e,t){const n=Ku(),s=Sr();if(!n?.getEntries||!s)return;const i=Xt(s),a=n.getEntries(),{op:l,start_timestamp:f}=yt(e);a.slice(aE).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":{qz(e,d,i);break}case"mark":case"paint":case"measure":{Fz(e,d,p,g,i,t.ignorePerformanceApiSpans);const y=Hu(),b=d.startTime<y.firstHiddenTime;d.name==="first-paint"&&b&&(ns.fp={value:d.startTime,unit:"millisecond"}),d.name==="first-contentful-paint"&&b&&(ns.fcp={value:d.startTime,unit:"millisecond"});break}case"resource":{Gz(e,d,d.name,p,g,i,t.ignoreResourceSpans);break}}}),aE=Math.max(a.length-1,0),Zz(e),l==="pageload"&&(Qz(ns),t.recordClsOnPageloadSpan||delete ns.cls,t.recordLcpOnPageloadSpan||delete ns.lcp,Object.entries(ns).forEach(([d,p])=>{dP(d,p.value,p.unit)}),e.setAttribute("performance.timeOrigin",i),e.setAttribute("performance.activationStart",Xc()),Yz(e,t)),Kn=void 0,Eh=void 0,ns={}}function Bz(e){if(e?.entryType==="measure")try{return e.detail.devtools.track==="Components ⚛"}catch{return}}function Fz(e,t,n,s,i,a){if(Bz(t)||["mark","measure"].includes(t.entryType)&&Ko(t.name,a))return;const l=Fu(!1),f=Xt(l?l.requestStart:0),d=i+Math.max(n,f),p=i+n,g=p+s,y={[gn]:"auto.resource.browser.metrics"};d!==p&&(y["sentry.browser.measure_happened_before_request"]=!0,y["sentry.browser.measure_start_time"]=d),Hz(y,t),d<=g&&ti(e,d,g,{name:t.name,op:t.entryType,attributes:y})}function Hz(e,t){try{const n=t.detail;if(!n)return;if(typeof n=="object"){for(const[s,i]of Object.entries(n))if(i&&Cc(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(Cc(n)){e["sentry.browser.measure.detail"]=n;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function qz(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(s=>{Td(e,t,s,n)}),Td(e,t,"secureConnection",n,"TLS/SSL"),Td(e,t,"fetch",n,"cache"),Td(e,t,"domainLookup",n,"DNS"),Kz(e,t,n)}function Td(e,t,n,s,i=n){const a=Vz(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:{[gn]:"auto.ui.browser.metrics",...n==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function Vz(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function Kz(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:{[gn]:"auto.ui.browser.metrics"}}),ti(e,a,i,{op:"browser.response",name:t.name,attributes:{[gn]:"auto.ui.browser.metrics"}}))}function Gz(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={[gn]:"auto.resource.browser.metrics"},p=ta(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),Xz(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,...N1(t)},y=a+s,b=y+i;ti(e,y,b,{name:n.replace(Ge.location.origin,""),op:f,attributes:g})}function Zz(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),Jg(n.rtt)&&(ns["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Jg(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),Jg(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}function Yz(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)),Eh?.sources&&t.recordClsOnPageloadSpan&&Eh.sources.forEach((n,s)=>e.setAttribute(`cls.source.${s+1}`,Vr(n.node)))}function Xz(e,t,n){n.forEach(([s,i])=>{const a=e[s];a!=null&&(typeof a=="number"&&a<Oz||typeof a=="string")&&(t[i]=a)})}function Qz(e){const t=Fu(!1);if(!t)return;const{responseStart:n,requestStart:s}=t;s<=n&&(e["ttfb.requestTime"]={value:n-s,unit:"millisecond"})}function Wz(){return Ku()&&Sr()?Mc("element",Jz):()=>{}}const Jz=({entries:e})=>{const t=Xn(),n=t?Dn(t):void 0,s=n?yt(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={[gn]:"auto.ui.browser.elementtiming",[eo]:"ui.elementtiming",[vs]:"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};PR({name:`element[${a.identifier}]`,attributes:b,startTime:p,onlyIfParent:!0},x=>{x.end(p+y)})})},eL=1e3;let cE,cv,lv;function tL(e){ci("dom",e),li("dom",nL)}function nL(){if(!Ge.document)return;const e=Hr.bind(null,"dom"),t=lE(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=lE(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 rL(e){if(e.type!==cv)return!1;try{if(!e.target||e.target._sentryId!==lv)return!1}catch{}return!0}function sL(e,t){return e!=="keypress"?!1:t?.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function lE(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const s=oL(n);if(sL(n.type,s))return;Yn(n,"_sentryCaptured",!0),s&&!s._sentryId&&Yn(s,"_sentryId",qr());const i=n.type==="keypress"?"input":n.type;rL(n)||(e({event:n,name:i,global:t}),cv=n.type,lv=s?s._sentryId:void 0),clearTimeout(cE),cE=Ge.setTimeout(()=>{lv=void 0,cv=void 0},eL)}}function oL(e){try{return e.target}catch{return null}}let Cd;function vb(e){const t="history";ci(t,e),li(t,iL)}function iL(){if(Ge.addEventListener("popstate",()=>{const t=Ge.location.href,n=Cd;if(Cd=t,n===t)return;Hr("history",{from:n,to:t})}),!T2())return;function e(t){return function(...n){const s=n.length>2?n[2]:void 0;if(s){const i=Cd,a=aL(String(s));if(Cd=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 aL(e){try{return new URL(e,Ge.location.origin).toString()}catch{return e}}const rh={};function cL(e){const t=rh[e];if(t)return t;let n=Ge[e];if(rv(n))return rh[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){$u&&be.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,i)}return n&&(rh[e]=n.bind(Ge))}function lL(e){rh[e]=void 0}const fc="__sentry_xhr_v3__";function j1(e){ci("xhr",e),li("xhr",uL)}function uL(){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=fL(s[1]);if(!l||!f)return t.apply(n,s);n[fc]={method:l,url:f,request_headers:{}},l==="POST"&&f.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const d=()=>{const p=n[fc];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[fc];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[fc];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 fL(e){if(Gs(e))return e;try{return e.toString()}catch{}}function dL(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return $u&&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 ey=[],sh=new Map,cc=new Map,hL=60;function pL(){if(Ku()&&Sr()){const t=mL();return()=>{t()}}return()=>{}}const uv={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 mL(){return vz(gL)}const gL=({metric:e})=>{if(e.value==null)return;const t=Xt(e.value);if(t>hL)return;const n=e.entries.find(S=>S.duration===e.value&&uv[S.name]);if(!n)return;const{interactionId:s}=n,i=uv[n.name],a=Xt(Sr()+n.startTime),l=Xn(),f=l?Dn(l):void 0,d=s!=null?sh.get(s):void 0,p=d?.span||f,g=p?yt(p).description:bt().getScopeData().transactionName,y=d?.elementName||Vr(n.target),b={[gn]:"auto.http.browser.inp",[eo]:`ui.interaction.${i}`,[Kc]:n.duration},x=yb({name:y,transaction:g,attributes:b,startTime:a});x&&(x.addEvent("inp",{[zu]:"millisecond",[Lu]:e.value}),x.end(a+t))};function yL(){const e=Object.keys(uv);D2()&&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(!Ez(f))return;const d=f.interactionId;if(d==null||sh.has(d))return;const p=f.target?Vr(f.target):n(f);if(ey.length>10){const g=ey.shift();sh.delete(g)}ey.push(d),sh.set(d,{span:l,elementName:p})})};Mc("event",s),Mc("first-input",s)}const vL=40;function bL(e,t=cL("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 lL("fetch"),d}finally{n-=l,s--}}return yD(e,i,lb(e.bufferSize||vL))}const Kr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,xL=30,SL=50;function fv(e,t,n,s){const i={filename:e,function:t==="<anonymous>"?sa:t,in_app:!0};return n!==void 0&&(i.lineno=n),s!==void 0&&(i.colno=s),i}const _L=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,wL=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,EL=/\((\S*)(?::(\d+))(?::(\d+))\)/,TL=/at (.+?) ?\(data:(.+?),/,CL=e=>{const t=e.match(TL);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=_L.exec(e);if(n){const[,i,a,l]=n;return fv(i,sa,+a,+l)}const s=wL.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const f=EL.exec(s[2]);f&&(s[2]=f[1],s[3]=f[2],s[4]=f[3])}const[a,l]=A1(s[1]||sa,s[2]);return fv(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},RL=[xL,CL],NL=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,jL=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,AL=e=>{const t=NL.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const a=jL.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]||sa;return[i,s]=A1(i,s),fv(s,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},kL=[SL,AL],OL=[RL,kL],ML=rR(...OL),A1=(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]:sa,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Rd=1024,IL="Breadcrumbs",PL=((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:IL,setup(n){t.console&&e2(UL(n)),t.dom&&tL(LL(n,t.dom)),t.xhr&&j1($L(n)),t.fetch&&l1(BL(n)),t.history&&vb(FL(n)),t.sentry&&n.on("beforeSendEvent",zL(n))}}}),DL=PL;function zL(e){return function(n){vt()===e&&oa({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Ki(n)},{event:n})}}function LL(e,t){return function(s){if(vt()!==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>Rd&&(Kr&&be.warn(`\`dom.maxStringLength\` cannot exceed ${Rd}, but a value of ${f} was configured. Sentry will use ${Rd} instead.`),f=Rd),typeof l=="string"&&(l=[l]);try{const p=s.event,g=HL(p)?p.target:p;i=Vr(g,{keyAttrs:l,maxStringLength:f}),a=uR(g)}catch{i="<unknown>"}if(i.length===0)return;const d={category:`ui.${s.name}`,message:i};a&&(d.data={"ui.component_name":a}),oa(d,{event:s.event,name:s.name,global:s.global})}}function UL(e){return function(n){if(vt()!==e)return;const s={category:"console",data:{arguments:n.args,logger:"console"},level:n2(n.level),message:vw(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)s.message=`Assertion failed: ${vw(n.args.slice(1)," ")||"console.assert"}`,s.data.arguments=n.args.slice(1);else return;oa(s,{input:n.args,level:n.level})}}function $L(e){return function(n){if(vt()!==e)return;const{startTimestamp:s,endTimestamp:i}=n,a=n.xhr[fc];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:c1(d)};e.emit("beforeOutgoingRequestBreadcrumb",b,y),oa(b,y)}}function BL(e){return function(n){if(vt()!==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),oa(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:c1(l.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",d,f),oa(d,f)}}}function FL(e){return function(n){if(vt()!==e)return;let s=n.from,i=n.to;const a=ta(st.location.href);let l=s?ta(s):void 0;const f=ta(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),oa({category:"navigation",data:{from:s,to:i}})}}function HL(e){return!!e&&!!e.target}const qL=["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"],VL="BrowserApiErrors",KL=((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:VL,setupOnce(){t.setTimeout&&gr(st,"setTimeout",uE),t.setInterval&&gr(st,"setInterval",uE),t.requestAnimationFrame&&gr(st,"requestAnimationFrame",ZL),t.XMLHttpRequest&&"XMLHttpRequest"in st&&gr(XMLHttpRequest.prototype,"send",YL);const n=t.eventTarget;n&&(Array.isArray(n)?n:qL).forEach(i=>XL(i,t))}}}),GL=KL;function uE(e){return function(...t){const n=t[0];return t[0]=Oc(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Xs(e)}`}}),e.apply(this,t)}}function ZL(e){return function(t){return e.apply(this,[Oc(t,{mechanism:{data:{handler:Xs(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function YL(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=Zv(a);return f&&(l.mechanism.data.handler=Xs(f)),Oc(a,l)})}),e.apply(this,t)}}function XL(e,t){const s=st[e]?.prototype;s?.hasOwnProperty?.("addEventListener")&&(gr(s,"addEventListener",function(i){return function(a,l,f){try{QL(l)&&(l.handleEvent=Oc(l.handleEvent,{mechanism:{data:{handler:Xs(l),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&WL(this,a,l),i.apply(this,[a,Oc(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 QL(e){return typeof e.handleEvent=="function"}function WL(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const JL=(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}Uw({ignoreDuration:!0}),Gg();const n=Zr();let s=n.getUser();n.addScopeListener(i=>{const a=i.getUser();(s?.id!==a?.id||s?.ip_address!==a?.ip_address)&&(Gg(),s=a)}),t==="route"&&vb(({from:i,to:a})=>{i!==a&&(Uw({ignoreDuration:!0}),Gg())})}}},e4="CultureContext",t4=(()=>({name:e4,preprocessEvent(e){const t=r4();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})}})),n4=t4;function r4(){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 s4="GlobalHandlers",o4=((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:s4,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(a4(n),fE("onerror")),t.onunhandledrejection&&(c4(n),fE("onunhandledrejection"))}}}),i4=o4;function a4(e){oR(t=>{const{stackParser:n,attachStacktrace:s}=k1();if(vt()!==e||f1())return;const{msg:i,url:a,line:l,column:f,error:d}=t,p=f4(pb(n,d||i,void 0,s,!1),a,l,f);p.level="error",BR(p,{originalException:d,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function c4(e){iR(t=>{const{stackParser:n,attachStacktrace:s}=k1();if(vt()!==e||f1())return;const i=l4(t),a=Cc(i)?u4(i):pb(n,i,void 0,s,!0);a.level="error",BR(a,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function l4(e){if(Cc(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 u4(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function f4(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=d4(t)??Ou();return d.length===0&&d.push({colno:p,filename:y,function:sa,in_app:!0,lineno:g}),e}function fE(e){Kr&&be.log(`Global Handler attached: ${e}`)}function k1(){return vt()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function d4(e){if(!(!Gs(e)||e.length===0))return e.startsWith("data:")?`<${Go(e,!1)}>`:e}const h4=()=>({name:"HttpContext",preprocessEvent(e){if(!st.navigator&&!st.location&&!st.document)return;const t=fb(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}}),p4="cause",m4=5,g4="LinkedErrors",y4=((e={})=>{const t=e.limit||m4,n=e.key||p4;return{name:g4,preprocessEvent(s,i,a){const l=a.getOptions();JD(db,l.stackParser,n,t,s,i)}}}),v4=y4;function b4(){return x4()?(Kr&&ha(()=>{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 x4(){if(typeof st.window>"u")return!1;const e=st;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;const n=Ou(),s=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(st===st.top&&s.some(a=>n.startsWith(`${a}://`)))}function S4(e){return[VD(),BD(),f2(),GL(),DL(),i4(),v4(),o2(),h4(),n4(),JL()]}function _4(e={}){const t=!e.skipBrowserExtensionCheck&&b4();let n=e.defaultIntegrations==null?S4():e.defaultIntegrations;const s={...e,enabled:t?!1:e.enabled,stackParser:FM(e.stackParser||ML),integrations:ZP({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||bL};return ND(X2,s)}function w4(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function O1(e){try{return new URL(e,st.location.origin).href}catch{return}}function E4(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function M1(e){try{return new Headers(e)}catch{return}}const dE=new WeakMap,ty=new Map,I1={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function T4(e,t){const{traceFetch:n,traceXHR:s,trackFetchStreamPerformance:i,shouldCreateSpanForRequest:a,enableHTTPTimings:l,tracePropagationTargets:f,onRequestSpanStart:d,onRequestSpanEnd:p}={...I1,...t},g=typeof a=="function"?a:S=>!0,y=S=>C4(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=ty.get(w.span_id);T&&(w.timestamp=T/1e3,ty.delete(w.span_id))}}),S)),i&&N2(S=>{if(S.response){const w=dE.get(S.response);w&&S.endTimestamp&&ty.set(w,S.endTimestamp)}}),l1(S=>{const w=d2(S,g,y,b,{propagateTraceparent:x,onRequestSpanEnd:p});if(S.response&&S.fetchData.__span&&dE.set(S.response,S.fetchData.__span),w){const T=O1(S.fetchData.url),C=T?ta(T).host:void 0;w.setAttributes({"http.url":T?Go(T):void 0,"server.address":C}),l&&hE(w),d?.(w,{headers:S.headers})}})),s&&j1(S=>{const w=R4(S,g,y,b,x,p);w&&(l&&hE(w),d?.(w,{headers:M1(S.xhr.__sentry_xhr_v3__?.request_headers)}))})}function hE(e){const{url:t}=yt(e).data;if(!t||typeof t!="string")return;const n=Mc("resource",({entries:s})=>{s.forEach(i=>{E4(i)&&i.name.endsWith(t)&&(e.setAttributes(N1(i)),setTimeout(n))})})}function C4(e,t){const n=Ou();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?Ko(s.toString(),t)||a&&Ko(s.pathname,t):a}else{const s=!!e.match(/^\/(?!\/)/);return t?Ko(e,t):s}}function R4(e,t,n,s,i,a){const l=e.xhr,f=l?.[fc];if(!l||l.__sentry_own_request__||!f)return;const{url:d,method:p}=f,g=ss()&&t(d);if(e.endTimestamp){const C=l.__sentry_xhr_span_id__;if(!C)return;const k=s[C];k&&(g&&f.status_code!==void 0&&(yR(k,f.status_code),k.end(),a?.(k,{headers:M1(dL(l)),error:e.error})),delete s[C]);return}const y=O1(d),b=ta(y||d),x=Go(OD(d)),S=!!Xn(),w=g&&S?Zc({name:`${p} ${x}`,attributes:{url:Go(d),type:"xhr","http.method":p,"http.url":y?Go(y):void 0,"server.address":b?.host,[gn]:"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)&&N4(l,ss()&&S?w:void 0,i);const T=vt();return T&&T.emit("beforeOutgoingRequestSpan",w,e),w}function N4(e,t,n){const{"sentry-trace":s,baggage:i,traceparent:a}=s1({span:t,propagateTraceparent:n});s&&j4(e,s,i,a)}function j4(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||!w4(a))&&e.setRequestHeader("baggage",n)}}catch{}}function A4(){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}=yt(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 k4=3600,P1="sentry_previous_trace",O4="sentry.previous_trace";function M4(e,{linkPreviousTrace:t,consistentTraceSampling:n}){const s=t==="session-storage";let i=s?D4():void 0;e.on("spanStart",l=>{if(Dn(l)!==l)return;const f=bt().getPropagationContext();i=I4(i,l,f),s&&P4(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(dv(i.spanContext))},sampleRand:i.sampleRand}),l.parentSampled=dv(i.spanContext),l.parentSampleRate=i.sampleRate,l.spanAttributes={...l.spanAttributes,[gR]:i.sampleRate}})}function I4(e,t,n){const s=yt(t);function i(){try{return Number(n.dsc?.sample_rate)??Number(s.data?.[Yv])}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<=k4&&(Kr&&be.log(`Adding previous_trace \`${JSON.stringify(l)}\` link to span \`${JSON.stringify({op:s.op,...t.spanContext()})}\``),t.addLink({context:l,attributes:{[mI]:"previous_trace"}}),t.setAttribute(O4,`${l.traceId}-${l.spanId}-${dv(l)?1:0}`)),a)}function P4(e){try{st.sessionStorage.setItem(P1,JSON.stringify(e))}catch(t){Kr&&be.warn("Could not store previous trace in sessionStorage",t)}}function D4(){try{const e=st.sessionStorage?.getItem(P1);return JSON.parse(e)}catch{return}}function dv(e){return e.traceFlags===1}const z4="BrowserTracing",L4={...Jd,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:{},...I1},U4=((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:k,enableHTTPTimings:N,ignoreResourceSpans:R,ignorePerformanceApiSpans:M,instrumentPageLoad:L,instrumentNavigation:j,detectRedirects:A,linkPreviousTrace:P,consistentTraceSampling:G,enableReportPageLoaded:B,onRequestSpanStart:z,onRequestSpanEnd:Q}={...L4,...e};let Y,ee,D;function K(q,V,U=!0){const I=V.op==="pageload",H=V.name,W=g?g(V):V,X=W.attributes||{};if(H!==W.name&&(X[vs]="custom",W.attributes=X),!U){const de=pa();Zc({...W,startTime:de}).end(de);return}t.name=W.name,t.source=X[vs];const oe=UR(W,{idleTimeout:y,finalTimeout:b,childSpanTimeout:x,disableAutoFinish:I,beforeSpanEnd:de=>{Y?.(),$z(de,{recordClsOnPageloadSpan:!d,recordLcpOnPageloadSpan:!p,ignoreResourceSpans:R,ignorePerformanceApiSpans:M}),gE(q,void 0);const xe=bt(),he=xe.getPropagationContext();xe.setPropagationContext({...he,traceId:oe.spanContext().traceId,sampled:ui(oe),dsc:to(de)}),I&&(D=void 0)},trimIdleSpanEndTimestamp:!B});I&&B&&(D=oe),gE(q,oe);function se(){n&&["interactive","complete"].includes(n.readyState)&&q.emit("idleSpanEnableAutoFinish",oe)}I&&!B&&n&&(n.addEventListener("readystatechange",()=>{se()}),se())}return{name:z4,setup(q){if(qI(),Y=Mz({recordClsStandaloneSpans:d||!1,recordLcpStandaloneSpans:p||!1,client:q}),s&&pL(),i&&Wz(),l&&ct.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?Pz():a&&Iz(),f&&Dz(),A&&n){const U=()=>{ee=cn()};addEventListener("click",U,{capture:!0}),addEventListener("keydown",U,{capture:!0,passive:!0})}function V(){const U=_u(q);U&&!yt(U).timestamp&&(Kr&&be.log(`[Tracing] Finishing current active span with op: ${yt(U).op}`),U.setAttribute(vu,"cancelled"),U.end())}q.on("startNavigationSpan",(U,I)=>{if(vt()!==q)return;if(I?.isRedirect){Kr&&be.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),K(q,{op:"navigation.redirect",...U},!1);return}ee=void 0,V(),Zr().setPropagationContext({traceId:Ws(),sampleRand:Math.random(),propagationSpanId:ss()?void 0:Zs()});const H=bt();H.setPropagationContext({traceId:Ws(),sampleRand:Math.random(),propagationSpanId:ss()?void 0:Zs()}),H.setSDKProcessingMetadata({normalizedRequest:void 0}),K(q,{op:"navigation",...U,parentSpan:null,forceTransaction:!0})}),q.on("startPageLoadSpan",(U,I={})=>{if(vt()!==q)return;V();const H=I.sentryTrace||pE("sentry-trace")||mE("sentry-trace"),W=I.baggage||pE("baggage")||mE("baggage"),X=DI(H,W),oe=bt();oe.setPropagationContext(X),ss()||(oe.getPropagationContext().propagationSpanId=Zs()),oe.setSDKProcessingMetadata({normalizedRequest:fb()}),K(q,{op:"pageload",...U})}),q.on("endPageloadSpan",()=>{B&&D&&(D.setAttribute(vu,"reportPageLoaded"),D.end())})},afterAllSetup(q){let V=Ou();if(P!=="off"&&M4(q,{linkPreviousTrace:P,consistentTraceSampling:G}),st.location){if(L){const U=Sr();$4(q,{name:st.location.pathname,startTime:U?U/1e3:void 0,attributes:{[vs]:"url",[gn]:"auto.pageload.browser"}})}j&&vb(({to:U,from:I})=>{if(I===void 0&&V?.indexOf(U)!==-1){V=void 0;return}V=void 0;const H=n1(U),W=_u(q),X=W&&A&&H4(W,ee);B4(q,{name:H?.pathname||st.location.pathname,attributes:{[vs]:"url",[gn]:"auto.navigation.browser"}},{url:U,isRedirect:X})})}S&&A4(),f&&F4(q,y,b,x,t),s&&yL(),T4(q,{traceFetch:w,traceXHR:T,trackFetchStreamPerformance:C,tracePropagationTargets:q.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:k,enableHTTPTimings:N,onRequestSpanStart:z,onRequestSpanEnd:Q})}}});function $4(e,t,n){e.emit("startPageLoadSpan",t,n),bt().setTransactionName(t.name);const s=_u(e);return s&&e.emit("afterStartPageLoadSpan",s),s}function B4(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:{...fb(),url:s}}),_u(e)}function pE(e){return st.document?.querySelector(`meta[name=${e}]`)?.getAttribute("content")||void 0}function mE(e){return st.performance?.getEntriesByType?.("navigation")[0]?.serverTiming?.find(s=>s.name===e)?.description}function F4(e,t,n,s,i){const a=st.document;let l;const f=()=>{const d="ui.action.click",p=_u(e);if(p){const g=yt(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(vu,"interactionInterrupted"),l.end(),l=void 0),!i.name){Kr&&be.warn(`[Tracing] Did not create ${d} transaction because _latestRouteName is missing.`);return}l=UR({name:i.name,op:d,attributes:{[vs]:i.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:s})};a&&addEventListener("click",f,{capture:!0})}const D1="_sentry_idleSpan";function _u(e){return e[D1]}function gE(e,t){Yn(e,D1,t)}const yE=1.5;function H4(e,t){const n=yt(e),s=pa(),i=n.start_timestamp;return!(s-i>yE||t&&s-t<=yE)}function z1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ny={exports:{}},Ke={};var vE;function q4(){if(vE)return Ke;vE=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(I){return I===null||typeof I!="object"?null:(I=b&&I[b]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,T={};function C(I,H,W){this.props=I,this.context=H,this.refs=T,this.updater=W||S}C.prototype.isReactComponent={},C.prototype.setState=function(I,H){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,H,"setState")},C.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function k(){}k.prototype=C.prototype;function N(I,H,W){this.props=I,this.context=H,this.refs=T,this.updater=W||S}var R=N.prototype=new k;R.constructor=N,w(R,C.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function L(){}var j={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function P(I,H,W){var X=W.ref;return{$$typeof:e,type:I,key:H,ref:X!==void 0?X:null,props:W}}function G(I,H){return P(I.type,H,I.props)}function B(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function z(I){var H={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(W){return H[W]})}var Q=/\/+/g;function Y(I,H){return typeof I=="object"&&I!==null&&I.key!=null?z(""+I.key):H.toString(36)}function ee(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(L,L):(I.status="pending",I.then(function(H){I.status==="pending"&&(I.status="fulfilled",I.value=H)},function(H){I.status==="pending"&&(I.status="rejected",I.reason=H)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function D(I,H,W,X,oe){var se=typeof I;(se==="undefined"||se==="boolean")&&(I=null);var de=!1;if(I===null)de=!0;else switch(se){case"bigint":case"string":case"number":de=!0;break;case"object":switch(I.$$typeof){case e:case t:de=!0;break;case g:return de=I._init,D(de(I._payload),H,W,X,oe)}}if(de)return oe=oe(I),de=X===""?"."+Y(I,0):X,M(oe)?(W="",de!=null&&(W=de.replace(Q,"$&/")+"/"),D(oe,H,W,"",function(Me){return Me})):oe!=null&&(B(oe)&&(oe=G(oe,W+(oe.key==null||I&&I.key===oe.key?"":(""+oe.key).replace(Q,"$&/")+"/")+de)),H.push(oe)),1;de=0;var xe=X===""?".":X+":";if(M(I))for(var he=0;he<I.length;he++)X=I[he],se=xe+Y(X,he),de+=D(X,H,W,se,oe);else if(he=x(I),typeof he=="function")for(I=he.call(I),he=0;!(X=I.next()).done;)X=X.value,se=xe+Y(X,he++),de+=D(X,H,W,se,oe);else if(se==="object"){if(typeof I.then=="function")return D(ee(I),H,W,X,oe);throw H=String(I),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return de}function K(I,H,W){if(I==null)return I;var X=[],oe=0;return D(I,X,"","",function(se){return H.call(W,se,oe++)}),X}function q(I){if(I._status===-1){var H=I._result;H=H(),H.then(function(W){(I._status===0||I._status===-1)&&(I._status=1,I._result=W)},function(W){(I._status===0||I._status===-1)&&(I._status=2,I._result=W)}),I._status===-1&&(I._status=0,I._result=H)}if(I._status===1)return I._result.default;throw I._result}var V=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},U={map:K,forEach:function(I,H,W){K(I,function(){H.apply(this,arguments)},W)},count:function(I){var H=0;return K(I,function(){H++}),H},toArray:function(I){return K(I,function(H){return H})||[]},only:function(I){if(!B(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Ke.Activity=y,Ke.Children=U,Ke.Component=C,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=N,Ke.StrictMode=s,Ke.Suspense=d,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(I){return j.H.useMemoCache(I)}},Ke.cache=function(I){return function(){return I.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(I,H,W){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var X=w({},I.props),oe=I.key;if(H!=null)for(se in H.key!==void 0&&(oe=""+H.key),H)!A.call(H,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&H.ref===void 0||(X[se]=H[se]);var se=arguments.length-2;if(se===1)X.children=W;else if(1<se){for(var de=Array(se),xe=0;xe<se;xe++)de[xe]=arguments[xe+2];X.children=de}return P(I.type,oe,X)},Ke.createContext=function(I){return I={$$typeof:l,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:a,_context:I},I},Ke.createElement=function(I,H,W){var X,oe={},se=null;if(H!=null)for(X in H.key!==void 0&&(se=""+H.key),H)A.call(H,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(oe[X]=H[X]);var de=arguments.length-2;if(de===1)oe.children=W;else if(1<de){for(var xe=Array(de),he=0;he<de;he++)xe[he]=arguments[he+2];oe.children=xe}if(I&&I.defaultProps)for(X in de=I.defaultProps,de)oe[X]===void 0&&(oe[X]=de[X]);return P(I,se,oe)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(I){return{$$typeof:f,render:I}},Ke.isValidElement=B,Ke.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:q}},Ke.memo=function(I,H){return{$$typeof:p,type:I,compare:H===void 0?null:H}},Ke.startTransition=function(I){var H=j.T,W={};j.T=W;try{var X=I(),oe=j.S;oe!==null&&oe(W,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(L,V)}catch(se){V(se)}finally{H!==null&&W.types!==null&&(H.types=W.types),j.T=H}},Ke.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Ke.use=function(I){return j.H.use(I)},Ke.useActionState=function(I,H,W){return j.H.useActionState(I,H,W)},Ke.useCallback=function(I,H){return j.H.useCallback(I,H)},Ke.useContext=function(I){return j.H.useContext(I)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(I,H){return j.H.useDeferredValue(I,H)},Ke.useEffect=function(I,H){return j.H.useEffect(I,H)},Ke.useEffectEvent=function(I){return j.H.useEffectEvent(I)},Ke.useId=function(){return j.H.useId()},Ke.useImperativeHandle=function(I,H,W){return j.H.useImperativeHandle(I,H,W)},Ke.useInsertionEffect=function(I,H){return j.H.useInsertionEffect(I,H)},Ke.useLayoutEffect=function(I,H){return j.H.useLayoutEffect(I,H)},Ke.useMemo=function(I,H){return j.H.useMemo(I,H)},Ke.useOptimistic=function(I,H){return j.H.useOptimistic(I,H)},Ke.useReducer=function(I,H,W){return j.H.useReducer(I,H,W)},Ke.useRef=function(I){return j.H.useRef(I)},Ke.useState=function(I){return j.H.useState(I)},Ke.useSyncExternalStore=function(I,H,W){return j.H.useSyncExternalStore(I,H,W)},Ke.useTransition=function(){return j.H.useTransition()},Ke.version="19.2.4",Ke}var bE;function Gu(){return bE||(bE=1,ny.exports=q4()),ny.exports}var _=Gu();const Ic=z1(_),L1=IM({__proto__:null,default:Ic},[_]);function V4(e){const t={...e};return r1(t,"react"),$P("react",{version:_.version}),_4(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 yc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class U1 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $1={};function ni(e){return $1}function B1(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 hv(e,t){return typeof t=="bigint"?t.toString():t}function bb(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function xb(e){return e==null}function Sb(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function K4(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 xE=Symbol("evaluating");function wt(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==xE)return s===void 0&&(s=xE,s=n()),s},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function ga(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 SE(e){return JSON.stringify(e)}function G4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const F1="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Th(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Z4=bb(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Pc(e){if(Th(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Th(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function H1(e){return Pc(e)?{...e}:Array.isArray(e)?[...e]:e}const Y4=new Set(["string","number","symbol"]);function Dc(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 X4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Q4={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 W4(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 ga(this,"shape",l),l},checks:[]});return di(e,a)}function J4(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 ga(this,"shape",l),l},checks:[]});return di(e,a)}function e5(e,t){if(!Pc(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 ga(this,"shape",a),a}});return di(e,i)}function t5(e,t){if(!Pc(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 ga(this,"shape",s),s}});return di(e,n)}function n5(e,t){const n=fi(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return ga(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return di(e,n)}function r5(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 ga(this,"shape",d),d},checks:[]});return di(t,l)}function s5(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 ga(this,"shape",a),a}});return di(t,s)}function dc(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 hc(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}function Nd(e){return typeof e=="string"?e:e?.message}function ri(e,t,n){const s={...e,path:e.path??[]};if(!e.message){const i=Nd(e.inst?._zod.def?.error?.(e))??Nd(t?.error?.(e))??Nd(n.customError?.(e))??Nd(n.localeError?.(e))??"Invalid input";s.message=i}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function _b(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function wu(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}const q1=(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,hv,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},V1=ue("$ZodError",q1),K1=ue("$ZodError",q1,{Parent:Error});function o5(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 i5(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 wb=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 yc;if(l.issues.length){const f=new(i?.Err??e)(l.issues.map(d=>ri(d,a,ni())));throw F1(f,i?.callee),f}return l.value},Eb=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 F1(f,i?.callee),f}return l.value},cp=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 yc;return a.issues.length?{success:!1,error:new(e??V1)(a.issues.map(l=>ri(l,i,ni())))}:{success:!0,data:a.value}},a5=cp(K1),lp=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}},c5=lp(K1),l5=e=>(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return wb(e)(t,n,i)},u5=e=>(t,n,s)=>wb(e)(t,n,s),f5=e=>async(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Eb(e)(t,n,i)},d5=e=>async(t,n,s)=>Eb(e)(t,n,s),h5=e=>(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return cp(e)(t,n,i)},p5=e=>(t,n,s)=>cp(e)(t,n,s),m5=e=>async(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return lp(e)(t,n,i)},g5=e=>async(t,n,s)=>lp(e)(t,n,s),y5=/^[cC][^\s-]{8,}$/,v5=/^[0-9a-z]+$/,b5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,x5=/^[0-9a-vA-V]{20}$/,S5=/^[A-Za-z0-9]{27}$/,_5=/^[a-zA-Z0-9_-]{21}$/,w5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,E5=/^([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})$/,_E=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)$/,T5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,C5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function R5(){return new RegExp(C5,"u")}const N5=/^(?:(?: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])$/,j5=/^(([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}|:))$/,A5=/^((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])$/,k5=/^(([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])$/,O5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,G1=/^[A-Za-z0-9_-]*$/,M5=/^\+[1-9]\d{6,14}$/,Z1="(?:(?:\\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])))",I5=new RegExp(`^${Z1}$`);function Y1(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 P5(e){return new RegExp(`^${Y1(e)}$`)}function D5(e){const t=Y1({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(`^${Z1}T(?:${s})$`)}const z5=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},L5=/^-?\d+$/,X1=/^-?\d+(?:\.\d+)?$/,U5=/^(?:true|false)$/i,$5=/^[^A-Z]*$/,B5=/^[^a-z]*$/,Qn=ue("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Q1={number:"number",bigint:"bigint",object:"date"},W1=ue("$ZodCheckLessThan",(e,t)=>{Qn.init(e,t);const n=Q1[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})}}),J1=ue("$ZodCheckGreaterThan",(e,t)=>{Qn.init(e,t);const n=Q1[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})}}),F5=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):K4(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})}}),H5=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]=Q4[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=L5)}),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})}}),q5=ue("$ZodCheckMaxLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!xb(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=_b(i);s.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),V5=ue("$ZodCheckMinLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!xb(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=_b(i);s.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),K5=ue("$ZodCheckLengthEquals",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!xb(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=_b(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})}}),up=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=()=>{})}),G5=ue("$ZodCheckRegex",(e,t)=>{up.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})}}),Z5=ue("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=$5),up.init(e,t)}),Y5=ue("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=B5),up.init(e,t)}),X5=ue("$ZodCheckIncludes",(e,t)=>{Qn.init(e,t);const n=Dc(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})}}),Q5=ue("$ZodCheckStartsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`^${Dc(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})}}),W5=ue("$ZodCheckEndsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`.*${Dc(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})}}),J5=ue("$ZodCheckOverwrite",(e,t)=>{Qn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class eU{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 bz(){return oz(e=>{Vu("cls",{metric:e}),v1=e},{reportAllChanges:!0})}function xz(){return pz(e=>{Vu("lcp",{metric:e}),b1=e},{reportAllChanges:!0})}function Sz(){return gz(e=>{Vu("ttfb",{metric:e}),x1=e})}function _z(){return fz(e=>{Vu("inp",{metric:e}),S1=e})}function ap(e,t,n,s,i=!1){E1(e,t);let a;return wh[e]||(a=n(),wh[e]=!0),s&&t({metric:s}),T1(e,t,i?a:void 0)}function wz(e){const t={};e==="event"&&(t.durationThreshold=0),Qc(e,n=>{Vu(e,{entries:n})},t)}function E1(e,t){uu[e]=uu[e]||[],uu[e].push(t)}function T1(e,t,n){return()=>{n&&n();const s=uu[e];if(!s)return;const i=s.indexOf(t);i!==-1&&s.splice(i,1)}}function Ez(e){return"duration"in e}const Tz=e=>{const t=n=>{(n.type==="pagehide"||Ge.document?.visibilityState==="hidden")&&e(n)};Zo("visibilitychange",t,{capture:!0,once:!0}),Zo("pagehide",t,{capture:!0,once:!0})};function Jg(e){return typeof e=="number"&&isFinite(e)}function ti(e,t,n,{...s}){const i=yt(e).start_timestamp;return i&&i>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),nb(e,()=>{const a=Zc({startTime:t,...s});return a&&a.end(n),a})}function yb(e){const t=vt();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 Zc({name:n,attributes:w,startTime:a,experimental:{standalone:!0}})}function Ku(){return Ge.addEventListener&&Ge.performance}function Xt(e){return e/1e3}function Cz(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 C1(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function R1(e,t){let n,s=!1;function i(f){!s&&n&&t(f,n),s=!0}Tz(()=>{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 Rz(e){let t=0,n;if(!C1("layout-shift"))return;const s=_1(({metric:i})=>{const a=i.entries[i.entries.length-1];a&&(t=i.value,n=a)},!0);R1(e,(i,a)=>{Nz(t,n,a,i),s()})}function Nz(e,t,n,s){$u&&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={[gn]:"auto.http.browser.cls",[eo]:"ui.webvital.cls",[Kc]: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=yb({name:l,transaction:a,attributes:f,startTime:i});d&&(d.addEvent("cls",{[zu]:"",[Lu]:e}),d.end(i))}function jz(e){let t=0,n;if(!C1("largest-contentful-paint"))return;const s=w1(({metric:i})=>{const a=i.entries[i.entries.length-1];a&&(t=i.value,n=a)},!0);R1(e,(i,a)=>{Az(t,n,a,i),s()})}function Az(e,t,n,s){$u&&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={[gn]:"auto.http.browser.lcp",[eo]:"ui.webvital.lcp",[Kc]: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=yb({name:l,transaction:a,attributes:f,startTime:i});d&&(d.addEvent("lcp",{[zu]:"millisecond",[Lu]:e}),d.end(i))}function Pr(e){return e&&((Sr()||performance.timeOrigin)+e)/1e3}function N1(e){const t={};if(e.nextHopProtocol!=null){const{name:n,version:s}=Cz(e.nextHopProtocol);t["network.protocol.version"]=s,t["network.protocol.name"]=n}return Sr()||Ku()?.timeOrigin?kz({...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 kz(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}const Oz=2147483647;let aE=0,ns={},Kn,Eh;function Mz({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){const s=Ku();if(s&&Sr()){s.mark&&Ge.performance.mark("sentry-tracing-init");const i=t?jz(n):Lz(),a=Uz(),l=e?Rz(n):zz();return()=>{i?.(),a(),l?.()}}return()=>{}}function Iz(){Mc("longtask",({entries:e})=>{const t=Xn();if(!t)return;const{op:n,start_timestamp:s}=yt(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:{[gn]:"auto.ui.browser.metrics"}})}})}function Pz(){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}=yt(n);if(l==="navigation"&&a&&i<a)continue;const f=Xt(s.duration),d={[gn]:"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 Dz(){Mc("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:{[gn]:"auto.ui.browser.metrics"}},l=uR(n.target);l&&(a.attributes["ui.component_name"]=l),ti(t,s,s+i,a)}}})}function zz(){return _1(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ns.cls={value:e.value,unit:""},Eh=t)},!0)}function Lz(){return w1(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(ns.lcp={value:e.value,unit:"millisecond"},Kn=t)},!0)}function Uz(){return yz(({metric:e})=>{e.entries[e.entries.length-1]&&(ns.ttfb={value:e.value,unit:"millisecond"})})}function $z(e,t){const n=Ku(),s=Sr();if(!n?.getEntries||!s)return;const i=Xt(s),a=n.getEntries(),{op:l,start_timestamp:f}=yt(e);a.slice(aE).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":{qz(e,d,i);break}case"mark":case"paint":case"measure":{Fz(e,d,p,g,i,t.ignorePerformanceApiSpans);const y=Hu(),b=d.startTime<y.firstHiddenTime;d.name==="first-paint"&&b&&(ns.fp={value:d.startTime,unit:"millisecond"}),d.name==="first-contentful-paint"&&b&&(ns.fcp={value:d.startTime,unit:"millisecond"});break}case"resource":{Gz(e,d,d.name,p,g,i,t.ignoreResourceSpans);break}}}),aE=Math.max(a.length-1,0),Zz(e),l==="pageload"&&(Qz(ns),t.recordClsOnPageloadSpan||delete ns.cls,t.recordLcpOnPageloadSpan||delete ns.lcp,Object.entries(ns).forEach(([d,p])=>{dP(d,p.value,p.unit)}),e.setAttribute("performance.timeOrigin",i),e.setAttribute("performance.activationStart",Xc()),Yz(e,t)),Kn=void 0,Eh=void 0,ns={}}function Bz(e){if(e?.entryType==="measure")try{return e.detail.devtools.track==="Components ⚛"}catch{return}}function Fz(e,t,n,s,i,a){if(Bz(t)||["mark","measure"].includes(t.entryType)&&Ko(t.name,a))return;const l=Fu(!1),f=Xt(l?l.requestStart:0),d=i+Math.max(n,f),p=i+n,g=p+s,y={[gn]:"auto.resource.browser.metrics"};d!==p&&(y["sentry.browser.measure_happened_before_request"]=!0,y["sentry.browser.measure_start_time"]=d),Hz(y,t),d<=g&&ti(e,d,g,{name:t.name,op:t.entryType,attributes:y})}function Hz(e,t){try{const n=t.detail;if(!n)return;if(typeof n=="object"){for(const[s,i]of Object.entries(n))if(i&&Cc(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(Cc(n)){e["sentry.browser.measure.detail"]=n;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function qz(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(s=>{Td(e,t,s,n)}),Td(e,t,"secureConnection",n,"TLS/SSL"),Td(e,t,"fetch",n,"cache"),Td(e,t,"domainLookup",n,"DNS"),Kz(e,t,n)}function Td(e,t,n,s,i=n){const a=Vz(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:{[gn]:"auto.ui.browser.metrics",...n==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function Vz(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function Kz(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:{[gn]:"auto.ui.browser.metrics"}}),ti(e,a,i,{op:"browser.response",name:t.name,attributes:{[gn]:"auto.ui.browser.metrics"}}))}function Gz(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={[gn]:"auto.resource.browser.metrics"},p=ta(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),Xz(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,...N1(t)},y=a+s,b=y+i;ti(e,y,b,{name:n.replace(Ge.location.origin,""),op:f,attributes:g})}function Zz(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),Jg(n.rtt)&&(ns["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Jg(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),Jg(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}function Yz(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)),Eh?.sources&&t.recordClsOnPageloadSpan&&Eh.sources.forEach((n,s)=>e.setAttribute(`cls.source.${s+1}`,Vr(n.node)))}function Xz(e,t,n){n.forEach(([s,i])=>{const a=e[s];a!=null&&(typeof a=="number"&&a<Oz||typeof a=="string")&&(t[i]=a)})}function Qz(e){const t=Fu(!1);if(!t)return;const{responseStart:n,requestStart:s}=t;s<=n&&(e["ttfb.requestTime"]={value:n-s,unit:"millisecond"})}function Wz(){return Ku()&&Sr()?Mc("element",Jz):()=>{}}const Jz=({entries:e})=>{const t=Xn(),n=t?Dn(t):void 0,s=n?yt(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={[gn]:"auto.ui.browser.elementtiming",[eo]:"ui.elementtiming",[vs]:"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};PR({name:`element[${a.identifier}]`,attributes:b,startTime:p,onlyIfParent:!0},x=>{x.end(p+y)})})},eL=1e3;let cE,cv,lv;function tL(e){ci("dom",e),li("dom",nL)}function nL(){if(!Ge.document)return;const e=Hr.bind(null,"dom"),t=lE(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=lE(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 rL(e){if(e.type!==cv)return!1;try{if(!e.target||e.target._sentryId!==lv)return!1}catch{}return!0}function sL(e,t){return e!=="keypress"?!1:t?.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function lE(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const s=oL(n);if(sL(n.type,s))return;Yn(n,"_sentryCaptured",!0),s&&!s._sentryId&&Yn(s,"_sentryId",qr());const i=n.type==="keypress"?"input":n.type;rL(n)||(e({event:n,name:i,global:t}),cv=n.type,lv=s?s._sentryId:void 0),clearTimeout(cE),cE=Ge.setTimeout(()=>{lv=void 0,cv=void 0},eL)}}function oL(e){try{return e.target}catch{return null}}let Cd;function vb(e){const t="history";ci(t,e),li(t,iL)}function iL(){if(Ge.addEventListener("popstate",()=>{const t=Ge.location.href,n=Cd;if(Cd=t,n===t)return;Hr("history",{from:n,to:t})}),!TD())return;function e(t){return function(...n){const s=n.length>2?n[2]:void 0;if(s){const i=Cd,a=aL(String(s));if(Cd=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 aL(e){try{return new URL(e,Ge.location.origin).toString()}catch{return e}}const rh={};function cL(e){const t=rh[e];if(t)return t;let n=Ge[e];if(rv(n))return rh[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){$u&&be.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,i)}return n&&(rh[e]=n.bind(Ge))}function lL(e){rh[e]=void 0}const fc="__sentry_xhr_v3__";function j1(e){ci("xhr",e),li("xhr",uL)}function uL(){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=fL(s[1]);if(!l||!f)return t.apply(n,s);n[fc]={method:l,url:f,request_headers:{}},l==="POST"&&f.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const d=()=>{const p=n[fc];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[fc];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[fc];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 fL(e){if(Gs(e))return e;try{return e.toString()}catch{}}function dL(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return $u&&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 ey=[],sh=new Map,cc=new Map,hL=60;function pL(){if(Ku()&&Sr()){const t=mL();return()=>{t()}}return()=>{}}const uv={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 mL(){return vz(gL)}const gL=({metric:e})=>{if(e.value==null)return;const t=Xt(e.value);if(t>hL)return;const n=e.entries.find(S=>S.duration===e.value&&uv[S.name]);if(!n)return;const{interactionId:s}=n,i=uv[n.name],a=Xt(Sr()+n.startTime),l=Xn(),f=l?Dn(l):void 0,d=s!=null?sh.get(s):void 0,p=d?.span||f,g=p?yt(p).description:bt().getScopeData().transactionName,y=d?.elementName||Vr(n.target),b={[gn]:"auto.http.browser.inp",[eo]:`ui.interaction.${i}`,[Kc]:n.duration},x=yb({name:y,transaction:g,attributes:b,startTime:a});x&&(x.addEvent("inp",{[zu]:"millisecond",[Lu]:e.value}),x.end(a+t))};function yL(){const e=Object.keys(uv);DD()&&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(!Ez(f))return;const d=f.interactionId;if(d==null||sh.has(d))return;const p=f.target?Vr(f.target):n(f);if(ey.length>10){const g=ey.shift();sh.delete(g)}ey.push(d),sh.set(d,{span:l,elementName:p})})};Mc("event",s),Mc("first-input",s)}const vL=40;function bL(e,t=cL("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 lL("fetch"),d}finally{n-=l,s--}}return y2(e,i,lb(e.bufferSize||vL))}const Kr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,xL=30,SL=50;function fv(e,t,n,s){const i={filename:e,function:t==="<anonymous>"?sa:t,in_app:!0};return n!==void 0&&(i.lineno=n),s!==void 0&&(i.colno=s),i}const _L=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,wL=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,EL=/\((\S*)(?::(\d+))(?::(\d+))\)/,TL=/at (.+?) ?\(data:(.+?),/,CL=e=>{const t=e.match(TL);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const n=_L.exec(e);if(n){const[,i,a,l]=n;return fv(i,sa,+a,+l)}const s=wL.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const f=EL.exec(s[2]);f&&(s[2]=f[1],s[3]=f[2],s[4]=f[3])}const[a,l]=A1(s[1]||sa,s[2]);return fv(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},RL=[xL,CL],NL=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,jL=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,AL=e=>{const t=NL.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const a=jL.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]||sa;return[i,s]=A1(i,s),fv(s,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},kL=[SL,AL],OL=[RL,kL],ML=rR(...OL),A1=(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]:sa,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Rd=1024,IL="Breadcrumbs",PL=((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:IL,setup(n){t.console&&eD(UL(n)),t.dom&&tL(LL(n,t.dom)),t.xhr&&j1($L(n)),t.fetch&&l1(BL(n)),t.history&&vb(FL(n)),t.sentry&&n.on("beforeSendEvent",zL(n))}}}),DL=PL;function zL(e){return function(n){vt()===e&&oa({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Ki(n)},{event:n})}}function LL(e,t){return function(s){if(vt()!==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>Rd&&(Kr&&be.warn(`\`dom.maxStringLength\` cannot exceed ${Rd}, but a value of ${f} was configured. Sentry will use ${Rd} instead.`),f=Rd),typeof l=="string"&&(l=[l]);try{const p=s.event,g=HL(p)?p.target:p;i=Vr(g,{keyAttrs:l,maxStringLength:f}),a=uR(g)}catch{i="<unknown>"}if(i.length===0)return;const d={category:`ui.${s.name}`,message:i};a&&(d.data={"ui.component_name":a}),oa(d,{event:s.event,name:s.name,global:s.global})}}function UL(e){return function(n){if(vt()!==e)return;const s={category:"console",data:{arguments:n.args,logger:"console"},level:nD(n.level),message:vw(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)s.message=`Assertion failed: ${vw(n.args.slice(1)," ")||"console.assert"}`,s.data.arguments=n.args.slice(1);else return;oa(s,{input:n.args,level:n.level})}}function $L(e){return function(n){if(vt()!==e)return;const{startTimestamp:s,endTimestamp:i}=n,a=n.xhr[fc];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:c1(d)};e.emit("beforeOutgoingRequestBreadcrumb",b,y),oa(b,y)}}function BL(e){return function(n){if(vt()!==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),oa(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:c1(l.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",d,f),oa(d,f)}}}function FL(e){return function(n){if(vt()!==e)return;let s=n.from,i=n.to;const a=ta(st.location.href);let l=s?ta(s):void 0;const f=ta(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),oa({category:"navigation",data:{from:s,to:i}})}}function HL(e){return!!e&&!!e.target}const qL=["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"],VL="BrowserApiErrors",KL=((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:VL,setupOnce(){t.setTimeout&&gr(st,"setTimeout",uE),t.setInterval&&gr(st,"setInterval",uE),t.requestAnimationFrame&&gr(st,"requestAnimationFrame",ZL),t.XMLHttpRequest&&"XMLHttpRequest"in st&&gr(XMLHttpRequest.prototype,"send",YL);const n=t.eventTarget;n&&(Array.isArray(n)?n:qL).forEach(i=>XL(i,t))}}}),GL=KL;function uE(e){return function(...t){const n=t[0];return t[0]=Oc(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Xs(e)}`}}),e.apply(this,t)}}function ZL(e){return function(t){return e.apply(this,[Oc(t,{mechanism:{data:{handler:Xs(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function YL(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=Zv(a);return f&&(l.mechanism.data.handler=Xs(f)),Oc(a,l)})}),e.apply(this,t)}}function XL(e,t){const s=st[e]?.prototype;s?.hasOwnProperty?.("addEventListener")&&(gr(s,"addEventListener",function(i){return function(a,l,f){try{QL(l)&&(l.handleEvent=Oc(l.handleEvent,{mechanism:{data:{handler:Xs(l),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&WL(this,a,l),i.apply(this,[a,Oc(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 QL(e){return typeof e.handleEvent=="function"}function WL(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const JL=(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}Uw({ignoreDuration:!0}),Gg();const n=Zr();let s=n.getUser();n.addScopeListener(i=>{const a=i.getUser();(s?.id!==a?.id||s?.ip_address!==a?.ip_address)&&(Gg(),s=a)}),t==="route"&&vb(({from:i,to:a})=>{i!==a&&(Uw({ignoreDuration:!0}),Gg())})}}},e4="CultureContext",t4=(()=>({name:e4,preprocessEvent(e){const t=r4();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})}})),n4=t4;function r4(){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 s4="GlobalHandlers",o4=((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:s4,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(a4(n),fE("onerror")),t.onunhandledrejection&&(c4(n),fE("onunhandledrejection"))}}}),i4=o4;function a4(e){oR(t=>{const{stackParser:n,attachStacktrace:s}=k1();if(vt()!==e||f1())return;const{msg:i,url:a,line:l,column:f,error:d}=t,p=f4(pb(n,d||i,void 0,s,!1),a,l,f);p.level="error",BR(p,{originalException:d,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function c4(e){iR(t=>{const{stackParser:n,attachStacktrace:s}=k1();if(vt()!==e||f1())return;const i=l4(t),a=Cc(i)?u4(i):pb(n,i,void 0,s,!0);a.level="error",BR(a,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function l4(e){if(Cc(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 u4(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function f4(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=d4(t)??Ou();return d.length===0&&d.push({colno:p,filename:y,function:sa,in_app:!0,lineno:g}),e}function fE(e){Kr&&be.log(`Global Handler attached: ${e}`)}function k1(){return vt()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function d4(e){if(!(!Gs(e)||e.length===0))return e.startsWith("data:")?`<${Go(e,!1)}>`:e}const h4=()=>({name:"HttpContext",preprocessEvent(e){if(!st.navigator&&!st.location&&!st.document)return;const t=fb(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}}),p4="cause",m4=5,g4="LinkedErrors",y4=((e={})=>{const t=e.limit||m4,n=e.key||p4;return{name:g4,preprocessEvent(s,i,a){const l=a.getOptions();J2(db,l.stackParser,n,t,s,i)}}}),v4=y4;function b4(){return x4()?(Kr&&ha(()=>{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 x4(){if(typeof st.window>"u")return!1;const e=st;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;const n=Ou(),s=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(st===st.top&&s.some(a=>n.startsWith(`${a}://`)))}function S4(e){return[V2(),B2(),fD(),GL(),DL(),i4(),v4(),oD(),h4(),n4(),JL()]}function _4(e={}){const t=!e.skipBrowserExtensionCheck&&b4();let n=e.defaultIntegrations==null?S4():e.defaultIntegrations;const s={...e,enabled:t?!1:e.enabled,stackParser:FM(e.stackParser||ML),integrations:ZP({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||bL};return N2(XD,s)}function w4(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function O1(e){try{return new URL(e,st.location.origin).href}catch{return}}function E4(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function M1(e){try{return new Headers(e)}catch{return}}const dE=new WeakMap,ty=new Map,I1={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function T4(e,t){const{traceFetch:n,traceXHR:s,trackFetchStreamPerformance:i,shouldCreateSpanForRequest:a,enableHTTPTimings:l,tracePropagationTargets:f,onRequestSpanStart:d,onRequestSpanEnd:p}={...I1,...t},g=typeof a=="function"?a:S=>!0,y=S=>C4(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=ty.get(w.span_id);T&&(w.timestamp=T/1e3,ty.delete(w.span_id))}}),S)),i&&ND(S=>{if(S.response){const w=dE.get(S.response);w&&S.endTimestamp&&ty.set(w,S.endTimestamp)}}),l1(S=>{const w=dD(S,g,y,b,{propagateTraceparent:x,onRequestSpanEnd:p});if(S.response&&S.fetchData.__span&&dE.set(S.response,S.fetchData.__span),w){const T=O1(S.fetchData.url),C=T?ta(T).host:void 0;w.setAttributes({"http.url":T?Go(T):void 0,"server.address":C}),l&&hE(w),d?.(w,{headers:S.headers})}})),s&&j1(S=>{const w=R4(S,g,y,b,x,p);w&&(l&&hE(w),d?.(w,{headers:M1(S.xhr.__sentry_xhr_v3__?.request_headers)}))})}function hE(e){const{url:t}=yt(e).data;if(!t||typeof t!="string")return;const n=Mc("resource",({entries:s})=>{s.forEach(i=>{E4(i)&&i.name.endsWith(t)&&(e.setAttributes(N1(i)),setTimeout(n))})})}function C4(e,t){const n=Ou();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?Ko(s.toString(),t)||a&&Ko(s.pathname,t):a}else{const s=!!e.match(/^\/(?!\/)/);return t?Ko(e,t):s}}function R4(e,t,n,s,i,a){const l=e.xhr,f=l?.[fc];if(!l||l.__sentry_own_request__||!f)return;const{url:d,method:p}=f,g=ss()&&t(d);if(e.endTimestamp){const C=l.__sentry_xhr_span_id__;if(!C)return;const k=s[C];k&&(g&&f.status_code!==void 0&&(yR(k,f.status_code),k.end(),a?.(k,{headers:M1(dL(l)),error:e.error})),delete s[C]);return}const y=O1(d),b=ta(y||d),x=Go(O2(d)),S=!!Xn(),w=g&&S?Zc({name:`${p} ${x}`,attributes:{url:Go(d),type:"xhr","http.method":p,"http.url":y?Go(y):void 0,"server.address":b?.host,[gn]:"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)&&N4(l,ss()&&S?w:void 0,i);const T=vt();return T&&T.emit("beforeOutgoingRequestSpan",w,e),w}function N4(e,t,n){const{"sentry-trace":s,baggage:i,traceparent:a}=s1({span:t,propagateTraceparent:n});s&&j4(e,s,i,a)}function j4(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||!w4(a))&&e.setRequestHeader("baggage",n)}}catch{}}function A4(){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}=yt(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 k4=3600,P1="sentry_previous_trace",O4="sentry.previous_trace";function M4(e,{linkPreviousTrace:t,consistentTraceSampling:n}){const s=t==="session-storage";let i=s?D4():void 0;e.on("spanStart",l=>{if(Dn(l)!==l)return;const f=bt().getPropagationContext();i=I4(i,l,f),s&&P4(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(dv(i.spanContext))},sampleRand:i.sampleRand}),l.parentSampled=dv(i.spanContext),l.parentSampleRate=i.sampleRate,l.spanAttributes={...l.spanAttributes,[gR]:i.sampleRate}})}function I4(e,t,n){const s=yt(t);function i(){try{return Number(n.dsc?.sample_rate)??Number(s.data?.[Yv])}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<=k4&&(Kr&&be.log(`Adding previous_trace \`${JSON.stringify(l)}\` link to span \`${JSON.stringify({op:s.op,...t.spanContext()})}\``),t.addLink({context:l,attributes:{[mI]:"previous_trace"}}),t.setAttribute(O4,`${l.traceId}-${l.spanId}-${dv(l)?1:0}`)),a)}function P4(e){try{st.sessionStorage.setItem(P1,JSON.stringify(e))}catch(t){Kr&&be.warn("Could not store previous trace in sessionStorage",t)}}function D4(){try{const e=st.sessionStorage?.getItem(P1);return JSON.parse(e)}catch{return}}function dv(e){return e.traceFlags===1}const z4="BrowserTracing",L4={...Jd,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:{},...I1},U4=((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:k,enableHTTPTimings:N,ignoreResourceSpans:R,ignorePerformanceApiSpans:M,instrumentPageLoad:L,instrumentNavigation:j,detectRedirects:A,linkPreviousTrace:P,consistentTraceSampling:G,enableReportPageLoaded:B,onRequestSpanStart:z,onRequestSpanEnd:Q}={...L4,...e};let Y,ee,D;function K(q,V,U=!0){const I=V.op==="pageload",H=V.name,W=g?g(V):V,X=W.attributes||{};if(H!==W.name&&(X[vs]="custom",W.attributes=X),!U){const de=pa();Zc({...W,startTime:de}).end(de);return}t.name=W.name,t.source=X[vs];const oe=UR(W,{idleTimeout:y,finalTimeout:b,childSpanTimeout:x,disableAutoFinish:I,beforeSpanEnd:de=>{Y?.(),$z(de,{recordClsOnPageloadSpan:!d,recordLcpOnPageloadSpan:!p,ignoreResourceSpans:R,ignorePerformanceApiSpans:M}),gE(q,void 0);const xe=bt(),he=xe.getPropagationContext();xe.setPropagationContext({...he,traceId:oe.spanContext().traceId,sampled:ui(oe),dsc:to(de)}),I&&(D=void 0)},trimIdleSpanEndTimestamp:!B});I&&B&&(D=oe),gE(q,oe);function se(){n&&["interactive","complete"].includes(n.readyState)&&q.emit("idleSpanEnableAutoFinish",oe)}I&&!B&&n&&(n.addEventListener("readystatechange",()=>{se()}),se())}return{name:z4,setup(q){if(qI(),Y=Mz({recordClsStandaloneSpans:d||!1,recordLcpStandaloneSpans:p||!1,client:q}),s&&pL(),i&&Wz(),l&&ct.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?Pz():a&&Iz(),f&&Dz(),A&&n){const U=()=>{ee=cn()};addEventListener("click",U,{capture:!0}),addEventListener("keydown",U,{capture:!0,passive:!0})}function V(){const U=_u(q);U&&!yt(U).timestamp&&(Kr&&be.log(`[Tracing] Finishing current active span with op: ${yt(U).op}`),U.setAttribute(vu,"cancelled"),U.end())}q.on("startNavigationSpan",(U,I)=>{if(vt()!==q)return;if(I?.isRedirect){Kr&&be.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),K(q,{op:"navigation.redirect",...U},!1);return}ee=void 0,V(),Zr().setPropagationContext({traceId:Ws(),sampleRand:Math.random(),propagationSpanId:ss()?void 0:Zs()});const H=bt();H.setPropagationContext({traceId:Ws(),sampleRand:Math.random(),propagationSpanId:ss()?void 0:Zs()}),H.setSDKProcessingMetadata({normalizedRequest:void 0}),K(q,{op:"navigation",...U,parentSpan:null,forceTransaction:!0})}),q.on("startPageLoadSpan",(U,I={})=>{if(vt()!==q)return;V();const H=I.sentryTrace||pE("sentry-trace")||mE("sentry-trace"),W=I.baggage||pE("baggage")||mE("baggage"),X=DI(H,W),oe=bt();oe.setPropagationContext(X),ss()||(oe.getPropagationContext().propagationSpanId=Zs()),oe.setSDKProcessingMetadata({normalizedRequest:fb()}),K(q,{op:"pageload",...U})}),q.on("endPageloadSpan",()=>{B&&D&&(D.setAttribute(vu,"reportPageLoaded"),D.end())})},afterAllSetup(q){let V=Ou();if(P!=="off"&&M4(q,{linkPreviousTrace:P,consistentTraceSampling:G}),st.location){if(L){const U=Sr();$4(q,{name:st.location.pathname,startTime:U?U/1e3:void 0,attributes:{[vs]:"url",[gn]:"auto.pageload.browser"}})}j&&vb(({to:U,from:I})=>{if(I===void 0&&V?.indexOf(U)!==-1){V=void 0;return}V=void 0;const H=n1(U),W=_u(q),X=W&&A&&H4(W,ee);B4(q,{name:H?.pathname||st.location.pathname,attributes:{[vs]:"url",[gn]:"auto.navigation.browser"}},{url:U,isRedirect:X})})}S&&A4(),f&&F4(q,y,b,x,t),s&&yL(),T4(q,{traceFetch:w,traceXHR:T,trackFetchStreamPerformance:C,tracePropagationTargets:q.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:k,enableHTTPTimings:N,onRequestSpanStart:z,onRequestSpanEnd:Q})}}});function $4(e,t,n){e.emit("startPageLoadSpan",t,n),bt().setTransactionName(t.name);const s=_u(e);return s&&e.emit("afterStartPageLoadSpan",s),s}function B4(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:{...fb(),url:s}}),_u(e)}function pE(e){return st.document?.querySelector(`meta[name=${e}]`)?.getAttribute("content")||void 0}function mE(e){return st.performance?.getEntriesByType?.("navigation")[0]?.serverTiming?.find(s=>s.name===e)?.description}function F4(e,t,n,s,i){const a=st.document;let l;const f=()=>{const d="ui.action.click",p=_u(e);if(p){const g=yt(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(vu,"interactionInterrupted"),l.end(),l=void 0),!i.name){Kr&&be.warn(`[Tracing] Did not create ${d} transaction because _latestRouteName is missing.`);return}l=UR({name:i.name,op:d,attributes:{[vs]:i.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:s})};a&&addEventListener("click",f,{capture:!0})}const D1="_sentry_idleSpan";function _u(e){return e[D1]}function gE(e,t){Yn(e,D1,t)}const yE=1.5;function H4(e,t){const n=yt(e),s=pa(),i=n.start_timestamp;return!(s-i>yE||t&&s-t<=yE)}function z1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ny={exports:{}},Ke={};var vE;function q4(){if(vE)return Ke;vE=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(I){return I===null||typeof I!="object"?null:(I=b&&I[b]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,T={};function C(I,H,W){this.props=I,this.context=H,this.refs=T,this.updater=W||S}C.prototype.isReactComponent={},C.prototype.setState=function(I,H){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,H,"setState")},C.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function k(){}k.prototype=C.prototype;function N(I,H,W){this.props=I,this.context=H,this.refs=T,this.updater=W||S}var R=N.prototype=new k;R.constructor=N,w(R,C.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function L(){}var j={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function P(I,H,W){var X=W.ref;return{$$typeof:e,type:I,key:H,ref:X!==void 0?X:null,props:W}}function G(I,H){return P(I.type,H,I.props)}function B(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function z(I){var H={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(W){return H[W]})}var Q=/\/+/g;function Y(I,H){return typeof I=="object"&&I!==null&&I.key!=null?z(""+I.key):H.toString(36)}function ee(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(L,L):(I.status="pending",I.then(function(H){I.status==="pending"&&(I.status="fulfilled",I.value=H)},function(H){I.status==="pending"&&(I.status="rejected",I.reason=H)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function D(I,H,W,X,oe){var se=typeof I;(se==="undefined"||se==="boolean")&&(I=null);var de=!1;if(I===null)de=!0;else switch(se){case"bigint":case"string":case"number":de=!0;break;case"object":switch(I.$$typeof){case e:case t:de=!0;break;case g:return de=I._init,D(de(I._payload),H,W,X,oe)}}if(de)return oe=oe(I),de=X===""?"."+Y(I,0):X,M(oe)?(W="",de!=null&&(W=de.replace(Q,"$&/")+"/"),D(oe,H,W,"",function(Me){return Me})):oe!=null&&(B(oe)&&(oe=G(oe,W+(oe.key==null||I&&I.key===oe.key?"":(""+oe.key).replace(Q,"$&/")+"/")+de)),H.push(oe)),1;de=0;var xe=X===""?".":X+":";if(M(I))for(var he=0;he<I.length;he++)X=I[he],se=xe+Y(X,he),de+=D(X,H,W,se,oe);else if(he=x(I),typeof he=="function")for(I=he.call(I),he=0;!(X=I.next()).done;)X=X.value,se=xe+Y(X,he++),de+=D(X,H,W,se,oe);else if(se==="object"){if(typeof I.then=="function")return D(ee(I),H,W,X,oe);throw H=String(I),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return de}function K(I,H,W){if(I==null)return I;var X=[],oe=0;return D(I,X,"","",function(se){return H.call(W,se,oe++)}),X}function q(I){if(I._status===-1){var H=I._result;H=H(),H.then(function(W){(I._status===0||I._status===-1)&&(I._status=1,I._result=W)},function(W){(I._status===0||I._status===-1)&&(I._status=2,I._result=W)}),I._status===-1&&(I._status=0,I._result=H)}if(I._status===1)return I._result.default;throw I._result}var V=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},U={map:K,forEach:function(I,H,W){K(I,function(){H.apply(this,arguments)},W)},count:function(I){var H=0;return K(I,function(){H++}),H},toArray:function(I){return K(I,function(H){return H})||[]},only:function(I){if(!B(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Ke.Activity=y,Ke.Children=U,Ke.Component=C,Ke.Fragment=n,Ke.Profiler=i,Ke.PureComponent=N,Ke.StrictMode=s,Ke.Suspense=d,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(I){return j.H.useMemoCache(I)}},Ke.cache=function(I){return function(){return I.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(I,H,W){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var X=w({},I.props),oe=I.key;if(H!=null)for(se in H.key!==void 0&&(oe=""+H.key),H)!A.call(H,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&H.ref===void 0||(X[se]=H[se]);var se=arguments.length-2;if(se===1)X.children=W;else if(1<se){for(var de=Array(se),xe=0;xe<se;xe++)de[xe]=arguments[xe+2];X.children=de}return P(I.type,oe,X)},Ke.createContext=function(I){return I={$$typeof:l,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:a,_context:I},I},Ke.createElement=function(I,H,W){var X,oe={},se=null;if(H!=null)for(X in H.key!==void 0&&(se=""+H.key),H)A.call(H,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(oe[X]=H[X]);var de=arguments.length-2;if(de===1)oe.children=W;else if(1<de){for(var xe=Array(de),he=0;he<de;he++)xe[he]=arguments[he+2];oe.children=xe}if(I&&I.defaultProps)for(X in de=I.defaultProps,de)oe[X]===void 0&&(oe[X]=de[X]);return P(I,se,oe)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(I){return{$$typeof:f,render:I}},Ke.isValidElement=B,Ke.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:q}},Ke.memo=function(I,H){return{$$typeof:p,type:I,compare:H===void 0?null:H}},Ke.startTransition=function(I){var H=j.T,W={};j.T=W;try{var X=I(),oe=j.S;oe!==null&&oe(W,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(L,V)}catch(se){V(se)}finally{H!==null&&W.types!==null&&(H.types=W.types),j.T=H}},Ke.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Ke.use=function(I){return j.H.use(I)},Ke.useActionState=function(I,H,W){return j.H.useActionState(I,H,W)},Ke.useCallback=function(I,H){return j.H.useCallback(I,H)},Ke.useContext=function(I){return j.H.useContext(I)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(I,H){return j.H.useDeferredValue(I,H)},Ke.useEffect=function(I,H){return j.H.useEffect(I,H)},Ke.useEffectEvent=function(I){return j.H.useEffectEvent(I)},Ke.useId=function(){return j.H.useId()},Ke.useImperativeHandle=function(I,H,W){return j.H.useImperativeHandle(I,H,W)},Ke.useInsertionEffect=function(I,H){return j.H.useInsertionEffect(I,H)},Ke.useLayoutEffect=function(I,H){return j.H.useLayoutEffect(I,H)},Ke.useMemo=function(I,H){return j.H.useMemo(I,H)},Ke.useOptimistic=function(I,H){return j.H.useOptimistic(I,H)},Ke.useReducer=function(I,H,W){return j.H.useReducer(I,H,W)},Ke.useRef=function(I){return j.H.useRef(I)},Ke.useState=function(I){return j.H.useState(I)},Ke.useSyncExternalStore=function(I,H,W){return j.H.useSyncExternalStore(I,H,W)},Ke.useTransition=function(){return j.H.useTransition()},Ke.version="19.2.4",Ke}var bE;function Gu(){return bE||(bE=1,ny.exports=q4()),ny.exports}var _=Gu();const Ic=z1(_),L1=IM({__proto__:null,default:Ic},[_]);function V4(e){const t={...e};return r1(t,"react"),$P("react",{version:_.version}),_4(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 yc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class U1 extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $1={};function ni(e){return $1}function B1(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 hv(e,t){return typeof t=="bigint"?t.toString():t}function bb(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function xb(e){return e==null}function Sb(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function K4(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 xE=Symbol("evaluating");function wt(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==xE)return s===void 0&&(s=xE,s=n()),s},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function ga(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 SE(e){return JSON.stringify(e)}function G4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const F1="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Th(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Z4=bb(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Pc(e){if(Th(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Th(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function H1(e){return Pc(e)?{...e}:Array.isArray(e)?[...e]:e}const Y4=new Set(["string","number","symbol"]);function Dc(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 X4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Q4={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 W4(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 ga(this,"shape",l),l},checks:[]});return di(e,a)}function J4(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 ga(this,"shape",l),l},checks:[]});return di(e,a)}function e5(e,t){if(!Pc(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 ga(this,"shape",a),a}});return di(e,i)}function t5(e,t){if(!Pc(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 ga(this,"shape",s),s}});return di(e,n)}function n5(e,t){const n=fi(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return ga(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return di(e,n)}function r5(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 ga(this,"shape",d),d},checks:[]});return di(t,l)}function s5(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 ga(this,"shape",a),a}});return di(t,s)}function dc(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 hc(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}function Nd(e){return typeof e=="string"?e:e?.message}function ri(e,t,n){const s={...e,path:e.path??[]};if(!e.message){const i=Nd(e.inst?._zod.def?.error?.(e))??Nd(t?.error?.(e))??Nd(n.customError?.(e))??Nd(n.localeError?.(e))??"Invalid input";s.message=i}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function _b(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function wu(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}const q1=(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,hv,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},V1=ue("$ZodError",q1),K1=ue("$ZodError",q1,{Parent:Error});function o5(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 i5(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 wb=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 yc;if(l.issues.length){const f=new(i?.Err??e)(l.issues.map(d=>ri(d,a,ni())));throw F1(f,i?.callee),f}return l.value},Eb=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 F1(f,i?.callee),f}return l.value},cp=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 yc;return a.issues.length?{success:!1,error:new(e??V1)(a.issues.map(l=>ri(l,i,ni())))}:{success:!0,data:a.value}},a5=cp(K1),lp=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}},c5=lp(K1),l5=e=>(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return wb(e)(t,n,i)},u5=e=>(t,n,s)=>wb(e)(t,n,s),f5=e=>async(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Eb(e)(t,n,i)},d5=e=>async(t,n,s)=>Eb(e)(t,n,s),h5=e=>(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return cp(e)(t,n,i)},p5=e=>(t,n,s)=>cp(e)(t,n,s),m5=e=>async(t,n,s)=>{const i=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return lp(e)(t,n,i)},g5=e=>async(t,n,s)=>lp(e)(t,n,s),y5=/^[cC][^\s-]{8,}$/,v5=/^[0-9a-z]+$/,b5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,x5=/^[0-9a-vA-V]{20}$/,S5=/^[A-Za-z0-9]{27}$/,_5=/^[a-zA-Z0-9_-]{21}$/,w5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,E5=/^([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})$/,_E=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)$/,T5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,C5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function R5(){return new RegExp(C5,"u")}const N5=/^(?:(?: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])$/,j5=/^(([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}|:))$/,A5=/^((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])$/,k5=/^(([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])$/,O5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,G1=/^[A-Za-z0-9_-]*$/,M5=/^\+[1-9]\d{6,14}$/,Z1="(?:(?:\\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])))",I5=new RegExp(`^${Z1}$`);function Y1(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 P5(e){return new RegExp(`^${Y1(e)}$`)}function D5(e){const t=Y1({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(`^${Z1}T(?:${s})$`)}const z5=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},L5=/^-?\d+$/,X1=/^-?\d+(?:\.\d+)?$/,U5=/^(?:true|false)$/i,$5=/^[^A-Z]*$/,B5=/^[^a-z]*$/,Qn=ue("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Q1={number:"number",bigint:"bigint",object:"date"},W1=ue("$ZodCheckLessThan",(e,t)=>{Qn.init(e,t);const n=Q1[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})}}),J1=ue("$ZodCheckGreaterThan",(e,t)=>{Qn.init(e,t);const n=Q1[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})}}),F5=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):K4(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})}}),H5=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]=Q4[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=L5)}),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})}}),q5=ue("$ZodCheckMaxLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!xb(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=_b(i);s.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),V5=ue("$ZodCheckMinLength",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!xb(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=_b(i);s.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),K5=ue("$ZodCheckLengthEquals",(e,t)=>{var n;Qn.init(e,t),(n=e._zod.def).when??(n.when=s=>{const i=s.value;return!xb(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=_b(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})}}),up=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=()=>{})}),G5=ue("$ZodCheckRegex",(e,t)=>{up.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})}}),Z5=ue("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=$5),up.init(e,t)}),Y5=ue("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=B5),up.init(e,t)}),X5=ue("$ZodCheckIncludes",(e,t)=>{Qn.init(e,t);const n=Dc(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})}}),Q5=ue("$ZodCheckStartsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`^${Dc(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})}}),W5=ue("$ZodCheckEndsWith",(e,t)=>{Qn.init(e,t);const n=new RegExp(`.*${Dc(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})}}),J5=ue("$ZodCheckOverwrite",(e,t)=>{Qn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class eU{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 tU={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=tU;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=dc(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 yc;if(g||x instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await x,l.issues.length!==b&&(p||(p=dc(l,b)))});else{if(l.issues.length===b)continue;p||(p=dc(l,b))}}return g?g.then(()=>l):l},a=(l,f,d)=>{if(dc(l))return l.aborted=!0,l;const p=i(f,s,d);if(p instanceof Promise){if(d.async===!1)throw new yc;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 yc;return d.then(p=>i(p,s,f))}return i(d,s,f)}}wt(e,"~standard",()=>({validate:i=>{try{const a=a5(e,i);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return c5(e,i).then(l=>l.success?{value:l.data}:{issues:l.error?.issues})}},vendor:"zod",version:1}))}),Tb=ue("$ZodString",(e,t)=>{Ft.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??z5(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)=>{up.init(e,t),Tb.init(e,t)}),nU=ue("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=E5),Bt.init(e,t)}),rU=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=_E(s))}else t.pattern??(t.pattern=_E());Bt.init(e,t)}),sU=ue("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=T5),Bt.init(e,t)}),oU=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})}}}),iU=ue("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=R5()),Bt.init(e,t)}),aU=ue("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=_5),Bt.init(e,t)}),cU=ue("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=y5),Bt.init(e,t)}),lU=ue("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=v5),Bt.init(e,t)}),uU=ue("$ZodULID",(e,t)=>{t.pattern??(t.pattern=b5),Bt.init(e,t)}),fU=ue("$ZodXID",(e,t)=>{t.pattern??(t.pattern=x5),Bt.init(e,t)}),dU=ue("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=S5),Bt.init(e,t)}),hU=ue("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=D5(t)),Bt.init(e,t)}),pU=ue("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=I5),Bt.init(e,t)}),mU=ue("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=P5(t)),Bt.init(e,t)}),gU=ue("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=w5),Bt.init(e,t)}),yU=ue("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=N5),Bt.init(e,t),e._zod.bag.format="ipv4"}),vU=ue("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=j5),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})}}}),bU=ue("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=A5),Bt.init(e,t)}),xU=ue("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=k5),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 eN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const SU=ue("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=O5),Bt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{eN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function _U(e){if(!G1.test(e))return!1;const t=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return eN(n)}const wU=ue("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=G1),Bt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{_U(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),EU=ue("$ZodE164",(e,t)=>{t.pattern??(t.pattern=M5),Bt.init(e,t)});function TU(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 CU=ue("$ZodJWT",(e,t)=>{Bt.init(e,t),e._zod.check=n=>{TU(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),tN=ue("$ZodNumber",(e,t)=>{Ft.init(e,t),e._zod.pattern=e._zod.bag.pattern??X1,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}}),RU=ue("$ZodNumberFormat",(e,t)=>{H5.init(e,t),tN.init(e,t)}),NU=ue("$ZodBoolean",(e,t)=>{Ft.init(e,t),e._zod.pattern=U5,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}}),jU=ue("$ZodUnknown",(e,t)=>{Ft.init(e,t),e._zod.parse=n=>n}),AU=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 wE(e,t,n){e.issues.length&&t.issues.push(...hc(n,e.issues)),t.value[n]=e.value}const kU=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=>wE(p,n,l))):wE(d,n,l)}return a.length?Promise.all(a).then(()=>n):n}});function Ch(e,t,n,s,i){if(e.issues.length){if(i&&!(n in s))return;t.issues.push(...hc(n,e.issues))}e.value===void 0?n in s&&(t.value[n]=void 0):t.value[n]=e.value}function nN(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=X4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function rN(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=>Ch(x,n,y,t,g))):Ch(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 OU=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=bb(()=>nN(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=Th,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=>Ch(T,f,b,p,S))):Ch(w,f,b,p,S)}return a?rN(g,p,f,d,s.value,e):g.length?Promise.all(g).then(()=>f):f}}),MU=ue("$ZodObjectJIT",(e,t)=>{OU.init(e,t);const n=e._zod.parse,s=bb(()=>nN(t)),i=b=>{const x=new eU(["shape","payload","ctx"]),S=s.value,w=N=>{const R=SE(N);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 N of S.keys)T[N]=`key_${C++}`;x.write("const newResult = {};");for(const N of S.keys){const R=T[N],M=SE(N),j=b[N]?._zod?.optout==="optional";x.write(`const ${R} = ${w(N)};`),j?x.write(`
|
|
24
24
|
if (${R}.issues.length) {
|
|
@@ -56,7 +56,7 @@ Error:`,i)}}function bz(){return oz(e=>{Vu("cls",{metric:e}),v1=e},{reportAllCha
|
|
|
56
56
|
|
|
57
57
|
`)}x.write("payload.value = newResult;"),x.write("return payload;");const k=x.compile();return(N,R)=>k(b,N,R)};let a;const l=Th,f=!$1.jitless,p=f&&Z4.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?rN([],S,b,x,y,e):b):n(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),b)}});function EE(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=>!dc(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 IU=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=>Sb(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=>EE(d,i,e,a)):EE(f,i,e,a)}}),PU=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])=>TE(n,d,p)):TE(n,a,l)}});function pv(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(Pc(e)&&Pc(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=pv(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=pv(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 TE(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}),dc(e))return e;const l=pv(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 DU=ue("$ZodRecord",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,s)=>{const i=n.value;if(!Pc(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(...hc(p,y.issues)),n.value[p]=y.value})):(g.issues.length&&n.issues.push(...hc(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"&&X1.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(...hc(f,y.issues)),n.value[d.value]=y.value})):(g.issues.length&&n.issues.push(...hc(f,g.issues)),n.value[d.value]=g.value)}}return a.length?Promise.all(a).then(()=>n):n}}),zU=ue("$ZodEnum",(e,t)=>{Ft.init(e,t);const n=B1(t.entries),s=new Set(n);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.filter(i=>Y4.has(typeof i)).map(i=>typeof i=="string"?Dc(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}}),LU=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"?Dc(s):s?Dc(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}}),UU=ue("$ZodTransform",(e,t)=>{Ft.init(e,t),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new U1(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 yc;return n.value=i,n}});function CE(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const sN=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(`^(${Sb(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=>CE(a,n.value)):CE(i,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,s)}}),$U=ue("$ZodExactOptional",(e,t)=>{sN.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)}),BU=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(`^(${Sb(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)}),FU=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=>RE(a,t)):RE(i,t)}});function RE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const HU=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))}),qU=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=>NE(a,e)):NE(i,e)}});function NE(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 VU=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)}}),KU=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=>jd(l,t.in,s)):jd(a,t.in,s)}const i=t.in._zod.run(n,s);return i instanceof Promise?i.then(a=>jd(a,t.out,s)):jd(i,t.out,s)}});function jd(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const GU=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(jE):jE(i)}});function jE(e){return e.value=Object.freeze(e.value),e}const ZU=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=>AE(a,n,s,e));AE(i,n,s,e)}});function AE(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(wu(i))}}var kE;class YU{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 XU(){return new YU}(kE=globalThis).__zod_globalRegistry??(kE.__zod_globalRegistry=XU());const cu=globalThis.__zod_globalRegistry;function QU(e,t){return new e({type:"string",...De(t)})}function WU(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...De(t)})}function OE(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...De(t)})}function JU(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...De(t)})}function e3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...De(t)})}function t3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...De(t)})}function n3(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...De(t)})}function r3(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...De(t)})}function s3(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...De(t)})}function o3(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...De(t)})}function i3(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...De(t)})}function a3(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...De(t)})}function c3(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...De(t)})}function l3(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...De(t)})}function u3(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...De(t)})}function f3(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...De(t)})}function d3(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...De(t)})}function h3(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...De(t)})}function p3(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...De(t)})}function m3(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...De(t)})}function g3(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...De(t)})}function y3(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...De(t)})}function v3(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...De(t)})}function b3(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...De(t)})}function x3(e,t){return new e({type:"string",format:"date",check:"string_format",...De(t)})}function S3(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...De(t)})}function _3(e,t){return new e({type:"string",format:"duration",check:"string_format",...De(t)})}function w3(e,t){return new e({type:"number",checks:[],...De(t)})}function E3(e,t){return new e({type:"number",coerce:!0,checks:[],...De(t)})}function T3(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...De(t)})}function C3(e,t){return new e({type:"boolean",...De(t)})}function R3(e){return new e({type:"unknown"})}function N3(e,t){return new e({type:"never",...De(t)})}function ME(e,t){return new W1({check:"less_than",...De(t),value:e,inclusive:!1})}function ry(e,t){return new W1({check:"less_than",...De(t),value:e,inclusive:!0})}function IE(e,t){return new J1({check:"greater_than",...De(t),value:e,inclusive:!1})}function sy(e,t){return new J1({check:"greater_than",...De(t),value:e,inclusive:!0})}function PE(e,t){return new F5({check:"multiple_of",...De(t),value:e})}function oN(e,t){return new q5({check:"max_length",...De(t),maximum:e})}function Rh(e,t){return new V5({check:"min_length",...De(t),minimum:e})}function iN(e,t){return new K5({check:"length_equals",...De(t),length:e})}function j3(e,t){return new G5({check:"string_format",format:"regex",...De(t),pattern:e})}function A3(e){return new Z5({check:"string_format",format:"lowercase",...De(e)})}function k3(e){return new Y5({check:"string_format",format:"uppercase",...De(e)})}function O3(e,t){return new X5({check:"string_format",format:"includes",...De(t),includes:e})}function M3(e,t){return new Q5({check:"string_format",format:"starts_with",...De(t),prefix:e})}function I3(e,t){return new W5({check:"string_format",format:"ends_with",...De(t),suffix:e})}function Wc(e){return new J5({check:"overwrite",tx:e})}function P3(e){return Wc(t=>t.normalize(e))}function D3(){return Wc(e=>e.trim())}function z3(){return Wc(e=>e.toLowerCase())}function L3(){return Wc(e=>e.toUpperCase())}function U3(){return Wc(e=>G4(e))}function $3(e,t,n){return new e({type:"array",element:t,...De(n)})}function B3(e,t,n){return new e({type:"custom",check:"custom",fn:t,...De(n)})}function F3(e){const t=H3(n=>(n.addIssue=s=>{if(typeof s=="string")n.issues.push(wu(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(wu(i))}},e(n.value,n)));return t}function H3(e,t){const n=new Qn({check:"custom",...De(t)});return n._zod.check=e,n}function aN(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??cu,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 cN(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 lN(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:Nh(t,"input",e.processors),output:Nh(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 q3=(e,t={})=>n=>{const s=aN({...n,processors:t});return ln(e,s),cN(s,e),lN(s,e)},Nh=(e,t,n={})=>s=>{const{libraryOptions:i,target:a}=s??{},l=aN({...i??{},target:a,io:t,processors:n});return ln(e,l),cN(l,e),lN(l,e)},V3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},K3=(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=V3[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}))])}},G3=(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)},Z3=(e,t,n,s)=>{n.type="boolean"},Y3=(e,t,n,s)=>{n.not={}},X3=(e,t,n,s)=>{},Q3=(e,t,n,s)=>{const i=e._zod.def,a=B1(i.entries);a.every(l=>typeof l=="number")&&(n.type="number"),a.every(l=>typeof l=="string")&&(n.type="string"),n.enum=a},W3=(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},J3=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},e$=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},t$=(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"]})},n$=(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)},r$=(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},s$=(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},o$=(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)}},i$=(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"}]},a$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType},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.default=JSON.parse(JSON.stringify(i.defaultValue))},l$=(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)))},u$=(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},f$=(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},d$=(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},uN=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType},h$=ue("ZodISODateTime",(e,t)=>{hU.init(e,t),qt.init(e,t)});function p$(e){return b3(h$,e)}const m$=ue("ZodISODate",(e,t)=>{pU.init(e,t),qt.init(e,t)});function g$(e){return x3(m$,e)}const y$=ue("ZodISOTime",(e,t)=>{mU.init(e,t),qt.init(e,t)});function v$(e){return S3(y$,e)}const b$=ue("ZodISODuration",(e,t)=>{gU.init(e,t),qt.init(e,t)});function x$(e){return _3(b$,e)}const S$=(e,t)=>{V1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>i5(e,n)},flatten:{value:n=>o5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,hv,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,hv,2)}},isEmpty:{get(){return e.issues.length===0}}})},Yr=ue("ZodError",S$,{Parent:Error}),_$=wb(Yr),w$=Eb(Yr),E$=cp(Yr),T$=lp(Yr),C$=l5(Yr),R$=u5(Yr),N$=f5(Yr),j$=d5(Yr),A$=h5(Yr),k$=p5(Yr),O$=m5(Yr),M$=g5(Yr),Ht=ue("ZodType",(e,t)=>(Ft.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Nh(e,"input"),output:Nh(e,"output")}}),e.toJSONSchema=q3(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)=>_$(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>E$(e,n,s),e.parseAsync=async(n,s)=>w$(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>T$(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>C$(e,n,s),e.decode=(n,s)=>R$(e,n,s),e.encodeAsync=async(n,s)=>N$(e,n,s),e.decodeAsync=async(n,s)=>j$(e,n,s),e.safeEncode=(n,s)=>A$(e,n,s),e.safeDecode=(n,s)=>k$(e,n,s),e.safeEncodeAsync=async(n,s)=>O$(e,n,s),e.safeDecodeAsync=async(n,s)=>M$(e,n,s),e.refine=(n,s)=>e.check(CB(n,s)),e.superRefine=n=>e.check(RB(n)),e.overwrite=n=>e.check(Wc(n)),e.optional=()=>LE(e),e.exactOptional=()=>hB(e),e.nullable=()=>UE(e),e.nullish=()=>LE(UE(e)),e.nonoptional=n=>bB(e,n),e.array=()=>Gr(e),e.or=n=>Rb([e,n]),e.and=n=>aB(e,n),e.transform=n=>$E(e,fB(n)),e.default=n=>gB(e,n),e.prefault=n=>vB(e,n),e.catch=n=>SB(e,n),e.pipe=n=>$E(e,n),e.readonly=()=>EB(e),e.describe=n=>{const s=e.clone();return cu.add(s,{description:n}),s},Object.defineProperty(e,"description",{get(){return cu.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return cu.get(e);const s=e.clone();return cu.add(s,n[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),fN=ue("_ZodString",(e,t)=>{Tb.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>K3(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(j3(...s)),e.includes=(...s)=>e.check(O3(...s)),e.startsWith=(...s)=>e.check(M3(...s)),e.endsWith=(...s)=>e.check(I3(...s)),e.min=(...s)=>e.check(Rh(...s)),e.max=(...s)=>e.check(oN(...s)),e.length=(...s)=>e.check(iN(...s)),e.nonempty=(...s)=>e.check(Rh(1,...s)),e.lowercase=s=>e.check(A3(s)),e.uppercase=s=>e.check(k3(s)),e.trim=()=>e.check(D3()),e.normalize=(...s)=>e.check(P3(...s)),e.toLowerCase=()=>e.check(z3()),e.toUpperCase=()=>e.check(L3()),e.slugify=()=>e.check(U3())}),I$=ue("ZodString",(e,t)=>{Tb.init(e,t),fN.init(e,t),e.email=n=>e.check(WU(P$,n)),e.url=n=>e.check(r3(D$,n)),e.jwt=n=>e.check(v3(Q$,n)),e.emoji=n=>e.check(s3(z$,n)),e.guid=n=>e.check(OE(DE,n)),e.uuid=n=>e.check(JU(Ad,n)),e.uuidv4=n=>e.check(e3(Ad,n)),e.uuidv6=n=>e.check(t3(Ad,n)),e.uuidv7=n=>e.check(n3(Ad,n)),e.nanoid=n=>e.check(o3(L$,n)),e.guid=n=>e.check(OE(DE,n)),e.cuid=n=>e.check(i3(U$,n)),e.cuid2=n=>e.check(a3($$,n)),e.ulid=n=>e.check(c3(B$,n)),e.base64=n=>e.check(m3(Z$,n)),e.base64url=n=>e.check(g3(Y$,n)),e.xid=n=>e.check(l3(F$,n)),e.ksuid=n=>e.check(u3(H$,n)),e.ipv4=n=>e.check(f3(q$,n)),e.ipv6=n=>e.check(d3(V$,n)),e.cidrv4=n=>e.check(h3(K$,n)),e.cidrv6=n=>e.check(p3(G$,n)),e.e164=n=>e.check(y3(X$,n)),e.datetime=n=>e.check(p$(n)),e.date=n=>e.check(g$(n)),e.time=n=>e.check(v$(n)),e.duration=n=>e.check(x$(n))});function Fe(e){return QU(I$,e)}const qt=ue("ZodStringFormat",(e,t)=>{Bt.init(e,t),fN.init(e,t)}),P$=ue("ZodEmail",(e,t)=>{sU.init(e,t),qt.init(e,t)}),DE=ue("ZodGUID",(e,t)=>{nU.init(e,t),qt.init(e,t)}),Ad=ue("ZodUUID",(e,t)=>{rU.init(e,t),qt.init(e,t)}),D$=ue("ZodURL",(e,t)=>{oU.init(e,t),qt.init(e,t)}),z$=ue("ZodEmoji",(e,t)=>{iU.init(e,t),qt.init(e,t)}),L$=ue("ZodNanoID",(e,t)=>{aU.init(e,t),qt.init(e,t)}),U$=ue("ZodCUID",(e,t)=>{cU.init(e,t),qt.init(e,t)}),$$=ue("ZodCUID2",(e,t)=>{lU.init(e,t),qt.init(e,t)}),B$=ue("ZodULID",(e,t)=>{uU.init(e,t),qt.init(e,t)}),F$=ue("ZodXID",(e,t)=>{fU.init(e,t),qt.init(e,t)}),H$=ue("ZodKSUID",(e,t)=>{dU.init(e,t),qt.init(e,t)}),q$=ue("ZodIPv4",(e,t)=>{yU.init(e,t),qt.init(e,t)}),V$=ue("ZodIPv6",(e,t)=>{vU.init(e,t),qt.init(e,t)}),K$=ue("ZodCIDRv4",(e,t)=>{bU.init(e,t),qt.init(e,t)}),G$=ue("ZodCIDRv6",(e,t)=>{xU.init(e,t),qt.init(e,t)}),Z$=ue("ZodBase64",(e,t)=>{SU.init(e,t),qt.init(e,t)}),Y$=ue("ZodBase64URL",(e,t)=>{wU.init(e,t),qt.init(e,t)}),X$=ue("ZodE164",(e,t)=>{EU.init(e,t),qt.init(e,t)}),Q$=ue("ZodJWT",(e,t)=>{CU.init(e,t),qt.init(e,t)}),Cb=ue("ZodNumber",(e,t)=>{tN.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>G3(e,s,i),e.gt=(s,i)=>e.check(IE(s,i)),e.gte=(s,i)=>e.check(sy(s,i)),e.min=(s,i)=>e.check(sy(s,i)),e.lt=(s,i)=>e.check(ME(s,i)),e.lte=(s,i)=>e.check(ry(s,i)),e.max=(s,i)=>e.check(ry(s,i)),e.int=s=>e.check(zE(s)),e.safe=s=>e.check(zE(s)),e.positive=s=>e.check(IE(0,s)),e.nonnegative=s=>e.check(sy(0,s)),e.negative=s=>e.check(ME(0,s)),e.nonpositive=s=>e.check(ry(0,s)),e.multipleOf=(s,i)=>e.check(PE(s,i)),e.step=(s,i)=>e.check(PE(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 w3(Cb,e)}const W$=ue("ZodNumberFormat",(e,t)=>{RU.init(e,t),Cb.init(e,t)});function zE(e){return T3(W$,e)}const J$=ue("ZodBoolean",(e,t)=>{NU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Z3(e,n,s)});function no(e){return C3(J$,e)}const eB=ue("ZodUnknown",(e,t)=>{jU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>X3()});function ia(){return R3(eB)}const tB=ue("ZodNever",(e,t)=>{AU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Y3(e,n,s)});function nB(e){return N3(tB,e)}const rB=ue("ZodArray",(e,t)=>{kU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>t$(e,n,s,i),e.element=t.element,e.min=(n,s)=>e.check(Rh(n,s)),e.nonempty=n=>e.check(Rh(1,n)),e.max=(n,s)=>e.check(oN(n,s)),e.length=(n,s)=>e.check(iN(n,s)),e.unwrap=()=>e.element});function Gr(e,t){return $3(rB,e,t)}const sB=ue("ZodObject",(e,t)=>{MU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>n$(e,n,s,i),wt(e,"shape",()=>t.shape),e.keyof=()=>Yu(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ia()}),e.loose=()=>e.clone({...e._zod.def,catchall:ia()}),e.strict=()=>e.clone({...e._zod.def,catchall:nB()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>e5(e,n),e.safeExtend=n=>t5(e,n),e.merge=n=>n5(e,n),e.pick=n=>W4(e,n),e.omit=n=>J4(e,n),e.partial=(...n)=>r5(dN,e,n[0]),e.required=(...n)=>s5(hN,e,n[0])});function At(e,t){const n={type:"object",shape:e??{},...De(t)};return new sB(n)}const oB=ue("ZodUnion",(e,t)=>{IU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>r$(e,n,s,i),e.options=t.options});function Rb(e,t){return new oB({type:"union",options:e,...De(t)})}const iB=ue("ZodIntersection",(e,t)=>{PU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>s$(e,n,s,i)});function aB(e,t){return new iB({type:"intersection",left:e,right:t})}const cB=ue("ZodRecord",(e,t)=>{DU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>o$(e,n,s,i),e.keyType=t.keyType,e.valueType=t.valueType});function Zu(e,t,n){return new cB({type:"record",keyType:e,valueType:t,...De(n)})}const mv=ue("ZodEnum",(e,t)=>{zU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>Q3(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 mv({...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 mv({...t,checks:[],...De(i),entries:a})}});function Yu(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new mv({type:"enum",entries:n,...De(t)})}const lB=ue("ZodLiteral",(e,t)=>{LU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>W3(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 lB({type:"literal",values:Array.isArray(e)?e:[e],...De(t)})}const uB=ue("ZodTransform",(e,t)=>{UU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>e$(e,n),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new U1(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(wu(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(wu(l))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(a=>(n.value=a,n)):(n.value=i,n)}});function fB(e){return new uB({type:"transform",transform:e})}const dN=ue("ZodOptional",(e,t)=>{sN.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>uN(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function LE(e){return new dN({type:"optional",innerType:e})}const dB=ue("ZodExactOptional",(e,t)=>{$U.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>uN(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function hB(e){return new dB({type:"optional",innerType:e})}const pB=ue("ZodNullable",(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});function UE(e){return new pB({type:"nullable",innerType:e})}const mB=ue("ZodDefault",(e,t)=>{FU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>c$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gB(e,t){return new mB({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():H1(t)}})}const yB=ue("ZodPrefault",(e,t)=>{HU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>l$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function vB(e,t){return new yB({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():H1(t)}})}const hN=ue("ZodNonOptional",(e,t)=>{qU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>a$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function bB(e,t){return new hN({type:"nonoptional",innerType:e,...De(t)})}const xB=ue("ZodCatch",(e,t)=>{VU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>u$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function SB(e,t){return new xB({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const _B=ue("ZodPipe",(e,t)=>{KU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>f$(e,n,s,i),e.in=t.in,e.out=t.out});function $E(e,t){return new _B({type:"pipe",in:e,out:t})}const wB=ue("ZodReadonly",(e,t)=>{GU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>d$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function EB(e){return new wB({type:"readonly",innerType:e})}const TB=ue("ZodCustom",(e,t)=>{ZU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>J3(e,n)});function CB(e,t={}){return B3(TB,e,t)}function RB(e){return F3(e)}function BE(e){return E3(Cb,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 pN=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:Yu(["PUT","POST"]).optional(),uploadHeaders:Zu(Fe(),Fe()).optional(),chunkSize:tn().int().optional()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i)});At({ok:no(),metadata:pN.optional(),error:Fe().optional()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i)});At({url:Fe().url(),expiresAt:Fe(),metadata:pN});At({error:Fe(),message:Fe().optional(),code:Fe().optional()});At({limit:BE().int().min(1).max(100).default(50),offset:BE().int().min(0).default(0)});const NB="json-row-frame-v1",jB="gzip",mN=Yu(["upsert","delete"]),AB=Zu(Fe(),Fe()),gN=Zu(Fe(),Rb([Fe(),Gr(Fe())])),kB=At({table:Fe(),row_id:Fe(),op:mN,payload:Zu(Fe(),ia()).nullable(),base_version:tn().int().nullable().optional()}),OB=At({clientId:Fe().min(1),clientCommitId:Fe().min(1),operations:Gr(kB).min(1),schemaVersion:tn().int().min(1)}),MB=At({opIndex:tn().int(),status:si("applied")}),IB=At({opIndex:tn().int(),status:si("conflict"),message:Fe(),server_version:tn().int(),server_row:ia()}),PB=At({opIndex:tn().int(),status:si("error"),error:Fe(),code:Fe().optional(),retriable:no().optional()}),DB=Rb([MB,IB,PB]),zB=At({ok:si(!0),status:Yu(["applied","cached","rejected"]),commitSeq:tn().int().optional(),results:Gr(DB)}),yN=At({asOfCommitSeq:tn().int(),tables:Gr(Fe()),tableIndex:tn().int(),rowCursor:Fe().nullable()}),LB=At({id:Fe().min(1),table:Fe().min(1),scopes:gN,params:Zu(Fe(),ia()).optional(),cursor:tn().int(),bootstrapState:yN.nullable().optional()}),UB=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(LB)}),$B=At({table:Fe(),row_id:Fe(),op:mN,row_json:ia().nullable(),row_version:tn().int().nullable(),scopes:AB}),BB=At({commitSeq:tn().int(),createdAt:Fe(),actorId:Fe(),changes:Gr($B)}),FB=At({id:Fe(),byteLength:tn().int(),sha256:Fe(),encoding:si(NB),compression:si(jB)}),HB=At({table:Fe(),rows:Gr(ia()),chunks:Gr(FB).optional(),isFirstPage:no(),isLastPage:no()}),qB=At({id:Fe(),status:Yu(["active","revoked"]),scopes:gN,bootstrap:no(),bootstrapState:yN.nullable().optional(),nextCursor:tn().int(),commits:Gr(BB),snapshots:Gr(HB).optional()}),VB=At({ok:si(!0),subscriptions:Gr(qB)});At({clientId:Fe().min(1),push:OB.omit({clientId:!0}).optional(),pull:UB.omit({clientId:!0}).optional()});At({ok:si(!0),push:zB.optional(),pull:VB.optional()});new TextEncoder;const KB={setAttribute(){},setAttributes(){},setStatus(){}};function GB(e){return e.level?e.level:e.error?"error":"info"}function oy(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 ZB(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 YB(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 FE(e){const t={};for(const[n,s]of Object.entries(e)){const i=YB(s);i!==void 0&&(t[n]=i)}return Object.keys(t).length>0?t:null}function XB(e){return{startSpan(t,n){return e.startSpan?e.startSpan(t,s=>n(ZB(s))):n(KB)}}}function QB(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 WB(e){return{log(t){const n=GB(t),{event:s,...i}=t,a=oy(e.logger,n);if(!a)return;const l=FE(i);if(!l){a(s);return}a(s,l)},tracer:XB(e),metrics:QB(e),captureException(t,n){if(e.captureException?.(t),!n)return;const s=oy(e.logger,"error")??oy(e.logger,"info");if(!s)return;const i=FE(n);if(!i){s("sync.exception.context");return}s("sync.exception.context",i)}}}function JB(e){if(e?.attributes)return{attributes:e.attributes}}function HE(e){if(!e)return;const t=!!e.attributes,n=!!e.unit;if(!(!t&&!n))return{attributes:e.attributes,unit:e.unit}}function e6(){return WB({logger:E2,startSpan(e,t){return PR(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=JB(n);if(s){rE(e,t,s);return}rE(e,t)},gauge(e,t,n){const s=HE(n);if(s){sE(e,t,s);return}sE(e,t)},distribution(e,t,n){const s=HE(n);if(s){oE(e,t,s);return}oE(e,t)}},captureException(e){$R(e)}})}function t6(){return e6()}function n6(e){const t=r6(e);return V4(t),t6()}function r6(e){const t=e.integrations;if(typeof t=="function")return e;const n=t??[];return n.some(i=>i.name==="BrowserTracing")?e:{...e,integrations:[U4(),...n]}}var iy={exports:{}},Jl={};var qE;function s6(){if(qE)return Jl;qE=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 Jl.Fragment=t,Jl.jsx=n,Jl.jsxs=n,Jl}var VE;function o6(){return VE||(VE=1,iy.exports=s6()),iy.exports}var h=o6(),ay={exports:{}},eu={},cy={exports:{}},ly={};var KE;function i6(){return KE||(KE=1,(function(e){function t(D,K){var q=D.length;D.push(K);e:for(;0<q;){var V=q-1>>>1,U=D[V];if(0<i(U,K))D[V]=K,D[q]=U,q=V;else break e}}function n(D){return D.length===0?null:D[0]}function s(D){if(D.length===0)return null;var K=D[0],q=D.pop();if(q!==K){D[0]=q;e:for(var V=0,U=D.length,I=U>>>1;V<I;){var H=2*(V+1)-1,W=D[H],X=H+1,oe=D[X];if(0>i(W,q))X<U&&0>i(oe,W)?(D[V]=oe,D[X]=q,V=X):(D[V]=W,D[H]=q,V=H);else if(X<U&&0>i(oe,q))D[V]=oe,D[X]=q,V=X;else break e}}return K}function i(D,K){var q=D.sortIndex-K.sortIndex;return q!==0?q:D.id-K.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,k=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(D){for(var K=n(p);K!==null;){if(K.callback===null)s(p);else if(K.startTime<=D)s(p),K.sortIndex=K.expirationTime,t(d,K);else break;K=n(p)}}function M(D){if(w=!1,R(D),!S)if(n(d)!==null)S=!0,L||(L=!0,z());else{var K=n(p);K!==null&&ee(M,K.startTime-D)}}var L=!1,j=-1,A=5,P=-1;function G(){return T?!0:!(e.unstable_now()-P<A)}function B(){if(T=!1,L){var D=e.unstable_now();P=D;var K=!0;try{e:{S=!1,w&&(w=!1,k(j),j=-1),x=!0;var q=b;try{t:{for(R(D),y=n(d);y!==null&&!(y.expirationTime>D&&G());){var V=y.callback;if(typeof V=="function"){y.callback=null,b=y.priorityLevel;var U=V(y.expirationTime<=D);if(D=e.unstable_now(),typeof U=="function"){y.callback=U,R(D),K=!0;break t}y===n(d)&&s(d),R(D)}else s(d);y=n(d)}if(y!==null)K=!0;else{var I=n(p);I!==null&&ee(M,I.startTime-D),K=!1}}break e}finally{y=null,b=q,x=!1}K=void 0}}finally{K?z():L=!1}}}var z;if(typeof N=="function")z=function(){N(B)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,Y=Q.port2;Q.port1.onmessage=B,z=function(){Y.postMessage(null)}}else z=function(){C(B,0)};function ee(D,K){j=C(function(){D(e.unstable_now())},K)}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(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(D){switch(b){case 1:case 2:case 3:var K=3;break;default:K=b}var q=b;b=K;try{return D()}finally{b=q}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(D,K){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var q=b;b=D;try{return K()}finally{b=q}},e.unstable_scheduleCallback=function(D,K,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,D){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=q+U,D={id:g++,callback:K,priorityLevel:D,startTime:q,expirationTime:U,sortIndex:-1},q>V?(D.sortIndex=q,t(p,D),n(d)===null&&D===n(p)&&(w?(k(j),j=-1):w=!0,ee(M,q-V))):(D.sortIndex=U,t(d,D),S||x||(S=!0,L||(L=!0,z()))),D},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(D){var K=b;return function(){var q=b;b=K;try{return D.apply(this,arguments)}finally{b=q}}}})(ly)),ly}var GE;function a6(){return GE||(GE=1,cy.exports=i6()),cy.exports}var uy={exports:{}},Rn={};var ZE;function c6(){if(ZE)return Rn;ZE=1;var e=Gu();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 YE;function vN(){if(YE)return uy.exports;YE=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(),uy.exports=c6(),uy.exports}var XE;function l6(){if(XE)return eu;XE=1;var e=a6(),t=Gu(),n=vN();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,O=m.child;O;){if(O===c){E=!0,c=m,u=v;break}if(O===u){E=!0,u=m,c=v;break}O=O.sibling}if(!E){for(O=v.child;O;){if(O===c){E=!0,c=v,u=m;break}if(O===u){E=!0,u=v,c=m;break}O=O.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"),k=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function z(r){return r===null||typeof r!="object"?null:(r=B&&r[B]||r["@@iterator"],typeof r=="function"?r:null)}var Q=Symbol.for("react.client.reference");function Y(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Q?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 M:return"Suspense";case L:return"SuspenseList";case P:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case N:return r.displayName||"Context";case k: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 j:return o=r.displayName||null,o!==null?o:Y(r.type)||"Memo";case A:o=r._payload,r=r._init;try{return Y(r(o))}catch{}}return null}var ee=Array.isArray,D=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q={pending:!1,data:null,method:null,action:null},V=[],U=-1;function I(r){return{current:r}}function H(r){0>U||(r.current=V[U],V[U]=null,U--)}function W(r,o){U++,V[U]=r.current,r.current=o}var X=I(null),oe=I(null),se=I(null),de=I(null);function xe(r,o){switch(W(se,o),W(oe,r),W(X,null),o.nodeType){case 9:case 11:r=(r=o.documentElement)&&(r=r.namespaceURI)?I_(r):0;break;default:if(r=o.tagName,o=o.namespaceURI)o=I_(o),r=P_(o,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}H(X),W(X,r)}function he(){H(X),H(oe),H(se)}function Me(r){r.memoizedState!==null&&W(de,r);var o=X.current,c=P_(o,r.type);o!==c&&(W(oe,r),W(X,c))}function _e(r){oe.current===r&&(H(X),H(oe)),de.current===r&&(H(de),Zl._currentValue=q)}var ne,pe;function ae(r){if(ne===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);ne=o&&o[1]||"",pe=-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 lN(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:Nh(t,"input",e.processors),output:Nh(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 q3=(e,t={})=>n=>{const s=aN({...n,processors:t});return ln(e,s),cN(s,e),lN(s,e)},Nh=(e,t,n={})=>s=>{const{libraryOptions:i,target:a}=s??{},l=aN({...i??{},target:a,io:t,processors:n});return ln(e,l),cN(l,e),lN(l,e)},V3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},K3=(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=V3[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}))])}},G3=(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)},Z3=(e,t,n,s)=>{n.type="boolean"},Y3=(e,t,n,s)=>{n.not={}},X3=(e,t,n,s)=>{},Q3=(e,t,n,s)=>{const i=e._zod.def,a=B1(i.entries);a.every(l=>typeof l=="number")&&(n.type="number"),a.every(l=>typeof l=="string")&&(n.type="string"),n.enum=a},W3=(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},J3=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},e$=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},t$=(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"]})},n$=(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)},r$=(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},s$=(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},o$=(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)}},i$=(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"}]},a$=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType},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.default=JSON.parse(JSON.stringify(i.defaultValue))},l$=(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)))},u$=(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},f$=(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},d$=(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},uN=(e,t,n,s)=>{const i=e._zod.def;ln(i.innerType,t,s);const a=t.seen.get(e);a.ref=i.innerType},h$=ue("ZodISODateTime",(e,t)=>{hU.init(e,t),qt.init(e,t)});function p$(e){return b3(h$,e)}const m$=ue("ZodISODate",(e,t)=>{pU.init(e,t),qt.init(e,t)});function g$(e){return x3(m$,e)}const y$=ue("ZodISOTime",(e,t)=>{mU.init(e,t),qt.init(e,t)});function v$(e){return S3(y$,e)}const b$=ue("ZodISODuration",(e,t)=>{gU.init(e,t),qt.init(e,t)});function x$(e){return _3(b$,e)}const S$=(e,t)=>{V1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>i5(e,n)},flatten:{value:n=>o5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,hv,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,hv,2)}},isEmpty:{get(){return e.issues.length===0}}})},Yr=ue("ZodError",S$,{Parent:Error}),_$=wb(Yr),w$=Eb(Yr),E$=cp(Yr),T$=lp(Yr),C$=l5(Yr),R$=u5(Yr),N$=f5(Yr),j$=d5(Yr),A$=h5(Yr),k$=p5(Yr),O$=m5(Yr),M$=g5(Yr),Ht=ue("ZodType",(e,t)=>(Ft.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Nh(e,"input"),output:Nh(e,"output")}}),e.toJSONSchema=q3(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)=>_$(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>E$(e,n,s),e.parseAsync=async(n,s)=>w$(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>T$(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>C$(e,n,s),e.decode=(n,s)=>R$(e,n,s),e.encodeAsync=async(n,s)=>N$(e,n,s),e.decodeAsync=async(n,s)=>j$(e,n,s),e.safeEncode=(n,s)=>A$(e,n,s),e.safeDecode=(n,s)=>k$(e,n,s),e.safeEncodeAsync=async(n,s)=>O$(e,n,s),e.safeDecodeAsync=async(n,s)=>M$(e,n,s),e.refine=(n,s)=>e.check(CB(n,s)),e.superRefine=n=>e.check(RB(n)),e.overwrite=n=>e.check(Wc(n)),e.optional=()=>LE(e),e.exactOptional=()=>hB(e),e.nullable=()=>UE(e),e.nullish=()=>LE(UE(e)),e.nonoptional=n=>bB(e,n),e.array=()=>Gr(e),e.or=n=>Rb([e,n]),e.and=n=>aB(e,n),e.transform=n=>$E(e,fB(n)),e.default=n=>gB(e,n),e.prefault=n=>vB(e,n),e.catch=n=>SB(e,n),e.pipe=n=>$E(e,n),e.readonly=()=>EB(e),e.describe=n=>{const s=e.clone();return cu.add(s,{description:n}),s},Object.defineProperty(e,"description",{get(){return cu.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return cu.get(e);const s=e.clone();return cu.add(s,n[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),fN=ue("_ZodString",(e,t)=>{Tb.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>K3(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(j3(...s)),e.includes=(...s)=>e.check(O3(...s)),e.startsWith=(...s)=>e.check(M3(...s)),e.endsWith=(...s)=>e.check(I3(...s)),e.min=(...s)=>e.check(Rh(...s)),e.max=(...s)=>e.check(oN(...s)),e.length=(...s)=>e.check(iN(...s)),e.nonempty=(...s)=>e.check(Rh(1,...s)),e.lowercase=s=>e.check(A3(s)),e.uppercase=s=>e.check(k3(s)),e.trim=()=>e.check(D3()),e.normalize=(...s)=>e.check(P3(...s)),e.toLowerCase=()=>e.check(z3()),e.toUpperCase=()=>e.check(L3()),e.slugify=()=>e.check(U3())}),I$=ue("ZodString",(e,t)=>{Tb.init(e,t),fN.init(e,t),e.email=n=>e.check(WU(P$,n)),e.url=n=>e.check(r3(D$,n)),e.jwt=n=>e.check(v3(Q$,n)),e.emoji=n=>e.check(s3(z$,n)),e.guid=n=>e.check(OE(DE,n)),e.uuid=n=>e.check(JU(Ad,n)),e.uuidv4=n=>e.check(e3(Ad,n)),e.uuidv6=n=>e.check(t3(Ad,n)),e.uuidv7=n=>e.check(n3(Ad,n)),e.nanoid=n=>e.check(o3(L$,n)),e.guid=n=>e.check(OE(DE,n)),e.cuid=n=>e.check(i3(U$,n)),e.cuid2=n=>e.check(a3($$,n)),e.ulid=n=>e.check(c3(B$,n)),e.base64=n=>e.check(m3(Z$,n)),e.base64url=n=>e.check(g3(Y$,n)),e.xid=n=>e.check(l3(F$,n)),e.ksuid=n=>e.check(u3(H$,n)),e.ipv4=n=>e.check(f3(q$,n)),e.ipv6=n=>e.check(d3(V$,n)),e.cidrv4=n=>e.check(h3(K$,n)),e.cidrv6=n=>e.check(p3(G$,n)),e.e164=n=>e.check(y3(X$,n)),e.datetime=n=>e.check(p$(n)),e.date=n=>e.check(g$(n)),e.time=n=>e.check(v$(n)),e.duration=n=>e.check(x$(n))});function Fe(e){return QU(I$,e)}const qt=ue("ZodStringFormat",(e,t)=>{Bt.init(e,t),fN.init(e,t)}),P$=ue("ZodEmail",(e,t)=>{sU.init(e,t),qt.init(e,t)}),DE=ue("ZodGUID",(e,t)=>{nU.init(e,t),qt.init(e,t)}),Ad=ue("ZodUUID",(e,t)=>{rU.init(e,t),qt.init(e,t)}),D$=ue("ZodURL",(e,t)=>{oU.init(e,t),qt.init(e,t)}),z$=ue("ZodEmoji",(e,t)=>{iU.init(e,t),qt.init(e,t)}),L$=ue("ZodNanoID",(e,t)=>{aU.init(e,t),qt.init(e,t)}),U$=ue("ZodCUID",(e,t)=>{cU.init(e,t),qt.init(e,t)}),$$=ue("ZodCUID2",(e,t)=>{lU.init(e,t),qt.init(e,t)}),B$=ue("ZodULID",(e,t)=>{uU.init(e,t),qt.init(e,t)}),F$=ue("ZodXID",(e,t)=>{fU.init(e,t),qt.init(e,t)}),H$=ue("ZodKSUID",(e,t)=>{dU.init(e,t),qt.init(e,t)}),q$=ue("ZodIPv4",(e,t)=>{yU.init(e,t),qt.init(e,t)}),V$=ue("ZodIPv6",(e,t)=>{vU.init(e,t),qt.init(e,t)}),K$=ue("ZodCIDRv4",(e,t)=>{bU.init(e,t),qt.init(e,t)}),G$=ue("ZodCIDRv6",(e,t)=>{xU.init(e,t),qt.init(e,t)}),Z$=ue("ZodBase64",(e,t)=>{SU.init(e,t),qt.init(e,t)}),Y$=ue("ZodBase64URL",(e,t)=>{wU.init(e,t),qt.init(e,t)}),X$=ue("ZodE164",(e,t)=>{EU.init(e,t),qt.init(e,t)}),Q$=ue("ZodJWT",(e,t)=>{CU.init(e,t),qt.init(e,t)}),Cb=ue("ZodNumber",(e,t)=>{tN.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>G3(e,s,i),e.gt=(s,i)=>e.check(IE(s,i)),e.gte=(s,i)=>e.check(sy(s,i)),e.min=(s,i)=>e.check(sy(s,i)),e.lt=(s,i)=>e.check(ME(s,i)),e.lte=(s,i)=>e.check(ry(s,i)),e.max=(s,i)=>e.check(ry(s,i)),e.int=s=>e.check(zE(s)),e.safe=s=>e.check(zE(s)),e.positive=s=>e.check(IE(0,s)),e.nonnegative=s=>e.check(sy(0,s)),e.negative=s=>e.check(ME(0,s)),e.nonpositive=s=>e.check(ry(0,s)),e.multipleOf=(s,i)=>e.check(PE(s,i)),e.step=(s,i)=>e.check(PE(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 w3(Cb,e)}const W$=ue("ZodNumberFormat",(e,t)=>{RU.init(e,t),Cb.init(e,t)});function zE(e){return T3(W$,e)}const J$=ue("ZodBoolean",(e,t)=>{NU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Z3(e,n,s)});function no(e){return C3(J$,e)}const eB=ue("ZodUnknown",(e,t)=>{jU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>X3()});function ia(){return R3(eB)}const tB=ue("ZodNever",(e,t)=>{AU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>Y3(e,n,s)});function nB(e){return N3(tB,e)}const rB=ue("ZodArray",(e,t)=>{kU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>t$(e,n,s,i),e.element=t.element,e.min=(n,s)=>e.check(Rh(n,s)),e.nonempty=n=>e.check(Rh(1,n)),e.max=(n,s)=>e.check(oN(n,s)),e.length=(n,s)=>e.check(iN(n,s)),e.unwrap=()=>e.element});function Gr(e,t){return $3(rB,e,t)}const sB=ue("ZodObject",(e,t)=>{MU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>n$(e,n,s,i),wt(e,"shape",()=>t.shape),e.keyof=()=>Yu(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ia()}),e.loose=()=>e.clone({...e._zod.def,catchall:ia()}),e.strict=()=>e.clone({...e._zod.def,catchall:nB()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>e5(e,n),e.safeExtend=n=>t5(e,n),e.merge=n=>n5(e,n),e.pick=n=>W4(e,n),e.omit=n=>J4(e,n),e.partial=(...n)=>r5(dN,e,n[0]),e.required=(...n)=>s5(hN,e,n[0])});function At(e,t){const n={type:"object",shape:e??{},...De(t)};return new sB(n)}const oB=ue("ZodUnion",(e,t)=>{IU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>r$(e,n,s,i),e.options=t.options});function Rb(e,t){return new oB({type:"union",options:e,...De(t)})}const iB=ue("ZodIntersection",(e,t)=>{PU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>s$(e,n,s,i)});function aB(e,t){return new iB({type:"intersection",left:e,right:t})}const cB=ue("ZodRecord",(e,t)=>{DU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>o$(e,n,s,i),e.keyType=t.keyType,e.valueType=t.valueType});function Zu(e,t,n){return new cB({type:"record",keyType:e,valueType:t,...De(n)})}const mv=ue("ZodEnum",(e,t)=>{zU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(s,i,a)=>Q3(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 mv({...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 mv({...t,checks:[],...De(i),entries:a})}});function Yu(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new mv({type:"enum",entries:n,...De(t)})}const lB=ue("ZodLiteral",(e,t)=>{LU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>W3(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 lB({type:"literal",values:Array.isArray(e)?e:[e],...De(t)})}const uB=ue("ZodTransform",(e,t)=>{UU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>e$(e,n),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new U1(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(wu(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(wu(l))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(a=>(n.value=a,n)):(n.value=i,n)}});function fB(e){return new uB({type:"transform",transform:e})}const dN=ue("ZodOptional",(e,t)=>{sN.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>uN(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function LE(e){return new dN({type:"optional",innerType:e})}const dB=ue("ZodExactOptional",(e,t)=>{$U.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>uN(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function hB(e){return new dB({type:"optional",innerType:e})}const pB=ue("ZodNullable",(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});function UE(e){return new pB({type:"nullable",innerType:e})}const mB=ue("ZodDefault",(e,t)=>{FU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>c$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gB(e,t){return new mB({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():H1(t)}})}const yB=ue("ZodPrefault",(e,t)=>{HU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>l$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function vB(e,t){return new yB({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():H1(t)}})}const hN=ue("ZodNonOptional",(e,t)=>{qU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>a$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function bB(e,t){return new hN({type:"nonoptional",innerType:e,...De(t)})}const xB=ue("ZodCatch",(e,t)=>{VU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>u$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function SB(e,t){return new xB({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const _B=ue("ZodPipe",(e,t)=>{KU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>f$(e,n,s,i),e.in=t.in,e.out=t.out});function $E(e,t){return new _B({type:"pipe",in:e,out:t})}const wB=ue("ZodReadonly",(e,t)=>{GU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>d$(e,n,s,i),e.unwrap=()=>e._zod.def.innerType});function EB(e){return new wB({type:"readonly",innerType:e})}const TB=ue("ZodCustom",(e,t)=>{ZU.init(e,t),Ht.init(e,t),e._zod.processJSONSchema=(n,s,i)=>J3(e,n)});function CB(e,t={}){return B3(TB,e,t)}function RB(e){return F3(e)}function BE(e){return E3(Cb,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 pN=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:Yu(["PUT","POST"]).optional(),uploadHeaders:Zu(Fe(),Fe()).optional(),chunkSize:tn().int().optional()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i)});At({ok:no(),metadata:pN.optional(),error:Fe().optional()});At({hash:Fe().regex(/^sha256:[0-9a-f]{64}$/i)});At({url:Fe().url(),expiresAt:Fe(),metadata:pN});At({error:Fe(),message:Fe().optional(),code:Fe().optional()});At({limit:BE().int().min(1).max(100).default(50),offset:BE().int().min(0).default(0)});const NB="json-row-frame-v1",jB="gzip",mN=Yu(["upsert","delete"]),AB=Zu(Fe(),Fe()),gN=Zu(Fe(),Rb([Fe(),Gr(Fe())])),kB=At({table:Fe(),row_id:Fe(),op:mN,payload:Zu(Fe(),ia()).nullable(),base_version:tn().int().nullable().optional()}),OB=At({clientId:Fe().min(1),clientCommitId:Fe().min(1),operations:Gr(kB).min(1),schemaVersion:tn().int().min(1)}),MB=At({opIndex:tn().int(),status:si("applied")}),IB=At({opIndex:tn().int(),status:si("conflict"),message:Fe(),server_version:tn().int(),server_row:ia()}),PB=At({opIndex:tn().int(),status:si("error"),error:Fe(),code:Fe().optional(),retriable:no().optional()}),DB=Rb([MB,IB,PB]),zB=At({ok:si(!0),status:Yu(["applied","cached","rejected"]),commitSeq:tn().int().optional(),results:Gr(DB)}),yN=At({asOfCommitSeq:tn().int(),tables:Gr(Fe()),tableIndex:tn().int(),rowCursor:Fe().nullable()}),LB=At({id:Fe().min(1),table:Fe().min(1),scopes:gN,params:Zu(Fe(),ia()).optional(),cursor:tn().int(),bootstrapState:yN.nullable().optional()}),UB=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(LB)}),$B=At({table:Fe(),row_id:Fe(),op:mN,row_json:ia().nullable(),row_version:tn().int().nullable(),scopes:AB}),BB=At({commitSeq:tn().int(),createdAt:Fe(),actorId:Fe(),changes:Gr($B)}),FB=At({id:Fe(),byteLength:tn().int(),sha256:Fe(),encoding:si(NB),compression:si(jB)}),HB=At({table:Fe(),rows:Gr(ia()),chunks:Gr(FB).optional(),isFirstPage:no(),isLastPage:no()}),qB=At({id:Fe(),status:Yu(["active","revoked"]),scopes:gN,bootstrap:no(),bootstrapState:yN.nullable().optional(),nextCursor:tn().int(),commits:Gr(BB),snapshots:Gr(HB).optional()}),VB=At({ok:si(!0),subscriptions:Gr(qB)});At({clientId:Fe().min(1),push:OB.omit({clientId:!0}).optional(),pull:UB.omit({clientId:!0}).optional()});At({ok:si(!0),push:zB.optional(),pull:VB.optional()});new TextEncoder;const KB={setAttribute(){},setAttributes(){},setStatus(){}};function GB(e){return e.level?e.level:e.error?"error":"info"}function oy(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 ZB(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 YB(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 FE(e){const t={};for(const[n,s]of Object.entries(e)){const i=YB(s);i!==void 0&&(t[n]=i)}return Object.keys(t).length>0?t:null}function XB(e){return{startSpan(t,n){return e.startSpan?e.startSpan(t,s=>n(ZB(s))):n(KB)}}}function QB(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 WB(e){return{log(t){const n=GB(t),{event:s,...i}=t,a=oy(e.logger,n);if(!a)return;const l=FE(i);if(!l){a(s);return}a(s,l)},tracer:XB(e),metrics:QB(e),captureException(t,n){if(e.captureException?.(t),!n)return;const s=oy(e.logger,"error")??oy(e.logger,"info");if(!s)return;const i=FE(n);if(!i){s("sync.exception.context");return}s("sync.exception.context",i)}}}function JB(e){if(e?.attributes)return{attributes:e.attributes}}function HE(e){if(!e)return;const t=!!e.attributes,n=!!e.unit;if(!(!t&&!n))return{attributes:e.attributes,unit:e.unit}}function e6(){return WB({logger:ED,startSpan(e,t){return PR(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=JB(n);if(s){rE(e,t,s);return}rE(e,t)},gauge(e,t,n){const s=HE(n);if(s){sE(e,t,s);return}sE(e,t)},distribution(e,t,n){const s=HE(n);if(s){oE(e,t,s);return}oE(e,t)}},captureException(e){$R(e)}})}function t6(){return e6()}function n6(e){const t=r6(e);return V4(t),t6()}function r6(e){const t=e.integrations;if(typeof t=="function")return e;const n=t??[];return n.some(i=>i.name==="BrowserTracing")?e:{...e,integrations:[U4(),...n]}}var iy={exports:{}},Jl={};var qE;function s6(){if(qE)return Jl;qE=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 Jl.Fragment=t,Jl.jsx=n,Jl.jsxs=n,Jl}var VE;function o6(){return VE||(VE=1,iy.exports=s6()),iy.exports}var h=o6(),ay={exports:{}},eu={},cy={exports:{}},ly={};var KE;function i6(){return KE||(KE=1,(function(e){function t(D,K){var q=D.length;D.push(K);e:for(;0<q;){var V=q-1>>>1,U=D[V];if(0<i(U,K))D[V]=K,D[q]=U,q=V;else break e}}function n(D){return D.length===0?null:D[0]}function s(D){if(D.length===0)return null;var K=D[0],q=D.pop();if(q!==K){D[0]=q;e:for(var V=0,U=D.length,I=U>>>1;V<I;){var H=2*(V+1)-1,W=D[H],X=H+1,oe=D[X];if(0>i(W,q))X<U&&0>i(oe,W)?(D[V]=oe,D[X]=q,V=X):(D[V]=W,D[H]=q,V=H);else if(X<U&&0>i(oe,q))D[V]=oe,D[X]=q,V=X;else break e}}return K}function i(D,K){var q=D.sortIndex-K.sortIndex;return q!==0?q:D.id-K.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,k=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(D){for(var K=n(p);K!==null;){if(K.callback===null)s(p);else if(K.startTime<=D)s(p),K.sortIndex=K.expirationTime,t(d,K);else break;K=n(p)}}function M(D){if(w=!1,R(D),!S)if(n(d)!==null)S=!0,L||(L=!0,z());else{var K=n(p);K!==null&&ee(M,K.startTime-D)}}var L=!1,j=-1,A=5,P=-1;function G(){return T?!0:!(e.unstable_now()-P<A)}function B(){if(T=!1,L){var D=e.unstable_now();P=D;var K=!0;try{e:{S=!1,w&&(w=!1,k(j),j=-1),x=!0;var q=b;try{t:{for(R(D),y=n(d);y!==null&&!(y.expirationTime>D&&G());){var V=y.callback;if(typeof V=="function"){y.callback=null,b=y.priorityLevel;var U=V(y.expirationTime<=D);if(D=e.unstable_now(),typeof U=="function"){y.callback=U,R(D),K=!0;break t}y===n(d)&&s(d),R(D)}else s(d);y=n(d)}if(y!==null)K=!0;else{var I=n(p);I!==null&&ee(M,I.startTime-D),K=!1}}break e}finally{y=null,b=q,x=!1}K=void 0}}finally{K?z():L=!1}}}var z;if(typeof N=="function")z=function(){N(B)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,Y=Q.port2;Q.port1.onmessage=B,z=function(){Y.postMessage(null)}}else z=function(){C(B,0)};function ee(D,K){j=C(function(){D(e.unstable_now())},K)}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(D){D.callback=null},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(D){switch(b){case 1:case 2:case 3:var K=3;break;default:K=b}var q=b;b=K;try{return D()}finally{b=q}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(D,K){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var q=b;b=D;try{return K()}finally{b=q}},e.unstable_scheduleCallback=function(D,K,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,D){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=q+U,D={id:g++,callback:K,priorityLevel:D,startTime:q,expirationTime:U,sortIndex:-1},q>V?(D.sortIndex=q,t(p,D),n(d)===null&&D===n(p)&&(w?(k(j),j=-1):w=!0,ee(M,q-V))):(D.sortIndex=U,t(d,D),S||x||(S=!0,L||(L=!0,z()))),D},e.unstable_shouldYield=G,e.unstable_wrapCallback=function(D){var K=b;return function(){var q=b;b=K;try{return D.apply(this,arguments)}finally{b=q}}}})(ly)),ly}var GE;function a6(){return GE||(GE=1,cy.exports=i6()),cy.exports}var uy={exports:{}},Rn={};var ZE;function c6(){if(ZE)return Rn;ZE=1;var e=Gu();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 YE;function vN(){if(YE)return uy.exports;YE=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(),uy.exports=c6(),uy.exports}var XE;function l6(){if(XE)return eu;XE=1;var e=a6(),t=Gu(),n=vN();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,O=m.child;O;){if(O===c){E=!0,c=m,u=v;break}if(O===u){E=!0,u=m,c=v;break}O=O.sibling}if(!E){for(O=v.child;O;){if(O===c){E=!0,c=v,u=m;break}if(O===u){E=!0,u=v,c=m;break}O=O.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"),k=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function z(r){return r===null||typeof r!="object"?null:(r=B&&r[B]||r["@@iterator"],typeof r=="function"?r:null)}var Q=Symbol.for("react.client.reference");function Y(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Q?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 M:return"Suspense";case L:return"SuspenseList";case P:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case N:return r.displayName||"Context";case k: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 j:return o=r.displayName||null,o!==null?o:Y(r.type)||"Memo";case A:o=r._payload,r=r._init;try{return Y(r(o))}catch{}}return null}var ee=Array.isArray,D=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q={pending:!1,data:null,method:null,action:null},V=[],U=-1;function I(r){return{current:r}}function H(r){0>U||(r.current=V[U],V[U]=null,U--)}function W(r,o){U++,V[U]=r.current,r.current=o}var X=I(null),oe=I(null),se=I(null),de=I(null);function xe(r,o){switch(W(se,o),W(oe,r),W(X,null),o.nodeType){case 9:case 11:r=(r=o.documentElement)&&(r=r.namespaceURI)?I_(r):0;break;default:if(r=o.tagName,o=o.namespaceURI)o=I_(o),r=P_(o,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}H(X),W(X,r)}function he(){H(X),H(oe),H(se)}function Me(r){r.memoizedState!==null&&W(de,r);var o=X.current,c=P_(o,r.type);o!==c&&(W(oe,r),W(X,c))}function _e(r){oe.current===r&&(H(X),H(oe)),de.current===r&&(H(de),Zl._currentValue=q)}var ne,pe;function ae(r){if(ne===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);ne=o&&o[1]||"",pe=-1<c.stack.indexOf(`
|
|
60
60
|
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
61
61
|
`+ne+r+pe}var we=!1;function ve(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 fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ie){var re=ie}Reflect.construct(r,[],fe)}else{try{fe.call()}catch(ie){re=ie}r.call(fe.prototype)}}else{try{throw Error()}catch(ie){re=ie}(fe=r())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ie){if(ie&&re&&typeof ie.stack=="string")return[ie.stack,re.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],O=v[1];if(E&&O){var $=E.split(`
|
|
62
62
|
`),te=O.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 Jh(e,t){e&&Object.assign(e.style,t)}const XG={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},QG={position:"fixed"},WG=_.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=n8,...k}=t,{store:N,listRef:R,labelsRef:M,alignItemWithTriggerActiveRef:L,selectedItemTextRef:j,valuesRef:A,initialValueRef:P,popupRef:G,setValue:B}=Ju(),z=KA(),Q=at(N,it.open),Y=at(N,it.mounted),ee=at(N,it.modal),D=at(N,it.value),K=at(N,it.openMethod),q=at(N,it.positionerElement),V=at(N,it.triggerElement),U=at(N,it.isItemEqualToValue),I=at(N,it.transitionStatus),H=_.useRef(null),W=_.useRef(null),[X,oe]=_.useState(T),se=Y&&X&&K!=="touch";!Y&&X!==T&&oe(T),Le(()=>{Y||(it.scrollUpArrowVisible(N.state)&&N.set("scrollUpArrowVisible",!1),it.scrollDownArrowVisible(N.state)&&N.set("scrollDownArrowVisible",!1))},[N,Y]),_.useImperativeHandle(L,()=>se),GA((se||ee)&&Q&&K!=="touch",V);const de=FA({anchor:s,floatingRootContext:z,positionMethod:i,mounted:Y,side:f,sideOffset:p,align:d,alignOffset:g,arrowPadding:x,collisionBoundary:y,collisionPadding:b,sticky:S,disableAnchorTracking:w??se,collisionAvoidance:C,keepMounted:!0}),xe=se?"none":de.side,he=se?QG:de.positionerStyles,Me=_.useMemo(()=>{const Se={};return Q||(Se.pointerEvents="none"),{role:"presentation",hidden:!Y,style:{...he,...Se}}},[Q,Y,he]),_e={open:Q,side:xe,align:de.align,anchorHidden:de.anchorHidden},ne=Ae(Se=>{N.set("positionerElement",Se)}),pe=zt("div",t,{ref:[n,ne],state:_e,stateAttributesMapping:il,props:[Me,kp(I),k]}),ae=_.useRef(0),we=Ae(Se=>{if(Se.size===0&&ae.current===0||A.current.length===0)return;const ye=ae.current;if(ae.current=Se.size,Se.size===ye)return;const Ue=Yt(ii);if(ye!==0&&!N.state.multiple&&D!==null&&Uy(A.current,D,U)===-1){const Ee=P.current,Xe=Ee!=null&&Uy(A.current,Ee,U)!==-1?Ee:null;B(Xe,Ue),Xe===null&&(N.set("selectedIndex",null),j.current=null)}if(ye!==0&&N.state.multiple&&Array.isArray(D)){const Ie=Ve=>Uy(A.current,Ve,U)!==-1,Ee=D.filter(Ve=>Ie(Ve));(Ee.length!==D.length||Ee.some(Ve=>!CG(D,Ve,U)))&&(B(Ee,Ue),Ee.length===0&&(N.set("selectedIndex",null),j.current=null))}if(Q&&se){N.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ie={height:""};Jh(q,Ie),Jh(G.current,Ie)}}),ve=_.useMemo(()=>({...de,side:xe,alignItemWithTriggerActive:se,setControlledAlignItemWithTrigger:oe,scrollUpArrowRef:H,scrollDownArrowRef:W}),[de,xe,se,oe]);return h.jsx(YA,{elementsRef:R,labelsRef:M,onMapChange:we,children:h.jsxs(XA.Provider,{value:ve,children:[Y&&ee&&h.jsx(QA,{inert:px(!Q),cutout:V}),pe]})})});function WA(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 Kd="base-ui-disable-scrollbar",$C={className:Kd,getElement(e){return h.jsx("style",{nonce:e,href:Kd,precedence:"base-ui:low",children:`.${Kd}{scrollbar-width:none}.${Kd}::-webkit-scrollbar{display:none}`})}},JG=_.createContext(void 0);function JA(e){return _.useContext(JG)}const Ec="ArrowUp",Qi="ArrowDown",ku="ArrowLeft",Tc="ArrowRight",ef="Home",tf="End",ek=new Set([ku,Tc]),eZ=new Set([ku,Tc,ef,tf]),tk=new Set([Ec,Qi]),tZ=new Set([Ec,Qi,ef,tf]),nk=new Set([...ek,...tk]),nZ=new Set([...nk,ef,tf]),rk=new Set([Ec,Qi,ku,Tc,ef,tf]),rZ="Shift",sZ="Control",oZ="Alt",iZ="Meta",aZ=new Set([rZ,sZ,oZ,iZ]);function cZ(e){return Zt(e)&&e.tagName==="INPUT"}function BC(e){return!!(cZ(e)&&e.selectionStart!=null||Zt(e)&&e.tagName==="TEXTAREA")}function FC(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=HC(e,t,"left"),p=Gd(e),g=Gd(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=HC(e,t,"top"),p=Gd(e),g=Gd(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 HC(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 Gd(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 $y(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const lZ=_.createContext(void 0),uZ={disableStyleElements:!1};function fZ(){return _.useContext(lZ)??uZ}const qi=1,dZ={...il,...va},hZ=_.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}=Ju(),{side:k,align:N,alignItemWithTriggerActive:R,setControlledAlignItemWithTrigger:M,scrollDownArrowRef:L,scrollUpArrowRef:j}=YG(),A=JA()!=null,P=KA(),{nonce:G,disableStyleElements:B}=fZ(),z=rs(),Q=at(f,it.id),Y=at(f,it.open),ee=at(f,it.mounted),D=at(f,it.popupProps),K=at(f,it.transitionStatus),q=at(f,it.triggerElement),V=at(f,it.positionerElement),U=at(f,it.listElement),I=_.useRef(0),H=_.useRef(!1),W=_.useRef(0),X=_.useRef(!1),oe=_.useRef({}),se=cx(),de=Ae(_e=>{if(!V||!d.current||!X.current)return;if(H.current||!R){w();return}const ne=V.style.top==="0px",pe=V.style.bottom==="0px",ae=V.getBoundingClientRect().height,we=Rt(V),ve=getComputedStyle(V),Se=parseFloat(ve.marginTop),ye=parseFloat(ve.marginBottom),Ue=qC(getComputedStyle(d.current)),Ie=Math.min(we.documentElement.clientHeight-Se-ye,Ue),Ee=_e.scrollTop,Ve=VC(_e);let Xe=0,Be=null,We=!1,He=!1;const me=qe=>{V.style.height=`${qe}px`},Te=(qe,mt)=>{const lt=$y(qe,0,Ie-ae);lt>0&&me(ae+lt),_e.scrollTop=mt,Ie-(ae+lt)<=qi&&(H.current=!0),w()};if(ne){const qe=Ve-Ee,mt=ae+qe,lt=Math.min(mt,Ie);if(Xe=lt,qe<=qi){Te(qe,Ve);return}Ie-lt>qi?He=!0:We=!0}else if(pe){const qe=Ee,mt=ae+qe,lt=Math.min(mt,Ie),wr=mt-Ie;if(Xe=lt,qe<=qi){Te(qe,0);return}Ie-lt>qi?Be=0:(We=!0,Ee<Ve&&(Be=Ee-(qe-wr)))}if(Xe=Math.ceil(Xe),Xe!==0&&me(Xe),He||Be!=null){const qe=VC(_e),mt=He?qe:$y(Be,0,qe);Math.abs(_e.scrollTop-mt)>qi&&(_e.scrollTop=mt)}(We||Xe>=Ie-qi)&&(H.current=!0),w()});_.useImperativeHandle(T,()=>de,[de]),ba({open:Y,ref:d,onComplete(){Y&&p?.(!0)}});const xe={open:Y,transitionStatus:K,side:k,align:N};Le(()=>{!V||!d.current||Object.keys(oe.current).length||(oe.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(()=>{Y||R||(X.current=!1,H.current=!1,I.current=0,W.current=0,Jh(V,oe.current))},[Y,R,V,d]),Le(()=>{const _e=d.current;if(!(!Y||!q||!V||!_e||f.state.transitionStatus==="ending")){if(!R){X.current=!0,se.request(w),_e.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const ne=pZ(_e);_e.style.removeProperty("--transform-origin");try{const pe=getComputedStyle(V),ae=getComputedStyle(_e),we=Rt(q),ve=un(V),Se=q.getBoundingClientRect(),ye=V.getBoundingClientRect(),Ue=Se.left,Ie=Se.height,Ee=U||_e,Ve=Ee.scrollHeight,Xe=parseFloat(ae.borderBottomWidth),Be=parseFloat(pe.marginTop)||10,We=parseFloat(pe.marginBottom)||10,He=parseFloat(pe.minHeight)||100,me=qC(ae),Te=5,qe=5,mt=20,lt=we.documentElement.clientHeight-Be-We,wr=we.documentElement.clientWidth,Er=lt-Se.bottom+Ie,Qt=b.current,ut=y.current;let xt,ot=0,Wt=0;if(Qt&&ut){const tr=ut.getBoundingClientRect();xt=Qt.getBoundingClientRect();const ls=tr.left-Ue,uo=xt.left-ye.left,fo=tr.top-Se.top+tr.height/2,nr=xt.top-ye.top+xt.height/2;ot=ls-uo,Wt=nr-fo}const vn=Er+Wt+We+Xe;let kt=Math.min(lt,vn);const Cn=lt-Be-We,er=vn-kt,An=Math.max(Te,Ue+ot),as=wr-qe,cs=Math.max(0,An+ye.width-as);V.style.left=`${An-cs}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,_i=er>=_a;_i&&(kt=Math.min(lt,ye.height)-(er-_a));const wi=Se.top<mt||Se.bottom>lt-mt||kt<Math.min(Ve,He),ws=(ve.visualViewport?.scale??1)!==1&&sx;if(wi||ws){X.current=!0,Jh(V,oe.current),hi.flushSync(()=>M(!1));return}if(_i){const tr=Math.max(0,lt-vn);V.style.top=ye.height>=Cn?"0":`${tr}px`,V.style.height=`${kt}px`,Ee.scrollTop=Ee.scrollHeight-Ee.clientHeight,I.current=Math.max(He,kt)}else V.style.bottom="0",I.current=Math.max(He,kt),Ee.scrollTop=er;if(xt){const tr=ye.top,ls=ye.height,uo=xt.top+xt.height/2,fo=ls>0?(uo-tr)/ls*100:50,nr=$y(fo,0,100);_e.style.setProperty("--transform-origin",`50% ${nr}%`)}(I.current===lt||kt>=me)&&(H.current=!0),w(),setTimeout(()=>{X.current=!0})}finally{ne()}})}},[f,Y,V,q,y,b,d,w,R,M,se,L,j,U]),_.useEffect(()=>{if(!R||!V||!Y)return;const _e=un(V);function ne(pe){g(!1,Yt(R8,pe))}return _e.addEventListener("resize",ne),()=>{_e.removeEventListener("resize",ne)}},[g,R,V,Y]);const he={...U?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":S||void 0,id:`${Q}-list`},onKeyDown(_e){x.current=!0,A&&rk.has(_e.key)&&_e.stopPropagation()},onMouseMove(){x.current=!1},onPointerLeave(_e){if(!C||WA(_e)||_e.pointerType==="touch")return;const ne=_e.currentTarget;z.start(0,()=>{f.set("activeIndex",null),ne.focus({preventScroll:!0})})},onScroll(_e){U||de(_e.currentTarget)},...R&&{style:U?{height:"100%"}:XG}},Me=zt("div",t,{ref:[n,d],state:xe,stateAttributesMapping:dZ,props:[D,he,kp(K),{className:!U&&R?$C.className:void 0},l]});return h.jsxs(_.Fragment,{children:[!B&&$C.getElement(G),h.jsx(NA,{context:P,modal:!1,disabled:!ee,returnFocus:a,restoreFocus:!0,children:Me})]})});function qC(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function VC(e){return Math.max(0,e.scrollHeight-e.clientHeight)}const KC=[["transform","none"],["scale","1"],["translate","0 0"]];function pZ(e){const{style:t}=e,n={};for(const[s,i]of KC)n[s]=t.getPropertyValue(s),t.setProperty(s,i,"important");return()=>{for(const[s]of KC){const i=n[s];i?t.setProperty(s,i):t.removeProperty(s)}}}let sk=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function mx(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}=VG(),b=_.useRef(-1),[x,S]=_.useState(a??(i===sk.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 k=t!==void 0;g.current[x]=k?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 k=w.current?C.get(w.current)?.index:null;k!=null&&S(k)})},[a,d,S]),_.useMemo(()=>({ref:T,index:x}),[x,T])}const mZ=_.createContext(void 0),gZ=_.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=mx({label:l,textRef:g,indexGuessBehavior:sk.GuessFromOrder}),{store:b,getItemProps:x,setOpen:S,setValue:w,selectionRef:T,typingRef:C,valuesRef:k,keyboardActiveRef:N,multiple:R,highlightItemOnHover:M}=Ju(),L=rs(),j=at(b,it.isActive,y.index),A=at(b,it.isSelected,y.index,a),P=at(b,it.isSelectedByFocus,y.index),G=at(b,it.isItemEqualToValue),B=y.index,z=B!==-1,Q=_.useRef(null),Y=Jo(B);Le(()=>{if(!z)return;const se=k.current;return se[B]=a,()=>{delete se[B]}},[z,B,a,k]),Le(()=>{if(!z)return;const se=b.state.value;let de=se;R&&Array.isArray(se)&&se.length>0&&(de=se[se.length-1]),de!==void 0&&Bc(a,de,G)&&b.set("selectedIndex",B)},[z,B,R,G,b,a]);const ee={disabled:f,selected:A,highlighted:j},D=x({active:j,selected:A});D.onFocus=void 0,D.id=void 0;const K=_.useRef(null),q=_.useRef("mouse"),V=_.useRef(!1),{getButtonProps:U,buttonRef:I}=el({disabled:f,focusableWhenDisabled:!0,native:d});function H(se){const de=b.state.value;if(R){const xe=Array.isArray(de)?de:[],he=A?RG(xe,a,G):[...xe,a];w(he,Yt(Ny,se))}else w(a,Yt(Ny,se)),S(!1,Yt(Ny,se))}const W={role:"option","aria-selected":A,tabIndex:j?0:-1,onFocus(){b.set("activeIndex",B)},onMouseEnter(){!N.current&&b.state.selectedIndex===null&&M&&b.set("activeIndex",B)},onMouseMove(){M&&b.set("activeIndex",B)},onMouseLeave(se){!M||N.current||WA(se)||L.start(0,()=>{b.state.activeIndex===B&&b.set("activeIndex",null)})},onTouchStart(){T.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(se){K.current=se.key,b.set("activeIndex",B)},onClick(se){V.current=!1,!(se.type==="keydown"&&K.current===null)&&(f||K.current===" "&&C.current||q.current!=="touch"&&!j||(K.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 de=!T.current.allowSelectedMouseUp&&A,xe=!T.current.allowUnselectedMouseUp&&!A;de||xe||q.current!=="touch"&&!j||H(se.nativeEvent)}},X=zt("div",t,{ref:[I,n,y.ref,Q],state:ee,props:[D,W,p,U]}),oe=_.useMemo(()=>({selected:A,indexRef:Y,textRef:g,selectedByFocus:P,hasRegistered:z}),[A,Y,g,P,z]);return h.jsx(mZ.Provider,{value:oe,children:X})})),yZ=_.forwardRef(({className:e,children:t,...n},s)=>h.jsx(DG,{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}));yZ.displayName="SelectTrigger";const vZ=_.forwardRef(({className:e,portalProps:t,positionerProps:n,...s},i)=>h.jsx(LG,{...t,children:h.jsx(WG,{...n,children:h.jsx(hZ,{ref:i,className:ge("bg-panel border border-border rounded-md py-1 shadow-lg z-50",e),...s})})}));vZ.displayName="SelectContent";const bZ=_.forwardRef(({className:e,...t},n)=>h.jsx(gZ,{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}));bZ.displayName="SelectItem";const xZ=_.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}));xZ.displayName="Textarea";const ok=_.createContext(void 0);function SZ(e=!0){const t=_.useContext(ok);if(t===void 0&&!e)throw new Error(yn(7));return t}function ik(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:s}=Ij(),{ref:i,index:a}=mx(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 _Z(e){const{render:t,className:n,state:s=an,props:i=Nu,refs:a=Nu,metadata:l,stateAttributesMapping:f,tag:d="div",...p}=e,{compositeProps:g,compositeRef:y}=ik({metadata:l});return zt(d,e,{state:s,ref:[...a,y],props:[g,...i,p],stateAttributesMapping:f})}const wZ=_.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=SZ(),T=w?.value??[],C=w?void 0:i,k=(a||w?.disabled)??!1,[N,R]=yp({controlled:w?S!==void 0&&T.indexOf(S)>-1:d,default:C,name:"Toggle",state:"pressed"}),M=Ae((z,Q)=>{S&&w?.setGroupValue?.(S,z,Q),f?.(z,Q)}),{getButtonProps:L,buttonRef:j}=el({disabled:k,native:b}),A={disabled:k,pressed:N},P=[j,n],G=[{"aria-pressed":N,onClick(z){const Q=!N,Y=Yt(ii,z.nativeEvent);M(Q,Y),!Y.isCanceled&&R(Q)}},x,L],B=zt("button",t,{enabled:!w,state:A,ref:P,props:G});return w?h.jsx(_Z,{tag:"button",render:p,className:s,state:A,refs:P,props:G}):B}),Dr=_.forwardRef(({className:e,...t},n)=>h.jsx(wZ,{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 EZ(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const ak="data-composite-item-active",TZ=[];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=TZ}=e,[S,w]=_.useState(0),T=n>1,C=_.useRef(null),k=so(C,p),N=_.useRef([]),R=_.useRef(!1),M=f??S,L=Ae((P,G=!1)=>{if((d??w)(P),G){const B=N.current[P];FC(C.current,B,l,a)}}),j=Ae(P=>{if(P.size===0||R.current)return;R.current=!0;const G=Array.from(P.keys()),B=G.find(Q=>Q?.hasAttribute(ak))??null,z=B?G.indexOf(B):-1;z!==-1&&L(z),FC(C.current,B,l,a)}),A=_.useMemo(()=>({"aria-orientation":a==="both"?void 0:a,ref:k,onFocus(P){!C.current||!BC(P.target)||P.target.setSelectionRange(0,P.target.value.length??0)},onKeyDown(P){const G=g?nZ:nk;if(!G.has(P.key)||RZ(P,x)||!C.current)return;const z=l==="rtl",Q=z?ku:Tc,Y={horizontal:Q,vertical:Qi,both:Q}[a],ee=z?Tc:ku,D={horizontal:ee,vertical:Ec,both:ee}[a];if(BC(P.target)&&!EZ(P.target)){const W=P.target.selectionStart,X=P.target.selectionEnd,oe=P.target.value??"";if(W==null||P.shiftKey||W!==X||P.key!==D&&W<oe.length||P.key!==Y&&W>0)return}let K=M;const q=BV(N,b),V=FV(N,b);if(T){const W=t||Array.from({length:N.current.length},()=>({width:1,height:1})),X=qV(W,n,i),oe=X.findIndex(de=>de!=null&&!pu(N,de,b)),se=X.reduce((de,xe,he)=>xe!=null&&!pu(N,xe,b)?he:de,-1);K=X[HV({current:X.map(de=>de?N.current[de]:null)},{event:P,orientation:a,loopFocus:s,cols:n,disabledIndices:KV([...b||N.current.map((de,xe)=>pu(N,xe)?xe:void 0),void 0],X),minIndex:oe,maxIndex:se,prevIndex:VV(M>V?q:M,W,X,n,P.key===Qi?"bl":P.key===Tc?"tr":"tl"),rtl:z})]}const U={horizontal:[Q],vertical:[Qi],both:[Q,Qi]}[a],I={horizontal:[ee],vertical:[Ec],both:[ee,Ec]}[a],H=T?G:{horizontal:g?eZ:ek,vertical:g?tZ:tk,both:G}[a];g&&(P.key===ef?K=q:P.key===tf&&(K=V)),K===M&&(U.includes(P.key)||I.includes(P.key))&&(s&&K===V&&U.includes(P.key)?K=q:s&&K===q&&I.includes(P.key)?K=V:K=fr(N,{startingIndex:K,decrement:I.includes(P.key),disabledIndices:b})),K!==M&&!lh(N,K)&&(y&&P.stopPropagation(),H.has(P.key)&&P.preventDefault(),L(K,!0),queueMicrotask(()=>{N.current[K]?.focus()}))}}),[n,i,l,b,N,g,M,T,t,s,k,x,L,a,y]);return _.useMemo(()=>({props:A,highlightedIndex:M,onHighlightedIndexChange:L,elementsRef:N,disabledIndices:b,onMapChange:j,relayKeyboardEvent:A.onKeyDown}),[A,M,L,N,b,j])}function RZ(e,t){for(const n of aZ.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function ck(e){const{render:t,className:n,refs:s=Nu,props:i=Nu,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:k,modifierKeys:N,highlightItemOnHover:R=!1,tag:M="div",...L}=e,j=$A(),{props:A,highlightedIndex:P,onHighlightedIndexChange:G,elementsRef:B,onMapChange:z,relayKeyboardEvent:Q}=CZ({itemSizes:y,cols:x,loopFocus:b,dense:g,orientation:p,highlightedIndex:f,onHighlightedIndexChange:d,rootRef:C,stopEventPropagation:T,enableHomeAndEndKeys:S,direction:j,disabledIndices:k,modifierKeys:N}),Y=zt(M,e,{state:a,ref:s,props:[A,...i,L],stateAttributesMapping:l}),ee=_.useMemo(()=>({highlightedIndex:P,onHighlightedIndexChange:G,highlightItemOnHover:R,relayKeyboardEvent:Q}),[P,G,R,Q]);return h.jsx(Mj.Provider,{value:ee,children:h.jsx(YA,{elementsRef:B,onMapChange:D=>{w?.(D),z(D)},children:Y})})}let NZ=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const GC={multiple(e){return e?{[NZ.multiple]:""}:null}},jZ=_.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=JA(),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,k]=yp({controlled:p,default:S,name:"ToggleGroup",state:"value"}),N=Ae((A,P,G)=>{let B;if(d?(B=C.slice(),P?B.push(A):B.splice(C.indexOf(A),1)):B=P?[A]:[],Array.isArray(B)){if(l?.(B,G),G.isCanceled)return;k(B)}}),R={disabled:T,multiple:d,orientation:f},M=_.useMemo(()=>({disabled:T,orientation:f,setGroupValue:N,value:C,isValueInitialized:w}),[T,f,N,C,w]),L={role:"group"},j=zt("div",t,{enabled:!!x,state:R,ref:n,props:[L,b],stateAttributesMapping:GC});return h.jsx(ok.Provider,{value:M,children:x?j:h.jsx(ck,{render:y,className:g,state:R,refs:[n],props:[L,b],stateAttributesMapping:GC,loopFocus:a,enableHomeAndEndKeys:!0})})}),hh=_.forwardRef(({className:e,...t},n)=>h.jsx(jZ,{ref:n,className:ge("flex items-center gap-0.5",e),...t}));hh.displayName="ToggleGroup";const AZ=ge(Gj({variant:"secondary",size:"sm"}),"h-7 whitespace-nowrap uppercase tracking-[0.08em] leading-none no-underline");function lk({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 kZ({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(lk,{active:l,onClick:f,children:a.label},a.id)})})}const OZ=mi("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}}),MZ={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 IZ({color:e,size:t,glow:n,pulse:s,className:i}){return h.jsx("span",{className:ge(OZ({color:e,size:t,glow:n}),s&&"dot-pulse",i),style:n?{boxShadow:MZ[e??"healthy"]}:void 0})}const PZ="0.0.6-116",DZ={version:PZ},zZ=DZ.version;function LZ({label:e,className:t}){return h.jsxs("div",{className:ge("flex items-center gap-3",t),children:[h.jsx(IZ,{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",zZ]})]})}function UZ({brand:e,center:t,right:n,className:s}){return h.jsxs(h.Fragment,{children:[h.jsx("div",{"aria-hidden":"true",className:"h-[42px] shrink-0"}),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 $Z=mi("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($Z({variant:t,className:e})),...n}));In.displayName="Alert";const nf=_.forwardRef(({className:e,...t},n)=>h.jsx("h5",{ref:n,className:ge("font-medium text-white mb-1",e),...t}));nf.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 uk=_.createContext(void 0);function al(e){const t=_.useContext(uk);if(e===!1&&t===void 0)throw new Error(yn(27));return t}const BZ={...il,...va},gx=_.forwardRef(function(t,n){const{render:s,className:i,forceRender:a=!1,...l}=t,{store:f}=al(),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:BZ,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:a||!p})}),fk=_.forwardRef(function(t,n){const{render:s,className:i,id:a,...l}=t,{store:f}=al(),d=br(a);return f.useSyncedValueWithCleanup("descriptionElementId",d),zt("p",t,{ref:n,props:[{id:d},l]})});let FZ=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),HZ=(function(e){return e[e.open=Xi.open]="open",e[e.closed=Xi.closed]="closed",e[e.startingStyle=Xi.startingStyle]="startingStyle",e[e.endingStyle=Xi.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const dk=_.createContext(void 0);function qZ(){const e=_.useContext(dk);if(e===void 0)throw new Error(yn(26));return e}const VZ={...il,...va,nestedDialogOpen(e){return e?{[HZ.nestedDialogOpen]:""}:null}},hk=_.forwardRef(function(t,n){const{className:s,finalFocus:i,initialFocus:a,render:l,...f}=t,{store:d}=al(),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"),k=d.useState("openMethod"),N=d.useState("titleElementId"),R=d.useState("transitionStatus"),M=d.useState("role");qZ(),ba({open:C,ref:d.context.popupRef,onComplete(){C&&d.context.onOpenChangeComplete?.(!0)}});function L(B){return B==="touch"?d.context.popupRef.current:!0}const j=a===void 0?L:a,A=T>0,G=zt("div",t,{state:{open:C,nested:w,transitionStatus:R,nestedDialogOpen:A},props:[b,{"aria-labelledby":N??void 0,"aria-describedby":p??void 0,role:M,tabIndex:-1,hidden:!S,onKeyDown(B){rk.has(B.key)&&B.stopPropagation()},style:{[FZ.nestedDialogs]:T}},f],ref:[n,d.context.popupRef,d.useStateSetter("popupElement")],stateAttributesMapping:VZ});return h.jsx(NA,{context:y,openInteractionType:k,disabled:!S,closeOnFocusOut:!g,initialFocus:j,returnFocus:i,modal:x!==!1,restoreFocus:"popup",children:G})}),pk=_.forwardRef(function(t,n){const{keepMounted:s=!1,...i}=t,{store:a}=al(),l=a.useState("mounted"),f=a.useState("modal"),d=a.useState("open");return l||s?h.jsx(dk.Provider,{value:s,children:h.jsxs(RA,{ref:n,...i,children:[l&&f===!0&&h.jsx(QA,{ref:a.context.internalBackdropRef,inert:px(!d)}),t.children]})}):null});function KZ(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}=OG(i);_7(t);const{forceUnmount:y}=w7(i,t,()=>{g()}),b=Ae(G=>{const B=Yt(G);return B.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},B}),x=_.useCallback(()=>{t.setOpen(!1,b(C8))},[t,b]);_.useImperativeHandle(s,()=>({unmount:y,close:x}),[y,x]);const S=j7({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,T]=_.useState(0),C=w===0,k=L7(S),N=u7(S,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(G){if(!t.context.outsidePressEnabledRef.current||"button"in G&&G.button!==0||"touches"in G&&G.touches.length!==1)return!1;const B=Ur(G);if(C&&!a){const z=B;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===z||t.context.backdropRef.current===z||Ot(z,f)&&!z?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});GA(i&&l===!0,f);const{getReferenceProps:R,getFloatingProps:M,getTriggerProps:L}=D7([k,N]);t.useContextCallback("onNestedDialogOpen",G=>{T(G+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 j=_.useMemo(()=>R(p),[R,p]),A=_.useMemo(()=>L(p),[L,p]),P=_.useMemo(()=>M(),[M]);t.useSyncedValues({openMethod:d,activeTriggerProps:j,inactiveTriggerProps:A,popupProps:P,floatingRootContext:S,nestedOpenDialogCount:w})}const GZ={...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 ZZ extends zA{constructor(t){super(YZ(t),{popupRef:_.createRef(),backdropRef:_.createRef(),internalBackdropRef:_.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new dx,onOpenChange:void 0,onOpenChangeComplete:void 0},GZ)}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 YZ(e={}){return{...T7(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function XZ(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=al(!0),x=!!b,S=zn(()=>p?.store??new ZZ({open:s,openProp:n,activeTriggerId:y,triggerIdProp:g,modal:f,disablePointerDismissal:l,nested:x})).current;dV(()=>{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");KZ({store:S,actionsRef:d,parentContext:b?.store.context});const T=_.useMemo(()=>({store:S}),[S]);return h.jsx(uk.Provider,{value:T,children:typeof t=="function"?t({payload:w}):t})}const mk=_.forwardRef(function(t,n){const{render:s,className:i,id:a,...l}=t,{store:f}=al(),d=br(a);return f.useSyncedValueWithCleanup("titleElementId",d),zt("h2",t,{ref:n,props:[{id:d},l]})}),$r=XZ,QZ=_.forwardRef(({className:e,...t},n)=>h.jsx(gx,{ref:n,className:ge("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",e),...t}));QZ.displayName="DialogOverlay";const hr=_.forwardRef(({className:e,children:t,...n},s)=>h.jsxs(pk,{children:[h.jsx(gx,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),h.jsx(hk,{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(mk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 uppercase tracking-widest",e),...t}));mr.displayName="DialogTitle";const WZ=_.forwardRef(({className:e,...t},n)=>h.jsx(fk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500",e),...t}));WZ.displayName="DialogDescription";const yx=_.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(Oe,{size:"sm",variant:"default",disabled:t<=1,onClick:()=>i(t-1),children:"Prev"}),h.jsx(Oe,{size:"sm",variant:"default",disabled:t>=n,onClick:()=>i(t+1),children:"Next"})]})]}));yx.displayName="Pagination";const JZ=_.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}));JZ.displayName="Separator";const eY=mi("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"}}),tY=_.forwardRef(({className:e,side:t,children:n,...s},i)=>h.jsxs(pk,{children:[h.jsx(gx,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),h.jsx(hk,{ref:i,className:ge(eY({side:t,className:e})),...s,children:n})]}));tY.displayName="SheetContent";const nY=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-b border-border",e),...t}));nY.displayName="SheetHeader";const rY=_.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}));rY.displayName="SheetFooter";const sY=_.forwardRef(({className:e,...t},n)=>h.jsx(mk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 uppercase tracking-widest",e),...t}));sY.displayName="SheetTitle";const oY=_.forwardRef(({className:e,...t},n)=>h.jsx(fk,{ref:n,className:ge("text-sm text-neutral-400",e),...t}));oY.displayName="SheetDescription";const iY=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("rounded-md bg-neutral-800 animate-pulse",e),...t}));iY.displayName="Skeleton";const aY=_.createContext(void 0);function vx(){const e=_.useContext(aY);if(e===void 0)throw new Error(yn(64));return e}let cY=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const gk={tabActivationDirection:e=>({[cY.activationDirection]:e})},yk=_.createContext(void 0);function lY(){const e=_.useContext(yk);if(e===void 0)throw new Error(yn(65));return e}const uY=_.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}=vx(),{activateOnFocus:x,highlightedTabIndex:S,onTabActivation:w,setHighlightedTabIndex:T,tabsListElement:C}=lY(),k=br(f),N=_.useMemo(()=>({disabled:i,id:k,value:l}),[i,k,l]),{compositeProps:R,compositeRef:M,index:L}=ik({metadata:N}),j=l===g,A=_.useRef(!1);Le(()=>{if(A.current){A.current=!1;return}if(!(j&&L>-1&&S!==L))return;const V=C;if(V!=null){const U=Bo(Rt(V));if(U&&Ot(V,U))return}i||T(L)},[j,L,S,T,i,C]);const{getButtonProps:P,buttonRef:G}=el({disabled:i,native:d,focusableWhenDisabled:!0}),B=y(l),z=_.useRef(!1),Q=_.useRef(!1);function Y(V){j||i||w(l,Yt(ii,V.nativeEvent,void 0,{activationDirection:"none"}))}function ee(V){j||(L>-1&&!i&&T(L),!i&&x&&(!z.current||z.current&&Q.current)&&w(l,Yt(ii,V.nativeEvent,void 0,{activationDirection:"none"})))}function D(V){if(j||i)return;z.current=!0;function U(){z.current=!1,Q.current=!1}(!V.button||V.button===0)&&(Q.current=!0,Rt(V.currentTarget).addEventListener("pointerup",U,{once:!0}))}return zt("button",t,{state:{disabled:i,active:j,orientation:b},ref:[n,G,M],props:[R,{role:"tab","aria-controls":B,"aria-selected":j,id:k,onClick:Y,onFocus:ee,onPointerDown:D,[ak]:j?"":void 0,onKeyDownCapture(){A.current=!0}},p,P]})});let fY=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const dY={...gk,...va},hY=_.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}=vx(),S=br(),w=_.useMemo(()=>({id:S,value:i}),[S,i]),{ref:T,index:C}=mx({metadata:w}),k=i===d,{mounted:N,transitionStatus:R,setMounted:M}=Ap(k),L=!N,j=p(i),A={hidden:L,orientation:g,tabActivationDirection:y,transitionStatus:R},P=_.useRef(null),G=zt("div",t,{state:A,ref:[n,T,P],props:[{"aria-labelledby":j,hidden:L,id:S,role:"tabpanel",tabIndex:k?0:-1,inert:px(!k),[fY.index]:C},f],stateAttributesMapping:dY});return ba({open:k,ref:P,onComplete(){k||M(!1)}}),Le(()=>{if(!(L&&!l)&&S!=null)return b(i,S),()=>{x(i,S)}},[L,l,i,S,b,x]),l||N?G:null}),pY=_.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}=vx(),[S,w]=_.useState(0),[T,C]=_.useState(null),k=mY(y,g,T,d),N=Ae((j,A)=>{if(j!==y){const P=k(j);A.activationDirection=P,p(j,A)}}),R={orientation:g,tabActivationDirection:x},M={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},L=_.useMemo(()=>({activateOnFocus:s,highlightedTabIndex:S,onTabActivation:N,setHighlightedTabIndex:w,tabsListElement:T,value:y}),[s,S,N,w,T,y]);return h.jsx(yk.Provider,{value:L,children:h.jsx(ck,{render:l,className:i,state:R,refs:[n,C],props:[M,f],stateAttributesMapping:gk,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:a,orientation:g,onHighlightedIndexChange:w,onMapChange:b,disabledIndices:Nu})})});function ZC(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 mY(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}=ZC(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}=ZC(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 gY=_.forwardRef(({className:e,...t},n)=>h.jsx(pY,{ref:n,className:ge("flex items-center gap-0.5",e),...t}));gY.displayName="TabsList";const yY=mi("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"}}),vY=_.forwardRef(({className:e,variant:t,...n},s)=>h.jsx(uY,{ref:s,className:ge(yY({variant:t,className:e})),...n}));vY.displayName="TabsTrigger";const bY=_.forwardRef(({className:e,...t},n)=>h.jsx(hY,{ref:n,className:ge("outline-none",e),...t}));bY.displayName="TabsContent";const xY=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("font-mono text-[11px] text-neutral-300",e),...t}));xY.displayName="Text";const SY=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("font-mono text-[10px] text-neutral-500",e),...t}));SY.displayName="TextMuted";const _Y=_.forwardRef(({className:e,...t},n)=>h.jsx("code",{ref:n,className:ge("font-mono text-[11px] text-white",e),...t}));_Y.displayName="TextCode";const wY=_.forwardRef(({className:e,...t},n)=>h.jsx("span",{ref:n,className:ge("font-mono text-[9px] uppercase tracking-wider text-neutral-500",e),...t}));wY.displayName="TextLabel";const EY=_.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}));EY.displayName="CodeBlock";function xa(e,t){const[n,s]=_.useState(()=>{if(typeof window>"u")return t;try{const a=window.localStorage.getItem(e);return a===null?t:JSON.parse(a)}catch{return t}});_.useEffect(()=>{try{n==null?window.localStorage.removeItem(e):window.localStorage.setItem(e,JSON.stringify(n))}catch{}},[e,n]);const i=_.useCallback(a=>{s(l=>typeof a=="function"?a(l):a)},[]);return[n,i]}const TY="console:instance-id";function Lt(){const[e,t]=xa(TY,""),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 Si(e,t){return e===0?!1:e??t}function rf(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 sf(e={}){const t=Vt(),{instanceId:n}=Lt(),s=e.instanceId??n,i=rf(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 Xu(t.GET("/console/stats",{params:{query:i}}))},enabled:!!t,refetchInterval:Si(e.refetchIntervalMs,5e3)})}function CY(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:Si(t.refetchIntervalMs,3e4)})}function RY(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:Si(t.refetchIntervalMs,3e4)})}function NY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=rf({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 Xu(n.GET("/console/commits",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:Si(t.refetchIntervalMs,1e4)})}function jY(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 AY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=rf({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 Xu(n.GET("/console/timeline",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:Si(t.refetchIntervalMs,1e4)})}function vk(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=rf({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 Xu(n.GET("/console/clients",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:Si(t.refetchIntervalMs,1e4)})}function kY(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 OY(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 MY(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 IY(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 PY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=rf({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 Xu(n.GET("/console/operations",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:Si(t.refetchIntervalMs,1e4)})}function DY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 zY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 LY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 UY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 $Y(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 BY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 FY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 HY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 qY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 VY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 KY(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:Si(e.refetchIntervalMs,3e4)})}function GY(){const{config:e}=Dt(),t=_r();return is({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 YY="console:partition-id";function of(){const[e,t]=xa(YY,""),n=e.trim();return _.useMemo(()=>({partitionId:n.length>0?n:void 0,rawPartitionId:e,setPartitionId:t,clearPartitionId:()=>t("")}),[n,e,t])}const YC={refreshInterval:5,timeFormat:"relative",showSparklines:!0,pageSize:20};function af(){const[e,t]=xa("console:preferences",YC);return{preferences:e,setPreferences:t,updatePreference:(i,a)=>{t(l=>({...l,[i]:a}))},resetPreferences:()=>{t(YC)}}}const XY=[{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"}],QY=[{value:10,label:"10"},{value:20,label:"20"},{value:50,label:"50"},{value:100,label:"100"}],bx="syncular-console-root";function WY(e){e.classList.add(bx)}const JY=[{suffix:"",label:"Command"},{suffix:"/stream",label:"Stream"},{suffix:"/fleet",label:"Fleet"},{suffix:"/ops",label:"Ops"},{suffix:"/storage",label:"Storage"},{suffix:"/config",label:"Config"}];function eX(e){const t=e?.trim()??"";return!t||t==="/"?"":(t.startsWith("/")?t:`/${t}`).replace(/\/+$/g,"")}function By(e,t){return e?t?`${e}${t}`:e:t||"/"}function tX({basePath:e,appHref:t,modeBadge:n}){const{connect:s,config:i,isConnected:a,isConnecting:l}=Dt(),{preferences:f}=af(),{instanceId:d,rawInstanceId:p,setInstanceId:g,clearInstanceId:y}=Lt(),{partitionId:b,rawPartitionId:x,setPartitionId:S,clearPartitionId:w}=of(),T=vr({select:P=>P.location.pathname}),{data:C}=sf({refetchIntervalMs:f.refreshInterval*1e3,partitionId:b,instanceId:d}),k=eX(e),N=_.useMemo(()=>JY.map(P=>({...P,id:By(k,P.suffix)})),[k]),R=By(k,""),M=By(k,"/config"),L=l?"connecting":a?"connected":i?"disconnected":"not-configured",j=N.find(P=>P.suffix===""?T===R||T===`${R}/`:T.startsWith(P.id))?.id??R,A=C?[{label:"HEAD",value:`#${C.maxCommitSeq}`},{label:"COMMITS",value:`${C.commitCount}`},{label:"CHANGES",value:`${C.changeCount}`},{label:"CLIENTS",value:`${C.activeClientCount}/${C.clientCount}`}]:[];return h.jsxs("div",{className:`${bx} h-screen bg-background text-foreground flex flex-col`,children:[h.jsx(UZ,{brand:h.jsx(xc,{to:R,children:h.jsx(LZ,{label:"console"})}),center:h.jsx(kZ,{items:N,activeId:j,renderItem:(P,{active:G})=>h.jsx(xc,{to:P.id,children:h.jsx(lk,{active:G,children:P.label})},P.id)}),right:h.jsxs("div",{className:"flex items-center gap-2",children:[n?h.jsx(mn,{variant:"flow",className:"hidden md:inline-flex px-2 py-1 text-[10px]",children:n}):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:"Instance"}),h.jsx(Gn,{variant:"mono",value:p,onChange:P=>g(P.target.value),onBlur:P=>g(P.target.value.trim()),placeholder:"all",className:"h-7 w-[110px] px-2 py-1"}),d?h.jsx(Oe,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:y,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:x,onChange:P=>S(P.target.value),onBlur:P=>S(P.target.value.trim()),placeholder:"all",className:"h-7 w-[110px] px-2 py-1"}),b?h.jsx(Oe,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:w,children:"All"}):null]}),h.jsx(I8,{state:L}),h.jsx(xc,{to:M,children:h.jsx(Oe,{variant:T===M?"secondary":"ghost",size:"icon",children:h.jsx(Q8,{className:"h-3 w-3"})})}),t?h.jsxs("a",{href:t,className:AZ,children:[h.jsx(Y8,{className:"h-3 w-3"}),"Go to app"]}):null]})}),h.jsx("main",{className:"flex-1 overflow-auto pb-[32px]",children:h.jsx("div",{className:"min-h-full",children:a||T===M?h.jsx("div",{style:{animation:"pageIn 0.3s ease-out"},children:h.jsx(JN,{})},T):h.jsx(nX,{configPath:M,hasSavedConfig:!!i,isConnecting:l,onConnect:()=>{s()}})})}),a&&h.jsx(Vj,{isLive:a,metrics:A,uptime:"--"})]})}function nX({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(Oe,{variant:"default",onClick:s,disabled:n,children:n?"Connecting...":"Connect"}),h.jsx(xc,{to:e,children:h.jsx(Oe,{variant:"link",children:"Configure connection"})})]})]})}const lo=MH({component:tX});function rX(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("swServer")==="1"}function sX(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,k]=_.useState(null),N=_.useRef(null),R=_.useRef(null),M=_.useRef(null),L=_.useRef(0),j=_.useRef(0),A=_.useRef(null),P=_.useRef(null),G=_.useCallback(()=>{b([]),A.current=null,P.current=null},[]);return _.useEffect(()=>{if(!n||!d||!f?.serverUrl||!f?.token)return;let B=!1;const z=Number.isFinite(i)?Math.max(1,Math.min(500,Math.floor(i))):100;if(rX()||typeof WebSocket>"u"){T("connecting"),S(!1);let V=null,U=!1;const I=async()=>{if(!(B||U)){U=!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(z)),H.searchParams.set("offset","0"),a&&H.searchParams.set("partitionId",a);const X=await fetch(H.toString(),{headers:{Authorization:`Bearer ${f.token}`}});if(!X.ok)throw new Error(`Live event polling failed (${X.status})`);const oe=await X.json(),de=(Array.isArray(oe.items)?oe.items:[]).filter(Me=>g?Me.instanceId===g:!0).sort((Me,_e)=>Me.eventId-_e.eventId),xe=P.current??-1,he=de.filter(Me=>Me.eventId>xe);if(he.length>0){const Me=he.map(ne=>({type:ne.eventType,timestamp:ne.createdAt,data:ne})).reverse();b(ne=>[...Me,...ne].slice(0,t));const _e=he[he.length-1];P.current=_e.eventId,A.current=_e.createdAt}else if(de.length>0){const Me=de[de.length-1];P.current=Math.max(P.current??-1,Me.eventId),A.current=Me.createdAt}k(null),S(!0),T("connected")}catch(H){B||(S(!1),T("disconnected"),k(H instanceof Error?H:new Error("Live event polling failed")))}finally{U=!1}}};return I(),V=setInterval(()=>{I()},2e3),()=>{B=!0,V&&clearInterval(V),S(!1),T("disconnected")}}const Y=()=>{R.current&&(clearTimeout(R.current),R.current=null)},ee=()=>{M.current&&(clearInterval(M.current),M.current=null)},D=()=>{if(B||R.current)return;L.current+=1;const V=Math.min(3e4,1e3*2**Math.max(0,L.current-1)),U=Math.floor(V*.2*Math.random()),I=V+U;R.current=setTimeout(()=>{R.current=null,B||q()},I)},K=()=>{j.current=Date.now(),S(!0),T("connected")},q=()=>{if(B)return;T("connecting"),Y();const V=(()=>{const I=new URL(f.serverUrl,window.location.origin);I.protocol=I.protocol==="https:"?"wss:":"ws:";const H=I.pathname.endsWith("/")?I.pathname.slice(0,-1):I.pathname;return I.pathname=`${H}/console/events/live`,I.search="",A.current&&I.searchParams.set("since",A.current),I.searchParams.set("replayLimit",String(z)),a&&I.searchParams.set("partitionId",a),g&&I.searchParams.set("instanceId",g),I.toString()})(),U=new WebSocket(V);N.current=U,U.onopen=()=>{if(B){U.close();return}L.current=0,k(null),T("connecting"),S(!1);try{U.send(JSON.stringify({type:"auth",token:f.token}))}catch{U.close();return}ee(),M.current=setInterval(()=>{const I=N.current;if(!I||I.readyState!==WebSocket.OPEN)return;const H=j.current;!H||Date.now()-H<=s||(S(!1),T("stale"),I.close())},1e3)},U.onclose=()=>{B||(S(!1),T("disconnected"),ee(),D())},U.onerror=()=>{B||k(new Error("WebSocket connection failed"))},U.onmessage=I=>{try{const H=JSON.parse(I.data),W=H.type;if(K(),W==="connected"||W==="heartbeat"||W==="auth_required")return;if(W==="error"){const de=typeof H.message=="string"?H.message:"Live events authentication failed";k(new Error(de));return}const X={type:W,timestamp:H.timestamp||new Date().toISOString(),data:H};if(a&&X.data.partitionId!==a||g&&X.data.instanceId!==g)return;const oe=Date.parse(A.current??""),se=Date.parse(X.timestamp);Number.isFinite(se)&&(!Number.isFinite(oe)||se>oe)&&(A.current=X.timestamp),b(de=>[X,...de].slice(0,t))}catch{}}};return q(),()=>{B=!0,Y(),ee(),N.current&&(N.current.close(),N.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:G}}function oX(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 iX=_.createContext(null);function bk(){const[e,t]=xa("console:time-range","24h");return{range:e,setRange:t}}const aX=[{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 cX(e){const t=e.toLowerCase();for(const n of aX)if(t.includes(n.hint))return n.type;return"client"}function lX(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 uX(e,t){return typeof e.lagCommitCount=="number"?Math.max(0,e.lagCommitCount):t?Math.max(0,t.maxCommitSeq-e.cursor):0}function fX(e,t){return e.activityState==="stale"?"offline":t>0?"syncing":"online"}function dX(e,t){return e.length<=16?e:`${e.slice(0,12)}-${t+1}`}function hX(e,t,n={}){const s=n.maxNodes??10;return e.slice(0,s).map((i,a)=>{const l=uX(i,t),f=fX(i,l);return{id:dX(i.clientId,a),type:cX(i.clientId),status:f,cursor:Math.max(0,i.cursor),actor:i.actorId,mode:i.connectionMode,dialect:lX(i.clientId),scopes:Object.keys(i.effectiveScopes||{}),lastSeen:i.updatedAt}})}const pX={enabled:!1,thresholds:{p90Latency:500,errorRate:5,clientLag:100}};function XC(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 mX(e){const t=e.length>1&&e.endsWith("/")?e.slice(0,-1):e;return t==="/console"||t.startsWith("/console/")?"/console/stream":"/stream"}function gX(){const e=mp(),t=_.useMemo(()=>typeof window>"u"?"/stream":mX(window.location.pathname),[]),n=bk(),{range:s}=n,{preferences:i}=af(),{partitionId:a}=of(),l=i.refreshInterval*1e3,[f]=xa("console:alert-config",pX),[d,p]=_.useState("1h"),{data:g}=sf({refetchIntervalMs:l,partitionId:a}),{data:y}=CY({range:s,partitionId:a},{refetchIntervalMs:l}),{data:b}=RY({range:s,partitionId:a},{refetchIntervalMs:l}),{data:x}=NY({limit:5,partitionId:a},{refetchIntervalMs:l}),{data:S}=vk({limit:12,offset:0,partitionId:a},{refetchIntervalMs:l}),{events:w,isConnected:T}=sX({maxEvents:8,partitionId:a}),C=_.useMemo(()=>{const z=y?.buckets??[];let Q=0,Y=0;for(const D of z)Q+=D.pushCount+D.pullCount,Y+=D.errorCount;const ee=Q>0?Y/Q*100:0;return{totalEvents:Q,errorRate:ee}},[y?.buckets]),k=_.useMemo(()=>S?.items?hX(S.items,g,{maxNodes:12}):[],[S?.items,g]),N=k.filter(z=>z.status!=="offline").length,R=k.filter(z=>z.status==="offline").length,M=_.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]),L=_.useMemo(()=>w.map(z=>({type:z.type.toUpperCase(),actor:z.data?.actorId??"",table:(z.data?.tables??[])[0]??"",time:XC(z.timestamp,i.timeFormat)})),[w,i.timeFormat]),j=_.useMemo(()=>{const z=y?.buckets;if(!z?.length)return[];const Q=Math.max(...z.map(Y=>Math.max(Y.pushCount,Y.pullCount)),1);return z.map(Y=>({pushPercent:Q>0?Y.pushCount/Q*100:0,pullPercent:Q>0?Y.pullCount/Q*100:0}))},[y?.buckets]),A=_.useMemo(()=>{if(!b)return[];const z=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/z*100,pullBarPercent:b.pull.p50/z*100},{label:"P90",pushMs:b.push.p90,pullMs:b.pull.p90,pushBarPercent:b.push.p90/z*100,pullBarPercent:b.pull.p90/z*100},{label:"P99",pushMs:b.push.p99,pullMs:b.pull.p99,pushBarPercent:b.push.p99/z*100,pullBarPercent:b.pull.p99/z*100}]},[b]),P=_.useMemo(()=>x?.items?x.items.map(z=>({seq:z.commitSeq,actor:z.actorId,changes:z.changeCount,tables:(z.affectedTables??[]).join(", "),time:XC(z.createdAt,i.timeFormat)})):[],[x?.items,i.timeFormat]),G=_.useMemo(()=>Math.max(0,100-C.errorRate),[C.errorRate]),B=_.useMemo(()=>{if(!f.enabled||!g)return[];const z=[];return b?.push?.p90&&b.push.p90>f.thresholds.p90Latency&&z.push(`P90 push latency (${b.push.p90}ms) exceeds threshold (${f.thresholds.p90Latency}ms)`),g.minActiveClientCursor!==null&&g.maxCommitSeq-g.minActiveClientCursor>f.thresholds.clientLag&&z.push(`Client lag (${g.maxCommitSeq-g.minActiveClientCursor}) exceeds threshold (${f.thresholds.clientLag})`),C.errorRate>f.thresholds.errorRate&&z.push(`Error rate (${C.errorRate.toFixed(1)}%) exceeds threshold (${f.thresholds.errorRate}%)`),z},[f,g,b,C.errorRate]);return g?h.jsx(iX.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(nf,{children:"Threshold Exceeded"}),h.jsx(Pn,{children:B.map((z,Q)=>h.jsx("span",{className:"block",children:z},Q))})]})}),h.jsx(HA,{clients:k,totalNodes:k.length+2,onlineCount:N,offlineCount:R,relayClientIds:[]}),h.jsx(Jj,{items:M}),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(Tj,{bars:j,activeRange:d,onRangeChange:p})}),h.jsx("div",{className:"border-b border-border border-r border-border",children:h.jsx(eA,{buckets:A,successRate:G})}),h.jsx("div",{className:"border-r border-border",children:h.jsx(Kj,{commits:P,onViewAll:()=>e({href:t})})})]}),h.jsx(tA,{entries:L,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 yX(){return h.jsx(gX,{})}function vX({children:e}){return h.jsxs("div",{className:"space-y-4 px-5 py-5",children:[h.jsx(bX,{}),h.jsx(EX,{}),h.jsx(TX,{}),e]})}function bX(){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,k]=xa("console:disconnect-clear-saved-config",!1);_.useEffect(()=>{const j=new URLSearchParams(window.location.search),A=j.get("server");let P=!1;if(A&&(d(A),j.delete("server"),P=!0),j.has("token")&&(j.delete("token"),P=!0),P){const G=j.toString(),B=G?`${window.location.pathname}?${G}`:window.location.pathname;window.history.replaceState({},"",B)}},[]),_.useEffect(()=>{t?.serverUrl&&d(t.serverUrl),t?.token&&g(t.token)},[t?.serverUrl,t?.token]),_.useEffect(()=>{T(null)},[]);const N=async()=>{e(),b(null);const j=await n({serverUrl:f.trim(),token:p.trim()},{persistOverride:!0});T(j?"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)},M=async()=>{S(!0),b(null),T(null);const j=performance.now();try{const A=f.trim(),P=p.trim();if(!A||!P)throw new Error("Missing server URL or token");if(!(await fetch(`${A}/console/stats`,{headers:{Authorization:`Bearer ${P}`}})).ok)throw new Error("Failed to connect");b(Math.round(performance.now()-j))}catch{b(-1)}finally{S(!1)}},L=i??w??(y!==null?y<0?"Connection failed":`Connection successful (${y}ms latency)`:void 0);return h.jsx(Zj,{isConnected:a,isConnecting:l,isTestingConnection:x,serverUrl:f,onServerUrlChange:d,consoleToken:p,onConsoleTokenChange:g,onSaveAndConnect:N,onDisconnect:R,onTestConnection:M,statusMessage:L,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(Ep,{checked:C,onCheckedChange:k})]})})})}const xX=1440*60*1e3;function QC(e){const t=e.trim();if(!t)return null;const n=Number.parseInt(t,10);return!Number.isInteger(n)||n<=0?null:n}function Fy(e){if(!e)return"Never";const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():"Invalid date"}function SX(e){return e.length===0?"all scopes":e.length<=2?e.join(", "):`${e.slice(0,2).join(", ")} +${e.length-2}`}function _X(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*xX?"expiring":"active"}function wX(e){return e==="revoked"?"destructive":e==="expired"?"offline":e==="expiring"?"syncing":"healthy"}function EX(){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(""),[k,N]=_.useState(""),[R,M]=_.useState(null),[L,j]=_.useState([]),[A,P]=_.useState(null),[G,B]=_.useState(null),[z,Q]=_.useState(null),[Y,ee]=_.useState(null),[D,K]=_.useState(null),[q,V]=_.useState(null),[U,I]=_.useState(null),H=_.useMemo(()=>QC(i),[i]),W=H??14,X=_.useMemo(()=>QC(k),[k]),oe=k.trim().length>0,se=!oe||X!==null,de=_.useMemo(()=>({type:e==="all"?void 0:e,status:n==="all"?void 0:n,expiresWithinDays:n==="expiring"?W:void 0}),[e,n,W]),{data:xe,isLoading:he,error:Me}=$Y(de),_e=BY(),ne=HY(),pe=FY(),ae=qY(),we=VY();_.useEffect(()=>{const me=new Set((xe?.items??[]).map(Te=>Te.keyId));j(Te=>Te.filter(qe=>me.has(qe)))},[xe?.items]);const ve=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:oe?X??void 0:void 0});M(Te.secretKey),y(""),w(""),C(""),N("")}catch{}},Se=me=>{navigator.clipboard.writeText(me),B(me),setTimeout(()=>B(null),2e3)},ye=async()=>{if(z)try{await pe.mutateAsync(z)}finally{Q(null)}},Ue=async()=>{if(L.length!==0)try{const me=await ne.mutateAsync({keyIds:L});P(me),j([])}catch{}},Ie=async()=>{if(Y)try{const me=await we.mutateAsync(Y.keyId);K({oldKeyId:Y.keyId,oldKeyName:Y.name,secretKey:me.secretKey})}catch{}},Ee=async()=>{if(D)try{await pe.mutateAsync(D.oldKeyId)}finally{K(null),ee(null)}},Ve=async()=>{if(q)try{const me=await ae.mutateAsync(q);I(me.secretKey)}finally{V(null)}};if(he)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 Xe=(xe?.items??[]).filter(me=>me.revokedAt===null).map(me=>me.keyId),Be=Xe.length>0&&Xe.every(me=>L.includes(me)),We=L.length>0,He=(xe?.items??[]).filter(me=>L.includes(me.keyId)).map(me=>me.name);return h.jsxs(h.Fragment,{children:[h.jsxs(tx,{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(Oe,{size:"sm",variant:"destructive",onClick:()=>p(!0),disabled:L.length===0,children:["Revoke Selected (",L.length,")"]}),h.jsx(Oe,{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(ms,{children:[h.jsx(ts,{children:"Type filter"}),h.jsxs(hh,{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(ms,{children:[h.jsx(ts,{children:"Status filter"}),h.jsxs(hh,{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(ms,{children:[h.jsx(ts,{htmlFor:"api-key-expiring-window",children:"Expiring window (days)"}),h.jsx(mc,{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]})]}),xe?.items.length===0?h.jsx(Jb,{message:"No API keys match the current filters."}):h.jsxs(nl,{children:[h.jsx(rl,{children:h.jsxs(os,{children:[h.jsx(ht,{className:"w-[28px]",children:h.jsx(Fv,{checked:Be,indeterminate:!Be&&We&&Xe.length>0,onCheckedChange:me=>{j(me?Xe:[])},"aria-label":"Select all active keys"})}),h.jsx(ht,{className:"w-[100px]",children:"NAME"}),h.jsx(ht,{className:"w-[55px]",children:"TYPE"}),h.jsx(ht,{className:"w-[90px]",children:"KEY PREFIX"}),h.jsx(ht,{className:"w-[80px]",children:"ACTOR"}),h.jsx(ht,{className:"w-[100px]",children:"SCOPES"}),h.jsx(ht,{className:"w-[120px]",children:"CREATED"}),h.jsx(ht,{className:"w-[120px]",children:"LAST USED"}),h.jsx(ht,{className:"w-[120px]",children:"EXPIRES"}),h.jsx(ht,{className:"flex-1",children:"STATUS"})]})}),h.jsx(sl,{children:(xe?.items??[]).map(me=>{const Te=_X(me,W);return h.jsxs(os,{className:"group relative",children:[h.jsx(pt,{className:"w-[28px]",children:h.jsx(Fv,{checked:L.includes(me.keyId),onCheckedChange:qe=>{j(mt=>qe?[...new Set([...mt,me.keyId])]:mt.filter(lt=>lt!==me.keyId))},"aria-label":`Select ${me.name}`,disabled:me.revokedAt!==null})}),h.jsx(pt,{className:"w-[100px] font-medium",children:me.name}),h.jsx(pt,{className:"w-[55px]",children:h.jsx(mn,{variant:me.keyType==="admin"?"flow":me.keyType==="proxy"?"ghost":"relay",children:me.keyType})}),h.jsx(pt,{className:"w-[90px]",children:h.jsxs("code",{className:"font-mono text-[11px]",children:[me.keyPrefix,"..."]})}),h.jsx(pt,{className:"w-[80px] text-neutral-500",children:me.actorId??"-"}),h.jsx(pt,{className:"w-[100px] text-neutral-500",children:h.jsx("code",{className:"font-mono text-[10px]",children:SX(me.scopeKeys)})}),h.jsx(pt,{className:"w-[120px] text-neutral-500",children:Fy(me.createdAt)}),h.jsx(pt,{className:"w-[120px] text-neutral-500",children:Fy(me.lastUsedAt)}),h.jsx(pt,{className:"w-[120px] text-neutral-500",children:Fy(me.expiresAt)}),h.jsx(pt,{className:"flex-1",children:h.jsx(mn,{variant:wX(Te),children:Te})}),me.revokedAt===null&&h.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{type:"button",onClick:()=>ee(me),className:"px-1.5 py-0.5 rounded text-[9px] font-mono text-neutral-600 hover:text-white hover:bg-white/[0.05] cursor-pointer transition-colors",children:"stage"}),h.jsx("button",{type:"button",onClick:()=>V(me.keyId),className:"px-1.5 py-0.5 rounded text-[9px] font-mono text-neutral-600 hover:text-white hover:bg-white/[0.05] cursor-pointer transition-colors",children:"rotate"}),h.jsx("button",{type:"button",onClick:()=>Q(me.keyId),className:"px-1.5 py-0.5 rounded text-[9px] font-mono text-neutral-600 hover:text-offline hover:bg-offline/10 cursor-pointer transition-colors",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(WC,{copiedKeyId:G,onClose:()=>{M(null),f(!1)},onCopy:Se,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(ms,{children:[h.jsx(ts,{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(ms,{children:[h.jsx(ts,{children:"Key type"}),h.jsxs(hh,{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(ms,{children:[h.jsx(ts,{htmlFor:"api-key-actor-id",children:"Actor ID (optional)"}),h.jsx(mc,{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(ms,{children:[h.jsx(ts,{htmlFor:"api-key-scope-keys",children:"Scope keys (optional)"}),h.jsx(mc,{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(ms,{children:[h.jsx(ts,{htmlFor:"api-key-expires-days",children:"Expires in days (optional)"}),h.jsx(mc,{children:"Leave empty to keep the key non-expiring."}),h.jsx(Gn,{id:"api-key-expires-days",placeholder:"30",value:k,inputMode:"numeric",onChange:me=>N(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(Oe,{variant:"default",onClick:()=>f(!1),children:"Cancel"}),h.jsx(Oe,{variant:"primary",onClick:ve,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||P(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(Oe,{variant:"primary",onClick:()=>{p(!1),P(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(Oe,{variant:"default",onClick:()=>p(!1),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",onClick:Ue,disabled:ne.isPending||L.length===0,children:ne.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking..."]}):"Revoke Selected"})]})]})]})}),h.jsx($r,{open:Y!==null||D!==null,onOpenChange:()=>{ee(null),K(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Stage Rotate API Key"})}),D?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 ",D.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:D.secretKey}),h.jsx(Oe,{variant:"default",size:"sm",onClick:()=>Se(D.secretKey),children:G===D.secretKey?"Copied":"Copy"})]}),h.jsxs(Nn,{children:[h.jsx(Oe,{variant:"default",onClick:()=>{K(null),ee(null)},children:"Keep Old Key Active"}),h.jsx(Oe,{variant:"destructive",onClick:Ee,disabled:pe.isPending,children:pe.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(Oe,{variant:"default",onClick:()=>ee(null),children:"Cancel"}),h.jsx(Oe,{variant:"primary",onClick:Ie,disabled:we.isPending||!Y,children:we.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Staging..."]}):"Create Replacement Key"})]})]})]})}),h.jsx($r,{open:z!==null,onOpenChange:()=>Q(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(Oe,{variant:"default",onClick:()=>Q(null),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",onClick:ye,disabled:pe.isPending,children:pe.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking..."]}):"Revoke"})]})]})}),h.jsx($r,{open:q!==null||U!==null,onOpenChange:()=>{V(null),I(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Rotate API Key"})}),U?h.jsx(WC,{copiedKeyId:G,onClose:()=>I(null),onCopy:Se,secretKey:U,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(Oe,{variant:"default",onClick:()=>V(null),children:"Cancel"}),h.jsx(Oe,{variant:"primary",onClick:Ve,disabled:ae.isPending,children:ae.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Rotating..."]}):"Rotate"})]})]})]})})]})}function TX(){const{preferences:e,updatePreference:t,resetPreferences:n}=af(),s=[{type:"filter",label:"Auto-refresh interval",options:XY.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:QY.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(nA,{rows:s,onResetDefaults:n})}function WC({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(Oe,{variant:"default",size:"sm",onClick:()=>n(s),children:e===s?"Copied":"Copy"})]}),h.jsx(Nn,{children:h.jsx(Oe,{variant:"primary",onClick:t,children:"Done"})})]})}function CX(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 RX(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 NX(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 jX(e,t,n){return{id:e.clientId,type:CX(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:RX(e.clientId),scopes:Object.keys(e.effectiveScopes??{}),lastSeen:NX(e.updatedAt,n)}}function AX({emptyState:e}={}){const[t,n]=_.useState(1),[s,i]=_.useState(null),{preferences:a}=af(),{partitionId:l}=of(),f=a.pageSize,d=a.refreshInterval*1e3,{data:p,isLoading:g}=sf({refetchIntervalMs:d,partitionId:l}),{data:y,isLoading:b,error:x}=vk({limit:f,offset:(t-1)*f,partitionId:l},{refetchIntervalMs:d}),S=DY(),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 k=(y?.items??[]).map(N=>jX(N,T,a.timeFormat));return h.jsxs("div",{className:"flex flex-col gap-5 px-5 py-5",children:[k.length>0&&h.jsx(sA,{clients:k,headSeq:T}),k.length===0?e??h.jsx(iV,{children:h.jsx(Jb,{message:"No clients yet"})}):h.jsx(Qj,{clients:k,headSeq:T,onEvict:N=>{const R=y?.items.find(M=>M.clientId===N);i(R?.clientId??N)}}),w>1&&h.jsx(yx,{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(Oe,{variant:"default",onClick:()=>i(null),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",onClick:C,disabled:S.isPending,children:S.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Evicting..."]}):"Evict"})]})]})})]})}const kX={latencyThresholdMs:1e3,errorRateThreshold:5,clientLagThreshold:50,enabled:!1};function OX(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 MX(e){const t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);return Array.from(new Set(t))}function IX(e){switch(e){case"notify_data_change":return"Notify";case"evict_client":return"Evict";case"compact":return"Compact";default:return"Prune"}}function JC(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function PX(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function DX(e){const t=JC(e.requestPayload),n=JC(e.resultPayload);if(e.operationType==="notify_data_change"){const a=PX(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 zX(e){const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function LX(){const{partitionId:e}=of();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(UX,{}),h.jsx(qX,{})]}),h.jsxs("div",{className:"grid gap-4 xl:grid-cols-3",children:[h.jsx($X,{partitionId:e}),h.jsx(BX,{partitionId:e}),h.jsx(FX,{partitionId:e})]}),h.jsx(HX,{partitionId:e})]})}function UX(){const{data:e,isLoading:t,error:n}=MY();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?OX(i.snapshotChunkTtlMs):"default"}));return h.jsx(Wj,{handlers:s,tableCount:e?.items.length??0})}function $X({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState(null),{data:a,isLoading:l}=sf({partitionId:e}),{data:f,isLoading:d,refetch:p}=IY({enabled:!1}),g=zY(),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(Tp,{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(nf,{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(mn,{variant:f.commitsToDelete>0?"offline":"ghost",children:f.commitsToDelete})]})]})]}):null}),h.jsxs(Nn,{children:[h.jsx(Oe,{variant:"default",onClick:()=>n(!1),children:s!==null?"Close":"Cancel"}),s===null&&h.jsx(Oe,{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 BX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState(null),{data:a,isLoading:l}=sf({partitionId:e}),f=LY(),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(Tp,{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(nf,{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(Oe,{variant:"default",onClick:()=>n(!1),children:s!==null?"Close":"Cancel"}),s===null&&h.jsx(Oe,{variant:"primary",onClick:p,disabled:f.isPending,children:f.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Compacting..."]}):"Compact Now"})]})]})})]})}function FX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState("tasks"),[a,l]=_.useState(e??""),[f,d]=_.useState(null),[p,g]=_.useState(null),y=UY(),b=MX(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(Tp,{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(nf,{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(ms,{children:[h.jsx(ts,{children:"Tables (comma-separated)"}),h.jsx(Gn,{value:s,onChange:T=>i(T.target.value),placeholder:"tasks, notes",disabled:y.isPending}),h.jsx(mc,{children:"Enter one or more table names affected by the external change."})]}),h.jsxs(ms,{children:[h.jsx(ts,{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(Oe,{variant:"default",onClick:()=>n(!1),children:f?"Close":"Cancel"}),f?null:h.jsx(Oe,{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 HX({partitionId:e}){const[t,n]=_.useState("all"),{data:s,isLoading:i,error:a}=PY({limit:20,offset:0,operationType:t==="all"?void 0:t,partitionId:e},{refetchIntervalMs:5e3});return h.jsx(tx,{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(Oe,{variant:t==="all"?"default":"ghost",size:"sm",onClick:()=>n("all"),children:"All"}),h.jsx(Oe,{variant:t==="prune"?"default":"ghost",size:"sm",onClick:()=>n("prune"),children:"Prune"}),h.jsx(Oe,{variant:t==="compact"?"default":"ghost",size:"sm",onClick:()=>n("compact"),children:"Compact"}),h.jsx(Oe,{variant:t==="notify_data_change"?"default":"ghost",size:"sm",onClick:()=>n("notify_data_change"),children:"Notify"}),h.jsx(Oe,{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(nl,{children:[h.jsx(rl,{children:h.jsxs(os,{children:[h.jsx(ht,{children:"Time"}),h.jsx(ht,{children:"Type"}),h.jsx(ht,{children:"User"}),h.jsx(ht,{children:"Target"}),h.jsx(ht,{children:"Result"})]})}),h.jsx(sl,{children:(s?.items??[]).map((l,f)=>h.jsxs(os,{children:[h.jsx(pt,{className:"whitespace-nowrap text-xs text-neutral-400",children:zX(l.createdAt)}),h.jsx(pt,{children:h.jsx(mn,{variant:"ghost",children:IX(l.operationType)})}),h.jsx(pt,{className:"font-mono text-xs",children:l.consoleUserId??"system"}),h.jsx(pt,{className:"font-mono text-xs",children:l.targetClientId??l.partitionId??(l.operationType==="notify_data_change"?"partition default":"global")}),h.jsx(pt,{className:"font-mono text-xs text-neutral-300",children:DX(l)})]},`${l.operationId}:${l.createdAt}:${f}`))})]})})})}function qX(){const[e,t]=xa("console:alert-config",kX),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(qj,{enabled:e.enabled,onEnabledChange:i,thresholds:n,onThresholdsChange:s})}function VX(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 KX(e){const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function GX(){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}=KY({prefix:n,cursor:i,limit:100}),x=GY(),S=ZY();function w(){const M=e.trim();s(M.length>0?M:void 0),a(void 0),f([])}function T(){t(""),s(void 0),a(void 0),f([])}function C(){g?.cursor&&(f(M=>[...M,i??""]),a(g.cursor))}function k(){f(M=>{const L=[...M],j=L.pop();return a(j&&j.length>0?j:void 0),L})}function N(){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(tx,{title:"Storage",actions:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Gn,{placeholder:"Prefix filter...",value:e,onChange:M=>t(M.target.value),onKeyDown:M=>{M.key==="Enter"&&w()},className:"h-7 w-48 text-xs"}),h.jsx(Oe,{variant:"default",size:"sm",onClick:w,children:"Filter"}),n&&h.jsx(Oe,{variant:"ghost",size:"sm",onClick:T,children:"Clear"})]}),children:R.length===0?h.jsx(Jb,{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(nl,{children:[h.jsx(rl,{children:h.jsxs(os,{children:[h.jsx(ht,{children:"Key"}),h.jsx(ht,{children:"Size"}),h.jsx(ht,{children:"Type"}),h.jsx(ht,{children:"Uploaded"}),h.jsx(ht,{children:"Actions"})]})}),h.jsx(sl,{children:R.map(M=>h.jsxs(os,{children:[h.jsx(pt,{className:"font-mono text-xs max-w-[320px]",title:M.key,children:M.key}),h.jsx(pt,{className:"font-mono text-xs text-neutral-400 whitespace-nowrap",children:VX(M.size)}),h.jsx(pt,{children:M.httpMetadata?.contentType?h.jsx(mn,{variant:"ghost",children:M.httpMetadata.contentType}):h.jsx("span",{className:"text-neutral-500 text-xs",children:"--"})}),h.jsx(pt,{className:"whitespace-nowrap text-xs text-neutral-400",children:KX(M.uploaded)}),h.jsx(pt,{children:h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>{S(M.key)},children:"Download"}),h.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>p(M.key),children:"Delete"})]})})]},M.key))})]})}),h.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[h.jsx(Oe,{variant:"ghost",size:"sm",disabled:l.length===0,onClick:k,children:"Previous"}),h.jsx(Oe,{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(Oe,{variant:"default",onClick:()=>p(null),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",onClick:N,disabled:x.isPending,children:x.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"})," Deleting..."]}):"Delete"})]})]})})]})}const ZX={};function au(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 YX(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 XX(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 Zd(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function QX(e,t){return e?`#${e.federatedCommitId??(t?`${t}:${e.commitSeq}`:String(e.commitSeq))}`:"#?"}function WX(e,t){return e?`E${e.federatedEventId??(t?`${t}:${e.eventId}`:e.eventId)}`:"E?"}function JX(e,t,n){return!e||!t?null:e.replaceAll("{traceId}",encodeURIComponent(t)).replaceAll("{spanId}",encodeURIComponent(n??""))}function xx({initialSelectedEntryId:e}={}){const{preferences:t}=af(),{partitionId:n}=of(),{range:s,setRange:i}=bk(),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),[k,N]=_.useState(!1),[R,M]=_.useState(e??null),L=_.useRef(!1),j=_.useMemo(()=>YX(S),[S]),A=_.useMemo(()=>new Date(Date.now()-XX(s)).toISOString(),[s]),{data:P,isLoading:G,refetch:B}=AY({limit:a,offset:(T-1)*a,...n?{partitionId:n}:{},view:d,...d!=="commits"&&g!=="all"?{eventType:g}:{},...d!=="commits"&&b!=="all"?{outcome:b}:{},...j.actorId?{actorId:j.actorId}:{},...j.clientId?{clientId:j.clientId}:{},...j.requestId?{requestId:j.requestId}:{},...j.traceId?{traceId:j.traceId}:{},...j.table?{table:j.table}:{},...j.search?{search:j.search}:{},from:A},{refetchIntervalMs:l}),z=oX(),Q=R?.startsWith("#")?R.slice(1):void 0,Y=R?.startsWith("E")?R.slice(1):void 0,ee=Q&&Q!=="?"?Q:void 0,D=Y&&Y!=="?"?Y:void 0,{data:K,isLoading:q,error:V}=jY(ee,{enabled:ee!==void 0,partitionId:n}),{data:U,isLoading:I,error:H}=kY(D,{enabled:D!==void 0,partitionId:n}),{data:W,isLoading:X,error:oe}=OY(D,{enabled:D!==void 0&&!!U?.payloadRef,partitionId:n}),se=_.useMemo(()=>JX(f,U?.traceId??null,U?.spanId??null),[U?.spanId,U?.traceId,f]);_.useEffect(()=>{C(1)},[]),_.useEffect(()=>{C(1)},[]),_.useEffect(()=>{e&&M(e)},[e]),_.useEffect(()=>{if(!L.current){L.current=!0;return}M(null)},[]),_.useEffect(()=>{C(1),M(null)},[]);const xe=_.useMemo(()=>(P?.items??[]).map(we=>{const ve=we.instanceId??we.commit?.instanceId??we.event?.instanceId,Se=ve?`[${ve}] `:"";if(we.type==="commit"&&we.commit){const Ue=we.commit;return{type:"commit",id:QX(Ue,ve),outcome:"--",duration:"--",actor:Ue.actorId,client:Ue.clientId,detail:`${Se}${Ue.changeCount} chg | ${(Ue.affectedTables??[]).join(", ")}`,time:au(we.timestamp,t.timeFormat)}}const ye=we.event;return ye?{type:ye.eventType,id:WX(ye,ve),outcome:ye.outcome,duration:`${ye.durationMs}ms`,actor:ye.actorId,client:ye.clientId,detail:`${Se}${(ye.tables??[]).join(", ")||"--"}`,time:au(we.timestamp,t.timeFormat)}:{type:"pull",id:"E?",outcome:"unknown",duration:"--",actor:"",client:"",detail:"--",time:au(we.timestamp,t.timeFormat)}}),[t.timeFormat,P?.items]),he=P?.total??0,Me=Math.max(1,Math.ceil(he/a)),_e=G,ne=[{label:"",options:[{id:"all",label:"All"},{id:"commits",label:"Commits"},{id:"events",label:"Events"}],activeId:d,onActiveChange:ae=>{p(ae),ae==="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:ae=>{i(ae),C(1)}},{label:"Type",options:[{id:"all",label:"All"},{id:"push",label:"Push"},{id:"pull",label:"Pull"}],activeId:g,onActiveChange:ae=>{y(ae),C(1)}},{label:"Outcome",options:[{id:"all",label:"All"},{id:"applied",label:"Applied"},{id:"error",label:"Error"},{id:"rejected",label:"Rejected"}],activeId:b,onActiveChange:ae=>{x(ae),C(1)}}];function pe(){z.mutate(void 0,{onSuccess:()=>{N(!1),B()}})}return h.jsxs("div",{className:"flex flex-col h-full",children:[_e&&xe.length===0?h.jsx("div",{className:"flex items-center justify-center py-24",children:h.jsx(Pt,{size:"lg"})}):h.jsx(rA,{entries:xe,selectedEntryId:R,onEntryClick:ae=>M(ae.id),filterBar:h.jsx(Yj,{groups:ne,searchValue:S,searchPlaceholder:"Use actor:, client:, table:, request:, trace: or free text...",onSearchChange:w,actions:h.jsxs(h.Fragment,{children:[h.jsx(Oe,{size:"sm",variant:"ghost",onClick:()=>{B()},children:"Refresh"}),h.jsx(Oe,{size:"sm",variant:"ghost",children:"Export"}),h.jsx(Oe,{size:"sm",variant:"destructive",onClick:()=>N(!0),children:"Clear"})]})}),pagination:h.jsx(yx,{page:T,totalPages:Me,totalItems:he,onPageChange:C})}),h.jsx($r,{open:R!==null,onOpenChange:ae=>{ae||M(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:ee!==void 0?`Commit #${ee}`:D!==void 0?`Event E${D}`:"Entry details"})}),h.jsx("div",{className:"px-5 py-4 space-y-3 max-h-[70vh] overflow-y-auto",children:q||I?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."}):K?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:K.actorId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Client"}),h.jsx("div",{className:"text-neutral-100",children:K.clientId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Instance"}),h.jsx("div",{className:"text-neutral-100",children:K.instanceId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Created"}),h.jsx("div",{className:"text-neutral-100",children:au(K.createdAt,t.timeFormat)})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Changes"}),h.jsx("div",{className:"text-neutral-100",children:K.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:K.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"}),K.changes.length===0?h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No changes recorded."}):K.changes.map(ae=>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:[ae.table," | ",ae.op]}),h.jsxs("span",{className:"text-neutral-500",children:["#",ae.changeId]})]}),h.jsxs("div",{className:"font-mono text-[11px] text-neutral-400",children:["rowId: ",ae.rowId,ae.rowVersion!==null?` | version: ${ae.rowVersion}`:""]}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Zd(ae.rowJson)})]},ae.changeId))]})]}):U?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:U.eventType})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Path"}),h.jsx("div",{className:"text-neutral-100",children:U.syncPath})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Instance"}),h.jsx("div",{className:"text-neutral-100",children:U.instanceId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Outcome"}),h.jsx("div",{className:"text-neutral-100",children:U.outcome})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Response Status"}),h.jsx("div",{className:"text-neutral-100",children:U.responseStatus})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Actor"}),h.jsx("div",{className:"text-neutral-100",children:U.actorId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Client"}),h.jsx("div",{className:"text-neutral-100",children:U.clientId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Status"}),h.jsx("div",{className:"text-neutral-100",children:U.statusCode})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Transport"}),h.jsx("div",{className:"text-neutral-100",children:U.transportPath})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Duration"}),h.jsxs("div",{className:"text-neutral-100",children:[U.durationMs,"ms"]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Request ID"}),h.jsx("div",{className:"text-neutral-100",children:U.requestId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Trace ID"}),h.jsx("div",{className:"text-neutral-100",children:U.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:U.spanId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Commit Seq"}),h.jsx("div",{className:"text-neutral-100",children:U.commitSeq??"--"}),U.commitSeq!==null&&h.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>M(`#${U.instanceId?`${U.instanceId}:`:""}${U.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:U.subscriptionCount??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Error Code"}),h.jsx("div",{className:"text-neutral-100",children:U.errorCode??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Payload Ref"}),h.jsx("div",{className:"text-neutral-100",children:U.payloadRef??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Created"}),h.jsx("div",{className:"text-neutral-100",children:au(U.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:U.tables.join(", ")||"--"})]}),U.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:Zd(U.scopesSummary)})]}),U.payloadRef&&h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Payload Snapshot"}),X?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..."})]}):oe?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:Zd(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:Zd(W.responsePayload)})]}):h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No payload snapshot available."})]}),U.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:U.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(Oe,{variant:"default",size:"sm",onClick:()=>M(null),children:"Close"})})]})}),h.jsx($r,{open:k,onOpenChange:ae=>{ae||N(!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(Oe,{variant:"default",size:"sm",onClick:()=>N(!1),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",size:"sm",onClick:pe,disabled:z.isPending,children:z.isPending?"Clearing...":"Clear all"})]})]})})]})}const eQ=ao({getParentRoute:()=>lo,path:"/config",component:vX}),tQ=ao({getParentRoute:()=>lo,path:"/fleet",component:AX}),nQ=ao({getParentRoute:()=>lo,path:"/",component:yX});function rQ(){const{seq:e}=xk.useParams();return h.jsx(xx,{initialSelectedEntryId:`#${e}`})}const xk=ao({getParentRoute:()=>lo,path:"/investigate/commit/$seq",component:rQ});function sQ(){const{id:e}=Sk.useParams();return h.jsx(xx,{initialSelectedEntryId:`E${e}`})}const Sk=ao({getParentRoute:()=>lo,path:"/investigate/event/$id",component:sQ}),oQ=ao({getParentRoute:()=>lo,path:"/ops",component:LX}),iQ=ao({getParentRoute:()=>lo,path:"/storage",component:GX}),aQ=ao({getParentRoute:()=>lo,path:"/stream",component:xx}),cQ=lo.addChildren([nQ,aQ,xk,Sk,tQ,oQ,iQ,eQ]),lQ="syncular-console-basepath",uQ="syncular-console-server-url",fQ="syncular-console-token";function dQ(e){if(!e)return;const t=e.trim();return t.length>0?t:void 0}function Hv(e){const t=globalThis.document;if(!t)return;const n=t.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return dQ(n)}function _k(e){return!e||e==="/"?"/":(e.startsWith("/")?e:`/${e}`).replace(/\/+$/g,"")||"/"}function hQ(){return _k(Hv(lQ))}function pQ(){const e=Hv(uQ),t=Hv(fQ);return!e||!t?null:{serverUrl:e,token:t}}function mQ(){return new P6({defaultOptions:{queries:{staleTime:5e3,retry:1}}})}function gQ(e){return _k(e??hQ())}function yQ(e){const[t]=_.useState(()=>mQ()),n=_.useMemo(()=>BH({routeTree:cQ,basepath:gQ(e.basePath)}),[e.basePath]),s=e.defaultConfig===void 0?pQ():e.defaultConfig,i=e.autoConnect??e.defaultConfig===void 0;return h.jsx(D6,{client:t,children:h.jsx(sq,{defaultConfig:s,autoConnect:i,storageMode:e.storageMode,children:h.jsx(qH,{router:n})})})}function vQ(e){return h.jsx("div",{className:bx,children:h.jsx(yQ,{...e})})}function bQ(e){const t=document.querySelector(e);if(!t)throw new Error(`Unable to mount console: ${e} not found`);return t}function xQ(e,t={}){const n=bQ(e);WY(n);const s=f6.createRoot(n),i=h.jsx(vQ,{basePath:t.basePath,defaultConfig:t.defaultConfig,autoConnect:t.autoConnect});return t.strictMode===!1?(s.render(i),s):(s.render(h.jsx(_.StrictMode,{children:i})),s)}var SQ={};const _Q="syncular-sentry-dsn",wQ="syncular-sentry-environment",EQ="syncular-sentry-release";function gu(e){if(!e)return;const t=e.trim();return t.length>0?t:void 0}function Hy(e){if(typeof document>"u")return;const t=document.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return gu(t)}function qy(e){if(!(typeof process>"u"))return gu(SQ[e])}function Vy(e){for(const t of e)if(t)return t}function TQ(){const e=Vy([gu(globalThis.__SYNCULAR_SENTRY_DSN__),Hy(_Q),qy("SYNCULAR_SENTRY_DSN")]);if(!e)return null;const t=Vy([gu(globalThis.__SYNCULAR_SENTRY_ENVIRONMENT__),Hy(wQ),qy("SYNCULAR_SENTRY_ENVIRONMENT")]),n=Vy([gu(globalThis.__SYNCULAR_SENTRY_RELEASE__),Hy(EQ),qy("SYNCULAR_SENTRY_RELEASE")]);return{dsn:e,environment:t,release:n,enableLogs:!0,tracesSampleRate:.2,tracePropagationTargets:[/^https?:\/\/.*\/api\/.*/]}}const eR=TQ();eR&&n6(eR);xQ("#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 Jh(e,t){e&&Object.assign(e.style,t)}const XG={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},QG={position:"fixed"},WG=_.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=n8,...k}=t,{store:N,listRef:R,labelsRef:M,alignItemWithTriggerActiveRef:L,selectedItemTextRef:j,valuesRef:A,initialValueRef:P,popupRef:G,setValue:B}=Ju(),z=KA(),Q=at(N,it.open),Y=at(N,it.mounted),ee=at(N,it.modal),D=at(N,it.value),K=at(N,it.openMethod),q=at(N,it.positionerElement),V=at(N,it.triggerElement),U=at(N,it.isItemEqualToValue),I=at(N,it.transitionStatus),H=_.useRef(null),W=_.useRef(null),[X,oe]=_.useState(T),se=Y&&X&&K!=="touch";!Y&&X!==T&&oe(T),Le(()=>{Y||(it.scrollUpArrowVisible(N.state)&&N.set("scrollUpArrowVisible",!1),it.scrollDownArrowVisible(N.state)&&N.set("scrollDownArrowVisible",!1))},[N,Y]),_.useImperativeHandle(L,()=>se),GA((se||ee)&&Q&&K!=="touch",V);const de=FA({anchor:s,floatingRootContext:z,positionMethod:i,mounted:Y,side:f,sideOffset:p,align:d,alignOffset:g,arrowPadding:x,collisionBoundary:y,collisionPadding:b,sticky:S,disableAnchorTracking:w??se,collisionAvoidance:C,keepMounted:!0}),xe=se?"none":de.side,he=se?QG:de.positionerStyles,Me=_.useMemo(()=>{const Se={};return Q||(Se.pointerEvents="none"),{role:"presentation",hidden:!Y,style:{...he,...Se}}},[Q,Y,he]),_e={open:Q,side:xe,align:de.align,anchorHidden:de.anchorHidden},ne=Ae(Se=>{N.set("positionerElement",Se)}),pe=zt("div",t,{ref:[n,ne],state:_e,stateAttributesMapping:il,props:[Me,kp(I),k]}),ae=_.useRef(0),we=Ae(Se=>{if(Se.size===0&&ae.current===0||A.current.length===0)return;const ye=ae.current;if(ae.current=Se.size,Se.size===ye)return;const Ue=Yt(ii);if(ye!==0&&!N.state.multiple&&D!==null&&Uy(A.current,D,U)===-1){const Ee=P.current,Xe=Ee!=null&&Uy(A.current,Ee,U)!==-1?Ee:null;B(Xe,Ue),Xe===null&&(N.set("selectedIndex",null),j.current=null)}if(ye!==0&&N.state.multiple&&Array.isArray(D)){const Ie=Ve=>Uy(A.current,Ve,U)!==-1,Ee=D.filter(Ve=>Ie(Ve));(Ee.length!==D.length||Ee.some(Ve=>!CG(D,Ve,U)))&&(B(Ee,Ue),Ee.length===0&&(N.set("selectedIndex",null),j.current=null))}if(Q&&se){N.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ie={height:""};Jh(q,Ie),Jh(G.current,Ie)}}),ve=_.useMemo(()=>({...de,side:xe,alignItemWithTriggerActive:se,setControlledAlignItemWithTrigger:oe,scrollUpArrowRef:H,scrollDownArrowRef:W}),[de,xe,se,oe]);return h.jsx(YA,{elementsRef:R,labelsRef:M,onMapChange:we,children:h.jsxs(XA.Provider,{value:ve,children:[Y&&ee&&h.jsx(QA,{inert:px(!Q),cutout:V}),pe]})})});function WA(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 Kd="base-ui-disable-scrollbar",$C={className:Kd,getElement(e){return h.jsx("style",{nonce:e,href:Kd,precedence:"base-ui:low",children:`.${Kd}{scrollbar-width:none}.${Kd}::-webkit-scrollbar{display:none}`})}},JG=_.createContext(void 0);function JA(e){return _.useContext(JG)}const Ec="ArrowUp",Qi="ArrowDown",ku="ArrowLeft",Tc="ArrowRight",ef="Home",tf="End",ek=new Set([ku,Tc]),eZ=new Set([ku,Tc,ef,tf]),tk=new Set([Ec,Qi]),tZ=new Set([Ec,Qi,ef,tf]),nk=new Set([...ek,...tk]),nZ=new Set([...nk,ef,tf]),rk=new Set([Ec,Qi,ku,Tc,ef,tf]),rZ="Shift",sZ="Control",oZ="Alt",iZ="Meta",aZ=new Set([rZ,sZ,oZ,iZ]);function cZ(e){return Zt(e)&&e.tagName==="INPUT"}function BC(e){return!!(cZ(e)&&e.selectionStart!=null||Zt(e)&&e.tagName==="TEXTAREA")}function FC(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=HC(e,t,"left"),p=Gd(e),g=Gd(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=HC(e,t,"top"),p=Gd(e),g=Gd(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 HC(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 Gd(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 $y(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const lZ=_.createContext(void 0),uZ={disableStyleElements:!1};function fZ(){return _.useContext(lZ)??uZ}const qi=1,dZ={...il,...va},hZ=_.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}=Ju(),{side:k,align:N,alignItemWithTriggerActive:R,setControlledAlignItemWithTrigger:M,scrollDownArrowRef:L,scrollUpArrowRef:j}=YG(),A=JA()!=null,P=KA(),{nonce:G,disableStyleElements:B}=fZ(),z=rs(),Q=at(f,it.id),Y=at(f,it.open),ee=at(f,it.mounted),D=at(f,it.popupProps),K=at(f,it.transitionStatus),q=at(f,it.triggerElement),V=at(f,it.positionerElement),U=at(f,it.listElement),I=_.useRef(0),H=_.useRef(!1),W=_.useRef(0),X=_.useRef(!1),oe=_.useRef({}),se=cx(),de=Ae(_e=>{if(!V||!d.current||!X.current)return;if(H.current||!R){w();return}const ne=V.style.top==="0px",pe=V.style.bottom==="0px",ae=V.getBoundingClientRect().height,we=Rt(V),ve=getComputedStyle(V),Se=parseFloat(ve.marginTop),ye=parseFloat(ve.marginBottom),Ue=qC(getComputedStyle(d.current)),Ie=Math.min(we.documentElement.clientHeight-Se-ye,Ue),Ee=_e.scrollTop,Ve=VC(_e);let Xe=0,Be=null,We=!1,He=!1;const me=qe=>{V.style.height=`${qe}px`},Te=(qe,mt)=>{const lt=$y(qe,0,Ie-ae);lt>0&&me(ae+lt),_e.scrollTop=mt,Ie-(ae+lt)<=qi&&(H.current=!0),w()};if(ne){const qe=Ve-Ee,mt=ae+qe,lt=Math.min(mt,Ie);if(Xe=lt,qe<=qi){Te(qe,Ve);return}Ie-lt>qi?He=!0:We=!0}else if(pe){const qe=Ee,mt=ae+qe,lt=Math.min(mt,Ie),wr=mt-Ie;if(Xe=lt,qe<=qi){Te(qe,0);return}Ie-lt>qi?Be=0:(We=!0,Ee<Ve&&(Be=Ee-(qe-wr)))}if(Xe=Math.ceil(Xe),Xe!==0&&me(Xe),He||Be!=null){const qe=VC(_e),mt=He?qe:$y(Be,0,qe);Math.abs(_e.scrollTop-mt)>qi&&(_e.scrollTop=mt)}(We||Xe>=Ie-qi)&&(H.current=!0),w()});_.useImperativeHandle(T,()=>de,[de]),ba({open:Y,ref:d,onComplete(){Y&&p?.(!0)}});const xe={open:Y,transitionStatus:K,side:k,align:N};Le(()=>{!V||!d.current||Object.keys(oe.current).length||(oe.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(()=>{Y||R||(X.current=!1,H.current=!1,I.current=0,W.current=0,Jh(V,oe.current))},[Y,R,V,d]),Le(()=>{const _e=d.current;if(!(!Y||!q||!V||!_e||f.state.transitionStatus==="ending")){if(!R){X.current=!0,se.request(w),_e.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const ne=pZ(_e);_e.style.removeProperty("--transform-origin");try{const pe=getComputedStyle(V),ae=getComputedStyle(_e),we=Rt(q),ve=un(V),Se=q.getBoundingClientRect(),ye=V.getBoundingClientRect(),Ue=Se.left,Ie=Se.height,Ee=U||_e,Ve=Ee.scrollHeight,Xe=parseFloat(ae.borderBottomWidth),Be=parseFloat(pe.marginTop)||10,We=parseFloat(pe.marginBottom)||10,He=parseFloat(pe.minHeight)||100,me=qC(ae),Te=5,qe=5,mt=20,lt=we.documentElement.clientHeight-Be-We,wr=we.documentElement.clientWidth,Er=lt-Se.bottom+Ie,Qt=b.current,ut=y.current;let xt,ot=0,Wt=0;if(Qt&&ut){const tr=ut.getBoundingClientRect();xt=Qt.getBoundingClientRect();const ls=tr.left-Ue,uo=xt.left-ye.left,fo=tr.top-Se.top+tr.height/2,nr=xt.top-ye.top+xt.height/2;ot=ls-uo,Wt=nr-fo}const vn=Er+Wt+We+Xe;let kt=Math.min(lt,vn);const Cn=lt-Be-We,er=vn-kt,An=Math.max(Te,Ue+ot),as=wr-qe,cs=Math.max(0,An+ye.width-as);V.style.left=`${An-cs}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,_i=er>=_a;_i&&(kt=Math.min(lt,ye.height)-(er-_a));const wi=Se.top<mt||Se.bottom>lt-mt||kt<Math.min(Ve,He),ws=(ve.visualViewport?.scale??1)!==1&&sx;if(wi||ws){X.current=!0,Jh(V,oe.current),hi.flushSync(()=>M(!1));return}if(_i){const tr=Math.max(0,lt-vn);V.style.top=ye.height>=Cn?"0":`${tr}px`,V.style.height=`${kt}px`,Ee.scrollTop=Ee.scrollHeight-Ee.clientHeight,I.current=Math.max(He,kt)}else V.style.bottom="0",I.current=Math.max(He,kt),Ee.scrollTop=er;if(xt){const tr=ye.top,ls=ye.height,uo=xt.top+xt.height/2,fo=ls>0?(uo-tr)/ls*100:50,nr=$y(fo,0,100);_e.style.setProperty("--transform-origin",`50% ${nr}%`)}(I.current===lt||kt>=me)&&(H.current=!0),w(),setTimeout(()=>{X.current=!0})}finally{ne()}})}},[f,Y,V,q,y,b,d,w,R,M,se,L,j,U]),_.useEffect(()=>{if(!R||!V||!Y)return;const _e=un(V);function ne(pe){g(!1,Yt(R8,pe))}return _e.addEventListener("resize",ne),()=>{_e.removeEventListener("resize",ne)}},[g,R,V,Y]);const he={...U?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":S||void 0,id:`${Q}-list`},onKeyDown(_e){x.current=!0,A&&rk.has(_e.key)&&_e.stopPropagation()},onMouseMove(){x.current=!1},onPointerLeave(_e){if(!C||WA(_e)||_e.pointerType==="touch")return;const ne=_e.currentTarget;z.start(0,()=>{f.set("activeIndex",null),ne.focus({preventScroll:!0})})},onScroll(_e){U||de(_e.currentTarget)},...R&&{style:U?{height:"100%"}:XG}},Me=zt("div",t,{ref:[n,d],state:xe,stateAttributesMapping:dZ,props:[D,he,kp(K),{className:!U&&R?$C.className:void 0},l]});return h.jsxs(_.Fragment,{children:[!B&&$C.getElement(G),h.jsx(NA,{context:P,modal:!1,disabled:!ee,returnFocus:a,restoreFocus:!0,children:Me})]})});function qC(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function VC(e){return Math.max(0,e.scrollHeight-e.clientHeight)}const KC=[["transform","none"],["scale","1"],["translate","0 0"]];function pZ(e){const{style:t}=e,n={};for(const[s,i]of KC)n[s]=t.getPropertyValue(s),t.setProperty(s,i,"important");return()=>{for(const[s]of KC){const i=n[s];i?t.setProperty(s,i):t.removeProperty(s)}}}let sk=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function mx(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}=VG(),b=_.useRef(-1),[x,S]=_.useState(a??(i===sk.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 k=t!==void 0;g.current[x]=k?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 k=w.current?C.get(w.current)?.index:null;k!=null&&S(k)})},[a,d,S]),_.useMemo(()=>({ref:T,index:x}),[x,T])}const mZ=_.createContext(void 0),gZ=_.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=mx({label:l,textRef:g,indexGuessBehavior:sk.GuessFromOrder}),{store:b,getItemProps:x,setOpen:S,setValue:w,selectionRef:T,typingRef:C,valuesRef:k,keyboardActiveRef:N,multiple:R,highlightItemOnHover:M}=Ju(),L=rs(),j=at(b,it.isActive,y.index),A=at(b,it.isSelected,y.index,a),P=at(b,it.isSelectedByFocus,y.index),G=at(b,it.isItemEqualToValue),B=y.index,z=B!==-1,Q=_.useRef(null),Y=Jo(B);Le(()=>{if(!z)return;const se=k.current;return se[B]=a,()=>{delete se[B]}},[z,B,a,k]),Le(()=>{if(!z)return;const se=b.state.value;let de=se;R&&Array.isArray(se)&&se.length>0&&(de=se[se.length-1]),de!==void 0&&Bc(a,de,G)&&b.set("selectedIndex",B)},[z,B,R,G,b,a]);const ee={disabled:f,selected:A,highlighted:j},D=x({active:j,selected:A});D.onFocus=void 0,D.id=void 0;const K=_.useRef(null),q=_.useRef("mouse"),V=_.useRef(!1),{getButtonProps:U,buttonRef:I}=el({disabled:f,focusableWhenDisabled:!0,native:d});function H(se){const de=b.state.value;if(R){const xe=Array.isArray(de)?de:[],he=A?RG(xe,a,G):[...xe,a];w(he,Yt(Ny,se))}else w(a,Yt(Ny,se)),S(!1,Yt(Ny,se))}const W={role:"option","aria-selected":A,tabIndex:j?0:-1,onFocus(){b.set("activeIndex",B)},onMouseEnter(){!N.current&&b.state.selectedIndex===null&&M&&b.set("activeIndex",B)},onMouseMove(){M&&b.set("activeIndex",B)},onMouseLeave(se){!M||N.current||WA(se)||L.start(0,()=>{b.state.activeIndex===B&&b.set("activeIndex",null)})},onTouchStart(){T.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(se){K.current=se.key,b.set("activeIndex",B)},onClick(se){V.current=!1,!(se.type==="keydown"&&K.current===null)&&(f||K.current===" "&&C.current||q.current!=="touch"&&!j||(K.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 de=!T.current.allowSelectedMouseUp&&A,xe=!T.current.allowUnselectedMouseUp&&!A;de||xe||q.current!=="touch"&&!j||H(se.nativeEvent)}},X=zt("div",t,{ref:[I,n,y.ref,Q],state:ee,props:[D,W,p,U]}),oe=_.useMemo(()=>({selected:A,indexRef:Y,textRef:g,selectedByFocus:P,hasRegistered:z}),[A,Y,g,P,z]);return h.jsx(mZ.Provider,{value:oe,children:X})})),yZ=_.forwardRef(({className:e,children:t,...n},s)=>h.jsx(DG,{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}));yZ.displayName="SelectTrigger";const vZ=_.forwardRef(({className:e,portalProps:t,positionerProps:n,...s},i)=>h.jsx(LG,{...t,children:h.jsx(WG,{...n,children:h.jsx(hZ,{ref:i,className:ge("bg-panel border border-border rounded-md py-1 shadow-lg z-50",e),...s})})}));vZ.displayName="SelectContent";const bZ=_.forwardRef(({className:e,...t},n)=>h.jsx(gZ,{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}));bZ.displayName="SelectItem";const xZ=_.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}));xZ.displayName="Textarea";const ok=_.createContext(void 0);function SZ(e=!0){const t=_.useContext(ok);if(t===void 0&&!e)throw new Error(yn(7));return t}function ik(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:s}=Ij(),{ref:i,index:a}=mx(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 _Z(e){const{render:t,className:n,state:s=an,props:i=Nu,refs:a=Nu,metadata:l,stateAttributesMapping:f,tag:d="div",...p}=e,{compositeProps:g,compositeRef:y}=ik({metadata:l});return zt(d,e,{state:s,ref:[...a,y],props:[g,...i,p],stateAttributesMapping:f})}const wZ=_.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=SZ(),T=w?.value??[],C=w?void 0:i,k=(a||w?.disabled)??!1,[N,R]=yp({controlled:w?S!==void 0&&T.indexOf(S)>-1:d,default:C,name:"Toggle",state:"pressed"}),M=Ae((z,Q)=>{S&&w?.setGroupValue?.(S,z,Q),f?.(z,Q)}),{getButtonProps:L,buttonRef:j}=el({disabled:k,native:b}),A={disabled:k,pressed:N},P=[j,n],G=[{"aria-pressed":N,onClick(z){const Q=!N,Y=Yt(ii,z.nativeEvent);M(Q,Y),!Y.isCanceled&&R(Q)}},x,L],B=zt("button",t,{enabled:!w,state:A,ref:P,props:G});return w?h.jsx(_Z,{tag:"button",render:p,className:s,state:A,refs:P,props:G}):B}),Dr=_.forwardRef(({className:e,...t},n)=>h.jsx(wZ,{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 EZ(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const ak="data-composite-item-active",TZ=[];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=TZ}=e,[S,w]=_.useState(0),T=n>1,C=_.useRef(null),k=so(C,p),N=_.useRef([]),R=_.useRef(!1),M=f??S,L=Ae((P,G=!1)=>{if((d??w)(P),G){const B=N.current[P];FC(C.current,B,l,a)}}),j=Ae(P=>{if(P.size===0||R.current)return;R.current=!0;const G=Array.from(P.keys()),B=G.find(Q=>Q?.hasAttribute(ak))??null,z=B?G.indexOf(B):-1;z!==-1&&L(z),FC(C.current,B,l,a)}),A=_.useMemo(()=>({"aria-orientation":a==="both"?void 0:a,ref:k,onFocus(P){!C.current||!BC(P.target)||P.target.setSelectionRange(0,P.target.value.length??0)},onKeyDown(P){const G=g?nZ:nk;if(!G.has(P.key)||RZ(P,x)||!C.current)return;const z=l==="rtl",Q=z?ku:Tc,Y={horizontal:Q,vertical:Qi,both:Q}[a],ee=z?Tc:ku,D={horizontal:ee,vertical:Ec,both:ee}[a];if(BC(P.target)&&!EZ(P.target)){const W=P.target.selectionStart,X=P.target.selectionEnd,oe=P.target.value??"";if(W==null||P.shiftKey||W!==X||P.key!==D&&W<oe.length||P.key!==Y&&W>0)return}let K=M;const q=BV(N,b),V=FV(N,b);if(T){const W=t||Array.from({length:N.current.length},()=>({width:1,height:1})),X=qV(W,n,i),oe=X.findIndex(de=>de!=null&&!pu(N,de,b)),se=X.reduce((de,xe,he)=>xe!=null&&!pu(N,xe,b)?he:de,-1);K=X[HV({current:X.map(de=>de?N.current[de]:null)},{event:P,orientation:a,loopFocus:s,cols:n,disabledIndices:KV([...b||N.current.map((de,xe)=>pu(N,xe)?xe:void 0),void 0],X),minIndex:oe,maxIndex:se,prevIndex:VV(M>V?q:M,W,X,n,P.key===Qi?"bl":P.key===Tc?"tr":"tl"),rtl:z})]}const U={horizontal:[Q],vertical:[Qi],both:[Q,Qi]}[a],I={horizontal:[ee],vertical:[Ec],both:[ee,Ec]}[a],H=T?G:{horizontal:g?eZ:ek,vertical:g?tZ:tk,both:G}[a];g&&(P.key===ef?K=q:P.key===tf&&(K=V)),K===M&&(U.includes(P.key)||I.includes(P.key))&&(s&&K===V&&U.includes(P.key)?K=q:s&&K===q&&I.includes(P.key)?K=V:K=fr(N,{startingIndex:K,decrement:I.includes(P.key),disabledIndices:b})),K!==M&&!lh(N,K)&&(y&&P.stopPropagation(),H.has(P.key)&&P.preventDefault(),L(K,!0),queueMicrotask(()=>{N.current[K]?.focus()}))}}),[n,i,l,b,N,g,M,T,t,s,k,x,L,a,y]);return _.useMemo(()=>({props:A,highlightedIndex:M,onHighlightedIndexChange:L,elementsRef:N,disabledIndices:b,onMapChange:j,relayKeyboardEvent:A.onKeyDown}),[A,M,L,N,b,j])}function RZ(e,t){for(const n of aZ.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function ck(e){const{render:t,className:n,refs:s=Nu,props:i=Nu,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:k,modifierKeys:N,highlightItemOnHover:R=!1,tag:M="div",...L}=e,j=$A(),{props:A,highlightedIndex:P,onHighlightedIndexChange:G,elementsRef:B,onMapChange:z,relayKeyboardEvent:Q}=CZ({itemSizes:y,cols:x,loopFocus:b,dense:g,orientation:p,highlightedIndex:f,onHighlightedIndexChange:d,rootRef:C,stopEventPropagation:T,enableHomeAndEndKeys:S,direction:j,disabledIndices:k,modifierKeys:N}),Y=zt(M,e,{state:a,ref:s,props:[A,...i,L],stateAttributesMapping:l}),ee=_.useMemo(()=>({highlightedIndex:P,onHighlightedIndexChange:G,highlightItemOnHover:R,relayKeyboardEvent:Q}),[P,G,R,Q]);return h.jsx(Mj.Provider,{value:ee,children:h.jsx(YA,{elementsRef:B,onMapChange:D=>{w?.(D),z(D)},children:Y})})}let NZ=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const GC={multiple(e){return e?{[NZ.multiple]:""}:null}},jZ=_.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=JA(),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,k]=yp({controlled:p,default:S,name:"ToggleGroup",state:"value"}),N=Ae((A,P,G)=>{let B;if(d?(B=C.slice(),P?B.push(A):B.splice(C.indexOf(A),1)):B=P?[A]:[],Array.isArray(B)){if(l?.(B,G),G.isCanceled)return;k(B)}}),R={disabled:T,multiple:d,orientation:f},M=_.useMemo(()=>({disabled:T,orientation:f,setGroupValue:N,value:C,isValueInitialized:w}),[T,f,N,C,w]),L={role:"group"},j=zt("div",t,{enabled:!!x,state:R,ref:n,props:[L,b],stateAttributesMapping:GC});return h.jsx(ok.Provider,{value:M,children:x?j:h.jsx(ck,{render:y,className:g,state:R,refs:[n],props:[L,b],stateAttributesMapping:GC,loopFocus:a,enableHomeAndEndKeys:!0})})}),hh=_.forwardRef(({className:e,...t},n)=>h.jsx(jZ,{ref:n,className:ge("flex items-center gap-0.5",e),...t}));hh.displayName="ToggleGroup";const AZ=ge(Gj({variant:"secondary",size:"sm"}),"h-7 whitespace-nowrap uppercase tracking-[0.08em] leading-none no-underline");function lk({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 kZ({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(lk,{active:l,onClick:f,children:a.label},a.id)})})}const OZ=mi("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}}),MZ={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 IZ({color:e,size:t,glow:n,pulse:s,className:i}){return h.jsx("span",{className:ge(OZ({color:e,size:t,glow:n}),s&&"dot-pulse",i),style:n?{boxShadow:MZ[e??"healthy"]}:void 0})}const PZ="0.0.6-122",DZ={version:PZ},zZ=DZ.version;function LZ({label:e,className:t}){return h.jsxs("div",{className:ge("flex items-center gap-3",t),children:[h.jsx(IZ,{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",zZ]})]})}function UZ({brand:e,center:t,right:n,className:s}){return h.jsxs(h.Fragment,{children:[h.jsx("div",{"aria-hidden":"true",className:"h-[42px] shrink-0"}),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 $Z=mi("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($Z({variant:t,className:e})),...n}));In.displayName="Alert";const nf=_.forwardRef(({className:e,...t},n)=>h.jsx("h5",{ref:n,className:ge("font-medium text-white mb-1",e),...t}));nf.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 uk=_.createContext(void 0);function al(e){const t=_.useContext(uk);if(e===!1&&t===void 0)throw new Error(yn(27));return t}const BZ={...il,...va},gx=_.forwardRef(function(t,n){const{render:s,className:i,forceRender:a=!1,...l}=t,{store:f}=al(),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:BZ,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:a||!p})}),fk=_.forwardRef(function(t,n){const{render:s,className:i,id:a,...l}=t,{store:f}=al(),d=br(a);return f.useSyncedValueWithCleanup("descriptionElementId",d),zt("p",t,{ref:n,props:[{id:d},l]})});let FZ=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),HZ=(function(e){return e[e.open=Xi.open]="open",e[e.closed=Xi.closed]="closed",e[e.startingStyle=Xi.startingStyle]="startingStyle",e[e.endingStyle=Xi.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const dk=_.createContext(void 0);function qZ(){const e=_.useContext(dk);if(e===void 0)throw new Error(yn(26));return e}const VZ={...il,...va,nestedDialogOpen(e){return e?{[HZ.nestedDialogOpen]:""}:null}},hk=_.forwardRef(function(t,n){const{className:s,finalFocus:i,initialFocus:a,render:l,...f}=t,{store:d}=al(),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"),k=d.useState("openMethod"),N=d.useState("titleElementId"),R=d.useState("transitionStatus"),M=d.useState("role");qZ(),ba({open:C,ref:d.context.popupRef,onComplete(){C&&d.context.onOpenChangeComplete?.(!0)}});function L(B){return B==="touch"?d.context.popupRef.current:!0}const j=a===void 0?L:a,A=T>0,G=zt("div",t,{state:{open:C,nested:w,transitionStatus:R,nestedDialogOpen:A},props:[b,{"aria-labelledby":N??void 0,"aria-describedby":p??void 0,role:M,tabIndex:-1,hidden:!S,onKeyDown(B){rk.has(B.key)&&B.stopPropagation()},style:{[FZ.nestedDialogs]:T}},f],ref:[n,d.context.popupRef,d.useStateSetter("popupElement")],stateAttributesMapping:VZ});return h.jsx(NA,{context:y,openInteractionType:k,disabled:!S,closeOnFocusOut:!g,initialFocus:j,returnFocus:i,modal:x!==!1,restoreFocus:"popup",children:G})}),pk=_.forwardRef(function(t,n){const{keepMounted:s=!1,...i}=t,{store:a}=al(),l=a.useState("mounted"),f=a.useState("modal"),d=a.useState("open");return l||s?h.jsx(dk.Provider,{value:s,children:h.jsxs(RA,{ref:n,...i,children:[l&&f===!0&&h.jsx(QA,{ref:a.context.internalBackdropRef,inert:px(!d)}),t.children]})}):null});function KZ(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}=OG(i);_7(t);const{forceUnmount:y}=w7(i,t,()=>{g()}),b=Ae(G=>{const B=Yt(G);return B.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},B}),x=_.useCallback(()=>{t.setOpen(!1,b(C8))},[t,b]);_.useImperativeHandle(s,()=>({unmount:y,close:x}),[y,x]);const S=j7({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,T]=_.useState(0),C=w===0,k=L7(S),N=u7(S,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(G){if(!t.context.outsidePressEnabledRef.current||"button"in G&&G.button!==0||"touches"in G&&G.touches.length!==1)return!1;const B=Ur(G);if(C&&!a){const z=B;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===z||t.context.backdropRef.current===z||Ot(z,f)&&!z?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});GA(i&&l===!0,f);const{getReferenceProps:R,getFloatingProps:M,getTriggerProps:L}=D7([k,N]);t.useContextCallback("onNestedDialogOpen",G=>{T(G+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 j=_.useMemo(()=>R(p),[R,p]),A=_.useMemo(()=>L(p),[L,p]),P=_.useMemo(()=>M(),[M]);t.useSyncedValues({openMethod:d,activeTriggerProps:j,inactiveTriggerProps:A,popupProps:P,floatingRootContext:S,nestedOpenDialogCount:w})}const GZ={...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 ZZ extends zA{constructor(t){super(YZ(t),{popupRef:_.createRef(),backdropRef:_.createRef(),internalBackdropRef:_.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new dx,onOpenChange:void 0,onOpenChangeComplete:void 0},GZ)}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 YZ(e={}){return{...T7(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function XZ(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=al(!0),x=!!b,S=zn(()=>p?.store??new ZZ({open:s,openProp:n,activeTriggerId:y,triggerIdProp:g,modal:f,disablePointerDismissal:l,nested:x})).current;dV(()=>{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");KZ({store:S,actionsRef:d,parentContext:b?.store.context});const T=_.useMemo(()=>({store:S}),[S]);return h.jsx(uk.Provider,{value:T,children:typeof t=="function"?t({payload:w}):t})}const mk=_.forwardRef(function(t,n){const{render:s,className:i,id:a,...l}=t,{store:f}=al(),d=br(a);return f.useSyncedValueWithCleanup("titleElementId",d),zt("h2",t,{ref:n,props:[{id:d},l]})}),$r=XZ,QZ=_.forwardRef(({className:e,...t},n)=>h.jsx(gx,{ref:n,className:ge("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",e),...t}));QZ.displayName="DialogOverlay";const hr=_.forwardRef(({className:e,children:t,...n},s)=>h.jsxs(pk,{children:[h.jsx(gx,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),h.jsx(hk,{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(mk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 uppercase tracking-widest",e),...t}));mr.displayName="DialogTitle";const WZ=_.forwardRef(({className:e,...t},n)=>h.jsx(fk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500",e),...t}));WZ.displayName="DialogDescription";const yx=_.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(Oe,{size:"sm",variant:"default",disabled:t<=1,onClick:()=>i(t-1),children:"Prev"}),h.jsx(Oe,{size:"sm",variant:"default",disabled:t>=n,onClick:()=>i(t+1),children:"Next"})]})]}));yx.displayName="Pagination";const JZ=_.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}));JZ.displayName="Separator";const eY=mi("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"}}),tY=_.forwardRef(({className:e,side:t,children:n,...s},i)=>h.jsxs(pk,{children:[h.jsx(gx,{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm"}),h.jsx(hk,{ref:i,className:ge(eY({side:t,className:e})),...s,children:n})]}));tY.displayName="SheetContent";const nY=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("px-5 py-3 border-b border-border",e),...t}));nY.displayName="SheetHeader";const rY=_.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}));rY.displayName="SheetFooter";const sY=_.forwardRef(({className:e,...t},n)=>h.jsx(mk,{ref:n,className:ge("font-mono text-[10px] text-neutral-500 uppercase tracking-widest",e),...t}));sY.displayName="SheetTitle";const oY=_.forwardRef(({className:e,...t},n)=>h.jsx(fk,{ref:n,className:ge("text-sm text-neutral-400",e),...t}));oY.displayName="SheetDescription";const iY=_.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:ge("rounded-md bg-neutral-800 animate-pulse",e),...t}));iY.displayName="Skeleton";const aY=_.createContext(void 0);function vx(){const e=_.useContext(aY);if(e===void 0)throw new Error(yn(64));return e}let cY=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const gk={tabActivationDirection:e=>({[cY.activationDirection]:e})},yk=_.createContext(void 0);function lY(){const e=_.useContext(yk);if(e===void 0)throw new Error(yn(65));return e}const uY=_.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}=vx(),{activateOnFocus:x,highlightedTabIndex:S,onTabActivation:w,setHighlightedTabIndex:T,tabsListElement:C}=lY(),k=br(f),N=_.useMemo(()=>({disabled:i,id:k,value:l}),[i,k,l]),{compositeProps:R,compositeRef:M,index:L}=ik({metadata:N}),j=l===g,A=_.useRef(!1);Le(()=>{if(A.current){A.current=!1;return}if(!(j&&L>-1&&S!==L))return;const V=C;if(V!=null){const U=Bo(Rt(V));if(U&&Ot(V,U))return}i||T(L)},[j,L,S,T,i,C]);const{getButtonProps:P,buttonRef:G}=el({disabled:i,native:d,focusableWhenDisabled:!0}),B=y(l),z=_.useRef(!1),Q=_.useRef(!1);function Y(V){j||i||w(l,Yt(ii,V.nativeEvent,void 0,{activationDirection:"none"}))}function ee(V){j||(L>-1&&!i&&T(L),!i&&x&&(!z.current||z.current&&Q.current)&&w(l,Yt(ii,V.nativeEvent,void 0,{activationDirection:"none"})))}function D(V){if(j||i)return;z.current=!0;function U(){z.current=!1,Q.current=!1}(!V.button||V.button===0)&&(Q.current=!0,Rt(V.currentTarget).addEventListener("pointerup",U,{once:!0}))}return zt("button",t,{state:{disabled:i,active:j,orientation:b},ref:[n,G,M],props:[R,{role:"tab","aria-controls":B,"aria-selected":j,id:k,onClick:Y,onFocus:ee,onPointerDown:D,[ak]:j?"":void 0,onKeyDownCapture(){A.current=!0}},p,P]})});let fY=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const dY={...gk,...va},hY=_.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}=vx(),S=br(),w=_.useMemo(()=>({id:S,value:i}),[S,i]),{ref:T,index:C}=mx({metadata:w}),k=i===d,{mounted:N,transitionStatus:R,setMounted:M}=Ap(k),L=!N,j=p(i),A={hidden:L,orientation:g,tabActivationDirection:y,transitionStatus:R},P=_.useRef(null),G=zt("div",t,{state:A,ref:[n,T,P],props:[{"aria-labelledby":j,hidden:L,id:S,role:"tabpanel",tabIndex:k?0:-1,inert:px(!k),[fY.index]:C},f],stateAttributesMapping:dY});return ba({open:k,ref:P,onComplete(){k||M(!1)}}),Le(()=>{if(!(L&&!l)&&S!=null)return b(i,S),()=>{x(i,S)}},[L,l,i,S,b,x]),l||N?G:null}),pY=_.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}=vx(),[S,w]=_.useState(0),[T,C]=_.useState(null),k=mY(y,g,T,d),N=Ae((j,A)=>{if(j!==y){const P=k(j);A.activationDirection=P,p(j,A)}}),R={orientation:g,tabActivationDirection:x},M={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},L=_.useMemo(()=>({activateOnFocus:s,highlightedTabIndex:S,onTabActivation:N,setHighlightedTabIndex:w,tabsListElement:T,value:y}),[s,S,N,w,T,y]);return h.jsx(yk.Provider,{value:L,children:h.jsx(ck,{render:l,className:i,state:R,refs:[n,C],props:[M,f],stateAttributesMapping:gk,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:a,orientation:g,onHighlightedIndexChange:w,onMapChange:b,disabledIndices:Nu})})});function ZC(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 mY(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}=ZC(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}=ZC(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 gY=_.forwardRef(({className:e,...t},n)=>h.jsx(pY,{ref:n,className:ge("flex items-center gap-0.5",e),...t}));gY.displayName="TabsList";const yY=mi("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"}}),vY=_.forwardRef(({className:e,variant:t,...n},s)=>h.jsx(uY,{ref:s,className:ge(yY({variant:t,className:e})),...n}));vY.displayName="TabsTrigger";const bY=_.forwardRef(({className:e,...t},n)=>h.jsx(hY,{ref:n,className:ge("outline-none",e),...t}));bY.displayName="TabsContent";const xY=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("font-mono text-[11px] text-neutral-300",e),...t}));xY.displayName="Text";const SY=_.forwardRef(({className:e,...t},n)=>h.jsx("p",{ref:n,className:ge("font-mono text-[10px] text-neutral-500",e),...t}));SY.displayName="TextMuted";const _Y=_.forwardRef(({className:e,...t},n)=>h.jsx("code",{ref:n,className:ge("font-mono text-[11px] text-white",e),...t}));_Y.displayName="TextCode";const wY=_.forwardRef(({className:e,...t},n)=>h.jsx("span",{ref:n,className:ge("font-mono text-[9px] uppercase tracking-wider text-neutral-500",e),...t}));wY.displayName="TextLabel";const EY=_.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}));EY.displayName="CodeBlock";function xa(e,t){const[n,s]=_.useState(()=>{if(typeof window>"u")return t;try{const a=window.localStorage.getItem(e);return a===null?t:JSON.parse(a)}catch{return t}});_.useEffect(()=>{try{n==null?window.localStorage.removeItem(e):window.localStorage.setItem(e,JSON.stringify(n))}catch{}},[e,n]);const i=_.useCallback(a=>{s(l=>typeof a=="function"?a(l):a)},[]);return[n,i]}const TY="console:instance-id";function Lt(){const[e,t]=xa(TY,""),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 Si(e,t){return e===0?!1:e??t}function rf(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 sf(e={}){const t=Vt(),{instanceId:n}=Lt(),s=e.instanceId??n,i=rf(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 Xu(t.GET("/console/stats",{params:{query:i}}))},enabled:!!t,refetchInterval:Si(e.refetchIntervalMs,5e3)})}function CY(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:Si(t.refetchIntervalMs,3e4)})}function RY(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:Si(t.refetchIntervalMs,3e4)})}function NY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=rf({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 Xu(n.GET("/console/commits",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:Si(t.refetchIntervalMs,1e4)})}function jY(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 AY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=rf({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 Xu(n.GET("/console/timeline",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:Si(t.refetchIntervalMs,1e4)})}function vk(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=rf({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 Xu(n.GET("/console/clients",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:Si(t.refetchIntervalMs,1e4)})}function kY(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 OY(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 MY(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 IY(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 PY(e={},t={}){const n=Vt(),{instanceId:s}=Lt(),i=e.instanceId??s,a=rf({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 Xu(n.GET("/console/operations",{params:{query:a}}))},enabled:(t.enabled??!0)&&!!n,refetchInterval:Si(t.refetchIntervalMs,1e4)})}function DY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 zY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 LY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 UY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 $Y(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 BY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 FY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 HY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 qY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 VY(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 KY(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:Si(e.refetchIntervalMs,3e4)})}function GY(){const{config:e}=Dt(),t=_r();return is({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 YY="console:partition-id";function of(){const[e,t]=xa(YY,""),n=e.trim();return _.useMemo(()=>({partitionId:n.length>0?n:void 0,rawPartitionId:e,setPartitionId:t,clearPartitionId:()=>t("")}),[n,e,t])}const YC={refreshInterval:5,timeFormat:"relative",showSparklines:!0,pageSize:20};function af(){const[e,t]=xa("console:preferences",YC);return{preferences:e,setPreferences:t,updatePreference:(i,a)=>{t(l=>({...l,[i]:a}))},resetPreferences:()=>{t(YC)}}}const XY=[{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"}],QY=[{value:10,label:"10"},{value:20,label:"20"},{value:50,label:"50"},{value:100,label:"100"}],bx="syncular-console-root";function WY(e){e.classList.add(bx)}const JY=[{suffix:"",label:"Command"},{suffix:"/stream",label:"Stream"},{suffix:"/fleet",label:"Fleet"},{suffix:"/ops",label:"Ops"},{suffix:"/storage",label:"Storage"},{suffix:"/config",label:"Config"}];function eX(e){const t=e?.trim()??"";return!t||t==="/"?"":(t.startsWith("/")?t:`/${t}`).replace(/\/+$/g,"")}function By(e,t){return e?t?`${e}${t}`:e:t||"/"}function tX({basePath:e,appHref:t,modeBadge:n}){const{connect:s,config:i,isConnected:a,isConnecting:l}=Dt(),{preferences:f}=af(),{instanceId:d,rawInstanceId:p,setInstanceId:g,clearInstanceId:y}=Lt(),{partitionId:b,rawPartitionId:x,setPartitionId:S,clearPartitionId:w}=of(),T=vr({select:P=>P.location.pathname}),{data:C}=sf({refetchIntervalMs:f.refreshInterval*1e3,partitionId:b,instanceId:d}),k=eX(e),N=_.useMemo(()=>JY.map(P=>({...P,id:By(k,P.suffix)})),[k]),R=By(k,""),M=By(k,"/config"),L=l?"connecting":a?"connected":i?"disconnected":"not-configured",j=N.find(P=>P.suffix===""?T===R||T===`${R}/`:T.startsWith(P.id))?.id??R,A=C?[{label:"HEAD",value:`#${C.maxCommitSeq}`},{label:"COMMITS",value:`${C.commitCount}`},{label:"CHANGES",value:`${C.changeCount}`},{label:"CLIENTS",value:`${C.activeClientCount}/${C.clientCount}`}]:[];return h.jsxs("div",{className:`${bx} h-screen bg-background text-foreground flex flex-col`,children:[h.jsx(UZ,{brand:h.jsx(xc,{to:R,children:h.jsx(LZ,{label:"console"})}),center:h.jsx(kZ,{items:N,activeId:j,renderItem:(P,{active:G})=>h.jsx(xc,{to:P.id,children:h.jsx(lk,{active:G,children:P.label})},P.id)}),right:h.jsxs("div",{className:"flex items-center gap-2",children:[n?h.jsx(mn,{variant:"flow",className:"hidden md:inline-flex px-2 py-1 text-[10px]",children:n}):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:"Instance"}),h.jsx(Gn,{variant:"mono",value:p,onChange:P=>g(P.target.value),onBlur:P=>g(P.target.value.trim()),placeholder:"all",className:"h-7 w-[110px] px-2 py-1"}),d?h.jsx(Oe,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:y,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:x,onChange:P=>S(P.target.value),onBlur:P=>S(P.target.value.trim()),placeholder:"all",className:"h-7 w-[110px] px-2 py-1"}),b?h.jsx(Oe,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:w,children:"All"}):null]}),h.jsx(I8,{state:L}),h.jsx(xc,{to:M,children:h.jsx(Oe,{variant:T===M?"secondary":"ghost",size:"icon",children:h.jsx(Q8,{className:"h-3 w-3"})})}),t?h.jsxs("a",{href:t,className:AZ,children:[h.jsx(Y8,{className:"h-3 w-3"}),"Go to app"]}):null]})}),h.jsx("main",{className:"flex-1 overflow-auto pb-[32px]",children:h.jsx("div",{className:"min-h-full",children:a||T===M?h.jsx("div",{style:{animation:"pageIn 0.3s ease-out"},children:h.jsx(JN,{})},T):h.jsx(nX,{configPath:M,hasSavedConfig:!!i,isConnecting:l,onConnect:()=>{s()}})})}),a&&h.jsx(Vj,{isLive:a,metrics:A,uptime:"--"})]})}function nX({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(Oe,{variant:"default",onClick:s,disabled:n,children:n?"Connecting...":"Connect"}),h.jsx(xc,{to:e,children:h.jsx(Oe,{variant:"link",children:"Configure connection"})})]})]})}const lo=MH({component:tX});function rX(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("swServer")==="1"}function sX(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,k]=_.useState(null),N=_.useRef(null),R=_.useRef(null),M=_.useRef(null),L=_.useRef(0),j=_.useRef(0),A=_.useRef(null),P=_.useRef(null),G=_.useCallback(()=>{b([]),A.current=null,P.current=null},[]);return _.useEffect(()=>{if(!n||!d||!f?.serverUrl||!f?.token)return;let B=!1;const z=Number.isFinite(i)?Math.max(1,Math.min(500,Math.floor(i))):100;if(rX()||typeof WebSocket>"u"){T("connecting"),S(!1);let V=null,U=!1;const I=async()=>{if(!(B||U)){U=!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(z)),H.searchParams.set("offset","0"),a&&H.searchParams.set("partitionId",a);const X=await fetch(H.toString(),{headers:{Authorization:`Bearer ${f.token}`}});if(!X.ok)throw new Error(`Live event polling failed (${X.status})`);const oe=await X.json(),de=(Array.isArray(oe.items)?oe.items:[]).filter(Me=>g?Me.instanceId===g:!0).sort((Me,_e)=>Me.eventId-_e.eventId),xe=P.current??-1,he=de.filter(Me=>Me.eventId>xe);if(he.length>0){const Me=he.map(ne=>({type:ne.eventType,timestamp:ne.createdAt,data:ne})).reverse();b(ne=>[...Me,...ne].slice(0,t));const _e=he[he.length-1];P.current=_e.eventId,A.current=_e.createdAt}else if(de.length>0){const Me=de[de.length-1];P.current=Math.max(P.current??-1,Me.eventId),A.current=Me.createdAt}k(null),S(!0),T("connected")}catch(H){B||(S(!1),T("disconnected"),k(H instanceof Error?H:new Error("Live event polling failed")))}finally{U=!1}}};return I(),V=setInterval(()=>{I()},2e3),()=>{B=!0,V&&clearInterval(V),S(!1),T("disconnected")}}const Y=()=>{R.current&&(clearTimeout(R.current),R.current=null)},ee=()=>{M.current&&(clearInterval(M.current),M.current=null)},D=()=>{if(B||R.current)return;L.current+=1;const V=Math.min(3e4,1e3*2**Math.max(0,L.current-1)),U=Math.floor(V*.2*Math.random()),I=V+U;R.current=setTimeout(()=>{R.current=null,B||q()},I)},K=()=>{j.current=Date.now(),S(!0),T("connected")},q=()=>{if(B)return;T("connecting"),Y();const V=(()=>{const I=new URL(f.serverUrl,window.location.origin);I.protocol=I.protocol==="https:"?"wss:":"ws:";const H=I.pathname.endsWith("/")?I.pathname.slice(0,-1):I.pathname;return I.pathname=`${H}/console/events/live`,I.search="",A.current&&I.searchParams.set("since",A.current),I.searchParams.set("replayLimit",String(z)),a&&I.searchParams.set("partitionId",a),g&&I.searchParams.set("instanceId",g),I.toString()})(),U=new WebSocket(V);N.current=U,U.onopen=()=>{if(B){U.close();return}L.current=0,k(null),T("connecting"),S(!1);try{U.send(JSON.stringify({type:"auth",token:f.token}))}catch{U.close();return}ee(),M.current=setInterval(()=>{const I=N.current;if(!I||I.readyState!==WebSocket.OPEN)return;const H=j.current;!H||Date.now()-H<=s||(S(!1),T("stale"),I.close())},1e3)},U.onclose=()=>{B||(S(!1),T("disconnected"),ee(),D())},U.onerror=()=>{B||k(new Error("WebSocket connection failed"))},U.onmessage=I=>{try{const H=JSON.parse(I.data),W=H.type;if(K(),W==="connected"||W==="heartbeat"||W==="auth_required")return;if(W==="error"){const de=typeof H.message=="string"?H.message:"Live events authentication failed";k(new Error(de));return}const X={type:W,timestamp:H.timestamp||new Date().toISOString(),data:H};if(a&&X.data.partitionId!==a||g&&X.data.instanceId!==g)return;const oe=Date.parse(A.current??""),se=Date.parse(X.timestamp);Number.isFinite(se)&&(!Number.isFinite(oe)||se>oe)&&(A.current=X.timestamp),b(de=>[X,...de].slice(0,t))}catch{}}};return q(),()=>{B=!0,Y(),ee(),N.current&&(N.current.close(),N.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:G}}function oX(){const e=Vt(),{config:t}=Dt(),{instanceId:n}=Lt(),s=_r();return is({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 iX=_.createContext(null);function bk(){const[e,t]=xa("console:time-range","24h");return{range:e,setRange:t}}const aX=[{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 cX(e){const t=e.toLowerCase();for(const n of aX)if(t.includes(n.hint))return n.type;return"client"}function lX(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 uX(e,t){return typeof e.lagCommitCount=="number"?Math.max(0,e.lagCommitCount):t?Math.max(0,t.maxCommitSeq-e.cursor):0}function fX(e,t){return e.activityState==="stale"?"offline":t>0?"syncing":"online"}function dX(e,t){return e.length<=16?e:`${e.slice(0,12)}-${t+1}`}function hX(e,t,n={}){const s=n.maxNodes??10;return e.slice(0,s).map((i,a)=>{const l=uX(i,t),f=fX(i,l);return{id:dX(i.clientId,a),type:cX(i.clientId),status:f,cursor:Math.max(0,i.cursor),actor:i.actorId,mode:i.connectionMode,dialect:lX(i.clientId),scopes:Object.keys(i.effectiveScopes||{}),lastSeen:i.updatedAt}})}const pX={enabled:!1,thresholds:{p90Latency:500,errorRate:5,clientLag:100}};function XC(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 mX(e){const t=e.length>1&&e.endsWith("/")?e.slice(0,-1):e;return t==="/console"||t.startsWith("/console/")?"/console/stream":"/stream"}function gX(){const e=mp(),t=_.useMemo(()=>typeof window>"u"?"/stream":mX(window.location.pathname),[]),n=bk(),{range:s}=n,{preferences:i}=af(),{partitionId:a}=of(),l=i.refreshInterval*1e3,[f]=xa("console:alert-config",pX),[d,p]=_.useState("1h"),{data:g}=sf({refetchIntervalMs:l,partitionId:a}),{data:y}=CY({range:s,partitionId:a},{refetchIntervalMs:l}),{data:b}=RY({range:s,partitionId:a},{refetchIntervalMs:l}),{data:x}=NY({limit:5,partitionId:a},{refetchIntervalMs:l}),{data:S}=vk({limit:12,offset:0,partitionId:a},{refetchIntervalMs:l}),{events:w,isConnected:T}=sX({maxEvents:8,partitionId:a}),C=_.useMemo(()=>{const z=y?.buckets??[];let Q=0,Y=0;for(const D of z)Q+=D.pushCount+D.pullCount,Y+=D.errorCount;const ee=Q>0?Y/Q*100:0;return{totalEvents:Q,errorRate:ee}},[y?.buckets]),k=_.useMemo(()=>S?.items?hX(S.items,g,{maxNodes:12}):[],[S?.items,g]),N=k.filter(z=>z.status!=="offline").length,R=k.filter(z=>z.status==="offline").length,M=_.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]),L=_.useMemo(()=>w.map(z=>({type:z.type.toUpperCase(),actor:z.data?.actorId??"",table:(z.data?.tables??[])[0]??"",time:XC(z.timestamp,i.timeFormat)})),[w,i.timeFormat]),j=_.useMemo(()=>{const z=y?.buckets;if(!z?.length)return[];const Q=Math.max(...z.map(Y=>Math.max(Y.pushCount,Y.pullCount)),1);return z.map(Y=>({pushPercent:Q>0?Y.pushCount/Q*100:0,pullPercent:Q>0?Y.pullCount/Q*100:0}))},[y?.buckets]),A=_.useMemo(()=>{if(!b)return[];const z=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/z*100,pullBarPercent:b.pull.p50/z*100},{label:"P90",pushMs:b.push.p90,pullMs:b.pull.p90,pushBarPercent:b.push.p90/z*100,pullBarPercent:b.pull.p90/z*100},{label:"P99",pushMs:b.push.p99,pullMs:b.pull.p99,pushBarPercent:b.push.p99/z*100,pullBarPercent:b.pull.p99/z*100}]},[b]),P=_.useMemo(()=>x?.items?x.items.map(z=>({seq:z.commitSeq,actor:z.actorId,changes:z.changeCount,tables:(z.affectedTables??[]).join(", "),time:XC(z.createdAt,i.timeFormat)})):[],[x?.items,i.timeFormat]),G=_.useMemo(()=>Math.max(0,100-C.errorRate),[C.errorRate]),B=_.useMemo(()=>{if(!f.enabled||!g)return[];const z=[];return b?.push?.p90&&b.push.p90>f.thresholds.p90Latency&&z.push(`P90 push latency (${b.push.p90}ms) exceeds threshold (${f.thresholds.p90Latency}ms)`),g.minActiveClientCursor!==null&&g.maxCommitSeq-g.minActiveClientCursor>f.thresholds.clientLag&&z.push(`Client lag (${g.maxCommitSeq-g.minActiveClientCursor}) exceeds threshold (${f.thresholds.clientLag})`),C.errorRate>f.thresholds.errorRate&&z.push(`Error rate (${C.errorRate.toFixed(1)}%) exceeds threshold (${f.thresholds.errorRate}%)`),z},[f,g,b,C.errorRate]);return g?h.jsx(iX.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(nf,{children:"Threshold Exceeded"}),h.jsx(Pn,{children:B.map((z,Q)=>h.jsx("span",{className:"block",children:z},Q))})]})}),h.jsx(HA,{clients:k,totalNodes:k.length+2,onlineCount:N,offlineCount:R,relayClientIds:[]}),h.jsx(Jj,{items:M}),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(Tj,{bars:j,activeRange:d,onRangeChange:p})}),h.jsx("div",{className:"border-b border-border border-r border-border",children:h.jsx(eA,{buckets:A,successRate:G})}),h.jsx("div",{className:"border-r border-border",children:h.jsx(Kj,{commits:P,onViewAll:()=>e({href:t})})})]}),h.jsx(tA,{entries:L,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 yX(){return h.jsx(gX,{})}function vX({children:e}){return h.jsxs("div",{className:"space-y-4 px-5 py-5",children:[h.jsx(bX,{}),h.jsx(EX,{}),h.jsx(TX,{}),e]})}function bX(){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,k]=xa("console:disconnect-clear-saved-config",!1);_.useEffect(()=>{const j=new URLSearchParams(window.location.search),A=j.get("server");let P=!1;if(A&&(d(A),j.delete("server"),P=!0),j.has("token")&&(j.delete("token"),P=!0),P){const G=j.toString(),B=G?`${window.location.pathname}?${G}`:window.location.pathname;window.history.replaceState({},"",B)}},[]),_.useEffect(()=>{t?.serverUrl&&d(t.serverUrl),t?.token&&g(t.token)},[t?.serverUrl,t?.token]),_.useEffect(()=>{T(null)},[]);const N=async()=>{e(),b(null);const j=await n({serverUrl:f.trim(),token:p.trim()},{persistOverride:!0});T(j?"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)},M=async()=>{S(!0),b(null),T(null);const j=performance.now();try{const A=f.trim(),P=p.trim();if(!A||!P)throw new Error("Missing server URL or token");if(!(await fetch(`${A}/console/stats`,{headers:{Authorization:`Bearer ${P}`}})).ok)throw new Error("Failed to connect");b(Math.round(performance.now()-j))}catch{b(-1)}finally{S(!1)}},L=i??w??(y!==null?y<0?"Connection failed":`Connection successful (${y}ms latency)`:void 0);return h.jsx(Zj,{isConnected:a,isConnecting:l,isTestingConnection:x,serverUrl:f,onServerUrlChange:d,consoleToken:p,onConsoleTokenChange:g,onSaveAndConnect:N,onDisconnect:R,onTestConnection:M,statusMessage:L,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(Ep,{checked:C,onCheckedChange:k})]})})})}const xX=1440*60*1e3;function QC(e){const t=e.trim();if(!t)return null;const n=Number.parseInt(t,10);return!Number.isInteger(n)||n<=0?null:n}function Fy(e){if(!e)return"Never";const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():"Invalid date"}function SX(e){return e.length===0?"all scopes":e.length<=2?e.join(", "):`${e.slice(0,2).join(", ")} +${e.length-2}`}function _X(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*xX?"expiring":"active"}function wX(e){return e==="revoked"?"destructive":e==="expired"?"offline":e==="expiring"?"syncing":"healthy"}function EX(){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(""),[k,N]=_.useState(""),[R,M]=_.useState(null),[L,j]=_.useState([]),[A,P]=_.useState(null),[G,B]=_.useState(null),[z,Q]=_.useState(null),[Y,ee]=_.useState(null),[D,K]=_.useState(null),[q,V]=_.useState(null),[U,I]=_.useState(null),H=_.useMemo(()=>QC(i),[i]),W=H??14,X=_.useMemo(()=>QC(k),[k]),oe=k.trim().length>0,se=!oe||X!==null,de=_.useMemo(()=>({type:e==="all"?void 0:e,status:n==="all"?void 0:n,expiresWithinDays:n==="expiring"?W:void 0}),[e,n,W]),{data:xe,isLoading:he,error:Me}=$Y(de),_e=BY(),ne=HY(),pe=FY(),ae=qY(),we=VY();_.useEffect(()=>{const me=new Set((xe?.items??[]).map(Te=>Te.keyId));j(Te=>Te.filter(qe=>me.has(qe)))},[xe?.items]);const ve=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:oe?X??void 0:void 0});M(Te.secretKey),y(""),w(""),C(""),N("")}catch{}},Se=me=>{navigator.clipboard.writeText(me),B(me),setTimeout(()=>B(null),2e3)},ye=async()=>{if(z)try{await pe.mutateAsync(z)}finally{Q(null)}},Ue=async()=>{if(L.length!==0)try{const me=await ne.mutateAsync({keyIds:L});P(me),j([])}catch{}},Ie=async()=>{if(Y)try{const me=await we.mutateAsync(Y.keyId);K({oldKeyId:Y.keyId,oldKeyName:Y.name,secretKey:me.secretKey})}catch{}},Ee=async()=>{if(D)try{await pe.mutateAsync(D.oldKeyId)}finally{K(null),ee(null)}},Ve=async()=>{if(q)try{const me=await ae.mutateAsync(q);I(me.secretKey)}finally{V(null)}};if(he)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 Xe=(xe?.items??[]).filter(me=>me.revokedAt===null).map(me=>me.keyId),Be=Xe.length>0&&Xe.every(me=>L.includes(me)),We=L.length>0,He=(xe?.items??[]).filter(me=>L.includes(me.keyId)).map(me=>me.name);return h.jsxs(h.Fragment,{children:[h.jsxs(tx,{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(Oe,{size:"sm",variant:"destructive",onClick:()=>p(!0),disabled:L.length===0,children:["Revoke Selected (",L.length,")"]}),h.jsx(Oe,{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(ms,{children:[h.jsx(ts,{children:"Type filter"}),h.jsxs(hh,{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(ms,{children:[h.jsx(ts,{children:"Status filter"}),h.jsxs(hh,{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(ms,{children:[h.jsx(ts,{htmlFor:"api-key-expiring-window",children:"Expiring window (days)"}),h.jsx(mc,{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]})]}),xe?.items.length===0?h.jsx(Jb,{message:"No API keys match the current filters."}):h.jsxs(nl,{children:[h.jsx(rl,{children:h.jsxs(os,{children:[h.jsx(ht,{className:"w-[28px]",children:h.jsx(Fv,{checked:Be,indeterminate:!Be&&We&&Xe.length>0,onCheckedChange:me=>{j(me?Xe:[])},"aria-label":"Select all active keys"})}),h.jsx(ht,{className:"w-[100px]",children:"NAME"}),h.jsx(ht,{className:"w-[55px]",children:"TYPE"}),h.jsx(ht,{className:"w-[90px]",children:"KEY PREFIX"}),h.jsx(ht,{className:"w-[80px]",children:"ACTOR"}),h.jsx(ht,{className:"w-[100px]",children:"SCOPES"}),h.jsx(ht,{className:"w-[120px]",children:"CREATED"}),h.jsx(ht,{className:"w-[120px]",children:"LAST USED"}),h.jsx(ht,{className:"w-[120px]",children:"EXPIRES"}),h.jsx(ht,{className:"flex-1",children:"STATUS"})]})}),h.jsx(sl,{children:(xe?.items??[]).map(me=>{const Te=_X(me,W);return h.jsxs(os,{className:"group relative",children:[h.jsx(pt,{className:"w-[28px]",children:h.jsx(Fv,{checked:L.includes(me.keyId),onCheckedChange:qe=>{j(mt=>qe?[...new Set([...mt,me.keyId])]:mt.filter(lt=>lt!==me.keyId))},"aria-label":`Select ${me.name}`,disabled:me.revokedAt!==null})}),h.jsx(pt,{className:"w-[100px] font-medium",children:me.name}),h.jsx(pt,{className:"w-[55px]",children:h.jsx(mn,{variant:me.keyType==="admin"?"flow":me.keyType==="proxy"?"ghost":"relay",children:me.keyType})}),h.jsx(pt,{className:"w-[90px]",children:h.jsxs("code",{className:"font-mono text-[11px]",children:[me.keyPrefix,"..."]})}),h.jsx(pt,{className:"w-[80px] text-neutral-500",children:me.actorId??"-"}),h.jsx(pt,{className:"w-[100px] text-neutral-500",children:h.jsx("code",{className:"font-mono text-[10px]",children:SX(me.scopeKeys)})}),h.jsx(pt,{className:"w-[120px] text-neutral-500",children:Fy(me.createdAt)}),h.jsx(pt,{className:"w-[120px] text-neutral-500",children:Fy(me.lastUsedAt)}),h.jsx(pt,{className:"w-[120px] text-neutral-500",children:Fy(me.expiresAt)}),h.jsx(pt,{className:"flex-1",children:h.jsx(mn,{variant:wX(Te),children:Te})}),me.revokedAt===null&&h.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{type:"button",onClick:()=>ee(me),className:"px-1.5 py-0.5 rounded text-[9px] font-mono text-neutral-600 hover:text-white hover:bg-white/[0.05] cursor-pointer transition-colors",children:"stage"}),h.jsx("button",{type:"button",onClick:()=>V(me.keyId),className:"px-1.5 py-0.5 rounded text-[9px] font-mono text-neutral-600 hover:text-white hover:bg-white/[0.05] cursor-pointer transition-colors",children:"rotate"}),h.jsx("button",{type:"button",onClick:()=>Q(me.keyId),className:"px-1.5 py-0.5 rounded text-[9px] font-mono text-neutral-600 hover:text-offline hover:bg-offline/10 cursor-pointer transition-colors",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(WC,{copiedKeyId:G,onClose:()=>{M(null),f(!1)},onCopy:Se,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(ms,{children:[h.jsx(ts,{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(ms,{children:[h.jsx(ts,{children:"Key type"}),h.jsxs(hh,{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(ms,{children:[h.jsx(ts,{htmlFor:"api-key-actor-id",children:"Actor ID (optional)"}),h.jsx(mc,{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(ms,{children:[h.jsx(ts,{htmlFor:"api-key-scope-keys",children:"Scope keys (optional)"}),h.jsx(mc,{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(ms,{children:[h.jsx(ts,{htmlFor:"api-key-expires-days",children:"Expires in days (optional)"}),h.jsx(mc,{children:"Leave empty to keep the key non-expiring."}),h.jsx(Gn,{id:"api-key-expires-days",placeholder:"30",value:k,inputMode:"numeric",onChange:me=>N(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(Oe,{variant:"default",onClick:()=>f(!1),children:"Cancel"}),h.jsx(Oe,{variant:"primary",onClick:ve,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||P(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(Oe,{variant:"primary",onClick:()=>{p(!1),P(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(Oe,{variant:"default",onClick:()=>p(!1),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",onClick:Ue,disabled:ne.isPending||L.length===0,children:ne.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking..."]}):"Revoke Selected"})]})]})]})}),h.jsx($r,{open:Y!==null||D!==null,onOpenChange:()=>{ee(null),K(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Stage Rotate API Key"})}),D?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 ",D.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:D.secretKey}),h.jsx(Oe,{variant:"default",size:"sm",onClick:()=>Se(D.secretKey),children:G===D.secretKey?"Copied":"Copy"})]}),h.jsxs(Nn,{children:[h.jsx(Oe,{variant:"default",onClick:()=>{K(null),ee(null)},children:"Keep Old Key Active"}),h.jsx(Oe,{variant:"destructive",onClick:Ee,disabled:pe.isPending,children:pe.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(Oe,{variant:"default",onClick:()=>ee(null),children:"Cancel"}),h.jsx(Oe,{variant:"primary",onClick:Ie,disabled:we.isPending||!Y,children:we.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Staging..."]}):"Create Replacement Key"})]})]})]})}),h.jsx($r,{open:z!==null,onOpenChange:()=>Q(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(Oe,{variant:"default",onClick:()=>Q(null),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",onClick:ye,disabled:pe.isPending,children:pe.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Revoking..."]}):"Revoke"})]})]})}),h.jsx($r,{open:q!==null||U!==null,onOpenChange:()=>{V(null),I(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:"Rotate API Key"})}),U?h.jsx(WC,{copiedKeyId:G,onClose:()=>I(null),onCopy:Se,secretKey:U,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(Oe,{variant:"default",onClick:()=>V(null),children:"Cancel"}),h.jsx(Oe,{variant:"primary",onClick:Ve,disabled:ae.isPending,children:ae.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Rotating..."]}):"Rotate"})]})]})]})})]})}function TX(){const{preferences:e,updatePreference:t,resetPreferences:n}=af(),s=[{type:"filter",label:"Auto-refresh interval",options:XY.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:QY.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(nA,{rows:s,onResetDefaults:n})}function WC({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(Oe,{variant:"default",size:"sm",onClick:()=>n(s),children:e===s?"Copied":"Copy"})]}),h.jsx(Nn,{children:h.jsx(Oe,{variant:"primary",onClick:t,children:"Done"})})]})}function CX(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 RX(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 NX(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 jX(e,t,n){return{id:e.clientId,type:CX(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:RX(e.clientId),scopes:Object.keys(e.effectiveScopes??{}),lastSeen:NX(e.updatedAt,n)}}function AX({emptyState:e}={}){const[t,n]=_.useState(1),[s,i]=_.useState(null),{preferences:a}=af(),{partitionId:l}=of(),f=a.pageSize,d=a.refreshInterval*1e3,{data:p,isLoading:g}=sf({refetchIntervalMs:d,partitionId:l}),{data:y,isLoading:b,error:x}=vk({limit:f,offset:(t-1)*f,partitionId:l},{refetchIntervalMs:d}),S=DY(),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 k=(y?.items??[]).map(N=>jX(N,T,a.timeFormat));return h.jsxs("div",{className:"flex flex-col gap-5 px-5 py-5",children:[k.length>0&&h.jsx(sA,{clients:k,headSeq:T}),k.length===0?e??h.jsx(iV,{children:h.jsx(Jb,{message:"No clients yet"})}):h.jsx(Qj,{clients:k,headSeq:T,onEvict:N=>{const R=y?.items.find(M=>M.clientId===N);i(R?.clientId??N)}}),w>1&&h.jsx(yx,{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(Oe,{variant:"default",onClick:()=>i(null),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",onClick:C,disabled:S.isPending,children:S.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Evicting..."]}):"Evict"})]})]})})]})}const kX={latencyThresholdMs:1e3,errorRateThreshold:5,clientLagThreshold:50,enabled:!1};function OX(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 MX(e){const t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);return Array.from(new Set(t))}function IX(e){switch(e){case"notify_data_change":return"Notify";case"evict_client":return"Evict";case"compact":return"Compact";default:return"Prune"}}function JC(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function PX(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function DX(e){const t=JC(e.requestPayload),n=JC(e.resultPayload);if(e.operationType==="notify_data_change"){const a=PX(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 zX(e){const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function LX(){const{partitionId:e}=of();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(UX,{}),h.jsx(qX,{})]}),h.jsxs("div",{className:"grid gap-4 xl:grid-cols-3",children:[h.jsx($X,{partitionId:e}),h.jsx(BX,{partitionId:e}),h.jsx(FX,{partitionId:e})]}),h.jsx(HX,{partitionId:e})]})}function UX(){const{data:e,isLoading:t,error:n}=MY();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?OX(i.snapshotChunkTtlMs):"default"}));return h.jsx(Wj,{handlers:s,tableCount:e?.items.length??0})}function $X({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState(null),{data:a,isLoading:l}=sf({partitionId:e}),{data:f,isLoading:d,refetch:p}=IY({enabled:!1}),g=zY(),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(Tp,{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(nf,{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(mn,{variant:f.commitsToDelete>0?"offline":"ghost",children:f.commitsToDelete})]})]})]}):null}),h.jsxs(Nn,{children:[h.jsx(Oe,{variant:"default",onClick:()=>n(!1),children:s!==null?"Close":"Cancel"}),s===null&&h.jsx(Oe,{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 BX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState(null),{data:a,isLoading:l}=sf({partitionId:e}),f=LY(),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(Tp,{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(nf,{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(Oe,{variant:"default",onClick:()=>n(!1),children:s!==null?"Close":"Cancel"}),s===null&&h.jsx(Oe,{variant:"primary",onClick:p,disabled:f.isPending,children:f.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"}),"Compacting..."]}):"Compact Now"})]})]})})]})}function FX({partitionId:e}){const[t,n]=_.useState(!1),[s,i]=_.useState("tasks"),[a,l]=_.useState(e??""),[f,d]=_.useState(null),[p,g]=_.useState(null),y=UY(),b=MX(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(Tp,{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(nf,{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(ms,{children:[h.jsx(ts,{children:"Tables (comma-separated)"}),h.jsx(Gn,{value:s,onChange:T=>i(T.target.value),placeholder:"tasks, notes",disabled:y.isPending}),h.jsx(mc,{children:"Enter one or more table names affected by the external change."})]}),h.jsxs(ms,{children:[h.jsx(ts,{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(Oe,{variant:"default",onClick:()=>n(!1),children:f?"Close":"Cancel"}),f?null:h.jsx(Oe,{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 HX({partitionId:e}){const[t,n]=_.useState("all"),{data:s,isLoading:i,error:a}=PY({limit:20,offset:0,operationType:t==="all"?void 0:t,partitionId:e},{refetchIntervalMs:5e3});return h.jsx(tx,{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(Oe,{variant:t==="all"?"default":"ghost",size:"sm",onClick:()=>n("all"),children:"All"}),h.jsx(Oe,{variant:t==="prune"?"default":"ghost",size:"sm",onClick:()=>n("prune"),children:"Prune"}),h.jsx(Oe,{variant:t==="compact"?"default":"ghost",size:"sm",onClick:()=>n("compact"),children:"Compact"}),h.jsx(Oe,{variant:t==="notify_data_change"?"default":"ghost",size:"sm",onClick:()=>n("notify_data_change"),children:"Notify"}),h.jsx(Oe,{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(nl,{children:[h.jsx(rl,{children:h.jsxs(os,{children:[h.jsx(ht,{children:"Time"}),h.jsx(ht,{children:"Type"}),h.jsx(ht,{children:"User"}),h.jsx(ht,{children:"Target"}),h.jsx(ht,{children:"Result"})]})}),h.jsx(sl,{children:(s?.items??[]).map((l,f)=>h.jsxs(os,{children:[h.jsx(pt,{className:"whitespace-nowrap text-xs text-neutral-400",children:zX(l.createdAt)}),h.jsx(pt,{children:h.jsx(mn,{variant:"ghost",children:IX(l.operationType)})}),h.jsx(pt,{className:"font-mono text-xs",children:l.consoleUserId??"system"}),h.jsx(pt,{className:"font-mono text-xs",children:l.targetClientId??l.partitionId??(l.operationType==="notify_data_change"?"partition default":"global")}),h.jsx(pt,{className:"font-mono text-xs text-neutral-300",children:DX(l)})]},`${l.operationId}:${l.createdAt}:${f}`))})]})})})}function qX(){const[e,t]=xa("console:alert-config",kX),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(qj,{enabled:e.enabled,onEnabledChange:i,thresholds:n,onThresholdsChange:s})}function VX(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 KX(e){const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function GX(){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}=KY({prefix:n,cursor:i,limit:100}),x=GY(),S=ZY();function w(){const M=e.trim();s(M.length>0?M:void 0),a(void 0),f([])}function T(){t(""),s(void 0),a(void 0),f([])}function C(){g?.cursor&&(f(M=>[...M,i??""]),a(g.cursor))}function k(){f(M=>{const L=[...M],j=L.pop();return a(j&&j.length>0?j:void 0),L})}function N(){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(tx,{title:"Storage",actions:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Gn,{placeholder:"Prefix filter...",value:e,onChange:M=>t(M.target.value),onKeyDown:M=>{M.key==="Enter"&&w()},className:"h-7 w-48 text-xs"}),h.jsx(Oe,{variant:"default",size:"sm",onClick:w,children:"Filter"}),n&&h.jsx(Oe,{variant:"ghost",size:"sm",onClick:T,children:"Clear"})]}),children:R.length===0?h.jsx(Jb,{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(nl,{children:[h.jsx(rl,{children:h.jsxs(os,{children:[h.jsx(ht,{children:"Key"}),h.jsx(ht,{children:"Size"}),h.jsx(ht,{children:"Type"}),h.jsx(ht,{children:"Uploaded"}),h.jsx(ht,{children:"Actions"})]})}),h.jsx(sl,{children:R.map(M=>h.jsxs(os,{children:[h.jsx(pt,{className:"font-mono text-xs max-w-[320px]",title:M.key,children:M.key}),h.jsx(pt,{className:"font-mono text-xs text-neutral-400 whitespace-nowrap",children:VX(M.size)}),h.jsx(pt,{children:M.httpMetadata?.contentType?h.jsx(mn,{variant:"ghost",children:M.httpMetadata.contentType}):h.jsx("span",{className:"text-neutral-500 text-xs",children:"--"})}),h.jsx(pt,{className:"whitespace-nowrap text-xs text-neutral-400",children:KX(M.uploaded)}),h.jsx(pt,{children:h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>{S(M.key)},children:"Download"}),h.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>p(M.key),children:"Delete"})]})})]},M.key))})]})}),h.jsxs("div",{className:"flex items-center justify-between px-2 py-2",children:[h.jsx(Oe,{variant:"ghost",size:"sm",disabled:l.length===0,onClick:k,children:"Previous"}),h.jsx(Oe,{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(Oe,{variant:"default",onClick:()=>p(null),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",onClick:N,disabled:x.isPending,children:x.isPending?h.jsxs(h.Fragment,{children:[h.jsx(Pt,{size:"sm"})," Deleting..."]}):"Delete"})]})]})})]})}const ZX={};function au(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 YX(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 XX(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 Zd(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function QX(e,t){return e?`#${e.federatedCommitId??(t?`${t}:${e.commitSeq}`:String(e.commitSeq))}`:"#?"}function WX(e,t){return e?`E${e.federatedEventId??(t?`${t}:${e.eventId}`:e.eventId)}`:"E?"}function JX(e,t,n){return!e||!t?null:e.replaceAll("{traceId}",encodeURIComponent(t)).replaceAll("{spanId}",encodeURIComponent(n??""))}function xx({initialSelectedEntryId:e}={}){const{preferences:t}=af(),{partitionId:n}=of(),{range:s,setRange:i}=bk(),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),[k,N]=_.useState(!1),[R,M]=_.useState(e??null),L=_.useRef(!1),j=_.useMemo(()=>YX(S),[S]),A=_.useMemo(()=>new Date(Date.now()-XX(s)).toISOString(),[s]),{data:P,isLoading:G,refetch:B}=AY({limit:a,offset:(T-1)*a,...n?{partitionId:n}:{},view:d,...d!=="commits"&&g!=="all"?{eventType:g}:{},...d!=="commits"&&b!=="all"?{outcome:b}:{},...j.actorId?{actorId:j.actorId}:{},...j.clientId?{clientId:j.clientId}:{},...j.requestId?{requestId:j.requestId}:{},...j.traceId?{traceId:j.traceId}:{},...j.table?{table:j.table}:{},...j.search?{search:j.search}:{},from:A},{refetchIntervalMs:l}),z=oX(),Q=R?.startsWith("#")?R.slice(1):void 0,Y=R?.startsWith("E")?R.slice(1):void 0,ee=Q&&Q!=="?"?Q:void 0,D=Y&&Y!=="?"?Y:void 0,{data:K,isLoading:q,error:V}=jY(ee,{enabled:ee!==void 0,partitionId:n}),{data:U,isLoading:I,error:H}=kY(D,{enabled:D!==void 0,partitionId:n}),{data:W,isLoading:X,error:oe}=OY(D,{enabled:D!==void 0&&!!U?.payloadRef,partitionId:n}),se=_.useMemo(()=>JX(f,U?.traceId??null,U?.spanId??null),[U?.spanId,U?.traceId,f]);_.useEffect(()=>{C(1)},[]),_.useEffect(()=>{C(1)},[]),_.useEffect(()=>{e&&M(e)},[e]),_.useEffect(()=>{if(!L.current){L.current=!0;return}M(null)},[]),_.useEffect(()=>{C(1),M(null)},[]);const xe=_.useMemo(()=>(P?.items??[]).map(we=>{const ve=we.instanceId??we.commit?.instanceId??we.event?.instanceId,Se=ve?`[${ve}] `:"";if(we.type==="commit"&&we.commit){const Ue=we.commit;return{type:"commit",id:QX(Ue,ve),outcome:"--",duration:"--",actor:Ue.actorId,client:Ue.clientId,detail:`${Se}${Ue.changeCount} chg | ${(Ue.affectedTables??[]).join(", ")}`,time:au(we.timestamp,t.timeFormat)}}const ye=we.event;return ye?{type:ye.eventType,id:WX(ye,ve),outcome:ye.outcome,duration:`${ye.durationMs}ms`,actor:ye.actorId,client:ye.clientId,detail:`${Se}${(ye.tables??[]).join(", ")||"--"}`,time:au(we.timestamp,t.timeFormat)}:{type:"pull",id:"E?",outcome:"unknown",duration:"--",actor:"",client:"",detail:"--",time:au(we.timestamp,t.timeFormat)}}),[t.timeFormat,P?.items]),he=P?.total??0,Me=Math.max(1,Math.ceil(he/a)),_e=G,ne=[{label:"",options:[{id:"all",label:"All"},{id:"commits",label:"Commits"},{id:"events",label:"Events"}],activeId:d,onActiveChange:ae=>{p(ae),ae==="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:ae=>{i(ae),C(1)}},{label:"Type",options:[{id:"all",label:"All"},{id:"push",label:"Push"},{id:"pull",label:"Pull"}],activeId:g,onActiveChange:ae=>{y(ae),C(1)}},{label:"Outcome",options:[{id:"all",label:"All"},{id:"applied",label:"Applied"},{id:"error",label:"Error"},{id:"rejected",label:"Rejected"}],activeId:b,onActiveChange:ae=>{x(ae),C(1)}}];function pe(){z.mutate(void 0,{onSuccess:()=>{N(!1),B()}})}return h.jsxs("div",{className:"flex flex-col h-full",children:[_e&&xe.length===0?h.jsx("div",{className:"flex items-center justify-center py-24",children:h.jsx(Pt,{size:"lg"})}):h.jsx(rA,{entries:xe,selectedEntryId:R,onEntryClick:ae=>M(ae.id),filterBar:h.jsx(Yj,{groups:ne,searchValue:S,searchPlaceholder:"Use actor:, client:, table:, request:, trace: or free text...",onSearchChange:w,actions:h.jsxs(h.Fragment,{children:[h.jsx(Oe,{size:"sm",variant:"ghost",onClick:()=>{B()},children:"Refresh"}),h.jsx(Oe,{size:"sm",variant:"ghost",children:"Export"}),h.jsx(Oe,{size:"sm",variant:"destructive",onClick:()=>N(!0),children:"Clear"})]})}),pagination:h.jsx(yx,{page:T,totalPages:Me,totalItems:he,onPageChange:C})}),h.jsx($r,{open:R!==null,onOpenChange:ae=>{ae||M(null)},children:h.jsxs(hr,{children:[h.jsx(pr,{children:h.jsx(mr,{children:ee!==void 0?`Commit #${ee}`:D!==void 0?`Event E${D}`:"Entry details"})}),h.jsx("div",{className:"px-5 py-4 space-y-3 max-h-[70vh] overflow-y-auto",children:q||I?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."}):K?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:K.actorId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Client"}),h.jsx("div",{className:"text-neutral-100",children:K.clientId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Instance"}),h.jsx("div",{className:"text-neutral-100",children:K.instanceId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Created"}),h.jsx("div",{className:"text-neutral-100",children:au(K.createdAt,t.timeFormat)})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Changes"}),h.jsx("div",{className:"text-neutral-100",children:K.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:K.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"}),K.changes.length===0?h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No changes recorded."}):K.changes.map(ae=>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:[ae.table," | ",ae.op]}),h.jsxs("span",{className:"text-neutral-500",children:["#",ae.changeId]})]}),h.jsxs("div",{className:"font-mono text-[11px] text-neutral-400",children:["rowId: ",ae.rowId,ae.rowVersion!==null?` | version: ${ae.rowVersion}`:""]}),h.jsx("pre",{className:"font-mono text-[10px] rounded bg-surface p-2 overflow-x-auto text-neutral-200",children:Zd(ae.rowJson)})]},ae.changeId))]})]}):U?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:U.eventType})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Path"}),h.jsx("div",{className:"text-neutral-100",children:U.syncPath})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Instance"}),h.jsx("div",{className:"text-neutral-100",children:U.instanceId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Outcome"}),h.jsx("div",{className:"text-neutral-100",children:U.outcome})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Response Status"}),h.jsx("div",{className:"text-neutral-100",children:U.responseStatus})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Actor"}),h.jsx("div",{className:"text-neutral-100",children:U.actorId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Client"}),h.jsx("div",{className:"text-neutral-100",children:U.clientId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Status"}),h.jsx("div",{className:"text-neutral-100",children:U.statusCode})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Transport"}),h.jsx("div",{className:"text-neutral-100",children:U.transportPath})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Duration"}),h.jsxs("div",{className:"text-neutral-100",children:[U.durationMs,"ms"]})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Request ID"}),h.jsx("div",{className:"text-neutral-100",children:U.requestId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Trace ID"}),h.jsx("div",{className:"text-neutral-100",children:U.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:U.spanId??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Commit Seq"}),h.jsx("div",{className:"text-neutral-100",children:U.commitSeq??"--"}),U.commitSeq!==null&&h.jsx(Oe,{variant:"ghost",size:"sm",onClick:()=>M(`#${U.instanceId?`${U.instanceId}:`:""}${U.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:U.subscriptionCount??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Error Code"}),h.jsx("div",{className:"text-neutral-100",children:U.errorCode??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Payload Ref"}),h.jsx("div",{className:"text-neutral-100",children:U.payloadRef??"--"})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-neutral-500",children:"Created"}),h.jsx("div",{className:"text-neutral-100",children:au(U.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:U.tables.join(", ")||"--"})]}),U.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:Zd(U.scopesSummary)})]}),U.payloadRef&&h.jsxs("div",{children:[h.jsx("p",{className:"font-mono text-[10px] uppercase tracking-wider text-neutral-500 mb-2",children:"Payload Snapshot"}),X?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..."})]}):oe?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:Zd(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:Zd(W.responsePayload)})]}):h.jsx("p",{className:"font-mono text-[11px] text-neutral-500",children:"No payload snapshot available."})]}),U.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:U.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(Oe,{variant:"default",size:"sm",onClick:()=>M(null),children:"Close"})})]})}),h.jsx($r,{open:k,onOpenChange:ae=>{ae||N(!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(Oe,{variant:"default",size:"sm",onClick:()=>N(!1),children:"Cancel"}),h.jsx(Oe,{variant:"destructive",size:"sm",onClick:pe,disabled:z.isPending,children:z.isPending?"Clearing...":"Clear all"})]})]})})]})}const eQ=ao({getParentRoute:()=>lo,path:"/config",component:vX}),tQ=ao({getParentRoute:()=>lo,path:"/fleet",component:AX}),nQ=ao({getParentRoute:()=>lo,path:"/",component:yX});function rQ(){const{seq:e}=xk.useParams();return h.jsx(xx,{initialSelectedEntryId:`#${e}`})}const xk=ao({getParentRoute:()=>lo,path:"/investigate/commit/$seq",component:rQ});function sQ(){const{id:e}=Sk.useParams();return h.jsx(xx,{initialSelectedEntryId:`E${e}`})}const Sk=ao({getParentRoute:()=>lo,path:"/investigate/event/$id",component:sQ}),oQ=ao({getParentRoute:()=>lo,path:"/ops",component:LX}),iQ=ao({getParentRoute:()=>lo,path:"/storage",component:GX}),aQ=ao({getParentRoute:()=>lo,path:"/stream",component:xx}),cQ=lo.addChildren([nQ,aQ,xk,Sk,tQ,oQ,iQ,eQ]),lQ="syncular-console-basepath",uQ="syncular-console-server-url",fQ="syncular-console-token";function dQ(e){if(!e)return;const t=e.trim();return t.length>0?t:void 0}function Hv(e){const t=globalThis.document;if(!t)return;const n=t.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return dQ(n)}function _k(e){return!e||e==="/"?"/":(e.startsWith("/")?e:`/${e}`).replace(/\/+$/g,"")||"/"}function hQ(){return _k(Hv(lQ))}function pQ(){const e=Hv(uQ),t=Hv(fQ);return!e||!t?null:{serverUrl:e,token:t}}function mQ(){return new P6({defaultOptions:{queries:{staleTime:5e3,retry:1}}})}function gQ(e){return _k(e??hQ())}function yQ(e){const[t]=_.useState(()=>mQ()),n=_.useMemo(()=>BH({routeTree:cQ,basepath:gQ(e.basePath)}),[e.basePath]),s=e.defaultConfig===void 0?pQ():e.defaultConfig,i=e.autoConnect??e.defaultConfig===void 0;return h.jsx(D6,{client:t,children:h.jsx(sq,{defaultConfig:s,autoConnect:i,storageMode:e.storageMode,children:h.jsx(qH,{router:n})})})}function vQ(e){return h.jsx("div",{className:bx,children:h.jsx(yQ,{...e})})}function bQ(e){const t=document.querySelector(e);if(!t)throw new Error(`Unable to mount console: ${e} not found`);return t}function xQ(e,t={}){const n=bQ(e);WY(n);const s=f6.createRoot(n),i=h.jsx(vQ,{basePath:t.basePath,defaultConfig:t.defaultConfig,autoConnect:t.autoConnect});return t.strictMode===!1?(s.render(i),s):(s.render(h.jsx(_.StrictMode,{children:i})),s)}var SQ={};const _Q="syncular-sentry-dsn",wQ="syncular-sentry-environment",EQ="syncular-sentry-release";function gu(e){if(!e)return;const t=e.trim();return t.length>0?t:void 0}function Hy(e){if(typeof document>"u")return;const t=document.querySelector(`meta[name="${e}"]`)?.getAttribute("content");return gu(t)}function qy(e){if(!(typeof process>"u"))return gu(SQ[e])}function Vy(e){for(const t of e)if(t)return t}function TQ(){const e=Vy([gu(globalThis.__SYNCULAR_SENTRY_DSN__),Hy(_Q),qy("SYNCULAR_SENTRY_DSN")]);if(!e)return null;const t=Vy([gu(globalThis.__SYNCULAR_SENTRY_ENVIRONMENT__),Hy(wQ),qy("SYNCULAR_SENTRY_ENVIRONMENT")]),n=Vy([gu(globalThis.__SYNCULAR_SENTRY_RELEASE__),Hy(EQ),qy("SYNCULAR_SENTRY_RELEASE")]);return{dsn:e,environment:t,release:n,enableLogs:!0,tracesSampleRate:.2,tracePropagationTargets:[/^https?:\/\/.*\/api\/.*/]}}const eR=TQ();eR&&n6(eR);xQ("#root");
|