@hellcoder/companion 0.105.2 → 0.105.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentsPage-D1iuUiHX.js → AgentsPage-Chj3i8hp.js} +1 -1
- package/dist/assets/{CronManager-CLKlW4pc.js → CronManager-CnSV7pph.js} +1 -1
- package/dist/assets/{IntegrationsPage-CY3rD93q.js → IntegrationsPage-D7He8DJZ.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-CaNewlOp.js → LinearOAuthSettingsPage-BhbSx1L1.js} +1 -1
- package/dist/assets/{LinearSettingsPage-B-9ZMgYC.js → LinearSettingsPage-xYU0CnhC.js} +1 -1
- package/dist/assets/{Playground-BqRkgMBH.js → Playground-ZMOfN3kG.js} +1 -1
- package/dist/assets/{PromptsPage-BA_qgnJV.js → PromptsPage-C-YET0qF.js} +1 -1
- package/dist/assets/{RunsPage-CBmACxTt.js → RunsPage-D8p_NPsc.js} +1 -1
- package/dist/assets/{SandboxManager-eWZ5PosF.js → SandboxManager-DNct4A2p.js} +1 -1
- package/dist/assets/{SettingsPage-DGA37UhJ.js → SettingsPage-Bc33muUi.js} +1 -1
- package/dist/assets/{TailscalePage-L4M_MY6O.js → TailscalePage-CVXN6STS.js} +1 -1
- package/dist/assets/{index-D3RdMj2z.js → index-B_8Ih1pQ.js} +10 -10
- package/dist/assets/{sw-register-CWd_l93k.js → sw-register-Gj6h8GCi.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/claude-adapter.test.ts +41 -14
- package/server/claude-adapter.ts +9 -8
|
@@ -45,8 +45,8 @@ var uj=Object.defineProperty;var dj=(e,t,n)=>t in e?uj(e,t,{enumerable:!0,config
|
|
|
45
45
|
`);for(m=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;m<ee.length&&!ee[m].includes("DetermineComponentFrameRoot");)m++;if(d===H.length||m===ee.length)for(d=H.length-1,m=ee.length-1;1<=d&&0<=m&&H[d]!==ee[m];)m--;for(;1<=d&&0<=m;d--,m--)if(H[d]!==ee[m]){if(d!==1||m!==1)do if(d--,m--,0>m||H[d]!==ee[m]){var oe=`
|
|
46
46
|
`+H[d].replace(" at new "," at ");return r.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",r.displayName)),oe}while(1<=d&&0<=m);break}}}finally{bt=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?zt(o):""}function dn(r,i){switch(r.tag){case 26:case 27:case 5:return zt(r.type);case 16:return zt("Lazy");case 13:return r.child!==i&&i!==null?zt("Suspense Fallback"):zt("Suspense");case 19:return zt("SuspenseList");case 0:case 15:return Lt(r.type,!1);case 11:return Lt(r.type.render,!1);case 1:return Lt(r.type,!0);case 31:return zt("Activity");default:return""}}function st(r){try{var i="",o=null;do i+=dn(r,o),o=r,r=r.return;while(r);return i}catch(d){return`
|
|
47
47
|
Error generating stack: `+d.message+`
|
|
48
|
-
`+d.stack}}var fn=Object.prototype.hasOwnProperty,yn=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,yt=e.unstable_requestPaint,qe=e.unstable_now,Or=e.unstable_getCurrentPriorityLevel,ae=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,W=e.unstable_NormalPriority,fe=e.unstable_LowPriority,Te=e.unstable_IdlePriority,Ye=e.log,tt=e.unstable_setDisableYieldValue,nt=null,vt=null;function hn(r){if(typeof Ye=="function"&&tt(r),vt&&typeof vt.setStrictMode=="function")try{vt.setStrictMode(nt,r)}catch{}}var Ze=Math.clz32?Math.clz32:Yr,nr=Math.log,En=Math.LN2;function Yr(r){return r>>>=0,r===0?32:31-(nr(r)/En|0)|0}var Br=256,Pr=262144,te=4194304;function he(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function ge(r,i,o){var d=r.pendingLanes;if(d===0)return 0;var m=0,x=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var N=d&134217727;return N!==0?(d=N&~x,d!==0?m=he(d):(w&=N,w!==0?m=he(w):o||(o=N&~r,o!==0&&(m=he(o))))):(N=d&~x,N!==0?m=he(N):w!==0?m=he(w):o||(o=d&~r,o!==0&&(m=he(o)))),m===0?0:i!==0&&i!==m&&(i&x)===0&&(x=m&-m,o=i&-i,x>=o||x===32&&(o&4194048)!==0)?i:m}function We(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Dt(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rn(){var r=te;return te<<=1,(te&62914560)===0&&(te=4194304),r}function Tn(r){for(var i=[],o=0;31>o;o++)i.push(r);return i}function Ot(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ln(r,i,o,d,m,x){var w=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var N=r.entanglements,H=r.expirationTimes,ee=r.hiddenUpdates;for(o=w&~o;0<o;){var oe=31-Ze(o),ue=1<<oe;N[oe]=0,H[oe]=-1;var ne=ee[oe];if(ne!==null)for(ee[oe]=null,oe=0;oe<ne.length;oe++){var ie=ne[oe];ie!==null&&(ie.lane&=-536870913)}o&=~ue}d!==0&&mr(r,d,0),x!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=x&~(w&~i))}function mr(r,i,o){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-Ze(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function wa(r,i){var o=r.entangledLanes|=i;for(r=r.entanglements;o;){var d=31-Ze(o),m=1<<d;m&i|r[d]&i&&(r[d]|=i),o&=~m}}function Pl(r,i){var o=i&-i;return o=(o&42)!==0?1:Dn(o),(o&(r.suspendedLanes|i))!==0?0:o}function Dn(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function zi(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function $l(){var r=z.p;return r!==0?r:(r=window.event,r===void 0?32:F1(r.type))}function Ul(r,i){var o=z.p;try{return z.p=r,i()}finally{z.p=o}}var gr=Math.random().toString(36).slice(2),Ht="__reactFiber$"+gr,_n="__reactProps$"+gr,rr="__reactContainer$"+gr,Fl="__reactEvents$"+gr,pf="__reactListeners$"+gr,Li="__reactHandles$"+gr,Di="__reactResources$"+gr,Wr="__reactMarker$"+gr;function Gs(r){delete r[Ht],delete r[_n],delete r[Fl],delete r[pf],delete r[Li]}function ps(r){var i=r[Ht];if(i)return i;for(var o=r.parentNode;o;){if(i=o[rr]||o[Ht]){if(o=i.alternate,i.child!==null||o!==null&&o.child!==null)for(r=j1(r);r!==null;){if(o=r[Ht])return o;r=j1(r)}return i}r=o,o=r.parentNode}return null}function In(r){if(r=r[Ht]||r[rr]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Oi(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(s(33))}function Xr(r){var i=r[Di];return i||(i=r[Di]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Yt(r){r[Wr]=!0}var qn=new Set,Sa={};function $r(r,i){Qr(r,i),Qr(r+"Capture",i)}function Qr(r,i){for(Sa[r]=i,r=0;r<i.length;r++)qn.add(i[r])}var Hl=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Il={},Wt={};function mf(r){return fn.call(Wt,r)?!0:fn.call(Il,r)?!1:Hl.test(r)?Wt[r]=!0:(Il[r]=!0,!1)}function Bi(r,i,o){if(mf(i))if(o===null)r.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+o)}}function ka(r,i,o){if(o===null)r.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+o)}}function Ur(r,i,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(i,o,""+d)}}function Vn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Dc(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function ql(r,i,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return m.call(this)},set:function(w){o=""+w,x.call(this,w)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function ja(r){if(!r._valueTracker){var i=Dc(r)?"checked":"value";r._valueTracker=ql(r,i,""+r[i])}}function Kr(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var o=i.getValue(),d="";return r&&(d=Dc(r)?r.checked?"true":"false":r.value),r=d,r!==o?(i.setValue(r),!0):!1}function Ys(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var xr=/[\n"\\]/g;function Jt(r){return r.replace(xr,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Pi(r,i,o,d,m,x,w,N){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),i!=null?w==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Vn(i)):r.value!==""+Vn(i)&&(r.value=""+Vn(i)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),i!=null?Na(r,w,Vn(i)):o!=null?Na(r,w,Vn(o)):d!=null&&r.removeAttribute("value"),m==null&&x!=null&&(r.defaultChecked=!!x),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?r.name=""+Vn(N):r.removeAttribute("name")}function Oc(r,i,o,d,m,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),i!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){ja(r);return}o=o!=null?""+Vn(o):"",i=i!=null?""+Vn(i):o,N||i===r.value||(r.value=i),r.defaultValue=i}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=N?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),ja(r)}function Na(r,i,o){i==="number"&&Ys(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function Ws(r,i,o,d){if(r=r.options,i){i={};for(var m=0;m<o.length;m++)i["$"+o[m]]=!0;for(o=0;o<r.length;o++)m=i.hasOwnProperty("$"+r[o].value),r[o].selected!==m&&(r[o].selected=m),m&&d&&(r[o].defaultSelected=!0)}else{for(o=""+Vn(o),i=null,m=0;m<r.length;m++){if(r[m].value===o){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}i!==null||r[m].disabled||(i=r[m])}i!==null&&(i.selected=!0)}}function Ca(r,i,o){if(i!=null&&(i=""+Vn(i),i!==r.value&&(r.value=i),o==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=o!=null?""+Vn(o):""}function Vl(r,i,o,d){if(i==null){if(d!=null){if(o!=null)throw Error(s(92));if(G(d)){if(1<d.length)throw Error(s(93));d=d[0]}o=d}o==null&&(o=""),i=o}o=Vn(i),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),ja(r)}function Xs(r,i){if(i){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=i;return}}r.textContent=i}var gf=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Bc(r,i,o){var d=i.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,o):typeof o!="number"||o===0||gf.has(i)?i==="float"?r.cssFloat=o:r[i]=(""+o).trim():r[i]=o+"px"}function Pc(r,i,o){if(i!=null&&typeof i!="object")throw Error(s(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in i)d=i[m],i.hasOwnProperty(m)&&o[m]!==d&&Bc(r,m,d)}else for(var x in i)i.hasOwnProperty(x)&&Bc(r,x,i[x])}function Ea(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $c=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),xf=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ta(r){return xf.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function vr(){}var Qs=null;function Aa(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ks=null,Zs=null;function Uc(r){var i=In(r);if(i&&(r=i.stateNode)){var o=r[_n]||null;e:switch(r=i.stateNode,i.type){case"input":if(Pi(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),i=o.name,o.type==="radio"&&i!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Jt(""+i)+'"][type="radio"]'),i=0;i<o.length;i++){var d=o[i];if(d!==r&&d.form===r.form){var m=d[_n]||null;if(!m)throw Error(s(90));Pi(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(i=0;i<o.length;i++)d=o[i],d.form===r.form&&Kr(d)}break e;case"textarea":Ca(r,o.value,o.defaultValue);break e;case"select":i=o.value,i!=null&&Ws(r,!!o.multiple,i,!1)}}}var Gl=!1;function Fc(r,i,o){if(Gl)return r(i,o);Gl=!0;try{var d=r(i);return d}finally{if(Gl=!1,(Ks!==null||Zs!==null)&&(Tu(),Ks&&(i=Ks,r=Zs,Zs=Ks=null,Uc(i),r)))for(i=0;i<r.length;i++)Uc(r[i])}}function $i(r,i){var o=r.stateNode;if(o===null)return null;var d=o[_n]||null;if(d===null)return null;o=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(s(231,i,typeof o));return o}var br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ma=!1;if(br)try{var Js={};Object.defineProperty(Js,"passive",{get:function(){Ma=!0}}),window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{Ma=!1}var q=null,de=null,Xe=null;function ht(){if(Xe)return Xe;var r,i=de,o=i.length,d,m="value"in q?q.value:q.textContent,x=m.length;for(r=0;r<o&&i[r]===m[r];r++);var w=o-r;for(d=1;d<=w&&i[o-d]===m[x-d];d++);return Xe=m.slice(r,1<d?1-d:void 0)}function it(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function Fe(){return!0}function On(){return!1}function pn(r){function i(o,d,m,x,w){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in r)r.hasOwnProperty(N)&&(o=r[N],this[N]=o?o(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Fe:On,this.isPropagationStopped=On,this}return v(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Fe)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Fe)},persist:function(){},isPersistent:Fe}),i}var yr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ms=pn(yr),mn=v({},yr,{view:0,detail:0}),Hc=pn(mn),Yl,Wl,Ui,Fi=v({},mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bf,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ui&&(Ui&&r.type==="mousemove"?(Yl=r.screenX-Ui.screenX,Wl=r.screenY-Ui.screenY):Wl=Yl=0,Ui=r),Yl)},movementY:function(r){return"movementY"in r?r.movementY:Wl}}),vf=pn(Fi),Ic=v({},Fi,{dataTransfer:0}),qc=pn(Ic),Vc=v({},mn,{relatedTarget:0}),Zr=pn(Vc),Gc=v({},yr,{animationName:0,elapsedTime:0,pseudoElement:0}),Yc=pn(Gc),Ra=v({},yr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),mS=pn(Ra),gS=v({},yr,{data:0}),_x=pn(gS),xS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vS={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},bS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yS(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=bS[r])?!!i[r]:!1}function bf(){return yS}var _S=v({},mn,{key:function(r){if(r.key){var i=xS[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=it(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?vS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bf,charCode:function(r){return r.type==="keypress"?it(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?it(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),wS=pn(_S),SS=v({},Fi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wx=pn(SS),kS=v({},mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bf}),jS=pn(kS),NS=v({},yr,{propertyName:0,elapsedTime:0,pseudoElement:0}),CS=pn(NS),ES=v({},Fi,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),TS=pn(ES),AS=v({},yr,{newState:0,oldState:0}),MS=pn(AS),RS=[9,13,27,32],yf=br&&"CompositionEvent"in window,Xl=null;br&&"documentMode"in document&&(Xl=document.documentMode);var zS=br&&"TextEvent"in window&&!Xl,Sx=br&&(!yf||Xl&&8<Xl&&11>=Xl),kx=" ",jx=!1;function Nx(r,i){switch(r){case"keyup":return RS.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var za=!1;function LS(r,i){switch(r){case"compositionend":return Cx(i);case"keypress":return i.which!==32?null:(jx=!0,kx);case"textInput":return r=i.data,r===kx&&jx?null:r;default:return null}}function DS(r,i){if(za)return r==="compositionend"||!yf&&Nx(r,i)?(r=ht(),Xe=de=q=null,za=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Sx&&i.locale!=="ko"?null:i.data;default:return null}}var OS={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ex(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!OS[r.type]:i==="textarea"}function Tx(r,i,o,d){Ks?Zs?Zs.push(d):Zs=[d]:Ks=d,i=Ou(i,"onChange"),0<i.length&&(o=new ms("onChange","change",null,o,d),r.push({event:o,listeners:i}))}var Ql=null,Kl=null;function BS(r){d1(r,0)}function Wc(r){var i=Oi(r);if(Kr(i))return r}function Ax(r,i){if(r==="change")return i}var Mx=!1;if(br){var _f;if(br){var wf="oninput"in document;if(!wf){var Rx=document.createElement("div");Rx.setAttribute("oninput","return;"),wf=typeof Rx.oninput=="function"}_f=wf}else _f=!1;Mx=_f&&(!document.documentMode||9<document.documentMode)}function zx(){Ql&&(Ql.detachEvent("onpropertychange",Lx),Kl=Ql=null)}function Lx(r){if(r.propertyName==="value"&&Wc(Kl)){var i=[];Tx(i,Kl,r,Aa(r)),Fc(BS,i)}}function PS(r,i,o){r==="focusin"?(zx(),Ql=i,Kl=o,Ql.attachEvent("onpropertychange",Lx)):r==="focusout"&&zx()}function $S(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Wc(Kl)}function US(r,i){if(r==="click")return Wc(i)}function FS(r,i){if(r==="input"||r==="change")return Wc(i)}function HS(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var sr=typeof Object.is=="function"?Object.is:HS;function Zl(r,i){if(sr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var o=Object.keys(r),d=Object.keys(i);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!fn.call(i,m)||!sr(r[m],i[m]))return!1}return!0}function Dx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Ox(r,i){var o=Dx(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=i&&d>=i)return{node:o,offset:i-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Dx(o)}}function Bx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?Bx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function Px(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Ys(r.document);i instanceof r.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)r=i.contentWindow;else break;i=Ys(r.document)}return i}function Sf(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var IS=br&&"documentMode"in document&&11>=document.documentMode,La=null,kf=null,Jl=null,jf=!1;function $x(r,i,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;jf||La==null||La!==Ys(d)||(d=La,"selectionStart"in d&&Sf(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Jl&&Zl(Jl,d)||(Jl=d,d=Ou(kf,"onSelect"),0<d.length&&(i=new ms("onSelect","select",null,i,o),r.push({event:i,listeners:d}),i.target=La)))}function Hi(r,i){var o={};return o[r.toLowerCase()]=i.toLowerCase(),o["Webkit"+r]="webkit"+i,o["Moz"+r]="moz"+i,o}var Da={animationend:Hi("Animation","AnimationEnd"),animationiteration:Hi("Animation","AnimationIteration"),animationstart:Hi("Animation","AnimationStart"),transitionrun:Hi("Transition","TransitionRun"),transitionstart:Hi("Transition","TransitionStart"),transitioncancel:Hi("Transition","TransitionCancel"),transitionend:Hi("Transition","TransitionEnd")},Nf={},Ux={};br&&(Ux=document.createElement("div").style,"AnimationEvent"in window||(delete Da.animationend.animation,delete Da.animationiteration.animation,delete Da.animationstart.animation),"TransitionEvent"in window||delete Da.transitionend.transition);function Ii(r){if(Nf[r])return Nf[r];if(!Da[r])return r;var i=Da[r],o;for(o in i)if(i.hasOwnProperty(o)&&o in Ux)return Nf[r]=i[o];return r}var Fx=Ii("animationend"),Hx=Ii("animationiteration"),Ix=Ii("animationstart"),qS=Ii("transitionrun"),VS=Ii("transitionstart"),GS=Ii("transitioncancel"),qx=Ii("transitionend"),Vx=new Map,Cf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Cf.push("scrollEnd");function Fr(r,i){Vx.set(r,i),$r(i,[r])}var Xc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},_r=[],Oa=0,Ef=0;function Qc(){for(var r=Oa,i=Ef=Oa=0;i<r;){var o=_r[i];_r[i++]=null;var d=_r[i];_r[i++]=null;var m=_r[i];_r[i++]=null;var x=_r[i];if(_r[i++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}x!==0&&Gx(o,m,x)}}function Kc(r,i,o,d){_r[Oa++]=r,_r[Oa++]=i,_r[Oa++]=o,_r[Oa++]=d,Ef|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Tf(r,i,o,d){return Kc(r,i,o,d),Zc(r)}function qi(r,i){return Kc(r,null,null,i),Zc(r)}function Gx(r,i,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var m=!1,x=r.return;x!==null;)x.childLanes|=o,d=x.alternate,d!==null&&(d.childLanes|=o),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(m=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,m&&i!==null&&(m=31-Ze(o),r=x.hiddenUpdates,d=r[m],d===null?r[m]=[i]:d.push(i),i.lane=o|536870912),x):null}function Zc(r){if(50<wo)throw wo=0,Ph=null,Error(s(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var Ba={};function YS(r,i,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ir(r,i,o,d){return new YS(r,i,o,d)}function Af(r){return r=r.prototype,!(!r||!r.isReactComponent)}function gs(r,i){var o=r.alternate;return o===null?(o=ir(r.tag,i,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=i,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,i=r.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Yx(r,i){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,i=o.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function Jc(r,i,o,d,m,x){var w=0;if(d=r,typeof r=="function")Af(r)&&(w=1);else if(typeof r=="string")w=Zk(r,o,pe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case Y:return r=ir(31,o,i,m),r.elementType=Y,r.lanes=x,r;case j:return Vi(o.children,m,x,i);case E:w=8,m|=24;break;case k:return r=ir(12,o,i,m|2),r.elementType=k,r.lanes=x,r;case B:return r=ir(13,o,i,m),r.elementType=B,r.lanes=x,r;case D:return r=ir(19,o,i,m),r.elementType=D,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:w=10;break e;case A:w=9;break e;case L:w=11;break e;case U:w=14;break e;case F:w=16,d=null;break e}w=29,o=Error(s(130,r===null?"null":typeof r,"")),d=null}return i=ir(w,o,i,m),i.elementType=r,i.type=d,i.lanes=x,i}function Vi(r,i,o,d){return r=ir(7,r,d,i),r.lanes=o,r}function Mf(r,i,o){return r=ir(6,r,null,i),r.lanes=o,r}function Wx(r){var i=ir(18,null,null,0);return i.stateNode=r,i}function Rf(r,i,o){return i=ir(4,r.children!==null?r.children:[],r.key,i),i.lanes=o,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Xx=new WeakMap;function wr(r,i){if(typeof r=="object"&&r!==null){var o=Xx.get(r);return o!==void 0?o:(i={value:r,source:i,stack:st(i)},Xx.set(r,i),i)}return{value:r,source:i,stack:st(i)}}var Pa=[],$a=0,eu=null,eo=0,Sr=[],kr=0,ei=null,Jr=1,es="";function xs(r,i){Pa[$a++]=eo,Pa[$a++]=eu,eu=r,eo=i}function Qx(r,i,o){Sr[kr++]=Jr,Sr[kr++]=es,Sr[kr++]=ei,ei=r;var d=Jr;r=es;var m=32-Ze(d)-1;d&=~(1<<m),o+=1;var x=32-Ze(i)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,Jr=1<<32-Ze(i)+m|o<<m|d,es=x+r}else Jr=1<<x|o<<m|d,es=r}function zf(r){r.return!==null&&(xs(r,1),Qx(r,1,0))}function Lf(r){for(;r===eu;)eu=Pa[--$a],Pa[$a]=null,eo=Pa[--$a],Pa[$a]=null;for(;r===ei;)ei=Sr[--kr],Sr[kr]=null,es=Sr[--kr],Sr[kr]=null,Jr=Sr[--kr],Sr[kr]=null}function Kx(r,i){Sr[kr++]=Jr,Sr[kr++]=es,Sr[kr++]=ei,Jr=i.id,es=i.overflow,ei=r}var wn=null,Pt=null,dt=!1,ti=null,jr=!1,Df=Error(s(519));function ni(r){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw to(wr(i,r)),Df}function Zx(r){var i=r.stateNode,o=r.type,d=r.memoizedProps;switch(i[Ht]=r,i[_n]=d,o){case"dialog":lt("cancel",i),lt("close",i);break;case"iframe":case"object":case"embed":lt("load",i);break;case"video":case"audio":for(o=0;o<ko.length;o++)lt(ko[o],i);break;case"source":lt("error",i);break;case"img":case"image":case"link":lt("error",i),lt("load",i);break;case"details":lt("toggle",i);break;case"input":lt("invalid",i),Oc(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":lt("invalid",i);break;case"textarea":lt("invalid",i),Vl(i,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||i.textContent===""+o||d.suppressHydrationWarning===!0||m1(i.textContent,o)?(d.popover!=null&&(lt("beforetoggle",i),lt("toggle",i)),d.onScroll!=null&<("scroll",i),d.onScrollEnd!=null&<("scrollend",i),d.onClick!=null&&(i.onclick=vr),i=!0):i=!1,i||ni(r,!0)}function Jx(r){for(wn=r.return;wn;)switch(wn.tag){case 5:case 31:case 13:jr=!1;return;case 27:case 3:jr=!0;return;default:wn=wn.return}}function Ua(r){if(r!==wn)return!1;if(!dt)return Jx(r),dt=!0,!1;var i=r.tag,o;if((o=i!==3&&i!==27)&&((o=i===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||Jh(r.type,r.memoizedProps)),o=!o),o&&Pt&&ni(r),Jx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Pt=k1(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Pt=k1(r)}else i===27?(i=Pt,gi(r.type)?(r=sp,sp=null,Pt=r):Pt=i):Pt=wn?Cr(r.stateNode.nextSibling):null;return!0}function Gi(){Pt=wn=null,dt=!1}function Of(){var r=ti;return r!==null&&(Xn===null?Xn=r:Xn.push.apply(Xn,r),ti=null),r}function to(r){ti===null?ti=[r]:ti.push(r)}var Bf=P(null),Yi=null,vs=null;function ri(r,i,o){M(Bf,i._currentValue),i._currentValue=o}function bs(r){r._currentValue=Bf.current,Z(Bf)}function Pf(r,i,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===o)break;r=r.return}}function $f(r,i,o,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=m;for(var H=0;H<i.length;H++)if(N.context===i[H]){x.lanes|=o,N=x.alternate,N!==null&&(N.lanes|=o),Pf(x.return,o,r),d||(w=null);break e}x=N.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(s(341));w.lanes|=o,x=w.alternate,x!==null&&(x.lanes|=o),Pf(w,o,r),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===r){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function Fa(r,i,o,d){r=null;for(var m=i,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(s(387));if(w=w.memoizedProps,w!==null){var N=m.type;sr(m.pendingProps.value,w.value)||(r!==null?r.push(N):r=[N])}}else if(m===Ae.current){if(w=m.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(To):r=[To])}m=m.return}r!==null&&$f(i,r,o,d),i.flags|=262144}function tu(r){for(r=r.firstContext;r!==null;){if(!sr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Wi(r){Yi=r,vs=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Sn(r){return e0(Yi,r)}function nu(r,i){return Yi===null&&Wi(r),e0(r,i)}function e0(r,i){var o=i._currentValue;if(i={context:i,memoizedValue:o,next:null},vs===null){if(r===null)throw Error(s(308));vs=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else vs=vs.next=i;return o}var WS=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(o){return o()})}},XS=e.unstable_scheduleCallback,QS=e.unstable_NormalPriority,sn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uf(){return{controller:new WS,data:new Map,refCount:0}}function no(r){r.refCount--,r.refCount===0&&XS(QS,function(){r.controller.abort()})}var ro=null,Ff=0,Ha=0,Ia=null;function KS(r,i){if(ro===null){var o=ro=[];Ff=0,Ha=qh(),Ia={status:"pending",value:void 0,then:function(d){o.push(d)}}}return Ff++,i.then(t0,t0),i}function t0(){if(--Ff===0&&ro!==null){Ia!==null&&(Ia.status="fulfilled");var r=ro;ro=null,Ha=0,Ia=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function ZS(r,i){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var m=0;m<o.length;m++)(0,o[m])(i)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var n0=$.S;$.S=function(r,i){$v=qe(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&KS(r,i),n0!==null&&n0(r,i)};var Xi=P(null);function Hf(){var r=Xi.current;return r!==null?r:Et.pooledCache}function ru(r,i){i===null?M(Xi,Xi.current):M(Xi,i.pool)}function r0(){var r=Hf();return r===null?null:{parent:sn._currentValue,pool:r}}var qa=Error(s(460)),If=Error(s(474)),su=Error(s(542)),iu={then:function(){}};function s0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function i0(r,i,o){switch(o=r[o],o===void 0?r.push(i):o!==i&&(i.then(vr,vr),i=o),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,l0(r),r;default:if(typeof i.status=="string")i.then(vr,vr);else{if(r=Et,r!==null&&100<r.shellSuspendCounter)throw Error(s(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var m=i;m.status="fulfilled",m.value=d}},function(d){if(i.status==="pending"){var m=i;m.status="rejected",m.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,l0(r),r}throw Ki=i,qa}}function Qi(r){try{var i=r._init;return i(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Ki=o,qa):o}}var Ki=null;function a0(){if(Ki===null)throw Error(s(459));var r=Ki;return Ki=null,r}function l0(r){if(r===qa||r===su)throw Error(s(483))}var Va=null,so=0;function au(r){var i=so;return so+=1,Va===null&&(Va=[]),i0(Va,r,i)}function io(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function lu(r,i){throw i.$$typeof===y?Error(s(525)):(r=Object.prototype.toString.call(i),Error(s(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function o0(r){function i(K,V){if(r){var J=K.deletions;J===null?(K.deletions=[V],K.flags|=16):J.push(V)}}function o(K,V){if(!r)return null;for(;V!==null;)i(K,V),V=V.sibling;return null}function d(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function m(K,V){return K=gs(K,V),K.index=0,K.sibling=null,K}function x(K,V,J){return K.index=J,r?(J=K.alternate,J!==null?(J=J.index,J<V?(K.flags|=67108866,V):J):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function w(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function N(K,V,J,ce){return V===null||V.tag!==6?(V=Mf(J,K.mode,ce),V.return=K,V):(V=m(V,J),V.return=K,V)}function H(K,V,J,ce){var Be=J.type;return Be===j?oe(K,V,J.props.children,ce,J.key):V!==null&&(V.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===F&&Qi(Be)===V.type)?(V=m(V,J.props),io(V,J),V.return=K,V):(V=Jc(J.type,J.key,J.props,null,K.mode,ce),io(V,J),V.return=K,V)}function ee(K,V,J,ce){return V===null||V.tag!==4||V.stateNode.containerInfo!==J.containerInfo||V.stateNode.implementation!==J.implementation?(V=Rf(J,K.mode,ce),V.return=K,V):(V=m(V,J.children||[]),V.return=K,V)}function oe(K,V,J,ce,Be){return V===null||V.tag!==7?(V=Vi(J,K.mode,ce,Be),V.return=K,V):(V=m(V,J),V.return=K,V)}function ue(K,V,J){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Mf(""+V,K.mode,J),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case b:return J=Jc(V.type,V.key,V.props,null,K.mode,J),io(J,V),J.return=K,J;case _:return V=Rf(V,K.mode,J),V.return=K,V;case F:return V=Qi(V),ue(K,V,J)}if(G(V)||T(V))return V=Vi(V,K.mode,J,null),V.return=K,V;if(typeof V.then=="function")return ue(K,au(V),J);if(V.$$typeof===C)return ue(K,nu(K,V),J);lu(K,V)}return null}function ne(K,V,J,ce){var Be=V!==null?V.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Be!==null?null:N(K,V,""+J,ce);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return J.key===Be?H(K,V,J,ce):null;case _:return J.key===Be?ee(K,V,J,ce):null;case F:return J=Qi(J),ne(K,V,J,ce)}if(G(J)||T(J))return Be!==null?null:oe(K,V,J,ce,null);if(typeof J.then=="function")return ne(K,V,au(J),ce);if(J.$$typeof===C)return ne(K,V,nu(K,J),ce);lu(K,J)}return null}function ie(K,V,J,ce,Be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return K=K.get(J)||null,N(V,K,""+ce,Be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:return K=K.get(ce.key===null?J:ce.key)||null,H(V,K,ce,Be);case _:return K=K.get(ce.key===null?J:ce.key)||null,ee(V,K,ce,Be);case F:return ce=Qi(ce),ie(K,V,J,ce,Be)}if(G(ce)||T(ce))return K=K.get(J)||null,oe(V,K,ce,Be,null);if(typeof ce.then=="function")return ie(K,V,J,au(ce),Be);if(ce.$$typeof===C)return ie(K,V,J,nu(V,ce),Be);lu(V,ce)}return null}function Ee(K,V,J,ce){for(var Be=null,mt=null,Me=V,Je=V=0,ut=null;Me!==null&&Je<J.length;Je++){Me.index>Je?(ut=Me,Me=null):ut=Me.sibling;var gt=ne(K,Me,J[Je],ce);if(gt===null){Me===null&&(Me=ut);break}r&&Me&>.alternate===null&&i(K,Me),V=x(gt,V,Je),mt===null?Be=gt:mt.sibling=gt,mt=gt,Me=ut}if(Je===J.length)return o(K,Me),dt&&xs(K,Je),Be;if(Me===null){for(;Je<J.length;Je++)Me=ue(K,J[Je],ce),Me!==null&&(V=x(Me,V,Je),mt===null?Be=Me:mt.sibling=Me,mt=Me);return dt&&xs(K,Je),Be}for(Me=d(Me);Je<J.length;Je++)ut=ie(Me,K,Je,J[Je],ce),ut!==null&&(r&&ut.alternate!==null&&Me.delete(ut.key===null?Je:ut.key),V=x(ut,V,Je),mt===null?Be=ut:mt.sibling=ut,mt=ut);return r&&Me.forEach(function(_i){return i(K,_i)}),dt&&xs(K,Je),Be}function Ue(K,V,J,ce){if(J==null)throw Error(s(151));for(var Be=null,mt=null,Me=V,Je=V=0,ut=null,gt=J.next();Me!==null&&!gt.done;Je++,gt=J.next()){Me.index>Je?(ut=Me,Me=null):ut=Me.sibling;var _i=ne(K,Me,gt.value,ce);if(_i===null){Me===null&&(Me=ut);break}r&&Me&&_i.alternate===null&&i(K,Me),V=x(_i,V,Je),mt===null?Be=_i:mt.sibling=_i,mt=_i,Me=ut}if(gt.done)return o(K,Me),dt&&xs(K,Je),Be;if(Me===null){for(;!gt.done;Je++,gt=J.next())gt=ue(K,gt.value,ce),gt!==null&&(V=x(gt,V,Je),mt===null?Be=gt:mt.sibling=gt,mt=gt);return dt&&xs(K,Je),Be}for(Me=d(Me);!gt.done;Je++,gt=J.next())gt=ie(Me,K,Je,gt.value,ce),gt!==null&&(r&>.alternate!==null&&Me.delete(gt.key===null?Je:gt.key),V=x(gt,V,Je),mt===null?Be=gt:mt.sibling=gt,mt=gt);return r&&Me.forEach(function(cj){return i(K,cj)}),dt&&xs(K,Je),Be}function jt(K,V,J,ce){if(typeof J=="object"&&J!==null&&J.type===j&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case b:e:{for(var Be=J.key;V!==null;){if(V.key===Be){if(Be=J.type,Be===j){if(V.tag===7){o(K,V.sibling),ce=m(V,J.props.children),ce.return=K,K=ce;break e}}else if(V.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===F&&Qi(Be)===V.type){o(K,V.sibling),ce=m(V,J.props),io(ce,J),ce.return=K,K=ce;break e}o(K,V);break}else i(K,V);V=V.sibling}J.type===j?(ce=Vi(J.props.children,K.mode,ce,J.key),ce.return=K,K=ce):(ce=Jc(J.type,J.key,J.props,null,K.mode,ce),io(ce,J),ce.return=K,K=ce)}return w(K);case _:e:{for(Be=J.key;V!==null;){if(V.key===Be)if(V.tag===4&&V.stateNode.containerInfo===J.containerInfo&&V.stateNode.implementation===J.implementation){o(K,V.sibling),ce=m(V,J.children||[]),ce.return=K,K=ce;break e}else{o(K,V);break}else i(K,V);V=V.sibling}ce=Rf(J,K.mode,ce),ce.return=K,K=ce}return w(K);case F:return J=Qi(J),jt(K,V,J,ce)}if(G(J))return Ee(K,V,J,ce);if(T(J)){if(Be=T(J),typeof Be!="function")throw Error(s(150));return J=Be.call(J),Ue(K,V,J,ce)}if(typeof J.then=="function")return jt(K,V,au(J),ce);if(J.$$typeof===C)return jt(K,V,nu(K,J),ce);lu(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,V!==null&&V.tag===6?(o(K,V.sibling),ce=m(V,J),ce.return=K,K=ce):(o(K,V),ce=Mf(J,K.mode,ce),ce.return=K,K=ce),w(K)):o(K,V)}return function(K,V,J,ce){try{so=0;var Be=jt(K,V,J,ce);return Va=null,Be}catch(Me){if(Me===qa||Me===su)throw Me;var mt=ir(29,Me,null,K.mode);return mt.lanes=ce,mt.return=K,mt}finally{}}}var Zi=o0(!0),c0=o0(!1),si=!1;function qf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vf(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ii(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ai(r,i,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(xt&2)!==0){var m=d.pending;return m===null?i.next=i:(i.next=m.next,m.next=i),d.pending=i,i=Zc(r),Gx(r,null,o),i}return Kc(r,d,i,o),Zc(r)}function ao(r,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,o|=d,i.lanes=o,wa(r,o)}}function Gf(r,i){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,o=o.next}while(o!==null);x===null?m=x=i:x=x.next=i}else m=x=i;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=i:r.next=i,o.lastBaseUpdate=i}var Yf=!1;function lo(){if(Yf){var r=Ia;if(r!==null)throw r}}function oo(r,i,o,d){Yf=!1;var m=r.updateQueue;si=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var H=N,ee=H.next;H.next=null,w===null?x=ee:w.next=ee,w=H;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,N=oe.lastBaseUpdate,N!==w&&(N===null?oe.firstBaseUpdate=ee:N.next=ee,oe.lastBaseUpdate=H))}if(x!==null){var ue=m.baseState;w=0,oe=ee=H=null,N=x;do{var ne=N.lane&-536870913,ie=ne!==N.lane;if(ie?(ct&ne)===ne:(d&ne)===ne){ne!==0&&ne===Ha&&(Yf=!0),oe!==null&&(oe=oe.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ee=r,Ue=N;ne=i;var jt=o;switch(Ue.tag){case 1:if(Ee=Ue.payload,typeof Ee=="function"){ue=Ee.call(jt,ue,ne);break e}ue=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ue.payload,ne=typeof Ee=="function"?Ee.call(jt,ue,ne):Ee,ne==null)break e;ue=v({},ue,ne);break e;case 2:si=!0}}ne=N.callback,ne!==null&&(r.flags|=64,ie&&(r.flags|=8192),ie=m.callbacks,ie===null?m.callbacks=[ne]:ie.push(ne))}else ie={lane:ne,tag:N.tag,payload:N.payload,callback:N.callback,next:null},oe===null?(ee=oe=ie,H=ue):oe=oe.next=ie,w|=ne;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;ie=N,N=ie.next,ie.next=null,m.lastBaseUpdate=ie,m.shared.pending=null}}while(!0);oe===null&&(H=ue),m.baseState=H,m.firstBaseUpdate=ee,m.lastBaseUpdate=oe,x===null&&(m.shared.lanes=0),di|=w,r.lanes=w,r.memoizedState=ue}}function u0(r,i){if(typeof r!="function")throw Error(s(191,r));r.call(i)}function d0(r,i){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)u0(o[r],i)}var Ga=P(null),ou=P(0);function f0(r,i){r=Es,M(ou,r),M(Ga,i),Es=r|i.baseLanes}function Wf(){M(ou,Es),M(Ga,Ga.current)}function Xf(){Es=ou.current,Z(Ga),Z(ou)}var ar=P(null),Nr=null;function li(r){var i=r.alternate;M(en,en.current&1),M(ar,r),Nr===null&&(i===null||Ga.current!==null||i.memoizedState!==null)&&(Nr=r)}function Qf(r){M(en,en.current),M(ar,r),Nr===null&&(Nr=r)}function h0(r){r.tag===22?(M(en,en.current),M(ar,r),Nr===null&&(Nr=r)):oi()}function oi(){M(en,en.current),M(ar,ar.current)}function lr(r){Z(ar),Nr===r&&(Nr=null),Z(en)}var en=P(0);function cu(r){for(var i=r;i!==null;){if(i.tag===13){var o=i.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||np(o)||rp(o)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var ys=0,Ke=null,St=null,an=null,uu=!1,Ya=!1,Ji=!1,du=0,co=0,Wa=null,JS=0;function Qt(){throw Error(s(321))}function Kf(r,i){if(i===null)return!1;for(var o=0;o<i.length&&o<r.length;o++)if(!sr(r[o],i[o]))return!1;return!0}function Zf(r,i,o,d,m,x){return ys=x,Ke=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,$.H=r===null||r.memoizedState===null?Q0:hh,Ji=!1,x=o(d,m),Ji=!1,Ya&&(x=m0(i,o,d,m)),p0(r),x}function p0(r){$.H=ho;var i=St!==null&&St.next!==null;if(ys=0,an=St=Ke=null,uu=!1,co=0,Wa=null,i)throw Error(s(300));r===null||ln||(r=r.dependencies,r!==null&&tu(r)&&(ln=!0))}function m0(r,i,o,d){Ke=r;var m=0;do{if(Ya&&(Wa=null),co=0,Ya=!1,25<=m)throw Error(s(301));if(m+=1,an=St=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}$.H=K0,x=i(o,d)}while(Ya);return x}function ek(){var r=$.H,i=r.useState()[0];return i=typeof i.then=="function"?uo(i):i,r=r.useState()[0],(St!==null?St.memoizedState:null)!==r&&(Ke.flags|=1024),i}function Jf(){var r=du!==0;return du=0,r}function eh(r,i,o){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~o}function th(r){if(uu){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}uu=!1}ys=0,an=St=Ke=null,Ya=!1,co=du=0,Wa=null}function Bn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return an===null?Ke.memoizedState=an=r:an=an.next=r,an}function tn(){if(St===null){var r=Ke.alternate;r=r!==null?r.memoizedState:null}else r=St.next;var i=an===null?Ke.memoizedState:an.next;if(i!==null)an=i,St=r;else{if(r===null)throw Ke.alternate===null?Error(s(467)):Error(s(310));St=r,r={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},an===null?Ke.memoizedState=an=r:an=an.next=r}return an}function fu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uo(r){var i=co;return co+=1,Wa===null&&(Wa=[]),r=i0(Wa,r,i),i=Ke,(an===null?i.memoizedState:an.next)===null&&(i=i.alternate,$.H=i===null||i.memoizedState===null?Q0:hh),r}function hu(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return uo(r);if(r.$$typeof===C)return Sn(r)}throw Error(s(438,String(r)))}function nh(r){var i=null,o=Ke.updateQueue;if(o!==null&&(i=o.memoCache),i==null){var d=Ke.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(m){return m.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),o===null&&(o=fu(),Ke.updateQueue=o),o.memoCache=i,o=i.data[i.index],o===void 0)for(o=i.data[i.index]=Array(r),d=0;d<r;d++)o[d]=O;return i.index++,o}function _s(r,i){return typeof i=="function"?i(r):i}function pu(r){var i=tn();return rh(i,St,r)}function rh(r,i,o){var d=r.queue;if(d===null)throw Error(s(311));d.lastRenderedReducer=o;var m=r.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}i.baseQueue=m=x,d.pending=null}if(x=r.baseState,m===null)r.memoizedState=x;else{i=m.next;var N=w=null,H=null,ee=i,oe=!1;do{var ue=ee.lane&-536870913;if(ue!==ee.lane?(ct&ue)===ue:(ys&ue)===ue){var ne=ee.revertLane;if(ne===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ue===Ha&&(oe=!0);else if((ys&ne)===ne){ee=ee.next,ne===Ha&&(oe=!0);continue}else ue={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=ue,w=x):H=H.next=ue,Ke.lanes|=ne,di|=ne;ue=ee.action,Ji&&o(x,ue),x=ee.hasEagerState?ee.eagerState:o(x,ue)}else ne={lane:ue,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=ne,w=x):H=H.next=ne,Ke.lanes|=ue,di|=ue;ee=ee.next}while(ee!==null&&ee!==i);if(H===null?w=x:H.next=N,!sr(x,r.memoizedState)&&(ln=!0,oe&&(o=Ia,o!==null)))throw o;r.memoizedState=x,r.baseState=w,r.baseQueue=H,d.lastRenderedState=x}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function sh(r){var i=tn(),o=i.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=r;var d=o.dispatch,m=o.pending,x=i.memoizedState;if(m!==null){o.pending=null;var w=m=m.next;do x=r(x,w.action),w=w.next;while(w!==m);sr(x,i.memoizedState)||(ln=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),o.lastRenderedState=x}return[x,d]}function g0(r,i,o){var d=Ke,m=tn(),x=dt;if(x){if(o===void 0)throw Error(s(407));o=o()}else o=i();var w=!sr((St||m).memoizedState,o);if(w&&(m.memoizedState=o,ln=!0),m=m.queue,lh(b0.bind(null,d,m,r),[r]),m.getSnapshot!==i||w||an!==null&&an.memoizedState.tag&1){if(d.flags|=2048,Xa(9,{destroy:void 0},v0.bind(null,d,m,o,i),null),Et===null)throw Error(s(349));x||(ys&127)!==0||x0(d,i,o)}return o}function x0(r,i,o){r.flags|=16384,r={getSnapshot:i,value:o},i=Ke.updateQueue,i===null?(i=fu(),Ke.updateQueue=i,i.stores=[r]):(o=i.stores,o===null?i.stores=[r]:o.push(r))}function v0(r,i,o,d){i.value=o,i.getSnapshot=d,y0(i)&&_0(r)}function b0(r,i,o){return o(function(){y0(i)&&_0(r)})}function y0(r){var i=r.getSnapshot;r=r.value;try{var o=i();return!sr(r,o)}catch{return!0}}function _0(r){var i=qi(r,2);i!==null&&Qn(i,r,2)}function ih(r){var i=Bn();if(typeof r=="function"){var o=r;if(r=o(),Ji){hn(!0);try{o()}finally{hn(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:r},i}function w0(r,i,o,d){return r.baseState=o,rh(r,St,typeof d=="function"?d:_s)}function tk(r,i,o,d,m){if(xu(r))throw Error(s(485));if(r=i.action,r!==null){var x={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};$.T!==null?o(!0):x.isTransition=!1,d(x),o=i.pending,o===null?(x.next=i.pending=x,S0(i,x)):(x.next=o.next,i.pending=o.next=x)}}function S0(r,i){var o=i.action,d=i.payload,m=r.state;if(i.isTransition){var x=$.T,w={};$.T=w;try{var N=o(m,d),H=$.S;H!==null&&H(w,N),k0(r,i,N)}catch(ee){ah(r,i,ee)}finally{x!==null&&w.types!==null&&(x.types=w.types),$.T=x}}else try{x=o(m,d),k0(r,i,x)}catch(ee){ah(r,i,ee)}}function k0(r,i,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){j0(r,i,d)},function(d){return ah(r,i,d)}):j0(r,i,o)}function j0(r,i,o){i.status="fulfilled",i.value=o,N0(i),r.state=o,i=r.pending,i!==null&&(o=i.next,o===i?r.pending=null:(o=o.next,i.next=o,S0(r,o)))}function ah(r,i,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=o,N0(i),i=i.next;while(i!==d)}r.action=null}function N0(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function C0(r,i){return i}function E0(r,i){if(dt){var o=Et.formState;if(o!==null){e:{var d=Ke;if(dt){if(Pt){t:{for(var m=Pt,x=jr;m.nodeType!==8;){if(!x){m=null;break t}if(m=Cr(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Pt=Cr(m.nextSibling),d=m.data==="F!";break e}}ni(d)}d=!1}d&&(i=o[0])}}return o=Bn(),o.memoizedState=o.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:C0,lastRenderedState:i},o.queue=d,o=Y0.bind(null,Ke,d),d.dispatch=o,d=ih(!1),x=fh.bind(null,Ke,!1,d.queue),d=Bn(),m={state:i,dispatch:null,action:r,pending:null},d.queue=m,o=tk.bind(null,Ke,m,x,o),m.dispatch=o,d.memoizedState=r,[i,o,!1]}function T0(r){var i=tn();return A0(i,St,r)}function A0(r,i,o){if(i=rh(r,i,C0)[0],r=pu(_s)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=uo(i)}catch(w){throw w===qa?su:w}else d=i;i=tn();var m=i.queue,x=m.dispatch;return o!==i.memoizedState&&(Ke.flags|=2048,Xa(9,{destroy:void 0},nk.bind(null,m,o),null)),[d,x,r]}function nk(r,i){r.action=i}function M0(r){var i=tn(),o=St;if(o!==null)return A0(i,o,r);tn(),i=i.memoizedState,o=tn();var d=o.queue.dispatch;return o.memoizedState=r,[i,d,!1]}function Xa(r,i,o,d){return r={tag:r,create:o,deps:d,inst:i,next:null},i=Ke.updateQueue,i===null&&(i=fu(),Ke.updateQueue=i),o=i.lastEffect,o===null?i.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,i.lastEffect=r),r}function R0(){return tn().memoizedState}function mu(r,i,o,d){var m=Bn();Ke.flags|=r,m.memoizedState=Xa(1|i,{destroy:void 0},o,d===void 0?null:d)}function gu(r,i,o,d){var m=tn();d=d===void 0?null:d;var x=m.memoizedState.inst;St!==null&&d!==null&&Kf(d,St.memoizedState.deps)?m.memoizedState=Xa(i,x,o,d):(Ke.flags|=r,m.memoizedState=Xa(1|i,x,o,d))}function z0(r,i){mu(8390656,8,r,i)}function lh(r,i){gu(2048,8,r,i)}function rk(r){Ke.flags|=4;var i=Ke.updateQueue;if(i===null)i=fu(),Ke.updateQueue=i,i.events=[r];else{var o=i.events;o===null?i.events=[r]:o.push(r)}}function L0(r){var i=tn().memoizedState;return rk({ref:i,nextImpl:r}),function(){if((xt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function D0(r,i){return gu(4,2,r,i)}function O0(r,i){return gu(4,4,r,i)}function B0(r,i){if(typeof i=="function"){r=r();var o=i(r);return function(){typeof o=="function"?o():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function P0(r,i,o){o=o!=null?o.concat([r]):null,gu(4,4,B0.bind(null,i,r),o)}function oh(){}function $0(r,i){var o=tn();i=i===void 0?null:i;var d=o.memoizedState;return i!==null&&Kf(i,d[1])?d[0]:(o.memoizedState=[r,i],r)}function U0(r,i){var o=tn();i=i===void 0?null:i;var d=o.memoizedState;if(i!==null&&Kf(i,d[1]))return d[0];if(d=r(),Ji){hn(!0);try{r()}finally{hn(!1)}}return o.memoizedState=[d,i],d}function ch(r,i,o){return o===void 0||(ys&1073741824)!==0&&(ct&261930)===0?r.memoizedState=i:(r.memoizedState=o,r=Fv(),Ke.lanes|=r,di|=r,o)}function F0(r,i,o,d){return sr(o,i)?o:Ga.current!==null?(r=ch(r,o,d),sr(r,i)||(ln=!0),r):(ys&42)===0||(ys&1073741824)!==0&&(ct&261930)===0?(ln=!0,r.memoizedState=o):(r=Fv(),Ke.lanes|=r,di|=r,i)}function H0(r,i,o,d,m){var x=z.p;z.p=x!==0&&8>x?x:8;var w=$.T,N={};$.T=N,fh(r,!1,i,o);try{var H=m(),ee=$.S;if(ee!==null&&ee(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=ZS(H,d);fo(r,i,oe,ur(r))}else fo(r,i,d,ur(r))}catch(ue){fo(r,i,{then:function(){},status:"rejected",reason:ue},ur())}finally{z.p=x,w!==null&&N.types!==null&&(w.types=N.types),$.T=w}}function sk(){}function uh(r,i,o,d){if(r.tag!==5)throw Error(s(476));var m=I0(r).queue;H0(r,m,i,re,o===null?sk:function(){return q0(r),o(d)})}function I0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:re},next:null};var o={};return i.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:o},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function q0(r){var i=I0(r);i.next===null&&(i=r.alternate.memoizedState),fo(r,i.next.queue,{},ur())}function dh(){return Sn(To)}function V0(){return tn().memoizedState}function G0(){return tn().memoizedState}function ik(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var o=ur();r=ii(o);var d=ai(i,r,o);d!==null&&(Qn(d,i,o),ao(d,i,o)),i={cache:Uf()},r.payload=i;return}i=i.return}}function ak(r,i,o){var d=ur();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},xu(r)?W0(i,o):(o=Tf(r,i,o,d),o!==null&&(Qn(o,r,d),X0(o,i,d)))}function Y0(r,i,o){var d=ur();fo(r,i,o,d)}function fo(r,i,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(xu(r))W0(i,m);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var w=i.lastRenderedState,N=x(w,o);if(m.hasEagerState=!0,m.eagerState=N,sr(N,w))return Kc(r,i,m,0),Et===null&&Qc(),!1}catch{}finally{}if(o=Tf(r,i,m,d),o!==null)return Qn(o,r,d),X0(o,i,d),!0}return!1}function fh(r,i,o,d){if(d={lane:2,revertLane:qh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},xu(r)){if(i)throw Error(s(479))}else i=Tf(r,o,d,2),i!==null&&Qn(i,r,2)}function xu(r){var i=r.alternate;return r===Ke||i!==null&&i===Ke}function W0(r,i){Ya=uu=!0;var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}function X0(r,i,o){if((o&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,o|=d,i.lanes=o,wa(r,o)}}var ho={readContext:Sn,use:hu,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt};ho.useEffectEvent=Qt;var Q0={readContext:Sn,use:hu,useCallback:function(r,i){return Bn().memoizedState=[r,i===void 0?null:i],r},useContext:Sn,useEffect:z0,useImperativeHandle:function(r,i,o){o=o!=null?o.concat([r]):null,mu(4194308,4,B0.bind(null,i,r),o)},useLayoutEffect:function(r,i){return mu(4194308,4,r,i)},useInsertionEffect:function(r,i){mu(4,2,r,i)},useMemo:function(r,i){var o=Bn();i=i===void 0?null:i;var d=r();if(Ji){hn(!0);try{r()}finally{hn(!1)}}return o.memoizedState=[d,i],d},useReducer:function(r,i,o){var d=Bn();if(o!==void 0){var m=o(i);if(Ji){hn(!0);try{o(i)}finally{hn(!1)}}}else m=i;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=ak.bind(null,Ke,r),[d.memoizedState,r]},useRef:function(r){var i=Bn();return r={current:r},i.memoizedState=r},useState:function(r){r=ih(r);var i=r.queue,o=Y0.bind(null,Ke,i);return i.dispatch=o,[r.memoizedState,o]},useDebugValue:oh,useDeferredValue:function(r,i){var o=Bn();return ch(o,r,i)},useTransition:function(){var r=ih(!1);return r=H0.bind(null,Ke,r.queue,!0,!1),Bn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,o){var d=Ke,m=Bn();if(dt){if(o===void 0)throw Error(s(407));o=o()}else{if(o=i(),Et===null)throw Error(s(349));(ct&127)!==0||x0(d,i,o)}m.memoizedState=o;var x={value:o,getSnapshot:i};return m.queue=x,z0(b0.bind(null,d,x,r),[r]),d.flags|=2048,Xa(9,{destroy:void 0},v0.bind(null,d,x,o,i),null),o},useId:function(){var r=Bn(),i=Et.identifierPrefix;if(dt){var o=es,d=Jr;o=(d&~(1<<32-Ze(d)-1)).toString(32)+o,i="_"+i+"R_"+o,o=du++,0<o&&(i+="H"+o.toString(32)),i+="_"}else o=JS++,i="_"+i+"r_"+o.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:dh,useFormState:E0,useActionState:E0,useOptimistic:function(r){var i=Bn();i.memoizedState=i.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=o,i=fh.bind(null,Ke,!0,o),o.dispatch=i,[r,i]},useMemoCache:nh,useCacheRefresh:function(){return Bn().memoizedState=ik.bind(null,Ke)},useEffectEvent:function(r){var i=Bn(),o={impl:r};return i.memoizedState=o,function(){if((xt&2)!==0)throw Error(s(440));return o.impl.apply(void 0,arguments)}}},hh={readContext:Sn,use:hu,useCallback:$0,useContext:Sn,useEffect:lh,useImperativeHandle:P0,useInsertionEffect:D0,useLayoutEffect:O0,useMemo:U0,useReducer:pu,useRef:R0,useState:function(){return pu(_s)},useDebugValue:oh,useDeferredValue:function(r,i){var o=tn();return F0(o,St.memoizedState,r,i)},useTransition:function(){var r=pu(_s)[0],i=tn().memoizedState;return[typeof r=="boolean"?r:uo(r),i]},useSyncExternalStore:g0,useId:V0,useHostTransitionStatus:dh,useFormState:T0,useActionState:T0,useOptimistic:function(r,i){var o=tn();return w0(o,St,r,i)},useMemoCache:nh,useCacheRefresh:G0};hh.useEffectEvent=L0;var K0={readContext:Sn,use:hu,useCallback:$0,useContext:Sn,useEffect:lh,useImperativeHandle:P0,useInsertionEffect:D0,useLayoutEffect:O0,useMemo:U0,useReducer:sh,useRef:R0,useState:function(){return sh(_s)},useDebugValue:oh,useDeferredValue:function(r,i){var o=tn();return St===null?ch(o,r,i):F0(o,St.memoizedState,r,i)},useTransition:function(){var r=sh(_s)[0],i=tn().memoizedState;return[typeof r=="boolean"?r:uo(r),i]},useSyncExternalStore:g0,useId:V0,useHostTransitionStatus:dh,useFormState:M0,useActionState:M0,useOptimistic:function(r,i){var o=tn();return St!==null?w0(o,St,r,i):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:nh,useCacheRefresh:G0};K0.useEffectEvent=L0;function ph(r,i,o,d){i=r.memoizedState,o=o(d,i),o=o==null?i:v({},i,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var mh={enqueueSetState:function(r,i,o){r=r._reactInternals;var d=ur(),m=ii(d);m.payload=i,o!=null&&(m.callback=o),i=ai(r,m,d),i!==null&&(Qn(i,r,d),ao(i,r,d))},enqueueReplaceState:function(r,i,o){r=r._reactInternals;var d=ur(),m=ii(d);m.tag=1,m.payload=i,o!=null&&(m.callback=o),i=ai(r,m,d),i!==null&&(Qn(i,r,d),ao(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var o=ur(),d=ii(o);d.tag=2,i!=null&&(d.callback=i),i=ai(r,d,o),i!==null&&(Qn(i,r,o),ao(i,r,o))}};function Z0(r,i,o,d,m,x,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,w):i.prototype&&i.prototype.isPureReactComponent?!Zl(o,d)||!Zl(m,x):!0}function J0(r,i,o,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(o,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(o,d),i.state!==r&&mh.enqueueReplaceState(i,i.state,null)}function ea(r,i){var o=i;if("ref"in i){o={};for(var d in i)d!=="ref"&&(o[d]=i[d])}if(r=r.defaultProps){o===i&&(o=v({},o));for(var m in r)o[m]===void 0&&(o[m]=r[m])}return o}function ev(r){Xc(r)}function tv(r){console.error(r)}function nv(r){Xc(r)}function vu(r,i){try{var o=r.onUncaughtError;o(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function rv(r,i,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function gh(r,i,o){return o=ii(o),o.tag=3,o.payload={element:null},o.callback=function(){vu(r,i)},o}function sv(r){return r=ii(r),r.tag=3,r}function iv(r,i,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;r.payload=function(){return m(x)},r.callback=function(){rv(i,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){rv(i,o,d),typeof m!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var N=d.stack;this.componentDidCatch(d.value,{componentStack:N!==null?N:""})})}function lk(r,i,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=o.alternate,i!==null&&Fa(i,o,m,!0),o=ar.current,o!==null){switch(o.tag){case 31:case 13:return Nr===null?Au():o.alternate===null&&Kt===0&&(Kt=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===iu?o.flags|=16384:(i=o.updateQueue,i===null?o.updateQueue=new Set([d]):i.add(d),Fh(r,d,m)),!1;case 22:return o.flags|=65536,d===iu?o.flags|=16384:(i=o.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=i):(o=i.retryQueue,o===null?i.retryQueue=new Set([d]):o.add(d)),Fh(r,d,m)),!1}throw Error(s(435,o.tag))}return Fh(r,d,m),Au(),!1}if(dt)return i=ar.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=m,d!==Df&&(r=Error(s(422),{cause:d}),to(wr(r,o)))):(d!==Df&&(i=Error(s(423),{cause:d}),to(wr(i,o))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=wr(d,o),m=gh(r.stateNode,d,m),Gf(r,m),Kt!==4&&(Kt=2)),!1;var x=Error(s(520),{cause:d});if(x=wr(x,o),_o===null?_o=[x]:_o.push(x),Kt!==4&&(Kt=2),i===null)return!0;d=wr(d,o),o=i;do{switch(o.tag){case 3:return o.flags|=65536,r=m&-m,o.lanes|=r,r=gh(o.stateNode,d,r),Gf(o,r),!1;case 1:if(i=o.type,x=o.stateNode,(o.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(fi===null||!fi.has(x))))return o.flags|=65536,m&=-m,o.lanes|=m,m=sv(m),iv(m,r,o,d),Gf(o,m),!1}o=o.return}while(o!==null);return!1}var xh=Error(s(461)),ln=!1;function kn(r,i,o,d){i.child=r===null?c0(i,null,o,d):Zi(i,r.child,o,d)}function av(r,i,o,d,m){o=o.render;var x=i.ref;if("ref"in d){var w={};for(var N in d)N!=="ref"&&(w[N]=d[N])}else w=d;return Wi(i),d=Zf(r,i,o,w,x,m),N=Jf(),r!==null&&!ln?(eh(r,i,m),ws(r,i,m)):(dt&&N&&zf(i),i.flags|=1,kn(r,i,d,m),i.child)}function lv(r,i,o,d,m){if(r===null){var x=o.type;return typeof x=="function"&&!Af(x)&&x.defaultProps===void 0&&o.compare===null?(i.tag=15,i.type=x,ov(r,i,x,d,m)):(r=Jc(o.type,null,d,i,i.mode,m),r.ref=i.ref,r.return=i,i.child=r)}if(x=r.child,!jh(r,m)){var w=x.memoizedProps;if(o=o.compare,o=o!==null?o:Zl,o(w,d)&&r.ref===i.ref)return ws(r,i,m)}return i.flags|=1,r=gs(x,d),r.ref=i.ref,r.return=i,i.child=r}function ov(r,i,o,d,m){if(r!==null){var x=r.memoizedProps;if(Zl(x,d)&&r.ref===i.ref)if(ln=!1,i.pendingProps=d=x,jh(r,m))(r.flags&131072)!==0&&(ln=!0);else return i.lanes=r.lanes,ws(r,i,m)}return vh(r,i,o,d,m)}function cv(r,i,o,d){var m=d.children,x=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,r!==null){for(d=i.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,i.child=null;return uv(r,i,x,o,d)}if((o&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&ru(i,x!==null?x.cachePool:null),x!==null?f0(i,x):Wf(),h0(i);else return d=i.lanes=536870912,uv(r,i,x!==null?x.baseLanes|o:o,o,d)}else x!==null?(ru(i,x.cachePool),f0(i,x),oi(),i.memoizedState=null):(r!==null&&ru(i,null),Wf(),oi());return kn(r,i,m,o),i.child}function po(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function uv(r,i,o,d,m){var x=Hf();return x=x===null?null:{parent:sn._currentValue,pool:x},i.memoizedState={baseLanes:o,cachePool:x},r!==null&&ru(i,null),Wf(),h0(i),r!==null&&Fa(r,i,d,!0),i.childLanes=m,null}function bu(r,i){return i=_u({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function dv(r,i,o){return Zi(i,r.child,null,o),r=bu(i,i.pendingProps),r.flags|=2,lr(i),i.memoizedState=null,r}function ok(r,i,o){var d=i.pendingProps,m=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(dt){if(d.mode==="hidden")return r=bu(i,d),i.lanes=536870912,po(null,r);if(Qf(i),(r=Pt)?(r=S1(r,jr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ei!==null?{id:Jr,overflow:es}:null,retryLane:536870912,hydrationErrors:null},o=Wx(r),o.return=i,i.child=o,wn=i,Pt=null)):r=null,r===null)throw ni(i);return i.lanes=536870912,null}return bu(i,d)}var x=r.memoizedState;if(x!==null){var w=x.dehydrated;if(Qf(i),m)if(i.flags&256)i.flags&=-257,i=dv(r,i,o);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(s(558));else if(ln||Fa(r,i,o,!1),m=(o&r.childLanes)!==0,ln||m){if(d=Et,d!==null&&(w=Pl(d,o),w!==0&&w!==x.retryLane))throw x.retryLane=w,qi(r,w),Qn(d,r,w),xh;Au(),i=dv(r,i,o)}else r=x.treeContext,Pt=Cr(w.nextSibling),wn=i,dt=!0,ti=null,jr=!1,r!==null&&Kx(i,r),i=bu(i,d),i.flags|=4096;return i}return r=gs(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function yu(r,i){var o=i.ref;if(o===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(s(284));(r===null||r.ref!==o)&&(i.flags|=4194816)}}function vh(r,i,o,d,m){return Wi(i),o=Zf(r,i,o,d,void 0,m),d=Jf(),r!==null&&!ln?(eh(r,i,m),ws(r,i,m)):(dt&&d&&zf(i),i.flags|=1,kn(r,i,o,m),i.child)}function fv(r,i,o,d,m,x){return Wi(i),i.updateQueue=null,o=m0(i,d,o,m),p0(r),d=Jf(),r!==null&&!ln?(eh(r,i,x),ws(r,i,x)):(dt&&d&&zf(i),i.flags|=1,kn(r,i,o,x),i.child)}function hv(r,i,o,d,m){if(Wi(i),i.stateNode===null){var x=Ba,w=o.contextType;typeof w=="object"&&w!==null&&(x=Sn(w)),x=new o(d,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=mh,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=d,x.state=i.memoizedState,x.refs={},qf(i),w=o.contextType,x.context=typeof w=="object"&&w!==null?Sn(w):Ba,x.state=i.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(ph(i,o,w,d),x.state=i.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&mh.enqueueReplaceState(x,x.state,null),oo(i,d,x,m),lo(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){x=i.stateNode;var N=i.memoizedProps,H=ea(o,N);x.props=H;var ee=x.context,oe=o.contextType;w=Ba,typeof oe=="object"&&oe!==null&&(w=Sn(oe));var ue=o.getDerivedStateFromProps;oe=typeof ue=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=i.pendingProps!==N,oe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||ee!==w)&&J0(i,x,d,w),si=!1;var ne=i.memoizedState;x.state=ne,oo(i,d,x,m),lo(),ee=i.memoizedState,N||ne!==ee||si?(typeof ue=="function"&&(ph(i,o,ue,d),ee=i.memoizedState),(H=si||Z0(i,o,H,d,ne,ee,w))?(oe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=ee),x.props=d,x.state=ee,x.context=w,d=H):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{x=i.stateNode,Vf(r,i),w=i.memoizedProps,oe=ea(o,w),x.props=oe,ue=i.pendingProps,ne=x.context,ee=o.contextType,H=Ba,typeof ee=="object"&&ee!==null&&(H=Sn(ee)),N=o.getDerivedStateFromProps,(ee=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ue||ne!==H)&&J0(i,x,d,H),si=!1,ne=i.memoizedState,x.state=ne,oo(i,d,x,m),lo();var ie=i.memoizedState;w!==ue||ne!==ie||si||r!==null&&r.dependencies!==null&&tu(r.dependencies)?(typeof N=="function"&&(ph(i,o,N,d),ie=i.memoizedState),(oe=si||Z0(i,o,oe,d,ne,ie,H)||r!==null&&r.dependencies!==null&&tu(r.dependencies))?(ee||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,ie,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,ie,H)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=ie),x.props=d,x.state=ie,x.context=H,d=oe):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),d=!1)}return x=d,yu(r,i),d=(i.flags&128)!==0,x||d?(x=i.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,r!==null&&d?(i.child=Zi(i,r.child,null,m),i.child=Zi(i,null,o,m)):kn(r,i,o,m),i.memoizedState=x.state,r=i.child):r=ws(r,i,m),r}function pv(r,i,o,d){return Gi(),i.flags|=256,kn(r,i,o,d),i.child}var bh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yh(r){return{baseLanes:r,cachePool:r0()}}function _h(r,i,o){return r=r!==null?r.childLanes&~o:0,i&&(r|=cr),r}function mv(r,i,o){var d=i.pendingProps,m=!1,x=(i.flags&128)!==0,w;if((w=x)||(w=r!==null&&r.memoizedState===null?!1:(en.current&2)!==0),w&&(m=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,r===null){if(dt){if(m?li(i):oi(),(r=Pt)?(r=S1(r,jr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ei!==null?{id:Jr,overflow:es}:null,retryLane:536870912,hydrationErrors:null},o=Wx(r),o.return=i,i.child=o,wn=i,Pt=null)):r=null,r===null)throw ni(i);return rp(r)?i.lanes=32:i.lanes=536870912,null}var N=d.children;return d=d.fallback,m?(oi(),m=i.mode,N=_u({mode:"hidden",children:N},m),d=Vi(d,m,o,null),N.return=i,d.return=i,N.sibling=d,i.child=N,d=i.child,d.memoizedState=yh(o),d.childLanes=_h(r,w,o),i.memoizedState=bh,po(null,d)):(li(i),wh(i,N))}var H=r.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(x)i.flags&256?(li(i),i.flags&=-257,i=Sh(r,i,o)):i.memoizedState!==null?(oi(),i.child=r.child,i.flags|=128,i=null):(oi(),N=d.fallback,m=i.mode,d=_u({mode:"visible",children:d.children},m),N=Vi(N,m,o,null),N.flags|=2,d.return=i,N.return=i,d.sibling=N,i.child=d,Zi(i,r.child,null,o),d=i.child,d.memoizedState=yh(o),d.childLanes=_h(r,w,o),i.memoizedState=bh,i=po(null,d));else if(li(i),rp(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var ee=w.dgst;w=ee,d=Error(s(419)),d.stack="",d.digest=w,to({value:d,source:null,stack:null}),i=Sh(r,i,o)}else if(ln||Fa(r,i,o,!1),w=(o&r.childLanes)!==0,ln||w){if(w=Et,w!==null&&(d=Pl(w,o),d!==0&&d!==H.retryLane))throw H.retryLane=d,qi(r,d),Qn(w,r,d),xh;np(N)||Au(),i=Sh(r,i,o)}else np(N)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,Pt=Cr(N.nextSibling),wn=i,dt=!0,ti=null,jr=!1,r!==null&&Kx(i,r),i=wh(i,d.children),i.flags|=4096);return i}return m?(oi(),N=d.fallback,m=i.mode,H=r.child,ee=H.sibling,d=gs(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,ee!==null?N=gs(ee,N):(N=Vi(N,m,o,null),N.flags|=2),N.return=i,d.return=i,d.sibling=N,i.child=d,po(null,d),d=i.child,N=r.child.memoizedState,N===null?N=yh(o):(m=N.cachePool,m!==null?(H=sn._currentValue,m=m.parent!==H?{parent:H,pool:H}:m):m=r0(),N={baseLanes:N.baseLanes|o,cachePool:m}),d.memoizedState=N,d.childLanes=_h(r,w,o),i.memoizedState=bh,po(r.child,d)):(li(i),o=r.child,r=o.sibling,o=gs(o,{mode:"visible",children:d.children}),o.return=i,o.sibling=null,r!==null&&(w=i.deletions,w===null?(i.deletions=[r],i.flags|=16):w.push(r)),i.child=o,i.memoizedState=null,o)}function wh(r,i){return i=_u({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function _u(r,i){return r=ir(22,r,null,i),r.lanes=0,r}function Sh(r,i,o){return Zi(i,r.child,null,o),r=wh(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function gv(r,i,o){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),Pf(r.return,i,o)}function kh(r,i,o,d,m,x){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:x}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=m,w.treeForkCount=x)}function xv(r,i,o){var d=i.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=en.current,N=(w&2)!==0;if(N?(w=w&1|2,i.flags|=128):w&=1,M(en,w),kn(r,i,d,o),d=dt?eo:0,!N&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&gv(r,o,i);else if(r.tag===19)gv(r,o,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(o=i.child,m=null;o!==null;)r=o.alternate,r!==null&&cu(r)===null&&(m=o),o=o.sibling;o=m,o===null?(m=i.child,i.child=null):(m=o.sibling,o.sibling=null),kh(i,!1,m,o,x,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=i.child,i.child=null;m!==null;){if(r=m.alternate,r!==null&&cu(r)===null){i.child=m;break}r=m.sibling,m.sibling=o,o=m,m=r}kh(i,!0,o,null,x,d);break;case"together":kh(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function ws(r,i,o){if(r!==null&&(i.dependencies=r.dependencies),di|=i.lanes,(o&i.childLanes)===0)if(r!==null){if(Fa(r,i,o,!1),(o&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(s(153));if(i.child!==null){for(r=i.child,o=gs(r,r.pendingProps),i.child=o,o.return=i;r.sibling!==null;)r=r.sibling,o=o.sibling=gs(r,r.pendingProps),o.return=i;o.sibling=null}return i.child}function jh(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&tu(r)))}function ck(r,i,o){switch(i.tag){case 3:ze(i,i.stateNode.containerInfo),ri(i,sn,r.memoizedState.cache),Gi();break;case 27:case 5:et(i);break;case 4:ze(i,i.stateNode.containerInfo);break;case 10:ri(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Qf(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(li(i),i.flags|=128,null):(o&i.child.childLanes)!==0?mv(r,i,o):(li(i),r=ws(r,i,o),r!==null?r.sibling:null);li(i);break;case 19:var m=(r.flags&128)!==0;if(d=(o&i.childLanes)!==0,d||(Fa(r,i,o,!1),d=(o&i.childLanes)!==0),m){if(d)return xv(r,i,o);i.flags|=128}if(m=i.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),M(en,en.current),d)break;return null;case 22:return i.lanes=0,cv(r,i,o,i.pendingProps);case 24:ri(i,sn,r.memoizedState.cache)}return ws(r,i,o)}function vv(r,i,o){if(r!==null)if(r.memoizedProps!==i.pendingProps)ln=!0;else{if(!jh(r,o)&&(i.flags&128)===0)return ln=!1,ck(r,i,o);ln=(r.flags&131072)!==0}else ln=!1,dt&&(i.flags&1048576)!==0&&Qx(i,eo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Qi(i.elementType),i.type=r,typeof r=="function")Af(r)?(d=ea(r,d),i.tag=1,i=hv(null,i,r,d,o)):(i.tag=0,i=vh(null,i,r,d,o));else{if(r!=null){var m=r.$$typeof;if(m===L){i.tag=11,i=av(null,i,r,d,o);break e}else if(m===U){i.tag=14,i=lv(null,i,r,d,o);break e}}throw i=Q(r)||r,Error(s(306,i,""))}}return i;case 0:return vh(r,i,i.type,i.pendingProps,o);case 1:return d=i.type,m=ea(d,i.pendingProps),hv(r,i,d,m,o);case 3:e:{if(ze(i,i.stateNode.containerInfo),r===null)throw Error(s(387));d=i.pendingProps;var x=i.memoizedState;m=x.element,Vf(r,i),oo(i,d,null,o);var w=i.memoizedState;if(d=w.cache,ri(i,sn,d),d!==x.cache&&$f(i,[sn],o,!0),lo(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=pv(r,i,d,o);break e}else if(d!==m){m=wr(Error(s(424)),i),to(m),i=pv(r,i,d,o);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Pt=Cr(r.firstChild),wn=i,dt=!0,ti=null,jr=!0,o=c0(i,null,d,o),i.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(Gi(),d===m){i=ws(r,i,o);break e}kn(r,i,d,o)}i=i.child}return i;case 26:return yu(r,i),r===null?(o=T1(i.type,null,i.pendingProps,null))?i.memoizedState=o:dt||(o=i.type,r=i.pendingProps,d=Bu(Ce.current).createElement(o),d[Ht]=i,d[_n]=r,jn(d,o,r),Yt(d),i.stateNode=d):i.memoizedState=T1(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return et(i),r===null&&dt&&(d=i.stateNode=N1(i.type,i.pendingProps,Ce.current),wn=i,jr=!0,m=Pt,gi(i.type)?(sp=m,Pt=Cr(d.firstChild)):Pt=m),kn(r,i,i.pendingProps.children,o),yu(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&dt&&((m=d=Pt)&&(d=$k(d,i.type,i.pendingProps,jr),d!==null?(i.stateNode=d,wn=i,Pt=Cr(d.firstChild),jr=!1,m=!0):m=!1),m||ni(i)),et(i),m=i.type,x=i.pendingProps,w=r!==null?r.memoizedProps:null,d=x.children,Jh(m,x)?d=null:w!==null&&Jh(m,w)&&(i.flags|=32),i.memoizedState!==null&&(m=Zf(r,i,ek,null,null,o),To._currentValue=m),yu(r,i),kn(r,i,d,o),i.child;case 6:return r===null&&dt&&((r=o=Pt)&&(o=Uk(o,i.pendingProps,jr),o!==null?(i.stateNode=o,wn=i,Pt=null,r=!0):r=!1),r||ni(i)),null;case 13:return mv(r,i,o);case 4:return ze(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Zi(i,null,d,o):kn(r,i,d,o),i.child;case 11:return av(r,i,i.type,i.pendingProps,o);case 7:return kn(r,i,i.pendingProps,o),i.child;case 8:return kn(r,i,i.pendingProps.children,o),i.child;case 12:return kn(r,i,i.pendingProps.children,o),i.child;case 10:return d=i.pendingProps,ri(i,i.type,d.value),kn(r,i,d.children,o),i.child;case 9:return m=i.type._context,d=i.pendingProps.children,Wi(i),m=Sn(m),d=d(m),i.flags|=1,kn(r,i,d,o),i.child;case 14:return lv(r,i,i.type,i.pendingProps,o);case 15:return ov(r,i,i.type,i.pendingProps,o);case 19:return xv(r,i,o);case 31:return ok(r,i,o);case 22:return cv(r,i,o,i.pendingProps);case 24:return Wi(i),d=Sn(sn),r===null?(m=Hf(),m===null&&(m=Et,x=Uf(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=o),m=x),i.memoizedState={parent:d,cache:m},qf(i),ri(i,sn,m)):((r.lanes&o)!==0&&(Vf(r,i),oo(i,null,null,o),lo()),m=r.memoizedState,x=i.memoizedState,m.parent!==d?(m={parent:d,cache:d},i.memoizedState=m,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=m),ri(i,sn,d)):(d=x.cache,ri(i,sn,d),d!==m.cache&&$f(i,[sn],o,!0))),kn(r,i,i.pendingProps.children,o),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Ss(r){r.flags|=4}function Nh(r,i,o,d,m){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if(Vv())r.flags|=8192;else throw Ki=iu,If}else r.flags&=-16777217}function bv(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!L1(i))if(Vv())r.flags|=8192;else throw Ki=iu,If}function wu(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?rn():536870912,r.lanes|=i,Ja|=i)}function mo(r,i){if(!dt)switch(r.tailMode){case"hidden":i=r.tail;for(var o=null;i!==null;)i.alternate!==null&&(o=i),i=i.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function $t(r){var i=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(i)for(var m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=o,i}function uk(r,i,o){var d=i.pendingProps;switch(Lf(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $t(i),null;case 1:return $t(i),null;case 3:return o=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),bs(sn),De(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(Ua(i)?Ss(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Of())),$t(i),null;case 26:var m=i.type,x=i.memoizedState;return r===null?(Ss(i),x!==null?($t(i),bv(i,x)):($t(i),Nh(i,m,null,d,o))):x?x!==r.memoizedState?(Ss(i),$t(i),bv(i,x)):($t(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Ss(i),$t(i),Nh(i,m,r,d,o)),null;case 27:if(xe(i),o=Ce.current,m=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ss(i);else{if(!d){if(i.stateNode===null)throw Error(s(166));return $t(i),null}r=pe.current,Ua(i)?Zx(i):(r=N1(m,d,o),i.stateNode=r,Ss(i))}return $t(i),null;case 5:if(xe(i),m=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ss(i);else{if(!d){if(i.stateNode===null)throw Error(s(166));return $t(i),null}if(x=pe.current,Ua(i))Zx(i);else{var w=Bu(Ce.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}x[Ht]=i,x[_n]=d;e:for(w=i.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===i)break e;for(;w.sibling===null;){if(w.return===null||w.return===i)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}i.stateNode=x;e:switch(jn(x,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Ss(i)}}return $t(i),Nh(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,o),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Ss(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(s(166));if(r=Ce.current,Ua(i)){if(r=i.stateNode,o=i.memoizedProps,d=null,m=wn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Ht]=i,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||m1(r.nodeValue,o)),r||ni(i,!0)}else r=Bu(r).createTextNode(d),r[Ht]=i,i.stateNode=r}return $t(i),null;case 31:if(o=i.memoizedState,r===null||r.memoizedState!==null){if(d=Ua(i),o!==null){if(r===null){if(!d)throw Error(s(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(557));r[Ht]=i}else Gi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;$t(i),r=!1}else o=Of(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return i.flags&256?(lr(i),i):(lr(i),null);if((i.flags&128)!==0)throw Error(s(558))}return $t(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=Ua(i),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(s(318));if(m=i.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(s(317));m[Ht]=i}else Gi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;$t(i),m=!1}else m=Of(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return i.flags&256?(lr(i),i):(lr(i),null)}return lr(i),(i.flags&128)!==0?(i.lanes=o,i):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=i.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==m&&(d.flags|=2048)),o!==r&&o&&(i.child.flags|=8192),wu(i,i.updateQueue),$t(i),null);case 4:return De(),r===null&&Wh(i.stateNode.containerInfo),$t(i),null;case 10:return bs(i.type),$t(i),null;case 19:if(Z(en),d=i.memoizedState,d===null)return $t(i),null;if(m=(i.flags&128)!==0,x=d.rendering,x===null)if(m)mo(d,!1);else{if(Kt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(x=cu(r),x!==null){for(i.flags|=128,mo(d,!1),r=x.updateQueue,i.updateQueue=r,wu(i,r),i.subtreeFlags=0,r=o,o=i.child;o!==null;)Yx(o,r),o=o.sibling;return M(en,en.current&1|2),dt&&xs(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&qe()>Cu&&(i.flags|=128,m=!0,mo(d,!1),i.lanes=4194304)}else{if(!m)if(r=cu(x),r!==null){if(i.flags|=128,m=!0,r=r.updateQueue,i.updateQueue=r,wu(i,r),mo(d,!0),d.tail===null&&d.tailMode==="hidden"&&!x.alternate&&!dt)return $t(i),null}else 2*qe()-d.renderingStartTime>Cu&&o!==536870912&&(i.flags|=128,m=!0,mo(d,!1),i.lanes=4194304);d.isBackwards?(x.sibling=i.child,i.child=x):(r=d.last,r!==null?r.sibling=x:i.child=x,d.last=x)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=qe(),r.sibling=null,o=en.current,M(en,m?o&1|2:o&1),dt&&xs(i,d.treeForkCount),r):($t(i),null);case 22:case 23:return lr(i),Xf(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(o&536870912)!==0&&(i.flags&128)===0&&($t(i),i.subtreeFlags&6&&(i.flags|=8192)):$t(i),o=i.updateQueue,o!==null&&wu(i,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==o&&(i.flags|=2048),r!==null&&Z(Xi),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),bs(sn),$t(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function dk(r,i){switch(Lf(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return bs(sn),De(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return xe(i),null;case 31:if(i.memoizedState!==null){if(lr(i),i.alternate===null)throw Error(s(340));Gi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(lr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Gi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return Z(en),null;case 4:return De(),null;case 10:return bs(i.type),null;case 22:case 23:return lr(i),Xf(),r!==null&&Z(Xi),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return bs(sn),null;case 25:return null;default:return null}}function yv(r,i){switch(Lf(i),i.tag){case 3:bs(sn),De();break;case 26:case 27:case 5:xe(i);break;case 4:De();break;case 31:i.memoizedState!==null&&lr(i);break;case 13:lr(i);break;case 19:Z(en);break;case 10:bs(i.type);break;case 22:case 23:lr(i),Xf(),r!==null&&Z(Xi);break;case 24:bs(sn)}}function go(r,i){try{var o=i.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&r)===r){d=void 0;var x=o.create,w=o.inst;d=x(),w.destroy=d}o=o.next}while(o!==m)}}catch(N){wt(i,i.return,N)}}function ci(r,i,o){try{var d=i.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&r)===r){var w=d.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,m=i;var H=o,ee=N;try{ee()}catch(oe){wt(m,H,oe)}}}d=d.next}while(d!==x)}}catch(oe){wt(i,i.return,oe)}}function _v(r){var i=r.updateQueue;if(i!==null){var o=r.stateNode;try{d0(i,o)}catch(d){wt(r,r.return,d)}}}function wv(r,i,o){o.props=ea(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){wt(r,i,d)}}function xo(r,i){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(m){wt(r,i,m)}}function ts(r,i){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){wt(r,i,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){wt(r,i,m)}else o.current=null}function Sv(r){var i=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){wt(r,r.return,m)}}function Ch(r,i,o){try{var d=r.stateNode;zk(d,r.type,o,i),d[_n]=i}catch(m){wt(r,r.return,m)}}function kv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&gi(r.type)||r.tag===4}function Eh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||kv(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&gi(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Th(r,i,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,i):(i=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,i.appendChild(r),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=vr));else if(d!==4&&(d===27&&gi(r.type)&&(o=r.stateNode,i=null),r=r.child,r!==null))for(Th(r,i,o),r=r.sibling;r!==null;)Th(r,i,o),r=r.sibling}function Su(r,i,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?o.insertBefore(r,i):o.appendChild(r);else if(d!==4&&(d===27&&gi(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(Su(r,i,o),r=r.sibling;r!==null;)Su(r,i,o),r=r.sibling}function jv(r){var i=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,m=i.attributes;m.length;)i.removeAttributeNode(m[0]);jn(i,d,o),i[Ht]=r,i[_n]=o}catch(x){wt(r,r.return,x)}}var ks=!1,on=!1,Ah=!1,Nv=typeof WeakSet=="function"?WeakSet:Set,bn=null;function fk(r,i){if(r=r.containerInfo,Kh=qu,r=Px(r),Sf(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var w=0,N=-1,H=-1,ee=0,oe=0,ue=r,ne=null;t:for(;;){for(var ie;ue!==o||m!==0&&ue.nodeType!==3||(N=w+m),ue!==x||d!==0&&ue.nodeType!==3||(H=w+d),ue.nodeType===3&&(w+=ue.nodeValue.length),(ie=ue.firstChild)!==null;)ne=ue,ue=ie;for(;;){if(ue===r)break t;if(ne===o&&++ee===m&&(N=w),ne===x&&++oe===d&&(H=w),(ie=ue.nextSibling)!==null)break;ue=ne,ne=ue.parentNode}ue=ie}o=N===-1||H===-1?null:{start:N,end:H}}else o=null}o=o||{start:0,end:0}}else o=null;for(Zh={focusedElem:r,selectionRange:o},qu=!1,bn=i;bn!==null;)if(i=bn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,bn=r;else for(;bn!==null;){switch(i=bn,x=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<r.length;o++)m=r[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,o=i,m=x.memoizedProps,x=x.memoizedState,d=o.stateNode;try{var Ee=ea(o.type,m);r=d.getSnapshotBeforeUpdate(Ee,x),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){wt(o,o.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,o=r.nodeType,o===9)tp(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":tp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(s(163))}if(r=i.sibling,r!==null){r.return=i.return,bn=r;break}bn=i.return}}function Cv(r,i,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:Ns(r,o),d&4&&go(5,o);break;case 1:if(Ns(r,o),d&4)if(r=o.stateNode,i===null)try{r.componentDidMount()}catch(w){wt(o,o.return,w)}else{var m=ea(o.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(m,i,r.__reactInternalSnapshotBeforeUpdate)}catch(w){wt(o,o.return,w)}}d&64&&_v(o),d&512&&xo(o,o.return);break;case 3:if(Ns(r,o),d&64&&(r=o.updateQueue,r!==null)){if(i=null,o.child!==null)switch(o.child.tag){case 27:case 5:i=o.child.stateNode;break;case 1:i=o.child.stateNode}try{d0(r,i)}catch(w){wt(o,o.return,w)}}break;case 27:i===null&&d&4&&jv(o);case 26:case 5:Ns(r,o),i===null&&d&4&&Sv(o),d&512&&xo(o,o.return);break;case 12:Ns(r,o);break;case 31:Ns(r,o),d&4&&Av(r,o);break;case 13:Ns(r,o),d&4&&Mv(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=_k.bind(null,o),Fk(r,o))));break;case 22:if(d=o.memoizedState!==null||ks,!d){i=i!==null&&i.memoizedState!==null||on,m=ks;var x=on;ks=d,(on=i)&&!x?Cs(r,o,(o.subtreeFlags&8772)!==0):Ns(r,o),ks=m,on=x}break;case 30:break;default:Ns(r,o)}}function Ev(r){var i=r.alternate;i!==null&&(r.alternate=null,Ev(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Gs(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var It=null,Gn=!1;function js(r,i,o){for(o=o.child;o!==null;)Tv(r,i,o),o=o.sibling}function Tv(r,i,o){if(vt&&typeof vt.onCommitFiberUnmount=="function")try{vt.onCommitFiberUnmount(nt,o)}catch{}switch(o.tag){case 26:on||ts(o,i),js(r,i,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:on||ts(o,i);var d=It,m=Gn;gi(o.type)&&(It=o.stateNode,Gn=!1),js(r,i,o),No(o.stateNode),It=d,Gn=m;break;case 5:on||ts(o,i);case 6:if(d=It,m=Gn,It=null,js(r,i,o),It=d,Gn=m,It!==null)if(Gn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(o.stateNode)}catch(x){wt(o,i,x)}else try{It.removeChild(o.stateNode)}catch(x){wt(o,i,x)}break;case 18:It!==null&&(Gn?(r=It,_1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),ll(r)):_1(It,o.stateNode));break;case 4:d=It,m=Gn,It=o.stateNode.containerInfo,Gn=!0,js(r,i,o),It=d,Gn=m;break;case 0:case 11:case 14:case 15:ci(2,o,i),on||ci(4,o,i),js(r,i,o);break;case 1:on||(ts(o,i),d=o.stateNode,typeof d.componentWillUnmount=="function"&&wv(o,i,d)),js(r,i,o);break;case 21:js(r,i,o);break;case 22:on=(d=on)||o.memoizedState!==null,js(r,i,o),on=d;break;default:js(r,i,o)}}function Av(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{ll(r)}catch(o){wt(i,i.return,o)}}}function Mv(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{ll(r)}catch(o){wt(i,i.return,o)}}function hk(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new Nv),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new Nv),i;default:throw Error(s(435,r.tag))}}function ku(r,i){var o=hk(r);i.forEach(function(d){if(!o.has(d)){o.add(d);var m=wk.bind(null,r,d);d.then(m,m)}})}function Yn(r,i){var o=i.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],x=r,w=i,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(gi(N.type)){It=N.stateNode,Gn=!1;break e}break;case 5:It=N.stateNode,Gn=!1;break e;case 3:case 4:It=N.stateNode.containerInfo,Gn=!0;break e}N=N.return}if(It===null)throw Error(s(160));Tv(x,w,m),It=null,Gn=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Rv(i,r),i=i.sibling}var Hr=null;function Rv(r,i){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Yn(i,r),Wn(r),d&4&&(ci(3,r,r.return),go(3,r),ci(5,r,r.return));break;case 1:Yn(i,r),Wn(r),d&512&&(on||o===null||ts(o,o.return)),d&64&&ks&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=Hr;if(Yn(i,r),Wn(r),d&512&&(on||o===null||ts(o,o.return)),d&4){var x=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":x=m.getElementsByTagName("title")[0],(!x||x[Wr]||x[Ht]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(d),m.head.insertBefore(x,m.querySelector("head > title"))),jn(x,d,o),x[Ht]=r,Yt(x),d=x;break e;case"link":var w=R1("link","href",m).get(d+(o.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&x.getAttribute("rel")===(o.rel==null?null:o.rel)&&x.getAttribute("title")===(o.title==null?null:o.title)&&x.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){w.splice(N,1);break t}}x=m.createElement(d),jn(x,d,o),m.head.appendChild(x);break;case"meta":if(w=R1("meta","content",m).get(d+(o.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(o.content==null?null:""+o.content)&&x.getAttribute("name")===(o.name==null?null:o.name)&&x.getAttribute("property")===(o.property==null?null:o.property)&&x.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&x.getAttribute("charset")===(o.charSet==null?null:o.charSet)){w.splice(N,1);break t}}x=m.createElement(d),jn(x,d,o),m.head.appendChild(x);break;default:throw Error(s(468,d))}x[Ht]=r,Yt(x),d=x}r.stateNode=d}else z1(m,r.type,r.stateNode);else r.stateNode=M1(m,d,r.memoizedProps);else x!==d?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,d===null?z1(m,r.type,r.stateNode):M1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Ch(r,r.memoizedProps,o.memoizedProps)}break;case 27:Yn(i,r),Wn(r),d&512&&(on||o===null||ts(o,o.return)),o!==null&&d&4&&Ch(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Yn(i,r),Wn(r),d&512&&(on||o===null||ts(o,o.return)),r.flags&32){m=r.stateNode;try{Xs(m,"")}catch(Ee){wt(r,r.return,Ee)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,Ch(r,m,o!==null?o.memoizedProps:m)),d&1024&&(Ah=!0);break;case 6:if(Yn(i,r),Wn(r),d&4){if(r.stateNode===null)throw Error(s(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Ee){wt(r,r.return,Ee)}}break;case 3:if(Uu=null,m=Hr,Hr=Pu(i.containerInfo),Yn(i,r),Hr=m,Wn(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{ll(i.containerInfo)}catch(Ee){wt(r,r.return,Ee)}Ah&&(Ah=!1,zv(r));break;case 4:d=Hr,Hr=Pu(r.stateNode.containerInfo),Yn(i,r),Wn(r),Hr=d;break;case 12:Yn(i,r),Wn(r);break;case 31:Yn(i,r),Wn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ku(r,d)));break;case 13:Yn(i,r),Wn(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Nu=qe()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ku(r,d)));break;case 22:m=r.memoizedState!==null;var H=o!==null&&o.memoizedState!==null,ee=ks,oe=on;if(ks=ee||m,on=oe||H,Yn(i,r),on=oe,ks=ee,Wn(r),d&8192)e:for(i=r.stateNode,i._visibility=m?i._visibility&-2:i._visibility|1,m&&(o===null||H||ks||on||ta(r)),o=null,i=r;;){if(i.tag===5||i.tag===26){if(o===null){H=o=i;try{if(x=H.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=H.stateNode;var ue=H.memoizedProps.style,ne=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;N.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ee){wt(H,H.return,Ee)}}}else if(i.tag===6){if(o===null){H=i;try{H.stateNode.nodeValue=m?"":H.memoizedProps}catch(Ee){wt(H,H.return,Ee)}}}else if(i.tag===18){if(o===null){H=i;try{var ie=H.stateNode;m?w1(ie,!0):w1(H.stateNode,!1)}catch(Ee){wt(H,H.return,Ee)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;o===i&&(o=null),i=i.return}o===i&&(o=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,ku(r,o))));break;case 19:Yn(i,r),Wn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ku(r,d)));break;case 30:break;case 21:break;default:Yn(i,r),Wn(r)}}function Wn(r){var i=r.flags;if(i&2){try{for(var o,d=r.return;d!==null;){if(kv(d)){o=d;break}d=d.return}if(o==null)throw Error(s(160));switch(o.tag){case 27:var m=o.stateNode,x=Eh(r);Su(r,x,m);break;case 5:var w=o.stateNode;o.flags&32&&(Xs(w,""),o.flags&=-33);var N=Eh(r);Su(r,N,w);break;case 3:case 4:var H=o.stateNode.containerInfo,ee=Eh(r);Th(r,ee,H);break;default:throw Error(s(161))}}catch(oe){wt(r,r.return,oe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function zv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;zv(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ns(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Cv(r,i.alternate,i),i=i.sibling}function ta(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:ci(4,i,i.return),ta(i);break;case 1:ts(i,i.return);var o=i.stateNode;typeof o.componentWillUnmount=="function"&&wv(i,i.return,o),ta(i);break;case 27:No(i.stateNode);case 26:case 5:ts(i,i.return),ta(i);break;case 22:i.memoizedState===null&&ta(i);break;case 30:ta(i);break;default:ta(i)}r=r.sibling}}function Cs(r,i,o){for(o=o&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,m=r,x=i,w=x.flags;switch(x.tag){case 0:case 11:case 15:Cs(m,x,o),go(4,x);break;case 1:if(Cs(m,x,o),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ee){wt(d,d.return,ee)}if(d=x,m=d.updateQueue,m!==null){var N=d.stateNode;try{var H=m.shared.hiddenCallbacks;if(H!==null)for(m.shared.hiddenCallbacks=null,m=0;m<H.length;m++)u0(H[m],N)}catch(ee){wt(d,d.return,ee)}}o&&w&64&&_v(x),xo(x,x.return);break;case 27:jv(x);case 26:case 5:Cs(m,x,o),o&&d===null&&w&4&&Sv(x),xo(x,x.return);break;case 12:Cs(m,x,o);break;case 31:Cs(m,x,o),o&&w&4&&Av(m,x);break;case 13:Cs(m,x,o),o&&w&4&&Mv(m,x);break;case 22:x.memoizedState===null&&Cs(m,x,o),xo(x,x.return);break;case 30:break;default:Cs(m,x,o)}i=i.sibling}}function Mh(r,i){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&no(o))}function Rh(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&no(r))}function Ir(r,i,o,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Lv(r,i,o,d),i=i.sibling}function Lv(r,i,o,d){var m=i.flags;switch(i.tag){case 0:case 11:case 15:Ir(r,i,o,d),m&2048&&go(9,i);break;case 1:Ir(r,i,o,d);break;case 3:Ir(r,i,o,d),m&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&no(r)));break;case 12:if(m&2048){Ir(r,i,o,d),r=i.stateNode;try{var x=i.memoizedProps,w=x.id,N=x.onPostCommit;typeof N=="function"&&N(w,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){wt(i,i.return,H)}}else Ir(r,i,o,d);break;case 31:Ir(r,i,o,d);break;case 13:Ir(r,i,o,d);break;case 23:break;case 22:x=i.stateNode,w=i.alternate,i.memoizedState!==null?x._visibility&2?Ir(r,i,o,d):vo(r,i):x._visibility&2?Ir(r,i,o,d):(x._visibility|=2,Qa(r,i,o,d,(i.subtreeFlags&10256)!==0||!1)),m&2048&&Mh(w,i);break;case 24:Ir(r,i,o,d),m&2048&&Rh(i.alternate,i);break;default:Ir(r,i,o,d)}}function Qa(r,i,o,d,m){for(m=m&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=r,w=i,N=o,H=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:Qa(x,w,N,H,m),go(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Qa(x,w,N,H,m):vo(x,w):(oe._visibility|=2,Qa(x,w,N,H,m)),m&&ee&2048&&Mh(w.alternate,w);break;case 24:Qa(x,w,N,H,m),m&&ee&2048&&Rh(w.alternate,w);break;default:Qa(x,w,N,H,m)}i=i.sibling}}function vo(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var o=r,d=i,m=d.flags;switch(d.tag){case 22:vo(o,d),m&2048&&Mh(d.alternate,d);break;case 24:vo(o,d),m&2048&&Rh(d.alternate,d);break;default:vo(o,d)}i=i.sibling}}var bo=8192;function Ka(r,i,o){if(r.subtreeFlags&bo)for(r=r.child;r!==null;)Dv(r,i,o),r=r.sibling}function Dv(r,i,o){switch(r.tag){case 26:Ka(r,i,o),r.flags&bo&&r.memoizedState!==null&&Jk(o,Hr,r.memoizedState,r.memoizedProps);break;case 5:Ka(r,i,o);break;case 3:case 4:var d=Hr;Hr=Pu(r.stateNode.containerInfo),Ka(r,i,o),Hr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=bo,bo=16777216,Ka(r,i,o),bo=d):Ka(r,i,o));break;default:Ka(r,i,o)}}function Ov(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function yo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var o=0;o<i.length;o++){var d=i[o];bn=d,Pv(d,r)}Ov(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Bv(r),r=r.sibling}function Bv(r){switch(r.tag){case 0:case 11:case 15:yo(r),r.flags&2048&&ci(9,r,r.return);break;case 3:yo(r);break;case 12:yo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,ju(r)):yo(r);break;default:yo(r)}}function ju(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var o=0;o<i.length;o++){var d=i[o];bn=d,Pv(d,r)}Ov(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:ci(8,i,i.return),ju(i);break;case 22:o=i.stateNode,o._visibility&2&&(o._visibility&=-3,ju(i));break;default:ju(i)}r=r.sibling}}function Pv(r,i){for(;bn!==null;){var o=bn;switch(o.tag){case 0:case 11:case 15:ci(8,o,i);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:no(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,bn=d;else e:for(o=r;bn!==null;){d=bn;var m=d.sibling,x=d.return;if(Ev(d),d===o){bn=null;break e}if(m!==null){m.return=x,bn=m;break e}bn=x}}}var pk={getCacheForType:function(r){var i=Sn(sn),o=i.data.get(r);return o===void 0&&(o=r(),i.data.set(r,o)),o},cacheSignal:function(){return Sn(sn).controller.signal}},mk=typeof WeakMap=="function"?WeakMap:Map,xt=0,Et=null,at=null,ct=0,_t=0,or=null,ui=!1,Za=!1,zh=!1,Es=0,Kt=0,di=0,na=0,Lh=0,cr=0,Ja=0,_o=null,Xn=null,Dh=!1,Nu=0,$v=0,Cu=1/0,Eu=null,fi=null,gn=0,hi=null,el=null,Ts=0,Oh=0,Bh=null,Uv=null,wo=0,Ph=null;function ur(){return(xt&2)!==0&&ct!==0?ct&-ct:$.T!==null?qh():$l()}function Fv(){if(cr===0)if((ct&536870912)===0||dt){var r=Pr;Pr<<=1,(Pr&3932160)===0&&(Pr=262144),cr=r}else cr=536870912;return r=ar.current,r!==null&&(r.flags|=32),cr}function Qn(r,i,o){(r===Et&&(_t===2||_t===9)||r.cancelPendingCommit!==null)&&(tl(r,0),pi(r,ct,cr,!1)),Ot(r,o),((xt&2)===0||r!==Et)&&(r===Et&&((xt&2)===0&&(na|=o),Kt===4&&pi(r,ct,cr,!1)),ns(r))}function Hv(r,i,o){if((xt&6)!==0)throw Error(s(327));var d=!o&&(i&127)===0&&(i&r.expiredLanes)===0||We(r,i),m=d?vk(r,i):Uh(r,i,!0),x=d;do{if(m===0){Za&&!d&&pi(r,i,0,!1);break}else{if(o=r.current.alternate,x&&!gk(o)){m=Uh(r,i,!1),x=!1;continue}if(m===2){if(x=i,r.errorRecoveryDisabledLanes&x)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){i=w;e:{var N=r;m=_o;var H=N.current.memoizedState.isDehydrated;if(H&&(tl(N,w).flags|=256),w=Uh(N,w,!1),w!==2){if(zh&&!H){N.errorRecoveryDisabledLanes|=x,na|=x,m=4;break e}x=Xn,Xn=m,x!==null&&(Xn===null?Xn=x:Xn.push.apply(Xn,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){tl(r,0),pi(r,i,0,!0);break}e:{switch(d=r,x=m,x){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:pi(d,i,cr,!ui);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(m=Nu+300-qe(),10<m)){if(pi(d,i,cr,!ui),ge(d,0,!0)!==0)break e;Ts=i,d.timeoutHandle=b1(Iv.bind(null,d,o,Xn,Eu,Dh,i,cr,na,Ja,ui,x,"Throttled",-0,0),m);break e}Iv(d,o,Xn,Eu,Dh,i,cr,na,Ja,ui,x,null,-0,0)}}break}while(!0);ns(r)}function Iv(r,i,o,d,m,x,w,N,H,ee,oe,ue,ne,ie){if(r.timeoutHandle=-1,ue=i.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vr},Dv(i,x,ue);var Ee=(x&62914560)===x?Nu-qe():(x&4194048)===x?$v-qe():0;if(Ee=ej(ue,Ee),Ee!==null){Ts=x,r.cancelPendingCommit=Ee(Kv.bind(null,r,i,x,o,d,m,w,N,H,oe,ue,null,ne,ie)),pi(r,x,w,!ee);return}}Kv(r,i,x,o,d,m,w,N,H)}function gk(r){for(var i=r;;){var o=i.tag;if((o===0||o===11||o===15)&&i.flags&16384&&(o=i.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],x=m.getSnapshot;m=m.value;try{if(!sr(x(),m))return!1}catch{return!1}}if(o=i.child,i.subtreeFlags&16384&&o!==null)o.return=i,i=o;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function pi(r,i,o,d){i&=~Lh,i&=~na,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var m=i;0<m;){var x=31-Ze(m),w=1<<x;d[x]=-1,m&=~w}o!==0&&mr(r,o,i)}function Tu(){return(xt&6)===0?(So(0),!1):!0}function $h(){if(at!==null){if(_t===0)var r=at.return;else r=at,vs=Yi=null,th(r),Va=null,so=0,r=at;for(;r!==null;)yv(r.alternate,r),r=r.return;at=null}}function tl(r,i){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,Ok(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),Ts=0,$h(),Et=r,at=o=gs(r.current,null),ct=i,_t=0,or=null,ui=!1,Za=We(r,i),zh=!1,Ja=cr=Lh=na=di=Kt=0,Xn=_o=null,Dh=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var m=31-Ze(d),x=1<<m;i|=r[m],d&=~x}return Es=i,Qc(),o}function qv(r,i){Ke=null,$.H=ho,i===qa||i===su?(i=a0(),_t=3):i===If?(i=a0(),_t=4):_t=i===xh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,or=i,at===null&&(Kt=1,vu(r,wr(i,r.current)))}function Vv(){var r=ar.current;return r===null?!0:(ct&4194048)===ct?Nr===null:(ct&62914560)===ct||(ct&536870912)!==0?r===Nr:!1}function Gv(){var r=$.H;return $.H=ho,r===null?ho:r}function Yv(){var r=$.A;return $.A=pk,r}function Au(){Kt=4,ui||(ct&4194048)!==ct&&ar.current!==null||(Za=!0),(di&134217727)===0&&(na&134217727)===0||Et===null||pi(Et,ct,cr,!1)}function Uh(r,i,o){var d=xt;xt|=2;var m=Gv(),x=Yv();(Et!==r||ct!==i)&&(Eu=null,tl(r,i)),i=!1;var w=Kt;e:do try{if(_t!==0&&at!==null){var N=at,H=or;switch(_t){case 8:$h(),w=6;break e;case 3:case 2:case 9:case 6:ar.current===null&&(i=!0);var ee=_t;if(_t=0,or=null,nl(r,N,H,ee),o&&Za){w=0;break e}break;default:ee=_t,_t=0,or=null,nl(r,N,H,ee)}}xk(),w=Kt;break}catch(oe){qv(r,oe)}while(!0);return i&&r.shellSuspendCounter++,vs=Yi=null,xt=d,$.H=m,$.A=x,at===null&&(Et=null,ct=0,Qc()),w}function xk(){for(;at!==null;)Wv(at)}function vk(r,i){var o=xt;xt|=2;var d=Gv(),m=Yv();Et!==r||ct!==i?(Eu=null,Cu=qe()+500,tl(r,i)):Za=We(r,i);e:do try{if(_t!==0&&at!==null){i=at;var x=or;t:switch(_t){case 1:_t=0,or=null,nl(r,i,x,1);break;case 2:case 9:if(s0(x)){_t=0,or=null,Xv(i);break}i=function(){_t!==2&&_t!==9||Et!==r||(_t=7),ns(r)},x.then(i,i);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:s0(x)?(_t=0,or=null,Xv(i)):(_t=0,or=null,nl(r,i,x,7));break;case 5:var w=null;switch(at.tag){case 26:w=at.memoizedState;case 5:case 27:var N=at;if(w?L1(w):N.stateNode.complete){_t=0,or=null;var H=N.sibling;if(H!==null)at=H;else{var ee=N.return;ee!==null?(at=ee,Mu(ee)):at=null}break t}}_t=0,or=null,nl(r,i,x,5);break;case 6:_t=0,or=null,nl(r,i,x,6);break;case 8:$h(),Kt=6;break e;default:throw Error(s(462))}}bk();break}catch(oe){qv(r,oe)}while(!0);return vs=Yi=null,$.H=d,$.A=m,xt=o,at!==null?0:(Et=null,ct=0,Qc(),Kt)}function bk(){for(;at!==null&&!Oe();)Wv(at)}function Wv(r){var i=vv(r.alternate,r,Es);r.memoizedProps=r.pendingProps,i===null?Mu(r):at=i}function Xv(r){var i=r,o=i.alternate;switch(i.tag){case 15:case 0:i=fv(o,i,i.pendingProps,i.type,void 0,ct);break;case 11:i=fv(o,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:th(i);default:yv(o,i),i=at=Yx(i,Es),i=vv(o,i,Es)}r.memoizedProps=r.pendingProps,i===null?Mu(r):at=i}function nl(r,i,o,d){vs=Yi=null,th(i),Va=null,so=0;var m=i.return;try{if(lk(r,m,i,o,ct)){Kt=1,vu(r,wr(o,r.current)),at=null;return}}catch(x){if(m!==null)throw at=m,x;Kt=1,vu(r,wr(o,r.current)),at=null;return}i.flags&32768?(dt||d===1?r=!0:Za||(ct&536870912)!==0?r=!1:(ui=r=!0,(d===2||d===9||d===3||d===6)&&(d=ar.current,d!==null&&d.tag===13&&(d.flags|=16384))),Qv(i,r)):Mu(i)}function Mu(r){var i=r;do{if((i.flags&32768)!==0){Qv(i,ui);return}r=i.return;var o=uk(i.alternate,i,Es);if(o!==null){at=o;return}if(i=i.sibling,i!==null){at=i;return}at=i=r}while(i!==null);Kt===0&&(Kt=5)}function Qv(r,i){do{var o=dk(r.alternate,r);if(o!==null){o.flags&=32767,at=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!i&&(r=r.sibling,r!==null)){at=r;return}at=r=o}while(r!==null);Kt=6,at=null}function Kv(r,i,o,d,m,x,w,N,H){r.cancelPendingCommit=null;do Ru();while(gn!==0);if((xt&6)!==0)throw Error(s(327));if(i!==null){if(i===r.current)throw Error(s(177));if(x=i.lanes|i.childLanes,x|=Ef,Ln(r,o,x,w,N,H),r===Et&&(at=Et=null,ct=0),el=i,hi=r,Ts=o,Oh=x,Bh=m,Uv=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,Sk(W,function(){return n1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=$.T,$.T=null,m=z.p,z.p=2,w=xt,xt|=4;try{fk(r,i,o)}finally{xt=w,z.p=m,$.T=d}}gn=1,Zv(),Jv(),e1()}}function Zv(){if(gn===1){gn=0;var r=hi,i=el,o=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||o){o=$.T,$.T=null;var d=z.p;z.p=2;var m=xt;xt|=4;try{Rv(i,r);var x=Zh,w=Px(r.containerInfo),N=x.focusedElem,H=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&Bx(N.ownerDocument.documentElement,N)){if(H!==null&&Sf(N)){var ee=H.start,oe=H.end;if(oe===void 0&&(oe=ee),"selectionStart"in N)N.selectionStart=ee,N.selectionEnd=Math.min(oe,N.value.length);else{var ue=N.ownerDocument||document,ne=ue&&ue.defaultView||window;if(ne.getSelection){var ie=ne.getSelection(),Ee=N.textContent.length,Ue=Math.min(H.start,Ee),jt=H.end===void 0?Ue:Math.min(H.end,Ee);!ie.extend&&Ue>jt&&(w=jt,jt=Ue,Ue=w);var K=Ox(N,Ue),V=Ox(N,jt);if(K&&V&&(ie.rangeCount!==1||ie.anchorNode!==K.node||ie.anchorOffset!==K.offset||ie.focusNode!==V.node||ie.focusOffset!==V.offset)){var J=ue.createRange();J.setStart(K.node,K.offset),ie.removeAllRanges(),Ue>jt?(ie.addRange(J),ie.extend(V.node,V.offset)):(J.setEnd(V.node,V.offset),ie.addRange(J))}}}}for(ue=[],ie=N;ie=ie.parentNode;)ie.nodeType===1&&ue.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ue.length;N++){var ce=ue[N];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}qu=!!Kh,Zh=Kh=null}finally{xt=m,z.p=d,$.T=o}}r.current=i,gn=2}}function Jv(){if(gn===2){gn=0;var r=hi,i=el,o=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||o){o=$.T,$.T=null;var d=z.p;z.p=2;var m=xt;xt|=4;try{Cv(r,i.alternate,i)}finally{xt=m,z.p=d,$.T=o}}gn=3}}function e1(){if(gn===4||gn===3){gn=0,yt();var r=hi,i=el,o=Ts,d=Uv;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?gn=5:(gn=0,el=hi=null,t1(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(fi=null),zi(o),i=i.stateNode,vt&&typeof vt.onCommitFiberRoot=="function")try{vt.onCommitFiberRoot(nt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=$.T,m=z.p,z.p=2,$.T=null;try{for(var x=r.onRecoverableError,w=0;w<d.length;w++){var N=d[w];x(N.value,{componentStack:N.stack})}}finally{$.T=i,z.p=m}}(Ts&3)!==0&&Ru(),ns(r),m=r.pendingLanes,(o&261930)!==0&&(m&42)!==0?r===Ph?wo++:(wo=0,Ph=r):wo=0,So(0)}}function t1(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,no(i)))}function Ru(){return Zv(),Jv(),e1(),n1()}function n1(){if(gn!==5)return!1;var r=hi,i=Oh;Oh=0;var o=zi(Ts),d=$.T,m=z.p;try{z.p=32>o?32:o,$.T=null,o=Bh,Bh=null;var x=hi,w=Ts;if(gn=0,el=hi=null,Ts=0,(xt&6)!==0)throw Error(s(331));var N=xt;if(xt|=4,Bv(x.current),Lv(x,x.current,w,o),xt=N,So(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(nt,x)}catch{}return!0}finally{z.p=m,$.T=d,t1(r,i)}}function r1(r,i,o){i=wr(o,i),i=gh(r.stateNode,i,2),r=ai(r,i,2),r!==null&&(Ot(r,2),ns(r))}function wt(r,i,o){if(r.tag===3)r1(r,r,o);else for(;i!==null;){if(i.tag===3){r1(i,r,o);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(fi===null||!fi.has(d))){r=wr(o,r),o=sv(2),d=ai(i,o,2),d!==null&&(iv(o,d,i,r),Ot(d,2),ns(d));break}}i=i.return}}function Fh(r,i,o){var d=r.pingCache;if(d===null){d=r.pingCache=new mk;var m=new Set;d.set(i,m)}else m=d.get(i),m===void 0&&(m=new Set,d.set(i,m));m.has(o)||(zh=!0,m.add(o),r=yk.bind(null,r,i,o),i.then(r,r))}function yk(r,i,o){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,Et===r&&(ct&o)===o&&(Kt===4||Kt===3&&(ct&62914560)===ct&&300>qe()-Nu?(xt&2)===0&&tl(r,0):Lh|=o,Ja===ct&&(Ja=0)),ns(r)}function s1(r,i){i===0&&(i=rn()),r=qi(r,i),r!==null&&(Ot(r,i),ns(r))}function _k(r){var i=r.memoizedState,o=0;i!==null&&(o=i.retryLane),s1(r,o)}function wk(r,i){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(s(314))}d!==null&&d.delete(i),s1(r,o)}function Sk(r,i){return yn(r,i)}var zu=null,rl=null,Hh=!1,Lu=!1,Ih=!1,mi=0;function ns(r){r!==rl&&r.next===null&&(rl===null?zu=rl=r:rl=rl.next=r),Lu=!0,Hh||(Hh=!0,jk())}function So(r,i){if(!Ih&&Lu){Ih=!0;do for(var o=!1,d=zu;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,N=d.pingedLanes;x=(1<<31-Ze(42|r)+1)-1,x&=m&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,o1(d,x))}else x=ct,x=ge(d,d===Et?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||We(d,x)||(o=!0,o1(d,x));d=d.next}while(o);Ih=!1}}function kk(){i1()}function i1(){Lu=Hh=!1;var r=0;mi!==0&&Dk()&&(r=mi);for(var i=qe(),o=null,d=zu;d!==null;){var m=d.next,x=a1(d,i);x===0?(d.next=null,o===null?zu=m:o.next=m,m===null&&(rl=o)):(o=d,(r!==0||(x&3)!==0)&&(Lu=!0)),d=m}gn!==0&&gn!==5||So(r),mi!==0&&(mi=0)}function a1(r,i){for(var o=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var w=31-Ze(x),N=1<<w,H=m[w];H===-1?((N&o)===0||(N&d)!==0)&&(m[w]=Dt(N,i)):H<=i&&(r.expiredLanes|=N),x&=~N}if(i=Et,o=ct,o=ge(r,r===i?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===i&&(_t===2||_t===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&je(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||We(r,o)){if(i=o&-o,i===r.callbackPriority)return i;switch(d!==null&&je(d),zi(o)){case 2:case 8:o=ve;break;case 32:o=W;break;case 268435456:o=Te;break;default:o=W}return d=l1.bind(null,r),o=yn(o,d),r.callbackPriority=i,r.callbackNode=o,i}return d!==null&&d!==null&&je(d),r.callbackPriority=2,r.callbackNode=null,2}function l1(r,i){if(gn!==0&&gn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(Ru()&&r.callbackNode!==o)return null;var d=ct;return d=ge(r,r===Et?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Hv(r,d,i),a1(r,qe()),r.callbackNode!=null&&r.callbackNode===o?l1.bind(null,r):null)}function o1(r,i){if(Ru())return null;Hv(r,i,!0)}function jk(){Bk(function(){(xt&6)!==0?yn(ae,kk):i1()})}function qh(){if(mi===0){var r=Ha;r===0&&(r=Br,Br<<=1,(Br&261888)===0&&(Br=256)),mi=r}return mi}function c1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Ta(""+r)}function u1(r,i){var o=i.ownerDocument.createElement("input");return o.name=i.name,o.value=i.value,r.id&&o.setAttribute("form",r.id),i.parentNode.insertBefore(o,i),r=new FormData(r),o.parentNode.removeChild(o),r}function Nk(r,i,o,d,m){if(i==="submit"&&o&&o.stateNode===m){var x=c1((m[_n]||null).action),w=d.submitter;w&&(i=(i=w[_n]||null)?c1(i.formAction):w.getAttribute("formAction"),i!==null&&(x=i,w=null));var N=new ms("action","action",null,d,m);r.push({event:N,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(mi!==0){var H=w?u1(m,w):new FormData(m);uh(o,{pending:!0,data:H,method:m.method,action:x},null,H)}}else typeof x=="function"&&(N.preventDefault(),H=w?u1(m,w):new FormData(m),uh(o,{pending:!0,data:H,method:m.method,action:x},x,H))},currentTarget:m}]})}}for(var Vh=0;Vh<Cf.length;Vh++){var Gh=Cf[Vh],Ck=Gh.toLowerCase(),Ek=Gh[0].toUpperCase()+Gh.slice(1);Fr(Ck,"on"+Ek)}Fr(Fx,"onAnimationEnd"),Fr(Hx,"onAnimationIteration"),Fr(Ix,"onAnimationStart"),Fr("dblclick","onDoubleClick"),Fr("focusin","onFocus"),Fr("focusout","onBlur"),Fr(qS,"onTransitionRun"),Fr(VS,"onTransitionStart"),Fr(GS,"onTransitionCancel"),Fr(qx,"onTransitionEnd"),Qr("onMouseEnter",["mouseout","mouseover"]),Qr("onMouseLeave",["mouseout","mouseover"]),Qr("onPointerEnter",["pointerout","pointerover"]),Qr("onPointerLeave",["pointerout","pointerover"]),$r("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$r("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$r("onBeforeInput",["compositionend","keypress","textInput","paste"]),$r("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$r("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$r("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ko="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ko));function d1(r,i){i=(i&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],m=d.event;d=d.listeners;e:{var x=void 0;if(i)for(var w=d.length-1;0<=w;w--){var N=d[w],H=N.instance,ee=N.currentTarget;if(N=N.listener,H!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=ee;try{x(m)}catch(oe){Xc(oe)}m.currentTarget=null,x=H}else for(w=0;w<d.length;w++){if(N=d[w],H=N.instance,ee=N.currentTarget,N=N.listener,H!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=ee;try{x(m)}catch(oe){Xc(oe)}m.currentTarget=null,x=H}}}}function lt(r,i){var o=i[Fl];o===void 0&&(o=i[Fl]=new Set);var d=r+"__bubble";o.has(d)||(f1(i,r,2,!1),o.add(d))}function Yh(r,i,o){var d=0;i&&(d|=4),f1(o,r,d,i)}var Du="_reactListening"+Math.random().toString(36).slice(2);function Wh(r){if(!r[Du]){r[Du]=!0,qn.forEach(function(o){o!=="selectionchange"&&(Tk.has(o)||Yh(o,!1,r),Yh(o,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Du]||(i[Du]=!0,Yh("selectionchange",!1,i))}}function f1(r,i,o,d){switch(F1(i)){case 2:var m=rj;break;case 8:m=sj;break;default:m=cp}o=m.bind(null,i,o,r),m=void 0,!Ma||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(i,o,{capture:!0,passive:m}):r.addEventListener(i,o,!0):m!==void 0?r.addEventListener(i,o,{passive:m}):r.addEventListener(i,o,!1)}function Xh(r,i,o,d,m){var x=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var N=d.stateNode.containerInfo;if(N===m)break;if(w===4)for(w=d.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;N!==null;){if(w=ps(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){d=x=w;continue e}N=N.parentNode}}d=d.return}Fc(function(){var ee=x,oe=Aa(o),ue=[];e:{var ne=Vx.get(r);if(ne!==void 0){var ie=ms,Ee=r;switch(r){case"keypress":if(it(o)===0)break e;case"keydown":case"keyup":ie=wS;break;case"focusin":Ee="focus",ie=Zr;break;case"focusout":Ee="blur",ie=Zr;break;case"beforeblur":case"afterblur":ie=Zr;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=vf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=qc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=jS;break;case Fx:case Hx:case Ix:ie=Yc;break;case qx:ie=CS;break;case"scroll":case"scrollend":ie=Hc;break;case"wheel":ie=TS;break;case"copy":case"cut":case"paste":ie=mS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=wx;break;case"toggle":case"beforetoggle":ie=MS}var Ue=(i&4)!==0,jt=!Ue&&(r==="scroll"||r==="scrollend"),K=Ue?ne!==null?ne+"Capture":null:ne;Ue=[];for(var V=ee,J;V!==null;){var ce=V;if(J=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||J===null||K===null||(ce=$i(V,K),ce!=null&&Ue.push(jo(V,ce,J))),jt)break;V=V.return}0<Ue.length&&(ne=new ie(ne,Ee,null,o,oe),ue.push({event:ne,listeners:Ue}))}}if((i&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",ie=r==="mouseout"||r==="pointerout",ne&&o!==Qs&&(Ee=o.relatedTarget||o.fromElement)&&(ps(Ee)||Ee[rr]))break e;if((ie||ne)&&(ne=oe.window===oe?oe:(ne=oe.ownerDocument)?ne.defaultView||ne.parentWindow:window,ie?(Ee=o.relatedTarget||o.toElement,ie=ee,Ee=Ee?ps(Ee):null,Ee!==null&&(jt=c(Ee),Ue=Ee.tag,Ee!==jt||Ue!==5&&Ue!==27&&Ue!==6)&&(Ee=null)):(ie=null,Ee=ee),ie!==Ee)){if(Ue=vf,ce="onMouseLeave",K="onMouseEnter",V="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=wx,ce="onPointerLeave",K="onPointerEnter",V="pointer"),jt=ie==null?ne:Oi(ie),J=Ee==null?ne:Oi(Ee),ne=new Ue(ce,V+"leave",ie,o,oe),ne.target=jt,ne.relatedTarget=J,ce=null,ps(oe)===ee&&(Ue=new Ue(K,V+"enter",Ee,o,oe),Ue.target=J,Ue.relatedTarget=jt,ce=Ue),jt=ce,ie&&Ee)t:{for(Ue=Ak,K=ie,V=Ee,J=0,ce=K;ce;ce=Ue(ce))J++;ce=0;for(var Be=V;Be;Be=Ue(Be))ce++;for(;0<J-ce;)K=Ue(K),J--;for(;0<ce-J;)V=Ue(V),ce--;for(;J--;){if(K===V||V!==null&&K===V.alternate){Ue=K;break t}K=Ue(K),V=Ue(V)}Ue=null}else Ue=null;ie!==null&&h1(ue,ne,ie,Ue,!1),Ee!==null&&jt!==null&&h1(ue,jt,Ee,Ue,!0)}}e:{if(ne=ee?Oi(ee):window,ie=ne.nodeName&&ne.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ne.type==="file")var mt=Ax;else if(Ex(ne))if(Mx)mt=FS;else{mt=$S;var Me=PS}else ie=ne.nodeName,!ie||ie.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Ea(ee.elementType)&&(mt=Ax):mt=US;if(mt&&(mt=mt(r,ee))){Tx(ue,mt,o,oe);break e}Me&&Me(r,ne,ee),r==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Na(ne,"number",ne.value)}switch(Me=ee?Oi(ee):window,r){case"focusin":(Ex(Me)||Me.contentEditable==="true")&&(La=Me,kf=ee,Jl=null);break;case"focusout":Jl=kf=La=null;break;case"mousedown":jf=!0;break;case"contextmenu":case"mouseup":case"dragend":jf=!1,$x(ue,o,oe);break;case"selectionchange":if(IS)break;case"keydown":case"keyup":$x(ue,o,oe)}var Je;if(yf)e:{switch(r){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else za?Nx(r,o)&&(ut="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(ut="onCompositionStart");ut&&(Sx&&o.locale!=="ko"&&(za||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&za&&(Je=ht()):(q=oe,de="value"in q?q.value:q.textContent,za=!0)),Me=Ou(ee,ut),0<Me.length&&(ut=new _x(ut,r,null,o,oe),ue.push({event:ut,listeners:Me}),Je?ut.data=Je:(Je=Cx(o),Je!==null&&(ut.data=Je)))),(Je=zS?LS(r,o):DS(r,o))&&(ut=Ou(ee,"onBeforeInput"),0<ut.length&&(Me=new _x("onBeforeInput","beforeinput",null,o,oe),ue.push({event:Me,listeners:ut}),Me.data=Je)),Nk(ue,r,ee,o,oe)}d1(ue,i)})}function jo(r,i,o){return{instance:r,listener:i,currentTarget:o}}function Ou(r,i){for(var o=i+"Capture",d=[];r!==null;){var m=r,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=$i(r,o),m!=null&&d.unshift(jo(r,m,x)),m=$i(r,i),m!=null&&d.push(jo(r,m,x))),r.tag===3)return d;r=r.return}return[]}function Ak(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function h1(r,i,o,d,m){for(var x=i._reactName,w=[];o!==null&&o!==d;){var N=o,H=N.alternate,ee=N.stateNode;if(N=N.tag,H!==null&&H===d)break;N!==5&&N!==26&&N!==27||ee===null||(H=ee,m?(ee=$i(o,x),ee!=null&&w.unshift(jo(o,ee,H))):m||(ee=$i(o,x),ee!=null&&w.push(jo(o,ee,H)))),o=o.return}w.length!==0&&r.push({event:i,listeners:w})}var Mk=/\r\n?/g,Rk=/\u0000|\uFFFD/g;function p1(r){return(typeof r=="string"?r:""+r).replace(Mk,`
|
|
49
|
-
`).replace(Rk,"")}function m1(r,i){return i=p1(i),p1(r)===i}function kt(r,i,o,d,m,x){switch(o){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||Xs(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&Xs(r,""+d);break;case"className":ka(r,"class",d);break;case"tabIndex":ka(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ka(r,o,d);break;case"style":Pc(r,d,x);break;case"data":if(i!=="object"){ka(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Ta(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(o==="formAction"?(i!=="input"&&kt(r,i,"name",m.name,m,null),kt(r,i,"formEncType",m.formEncType,m,null),kt(r,i,"formMethod",m.formMethod,m,null),kt(r,i,"formTarget",m.formTarget,m,null)):(kt(r,i,"encType",m.encType,m,null),kt(r,i,"method",m.method,m,null),kt(r,i,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Ta(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=vr);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(s(60));r.innerHTML=o}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}o=Ta(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":lt("beforetoggle",r),lt("toggle",r),Bi(r,"popover",d);break;case"xlinkActuate":Ur(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ur(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ur(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ur(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ur(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ur(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Bi(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=$c.get(o)||o,Bi(r,o,d))}}function Qh(r,i,o,d,m,x){switch(o){case"style":Pc(r,d,x);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(s(60));r.innerHTML=o}}break;case"children":typeof d=="string"?Xs(r,d):(typeof d=="number"||typeof d=="bigint")&&Xs(r,""+d);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"onClick":d!=null&&(r.onclick=vr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sa.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),i=o.slice(2,m?o.length-7:void 0),x=r[_n]||null,x=x!=null?x[o]:null,typeof x=="function"&&r.removeEventListener(i,x,m),typeof d=="function")){typeof x!="function"&&x!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(i,d,m);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):Bi(r,o,d)}}}function jn(r,i,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",r),lt("load",r);var d=!1,m=!1,x;for(x in o)if(o.hasOwnProperty(x)){var w=o[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:kt(r,i,x,w,o,null)}}m&&kt(r,i,"srcSet",o.srcSet,o,null),d&&kt(r,i,"src",o.src,o,null);return;case"input":lt("invalid",r);var N=x=w=m=null,H=null,ee=null;for(d in o)if(o.hasOwnProperty(d)){var oe=o[d];if(oe!=null)switch(d){case"name":m=oe;break;case"type":w=oe;break;case"checked":H=oe;break;case"defaultChecked":ee=oe;break;case"value":x=oe;break;case"defaultValue":N=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,i));break;default:kt(r,i,d,oe,o,null)}}Oc(r,x,N,H,ee,w,m,!1);return;case"select":lt("invalid",r),d=w=x=null;for(m in o)if(o.hasOwnProperty(m)&&(N=o[m],N!=null))switch(m){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":d=N;default:kt(r,i,m,N,o,null)}i=x,o=w,r.multiple=!!d,i!=null?Ws(r,!!d,i,!1):o!=null&&Ws(r,!!d,o,!0);return;case"textarea":lt("invalid",r),x=m=d=null;for(w in o)if(o.hasOwnProperty(w)&&(N=o[w],N!=null))switch(w){case"value":d=N;break;case"defaultValue":m=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(s(91));break;default:kt(r,i,w,N,o,null)}Vl(r,d,m,x);return;case"option":for(H in o)if(o.hasOwnProperty(H)&&(d=o[H],d!=null))switch(H){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:kt(r,i,H,d,o,null)}return;case"dialog":lt("beforetoggle",r),lt("toggle",r),lt("cancel",r),lt("close",r);break;case"iframe":case"object":lt("load",r);break;case"video":case"audio":for(d=0;d<ko.length;d++)lt(ko[d],r);break;case"image":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"embed":case"source":case"link":lt("error",r),lt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in o)if(o.hasOwnProperty(ee)&&(d=o[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:kt(r,i,ee,d,o,null)}return;default:if(Ea(i)){for(oe in o)o.hasOwnProperty(oe)&&(d=o[oe],d!==void 0&&Qh(r,i,oe,d,o,void 0));return}}for(N in o)o.hasOwnProperty(N)&&(d=o[N],d!=null&&kt(r,i,N,d,o,null))}function zk(r,i,o,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,N=null,H=null,ee=null,oe=null;for(ie in o){var ue=o[ie];if(o.hasOwnProperty(ie)&&ue!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":H=ue;default:d.hasOwnProperty(ie)||kt(r,i,ie,null,d,ue)}}for(var ne in d){var ie=d[ne];if(ue=o[ne],d.hasOwnProperty(ne)&&(ie!=null||ue!=null))switch(ne){case"type":x=ie;break;case"name":m=ie;break;case"checked":ee=ie;break;case"defaultChecked":oe=ie;break;case"value":w=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:ie!==ue&&kt(r,i,ne,ie,d,ue)}}Pi(r,w,N,H,ee,oe,x,m);return;case"select":ie=w=N=ne=null;for(x in o)if(H=o[x],o.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":ie=H;default:d.hasOwnProperty(x)||kt(r,i,x,null,d,H)}for(m in d)if(x=d[m],H=o[m],d.hasOwnProperty(m)&&(x!=null||H!=null))switch(m){case"value":ne=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==H&&kt(r,i,m,x,d,H)}i=N,o=w,d=ie,ne!=null?Ws(r,!!o,ne,!1):!!d!=!!o&&(i!=null?Ws(r,!!o,i,!0):Ws(r,!!o,o?[]:"",!1));return;case"textarea":ie=ne=null;for(N in o)if(m=o[N],o.hasOwnProperty(N)&&m!=null&&!d.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:kt(r,i,N,null,d,m)}for(w in d)if(m=d[w],x=o[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":ne=m;break;case"defaultValue":ie=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(s(91));break;default:m!==x&&kt(r,i,w,m,d,x)}Ca(r,ne,ie);return;case"option":for(var Ee in o)if(ne=o[Ee],o.hasOwnProperty(Ee)&&ne!=null&&!d.hasOwnProperty(Ee))switch(Ee){case"selected":r.selected=!1;break;default:kt(r,i,Ee,null,d,ne)}for(H in d)if(ne=d[H],ie=o[H],d.hasOwnProperty(H)&&ne!==ie&&(ne!=null||ie!=null))switch(H){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:kt(r,i,H,ne,d,ie)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in o)ne=o[Ue],o.hasOwnProperty(Ue)&&ne!=null&&!d.hasOwnProperty(Ue)&&kt(r,i,Ue,null,d,ne);for(ee in d)if(ne=d[ee],ie=o[ee],d.hasOwnProperty(ee)&&ne!==ie&&(ne!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,i));break;default:kt(r,i,ee,ne,d,ie)}return;default:if(Ea(i)){for(var jt in o)ne=o[jt],o.hasOwnProperty(jt)&&ne!==void 0&&!d.hasOwnProperty(jt)&&Qh(r,i,jt,void 0,d,ne);for(oe in d)ne=d[oe],ie=o[oe],!d.hasOwnProperty(oe)||ne===ie||ne===void 0&&ie===void 0||Qh(r,i,oe,ne,d,ie);return}}for(var K in o)ne=o[K],o.hasOwnProperty(K)&&ne!=null&&!d.hasOwnProperty(K)&&kt(r,i,K,null,d,ne);for(ue in d)ne=d[ue],ie=o[ue],!d.hasOwnProperty(ue)||ne===ie||ne==null&&ie==null||kt(r,i,ue,ne,d,ie)}function g1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Lk(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],x=m.transferSize,w=m.initiatorType,N=m.duration;if(x&&N&&g1(w)){for(w=0,N=m.responseEnd,d+=1;d<o.length;d++){var H=o[d],ee=H.startTime;if(ee>N)break;var oe=H.transferSize,ue=H.initiatorType;oe&&g1(ue)&&(H=H.responseEnd,w+=oe*(H<N?1:(N-ee)/(H-ee)))}if(--d,i+=8*(x+w)/(m.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Kh=null,Zh=null;function Bu(r){return r.nodeType===9?r:r.ownerDocument}function x1(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function v1(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Jh(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var ep=null;function Dk(){var r=window.event;return r&&r.type==="popstate"?r===ep?!1:(ep=r,!0):(ep=null,!1)}var b1=typeof setTimeout=="function"?setTimeout:void 0,Ok=typeof clearTimeout=="function"?clearTimeout:void 0,y1=typeof Promise=="function"?Promise:void 0,Bk=typeof queueMicrotask=="function"?queueMicrotask:typeof y1<"u"?function(r){return y1.resolve(null).then(r).catch(Pk)}:b1;function Pk(r){setTimeout(function(){throw r})}function gi(r){return r==="head"}function _1(r,i){var o=i,d=0;do{var m=o.nextSibling;if(r.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(m),ll(i);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")No(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,No(o);for(var x=o.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[Wr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=w}}else o==="body"&&No(r.ownerDocument.body);o=m}while(o);ll(i)}function w1(r,i){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?i?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(i?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function tp(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var o=i;switch(i=i.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":tp(o),Gs(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function $k(r,i,o,d){for(;r.nodeType===1;){var m=o;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Wr])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(x=r.getAttribute("src"),(x!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=Cr(r.nextSibling),r===null)break}return null}function Uk(r,i,o){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=Cr(r.nextSibling),r===null))return null;return r}function S1(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Cr(r.nextSibling),r===null))return null;return r}function np(r){return r.data==="$?"||r.data==="$~"}function rp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function Fk(r,i){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||o.readyState!=="loading")i();else{var d=function(){i(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Cr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var sp=null;function k1(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(i===0)return Cr(r.nextSibling);i--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||i++}r=r.nextSibling}return null}function j1(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(i===0)return r;i--}else o!=="/$"&&o!=="/&"||i++}r=r.previousSibling}return null}function N1(r,i,o){switch(i=Bu(o),r){case"html":if(r=i.documentElement,!r)throw Error(s(452));return r;case"head":if(r=i.head,!r)throw Error(s(453));return r;case"body":if(r=i.body,!r)throw Error(s(454));return r;default:throw Error(s(451))}}function No(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Gs(r)}var Er=new Map,C1=new Set;function Pu(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var As=z.d;z.d={f:Hk,r:Ik,D:qk,C:Vk,L:Gk,m:Yk,X:Xk,S:Wk,M:Qk};function Hk(){var r=As.f(),i=Tu();return r||i}function Ik(r){var i=In(r);i!==null&&i.tag===5&&i.type==="form"?q0(i):As.r(r)}var sl=typeof document>"u"?null:document;function E1(r,i,o){var d=sl;if(d&&typeof i=="string"&&i){var m=Jt(i);m='link[rel="'+r+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),C1.has(m)||(C1.add(m),r={rel:r,crossOrigin:o,href:i},d.querySelector(m)===null&&(i=d.createElement("link"),jn(i,"link",r),Yt(i),d.head.appendChild(i)))}}function qk(r){As.D(r),E1("dns-prefetch",r,null)}function Vk(r,i){As.C(r,i),E1("preconnect",r,i)}function Gk(r,i,o){As.L(r,i,o);var d=sl;if(d&&r&&i){var m='link[rel="preload"][as="'+Jt(i)+'"]';i==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Jt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Jt(o.imageSizes)+'"]')):m+='[href="'+Jt(r)+'"]';var x=m;switch(i){case"style":x=il(r);break;case"script":x=al(r)}Er.has(x)||(r=v({rel:"preload",href:i==="image"&&o&&o.imageSrcSet?void 0:r,as:i},o),Er.set(x,r),d.querySelector(m)!==null||i==="style"&&d.querySelector(Co(x))||i==="script"&&d.querySelector(Eo(x))||(i=d.createElement("link"),jn(i,"link",r),Yt(i),d.head.appendChild(i)))}}function Yk(r,i){As.m(r,i);var o=sl;if(o&&r){var d=i&&typeof i.as=="string"?i.as:"script",m='link[rel="modulepreload"][as="'+Jt(d)+'"][href="'+Jt(r)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=al(r)}if(!Er.has(x)&&(r=v({rel:"modulepreload",href:r},i),Er.set(x,r),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Eo(x)))return}d=o.createElement("link"),jn(d,"link",r),Yt(d),o.head.appendChild(d)}}}function Wk(r,i,o){As.S(r,i,o);var d=sl;if(d&&r){var m=Xr(d).hoistableStyles,x=il(r);i=i||"default";var w=m.get(x);if(!w){var N={loading:0,preload:null};if(w=d.querySelector(Co(x)))N.loading=5;else{r=v({rel:"stylesheet",href:r,"data-precedence":i},o),(o=Er.get(x))&&ip(r,o);var H=w=d.createElement("link");Yt(H),jn(H,"link",r),H._p=new Promise(function(ee,oe){H.onload=ee,H.onerror=oe}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,$u(w,i,d)}w={type:"stylesheet",instance:w,count:1,state:N},m.set(x,w)}}}function Xk(r,i){As.X(r,i);var o=sl;if(o&&r){var d=Xr(o).hoistableScripts,m=al(r),x=d.get(m);x||(x=o.querySelector(Eo(m)),x||(r=v({src:r,async:!0},i),(i=Er.get(m))&&ap(r,i),x=o.createElement("script"),Yt(x),jn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function Qk(r,i){As.M(r,i);var o=sl;if(o&&r){var d=Xr(o).hoistableScripts,m=al(r),x=d.get(m);x||(x=o.querySelector(Eo(m)),x||(r=v({src:r,async:!0,type:"module"},i),(i=Er.get(m))&&ap(r,i),x=o.createElement("script"),Yt(x),jn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function T1(r,i,o,d){var m=(m=Ce.current)?Pu(m):null;if(!m)throw Error(s(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(i=il(o.href),o=Xr(m).hoistableStyles,d=o.get(i),d||(d={type:"style",instance:null,count:0,state:null},o.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=il(o.href);var x=Xr(m).hoistableStyles,w=x.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,w),(x=m.querySelector(Co(r)))&&!x._p&&(w.instance=x,w.state.loading=5),Er.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Er.set(r,o),x||Kk(m,r,o,w.state))),i&&d===null)throw Error(s(528,""));return w}if(i&&d!==null)throw Error(s(529,""));return null;case"script":return i=o.async,o=o.src,typeof o=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=al(o),o=Xr(m).hoistableScripts,d=o.get(i),d||(d={type:"script",instance:null,count:0,state:null},o.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,r))}}function il(r){return'href="'+Jt(r)+'"'}function Co(r){return'link[rel="stylesheet"]['+r+"]"}function A1(r){return v({},r,{"data-precedence":r.precedence,precedence:null})}function Kk(r,i,o,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),jn(i,"link",o),Yt(i),r.head.appendChild(i))}function al(r){return'[src="'+Jt(r)+'"]'}function Eo(r){return"script[async]"+r}function M1(r,i,o){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Jt(o.href)+'"]');if(d)return i.instance=d,Yt(d),d;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Yt(d),jn(d,"style",m),$u(d,o.precedence,r),i.instance=d;case"stylesheet":m=il(o.href);var x=r.querySelector(Co(m));if(x)return i.state.loading|=4,i.instance=x,Yt(x),x;d=A1(o),(m=Er.get(m))&&ip(d,m),x=(r.ownerDocument||r).createElement("link"),Yt(x);var w=x;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),jn(x,"link",d),i.state.loading|=4,$u(x,o.precedence,r),i.instance=x;case"script":return x=al(o.src),(m=r.querySelector(Eo(x)))?(i.instance=m,Yt(m),m):(d=o,(m=Er.get(x))&&(d=v({},o),ap(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Yt(m),jn(m,"link",d),r.head.appendChild(m),i.instance=m);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,$u(d,o.precedence,r));return i.instance}function $u(r,i,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,x=m,w=0;w<d.length;w++){var N=d[w];if(N.dataset.precedence===i)x=N;else if(x!==m)break}x?x.parentNode.insertBefore(r,x.nextSibling):(i=o.nodeType===9?o.head:o,i.insertBefore(r,i.firstChild))}function ip(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function ap(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Uu=null;function R1(r,i,o){if(Uu===null){var d=new Map,m=Uu=new Map;m.set(o,d)}else m=Uu,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),m=0;m<o.length;m++){var x=o[m];if(!(x[Wr]||x[Ht]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(i)||"";w=r+w;var N=d.get(w);N?N.push(x):d.set(w,[x])}}return d}function z1(r,i,o){r=r.ownerDocument||r,r.head.insertBefore(o,i==="title"?r.querySelector("head > title"):null)}function Zk(r,i,o){if(o===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function L1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function Jk(r,i,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=il(d.href),x=i.querySelector(Co(m));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Fu.bind(r),i.then(r,r)),o.state.loading|=4,o.instance=x,Yt(x);return}x=i.ownerDocument||i,d=A1(d),(m=Er.get(m))&&ip(d,m),x=x.createElement("link"),Yt(x);var w=x;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),jn(x,"link",d),o.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,i),(i=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=Fu.bind(r),i.addEventListener("load",o),i.addEventListener("error",o))}}var lp=0;function ej(r,i){return r.stylesheets&&r.count===0&&Iu(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Iu(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+i);0<r.imgBytes&&lp===0&&(lp=62500*Lk());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Iu(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>lp?50:800)+i);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function Fu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Iu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Hu=null;function Iu(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Hu=new Map,i.forEach(tj,r),Hu=null,Fu.call(r))}function tj(r,i){if(!(i.state.loading&4)){var o=Hu.get(r);if(o)var d=o.get(null);else{o=new Map,Hu.set(r,o);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}m=i.instance,w=m.getAttribute("data-precedence"),x=o.get(w)||d,x===d&&o.set(null,m),o.set(w,m),this.count++,d=Fu.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),i.state.loading|=4}}var To={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function nj(r,i,o,d,m,x,w,N,H){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Tn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tn(0),this.hiddenUpdates=Tn(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function D1(r,i,o,d,m,x,w,N,H,ee,oe,ue){return r=new nj(r,i,o,w,H,ee,oe,ue,N),i=1,x===!0&&(i|=24),x=ir(3,null,null,i),r.current=x,x.stateNode=r,i=Uf(),i.refCount++,r.pooledCache=i,i.refCount++,x.memoizedState={element:d,isDehydrated:o,cache:i},qf(x),r}function O1(r){return r?(r=Ba,r):Ba}function B1(r,i,o,d,m,x){m=O1(m),d.context===null?d.context=m:d.pendingContext=m,d=ii(i),d.payload={element:o},x=x===void 0?null:x,x!==null&&(d.callback=x),o=ai(r,d,i),o!==null&&(Qn(o,r,i),ao(o,r,i))}function P1(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<i?o:i}}function op(r,i){P1(r,i),(r=r.alternate)&&P1(r,i)}function $1(r){if(r.tag===13||r.tag===31){var i=qi(r,67108864);i!==null&&Qn(i,r,67108864),op(r,67108864)}}function U1(r){if(r.tag===13||r.tag===31){var i=ur();i=Dn(i);var o=qi(r,i);o!==null&&Qn(o,r,i),op(r,i)}}var qu=!0;function rj(r,i,o,d){var m=$.T;$.T=null;var x=z.p;try{z.p=2,cp(r,i,o,d)}finally{z.p=x,$.T=m}}function sj(r,i,o,d){var m=$.T;$.T=null;var x=z.p;try{z.p=8,cp(r,i,o,d)}finally{z.p=x,$.T=m}}function cp(r,i,o,d){if(qu){var m=up(d);if(m===null)Xh(r,i,d,Vu,o),H1(r,d);else if(aj(m,r,i,o,d))d.stopPropagation();else if(H1(r,d),i&4&&-1<ij.indexOf(r)){for(;m!==null;){var x=In(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=he(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-Ze(w);N.entanglements[1]|=H,w&=~H}ns(x),(xt&6)===0&&(Cu=qe()+500,So(0))}}break;case 31:case 13:N=qi(x,2),N!==null&&Qn(N,x,2),Tu(),op(x,2)}if(x=up(d),x===null&&Xh(r,i,d,Vu,o),x===m)break;m=x}m!==null&&d.stopPropagation()}else Xh(r,i,d,null,o)}}function up(r){return r=Aa(r),dp(r)}var Vu=null;function dp(r){if(Vu=null,r=ps(r),r!==null){var i=c(r);if(i===null)r=null;else{var o=i.tag;if(o===13){if(r=u(i),r!==null)return r;r=null}else if(o===31){if(r=f(i),r!==null)return r;r=null}else if(o===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Vu=r,null}function F1(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Or()){case ae:return 2;case ve:return 8;case W:case fe:return 32;case Te:return 268435456;default:return 32}default:return 32}}var fp=!1,xi=null,vi=null,bi=null,Ao=new Map,Mo=new Map,yi=[],ij="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function H1(r,i){switch(r){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":vi=null;break;case"mouseover":case"mouseout":bi=null;break;case"pointerover":case"pointerout":Ao.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mo.delete(i.pointerId)}}function Ro(r,i,o,d,m,x){return r===null||r.nativeEvent!==x?(r={blockedOn:i,domEventName:o,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},i!==null&&(i=In(i),i!==null&&$1(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,m!==null&&i.indexOf(m)===-1&&i.push(m),r)}function aj(r,i,o,d,m){switch(i){case"focusin":return xi=Ro(xi,r,i,o,d,m),!0;case"dragenter":return vi=Ro(vi,r,i,o,d,m),!0;case"mouseover":return bi=Ro(bi,r,i,o,d,m),!0;case"pointerover":var x=m.pointerId;return Ao.set(x,Ro(Ao.get(x)||null,r,i,o,d,m)),!0;case"gotpointercapture":return x=m.pointerId,Mo.set(x,Ro(Mo.get(x)||null,r,i,o,d,m)),!0}return!1}function I1(r){var i=ps(r.target);if(i!==null){var o=c(i);if(o!==null){if(i=o.tag,i===13){if(i=u(o),i!==null){r.blockedOn=i,Ul(r.priority,function(){U1(o)});return}}else if(i===31){if(i=f(o),i!==null){r.blockedOn=i,Ul(r.priority,function(){U1(o)});return}}else if(i===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Gu(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var o=up(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);Qs=d,o.target.dispatchEvent(d),Qs=null}else return i=In(o),i!==null&&$1(i),r.blockedOn=o,!1;i.shift()}return!0}function q1(r,i,o){Gu(r)&&o.delete(i)}function lj(){fp=!1,xi!==null&&Gu(xi)&&(xi=null),vi!==null&&Gu(vi)&&(vi=null),bi!==null&&Gu(bi)&&(bi=null),Ao.forEach(q1),Mo.forEach(q1)}function Yu(r,i){r.blockedOn===i&&(r.blockedOn=null,fp||(fp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,lj)))}var Wu=null;function V1(r){Wu!==r&&(Wu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Wu===r&&(Wu=null);for(var i=0;i<r.length;i+=3){var o=r[i],d=r[i+1],m=r[i+2];if(typeof d!="function"){if(dp(d||o)===null)continue;break}var x=In(o);x!==null&&(r.splice(i,3),i-=3,uh(x,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function ll(r){function i(H){return Yu(H,r)}xi!==null&&Yu(xi,r),vi!==null&&Yu(vi,r),bi!==null&&Yu(bi,r),Ao.forEach(i),Mo.forEach(i);for(var o=0;o<yi.length;o++){var d=yi[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<yi.length&&(o=yi[0],o.blockedOn===null);)I1(o),o.blockedOn===null&&yi.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],x=o[d+1],w=m[_n]||null;if(typeof x=="function")w||V1(o);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[_n]||null)N=w.formAction;else if(dp(m)!==null)continue}else N=w.action;typeof N=="function"?o[d+1]=N:(o.splice(d,3),d-=3),V1(o)}}}function G1(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function i(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),m!==null&&(m(),m=null)}}}function hp(r){this._internalRoot=r}Xu.prototype.render=hp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(s(409));var o=i.current,d=ur();B1(o,d,r,i,null,null)},Xu.prototype.unmount=hp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;B1(r.current,2,null,r,null,null),Tu(),i[rr]=null}};function Xu(r){this._internalRoot=r}Xu.prototype.unstable_scheduleHydration=function(r){if(r){var i=$l();r={blockedOn:null,target:r,priority:i};for(var o=0;o<yi.length&&i!==0&&i<yi[o].priority;o++);yi.splice(o,0,r),o===0&&I1(r)}};var Y1=t.version;if(Y1!=="19.2.7")throw Error(s(527,Y1,"19.2.7"));z.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(s(188)):(r=Object.keys(r).join(","),Error(s(268,r)));return r=p(i),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var oj={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qu.isDisabled&&Qu.supportsFiber)try{nt=Qu.inject(oj),vt=Qu}catch{}}return Lo.createRoot=function(r,i){if(!a(r))throw Error(s(299));var o=!1,d="",m=ev,x=tv,w=nv;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(m=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=D1(r,1,!1,null,null,o,d,null,m,x,w,G1),r[rr]=i.current,Wh(r),new hp(i)},Lo.hydrateRoot=function(r,i,o){if(!a(r))throw Error(s(299));var d=!1,m="",x=ev,w=tv,N=nv,H=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(N=o.onRecoverableError),o.formState!==void 0&&(H=o.formState)),i=D1(r,1,!0,i,o??null,d,m,H,x,w,N,G1),i.context=O1(null),o=i.current,d=ur(),d=Dn(d),m=ii(d),m.callback=null,ai(o,m,d),o=d,i.current.lanes=o,Ot(i,o),ns(i),r[rr]=i.current,Wh(r),new Xu(i)},Lo.version="19.2.7",Lo}var ib;function _j(){if(ib)return gp.exports;ib=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(),gp.exports=yj(),gp.exports}var wj=_j();const ab=e=>{let t;const n=new Set,s=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,y))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(s,a,f);return f},Sj=(e=>e?ab(e):ab),kj=e=>e;function jj(e,t=kj){const n=Ku.useSyncExternalStore(e.subscribe,Ku.useCallback(()=>t(e.getState()),[e,t]),Ku.useCallback(()=>t(e.getInitialState()),[e,t]));return Ku.useDebugValue(n),n}const lb=e=>{const t=Sj(e),n=s=>jj(t,s);return Object.assign(n,t),n},Nj=(e=>e?lb(e):lb),bm="companion_auth_token";function ob(){return typeof window>"u"?null:localStorage.getItem(bm)||null}const Cj=e=>({authToken:ob(),isAuthenticated:ob()!==null,setAuthToken:t=>{localStorage.setItem(bm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(bm),e({authToken:null,isAuthenticated:!1})}});function qt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function Ej(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function Tj(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function Aj(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function Mj(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const Rj=e=>({sessions:new Map,sdkSessions:[],currentSessionId:Aj(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:Tj(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,collapsedProjects:Mj(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const s=new Map(n.sessions);s.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:s,messages:a}}),updateSession:(t,n)=>e(s=>{const a=new Map(s.sessions),c=a.get(t);return c&&a.set(t,{...c,...n}),{sessions:a}}),removeSession:t=>e(n=>{const s=qt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(s.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:qt(n.sessions,t),connectionStatus:qt(n.connectionStatus,t),cliConnected:qt(n.cliConnected,t),cliReconnecting:qt(n.cliReconnecting,t),sessionStatus:qt(n.sessionStatus,t),previousPermissionMode:qt(n.previousPermissionMode,t),sessionNames:s,recentlyRenamed:Ej(n.recentlyRenamed,t),mcpServers:qt(n.mcpServers,t),prStatus:qt(n.prStatus,t),linkedLinearIssues:qt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:qt(n.messages,t),streaming:qt(n.streaming,t),streamingStartedAt:qt(n.streamingStartedAt,t),streamingOutputTokens:qt(n.streamingOutputTokens,t),pendingPermissions:qt(n.pendingPermissions,t),aiResolvedPermissions:qt(n.aiResolvedPermissions,t),sessionTasks:qt(n.sessionTasks,t),changedFilesTick:qt(n.changedFilesTick,t),gitChangedFilesCount:qt(n.gitChangedFilesCount,t),sessionProcesses:qt(n.sessionProcesses,t),toolProgress:qt(n.toolProgress,t),toolActivity:qt(n.toolActivity,t),diffPanelSelectedFile:qt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:qt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(s=>{const a=new Map(s.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(s=>{const a=new Map(s.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(s=>{const a=new Map(s.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(s=>{const a=new Map(s.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(s=>{const a=new Map(s.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(s=>{const a=new Map(s.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const s=new Set(n.recentlyRenamed);return s.add(t),{recentlyRenamed:s}}),clearRecentlyRenamed:t=>e(n=>{const s=new Set(n.recentlyRenamed);return s.delete(t),{recentlyRenamed:s}}),setPRStatus:(t,n)=>e(s=>{const a=new Map(s.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(s=>{const a=new Map(s.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(s=>{const a=new Map(s.mcpServers);return a.set(t,n),{mcpServers:a}}),toggleProjectCollapse:t=>e(n=>{const s=new Set(n.collapsedProjects);return s.has(t)?s.delete(t):s.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(s))),{collapsedProjects:s}}),setSessionAiValidation:(t,n)=>e(s=>{const a=new Map(s.sessions),c=a.get(t);return c?(a.set(t,{...c,...n}),{sessions:a}):{}})}),zj=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(s=>{const a=s.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return s;const c=new Map(s.messages);return c.set(t,[...a,n]),{messages:c}}),setMessages:(t,n)=>e(s=>{const a=new Map(s.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(s=>{const a=new Map(s.messages),c=[...a.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return a.set(t,c),{messages:a}}),setStreaming:(t,n)=>e(s=>{const a=new Map(s.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(s=>{const a=new Map(s.streamingStartedAt),c=new Map(s.streamingOutputTokens);return n===null?(a.delete(t),c.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:c}}),setLastActivity:(t,n)=>e(s=>{const a=new Map(s.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(s=>{const a=new Map(s.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const s=new Map(n.promptSuggestions);return s.delete(t),{promptSuggestions:s}})}),Lj=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(s=>{const a=new Map(s.pendingPermissions),c=new Map(a.get(t)||[]);return c.set(n.request_id,n),a.set(t,c),{pendingPermissions:a}}),removePermission:(t,n)=>e(s=>{const a=new Map(s.pendingPermissions),c=a.get(t);if(c){const u=new Map(c);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(s=>{const a=new Map(s.aiResolvedPermissions),c=[...a.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),a.set(t,c),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const s=new Map(n.aiResolvedPermissions);return s.delete(t),{aiResolvedPermissions:s}})}),Dj=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(s=>{const a=new Map(s.sessionTasks),c=[...a.get(t)||[],n];return a.set(t,c),{sessionTasks:a}}),setTasks:(t,n)=>e(s=>{const a=new Map(s.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,s)=>e(a=>{const c=new Map(a.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(f=>f.id===n?{...f,...s}:f)),{sessionTasks:c}}),addProcess:(t,n)=>e(s=>{const a=new Map(s.sessionProcesses),c=[...a.get(t)||[],n];return a.set(t,c),{sessionProcesses:a}}),updateProcess:(t,n,s)=>e(a=>{const c=new Map(a.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.taskId===n?{...f,...s}:f)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,s)=>e(a=>{const c=new Map(a.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(s=>{const a=new Map(s.sessionBackgroundAgents),c=[...a.get(t)||[],n];return a.set(t,c),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,s)=>e(a=>{const c=new Map(a.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const s=new Map(n.changedFilesTick);return s.set(t,(s.get(t)??0)+1),{changedFilesTick:s}}),setGitChangedFilesCount:(t,n)=>e(s=>{const a=new Map(s.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,s)=>e(a=>{const c=new Map(a.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,s),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(s=>{const a=new Map(s.toolProgress);if(n){const c=a.get(t);if(c){const u=new Map(c);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(s=>{const a=new Map(s.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(s=>{const a=new Map(s.toolActivity),c=[...a.get(t)||[]],u=c.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=c[u];c[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else c.push(n);return a.set(t,c),{toolActivity:a}}),updateToolActivity:(t,n,s)=>e(a=>{const c=new Map(a.toolActivity),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{toolActivity:c}})}),qs=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],Oj=qs.map(e=>e.id),Q_="cc-task-panel-config";function ym(){return{order:[...Oj],enabled:Object.fromEntries(qs.map(e=>[e.id,!0]))}}function Bj(){if(typeof window>"u")return ym();try{const e=localStorage.getItem(Q_);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of qs)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const s=new Set(qs.map(a=>a.id));return t.order=t.order.filter(a=>s.has(a)),t}}catch{}return ym()}function Zu(e){try{localStorage.setItem(Q_,JSON.stringify(e))}catch{}}function Pj(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-dark-mode");return e!==null?e==="true":window.matchMedia("(prefers-color-scheme: dark)").matches}function $j(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function Uj(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function K_(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}const Fj=e=>({darkMode:Pj(),notificationSound:$j(),notificationDesktop:Uj(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:Bj(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:K_(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const s={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return Zu(s),{taskPanelConfig:s}}),moveSectionUp:t=>e(n=>{const s=[...n.taskPanelConfig.order],a=s.indexOf(t);if(a<=0)return n;[s[a-1],s[a]]=[s[a],s[a-1]];const c={...n.taskPanelConfig,order:s};return Zu(c),{taskPanelConfig:c}}),moveSectionDown:t=>e(n=>{const s=[...n.taskPanelConfig.order],a=s.indexOf(t);if(a<0||a>=s.length-1)return n;[s[a],s[a+1]]=[s[a+1],s[a]];const c={...n.taskPanelConfig,order:s};return Zu(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=ym();Zu(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const s=new Map(n.chatTabReentryTickBySession),a=(s.get(t)??0)+1;return s.set(t,a),{chatTabReentryTickBySession:s}}),setDiffPanelSelectedFile:(t,n)=>e(s=>{const a=new Map(s.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function Z_(){if(typeof window>"u")return"bottom";const e=window.localStorage.getItem("cc-terminal-placement");return e==="top"||e==="right"||e==="bottom"||e==="left"?e:"bottom"}const Hj=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:Z_(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const s=t.target==="docker",a=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=s?a:a+1,f=s?c+1:c,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:s?`Docker ${c}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),closeQuickTerminalTab:t=>e(n=>{var c;const s=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((c=s[0])==null?void 0:c.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:s,activeQuickTerminalTabId:a,quickTerminalOpen:s.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function Ij(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const qj=e=>({updateInfo:null,updateDismissedVersion:Ij(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const s=n.creationProgress||[],a=s.findIndex(c=>c.step===t.step);if(a>=0){const c=[...s];return c[a]=t,{creationProgress:c}}return{creationProgress:[...s,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),X=Nj((...e)=>({...Cj(...e),...Rj(...e),...zj(...e),...Lj(...e),...Dj(...e),...Fj(...e),...Hj(...e),...qj(...e),reset:()=>{const[t]=e;t({sessions:new Map,sdkSessions:[],currentSessionId:null,connectionStatus:new Map,cliConnected:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:new Map,recentlyRenamed:new Set,mcpServers:new Map,prStatus:new Map,linkedLinearIssues:new Map,messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,pendingPermissions:new Map,aiResolvedPermissions:new Map,sessionTasks:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,sessionProcesses:new Map,toolProgress:new Map,toolActivity:new Map,taskPanelConfigMode:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:K_(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:Z_(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),Vj=Object.freeze(Object.defineProperty({__proto__:null,useStore:X},Symbol.toStringTag,{value:"Module"})),Gj="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",Yj=/invalid authentication credentials|authentication_failed|\b40[13]\s+(?:unauthorized|forbidden)\b|(?:unauthorized|forbidden)[^\n]{0,12}\b40[13]\b|please run\s+`?\/?login|claude login|credentials?\s+(?:expired|invalid|revoked)|oauth token|token\s+(?:expired|revoked)/i;function Wj(e){return Yj.test(e)}function Xj(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:Wj(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const cb=["Swift","Calm","Bold","Bright","Warm","Keen","Vast","Crisp","Agile","Noble","Vivid","Lucid","Brisk","Deft","Fleet","Grand","Lush","Prime","Sage","True","Clear","Deep","Fair","Firm","Glad","Kind","Pure","Rich","Safe","Wise","Fresh","Sharp","Steady","Quick","Gentle","Silent","Golden","Radiant","Serene","Verdant"],ub=["Falcon","River","Cedar","Stone","Ember","Frost","Bloom","Ridge","Crane","Birch","Coral","Dawn","Flint","Grove","Heron","Lark","Maple","Opal","Pearl","Quartz","Reef","Sage","Tide","Vale","Wren","Aspen","Brook","Cliff","Delta","Eagle","Fern","Harbor","Iris","Jade","Lotus","Mesa","Nova","Orbit","Pebble","Summit"];function db(){const e=cb[Math.floor(Math.random()*cb.length)],t=ub[Math.floor(Math.random()*ub.length)];return`${e} ${t}`}function J_(e){for(let t=0;t<100;t++){const n=db();if(!e.has(n))return n}return db()}let yp=null;function Qj(){return yp||(yp=new AudioContext),yp}function Kj(){try{const e=Qj();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),s=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),s.gain.setValueAtTime(.3,t),s.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(s),s.connect(e.destination),n.start(t),n.stop(t+.3);const a=e.createOscillator(),c=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(c),c.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class e5{diff(t,n,s={}){let a;typeof s=="function"?(a=s,s={}):"callback"in s&&(a=s.callback);const c=this.castInput(t,s),u=this.castInput(n,s),f=this.removeEmpty(this.tokenize(c,s)),h=this.removeEmpty(this.tokenize(u,s));return this.diffWithOptionsObj(f,h,s,a)}diffWithOptionsObj(t,n,s,a){var c;const u=A=>{if(A=this.postProcess(A,s),a){setTimeout(function(){a(A)},0);return}else return A},f=n.length,h=t.length;let p=1,g=f+h;s.maxEditLength!=null&&(g=Math.min(g,s.maxEditLength));const v=(c=s.timeout)!==null&&c!==void 0?c:1/0,y=Date.now()+v,b=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(b[0],n,t,0,s);if(b[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(b[0].lastComponent,n,t));let j=-1/0,E=1/0;const k=()=>{for(let A=Math.max(j,-p);A<=Math.min(E,p);A+=2){let C;const L=b[A-1],B=b[A+1];L&&(b[A-1]=void 0);let D=!1;if(B){const F=B.oldPos-A;D=B&&0<=F&&F<f}const U=L&&L.oldPos+1<h;if(!D&&!U){b[A]=void 0;continue}if(!U||D&&L.oldPos<B.oldPos?C=this.addToPath(B,!0,!1,0,s):C=this.addToPath(L,!1,!0,1,s),_=this.extractCommon(C,n,t,A,s),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;b[A]=C,C.oldPos+1>=h&&(E=Math.min(E,A-1)),_+1>=f&&(j=Math.max(j,A+1))}p++};if(a)(function A(){setTimeout(function(){if(p>g||Date.now()>y)return a(void 0);k()||A()},0)})();else for(;p<=g&&Date.now()<=y;){const A=k();if(A)return A}}addToPath(t,n,s,a,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===n&&u.removed===s?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:s,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:s,previousComponent:u}}}extractCommon(t,n,s,a,c){const u=n.length,f=s.length;let h=t.oldPos,p=h-a,g=0;for(;p+1<u&&h+1<f&&this.equals(s[h+1],n[p+1],c);)p++,h++,g++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!c.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,s){return s.comparator?s.comparator(t,n):t===n||!!s.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let s=0;s<t.length;s++)t[s]&&n.push(t[s]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,s){const a=[];let c;for(;t;)a.push(t),c=t.previousComponent,delete t.previousComponent,t=c;a.reverse();const u=a.length;let f=0,h=0,p=0;for(;f<u;f++){const g=a[f];if(g.removed)g.value=this.join(s.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(h,h+g.count);v=v.map(function(y,b){const _=s[p+b];return _.length>y.length?_:y}),g.value=this.join(v)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return a}}function fb(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function hb(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function _m(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function wm(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Do(e,t){return _m(e,t,"")}function Ju(e,t){return wm(e,t,"")}function pb(e,t){return t.slice(0,Zj(e,t))}function Zj(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let s=t.length;e.length<t.length&&(s=e.length);const a=Array(s);let c=0;a[0]=0;for(let u=1;u<s;u++){for(t[u]==t[c]?a[u]=a[c]:a[u]=c;c>0&&t[u]!=t[c];)c=a[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=a[c];e[u]==t[c]&&c++}return c}function t5(e,t){const n=[];for(const s of Array.from(t.segment(e))){const a=s.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function Sm(e,t){if(t)return rc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function gl(e,t){if(t)return rc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function rc(e,t){if(!t)return[gl(e),Sm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=t5(e,t),s=n[0],a=n[n.length-1],c=/\s/.test(s)?s:"",u=/\s/.test(a)?a:"";return[c,u]}const mb="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Jj=new RegExp(`[${mb}]+|\\s+|[^${mb}]`,"ug");class eN extends e5{equals(t,n,s){return s.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let s;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');s=t5(t,u)}else s=t.match(Jj)||[];const a=[];let c=null;return s.forEach(u=>{/\s/.test(u)?c==null?a.push(u):a.push(a.pop()+u):c!=null&&/\s/.test(c)?a[a.length-1]==c?a.push(a.pop()+u):a.push(c+u):a.push(u),c=u}),a}join(t){return t.map((n,s)=>s==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let s=null,a=null,c=null;return t.forEach(u=>{u.added?a=u:u.removed?c=u:((a||c)&&gb(s,c,a,u,n.intlSegmenter),s=u,a=null,c=null)}),(a||c)&&gb(s,c,a,null,n.intlSegmenter),t}}const tN=new eN;function nN(e,t,n){return tN.diff(e,t,n)}function gb(e,t,n,s,a){if(t&&n){const[c,u]=rc(t.value,a),[f,h]=rc(n.value,a);if(e){const p=fb(c,f);e.value=wm(e.value,f,p),t.value=Do(t.value,p),n.value=Do(n.value,p)}if(s){const p=hb(u,h);s.value=_m(s.value,h,p),t.value=Ju(t.value,p),n.value=Ju(n.value,p)}}else if(n){if(e){const c=gl(n.value,a);n.value=n.value.substring(c.length)}if(s){const c=gl(s.value,a);s.value=s.value.substring(c.length)}}else if(e&&s){const c=gl(s.value,a),[u,f]=rc(t.value,a),h=fb(c,u);t.value=Do(t.value,h);const p=hb(Do(c,h),f);t.value=Ju(t.value,p),s.value=_m(s.value,c,p),e.value=wm(e.value,c,c.slice(0,c.length-p.length))}else if(s){const c=gl(s.value,a),u=Sm(t.value,a),f=pb(u,c);t.value=Ju(t.value,f)}else if(e){const c=Sm(e.value,a),u=gl(t.value,a),f=pb(c,u);t.value=Do(t.value,f)}}class rN extends e5{constructor(){super(...arguments),this.tokenize=iN}equals(t,n,s){return s.ignoreWhitespace?((!s.newlineIsToken||!t.includes(`
|
|
48
|
+
`+d.stack}}var fn=Object.prototype.hasOwnProperty,_n=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,Oe=e.unstable_shouldYield,yt=e.unstable_requestPaint,qe=e.unstable_now,Or=e.unstable_getCurrentPriorityLevel,ae=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,W=e.unstable_NormalPriority,fe=e.unstable_LowPriority,Te=e.unstable_IdlePriority,Ye=e.log,tt=e.unstable_setDisableYieldValue,nt=null,vt=null;function hn(r){if(typeof Ye=="function"&&tt(r),vt&&typeof vt.setStrictMode=="function")try{vt.setStrictMode(nt,r)}catch{}}var Ze=Math.clz32?Math.clz32:Yr,nr=Math.log,En=Math.LN2;function Yr(r){return r>>>=0,r===0?32:31-(nr(r)/En|0)|0}var Br=256,Pr=262144,te=4194304;function he(r){var i=r&42;if(i!==0)return i;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function ge(r,i,o){var d=r.pendingLanes;if(d===0)return 0;var m=0,x=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var N=d&134217727;return N!==0?(d=N&~x,d!==0?m=he(d):(w&=N,w!==0?m=he(w):o||(o=N&~r,o!==0&&(m=he(o))))):(N=d&~x,N!==0?m=he(N):w!==0?m=he(w):o||(o=d&~r,o!==0&&(m=he(o)))),m===0?0:i!==0&&i!==m&&(i&x)===0&&(x=m&-m,o=i&-i,x>=o||x===32&&(o&4194048)!==0)?i:m}function We(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function Dt(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function rn(){var r=te;return te<<=1,(te&62914560)===0&&(te=4194304),r}function Tn(r){for(var i=[],o=0;31>o;o++)i.push(r);return i}function Ot(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ln(r,i,o,d,m,x){var w=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var N=r.entanglements,H=r.expirationTimes,ee=r.hiddenUpdates;for(o=w&~o;0<o;){var oe=31-Ze(o),ue=1<<oe;N[oe]=0,H[oe]=-1;var ne=ee[oe];if(ne!==null)for(ee[oe]=null,oe=0;oe<ne.length;oe++){var ie=ne[oe];ie!==null&&(ie.lane&=-536870913)}o&=~ue}d!==0&&mr(r,d,0),x!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=x&~(w&~i))}function mr(r,i,o){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-Ze(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function wa(r,i){var o=r.entangledLanes|=i;for(r=r.entanglements;o;){var d=31-Ze(o),m=1<<d;m&i|r[d]&i&&(r[d]|=i),o&=~m}}function Pl(r,i){var o=i&-i;return o=(o&42)!==0?1:Dn(o),(o&(r.suspendedLanes|i))!==0?0:o}function Dn(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function zi(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function $l(){var r=z.p;return r!==0?r:(r=window.event,r===void 0?32:F1(r.type))}function Ul(r,i){var o=z.p;try{return z.p=r,i()}finally{z.p=o}}var gr=Math.random().toString(36).slice(2),Ht="__reactFiber$"+gr,wn="__reactProps$"+gr,rr="__reactContainer$"+gr,Fl="__reactEvents$"+gr,pf="__reactListeners$"+gr,Li="__reactHandles$"+gr,Di="__reactResources$"+gr,Wr="__reactMarker$"+gr;function Gs(r){delete r[Ht],delete r[wn],delete r[Fl],delete r[pf],delete r[Li]}function ps(r){var i=r[Ht];if(i)return i;for(var o=r.parentNode;o;){if(i=o[rr]||o[Ht]){if(o=i.alternate,i.child!==null||o!==null&&o.child!==null)for(r=j1(r);r!==null;){if(o=r[Ht])return o;r=j1(r)}return i}r=o,o=r.parentNode}return null}function In(r){if(r=r[Ht]||r[rr]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Oi(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(s(33))}function Xr(r){var i=r[Di];return i||(i=r[Di]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Yt(r){r[Wr]=!0}var qn=new Set,Sa={};function $r(r,i){Qr(r,i),Qr(r+"Capture",i)}function Qr(r,i){for(Sa[r]=i,r=0;r<i.length;r++)qn.add(i[r])}var Hl=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Il={},Wt={};function mf(r){return fn.call(Wt,r)?!0:fn.call(Il,r)?!1:Hl.test(r)?Wt[r]=!0:(Il[r]=!0,!1)}function Bi(r,i,o){if(mf(i))if(o===null)r.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+o)}}function ka(r,i,o){if(o===null)r.removeAttribute(i);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+o)}}function Ur(r,i,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(i,o,""+d)}}function Vn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Dc(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function ql(r,i,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,x=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return m.call(this)},set:function(w){o=""+w,x.call(this,w)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(w){o=""+w},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function ja(r){if(!r._valueTracker){var i=Dc(r)?"checked":"value";r._valueTracker=ql(r,i,""+r[i])}}function Kr(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var o=i.getValue(),d="";return r&&(d=Dc(r)?r.checked?"true":"false":r.value),r=d,r!==o?(i.setValue(r),!0):!1}function Ys(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var xr=/[\n"\\]/g;function Jt(r){return r.replace(xr,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Pi(r,i,o,d,m,x,w,N){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),i!=null?w==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Vn(i)):r.value!==""+Vn(i)&&(r.value=""+Vn(i)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),i!=null?Na(r,w,Vn(i)):o!=null?Na(r,w,Vn(o)):d!=null&&r.removeAttribute("value"),m==null&&x!=null&&(r.defaultChecked=!!x),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?r.name=""+Vn(N):r.removeAttribute("name")}function Oc(r,i,o,d,m,x,w,N){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(r.type=x),i!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){ja(r);return}o=o!=null?""+Vn(o):"",i=i!=null?""+Vn(i):o,N||i===r.value||(r.value=i),r.defaultValue=i}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=N?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),ja(r)}function Na(r,i,o){i==="number"&&Ys(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function Ws(r,i,o,d){if(r=r.options,i){i={};for(var m=0;m<o.length;m++)i["$"+o[m]]=!0;for(o=0;o<r.length;o++)m=i.hasOwnProperty("$"+r[o].value),r[o].selected!==m&&(r[o].selected=m),m&&d&&(r[o].defaultSelected=!0)}else{for(o=""+Vn(o),i=null,m=0;m<r.length;m++){if(r[m].value===o){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}i!==null||r[m].disabled||(i=r[m])}i!==null&&(i.selected=!0)}}function Ca(r,i,o){if(i!=null&&(i=""+Vn(i),i!==r.value&&(r.value=i),o==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=o!=null?""+Vn(o):""}function Vl(r,i,o,d){if(i==null){if(d!=null){if(o!=null)throw Error(s(92));if(G(d)){if(1<d.length)throw Error(s(93));d=d[0]}o=d}o==null&&(o=""),i=o}o=Vn(i),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),ja(r)}function Xs(r,i){if(i){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=i;return}}r.textContent=i}var gf=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Bc(r,i,o){var d=i.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,o):typeof o!="number"||o===0||gf.has(i)?i==="float"?r.cssFloat=o:r[i]=(""+o).trim():r[i]=o+"px"}function Pc(r,i,o){if(i!=null&&typeof i!="object")throw Error(s(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var m in i)d=i[m],i.hasOwnProperty(m)&&o[m]!==d&&Bc(r,m,d)}else for(var x in i)i.hasOwnProperty(x)&&Bc(r,x,i[x])}function Ea(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $c=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),xf=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ta(r){return xf.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function vr(){}var Qs=null;function Aa(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ks=null,Zs=null;function Uc(r){var i=In(r);if(i&&(r=i.stateNode)){var o=r[wn]||null;e:switch(r=i.stateNode,i.type){case"input":if(Pi(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),i=o.name,o.type==="radio"&&i!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Jt(""+i)+'"][type="radio"]'),i=0;i<o.length;i++){var d=o[i];if(d!==r&&d.form===r.form){var m=d[wn]||null;if(!m)throw Error(s(90));Pi(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(i=0;i<o.length;i++)d=o[i],d.form===r.form&&Kr(d)}break e;case"textarea":Ca(r,o.value,o.defaultValue);break e;case"select":i=o.value,i!=null&&Ws(r,!!o.multiple,i,!1)}}}var Gl=!1;function Fc(r,i,o){if(Gl)return r(i,o);Gl=!0;try{var d=r(i);return d}finally{if(Gl=!1,(Ks!==null||Zs!==null)&&(Tu(),Ks&&(i=Ks,r=Zs,Zs=Ks=null,Uc(i),r)))for(i=0;i<r.length;i++)Uc(r[i])}}function $i(r,i){var o=r.stateNode;if(o===null)return null;var d=o[wn]||null;if(d===null)return null;o=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(s(231,i,typeof o));return o}var br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ma=!1;if(br)try{var Js={};Object.defineProperty(Js,"passive",{get:function(){Ma=!0}}),window.addEventListener("test",Js,Js),window.removeEventListener("test",Js,Js)}catch{Ma=!1}var q=null,de=null,Xe=null;function ht(){if(Xe)return Xe;var r,i=de,o=i.length,d,m="value"in q?q.value:q.textContent,x=m.length;for(r=0;r<o&&i[r]===m[r];r++);var w=o-r;for(d=1;d<=w&&i[o-d]===m[x-d];d++);return Xe=m.slice(r,1<d?1-d:void 0)}function it(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function Fe(){return!0}function On(){return!1}function pn(r){function i(o,d,m,x,w){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var N in r)r.hasOwnProperty(N)&&(o=r[N],this[N]=o?o(x):x[N]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Fe:On,this.isPropagationStopped=On,this}return v(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Fe)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Fe)},persist:function(){},isPersistent:Fe}),i}var yr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ms=pn(yr),mn=v({},yr,{view:0,detail:0}),Hc=pn(mn),Yl,Wl,Ui,Fi=v({},mn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bf,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ui&&(Ui&&r.type==="mousemove"?(Yl=r.screenX-Ui.screenX,Wl=r.screenY-Ui.screenY):Wl=Yl=0,Ui=r),Yl)},movementY:function(r){return"movementY"in r?r.movementY:Wl}}),vf=pn(Fi),Ic=v({},Fi,{dataTransfer:0}),qc=pn(Ic),Vc=v({},mn,{relatedTarget:0}),Zr=pn(Vc),Gc=v({},yr,{animationName:0,elapsedTime:0,pseudoElement:0}),Yc=pn(Gc),Ra=v({},yr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),mS=pn(Ra),gS=v({},yr,{data:0}),_x=pn(gS),xS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vS={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},bS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yS(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=bS[r])?!!i[r]:!1}function bf(){return yS}var _S=v({},mn,{key:function(r){if(r.key){var i=xS[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=it(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?vS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bf,charCode:function(r){return r.type==="keypress"?it(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?it(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),wS=pn(_S),SS=v({},Fi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wx=pn(SS),kS=v({},mn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bf}),jS=pn(kS),NS=v({},yr,{propertyName:0,elapsedTime:0,pseudoElement:0}),CS=pn(NS),ES=v({},Fi,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),TS=pn(ES),AS=v({},yr,{newState:0,oldState:0}),MS=pn(AS),RS=[9,13,27,32],yf=br&&"CompositionEvent"in window,Xl=null;br&&"documentMode"in document&&(Xl=document.documentMode);var zS=br&&"TextEvent"in window&&!Xl,Sx=br&&(!yf||Xl&&8<Xl&&11>=Xl),kx=" ",jx=!1;function Nx(r,i){switch(r){case"keyup":return RS.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var za=!1;function LS(r,i){switch(r){case"compositionend":return Cx(i);case"keypress":return i.which!==32?null:(jx=!0,kx);case"textInput":return r=i.data,r===kx&&jx?null:r;default:return null}}function DS(r,i){if(za)return r==="compositionend"||!yf&&Nx(r,i)?(r=ht(),Xe=de=q=null,za=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Sx&&i.locale!=="ko"?null:i.data;default:return null}}var OS={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ex(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!OS[r.type]:i==="textarea"}function Tx(r,i,o,d){Ks?Zs?Zs.push(d):Zs=[d]:Ks=d,i=Ou(i,"onChange"),0<i.length&&(o=new ms("onChange","change",null,o,d),r.push({event:o,listeners:i}))}var Ql=null,Kl=null;function BS(r){d1(r,0)}function Wc(r){var i=Oi(r);if(Kr(i))return r}function Ax(r,i){if(r==="change")return i}var Mx=!1;if(br){var _f;if(br){var wf="oninput"in document;if(!wf){var Rx=document.createElement("div");Rx.setAttribute("oninput","return;"),wf=typeof Rx.oninput=="function"}_f=wf}else _f=!1;Mx=_f&&(!document.documentMode||9<document.documentMode)}function zx(){Ql&&(Ql.detachEvent("onpropertychange",Lx),Kl=Ql=null)}function Lx(r){if(r.propertyName==="value"&&Wc(Kl)){var i=[];Tx(i,Kl,r,Aa(r)),Fc(BS,i)}}function PS(r,i,o){r==="focusin"?(zx(),Ql=i,Kl=o,Ql.attachEvent("onpropertychange",Lx)):r==="focusout"&&zx()}function $S(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Wc(Kl)}function US(r,i){if(r==="click")return Wc(i)}function FS(r,i){if(r==="input"||r==="change")return Wc(i)}function HS(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var sr=typeof Object.is=="function"?Object.is:HS;function Zl(r,i){if(sr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var o=Object.keys(r),d=Object.keys(i);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!fn.call(i,m)||!sr(r[m],i[m]))return!1}return!0}function Dx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Ox(r,i){var o=Dx(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=i&&d>=i)return{node:o,offset:i-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Dx(o)}}function Bx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?Bx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function Px(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Ys(r.document);i instanceof r.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)r=i.contentWindow;else break;i=Ys(r.document)}return i}function Sf(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var IS=br&&"documentMode"in document&&11>=document.documentMode,La=null,kf=null,Jl=null,jf=!1;function $x(r,i,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;jf||La==null||La!==Ys(d)||(d=La,"selectionStart"in d&&Sf(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Jl&&Zl(Jl,d)||(Jl=d,d=Ou(kf,"onSelect"),0<d.length&&(i=new ms("onSelect","select",null,i,o),r.push({event:i,listeners:d}),i.target=La)))}function Hi(r,i){var o={};return o[r.toLowerCase()]=i.toLowerCase(),o["Webkit"+r]="webkit"+i,o["Moz"+r]="moz"+i,o}var Da={animationend:Hi("Animation","AnimationEnd"),animationiteration:Hi("Animation","AnimationIteration"),animationstart:Hi("Animation","AnimationStart"),transitionrun:Hi("Transition","TransitionRun"),transitionstart:Hi("Transition","TransitionStart"),transitioncancel:Hi("Transition","TransitionCancel"),transitionend:Hi("Transition","TransitionEnd")},Nf={},Ux={};br&&(Ux=document.createElement("div").style,"AnimationEvent"in window||(delete Da.animationend.animation,delete Da.animationiteration.animation,delete Da.animationstart.animation),"TransitionEvent"in window||delete Da.transitionend.transition);function Ii(r){if(Nf[r])return Nf[r];if(!Da[r])return r;var i=Da[r],o;for(o in i)if(i.hasOwnProperty(o)&&o in Ux)return Nf[r]=i[o];return r}var Fx=Ii("animationend"),Hx=Ii("animationiteration"),Ix=Ii("animationstart"),qS=Ii("transitionrun"),VS=Ii("transitionstart"),GS=Ii("transitioncancel"),qx=Ii("transitionend"),Vx=new Map,Cf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Cf.push("scrollEnd");function Fr(r,i){Vx.set(r,i),$r(i,[r])}var Xc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},_r=[],Oa=0,Ef=0;function Qc(){for(var r=Oa,i=Ef=Oa=0;i<r;){var o=_r[i];_r[i++]=null;var d=_r[i];_r[i++]=null;var m=_r[i];_r[i++]=null;var x=_r[i];if(_r[i++]=null,d!==null&&m!==null){var w=d.pending;w===null?m.next=m:(m.next=w.next,w.next=m),d.pending=m}x!==0&&Gx(o,m,x)}}function Kc(r,i,o,d){_r[Oa++]=r,_r[Oa++]=i,_r[Oa++]=o,_r[Oa++]=d,Ef|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Tf(r,i,o,d){return Kc(r,i,o,d),Zc(r)}function qi(r,i){return Kc(r,null,null,i),Zc(r)}function Gx(r,i,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var m=!1,x=r.return;x!==null;)x.childLanes|=o,d=x.alternate,d!==null&&(d.childLanes|=o),x.tag===22&&(r=x.stateNode,r===null||r._visibility&1||(m=!0)),r=x,x=x.return;return r.tag===3?(x=r.stateNode,m&&i!==null&&(m=31-Ze(o),r=x.hiddenUpdates,d=r[m],d===null?r[m]=[i]:d.push(i),i.lane=o|536870912),x):null}function Zc(r){if(50<wo)throw wo=0,Ph=null,Error(s(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var Ba={};function YS(r,i,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ir(r,i,o,d){return new YS(r,i,o,d)}function Af(r){return r=r.prototype,!(!r||!r.isReactComponent)}function gs(r,i){var o=r.alternate;return o===null?(o=ir(r.tag,i,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=i,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,i=r.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Yx(r,i){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,i=o.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function Jc(r,i,o,d,m,x){var w=0;if(d=r,typeof r=="function")Af(r)&&(w=1);else if(typeof r=="string")w=Zk(r,o,pe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case Y:return r=ir(31,o,i,m),r.elementType=Y,r.lanes=x,r;case j:return Vi(o.children,m,x,i);case E:w=8,m|=24;break;case k:return r=ir(12,o,i,m|2),r.elementType=k,r.lanes=x,r;case B:return r=ir(13,o,i,m),r.elementType=B,r.lanes=x,r;case D:return r=ir(19,o,i,m),r.elementType=D,r.lanes=x,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:w=10;break e;case A:w=9;break e;case L:w=11;break e;case U:w=14;break e;case F:w=16,d=null;break e}w=29,o=Error(s(130,r===null?"null":typeof r,"")),d=null}return i=ir(w,o,i,m),i.elementType=r,i.type=d,i.lanes=x,i}function Vi(r,i,o,d){return r=ir(7,r,d,i),r.lanes=o,r}function Mf(r,i,o){return r=ir(6,r,null,i),r.lanes=o,r}function Wx(r){var i=ir(18,null,null,0);return i.stateNode=r,i}function Rf(r,i,o){return i=ir(4,r.children!==null?r.children:[],r.key,i),i.lanes=o,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Xx=new WeakMap;function wr(r,i){if(typeof r=="object"&&r!==null){var o=Xx.get(r);return o!==void 0?o:(i={value:r,source:i,stack:st(i)},Xx.set(r,i),i)}return{value:r,source:i,stack:st(i)}}var Pa=[],$a=0,eu=null,eo=0,Sr=[],kr=0,ei=null,Jr=1,es="";function xs(r,i){Pa[$a++]=eo,Pa[$a++]=eu,eu=r,eo=i}function Qx(r,i,o){Sr[kr++]=Jr,Sr[kr++]=es,Sr[kr++]=ei,ei=r;var d=Jr;r=es;var m=32-Ze(d)-1;d&=~(1<<m),o+=1;var x=32-Ze(i)+m;if(30<x){var w=m-m%5;x=(d&(1<<w)-1).toString(32),d>>=w,m-=w,Jr=1<<32-Ze(i)+m|o<<m|d,es=x+r}else Jr=1<<x|o<<m|d,es=r}function zf(r){r.return!==null&&(xs(r,1),Qx(r,1,0))}function Lf(r){for(;r===eu;)eu=Pa[--$a],Pa[$a]=null,eo=Pa[--$a],Pa[$a]=null;for(;r===ei;)ei=Sr[--kr],Sr[kr]=null,es=Sr[--kr],Sr[kr]=null,Jr=Sr[--kr],Sr[kr]=null}function Kx(r,i){Sr[kr++]=Jr,Sr[kr++]=es,Sr[kr++]=ei,Jr=i.id,es=i.overflow,ei=r}var Sn=null,Pt=null,dt=!1,ti=null,jr=!1,Df=Error(s(519));function ni(r){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw to(wr(i,r)),Df}function Zx(r){var i=r.stateNode,o=r.type,d=r.memoizedProps;switch(i[Ht]=r,i[wn]=d,o){case"dialog":lt("cancel",i),lt("close",i);break;case"iframe":case"object":case"embed":lt("load",i);break;case"video":case"audio":for(o=0;o<ko.length;o++)lt(ko[o],i);break;case"source":lt("error",i);break;case"img":case"image":case"link":lt("error",i),lt("load",i);break;case"details":lt("toggle",i);break;case"input":lt("invalid",i),Oc(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":lt("invalid",i);break;case"textarea":lt("invalid",i),Vl(i,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||i.textContent===""+o||d.suppressHydrationWarning===!0||m1(i.textContent,o)?(d.popover!=null&&(lt("beforetoggle",i),lt("toggle",i)),d.onScroll!=null&<("scroll",i),d.onScrollEnd!=null&<("scrollend",i),d.onClick!=null&&(i.onclick=vr),i=!0):i=!1,i||ni(r,!0)}function Jx(r){for(Sn=r.return;Sn;)switch(Sn.tag){case 5:case 31:case 13:jr=!1;return;case 27:case 3:jr=!0;return;default:Sn=Sn.return}}function Ua(r){if(r!==Sn)return!1;if(!dt)return Jx(r),dt=!0,!1;var i=r.tag,o;if((o=i!==3&&i!==27)&&((o=i===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||Jh(r.type,r.memoizedProps)),o=!o),o&&Pt&&ni(r),Jx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Pt=k1(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Pt=k1(r)}else i===27?(i=Pt,gi(r.type)?(r=sp,sp=null,Pt=r):Pt=i):Pt=Sn?Cr(r.stateNode.nextSibling):null;return!0}function Gi(){Pt=Sn=null,dt=!1}function Of(){var r=ti;return r!==null&&(Xn===null?Xn=r:Xn.push.apply(Xn,r),ti=null),r}function to(r){ti===null?ti=[r]:ti.push(r)}var Bf=P(null),Yi=null,vs=null;function ri(r,i,o){M(Bf,i._currentValue),i._currentValue=o}function bs(r){r._currentValue=Bf.current,Z(Bf)}function Pf(r,i,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===o)break;r=r.return}}function $f(r,i,o,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var N=x;x=m;for(var H=0;H<i.length;H++)if(N.context===i[H]){x.lanes|=o,N=x.alternate,N!==null&&(N.lanes|=o),Pf(x.return,o,r),d||(w=null);break e}x=N.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(s(341));w.lanes|=o,x=w.alternate,x!==null&&(x.lanes|=o),Pf(w,o,r),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===r){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function Fa(r,i,o,d){r=null;for(var m=i,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(s(387));if(w=w.memoizedProps,w!==null){var N=m.type;sr(m.pendingProps.value,w.value)||(r!==null?r.push(N):r=[N])}}else if(m===Ae.current){if(w=m.alternate,w===null)throw Error(s(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(To):r=[To])}m=m.return}r!==null&&$f(i,r,o,d),i.flags|=262144}function tu(r){for(r=r.firstContext;r!==null;){if(!sr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Wi(r){Yi=r,vs=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function kn(r){return e0(Yi,r)}function nu(r,i){return Yi===null&&Wi(r),e0(r,i)}function e0(r,i){var o=i._currentValue;if(i={context:i,memoizedValue:o,next:null},vs===null){if(r===null)throw Error(s(308));vs=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else vs=vs.next=i;return o}var WS=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(o){return o()})}},XS=e.unstable_scheduleCallback,QS=e.unstable_NormalPriority,sn={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uf(){return{controller:new WS,data:new Map,refCount:0}}function no(r){r.refCount--,r.refCount===0&&XS(QS,function(){r.controller.abort()})}var ro=null,Ff=0,Ha=0,Ia=null;function KS(r,i){if(ro===null){var o=ro=[];Ff=0,Ha=qh(),Ia={status:"pending",value:void 0,then:function(d){o.push(d)}}}return Ff++,i.then(t0,t0),i}function t0(){if(--Ff===0&&ro!==null){Ia!==null&&(Ia.status="fulfilled");var r=ro;ro=null,Ha=0,Ia=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function ZS(r,i){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var m=0;m<o.length;m++)(0,o[m])(i)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var n0=$.S;$.S=function(r,i){$v=qe(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&KS(r,i),n0!==null&&n0(r,i)};var Xi=P(null);function Hf(){var r=Xi.current;return r!==null?r:Et.pooledCache}function ru(r,i){i===null?M(Xi,Xi.current):M(Xi,i.pool)}function r0(){var r=Hf();return r===null?null:{parent:sn._currentValue,pool:r}}var qa=Error(s(460)),If=Error(s(474)),su=Error(s(542)),iu={then:function(){}};function s0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function i0(r,i,o){switch(o=r[o],o===void 0?r.push(i):o!==i&&(i.then(vr,vr),i=o),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,l0(r),r;default:if(typeof i.status=="string")i.then(vr,vr);else{if(r=Et,r!==null&&100<r.shellSuspendCounter)throw Error(s(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var m=i;m.status="fulfilled",m.value=d}},function(d){if(i.status==="pending"){var m=i;m.status="rejected",m.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,l0(r),r}throw Ki=i,qa}}function Qi(r){try{var i=r._init;return i(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Ki=o,qa):o}}var Ki=null;function a0(){if(Ki===null)throw Error(s(459));var r=Ki;return Ki=null,r}function l0(r){if(r===qa||r===su)throw Error(s(483))}var Va=null,so=0;function au(r){var i=so;return so+=1,Va===null&&(Va=[]),i0(Va,r,i)}function io(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function lu(r,i){throw i.$$typeof===y?Error(s(525)):(r=Object.prototype.toString.call(i),Error(s(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function o0(r){function i(K,V){if(r){var J=K.deletions;J===null?(K.deletions=[V],K.flags|=16):J.push(V)}}function o(K,V){if(!r)return null;for(;V!==null;)i(K,V),V=V.sibling;return null}function d(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function m(K,V){return K=gs(K,V),K.index=0,K.sibling=null,K}function x(K,V,J){return K.index=J,r?(J=K.alternate,J!==null?(J=J.index,J<V?(K.flags|=67108866,V):J):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function w(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function N(K,V,J,ce){return V===null||V.tag!==6?(V=Mf(J,K.mode,ce),V.return=K,V):(V=m(V,J),V.return=K,V)}function H(K,V,J,ce){var Be=J.type;return Be===j?oe(K,V,J.props.children,ce,J.key):V!==null&&(V.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===F&&Qi(Be)===V.type)?(V=m(V,J.props),io(V,J),V.return=K,V):(V=Jc(J.type,J.key,J.props,null,K.mode,ce),io(V,J),V.return=K,V)}function ee(K,V,J,ce){return V===null||V.tag!==4||V.stateNode.containerInfo!==J.containerInfo||V.stateNode.implementation!==J.implementation?(V=Rf(J,K.mode,ce),V.return=K,V):(V=m(V,J.children||[]),V.return=K,V)}function oe(K,V,J,ce,Be){return V===null||V.tag!==7?(V=Vi(J,K.mode,ce,Be),V.return=K,V):(V=m(V,J),V.return=K,V)}function ue(K,V,J){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Mf(""+V,K.mode,J),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case b:return J=Jc(V.type,V.key,V.props,null,K.mode,J),io(J,V),J.return=K,J;case _:return V=Rf(V,K.mode,J),V.return=K,V;case F:return V=Qi(V),ue(K,V,J)}if(G(V)||T(V))return V=Vi(V,K.mode,J,null),V.return=K,V;if(typeof V.then=="function")return ue(K,au(V),J);if(V.$$typeof===C)return ue(K,nu(K,V),J);lu(K,V)}return null}function ne(K,V,J,ce){var Be=V!==null?V.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Be!==null?null:N(K,V,""+J,ce);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return J.key===Be?H(K,V,J,ce):null;case _:return J.key===Be?ee(K,V,J,ce):null;case F:return J=Qi(J),ne(K,V,J,ce)}if(G(J)||T(J))return Be!==null?null:oe(K,V,J,ce,null);if(typeof J.then=="function")return ne(K,V,au(J),ce);if(J.$$typeof===C)return ne(K,V,nu(K,J),ce);lu(K,J)}return null}function ie(K,V,J,ce,Be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return K=K.get(J)||null,N(V,K,""+ce,Be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case b:return K=K.get(ce.key===null?J:ce.key)||null,H(V,K,ce,Be);case _:return K=K.get(ce.key===null?J:ce.key)||null,ee(V,K,ce,Be);case F:return ce=Qi(ce),ie(K,V,J,ce,Be)}if(G(ce)||T(ce))return K=K.get(J)||null,oe(V,K,ce,Be,null);if(typeof ce.then=="function")return ie(K,V,J,au(ce),Be);if(ce.$$typeof===C)return ie(K,V,J,nu(V,ce),Be);lu(V,ce)}return null}function Ee(K,V,J,ce){for(var Be=null,mt=null,Me=V,Je=V=0,ut=null;Me!==null&&Je<J.length;Je++){Me.index>Je?(ut=Me,Me=null):ut=Me.sibling;var gt=ne(K,Me,J[Je],ce);if(gt===null){Me===null&&(Me=ut);break}r&&Me&>.alternate===null&&i(K,Me),V=x(gt,V,Je),mt===null?Be=gt:mt.sibling=gt,mt=gt,Me=ut}if(Je===J.length)return o(K,Me),dt&&xs(K,Je),Be;if(Me===null){for(;Je<J.length;Je++)Me=ue(K,J[Je],ce),Me!==null&&(V=x(Me,V,Je),mt===null?Be=Me:mt.sibling=Me,mt=Me);return dt&&xs(K,Je),Be}for(Me=d(Me);Je<J.length;Je++)ut=ie(Me,K,Je,J[Je],ce),ut!==null&&(r&&ut.alternate!==null&&Me.delete(ut.key===null?Je:ut.key),V=x(ut,V,Je),mt===null?Be=ut:mt.sibling=ut,mt=ut);return r&&Me.forEach(function(_i){return i(K,_i)}),dt&&xs(K,Je),Be}function Ue(K,V,J,ce){if(J==null)throw Error(s(151));for(var Be=null,mt=null,Me=V,Je=V=0,ut=null,gt=J.next();Me!==null&&!gt.done;Je++,gt=J.next()){Me.index>Je?(ut=Me,Me=null):ut=Me.sibling;var _i=ne(K,Me,gt.value,ce);if(_i===null){Me===null&&(Me=ut);break}r&&Me&&_i.alternate===null&&i(K,Me),V=x(_i,V,Je),mt===null?Be=_i:mt.sibling=_i,mt=_i,Me=ut}if(gt.done)return o(K,Me),dt&&xs(K,Je),Be;if(Me===null){for(;!gt.done;Je++,gt=J.next())gt=ue(K,gt.value,ce),gt!==null&&(V=x(gt,V,Je),mt===null?Be=gt:mt.sibling=gt,mt=gt);return dt&&xs(K,Je),Be}for(Me=d(Me);!gt.done;Je++,gt=J.next())gt=ie(Me,K,Je,gt.value,ce),gt!==null&&(r&>.alternate!==null&&Me.delete(gt.key===null?Je:gt.key),V=x(gt,V,Je),mt===null?Be=gt:mt.sibling=gt,mt=gt);return r&&Me.forEach(function(cj){return i(K,cj)}),dt&&xs(K,Je),Be}function jt(K,V,J,ce){if(typeof J=="object"&&J!==null&&J.type===j&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case b:e:{for(var Be=J.key;V!==null;){if(V.key===Be){if(Be=J.type,Be===j){if(V.tag===7){o(K,V.sibling),ce=m(V,J.props.children),ce.return=K,K=ce;break e}}else if(V.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===F&&Qi(Be)===V.type){o(K,V.sibling),ce=m(V,J.props),io(ce,J),ce.return=K,K=ce;break e}o(K,V);break}else i(K,V);V=V.sibling}J.type===j?(ce=Vi(J.props.children,K.mode,ce,J.key),ce.return=K,K=ce):(ce=Jc(J.type,J.key,J.props,null,K.mode,ce),io(ce,J),ce.return=K,K=ce)}return w(K);case _:e:{for(Be=J.key;V!==null;){if(V.key===Be)if(V.tag===4&&V.stateNode.containerInfo===J.containerInfo&&V.stateNode.implementation===J.implementation){o(K,V.sibling),ce=m(V,J.children||[]),ce.return=K,K=ce;break e}else{o(K,V);break}else i(K,V);V=V.sibling}ce=Rf(J,K.mode,ce),ce.return=K,K=ce}return w(K);case F:return J=Qi(J),jt(K,V,J,ce)}if(G(J))return Ee(K,V,J,ce);if(T(J)){if(Be=T(J),typeof Be!="function")throw Error(s(150));return J=Be.call(J),Ue(K,V,J,ce)}if(typeof J.then=="function")return jt(K,V,au(J),ce);if(J.$$typeof===C)return jt(K,V,nu(K,J),ce);lu(K,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,V!==null&&V.tag===6?(o(K,V.sibling),ce=m(V,J),ce.return=K,K=ce):(o(K,V),ce=Mf(J,K.mode,ce),ce.return=K,K=ce),w(K)):o(K,V)}return function(K,V,J,ce){try{so=0;var Be=jt(K,V,J,ce);return Va=null,Be}catch(Me){if(Me===qa||Me===su)throw Me;var mt=ir(29,Me,null,K.mode);return mt.lanes=ce,mt.return=K,mt}finally{}}}var Zi=o0(!0),c0=o0(!1),si=!1;function qf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vf(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function ii(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ai(r,i,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(xt&2)!==0){var m=d.pending;return m===null?i.next=i:(i.next=m.next,m.next=i),d.pending=i,i=Zc(r),Gx(r,null,o),i}return Kc(r,d,i,o),Zc(r)}function ao(r,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,o|=d,i.lanes=o,wa(r,o)}}function Gf(r,i){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var w={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,o=o.next}while(o!==null);x===null?m=x=i:x=x.next=i}else m=x=i;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=i:r.next=i,o.lastBaseUpdate=i}var Yf=!1;function lo(){if(Yf){var r=Ia;if(r!==null)throw r}}function oo(r,i,o,d){Yf=!1;var m=r.updateQueue;si=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var H=N,ee=H.next;H.next=null,w===null?x=ee:w.next=ee,w=H;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,N=oe.lastBaseUpdate,N!==w&&(N===null?oe.firstBaseUpdate=ee:N.next=ee,oe.lastBaseUpdate=H))}if(x!==null){var ue=m.baseState;w=0,oe=ee=H=null,N=x;do{var ne=N.lane&-536870913,ie=ne!==N.lane;if(ie?(ct&ne)===ne:(d&ne)===ne){ne!==0&&ne===Ha&&(Yf=!0),oe!==null&&(oe=oe.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Ee=r,Ue=N;ne=i;var jt=o;switch(Ue.tag){case 1:if(Ee=Ue.payload,typeof Ee=="function"){ue=Ee.call(jt,ue,ne);break e}ue=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=Ue.payload,ne=typeof Ee=="function"?Ee.call(jt,ue,ne):Ee,ne==null)break e;ue=v({},ue,ne);break e;case 2:si=!0}}ne=N.callback,ne!==null&&(r.flags|=64,ie&&(r.flags|=8192),ie=m.callbacks,ie===null?m.callbacks=[ne]:ie.push(ne))}else ie={lane:ne,tag:N.tag,payload:N.payload,callback:N.callback,next:null},oe===null?(ee=oe=ie,H=ue):oe=oe.next=ie,w|=ne;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;ie=N,N=ie.next,ie.next=null,m.lastBaseUpdate=ie,m.shared.pending=null}}while(!0);oe===null&&(H=ue),m.baseState=H,m.firstBaseUpdate=ee,m.lastBaseUpdate=oe,x===null&&(m.shared.lanes=0),di|=w,r.lanes=w,r.memoizedState=ue}}function u0(r,i){if(typeof r!="function")throw Error(s(191,r));r.call(i)}function d0(r,i){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)u0(o[r],i)}var Ga=P(null),ou=P(0);function f0(r,i){r=Es,M(ou,r),M(Ga,i),Es=r|i.baseLanes}function Wf(){M(ou,Es),M(Ga,Ga.current)}function Xf(){Es=ou.current,Z(Ga),Z(ou)}var ar=P(null),Nr=null;function li(r){var i=r.alternate;M(en,en.current&1),M(ar,r),Nr===null&&(i===null||Ga.current!==null||i.memoizedState!==null)&&(Nr=r)}function Qf(r){M(en,en.current),M(ar,r),Nr===null&&(Nr=r)}function h0(r){r.tag===22?(M(en,en.current),M(ar,r),Nr===null&&(Nr=r)):oi()}function oi(){M(en,en.current),M(ar,ar.current)}function lr(r){Z(ar),Nr===r&&(Nr=null),Z(en)}var en=P(0);function cu(r){for(var i=r;i!==null;){if(i.tag===13){var o=i.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||np(o)||rp(o)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var ys=0,Ke=null,St=null,an=null,uu=!1,Ya=!1,Ji=!1,du=0,co=0,Wa=null,JS=0;function Qt(){throw Error(s(321))}function Kf(r,i){if(i===null)return!1;for(var o=0;o<i.length&&o<r.length;o++)if(!sr(r[o],i[o]))return!1;return!0}function Zf(r,i,o,d,m,x){return ys=x,Ke=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,$.H=r===null||r.memoizedState===null?Q0:hh,Ji=!1,x=o(d,m),Ji=!1,Ya&&(x=m0(i,o,d,m)),p0(r),x}function p0(r){$.H=ho;var i=St!==null&&St.next!==null;if(ys=0,an=St=Ke=null,uu=!1,co=0,Wa=null,i)throw Error(s(300));r===null||ln||(r=r.dependencies,r!==null&&tu(r)&&(ln=!0))}function m0(r,i,o,d){Ke=r;var m=0;do{if(Ya&&(Wa=null),co=0,Ya=!1,25<=m)throw Error(s(301));if(m+=1,an=St=null,r.updateQueue!=null){var x=r.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}$.H=K0,x=i(o,d)}while(Ya);return x}function ek(){var r=$.H,i=r.useState()[0];return i=typeof i.then=="function"?uo(i):i,r=r.useState()[0],(St!==null?St.memoizedState:null)!==r&&(Ke.flags|=1024),i}function Jf(){var r=du!==0;return du=0,r}function eh(r,i,o){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~o}function th(r){if(uu){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}uu=!1}ys=0,an=St=Ke=null,Ya=!1,co=du=0,Wa=null}function Bn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return an===null?Ke.memoizedState=an=r:an=an.next=r,an}function tn(){if(St===null){var r=Ke.alternate;r=r!==null?r.memoizedState:null}else r=St.next;var i=an===null?Ke.memoizedState:an.next;if(i!==null)an=i,St=r;else{if(r===null)throw Ke.alternate===null?Error(s(467)):Error(s(310));St=r,r={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},an===null?Ke.memoizedState=an=r:an=an.next=r}return an}function fu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uo(r){var i=co;return co+=1,Wa===null&&(Wa=[]),r=i0(Wa,r,i),i=Ke,(an===null?i.memoizedState:an.next)===null&&(i=i.alternate,$.H=i===null||i.memoizedState===null?Q0:hh),r}function hu(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return uo(r);if(r.$$typeof===C)return kn(r)}throw Error(s(438,String(r)))}function nh(r){var i=null,o=Ke.updateQueue;if(o!==null&&(i=o.memoCache),i==null){var d=Ke.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(m){return m.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),o===null&&(o=fu(),Ke.updateQueue=o),o.memoCache=i,o=i.data[i.index],o===void 0)for(o=i.data[i.index]=Array(r),d=0;d<r;d++)o[d]=O;return i.index++,o}function _s(r,i){return typeof i=="function"?i(r):i}function pu(r){var i=tn();return rh(i,St,r)}function rh(r,i,o){var d=r.queue;if(d===null)throw Error(s(311));d.lastRenderedReducer=o;var m=r.baseQueue,x=d.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}i.baseQueue=m=x,d.pending=null}if(x=r.baseState,m===null)r.memoizedState=x;else{i=m.next;var N=w=null,H=null,ee=i,oe=!1;do{var ue=ee.lane&-536870913;if(ue!==ee.lane?(ct&ue)===ue:(ys&ue)===ue){var ne=ee.revertLane;if(ne===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),ue===Ha&&(oe=!0);else if((ys&ne)===ne){ee=ee.next,ne===Ha&&(oe=!0);continue}else ue={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=ue,w=x):H=H.next=ue,Ke.lanes|=ne,di|=ne;ue=ee.action,Ji&&o(x,ue),x=ee.hasEagerState?ee.eagerState:o(x,ue)}else ne={lane:ue,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},H===null?(N=H=ne,w=x):H=H.next=ne,Ke.lanes|=ue,di|=ue;ee=ee.next}while(ee!==null&&ee!==i);if(H===null?w=x:H.next=N,!sr(x,r.memoizedState)&&(ln=!0,oe&&(o=Ia,o!==null)))throw o;r.memoizedState=x,r.baseState=w,r.baseQueue=H,d.lastRenderedState=x}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function sh(r){var i=tn(),o=i.queue;if(o===null)throw Error(s(311));o.lastRenderedReducer=r;var d=o.dispatch,m=o.pending,x=i.memoizedState;if(m!==null){o.pending=null;var w=m=m.next;do x=r(x,w.action),w=w.next;while(w!==m);sr(x,i.memoizedState)||(ln=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),o.lastRenderedState=x}return[x,d]}function g0(r,i,o){var d=Ke,m=tn(),x=dt;if(x){if(o===void 0)throw Error(s(407));o=o()}else o=i();var w=!sr((St||m).memoizedState,o);if(w&&(m.memoizedState=o,ln=!0),m=m.queue,lh(b0.bind(null,d,m,r),[r]),m.getSnapshot!==i||w||an!==null&&an.memoizedState.tag&1){if(d.flags|=2048,Xa(9,{destroy:void 0},v0.bind(null,d,m,o,i),null),Et===null)throw Error(s(349));x||(ys&127)!==0||x0(d,i,o)}return o}function x0(r,i,o){r.flags|=16384,r={getSnapshot:i,value:o},i=Ke.updateQueue,i===null?(i=fu(),Ke.updateQueue=i,i.stores=[r]):(o=i.stores,o===null?i.stores=[r]:o.push(r))}function v0(r,i,o,d){i.value=o,i.getSnapshot=d,y0(i)&&_0(r)}function b0(r,i,o){return o(function(){y0(i)&&_0(r)})}function y0(r){var i=r.getSnapshot;r=r.value;try{var o=i();return!sr(r,o)}catch{return!0}}function _0(r){var i=qi(r,2);i!==null&&Qn(i,r,2)}function ih(r){var i=Bn();if(typeof r=="function"){var o=r;if(r=o(),Ji){hn(!0);try{o()}finally{hn(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:r},i}function w0(r,i,o,d){return r.baseState=o,rh(r,St,typeof d=="function"?d:_s)}function tk(r,i,o,d,m){if(xu(r))throw Error(s(485));if(r=i.action,r!==null){var x={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};$.T!==null?o(!0):x.isTransition=!1,d(x),o=i.pending,o===null?(x.next=i.pending=x,S0(i,x)):(x.next=o.next,i.pending=o.next=x)}}function S0(r,i){var o=i.action,d=i.payload,m=r.state;if(i.isTransition){var x=$.T,w={};$.T=w;try{var N=o(m,d),H=$.S;H!==null&&H(w,N),k0(r,i,N)}catch(ee){ah(r,i,ee)}finally{x!==null&&w.types!==null&&(x.types=w.types),$.T=x}}else try{x=o(m,d),k0(r,i,x)}catch(ee){ah(r,i,ee)}}function k0(r,i,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){j0(r,i,d)},function(d){return ah(r,i,d)}):j0(r,i,o)}function j0(r,i,o){i.status="fulfilled",i.value=o,N0(i),r.state=o,i=r.pending,i!==null&&(o=i.next,o===i?r.pending=null:(o=o.next,i.next=o,S0(r,o)))}function ah(r,i,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=o,N0(i),i=i.next;while(i!==d)}r.action=null}function N0(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function C0(r,i){return i}function E0(r,i){if(dt){var o=Et.formState;if(o!==null){e:{var d=Ke;if(dt){if(Pt){t:{for(var m=Pt,x=jr;m.nodeType!==8;){if(!x){m=null;break t}if(m=Cr(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){Pt=Cr(m.nextSibling),d=m.data==="F!";break e}}ni(d)}d=!1}d&&(i=o[0])}}return o=Bn(),o.memoizedState=o.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:C0,lastRenderedState:i},o.queue=d,o=Y0.bind(null,Ke,d),d.dispatch=o,d=ih(!1),x=fh.bind(null,Ke,!1,d.queue),d=Bn(),m={state:i,dispatch:null,action:r,pending:null},d.queue=m,o=tk.bind(null,Ke,m,x,o),m.dispatch=o,d.memoizedState=r,[i,o,!1]}function T0(r){var i=tn();return A0(i,St,r)}function A0(r,i,o){if(i=rh(r,i,C0)[0],r=pu(_s)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=uo(i)}catch(w){throw w===qa?su:w}else d=i;i=tn();var m=i.queue,x=m.dispatch;return o!==i.memoizedState&&(Ke.flags|=2048,Xa(9,{destroy:void 0},nk.bind(null,m,o),null)),[d,x,r]}function nk(r,i){r.action=i}function M0(r){var i=tn(),o=St;if(o!==null)return A0(i,o,r);tn(),i=i.memoizedState,o=tn();var d=o.queue.dispatch;return o.memoizedState=r,[i,d,!1]}function Xa(r,i,o,d){return r={tag:r,create:o,deps:d,inst:i,next:null},i=Ke.updateQueue,i===null&&(i=fu(),Ke.updateQueue=i),o=i.lastEffect,o===null?i.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,i.lastEffect=r),r}function R0(){return tn().memoizedState}function mu(r,i,o,d){var m=Bn();Ke.flags|=r,m.memoizedState=Xa(1|i,{destroy:void 0},o,d===void 0?null:d)}function gu(r,i,o,d){var m=tn();d=d===void 0?null:d;var x=m.memoizedState.inst;St!==null&&d!==null&&Kf(d,St.memoizedState.deps)?m.memoizedState=Xa(i,x,o,d):(Ke.flags|=r,m.memoizedState=Xa(1|i,x,o,d))}function z0(r,i){mu(8390656,8,r,i)}function lh(r,i){gu(2048,8,r,i)}function rk(r){Ke.flags|=4;var i=Ke.updateQueue;if(i===null)i=fu(),Ke.updateQueue=i,i.events=[r];else{var o=i.events;o===null?i.events=[r]:o.push(r)}}function L0(r){var i=tn().memoizedState;return rk({ref:i,nextImpl:r}),function(){if((xt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function D0(r,i){return gu(4,2,r,i)}function O0(r,i){return gu(4,4,r,i)}function B0(r,i){if(typeof i=="function"){r=r();var o=i(r);return function(){typeof o=="function"?o():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function P0(r,i,o){o=o!=null?o.concat([r]):null,gu(4,4,B0.bind(null,i,r),o)}function oh(){}function $0(r,i){var o=tn();i=i===void 0?null:i;var d=o.memoizedState;return i!==null&&Kf(i,d[1])?d[0]:(o.memoizedState=[r,i],r)}function U0(r,i){var o=tn();i=i===void 0?null:i;var d=o.memoizedState;if(i!==null&&Kf(i,d[1]))return d[0];if(d=r(),Ji){hn(!0);try{r()}finally{hn(!1)}}return o.memoizedState=[d,i],d}function ch(r,i,o){return o===void 0||(ys&1073741824)!==0&&(ct&261930)===0?r.memoizedState=i:(r.memoizedState=o,r=Fv(),Ke.lanes|=r,di|=r,o)}function F0(r,i,o,d){return sr(o,i)?o:Ga.current!==null?(r=ch(r,o,d),sr(r,i)||(ln=!0),r):(ys&42)===0||(ys&1073741824)!==0&&(ct&261930)===0?(ln=!0,r.memoizedState=o):(r=Fv(),Ke.lanes|=r,di|=r,i)}function H0(r,i,o,d,m){var x=z.p;z.p=x!==0&&8>x?x:8;var w=$.T,N={};$.T=N,fh(r,!1,i,o);try{var H=m(),ee=$.S;if(ee!==null&&ee(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=ZS(H,d);fo(r,i,oe,ur(r))}else fo(r,i,d,ur(r))}catch(ue){fo(r,i,{then:function(){},status:"rejected",reason:ue},ur())}finally{z.p=x,w!==null&&N.types!==null&&(w.types=N.types),$.T=w}}function sk(){}function uh(r,i,o,d){if(r.tag!==5)throw Error(s(476));var m=I0(r).queue;H0(r,m,i,re,o===null?sk:function(){return q0(r),o(d)})}function I0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:re},next:null};var o={};return i.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:o},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function q0(r){var i=I0(r);i.next===null&&(i=r.alternate.memoizedState),fo(r,i.next.queue,{},ur())}function dh(){return kn(To)}function V0(){return tn().memoizedState}function G0(){return tn().memoizedState}function ik(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var o=ur();r=ii(o);var d=ai(i,r,o);d!==null&&(Qn(d,i,o),ao(d,i,o)),i={cache:Uf()},r.payload=i;return}i=i.return}}function ak(r,i,o){var d=ur();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},xu(r)?W0(i,o):(o=Tf(r,i,o,d),o!==null&&(Qn(o,r,d),X0(o,i,d)))}function Y0(r,i,o){var d=ur();fo(r,i,o,d)}function fo(r,i,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(xu(r))W0(i,m);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var w=i.lastRenderedState,N=x(w,o);if(m.hasEagerState=!0,m.eagerState=N,sr(N,w))return Kc(r,i,m,0),Et===null&&Qc(),!1}catch{}finally{}if(o=Tf(r,i,m,d),o!==null)return Qn(o,r,d),X0(o,i,d),!0}return!1}function fh(r,i,o,d){if(d={lane:2,revertLane:qh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},xu(r)){if(i)throw Error(s(479))}else i=Tf(r,o,d,2),i!==null&&Qn(i,r,2)}function xu(r){var i=r.alternate;return r===Ke||i!==null&&i===Ke}function W0(r,i){Ya=uu=!0;var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}function X0(r,i,o){if((o&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,o|=d,i.lanes=o,wa(r,o)}}var ho={readContext:kn,use:hu,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt};ho.useEffectEvent=Qt;var Q0={readContext:kn,use:hu,useCallback:function(r,i){return Bn().memoizedState=[r,i===void 0?null:i],r},useContext:kn,useEffect:z0,useImperativeHandle:function(r,i,o){o=o!=null?o.concat([r]):null,mu(4194308,4,B0.bind(null,i,r),o)},useLayoutEffect:function(r,i){return mu(4194308,4,r,i)},useInsertionEffect:function(r,i){mu(4,2,r,i)},useMemo:function(r,i){var o=Bn();i=i===void 0?null:i;var d=r();if(Ji){hn(!0);try{r()}finally{hn(!1)}}return o.memoizedState=[d,i],d},useReducer:function(r,i,o){var d=Bn();if(o!==void 0){var m=o(i);if(Ji){hn(!0);try{o(i)}finally{hn(!1)}}}else m=i;return d.memoizedState=d.baseState=m,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:m},d.queue=r,r=r.dispatch=ak.bind(null,Ke,r),[d.memoizedState,r]},useRef:function(r){var i=Bn();return r={current:r},i.memoizedState=r},useState:function(r){r=ih(r);var i=r.queue,o=Y0.bind(null,Ke,i);return i.dispatch=o,[r.memoizedState,o]},useDebugValue:oh,useDeferredValue:function(r,i){var o=Bn();return ch(o,r,i)},useTransition:function(){var r=ih(!1);return r=H0.bind(null,Ke,r.queue,!0,!1),Bn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,o){var d=Ke,m=Bn();if(dt){if(o===void 0)throw Error(s(407));o=o()}else{if(o=i(),Et===null)throw Error(s(349));(ct&127)!==0||x0(d,i,o)}m.memoizedState=o;var x={value:o,getSnapshot:i};return m.queue=x,z0(b0.bind(null,d,x,r),[r]),d.flags|=2048,Xa(9,{destroy:void 0},v0.bind(null,d,x,o,i),null),o},useId:function(){var r=Bn(),i=Et.identifierPrefix;if(dt){var o=es,d=Jr;o=(d&~(1<<32-Ze(d)-1)).toString(32)+o,i="_"+i+"R_"+o,o=du++,0<o&&(i+="H"+o.toString(32)),i+="_"}else o=JS++,i="_"+i+"r_"+o.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:dh,useFormState:E0,useActionState:E0,useOptimistic:function(r){var i=Bn();i.memoizedState=i.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=o,i=fh.bind(null,Ke,!0,o),o.dispatch=i,[r,i]},useMemoCache:nh,useCacheRefresh:function(){return Bn().memoizedState=ik.bind(null,Ke)},useEffectEvent:function(r){var i=Bn(),o={impl:r};return i.memoizedState=o,function(){if((xt&2)!==0)throw Error(s(440));return o.impl.apply(void 0,arguments)}}},hh={readContext:kn,use:hu,useCallback:$0,useContext:kn,useEffect:lh,useImperativeHandle:P0,useInsertionEffect:D0,useLayoutEffect:O0,useMemo:U0,useReducer:pu,useRef:R0,useState:function(){return pu(_s)},useDebugValue:oh,useDeferredValue:function(r,i){var o=tn();return F0(o,St.memoizedState,r,i)},useTransition:function(){var r=pu(_s)[0],i=tn().memoizedState;return[typeof r=="boolean"?r:uo(r),i]},useSyncExternalStore:g0,useId:V0,useHostTransitionStatus:dh,useFormState:T0,useActionState:T0,useOptimistic:function(r,i){var o=tn();return w0(o,St,r,i)},useMemoCache:nh,useCacheRefresh:G0};hh.useEffectEvent=L0;var K0={readContext:kn,use:hu,useCallback:$0,useContext:kn,useEffect:lh,useImperativeHandle:P0,useInsertionEffect:D0,useLayoutEffect:O0,useMemo:U0,useReducer:sh,useRef:R0,useState:function(){return sh(_s)},useDebugValue:oh,useDeferredValue:function(r,i){var o=tn();return St===null?ch(o,r,i):F0(o,St.memoizedState,r,i)},useTransition:function(){var r=sh(_s)[0],i=tn().memoizedState;return[typeof r=="boolean"?r:uo(r),i]},useSyncExternalStore:g0,useId:V0,useHostTransitionStatus:dh,useFormState:M0,useActionState:M0,useOptimistic:function(r,i){var o=tn();return St!==null?w0(o,St,r,i):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:nh,useCacheRefresh:G0};K0.useEffectEvent=L0;function ph(r,i,o,d){i=r.memoizedState,o=o(d,i),o=o==null?i:v({},i,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var mh={enqueueSetState:function(r,i,o){r=r._reactInternals;var d=ur(),m=ii(d);m.payload=i,o!=null&&(m.callback=o),i=ai(r,m,d),i!==null&&(Qn(i,r,d),ao(i,r,d))},enqueueReplaceState:function(r,i,o){r=r._reactInternals;var d=ur(),m=ii(d);m.tag=1,m.payload=i,o!=null&&(m.callback=o),i=ai(r,m,d),i!==null&&(Qn(i,r,d),ao(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var o=ur(),d=ii(o);d.tag=2,i!=null&&(d.callback=i),i=ai(r,d,o),i!==null&&(Qn(i,r,o),ao(i,r,o))}};function Z0(r,i,o,d,m,x,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,x,w):i.prototype&&i.prototype.isPureReactComponent?!Zl(o,d)||!Zl(m,x):!0}function J0(r,i,o,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(o,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(o,d),i.state!==r&&mh.enqueueReplaceState(i,i.state,null)}function ea(r,i){var o=i;if("ref"in i){o={};for(var d in i)d!=="ref"&&(o[d]=i[d])}if(r=r.defaultProps){o===i&&(o=v({},o));for(var m in r)o[m]===void 0&&(o[m]=r[m])}return o}function ev(r){Xc(r)}function tv(r){console.error(r)}function nv(r){Xc(r)}function vu(r,i){try{var o=r.onUncaughtError;o(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function rv(r,i,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function gh(r,i,o){return o=ii(o),o.tag=3,o.payload={element:null},o.callback=function(){vu(r,i)},o}function sv(r){return r=ii(r),r.tag=3,r}function iv(r,i,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var x=d.value;r.payload=function(){return m(x)},r.callback=function(){rv(i,o,d)}}var w=o.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){rv(i,o,d),typeof m!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var N=d.stack;this.componentDidCatch(d.value,{componentStack:N!==null?N:""})})}function lk(r,i,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=o.alternate,i!==null&&Fa(i,o,m,!0),o=ar.current,o!==null){switch(o.tag){case 31:case 13:return Nr===null?Au():o.alternate===null&&Kt===0&&(Kt=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===iu?o.flags|=16384:(i=o.updateQueue,i===null?o.updateQueue=new Set([d]):i.add(d),Fh(r,d,m)),!1;case 22:return o.flags|=65536,d===iu?o.flags|=16384:(i=o.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=i):(o=i.retryQueue,o===null?i.retryQueue=new Set([d]):o.add(d)),Fh(r,d,m)),!1}throw Error(s(435,o.tag))}return Fh(r,d,m),Au(),!1}if(dt)return i=ar.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=m,d!==Df&&(r=Error(s(422),{cause:d}),to(wr(r,o)))):(d!==Df&&(i=Error(s(423),{cause:d}),to(wr(i,o))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=wr(d,o),m=gh(r.stateNode,d,m),Gf(r,m),Kt!==4&&(Kt=2)),!1;var x=Error(s(520),{cause:d});if(x=wr(x,o),_o===null?_o=[x]:_o.push(x),Kt!==4&&(Kt=2),i===null)return!0;d=wr(d,o),o=i;do{switch(o.tag){case 3:return o.flags|=65536,r=m&-m,o.lanes|=r,r=gh(o.stateNode,d,r),Gf(o,r),!1;case 1:if(i=o.type,x=o.stateNode,(o.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(fi===null||!fi.has(x))))return o.flags|=65536,m&=-m,o.lanes|=m,m=sv(m),iv(m,r,o,d),Gf(o,m),!1}o=o.return}while(o!==null);return!1}var xh=Error(s(461)),ln=!1;function jn(r,i,o,d){i.child=r===null?c0(i,null,o,d):Zi(i,r.child,o,d)}function av(r,i,o,d,m){o=o.render;var x=i.ref;if("ref"in d){var w={};for(var N in d)N!=="ref"&&(w[N]=d[N])}else w=d;return Wi(i),d=Zf(r,i,o,w,x,m),N=Jf(),r!==null&&!ln?(eh(r,i,m),ws(r,i,m)):(dt&&N&&zf(i),i.flags|=1,jn(r,i,d,m),i.child)}function lv(r,i,o,d,m){if(r===null){var x=o.type;return typeof x=="function"&&!Af(x)&&x.defaultProps===void 0&&o.compare===null?(i.tag=15,i.type=x,ov(r,i,x,d,m)):(r=Jc(o.type,null,d,i,i.mode,m),r.ref=i.ref,r.return=i,i.child=r)}if(x=r.child,!jh(r,m)){var w=x.memoizedProps;if(o=o.compare,o=o!==null?o:Zl,o(w,d)&&r.ref===i.ref)return ws(r,i,m)}return i.flags|=1,r=gs(x,d),r.ref=i.ref,r.return=i,i.child=r}function ov(r,i,o,d,m){if(r!==null){var x=r.memoizedProps;if(Zl(x,d)&&r.ref===i.ref)if(ln=!1,i.pendingProps=d=x,jh(r,m))(r.flags&131072)!==0&&(ln=!0);else return i.lanes=r.lanes,ws(r,i,m)}return vh(r,i,o,d,m)}function cv(r,i,o,d){var m=d.children,x=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,r!==null){for(d=i.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~x}else d=0,i.child=null;return uv(r,i,x,o,d)}if((o&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&ru(i,x!==null?x.cachePool:null),x!==null?f0(i,x):Wf(),h0(i);else return d=i.lanes=536870912,uv(r,i,x!==null?x.baseLanes|o:o,o,d)}else x!==null?(ru(i,x.cachePool),f0(i,x),oi(),i.memoizedState=null):(r!==null&&ru(i,null),Wf(),oi());return jn(r,i,m,o),i.child}function po(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function uv(r,i,o,d,m){var x=Hf();return x=x===null?null:{parent:sn._currentValue,pool:x},i.memoizedState={baseLanes:o,cachePool:x},r!==null&&ru(i,null),Wf(),h0(i),r!==null&&Fa(r,i,d,!0),i.childLanes=m,null}function bu(r,i){return i=_u({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function dv(r,i,o){return Zi(i,r.child,null,o),r=bu(i,i.pendingProps),r.flags|=2,lr(i),i.memoizedState=null,r}function ok(r,i,o){var d=i.pendingProps,m=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(dt){if(d.mode==="hidden")return r=bu(i,d),i.lanes=536870912,po(null,r);if(Qf(i),(r=Pt)?(r=S1(r,jr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ei!==null?{id:Jr,overflow:es}:null,retryLane:536870912,hydrationErrors:null},o=Wx(r),o.return=i,i.child=o,Sn=i,Pt=null)):r=null,r===null)throw ni(i);return i.lanes=536870912,null}return bu(i,d)}var x=r.memoizedState;if(x!==null){var w=x.dehydrated;if(Qf(i),m)if(i.flags&256)i.flags&=-257,i=dv(r,i,o);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(s(558));else if(ln||Fa(r,i,o,!1),m=(o&r.childLanes)!==0,ln||m){if(d=Et,d!==null&&(w=Pl(d,o),w!==0&&w!==x.retryLane))throw x.retryLane=w,qi(r,w),Qn(d,r,w),xh;Au(),i=dv(r,i,o)}else r=x.treeContext,Pt=Cr(w.nextSibling),Sn=i,dt=!0,ti=null,jr=!1,r!==null&&Kx(i,r),i=bu(i,d),i.flags|=4096;return i}return r=gs(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function yu(r,i){var o=i.ref;if(o===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(s(284));(r===null||r.ref!==o)&&(i.flags|=4194816)}}function vh(r,i,o,d,m){return Wi(i),o=Zf(r,i,o,d,void 0,m),d=Jf(),r!==null&&!ln?(eh(r,i,m),ws(r,i,m)):(dt&&d&&zf(i),i.flags|=1,jn(r,i,o,m),i.child)}function fv(r,i,o,d,m,x){return Wi(i),i.updateQueue=null,o=m0(i,d,o,m),p0(r),d=Jf(),r!==null&&!ln?(eh(r,i,x),ws(r,i,x)):(dt&&d&&zf(i),i.flags|=1,jn(r,i,o,x),i.child)}function hv(r,i,o,d,m){if(Wi(i),i.stateNode===null){var x=Ba,w=o.contextType;typeof w=="object"&&w!==null&&(x=kn(w)),x=new o(d,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=mh,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=d,x.state=i.memoizedState,x.refs={},qf(i),w=o.contextType,x.context=typeof w=="object"&&w!==null?kn(w):Ba,x.state=i.memoizedState,w=o.getDerivedStateFromProps,typeof w=="function"&&(ph(i,o,w,d),x.state=i.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&mh.enqueueReplaceState(x,x.state,null),oo(i,d,x,m),lo(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){x=i.stateNode;var N=i.memoizedProps,H=ea(o,N);x.props=H;var ee=x.context,oe=o.contextType;w=Ba,typeof oe=="object"&&oe!==null&&(w=kn(oe));var ue=o.getDerivedStateFromProps;oe=typeof ue=="function"||typeof x.getSnapshotBeforeUpdate=="function",N=i.pendingProps!==N,oe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(N||ee!==w)&&J0(i,x,d,w),si=!1;var ne=i.memoizedState;x.state=ne,oo(i,d,x,m),lo(),ee=i.memoizedState,N||ne!==ee||si?(typeof ue=="function"&&(ph(i,o,ue,d),ee=i.memoizedState),(H=si||Z0(i,o,H,d,ne,ee,w))?(oe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=ee),x.props=d,x.state=ee,x.context=w,d=H):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{x=i.stateNode,Vf(r,i),w=i.memoizedProps,oe=ea(o,w),x.props=oe,ue=i.pendingProps,ne=x.context,ee=o.contextType,H=Ba,typeof ee=="object"&&ee!==null&&(H=kn(ee)),N=o.getDerivedStateFromProps,(ee=typeof N=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ue||ne!==H)&&J0(i,x,d,H),si=!1,ne=i.memoizedState,x.state=ne,oo(i,d,x,m),lo();var ie=i.memoizedState;w!==ue||ne!==ie||si||r!==null&&r.dependencies!==null&&tu(r.dependencies)?(typeof N=="function"&&(ph(i,o,N,d),ie=i.memoizedState),(oe=si||Z0(i,o,oe,d,ne,ie,H)||r!==null&&r.dependencies!==null&&tu(r.dependencies))?(ee||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(d,ie,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(d,ie,H)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=ie),x.props=d,x.state=ie,x.context=H,d=oe):(typeof x.componentDidUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),d=!1)}return x=d,yu(r,i),d=(i.flags&128)!==0,x||d?(x=i.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,r!==null&&d?(i.child=Zi(i,r.child,null,m),i.child=Zi(i,null,o,m)):jn(r,i,o,m),i.memoizedState=x.state,r=i.child):r=ws(r,i,m),r}function pv(r,i,o,d){return Gi(),i.flags|=256,jn(r,i,o,d),i.child}var bh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yh(r){return{baseLanes:r,cachePool:r0()}}function _h(r,i,o){return r=r!==null?r.childLanes&~o:0,i&&(r|=cr),r}function mv(r,i,o){var d=i.pendingProps,m=!1,x=(i.flags&128)!==0,w;if((w=x)||(w=r!==null&&r.memoizedState===null?!1:(en.current&2)!==0),w&&(m=!0,i.flags&=-129),w=(i.flags&32)!==0,i.flags&=-33,r===null){if(dt){if(m?li(i):oi(),(r=Pt)?(r=S1(r,jr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ei!==null?{id:Jr,overflow:es}:null,retryLane:536870912,hydrationErrors:null},o=Wx(r),o.return=i,i.child=o,Sn=i,Pt=null)):r=null,r===null)throw ni(i);return rp(r)?i.lanes=32:i.lanes=536870912,null}var N=d.children;return d=d.fallback,m?(oi(),m=i.mode,N=_u({mode:"hidden",children:N},m),d=Vi(d,m,o,null),N.return=i,d.return=i,N.sibling=d,i.child=N,d=i.child,d.memoizedState=yh(o),d.childLanes=_h(r,w,o),i.memoizedState=bh,po(null,d)):(li(i),wh(i,N))}var H=r.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(x)i.flags&256?(li(i),i.flags&=-257,i=Sh(r,i,o)):i.memoizedState!==null?(oi(),i.child=r.child,i.flags|=128,i=null):(oi(),N=d.fallback,m=i.mode,d=_u({mode:"visible",children:d.children},m),N=Vi(N,m,o,null),N.flags|=2,d.return=i,N.return=i,d.sibling=N,i.child=d,Zi(i,r.child,null,o),d=i.child,d.memoizedState=yh(o),d.childLanes=_h(r,w,o),i.memoizedState=bh,i=po(null,d));else if(li(i),rp(N)){if(w=N.nextSibling&&N.nextSibling.dataset,w)var ee=w.dgst;w=ee,d=Error(s(419)),d.stack="",d.digest=w,to({value:d,source:null,stack:null}),i=Sh(r,i,o)}else if(ln||Fa(r,i,o,!1),w=(o&r.childLanes)!==0,ln||w){if(w=Et,w!==null&&(d=Pl(w,o),d!==0&&d!==H.retryLane))throw H.retryLane=d,qi(r,d),Qn(w,r,d),xh;np(N)||Au(),i=Sh(r,i,o)}else np(N)?(i.flags|=192,i.child=r.child,i=null):(r=H.treeContext,Pt=Cr(N.nextSibling),Sn=i,dt=!0,ti=null,jr=!1,r!==null&&Kx(i,r),i=wh(i,d.children),i.flags|=4096);return i}return m?(oi(),N=d.fallback,m=i.mode,H=r.child,ee=H.sibling,d=gs(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,ee!==null?N=gs(ee,N):(N=Vi(N,m,o,null),N.flags|=2),N.return=i,d.return=i,d.sibling=N,i.child=d,po(null,d),d=i.child,N=r.child.memoizedState,N===null?N=yh(o):(m=N.cachePool,m!==null?(H=sn._currentValue,m=m.parent!==H?{parent:H,pool:H}:m):m=r0(),N={baseLanes:N.baseLanes|o,cachePool:m}),d.memoizedState=N,d.childLanes=_h(r,w,o),i.memoizedState=bh,po(r.child,d)):(li(i),o=r.child,r=o.sibling,o=gs(o,{mode:"visible",children:d.children}),o.return=i,o.sibling=null,r!==null&&(w=i.deletions,w===null?(i.deletions=[r],i.flags|=16):w.push(r)),i.child=o,i.memoizedState=null,o)}function wh(r,i){return i=_u({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function _u(r,i){return r=ir(22,r,null,i),r.lanes=0,r}function Sh(r,i,o){return Zi(i,r.child,null,o),r=wh(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function gv(r,i,o){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),Pf(r.return,i,o)}function kh(r,i,o,d,m,x){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:x}:(w.isBackwards=i,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=o,w.tailMode=m,w.treeForkCount=x)}function xv(r,i,o){var d=i.pendingProps,m=d.revealOrder,x=d.tail;d=d.children;var w=en.current,N=(w&2)!==0;if(N?(w=w&1|2,i.flags|=128):w&=1,M(en,w),jn(r,i,d,o),d=dt?eo:0,!N&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&gv(r,o,i);else if(r.tag===19)gv(r,o,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(m){case"forwards":for(o=i.child,m=null;o!==null;)r=o.alternate,r!==null&&cu(r)===null&&(m=o),o=o.sibling;o=m,o===null?(m=i.child,i.child=null):(m=o.sibling,o.sibling=null),kh(i,!1,m,o,x,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=i.child,i.child=null;m!==null;){if(r=m.alternate,r!==null&&cu(r)===null){i.child=m;break}r=m.sibling,m.sibling=o,o=m,m=r}kh(i,!0,o,null,x,d);break;case"together":kh(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function ws(r,i,o){if(r!==null&&(i.dependencies=r.dependencies),di|=i.lanes,(o&i.childLanes)===0)if(r!==null){if(Fa(r,i,o,!1),(o&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(s(153));if(i.child!==null){for(r=i.child,o=gs(r,r.pendingProps),i.child=o,o.return=i;r.sibling!==null;)r=r.sibling,o=o.sibling=gs(r,r.pendingProps),o.return=i;o.sibling=null}return i.child}function jh(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&tu(r)))}function ck(r,i,o){switch(i.tag){case 3:ze(i,i.stateNode.containerInfo),ri(i,sn,r.memoizedState.cache),Gi();break;case 27:case 5:et(i);break;case 4:ze(i,i.stateNode.containerInfo);break;case 10:ri(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Qf(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(li(i),i.flags|=128,null):(o&i.child.childLanes)!==0?mv(r,i,o):(li(i),r=ws(r,i,o),r!==null?r.sibling:null);li(i);break;case 19:var m=(r.flags&128)!==0;if(d=(o&i.childLanes)!==0,d||(Fa(r,i,o,!1),d=(o&i.childLanes)!==0),m){if(d)return xv(r,i,o);i.flags|=128}if(m=i.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),M(en,en.current),d)break;return null;case 22:return i.lanes=0,cv(r,i,o,i.pendingProps);case 24:ri(i,sn,r.memoizedState.cache)}return ws(r,i,o)}function vv(r,i,o){if(r!==null)if(r.memoizedProps!==i.pendingProps)ln=!0;else{if(!jh(r,o)&&(i.flags&128)===0)return ln=!1,ck(r,i,o);ln=(r.flags&131072)!==0}else ln=!1,dt&&(i.flags&1048576)!==0&&Qx(i,eo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Qi(i.elementType),i.type=r,typeof r=="function")Af(r)?(d=ea(r,d),i.tag=1,i=hv(null,i,r,d,o)):(i.tag=0,i=vh(null,i,r,d,o));else{if(r!=null){var m=r.$$typeof;if(m===L){i.tag=11,i=av(null,i,r,d,o);break e}else if(m===U){i.tag=14,i=lv(null,i,r,d,o);break e}}throw i=Q(r)||r,Error(s(306,i,""))}}return i;case 0:return vh(r,i,i.type,i.pendingProps,o);case 1:return d=i.type,m=ea(d,i.pendingProps),hv(r,i,d,m,o);case 3:e:{if(ze(i,i.stateNode.containerInfo),r===null)throw Error(s(387));d=i.pendingProps;var x=i.memoizedState;m=x.element,Vf(r,i),oo(i,d,null,o);var w=i.memoizedState;if(d=w.cache,ri(i,sn,d),d!==x.cache&&$f(i,[sn],o,!0),lo(),d=w.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:w.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=pv(r,i,d,o);break e}else if(d!==m){m=wr(Error(s(424)),i),to(m),i=pv(r,i,d,o);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Pt=Cr(r.firstChild),Sn=i,dt=!0,ti=null,jr=!0,o=c0(i,null,d,o),i.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(Gi(),d===m){i=ws(r,i,o);break e}jn(r,i,d,o)}i=i.child}return i;case 26:return yu(r,i),r===null?(o=T1(i.type,null,i.pendingProps,null))?i.memoizedState=o:dt||(o=i.type,r=i.pendingProps,d=Bu(Ce.current).createElement(o),d[Ht]=i,d[wn]=r,Nn(d,o,r),Yt(d),i.stateNode=d):i.memoizedState=T1(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return et(i),r===null&&dt&&(d=i.stateNode=N1(i.type,i.pendingProps,Ce.current),Sn=i,jr=!0,m=Pt,gi(i.type)?(sp=m,Pt=Cr(d.firstChild)):Pt=m),jn(r,i,i.pendingProps.children,o),yu(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&dt&&((m=d=Pt)&&(d=$k(d,i.type,i.pendingProps,jr),d!==null?(i.stateNode=d,Sn=i,Pt=Cr(d.firstChild),jr=!1,m=!0):m=!1),m||ni(i)),et(i),m=i.type,x=i.pendingProps,w=r!==null?r.memoizedProps:null,d=x.children,Jh(m,x)?d=null:w!==null&&Jh(m,w)&&(i.flags|=32),i.memoizedState!==null&&(m=Zf(r,i,ek,null,null,o),To._currentValue=m),yu(r,i),jn(r,i,d,o),i.child;case 6:return r===null&&dt&&((r=o=Pt)&&(o=Uk(o,i.pendingProps,jr),o!==null?(i.stateNode=o,Sn=i,Pt=null,r=!0):r=!1),r||ni(i)),null;case 13:return mv(r,i,o);case 4:return ze(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Zi(i,null,d,o):jn(r,i,d,o),i.child;case 11:return av(r,i,i.type,i.pendingProps,o);case 7:return jn(r,i,i.pendingProps,o),i.child;case 8:return jn(r,i,i.pendingProps.children,o),i.child;case 12:return jn(r,i,i.pendingProps.children,o),i.child;case 10:return d=i.pendingProps,ri(i,i.type,d.value),jn(r,i,d.children,o),i.child;case 9:return m=i.type._context,d=i.pendingProps.children,Wi(i),m=kn(m),d=d(m),i.flags|=1,jn(r,i,d,o),i.child;case 14:return lv(r,i,i.type,i.pendingProps,o);case 15:return ov(r,i,i.type,i.pendingProps,o);case 19:return xv(r,i,o);case 31:return ok(r,i,o);case 22:return cv(r,i,o,i.pendingProps);case 24:return Wi(i),d=kn(sn),r===null?(m=Hf(),m===null&&(m=Et,x=Uf(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=o),m=x),i.memoizedState={parent:d,cache:m},qf(i),ri(i,sn,m)):((r.lanes&o)!==0&&(Vf(r,i),oo(i,null,null,o),lo()),m=r.memoizedState,x=i.memoizedState,m.parent!==d?(m={parent:d,cache:d},i.memoizedState=m,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=m),ri(i,sn,d)):(d=x.cache,ri(i,sn,d),d!==m.cache&&$f(i,[sn],o,!0))),jn(r,i,i.pendingProps.children,o),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function Ss(r){r.flags|=4}function Nh(r,i,o,d,m){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(m&335544128)===m)if(r.stateNode.complete)r.flags|=8192;else if(Vv())r.flags|=8192;else throw Ki=iu,If}else r.flags&=-16777217}function bv(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!L1(i))if(Vv())r.flags|=8192;else throw Ki=iu,If}function wu(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?rn():536870912,r.lanes|=i,Ja|=i)}function mo(r,i){if(!dt)switch(r.tailMode){case"hidden":i=r.tail;for(var o=null;i!==null;)i.alternate!==null&&(o=i),i=i.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function $t(r){var i=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(i)for(var m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=r,m=m.sibling;else for(m=r.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=o,i}function uk(r,i,o){var d=i.pendingProps;switch(Lf(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $t(i),null;case 1:return $t(i),null;case 3:return o=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),bs(sn),De(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(Ua(i)?Ss(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Of())),$t(i),null;case 26:var m=i.type,x=i.memoizedState;return r===null?(Ss(i),x!==null?($t(i),bv(i,x)):($t(i),Nh(i,m,null,d,o))):x?x!==r.memoizedState?(Ss(i),$t(i),bv(i,x)):($t(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Ss(i),$t(i),Nh(i,m,r,d,o)),null;case 27:if(xe(i),o=Ce.current,m=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ss(i);else{if(!d){if(i.stateNode===null)throw Error(s(166));return $t(i),null}r=pe.current,Ua(i)?Zx(i):(r=N1(m,d,o),i.stateNode=r,Ss(i))}return $t(i),null;case 5:if(xe(i),m=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ss(i);else{if(!d){if(i.stateNode===null)throw Error(s(166));return $t(i),null}if(x=pe.current,Ua(i))Zx(i);else{var w=Bu(Ce.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?x.multiple=!0:d.size&&(x.size=d.size);break;default:x=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}x[Ht]=i,x[wn]=d;e:for(w=i.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===i)break e;for(;w.sibling===null;){if(w.return===null||w.return===i)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}i.stateNode=x;e:switch(Nn(x,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Ss(i)}}return $t(i),Nh(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,o),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Ss(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(s(166));if(r=Ce.current,Ua(i)){if(r=i.stateNode,o=i.memoizedProps,d=null,m=Sn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Ht]=i,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||m1(r.nodeValue,o)),r||ni(i,!0)}else r=Bu(r).createTextNode(d),r[Ht]=i,i.stateNode=r}return $t(i),null;case 31:if(o=i.memoizedState,r===null||r.memoizedState!==null){if(d=Ua(i),o!==null){if(r===null){if(!d)throw Error(s(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(557));r[Ht]=i}else Gi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;$t(i),r=!1}else o=Of(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return i.flags&256?(lr(i),i):(lr(i),null);if((i.flags&128)!==0)throw Error(s(558))}return $t(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=Ua(i),d!==null&&d.dehydrated!==null){if(r===null){if(!m)throw Error(s(318));if(m=i.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(s(317));m[Ht]=i}else Gi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;$t(i),m=!1}else m=Of(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return i.flags&256?(lr(i),i):(lr(i),null)}return lr(i),(i.flags&128)!==0?(i.lanes=o,i):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=i.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),x=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(x=d.memoizedState.cachePool.pool),x!==m&&(d.flags|=2048)),o!==r&&o&&(i.child.flags|=8192),wu(i,i.updateQueue),$t(i),null);case 4:return De(),r===null&&Wh(i.stateNode.containerInfo),$t(i),null;case 10:return bs(i.type),$t(i),null;case 19:if(Z(en),d=i.memoizedState,d===null)return $t(i),null;if(m=(i.flags&128)!==0,x=d.rendering,x===null)if(m)mo(d,!1);else{if(Kt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(x=cu(r),x!==null){for(i.flags|=128,mo(d,!1),r=x.updateQueue,i.updateQueue=r,wu(i,r),i.subtreeFlags=0,r=o,o=i.child;o!==null;)Yx(o,r),o=o.sibling;return M(en,en.current&1|2),dt&&xs(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&qe()>Cu&&(i.flags|=128,m=!0,mo(d,!1),i.lanes=4194304)}else{if(!m)if(r=cu(x),r!==null){if(i.flags|=128,m=!0,r=r.updateQueue,i.updateQueue=r,wu(i,r),mo(d,!0),d.tail===null&&d.tailMode==="hidden"&&!x.alternate&&!dt)return $t(i),null}else 2*qe()-d.renderingStartTime>Cu&&o!==536870912&&(i.flags|=128,m=!0,mo(d,!1),i.lanes=4194304);d.isBackwards?(x.sibling=i.child,i.child=x):(r=d.last,r!==null?r.sibling=x:i.child=x,d.last=x)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=qe(),r.sibling=null,o=en.current,M(en,m?o&1|2:o&1),dt&&xs(i,d.treeForkCount),r):($t(i),null);case 22:case 23:return lr(i),Xf(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(o&536870912)!==0&&(i.flags&128)===0&&($t(i),i.subtreeFlags&6&&(i.flags|=8192)):$t(i),o=i.updateQueue,o!==null&&wu(i,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==o&&(i.flags|=2048),r!==null&&Z(Xi),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),i.memoizedState.cache!==o&&(i.flags|=2048),bs(sn),$t(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function dk(r,i){switch(Lf(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return bs(sn),De(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return xe(i),null;case 31:if(i.memoizedState!==null){if(lr(i),i.alternate===null)throw Error(s(340));Gi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(lr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Gi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return Z(en),null;case 4:return De(),null;case 10:return bs(i.type),null;case 22:case 23:return lr(i),Xf(),r!==null&&Z(Xi),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return bs(sn),null;case 25:return null;default:return null}}function yv(r,i){switch(Lf(i),i.tag){case 3:bs(sn),De();break;case 26:case 27:case 5:xe(i);break;case 4:De();break;case 31:i.memoizedState!==null&&lr(i);break;case 13:lr(i);break;case 19:Z(en);break;case 10:bs(i.type);break;case 22:case 23:lr(i),Xf(),r!==null&&Z(Xi);break;case 24:bs(sn)}}function go(r,i){try{var o=i.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&r)===r){d=void 0;var x=o.create,w=o.inst;d=x(),w.destroy=d}o=o.next}while(o!==m)}}catch(N){wt(i,i.return,N)}}function ci(r,i,o){try{var d=i.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var x=m.next;d=x;do{if((d.tag&r)===r){var w=d.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,m=i;var H=o,ee=N;try{ee()}catch(oe){wt(m,H,oe)}}}d=d.next}while(d!==x)}}catch(oe){wt(i,i.return,oe)}}function _v(r){var i=r.updateQueue;if(i!==null){var o=r.stateNode;try{d0(i,o)}catch(d){wt(r,r.return,d)}}}function wv(r,i,o){o.props=ea(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){wt(r,i,d)}}function xo(r,i){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(m){wt(r,i,m)}}function ts(r,i){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){wt(r,i,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){wt(r,i,m)}else o.current=null}function Sv(r){var i=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){wt(r,r.return,m)}}function Ch(r,i,o){try{var d=r.stateNode;zk(d,r.type,o,i),d[wn]=i}catch(m){wt(r,r.return,m)}}function kv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&gi(r.type)||r.tag===4}function Eh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||kv(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&gi(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Th(r,i,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,i):(i=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,i.appendChild(r),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=vr));else if(d!==4&&(d===27&&gi(r.type)&&(o=r.stateNode,i=null),r=r.child,r!==null))for(Th(r,i,o),r=r.sibling;r!==null;)Th(r,i,o),r=r.sibling}function Su(r,i,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?o.insertBefore(r,i):o.appendChild(r);else if(d!==4&&(d===27&&gi(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(Su(r,i,o),r=r.sibling;r!==null;)Su(r,i,o),r=r.sibling}function jv(r){var i=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,m=i.attributes;m.length;)i.removeAttributeNode(m[0]);Nn(i,d,o),i[Ht]=r,i[wn]=o}catch(x){wt(r,r.return,x)}}var ks=!1,on=!1,Ah=!1,Nv=typeof WeakSet=="function"?WeakSet:Set,yn=null;function fk(r,i){if(r=r.containerInfo,Kh=qu,r=Px(r),Sf(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,x=d.focusNode;d=d.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var w=0,N=-1,H=-1,ee=0,oe=0,ue=r,ne=null;t:for(;;){for(var ie;ue!==o||m!==0&&ue.nodeType!==3||(N=w+m),ue!==x||d!==0&&ue.nodeType!==3||(H=w+d),ue.nodeType===3&&(w+=ue.nodeValue.length),(ie=ue.firstChild)!==null;)ne=ue,ue=ie;for(;;){if(ue===r)break t;if(ne===o&&++ee===m&&(N=w),ne===x&&++oe===d&&(H=w),(ie=ue.nextSibling)!==null)break;ue=ne,ne=ue.parentNode}ue=ie}o=N===-1||H===-1?null:{start:N,end:H}}else o=null}o=o||{start:0,end:0}}else o=null;for(Zh={focusedElem:r,selectionRange:o},qu=!1,yn=i;yn!==null;)if(i=yn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,yn=r;else for(;yn!==null;){switch(i=yn,x=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<r.length;o++)m=r[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&x!==null){r=void 0,o=i,m=x.memoizedProps,x=x.memoizedState,d=o.stateNode;try{var Ee=ea(o.type,m);r=d.getSnapshotBeforeUpdate(Ee,x),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){wt(o,o.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,o=r.nodeType,o===9)tp(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":tp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(s(163))}if(r=i.sibling,r!==null){r.return=i.return,yn=r;break}yn=i.return}}function Cv(r,i,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:Ns(r,o),d&4&&go(5,o);break;case 1:if(Ns(r,o),d&4)if(r=o.stateNode,i===null)try{r.componentDidMount()}catch(w){wt(o,o.return,w)}else{var m=ea(o.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(m,i,r.__reactInternalSnapshotBeforeUpdate)}catch(w){wt(o,o.return,w)}}d&64&&_v(o),d&512&&xo(o,o.return);break;case 3:if(Ns(r,o),d&64&&(r=o.updateQueue,r!==null)){if(i=null,o.child!==null)switch(o.child.tag){case 27:case 5:i=o.child.stateNode;break;case 1:i=o.child.stateNode}try{d0(r,i)}catch(w){wt(o,o.return,w)}}break;case 27:i===null&&d&4&&jv(o);case 26:case 5:Ns(r,o),i===null&&d&4&&Sv(o),d&512&&xo(o,o.return);break;case 12:Ns(r,o);break;case 31:Ns(r,o),d&4&&Av(r,o);break;case 13:Ns(r,o),d&4&&Mv(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=_k.bind(null,o),Fk(r,o))));break;case 22:if(d=o.memoizedState!==null||ks,!d){i=i!==null&&i.memoizedState!==null||on,m=ks;var x=on;ks=d,(on=i)&&!x?Cs(r,o,(o.subtreeFlags&8772)!==0):Ns(r,o),ks=m,on=x}break;case 30:break;default:Ns(r,o)}}function Ev(r){var i=r.alternate;i!==null&&(r.alternate=null,Ev(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Gs(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var It=null,Gn=!1;function js(r,i,o){for(o=o.child;o!==null;)Tv(r,i,o),o=o.sibling}function Tv(r,i,o){if(vt&&typeof vt.onCommitFiberUnmount=="function")try{vt.onCommitFiberUnmount(nt,o)}catch{}switch(o.tag){case 26:on||ts(o,i),js(r,i,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:on||ts(o,i);var d=It,m=Gn;gi(o.type)&&(It=o.stateNode,Gn=!1),js(r,i,o),No(o.stateNode),It=d,Gn=m;break;case 5:on||ts(o,i);case 6:if(d=It,m=Gn,It=null,js(r,i,o),It=d,Gn=m,It!==null)if(Gn)try{(It.nodeType===9?It.body:It.nodeName==="HTML"?It.ownerDocument.body:It).removeChild(o.stateNode)}catch(x){wt(o,i,x)}else try{It.removeChild(o.stateNode)}catch(x){wt(o,i,x)}break;case 18:It!==null&&(Gn?(r=It,_1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),ll(r)):_1(It,o.stateNode));break;case 4:d=It,m=Gn,It=o.stateNode.containerInfo,Gn=!0,js(r,i,o),It=d,Gn=m;break;case 0:case 11:case 14:case 15:ci(2,o,i),on||ci(4,o,i),js(r,i,o);break;case 1:on||(ts(o,i),d=o.stateNode,typeof d.componentWillUnmount=="function"&&wv(o,i,d)),js(r,i,o);break;case 21:js(r,i,o);break;case 22:on=(d=on)||o.memoizedState!==null,js(r,i,o),on=d;break;default:js(r,i,o)}}function Av(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{ll(r)}catch(o){wt(i,i.return,o)}}}function Mv(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{ll(r)}catch(o){wt(i,i.return,o)}}function hk(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new Nv),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new Nv),i;default:throw Error(s(435,r.tag))}}function ku(r,i){var o=hk(r);i.forEach(function(d){if(!o.has(d)){o.add(d);var m=wk.bind(null,r,d);d.then(m,m)}})}function Yn(r,i){var o=i.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],x=r,w=i,N=w;e:for(;N!==null;){switch(N.tag){case 27:if(gi(N.type)){It=N.stateNode,Gn=!1;break e}break;case 5:It=N.stateNode,Gn=!1;break e;case 3:case 4:It=N.stateNode.containerInfo,Gn=!0;break e}N=N.return}if(It===null)throw Error(s(160));Tv(x,w,m),It=null,Gn=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Rv(i,r),i=i.sibling}var Hr=null;function Rv(r,i){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Yn(i,r),Wn(r),d&4&&(ci(3,r,r.return),go(3,r),ci(5,r,r.return));break;case 1:Yn(i,r),Wn(r),d&512&&(on||o===null||ts(o,o.return)),d&64&&ks&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=Hr;if(Yn(i,r),Wn(r),d&512&&(on||o===null||ts(o,o.return)),d&4){var x=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":x=m.getElementsByTagName("title")[0],(!x||x[Wr]||x[Ht]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(d),m.head.insertBefore(x,m.querySelector("head > title"))),Nn(x,d,o),x[Ht]=r,Yt(x),d=x;break e;case"link":var w=R1("link","href",m).get(d+(o.href||""));if(w){for(var N=0;N<w.length;N++)if(x=w[N],x.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&x.getAttribute("rel")===(o.rel==null?null:o.rel)&&x.getAttribute("title")===(o.title==null?null:o.title)&&x.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){w.splice(N,1);break t}}x=m.createElement(d),Nn(x,d,o),m.head.appendChild(x);break;case"meta":if(w=R1("meta","content",m).get(d+(o.content||""))){for(N=0;N<w.length;N++)if(x=w[N],x.getAttribute("content")===(o.content==null?null:""+o.content)&&x.getAttribute("name")===(o.name==null?null:o.name)&&x.getAttribute("property")===(o.property==null?null:o.property)&&x.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&x.getAttribute("charset")===(o.charSet==null?null:o.charSet)){w.splice(N,1);break t}}x=m.createElement(d),Nn(x,d,o),m.head.appendChild(x);break;default:throw Error(s(468,d))}x[Ht]=r,Yt(x),d=x}r.stateNode=d}else z1(m,r.type,r.stateNode);else r.stateNode=M1(m,d,r.memoizedProps);else x!==d?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,d===null?z1(m,r.type,r.stateNode):M1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Ch(r,r.memoizedProps,o.memoizedProps)}break;case 27:Yn(i,r),Wn(r),d&512&&(on||o===null||ts(o,o.return)),o!==null&&d&4&&Ch(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Yn(i,r),Wn(r),d&512&&(on||o===null||ts(o,o.return)),r.flags&32){m=r.stateNode;try{Xs(m,"")}catch(Ee){wt(r,r.return,Ee)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,Ch(r,m,o!==null?o.memoizedProps:m)),d&1024&&(Ah=!0);break;case 6:if(Yn(i,r),Wn(r),d&4){if(r.stateNode===null)throw Error(s(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Ee){wt(r,r.return,Ee)}}break;case 3:if(Uu=null,m=Hr,Hr=Pu(i.containerInfo),Yn(i,r),Hr=m,Wn(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{ll(i.containerInfo)}catch(Ee){wt(r,r.return,Ee)}Ah&&(Ah=!1,zv(r));break;case 4:d=Hr,Hr=Pu(r.stateNode.containerInfo),Yn(i,r),Wn(r),Hr=d;break;case 12:Yn(i,r),Wn(r);break;case 31:Yn(i,r),Wn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ku(r,d)));break;case 13:Yn(i,r),Wn(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Nu=qe()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ku(r,d)));break;case 22:m=r.memoizedState!==null;var H=o!==null&&o.memoizedState!==null,ee=ks,oe=on;if(ks=ee||m,on=oe||H,Yn(i,r),on=oe,ks=ee,Wn(r),d&8192)e:for(i=r.stateNode,i._visibility=m?i._visibility&-2:i._visibility|1,m&&(o===null||H||ks||on||ta(r)),o=null,i=r;;){if(i.tag===5||i.tag===26){if(o===null){H=o=i;try{if(x=H.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{N=H.stateNode;var ue=H.memoizedProps.style,ne=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;N.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Ee){wt(H,H.return,Ee)}}}else if(i.tag===6){if(o===null){H=i;try{H.stateNode.nodeValue=m?"":H.memoizedProps}catch(Ee){wt(H,H.return,Ee)}}}else if(i.tag===18){if(o===null){H=i;try{var ie=H.stateNode;m?w1(ie,!0):w1(H.stateNode,!1)}catch(Ee){wt(H,H.return,Ee)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;o===i&&(o=null),i=i.return}o===i&&(o=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,ku(r,o))));break;case 19:Yn(i,r),Wn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ku(r,d)));break;case 30:break;case 21:break;default:Yn(i,r),Wn(r)}}function Wn(r){var i=r.flags;if(i&2){try{for(var o,d=r.return;d!==null;){if(kv(d)){o=d;break}d=d.return}if(o==null)throw Error(s(160));switch(o.tag){case 27:var m=o.stateNode,x=Eh(r);Su(r,x,m);break;case 5:var w=o.stateNode;o.flags&32&&(Xs(w,""),o.flags&=-33);var N=Eh(r);Su(r,N,w);break;case 3:case 4:var H=o.stateNode.containerInfo,ee=Eh(r);Th(r,ee,H);break;default:throw Error(s(161))}}catch(oe){wt(r,r.return,oe)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function zv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;zv(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ns(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Cv(r,i.alternate,i),i=i.sibling}function ta(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:ci(4,i,i.return),ta(i);break;case 1:ts(i,i.return);var o=i.stateNode;typeof o.componentWillUnmount=="function"&&wv(i,i.return,o),ta(i);break;case 27:No(i.stateNode);case 26:case 5:ts(i,i.return),ta(i);break;case 22:i.memoizedState===null&&ta(i);break;case 30:ta(i);break;default:ta(i)}r=r.sibling}}function Cs(r,i,o){for(o=o&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,m=r,x=i,w=x.flags;switch(x.tag){case 0:case 11:case 15:Cs(m,x,o),go(4,x);break;case 1:if(Cs(m,x,o),d=x,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ee){wt(d,d.return,ee)}if(d=x,m=d.updateQueue,m!==null){var N=d.stateNode;try{var H=m.shared.hiddenCallbacks;if(H!==null)for(m.shared.hiddenCallbacks=null,m=0;m<H.length;m++)u0(H[m],N)}catch(ee){wt(d,d.return,ee)}}o&&w&64&&_v(x),xo(x,x.return);break;case 27:jv(x);case 26:case 5:Cs(m,x,o),o&&d===null&&w&4&&Sv(x),xo(x,x.return);break;case 12:Cs(m,x,o);break;case 31:Cs(m,x,o),o&&w&4&&Av(m,x);break;case 13:Cs(m,x,o),o&&w&4&&Mv(m,x);break;case 22:x.memoizedState===null&&Cs(m,x,o),xo(x,x.return);break;case 30:break;default:Cs(m,x,o)}i=i.sibling}}function Mh(r,i){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&no(o))}function Rh(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&no(r))}function Ir(r,i,o,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Lv(r,i,o,d),i=i.sibling}function Lv(r,i,o,d){var m=i.flags;switch(i.tag){case 0:case 11:case 15:Ir(r,i,o,d),m&2048&&go(9,i);break;case 1:Ir(r,i,o,d);break;case 3:Ir(r,i,o,d),m&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&no(r)));break;case 12:if(m&2048){Ir(r,i,o,d),r=i.stateNode;try{var x=i.memoizedProps,w=x.id,N=x.onPostCommit;typeof N=="function"&&N(w,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(H){wt(i,i.return,H)}}else Ir(r,i,o,d);break;case 31:Ir(r,i,o,d);break;case 13:Ir(r,i,o,d);break;case 23:break;case 22:x=i.stateNode,w=i.alternate,i.memoizedState!==null?x._visibility&2?Ir(r,i,o,d):vo(r,i):x._visibility&2?Ir(r,i,o,d):(x._visibility|=2,Qa(r,i,o,d,(i.subtreeFlags&10256)!==0||!1)),m&2048&&Mh(w,i);break;case 24:Ir(r,i,o,d),m&2048&&Rh(i.alternate,i);break;default:Ir(r,i,o,d)}}function Qa(r,i,o,d,m){for(m=m&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=r,w=i,N=o,H=d,ee=w.flags;switch(w.tag){case 0:case 11:case 15:Qa(x,w,N,H,m),go(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Qa(x,w,N,H,m):vo(x,w):(oe._visibility|=2,Qa(x,w,N,H,m)),m&&ee&2048&&Mh(w.alternate,w);break;case 24:Qa(x,w,N,H,m),m&&ee&2048&&Rh(w.alternate,w);break;default:Qa(x,w,N,H,m)}i=i.sibling}}function vo(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var o=r,d=i,m=d.flags;switch(d.tag){case 22:vo(o,d),m&2048&&Mh(d.alternate,d);break;case 24:vo(o,d),m&2048&&Rh(d.alternate,d);break;default:vo(o,d)}i=i.sibling}}var bo=8192;function Ka(r,i,o){if(r.subtreeFlags&bo)for(r=r.child;r!==null;)Dv(r,i,o),r=r.sibling}function Dv(r,i,o){switch(r.tag){case 26:Ka(r,i,o),r.flags&bo&&r.memoizedState!==null&&Jk(o,Hr,r.memoizedState,r.memoizedProps);break;case 5:Ka(r,i,o);break;case 3:case 4:var d=Hr;Hr=Pu(r.stateNode.containerInfo),Ka(r,i,o),Hr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=bo,bo=16777216,Ka(r,i,o),bo=d):Ka(r,i,o));break;default:Ka(r,i,o)}}function Ov(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function yo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var o=0;o<i.length;o++){var d=i[o];yn=d,Pv(d,r)}Ov(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Bv(r),r=r.sibling}function Bv(r){switch(r.tag){case 0:case 11:case 15:yo(r),r.flags&2048&&ci(9,r,r.return);break;case 3:yo(r);break;case 12:yo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,ju(r)):yo(r);break;default:yo(r)}}function ju(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var o=0;o<i.length;o++){var d=i[o];yn=d,Pv(d,r)}Ov(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:ci(8,i,i.return),ju(i);break;case 22:o=i.stateNode,o._visibility&2&&(o._visibility&=-3,ju(i));break;default:ju(i)}r=r.sibling}}function Pv(r,i){for(;yn!==null;){var o=yn;switch(o.tag){case 0:case 11:case 15:ci(8,o,i);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:no(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,yn=d;else e:for(o=r;yn!==null;){d=yn;var m=d.sibling,x=d.return;if(Ev(d),d===o){yn=null;break e}if(m!==null){m.return=x,yn=m;break e}yn=x}}}var pk={getCacheForType:function(r){var i=kn(sn),o=i.data.get(r);return o===void 0&&(o=r(),i.data.set(r,o)),o},cacheSignal:function(){return kn(sn).controller.signal}},mk=typeof WeakMap=="function"?WeakMap:Map,xt=0,Et=null,at=null,ct=0,_t=0,or=null,ui=!1,Za=!1,zh=!1,Es=0,Kt=0,di=0,na=0,Lh=0,cr=0,Ja=0,_o=null,Xn=null,Dh=!1,Nu=0,$v=0,Cu=1/0,Eu=null,fi=null,gn=0,hi=null,el=null,Ts=0,Oh=0,Bh=null,Uv=null,wo=0,Ph=null;function ur(){return(xt&2)!==0&&ct!==0?ct&-ct:$.T!==null?qh():$l()}function Fv(){if(cr===0)if((ct&536870912)===0||dt){var r=Pr;Pr<<=1,(Pr&3932160)===0&&(Pr=262144),cr=r}else cr=536870912;return r=ar.current,r!==null&&(r.flags|=32),cr}function Qn(r,i,o){(r===Et&&(_t===2||_t===9)||r.cancelPendingCommit!==null)&&(tl(r,0),pi(r,ct,cr,!1)),Ot(r,o),((xt&2)===0||r!==Et)&&(r===Et&&((xt&2)===0&&(na|=o),Kt===4&&pi(r,ct,cr,!1)),ns(r))}function Hv(r,i,o){if((xt&6)!==0)throw Error(s(327));var d=!o&&(i&127)===0&&(i&r.expiredLanes)===0||We(r,i),m=d?vk(r,i):Uh(r,i,!0),x=d;do{if(m===0){Za&&!d&&pi(r,i,0,!1);break}else{if(o=r.current.alternate,x&&!gk(o)){m=Uh(r,i,!1),x=!1;continue}if(m===2){if(x=i,r.errorRecoveryDisabledLanes&x)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){i=w;e:{var N=r;m=_o;var H=N.current.memoizedState.isDehydrated;if(H&&(tl(N,w).flags|=256),w=Uh(N,w,!1),w!==2){if(zh&&!H){N.errorRecoveryDisabledLanes|=x,na|=x,m=4;break e}x=Xn,Xn=m,x!==null&&(Xn===null?Xn=x:Xn.push.apply(Xn,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){tl(r,0),pi(r,i,0,!0);break}e:{switch(d=r,x=m,x){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:pi(d,i,cr,!ui);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(m=Nu+300-qe(),10<m)){if(pi(d,i,cr,!ui),ge(d,0,!0)!==0)break e;Ts=i,d.timeoutHandle=b1(Iv.bind(null,d,o,Xn,Eu,Dh,i,cr,na,Ja,ui,x,"Throttled",-0,0),m);break e}Iv(d,o,Xn,Eu,Dh,i,cr,na,Ja,ui,x,null,-0,0)}}break}while(!0);ns(r)}function Iv(r,i,o,d,m,x,w,N,H,ee,oe,ue,ne,ie){if(r.timeoutHandle=-1,ue=i.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vr},Dv(i,x,ue);var Ee=(x&62914560)===x?Nu-qe():(x&4194048)===x?$v-qe():0;if(Ee=ej(ue,Ee),Ee!==null){Ts=x,r.cancelPendingCommit=Ee(Kv.bind(null,r,i,x,o,d,m,w,N,H,oe,ue,null,ne,ie)),pi(r,x,w,!ee);return}}Kv(r,i,x,o,d,m,w,N,H)}function gk(r){for(var i=r;;){var o=i.tag;if((o===0||o===11||o===15)&&i.flags&16384&&(o=i.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],x=m.getSnapshot;m=m.value;try{if(!sr(x(),m))return!1}catch{return!1}}if(o=i.child,i.subtreeFlags&16384&&o!==null)o.return=i,i=o;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function pi(r,i,o,d){i&=~Lh,i&=~na,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var m=i;0<m;){var x=31-Ze(m),w=1<<x;d[x]=-1,m&=~w}o!==0&&mr(r,o,i)}function Tu(){return(xt&6)===0?(So(0),!1):!0}function $h(){if(at!==null){if(_t===0)var r=at.return;else r=at,vs=Yi=null,th(r),Va=null,so=0,r=at;for(;r!==null;)yv(r.alternate,r),r=r.return;at=null}}function tl(r,i){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,Ok(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),Ts=0,$h(),Et=r,at=o=gs(r.current,null),ct=i,_t=0,or=null,ui=!1,Za=We(r,i),zh=!1,Ja=cr=Lh=na=di=Kt=0,Xn=_o=null,Dh=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var m=31-Ze(d),x=1<<m;i|=r[m],d&=~x}return Es=i,Qc(),o}function qv(r,i){Ke=null,$.H=ho,i===qa||i===su?(i=a0(),_t=3):i===If?(i=a0(),_t=4):_t=i===xh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,or=i,at===null&&(Kt=1,vu(r,wr(i,r.current)))}function Vv(){var r=ar.current;return r===null?!0:(ct&4194048)===ct?Nr===null:(ct&62914560)===ct||(ct&536870912)!==0?r===Nr:!1}function Gv(){var r=$.H;return $.H=ho,r===null?ho:r}function Yv(){var r=$.A;return $.A=pk,r}function Au(){Kt=4,ui||(ct&4194048)!==ct&&ar.current!==null||(Za=!0),(di&134217727)===0&&(na&134217727)===0||Et===null||pi(Et,ct,cr,!1)}function Uh(r,i,o){var d=xt;xt|=2;var m=Gv(),x=Yv();(Et!==r||ct!==i)&&(Eu=null,tl(r,i)),i=!1;var w=Kt;e:do try{if(_t!==0&&at!==null){var N=at,H=or;switch(_t){case 8:$h(),w=6;break e;case 3:case 2:case 9:case 6:ar.current===null&&(i=!0);var ee=_t;if(_t=0,or=null,nl(r,N,H,ee),o&&Za){w=0;break e}break;default:ee=_t,_t=0,or=null,nl(r,N,H,ee)}}xk(),w=Kt;break}catch(oe){qv(r,oe)}while(!0);return i&&r.shellSuspendCounter++,vs=Yi=null,xt=d,$.H=m,$.A=x,at===null&&(Et=null,ct=0,Qc()),w}function xk(){for(;at!==null;)Wv(at)}function vk(r,i){var o=xt;xt|=2;var d=Gv(),m=Yv();Et!==r||ct!==i?(Eu=null,Cu=qe()+500,tl(r,i)):Za=We(r,i);e:do try{if(_t!==0&&at!==null){i=at;var x=or;t:switch(_t){case 1:_t=0,or=null,nl(r,i,x,1);break;case 2:case 9:if(s0(x)){_t=0,or=null,Xv(i);break}i=function(){_t!==2&&_t!==9||Et!==r||(_t=7),ns(r)},x.then(i,i);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:s0(x)?(_t=0,or=null,Xv(i)):(_t=0,or=null,nl(r,i,x,7));break;case 5:var w=null;switch(at.tag){case 26:w=at.memoizedState;case 5:case 27:var N=at;if(w?L1(w):N.stateNode.complete){_t=0,or=null;var H=N.sibling;if(H!==null)at=H;else{var ee=N.return;ee!==null?(at=ee,Mu(ee)):at=null}break t}}_t=0,or=null,nl(r,i,x,5);break;case 6:_t=0,or=null,nl(r,i,x,6);break;case 8:$h(),Kt=6;break e;default:throw Error(s(462))}}bk();break}catch(oe){qv(r,oe)}while(!0);return vs=Yi=null,$.H=d,$.A=m,xt=o,at!==null?0:(Et=null,ct=0,Qc(),Kt)}function bk(){for(;at!==null&&!Oe();)Wv(at)}function Wv(r){var i=vv(r.alternate,r,Es);r.memoizedProps=r.pendingProps,i===null?Mu(r):at=i}function Xv(r){var i=r,o=i.alternate;switch(i.tag){case 15:case 0:i=fv(o,i,i.pendingProps,i.type,void 0,ct);break;case 11:i=fv(o,i,i.pendingProps,i.type.render,i.ref,ct);break;case 5:th(i);default:yv(o,i),i=at=Yx(i,Es),i=vv(o,i,Es)}r.memoizedProps=r.pendingProps,i===null?Mu(r):at=i}function nl(r,i,o,d){vs=Yi=null,th(i),Va=null,so=0;var m=i.return;try{if(lk(r,m,i,o,ct)){Kt=1,vu(r,wr(o,r.current)),at=null;return}}catch(x){if(m!==null)throw at=m,x;Kt=1,vu(r,wr(o,r.current)),at=null;return}i.flags&32768?(dt||d===1?r=!0:Za||(ct&536870912)!==0?r=!1:(ui=r=!0,(d===2||d===9||d===3||d===6)&&(d=ar.current,d!==null&&d.tag===13&&(d.flags|=16384))),Qv(i,r)):Mu(i)}function Mu(r){var i=r;do{if((i.flags&32768)!==0){Qv(i,ui);return}r=i.return;var o=uk(i.alternate,i,Es);if(o!==null){at=o;return}if(i=i.sibling,i!==null){at=i;return}at=i=r}while(i!==null);Kt===0&&(Kt=5)}function Qv(r,i){do{var o=dk(r.alternate,r);if(o!==null){o.flags&=32767,at=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!i&&(r=r.sibling,r!==null)){at=r;return}at=r=o}while(r!==null);Kt=6,at=null}function Kv(r,i,o,d,m,x,w,N,H){r.cancelPendingCommit=null;do Ru();while(gn!==0);if((xt&6)!==0)throw Error(s(327));if(i!==null){if(i===r.current)throw Error(s(177));if(x=i.lanes|i.childLanes,x|=Ef,Ln(r,o,x,w,N,H),r===Et&&(at=Et=null,ct=0),el=i,hi=r,Ts=o,Oh=x,Bh=m,Uv=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,Sk(W,function(){return n1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=$.T,$.T=null,m=z.p,z.p=2,w=xt,xt|=4;try{fk(r,i,o)}finally{xt=w,z.p=m,$.T=d}}gn=1,Zv(),Jv(),e1()}}function Zv(){if(gn===1){gn=0;var r=hi,i=el,o=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||o){o=$.T,$.T=null;var d=z.p;z.p=2;var m=xt;xt|=4;try{Rv(i,r);var x=Zh,w=Px(r.containerInfo),N=x.focusedElem,H=x.selectionRange;if(w!==N&&N&&N.ownerDocument&&Bx(N.ownerDocument.documentElement,N)){if(H!==null&&Sf(N)){var ee=H.start,oe=H.end;if(oe===void 0&&(oe=ee),"selectionStart"in N)N.selectionStart=ee,N.selectionEnd=Math.min(oe,N.value.length);else{var ue=N.ownerDocument||document,ne=ue&&ue.defaultView||window;if(ne.getSelection){var ie=ne.getSelection(),Ee=N.textContent.length,Ue=Math.min(H.start,Ee),jt=H.end===void 0?Ue:Math.min(H.end,Ee);!ie.extend&&Ue>jt&&(w=jt,jt=Ue,Ue=w);var K=Ox(N,Ue),V=Ox(N,jt);if(K&&V&&(ie.rangeCount!==1||ie.anchorNode!==K.node||ie.anchorOffset!==K.offset||ie.focusNode!==V.node||ie.focusOffset!==V.offset)){var J=ue.createRange();J.setStart(K.node,K.offset),ie.removeAllRanges(),Ue>jt?(ie.addRange(J),ie.extend(V.node,V.offset)):(J.setEnd(V.node,V.offset),ie.addRange(J))}}}}for(ue=[],ie=N;ie=ie.parentNode;)ie.nodeType===1&&ue.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ue.length;N++){var ce=ue[N];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}qu=!!Kh,Zh=Kh=null}finally{xt=m,z.p=d,$.T=o}}r.current=i,gn=2}}function Jv(){if(gn===2){gn=0;var r=hi,i=el,o=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||o){o=$.T,$.T=null;var d=z.p;z.p=2;var m=xt;xt|=4;try{Cv(r,i.alternate,i)}finally{xt=m,z.p=d,$.T=o}}gn=3}}function e1(){if(gn===4||gn===3){gn=0,yt();var r=hi,i=el,o=Ts,d=Uv;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?gn=5:(gn=0,el=hi=null,t1(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(fi=null),zi(o),i=i.stateNode,vt&&typeof vt.onCommitFiberRoot=="function")try{vt.onCommitFiberRoot(nt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=$.T,m=z.p,z.p=2,$.T=null;try{for(var x=r.onRecoverableError,w=0;w<d.length;w++){var N=d[w];x(N.value,{componentStack:N.stack})}}finally{$.T=i,z.p=m}}(Ts&3)!==0&&Ru(),ns(r),m=r.pendingLanes,(o&261930)!==0&&(m&42)!==0?r===Ph?wo++:(wo=0,Ph=r):wo=0,So(0)}}function t1(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,no(i)))}function Ru(){return Zv(),Jv(),e1(),n1()}function n1(){if(gn!==5)return!1;var r=hi,i=Oh;Oh=0;var o=zi(Ts),d=$.T,m=z.p;try{z.p=32>o?32:o,$.T=null,o=Bh,Bh=null;var x=hi,w=Ts;if(gn=0,el=hi=null,Ts=0,(xt&6)!==0)throw Error(s(331));var N=xt;if(xt|=4,Bv(x.current),Lv(x,x.current,w,o),xt=N,So(0,!1),vt&&typeof vt.onPostCommitFiberRoot=="function")try{vt.onPostCommitFiberRoot(nt,x)}catch{}return!0}finally{z.p=m,$.T=d,t1(r,i)}}function r1(r,i,o){i=wr(o,i),i=gh(r.stateNode,i,2),r=ai(r,i,2),r!==null&&(Ot(r,2),ns(r))}function wt(r,i,o){if(r.tag===3)r1(r,r,o);else for(;i!==null;){if(i.tag===3){r1(i,r,o);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(fi===null||!fi.has(d))){r=wr(o,r),o=sv(2),d=ai(i,o,2),d!==null&&(iv(o,d,i,r),Ot(d,2),ns(d));break}}i=i.return}}function Fh(r,i,o){var d=r.pingCache;if(d===null){d=r.pingCache=new mk;var m=new Set;d.set(i,m)}else m=d.get(i),m===void 0&&(m=new Set,d.set(i,m));m.has(o)||(zh=!0,m.add(o),r=yk.bind(null,r,i,o),i.then(r,r))}function yk(r,i,o){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,Et===r&&(ct&o)===o&&(Kt===4||Kt===3&&(ct&62914560)===ct&&300>qe()-Nu?(xt&2)===0&&tl(r,0):Lh|=o,Ja===ct&&(Ja=0)),ns(r)}function s1(r,i){i===0&&(i=rn()),r=qi(r,i),r!==null&&(Ot(r,i),ns(r))}function _k(r){var i=r.memoizedState,o=0;i!==null&&(o=i.retryLane),s1(r,o)}function wk(r,i){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(s(314))}d!==null&&d.delete(i),s1(r,o)}function Sk(r,i){return _n(r,i)}var zu=null,rl=null,Hh=!1,Lu=!1,Ih=!1,mi=0;function ns(r){r!==rl&&r.next===null&&(rl===null?zu=rl=r:rl=rl.next=r),Lu=!0,Hh||(Hh=!0,jk())}function So(r,i){if(!Ih&&Lu){Ih=!0;do for(var o=!1,d=zu;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var x=0;else{var w=d.suspendedLanes,N=d.pingedLanes;x=(1<<31-Ze(42|r)+1)-1,x&=m&~(w&~N),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,o1(d,x))}else x=ct,x=ge(d,d===Et?x:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(x&3)===0||We(d,x)||(o=!0,o1(d,x));d=d.next}while(o);Ih=!1}}function kk(){i1()}function i1(){Lu=Hh=!1;var r=0;mi!==0&&Dk()&&(r=mi);for(var i=qe(),o=null,d=zu;d!==null;){var m=d.next,x=a1(d,i);x===0?(d.next=null,o===null?zu=m:o.next=m,m===null&&(rl=o)):(o=d,(r!==0||(x&3)!==0)&&(Lu=!0)),d=m}gn!==0&&gn!==5||So(r),mi!==0&&(mi=0)}function a1(r,i){for(var o=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,x=r.pendingLanes&-62914561;0<x;){var w=31-Ze(x),N=1<<w,H=m[w];H===-1?((N&o)===0||(N&d)!==0)&&(m[w]=Dt(N,i)):H<=i&&(r.expiredLanes|=N),x&=~N}if(i=Et,o=ct,o=ge(r,r===i?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===i&&(_t===2||_t===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&je(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||We(r,o)){if(i=o&-o,i===r.callbackPriority)return i;switch(d!==null&&je(d),zi(o)){case 2:case 8:o=ve;break;case 32:o=W;break;case 268435456:o=Te;break;default:o=W}return d=l1.bind(null,r),o=_n(o,d),r.callbackPriority=i,r.callbackNode=o,i}return d!==null&&d!==null&&je(d),r.callbackPriority=2,r.callbackNode=null,2}function l1(r,i){if(gn!==0&&gn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(Ru()&&r.callbackNode!==o)return null;var d=ct;return d=ge(r,r===Et?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Hv(r,d,i),a1(r,qe()),r.callbackNode!=null&&r.callbackNode===o?l1.bind(null,r):null)}function o1(r,i){if(Ru())return null;Hv(r,i,!0)}function jk(){Bk(function(){(xt&6)!==0?_n(ae,kk):i1()})}function qh(){if(mi===0){var r=Ha;r===0&&(r=Br,Br<<=1,(Br&261888)===0&&(Br=256)),mi=r}return mi}function c1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Ta(""+r)}function u1(r,i){var o=i.ownerDocument.createElement("input");return o.name=i.name,o.value=i.value,r.id&&o.setAttribute("form",r.id),i.parentNode.insertBefore(o,i),r=new FormData(r),o.parentNode.removeChild(o),r}function Nk(r,i,o,d,m){if(i==="submit"&&o&&o.stateNode===m){var x=c1((m[wn]||null).action),w=d.submitter;w&&(i=(i=w[wn]||null)?c1(i.formAction):w.getAttribute("formAction"),i!==null&&(x=i,w=null));var N=new ms("action","action",null,d,m);r.push({event:N,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(mi!==0){var H=w?u1(m,w):new FormData(m);uh(o,{pending:!0,data:H,method:m.method,action:x},null,H)}}else typeof x=="function"&&(N.preventDefault(),H=w?u1(m,w):new FormData(m),uh(o,{pending:!0,data:H,method:m.method,action:x},x,H))},currentTarget:m}]})}}for(var Vh=0;Vh<Cf.length;Vh++){var Gh=Cf[Vh],Ck=Gh.toLowerCase(),Ek=Gh[0].toUpperCase()+Gh.slice(1);Fr(Ck,"on"+Ek)}Fr(Fx,"onAnimationEnd"),Fr(Hx,"onAnimationIteration"),Fr(Ix,"onAnimationStart"),Fr("dblclick","onDoubleClick"),Fr("focusin","onFocus"),Fr("focusout","onBlur"),Fr(qS,"onTransitionRun"),Fr(VS,"onTransitionStart"),Fr(GS,"onTransitionCancel"),Fr(qx,"onTransitionEnd"),Qr("onMouseEnter",["mouseout","mouseover"]),Qr("onMouseLeave",["mouseout","mouseover"]),Qr("onPointerEnter",["pointerout","pointerover"]),Qr("onPointerLeave",["pointerout","pointerover"]),$r("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$r("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$r("onBeforeInput",["compositionend","keypress","textInput","paste"]),$r("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$r("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$r("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ko="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Tk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ko));function d1(r,i){i=(i&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],m=d.event;d=d.listeners;e:{var x=void 0;if(i)for(var w=d.length-1;0<=w;w--){var N=d[w],H=N.instance,ee=N.currentTarget;if(N=N.listener,H!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=ee;try{x(m)}catch(oe){Xc(oe)}m.currentTarget=null,x=H}else for(w=0;w<d.length;w++){if(N=d[w],H=N.instance,ee=N.currentTarget,N=N.listener,H!==x&&m.isPropagationStopped())break e;x=N,m.currentTarget=ee;try{x(m)}catch(oe){Xc(oe)}m.currentTarget=null,x=H}}}}function lt(r,i){var o=i[Fl];o===void 0&&(o=i[Fl]=new Set);var d=r+"__bubble";o.has(d)||(f1(i,r,2,!1),o.add(d))}function Yh(r,i,o){var d=0;i&&(d|=4),f1(o,r,d,i)}var Du="_reactListening"+Math.random().toString(36).slice(2);function Wh(r){if(!r[Du]){r[Du]=!0,qn.forEach(function(o){o!=="selectionchange"&&(Tk.has(o)||Yh(o,!1,r),Yh(o,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Du]||(i[Du]=!0,Yh("selectionchange",!1,i))}}function f1(r,i,o,d){switch(F1(i)){case 2:var m=rj;break;case 8:m=sj;break;default:m=cp}o=m.bind(null,i,o,r),m=void 0,!Ma||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(i,o,{capture:!0,passive:m}):r.addEventListener(i,o,!0):m!==void 0?r.addEventListener(i,o,{passive:m}):r.addEventListener(i,o,!1)}function Xh(r,i,o,d,m){var x=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var w=d.tag;if(w===3||w===4){var N=d.stateNode.containerInfo;if(N===m)break;if(w===4)for(w=d.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;N!==null;){if(w=ps(N),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){d=x=w;continue e}N=N.parentNode}}d=d.return}Fc(function(){var ee=x,oe=Aa(o),ue=[];e:{var ne=Vx.get(r);if(ne!==void 0){var ie=ms,Ee=r;switch(r){case"keypress":if(it(o)===0)break e;case"keydown":case"keyup":ie=wS;break;case"focusin":Ee="focus",ie=Zr;break;case"focusout":Ee="blur",ie=Zr;break;case"beforeblur":case"afterblur":ie=Zr;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=vf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=qc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=jS;break;case Fx:case Hx:case Ix:ie=Yc;break;case qx:ie=CS;break;case"scroll":case"scrollend":ie=Hc;break;case"wheel":ie=TS;break;case"copy":case"cut":case"paste":ie=mS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=wx;break;case"toggle":case"beforetoggle":ie=MS}var Ue=(i&4)!==0,jt=!Ue&&(r==="scroll"||r==="scrollend"),K=Ue?ne!==null?ne+"Capture":null:ne;Ue=[];for(var V=ee,J;V!==null;){var ce=V;if(J=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||J===null||K===null||(ce=$i(V,K),ce!=null&&Ue.push(jo(V,ce,J))),jt)break;V=V.return}0<Ue.length&&(ne=new ie(ne,Ee,null,o,oe),ue.push({event:ne,listeners:Ue}))}}if((i&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",ie=r==="mouseout"||r==="pointerout",ne&&o!==Qs&&(Ee=o.relatedTarget||o.fromElement)&&(ps(Ee)||Ee[rr]))break e;if((ie||ne)&&(ne=oe.window===oe?oe:(ne=oe.ownerDocument)?ne.defaultView||ne.parentWindow:window,ie?(Ee=o.relatedTarget||o.toElement,ie=ee,Ee=Ee?ps(Ee):null,Ee!==null&&(jt=c(Ee),Ue=Ee.tag,Ee!==jt||Ue!==5&&Ue!==27&&Ue!==6)&&(Ee=null)):(ie=null,Ee=ee),ie!==Ee)){if(Ue=vf,ce="onMouseLeave",K="onMouseEnter",V="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=wx,ce="onPointerLeave",K="onPointerEnter",V="pointer"),jt=ie==null?ne:Oi(ie),J=Ee==null?ne:Oi(Ee),ne=new Ue(ce,V+"leave",ie,o,oe),ne.target=jt,ne.relatedTarget=J,ce=null,ps(oe)===ee&&(Ue=new Ue(K,V+"enter",Ee,o,oe),Ue.target=J,Ue.relatedTarget=jt,ce=Ue),jt=ce,ie&&Ee)t:{for(Ue=Ak,K=ie,V=Ee,J=0,ce=K;ce;ce=Ue(ce))J++;ce=0;for(var Be=V;Be;Be=Ue(Be))ce++;for(;0<J-ce;)K=Ue(K),J--;for(;0<ce-J;)V=Ue(V),ce--;for(;J--;){if(K===V||V!==null&&K===V.alternate){Ue=K;break t}K=Ue(K),V=Ue(V)}Ue=null}else Ue=null;ie!==null&&h1(ue,ne,ie,Ue,!1),Ee!==null&&jt!==null&&h1(ue,jt,Ee,Ue,!0)}}e:{if(ne=ee?Oi(ee):window,ie=ne.nodeName&&ne.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ne.type==="file")var mt=Ax;else if(Ex(ne))if(Mx)mt=FS;else{mt=$S;var Me=PS}else ie=ne.nodeName,!ie||ie.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Ea(ee.elementType)&&(mt=Ax):mt=US;if(mt&&(mt=mt(r,ee))){Tx(ue,mt,o,oe);break e}Me&&Me(r,ne,ee),r==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&Na(ne,"number",ne.value)}switch(Me=ee?Oi(ee):window,r){case"focusin":(Ex(Me)||Me.contentEditable==="true")&&(La=Me,kf=ee,Jl=null);break;case"focusout":Jl=kf=La=null;break;case"mousedown":jf=!0;break;case"contextmenu":case"mouseup":case"dragend":jf=!1,$x(ue,o,oe);break;case"selectionchange":if(IS)break;case"keydown":case"keyup":$x(ue,o,oe)}var Je;if(yf)e:{switch(r){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else za?Nx(r,o)&&(ut="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(ut="onCompositionStart");ut&&(Sx&&o.locale!=="ko"&&(za||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&za&&(Je=ht()):(q=oe,de="value"in q?q.value:q.textContent,za=!0)),Me=Ou(ee,ut),0<Me.length&&(ut=new _x(ut,r,null,o,oe),ue.push({event:ut,listeners:Me}),Je?ut.data=Je:(Je=Cx(o),Je!==null&&(ut.data=Je)))),(Je=zS?LS(r,o):DS(r,o))&&(ut=Ou(ee,"onBeforeInput"),0<ut.length&&(Me=new _x("onBeforeInput","beforeinput",null,o,oe),ue.push({event:Me,listeners:ut}),Me.data=Je)),Nk(ue,r,ee,o,oe)}d1(ue,i)})}function jo(r,i,o){return{instance:r,listener:i,currentTarget:o}}function Ou(r,i){for(var o=i+"Capture",d=[];r!==null;){var m=r,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=$i(r,o),m!=null&&d.unshift(jo(r,m,x)),m=$i(r,i),m!=null&&d.push(jo(r,m,x))),r.tag===3)return d;r=r.return}return[]}function Ak(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function h1(r,i,o,d,m){for(var x=i._reactName,w=[];o!==null&&o!==d;){var N=o,H=N.alternate,ee=N.stateNode;if(N=N.tag,H!==null&&H===d)break;N!==5&&N!==26&&N!==27||ee===null||(H=ee,m?(ee=$i(o,x),ee!=null&&w.unshift(jo(o,ee,H))):m||(ee=$i(o,x),ee!=null&&w.push(jo(o,ee,H)))),o=o.return}w.length!==0&&r.push({event:i,listeners:w})}var Mk=/\r\n?/g,Rk=/\u0000|\uFFFD/g;function p1(r){return(typeof r=="string"?r:""+r).replace(Mk,`
|
|
49
|
+
`).replace(Rk,"")}function m1(r,i){return i=p1(i),p1(r)===i}function kt(r,i,o,d,m,x){switch(o){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||Xs(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&Xs(r,""+d);break;case"className":ka(r,"class",d);break;case"tabIndex":ka(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ka(r,o,d);break;case"style":Pc(r,d,x);break;case"data":if(i!=="object"){ka(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Ta(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(o==="formAction"?(i!=="input"&&kt(r,i,"name",m.name,m,null),kt(r,i,"formEncType",m.formEncType,m,null),kt(r,i,"formMethod",m.formMethod,m,null),kt(r,i,"formTarget",m.formTarget,m,null)):(kt(r,i,"encType",m.encType,m,null),kt(r,i,"method",m.method,m,null),kt(r,i,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Ta(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=vr);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(s(60));r.innerHTML=o}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}o=Ta(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":lt("beforetoggle",r),lt("toggle",r),Bi(r,"popover",d);break;case"xlinkActuate":Ur(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ur(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ur(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ur(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ur(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ur(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Bi(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=$c.get(o)||o,Bi(r,o,d))}}function Qh(r,i,o,d,m,x){switch(o){case"style":Pc(r,d,x);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(s(60));r.innerHTML=o}}break;case"children":typeof d=="string"?Xs(r,d):(typeof d=="number"||typeof d=="bigint")&&Xs(r,""+d);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"onClick":d!=null&&(r.onclick=vr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sa.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),i=o.slice(2,m?o.length-7:void 0),x=r[wn]||null,x=x!=null?x[o]:null,typeof x=="function"&&r.removeEventListener(i,x,m),typeof d=="function")){typeof x!="function"&&x!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(i,d,m);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):Bi(r,o,d)}}}function Nn(r,i,o){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",r),lt("load",r);var d=!1,m=!1,x;for(x in o)if(o.hasOwnProperty(x)){var w=o[x];if(w!=null)switch(x){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:kt(r,i,x,w,o,null)}}m&&kt(r,i,"srcSet",o.srcSet,o,null),d&&kt(r,i,"src",o.src,o,null);return;case"input":lt("invalid",r);var N=x=w=m=null,H=null,ee=null;for(d in o)if(o.hasOwnProperty(d)){var oe=o[d];if(oe!=null)switch(d){case"name":m=oe;break;case"type":w=oe;break;case"checked":H=oe;break;case"defaultChecked":ee=oe;break;case"value":x=oe;break;case"defaultValue":N=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(s(137,i));break;default:kt(r,i,d,oe,o,null)}}Oc(r,x,N,H,ee,w,m,!1);return;case"select":lt("invalid",r),d=w=x=null;for(m in o)if(o.hasOwnProperty(m)&&(N=o[m],N!=null))switch(m){case"value":x=N;break;case"defaultValue":w=N;break;case"multiple":d=N;default:kt(r,i,m,N,o,null)}i=x,o=w,r.multiple=!!d,i!=null?Ws(r,!!d,i,!1):o!=null&&Ws(r,!!d,o,!0);return;case"textarea":lt("invalid",r),x=m=d=null;for(w in o)if(o.hasOwnProperty(w)&&(N=o[w],N!=null))switch(w){case"value":d=N;break;case"defaultValue":m=N;break;case"children":x=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(s(91));break;default:kt(r,i,w,N,o,null)}Vl(r,d,m,x);return;case"option":for(H in o)if(o.hasOwnProperty(H)&&(d=o[H],d!=null))switch(H){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:kt(r,i,H,d,o,null)}return;case"dialog":lt("beforetoggle",r),lt("toggle",r),lt("cancel",r),lt("close",r);break;case"iframe":case"object":lt("load",r);break;case"video":case"audio":for(d=0;d<ko.length;d++)lt(ko[d],r);break;case"image":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"embed":case"source":case"link":lt("error",r),lt("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in o)if(o.hasOwnProperty(ee)&&(d=o[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:kt(r,i,ee,d,o,null)}return;default:if(Ea(i)){for(oe in o)o.hasOwnProperty(oe)&&(d=o[oe],d!==void 0&&Qh(r,i,oe,d,o,void 0));return}}for(N in o)o.hasOwnProperty(N)&&(d=o[N],d!=null&&kt(r,i,N,d,o,null))}function zk(r,i,o,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,N=null,H=null,ee=null,oe=null;for(ie in o){var ue=o[ie];if(o.hasOwnProperty(ie)&&ue!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":H=ue;default:d.hasOwnProperty(ie)||kt(r,i,ie,null,d,ue)}}for(var ne in d){var ie=d[ne];if(ue=o[ne],d.hasOwnProperty(ne)&&(ie!=null||ue!=null))switch(ne){case"type":x=ie;break;case"name":m=ie;break;case"checked":ee=ie;break;case"defaultChecked":oe=ie;break;case"value":w=ie;break;case"defaultValue":N=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,i));break;default:ie!==ue&&kt(r,i,ne,ie,d,ue)}}Pi(r,w,N,H,ee,oe,x,m);return;case"select":ie=w=N=ne=null;for(x in o)if(H=o[x],o.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":ie=H;default:d.hasOwnProperty(x)||kt(r,i,x,null,d,H)}for(m in d)if(x=d[m],H=o[m],d.hasOwnProperty(m)&&(x!=null||H!=null))switch(m){case"value":ne=x;break;case"defaultValue":N=x;break;case"multiple":w=x;default:x!==H&&kt(r,i,m,x,d,H)}i=N,o=w,d=ie,ne!=null?Ws(r,!!o,ne,!1):!!d!=!!o&&(i!=null?Ws(r,!!o,i,!0):Ws(r,!!o,o?[]:"",!1));return;case"textarea":ie=ne=null;for(N in o)if(m=o[N],o.hasOwnProperty(N)&&m!=null&&!d.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:kt(r,i,N,null,d,m)}for(w in d)if(m=d[w],x=o[w],d.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":ne=m;break;case"defaultValue":ie=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(s(91));break;default:m!==x&&kt(r,i,w,m,d,x)}Ca(r,ne,ie);return;case"option":for(var Ee in o)if(ne=o[Ee],o.hasOwnProperty(Ee)&&ne!=null&&!d.hasOwnProperty(Ee))switch(Ee){case"selected":r.selected=!1;break;default:kt(r,i,Ee,null,d,ne)}for(H in d)if(ne=d[H],ie=o[H],d.hasOwnProperty(H)&&ne!==ie&&(ne!=null||ie!=null))switch(H){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:kt(r,i,H,ne,d,ie)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in o)ne=o[Ue],o.hasOwnProperty(Ue)&&ne!=null&&!d.hasOwnProperty(Ue)&&kt(r,i,Ue,null,d,ne);for(ee in d)if(ne=d[ee],ie=o[ee],d.hasOwnProperty(ee)&&ne!==ie&&(ne!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,i));break;default:kt(r,i,ee,ne,d,ie)}return;default:if(Ea(i)){for(var jt in o)ne=o[jt],o.hasOwnProperty(jt)&&ne!==void 0&&!d.hasOwnProperty(jt)&&Qh(r,i,jt,void 0,d,ne);for(oe in d)ne=d[oe],ie=o[oe],!d.hasOwnProperty(oe)||ne===ie||ne===void 0&&ie===void 0||Qh(r,i,oe,ne,d,ie);return}}for(var K in o)ne=o[K],o.hasOwnProperty(K)&&ne!=null&&!d.hasOwnProperty(K)&&kt(r,i,K,null,d,ne);for(ue in d)ne=d[ue],ie=o[ue],!d.hasOwnProperty(ue)||ne===ie||ne==null&&ie==null||kt(r,i,ue,ne,d,ie)}function g1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Lk(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],x=m.transferSize,w=m.initiatorType,N=m.duration;if(x&&N&&g1(w)){for(w=0,N=m.responseEnd,d+=1;d<o.length;d++){var H=o[d],ee=H.startTime;if(ee>N)break;var oe=H.transferSize,ue=H.initiatorType;oe&&g1(ue)&&(H=H.responseEnd,w+=oe*(H<N?1:(N-ee)/(H-ee)))}if(--d,i+=8*(x+w)/(m.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Kh=null,Zh=null;function Bu(r){return r.nodeType===9?r:r.ownerDocument}function x1(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function v1(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Jh(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var ep=null;function Dk(){var r=window.event;return r&&r.type==="popstate"?r===ep?!1:(ep=r,!0):(ep=null,!1)}var b1=typeof setTimeout=="function"?setTimeout:void 0,Ok=typeof clearTimeout=="function"?clearTimeout:void 0,y1=typeof Promise=="function"?Promise:void 0,Bk=typeof queueMicrotask=="function"?queueMicrotask:typeof y1<"u"?function(r){return y1.resolve(null).then(r).catch(Pk)}:b1;function Pk(r){setTimeout(function(){throw r})}function gi(r){return r==="head"}function _1(r,i){var o=i,d=0;do{var m=o.nextSibling;if(r.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(m),ll(i);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")No(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,No(o);for(var x=o.firstChild;x;){var w=x.nextSibling,N=x.nodeName;x[Wr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=w}}else o==="body"&&No(r.ownerDocument.body);o=m}while(o);ll(i)}function w1(r,i){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?i?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(i?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function tp(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var o=i;switch(i=i.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":tp(o),Gs(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function $k(r,i,o,d){for(;r.nodeType===1;){var m=o;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Wr])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(x=r.getAttribute("rel"),x==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(x!==m.rel||r.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||r.getAttribute("title")!==(m.title==null?null:m.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(x=r.getAttribute("src"),(x!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===x)return r}else return r;if(r=Cr(r.nextSibling),r===null)break}return null}function Uk(r,i,o){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=Cr(r.nextSibling),r===null))return null;return r}function S1(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Cr(r.nextSibling),r===null))return null;return r}function np(r){return r.data==="$?"||r.data==="$~"}function rp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function Fk(r,i){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||o.readyState!=="loading")i();else{var d=function(){i(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Cr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var sp=null;function k1(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(i===0)return Cr(r.nextSibling);i--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||i++}r=r.nextSibling}return null}function j1(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(i===0)return r;i--}else o!=="/$"&&o!=="/&"||i++}r=r.previousSibling}return null}function N1(r,i,o){switch(i=Bu(o),r){case"html":if(r=i.documentElement,!r)throw Error(s(452));return r;case"head":if(r=i.head,!r)throw Error(s(453));return r;case"body":if(r=i.body,!r)throw Error(s(454));return r;default:throw Error(s(451))}}function No(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Gs(r)}var Er=new Map,C1=new Set;function Pu(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var As=z.d;z.d={f:Hk,r:Ik,D:qk,C:Vk,L:Gk,m:Yk,X:Xk,S:Wk,M:Qk};function Hk(){var r=As.f(),i=Tu();return r||i}function Ik(r){var i=In(r);i!==null&&i.tag===5&&i.type==="form"?q0(i):As.r(r)}var sl=typeof document>"u"?null:document;function E1(r,i,o){var d=sl;if(d&&typeof i=="string"&&i){var m=Jt(i);m='link[rel="'+r+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),C1.has(m)||(C1.add(m),r={rel:r,crossOrigin:o,href:i},d.querySelector(m)===null&&(i=d.createElement("link"),Nn(i,"link",r),Yt(i),d.head.appendChild(i)))}}function qk(r){As.D(r),E1("dns-prefetch",r,null)}function Vk(r,i){As.C(r,i),E1("preconnect",r,i)}function Gk(r,i,o){As.L(r,i,o);var d=sl;if(d&&r&&i){var m='link[rel="preload"][as="'+Jt(i)+'"]';i==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Jt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Jt(o.imageSizes)+'"]')):m+='[href="'+Jt(r)+'"]';var x=m;switch(i){case"style":x=il(r);break;case"script":x=al(r)}Er.has(x)||(r=v({rel:"preload",href:i==="image"&&o&&o.imageSrcSet?void 0:r,as:i},o),Er.set(x,r),d.querySelector(m)!==null||i==="style"&&d.querySelector(Co(x))||i==="script"&&d.querySelector(Eo(x))||(i=d.createElement("link"),Nn(i,"link",r),Yt(i),d.head.appendChild(i)))}}function Yk(r,i){As.m(r,i);var o=sl;if(o&&r){var d=i&&typeof i.as=="string"?i.as:"script",m='link[rel="modulepreload"][as="'+Jt(d)+'"][href="'+Jt(r)+'"]',x=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=al(r)}if(!Er.has(x)&&(r=v({rel:"modulepreload",href:r},i),Er.set(x,r),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Eo(x)))return}d=o.createElement("link"),Nn(d,"link",r),Yt(d),o.head.appendChild(d)}}}function Wk(r,i,o){As.S(r,i,o);var d=sl;if(d&&r){var m=Xr(d).hoistableStyles,x=il(r);i=i||"default";var w=m.get(x);if(!w){var N={loading:0,preload:null};if(w=d.querySelector(Co(x)))N.loading=5;else{r=v({rel:"stylesheet",href:r,"data-precedence":i},o),(o=Er.get(x))&&ip(r,o);var H=w=d.createElement("link");Yt(H),Nn(H,"link",r),H._p=new Promise(function(ee,oe){H.onload=ee,H.onerror=oe}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,$u(w,i,d)}w={type:"stylesheet",instance:w,count:1,state:N},m.set(x,w)}}}function Xk(r,i){As.X(r,i);var o=sl;if(o&&r){var d=Xr(o).hoistableScripts,m=al(r),x=d.get(m);x||(x=o.querySelector(Eo(m)),x||(r=v({src:r,async:!0},i),(i=Er.get(m))&&ap(r,i),x=o.createElement("script"),Yt(x),Nn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function Qk(r,i){As.M(r,i);var o=sl;if(o&&r){var d=Xr(o).hoistableScripts,m=al(r),x=d.get(m);x||(x=o.querySelector(Eo(m)),x||(r=v({src:r,async:!0,type:"module"},i),(i=Er.get(m))&&ap(r,i),x=o.createElement("script"),Yt(x),Nn(x,"link",r),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},d.set(m,x))}}function T1(r,i,o,d){var m=(m=Ce.current)?Pu(m):null;if(!m)throw Error(s(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(i=il(o.href),o=Xr(m).hoistableStyles,d=o.get(i),d||(d={type:"style",instance:null,count:0,state:null},o.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=il(o.href);var x=Xr(m).hoistableStyles,w=x.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,w),(x=m.querySelector(Co(r)))&&!x._p&&(w.instance=x,w.state.loading=5),Er.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Er.set(r,o),x||Kk(m,r,o,w.state))),i&&d===null)throw Error(s(528,""));return w}if(i&&d!==null)throw Error(s(529,""));return null;case"script":return i=o.async,o=o.src,typeof o=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=al(o),o=Xr(m).hoistableScripts,d=o.get(i),d||(d={type:"script",instance:null,count:0,state:null},o.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,r))}}function il(r){return'href="'+Jt(r)+'"'}function Co(r){return'link[rel="stylesheet"]['+r+"]"}function A1(r){return v({},r,{"data-precedence":r.precedence,precedence:null})}function Kk(r,i,o,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Nn(i,"link",o),Yt(i),r.head.appendChild(i))}function al(r){return'[src="'+Jt(r)+'"]'}function Eo(r){return"script[async]"+r}function M1(r,i,o){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Jt(o.href)+'"]');if(d)return i.instance=d,Yt(d),d;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Yt(d),Nn(d,"style",m),$u(d,o.precedence,r),i.instance=d;case"stylesheet":m=il(o.href);var x=r.querySelector(Co(m));if(x)return i.state.loading|=4,i.instance=x,Yt(x),x;d=A1(o),(m=Er.get(m))&&ip(d,m),x=(r.ownerDocument||r).createElement("link"),Yt(x);var w=x;return w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),Nn(x,"link",d),i.state.loading|=4,$u(x,o.precedence,r),i.instance=x;case"script":return x=al(o.src),(m=r.querySelector(Eo(x)))?(i.instance=m,Yt(m),m):(d=o,(m=Er.get(x))&&(d=v({},o),ap(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Yt(m),Nn(m,"link",d),r.head.appendChild(m),i.instance=m);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,$u(d,o.precedence,r));return i.instance}function $u(r,i,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,x=m,w=0;w<d.length;w++){var N=d[w];if(N.dataset.precedence===i)x=N;else if(x!==m)break}x?x.parentNode.insertBefore(r,x.nextSibling):(i=o.nodeType===9?o.head:o,i.insertBefore(r,i.firstChild))}function ip(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function ap(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Uu=null;function R1(r,i,o){if(Uu===null){var d=new Map,m=Uu=new Map;m.set(o,d)}else m=Uu,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),m=0;m<o.length;m++){var x=o[m];if(!(x[Wr]||x[Ht]||r==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(i)||"";w=r+w;var N=d.get(w);N?N.push(x):d.set(w,[x])}}return d}function z1(r,i,o){r=r.ownerDocument||r,r.head.insertBefore(o,i==="title"?r.querySelector("head > title"):null)}function Zk(r,i,o){if(o===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function L1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function Jk(r,i,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=il(d.href),x=i.querySelector(Co(m));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Fu.bind(r),i.then(r,r)),o.state.loading|=4,o.instance=x,Yt(x);return}x=i.ownerDocument||i,d=A1(d),(m=Er.get(m))&&ip(d,m),x=x.createElement("link"),Yt(x);var w=x;w._p=new Promise(function(N,H){w.onload=N,w.onerror=H}),Nn(x,"link",d),o.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,i),(i=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=Fu.bind(r),i.addEventListener("load",o),i.addEventListener("error",o))}}var lp=0;function ej(r,i){return r.stylesheets&&r.count===0&&Iu(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Iu(r,r.stylesheets),r.unsuspend){var x=r.unsuspend;r.unsuspend=null,x()}},6e4+i);0<r.imgBytes&&lp===0&&(lp=62500*Lk());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Iu(r,r.stylesheets),r.unsuspend)){var x=r.unsuspend;r.unsuspend=null,x()}},(r.imgBytes>lp?50:800)+i);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function Fu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Iu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Hu=null;function Iu(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Hu=new Map,i.forEach(tj,r),Hu=null,Fu.call(r))}function tj(r,i){if(!(i.state.loading&4)){var o=Hu.get(r);if(o)var d=o.get(null);else{o=new Map,Hu.set(r,o);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(o.set(w.dataset.precedence,w),d=w)}d&&o.set(null,d)}m=i.instance,w=m.getAttribute("data-precedence"),x=o.get(w)||d,x===d&&o.set(null,m),o.set(w,m),this.count++,d=Fu.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),x?x.parentNode.insertBefore(m,x.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),i.state.loading|=4}}var To={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function nj(r,i,o,d,m,x,w,N,H){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Tn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tn(0),this.hiddenUpdates=Tn(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function D1(r,i,o,d,m,x,w,N,H,ee,oe,ue){return r=new nj(r,i,o,w,H,ee,oe,ue,N),i=1,x===!0&&(i|=24),x=ir(3,null,null,i),r.current=x,x.stateNode=r,i=Uf(),i.refCount++,r.pooledCache=i,i.refCount++,x.memoizedState={element:d,isDehydrated:o,cache:i},qf(x),r}function O1(r){return r?(r=Ba,r):Ba}function B1(r,i,o,d,m,x){m=O1(m),d.context===null?d.context=m:d.pendingContext=m,d=ii(i),d.payload={element:o},x=x===void 0?null:x,x!==null&&(d.callback=x),o=ai(r,d,i),o!==null&&(Qn(o,r,i),ao(o,r,i))}function P1(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<i?o:i}}function op(r,i){P1(r,i),(r=r.alternate)&&P1(r,i)}function $1(r){if(r.tag===13||r.tag===31){var i=qi(r,67108864);i!==null&&Qn(i,r,67108864),op(r,67108864)}}function U1(r){if(r.tag===13||r.tag===31){var i=ur();i=Dn(i);var o=qi(r,i);o!==null&&Qn(o,r,i),op(r,i)}}var qu=!0;function rj(r,i,o,d){var m=$.T;$.T=null;var x=z.p;try{z.p=2,cp(r,i,o,d)}finally{z.p=x,$.T=m}}function sj(r,i,o,d){var m=$.T;$.T=null;var x=z.p;try{z.p=8,cp(r,i,o,d)}finally{z.p=x,$.T=m}}function cp(r,i,o,d){if(qu){var m=up(d);if(m===null)Xh(r,i,d,Vu,o),H1(r,d);else if(aj(m,r,i,o,d))d.stopPropagation();else if(H1(r,d),i&4&&-1<ij.indexOf(r)){for(;m!==null;){var x=In(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=he(x.pendingLanes);if(w!==0){var N=x;for(N.pendingLanes|=2,N.entangledLanes|=2;w;){var H=1<<31-Ze(w);N.entanglements[1]|=H,w&=~H}ns(x),(xt&6)===0&&(Cu=qe()+500,So(0))}}break;case 31:case 13:N=qi(x,2),N!==null&&Qn(N,x,2),Tu(),op(x,2)}if(x=up(d),x===null&&Xh(r,i,d,Vu,o),x===m)break;m=x}m!==null&&d.stopPropagation()}else Xh(r,i,d,null,o)}}function up(r){return r=Aa(r),dp(r)}var Vu=null;function dp(r){if(Vu=null,r=ps(r),r!==null){var i=c(r);if(i===null)r=null;else{var o=i.tag;if(o===13){if(r=u(i),r!==null)return r;r=null}else if(o===31){if(r=f(i),r!==null)return r;r=null}else if(o===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Vu=r,null}function F1(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Or()){case ae:return 2;case ve:return 8;case W:case fe:return 32;case Te:return 268435456;default:return 32}default:return 32}}var fp=!1,xi=null,vi=null,bi=null,Ao=new Map,Mo=new Map,yi=[],ij="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function H1(r,i){switch(r){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":vi=null;break;case"mouseover":case"mouseout":bi=null;break;case"pointerover":case"pointerout":Ao.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mo.delete(i.pointerId)}}function Ro(r,i,o,d,m,x){return r===null||r.nativeEvent!==x?(r={blockedOn:i,domEventName:o,eventSystemFlags:d,nativeEvent:x,targetContainers:[m]},i!==null&&(i=In(i),i!==null&&$1(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,m!==null&&i.indexOf(m)===-1&&i.push(m),r)}function aj(r,i,o,d,m){switch(i){case"focusin":return xi=Ro(xi,r,i,o,d,m),!0;case"dragenter":return vi=Ro(vi,r,i,o,d,m),!0;case"mouseover":return bi=Ro(bi,r,i,o,d,m),!0;case"pointerover":var x=m.pointerId;return Ao.set(x,Ro(Ao.get(x)||null,r,i,o,d,m)),!0;case"gotpointercapture":return x=m.pointerId,Mo.set(x,Ro(Mo.get(x)||null,r,i,o,d,m)),!0}return!1}function I1(r){var i=ps(r.target);if(i!==null){var o=c(i);if(o!==null){if(i=o.tag,i===13){if(i=u(o),i!==null){r.blockedOn=i,Ul(r.priority,function(){U1(o)});return}}else if(i===31){if(i=f(o),i!==null){r.blockedOn=i,Ul(r.priority,function(){U1(o)});return}}else if(i===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Gu(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var o=up(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);Qs=d,o.target.dispatchEvent(d),Qs=null}else return i=In(o),i!==null&&$1(i),r.blockedOn=o,!1;i.shift()}return!0}function q1(r,i,o){Gu(r)&&o.delete(i)}function lj(){fp=!1,xi!==null&&Gu(xi)&&(xi=null),vi!==null&&Gu(vi)&&(vi=null),bi!==null&&Gu(bi)&&(bi=null),Ao.forEach(q1),Mo.forEach(q1)}function Yu(r,i){r.blockedOn===i&&(r.blockedOn=null,fp||(fp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,lj)))}var Wu=null;function V1(r){Wu!==r&&(Wu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Wu===r&&(Wu=null);for(var i=0;i<r.length;i+=3){var o=r[i],d=r[i+1],m=r[i+2];if(typeof d!="function"){if(dp(d||o)===null)continue;break}var x=In(o);x!==null&&(r.splice(i,3),i-=3,uh(x,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function ll(r){function i(H){return Yu(H,r)}xi!==null&&Yu(xi,r),vi!==null&&Yu(vi,r),bi!==null&&Yu(bi,r),Ao.forEach(i),Mo.forEach(i);for(var o=0;o<yi.length;o++){var d=yi[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<yi.length&&(o=yi[0],o.blockedOn===null);)I1(o),o.blockedOn===null&&yi.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],x=o[d+1],w=m[wn]||null;if(typeof x=="function")w||V1(o);else if(w){var N=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[wn]||null)N=w.formAction;else if(dp(m)!==null)continue}else N=w.action;typeof N=="function"?o[d+1]=N:(o.splice(d,3),d-=3),V1(o)}}}function G1(){function r(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function i(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),m!==null&&(m(),m=null)}}}function hp(r){this._internalRoot=r}Xu.prototype.render=hp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(s(409));var o=i.current,d=ur();B1(o,d,r,i,null,null)},Xu.prototype.unmount=hp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;B1(r.current,2,null,r,null,null),Tu(),i[rr]=null}};function Xu(r){this._internalRoot=r}Xu.prototype.unstable_scheduleHydration=function(r){if(r){var i=$l();r={blockedOn:null,target:r,priority:i};for(var o=0;o<yi.length&&i!==0&&i<yi[o].priority;o++);yi.splice(o,0,r),o===0&&I1(r)}};var Y1=t.version;if(Y1!=="19.2.7")throw Error(s(527,Y1,"19.2.7"));z.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(s(188)):(r=Object.keys(r).join(","),Error(s(268,r)));return r=p(i),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var oj={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qu.isDisabled&&Qu.supportsFiber)try{nt=Qu.inject(oj),vt=Qu}catch{}}return Lo.createRoot=function(r,i){if(!a(r))throw Error(s(299));var o=!1,d="",m=ev,x=tv,w=nv;return i!=null&&(i.unstable_strictMode===!0&&(o=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(m=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=D1(r,1,!1,null,null,o,d,null,m,x,w,G1),r[rr]=i.current,Wh(r),new hp(i)},Lo.hydrateRoot=function(r,i,o){if(!a(r))throw Error(s(299));var d=!1,m="",x=ev,w=tv,N=nv,H=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(N=o.onRecoverableError),o.formState!==void 0&&(H=o.formState)),i=D1(r,1,!0,i,o??null,d,m,H,x,w,N,G1),i.context=O1(null),o=i.current,d=ur(),d=Dn(d),m=ii(d),m.callback=null,ai(o,m,d),o=d,i.current.lanes=o,Ot(i,o),ns(i),r[rr]=i.current,Wh(r),new Xu(i)},Lo.version="19.2.7",Lo}var ib;function _j(){if(ib)return gp.exports;ib=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(),gp.exports=yj(),gp.exports}var wj=_j();const ab=e=>{let t;const n=new Set,s=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const y=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(b=>b(t,y))}},a=()=>t,f={setState:s,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(s,a,f);return f},Sj=(e=>e?ab(e):ab),kj=e=>e;function jj(e,t=kj){const n=Ku.useSyncExternalStore(e.subscribe,Ku.useCallback(()=>t(e.getState()),[e,t]),Ku.useCallback(()=>t(e.getInitialState()),[e,t]));return Ku.useDebugValue(n),n}const lb=e=>{const t=Sj(e),n=s=>jj(t,s);return Object.assign(n,t),n},Nj=(e=>e?lb(e):lb),bm="companion_auth_token";function ob(){return typeof window>"u"?null:localStorage.getItem(bm)||null}const Cj=e=>({authToken:ob(),isAuthenticated:ob()!==null,setAuthToken:t=>{localStorage.setItem(bm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(bm),e({authToken:null,isAuthenticated:!1})}});function qt(e,t){if(!e.has(t))return e;const n=new Map(e);return n.delete(t),n}function Ej(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function Tj(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function Aj(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function Mj(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const Rj=e=>({sessions:new Map,sdkSessions:[],currentSessionId:Aj(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:Tj(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,collapsedProjects:Mj(),setCurrentSession:t=>{t?localStorage.setItem("cc-current-session",t):localStorage.removeItem("cc-current-session"),e({currentSessionId:t})},addSession:t=>e(n=>{const s=new Map(n.sessions);s.set(t.session_id,t);const a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:s,messages:a}}),updateSession:(t,n)=>e(s=>{const a=new Map(s.sessions),c=a.get(t);return c&&a.set(t,{...c,...n}),{sessions:a}}),removeSession:t=>e(n=>{const s=qt(n.sessionNames,t);return localStorage.setItem("cc-session-names",JSON.stringify(Array.from(s.entries()))),n.currentSessionId===t&&localStorage.removeItem("cc-current-session"),{sessions:qt(n.sessions,t),connectionStatus:qt(n.connectionStatus,t),cliConnected:qt(n.cliConnected,t),cliReconnecting:qt(n.cliReconnecting,t),sessionStatus:qt(n.sessionStatus,t),previousPermissionMode:qt(n.previousPermissionMode,t),sessionNames:s,recentlyRenamed:Ej(n.recentlyRenamed,t),mcpServers:qt(n.mcpServers,t),prStatus:qt(n.prStatus,t),linkedLinearIssues:qt(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.sessionId!==t),currentSessionId:n.currentSessionId===t?null:n.currentSessionId,messages:qt(n.messages,t),streaming:qt(n.streaming,t),streamingStartedAt:qt(n.streamingStartedAt,t),streamingOutputTokens:qt(n.streamingOutputTokens,t),pendingPermissions:qt(n.pendingPermissions,t),aiResolvedPermissions:qt(n.aiResolvedPermissions,t),sessionTasks:qt(n.sessionTasks,t),changedFilesTick:qt(n.changedFilesTick,t),gitChangedFilesCount:qt(n.gitChangedFilesCount,t),sessionProcesses:qt(n.sessionProcesses,t),toolProgress:qt(n.toolProgress,t),toolActivity:qt(n.toolActivity,t),diffPanelSelectedFile:qt(n.diffPanelSelectedFile,t),chatTabReentryTickBySession:qt(n.chatTabReentryTickBySession,t)}}),setSdkSessions:t=>e({sdkSessions:t}),setConnectionStatus:(t,n)=>e(s=>{const a=new Map(s.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(s=>{const a=new Map(s.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(s=>{const a=new Map(s.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(s=>{const a=new Map(s.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(s=>{const a=new Map(s.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(s=>{const a=new Map(s.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),markRecentlyRenamed:t=>e(n=>{const s=new Set(n.recentlyRenamed);return s.add(t),{recentlyRenamed:s}}),clearRecentlyRenamed:t=>e(n=>{const s=new Set(n.recentlyRenamed);return s.delete(t),{recentlyRenamed:s}}),setPRStatus:(t,n)=>e(s=>{const a=new Map(s.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(s=>{const a=new Map(s.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(s=>{const a=new Map(s.mcpServers);return a.set(t,n),{mcpServers:a}}),toggleProjectCollapse:t=>e(n=>{const s=new Set(n.collapsedProjects);return s.has(t)?s.delete(t):s.add(t),localStorage.setItem("cc-collapsed-projects",JSON.stringify(Array.from(s))),{collapsedProjects:s}}),setSessionAiValidation:(t,n)=>e(s=>{const a=new Map(s.sessions),c=a.get(t);return c?(a.set(t,{...c,...n}),{sessions:a}):{}})}),zj=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(s=>{const a=s.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return s;const c=new Map(s.messages);return c.set(t,[...a,n]),{messages:c}}),setMessages:(t,n)=>e(s=>{const a=new Map(s.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(s=>{const a=new Map(s.messages),c=[...a.get(t)||[]];for(let u=c.length-1;u>=0;u--)if(c[u].role==="assistant"){c[u]=n(c[u]);break}return a.set(t,c),{messages:a}}),setStreaming:(t,n)=>e(s=>{const a=new Map(s.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(s=>{const a=new Map(s.streamingStartedAt),c=new Map(s.streamingOutputTokens);return n===null?(a.delete(t),c.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&c.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:c}}),setLastActivity:(t,n)=>e(s=>{const a=new Map(s.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(s=>{const a=new Map(s.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const s=new Map(n.promptSuggestions);return s.delete(t),{promptSuggestions:s}})}),Lj=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(s=>{const a=new Map(s.pendingPermissions),c=new Map(a.get(t)||[]);return c.set(n.request_id,n),a.set(t,c),{pendingPermissions:a}}),removePermission:(t,n)=>e(s=>{const a=new Map(s.pendingPermissions),c=a.get(t);if(c){const u=new Map(c);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(s=>{const a=new Map(s.aiResolvedPermissions),c=[...a.get(t)||[],n];return c.length>50&&c.splice(0,c.length-50),a.set(t,c),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const s=new Map(n.aiResolvedPermissions);return s.delete(t),{aiResolvedPermissions:s}})}),Dj=e=>({sessionTasks:new Map,sessionProcesses:new Map,sessionBackgroundAgents:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,toolProgress:new Map,toolActivity:new Map,addTask:(t,n)=>e(s=>{const a=new Map(s.sessionTasks),c=[...a.get(t)||[],n];return a.set(t,c),{sessionTasks:a}}),setTasks:(t,n)=>e(s=>{const a=new Map(s.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,s)=>e(a=>{const c=new Map(a.sessionTasks),u=c.get(t);return u&&c.set(t,u.map(f=>f.id===n?{...f,...s}:f)),{sessionTasks:c}}),addProcess:(t,n)=>e(s=>{const a=new Map(s.sessionProcesses),c=[...a.get(t)||[],n];return a.set(t,c),{sessionProcesses:a}}),updateProcess:(t,n,s)=>e(a=>{const c=new Map(a.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.taskId===n?{...f,...s}:f)),{sessionProcesses:c}}),updateProcessByToolUseId:(t,n,s)=>e(a=>{const c=new Map(a.sessionProcesses),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{sessionProcesses:c}}),addBackgroundAgent:(t,n)=>e(s=>{const a=new Map(s.sessionBackgroundAgents),c=[...a.get(t)||[],n];return a.set(t,c),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,s)=>e(a=>{const c=new Map(a.sessionBackgroundAgents),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{sessionBackgroundAgents:c}}),bumpChangedFilesTick:t=>e(n=>{const s=new Map(n.changedFilesTick);return s.set(t,(s.get(t)??0)+1),{changedFilesTick:s}}),setGitChangedFilesCount:(t,n)=>e(s=>{const a=new Map(s.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,s)=>e(a=>{const c=new Map(a.toolProgress),u=new Map(c.get(t)||[]);return u.set(n,s),c.set(t,u),{toolProgress:c}}),clearToolProgress:(t,n)=>e(s=>{const a=new Map(s.toolProgress);if(n){const c=a.get(t);if(c){const u=new Map(c);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(s=>{const a=new Map(s.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(s=>{const a=new Map(s.toolActivity),c=[...a.get(t)||[]],u=c.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=c[u];c[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else c.push(n);return a.set(t,c),{toolActivity:a}}),updateToolActivity:(t,n,s)=>e(a=>{const c=new Map(a.toolActivity),u=c.get(t);return u&&c.set(t,u.map(f=>f.toolUseId===n?{...f,...s}:f)),{toolActivity:c}})}),qs=[{id:"usage-limits",label:"Usage Limits",description:"API usage and rate limit meters",backends:null},{id:"server-memory",label:"Server Memory",description:"Host memory usage meter (out-of-memory awareness)",backends:null},{id:"git-branch",label:"Git Branch",description:"Current branch, ahead/behind, and line changes",backends:null},{id:"github-pr",label:"GitHub PR",description:"Pull request status, CI checks, and reviews",backends:null},{id:"linear-issue",label:"Linear Issue",description:"Linked Linear ticket and comments",backends:null},{id:"mcp-servers",label:"MCP Servers",description:"Model Context Protocol server connections",backends:null},{id:"tasks",label:"Tasks",description:"Agent task list and progress",backends:["claude"]}],Oj=qs.map(e=>e.id),Q_="cc-task-panel-config";function ym(){return{order:[...Oj],enabled:Object.fromEntries(qs.map(e=>[e.id,!0]))}}function Bj(){if(typeof window>"u")return ym();try{const e=localStorage.getItem(Q_);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of qs)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const s=new Set(qs.map(a=>a.id));return t.order=t.order.filter(a=>s.has(a)),t}}catch{}return ym()}function Zu(e){try{localStorage.setItem(Q_,JSON.stringify(e))}catch{}}function Pj(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-dark-mode");return e!==null?e==="true":window.matchMedia("(prefers-color-scheme: dark)").matches}function $j(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function Uj(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function K_(){if(typeof window>"u")return"last-commit";const e=window.localStorage.getItem("cc-diff-base");return e==="last-commit"||e==="default-branch"?e:"last-commit"}const Fj=e=>({darkMode:Pj(),notificationSound:$j(),notificationDesktop:Uj(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:Bj(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:K_(),setDarkMode:t=>{localStorage.setItem("cc-dark-mode",String(t)),e({darkMode:t})},toggleDarkMode:()=>e(t=>{const n=!t.darkMode;return localStorage.setItem("cc-dark-mode",String(n)),{darkMode:n}}),setNotificationSound:t=>{localStorage.setItem("cc-notification-sound",String(t)),e({notificationSound:t})},toggleNotificationSound:()=>e(t=>{const n=!t.notificationSound;return localStorage.setItem("cc-notification-sound",String(n)),{notificationSound:n}}),setNotificationDesktop:t=>{localStorage.setItem("cc-notification-desktop",String(t)),e({notificationDesktop:t})},toggleNotificationDesktop:()=>e(t=>{const n=!t.notificationDesktop;return localStorage.setItem("cc-notification-desktop",String(n)),{notificationDesktop:n}}),setPublicUrl:t=>e({publicUrl:t}),setSidebarOpen:t=>e({sidebarOpen:t}),setTaskPanelOpen:t=>e({taskPanelOpen:t}),setTaskPanelConfigMode:t=>e({taskPanelConfigMode:t}),toggleSectionEnabled:t=>e(n=>{const s={order:[...n.taskPanelConfig.order],enabled:{...n.taskPanelConfig.enabled,[t]:!n.taskPanelConfig.enabled[t]}};return Zu(s),{taskPanelConfig:s}}),moveSectionUp:t=>e(n=>{const s=[...n.taskPanelConfig.order],a=s.indexOf(t);if(a<=0)return n;[s[a-1],s[a]]=[s[a],s[a-1]];const c={...n.taskPanelConfig,order:s};return Zu(c),{taskPanelConfig:c}}),moveSectionDown:t=>e(n=>{const s=[...n.taskPanelConfig.order],a=s.indexOf(t);if(a<0||a>=s.length-1)return n;[s[a],s[a+1]]=[s[a+1],s[a]];const c={...n.taskPanelConfig,order:s};return Zu(c),{taskPanelConfig:c}}),resetTaskPanelConfig:()=>{const t=ym();Zu(t),e({taskPanelConfig:t})},newSession:()=>{localStorage.removeItem("cc-current-session"),e(t=>({currentSessionId:null,homeResetKey:t.homeResetKey+1}))},setActiveTab:t=>e({activeTab:t}),markChatTabReentry:t=>e(n=>{const s=new Map(n.chatTabReentryTickBySession),a=(s.get(t)??0)+1;return s.set(t,a),{chatTabReentryTickBySession:s}}),setDiffPanelSelectedFile:(t,n)=>e(s=>{const a=new Map(s.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function Z_(){if(typeof window>"u")return"bottom";const e=window.localStorage.getItem("cc-terminal-placement");return e==="top"||e==="right"||e==="bottom"||e==="left"?e:"bottom"}const Hj=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:Z_(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null,setQuickTerminalOpen:t=>e({quickTerminalOpen:t}),openQuickTerminal:t=>e(n=>{if(t.reuseIfExists){const p=n.quickTerminalTabs.find(g=>g.cwd===t.cwd&&g.containerId===t.containerId);if(p)return{quickTerminalOpen:!0,activeQuickTerminalTabId:p.id}}const s=t.target==="docker",a=n.quickTerminalNextHostIndex,c=n.quickTerminalNextDockerIndex,u=s?a:a+1,f=s?c+1:c,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:s?`Docker ${c}`:a===1?"Terminal":`Terminal ${a}`,cwd:t.cwd,containerId:t.containerId};return{quickTerminalOpen:!0,quickTerminalTabs:[...n.quickTerminalTabs,h],activeQuickTerminalTabId:h.id,quickTerminalNextHostIndex:u,quickTerminalNextDockerIndex:f}}),closeQuickTerminalTab:t=>e(n=>{var c;const s=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((c=s[0])==null?void 0:c.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:s,activeQuickTerminalTabId:a,quickTerminalOpen:s.length>0?n.quickTerminalOpen:!1}}),setActiveQuickTerminalTabId:t=>e({activeQuickTerminalTabId:t}),resetQuickTerminal:()=>e({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1}),setTerminalOpen:t=>e({terminalOpen:t}),setTerminalCwd:t=>e({terminalCwd:t}),setTerminalId:t=>e({terminalId:t}),openTerminal:t=>e({terminalOpen:!0,terminalCwd:t}),closeTerminal:()=>e({terminalOpen:!1,terminalCwd:null,terminalId:null})});function Ij(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const qj=e=>({updateInfo:null,updateDismissedVersion:Ij(),updateOverlayActive:!1,dockerUpdateDialogOpen:!1,creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null,claudeCompatInfo:null,setUpdateInfo:t=>e({updateInfo:t}),dismissUpdate:t=>{localStorage.setItem("cc-update-dismissed",t),e({updateDismissedVersion:t})},setUpdateOverlayActive:t=>e({updateOverlayActive:t}),setDockerUpdateDialogOpen:t=>e({dockerUpdateDialogOpen:t}),addCreationProgress:t=>e(n=>{const s=n.creationProgress||[],a=s.findIndex(c=>c.step===t.step);if(a>=0){const c=[...s];return c[a]=t,{creationProgress:c}}return{creationProgress:[...s,t]}}),clearCreation:()=>e({creationProgress:null,creationError:null,sessionCreating:!1,sessionCreatingBackend:null}),setSessionCreating:(t,n)=>e({sessionCreating:t,sessionCreatingBackend:n??null}),setCreationError:t=>e({creationError:t}),setClaudeCompatInfo:t=>e({claudeCompatInfo:t})}),X=Nj((...e)=>({...Cj(...e),...Rj(...e),...zj(...e),...Lj(...e),...Dj(...e),...Fj(...e),...Hj(...e),...qj(...e),reset:()=>{const[t]=e;t({sessions:new Map,sdkSessions:[],currentSessionId:null,connectionStatus:new Map,cliConnected:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:new Map,recentlyRenamed:new Set,mcpServers:new Map,prStatus:new Map,linkedLinearIssues:new Map,messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,pendingPermissions:new Map,aiResolvedPermissions:new Map,sessionTasks:new Map,changedFilesTick:new Map,gitChangedFilesCount:new Map,sessionProcesses:new Map,toolProgress:new Map,toolActivity:new Map,taskPanelConfigMode:!1,activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:K_(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:Z_(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),Vj=Object.freeze(Object.defineProperty({__proto__:null,useStore:X},Symbol.toStringTag,{value:"Module"})),Gj="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",Yj=/invalid authentication credentials|authentication_failed|\b40[13]\s+(?:unauthorized|forbidden)\b|(?:unauthorized|forbidden)[^\n]{0,12}\b40[13]\b|please run\s+`?\/?login|claude login|credentials?\s+(?:expired|invalid|revoked)|oauth token|token\s+(?:expired|revoked)/i;function Wj(e){return Yj.test(e)}function Xj(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:Wj(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const cb=["Swift","Calm","Bold","Bright","Warm","Keen","Vast","Crisp","Agile","Noble","Vivid","Lucid","Brisk","Deft","Fleet","Grand","Lush","Prime","Sage","True","Clear","Deep","Fair","Firm","Glad","Kind","Pure","Rich","Safe","Wise","Fresh","Sharp","Steady","Quick","Gentle","Silent","Golden","Radiant","Serene","Verdant"],ub=["Falcon","River","Cedar","Stone","Ember","Frost","Bloom","Ridge","Crane","Birch","Coral","Dawn","Flint","Grove","Heron","Lark","Maple","Opal","Pearl","Quartz","Reef","Sage","Tide","Vale","Wren","Aspen","Brook","Cliff","Delta","Eagle","Fern","Harbor","Iris","Jade","Lotus","Mesa","Nova","Orbit","Pebble","Summit"];function db(){const e=cb[Math.floor(Math.random()*cb.length)],t=ub[Math.floor(Math.random()*ub.length)];return`${e} ${t}`}function J_(e){for(let t=0;t<100;t++){const n=db();if(!e.has(n))return n}return db()}let yp=null;function Qj(){return yp||(yp=new AudioContext),yp}function Kj(){try{const e=Qj();e.state==="suspended"&&e.resume();const t=e.currentTime,n=e.createOscillator(),s=e.createGain();n.type="sine",n.frequency.setValueAtTime(659.25,t),s.gain.setValueAtTime(.3,t),s.gain.exponentialRampToValueAtTime(.001,t+.3),n.connect(s),s.connect(e.destination),n.start(t),n.stop(t+.3);const a=e.createOscillator(),c=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),c.gain.setValueAtTime(.001,t),c.gain.setValueAtTime(.3,t+.15),c.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(c),c.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class e5{diff(t,n,s={}){let a;typeof s=="function"?(a=s,s={}):"callback"in s&&(a=s.callback);const c=this.castInput(t,s),u=this.castInput(n,s),f=this.removeEmpty(this.tokenize(c,s)),h=this.removeEmpty(this.tokenize(u,s));return this.diffWithOptionsObj(f,h,s,a)}diffWithOptionsObj(t,n,s,a){var c;const u=A=>{if(A=this.postProcess(A,s),a){setTimeout(function(){a(A)},0);return}else return A},f=n.length,h=t.length;let p=1,g=f+h;s.maxEditLength!=null&&(g=Math.min(g,s.maxEditLength));const v=(c=s.timeout)!==null&&c!==void 0?c:1/0,y=Date.now()+v,b=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(b[0],n,t,0,s);if(b[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(b[0].lastComponent,n,t));let j=-1/0,E=1/0;const k=()=>{for(let A=Math.max(j,-p);A<=Math.min(E,p);A+=2){let C;const L=b[A-1],B=b[A+1];L&&(b[A-1]=void 0);let D=!1;if(B){const F=B.oldPos-A;D=B&&0<=F&&F<f}const U=L&&L.oldPos+1<h;if(!D&&!U){b[A]=void 0;continue}if(!U||D&&L.oldPos<B.oldPos?C=this.addToPath(B,!0,!1,0,s):C=this.addToPath(L,!1,!0,1,s),_=this.extractCommon(C,n,t,A,s),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;b[A]=C,C.oldPos+1>=h&&(E=Math.min(E,A-1)),_+1>=f&&(j=Math.max(j,A+1))}p++};if(a)(function A(){setTimeout(function(){if(p>g||Date.now()>y)return a(void 0);k()||A()},0)})();else for(;p<=g&&Date.now()<=y;){const A=k();if(A)return A}}addToPath(t,n,s,a,c){const u=t.lastComponent;return u&&!c.oneChangePerToken&&u.added===n&&u.removed===s?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:s,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:s,previousComponent:u}}}extractCommon(t,n,s,a,c){const u=n.length,f=s.length;let h=t.oldPos,p=h-a,g=0;for(;p+1<u&&h+1<f&&this.equals(s[h+1],n[p+1],c);)p++,h++,g++,c.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!c.oneChangePerToken&&(t.lastComponent={count:g,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,p}equals(t,n,s){return s.comparator?s.comparator(t,n):t===n||!!s.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let s=0;s<t.length;s++)t[s]&&n.push(t[s]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,s){const a=[];let c;for(;t;)a.push(t),c=t.previousComponent,delete t.previousComponent,t=c;a.reverse();const u=a.length;let f=0,h=0,p=0;for(;f<u;f++){const g=a[f];if(g.removed)g.value=this.join(s.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let v=n.slice(h,h+g.count);v=v.map(function(y,b){const _=s[p+b];return _.length>y.length?_:y}),g.value=this.join(v)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return a}}function fb(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function hb(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return"";for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function _m(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function wm(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Do(e,t){return _m(e,t,"")}function Ju(e,t){return wm(e,t,"")}function pb(e,t){return t.slice(0,Zj(e,t))}function Zj(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let s=t.length;e.length<t.length&&(s=e.length);const a=Array(s);let c=0;a[0]=0;for(let u=1;u<s;u++){for(t[u]==t[c]?a[u]=a[c]:a[u]=c;c>0&&t[u]!=t[c];)c=a[c];t[u]==t[c]&&c++}c=0;for(let u=n;u<e.length;u++){for(;c>0&&e[u]!=t[c];)c=a[c];e[u]==t[c]&&c++}return c}function t5(e,t){const n=[];for(const s of Array.from(t.segment(e))){const a=s.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function Sm(e,t){if(t)return rc(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function gl(e,t){if(t)return rc(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function rc(e,t){if(!t)return[gl(e),Sm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=t5(e,t),s=n[0],a=n[n.length-1],c=/\s/.test(s)?s:"",u=/\s/.test(a)?a:"";return[c,u]}const mb="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Jj=new RegExp(`[${mb}]+|\\s+|[^${mb}]`,"ug");class eN extends e5{equals(t,n,s){return s.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase()),t.trim()===n.trim()}tokenize(t,n={}){let s;if(n.intlSegmenter){const u=n.intlSegmenter;if(u.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');s=t5(t,u)}else s=t.match(Jj)||[];const a=[];let c=null;return s.forEach(u=>{/\s/.test(u)?c==null?a.push(u):a.push(a.pop()+u):c!=null&&/\s/.test(c)?a[a.length-1]==c?a.push(a.pop()+u):a.push(c+u):a.push(u),c=u}),a}join(t){return t.map((n,s)=>s==0?n:n.replace(/^\s+/,"")).join("")}postProcess(t,n){if(!t||n.oneChangePerToken)return t;let s=null,a=null,c=null;return t.forEach(u=>{u.added?a=u:u.removed?c=u:((a||c)&&gb(s,c,a,u,n.intlSegmenter),s=u,a=null,c=null)}),(a||c)&&gb(s,c,a,null,n.intlSegmenter),t}}const tN=new eN;function nN(e,t,n){return tN.diff(e,t,n)}function gb(e,t,n,s,a){if(t&&n){const[c,u]=rc(t.value,a),[f,h]=rc(n.value,a);if(e){const p=fb(c,f);e.value=wm(e.value,f,p),t.value=Do(t.value,p),n.value=Do(n.value,p)}if(s){const p=hb(u,h);s.value=_m(s.value,h,p),t.value=Ju(t.value,p),n.value=Ju(n.value,p)}}else if(n){if(e){const c=gl(n.value,a);n.value=n.value.substring(c.length)}if(s){const c=gl(s.value,a);s.value=s.value.substring(c.length)}}else if(e&&s){const c=gl(s.value,a),[u,f]=rc(t.value,a),h=fb(c,u);t.value=Do(t.value,h);const p=hb(Do(c,h),f);t.value=Ju(t.value,p),s.value=_m(s.value,c,p),e.value=wm(e.value,c,c.slice(0,c.length-p.length))}else if(s){const c=gl(s.value,a),u=Sm(t.value,a),f=pb(u,c);t.value=Ju(t.value,f)}else if(e){const c=Sm(e.value,a),u=gl(t.value,a),f=pb(c,u);t.value=Do(t.value,f)}}class rN extends e5{constructor(){super(...arguments),this.tokenize=iN}equals(t,n,s){return s.ignoreWhitespace?((!s.newlineIsToken||!t.includes(`
|
|
50
50
|
`))&&(t=t.trim()),(!s.newlineIsToken||!n.includes(`
|
|
51
51
|
`))&&(n=n.trim())):s.ignoreNewlineAtEof&&!s.newlineIsToken&&(t.endsWith(`
|
|
52
52
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
@@ -60,14 +60,14 @@ Error generating stack: `+d.message+`
|
|
|
60
60
|
`).length,b=y>15;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),s&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:s}),f&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),u?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${b&&!h?"max-h-[240px]":""}`,children:l.jsx(Ll,{oldText:a,newText:c,mode:"compact"})}),b&&!h&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),b&&l.jsx("button",{type:"button",onClick:()=>p(!h),className:"relative z-10 mt-1 text-[11px] text-cc-muted/40 hover:text-cc-muted/70 cursor-pointer transition-colors",children:h?"Show less":`Show all ${y} lines`})]}):v.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:v.map((_,j)=>{const E=_.path.split("/").pop()||_.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`text-[9px] font-semibold uppercase ${_.kind==="create"?"text-emerald-600/70 dark:text-emerald-400/70":_.kind==="delete"?"text-cc-error/70":"text-amber-600/70 dark:text-amber-400/70"}`,children:_.kind}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:E})]},`${_.path}-${j}`)})}):l.jsx("pre",{className:"mt-1 text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed",children:JSON.stringify(e,null,2)})]})}function mN({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",s=typeof e.description=="string"?e.description:"";return l.jsxs("div",{"data-tool-use-id":t,children:[s&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:s}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function gN({name:e,input:t}){switch(e){case"Bash":return l.jsx(xN,{input:t});case"Edit":return l.jsx(vN,{input:t});case"Write":return l.jsx(bN,{input:t});case"Read":return l.jsx(yN,{input:t});case"Glob":return l.jsx(_N,{input:t});case"Grep":return l.jsx(wN,{input:t});case"WebSearch":case"web_search":return l.jsx(SN,{input:t});case"WebFetch":return l.jsx(kN,{input:t});case"Task":return l.jsx(jN,{input:t});case"TodoWrite":return l.jsx(NN,{input:t});case"NotebookEdit":return l.jsx(CN,{input:t});case"SendMessage":return l.jsx(EN,{input:t});default:return l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(t,null,2)})}}function xN({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),l.jsxs("pre",{className:"px-3 py-2 rounded-lg bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code leading-relaxed overflow-x-auto",children:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function vN({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),s=String(e.new_string||""),c=(Array.isArray(e.changes)?e.changes:[]).map(u=>({path:typeof u.path=="string"?u.path:"",kind:typeof u.kind=="string"?u.kind:"update"})).filter(u=>u.path);return l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-warning/10 text-cc-warning",children:"replace all"}),n||s?l.jsx(Ll,{oldText:n,newText:s,fileName:t,mode:"compact"}):c.length>0?l.jsxs("div",{className:"space-y-1.5",children:[!!t&&l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),c.map((u,f)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary min-w-[54px] text-center",children:u.kind}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})]})}function bN({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Ll,{newText:n,fileName:t,mode:"compact"})}function yN({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,s=e.limit;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||s!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),s!=null&&l.jsxs("span",{children:["limit: ",s]})]})]})}function _N({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function wN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[12px] font-mono-code overflow-x-auto",children:String(e.pattern||"")}),l.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&l.jsxs("span",{children:["path: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&l.jsxs("span",{children:["glob: ",l.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&l.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&l.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&l.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function SN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function kN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.url&&l.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&l.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function jN({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&l.jsx("span",{className:"inline-block text-[10px] font-medium px-1.5 py-0.5 rounded bg-cc-primary/10 text-cc-primary",children:String(e.subagent_type)}),!!e.prompt&&l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-40 overflow-y-auto",children:String(e.prompt)})]})}function NN({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,s)=>{const a=n.status||"pending";return l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("span",{className:"shrink-0 mt-0.5",children:a==="completed"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm3.354-9.354a.5.5 0 00-.708-.708L7 8.586 5.354 6.94a.5.5 0 10-.708.708l2 2a.5.5 0 00.708 0l4-4z",clipRule:"evenodd"})}):a==="in_progress"?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug ${a==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},s)})}):l.jsx("pre",{className:"text-[11px] text-cc-muted font-mono-code whitespace-pre-wrap leading-relaxed max-h-60 overflow-y-auto",children:JSON.stringify(e,null,2)})}function CN({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,s=e.edit_mode;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&l.jsxs("span",{children:["type: ",n]}),s&&l.jsxs("span",{children:["mode: ",s]}),e.cell_number!=null&&l.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&l.jsx("pre",{className:"px-2 py-1.5 rounded bg-cc-code-bg text-cc-code-fg text-[11px] font-mono-code leading-relaxed max-h-40 overflow-y-auto",children:String(e.new_source)})]})}function EN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&l.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",l.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&l.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function mc(e,t){if(e==="Bash"&&typeof t.command=="string")return t.description&&typeof t.description=="string"&&t.description.length<=60?t.description:t.command.length>60?t.command.slice(0,60)+"...":t.command;if((e==="Read"||e==="Write"||e==="Edit")&&t.file_path)return String(t.file_path).split("/").slice(-2).join("/");if(e==="Edit"&&Array.isArray(t.changes)&&t.changes.length>0){const n=t.changes[0];if(n!=null&&n.path)return String(n.path).split("/").slice(-2).join("/")}if(e==="Glob"&&t.pattern)return String(t.pattern);if(e==="Grep"&&t.pattern){const n=String(t.pattern),s=t.path?` in ${String(t.path).split("/").slice(-2).join("/")}`:"",a=n+s;return a.length>60?a.slice(0,60)+"...":a}if((e==="WebSearch"||e==="web_search")&&t.query)return String(t.query);if(e==="WebFetch"&&t.url)try{const n=new URL(String(t.url));return n.hostname+n.pathname}catch{return String(t.url).slice(0,60)}return e==="Task"&&t.description?String(t.description):e==="TodoWrite"&&Array.isArray(t.todos)?`${t.todos.length} task${t.todos.length!==1?"s":""}`:e==="NotebookEdit"&&t.notebook_path?String(t.notebook_path).split("/").pop()||"":e==="SendMessage"&&t.recipient?`→ ${String(t.recipient)}`:""}function jl({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("polyline",{points:"3 11 6 8 3 5"}),l.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"7",cy:"7",r:"4"}),l.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M2 8h12M8 2c2 2 3 4 3 6s-1 4-3 6c-2-2-3-4-3-6s1-4 3-6z"})]}):e==="message"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"5",r:"3"}),l.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),l.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const TN=2e3,AN=new Set(["assistant","stream_event","result","tool_progress","tool_use_summary","status_change","system_event","permission_request","permission_auto_resolved","streamlined_text","streamlined_tool_use_summary"]),Vr=new Map,Is=new Map,Ed=new Map,vd=new Map,ki=new Map,sc=new Map,gc=new Map,Td=new Map;function s5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function i5(e){const t=X.getState(),n=t.sdkSessions.find(s=>s.sessionId===e);return n?!n.archived:t.currentSessionId===e}function MN(){const e=X.getState(),t=new Set;for(const n of e.sdkSessions)n.archived||t.add(n.sessionId);return e.currentSessionId&&t.add(e.currentSessionId),Array.from(t)}let xc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){xc=!0;for(const[e,t]of Is)clearTimeout(t),Is.delete(e)}else{xc=!1;for(const e of MN()){if(!i5(e))continue;const t=Vr.get(e);if(!s5(t)){if(t){try{t.close()}catch{}Vr.delete(e)}Tc(e)}}}});function bd(e){const t=e.startsWith("/"),n=e.split("/"),s=[];for(const a of n)if(!(!a||a===".")){if(a===".."){s.length>0&&s.pop();continue}s.push(a)}return`${t?"/":""}${s.join("/")}`}function RN(e,t){return e.startsWith("/")||!t?bd(e):bd(`${t}/${e}`)}function zN(e,t){if(!t)return!0;const n=bd(t);return e===n||e.startsWith(`${n}/`)}function LN(e){let t=Td.get(e);return t||(t=new Set,Td.set(e,t)),t}function _p(e,t){const n=X.getState(),s=LN(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:c,input:u,id:f}=a;if(f){if(s.has(f))continue;s.add(f)}if(c==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((g,v)=>({id:String(v+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),vd.set(e,p.length)}continue}if(c==="TaskCreate"){const h=(vd.get(e)||0)+1;vd.set(e,h);const p={id:String(h),subject:u.subject||"Task",description:u.description||"",activeForm:u.activeForm,status:"pending"};n.addTask(e,p);continue}if(c==="TaskUpdate"){const h=u.taskId;if(h){const p={};u.status&&(p.status=u.status),u.owner&&(p.owner=u.owner),u.activeForm!==void 0&&(p.activeForm=u.activeForm),u.addBlockedBy&&(p.blockedBy=u.addBlockedBy),n.updateTask(e,h,p)}}}}function wp(e,t){var c,u;const n=X.getState(),s=((c=n.sessions.get(e))==null?void 0:c.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let a=!1;for(const f of t){if(f.type!=="tool_use")continue;const{name:h,input:p}=f;if((h==="Edit"||h==="Write")&&typeof p.file_path=="string"){const g=RN(p.file_path,s);zN(g,s)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const Qo=new Map,DN=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function Sp(e,t){const n=X.getState();for(const s of t){if(s.type==="tool_use"&&s.name==="Bash"){const a=s.input;if(a.run_in_background===!0){let c=Qo.get(e);c||(c=new Map,Qo.set(e,c)),c.set(s.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(s.type==="tool_result"){const a=s.tool_use_id,c=Qo.get(e),u=c==null?void 0:c.get(a);if(c&&u){const h=(typeof s.content=="string"?s.content:Array.isArray(s.content)?s.content.map(p=>"text"in p?p.text:"").join(""):"").match(DN);if(h){const p={taskId:h[1],toolUseId:a,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}c.delete(a),c.size===0&&Qo.delete(e)}}}}const ed=new Map,Ad=new Map;function kp(e,t){const n=X.getState();let s=Ad.get(e);s||(s=new Set,Ad.set(e,s));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&s.has(a.id))continue;const c=a.input;if(c.run_in_background===!0){a.id&&s.add(a.id);let u=ed.get(e);u||(u=new Map,ed.set(e,u));const f={toolUseId:a.id,name:c.name||c.description||"Background agent",description:c.description||"",agentType:c.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(a.type==="tool_result"){const c=a.tool_use_id,u=ed.get(e),f=u==null?void 0:u.get(c);if(u&&f){const h=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(g=>"text"in g?g.text:"").join(""):"",p=a.is_error===!0;n.updateBackgroundAgent(e,c,{status:p?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(c),u.size===0&&ed.delete(e)}}}}function vb(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function bb(e){if(e.subtype==="compact_boundary")return`Context compacted (${e.compact_metadata.trigger}, pre-tokens: ${e.compact_metadata.pre_tokens}).`;if(e.subtype==="task_notification"){const t=e.summary?` ${e.summary}`:"";return`Task ${e.status}: ${e.task_id}.${t}`}if(e.subtype==="files_persisted"){const t=e.files.length,n=e.failed.length;return n>0?`Persisted ${t} file(s), ${n} failed.`:`Persisted ${t} file(s).`}if(e.subtype==="hook_started")return`Hook started: ${e.hook_name} (${e.hook_event}).`;if(e.subtype==="hook_response"){const t=typeof e.exit_code=="number"?` (exit ${e.exit_code})`:"";return`Hook ${e.outcome}: ${e.hook_name} (${e.hook_event})${t}.`}return null}let ON=0,BN=0;function ss(){return`msg-${Date.now()}-${++ON}`}function yb(e){var n;const t=(n=e.errors)!=null&&n.length?e.errors.join(", "):e.result||(e.api_error_status?`API error ${e.api_error_status}`:"The turn ended with an error but no details were provided.");return Xj(e)?`${Gj}
|
|
61
61
|
|
|
62
62
|
Details: ${t}`:`Error: ${t}`}function PN(e,t){const n=gc.get(e)||[];n.push(t),gc.set(e,n)}function $N(e,t){const n=gc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){gc.delete(e);for(const s of n)t.send(JSON.stringify(s))}}const Ds=new Map;function _b(e,t,n){const s=X.getState(),a=s.messages.get(e)||[],c=sc.get(e);let u=a.filter(h=>!h.isStreaming||h.id===c),f=-1;if(c&&(f=u.findIndex(h=>h.id===c),f===-1&&sc.delete(e)),f===-1){const h=`stream-${e}-${ss()}`;sc.set(e,h),u=[...u,{id:h,role:"assistant",content:t,timestamp:Date.now(),isStreaming:!0,streamingPhase:n}]}else{u=[...u];const h=u[f];u[f]={...h,role:"assistant",content:t,isStreaming:!0,streamingPhase:n}}s.setMessages(e,u)}function wi(e){sc.delete(e);const t=X.getState(),n=t.messages.get(e)||[],s=n.filter(a=>!a.isStreaming);return s.length!==n.length?(t.setMessages(e,s),!0):!1}const wb=new Map,UN=8e3;function ol(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const s=Date.now(),a=wb.get(e);a&&a.code===t&&s-a.at<UN||(wb.set(e,{code:t,at:s}),X.getState().appendMessage(e,{id:`companion-notice-${t}-${s}`,role:"system",content:n.userText,timestamp:s,meta:!0,metaCode:t}))}function a5(){return`cmsg-${Date.now()}-${++BN}`}function km(){return a5()}const FN=new Set(["user_message","permission_response","interrupt","set_model","set_permission_mode","mcp_get_status","mcp_toggle","mcp_reconnect","mcp_set_servers","set_ai_validation"]);function HN(e){const t=location.protocol==="https:"?"wss:":"ws:",n=localStorage.getItem("companion_auth_token")||"";return`${t}//${location.host}/ws/browser/${e}?token=${encodeURIComponent(n)}`}function l5(e){return`companion:last-seq:${e}`}function jm(e){const t=Ed.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(l5(e)),s=n?Number(n):0,a=Number.isFinite(s)?Math.max(0,Math.floor(s)):0;return Ed.set(e,a),a}catch{return 0}}function Sb(e,t){const n=Math.max(0,Math.floor(t));Ed.set(e,n);try{localStorage.setItem(l5(e),String(n))}catch{}}function kb(e,t){Pn(e,{type:"session_ack",last_seq:t})}function yd(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
63
|
-
`)}function jp(e){return e.type==="thinking"?`thinking:${e.thinking}`:e.type==="text"?`text:${e.text}`:e.type==="tool_use"?`tool_use:${e.id}`:e.type==="tool_result"?`tool_result:${e.tool_use_id}`:JSON.stringify(e)}function IN(e,t){const n=e||[],s=t||[];if(n.length===0&&s.length===0)return;const a=new Map;for(const f of s)a.set(jp(f),f);const c=[],u=new Set;for(const f of n){const h=jp(f);u.has(h)||(u.add(h),c.push(a.get(h)||f))}for(const f of s){const h=jp(f);u.has(h)||(u.add(h),c.push(f))}return c}function jb(e,t,n,s,a){return{toolUseId:e,toolName:t,preview:mc(t,n),startedAt:s,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function Nm(e,t){const n=IN(e.contentBlocks,t.contentBlocks),s=n&&n.length>0?yd(n):t.content||e.content;return{...e,...t,content:s,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function qN(e,t){const n=X.getState(),s=n.messages.get(e)||[],a=s.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const c=[...s];c[a]=Nm(c[a],t),n.setMessages(e,c)}function VN(e,t){var a,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(a=t.data)==null?void 0:a.substring)==null?void 0:c.call(a,0,120));return}const s=X.getState();s.connectionStatus.get(e)==="connecting"&&s.setConnectionStatus(e,"connected"),o5(e,n)}function o5(e,t,n={}){var u,f,h,p,g,v;const{processSeq:s=!0,ackSeqMessage:a=!0}=n,c=X.getState();if(s&&typeof t.seq=="number"){const y=jm(e);if(t.seq<=y)return;Sb(e,t.seq),a&&kb(e,t.seq)}switch(AN.has(t.type)&&c.setLastActivity(e,Date.now()),t.type){case"session_init":{const y=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),y||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const b=new Set(c.sessionNames.values()),_=J_(b);c.setSessionName(e,_)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const y=t.message;if(y.model==="<synthetic>"){wi(e),c.setStreaming(e,null),ol(e,"synthetic_noop",{detail:{stopReason:y.stop_reason,text:yd(y.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const b=yd(y.content),_={id:y.id,role:"assistant",content:b,contentBlocks:y.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:y.model,stopReason:y.stop_reason};if(wi(e),qN(e,_),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),(u=y.content)!=null&&u.length)for(const j of y.content)j.type==="tool_result"&&c.clearToolProgress(e,j.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(f=y.content)!=null&&f.length)for(const j of y.content){if(j.type==="tool_use"){const E=j.input||{};c.addToolActivity(e,jb(j.id,j.name,E,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&c.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=y.content)!=null&&h.length&&(_p(e,y.content),wp(e,y.content),Sp(e,y.content),kp(e,y.content));break}case"stream_event":{const y=t.event;if(y&&typeof y=="object"){if(y.type==="message_start"&&(ki.delete(e),Ds.delete(e),wi(e),c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),y.type==="content_block_delta"){const b=y.delta;if((b==null?void 0:b.type)==="text_delta"&&typeof b.text=="string"){const _=Ds.get(e)||{thinking:"",text:""};ki.get(e)==="thinking"&&(_.thinking=""),_.text+=b.text,Ds.set(e,_),ki.set(e,"text"),c.setStreaming(e,_.text),_b(e,_.text,"text")}if((b==null?void 0:b.type)==="thinking_delta"&&typeof b.thinking=="string"){const _=Ds.get(e)||{thinking:"",text:""};_.thinking+=b.thinking,Ds.set(e,_),ki.set(e,"thinking"),c.setStreaming(e,_.thinking),_b(e,_.thinking,"thinking")}}if(y.type==="message_delta"){const b=y.usage;b!=null&&b.output_tokens&&c.setStreamingStats(e,{outputTokens:b.output_tokens})}}break}case"result":{Td.delete(e),Ad.delete(e);const y=t.data,b={total_cost_usd:y.total_cost_usd,num_turns:y.num_turns};if(typeof y.total_lines_added=="number"&&(b.total_lines_added=y.total_lines_added),typeof y.total_lines_removed=="number"&&(b.total_lines_removed=y.total_lines_removed),y.modelUsage){for(const _ of Object.values(y.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);b.context_used_percent=Math.max(0,Math.min(j,100))}}c.updateSession(e,b),wi(e),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&Kj(),!document.hasFocus()&&c.notificationDesktop&&vb("Session completed","Claude finished the task",e),y.is_error&&c.appendMessage(e,{id:ss(),role:"system",content:yb(y),timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const b=t.request;vb("Permission needed",`${b.tool_name}: approve or deny`,b.request_id)}const y=t.request;if(y.tool_name&&y.input){const b=[{type:"tool_use",id:y.tool_use_id,name:y.tool_name,input:y.input}];_p(e,b),wp(e,b),Sp(e,b),kp(e,b)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=c.sdkSessions.find(b=>b.sessionId===e))==null?void 0:p.backendType)==="codex"&&c.appendMessage(e,{id:ss(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||ss(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:b,status:_,summary:j}=t.event;b&&_&&c.updateProcess(e,b,{status:_,completedAt:Date.now(),summary:j||void 0})}const y=bb(t.event);if(!y)break;c.appendMessage(e,{id:ss(),role:"system",content:y,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:ss(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:ss(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const y=t.phase;y==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)?ol(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase},userText:"Response interrupted — the session ended before the reply finished. It will resume automatically."}):ol(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):y==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)&&ol(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):y==="starting"||y==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),y==="ready"?c.setSessionStatus(e,"idle"):y==="streaming"?c.setSessionStatus(e,"running"):y==="compacting"?c.setSessionStatus(e,"compacting"):y==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)?ol(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):ol(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const y=c.sessionNames.get(e),b=y&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(y);(!y||b)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"message_history":{const y=[],b=new Map;for(let j=0;j<t.messages.length;j++){const E=t.messages[j];if(E.type==="user_message")y.push({id:E.id||ss(),role:"user",content:E.content,timestamp:E.timestamp});else if(E.type==="assistant"){const k=E.message,A=yd(k.content),C={id:k.id,role:"assistant",content:A,contentBlocks:k.content,timestamp:E.timestamp||Date.now(),parentToolUseId:E.parent_tool_use_id,model:k.model,stopReason:k.stop_reason},L=y.findIndex(B=>B.role==="assistant"&&B.id===C.id);if(L===-1?y.push(C):y[L]=Nm(y[L],C),(v=k.content)!=null&&v.length){_p(e,k.content),wp(e,k.content),Sp(e,k.content),kp(e,k.content);const B=E.timestamp||Date.now();for(const D of k.content){if(D.type==="tool_use"){const U=D.input||{},F=b.get(D.id);b.set(D.id,F??jb(D.id,D.name,U,B,E.parent_tool_use_id))}if(D.type==="tool_result"){const U=b.get(D.tool_use_id);U&&b.set(D.tool_use_id,{...U,completedAt:B,isError:U.isError||!!D.is_error,elapsedSeconds:Math.max(U.elapsedSeconds,U.completedAt?U.elapsedSeconds:Math.max(0,(B-U.startedAt)/1e3))})}}}}else if(E.type==="result"){const k=E.data;k.is_error&&y.push({id:`hist-error-${j}`,role:"system",content:yb(k),timestamp:Date.now()});const A={total_cost_usd:k.total_cost_usd,num_turns:k.num_turns};if(typeof k.total_lines_added=="number"&&(A.total_lines_added=k.total_lines_added),typeof k.total_lines_removed=="number"&&(A.total_lines_removed=k.total_lines_removed),k.modelUsage){for(const C of Object.values(k.modelUsage))if(C.contextWindow>0){const L=C,B=Math.round((L.inputTokens+L.outputTokens)/L.contextWindow*100);A.context_used_percent=Math.max(0,Math.min(B,100))}}c.updateSession(e,A)}else if(E.type==="system_event"){const k=bb(E.event);if(!k)continue;y.push({id:`hist-system-event-${j}`,role:"system",content:k,timestamp:E.timestamp||Date.now()})}}if(y.length>0){const j=c.messages.get(e)||[];if(j.length===0)c.setMessages(e,y);else{const E=[...j];for(const k of y){const A=E.findIndex(L=>L.id===k.id);if(A===-1){E.push(k);continue}const C=E[A];C.role==="assistant"&&k.role==="assistant"?E[A]=Nm(C,k):E[A]=k}E.sort((k,A)=>(k.timestamp??0)-(A.timestamp??0)),c.setMessages(e,E)}}c.setToolActivity(e,Array.from(b.values()).sort((j,E)=>j.startedAt-E.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(wi(e),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let y;for(const b of t.events){const _=jm(e);b.seq<=_||(Sb(e,b.seq),y=b.seq,o5(e,b.message,{processSeq:!1,ackSeqMessage:!1}))}typeof y=="number"&&kb(e,y);break}case"prompt_suggestion":{const y=t.suggestions;c.setPromptSuggestions(e,y);break}case"streamlined_text":{c.appendMessage(e,{id:ss(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:ss(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Tc(e){const t=Vr.get(e);if(s5(t))return;if(t){try{t.close()}catch{}Vr.delete(e)}X.getState().setConnectionStatus(e,"connecting");const s=new WebSocket(HN(e));Vr.set(e,s),s.onopen=()=>{const a=jm(e);s.send(JSON.stringify({type:"session_subscribe",last_seq:a})),$N(e,s);const c=Is.get(e);c&&(clearTimeout(c),Is.delete(e))},s.onmessage=a=>VN(e,a),s.onclose=()=>{Vr.get(e)===s&&(Vr.delete(e),X.getState().setConnectionStatus(e,"disconnected"),GN(e))},s.onerror=()=>{s.close()}}function GN(e){if(Is.has(e)||xc)return;const t=setTimeout(()=>{Is.delete(e),!xc&&i5(e)&&Tc(e)},TN);Is.set(e,t)}function Cm(e){const t=Is.get(e);t&&(clearTimeout(t),Is.delete(e));const n=Vr.get(e);n&&(n.close(),Vr.delete(e)),X.getState().setConnectionStatus(e,"disconnected"),Td.delete(e),Ad.delete(e),Qo.delete(e),vd.delete(e),ki.delete(e),sc.delete(e),Ds.delete(e),Ed.delete(e),gc.delete(e)}function YN(e){if(!xc)for(const t of e)t.archived||Tc(t.sessionId)}function WN(e){return new Promise((t,n)=>{const s=setInterval(()=>{const c=Vr.get(e);(c==null?void 0:c.readyState)===WebSocket.OPEN&&(clearInterval(s),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(s),n(new Error("Connection timeout"))},1e4)})}function Pn(e,t){const n=Vr.get(e);let s=t;const a=FN.has(t.type);if(a)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":t.client_msg_id||(s={...t,client_msg_id:a5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(s));return}a&&PN(e,s)}function Nb(e){Pn(e,{type:"mcp_get_status"})}function XN(e,t,n){Pn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function QN(e,t){Pn(e,{type:"mcp_reconnect",serverName:t})}function KN(e,t){Pn(e,{type:"mcp_set_servers",servers:t})}function ZN(e,t){Pn(e,{type:"set_ai_validation",...t})}var se=typeof window<"u"?window:void 0,vn=typeof globalThis<"u"?globalThis:se;typeof self>"u"&&(vn.self=vn),typeof File>"u"&&(vn.File=function(){});var Un=vn==null?void 0:vn.navigator,Ne=vn==null?void 0:vn.document,nn=vn==null?void 0:vn.location,Em=vn==null?void 0:vn.fetch,Tm=vn!=null&&vn.XMLHttpRequest&&"withCredentials"in new vn.XMLHttpRequest?vn.XMLHttpRequest:void 0,Cb=vn==null?void 0:vn.AbortController,JN=vn==null?void 0:vn.CompressionStream,Zn=Un==null?void 0:Un.userAgent,Le=se??{},Eb="1.396.3",Zt={DEBUG:!1,LIB_VERSION:Eb,LIB_NAME:"web",JS_SDK_VERSION:Eb};function Tb(e,t,n,s,a,c,u){try{var f=e[c](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(s,a)}function xn(e){return function(){var t=this,n=arguments;return new Promise((function(s,a){var c=e.apply(t,n);function u(h){Tb(c,s,a,u,f,"next",h)}function f(h){Tb(c,s,a,u,f,"throw",h)}u(void 0)}))}}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ye.apply(null,arguments)}function c5(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.indexOf(s)!==-1)continue;n[s]=e[s]}return n}var Ab=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Mb(e){return typeof e=="string"||e}function Rb(e){return typeof e=="string"?e:void 0}var Oo,Ps=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),zb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),eC=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],tC=["token"],u5="NativeGzipValidationError",Am=e=>e.length>=2&&e[0]===31&&e[1]===139,Lb=(e,t)=>e===zb.GZipJS||t===zb.GZipJS||t==="gzip",Db=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",td=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=u5,t},nC=(function(){var e=xn((function*(t,n){18>t.size&&td("too-short");var s=new Uint8Array(yield t.slice(0,10).arrayBuffer());Am(s)&&s[2]===8||td("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Oo)return Oo;Oo=[];for(var g=0;256>g;g++){for(var v=g,y=0;8>y;y++)v=1&v?3988292384^v>>>1:v>>>1;Oo[g]=v>>>0}return Oo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&td("invalid-crc");var c=n.length>>>0;a.getUint32(4,!0)!==c&&td("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Mm(){return Mm=xn((function*(e,t,n){t===void 0&&(t=!0);try{var s=new TextEncoder().encode(e),a=new CompressionStream("gzip"),c=a.writable.getWriter(),u=c.write(s).then((()=>c.close())).catch((function(){var p=xn((function*(g){try{yield c.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(a.readable).blob(),[h]=yield Promise.all([f,u]);return yield nC(h,s),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Mm.apply(this,arguments)}var rC=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ob=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return rC.concat(t).some((s=>{var a=s.toLowerCase();return n.indexOf(a)!==-1}))};function Ie(e,t){return e.indexOf(t)!==-1}var af=function(e){return e.trim()},Rm=function(e){return e.replace(/^\$/,"")},d5=Object.prototype,f5=d5.hasOwnProperty,lf=d5.toString,rt=Array.isArray||function(e){return lf.call(e)==="[object Array]"},as=e=>typeof e=="function",Ut=e=>e===Object(e)&&!rt(e),ji=e=>{if(Ut(e)){for(var t in e)if(f5.call(e,t))return!1;return!0}return!1},Se=e=>e===void 0,Ct=e=>lf.call(e)=="[object String]",zm=e=>Ct(e)&&e.trim().length===0,Fn=e=>e===null,Qe=e=>Se(e)||Fn(e),Hn=e=>lf.call(e)=="[object Number]"&&e==e,Os=e=>Hn(e)&&e>0,us=e=>lf.call(e)==="[object Boolean]",sC=e=>e instanceof FormData,iC=e=>Ie(eC,e),aC=e=>Ie(tC,e);function h5(e){return e===null||typeof e!="object"}function Md(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Mg(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var lC=[!0,"true",1,"1","yes"],Np=e=>Ie(lC,e),oC=[!1,"false",0,"0","no"];function cs(e,t,n,s,a){return t>n&&(s.warn("min cannot be greater than max."),t=n),Hn(e)?e>n?(s.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),cs(a||n,t,n,s))}class cC{constructor(t){this.Ee={},this.Pe=t.Pe,this.Fe=cs(t.bucketSize,0,100,t.Ae),this.$e=cs(t.refillRate,0,this.Fe,t.Ae),this.De=cs(t.refillInterval,0,864e5,t.Ae)}Ne(t,n){var s=Math.floor((n-t.lastAccess)/this.De);s>0&&(t.tokens=Math.min(t.tokens+s*this.$e,this.Fe),t.lastAccess=t.lastAccess+s*this.De)}consumeRateLimit(t){var n,s=Date.now(),a=String(t),c=this.Ee[a];return c?this.Ne(c,s):this.Ee[a]=c={tokens:this.Fe,lastAccess:s},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.Pe)==null||n.call(this,t)),c.tokens===0)}stop(){this.Ee={}}}var hr="Mobile",Rd="iOS",Hs="Android",Nl="Tablet",p5=Hs+" "+Nl,m5="iPad",g5="Apple",x5=g5+" Watch",ic="Safari",Cl="BlackBerry",v5="Samsung",b5=v5+"Browser",y5=v5+" Internet",ga="Chrome",uC=ga+" OS",_5=ga+" "+Rd,Rg="Internet Explorer",w5=Rg+" "+hr,zg="Opera",dC=zg+" Mini",Lg="Edge",S5="Microsoft "+Lg,Sl="Firefox",k5=Sl+" "+Rd,vc="Nintendo",bc="PlayStation",kl="Xbox",j5=Hs+" "+hr,N5=hr+" "+ic,Ko="Windows",Lm=Ko+" Phone",Bb="Nokia",Dm="Ouya",C5="Generic",fC=C5+" "+hr.toLowerCase(),E5=C5+" "+Nl.toLowerCase(),Om="Konqueror",T5="Oculus Browser",zd="Vivaldi",A5="Yandex",Ld="Whale",Bm="DuckDuckGo",M5="Pale Moon",Dd="Waterfox",ac="Brave",R5="Google Search App",Vt="(\\d+(\\.\\d+)?)",Cp=new RegExp("Version/"+Vt),hC=new RegExp(kl,"i"),pC=new RegExp(bc+" \\w+","i"),mC=new RegExp(vc+" \\w+","i"),Dg=new RegExp(Cl+"|PlayBook|BB10","i"),gC={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},z5=function(e,t,n,s){t=t||"";var a=(function(c){return c!=null&&c.brave?ac:null})(n);return a||(s!=null&&s.detectGoogleSearchApp&&Ie(e,"GSA/")?R5:Ie(e," OPR/")&&Ie(e,"Mini")?dC:Ie(e," OPR/")?zg:Dg.test(e)?Cl:Ie(e,"IE"+hr)||Ie(e,"WPDesktop")?w5:Ie(e,"OculusBrowser")?T5:Ie(e,b5)?y5:Ie(e,Lg)||Ie(e,"Edg/")?S5:Ie(e,zd+"/")?zd:Ie(e,"YaBrowser/")?A5:Ie(e,Ld+"/")?Ld:Ie(e,Bm+"/")||Ie(e,"Ddg/")?Bm:Ie(e,"FBIOS")?"Facebook "+hr:Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?_5:Ie(e,"CrMo")||Ie(e,ga)?ga:Ie(e,Hs)&&Ie(e,ic)?j5:Ie(e,"FxiOS")?k5:Ie(e.toLowerCase(),Om.toLowerCase())?Om:Ie(e,ac+"/")?ac:((c,u)=>u&&Ie(u,g5)||(function(f){return Ie(f,ic)&&!Ie(f,ga)&&!Ie(f,Hs)})(c))(e,t)?Ie(e,hr)?N5:ic:Ie(e,"PaleMoon/")?M5:Ie(e,Dd+"/")?Dd:Ie(e,Sl)?Sl:Ie(e,"MSIE")||Ie(e,"Trident/")?Rg:Ie(e,"Gecko")?Sl:"")},xC={[w5]:[new RegExp("rv:"+Vt)],[S5]:[new RegExp(Lg+"?\\/"+Vt)],[ga]:[new RegExp("("+ga+"|CrMo)\\/"+Vt)],[_5]:[new RegExp("CriOS\\/"+Vt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Vt)],[ic]:[Cp],[N5]:[Cp],[zg]:[new RegExp("(Opera|OPR)\\/"+Vt)],[Sl]:[new RegExp(Sl+"\\/"+Vt)],[k5]:[new RegExp("FxiOS\\/"+Vt)],[Om]:[new RegExp("Konqueror[:/]?"+Vt,"i")],[Cl]:[new RegExp(Cl+" "+Vt),Cp],[j5]:[new RegExp("android\\s"+Vt,"i")],[y5]:[new RegExp(b5+"\\/"+Vt)],[T5]:[new RegExp("OculusBrowser\\/"+Vt)],[zd]:[new RegExp(zd+"\\/"+Vt)],[A5]:[new RegExp("YaBrowser\\/"+Vt)],[Ld]:[new RegExp(Ld+"\\/"+Vt)],[ac]:[new RegExp(ac+"\\/"+Vt)],[Bm]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Vt)],[M5]:[new RegExp("PaleMoon\\/"+Vt)],[Dd]:[new RegExp(Dd+"\\/"+Vt)],[R5]:[new RegExp("GSA\\/"+Vt)],[Rg]:[new RegExp("(rv:|MSIE )"+Vt)],Mozilla:[new RegExp("rv:"+Vt)]},vC=function(e,t,n,s){var a=z5(e,t,n,s),c=xC[a];if(Se(c))return null;for(var u=0;c.length>u;u++){var f=e.match(c[u]);if(f)return parseFloat(f[f.length-2])}return null},Pb=[[new RegExp(kl+"; "+kl+" (.*?)[);]","i"),e=>[kl,e&&e[1]||""]],[new RegExp(vc,"i"),[vc,""]],[new RegExp(bc,"i"),[bc,""]],[Dg,[Cl,""]],[new RegExp(Ko,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Lm,""];if(new RegExp(hr).test(t)&&!/IEMobile\b/.test(t))return[Ko+" "+hr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var s=gC[n[1]]||"";return/arm/i.test(t)&&(s="RT"),[Ko,s]}return[Ko,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Rd,[e[3],e[4],e[5]||"0"].join(".")]:[Rd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Se(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Hs+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Hs+")","i"),e=>e&&e[2]?[Hs,[e[2],e[3],e[4]||"0"].join(".")]:[Hs,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[uC,""]],[/Linux|debian/i,["Linux",""]]],$b=function(e){return mC.test(e)?vc:pC.test(e)?bc:hC.test(e)?kl:new RegExp(Dm,"i").test(e)?Dm:new RegExp("("+Lm+"|WPDesktop)","i").test(e)?Lm:/iPad/.test(e)?m5:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?x5:Dg.test(e)?Cl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Bb,"i").test(e)?Bb:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(hr).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Hs:p5:new RegExp("(pda|"+hr+")","i").test(e)?fC:new RegExp(Nl,"i").test(e)&&!new RegExp(Nl+" pc","i").test(e)?E5:""},bC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ub(e,t){return typeof(n=e)=="string"&&bC.test(n)?e:t();var n}function Ei(e){return e&&e.split("#")[0]}function Ep(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var yC=e=>e instanceof Error,L5={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},_C=L5.info;function D5(e){if(us(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(rt(e))return{arrayValue:{values:e.map((t=>D5(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function O5(e){var t=[];for(var n in e){var s=e[n];Fn(s)||Se(s)||t.push({key:n,value:D5(s)})}return t}function wC(e,t){var n=e.level||"info",{text:s,number:a}=L5[n]||_C,c=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),Qe(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),Qe(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var f=ye({},u,e.attributes||{}),h={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:a,severityText:s,body:{stringValue:e.body},attributes:O5(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),Se(e.trace_flags)||(h.flags=e.trace_flags),h}function B5(e,t,n){return ye({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function P5(e,t,n,s){return{resourceLogs:[{resource:{attributes:O5(t)},scopeLogs:[{scope:{name:n,version:s},logRecords:e}]}]}}let SC=class{constructor(e,t,n,s,a,c,u){var f;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.Se=t,this.Ae=n,this.qe=s,this.je=a,this.Be=c,this.He=u,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=t.maxBufferSize,this.Je=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.Ye=t.flushIntervalMs,this.Ke=t.maxBatchRecordsPerPost,this.Xe=t.rateCapWindowMs,this.et=t.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.it(e);if(t!==null)if(t.body){if(this.nt()){var n={record:wC(t,this.qe())};this.je((()=>this.st(n)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(e){var t=this.Se.beforeSend;if(!t)return e;var n=rt(t)?t:[t],s=e;for(var a of n)try{var c=a(s);if(!c)return this.Ae.info("Log was rejected in beforeSend function"),null;s=c}catch(u){return this.Ae.error("Error in beforeSend function for log:",u),null}return s}nt(){if(this.et===void 0)return!0;var e=Date.now(),t=e-this.We;return this.Xe>t&&t>=0||(this.We=e,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var e=this;return xn((function*(){if(!e._instance.isDisabled)return e.Ue||(e.Ue=e.ot().finally((()=>{e.Ue=null}))),e.Ue}))()}ot(){var e=this;return xn((function*(){var t;e.tt();var n=(t=e._instance.getPersistedProperty(Ps.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var s=n.length,a=0;n.length>0&&s>a;){var c,u;e.ze=0;var f=Math.min(n.length,e.Ke),h=n.slice(0,f),p=P5(h.map((v=>v.record)),e.ut(),(c=e.He)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.ht(p);if(g.kind==="too-large"&&h.length>1)e.Ke=Math.max(1,Math.floor(h.length/2)),e.Ae.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.Ke);else if(g.kind==="retry-later"||(g.kind==="too-large"?e.Ae.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):g.kind==="ok"&&e.Se.maxBatchRecordsPerPost>e.Ke&&(e.Ke=Math.min(e.Se.maxBatchRecordsPerPost,e.Ke+1)),yield e.dt(h.length),n=(u=e._instance.getPersistedProperty(Ps.LogsQueue))!==null&&u!==void 0?u:[],a+=h.length,g.kind==="fatal"))throw g.error}}))()}dt(e){var t=this;return xn((function*(){var n,s=Math.max(0,e-t.ze),a=(n=t._instance.getPersistedProperty(Ps.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Ps.LogsQueue,a.slice(s)),yield t.Be()}))()}ut(){return B5(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Ps.LogsQueue))!==null&&t!==void 0?t:[];this.Je>n.length||(n.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Ps.LogsQueue,n),this.Qe>n.length?this.ct():this.rt()}}ct(e){e===void 0&&(e=this.Ye),this.vt||(this.vt=Ep((()=>{this.vt=void 0,this.rt()}),e))}ft(){var e=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,e)}yt(){var e=this._instance.getPersistedProperty(Ps.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return xn((function*(){t.tt();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((s=>Ep(s,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return xn((function*(){var n=!1,s=t.flush(),a=new Promise((c=>Ep((()=>{n=!0,c()}),e)));try{yield Promise.race([s,a])}finally{n&&s.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(e=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var nd,Fb,Tp;function kC(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Tp&&n.length===Fb||(Fb=n.length,Tp=n.reduce(((s,a)=>{nd||(nd={});var c=nd[a];if(c)s[c[0]]=c[1];else for(var u=e(a),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[a];if(p&&g){s[p]=g,nd[a]=[p,g];break}}return s}),{})),Tp}}class jC{constructor(t,n,s){s===void 0&&(s=[]),this.coercers=t,this.stackParser=n,this.modifiers=s}buildFromUnknown(t,n){n===void 0&&(n={});var s=n&&n.mechanism||{handled:!0,type:"generic"},a=this.buildCoercingContext(s,n,0).apply(t),c=this.buildParsingContext(n),u=this.parseStacktrace(a,c);return{$exception_list:this.convertToExceptionList(u,s),$exception_level:"error"}}modifyFrames(t){var n=this;return xn((function*(){for(var s of t)s.stacktrace&&s.stacktrace.frames&&rt(s.stacktrace.frames)&&(s.stacktrace.frames=yield n.applyModifiers(s.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var s,a;return t.cause!=null&&(s=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),ye({},t,{cause:s,stack:a})}applyChunkIds(t,n){return t.map((s=>(s.filename&&n&&(s.chunk_id=n[s.filename]),s)))}applyCoercers(t,n){for(var s of this.coercers)if(s.match(t))return s.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return xn((function*(){var s=t;for(var a of n.modifiers)s=yield a(s);return s}))()}convertToExceptionList(t,n){var s,a,c,u={type:t.type,value:t.value,mechanism:{type:(s=n.type)!==null&&s!==void 0?s:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,ye({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:kC(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,s){s===void 0&&(s=0);var a=(c,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(c,f)}};return ye({},n,{syntheticException:s==0?n.syntheticException:void 0,mechanism:t,apply:c=>a(c,s),next:c=>a(c,s+1)})}}var El="?";function Pm(e,t,n,s,a){var c={platform:e,filename:t,function:n==="<anonymous>"?El:n,in_app:!0};return Se(s)||(c.lineno=s),Se(a)||(c.colno=a),c}var $5=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return n||s?[e.indexOf("@")!==-1?e.split("@")[0]:El,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},NC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,CC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,EC=/\((\S*)(?::(\d+))(?::(\d+))\)/,TC=(e,t)=>{var n=NC.exec(e);if(n){var[,s,a,c]=n;return Pm(t,s,El,+a,+c)}var u=CC.exec(e);if(u){if(u[2]&&u[2].indexOf("eval")===0){var f=EC.exec(u[2]);f&&(u[2]=f[1],u[3]=f[2],u[4]=f[3])}var[h,p]=$5(u[1]||El,u[2]);return Pm(t,p,h,u[3]?+u[3]:void 0,u[4]?+u[4]:void 0)}},AC=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,MC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,RC=(e,t)=>{var n=AC.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var s=MC.exec(n[3]);s&&(n[1]=n[1]||"eval",n[3]=s[1],n[4]=s[2],n[5]="")}var a=n[3],c=n[1]||El;return[c,a]=$5(c,a),Pm(t,a,c,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Hb=/\(error: (.*)\)/;class zC{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var s=Ct(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:s?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return Md(t,"DOMException")}isDOMError(t){return Md(t,"DOMError")}}class LC{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var s=t.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(t){return t.stacktrace||t.stack||void 0}}class DC{constructor(){}match(t){return Md(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var s;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var OC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class BC{match(t){return typeof t=="string"}coerce(t,n){var s,[a,c]=this.getInfos(t);return{type:a??"Error",value:c??t,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(t){var n="Error",s=t,a=t.match(OC);return a&&(n=a[1],s=a[2]),[n,s]}}var PC=["fatal","error","warning","log","info","debug"];function U5(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var s=n.length;s>0;s--){var a=n.slice(0,s).join(", ");if(t>=a.length)return s===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class $C{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var s,a=this.getErrorPropertyFromObject(t);return a?n.apply(a):{type:this.getType(t),value:this.getValue(t),stack:(s=n.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Mg(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var s=this.getObjectClassName(t);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+U5(t)}isSeverityLevel(t){return Ct(t)&&!zm(t)&&PC.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var s=t[n];if(yC(s))return s}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class UC{match(t){return Mg(t)}coerce(t,n){var s,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+U5(t),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class FC{match(t){return h5(t)}coerce(t,n){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class HC{match(t){return Md(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Mg(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var s,a=this.getUnhandledRejectionReason(t);return h5(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}:n.apply(a)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var Od="$message",Bd="$timestamp",IC=new Set([Od,Bd]),Ap={enabled:!0,max_bytes:32768};function Pd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Ap.enabled,max_bytes:VC(e.max_bytes,Ap.max_bytes)}:ye({},Ap)}class qC{constructor(t){this.bt=[],this._t=0,this.Se=Pd(t)}setConfig(t){this.Se=Pd(t),this.wt()}add(t){var n=(function(a){var c=(function(g){var v=new WeakSet;try{return JSON.stringify(g,((y,b)=>{if(typeof b=="bigint")return b.toString();if(typeof b!="function"&&typeof b!="symbol"){if(b instanceof Date)return b.toISOString();if(b instanceof Error)return{name:b.name,message:b.message,stack:b.stack};if(b&&typeof b=="object"){if(v.has(b))return"[Circular]";v.add(b)}return b}}))}catch{return}})(a);if(c)try{var u=JSON.parse(c);if(!Ut(u))return;var f=u,h=f[Od],p=f[Bd];return!Ct(h)||h.trim().length===0||!Ct(p)&&!Hn(p)?void 0:{step:f,json:c}}catch{return}})(t);if(n){var s=(function(a){if(typeof TextEncoder<"u")return new TextEncoder().encode(a).length;for(var c=encodeURIComponent(a),u=0,f=0;c.length>f;f++)c[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);s>this.Se.max_bytes||(this.bt.push({step:n.step,bytes:s}),this._t+=s,this.wt())}}getAttachable(){return this.bt.map((t=>t.step))}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var t=this.bt.shift();t&&(this._t-=t.bytes)}}}function VC(e,t){if(!Hn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var F5=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,s={k(a){if(se&&(Zt.DEBUG||Le.POSTHOG_DEBUG||n)&&!Se(se.console)&&se.console){for(var c=("__rrweb_original__"in se.console[a])?se.console[a].__rrweb_original__:se.console[a],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];c(e,...f)}},debug(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];s.k("debug",...c)},info(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];s.k("log",...c)},warn(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];s.k("warn",...c)},error(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];s.k("error",...c)},critical(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];console.error(e,...c)},uninitializedWarning(a){s.error("You must initialize PostHog before calling "+a)},createLogger:(a,c)=>F5(e+" "+a,c)};return s},we=F5("[PostHog.js]"),Gt=we.createLogger,GC=Gt("[ExternalScriptsLoader]"),Mp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return GC.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var s=Ne==null?void 0:Ne.querySelectorAll("script");if(s){for(var a,c=function(){if(s[u].src===t){var h=s[u];return h.__posthog_loading_callback_fired?{v:n()}:(h.addEventListener("load",(p=>{h.__posthog_loading_callback_fired=!0,n(void 0,p)})),h.onerror=p=>n(p),{v:void 0})}},u=0;s.length>u;u++)if(a=c())return a.v}var f=()=>{if(!Ne)return n("document not found");var h=Ne.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=v=>{h.__posthog_loading_callback_fired=!0,n(void 0,v)},h.onerror=v=>n(v),e.config.prepare_external_dependency_script&&(h=e.config.prepare_external_dependency_script(h)),!h)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Ne.head.appendChild(h);else{var p,g=Ne.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ne.body.appendChild(h)}};Ne!=null&&Ne.body?f():Ne==null||Ne.addEventListener("DOMContentLoaded",f)};Le.__PosthogExtensions__=Le.__PosthogExtensions__||{},Le.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var s;if(e.config.strict_script_versioning)s=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var a="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;a=a+"&t="+Math.floor(Date.now()/c)*c}s=e.requestRouter.endpointFor("assets",a)}Mp(e,s,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Mp(e,u,n)}},Le.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);Mp(e,s,n)};var H5="$people_distinct_id",$d="$device_id",Rp="$device_model",Zo="__alias",Jo="__timers",$m="$autocapture_disabled_server_side",Um="$heatmaps_enabled_server_side",Fm="$exception_capture_enabled_server_side",Hm="$error_tracking_suppression_rules",Im="$error_tracking_capture_extension_exceptions",qm="$web_vitals_enabled_server_side",Og="$dead_clicks_enabled_server_side",Bg="$product_tours_enabled_server_side",Vm="$web_vitals_allowed_metrics",ma="$session_recording_remote_config",I5="$replay_sample_rate",q5="$replay_override_sampling",V5="$replay_override_linked_flag",G5="$replay_override_url_trigger",Y5="$replay_override_event_trigger",_l="$sesid",Pg="$session_is_sampled",pa="$enabled_feature_flags",_d="$active_feature_flags",ec="$early_access_features",Gm="$feature_flag_details",wd="$feature_flag_payloads",Ym="$feature_flag_request_id",Bs="$override_feature_flags",xl="$override_feature_flag_payloads",ua="$stored_person_properties",da="$stored_group_properties",Wm="$surveys",$g="$surveys_loaded_at",Xm="$surveys_activated",tc="ph_product_tours",lc="$flag_call_reported",Qm="$flag_call_reported_session_id",Km="$feature_flag_errors",yc="$feature_flag_evaluated_at",qr="$user_state",Zm="$client_session_props",Jm="$capture_rate_limit",eg="$initial_campaign_params",tg="$initial_referrer_info",Ud="$initial_person_info",Fd="$epp",W5="__POSTHOG_TOOLBAR__",rd="$posthog_cookieless",X5="$sdk_debug_extensions_init_method",Q5="$sdk_debug_extensions_init_time_ms",K5="$sdk_debug_recording_script_not_loaded",ng="PostHog loadExternalDependency extension not found.",fa="on_reject",Us="always",cl="anonymous",ul="identified",rg="identified_only",Hd="visibilitychange",Id="beforeunload",vl="$pageview",zp="$pageleave",Lp="$identify",Ib="$groupidentify";function sd(e,t){rt(e)&&e.forEach(t)}function Mt(e,t){if(!Qe(e))if(rt(e))e.forEach(t);else if(sC(e))e.forEach(((s,a)=>t(s,a)));else for(var n in e)f5.call(e,n)&&t(e[n],n)}var Bt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;t>s;s++)n[s-1]=arguments[s];for(var a of n)for(var c in a)a[c]!==void 0&&(e[c]=a[c]);return e};function Sd(e){for(var t=Object.keys(e),n=t.length,s=new Array(n);n--;)s[n]=[t[n],e[t[n]]];return s}var qb=function(e){try{return e()}catch{return}},YC=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),s=0;t>s;s++)n[s]=arguments[s];return e.apply(this,n)}catch(a){we.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),we.critical(a)}}},Ug=function(e){var t={};return Mt(e,(function(n,s){(Ct(n)&&n.length>0||Hn(n))&&(t[s]=n)})),t},WC=["herokuapp.com","vercel.app","netlify.app"];function XC(e){var t=e==null?void 0:e.hostname;if(!Ct(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of WC)if(n===s)return!1;return!0}function Xt(e,t,n,s){var{capture:a=!1,passive:c=!0}=s??{};e==null||e.addEventListener(t,n,{capture:a,passive:c})}function Z5(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Hn(e)&&isFinite(e)&&Math.floor(e)===e});class qd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,s,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(a)||0>t||0>n||0>s||0>a||t>0xffffffffffff||n>4095||s>1073741823||a>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/Math.pow(2,8),c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|s>>>24,c[9]=s>>>16,c[10]=s>>>8,c[11]=s,c[12]=a>>>24,c[13]=a>>>16,c[14]=a>>>8,c[15]=a,new qd(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new qd(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var s=this.bytes[n]-t.bytes[n];if(s!==0)return Math.sign(s)}return 0}}class QC{constructor(){this.S=0,this.C=0,this.I=new KC}generate(){var t=this.generateOrAbort();if(Se(t)){this.S=0;var n=this.generateOrAbort();if(Se(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.M();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return qd.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Vb,J5=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};se&&!Se(se.crypto)&&crypto.getRandomValues&&(J5=e=>crypto.getRandomValues(e));class KC{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(J5(this.R),this.O=0),this.R[this.O++]}}var $s=()=>ZC().toString(),ZC=()=>(Vb||(Vb=new QC)).generate(),Bo="",JC=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,os={N:()=>!!Ne,D(e){we.error("cookieStore error: "+e)},A(e){if(Ne){try{for(var t=e+"=",n=Ne.cookie.split(";").filter((c=>c.length)),s=0;n.length>s;s++){for(var a=n[s];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(os.A(e))||{}}catch{}return t},q(e,t,n,s,a){if(!Ne)return!1;try{var c="",u="",f=(function(g,v){if(v){var y=(function(_,j){if(j===void 0&&(j=Ne),Bo)return Bo;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var E=_.split("."),k=Math.min(E.length,8),A="dmn_chk_"+$s();!Bo&&k--;){var C=E.slice(k).join("."),L=A+"=1;domain=."+C+";path=/";j.cookie=L+";max-age=3",j.cookie.includes(A)&&(j.cookie=L+";max-age=0",Bo=C)}return Bo})(g);if(!y){var b=(_=>{var j=_.match(JC);return j?j[0]:""})(g);b!==y&&we.info("Warning: cookie subdomain discovery mismatch",b,y),y=b}return y?"; domain=."+y:""}return""})(Ne.location.hostname,s);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),c="; expires="+h.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&we.warn("cookieStore warning: large cookie, len="+p.length),Ne.cookie=p,!0}catch{return!1}},P(e,t){if(Ne!=null&&Ne.cookie)try{os.q(e,"",-1,t)}catch{return}}},Dp=null,At={N(){if(!Fn(Dp))return Dp;var e=!0;if(Se(se))e=!1;else try{var t="__mplssupport__";At.q(t,"xyz"),At.A(t)!=='"xyz"'&&(e=!1),At.P(t)}catch{e=!1}return e||we.error("localStorage unsupported; falling back to cookie store"),Dp=e,e},D(e){we.error("localStorage error: "+e)},A(e){try{return se==null?void 0:se.localStorage.getItem(e)}catch(t){At.D(t)}return null},F(e){try{return JSON.parse(At.A(e))||{}}catch{}return null},q(e,t){try{return se==null||se.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){At.D(n)}return!1},P(e){try{se==null||se.localStorage.removeItem(e)}catch(t){At.D(t)}}},e3=[$d,"distinct_id",_l,Pg,Fd,Ud,qr],id={},t3={N:()=>!0,D(e){we.error("memoryStorage error: "+e)},A:e=>id[e]||null,F:e=>id[e]||null,q:(e,t)=>(id[e]=t,!0),P(e){delete id[e]}},ra=null,Cn={N(){if(!Fn(ra))return ra;if(ra=!0,Se(se))ra=!1;else try{var e="__support__";Cn.q(e,"xyz"),Cn.A(e)!=='"xyz"'&&(ra=!1),Cn.P(e)}catch{ra=!1}return ra},D(e){we.error("sessionStorage error: ",e)},A(e){try{return se==null?void 0:se.sessionStorage.getItem(e)}catch(t){Cn.D(t)}return null},F(e){try{return JSON.parse(Cn.A(e))||null}catch{}return null},q(e,t){try{return se==null||se.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Cn.D(n)}return!1},P(e){try{se==null||se.sessionStorage.removeItem(e)}catch(t){Cn.D(t)}}};class n3{constructor(t){this._instance=t}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}isOptedOut(){return this.Se.cookieless_mode===Us||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===fa}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(t){this.Ct.q(this.It,t?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.P(this.It,this.Se.cross_subdomain_cookie)}get It(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:s}=this._instance.config;return s||(n?n+t:"__ph_opt_in_out_"+t)}get St(){var t=this.Ct.A(this.It);return Np(t)?1:Ie(oC,t)?0:-1}get Ct(){var t=this.Se.opt_out_capturing_persistence_type,n=t==="localStorage"?At:os;if(!this.Tt||this.Tt!==n){this.Tt=n;var s=t==="localStorage"?os:At;s.A(this.It)&&(this.Tt.A(this.It)||this.optInOut(Np(s.A(this.It))),s.P(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[Un==null?void 0:Un.doNotTrack,Un==null?void 0:Un.msDoNotTrack,Le.doNotTrack].some((t=>Np(t)))}}function ew(e,t){var n,s=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!as(s))return t;try{var a=s(t);return Ct(a)&&a?a:t}catch(c){return we.error("Error in get_current_url, falling back to window.location.href",c),t}}var r3=1,s3=3,i3=11;function Gb(e){return e instanceof Element&&(e.id===W5||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ti(e){return!!e&&e.nodeType===r3}function fr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function tw(e){return!!e&&e.nodeType===s3}function nw(e){return!!e&&e.nodeType===i3&&Ti(e.host)}function Fg(e){return e?af(e).split(/\s+/):[]}function Yb(e,t){var n=(function(s){var a,c=se==null||(a=se.location)==null?void 0:a.href;return Se(c)?void 0:ew(s,c)})(t);return!!(n&&e&&e.some((s=>n.match(s))))}function Vd(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Fg(t)}function rw(e){return Qe(e)?null:af(e).split(/(\s+)/).filter((t=>oc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function _c(e){var t="";return ig(e)&&!lw(e)&&e.childNodes&&e.childNodes.length&&Mt(e.childNodes,(function(n){var s;tw(n)&&n.textContent&&(t+=(s=rw(n.textContent))!==null&&s!==void 0?s:"")})),af(t)}function Op(e){return Se(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Hg=["a","button","form","input","select","textarea","label"];function sg(e,t){if(Se(t))return!0;var n,s=function(c){if(t.some((u=>(function(f,h){var p=f.matches||f.matchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector;try{return!!p&&p.call(f,h)}catch{return!1}})(c,u))))return{v:!0}};for(var a of e)if(n=s(a))return n.v;return!1}function sw(e){var t=e.parentNode;return!(!t||!Ti(t))&&t}var a3=[".ph-no-autocapture","[data-ph-no-autocapture]"],iw=["next","previous","prev",">","<"],l3=[...iw,"+","-","−","–"],Wb=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Xb=[".ph-no-rageclick",".ph-no-capture"],o3=["","text","search","email","password","url","tel","number"];function Qb(e,t){if(!se||Ig(e))return!1;var n,s,a,c,u;if(us(t)?(n=!!t&&Xb,s=void 0,a=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:Xb,s=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(h){return!(!h||!Ti(h))&&(!!fr(h,"textarea")||(fr(h,"input")?Ie(o3,(h.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var g=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return g==="true"||g===""})(h)))})(e))return!1;var{targetElementList:f}=aw(e,!1);return!(function(h,p){if(h===!1||Se(h))return!1;var g;if(h===!0)g=iw;else{if(!rt(h))return!1;if(h.length>10)return we.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((v=>v.toLowerCase()))}return p.some((v=>{var{safeText:y,ariaLabel:b}=v;return g.some((_=>Wb(y,_)||Wb(b,_)))}))})(s,f.map((h=>{var p;return{safeText:_c(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!sg(f,n)}var Ig=e=>!e||fr(e,"html")||!Ti(e),aw=(e,t)=>{if(!se||Ig(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,s=[e],a=e;a.parentNode&&!fr(a,"body");)if(nw(a.parentNode))s.push(a.parentNode.host),a=a.parentNode.host;else{var c=sw(a);if(!c)break;if(t||Hg.indexOf(c.tagName.toLowerCase())>-1)n=!0;else{var u=se.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}s.push(c),a=c}return{parentIsUsefulElement:n,targetElementList:s}};function ig(e){for(var t=e;t.parentNode&&!fr(t,"body");t=t.parentNode){var n=Vd(t);if(Ie(n,"ph-sensitive")||Ie(n,"ph-no-capture"))return!1}if(Ie(Vd(e),"ph-include"))return!0;var s=e.type||"";if(Ct(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var a=e.name||e.id||"";return!Ct(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function lw(e){return!!(fr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||fr(e,"select")||fr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var ow="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",c3=new RegExp("^(?:"+ow+")$"),u3=new RegExp(ow),cw="\\d{3}-?\\d{2}-?\\d{4}",d3=new RegExp("^("+cw+")$"),f3=new RegExp("("+cw+")");function oc(e,t){return t===void 0&&(t=!0),!(Qe(e)||Ct(e)&&(e=af(e),(t?c3:u3).test((e||"").replace(/[- ]/g,""))||(t?d3:f3).test(e)))}function Kb(e){var t=_c(e);return oc(t=(t+" "+uw(e)).trim())?t:""}function uw(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Mt(e.childNodes,(function(n){var s;if(n&&((s=n.tagName)==null?void 0:s.toLowerCase())==="span")try{var a=_c(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+uw(n)).trim())}catch(c){we.error("[AutoCapture]",c)}})),t}function Zb(e){return e.replace(/"|\\"/g,'\\"')}function h3(e){var t=e.attr__class;return t?rt(t)?t:Fg(t):void 0}var ad=Gt("[Dead Clicks]"),p3=()=>!0,m3=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Og)),s=e.instance.config.capture_dead_clicks;return us(s)?s:!!Ut(s)||n};class Jb{get lazyLoadedDeadClicksAutocapture(){return this.Et}constructor(t,n,s){this.instance=t,this.isEnabled=n,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Og]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt((()=>{this.Pt()})):this.stop()}Mt(t){var n,s;(n=Le.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(s=Le.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?ad.error("failed to load script",a):t()}))}Pt(){var t;if(Ne){if(!this.Et&&(t=Le.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Ut(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.Et=Le.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Et.start(Ne),ad.info("starting...")}}else ad.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,ad.info("stopping..."))}}var Bp=Gt("[SegmentIntegration]"),dw="posthog-js";function fw(e,t){var{organization:n,projectId:s,prefix:a,severityAllowList:c=["error"],sendExceptionsToPostHog:u=!0}=t===void 0?{}:t;return f=>{var h,p,g,v,y;if(c!=="*"&&!c.includes(f.level)||!e.__loaded)return f;f.tags||(f.tags={});var b=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());f.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(f.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,j=((h=f.exception)==null?void 0:h.values)||[],E=j.map((A=>ye({},A,{stacktrace:A.stacktrace?ye({},A.stacktrace,{type:"raw",frames:(A.stacktrace.frames||[]).map((C=>ye({},C,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((p=j[0])==null?void 0:p.value)||f.message,$exception_type:(g=j[0])==null?void 0:g.type,$exception_level:f.level,$exception_list:E,$sentry_event_id:f.event_id,$sentry_exception:f.exception,$sentry_exception_message:((v=j[0])==null?void 0:v.value)||f.message,$sentry_exception_type:(y=j[0])==null?void 0:y.type,$sentry_tags:f.tags};return n&&s&&(k.$sentry_url=(a||"https://sentry.io/organizations/")+n+"/issues/?project="+s+"&query="+f.event_id),u&&((_=e.exceptions)==null||_.sendExceptionEvent(k)),f}}class g3{constructor(t,n,s,a,c,u){this.name=dw,this.setupOnce=function(f){f(fw(t,{organization:n,projectId:s,prefix:a,severityAllowList:c,sendExceptionsToPostHog:u==null||u}))}}}class ey{constructor(t){this.Rt=(n,s,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(we.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Lt()}Lt(){var t;this.Ft=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.Rt)}destroy(){var t;(t=this.Ft)==null||t.call(this),this.Ft=void 0}doPageView(t,n){var s,a=this.At(t,n);return this.Ot={pathname:(s=se==null?void 0:se.location.pathname)!==null&&s!==void 0?s:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.At(t,(n=this.Ot)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Ot)==null?void 0:t.pageViewId}}At(t,n){var s=this.Ot;if(!s)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:s.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:u,lastScrollY:f,maxScrollY:h,maxContentHeight:p,lastContentY:g,maxContentY:v}=c;if(!(Se(u)||Se(f)||Se(h)||Se(p)||Se(g)||Se(v))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),v=Math.ceil(v);var y=u>1?cs(f/u,0,1,we):1,b=u>1?cs(h/u,0,1,we):1,_=p>1?cs(g/p,0,1,we):1,j=p>1?cs(v/p,0,1,we):1;a=Bt(a,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:y,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:j})}}return s.pathname&&(a.$prev_pageview_pathname=s.pathname),s.timestamp&&(a.$prev_pageview_duration=(t.getTime()-s.timestamp.getTime())/1e3),a}}var ld=["flags","surveys"],x3={[H5]:{exposure:"hidden"},[Zo]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Jo]:{exposure:"hidden"},[$m]:{exposure:"event"},[Um]:{exposure:"hidden"},[Fm]:{exposure:"event"},[Hm]:{exposure:"hidden"},[Im]:{exposure:"event"},[qm]:{exposure:"event"},[Og]:{exposure:"event"},[Bg]:{exposure:"hidden"},[Vm]:{exposure:"event"},[ma]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[_l]:{exposure:"hidden"},[Pg]:{exposure:"event"},[I5]:{exposure:"event",shouldSkipFromEventProperties:e=>Fn(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[pa]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Ut(e))return{};for(var t={},n=Object.keys(e),s=0;n.length>s;s++)t["$feature/"+n[s]]=e[n[s]];return t}},[_d]:{exposure:"event",storageGroup:"flags"},[ec]:{exposure:"hidden"},[Gm]:{exposure:"hidden",storageGroup:"flags"},[wd]:{exposure:"event",storageGroup:"flags"},[Ym]:{exposure:"event",storageGroup:"flags",volatile:!0},[Bs]:{exposure:"event"},[xl]:{exposure:"hidden"},[ua]:{exposure:"hidden"},[da]:{exposure:"hidden"},[Wm]:{exposure:"hidden",storageGroup:"surveys"},[$g]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Xm]:{exposure:"event"},[tc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[lc]:{exposure:"hidden"},[Qm]:{exposure:"hidden"},[Km]:{exposure:"hidden"},[yc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[qr]:{exposure:"hidden"},[Zm]:{exposure:"hidden"},[Jm]:{exposure:"hidden"},[eg]:{exposure:"hidden"},[tg]:{exposure:"hidden"},[Ud]:{exposure:"hidden"},[Fd]:{exposure:"hidden"},[q5]:{exposure:"event"},[V5]:{exposure:"event"},[G5]:{exposure:"event"},[Y5]:{exposure:"event"},[X5]:{exposure:"event"},[Q5]:{exposure:"event"},[K5]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},v3=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],sa=e=>{var t=x3[e];if(t)return t;for(var[n,s]of v3)if(e.indexOf(n)===0)return s},Gd=e=>{var t=Ne==null?void 0:Ne.createElement("a");return Se(t)?null:(t.href=e,t)},Tl=function(e,t){for(var n,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;s.length>a;a++){var c=s[a].split("=");if(c[0]===t){n=c;break}}if(!rt(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{we.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},wc=function(e,t,n){if(!e||!t||!t.length)return e;for(var s=e.split("#"),a=s[1],c=(s[0]||"").split("?"),u=c[1],f=c[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var v=h[g].split("=");rt(v)&&(t.includes(v[0])?p.push(v[0]+"="+n):p.push(h[g]))}var y=f;return u!=null&&(y+="?"+p.join("&")),a!=null&&(y+="#"+a),y},Yd=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},od="https?://(.*)",Al=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],b3=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Al],Sc="<masked>",y3=["li_fat_id"];function hw(e,t,n){if(!Ne)return{};var s,a=t?[...Al,...n||[]]:[],c=pw(wc(Ne.URL,a,Sc),e),u=(s={},Mt(y3,(function(f){var h=os.A(f);s[f]=h||null})),s);return Bt(u,c)}function pw(e,t){var n=b3.concat(t||[]),s={};return Mt(n,(function(a){var c=Tl(e,a);s[a]=c||null})),s}function mw(e){var t=(function(c){return c?c.search(od+"google.([^/?]*)")===0?"google":c.search(od+"bing.com")===0?"bing":c.search(od+"yahoo.com")===0?"yahoo":c.search(od+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",s={};if(!Fn(t)){s.$search_engine=t;var a=Ne?Tl(Ne.referrer,n):"";a.length&&(s.ph_keyword=a)}return s}function ty(){return navigator.language||navigator.userLanguage}var Wd="$direct";function gw(){return(Ne==null?void 0:Ne.referrer)||Wd}function xw(e,t,n){n===void 0&&(n=!1);var s=e?[...Al,...t||[]]:[],a=n?Ei(nn==null?void 0:nn.href):nn==null?void 0:nn.href,c=a==null?void 0:a.substring(0,1e3);return{r:gw().substring(0,1e3),u:c?wc(c,s,Sc):void 0}}function vw(e,t){var n;t===void 0&&(t=!1);var{r:s,u:a}=e,c=t?Ei(a):a,u={$referrer:s,$referring_domain:s==null?void 0:s==Wd?Wd:(n=Gd(s))==null?void 0:n.host};if(c){u.$current_url=c;var f=Gd(c);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;var h=pw(c);Bt(u,h)}if(s){var p=mw(s);Bt(u,p)}return u}function bw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function _3(){try{return new Date().getTimezoneOffset()}catch{return}}var w3={flags:yc,surveys:$g},S3=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],dl="main";class Pp{constructor(t,n,s){if(s===void 0&&(s=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=t,this.qt=s,this.props={},this.jt=!1,this.Bt=(c=>{var u="";return c.token&&(u=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+u+"_posthog"})(t),this.Ct=this.Ht(t),this.Nt=this.Ut(t),this.load(),t.debug&&we.info("Persistence loaded",t.persistence,ye({},this.props)),this.update_config(t,t,n),this.save(),se){var a=()=>this.flush();Xt(se,"beforeunload",a,{capture:!1}),Xt(se,"pagehide",a,{capture:!1})}}zt(){var t,n=(t=this.Se)==null?void 0:t.persistence_save_debounce_ms;return Hn(n)&&n>0?n:0}isDisabled(){return!!this.Vt}Ht(t){S3.indexOf(t.persistence.toLowerCase())===-1&&(we.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,s=(function(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...e3,...u];return ye({},At,{F(p){try{var g={};try{g=os.F(p)||{}}catch{}var v,y=JSON.parse(At.A(p)||"{}");if(f){var b={};for(var _ in g){var j=g[_];Fn(j)||j===""||(b[_]=j)}v=Bt(y,b)}else v=Bt(g,y);return At.q(p,v),v}catch{}return null},q(p,g,v,y,b,_){var j=At.q(p,g,void 0,void 0,_);try{var E={};h.forEach((k=>{g[k]&&(E[k]=g[k])})),Object.keys(E).length&&os.q(p,E,v,y,b,_)}catch(k){At.D(k)}return j},P(p,g){try{se==null||se.localStorage.removeItem(p),os.P(p,g)}catch(v){At.D(v)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),a=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&At.N()?(n=At,a=!0):c==="localstorage+cookie"&&s.N()?(n=s,a=!0):c==="sessionstorage"&&Cn.N()?n=Cn:c==="memory"?n=t3:c==="cookie"?n=os:s.N()?(n=s,a=!0):n=os,this.Dt=a,n}Wt(t){return this.Bt+"__"+t}Ut(t){return this.Dt&&!!t.split_storage}Gt(t){var n=t??this.Se.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var s=this.props[yc];return!s||typeof s!="number"||Date.now()-s>n}properties(){var t={};return Mt(this.props,((n,s)=>{var a=sa(s);if((a==null?void 0:a.exposure)==="derived"){if(a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,s===pa?()=>this.Gt():()=>!1))return;a.transformToEventProperties&&Bt(t,a.transformToEventProperties(n))}else if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,(()=>!1)))return;t[s]=n}})),t}load(){if(!this.Vt){var t=this.Ct.F(this.Bt);t&&(this.props=Bt({},t)),this.Nt&&this.Zt()}}Zt(){for(var t of ld){var n=At.F(this.Wt(t));if(n&&!ji(n)){var s=this.Qt(t);s.persisted=!0,this.Jt(t)||(s.fingerprint=this.Yt(n,t)),this.Kt(t,n)||Bt(this.props,n)}}}Jt(t){return Object.keys(this.props).some((n=>{var s;return((s=sa(n))==null?void 0:s.storageGroup)===t}))}Kt(t,n){var s=w3[t];if(!s)return!1;var a=n[s],c=this.props[s];return Hn(a)&&Hn(c)&&c>a}refreshKey(t){var n;if(!this.Vt){var s=this.Nt?(n=sa(t))==null?void 0:n.storageGroup:void 0,a=s?At.F(this.Wt(s)):this.Ct.F(this.Bt);if(a&&t in a)this.Xt(t,a[t]);else{if(s){var c=this.Ct.F(this.Bt);if(c&&t in c)return void this.Xt(t,c[t])}this.er(t)}}}save(){if(!this.Vt){var t=this.zt();t>0?Se(this.tr)&&(this.tr=setTimeout((()=>{this.tr=void 0,this.rr()}),t)):this.rr()}}flush(){Se(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.Bt,this.props,dl))}ir(){var{main:t,groups:n}=this.sr();for(var s of(this.nr(this.Ct,this.Bt,t,dl),ld)){var a,c=n[s];(!ji(c)||(a=this.$t[s])!=null&&a.persisted)&&this.nr(At,this.Wt(s),c,s)}}sr(){var t={},n={};for(var s of ld)n[s]={};return Mt(this.props,((a,c)=>{var u,f=(u=sa(c))==null?void 0:u.storageGroup;f?n[f][c]=a:t[c]=a})),{main:t,groups:n}}Yt(t,n){if(n===dl)return JSON.stringify(t)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var s={};return Mt(t,((a,c)=>{var u;s[c]=(u=sa(c))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(s)}nr(t,n,s,a){var c=this.Qt(a);if(a===dl||c.dirty||Se(c.fingerprint)){var u;try{if((u=this.Yt(s,a))===c.fingerprint)return void(c.dirty=!1)}catch{u=void 0}t.q(n,s,this.ar,this.lr,this.ur,this.Se.debug)?(c.dirty=!1,a!==dl&&(c.persisted=!0),Se(u)||(c.fingerprint=u)):this.Se.debug&&we.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var{keepGroupEntries:n=!1}=t===void 0?{}:t;if(Se(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.P(this.Bt,!1),this.Ct.P(this.Bt,!0),!n&&this.qt)for(var s of ld)At.P(this.Wt(s));n?delete this.$t[dl]:this.$t={}}clear(){this.remove(),this.props={}}register_once(t,n,s){if(Ut(t)){Se(n)&&(n="None"),this.ar=Se(s)?this.hr:s;var a=!1;if(Mt(t,((c,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Xt(u,c),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(Ut(t)){this.ar=Se(n)?this.hr:n;var s=!1;if(Mt(t,((a,c)=>{t.hasOwnProperty(c)&&this.props[c]!==a&&(this.Xt(c,a),s=!0)})),s)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.er(t),this.save())}update_campaign_params(){if(!this.jt){var t=hw(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);ji(Ug(t))||this.register(t),this.jt=!0}}update_search_keyword(){var t;this.register((t=Ne==null?void 0:Ne.referrer)?mw(t):{})}update_referrer_info(){var t;this.register_once({$referrer:gw(),$referring_domain:Ne!=null&&Ne.referrer&&((t=Gd(Ne.referrer))==null?void 0:t.host)||Wd},void 0)}set_initial_person_info(){this.props[eg]||this.props[tg]||this.register_once({[Ud]:xw(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Mt([tg,eg],(a=>{var c=this.props[a];c&&Mt(c,(function(u,f){t["$initial_"+Rm(f)]=u}))}));var n=this.props[Ud];if(n){var s=(function(a,c){c===void 0&&(c=!1);var u=vw(a,c),f={};return Mt(u,(function(h,p){f["$initial_"+Rm(p)]=h})),f})(n,this.Se.disable_capture_url_hashes);Bt(t,s)}return t}safe_merge(t){return Mt(this.props,(function(n,s){s in t||(t[s]=n)})),t}update_config(t,n,s){this.hr=this.ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!s),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var a=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),v=[...p].sort();return g.every(((y,b)=>y===v[b]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),c=a?this.Ht(t):this.Ct,u=this.Ut(t);if(a||u!==this.Nt){var f=this.props;this.clear(),this.Ct=c,this.Nt=u,this.props=f,this.save()}}set_disabled(t){this.Vt=t,this.Vt?this.remove():this.save()}set_cross_subdomain(t){t!==this.lr&&(this.lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ur&&(this.ur=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var s=this.props[Jo]||{};s[t]=n,this.Xt(Jo,s),this.save()}remove_event_timer(t){var n=this.props[Jo]||{},s=n[t];return Se(s)||(delete n[t],this.Xt(Jo,n),this.save()),s}get_property(t){return this.props[t]}set_property(t,n){this.Xt(t,n),this.save()}Xt(t,n){var s;this.props[t]=n,(s=sa(t))!=null&&s.volatile||this.dr(t)}er(t){delete this.props[t],this.dr(t)}dr(t){var n,s=(n=sa(t))==null?void 0:n.storageGroup;s&&(this.Qt(s).dirty=!0)}Qt(t){return this.$t[t]||(this.$t[t]={})}}var Po={Activation:"events",Cancellation:"cancelEvents"},$p={Popover:"popover",API:"api",Widget:"widget"},k3={Always:"always"},Fs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Up={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ag={Popover:"popover",Inline:"inline"},j3={SHOWN:"product tour shown"},ny={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ry=Gt("[RateLimiter]");class N3{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var s=n.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((a=>{ry.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void ry.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:s})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,s,a;t===void 0&&(t=!1);var{captureEventsBurstLimit:c,captureEventsPerSecond:u}=this,f=new Date().getTime(),h=(n=(s=this.instance.persistence)==null?void 0:s.get_property(Jm))!==null&&n!==void 0?n:{tokens:c,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>c&&(h.tokens=c);var p=1>h.tokens;return p||t||(h.tokens=Math.max(0,h.tokens-1)),!p||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+u+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(Jm,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var $o=Gt("[RemoteConfig]");class yw{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Le._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}cr(t){var n,s;(n=Le.__PosthogExtensions__)!=null&&n.loadExternalDependency?(s=Le.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return $o.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void $o.warn("Remote config is disabled. Falling back to local config.");this.cr((t=>{if(!t)return $o.info("No config found after loading remote JS config. Falling back to JSON."),void this.vr((n=>{this.pr(n),this.gr()}));this.pr(t),this.gr()}))}catch(t){$o.error("Error loading remote config",t)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}refresh(){!this._instance.mr()&&Ne&&Ne.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}gr(){var t;if(!this.yr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.yr=setInterval((()=>{this.refresh()}),n))}}pr(t){var n;t||$o.error("Failed to fetch remote config from PostHog."),this._instance.pr(t??{}),(t==null?void 0:t.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var ls={GZipJS:"gzip-js",Base64:"base64"},Dr=Uint8Array,Jn=Uint16Array,Ml=Uint32Array,qg=new Dr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vg=new Dr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),sy=new Dr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_w=function(e,t){for(var n=new Jn(31),s=0;31>s;++s)n[s]=t+=1<<e[s-1];var a=new Ml(n[30]);for(s=1;30>s;++s)for(var c=n[s];n[s+1]>c;++c)a[c]=c-n[s]<<5|s;return[n,a]},ww=_w(qg,2),lg=ww[1];ww[0][28]=258,lg[258]=28;for(var iy=_w(Vg,0)[1],Sw=new Jn(32768),Ft=0;32768>Ft;++Ft){var fl=(43690&Ft)>>>1|(21845&Ft)<<1;Sw[Ft]=((65280&(fl=(61680&(fl=(52428&fl)>>>2|(13107&fl)<<2))>>>4|(3855&fl)<<4))>>>8|(255&fl)<<8)>>>1}var cc=function(e,t,n){for(var s=e.length,a=0,c=new Jn(t);s>a;++a)++c[e[a]-1];var u,f=new Jn(t);for(a=0;t>a;++a)f[a]=f[a-1]+c[a-1]<<1;for(u=new Jn(s),a=0;s>a;++a)u[a]=Sw[f[e[a]-1]++]>>>15-e[a];return u},va=new Dr(288);for(Ft=0;144>Ft;++Ft)va[Ft]=8;for(Ft=144;256>Ft;++Ft)va[Ft]=9;for(Ft=256;280>Ft;++Ft)va[Ft]=7;for(Ft=280;288>Ft;++Ft)va[Ft]=8;var Xd=new Dr(32);for(Ft=0;32>Ft;++Ft)Xd[Ft]=5;var C3=cc(va,9),E3=cc(Xd,5),kw=function(e){return(e/8>>0)+(7&e&&1)},jw=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var s=new(e instanceof Jn?Jn:e instanceof Ml?Ml:Dr)(n-t);return s.set(e.subarray(t,n)),s},Ms=function(e,t,n){var s=t/8>>0;e[s]|=n<<=7&t,e[s+1]|=n>>>8},Uo=function(e,t,n){var s=t/8>>0;e[s]|=n<<=7&t,e[s+1]|=n>>>8,e[s+2]|=n>>>16},Fp=function(e,t){for(var n=[],s=0;e.length>s;++s)e[s]&&n.push({s,f:e[s]});var a=n.length,c=n.slice();if(!a)return[new Dr(0),0];if(a==1){var u=new Dr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(B,D){return B.f-D.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,v=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=a-1;)f=n[n[v].f>n[p].f?p++:v++],h=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var y=c[0].s;for(s=1;a>s;++s)c[s].s>y&&(y=c[s].s);var b=new Jn(y+1),_=og(n[g-1],b,0);if(_>t){s=0;var j=0,E=_-t,k=1<<E;for(c.sort((function(B,D){return b[D.s]-b[B.s]||B.f-D.f}));a>s;++s){var A=c[s].s;if(t>=b[A])break;j+=k-(1<<_-b[A]),b[A]=t}for(j>>>=E;j>0;){var C=c[s].s;t>b[C]?j-=1<<t-b[C]++-1:++s}for(;s>=0&&j;--s){var L=c[s].s;b[L]==t&&(--b[L],++j)}_=t}return[new Dr(b),_]},og=function(e,t,n){return e.s==-1?Math.max(og(e.l,t,n+1),og(e.r,t,n+1)):t[e.s]=n},ay=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Jn(++t),s=0,a=e[0],c=1,u=function(h){n[s++]=h},f=1;t>=f;++f)if(e[f]==a&&f!=t)++c;else{if(!a&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(a),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(a);c=1,a=e[f]}return[n.subarray(0,s),t]},Fo=function(e,t){for(var n=0,s=0;t.length>s;++s)n+=e[s]*t[s];return n},cg=function(e,t,n){var s=n.length,a=kw(t+2);e[a]=255&s,e[a+1]=s>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var c=0;s>c;++c)e[a+c+4]=n[c];return 8*(a+4+s)},ly=function(e,t,n,s,a,c,u,f,h,p,g){Ms(t,g++,n),++a[256];for(var v=Fp(a,15),y=v[0],b=v[1],_=Fp(c,15),j=_[0],E=_[1],k=ay(y),A=k[0],C=k[1],L=ay(j),B=L[0],D=L[1],U=new Jn(19),F=0;A.length>F;++F)U[31&A[F]]++;for(F=0;B.length>F;++F)U[31&B[F]]++;for(var Y=Fp(U,7),O=Y[0],I=Y[1],T=19;T>4&&!O[sy[T-1]];--T);var le,Q,G,$,z=p+5<<3,re=Fo(a,va)+Fo(c,Xd)+u,me=Fo(a,y)+Fo(c,j)+u+14+3*T+Fo(U,O)+(2*U[16]+3*U[17]+7*U[18]);if(re>=z&&me>=z)return cg(t,g,e.subarray(h,h+p));if(Ms(t,g,1+(re>me)),g+=2,re>me){le=cc(y,b),Q=y,G=cc(j,E),$=j;var R=cc(O,I);for(Ms(t,g,C-257),Ms(t,g+5,D-1),Ms(t,g+10,T-4),g+=14,F=0;T>F;++F)Ms(t,g+3*F,O[sy[F]]);g+=3*T;for(var P=[A,B],Z=0;2>Z;++Z){var M=P[Z];for(F=0;M.length>F;++F)Ms(t,g,R[pe=31&M[F]]),g+=O[pe],pe>15&&(Ms(t,g,M[F]>>>5&127),g+=M[F]>>>12)}}else le=C3,Q=va,G=E3,$=Xd;for(F=0;f>F;++F)if(s[F]>255){var pe;Uo(t,g,le[257+(pe=s[F]>>>18&31)]),g+=Q[pe+257],pe>7&&(Ms(t,g,s[F]>>>23&31),g+=qg[pe]);var _e=31&s[F];Uo(t,g,G[_e]),g+=$[_e],_e>3&&(Uo(t,g,s[F]>>>5&8191),g+=Vg[_e])}else Uo(t,g,le[s[F]]),g+=Q[s[F]];return Uo(t,g,le[256]),g+Q[256]},T3=new Ml([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),A3=(function(){for(var e=new Ml(256),t=0;256>t;++t){for(var n=t,s=9;--s;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Hp=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function M3(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(y){for(var b=v,_=0;y.length>_;++_)b=A3[255&b^y[_]]^b>>>8;v=b},d(){return 4294967295^v}}})(),s=e.length;n.p(e);var a,c,u,f,h,p=(f=10+((a=t).filename&&a.filename.length+1||0),h=8,(function(v,y,b,_,j,E){var k=v.length,A=new Dr(_+k+5*(1+Math.floor(k/7e3))+j),C=A.subarray(_,A.length-j),L=0;if(!y||8>k)for(var B=0;k>=B;B+=65535){var D=B+65535;k>D?L=cg(C,L,v.subarray(B,D)):(C[B]=!0,L=cg(C,L,v.subarray(B,k)))}else{for(var U=T3[y-1],F=U>>>13,Y=8191&U,O=(1<<b)-1,I=new Jn(32768),T=new Jn(O+1),le=Math.ceil(b/3),Q=2*le,G=function(yt){return(v[yt]^v[yt+1]<<le^v[yt+2]<<Q)&O},$=new Ml(25e3),z=new Jn(288),re=new Jn(32),me=0,R=0,P=(B=0,0),Z=0,M=0;k>B;++B){var pe=G(B),_e=32767&B,Ce=T[pe];if(I[_e]=Ce,T[pe]=_e,B>=Z){var Ae=k-B;if((me>7e3||P>24576)&&Ae>423){L=ly(v,C,0,$,z,re,R,P,M,B-M,L),P=me=R=0,M=B;for(var ze=0;286>ze;++ze)z[ze]=0;for(ze=0;30>ze;++ze)re[ze]=0}var De=2,et=0,xe=Y,Pe=_e-Ce&32767;if(Ae>2&&pe==G(B-Pe))for(var ft=Math.min(F,Ae)-1,zt=Math.min(32767,B),bt=Math.min(258,Ae);zt>=Pe&&--xe&&_e!=Ce;){if(v[B+De]==v[B+De-Pe]){for(var Lt=0;bt>Lt&&v[B+Lt]==v[B+Lt-Pe];++Lt);if(Lt>De){if(De=Lt,et=Pe,Lt>ft)break;var dn=Math.min(Pe,Lt-2),st=0;for(ze=0;dn>ze;++ze){var fn=B-Pe+ze+32768&32767,yn=fn-I[fn]+32768&32767;yn>st&&(st=yn,Ce=fn)}}}Pe+=(_e=Ce)-(Ce=I[_e])+32768&32767}if(et){$[P++]=268435456|lg[De]<<18|iy[et];var je=31&lg[De],Oe=31&iy[et];R+=qg[je]+Vg[Oe],++z[257+je],++re[Oe],Z=B+De,++me}else $[P++]=v[B],++z[v[B]]}}L=ly(v,C,!0,$,z,re,R,P,M,B-M,L)}return jw(A,0,_+kw(L)+j)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,f,h)),g=p.length;return(function(v,y){var b=y.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>y.level?4:y.level==9?2:0,v[9]=3,y.mtime!=0&&Hp(v,4,Math.floor(new Date(y.mtime||Date.now())/1e3)),b){v[3]=8;for(var _=0;b.length>=_;++_)v[_+10]=b.charCodeAt(_)}})(p,t),Hp(p,g-8,n.d()),Hp(p,g-4,s),p}var R3=!!Tm||!!Em,Nw="text/plain",kd=!1,z3=(e,t)=>{var[n,s]=e.split("#"),[a,c]=n.split("?");if(!c)return e;var u=c.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return a+(u?"?"+u:"")+(s?"#"+s:"")},Cw=function(e,t,n){var s;n===void 0&&(n=!0);var[a,c]=e.split("?"),u=ye({},t),f=(s=c==null?void 0:c.split("&").map((p=>{var g,[v,y]=p.split("="),b=n&&(g=u[v])!==null&&g!==void 0?g:y;return delete u[v],v+"="+b})))!==null&&s!==void 0?s:[],h=(function(p,g){var v,y;g===void 0&&(g="&");var b=[];return Mt(p,(function(_,j){Se(_)||Se(j)||j==="undefined"||(v=encodeURIComponent((E=>E instanceof File)(_)?_.name:_.toString()),y=encodeURIComponent(j),b[b.length]=y+"="+v)})),b.join(g)})(u);return h&&f.push(h),a+"?"+f.join("&")},wl=(e,t)=>JSON.stringify(e,((n,s)=>typeof s=="bigint"?s.toString():s),t),oy=e=>{if(e.xt)return e.xt;var{data:t,compression:n}=e;if(t){if(n===ls.GZipJS){var s=M3((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new Dr(f.length+(f.length>>>1)),v=0,y=function(E){g[v++]=E},b=0;p>b;++b){if(v+5>g.length){var _=new Dr(v+8+(p-b<<1));_.set(g),g=_}var j=f.charCodeAt(b);128>j?y(j):2048>j?(y(192|j>>>6),y(128|63&j)):j>55295&&57344>j?(y(240|(j=65536+(1047552&j)|1023&f.charCodeAt(++b))>>>18),y(128|j>>>12&63),y(128|j>>>6&63),y(128|63&j)):(y(224|j>>>12),y(128|j>>>6&63),y(128|63&j))}return jw(g,0,v)})(wl(t)),{mtime:0});return{contentType:Nw,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(n===ls.Base64){var a=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(wl(t)),c=(f=>"data="+encodeURIComponent(typeof f=="string"?f:wl(f)))(a);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var u=wl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Ew=e=>{var t,n,s=()=>({url:z3(e.url,"compression"),encodedBody:oy(ye({},e,{compression:void 0,xt:void 0}))});try{t=oy(e)}catch(a){if(Lb(e.compression,Tl(e.url,"compression")))return we.error("Failed to gzip request body, sending uncompressed payload",a),s();throw a}return t&&Lb(e.compression,Tl(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Am(new Uint8Array(n)):ArrayBuffer.isView(n)&&Am(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(kd=!0,s()):{url:e.url,encodedBody:t}},cy=e=>{try{return Ew(e)}catch(t){return we.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},L3=(function(){var e=xn((function*(t){var n=wl(t.data),s=yield(function(c,u,f){return Mm.apply(this,arguments)})(n,Zt.DEBUG,{rethrow:!0});if(!s)return t;var a=yield s.arrayBuffer();return ye({},t,{xt:{contentType:Nw,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),uy=(e,t)=>Cw(e,{_:new Date().getTime().toString(),ver:Zt.JS_SDK_VERSION,compression:t}),jd=[];Em&&jd.push({transport:"fetch",method(e){var t,n=cy(e);if(n){var{url:s,encodedBody:a}=n,{contentType:c,body:u,estimatedSize:f}=a??{},h=new Headers;Mt(e.headers,(function(y,b){h.append(b,y)})),c&&h.append("Content-Type",c);var p=null,g=null;if(Cb){var v=new Cb;p={signal:v.signal,timeout:setTimeout((()=>{var y,b;y=e.timeout,(b=new Error("PostHog request timed out"+(y?" after "+y+"ms":""))).name="AbortError",v.abort(g=b)}),e.timeout)}}Em(s,ye({method:(e==null?void 0:e.method)||"GET",headers:h,keepalive:e.method==="POST"&&52428.8>(f||0),body:u,signal:(t=p)==null?void 0:t.signal},e.fetchOptions)).then((y=>y.text().then((b=>{var _={statusCode:y.status,text:b};if(y.status===200)try{_.json=JSON.parse(b)}catch(j){we.error(j)}e.callback==null||e.callback(_)})))).catch((y=>{y===g?we.warn(y):we.error(y),e.callback==null||e.callback({statusCode:0,error:y})})).finally((()=>p?clearTimeout(p.timeout):null))}}}),Tm&&jd.push({transport:"XHR",method(e){var t=cy(e);if(t){var n=new Tm,{url:s,encodedBody:a}=t;n.open(e.method||"GET",s,!0);var{contentType:c,body:u}=a??{};Mt(e.headers,(function(f,h){n.setRequestHeader(h,f)})),c&&n.setRequestHeader("Content-Type",c),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(f)}},n.send(u)}}}),Un!=null&&Un.sendBeacon&&jd.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:n}=Ew(e),{contentType:s,body:a}=n??{};if(!a)return;var c=a instanceof Blob?a:new Blob([a],{type:s});Un.sendBeacon(t,c)}catch{}}});var ug=3e3;class D3{constructor(t,n){this.br=!0,this._r=[],this.wr=cs((n==null?void 0:n.flush_interval_ms)||ug,250,5e3,we.createLogger("flush interval"),ug),this.kr=t}enqueue(t){this._r.push(t),this.Sr||this.Cr()}unload(){this.Ir();var t=this._r.length>0?this.Tr():{},n=Object.values(t);[...n.filter((s=>s.url.indexOf("/e")===0)),...n.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.Er(ye({},s,{transport:"sendBeacon"}))}))}enable(){this.br=!1,this.Cr()}Cr(){var t=this;this.br||(this.Sr=setTimeout((()=>{if(this.Ir(),this._r.length>0){var n=this.Tr(),s=function(){var c=n[a],u=new Date().getTime();c.data&&rt(c.data)&&Mt(c.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.Er(c)};for(var a in n)s()}}),this.wr))}Er(t){try{this.kr(t)}catch(n){we.error(n)}}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var t={};return Mt(this._r,(n=>{var s,a=n,c=(a?a.batchKey:null)||a.url;Se(t[c])&&(t[c]=ye({},a,{data:[]})),(s=t[c].data)==null||s.push(a.data)})),this._r=[],t}}var O3=["retriesPerformedSoFar"];class B3{constructor(t){this.Mr=!1,this.Pr=3e3,this._r=[],this._instance=t,this._r=[],this.Rr=!0,!Se(se)&&"onLine"in se.navigator&&(this.Rr=se.navigator.onLine,this.Or=()=>{this.Rr=!0,this.Lr()},this.Fr=()=>{this.Rr=!1},Xt(se,"online",this.Or),Xt(se,"offline",this.Fr))}get length(){return this._r.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,s=c5(t,O3);Os(n)&&(s.url=Cw(s.url,{retry_count:n})),this._instance._send_request(ye({},s,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.st(ye({retriesPerformedSoFar:n},s));a.statusCode===0&&we.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}s.callback==null||s.callback(a)}}))}st(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var s=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),g=Math.random()-.5;return Math.ceil(p+g*(p-h))})(n),a=Date.now()+s;this._r.push({retryAt:a,requestOptions:t});var c="Enqueued failed request for retry in "+s;navigator.onLine||(c+=" (Browser is offline)"),we.warn(c),this.Mr||(this.Mr=!0,this.Ar())}Ar(){if(this.$r&&clearTimeout(this.$r),this._r.length===0)return this.Mr=!1,void(this.$r=void 0);this.$r=setTimeout((()=>{this.Rr&&this._r.length>0&&this.Lr(),this.Ar()}),this.Pr)}Lr(){var t=Date.now(),n=[],s=this._r.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this._r=n,s.length>0)for(var{requestOptions:a}of s)this.retriableRequest(a)}unload(){for(var{requestOptions:t}of(this.$r&&(clearTimeout(this.$r),this.$r=void 0),this.Mr=!1,Se(se)||(this.Or&&(se.removeEventListener("online",this.Or),this.Or=void 0),this.Fr&&(se.removeEventListener("offline",this.Fr),this.Fr=void 0)),this._r))try{this._instance._send_request(ye({},t,{transport:"sendBeacon"}))}catch(n){we.error(n)}this._r=[]}}class P3{constructor(t){this.Dr=()=>{var n,s,a,c;this.Nr||(this.Nr={});var u=this.scrollElement(),f=this.scrollY(),h=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=f+((u==null?void 0:u.clientHeight)||0),g=(u==null?void 0:u.scrollHeight)||0;this.Nr.lastScrollY=Math.ceil(f),this.Nr.maxScrollY=Math.max(f,(n=this.Nr.maxScrollY)!==null&&n!==void 0?n:0),this.Nr.maxScrollHeight=Math.max(h,(s=this.Nr.maxScrollHeight)!==null&&s!==void 0?s:0),this.Nr.lastContentY=p,this.Nr.maxContentY=Math.max(p,(a=this.Nr.maxContentY)!==null&&a!==void 0?a:0),this.Nr.maxContentHeight=Math.max(g,(c=this.Nr.maxContentHeight)!==null&&c!==void 0?c:0)},this._instance=t}get qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Nr}resetContext(){var t=this.Nr;return setTimeout(this.Dr,0),t}startMeasuringScrollPosition(){Xt(se,"scroll",this.Dr,{capture:!0}),Xt(se,"scrollend",this.Dr,{capture:!0}),Xt(se,"resize",this.Dr)}scrollElement(){if(!this.qr)return se==null?void 0:se.document.documentElement;var t=rt(this.qr)?this.qr:[this.qr];for(var n of t){var s=se==null?void 0:se.document.querySelector(n);if(s)return s}}jr(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.qr){var s=this.scrollElement();return s&&s[n]||0}return se?t==="y"?se.scrollY||se.pageYOffset||se.document.documentElement.scrollTop||0:se.scrollX||se.pageXOffset||se.document.documentElement.scrollLeft||0:0}scrollY(){return this.jr("y")}scrollX(){return this.jr("x")}}var $3=e=>xw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class dy{constructor(t,n,s,a){this.Br=c=>{var u=this.Hr();if(!u||u.sessionId!==c){var f={sessionId:c,props:this.Ur(this._instance)};this.zr.register({[Zm]:f})}},this._instance=t,this.Vr=n,this.zr=s,this.Ur=a||$3,this.Vr.onSessionId(this.Br)}Hr(){return this.zr.props[Zm]}getSetOnceProps(){var t,n=(t=this.Hr())==null?void 0:t.props;return n?"r"in n?vw(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Mt(Ug(this.getSetOnceProps()),((n,s)=>{s==="$current_url"&&(s="url"),t["$session_entry_"+Rm(s)]=n})),t}}class Gg{constructor(){this.Wr={}}on(t,n){return this.Wr[t]||(this.Wr[t]=[]),this.Wr[t].push(n),()=>{this.Wr[t]=this.Wr[t].filter((s=>s!==n))}}emit(t,n){for(var s of this.Wr[t]||[])s(n);for(var a of this.Wr["*"]||[])a(t,n)}}var Ho=Gt("[SessionId]");class fy{on(t,n){return this.Gr.on(t,n)}constructor(t,n,s){var a;if(this.Zr=null,this.Qr=[],this.Jr=void 0,this.Yr=!1,this.Gr=new Gg,this.Kr=(p,g)=>!(!Os(p)||!Os(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Us)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=t.config,this.zr=t.persistence,this.Xr=void 0,this.ei=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ti=n||$s,this.ri=s||$s;var c=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*cs(this.Se.session_idle_timeout_seconds||1800,60,36e3,Ho.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ii(),this.ni="ph_"+c+"_window_id",this.si="ph_"+c+"_primary_window_exists",this.oi()){var u=Cn.F(this.ni),f=Cn.F(this.si);u&&!f?this.Xr=u:Cn.P(this.ni),Cn.q(this.si,!0)}if((a=this.Se.bootstrap)!=null&&a.sessionID)try{var h=(p=>{var g=this.Se.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.ai(this.Se.bootstrap.sessionID,new Date().getTime(),h)}catch(p){Ho.error("Invalid sessionID in bootstrap",p)}this.li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Se(this.Qr)&&(this.Qr=[]),this.Qr.push(t),this.ei&&t(this.ei,this.Xr),()=>{this.Qr=this.Qr.filter((n=>n!==t))}}oi(){return this.Se.persistence!=="memory"&&!this.zr.Vt&&Cn.N()}ui(t){t!==this.Xr&&(this.Xr=t,this.oi()&&Cn.q(this.ni,t))}hi(){return this.Xr?this.Xr:this.oi()?Cn.F(this.ni):null}di(t){var n=this.Zr;return!Fn(n)&&!Fn(t)&&5e3>Math.abs(t-n)}ai(t,n,s){var a=n!==this._sessionActivityTimestamp,c=!(t!==this.ei||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=n,this.ei=t,c&&!a||c&&this.di(n)||(this.Zr=n,this.zr.register({[_l]:[n,t,s]}))}ci(){var t,n=(t=this.Se)==null?void 0:t.persistence_save_debounce_ms;return Os(n)&&n>0}vi(){this.ci()?this.zr.refreshKey(_l):(this.zr.flush(),this.zr.load())}fi(){var t;if(!Fn(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Zr){this.vi();var[,n,s]=this.pi();n===this.ei&&s===this._sessionStartTimestamp&&(this.Zr=this._sessionActivityTimestamp,this.zr.register({[_l]:[this._sessionActivityTimestamp,(t=this.ei)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.zr.flush())}}gi(){var[t]=this.pi(),n=Os(t)?t:0,s=Os(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,s)}mi(t){return this.vi(),this.Kr(t,this.gi())}pi(){var t=this.zr.props[_l];return rt(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Zr=null,clearTimeout(this.yi),this.yi=void 0,this.ai(null,null,null)}destroy(){this.Yr=!0,this.fi(),clearTimeout(this.yi),this.yi=void 0,this.Jr&&se&&(se.removeEventListener(Id,this.Jr,{capture:!1}),this.Jr=void 0),this.Qr=[]}li(){this.Jr=()=>{this.fi(),this.oi()&&Cn.P(this.si)},Xt(se,Id,this.Jr,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Se.cookieless_mode===Us)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=n||new Date().getTime(),[,a,c]=this.pi(),u=this.gi(),f=this.hi(),h=Os(c)&&Math.abs(s-c)>864e5,p=!1,g=!1,v=!a,y=a,b=!v&&!t&&this.Kr(s,u);b&&((b=this.mi(s))||Ho.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,c]=this.pi()),v||b||h?(a=this.ti(),f=this.ri(),Ho.info("new session ID generated",{sessionId:a,windowId:f,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),c=s,p=!0):(f||(f=this.ri(),p=!0),(g=a!==y)&&(Ho.info("adopted cross-tab session id",{sessionId:a,windowId:f}),p=!0));var _=Os(u)&&t&&!h?u:s,j=Os(c)?c:new Date().getTime();this.ui(f),this.ai(a,_,j),t||this.ii();var E={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:g};return p&&this.Qr.forEach((k=>k(a,f,E))),{sessionId:a,windowId:f,sessionStartTimestamp:j,changeReason:p?E:void 0,lastActivityTimestamp:u}}ii(){this.Yr||(clearTimeout(this.yi),this.yi=setTimeout((()=>{if(!this.Yr)if(this.mi(new Date().getTime())){var t=this.ei;this.resetSessionId(),this.Gr.emit("forcedIdleReset",{idleSessionId:t})}else this.ii()}),1.1*this.sessionTimeoutMs))}}var Tw=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Ob(n,t))return!0;try{var s=e==null?void 0:e.userAgentData;if(s!=null&&s.brands&&s.brands.some((a=>Ob(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function Aw(){return(Aw=xn((function*(){var e=Un==null?void 0:Un.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return Ct(n)&&n.length>0?n:void 0}catch(s){return void we.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}}))).apply(this,arguments)}var Qd=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function hy(e,t,n){return wl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Mw={exact:(e,t)=>t.some((n=>e.some((s=>n===s)))),is_not:(e,t)=>t.every((n=>e.every((s=>n!==s)))),regex:(e,t)=>t.some((n=>e.some((s=>Qd(n,s))))),not_regex:(e,t)=>t.every((n=>e.every((s=>!Qd(n,s))))),icontains:(e,t)=>t.map(cd).some((n=>e.map(cd).some((s=>n.includes(s))))),not_icontains:(e,t)=>t.map(cd).every((n=>e.map(cd).every((s=>!n.includes(s))))),gt:(e,t)=>t.some((n=>{var s=parseFloat(n);return!isNaN(s)&&e.some((a=>s>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var s=parseFloat(n);return!isNaN(s)&&e.some((a=>s<parseFloat(a)))}))},cd=e=>e.toLowerCase();function Rw(e,t){return!e||Object.entries(e).every((n=>{var[s,a]=n,c=t==null?void 0:t[s];if(Se(c)||Fn(c))return!1;var u=[String(c)],f=Mw[a.operator];return!!f&&f(a.values,u)}))}var dg="custom",py="i.posthog.com",U3=/^\/static\//;class F3{constructor(t){this.bi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+py,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.bi[this.apiHost]||(this.bi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":dg),this.bi[this.apiHost]}wi(t){if(U3.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var s=this.wi(n);if(s)return""+s+n}if(this.region===dg)return this.apiHost+n;var a=py+n;switch(t){case"assets":return"https://"+this.region+"-assets."+a;case"api":return"https://"+this.region+"."+a}}}var Nt=Gt("[Surveys]"),fg="seenSurvey_",H3=[$p.Popover,$p.Widget,$p.API],I3={ignoreConditions:!1,ignoreDelay:!1,displayType:ag.Popover},q3=Gt("[PostHog ExternalIntegrations]"),V3={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class G3{constructor(t){this._instance=t}Mt(t,n){var s;(s=Le.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,t,(a=>{if(a)return q3.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(u){var f,h,p;!a||(f=Le.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[u]||t.Mt(V3[u],(()=>{var g;(g=Le.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!a&&(h=Le.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((p=Le.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.stop())};for(var[s,a]of Object.entries((c=this._instance.config.integrations)!==null&&c!==void 0?c:{})){var c;n(s)}}}var hl,uc={},Ip=0,Kd=()=>{},my='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Io="Surveys module not available",gy="sanitize_properties is deprecated. Use before_send instead",zw="Invalid value for property_denylist config: ",bl="posthog",Lw=!R3&&(Zn==null?void 0:Zn.indexOf("MSIE"))===-1&&(Zn==null?void 0:Zn.indexOf("Mozilla"))===-1,xy=e=>{var t;return ye({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:XC(Ne==null?void 0:Ne.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kd,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:nn&&Ct(nn==null?void 0:nn.search)&&nn.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(se==null||(t=se.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){we.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:rg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ug},error_tracking:{},_onCapture:Kd},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:l3,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(e))},Y3=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],vy=e=>{var t={};for(var[n,s]of Y3)Se(e[n])||(t[s]=e[n]);var a=Bt({},t,e),c=e.__preview_external_dependency_versioned_paths;return Se(c)||(Se(e.strict_script_versioning)&&(a.strict_script_versioning=!!c),Ct(c)&&Se(e.asset_host)&&(a.asset_host=c)),rt(e.property_blacklist)&&(Se(e.property_denylist)?a.property_denylist=e.property_blacklist:rt(e.property_denylist)?a.property_denylist=[...e.property_blacklist,...e.property_denylist]:we.error(zw+e.property_denylist)),a};class W3{constructor(){this.__forceAllowLocalhost=!1}get xi(){return this.__forceAllowLocalhost}set xi(t){we.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class zr{ki(t,n){if(t){var s=this.Si.indexOf(t);s!==-1&&this.Si.splice(s,1)}return this.Si.push(n),n.initialize==null||n.initialize(),n}Ci(){return this.config.cookieless_mode===Us||this.config.cookieless_mode===fa&&this.consent.isRejected()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new W3,this.Ii=!1,this.version=Zt.LIB_VERSION,this.Ti=new Gg,this.Si=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xy(),this.SentryIntegration=g3,this.sentryIntegration=s=>(function(a,c){var u=fw(a,c);return{name:dw,processEvent:f=>u(f)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ei=!1,this.Mi=null,this.Pi=null,this.Ri=null,this.scrollManager=new P3(this),this.pageViewManager=new ey(this),this.rateLimiter=new N3(this),this.requestRouter=new F3(this),this.consent=new n3(this),this.externalIntegrations=new G3(this);var n=(t=zr.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(s,a,c)=>{var u=Ct(s)?{[s]:a}:s;this.setPersonProperties(u),c==null||c({})},set_once:(s,a,c)=>{var u=Ct(s)?{[s]:a}:s;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",(s=>we.info('send "'+(s==null?void 0:s.event)+'"',s)))}init(t,n,s){if(s&&s!==bl){var a,c=(a=uc[s])!==null&&a!==void 0?a:new zr;return c._init(t,n,s),uc[s]=c,uc[bl][s]=c,c}return this._init(t,n,s)}_init(t,n,s){var a,c;n===void 0&&(n={});var u=Ct(t)?t.trim():"";if(!u)return we.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Oi(n.debug),this.Li=n,this.Fi=[],n.person_profiles?this.Pi=n.person_profiles:n.process_person&&(this.Pi=n.process_person);var f=xy(n.defaults),h=vy(n),p=Bt({},f,h,{name:s,token:u});Ut(f.rageclick)&&Ut(h.rageclick)&&(p.rageclick=Bt({},f.rageclick,h.rageclick)),Ut(f.session_recording)&&Ut(h.session_recording)&&(p.session_recording=Bt({},f.session_recording,h.session_recording)),this.set_config(p),this.config.on_xhr_error&&we.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:ls.GZipJS;var g=this.Ai();this.persistence=new Pp(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Pp(ye({},this.config,{persistence:"sessionStorage"}),g,!1);var v=ye({},this.persistence.props),y=ye({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.$i=new D3((L=>this.Di(L)),this.config.request_queue_config),this.Ni=new B3(this),this.__request_queue=[];var b=this.Ci();if(b||(this.sessionManager=new fy(this),this.sessionPropsManager=new dy(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(we.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.qi(b)}),0)):(we.info("Initializing extensions synchronously"),this.qi(b)),Zt.DEBUG=Zt.DEBUG||this.config.debug,Zt.DEBUG&&we.info("Starting in debug mode",{this:this,config:n,thisC:ye({},this.config),p:v,s:y}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=ye({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var _=n.bootstrap.distinctID,j=this.get_distinct_id(),E=this.persistence.get_property(qr);if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&E===cl)this.identify(_);else if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&E===ul)we.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var k=this.config.get_device_id($s()),A=n.bootstrap.isIdentifiedID?k:_;this.persistence.set_property(qr,n.bootstrap.isIdentifiedID?ul:cl),this.register({distinct_id:_,$device_id:A})}}if(b)this.register_once({distinct_id:rd,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id($s());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(qr,cl)}return Xt(se,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(L,B){var D=L.config.segment;if(!D)return B();(function(U,F){var Y=U.config.segment;if(!Y)return F();var O=T=>{var le=()=>T.anonymousId()||$s();U.config.get_device_id=le,T.id()&&(U.register({distinct_id:T.id(),$device_id:le()}),U.persistence.set_property(qr,ul)),F()},I=Y.user();"then"in I&&as(I.then)?I.then(O):O(I)})(L,(()=>{D.register((U=>{typeof Promise<"u"&&Promise.resolve||Bp.warn("This browser does not have Promise support, and can not use the segment integration");var F=(Y,O)=>{if(!O)return Y;Y.event.userId||Y.event.anonymousId===U.get_distinct_id()||(Bp.info("No userId set, resetting PostHog"),U.reset()),Y.event.userId&&Y.event.userId!==U.get_distinct_id()&&(Bp.info("UserId set, identifying with PostHog"),U.identify(Y.event.userId));var I=U.calculateEventProperties(O,Y.event.properties);return Y.event.properties=Object.assign({},I,Y.event.properties),Y};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:Y=>F(Y,Y.event.event),page:Y=>F(Y,vl),identify:Y=>F(Y,Lp),screen:Y=>F(Y,"$screen")}})(L)).then((()=>{B()}))}))})(this,(()=>this.ji())):this.ji(),as(this.config._onCapture)&&this.config._onCapture!==Kd&&(we.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(L=>this.config._onCapture(L.event,L)))),this.config.ip&&we.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Aw.apply(this,arguments)})().then((L=>{L&&this.register({[Rp]:L})})).catch(Kd),this}qi(t){var n,s,a,c,u,f,h,p=performance.now(),g=ye({},zr.__defaultExtensionClasses,this.config.__extensionClasses),v=[];g.featureFlags&&this.Si.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new g.featureFlags(this)),g.exceptions&&this.Si.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new g.exceptions(this)),g.historyAutocapture&&this.Si.push(this.historyAutocapture=new g.historyAutocapture(this)),g.tracingHeaders&&this.Si.push(this.tracingHeaders=new g.tracingHeaders(this)),g.siteApps&&this.Si.push(this.siteApps=new g.siteApps(this)),g.sessionRecording&&!t&&this.Si.push(this.sessionRecording=new g.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),g.autocapture&&this.Si.push(this.autocapture=new g.autocapture(this)),g.surveys&&this.Si.push(this.surveys=(a=this.surveys)!==null&&a!==void 0?a:new g.surveys(this)),g.logs&&this.Si.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new g.logs(this)),g.conversations&&this.Si.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new g.conversations(this)),g.productTours&&this.Si.push(this.productTours=new g.productTours(this)),g.heatmaps&&this.Si.push(this.heatmaps=new g.heatmaps(this)),g.webVitalsAutocapture&&this.Si.push(this.webVitalsAutocapture=new g.webVitalsAutocapture(this)),g.exceptionObserver&&this.Si.push(this.exceptionObserver=new g.exceptionObserver(this)),g.deadClicksAutocapture&&this.Si.push(this.deadClicksAutocapture=new g.deadClicksAutocapture(this,m3)),g.toolbar&&this.Si.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new g.toolbar(this)),g.experiments&&this.Si.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new g.experiments(this)),this.Si.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.Bi){var y=this.Bi;this.Bi=void 0,this.pr(y)}})),this.Hi(v,p)}Hi(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Hi(t,n)}),0);var s=t.shift();if(s)try{s()}catch(c){we.error("Error initializing extension:",c)}}var a=Math.round(performance.now()-n);this.register_for_session({[X5]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Q5]:a}),this.config.__preview_deferred_init_extensions&&we.info("PostHog extensions initialized ("+a+"ms)")}pr(t){var n;if(!Ne||!Ne.body)return we.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Bi=t),this.Ui=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(t.supportedCompression,ls.GZipJS)?ls.GZipJS:Ie(t.supportedCompression,ls.Base64)?ls.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:rg}),this.Si.forEach((s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(t)))}ji(){try{this.config.loaded(this)}catch(s){we.critical("`loaded` function failed",s)}if(this.zi(),this.config.internal_or_test_user_hostname&&nn!=null&&nn.hostname){var t=nn.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ci())&&this.Vi()}),1),this.Wi=new yw(this),this.Wi.load()}zi(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.$i)==null||t.enable())}_dom_loaded(){this.is_capturing()&&sd(this.__request_queue,(t=>this.Di(t))),this.__request_queue=[],this.zi()}_handle_unload(){var t,n,s,a;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),this.config.request_batching?(this.Gi()&&this.capture(zp),(n=this.logs)==null||n.flushLogs("sendBeacon"),(s=this.$i)==null||s.unload(),(a=this.Ni)==null||a.unload()):this.Gi()&&this.capture(zp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Lw?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=ye({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(Se(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var s,a,c,u=ye({},n);u.timeout=u.timeout||6e4,u.url=uy(u.url,u.compression);var f=(s=u.transport)!==null&&s!==void 0?s:"fetch",h=jd.filter((g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport))),p=(a=(c=(function(g,v){for(var y=0;g.length>y;y++)if(g[y].transport===f)return g[y]})(h))==null?void 0:c.method)!==null&&a!==void 0?a:h[0].method;if(!p)throw new Error("No available transport method");f!=="sendBeacon"&&u.data&&u.compression===ls.GZipJS&&JN&&typeof Promise<"u"&&!kd?L3(u).then((g=>{p(g)})).catch((g=>{if(Db(g))return kd=!0,void p(ye({},u,{compression:void 0,url:uy(n.url,void 0)}));(v=>{if(!v||typeof v!="object")return!1;var y="name"in v?String(v.name):"";return Db(v)||y===u5})(g)&&(kd=!0),p(u)})):p(u)})(ye({},t,{callback:n=>{var s,a;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(s=(a=this.config).on_request_error)==null||s.call(a,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Di(t){this.Ni?this.Ni.retriableRequest(t):this._send_request(t)}_execute_array(t){Ip++;try{var n,s=[],a=[],c=[];sd(t,(f=>{if(f)if(rt(n=f[0]))c.push(f);else if(as(f))try{f.call(this)}catch(h){we.error("Error executing queued PostHog call",f,h)}else rt(f)&&n==="alias"?s.push(f):rt(f)&&n.indexOf("capture")!==-1&&as(this[n])?c.push(f):a.push(f)}));var u=function(f,h){sd(f,(function(p){try{if(rt(p[0])){var g=h;Mt(p,(function(v){g=g[v[0]].apply(g,v.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(v){we.error("Error executing queued PostHog call",p,v)}}))};u(s,this),u(a,this),u(c,this)}finally{Ip--}}push(t){if(Ip>0&&rt(t)&&Ct(t[0])){var n=zr.prototype[t[0]];as(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,s){var a,c,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.$i){if(this.is_capturing())if(!Se(t)&&Ct(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var g=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){n!=null&&n.$current_url&&!Ct(n==null?void 0:n.$current_url)&&(we.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||s!=null&&s.Zi||we.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var v=new Date,y=(s==null?void 0:s.timestamp)||v,b=Ub(s==null?void 0:s.uuid,$s),_={uuid:b,event:t,properties:this.calculateEventProperties(t,n||{},y,b)};t===vl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens),s!=null&&s.$set&&(_.$set=s==null?void 0:s.$set);var j=s==null?void 0:s.$unset;j&&(_.$unset=j);var E,k,A,C=this.Qi(s==null?void 0:s.$set_once,t!==Ib,t===Lp);if(C&&(_.$set_once=C),s!=null&&s._noTruncate||(c=this.config.properties_string_max_length,u=_,f=O=>Ct(O)?O.slice(0,c):O,h=new Set,_=(function O(I,T){return I!==Object(I)?f?f(I):I:h.has(I)?void 0:(h.add(I),rt(I)?(le=[],sd(I,(Q=>{le.push(O(Q))}))):(le={},Mt(I,((Q,G)=>{h.has(Q)||(le[G]=O(Q))}))),le);var le})(u)),_.timestamp=y,Se(s==null?void 0:s.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),t===Fs.DISMISSED||t===Fs.SENT){var L=n==null?void 0:n[Up.SURVEY_ID],B=n==null?void 0:n[Up.SURVEY_ITERATION];(O=>{try{var I=(T=>((le,Q)=>{var G=""+fg+Q.id;return Q.current_iteration&&Q.current_iteration>0&&(G=""+fg+Q.id+"_"+Q.current_iteration),G})(0,T))(O);if(localStorage.getItem(I))return;localStorage.setItem(I,"true")}catch(T){Nt.error("Failed to persist survey seen state",T)}})({id:L,current_iteration:B}),_.$set=ye({},_.$set,{[(E={id:L,current_iteration:B},k=t===Fs.SENT?"responded":"dismissed",A="$survey_"+k+"/"+E.id,E.current_iteration&&E.current_iteration>0&&(A="$survey_"+k+"/"+E.id+"/"+E.current_iteration),A)]:!0})}else t===Fs.SHOWN&&(_.$set=ye({},_.$set,{[Up.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===j3.SHOWN){var D=n==null?void 0:n[ny.TOUR_TYPE];D&&(_.$set=ye({},_.$set,{[ny.TOUR_LAST_SEEN_DATE+"/"+D]:new Date().toISOString()}))}var U=ye({},_.properties.$set,_.$set);if(ji(U)||this.setPersonPropertiesForFlags(U),!Qe(this.config.before_send)){var F=this.it(_);if(!F)return;(_=F).uuid=Ub(_.uuid,$s)}this.Ti.emit("eventCaptured",_);var Y={method:"POST",url:(a=s==null?void 0:s._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:s==null?void 0:s._batchKey,transport:s==null?void 0:s.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.Di(Y):this.$i.enqueue(Y),_}we.critical("This capture call is ignored due to client rate limiting.")}}else we.error("No event name provided to posthog.capture")}else we.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,s,a,c){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return n;var u=c?void 0:this.persistence.remove_event_timer(t),f=ye({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.Ci()&&(f.$cookieless_mode=!0),t==="$snapshot"){var h=ye({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!Ct(f.distinct_id)&&!Hn(f.distinct_id)||zm(f.distinct_id))&&we.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(k,A,C,L){var B,D,U,F;if(L===void 0&&(L=!1),!Zn)return{};var Y,O,I,T,le,Q,G,$,z,re=k?[...Al,...A||[]]:[],[me,R]=(function(pe){for(var _e=0;Pb.length>_e;_e++){var[Ce,Ae]=Pb[_e],ze=Ce.exec(pe),De=ze&&(as(Ae)?Ae(ze,pe):Ae);if(De)return De}return["",""]})(Zn),P=(Y=typeof navigator<"u"?navigator:void 0)!=null&&Y.brave?{brave:!0}:{},Z={detectGoogleSearchApp:C},M=Bt(Ug({$os:me,$os_version:R,$browser:z5(Zn,navigator.vendor,P,Z),$device:$b(Zn),$device_type:(I=Zn,T={userAgentDataPlatform:(B=navigator)==null||(B=B.userAgentData)==null?void 0:B.platform,maxTouchPoints:(D=navigator)==null?void 0:D.maxTouchPoints,screenWidth:se==null||(U=se.screen)==null?void 0:U.width,screenHeight:se==null||(F=se.screen)==null?void 0:F.height,devicePixelRatio:se==null?void 0:se.devicePixelRatio},z=$b(I),z===m5||z===p5||z==="Kobo"||z==="Kindle Fire"||z===E5?Nl:z===vc||z===kl||z===bc||z===Dm?"Console":z===x5?"Wearable":z?hr:(T==null?void 0:T.userAgentDataPlatform)==="Android"&&((le=T==null?void 0:T.maxTouchPoints)!==null&&le!==void 0?le:0)>0?600>Math.min((Q=T==null?void 0:T.screenWidth)!==null&&Q!==void 0?Q:0,(G=T==null?void 0:T.screenHeight)!==null&&G!==void 0?G:0)/(($=T==null?void 0:T.devicePixelRatio)!==null&&$!==void 0?$:1)?hr:Nl:"Desktop"),$timezone:bw(),$timezone_offset:_3()}),{$current_url:wc(L?Ei(nn==null?void 0:nn.href):nn==null?void 0:nn.href,re,Sc),$host:nn==null?void 0:nn.host,$pathname:nn==null?void 0:nn.pathname,$raw_user_agent:Zn.length>1e3?Zn.substring(0,997)+"...":Zn,$browser_version:vC(Zn,navigator.vendor,P,Z),$browser_language:ty(),$browser_language_prefix:(O=ty(),typeof O=="string"?O.split("-")[0]:void 0),$screen_height:se==null?void 0:se.screen.height,$screen_width:se==null?void 0:se.screen.width,$viewport_height:se==null?void 0:se.innerHeight,$viewport_width:se==null?void 0:se.innerWidth,$lib:Zt.LIB_NAME,$lib_version:Zt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Zt.SDK_DIST_CHANNEL&&(M.$sdk_dist_channel=Zt.SDK_DIST_CHANNEL),M})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var{sessionId:v,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(c,s.getTime());f.$session_id=v,f.$window_id=y}this.sessionPropsManager&&Bt(f,this.sessionPropsManager.getSessionProps());try{var b;this.sessionRecording&&Bt(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(b=this.Ni)==null?void 0:b.length}catch(k){f.$sdk_debug_error_capturing_properties=String(k)}if(this.requestRouter.region===dg&&(f.$lib_custom_api_host=this.config.api_host),p=t!==vl||c?t!==zp||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,a),f=Bt(f,p),t===vl&&Ne&&(f.title=Ne.title),!Se(u)){var _=s.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}Zn&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser"),(f=Bt({},g,this.persistence.properties(),this.sessionPersistence.properties(),f)).$is_identified=this._isIdentified(),rt(this.config.property_denylist)?Mt(this.config.property_denylist,(function(k){delete f[k]})):we.error(zw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var j=this.config.sanitize_properties;j&&(we.error(gy),f=j(f,t));var E=this.Ji();return f.$process_person_profile=E,E&&!c&&this.Yi("_calculate_event_properties"),f}Qi(t,n,s){var a;if(n===void 0&&(n=!0),s===void 0&&(s=!1),!this.persistence||!this.Ji()||this.Ii&&!s)return t;var c=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),f=Bt({},c,u||{},t||{}),h=this.config.sanitize_properties;return h&&(we.error(gy),f=h(f,"$set_once")),n&&(this.Ii=!0),ji(f)?void 0:f}register(t,n){var s;(s=this.persistence)==null||s.register(t,n)}register_once(t,n,s){var a;(a=this.persistence)==null||a.register_once(t,n,s)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Ki(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var s;return(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(t,n)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,s){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,s)}updateEarlyAccessFeatureEnrollment(t,n,s){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,s)}getEarlyAccessFeatures(t,n,s){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,s)}on(t,n){return this.Ti.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Io}),()=>{})}onSessionId(t){var n,s;return(n=(s=this.sessionManager)==null?void 0:s.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:Io})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Io})}renderSurvey(t,n){var s;(s=this.surveys)==null||s.renderSurvey(t,n)}displaySurvey(t,n){var s;n===void 0&&(n=I3),(s=this.surveys)==null||s.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,s;return(n=(s=this.surveys)==null?void 0:s.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:Io}}canRenderSurveyAsync(t,n){var s,a;return n===void 0&&(n=!1),(s=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Io})}Xi(t){return!t||zm(t)?(we.critical("Unique user id has not been set in posthog.identify"),!1):t===rd?(we.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(we.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,s){if(!this.__loaded||!this.persistence)return we.uninitializedWarning("posthog.identify");if(Hn(t)&&(t=t.toString(),we.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Xi(t)&&this.Yi("posthog.identify")){var a=this.get_distinct_id();this.register({$user_id:t}),this.get_property($d)||this.register_once({$had_persisted_distinct_id:!0,$device_id:a},""),t!==a&&t!==this.get_property(Zo)&&(this.unregister(Zo),this.register({distinct_id:t}));var c,u=(this.persistence.get_property(qr)||cl)===cl;t!==a&&u?(this.persistence.set_property(qr,ul),this.setPersonPropertiesForFlags({$set:n||{},$set_once:s||{}},!1),this.capture(Lp,{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:s||{}}),this.Ri=hy(t,n,s),(c=this.featureFlags)==null||c.setAnonymousDistinctId(a)):(n||s)&&this.setPersonProperties(n,s),t!==a&&(this.reloadFeatureFlags(),this.unregister(lc))}}setPersonProperties(t,n){if((t||n)&&this.Yi("posthog.setPersonProperties")){var s=hy(this.get_distinct_id(),t,n);this.Ri!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Ri=s):we.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,s=(rt(t)?t:[t]).filter((a=>Ct(a)&&a.length>0));s.length!==0&&this.Yi("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Ri=null)}group(t,n,s){if(t&&n){var a=this.getGroups(),c=a[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ye({},a,{[t]:n})}),c||s){var u={$group_type:t,$group_key:n};s&&(u.$group_set=s),this.capture(Ib,u)}s&&this.setGroupPropertiesForFlags({[t]:s}),c&&!s&&this.reloadFeatureFlags()}else we.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var s;n===void 0&&(n=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var s;n===void 0&&(n=!0),this.Yi("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,s,a,c,u,f,h,p,g;if(we.info("reset"),!this.__loaded)return we.uninitializedWarning("posthog.reset");var v,y=this.get_property($d),b=this.get_property(Rp),_=this.get_property(ma);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(s=this.sessionPersistence)==null||s.clear(),Se(_)||(v=this.persistence)==null||v.register({[ma]:_}),(a=this.surveys)==null||a.reset(),(c=this.Wi)==null||c.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.logs)==null||h.reset(),(p=this.persistence)==null||p.set_property(qr,cl),(g=this.sessionManager)==null||g.resetSessionId(),this.Ri=null,this.config.cookieless_mode===Us)this.register_once({distinct_id:rd,$device_id:null},"");else{var j=this.config.get_device_id($s());this.register_once({distinct_id:j,$device_id:t?j:y},""),t||Se(b)||this.register({[Rp]:b})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,n){var s;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(s=this.conversations)==null||s.en()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.tn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&s){var c,u=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!s)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(H5)?(we.critical("Attempting to create alias for existing People user - aborting."),-2):this.Yi("posthog.alias")?(Se(n)&&(n=this.get_distinct_id()),t!==n?(this.Ki(Zo,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(we.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ye({},this.config);if(Ut(t)){var s,a,c,u,f,h,p,g,v,y,b;Bt(this.config,vy(t));var _=this.Ai();(s=this.persistence)==null||s.update_config(this.config,n,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Pp(ye({},this.config,{persistence:"sessionStorage"}),_,!1);var j=this.Oi(this.config.debug);us(j)&&(this.config.debug=j),us(this.config.debug)&&(this.config.debug?(Zt.DEBUG=!0,At.N()&&At.q("ph_debug",!0),we.info("set_config",{config:t,oldConfig:n,newConfig:ye({},this.config)})):(Zt.DEBUG=!1,At.N()&&At.P("ph_debug"))),(a=this.exceptionObserver)==null||a.onConfigChange(),(c=this.exceptions)==null||c.onConfigChange(),(u=this.sessionRecording)==null||u.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(p=this.heatmaps)==null||p.startIfEnabled(),(g=this.exceptionObserver)==null||g.startIfEnabledOrStop(),(v=this.deadClicksAutocapture)==null||v.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.rn(),(b=this.externalIntegrations)==null||b.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Zt.LIB_NAME=t,Zt.LIB_VERSION=n}startSessionRecording(t){var n,s,a,c,u,f=t===!0,h={sampling:f||!(t==null||!t.sampling),linked_flag:f||!(t==null||!t.linked_flag),url_trigger:f||!(t==null||!t.url_trigger),event_trigger:f||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),h.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),h.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),h.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var s=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(ye({},a,n))}}addExceptionStep(t,n){var s;(s=this.exceptions)==null||s.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:zr.nn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,s;return(n=(s=this.toolbar)==null?void 0:s.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:bl;return n!==bl&&(n=bl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(qr))===ul||((n=this.sessionPersistence)==null?void 0:n.get_property(qr))===ul}Ji(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===rg&&!this._isIdentified()&&ji(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Zo])&&((n=this.persistence)==null||(n=n.props)==null||!n[Fd]))}Gi(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Ji()||this.Yi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Yi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Yi(t){return this.config.person_profiles==="never"?(we.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ki(Fd,!0),!0)}Ai(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==fa)}rn(){var t,n,s,a,c=this.Ai();return((t=this.persistence)==null?void 0:t.Vt)!==c&&((s=this.persistence)==null||s.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.Vt)!==c&&((a=this.sessionPersistence)==null||a.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Us){if(this.Ci()){var s,a,c,u,f;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new fy(this),this.pageViewManager=new ey(this),this.persistence&&(this.sessionPropsManager=new dy(this,this.sessionManager,this.persistence));var h,p=(c=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&c!==void 0?c:(f=zr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.ki(this.sessionRecording,new p(this)),this.Ui&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.Ui)))}var g,v;this.consent.optInOut(!0),this.rn(),this.zi(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==fa&&((g=this.surveys)==null||g.loadIfEnabled()),(Se(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((v=t==null?void 0:t.captureEventName)!==null&&v!==void 0?v:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vi()}else we.warn(my)}opt_out_capturing(){var t,n,s;this.config.cookieless_mode!==Us?(this.config.cookieless_mode===fa&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.rn(),this.config.cookieless_mode===fa&&(this.register({distinct_id:rd,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Vi(),this.zi())):we.warn(my)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Us||(this.config.cookieless_mode===fa?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.rn()}_is_bot(){return Un?Tw(Un,this.config.custom_blocked_useragents):void 0}Vi(){Ne&&(Ne.visibilityState==="visible"?this.Ei||(this.Ei=!0,this.capture(vl,{title:Ne.title},{send_instantly:!0}),this.Mi&&(Ne.removeEventListener(Hd,this.Mi),this.Mi=null)):this.Mi||(this.Mi=this.Vi.bind(this),Xt(Ne,Hd,this.Mi)))}debug(t){t===!1?(se==null||se.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(se==null||se.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}mr(){var t,n,s,a,c,u,f=this.Li||{};return"advanced_disable_flags"in f?!!f.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(we.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(s="advanced_disable_decide",a=we,c=(n="advanced_disable_flags")in(t=f)&&!Qe(t[n]),u=s in t&&!Qe(t[s]),c?t[n]:!!u&&(a&&a.warn("Config field '"+s+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[s]))}it(t){var n;if(Qe(this.config.before_send))return t;var s=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(aC),a=rt(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var u of a){if(c=u(c),Qe(c)){var f="Event '"+t.event+"' was rejected in beforeSend function";return iC(t.event)?we.warn(f+". This can cause unexpected behavior."):we.info(f),null}c.properties&&!ji(c.properties)||we.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of s)if(c.properties&&Qe(c.properties[h]))return we.warn("Event '"+t.event+"' had its '"+h+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return c}getPageViewId(){var t;return(t=this.pageViewManager.Ot)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(s)})}Oi(t){var n=us(t)&&!t,s=At.N()&&At.A("ph_debug")==="true";return!n&&(!!s||t)}}zr.__defaultExtensionClasses={},zr.nn={trace:hl=()=>{},debug:hl,info:hl,warn:hl,error:hl,fatal:hl},(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=YC(e.prototype[t[n]])})(zr,["identify"]);class by{constructor(t){this.disabled=t===!1;var n=Ut(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,s){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>s-a.timestamp){if(this.clicks.push({x:t,y:n,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:s}];return!1}}var qp="$copy_autocapture",Vp=Gt("[AutoCapture]");function Gp(e,t){return t.length>e?t.slice(0,e)+"...":t}function X3(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ti(t));return t}function Q3(e,t){var n,s,{e:a,maskAllElementAttributes:c,maskAllText:u,elementAttributeIgnoreList:f,elementsChainAsString:h,disableCaptureUrlHashes:p}=t;if(!Ti(e))return{props:{}};for(var g=[e],v=e;v.parentNode&&!fr(v,"body");)if(nw(v.parentNode))g.push(v.parentNode.host),v=v.parentNode.host;else{if(!Ti(v.parentNode))break;g.push(v.parentNode),v=v.parentNode}var y,b,_=[],j={},E=!1,k=!1;if(Mt(g,(D=>{var U=ig(D);if(fr(D,"a")){var F=D.getAttribute("href");E=!!(U&&F&&oc(F))&&(p?Ei(F):F)}Ie(Vd(D),"ph-no-capture")&&(k=!0),_.push((function(O,I,T,le,Q){Q===void 0&&(Q=!1);var G=O.tagName.toLowerCase(),$={tag_name:G};Hg.indexOf(G)>-1&&!T&&($.$el_text=G.toLowerCase()==="a"||G.toLowerCase()==="button"?Gp(1024,Kb(O)):Gp(1024,_c(O)));var z=Vd(O);z.length>0&&($.classes=z.filter((function(P){return P!==""}))),Mt(O.attributes,(function(P){var Z;if((!lw(O)||["name","id","class","aria-label"].indexOf(P.name)!==-1)&&(le==null||!le.includes(P.name))&&!I&&oc(P.value)&&(!Ct(Z=P.name)||Z.substring(0,10)!=="_ngcontent"&&Z.substring(0,7)!=="_nghost")){var M=P.value;P.name==="class"&&(M=Fg(M).join(" ")),$["attr__"+P.name]=Gp(1024,P.name==="href"&&Q?Ei(M):M)}}));for(var re=1,me=1,R=O;R=X3(R);)re++,R.tagName===O.tagName&&me++;return $.nth_child=re,$.nth_of_type=me,$})(D,c,u,f,p));var Y=(function(O){if(!ig(O))return{};var I={};return Mt(O.attributes,(function(T){if(T.name&&T.name.indexOf("data-ph-capture-attribute")===0){var le=T.name.replace("data-ph-capture-attribute-",""),Q=T.value;le&&Q&&oc(Q)&&(I[le]=Q)}})),I})(D);Bt(j,Y)})),k)return{props:{},explicitNoCapture:k};if(u||(_[0].$el_text=fr(e,"a")||fr(e,"button")?Kb(e):_c(e)),E){var A,C;_[0].attr__href=E;var L=(A=Gd(E))==null?void 0:A.host,B=se==null||(C=se.location)==null?void 0:C.host;L&&B&&L!==B&&(y=E)}return{props:Bt({$event_type:a.type,$ce_version:1},h?{}:{$elements:_},{$elements_chain:(b=_,(function(D){return D.map((U=>{var F,Y,O="";if(U.tag_name&&(O+=U.tag_name),U.attr_class)for(var I of(U.attr_class.sort(),U.attr_class))O+="."+I.replace(/"/g,"");var T=ye({},U.text?{text:U.text}:{},{"nth-child":(F=U.nth_child)!==null&&F!==void 0?F:0,"nth-of-type":(Y=U.nth_of_type)!==null&&Y!==void 0?Y:0},U.href?{href:U.href}:{},U.attr_id?{attr_id:U.attr_id}:{},U.attributes),le={};return Sd(T).sort(((Q,G)=>{var[$]=Q,[z]=G;return $.localeCompare(z)})).forEach((Q=>{var[G,$]=Q;return le[Zb(G.toString())]=Zb($.toString())})),(O+=":")+Sd(le).map((Q=>{var[G,$]=Q;return G+'="'+$+'"'})).join("")})).join(";")})((function(D){return D.map((U=>{var F,Y,O={text:(F=U.$el_text)==null?void 0:F.slice(0,400),tag_name:U.tag_name,href:(Y=U.attr__href)==null?void 0:Y.slice(0,2048),attr_class:h3(U),attr_id:U.attr__id,nth_child:U.nth_child,nth_of_type:U.nth_of_type,attributes:{}};return Sd(U).filter((I=>{var[T]=I;return T.indexOf("attr__")===0})).forEach((I=>{var[T,le]=I;return O.attributes[T]=le})),O}))})(b)))},(n=_[0])!=null&&n.$el_text?{$el_text:(s=_[0])==null?void 0:s.$el_text}:{},y&&a.type==="click"?{$external_click_url:y}:{},j)}}var qo=Gt("[ExceptionAutocapture]"),K3=Gt("[TracingHeaders]"),ia=Gt("[Web Vitals]"),yy=9e5,_y="disabled",wy="lazy_loading",Vo="awaiting_config",ud="missing_config";Gt("[SessionRecording]"),Gt("[SessionRecording]");var hg="[SessionRecording]",Rs=Gt(hg),Z3=Gt("[Heatmaps]");function Sy(e){return Ut(e)&&"clientX"in e&&"clientY"in e&&Hn(e.clientX)&&Hn(e.clientY)}var Yp=Gt("[Product Tours]"),Wp=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Bg))},J3=["$set_once","$set"],rs=Gt("[SiteApps]"),ky="Error while initializing PostHog app with config id ";function pl(e,t,n){if(Qe(e))return!1;switch(n){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class e4{constructor(t){this.sn=new Gg,this.an=(n,s)=>this.ln(n,s)&&this.un(n,s)&&this.hn(n,s)&&this.dn(n,s),this.ln=(n,s)=>s==null||!s.event||(n==null?void 0:n.event)===(s==null?void 0:s.event),this._instance=t,this.cn=new Set,this.vn=new Set}init(){var t,n;Se((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((s,a)=>{this.on(s,a)}))}register(t){var n,s;if(!Se((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.vn)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this.cn)==null||g.add((p==null?void 0:p.event)||"")}))})),(s=this._instance)!=null&&s.autocapture)){var a,c=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&c.add(h==null?void 0:h.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(c)}}on(t,n){var s;n!=null&&t.length!=0&&(this.cn.has(t)||this.cn.has(n==null?void 0:n.event))&&this.vn&&((s=this.vn)==null?void 0:s.size)>0&&this.vn.forEach((a=>{this.fn(n,a)&&this.sn.emit("actionCaptured",a.name)}))}pn(t){this.onAction("actionCaptured",(n=>t(n)))}fn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var s of n.steps)if(this.an(t,s))return!0;return!1}onAction(t,n){return this.sn.on(t,n)}un(t,n){if(n!=null&&n.url){var s,a=t==null||(s=t.properties)==null?void 0:s.$current_url;if(!a||typeof a!="string"||!pl(a,n.url,n.url_matching||"contains"))return!1}return!0}hn(t,n){return!!this.gn(t,n)&&!!this.mn(t,n)&&!!this.yn(t,n)}gn(t,n){var s;if(n==null||!n.href)return!0;var a=this.bn(t);if(a.length>0)return a.some((f=>pl(f.href,n.href,n.href_matching||"exact")));var c,u=(t==null||(s=t.properties)==null?void 0:s.$elements_chain)||"";return!!u&&pl((c=u.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}mn(t,n){var s;if(n==null||!n.text)return!0;var a=this.bn(t);if(a.length>0)return a.some((p=>pl(p.text,n.text,n.text_matching||"exact")||pl(p.$el_text,n.text,n.text_matching||"exact")));var c,u,f,h=(t==null||(s=t.properties)==null?void 0:s.$elements_chain)||"";return!!h&&(c=(function(p){for(var g,v=[],y=/(?::|")text="(.*?)"/g;!Qe(g=y.exec(p));)v.includes(g[1])||v.push(g[1]);return v})(h),u=n.text,f=n.text_matching||"exact",c.some((p=>pl(p,u,f))))}yn(t,n){var s,a;if(n==null||!n.selector)return!0;var c=t==null||(s=t.properties)==null?void 0:s.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}bn(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}dn(t,n){return n==null||!n.properties||n.properties.length===0||Rw(n.properties.reduce(((s,a)=>{var c=rt(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return s[a.key]={values:c,operator:a.operator||"exact"},s}),{}),t==null?void 0:t.properties)}}class t4{constructor(t){this._n=[],this._instance=t,this.wn=new Map,this.xn=new Map,this.kn=new Map}Sn(t,n){return!!t&&Rw(t.propertyFilters,n==null?void 0:n.properties)}Cn(t,n){var s=new Map;return t.forEach((a=>{var c;(c=a.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((u=>{if(u!=null&&u.name){var f=s.get(u.name)||[];f.push(a.id),s.set(u.name,f)}}))})),s}In(t,n,s){var a=(s===Po.Activation?this.wn:this.xn).get(t),c=[];return this.Tn((u=>{c=u.filter((f=>a==null?void 0:a.includes(f.id)))})),c.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[s])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.Sn(h,n)}))}register(t){var n;Se((n=this._instance)==null?void 0:n._addCaptureHook)||(this.En(t),this.Mn(t))}Mn(t){var n=t.filter((s=>{var a,c;return((a=s.conditions)==null?void 0:a.actions)&&((c=s.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.Pn==null&&(this.Pn=new e4(this._instance),this.Pn.init(),this.Pn.pn((s=>{this.onAction(s)}))),n.forEach((s=>{var a,c,u,f,h;s.conditions&&(a=s.conditions)!=null&&a.actions&&(c=s.conditions)!=null&&(c=c.actions)!=null&&c.values&&((u=s.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.Pn)==null||f.register(s.conditions.actions.values),(h=s.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var g=this.kn.get(p.name);g&&g.push(s.id),this.kn.set(p.name,g||[s.id])}})))})))}En(t){var n,s=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.events)&&((f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),a=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.cancelEvents)&&((f=c.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));s.length===0&&a.length===0||((n=this._instance)==null||n._addCaptureHook(((c,u)=>{this.onEvent(c,u)})),this.wn=this.Cn(t,Po.Activation),this.xn=this.Cn(t,Po.Cancellation))}onEvent(t,n){var s,a,c=this.Rn(),u=(n==null||(s=n.properties)==null?void 0:s.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.On(t,u);if(f==="consume")return c.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.Ln([u]);if(f==="persist")return c.info("shown item promoted to persisted activation",{event:t,itemId:u}),void this.Fn(u)}if(this.xn.has(t)){var h=this.In(t,n,Po.Cancellation);h.length>0&&(c.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((g=>g.id))}),this.Ln(h.map((g=>g.id))),h.forEach((g=>this.An(g.id))))}if(this.wn.has(t)){c.info("event name matched",{event:t,eventPayload:n,items:this.wn.get(t)});var p=this.In(t,n,Po.Activation);this.$n(p.map((g=>g.id)))}}onAction(t){this.kn.has(t)&&this.$n(this.kn.get(t)||[])}$n(t){t.length!==0&&(this._n=[...new Set([...this._n,...t])],this.Rn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Fn(t){this._n=this._n.filter((s=>s!==t));var n=this.Dn();n.includes(t)||this.Nn([...n,t])}Ln(t){var n=new Set(t);this._n=this._n.filter((c=>!n.has(c)));var s=this.Dn(),a=s.filter((c=>!n.has(c)));a.length!==s.length&&this.Nn(a)}Dn(){var t,n=this.qn();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}getActivatedIds(){return[...new Set([...this.Dn(),...this._n])].filter((t=>!this.jn(t)))}reset(){this._n=[],this.Dn().length>0&&this.Nn([])}getEventToItemsMap(){return this.wn}Bn(){return this.Pn}}class n4 extends t4{constructor(t){super(t)}qn(){return Xm}Hn(){return Fs.SHOWN}Tn(t){var n;(n=this._instance)==null||n.getSurveys(t)}An(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Rn(){return Nt}Nn(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Xm]:t})}jn(){return!1}On(t,n){var s;this.Tn((c=>{s=c.find((u=>u.id===n))}));var a=!s||(function(c){var u,f,h,p=((u=(f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)!==null&&u!==void 0?u:0)>0;return c.schedule===k3.Always||!((h=c.conditions)==null||(h=h.events)==null||!h.repeatedActivation||!p)})(s);return a?t===Fs.SHOWN?"consume":"ignore":t===Fs.SHOWN?"persist":t===Fs.DISMISSED||t===Fs.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Xp="SDK is not enabled or survey functionality is not yet loaded",jy="Disabled. Not loading surveys.",r4=se!=null&&se.location?Yd(se.location.hash,"__posthog")||Yd(location.hash,"state"):null,Ny="_postHogToolbarParams",Cy=Gt("[Toolbar]"),Nn=Gt("[FeatureFlags]"),aa=Gt("[FeatureFlags]",{debugEnabled:!0}),Qp=`" failed. Feature flags didn't load in time.`,Ey=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},Ty=e=>{var t={};for(var[n,s]of Sd(e||{}))s&&(t[n]=s);return t},zs=Gt("[Error tracking]"),Ay="Refusing to render web experiment since the viewer is a likely bot",s4={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Qd(t,e),not_regex:(e,t)=>!Qd(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Mn{get Se(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),n.getWebExperiments((a=>{Mn.Un("retrieved web experiments from the server"),n.zn=new Map,a.forEach((c=>{if(c.feature_flag_key){var u;n.zn&&(Mn.Un("setting flag key ",c.feature_flag_key," to web experiment ",c),(u=n.zn)==null||u.set(c.feature_flag_key,c));var f=n._instance.getFeatureFlag(c.feature_flag_key);Ct(f)&&c.variants[f]&&n.Vn(c.name,f,c.variants[f].transforms)}else if(c.variants)for(var h in c.variants){var p=c.variants[h];Mn.Wn(p,n._instance)&&n.Vn(c.name,h,p.transforms)}}))}),s)},this._instance=t,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Mn.Un(Ay);else if(!this.Se.disable_web_experiments){if(Qe(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Mn.Un("applying feature flags",t),t.forEach((n=>{var s;if(this.zn&&(s=this.zn)!=null&&s.has(n)){var a,c=this._instance.getFeatureFlag(n),u=(a=this.zn)==null?void 0:a.get(n);c&&u!=null&&u.variants[c]&&this.Vn(u.name,c,u.variants[c].transforms)}}))}}previewWebExperiment(){var t=Mn.getWindowLocation();if(t!=null&&t.search){var n=Tl(t==null?void 0:t.search,"__experiment_id"),s=Tl(t==null?void 0:t.search,"__experiment_variant");n&&s&&(Mn.Un("previewing web experiments "+n+" && "+s),this.getWebExperiments((a=>{this.Gn(parseInt(n),s,a)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,s){if(this.Se.disable_web_experiments&&!s)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}Gn(t,n,s){var a=s.filter((c=>c.id===t));a&&a.length>0&&(Mn.Un("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.Vn(a[0].name,n,a[0].variants[n].transforms))}static Wn(t,n){return!Qe(t.conditions)&&Mn.Zn(t,n)&&Mn.Qn(t)}static Zn(t,n){var s;if(Qe(t.conditions)||Qe((s=t.conditions)==null?void 0:s.url))return!0;var a=Mn.getWindowLocation();if(a){var c,u,f,h=ew(n,a.href);return(c=t.conditions)==null||!c.url||s4[(u=(f=t.conditions)==null?void 0:f.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return se==null?void 0:se.location}static Qn(t){var n;if(Qe(t.conditions)||Qe((n=t.conditions)==null?void 0:n.utm))return!0;var s=hw();if(s.utm_source){var a,c,u,f,h,p,g,v,y=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==s.utm_campaign,b=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==s.utm_source,_=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==s.utm_medium,j=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_term)==s.utm_term;return y&&_&&j&&b}return!1}static Un(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;n>a;a++)s[a-1]=arguments[a];we.info("[WebExperiments] "+t,s)}Vn(t,n,s){this._is_bot()?Mn.Un(Ay):n!=="control"?s.forEach((a=>{if(a.selector){var c;Mn.Un("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(c=document)==null?void 0:c.querySelectorAll(a.selector);u==null||u.forEach((f=>{var h=f;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)}))}})):Mn.Un("Control variants leave the page unmodified.")}_is_bot(){return Un&&this._instance?Tw(Un,this.Se.custom_blocked_useragents):void 0}}var Tr=Gt("[Conversations]"),la="Conversations not available yet.",My="console",of={featureFlags:class{constructor(e){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Se(){return this._instance.config}get zr(){return this._instance.persistence}ss(e){return this._instance.get_property(e)}os(){var e,t;return(e=(t=this.zr)==null?void 0:t.Gt(this.Se.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}ls(){return!!this.os()&&(this.ns||this.Kn||(this.ns=!0,Nn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}us(){var e,t=(e=this.Se.evaluation_contexts)!==null&&e!==void 0?e:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.rs||(Nn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),t!=null&&t.length?t.filter((n=>{var s=n&&typeof n=="string"&&n.trim().length>0;return s||Nn.error("Invalid evaluation context found:",n,"Expected non-empty string"),s})):[]}hs(){return this.us().length>0}ds(){var e=this.Se.flag_keys;if(!Se(e)){if(rt(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||Nn.error("Invalid flag key found:",t,"Expected non-empty string"),n}));Nn.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:n}=this._instance,s=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var a,c,u=(a=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&a!==void 0?a:{},f=Object.keys(s).filter((p=>!!s[p])).reduce(((p,g)=>(p[g]=s[g]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,g)=>(u[g]&&(p[g]=u[g]),p)),{});this.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var s,a,c=n!=null&&n.merge&&(s=this.ss(pa))!==null&&s!==void 0?s:{},u=n!=null&&n.merge&&(a=this.ss(wd))!==null&&a!==void 0?a:{},f=ye({},c,e),h=ye({},u,t),p={};for(var[g,v]of Object.entries(f))p[g]={key:g,enabled:Mb(v),variant:Rb(v),reason:void 0,metadata:Se(h==null?void 0:h[g])?void 0:{id:0,version:void 0,description:void 0,payload:h[g]}};this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.ss(Gm),t=this.ss(Bs),n=this.ss(xl);if(!n&&!t)return e||{};var s=Bt({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of a){var u,f,h=s[c],p=t==null?void 0:t[c],g=Se(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,v=Se(p)?h.variant:typeof p=="string"?p:void 0,y=n==null?void 0:n[c],b=ye({},h,{enabled:g,variant:g?v??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(b.original_enabled=h==null?void 0:h.enabled),v!==(h==null?void 0:h.variant)&&(b.original_variant=h==null?void 0:h.variant),y&&(b.metadata=ye({},h==null?void 0:h.metadata,{payload:y,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),s[c]=b}return this.Jn||(Nn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:s}),this.Jn=!0),s}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var s=e[n];return{key:n,enabled:Mb(s),variant:Rb(s),payload:Ab(t[n])}}))}getFlagVariants(){var e=this.ss(pa),t=this.ss(Bs);if(!t)return e||{};for(var n=Bt({},e),s=Object.keys(t),a=0;s.length>a;a++)n[s[a]]=t[s[a]];return this.Jn||(Nn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Jn=!0),n}getFlagPayloads(){var e=this.ss(wd),t=this.ss(xl);if(!t)return e||{};for(var n=Bt({},e||{}),s=Object.keys(t),a=0;s.length>a;a++)n[s[a]]=t[s[a]];return this.Jn||(Nn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Jn=!0),n}reloadFeatureFlags(){this.Xn||this.Se.advanced_disable_feature_flags||this.cs||(this._instance.Ti.emit("featureFlagsReloading",!0),this.cs=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.cs),this.cs=void 0}ensureFlagsLoaded(){this.Yn||this.Kn||this.cs||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Xn=e}vs(e){var t;if(this.fs(),!this._instance.mr())if(this.Kn)this.es=!0;else{var n=this.Se.token,s=this.ss($d),a={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ye({},((t=this.zr)==null?void 0:t.get_initial_props())||{},this.ss(ua)||{}),group_properties:this.ss(da),timezone:bw()};Fn(s)||Se(s)||(a.$device_id=s),(e!=null&&e.disableFlags||this.Se.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.hs()&&(a.evaluation_contexts=this.us());var c=this.ds();Se(c)||(a.flag_keys=c);var u=!!this.Se.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:f,data:a,compression:this.Se.disable_compression?void 0:ls.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:h=>{var p,g,v,y=!0;if(h.statusCode===200&&(this.es||(this.$anon_distinct_id=void 0),y=!1),this.Kn=!1,!a.disable_flags||this.es){this.ts=!y;var b=[];h.error?h.error instanceof Error?b.push(h.error.name==="AbortError"?"timeout":"connection_error"):b.push("unknown_error"):h.statusCode!==200&&b.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&b.push("errors_while_computing_flags");var _,j=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));j&&b.push("quota_limited"),(v=this.zr)==null||v.register({[Km]:b}),j?Nn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(a.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},y,{partialResponse:u}),this.es&&(this.es=!1,this.vs()))}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.ts)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var s=this.getFeatureFlagResult(e,t);return(n=s==null?void 0:s.variant)!==null&&n!==void 0?n:s==null?void 0:s.enabled}}else Nn.warn('getFeatureFlag for key "'+e+Qp)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.ts)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var n=this.getFlagVariants(),s=e in n,a=n[e],c=this.getFlagPayloads()[e],u=String(a),f=this.ss(Ym)||void 0,h=this.ss(yc)||void 0,p=this.ss(lc)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var g,v=this._instance.get_session_id(),y=this.ss(Qm);v&&v!==y&&(p={},(g=this.zr)==null||g.register({[lc]:p,[Qm]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var b,_,j,E,k,A,C,L,B,D;rt(p[e])?p[e].push(u):p[e]=[u],(b=this.zr)==null||b.register({[lc]:p});var U=this.getFeatureFlagDetails(e),F=[...(_=this.ss(Km))!==null&&_!==void 0?_:[]];Se(a)&&F.push("flag_missing");var Y={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:c||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((j=this.Se.bootstrap)==null||(j=j.featureFlags)==null?void 0:j[e])||null,$feature_flag_bootstrapped_payload:((E=this.Se.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])||null,$used_bootstrap_value:!this.ts};Se(U==null||(k=U.metadata)==null?void 0:k.version)||(Y.$feature_flag_version=U.metadata.version);var O,I=(A=U==null||(C=U.reason)==null?void 0:C.description)!==null&&A!==void 0?A:U==null||(L=U.reason)==null?void 0:L.code;I&&(Y.$feature_flag_reason=I),U!=null&&(B=U.metadata)!=null&&B.id&&(Y.$feature_flag_id=U.metadata.id),Se(U==null?void 0:U.original_variant)&&Se(U==null?void 0:U.original_enabled)||(Y.$feature_flag_original_response=Se(U.original_variant)?U.original_enabled:U.original_variant),U!=null&&(D=U.metadata)!=null&&D.original_payload&&(Y.$feature_flag_original_payload=U==null||(O=U.metadata)==null?void 0:O.original_payload),F.length&&(Y.$feature_flag_error=F.join(",")),this._instance.capture("$feature_flag_called",Y)}if(s)return{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:Ab(c)}}}else Nn.warn('getFeatureFlagResult for key "'+e+Qp)}getRemoteConfigPayload(e,t){var n=this.Se.token,s={distinct_id:this._instance.get_distinct_id(),token:n};this.hs()&&(s.evaluation_contexts=this.us());var a=this.ds();Se(a)||(s.flag_keys=a),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Se.disable_compression?void 0:ls.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(c){var u,f=(u=c.json)==null?void 0:u.featureFlagPayloads;t((f==null?void 0:f[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.ts){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return Se(n)?void 0:!!n}Nn.warn('isFeatureEnabled for key "'+e+Qp)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.zr){this.Yn=!0;var s=this.getFlagVariants(),a=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(u,f,h,p,g,v){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var y=(F=>{var Y=F.flags;return Y?(F.featureFlags=Object.fromEntries(Object.keys(Y).map((O=>{var I;return[O,(I=Y[O].variant)!==null&&I!==void 0?I:Y[O].enabled]}))),F.featureFlagPayloads=Object.fromEntries(Object.keys(Y).filter((O=>Y[O].enabled)).filter((O=>{var I;return(I=Y[O].metadata)==null?void 0:I.payload})).map((O=>{var I;return[O,(I=Y[O].metadata)==null?void 0:I.payload]})))):F.featureFlags&&Nn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),F})(u),b=y.flags,_=y.featureFlags,j=y.featureFlagPayloads;if(_){var E=u.requestId,k=u.evaluatedAt;if(rt(_)){Nn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var A={};if(_)for(var C=0;_.length>C;C++)A[_[C]]=!0;f&&f.register({[_d]:_,[pa]:A})}else{var L=_,B=j,D=b;if(v!=null&&v.partialResponse)L=ye({},h,L),B=ye({},p,B),D=ye({},g,D);else if(u.errorsWhileComputingFlags)if(b){var U=new Set(Object.keys(b).filter((F=>{var Y;return!((Y=b[F])!=null&&Y.failed)})));L=ye({},h,Object.fromEntries(Object.entries(L).filter((F=>{var[Y]=F;return U.has(Y)})))),B=ye({},p,Object.fromEntries(Object.entries(B||{}).filter((F=>{var[Y]=F;return U.has(Y)})))),D=ye({},g,Object.fromEntries(Object.entries(D||{}).filter((F=>{var[Y]=F;return U.has(Y)}))))}else L=ye({},h,L),B=ye({},p,B),D=ye({},g,D);f&&f.register(ye({[_d]:Object.keys(Ty(L)),[pa]:L||{},[wd]:B||{},[Gm]:D||{}},E?{[Ym]:E}:{},k?{[yc]:k}:{}))}}})(e,this.zr,s,a,c,n),t||(this.ns=!1),this.ps(t)}}override(e,t){t===void 0&&(t=!1),Nn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.zr)return Nn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.zr.unregister(Bs),this.zr.unregister(xl),this.ps(),aa.info("All overrides cleared");if(rt(e)){var t=Ey(e);return this.zr.register({[Bs]:t}),this.ps(),aa.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,s=e;if(this.Jn=!!((n=s.suppressWarning)!==null&&n!==void 0&&n),"flags"in s){if(s.flags===!1)this.zr.unregister(Bs),aa.info("Flag overrides cleared");else if(s.flags){if(rt(s.flags)){var a=Ey(s.flags);this.zr.register({[Bs]:a})}else this.zr.register({[Bs]:s.flags});aa.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.zr.unregister(xl),aa.info("Payload overrides cleared")):s.payloads&&(this.zr.register({[xl]:s.payloads}),aa.info("Payload overrides set",{payloads:s.payloads}))),void this.ps()}if(e&&typeof e=="object")return this.zr.register({[Bs]:e}),this.ps(),aa.info("Flag overrides set",{flags:e});Nn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Yn){var{flags:t,flagVariants:n}=this.gs();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var s,a=(this.ss(ec)||[]).find((h=>h.flagKey===e)),c={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(c,!1);var f=ye({},this.getFlagVariants(),{[e]:t});(s=this.zr)==null||s.register({[_d]:Object.keys(Ty(f)),[pa]:f}),this.ps()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var s=this.ss(ec),a=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+a),method:"GET",callback:c=>{var u,f;if(c.json){var h=c.json.earlyAccessFeatures;return(u=this.zr)==null||u.unregister(ec),(f=this.zr)==null||f.register({[ec]:h}),e(h)}}})}gs(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,s)=>(n[s]=t[s],n)),{})}}ps(e){var{flags:t,flagVariants:n}=this.gs();this.featureFlagEventHandlers.forEach((s=>s(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.ss(ua)||{},s=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,c={};if(a)for(var u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(c[u]=a[u]));this._instance.register({[ua]:ye({},n,c,s)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=ye({},this.ss(ua)||{});e.forEach((s=>{delete n[s]})),this._instance.register({[ua]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(ua),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.ss(da)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((s=>{n[s]=ye({},n[s],e[s]),delete e[s]})),this._instance.register({[da]:ye({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.ss(da)||{};this._instance.register({[da]:ye({},t,{[e]:{}})})}else this._instance.unregister(da)}reset(){this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},i4={sessionRecording:class{get Se(){return this._instance.config}get zr(){return this._instance.persistence}get started(){var e;return!((e=this.ys)==null||!e.isStarted)}get status(){var e,t;return this.bs===Vo||this.bs===ud?this.bs:(e=(t=this.ys)==null?void 0:t.status)!==null&&e!==void 0?e:this.bs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=_y,this._s=void 0,this._instance=e,!this._instance.sessionManager)throw Rs.error("started without valid sessionManager"),new Error(hg+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===Us)throw new Error(hg+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get ws(){var e,t=!((e=this._instance.get_property(ma))==null||!e.enabled),n=!this.Se.disable_session_recording,s=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return se&&t&&n&&!s}startIfEnabledOrStop(e){var t;if(!this.ws||(t=this.ys)==null||!t.isStarted){var n=!Se(Object.assign)&&!Se(Array.from);this.ws&&n?(this.xs(e),Rs.info("starting")):(this.bs=_y,this.stopRecording())}}xs(e){var t,n,s;this.ws&&(this.bs!==Vo&&this.bs!==ud&&(this.bs=wy),Le!=null&&(t=Le.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Le.__PosthogExtensions__)!=null&&n.initSessionRecording?this.ks(e):(s=Le.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Ss,(a=>{if(a)return Rs.error("could not load recorder",a);this.ks(e)})))}stopRecording(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.stop()}Cs(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.discard()}Is(){var e,t;(e=this.zr)==null||e.unregister(Pg),(t=this.zr)==null||t.unregister(I5)}Ts(e,t){if(Qe(e))return null;var n,s=Hn(e)?e:parseFloat(e);return typeof(n=s)!="number"||!Number.isFinite(n)||0>n||n>1?(Rs.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}Es(e){if(this.zr){var t,n,s=this.zr,a=()=>{var c,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.Ts((c=this.Se.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.Ts(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;Qe(p)&&this.Is();var g=u==null?void 0:u.minimumDurationMilliseconds;s.register({[ma]:ye({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:ye({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:Se(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};a(),(t=this._s)==null||t.call(this),this._s=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.Es(e),void this.Cs()):(this.Es(e),void this.startIfEnabledOrStop()):(this.bs===Vo&&(this.bs=ud,Rs.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.ys)!=null&&n.log?this.ys.log(e,t):Rs.warn("log called before recorder was ready")}get Ss(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ma);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Ms(){var e,t,n=this._instance.get_property(ma);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(a){return Rs.warn("persisted remote config for session recording is invalid and will be ignored",a),!1}var s=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-s}ks(e){var t,n;if((t=Le.__PosthogExtensions__)==null||!t.initSessionRecording)return Rs.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[K5]:!0});if(this.ys||(this.ys=(n=Le.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ms())return this.bs===ud||this.bs===Vo?void 0:(this.bs=Vo,Rs.info("persisted remote config is stale, requesting fresh config before starting"),void new yw(this._instance).load());this.bs=wy,this.ys.start(e)}onRRwebEmit(e){var t;(t=this.ys)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ys||(t=this.zr)==null||t.register({[V5]:!0}),(e=this.ys)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ys||(t=this.zr)==null||t.register({[q5]:!0}),(e=this.ys)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.ys||(n=this.zr)==null||n.register({[e==="url"?G5:Y5]:!0}),(t=this.ys)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.ys)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.ys)==null||!n.tryAddCustomEvent(e,t))}}},a4={autocapture:class{constructor(e){this.Ps=!1,this.Rs=null,this.Os=!1,this.instance=e,this.rageclicks=new by(e.config.rageclick),this.Ls=null}initialize(){this.startIfEnabled()}get Se(){var e,t,n=Ut(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((s=>new RegExp(s))),n}Fs(){if(this.isBrowserSupported()){if(se&&Ne){var e=n=>{n=n||(se==null?void 0:se.event);try{this.As(n)}catch(s){Vp.error("Failed to capture event",s)}};if(Xt(Ne,"submit",e,{capture:!0}),Xt(Ne,"change",e,{capture:!0}),Xt(Ne,"click",e,{capture:!0}),this.Se.capture_copied_text){var t=n=>{n=n||(se==null?void 0:se.event);try{this.As(n,qp)}catch(s){Vp.error("Failed to capture copy/cut event",s)}};Xt(Ne,"copy",t,{capture:!0}),Xt(Ne,"cut",t,{capture:!0})}}}else Vp.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ps&&(this.Fs(),this.Ps=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Os=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[$m]:!!e.autocapture_opt_out}),this.Rs=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Ls=e}getElementSelectors(e){var t,n=[];return(t=this.Ls)==null||t.forEach((s=>{var a=Ne==null?void 0:Ne.querySelectorAll(s);a==null||a.forEach((c=>{e===c&&n.push(s)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[$m];if(Fn(this.Rs)&&!us(n)&&!this.instance.mr())return!1;var s=(t=this.Rs)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!s}As(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,s=Op(e);tw(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Qb(s,this.instance.config.rageclick)&&this.As(e,"$rageclick");var a=t===qp;if(s&&(function(v,y,b,_,j,E){var k,A,C,L,B,D;if(b===void 0&&(b=void 0),!se||Ig(v)||(k=b)!=null&&k.url_allowlist&&!Yb(b.url_allowlist,E)||(A=b)!=null&&A.url_ignorelist&&Yb(b.url_ignorelist,E))return!1;if((C=b)!=null&&C.dom_event_allowlist){var U=b.dom_event_allowlist;if(U&&!U.some((T=>y.type===T)))return!1}var{parentIsUsefulElement:F,targetElementList:Y}=aw(v,_);if(!(function(T,le){var Q=le==null?void 0:le.element_allowlist;if(Se(Q))return!0;var G,$=function(re){if(Q.some((me=>re.tagName.toLowerCase()===me)))return{v:!0}};for(var z of T)if(G=$(z))return G.v;return!1})(Y,b)||!sg(Y,(L=b)==null?void 0:L.css_selector_allowlist)||sg(Y,(B=(D=b)==null?void 0:D.css_selector_ignorelist)!==null&&B!==void 0?B:a3))return!1;var O=se.getComputedStyle(v);if(O&&O.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0;var I=v.tagName.toLowerCase();switch(I){case"html":return!1;case"form":return(j||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(y.type)>=0;default:return F?(j||["click"]).indexOf(y.type)>=0:(j||["click"]).indexOf(y.type)>=0&&(Hg.indexOf(I)>-1||v.getAttribute("contenteditable")==="true")}})(s,e,this.Se,a,a?["copy","cut"]:void 0,this.instance)){var{props:c,explicitNoCapture:u}=Q3(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Os,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(u)return!1;var f=this.getElementSelectors(s);if(f&&f.length>0&&(c.$element_selectors=f),t===qp){var h,p=rw(se==null||(h=se.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;c.$selected_content=p,c.$copy_type=g}return this.instance.capture(t,c),!0}}}isBrowserSupported(){return as(Ne==null?void 0:Ne.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.$s=(se==null||(t=se.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(we.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,we.info("History API monitoring stopped")}monitorHistoryChanges(){se&&se.history&&(this.Ns("pushState"),this.Ns("replaceState"),this.qs())}Ns(e){var t;if(se&&((t=se.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(s,a,c){try{if(!(a in s))return()=>{};var u=s[a],f=c(u);return as(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0}})),s[a]=f,()=>{s[a]===f&&(s[a]=u)}}catch{return()=>{}}})(se.history,e,(s=>function(a,c,u){s.call(this,a,c,u),n.js(e)}))}}js(e){try{var t,n=se==null||(t=se.location)==null?void 0:t.pathname;if(!n)return;n!==this.$s&&this.isEnabled&&this._instance.capture(vl,{navigation_type:e}),this.$s=n}catch(s){we.error("Error capturing "+e+" pageview",s)}}qs(){if(!this.Ds){var e=()=>{this.js("popstate")};Xt(se,"popstate",e),this.Ds=()=>{se&&se.removeEventListener("popstate",e)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(e){var t;this.Bs=!1,this.Ps=!1,this.Hs=null,this.instance=e,this.Bs=!((t=this.instance.persistence)==null||!t.props[Um]),this.rageclicks=new by(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Ut(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(e=this.Se.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Qe(this.Se.capture_heatmaps)?Qe(this.Se.enable_heatmaps)?this.Bs:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Ps)return;Z3.info("starting..."),this.Us(),this.ke()}else{var e;clearInterval((e=this.Hs)!==null&&e!==void 0?e:void 0),this.zs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Um]:t}),this.Bs=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Vs(e){this.fe(e.originalEvent,"deadclick")}ke(){this.Hs&&clearInterval(this.Hs),this.Hs=(Ne==null?void 0:Ne.visibilityState)==="visible"?setInterval(this.Lr.bind(this),this.flushIntervalMilliseconds):null}Us(){se&&Ne&&(this.Ws=this.Lr.bind(this),Xt(se,Id,this.Ws),this.Gs=e=>this.fe(e||(se==null?void 0:se.event)),Xt(Ne,"click",this.Gs,{capture:!0}),this.Zs=e=>this.Qs(e||(se==null?void 0:se.event)),Xt(Ne,"mousemove",this.Zs,{capture:!0}),this.Js=new Jb(this.instance,p3,this.Vs.bind(this)),this.Js.startIfEnabledOrStop(),this.Ys=this.ke.bind(this),Xt(Ne,Hd,this.Ys),this.Ps=!0)}zs(){var e;se&&Ne&&(this.Ws&&se.removeEventListener(Id,this.Ws),this.Gs&&Ne.removeEventListener("click",this.Gs,{capture:!0}),this.Zs&&Ne.removeEventListener("mousemove",this.Zs,{capture:!0}),this.Ys&&Ne.removeEventListener(Hd,this.Ys),clearTimeout(this.Ks),(e=this.Js)==null||e.stop(),this.Ps=!1)}Xs(e,t){var n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),c=(function(u,f,h){for(var p=u;p&&Ti(p)&&!fr(p,"body");){if(p===h)return!1;if(Ie(f,se==null?void 0:se.getComputedStyle(p).position))return!0;p=sw(p)}return!1})(Op(e),["fixed","sticky"],a);return{x:e.clientX+(c?0:s),y:e.clientY+(c?0:n),target_fixed:c,type:t}}fe(e,t){var n;if(t===void 0&&(t="click"),!Gb(e.target)&&Sy(e)){var s=this.Xs(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Qb(Op(e),this.instance.config.rageclick)&&this.eo(ye({},s,{type:"rageclick"})),this.eo(s)}}Qs(e){!Gb(e.target)&&Sy(e)&&(clearTimeout(this.Ks),this.Ks=setTimeout((()=>{this.eo(this.Xs(e,"mousemove"))}),500))}eo(e){if(se){var t=this.Se.disable_capture_url_hashes?Ei(se.location.href):se.location.href,n=this.Se.custom_personal_data_properties,s=this.Se.mask_personal_data_properties?[...Al,...n||[]]:[],a=wc(t,s,Sc);this.R=this.R||{},this.R[a]||(this.R[a]=[]),this.R[a].push(e)}}Lr(){this.R&&!ji(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Jb,webVitalsAutocapture:class{constructor(e){var t;this.Bs=!1,this.Ps=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ro=()=>{clearTimeout(this.io),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,s)=>ye({},n,{["$web_vitals_"+s.name+"_event"]:ye({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.no=n=>{var s;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.so();if(!Se(a))if(Qe(n==null?void 0:n.name)||Qe(n==null?void 0:n.value))ia.error("Invalid metric received",n);else if(!this.oo||this.oo>n.value){this.R.url!==a&&(this.ro(),this.io=setTimeout(this.ro,this.flushToCaptureTimeoutMs)),Se(this.R.url)&&(this.R.url=a),this.R.firstMetricTimestamp=Se(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),u=ye({},n,{$current_url:a,timestamp:Date.now()});Se(c)||(u.$session_id=c.sessionId,u.$window_id=c.windowId),this.R.metrics.push(u),this.R.metrics.length===this.allowedMetrics.length&&this.ro()}else ia.error("Ignoring metric with value >= "+this.oo,n)},this.ao=()=>{if(!this.Ps){var n,s,a,c,u=Le.__PosthogExtensions__;Se(u)||Se(u.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:s,onFCP:a,onINP:c}=u.postHogWebVitalsCallbacks),n&&s&&a&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.no.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.no.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.no.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.no.bind(this)),this.Ps=!0):ia.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Bs=!((t=this._instance.persistence)==null||!t.props[qm]),this.startIfEnabled()}get lo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=Ut(this.lo)?(e=this.lo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Qe(n)?((t=this._instance.persistence)==null?void 0:t.props[Vm])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Ut(this.lo)?this.lo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Ut(this.lo)?this.lo.web_vitals_attribution:void 0;return e!=null&&e}get oo(){var e=Ut(this.lo)&&Hn(this.lo.__web_vitals_max_value)?this.lo.__web_vitals_max_value:yy;return e>0&&6e4>=e?yy:e}get isEnabled(){var e=nn==null?void 0:nn.protocol;if(e!=="http:"&&e!=="https:")return ia.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ut(this.lo)?this.lo.web_vitals:us(this.lo)?this.lo:void 0;return us(t)?t:this.Bs}startIfEnabled(){this.isEnabled&&!this.Ps&&(ia.info("enabled, starting..."),this.Mt(this.ao))}onRemoteConfig(e){if("capturePerformance"in e){var t=Ut(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Ut(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[qm]:t}),this._instance.persistence.register({[Vm]:n})),this.Bs=t,this.startIfEnabled()}}Mt(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(s=>{s?ia.error("failed to load script",s):e()}))}so(){var e=se?this._instance.config.disable_capture_url_hashes?Ei(se.location.href):se.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Al,...t||[]]:[];return wc(e,n,Sc)}ia.error("Could not determine current URL")}}},l4={exceptionObserver:class{constructor(e){var t,n,s;this.ao=()=>{var a;if(se&&this.isEnabled&&(a=Le.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var c=Le.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,u=Le.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,f=Le.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.uo&&this.Se.capture_unhandled_errors&&(this.uo=c(this.captureException.bind(this))),!this.ho&&this.Se.capture_unhandled_rejections&&(this.ho=u(this.captureException.bind(this))),!this.do&&this.Se.capture_console_errors&&(this.do=f(this.captureException.bind(this)))}catch(h){qo.error("failed to start",h),this.co()}}},this._instance=e,this.vo=!((t=this._instance.persistence)==null||!t.props[Fm]),this.fo=new cC({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,Ae:qo}),this.Se=this.po(),this.startIfEnabledOrStop()}po(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ut(e)?t=ye({},t,e):(Se(e)?this.vo:e)&&(t=ye({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(qo.info("enabled"),this.co(),this.Mt(this.ao)):this.co()}Mt(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return qo.error("failed to load script",s);e()}))}co(){var e,t,n;(e=this.uo)==null||e.call(this),this.uo=void 0,(t=this.ho)==null||t.call(this),this.ho=void 0,(n=this.do)==null||n.call(this),this.do=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.vo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Fm]:this.vo}),this.Se=this.po(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.po()}captureException(e){var t,n,s,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.fo.consumeRateLimit(a)?qo.info("Skipping exception capture because of client rate limiting.",{exception:a}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.mo=[],this.yo=new jC([new zC,new HC,new DC,new LC,new UC,new $C,new BC,new FC],(function(s){for(var a=arguments.length,c=new Array(a>1?a-1:0),u=1;a>u;u++)c[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
|
|
64
|
-
`),v=h;g.length>v;v++){var y=g[v];if(1024>=y.length){var b=Hb.test(y)?y.replace(Hb,"$1"):y;if(!b.match(/\S*Error: /)){for(var _ of c){var j=_(b,s);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(E){if(!E.length)return[];var k=Array.from(E);return k.reverse(),k.slice(0,50).map((A=>{return ye({},A,{filename:A.filename||(C=k,C[C.length-1]||{}).filename,function:A.function||El});var C}))})(p)}})("web:javascript",TC,RC)),this._instance=e,this.mo=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Hm))!==null&&t!==void 0?t:[],this.bo=Pd(this._o()),this.wo=new qC(this.bo)}onConfigChange(){this.bo=Pd(this._o()),this.wo.setConfig(this.bo)}onRemoteConfig(e){var t,n,s;if("errorTracking"in e){var a=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],c=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.mo=a,this._instance.persistence&&this._instance.persistence.register({[Hm]:this.mo,[Im]:c})}}get xo(){var e,t=!!this._instance.get_property(Im),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.yo.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.bo.enabled)try{if(!Ct(e)||e.trim().length===0)return void zs.warn("Ignoring exception step because message must be a non-empty string");var n=this.ko(t),{sanitizedProperties:s,droppedKeys:a}=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(c).reduce(((f,h)=>IC.has(h)?(u.push(h),f):(f[h]=c[h],f)),{}),droppedKeys:u}})(n);a.length>0&&zs.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.wo.add(ye({[Od]:e,[Bd]:new Date().toISOString()},s))}catch(c){zs.error("Failed to add exception step. Ignoring breadcrumb.",c)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.So(t)){if(this.Co(t))return this.Io("Exception dropped: matched a suppression rule"),void zs.info("Skipping exception capture because a suppression rule matched");if(!this.xo&&this.To(t))return this.Io("Exception dropped: thrown by a browser extension"),void zs.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Eo(t))return this.Io("Exception dropped: thrown by the PostHog SDK"),void zs.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.bo.enabled&&Qe(e.$exception_steps)?this.Mo(e):e;try{var s=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Zi:!0});return s&&this.wo.clear(),s}catch(a){return zs.error("Failed to capture exception event. Dropping this exception.",a),void this.wo.clear()}}catch(a){return void zs.error("Failed to process exception event. Ignoring this exception.",a)}}Mo(e){try{var t=this.wo.getAttachable();return t.length===0?e:ye({},e,{$exception_steps:t})}catch(n){return zs.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}Io(e){this.bo.enabled&&this.wo.add({[Od]:e,[Bd]:new Date().toISOString()})}ko(e){return Ut(e)?ye({},e):{}}_o(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Co(e){if(e.length===0)return!1;var t=e.reduce(((n,s)=>{var{type:a,value:c}=s;return Ct(a)&&a.length>0&&n.$exception_types.push(a),Ct(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this.mo.some((n=>{var s=n.values.map((a=>{var c,u=Mw[a.operator],f=rt(a.value)?a.value:[a.value],h=(c=t[a.key])!==null&&c!==void 0?c:[];return f.length>0&&u(f,h)}));return n.type==="OR"?s.some(Boolean):s.every(Boolean)}))}To(e){return e.flatMap((t=>{var n,s;return(n=(s=t.stacktrace)==null?void 0:s.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Eo(e){if(e.length>0){var t,n,s,a,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.length-1];return(s=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}So(e){return!Qe(e)&&rt(e)}}},o4=ye({productTours:class{get zr(){return this._instance.persistence}constructor(e){this.Po=null,this.Ro=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if("productTours"in e){var t,n;if(this.zr&&this.zr.register({[Bg]:!!e.productTours}),!Wp(this._instance))return!this.Po&&Qe((t=this.zr)==null?void 0:t.props[tc])||Yp.info("product tours disabled; stopping and clearing cached tours"),(n=this.Po)==null||n.stop(),this.Po=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Po&&Wp(this._instance)&&this.Mt((()=>this.Oo()))}Mt(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(s=>{s?Yp.error("Could not load product tours script",s):e()}))}Oo(){var e;!this.Po&&(e=Le.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Po=Le.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!rt(this.Ro)||t){var n=this.zr;if(n){var s=n.props[tc];if(rt(s)&&!t)return this.Ro=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:a=>{if(Wp(this._instance)){var c=a.statusCode;if(c!==200||!a.json){var u="Product Tours API could not be loaded, status: "+c;return Yp.error(u),void e([],{isLoaded:!1,error:u})}var f=rt(a.json.product_tours)?a.json.product_tours:[];this.Ro=f,n&&n.register({[tc]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Ro,{isLoaded:!0})}getActiveProductTours(e){Qe(this.Po)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Po.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Po)==null||t.showTourById(e)}previewTour(e){this.Po?this.Po.previewTour(e):this.Mt((()=>{var t;this.Oo(),(t=this.Po)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Po)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Po)==null||e.nextStep()}previousStep(){var e;(e=this.Po)==null||e.previousStep()}clearCache(){var e;this.Ro=null,(e=this.zr)==null||e.unregister(tc)}resetTour(e){var t;(t=this.Po)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Po)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Po)==null||t.cancelPendingTour(e)}}},of),c4={siteApps:class{constructor(e){this.Lo=0,this._instance=e,this.Fo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ao(e,t){if(t){var n=this.globalsForEvent(t);this.Fo.push(n),this.Fo.length>1e3&&(this.Fo=this.Fo.slice(10))}}get siteAppLoaders(){var e;return(e=Le._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Ao.bind(this));this.$o=()=>{e(),this.Fo=[],this.$o=void 0}}}globalsForEvent(e){var t,n,s,a,c,u,f;if(!e)throw new Error("Event payload is required");var h={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var[v,y]of Object.entries(g))h[v]={id:p[v],type:v,properties:y};var{$set_once:b,$set:_}=e;return{event:ye({},c5(e,J3),{properties:ye({},e.properties,_?{$set:ye({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},b?{$set_once:ye({},(s=(a=e.properties)==null?void 0:a.$set_once)!==null&&s!==void 0?s:{},b)}:{}),elements_chain:(c=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}Do(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(rs.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(rs.error("prepare_external_dependency_script returned null"),null):e}No(){var e,t,n,s,a,c,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Ne==null?void 0:Ne.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.Lo++,this.qo)return this.jo();var g=[],v=this,y=new WeakSet,b=(E,k,A)=>{if(E!=null&&E[k]){var C=E[k];E[k]=A(C),g.push((()=>{E[k]=C}))}},_=E=>{if(y.has(E))return E;var k=v.Do(E);return k&&y.add(k),k},j=E=>E.map((k=>typeof k=="string"?k:_(k))).filter((k=>!Fn(k)));return b(p,"appendChild",(E=>function(k){var A=_(k);return A?E.call(this,A):k})),b(p,"insertBefore",(E=>function(k,A){var C=_(k);return C?E.call(this,C,A):k})),b(p,"replaceChild",(E=>function(k,A){var C=_(k);return C?E.call(this,C,A):A})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(s=h.DocumentFragment)==null?void 0:s.prototype].forEach((E=>{b(E,"append",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),b(E,"prepend",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))}))})),[(a=h.Element)==null?void 0:a.prototype,(c=h.CharacterData)==null?void 0:c.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((E=>{b(E,"before",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),b(E,"after",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),b(E,"replaceWith",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];var B=j(C);return C.length&&!B.length?void 0:k.apply(this,B)}))})),b((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(E=>function(k,A){var C=_(A);return C?E.call(this,k,C):null})),this.qo=()=>{g.forEach((E=>E())),this.qo=void 0},this.jo()}jo(){var e=!1;return()=>{var t;e||(e=!0,this.Lo--,this.Lo===0&&((t=this.qo)==null||t.call(this)))}}Bo(e,t){t===void 0&&(t=!0);var n=this.No();try{var s=e(n);return t&&n(),s}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.Fo.length&&(rs.info("Processing "+this.Fo.length+" events for site app with id "+e.id),this.Fo.forEach((f=>this.Bo((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.$o)==null||u.call(this))},s=!1,a=u=>{t.errored=!u,t.loaded=!0,rs.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),s&&n()};try{var{processEvent:c}=this.Bo((u=>e.init({posthog:this._instance,callback(f){u(),a(f)}})),!1);c&&(t.processEvent=c),s=!0}catch(u){rs.error(ky+e.id,u),a(!1)}if(s&&t.loaded)try{n()}catch(u){rs.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Ho(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Uo(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),s=function(c){try{t.Bo((()=>c.processEvent==null?void 0:c.processEvent(n)))}catch(u){rs.error("Error while processing event "+e.event+" for site app "+c.id,u)}};for(var a of Object.values(this.apps))s(a)}}onRemoteConfig(e){var t,n,s,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Ho(),void this._instance.on("eventCaptured",(h=>this.Uo(h)))):void rs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.$o)==null||n.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var c=function(h){var p;Le["__$$ph_site_app_"+h]=a._instance,(p=Le.__PosthogExtensions__)==null||p.loadSiteApp==null||p.loadSiteApp(a._instance,f,(g=>{if(g)return rs.error(ky+h,g)}))};for(var{id:u,url:f}of e.siteApps)c(u)}else rs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},u4={tracingHeaders:class{constructor(e){this.zo=void 0,this.Vo=void 0,this.Wo=void 0,this.ao=()=>{var t,n,s=this.Go();s?(Se(this.zo)&&(this.zo=(t=Le.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Se(this.Vo)&&(this.Vo=(n=Le.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.co()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Mt(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return K3.error("failed to load script",s);e()}))}Zo(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Go(){var e=this.Zo();return rt(e)?(rt(this.Wo)?this.Wo.splice(0,this.Wo.length,...e):this.Wo=[...e],e.length>0?this.Wo:void 0):(rt(this.Wo)&&this.Wo.splice(0),this.Wo=e||void 0,this.Wo)}co(){var e,t;(e=this.zo)==null||e.call(this),(t=this.Vo)==null||t.call(this),this.zo=void 0,this.Vo=void 0}startIfEnabledOrStop(){this.Go()?this.Mt(this.ao):this.co()}}},d4=ye({surveys:class{get Se(){return this._instance.config}constructor(e){this.Qo=void 0,this._surveyManager=null,this.Jo=!1,this.Yo=[],this.Ko=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Se.disable_surveys){var t=e.surveys;if(Qe(t))return Nt.warn("Flags not loaded yet. Not loading surveys.");var n=rt(t);this.Qo=n?t.length>0:t,Nt.info("flags response received, isSurveysEnabled: "+this.Qo),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var s=localStorage.key(n);(s!=null&&s.startsWith(fg)||s!=null&&s.startsWith("inProgressSurvey_"))&&t.push(s)}t.forEach((a=>localStorage.removeItem(a)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Jo)Nt.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)Nt.info(jy);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())Nt.info("Not loading surveys in cookieless mode without consent.");else{var e=Le==null?void 0:Le.__PosthogExtensions__;if(e){if(!Se(this.Qo)||this.Se.advanced_enable_surveys){var t=this.Qo||this.Se.advanced_enable_surveys;this.Jo=!0;try{var n=e.generateSurveys;if(n)return void this.Xo(n,t);var s=e.loadExternalDependency;if(!s)return void this.ea(ng);s(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.ea("Could not load surveys script",a):this.Xo(e.generateSurveys,t)}))}catch(a){throw this.ea("Error initializing surveys",a),a}finally{this.Jo=!1}}}else Nt.error("PostHog Extensions not found.")}}Xo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new n4(this._instance),Nt.info("Surveys loaded successfully"),this.ta({isLoaded:!0})}ea(e,t){Nt.error(e,t),this.ta({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Yo.push(e),this._surveyManager&&this.ta({isLoaded:!0}),()=>{this.Yo=this.Yo.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Se.disable_surveys)return Nt.info(jy),e([]);var n,s=this._instance.get_property(Wm);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.Ko?this.Ko.then((a=>{var{surveys:c,context:u}=a;return e(c,u)})):(typeof Promise<"u"&&(this.Ko=new Promise((a=>{n=a}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:a=>{var c;this.Ko=null;var u=a.statusCode;if(u!==200||!a.json){var f="Surveys API could not be loaded, status: "+u;Nt.error(f);var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}var p,g=a.json.surveys||[],v=g.filter((b=>(function(_){return!(!_.start_date||_.end_date)})(b)&&((function(_){var j;return!((j=_.conditions)==null||(j=j.events)==null||(j=j.values)==null||!j.length)})(b)||(function(_){var j;return!((j=_.conditions)==null||(j=j.actions)==null||(j=j.values)==null||!j.length)})(b))));v.length>0&&((p=this._surveyEventReceiver)==null||p.register(v)),(c=this._instance.persistence)==null||c.register({[Wm]:g,[$g]:Date.now()});var y={isLoaded:!0};e(g,y),n==null||n({surveys:g,context:y})}}))}ta(e){for(var t of this.Yo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Nt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!Qe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Nt.warn("init was not called")}ra(e){var t=null;return this.getSurveys((n=>{var s;t=(s=n.find((a=>a.id===e)))!==null&&s!==void 0?s:null})),t}ia(e){if(Qe(this._surveyManager))return{eligible:!1,reason:Xp};var t=typeof e=="string"?this.ra(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Qe(this._surveyManager))return Nt.warn("init was not called"),{visible:!1,disabledReason:Xp};var t=this.ia(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Qe(this._surveyManager)?(Nt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Xp})):new Promise((n=>{this.getSurveys((s=>{var a,c=(a=s.find((f=>f.id===e)))!==null&&a!==void 0?a:null;if(c){var u=this.ia(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var s;if(Qe(this._surveyManager))Nt.warn("init was not called");else{var a=typeof e=="string"?this.ra(e):e;if(a!=null&&a.id)if(H3.includes(a.type)){var c=Ne==null?void 0:Ne.querySelector(t);if(c)return(s=a.appearance)!=null&&s.surveyPopupDelaySeconds?(Nt.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Nt.info("Rendering survey "+a.id+" with delay of "+((u=a.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(a,c,n),Nt.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,c,n);Nt.warn("Survey element not found")}else Nt.warn("Surveys of type "+a.type+" cannot be rendered in the app");else Nt.warn("Survey not found")}}displaySurvey(e,t){var n;if(Qe(this._surveyManager))Nt.warn("init was not called");else{var s=this.ra(e);if(s){var a=s;if((n=s.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=ye({},s,{appearance:ye({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ag.Popover&&t.initialResponses&&Nt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.canRenderSurvey(s);if(!c.visible)return void Nt.warn("Survey is not eligible to be displayed: ",c.disabledReason)}t.displayType!==ag.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else Nt.warn("Survey not found")}}cancelPendingSurvey(e){Qe(this._surveyManager)?Nt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},of),f4={toolbar:class{constructor(e){this.instance=e}na(e){Le.ph_toolbar_state=e}sa(){var e;return(e=Le.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),Z5(this.instance.config)||!se||!Ne)return!1;e=e??se.location,n=n??se.history;try{if(!t){try{se.localStorage.setItem("test","test"),se.localStorage.removeItem("test")}catch{return!1}t=se==null?void 0:se.localStorage}var s,a=r4||Yd(e.hash,"__posthog")||Yd(e.hash,"state"),c=a?qb((()=>JSON.parse(atob(decodeURIComponent(a)))))||qb((()=>JSON.parse(decodeURIComponent(a)))):null;return c&&c.action==="ph_authorize"?((s=c).source="url",s&&Object.keys(s).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Ny)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}oa(e){var t=Le.ph_load_toolbar||Le.ph_load_editor;!Qe(t)&&as(t)?t(e,this.instance):Cy.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ne==null||!Ne.getElementById(W5));if(!se||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=ye({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(se.localStorage.setItem(Ny,JSON.stringify(ye({},s,{source:void 0}))),this.sa()===2)this.oa(s);else if(this.sa()===0){var a;this.na(1),(a=Le.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return Cy.error("[Toolbar] Failed to load",c),void this.na(0);this.na(2),this.oa(s)})),Xt(se,"turbolinks:load",(()=>{this.na(0),this.loadToolbar(s)}))}return!0}aa(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},h4=ye({experiments:Mn},of),p4=ye({},of,i4,a4,l4,o4,c4,d4,u4,f4,h4,{conversations:class{constructor(e){this.la=void 0,this._conversationsManager=null,this.ua=!1,this.ha=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Qe(t)||(us(t)?this.la=t:(this.la=t.enabled,this.ha=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.la=void 0,this.ha=null}loadIfEnabled(){if(!(this._conversationsManager||this.ua||this._instance.config.disable_conversations||Z5(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Le==null?void 0:Le.__PosthogExtensions__;if(e&&!Se(this.la)&&this.la)if(this.ha&&this.ha.token){this.ua=!0;try{var t=e.initConversations;if(t)return this.da(t),void(this.ua=!1);var n=e.loadExternalDependency;if(!n)return void this.ca(ng);n(this._instance,"conversations",(s=>{s||!e.initConversations?this.ca("Could not load conversations script",s):this.da(e.initConversations),this.ua=!1}))}catch(s){this.ca("Error initializing conversations",s),this.ua=!1}}else Tr.error("Conversations enabled but missing token in remote config.")}}da(e){if(this.ha)try{this._conversationsManager=e(this.ha,this._instance),Tr.info("Conversations loaded successfully")}catch(t){this.ca("Error completing conversations initialization",t)}else Tr.error("Cannot complete initialization: remote config is null")}ca(e,t){Tr.error(e,t),this._conversationsManager=null,this.ua=!1}show(){this._conversationsManager?this._conversationsManager.show():Tr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.la===!0&&!Fn(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var s=this;return xn((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,n):(Tr.warn(la),null)}))()}getMessages(e,t){var n=this;return xn((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Tr.warn(la),null)}))()}markAsRead(e){var t=this;return xn((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Tr.warn(la),null)}))()}getTickets(e){var t=this;return xn((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Tr.warn(la),null)}))()}requestRestoreLink(e){var t=this;return xn((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Tr.warn(la),null)}))()}restoreFromToken(e){var t=this;return xn((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Tr.warn(la),null)}))()}restoreFromUrlToken(){var e=this;return xn((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Tr.warn(la),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}en(){var e;(e=this._conversationsManager)==null||e.setIdentity()}tn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.va=!1,this.fa=!1,this.Ae=Gt("[logs]"),this._r=[],this.pa=[],this.ga=()=>{var n,s;(n=this.ma)==null||n.onReconnect(),(s=this.ya)==null||s.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.va=!0),se&&Xt(se,"online",this.ga)}ba(e,t,n,s){var a,c=(function(u,f){var h,p,g,v,y,b,_,j=(h=u==null?void 0:u.flushIntervalMs)!==null&&h!==void 0?h:3e3,E=(p=u==null?void 0:u.maxBufferSize)!==null&&p!==void 0?p:100,k=f!=null&&f.consoleCapture?void 0:(g=u==null?void 0:u.maxLogsPerInterval)!==null&&g!==void 0?g:1e3,A=Se(k)?Math.max(E,2048):Math.max(E,k),C=u==null?void 0:u.resourceAttributes;return{serviceName:(v=(y=C==null?void 0:C["service.name"])!==null&&y!==void 0?y:u==null?void 0:u.serviceName)!==null&&v!==void 0?v:f==null?void 0:f.serviceNameDefault,serviceVersion:(b=C==null?void 0:C["service.version"])!==null&&b!==void 0?b:u==null?void 0:u.serviceVersion,environment:(_=C==null?void 0:C["deployment.environment"])!==null&&_!==void 0?_:u==null?void 0:u.environment,resourceAttributes:C,beforeSend:u==null?void 0:u.beforeSend,flushIntervalMs:j,maxBufferSize:E,maxQueueSize:A,maxBatchRecordsPerPost:100,rateCapWindowMs:j,maxLogsPerInterval:k,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new SC(this._a(e,t),c,this.Ae,(()=>this.wa()),(u=>u()),void 0,s),c]}xa(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;return this.ma&&this.ka===n||((t=this.ma)==null||t.reset(),this.ka=n,[this.ma,this.Sa]=this.ba((()=>this._r),(s=>{this._r=s}))),this.ma}Ca(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;return this.ya&&this.Ia===n||((t=this.ya)==null||t.reset(),this.Ia=n,[this.ya,this.Ta]=this.ba((()=>this.pa),(s=>{this.pa=s}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},My)),this.ya}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!Qe(n)&&n&&(this.va=!0,this.loadIfEnabled())}reset(){var e,t;this._r=[],(e=this.ma)==null||e.reset(),this.pa=[],(t=this.ya)==null||t.reset()}captureLog(e){this.xa().captureLog(e)}le(e){this.Ca().captureLog(e)}get logger(){return this.Ea||(this.Ea={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Ea}flushLogs(e){e?this.Ma(e):(this.ma&&this.ma.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))),this.ya&&this.ya.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.va&&!this.fa){var e=Le==null?void 0:Le.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var s;n||(s=e.logs)==null||!s.initializeLogs?this.Ae.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.fa=!0)})):this.Ae.error(ng)}else this.Ae.error("PostHog Extensions not found.")}}_a(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:s=>s===Ps.LogsQueue?e():void 0,setPersistedProperty(s,a){var c;s===Ps.LogsQueue&&t((c=a)!==null&&c!==void 0?c:[])},ht:s=>this.ht(s),getLibraryId:()=>Zt.LIB_NAME,getLibraryVersion:()=>Zt.LIB_VERSION}}ht(e){return new Promise((t=>{var n=!1,s=c=>{n||(n=!0,clearTimeout(a),t(c))},a=setTimeout((()=>s({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Pa(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(c){var u=c.statusCode;if(u>=200&&300>u)s({kind:"ok"});else if(u===413)s({kind:"too-large"});else if(u!==0&&u!==429&&500>u)s({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var f;s({kind:"retry-later",error:(f=c.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}))}Ma(e){this._r.length>0&&this.Ra(e,this._r,this.Sa,Zt.LIB_NAME,(t=>{this._r=t})),this.pa.length>0&&this.Ra(e,this.pa,this.Ta,My,(t=>{this.pa=t}))}Ra(e,t,n,s,a){if(t.length!==0){var c=t.map((f=>f.record));a([]);var u=P5(c,B5(n,Zt.LIB_NAME,Zt.LIB_VERSION),s,Zt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Pa(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}Pa(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}wa(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n,windowId:s,sessionStartTimestamp:a,lastActivityTimestamp:c}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n,t.windowId=s,Qe(a)||(t.sessionStartTimestamp=a),Qe(c)||(t.lastActivityTimestamp=c)}if(Le!=null&&(e=Le.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ei(Le.location.href):Le.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}});zr.__defaultExtensionClasses=ye({},p4);var kc=(function(){Zt.SDK_DIST_CHANNEL="npm";var e=uc[bl]=new zr;return(function(){function t(){t.done||(t.done=!0,Lw=!1,Mt(uc,(function(n){n._dom_loaded()})))}Ne!=null&&Ne.addEventListener?Ne.readyState==="complete"?t():Xt(Ne,"DOMContentLoaded",t,{capture:!1}):se&&we.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const m4="https://us.i.posthog.com",Dw="cc-telemetry-enabled";let pg=!1,jc=!1;function g4(){return m4}function x4(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(Dw);return e===null?!0:e==="true"}function Ow(e){pg&&(e?(kc.opt_in_capturing({captureEventName:null}),jc=!0):(kc.opt_out_capturing(),jc=!1))}function Gz(e){typeof localStorage<"u"&&localStorage.setItem(Dw,String(e)),Ow(e)}function v4(){const e=void 0;return e?(kc.init(e,{api_host:g4(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),pg=!0,Ow(x4()),!0):(pg=!1,jc=!1,!1)}function Yg(e,t){jc&&kc.capture(e,t)}function Ai(e,t){jc&&kc.captureException(e,t)}function b4(e){Yg("$pageview",{$current_url:e})}const ds="/api",Bw="companion_auth_token";function Mi(){if(typeof window>"u")return{};const e=localStorage.getItem(Bw);return e?{Authorization:`Bearer ${e}`}:{}}function ba(e){e===401&&typeof window<"u"&&(localStorage.removeItem(Bw),er(async()=>{const{useStore:t}=await Promise.resolve().then(()=>Vj);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function un(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ac(e,t,n,s){Yg("api_request_succeeded",{method:e,path:t,status:s,duration_ms:Math.round(n)})}function fs(e,t,n,s,a){Yg("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:s instanceof Error?s.message:String(s)}),Ai(s,{method:e,path:t,status:a})}async function He(e,t){const n=un();let s=!1;try{const a=await fetch(`${ds}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Mi()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw fs("POST",e,un()-n,u,a.status),s=!0,u}return Ac("POST",e,un()-n,a.status),a.json()}catch(a){throw s||fs("POST",e,un()-n,a),a}}async function Re(e){const t=un();let n=!1;try{const s=await fetch(`${ds}${e}`,{headers:{...Mi()}});if(!s.ok){ba(s.status);const a=await s.json().catch(()=>({error:s.statusText})),c=new Error(a.error||s.statusText);throw fs("GET",e,un()-t,c,s.status),n=!0,c}return Ac("GET",e,un()-t,s.status),s.json()}catch(s){throw n||fs("GET",e,un()-t,s),s}}async function Ar(e,t){const n=un();let s=!1;try{const a=await fetch(`${ds}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Mi()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw fs("PUT",e,un()-n,u,a.status),s=!0,u}return Ac("PUT",e,un()-n,a.status),a.json()}catch(a){throw s||fs("PUT",e,un()-n,a),a}}async function y4(e,t){const n=un();let s=!1;try{const a=await fetch(`${ds}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Mi()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw fs("PATCH",e,un()-n,u,a.status),s=!0,u}return Ac("PATCH",e,un()-n,a.status),a.json()}catch(a){throw s||fs("PATCH",e,un()-n,a),a}}async function Mr(e,t){const n=un();let s=!1;try{const a=await fetch(`${ds}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Mi()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw fs("DELETE",e,un()-n,u,a.status),s=!0,u}return Ac("DELETE",e,un()-n,a.status),a.json()}catch(a){throw s||fs("DELETE",e,un()-n,a),a}}async function _4(e,t){const n=await fetch(`${ds}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Mi()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const s=n.body.getReader(),a=new TextDecoder;let c="",u=null;for(;;){const{done:f,value:h}=await s.read();if(f)break;c+=a.decode(h,{stream:!0});const p=c.split(`
|
|
63
|
+
`)}function jp(e){return e.type==="thinking"?`thinking:${e.thinking}`:e.type==="text"?`text:${e.text}`:e.type==="tool_use"?`tool_use:${e.id}`:e.type==="tool_result"?`tool_result:${e.tool_use_id}`:JSON.stringify(e)}function IN(e,t){const n=e||[],s=t||[];if(n.length===0&&s.length===0)return;const a=new Map;for(const f of s)a.set(jp(f),f);const c=[],u=new Set;for(const f of n){const h=jp(f);u.has(h)||(u.add(h),c.push(a.get(h)||f))}for(const f of s){const h=jp(f);u.has(h)||(u.add(h),c.push(f))}return c}function jb(e,t,n,s,a){return{toolUseId:e,toolName:t,preview:mc(t,n),startedAt:s,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function Nm(e,t){const n=IN(e.contentBlocks,t.contentBlocks),s=n&&n.length>0?yd(n):t.content||e.content;return{...e,...t,content:s,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function qN(e,t){const n=X.getState(),s=n.messages.get(e)||[],a=s.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const c=[...s];c[a]=Nm(c[a],t),n.setMessages(e,c)}function VN(e,t){var a,c;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(c=(a=t.data)==null?void 0:a.substring)==null?void 0:c.call(a,0,120));return}const s=X.getState();s.connectionStatus.get(e)==="connecting"&&s.setConnectionStatus(e,"connected"),o5(e,n)}function o5(e,t,n={}){var u,f,h,p,g,v;const{processSeq:s=!0,ackSeqMessage:a=!0}=n,c=X.getState();if(s&&typeof t.seq=="number"){const y=jm(e);if(t.seq<=y)return;Sb(e,t.seq),a&&kb(e,t.seq)}switch(AN.has(t.type)&&c.setLastActivity(e,Date.now()),t.type){case"session_init":{const y=c.sessions.get(e);if(c.addSession(t.session),c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),y||c.setSessionStatus(e,"idle"),!c.sessionNames.has(e)){const b=new Set(c.sessionNames.values()),_=J_(b);c.setSessionName(e,_)}break}case"session_update":{c.updateSession(e,t.session);break}case"assistant":{const y=t.message;if(y.model==="<synthetic>"){wi(e),c.setStreaming(e,null),ol(e,"synthetic_noop",{detail:{stopReason:y.stop_reason,text:yd(y.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const b=yd(y.content),_={id:y.id,role:"assistant",content:b,contentBlocks:y.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:y.model,stopReason:y.stop_reason};if(wi(e),qN(e,_),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),(u=y.content)!=null&&u.length)for(const j of y.content)j.type==="tool_result"&&c.clearToolProgress(e,j.tool_use_id);if(c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now()}),(f=y.content)!=null&&f.length)for(const j of y.content){if(j.type==="tool_use"){const E=j.input||{};c.addToolActivity(e,jb(j.id,j.name,E,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&c.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=y.content)!=null&&h.length&&(_p(e,y.content),wp(e,y.content),Sp(e,y.content),kp(e,y.content));break}case"stream_event":{const y=t.event;if(y&&typeof y=="object"){if(y.type==="message_start"&&(ki.delete(e),Ds.delete(e),wi(e),c.setSessionStatus(e,"running"),c.streamingStartedAt.has(e)||c.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),y.type==="content_block_delta"){const b=y.delta;if((b==null?void 0:b.type)==="text_delta"&&typeof b.text=="string"){const _=Ds.get(e)||{thinking:"",text:""};ki.get(e)==="thinking"&&(_.thinking=""),_.text+=b.text,Ds.set(e,_),ki.set(e,"text"),c.setStreaming(e,_.text),_b(e,_.text,"text")}if((b==null?void 0:b.type)==="thinking_delta"&&typeof b.thinking=="string"){const _=Ds.get(e)||{thinking:"",text:""};_.thinking+=b.thinking,Ds.set(e,_),ki.set(e,"thinking"),c.setStreaming(e,_.thinking),_b(e,_.thinking,"thinking")}}if(y.type==="message_delta"){const b=y.usage;b!=null&&b.output_tokens&&c.setStreamingStats(e,{outputTokens:b.output_tokens})}}break}case"result":{Td.delete(e),Ad.delete(e);const y=t.data,b={total_cost_usd:y.total_cost_usd,num_turns:y.num_turns};if(typeof y.total_lines_added=="number"&&(b.total_lines_added=y.total_lines_added),typeof y.total_lines_removed=="number"&&(b.total_lines_removed=y.total_lines_removed),y.modelUsage){for(const _ of Object.values(y.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);b.context_used_percent=Math.max(0,Math.min(j,100))}}c.updateSession(e,b),wi(e),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"),!document.hasFocus()&&c.notificationSound&&Kj(),!document.hasFocus()&&c.notificationDesktop&&vb("Session completed","Claude finished the task",e),y.is_error&&c.appendMessage(e,{id:ss(),role:"system",content:yb(y),timestamp:Date.now()});break}case"permission_request":{if(c.addPermission(e,t.request),!document.hasFocus()&&c.notificationDesktop){const b=t.request;vb("Permission needed",`${b.tool_name}: approve or deny`,b.request_id)}const y=t.request;if(y.tool_name&&y.input){const b=[{type:"tool_use",id:y.tool_use_id,name:y.tool_name,input:y.input}];_p(e,b),wp(e,b),Sp(e,b),kp(e,b)}break}case"permission_cancelled":{c.removePermission(e,t.request_id);break}case"permission_auto_resolved":{c.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{c.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),c.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=c.sdkSessions.find(b=>b.sessionId===e))==null?void 0:p.backendType)==="codex"&&c.appendMessage(e,{id:ss(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{c.appendMessage(e,{id:t.id||ss(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),c.clearPromptSuggestions(e);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:b,status:_,summary:j}=t.event;b&&_&&c.updateProcess(e,b,{status:_,completedAt:Date.now(),summary:j||void 0})}const y=bb(t.event);if(!y)break;c.appendMessage(e,{id:ss(),role:"system",content:y,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?c.setSessionStatus(e,"compacting"):c.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&c.appendMessage(e,{id:ss(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{c.appendMessage(e,{id:ss(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const y=t.phase;y==="terminated"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)?ol(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase},userText:"Response interrupted — the session ended before the reply finished. It will resume automatically."}):ol(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):y==="reconnecting"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)&&ol(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):y==="starting"||y==="initializing"?(c.setCliConnected(e,!1),c.setCliReconnecting(e,!0)):(c.setCliConnected(e,!0),c.setCliReconnecting(e,!1),y==="ready"?c.setSessionStatus(e,"idle"):y==="streaming"?c.setSessionStatus(e,"running"):y==="compacting"?c.setSessionStatus(e,"compacting"):y==="awaiting_permission"&&c.setSessionStatus(e,"running"));break}case"cli_disconnected":{c.setCliConnected(e,!1),c.setCliReconnecting(e,!1),c.setSessionStatus(e,null),c.setStreaming(e,null),c.setStreamingStats(e,null),wi(e)?ol(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):ol(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{c.setCliConnected(e,!0),c.setCliReconnecting(e,!1);break}case"session_name_update":{const y=c.sessionNames.get(e),b=y&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(y);(!y||b)&&(c.setSessionName(e,t.name),c.markRecentlyRenamed(e));break}case"pr_status_update":{c.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{c.setMcpServers(e,t.servers);break}case"message_history":{const y=[],b=new Map;for(let j=0;j<t.messages.length;j++){const E=t.messages[j];if(E.type==="user_message")y.push({id:E.id||ss(),role:"user",content:E.content,timestamp:E.timestamp});else if(E.type==="assistant"){const k=E.message,A=yd(k.content),C={id:k.id,role:"assistant",content:A,contentBlocks:k.content,timestamp:E.timestamp||Date.now(),parentToolUseId:E.parent_tool_use_id,model:k.model,stopReason:k.stop_reason},L=y.findIndex(B=>B.role==="assistant"&&B.id===C.id);if(L===-1?y.push(C):y[L]=Nm(y[L],C),(v=k.content)!=null&&v.length){_p(e,k.content),wp(e,k.content),Sp(e,k.content),kp(e,k.content);const B=E.timestamp||Date.now();for(const D of k.content){if(D.type==="tool_use"){const U=D.input||{},F=b.get(D.id);b.set(D.id,F??jb(D.id,D.name,U,B,E.parent_tool_use_id))}if(D.type==="tool_result"){const U=b.get(D.tool_use_id);U&&b.set(D.tool_use_id,{...U,completedAt:B,isError:U.isError||!!D.is_error,elapsedSeconds:Math.max(U.elapsedSeconds,U.completedAt?U.elapsedSeconds:Math.max(0,(B-U.startedAt)/1e3))})}}}}else if(E.type==="result"){const k=E.data;k.is_error&&y.push({id:`hist-error-${j}`,role:"system",content:yb(k),timestamp:Date.now()});const A={total_cost_usd:k.total_cost_usd,num_turns:k.num_turns};if(typeof k.total_lines_added=="number"&&(A.total_lines_added=k.total_lines_added),typeof k.total_lines_removed=="number"&&(A.total_lines_removed=k.total_lines_removed),k.modelUsage){for(const C of Object.values(k.modelUsage))if(C.contextWindow>0){const L=C,B=Math.round((L.inputTokens+L.outputTokens)/L.contextWindow*100);A.context_used_percent=Math.max(0,Math.min(B,100))}}c.updateSession(e,A)}else if(E.type==="system_event"){const k=bb(E.event);if(!k)continue;y.push({id:`hist-system-event-${j}`,role:"system",content:k,timestamp:E.timestamp||Date.now()})}}if(y.length>0){const j=c.messages.get(e)||[];if(j.length===0)c.setMessages(e,y);else{const E=[...j];for(const k of y){const A=E.findIndex(L=>L.id===k.id);if(A===-1){E.push(k);continue}const C=E[A];C.role==="assistant"&&k.role==="assistant"?E[A]=Nm(C,k):E[A]=k}E.sort((k,A)=>(k.timestamp??0)-(A.timestamp??0)),c.setMessages(e,E)}}c.setToolActivity(e,Array.from(b.values()).sort((j,E)=>j.startedAt-E.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(wi(e),c.setStreaming(e,null),ki.delete(e),Ds.delete(e),c.setStreamingStats(e,null),c.clearToolProgress(e),c.setSessionStatus(e,"idle"));break}case"event_replay":{let y;for(const b of t.events){const _=jm(e);b.seq<=_||(Sb(e,b.seq),y=b.seq,o5(e,b.message,{processSeq:!1,ackSeqMessage:!1}))}typeof y=="number"&&kb(e,y);break}case"prompt_suggestion":{const y=t.suggestions;c.setPromptSuggestions(e,y);break}case"streamlined_text":{c.appendMessage(e,{id:ss(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{c.appendMessage(e,{id:ss(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Tc(e){const t=Vr.get(e);if(s5(t))return;if(t){try{t.close()}catch{}Vr.delete(e)}X.getState().setConnectionStatus(e,"connecting");const s=new WebSocket(HN(e));Vr.set(e,s),s.onopen=()=>{const a=jm(e);s.send(JSON.stringify({type:"session_subscribe",last_seq:a})),$N(e,s);const c=Is.get(e);c&&(clearTimeout(c),Is.delete(e))},s.onmessage=a=>VN(e,a),s.onclose=()=>{Vr.get(e)===s&&(Vr.delete(e),X.getState().setConnectionStatus(e,"disconnected"),GN(e))},s.onerror=()=>{s.close()}}function GN(e){if(Is.has(e)||xc)return;const t=setTimeout(()=>{Is.delete(e),!xc&&i5(e)&&Tc(e)},TN);Is.set(e,t)}function Cm(e){const t=Is.get(e);t&&(clearTimeout(t),Is.delete(e));const n=Vr.get(e);n&&(n.close(),Vr.delete(e)),X.getState().setConnectionStatus(e,"disconnected"),Td.delete(e),Ad.delete(e),Qo.delete(e),vd.delete(e),ki.delete(e),sc.delete(e),Ds.delete(e),Ed.delete(e),gc.delete(e)}function YN(e){if(!xc)for(const t of e)t.archived||Tc(t.sessionId)}function WN(e){return new Promise((t,n)=>{const s=setInterval(()=>{const c=Vr.get(e);(c==null?void 0:c.readyState)===WebSocket.OPEN&&(clearInterval(s),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(s),n(new Error("Connection timeout"))},1e4)})}function Pn(e,t){const n=Vr.get(e);let s=t;const a=FN.has(t.type);if(a)switch(t.type){case"user_message":case"permission_response":case"interrupt":case"set_model":case"set_permission_mode":case"mcp_get_status":case"mcp_toggle":case"mcp_reconnect":case"mcp_set_servers":case"set_ai_validation":t.client_msg_id||(s={...t,client_msg_id:a5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(s));return}a&&PN(e,s)}function Nb(e){Pn(e,{type:"mcp_get_status"})}function XN(e,t,n){Pn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function QN(e,t){Pn(e,{type:"mcp_reconnect",serverName:t})}function KN(e,t){Pn(e,{type:"mcp_set_servers",servers:t})}function ZN(e,t){Pn(e,{type:"set_ai_validation",...t})}var se=typeof window<"u"?window:void 0,bn=typeof globalThis<"u"?globalThis:se;typeof self>"u"&&(bn.self=bn),typeof File>"u"&&(bn.File=function(){});var Un=bn==null?void 0:bn.navigator,Ne=bn==null?void 0:bn.document,nn=bn==null?void 0:bn.location,Em=bn==null?void 0:bn.fetch,Tm=bn!=null&&bn.XMLHttpRequest&&"withCredentials"in new bn.XMLHttpRequest?bn.XMLHttpRequest:void 0,Cb=bn==null?void 0:bn.AbortController,JN=bn==null?void 0:bn.CompressionStream,Zn=Un==null?void 0:Un.userAgent,Le=se??{},Eb="1.396.4",Zt={DEBUG:!1,LIB_VERSION:Eb,LIB_NAME:"web",JS_SDK_VERSION:Eb};function Tb(e,t,n,s,a,c,u){try{var f=e[c](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(s,a)}function vn(e){return function(){var t=this,n=arguments;return new Promise((function(s,a){var c=e.apply(t,n);function u(h){Tb(c,s,a,u,f,"next",h)}function f(h){Tb(c,s,a,u,f,"throw",h)}u(void 0)}))}}function ye(){return ye=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ye.apply(null,arguments)}function c5(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.indexOf(s)!==-1)continue;n[s]=e[s]}return n}var Ab=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Mb(e){return typeof e=="string"||e}function Rb(e){return typeof e=="string"?e:void 0}var Oo,Ps=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),zb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),eC=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],tC=["token"],u5="NativeGzipValidationError",Am=e=>e.length>=2&&e[0]===31&&e[1]===139,Lb=(e,t)=>e===zb.GZipJS||t===zb.GZipJS||t==="gzip",Db=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",td=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=u5,t},nC=(function(){var e=vn((function*(t,n){18>t.size&&td("too-short");var s=new Uint8Array(yield t.slice(0,10).arrayBuffer());Am(s)&&s[2]===8||td("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Oo)return Oo;Oo=[];for(var g=0;256>g;g++){for(var v=g,y=0;8>y;y++)v=1&v?3988292384^v>>>1:v>>>1;Oo[g]=v>>>0}return Oo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&td("invalid-crc");var c=n.length>>>0;a.getUint32(4,!0)!==c&&td("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Mm(){return Mm=vn((function*(e,t,n){t===void 0&&(t=!0);try{var s=new TextEncoder().encode(e),a=new CompressionStream("gzip"),c=a.writable.getWriter(),u=c.write(s).then((()=>c.close())).catch((function(){var p=vn((function*(g){try{yield c.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(a.readable).blob(),[h]=yield Promise.all([f,u]);return yield nC(h,s),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Mm.apply(this,arguments)}var rC=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ob=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return rC.concat(t).some((s=>{var a=s.toLowerCase();return n.indexOf(a)!==-1}))};function Ie(e,t){return e.indexOf(t)!==-1}var af=function(e){return e.trim()},Rm=function(e){return e.replace(/^\$/,"")},d5=Object.prototype,f5=d5.hasOwnProperty,lf=d5.toString,rt=Array.isArray||function(e){return lf.call(e)==="[object Array]"},as=e=>typeof e=="function",Ut=e=>e===Object(e)&&!rt(e),ji=e=>{if(Ut(e)){for(var t in e)if(f5.call(e,t))return!1;return!0}return!1},Se=e=>e===void 0,Ct=e=>lf.call(e)=="[object String]",zm=e=>Ct(e)&&e.trim().length===0,Fn=e=>e===null,Qe=e=>Se(e)||Fn(e),Hn=e=>lf.call(e)=="[object Number]"&&e==e,Os=e=>Hn(e)&&e>0,us=e=>lf.call(e)==="[object Boolean]",sC=e=>e instanceof FormData,iC=e=>Ie(eC,e),aC=e=>Ie(tC,e);function h5(e){return e===null||typeof e!="object"}function Md(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Mg(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var lC=[!0,"true",1,"1","yes"],Np=e=>Ie(lC,e),oC=[!1,"false",0,"0","no"];function cs(e,t,n,s,a){return t>n&&(s.warn("min cannot be greater than max."),t=n),Hn(e)?e>n?(s.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),cs(a||n,t,n,s))}class cC{constructor(t){this.Ee={},this.Pe=t.Pe,this.Fe=cs(t.bucketSize,0,100,t.Ae),this.$e=cs(t.refillRate,0,this.Fe,t.Ae),this.De=cs(t.refillInterval,0,864e5,t.Ae)}Ne(t,n){var s=Math.floor((n-t.lastAccess)/this.De);s>0&&(t.tokens=Math.min(t.tokens+s*this.$e,this.Fe),t.lastAccess=t.lastAccess+s*this.De)}consumeRateLimit(t){var n,s=Date.now(),a=String(t),c=this.Ee[a];return c?this.Ne(c,s):this.Ee[a]=c={tokens:this.Fe,lastAccess:s},c.tokens===0||(c.tokens--,c.tokens===0&&((n=this.Pe)==null||n.call(this,t)),c.tokens===0)}stop(){this.Ee={}}}var hr="Mobile",Rd="iOS",Hs="Android",Nl="Tablet",p5=Hs+" "+Nl,m5="iPad",g5="Apple",x5=g5+" Watch",ic="Safari",Cl="BlackBerry",v5="Samsung",b5=v5+"Browser",y5=v5+" Internet",ga="Chrome",uC=ga+" OS",_5=ga+" "+Rd,Rg="Internet Explorer",w5=Rg+" "+hr,zg="Opera",dC=zg+" Mini",Lg="Edge",S5="Microsoft "+Lg,Sl="Firefox",k5=Sl+" "+Rd,vc="Nintendo",bc="PlayStation",kl="Xbox",j5=Hs+" "+hr,N5=hr+" "+ic,Ko="Windows",Lm=Ko+" Phone",Bb="Nokia",Dm="Ouya",C5="Generic",fC=C5+" "+hr.toLowerCase(),E5=C5+" "+Nl.toLowerCase(),Om="Konqueror",T5="Oculus Browser",zd="Vivaldi",A5="Yandex",Ld="Whale",Bm="DuckDuckGo",M5="Pale Moon",Dd="Waterfox",ac="Brave",R5="Google Search App",Vt="(\\d+(\\.\\d+)?)",Cp=new RegExp("Version/"+Vt),hC=new RegExp(kl,"i"),pC=new RegExp(bc+" \\w+","i"),mC=new RegExp(vc+" \\w+","i"),Dg=new RegExp(Cl+"|PlayBook|BB10","i"),gC={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},z5=function(e,t,n,s){t=t||"";var a=(function(c){return c!=null&&c.brave?ac:null})(n);return a||(s!=null&&s.detectGoogleSearchApp&&Ie(e,"GSA/")?R5:Ie(e," OPR/")&&Ie(e,"Mini")?dC:Ie(e," OPR/")?zg:Dg.test(e)?Cl:Ie(e,"IE"+hr)||Ie(e,"WPDesktop")?w5:Ie(e,"OculusBrowser")?T5:Ie(e,b5)?y5:Ie(e,Lg)||Ie(e,"Edg/")?S5:Ie(e,zd+"/")?zd:Ie(e,"YaBrowser/")?A5:Ie(e,Ld+"/")?Ld:Ie(e,Bm+"/")||Ie(e,"Ddg/")?Bm:Ie(e,"FBIOS")?"Facebook "+hr:Ie(e,"UCWEB")||Ie(e,"UCBrowser")?"UC Browser":Ie(e,"CriOS")?_5:Ie(e,"CrMo")||Ie(e,ga)?ga:Ie(e,Hs)&&Ie(e,ic)?j5:Ie(e,"FxiOS")?k5:Ie(e.toLowerCase(),Om.toLowerCase())?Om:Ie(e,ac+"/")?ac:((c,u)=>u&&Ie(u,g5)||(function(f){return Ie(f,ic)&&!Ie(f,ga)&&!Ie(f,Hs)})(c))(e,t)?Ie(e,hr)?N5:ic:Ie(e,"PaleMoon/")?M5:Ie(e,Dd+"/")?Dd:Ie(e,Sl)?Sl:Ie(e,"MSIE")||Ie(e,"Trident/")?Rg:Ie(e,"Gecko")?Sl:"")},xC={[w5]:[new RegExp("rv:"+Vt)],[S5]:[new RegExp(Lg+"?\\/"+Vt)],[ga]:[new RegExp("("+ga+"|CrMo)\\/"+Vt)],[_5]:[new RegExp("CriOS\\/"+Vt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Vt)],[ic]:[Cp],[N5]:[Cp],[zg]:[new RegExp("(Opera|OPR)\\/"+Vt)],[Sl]:[new RegExp(Sl+"\\/"+Vt)],[k5]:[new RegExp("FxiOS\\/"+Vt)],[Om]:[new RegExp("Konqueror[:/]?"+Vt,"i")],[Cl]:[new RegExp(Cl+" "+Vt),Cp],[j5]:[new RegExp("android\\s"+Vt,"i")],[y5]:[new RegExp(b5+"\\/"+Vt)],[T5]:[new RegExp("OculusBrowser\\/"+Vt)],[zd]:[new RegExp(zd+"\\/"+Vt)],[A5]:[new RegExp("YaBrowser\\/"+Vt)],[Ld]:[new RegExp(Ld+"\\/"+Vt)],[ac]:[new RegExp(ac+"\\/"+Vt)],[Bm]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Vt)],[M5]:[new RegExp("PaleMoon\\/"+Vt)],[Dd]:[new RegExp(Dd+"\\/"+Vt)],[R5]:[new RegExp("GSA\\/"+Vt)],[Rg]:[new RegExp("(rv:|MSIE )"+Vt)],Mozilla:[new RegExp("rv:"+Vt)]},vC=function(e,t,n,s){var a=z5(e,t,n,s),c=xC[a];if(Se(c))return null;for(var u=0;c.length>u;u++){var f=e.match(c[u]);if(f)return parseFloat(f[f.length-2])}return null},Pb=[[new RegExp(kl+"; "+kl+" (.*?)[);]","i"),e=>[kl,e&&e[1]||""]],[new RegExp(vc,"i"),[vc,""]],[new RegExp(bc,"i"),[bc,""]],[Dg,[Cl,""]],[new RegExp(Ko,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Lm,""];if(new RegExp(hr).test(t)&&!/IEMobile\b/.test(t))return[Ko+" "+hr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var s=gC[n[1]]||"";return/arm/i.test(t)&&(s="RT"),[Ko,s]}return[Ko,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Rd,[e[3],e[4],e[5]||"0"].join(".")]:[Rd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Se(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Hs+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Hs+")","i"),e=>e&&e[2]?[Hs,[e[2],e[3],e[4]||"0"].join(".")]:[Hs,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[uC,""]],[/Linux|debian/i,["Linux",""]]],$b=function(e){return mC.test(e)?vc:pC.test(e)?bc:hC.test(e)?kl:new RegExp(Dm,"i").test(e)?Dm:new RegExp("("+Lm+"|WPDesktop)","i").test(e)?Lm:/iPad/.test(e)?m5:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?x5:Dg.test(e)?Cl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Bb,"i").test(e)?Bb:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(hr).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Hs:p5:new RegExp("(pda|"+hr+")","i").test(e)?fC:new RegExp(Nl,"i").test(e)&&!new RegExp(Nl+" pc","i").test(e)?E5:""},bC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ub(e,t){return typeof(n=e)=="string"&&bC.test(n)?e:t();var n}function Ei(e){return e&&e.split("#")[0]}function Ep(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var yC=e=>e instanceof Error,L5={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},_C=L5.info;function D5(e){if(us(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(rt(e))return{arrayValue:{values:e.map((t=>D5(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function O5(e){var t=[];for(var n in e){var s=e[n];Fn(s)||Se(s)||t.push({key:n,value:D5(s)})}return t}function wC(e,t){var n=e.level||"info",{text:s,number:a}=L5[n]||_C,c=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),Qe(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),Qe(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var f=ye({},u,e.attributes||{}),h={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:a,severityText:s,body:{stringValue:e.body},attributes:O5(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),Se(e.trace_flags)||(h.flags=e.trace_flags),h}function B5(e,t,n){return ye({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function P5(e,t,n,s){return{resourceLogs:[{resource:{attributes:O5(t)},scopeLogs:[{scope:{name:n,version:s},logRecords:e}]}]}}let SC=class{constructor(e,t,n,s,a,c,u){var f;c===void 0&&(c=()=>Promise.resolve()),this._instance=e,this.Se=t,this.Ae=n,this.qe=s,this.je=a,this.Be=c,this.He=u,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=t.maxBufferSize,this.Je=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.Ye=t.flushIntervalMs,this.Ke=t.maxBatchRecordsPerPost,this.Xe=t.rateCapWindowMs,this.et=t.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.it(e);if(t!==null)if(t.body){if(this.nt()){var n={record:wC(t,this.qe())};this.je((()=>this.st(n)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(e){var t=this.Se.beforeSend;if(!t)return e;var n=rt(t)?t:[t],s=e;for(var a of n)try{var c=a(s);if(!c)return this.Ae.info("Log was rejected in beforeSend function"),null;s=c}catch(u){return this.Ae.error("Error in beforeSend function for log:",u),null}return s}nt(){if(this.et===void 0)return!0;var e=Date.now(),t=e-this.We;return this.Xe>t&&t>=0||(this.We=e,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var e=this;return vn((function*(){if(!e._instance.isDisabled)return e.Ue||(e.Ue=e.ot().finally((()=>{e.Ue=null}))),e.Ue}))()}ot(){var e=this;return vn((function*(){var t;e.tt();var n=(t=e._instance.getPersistedProperty(Ps.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var s=n.length,a=0;n.length>0&&s>a;){var c,u;e.ze=0;var f=Math.min(n.length,e.Ke),h=n.slice(0,f),p=P5(h.map((v=>v.record)),e.ut(),(c=e.He)!==null&&c!==void 0?c:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.ht(p);if(g.kind==="too-large"&&h.length>1)e.Ke=Math.max(1,Math.floor(h.length/2)),e.Ae.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.Ke);else if(g.kind==="retry-later"||(g.kind==="too-large"?e.Ae.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):g.kind==="ok"&&e.Se.maxBatchRecordsPerPost>e.Ke&&(e.Ke=Math.min(e.Se.maxBatchRecordsPerPost,e.Ke+1)),yield e.dt(h.length),n=(u=e._instance.getPersistedProperty(Ps.LogsQueue))!==null&&u!==void 0?u:[],a+=h.length,g.kind==="fatal"))throw g.error}}))()}dt(e){var t=this;return vn((function*(){var n,s=Math.max(0,e-t.ze),a=(n=t._instance.getPersistedProperty(Ps.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Ps.LogsQueue,a.slice(s)),yield t.Be()}))()}ut(){return B5(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Ps.LogsQueue))!==null&&t!==void 0?t:[];this.Je>n.length||(n.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Ps.LogsQueue,n),this.Qe>n.length?this.ct():this.rt()}}ct(e){e===void 0&&(e=this.Ye),this.vt||(this.vt=Ep((()=>{this.vt=void 0,this.rt()}),e))}ft(){var e=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,e)}yt(){var e=this._instance.getPersistedProperty(Ps.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return vn((function*(){t.tt();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((s=>Ep(s,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return vn((function*(){var n=!1,s=t.flush(),a=new Promise((c=>Ep((()=>{n=!0,c()}),e)));try{yield Promise.race([s,a])}finally{n&&s.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(e=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var nd,Fb,Tp;function kC(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Tp&&n.length===Fb||(Fb=n.length,Tp=n.reduce(((s,a)=>{nd||(nd={});var c=nd[a];if(c)s[c[0]]=c[1];else for(var u=e(a),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[a];if(p&&g){s[p]=g,nd[a]=[p,g];break}}return s}),{})),Tp}}class jC{constructor(t,n,s){s===void 0&&(s=[]),this.coercers=t,this.stackParser=n,this.modifiers=s}buildFromUnknown(t,n){n===void 0&&(n={});var s=n&&n.mechanism||{handled:!0,type:"generic"},a=this.buildCoercingContext(s,n,0).apply(t),c=this.buildParsingContext(n),u=this.parseStacktrace(a,c);return{$exception_list:this.convertToExceptionList(u,s),$exception_level:"error"}}modifyFrames(t){var n=this;return vn((function*(){for(var s of t)s.stacktrace&&s.stacktrace.frames&&rt(s.stacktrace.frames)&&(s.stacktrace.frames=yield n.applyModifiers(s.stacktrace.frames));return t}))()}coerceFallback(t){var n;return{type:"Error",value:"Unknown error",stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(t,n){var s,a;return t.cause!=null&&(s=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),ye({},t,{cause:s,stack:a})}applyChunkIds(t,n){return t.map((s=>(s.filename&&n&&(s.chunk_id=n[s.filename]),s)))}applyCoercers(t,n){for(var s of this.coercers)if(s.match(t))return s.coerce(t,n);return this.coerceFallback(n)}applyModifiers(t){var n=this;return vn((function*(){var s=t;for(var a of n.modifiers)s=yield a(s);return s}))()}convertToExceptionList(t,n){var s,a,c,u={type:t.type,value:t.value,mechanism:{type:(s=n.type)!==null&&s!==void 0?s:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(c=t.synthetic)!==null&&c!==void 0&&c}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,ye({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:kC(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,s){s===void 0&&(s=0);var a=(c,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(c,f)}};return ye({},n,{syntheticException:s==0?n.syntheticException:void 0,mechanism:t,apply:c=>a(c,s),next:c=>a(c,s+1)})}}var El="?";function Pm(e,t,n,s,a){var c={platform:e,filename:t,function:n==="<anonymous>"?El:n,in_app:!0};return Se(s)||(c.lineno=s),Se(a)||(c.colno=a),c}var $5=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return n||s?[e.indexOf("@")!==-1?e.split("@")[0]:El,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},NC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,CC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,EC=/\((\S*)(?::(\d+))(?::(\d+))\)/,TC=(e,t)=>{var n=NC.exec(e);if(n){var[,s,a,c]=n;return Pm(t,s,El,+a,+c)}var u=CC.exec(e);if(u){if(u[2]&&u[2].indexOf("eval")===0){var f=EC.exec(u[2]);f&&(u[2]=f[1],u[3]=f[2],u[4]=f[3])}var[h,p]=$5(u[1]||El,u[2]);return Pm(t,p,h,u[3]?+u[3]:void 0,u[4]?+u[4]:void 0)}},AC=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,MC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,RC=(e,t)=>{var n=AC.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var s=MC.exec(n[3]);s&&(n[1]=n[1]||"eval",n[3]=s[1],n[4]=s[2],n[5]="")}var a=n[3],c=n[1]||El;return[c,a]=$5(c,a),Pm(t,a,c,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Hb=/\(error: (.*)\)/;class zC{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var s=Ct(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:s?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return Md(t,"DOMException")}isDOMError(t){return Md(t,"DOMError")}}class LC{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var s=t.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(t){return t.stacktrace||t.stack||void 0}}class DC{constructor(){}match(t){return Md(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var s;return n.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var OC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class BC{match(t){return typeof t=="string"}coerce(t,n){var s,[a,c]=this.getInfos(t);return{type:a??"Error",value:c??t,stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(t){var n="Error",s=t,a=t.match(OC);return a&&(n=a[1],s=a[2]),[n,s]}}var PC=["fatal","error","warning","log","info","debug"];function U5(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var s=n.length;s>0;s--){var a=n.slice(0,s).join(", ");if(t>=a.length)return s===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class $C{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var s,a=this.getErrorPropertyFromObject(t);return a?n.apply(a):{type:this.getType(t),value:this.getValue(t),stack:(s=n.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Mg(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var s=this.getObjectClassName(t);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+U5(t)}isSeverityLevel(t){return Ct(t)&&!zm(t)&&PC.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var s=t[n];if(yC(s))return s}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class UC{match(t){return Mg(t)}coerce(t,n){var s,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+U5(t),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class FC{match(t){return h5(t)}coerce(t,n){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class HC{match(t){return Md(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Mg(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var s,a=this.getUnhandledRejectionReason(t);return h5(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(s=n.syntheticException)==null?void 0:s.stack,synthetic:!0}:n.apply(a)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var Od="$message",Bd="$timestamp",IC=new Set([Od,Bd]),Ap={enabled:!0,max_bytes:32768};function Pd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Ap.enabled,max_bytes:VC(e.max_bytes,Ap.max_bytes)}:ye({},Ap)}class qC{constructor(t){this.bt=[],this._t=0,this.Se=Pd(t)}setConfig(t){this.Se=Pd(t),this.wt()}add(t){var n=(function(a){var c,u,f;try{f=[],c=(u=JSON.stringify(a,(function(y,b){if(typeof b=="bigint")return b.toString();if(typeof b!="function"&&typeof b!="symbol"){if(b instanceof Error)return{name:b.name,message:b.message,stack:b.stack};if(b&&typeof b=="object"){for(;f.length>0&&f[f.length-1]!==this;)f.pop();if(f.includes(b))return"[Circular]";f.push(b)}return b}})))!==null&&u!==void 0?u:"null"}catch{return}try{var h=JSON.parse(c);if(!Ut(h))return;var p=h,g=p[Od],v=p[Bd];return!Ct(g)||g.trim().length===0||!Ct(v)&&!Hn(v)?void 0:{step:p,json:c}}catch{return}})(t);if(n){var s=(function(a){if(typeof TextEncoder<"u")return new TextEncoder().encode(a).length;for(var c=encodeURIComponent(a),u=0,f=0;c.length>f;f++)c[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);s>this.Se.max_bytes||(this.bt.push({step:n.step,bytes:s}),this._t+=s,this.wt())}}getAttachable(){return this.bt.map((t=>t.step))}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var t=this.bt.shift();t&&(this._t-=t.bytes)}}}function VC(e,t){if(!Hn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var F5=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,s={k(a){if(se&&(Zt.DEBUG||Le.POSTHOG_DEBUG||n)&&!Se(se.console)&&se.console){for(var c=("__rrweb_original__"in se.console[a])?se.console[a].__rrweb_original__:se.console[a],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];c(e,...f)}},debug(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];s.k("debug",...c)},info(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];s.k("log",...c)},warn(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];s.k("warn",...c)},error(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];s.k("error",...c)},critical(){for(var a=arguments.length,c=new Array(a),u=0;a>u;u++)c[u]=arguments[u];console.error(e,...c)},uninitializedWarning(a){s.error("You must initialize PostHog before calling "+a)},createLogger:(a,c)=>F5(e+" "+a,c)};return s},we=F5("[PostHog.js]"),Gt=we.createLogger,GC=Gt("[ExternalScriptsLoader]"),Mp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return GC.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var s=Ne==null?void 0:Ne.querySelectorAll("script");if(s){for(var a,c=function(){if(s[u].src===t){var h=s[u];return h.__posthog_loading_callback_fired?{v:n()}:(h.addEventListener("load",(p=>{h.__posthog_loading_callback_fired=!0,n(void 0,p)})),h.onerror=p=>n(p),{v:void 0})}},u=0;s.length>u;u++)if(a=c())return a.v}var f=()=>{if(!Ne)return n("document not found");var h=Ne.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=v=>{h.__posthog_loading_callback_fired=!0,n(void 0,v)},h.onerror=v=>n(v),e.config.prepare_external_dependency_script&&(h=e.config.prepare_external_dependency_script(h)),!h)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Ne.head.appendChild(h);else{var p,g=Ne.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ne.body.appendChild(h)}};Ne!=null&&Ne.body?f():Ne==null||Ne.addEventListener("DOMContentLoaded",f)};Le.__PosthogExtensions__=Le.__PosthogExtensions__||{},Le.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!=="remote-config"){var s;if(e.config.strict_script_versioning)s=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var a="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var c=3e5;a=a+"&t="+Math.floor(Date.now()/c)*c}s=e.requestRouter.endpointFor("assets",a)}Mp(e,s,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Mp(e,u,n)}},Le.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);Mp(e,s,n)};var H5="$people_distinct_id",$d="$device_id",Rp="$device_model",Zo="__alias",Jo="__timers",$m="$autocapture_disabled_server_side",Um="$heatmaps_enabled_server_side",Fm="$exception_capture_enabled_server_side",Hm="$error_tracking_suppression_rules",Im="$error_tracking_capture_extension_exceptions",qm="$web_vitals_enabled_server_side",Og="$dead_clicks_enabled_server_side",Bg="$product_tours_enabled_server_side",Vm="$web_vitals_allowed_metrics",ma="$session_recording_remote_config",I5="$replay_sample_rate",q5="$replay_override_sampling",V5="$replay_override_linked_flag",G5="$replay_override_url_trigger",Y5="$replay_override_event_trigger",_l="$sesid",Pg="$session_is_sampled",pa="$enabled_feature_flags",_d="$active_feature_flags",ec="$early_access_features",Gm="$feature_flag_details",wd="$feature_flag_payloads",Ym="$feature_flag_request_id",Bs="$override_feature_flags",xl="$override_feature_flag_payloads",ua="$stored_person_properties",da="$stored_group_properties",Wm="$surveys",$g="$surveys_loaded_at",Xm="$surveys_activated",tc="ph_product_tours",lc="$flag_call_reported",Qm="$flag_call_reported_session_id",Km="$feature_flag_errors",yc="$feature_flag_evaluated_at",qr="$user_state",Zm="$client_session_props",Jm="$capture_rate_limit",eg="$initial_campaign_params",tg="$initial_referrer_info",Ud="$initial_person_info",Fd="$epp",W5="__POSTHOG_TOOLBAR__",rd="$posthog_cookieless",X5="$sdk_debug_extensions_init_method",Q5="$sdk_debug_extensions_init_time_ms",K5="$sdk_debug_recording_script_not_loaded",ng="PostHog loadExternalDependency extension not found.",fa="on_reject",Us="always",cl="anonymous",ul="identified",rg="identified_only",Hd="visibilitychange",Id="beforeunload",vl="$pageview",zp="$pageleave",Lp="$identify",Ib="$groupidentify";function sd(e,t){rt(e)&&e.forEach(t)}function Mt(e,t){if(!Qe(e))if(rt(e))e.forEach(t);else if(sC(e))e.forEach(((s,a)=>t(s,a)));else for(var n in e)f5.call(e,n)&&t(e[n],n)}var Bt=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;t>s;s++)n[s-1]=arguments[s];for(var a of n)for(var c in a)a[c]!==void 0&&(e[c]=a[c]);return e};function Sd(e){for(var t=Object.keys(e),n=t.length,s=new Array(n);n--;)s[n]=[t[n],e[t[n]]];return s}var qb=function(e){try{return e()}catch{return}},YC=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),s=0;t>s;s++)n[s]=arguments[s];return e.apply(this,n)}catch(a){we.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),we.critical(a)}}},Ug=function(e){var t={};return Mt(e,(function(n,s){(Ct(n)&&n.length>0||Hn(n))&&(t[s]=n)})),t},WC=["herokuapp.com","vercel.app","netlify.app"];function XC(e){var t=e==null?void 0:e.hostname;if(!Ct(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of WC)if(n===s)return!1;return!0}function Xt(e,t,n,s){var{capture:a=!1,passive:c=!0}=s??{};e==null||e.addEventListener(t,n,{capture:a,passive:c})}function Z5(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Hn(e)&&isFinite(e)&&Math.floor(e)===e});class qd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,s,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(a)||0>t||0>n||0>s||0>a||t>0xffffffffffff||n>4095||s>1073741823||a>4294967295)throw new RangeError("invalid field value");var c=new Uint8Array(16);return c[0]=t/Math.pow(2,40),c[1]=t/Math.pow(2,32),c[2]=t/Math.pow(2,24),c[3]=t/Math.pow(2,16),c[4]=t/Math.pow(2,8),c[5]=t,c[6]=112|n>>>8,c[7]=n,c[8]=128|s>>>24,c[9]=s>>>16,c[10]=s>>>8,c[11]=s,c[12]=a>>>24,c[13]=a>>>16,c[14]=a>>>8,c[15]=a,new qd(c)}toString(){for(var t="",n=0;this.bytes.length>n;n++)t=t+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new qd(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;16>n;n++){var s=this.bytes[n]-t.bytes[n];if(s!==0)return Math.sign(s)}return 0}}class QC{constructor(){this.S=0,this.C=0,this.I=new KC}generate(){var t=this.generateOrAbort();if(Se(t)){this.S=0;var n=this.generateOrAbort();if(Se(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.M();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return qd.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Vb,J5=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};se&&!Se(se.crypto)&&crypto.getRandomValues&&(J5=e=>crypto.getRandomValues(e));class KC{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(J5(this.R),this.O=0),this.R[this.O++]}}var $s=()=>ZC().toString(),ZC=()=>(Vb||(Vb=new QC)).generate(),Bo="",JC=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,os={N:()=>!!Ne,D(e){we.error("cookieStore error: "+e)},A(e){if(Ne){try{for(var t=e+"=",n=Ne.cookie.split(";").filter((c=>c.length)),s=0;n.length>s;s++){for(var a=n[s];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(os.A(e))||{}}catch{}return t},q(e,t,n,s,a){if(!Ne)return!1;try{var c="",u="",f=(function(g,v){if(v){var y=(function(_,j){if(j===void 0&&(j=Ne),Bo)return Bo;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var E=_.split("."),k=Math.min(E.length,8),A="dmn_chk_"+$s();!Bo&&k--;){var C=E.slice(k).join("."),L=A+"=1;domain=."+C+";path=/";j.cookie=L+";max-age=3",j.cookie.includes(A)&&(j.cookie=L+";max-age=0",Bo=C)}return Bo})(g);if(!y){var b=(_=>{var j=_.match(JC);return j?j[0]:""})(g);b!==y&&we.info("Warning: cookie subdomain discovery mismatch",b,y),y=b}return y?"; domain=."+y:""}return""})(Ne.location.hostname,s);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),c="; expires="+h.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+c+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&we.warn("cookieStore warning: large cookie, len="+p.length),Ne.cookie=p,!0}catch{return!1}},P(e,t){if(Ne!=null&&Ne.cookie)try{os.q(e,"",-1,t)}catch{return}}},Dp=null,At={N(){if(!Fn(Dp))return Dp;var e=!0;if(Se(se))e=!1;else try{var t="__mplssupport__";At.q(t,"xyz"),At.A(t)!=='"xyz"'&&(e=!1),At.P(t)}catch{e=!1}return e||we.error("localStorage unsupported; falling back to cookie store"),Dp=e,e},D(e){we.error("localStorage error: "+e)},A(e){try{return se==null?void 0:se.localStorage.getItem(e)}catch(t){At.D(t)}return null},F(e){try{return JSON.parse(At.A(e))||{}}catch{}return null},q(e,t){try{return se==null||se.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){At.D(n)}return!1},P(e){try{se==null||se.localStorage.removeItem(e)}catch(t){At.D(t)}}},e3=[$d,"distinct_id",_l,Pg,Fd,Ud,qr],id={},t3={N:()=>!0,D(e){we.error("memoryStorage error: "+e)},A:e=>id[e]||null,F:e=>id[e]||null,q:(e,t)=>(id[e]=t,!0),P(e){delete id[e]}},ra=null,Cn={N(){if(!Fn(ra))return ra;if(ra=!0,Se(se))ra=!1;else try{var e="__support__";Cn.q(e,"xyz"),Cn.A(e)!=='"xyz"'&&(ra=!1),Cn.P(e)}catch{ra=!1}return ra},D(e){we.error("sessionStorage error: ",e)},A(e){try{return se==null?void 0:se.sessionStorage.getItem(e)}catch(t){Cn.D(t)}return null},F(e){try{return JSON.parse(Cn.A(e))||null}catch{}return null},q(e,t){try{return se==null||se.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Cn.D(n)}return!1},P(e){try{se==null||se.sessionStorage.removeItem(e)}catch(t){Cn.D(t)}}};class n3{constructor(t){this._instance=t}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}isOptedOut(){return this.Se.cookieless_mode===Us||this.isRejected()||this.consent===-1&&this.Se.cookieless_mode===fa}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Se.opt_out_capturing_by_default}optInOut(t){this.Ct.q(this.It,t?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.P(this.It,this.Se.cross_subdomain_cookie)}get It(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:s}=this._instance.config;return s||(n?n+t:"__ph_opt_in_out_"+t)}get St(){var t=this.Ct.A(this.It);return Np(t)?1:Ie(oC,t)?0:-1}get Ct(){var t=this.Se.opt_out_capturing_persistence_type,n=t==="localStorage"?At:os;if(!this.Tt||this.Tt!==n){this.Tt=n;var s=t==="localStorage"?os:At;s.A(this.It)&&(this.Tt.A(this.It)||this.optInOut(Np(s.A(this.It))),s.P(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[Un==null?void 0:Un.doNotTrack,Un==null?void 0:Un.msDoNotTrack,Le.doNotTrack].some((t=>Np(t)))}}function ew(e,t){var n,s=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!as(s))return t;try{var a=s(t);return Ct(a)&&a?a:t}catch(c){return we.error("Error in get_current_url, falling back to window.location.href",c),t}}var r3=1,s3=3,i3=11;function Gb(e){return e instanceof Element&&(e.id===W5||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ti(e){return!!e&&e.nodeType===r3}function fr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function tw(e){return!!e&&e.nodeType===s3}function nw(e){return!!e&&e.nodeType===i3&&Ti(e.host)}function Fg(e){return e?af(e).split(/\s+/):[]}function Yb(e,t){var n=(function(s){var a,c=se==null||(a=se.location)==null?void 0:a.href;return Se(c)?void 0:ew(s,c)})(t);return!!(n&&e&&e.some((s=>n.match(s))))}function Vd(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Fg(t)}function rw(e){return Qe(e)?null:af(e).split(/(\s+)/).filter((t=>oc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function _c(e){var t="";return ig(e)&&!lw(e)&&e.childNodes&&e.childNodes.length&&Mt(e.childNodes,(function(n){var s;tw(n)&&n.textContent&&(t+=(s=rw(n.textContent))!==null&&s!==void 0?s:"")})),af(t)}function Op(e){return Se(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Hg=["a","button","form","input","select","textarea","label"];function sg(e,t){if(Se(t))return!0;var n,s=function(c){if(t.some((u=>(function(f,h){var p=f.matches||f.matchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector;try{return!!p&&p.call(f,h)}catch{return!1}})(c,u))))return{v:!0}};for(var a of e)if(n=s(a))return n.v;return!1}function sw(e){var t=e.parentNode;return!(!t||!Ti(t))&&t}var a3=[".ph-no-autocapture","[data-ph-no-autocapture]"],iw=["next","previous","prev",">","<"],l3=[...iw,"+","-","−","–"],Wb=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Xb=[".ph-no-rageclick",".ph-no-capture"],o3=["","text","search","email","password","url","tel","number"];function Qb(e,t){if(!se||Ig(e))return!1;var n,s,a,c,u;if(us(t)?(n=!!t&&Xb,s=void 0,a=!1):(n=(c=t==null?void 0:t.css_selector_ignorelist)!==null&&c!==void 0?c:Xb,s=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(h){return!(!h||!Ti(h))&&(!!fr(h,"textarea")||(fr(h,"input")?Ie(o3,(h.getAttribute("type")||"").toLowerCase()):(function(p){if(p.isContentEditable)return!0;var g=p.getAttribute==null?void 0:p.getAttribute("contenteditable");return g==="true"||g===""})(h)))})(e))return!1;var{targetElementList:f}=aw(e,!1);return!(function(h,p){if(h===!1||Se(h))return!1;var g;if(h===!0)g=iw;else{if(!rt(h))return!1;if(h.length>10)return we.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((v=>v.toLowerCase()))}return p.some((v=>{var{safeText:y,ariaLabel:b}=v;return g.some((_=>Wb(y,_)||Wb(b,_)))}))})(s,f.map((h=>{var p;return{safeText:_c(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!sg(f,n)}var Ig=e=>!e||fr(e,"html")||!Ti(e),aw=(e,t)=>{if(!se||Ig(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,s=[e],a=e;a.parentNode&&!fr(a,"body");)if(nw(a.parentNode))s.push(a.parentNode.host),a=a.parentNode.host;else{var c=sw(a);if(!c)break;if(t||Hg.indexOf(c.tagName.toLowerCase())>-1)n=!0;else{var u=se.getComputedStyle(c);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}s.push(c),a=c}return{parentIsUsefulElement:n,targetElementList:s}};function ig(e){for(var t=e;t.parentNode&&!fr(t,"body");t=t.parentNode){var n=Vd(t);if(Ie(n,"ph-sensitive")||Ie(n,"ph-no-capture"))return!1}if(Ie(Vd(e),"ph-include"))return!0;var s=e.type||"";if(Ct(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var a=e.name||e.id||"";return!Ct(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function lw(e){return!!(fr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||fr(e,"select")||fr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var ow="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",c3=new RegExp("^(?:"+ow+")$"),u3=new RegExp(ow),cw="\\d{3}-?\\d{2}-?\\d{4}",d3=new RegExp("^("+cw+")$"),f3=new RegExp("("+cw+")");function oc(e,t){return t===void 0&&(t=!0),!(Qe(e)||Ct(e)&&(e=af(e),(t?c3:u3).test((e||"").replace(/[- ]/g,""))||(t?d3:f3).test(e)))}function Kb(e){var t=_c(e);return oc(t=(t+" "+uw(e)).trim())?t:""}function uw(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Mt(e.childNodes,(function(n){var s;if(n&&((s=n.tagName)==null?void 0:s.toLowerCase())==="span")try{var a=_c(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+uw(n)).trim())}catch(c){we.error("[AutoCapture]",c)}})),t}function Zb(e){return e.replace(/"|\\"/g,'\\"')}function h3(e){var t=e.attr__class;return t?rt(t)?t:Fg(t):void 0}var ad=Gt("[Dead Clicks]"),p3=()=>!0,m3=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Og)),s=e.instance.config.capture_dead_clicks;return us(s)?s:!!Ut(s)||n};class Jb{get lazyLoadedDeadClicksAutocapture(){return this.Et}constructor(t,n,s){this.instance=t,this.isEnabled=n,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Og]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt((()=>{this.Pt()})):this.stop()}Mt(t){var n,s;(n=Le.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(s=Le.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?ad.error("failed to load script",a):t()}))}Pt(){var t;if(Ne){if(!this.Et&&(t=Le.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Ut(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.Et=Le.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Et.start(Ne),ad.info("starting...")}}else ad.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,ad.info("stopping..."))}}var Bp=Gt("[SegmentIntegration]"),dw="posthog-js";function fw(e,t){var{organization:n,projectId:s,prefix:a,severityAllowList:c=["error"],sendExceptionsToPostHog:u=!0}=t===void 0?{}:t;return f=>{var h,p,g,v,y;if(c!=="*"&&!c.includes(f.level)||!e.__loaded)return f;f.tags||(f.tags={});var b=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());f.tags["PostHog Person URL"]=b,e.sessionRecordingStarted()&&(f.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var _,j=((h=f.exception)==null?void 0:h.values)||[],E=j.map((A=>ye({},A,{stacktrace:A.stacktrace?ye({},A.stacktrace,{type:"raw",frames:(A.stacktrace.frames||[]).map((C=>ye({},C,{platform:"web:javascript"})))}):void 0}))),k={$exception_message:((p=j[0])==null?void 0:p.value)||f.message,$exception_type:(g=j[0])==null?void 0:g.type,$exception_level:f.level,$exception_list:E,$sentry_event_id:f.event_id,$sentry_exception:f.exception,$sentry_exception_message:((v=j[0])==null?void 0:v.value)||f.message,$sentry_exception_type:(y=j[0])==null?void 0:y.type,$sentry_tags:f.tags};return n&&s&&(k.$sentry_url=(a||"https://sentry.io/organizations/")+n+"/issues/?project="+s+"&query="+f.event_id),u&&((_=e.exceptions)==null||_.sendExceptionEvent(k)),f}}class g3{constructor(t,n,s,a,c,u){this.name=dw,this.setupOnce=function(f){f(fw(t,{organization:n,projectId:s,prefix:a,severityAllowList:c,sendExceptionsToPostHog:u==null||u}))}}}class ey{constructor(t){this.Rt=(n,s,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(we.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Lt()}Lt(){var t;this.Ft=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.Rt)}destroy(){var t;(t=this.Ft)==null||t.call(this),this.Ft=void 0}doPageView(t,n){var s,a=this.At(t,n);return this.Ot={pathname:(s=se==null?void 0:se.location.pathname)!==null&&s!==void 0?s:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.At(t,(n=this.Ot)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.Ot)==null?void 0:t.pageViewId}}At(t,n){var s=this.Ot;if(!s)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:s.pageViewId},c=this._instance.scrollManager.getContext();if(c&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:u,lastScrollY:f,maxScrollY:h,maxContentHeight:p,lastContentY:g,maxContentY:v}=c;if(!(Se(u)||Se(f)||Se(h)||Se(p)||Se(g)||Se(v))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),v=Math.ceil(v);var y=u>1?cs(f/u,0,1,we):1,b=u>1?cs(h/u,0,1,we):1,_=p>1?cs(g/p,0,1,we):1,j=p>1?cs(v/p,0,1,we):1;a=Bt(a,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:y,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:b,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:v,$prev_pageview_max_content_percentage:j})}}return s.pathname&&(a.$prev_pageview_pathname=s.pathname),s.timestamp&&(a.$prev_pageview_duration=(t.getTime()-s.timestamp.getTime())/1e3),a}}var ld=["flags","surveys"],x3={[H5]:{exposure:"hidden"},[Zo]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Jo]:{exposure:"hidden"},[$m]:{exposure:"event"},[Um]:{exposure:"hidden"},[Fm]:{exposure:"event"},[Hm]:{exposure:"hidden"},[Im]:{exposure:"event"},[qm]:{exposure:"event"},[Og]:{exposure:"event"},[Bg]:{exposure:"hidden"},[Vm]:{exposure:"event"},[ma]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[_l]:{exposure:"hidden"},[Pg]:{exposure:"event"},[I5]:{exposure:"event",shouldSkipFromEventProperties:e=>Fn(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[pa]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Ut(e))return{};for(var t={},n=Object.keys(e),s=0;n.length>s;s++)t["$feature/"+n[s]]=e[n[s]];return t}},[_d]:{exposure:"event",storageGroup:"flags"},[ec]:{exposure:"hidden"},[Gm]:{exposure:"hidden",storageGroup:"flags"},[wd]:{exposure:"event",storageGroup:"flags"},[Ym]:{exposure:"event",storageGroup:"flags",volatile:!0},[Bs]:{exposure:"event"},[xl]:{exposure:"hidden"},[ua]:{exposure:"hidden"},[da]:{exposure:"hidden"},[Wm]:{exposure:"hidden",storageGroup:"surveys"},[$g]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Xm]:{exposure:"event"},[tc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[lc]:{exposure:"hidden"},[Qm]:{exposure:"hidden"},[Km]:{exposure:"hidden"},[yc]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[qr]:{exposure:"hidden"},[Zm]:{exposure:"hidden"},[Jm]:{exposure:"hidden"},[eg]:{exposure:"hidden"},[tg]:{exposure:"hidden"},[Ud]:{exposure:"hidden"},[Fd]:{exposure:"hidden"},[q5]:{exposure:"event"},[V5]:{exposure:"event"},[G5]:{exposure:"event"},[Y5]:{exposure:"event"},[X5]:{exposure:"event"},[Q5]:{exposure:"event"},[K5]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},v3=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],sa=e=>{var t=x3[e];if(t)return t;for(var[n,s]of v3)if(e.indexOf(n)===0)return s},Gd=e=>{var t=Ne==null?void 0:Ne.createElement("a");return Se(t)?null:(t.href=e,t)},Tl=function(e,t){for(var n,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;s.length>a;a++){var c=s[a].split("=");if(c[0]===t){n=c;break}}if(!rt(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{we.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},wc=function(e,t,n){if(!e||!t||!t.length)return e;for(var s=e.split("#"),a=s[1],c=(s[0]||"").split("?"),u=c[1],f=c[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var v=h[g].split("=");rt(v)&&(t.includes(v[0])?p.push(v[0]+"="+n):p.push(h[g]))}var y=f;return u!=null&&(y+="?"+p.join("&")),a!=null&&(y+="#"+a),y},Yd=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},od="https?://(.*)",Al=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],b3=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Al],Sc="<masked>",y3=["li_fat_id"];function hw(e,t,n){if(!Ne)return{};var s,a=t?[...Al,...n||[]]:[],c=pw(wc(Ne.URL,a,Sc),e),u=(s={},Mt(y3,(function(f){var h=os.A(f);s[f]=h||null})),s);return Bt(u,c)}function pw(e,t){var n=b3.concat(t||[]),s={};return Mt(n,(function(a){var c=Tl(e,a);s[a]=c||null})),s}function mw(e){var t=(function(c){return c?c.search(od+"google.([^/?]*)")===0?"google":c.search(od+"bing.com")===0?"bing":c.search(od+"yahoo.com")===0?"yahoo":c.search(od+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",s={};if(!Fn(t)){s.$search_engine=t;var a=Ne?Tl(Ne.referrer,n):"";a.length&&(s.ph_keyword=a)}return s}function ty(){return navigator.language||navigator.userLanguage}var Wd="$direct";function gw(){return(Ne==null?void 0:Ne.referrer)||Wd}function xw(e,t,n){n===void 0&&(n=!1);var s=e?[...Al,...t||[]]:[],a=n?Ei(nn==null?void 0:nn.href):nn==null?void 0:nn.href,c=a==null?void 0:a.substring(0,1e3);return{r:gw().substring(0,1e3),u:c?wc(c,s,Sc):void 0}}function vw(e,t){var n;t===void 0&&(t=!1);var{r:s,u:a}=e,c=t?Ei(a):a,u={$referrer:s,$referring_domain:s==null?void 0:s==Wd?Wd:(n=Gd(s))==null?void 0:n.host};if(c){u.$current_url=c;var f=Gd(c);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;var h=pw(c);Bt(u,h)}if(s){var p=mw(s);Bt(u,p)}return u}function bw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function _3(){try{return new Date().getTimezoneOffset()}catch{return}}var w3={flags:yc,surveys:$g},S3=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],dl="main";class Pp{constructor(t,n,s){if(s===void 0&&(s=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=t,this.qt=s,this.props={},this.jt=!1,this.Bt=(c=>{var u="";return c.token&&(u=c.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),c.persistence_name?"ph_"+c.persistence_name:"ph_"+u+"_posthog"})(t),this.Ct=this.Ht(t),this.Nt=this.Ut(t),this.load(),t.debug&&we.info("Persistence loaded",t.persistence,ye({},this.props)),this.update_config(t,t,n),this.save(),se){var a=()=>this.flush();Xt(se,"beforeunload",a,{capture:!1}),Xt(se,"pagehide",a,{capture:!1})}}zt(){var t,n=(t=this.Se)==null?void 0:t.persistence_save_debounce_ms;return Hn(n)&&n>0?n:0}isDisabled(){return!!this.Vt}Ht(t){S3.indexOf(t.persistence.toLowerCase())===-1&&(we.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n,s=(function(u,f){u===void 0&&(u=[]),f===void 0&&(f=!1);var h=[...e3,...u];return ye({},At,{F(p){try{var g={};try{g=os.F(p)||{}}catch{}var v,y=JSON.parse(At.A(p)||"{}");if(f){var b={};for(var _ in g){var j=g[_];Fn(j)||j===""||(b[_]=j)}v=Bt(y,b)}else v=Bt(g,y);return At.q(p,v),v}catch{}return null},q(p,g,v,y,b,_){var j=At.q(p,g,void 0,void 0,_);try{var E={};h.forEach((k=>{g[k]&&(E[k]=g[k])})),Object.keys(E).length&&os.q(p,E,v,y,b,_)}catch(k){At.D(k)}return j},P(p,g){try{se==null||se.localStorage.removeItem(p),os.P(p,g)}catch(v){At.D(v)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),a=!1,c=t.persistence.toLowerCase();return c==="localstorage"&&At.N()?(n=At,a=!0):c==="localstorage+cookie"&&s.N()?(n=s,a=!0):c==="sessionstorage"&&Cn.N()?n=Cn:c==="memory"?n=t3:c==="cookie"?n=os:s.N()?(n=s,a=!0):n=os,this.Dt=a,n}Wt(t){return this.Bt+"__"+t}Ut(t){return this.Dt&&!!t.split_storage}Gt(t){var n=t??this.Se.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var s=this.props[yc];return!s||typeof s!="number"||Date.now()-s>n}properties(){var t={};return Mt(this.props,((n,s)=>{var a=sa(s);if((a==null?void 0:a.exposure)==="derived"){if(a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,s===pa?()=>this.Gt():()=>!1))return;a.transformToEventProperties&&Bt(t,a.transformToEventProperties(n))}else if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,(()=>!1)))return;t[s]=n}})),t}load(){if(!this.Vt){var t=this.Ct.F(this.Bt);t&&(this.props=Bt({},t)),this.Nt&&this.Zt()}}Zt(){for(var t of ld){var n=At.F(this.Wt(t));if(n&&!ji(n)){var s=this.Qt(t);s.persisted=!0,this.Jt(t)||(s.fingerprint=this.Yt(n,t)),this.Kt(t,n)||Bt(this.props,n)}}}Jt(t){return Object.keys(this.props).some((n=>{var s;return((s=sa(n))==null?void 0:s.storageGroup)===t}))}Kt(t,n){var s=w3[t];if(!s)return!1;var a=n[s],c=this.props[s];return Hn(a)&&Hn(c)&&c>a}refreshKey(t){var n;if(!this.Vt){var s=this.Nt?(n=sa(t))==null?void 0:n.storageGroup:void 0,a=s?At.F(this.Wt(s)):this.Ct.F(this.Bt);if(a&&t in a)this.Xt(t,a[t]);else{if(s){var c=this.Ct.F(this.Bt);if(c&&t in c)return void this.Xt(t,c[t])}this.er(t)}}}save(){if(!this.Vt){var t=this.zt();t>0?Se(this.tr)&&(this.tr=setTimeout((()=>{this.tr=void 0,this.rr()}),t)):this.rr()}}flush(){Se(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.Bt,this.props,dl))}ir(){var{main:t,groups:n}=this.sr();for(var s of(this.nr(this.Ct,this.Bt,t,dl),ld)){var a,c=n[s];(!ji(c)||(a=this.$t[s])!=null&&a.persisted)&&this.nr(At,this.Wt(s),c,s)}}sr(){var t={},n={};for(var s of ld)n[s]={};return Mt(this.props,((a,c)=>{var u,f=(u=sa(c))==null?void 0:u.storageGroup;f?n[f][c]=a:t[c]=a})),{main:t,groups:n}}Yt(t,n){if(n===dl)return JSON.stringify(t)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var s={};return Mt(t,((a,c)=>{var u;s[c]=(u=sa(c))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(s)}nr(t,n,s,a){var c=this.Qt(a);if(a===dl||c.dirty||Se(c.fingerprint)){var u;try{if((u=this.Yt(s,a))===c.fingerprint)return void(c.dirty=!1)}catch{u=void 0}t.q(n,s,this.ar,this.lr,this.ur,this.Se.debug)?(c.dirty=!1,a!==dl&&(c.persisted=!0),Se(u)||(c.fingerprint=u)):this.Se.debug&&we.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var{keepGroupEntries:n=!1}=t===void 0?{}:t;if(Se(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.P(this.Bt,!1),this.Ct.P(this.Bt,!0),!n&&this.qt)for(var s of ld)At.P(this.Wt(s));n?delete this.$t[dl]:this.$t={}}clear(){this.remove(),this.props={}}register_once(t,n,s){if(Ut(t)){Se(n)&&(n="None"),this.ar=Se(s)?this.hr:s;var a=!1;if(Mt(t,((c,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Xt(u,c),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(Ut(t)){this.ar=Se(n)?this.hr:n;var s=!1;if(Mt(t,((a,c)=>{t.hasOwnProperty(c)&&this.props[c]!==a&&(this.Xt(c,a),s=!0)})),s)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.er(t),this.save())}update_campaign_params(){if(!this.jt){var t=hw(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);ji(Ug(t))||this.register(t),this.jt=!0}}update_search_keyword(){var t;this.register((t=Ne==null?void 0:Ne.referrer)?mw(t):{})}update_referrer_info(){var t;this.register_once({$referrer:gw(),$referring_domain:Ne!=null&&Ne.referrer&&((t=Gd(Ne.referrer))==null?void 0:t.host)||Wd},void 0)}set_initial_person_info(){this.props[eg]||this.props[tg]||this.register_once({[Ud]:xw(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Mt([tg,eg],(a=>{var c=this.props[a];c&&Mt(c,(function(u,f){t["$initial_"+Rm(f)]=u}))}));var n=this.props[Ud];if(n){var s=(function(a,c){c===void 0&&(c=!1);var u=vw(a,c),f={};return Mt(u,(function(h,p){f["$initial_"+Rm(p)]=h})),f})(n,this.Se.disable_capture_url_hashes);Bt(t,s)}return t}safe_merge(t){return Mt(this.props,(function(n,s){s in t||(t[s]=n)})),t}update_config(t,n,s){this.hr=this.ar=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!s),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var a=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),v=[...p].sort();return g.every(((y,b)=>y===v[b]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),c=a?this.Ht(t):this.Ct,u=this.Ut(t);if(a||u!==this.Nt){var f=this.props;this.clear(),this.Ct=c,this.Nt=u,this.props=f,this.save()}}set_disabled(t){this.Vt=t,this.Vt?this.remove():this.save()}set_cross_subdomain(t){t!==this.lr&&(this.lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ur&&(this.ur=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var s=this.props[Jo]||{};s[t]=n,this.Xt(Jo,s),this.save()}remove_event_timer(t){var n=this.props[Jo]||{},s=n[t];return Se(s)||(delete n[t],this.Xt(Jo,n),this.save()),s}get_property(t){return this.props[t]}set_property(t,n){this.Xt(t,n),this.save()}Xt(t,n){var s;this.props[t]=n,(s=sa(t))!=null&&s.volatile||this.dr(t)}er(t){delete this.props[t],this.dr(t)}dr(t){var n,s=(n=sa(t))==null?void 0:n.storageGroup;s&&(this.Qt(s).dirty=!0)}Qt(t){return this.$t[t]||(this.$t[t]={})}}var Po={Activation:"events",Cancellation:"cancelEvents"},$p={Popover:"popover",API:"api",Widget:"widget"},k3={Always:"always"},Fs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Up={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ag={Popover:"popover",Inline:"inline"},j3={SHOWN:"product tour shown"},ny={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ry=Gt("[RateLimiter]");class N3{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var s=n.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((a=>{ry.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void ry.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:s})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,s,a;t===void 0&&(t=!1);var{captureEventsBurstLimit:c,captureEventsPerSecond:u}=this,f=new Date().getTime(),h=(n=(s=this.instance.persistence)==null?void 0:s.get_property(Jm))!==null&&n!==void 0?n:{tokens:c,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>c&&(h.tokens=c);var p=1>h.tokens;return p||t||(h.tokens=Math.max(0,h.tokens-1)),!p||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+u+" events per second and "+c+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(Jm,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var $o=Gt("[RemoteConfig]");class yw{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Le._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}cr(t){var n,s;(n=Le.__PosthogExtensions__)!=null&&n.loadExternalDependency?(s=Le.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){t(n.json)}})}load(){try{if(this.remoteConfig)return $o.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void $o.warn("Remote config is disabled. Falling back to local config.");this.cr((t=>{if(!t)return $o.info("No config found after loading remote JS config. Falling back to JSON."),void this.vr((n=>{this.pr(n),this.gr()}));this.pr(t),this.gr()}))}catch(t){$o.error("Error loading remote config",t)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}refresh(){!this._instance.mr()&&Ne&&Ne.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}gr(){var t;if(!this.yr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.yr=setInterval((()=>{this.refresh()}),n))}}pr(t){var n;t||$o.error("Failed to fetch remote config from PostHog."),this._instance.pr(t??{}),(t==null?void 0:t.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var ls={GZipJS:"gzip-js",Base64:"base64"},Dr=Uint8Array,Jn=Uint16Array,Ml=Uint32Array,qg=new Dr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vg=new Dr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),sy=new Dr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_w=function(e,t){for(var n=new Jn(31),s=0;31>s;++s)n[s]=t+=1<<e[s-1];var a=new Ml(n[30]);for(s=1;30>s;++s)for(var c=n[s];n[s+1]>c;++c)a[c]=c-n[s]<<5|s;return[n,a]},ww=_w(qg,2),lg=ww[1];ww[0][28]=258,lg[258]=28;for(var iy=_w(Vg,0)[1],Sw=new Jn(32768),Ft=0;32768>Ft;++Ft){var fl=(43690&Ft)>>>1|(21845&Ft)<<1;Sw[Ft]=((65280&(fl=(61680&(fl=(52428&fl)>>>2|(13107&fl)<<2))>>>4|(3855&fl)<<4))>>>8|(255&fl)<<8)>>>1}var cc=function(e,t,n){for(var s=e.length,a=0,c=new Jn(t);s>a;++a)++c[e[a]-1];var u,f=new Jn(t);for(a=0;t>a;++a)f[a]=f[a-1]+c[a-1]<<1;for(u=new Jn(s),a=0;s>a;++a)u[a]=Sw[f[e[a]-1]++]>>>15-e[a];return u},va=new Dr(288);for(Ft=0;144>Ft;++Ft)va[Ft]=8;for(Ft=144;256>Ft;++Ft)va[Ft]=9;for(Ft=256;280>Ft;++Ft)va[Ft]=7;for(Ft=280;288>Ft;++Ft)va[Ft]=8;var Xd=new Dr(32);for(Ft=0;32>Ft;++Ft)Xd[Ft]=5;var C3=cc(va,9),E3=cc(Xd,5),kw=function(e){return(e/8>>0)+(7&e&&1)},jw=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var s=new(e instanceof Jn?Jn:e instanceof Ml?Ml:Dr)(n-t);return s.set(e.subarray(t,n)),s},Ms=function(e,t,n){var s=t/8>>0;e[s]|=n<<=7&t,e[s+1]|=n>>>8},Uo=function(e,t,n){var s=t/8>>0;e[s]|=n<<=7&t,e[s+1]|=n>>>8,e[s+2]|=n>>>16},Fp=function(e,t){for(var n=[],s=0;e.length>s;++s)e[s]&&n.push({s,f:e[s]});var a=n.length,c=n.slice();if(!a)return[new Dr(0),0];if(a==1){var u=new Dr(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(B,D){return B.f-D.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,v=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=a-1;)f=n[n[v].f>n[p].f?p++:v++],h=n[p!=g&&n[v].f>n[p].f?p++:v++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var y=c[0].s;for(s=1;a>s;++s)c[s].s>y&&(y=c[s].s);var b=new Jn(y+1),_=og(n[g-1],b,0);if(_>t){s=0;var j=0,E=_-t,k=1<<E;for(c.sort((function(B,D){return b[D.s]-b[B.s]||B.f-D.f}));a>s;++s){var A=c[s].s;if(t>=b[A])break;j+=k-(1<<_-b[A]),b[A]=t}for(j>>>=E;j>0;){var C=c[s].s;t>b[C]?j-=1<<t-b[C]++-1:++s}for(;s>=0&&j;--s){var L=c[s].s;b[L]==t&&(--b[L],++j)}_=t}return[new Dr(b),_]},og=function(e,t,n){return e.s==-1?Math.max(og(e.l,t,n+1),og(e.r,t,n+1)):t[e.s]=n},ay=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Jn(++t),s=0,a=e[0],c=1,u=function(h){n[s++]=h},f=1;t>=f;++f)if(e[f]==a&&f!=t)++c;else{if(!a&&c>2){for(;c>138;c-=138)u(32754);c>2&&(u(c>10?c-11<<5|28690:c-3<<5|12305),c=0)}else if(c>3){for(u(a),--c;c>6;c-=6)u(8304);c>2&&(u(c-3<<5|8208),c=0)}for(;c--;)u(a);c=1,a=e[f]}return[n.subarray(0,s),t]},Fo=function(e,t){for(var n=0,s=0;t.length>s;++s)n+=e[s]*t[s];return n},cg=function(e,t,n){var s=n.length,a=kw(t+2);e[a]=255&s,e[a+1]=s>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var c=0;s>c;++c)e[a+c+4]=n[c];return 8*(a+4+s)},ly=function(e,t,n,s,a,c,u,f,h,p,g){Ms(t,g++,n),++a[256];for(var v=Fp(a,15),y=v[0],b=v[1],_=Fp(c,15),j=_[0],E=_[1],k=ay(y),A=k[0],C=k[1],L=ay(j),B=L[0],D=L[1],U=new Jn(19),F=0;A.length>F;++F)U[31&A[F]]++;for(F=0;B.length>F;++F)U[31&B[F]]++;for(var Y=Fp(U,7),O=Y[0],I=Y[1],T=19;T>4&&!O[sy[T-1]];--T);var le,Q,G,$,z=p+5<<3,re=Fo(a,va)+Fo(c,Xd)+u,me=Fo(a,y)+Fo(c,j)+u+14+3*T+Fo(U,O)+(2*U[16]+3*U[17]+7*U[18]);if(re>=z&&me>=z)return cg(t,g,e.subarray(h,h+p));if(Ms(t,g,1+(re>me)),g+=2,re>me){le=cc(y,b),Q=y,G=cc(j,E),$=j;var R=cc(O,I);for(Ms(t,g,C-257),Ms(t,g+5,D-1),Ms(t,g+10,T-4),g+=14,F=0;T>F;++F)Ms(t,g+3*F,O[sy[F]]);g+=3*T;for(var P=[A,B],Z=0;2>Z;++Z){var M=P[Z];for(F=0;M.length>F;++F)Ms(t,g,R[pe=31&M[F]]),g+=O[pe],pe>15&&(Ms(t,g,M[F]>>>5&127),g+=M[F]>>>12)}}else le=C3,Q=va,G=E3,$=Xd;for(F=0;f>F;++F)if(s[F]>255){var pe;Uo(t,g,le[257+(pe=s[F]>>>18&31)]),g+=Q[pe+257],pe>7&&(Ms(t,g,s[F]>>>23&31),g+=qg[pe]);var _e=31&s[F];Uo(t,g,G[_e]),g+=$[_e],_e>3&&(Uo(t,g,s[F]>>>5&8191),g+=Vg[_e])}else Uo(t,g,le[s[F]]),g+=Q[s[F]];return Uo(t,g,le[256]),g+Q[256]},T3=new Ml([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),A3=(function(){for(var e=new Ml(256),t=0;256>t;++t){for(var n=t,s=9;--s;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Hp=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function M3(e,t){t===void 0&&(t={});var n=(function(){var v=4294967295;return{p(y){for(var b=v,_=0;y.length>_;++_)b=A3[255&b^y[_]]^b>>>8;v=b},d(){return 4294967295^v}}})(),s=e.length;n.p(e);var a,c,u,f,h,p=(f=10+((a=t).filename&&a.filename.length+1||0),h=8,(function(v,y,b,_,j,E){var k=v.length,A=new Dr(_+k+5*(1+Math.floor(k/7e3))+j),C=A.subarray(_,A.length-j),L=0;if(!y||8>k)for(var B=0;k>=B;B+=65535){var D=B+65535;k>D?L=cg(C,L,v.subarray(B,D)):(C[B]=!0,L=cg(C,L,v.subarray(B,k)))}else{for(var U=T3[y-1],F=U>>>13,Y=8191&U,O=(1<<b)-1,I=new Jn(32768),T=new Jn(O+1),le=Math.ceil(b/3),Q=2*le,G=function(yt){return(v[yt]^v[yt+1]<<le^v[yt+2]<<Q)&O},$=new Ml(25e3),z=new Jn(288),re=new Jn(32),me=0,R=0,P=(B=0,0),Z=0,M=0;k>B;++B){var pe=G(B),_e=32767&B,Ce=T[pe];if(I[_e]=Ce,T[pe]=_e,B>=Z){var Ae=k-B;if((me>7e3||P>24576)&&Ae>423){L=ly(v,C,0,$,z,re,R,P,M,B-M,L),P=me=R=0,M=B;for(var ze=0;286>ze;++ze)z[ze]=0;for(ze=0;30>ze;++ze)re[ze]=0}var De=2,et=0,xe=Y,Pe=_e-Ce&32767;if(Ae>2&&pe==G(B-Pe))for(var ft=Math.min(F,Ae)-1,zt=Math.min(32767,B),bt=Math.min(258,Ae);zt>=Pe&&--xe&&_e!=Ce;){if(v[B+De]==v[B+De-Pe]){for(var Lt=0;bt>Lt&&v[B+Lt]==v[B+Lt-Pe];++Lt);if(Lt>De){if(De=Lt,et=Pe,Lt>ft)break;var dn=Math.min(Pe,Lt-2),st=0;for(ze=0;dn>ze;++ze){var fn=B-Pe+ze+32768&32767,_n=fn-I[fn]+32768&32767;_n>st&&(st=_n,Ce=fn)}}}Pe+=(_e=Ce)-(Ce=I[_e])+32768&32767}if(et){$[P++]=268435456|lg[De]<<18|iy[et];var je=31&lg[De],Oe=31&iy[et];R+=qg[je]+Vg[Oe],++z[257+je],++re[Oe],Z=B+De,++me}else $[P++]=v[B],++z[v[B]]}}L=ly(v,C,!0,$,z,re,R,P,M,B-M,L)}return jw(A,0,_+kw(L)+j)})(c=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(c.length)))):12+u.mem,f,h)),g=p.length;return(function(v,y){var b=y.filename;if(v[0]=31,v[1]=139,v[2]=8,v[8]=2>y.level?4:y.level==9?2:0,v[9]=3,y.mtime!=0&&Hp(v,4,Math.floor(new Date(y.mtime||Date.now())/1e3)),b){v[3]=8;for(var _=0;b.length>=_;++_)v[_+10]=b.charCodeAt(_)}})(p,t),Hp(p,g-8,n.d()),Hp(p,g-4,s),p}var R3=!!Tm||!!Em,Nw="text/plain",kd=!1,z3=(e,t)=>{var[n,s]=e.split("#"),[a,c]=n.split("?");if(!c)return e;var u=c.split("&").filter((f=>f.split("=")[0]!==t)).join("&");return a+(u?"?"+u:"")+(s?"#"+s:"")},Cw=function(e,t,n){var s;n===void 0&&(n=!0);var[a,c]=e.split("?"),u=ye({},t),f=(s=c==null?void 0:c.split("&").map((p=>{var g,[v,y]=p.split("="),b=n&&(g=u[v])!==null&&g!==void 0?g:y;return delete u[v],v+"="+b})))!==null&&s!==void 0?s:[],h=(function(p,g){var v,y;g===void 0&&(g="&");var b=[];return Mt(p,(function(_,j){Se(_)||Se(j)||j==="undefined"||(v=encodeURIComponent((E=>E instanceof File)(_)?_.name:_.toString()),y=encodeURIComponent(j),b[b.length]=y+"="+v)})),b.join(g)})(u);return h&&f.push(h),a+"?"+f.join("&")},wl=(e,t)=>JSON.stringify(e,((n,s)=>typeof s=="bigint"?s.toString():s),t),oy=e=>{if(e.xt)return e.xt;var{data:t,compression:n}=e;if(t){if(n===ls.GZipJS){var s=M3((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new Dr(f.length+(f.length>>>1)),v=0,y=function(E){g[v++]=E},b=0;p>b;++b){if(v+5>g.length){var _=new Dr(v+8+(p-b<<1));_.set(g),g=_}var j=f.charCodeAt(b);128>j?y(j):2048>j?(y(192|j>>>6),y(128|63&j)):j>55295&&57344>j?(y(240|(j=65536+(1047552&j)|1023&f.charCodeAt(++b))>>>18),y(128|j>>>12&63),y(128|j>>>6&63),y(128|63&j)):(y(224|j>>>12),y(128|j>>>6&63),y(128|63&j))}return jw(g,0,v)})(wl(t)),{mtime:0});return{contentType:Nw,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(n===ls.Base64){var a=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(wl(t)),c=(f=>"data="+encodeURIComponent(typeof f=="string"?f:wl(f)))(a);return{contentType:"application/x-www-form-urlencoded",body:c,estimatedSize:new Blob([c]).size}}var u=wl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Ew=e=>{var t,n,s=()=>({url:z3(e.url,"compression"),encodedBody:oy(ye({},e,{compression:void 0,xt:void 0}))});try{t=oy(e)}catch(a){if(Lb(e.compression,Tl(e.url,"compression")))return we.error("Failed to gzip request body, sending uncompressed payload",a),s();throw a}return t&&Lb(e.compression,Tl(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Am(new Uint8Array(n)):ArrayBuffer.isView(n)&&Am(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(kd=!0,s()):{url:e.url,encodedBody:t}},cy=e=>{try{return Ew(e)}catch(t){return we.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},L3=(function(){var e=vn((function*(t){var n=wl(t.data),s=yield(function(c,u,f){return Mm.apply(this,arguments)})(n,Zt.DEBUG,{rethrow:!0});if(!s)return t;var a=yield s.arrayBuffer();return ye({},t,{xt:{contentType:Nw,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),uy=(e,t)=>Cw(e,{_:new Date().getTime().toString(),ver:Zt.JS_SDK_VERSION,compression:t}),jd=[];Em&&jd.push({transport:"fetch",method(e){var t,n=cy(e);if(n){var{url:s,encodedBody:a}=n,{contentType:c,body:u,estimatedSize:f}=a??{},h=new Headers;Mt(e.headers,(function(y,b){h.append(b,y)})),c&&h.append("Content-Type",c);var p=null,g=null;if(Cb){var v=new Cb;p={signal:v.signal,timeout:setTimeout((()=>{var y,b;y=e.timeout,(b=new Error("PostHog request timed out"+(y?" after "+y+"ms":""))).name="AbortError",v.abort(g=b)}),e.timeout)}}Em(s,ye({method:(e==null?void 0:e.method)||"GET",headers:h,keepalive:e.method==="POST"&&52428.8>(f||0),body:u,signal:(t=p)==null?void 0:t.signal},e.fetchOptions)).then((y=>y.text().then((b=>{var _={statusCode:y.status,text:b};if(y.status===200)try{_.json=JSON.parse(b)}catch(j){we.error(j)}e.callback==null||e.callback(_)})))).catch((y=>{y===g?we.warn(y):we.error(y),e.callback==null||e.callback({statusCode:0,error:y})})).finally((()=>p?clearTimeout(p.timeout):null))}}}),Tm&&jd.push({transport:"XHR",method(e){var t=cy(e);if(t){var n=new Tm,{url:s,encodedBody:a}=t;n.open(e.method||"GET",s,!0);var{contentType:c,body:u}=a??{};Mt(e.headers,(function(f,h){n.setRequestHeader(h,f)})),c&&n.setRequestHeader("Content-Type",c),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(f)}},n.send(u)}}}),Un!=null&&Un.sendBeacon&&jd.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:n}=Ew(e),{contentType:s,body:a}=n??{};if(!a)return;var c=a instanceof Blob?a:new Blob([a],{type:s});Un.sendBeacon(t,c)}catch{}}});var ug=3e3;class D3{constructor(t,n){this.br=!0,this._r=[],this.wr=cs((n==null?void 0:n.flush_interval_ms)||ug,250,5e3,we.createLogger("flush interval"),ug),this.kr=t}enqueue(t){this._r.push(t),this.Sr||this.Cr()}unload(){this.Ir();var t=this._r.length>0?this.Tr():{},n=Object.values(t);[...n.filter((s=>s.url.indexOf("/e")===0)),...n.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.Er(ye({},s,{transport:"sendBeacon"}))}))}enable(){this.br=!1,this.Cr()}Cr(){var t=this;this.br||(this.Sr=setTimeout((()=>{if(this.Ir(),this._r.length>0){var n=this.Tr(),s=function(){var c=n[a],u=new Date().getTime();c.data&&rt(c.data)&&Mt(c.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.Er(c)};for(var a in n)s()}}),this.wr))}Er(t){try{this.kr(t)}catch(n){we.error(n)}}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var t={};return Mt(this._r,(n=>{var s,a=n,c=(a?a.batchKey:null)||a.url;Se(t[c])&&(t[c]=ye({},a,{data:[]})),(s=t[c].data)==null||s.push(a.data)})),this._r=[],t}}var O3=["retriesPerformedSoFar"];class B3{constructor(t){this.Mr=!1,this.Pr=3e3,this._r=[],this._instance=t,this._r=[],this.Rr=!0,!Se(se)&&"onLine"in se.navigator&&(this.Rr=se.navigator.onLine,this.Or=()=>{this.Rr=!0,this.Lr()},this.Fr=()=>{this.Rr=!1},Xt(se,"online",this.Or),Xt(se,"offline",this.Fr))}get length(){return this._r.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,s=c5(t,O3);Os(n)&&(s.url=Cw(s.url,{retry_count:n})),this._instance._send_request(ye({},s,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.st(ye({retriesPerformedSoFar:n},s));a.statusCode===0&&we.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(n??0)+" retries.")}s.callback==null||s.callback(a)}}))}st(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var s=(function(u){var f=3e3*Math.pow(2,u),h=f/2,p=Math.min(18e5,f),g=Math.random()-.5;return Math.ceil(p+g*(p-h))})(n),a=Date.now()+s;this._r.push({retryAt:a,requestOptions:t});var c="Enqueued failed request for retry in "+s;navigator.onLine||(c+=" (Browser is offline)"),we.warn(c),this.Mr||(this.Mr=!0,this.Ar())}Ar(){if(this.$r&&clearTimeout(this.$r),this._r.length===0)return this.Mr=!1,void(this.$r=void 0);this.$r=setTimeout((()=>{this.Rr&&this._r.length>0&&this.Lr(),this.Ar()}),this.Pr)}Lr(){var t=Date.now(),n=[],s=this._r.filter((c=>t>c.retryAt||(n.push(c),!1)));if(this._r=n,s.length>0)for(var{requestOptions:a}of s)this.retriableRequest(a)}unload(){for(var{requestOptions:t}of(this.$r&&(clearTimeout(this.$r),this.$r=void 0),this.Mr=!1,Se(se)||(this.Or&&(se.removeEventListener("online",this.Or),this.Or=void 0),this.Fr&&(se.removeEventListener("offline",this.Fr),this.Fr=void 0)),this._r))try{this._instance._send_request(ye({},t,{transport:"sendBeacon"}))}catch(n){we.error(n)}this._r=[]}}class P3{constructor(t){this.Dr=()=>{var n,s,a,c;this.Nr||(this.Nr={});var u=this.scrollElement(),f=this.scrollY(),h=u?Math.max(0,u.scrollHeight-u.clientHeight):0,p=f+((u==null?void 0:u.clientHeight)||0),g=(u==null?void 0:u.scrollHeight)||0;this.Nr.lastScrollY=Math.ceil(f),this.Nr.maxScrollY=Math.max(f,(n=this.Nr.maxScrollY)!==null&&n!==void 0?n:0),this.Nr.maxScrollHeight=Math.max(h,(s=this.Nr.maxScrollHeight)!==null&&s!==void 0?s:0),this.Nr.lastContentY=p,this.Nr.maxContentY=Math.max(p,(a=this.Nr.maxContentY)!==null&&a!==void 0?a:0),this.Nr.maxContentHeight=Math.max(g,(c=this.Nr.maxContentHeight)!==null&&c!==void 0?c:0)},this._instance=t}get qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Nr}resetContext(){var t=this.Nr;return setTimeout(this.Dr,0),t}startMeasuringScrollPosition(){Xt(se,"scroll",this.Dr,{capture:!0}),Xt(se,"scrollend",this.Dr,{capture:!0}),Xt(se,"resize",this.Dr)}scrollElement(){if(!this.qr)return se==null?void 0:se.document.documentElement;var t=rt(this.qr)?this.qr:[this.qr];for(var n of t){var s=se==null?void 0:se.document.querySelector(n);if(s)return s}}jr(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.qr){var s=this.scrollElement();return s&&s[n]||0}return se?t==="y"?se.scrollY||se.pageYOffset||se.document.documentElement.scrollTop||0:se.scrollX||se.pageXOffset||se.document.documentElement.scrollLeft||0:0}scrollY(){return this.jr("y")}scrollX(){return this.jr("x")}}var $3=e=>xw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class dy{constructor(t,n,s,a){this.Br=c=>{var u=this.Hr();if(!u||u.sessionId!==c){var f={sessionId:c,props:this.Ur(this._instance)};this.zr.register({[Zm]:f})}},this._instance=t,this.Vr=n,this.zr=s,this.Ur=a||$3,this.Vr.onSessionId(this.Br)}Hr(){return this.zr.props[Zm]}getSetOnceProps(){var t,n=(t=this.Hr())==null?void 0:t.props;return n?"r"in n?vw(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Mt(Ug(this.getSetOnceProps()),((n,s)=>{s==="$current_url"&&(s="url"),t["$session_entry_"+Rm(s)]=n})),t}}class Gg{constructor(){this.Wr={}}on(t,n){return this.Wr[t]||(this.Wr[t]=[]),this.Wr[t].push(n),()=>{this.Wr[t]=this.Wr[t].filter((s=>s!==n))}}emit(t,n){for(var s of this.Wr[t]||[])s(n);for(var a of this.Wr["*"]||[])a(t,n)}}var Ho=Gt("[SessionId]");class fy{on(t,n){return this.Gr.on(t,n)}constructor(t,n,s){var a;if(this.Zr=null,this.Qr=[],this.Jr=void 0,this.Yr=!1,this.Gr=new Gg,this.Kr=(p,g)=>!(!Os(p)||!Os(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Us)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=t.config,this.zr=t.persistence,this.Xr=void 0,this.ei=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ti=n||$s,this.ri=s||$s;var c=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*cs(this.Se.session_idle_timeout_seconds||1800,60,36e3,Ho.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ii(),this.ni="ph_"+c+"_window_id",this.si="ph_"+c+"_primary_window_exists",this.oi()){var u=Cn.F(this.ni),f=Cn.F(this.si);u&&!f?this.Xr=u:Cn.P(this.ni),Cn.q(this.si,!0)}if((a=this.Se.bootstrap)!=null&&a.sessionID)try{var h=(p=>{var g=this.Se.bootstrap.sessionID.replace(/-/g,"");if(g.length!==32)throw new Error("Not a valid UUID");if(g[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(g.substring(0,12),16)})();this.ai(this.Se.bootstrap.sessionID,new Date().getTime(),h)}catch(p){Ho.error("Invalid sessionID in bootstrap",p)}this.li()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Se(this.Qr)&&(this.Qr=[]),this.Qr.push(t),this.ei&&t(this.ei,this.Xr),()=>{this.Qr=this.Qr.filter((n=>n!==t))}}oi(){return this.Se.persistence!=="memory"&&!this.zr.Vt&&Cn.N()}ui(t){t!==this.Xr&&(this.Xr=t,this.oi()&&Cn.q(this.ni,t))}hi(){return this.Xr?this.Xr:this.oi()?Cn.F(this.ni):null}di(t){var n=this.Zr;return!Fn(n)&&!Fn(t)&&5e3>Math.abs(t-n)}ai(t,n,s){var a=n!==this._sessionActivityTimestamp,c=!(t!==this.ei||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=n,this.ei=t,c&&!a||c&&this.di(n)||(this.Zr=n,this.zr.register({[_l]:[n,t,s]}))}ci(){var t,n=(t=this.Se)==null?void 0:t.persistence_save_debounce_ms;return Os(n)&&n>0}vi(){this.ci()?this.zr.refreshKey(_l):(this.zr.flush(),this.zr.load())}fi(){var t;if(!Fn(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Zr){this.vi();var[,n,s]=this.pi();n===this.ei&&s===this._sessionStartTimestamp&&(this.Zr=this._sessionActivityTimestamp,this.zr.register({[_l]:[this._sessionActivityTimestamp,(t=this.ei)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.zr.flush())}}gi(){var[t]=this.pi(),n=Os(t)?t:0,s=Os(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,s)}mi(t){return this.vi(),this.Kr(t,this.gi())}pi(){var t=this.zr.props[_l];return rt(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Zr=null,clearTimeout(this.yi),this.yi=void 0,this.ai(null,null,null)}destroy(){this.Yr=!0,this.fi(),clearTimeout(this.yi),this.yi=void 0,this.Jr&&se&&(se.removeEventListener(Id,this.Jr,{capture:!1}),this.Jr=void 0),this.Qr=[]}li(){this.Jr=()=>{this.fi(),this.oi()&&Cn.P(this.si)},Xt(se,Id,this.Jr,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Se.cookieless_mode===Us)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=n||new Date().getTime(),[,a,c]=this.pi(),u=this.gi(),f=this.hi(),h=Os(c)&&Math.abs(s-c)>864e5,p=!1,g=!1,v=!a,y=a,b=!v&&!t&&this.Kr(s,u);b&&((b=this.mi(s))||Ho.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,c]=this.pi()),v||b||h?(a=this.ti(),f=this.ri(),Ho.info("new session ID generated",{sessionId:a,windowId:f,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),c=s,p=!0):(f||(f=this.ri(),p=!0),(g=a!==y)&&(Ho.info("adopted cross-tab session id",{sessionId:a,windowId:f}),p=!0));var _=Os(u)&&t&&!h?u:s,j=Os(c)?c:new Date().getTime();this.ui(f),this.ai(a,_,j),t||this.ii();var E={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:g};return p&&this.Qr.forEach((k=>k(a,f,E))),{sessionId:a,windowId:f,sessionStartTimestamp:j,changeReason:p?E:void 0,lastActivityTimestamp:u}}ii(){this.Yr||(clearTimeout(this.yi),this.yi=setTimeout((()=>{if(!this.Yr)if(this.mi(new Date().getTime())){var t=this.ei;this.resetSessionId(),this.Gr.emit("forcedIdleReset",{idleSessionId:t})}else this.ii()}),1.1*this.sessionTimeoutMs))}}var Tw=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Ob(n,t))return!0;try{var s=e==null?void 0:e.userAgentData;if(s!=null&&s.brands&&s.brands.some((a=>Ob(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function Aw(){return(Aw=vn((function*(){var e=Un==null?void 0:Un.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return Ct(n)&&n.length>0?n:void 0}catch(s){return void we.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}}))).apply(this,arguments)}var Qd=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function hy(e,t,n){return wl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Mw={exact:(e,t)=>t.some((n=>e.some((s=>n===s)))),is_not:(e,t)=>t.every((n=>e.every((s=>n!==s)))),regex:(e,t)=>t.some((n=>e.some((s=>Qd(n,s))))),not_regex:(e,t)=>t.every((n=>e.every((s=>!Qd(n,s))))),icontains:(e,t)=>t.map(cd).some((n=>e.map(cd).some((s=>n.includes(s))))),not_icontains:(e,t)=>t.map(cd).every((n=>e.map(cd).every((s=>!n.includes(s))))),gt:(e,t)=>t.some((n=>{var s=parseFloat(n);return!isNaN(s)&&e.some((a=>s>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var s=parseFloat(n);return!isNaN(s)&&e.some((a=>s<parseFloat(a)))}))},cd=e=>e.toLowerCase();function Rw(e,t){return!e||Object.entries(e).every((n=>{var[s,a]=n,c=t==null?void 0:t[s];if(Se(c)||Fn(c))return!1;var u=[String(c)],f=Mw[a.operator];return!!f&&f(a.values,u)}))}var dg="custom",py="i.posthog.com",U3=/^\/static\//;class F3{constructor(t){this.bi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+py,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.bi[this.apiHost]||(this.bi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":dg),this.bi[this.apiHost]}wi(t){if(U3.test(t)){var n=this.instance.config.asset_host;if(typeof n=="string")return n.trim().replace(/\/$/,"")||void 0}}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(t==="assets"){var s=this.wi(n);if(s)return""+s+n}if(this.region===dg)return this.apiHost+n;var a=py+n;switch(t){case"assets":return"https://"+this.region+"-assets."+a;case"api":return"https://"+this.region+"."+a}}}var Nt=Gt("[Surveys]"),fg="seenSurvey_",H3=[$p.Popover,$p.Widget,$p.API],I3={ignoreConditions:!1,ignoreDelay:!1,displayType:ag.Popover},q3=Gt("[PostHog ExternalIntegrations]"),V3={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class G3{constructor(t){this._instance=t}Mt(t,n){var s;(s=Le.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,t,(a=>{if(a)return q3.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(u){var f,h,p;!a||(f=Le.__PosthogExtensions__)!=null&&(f=f.integrations)!=null&&f[u]||t.Mt(V3[u],(()=>{var g;(g=Le.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[u])==null||g.start(t._instance)})),!a&&(h=Le.__PosthogExtensions__)!=null&&(h=h.integrations)!=null&&h[u]&&((p=Le.__PosthogExtensions__)==null||(p=p.integrations)==null||(p=p[u])==null||p.stop())};for(var[s,a]of Object.entries((c=this._instance.config.integrations)!==null&&c!==void 0?c:{})){var c;n(s)}}}var hl,uc={},Ip=0,Kd=()=>{},my='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Io="Surveys module not available",gy="sanitize_properties is deprecated. Use before_send instead",zw="Invalid value for property_denylist config: ",bl="posthog",Lw=!R3&&(Zn==null?void 0:Zn.indexOf("MSIE"))===-1&&(Zn==null?void 0:Zn.indexOf("Mozilla"))===-1,xy=e=>{var t;return ye({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:XC(Ne==null?void 0:Ne.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kd,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:nn&&Ct(nn==null?void 0:nn.search)&&nn.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(se==null||(t=se.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){we.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:rg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ug},error_tracking:{},_onCapture:Kd},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:l3,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:n&&n>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(e))},Y3=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],vy=e=>{var t={};for(var[n,s]of Y3)Se(e[n])||(t[s]=e[n]);var a=Bt({},t,e),c=e.__preview_external_dependency_versioned_paths;return Se(c)||(Se(e.strict_script_versioning)&&(a.strict_script_versioning=!!c),Ct(c)&&Se(e.asset_host)&&(a.asset_host=c)),rt(e.property_blacklist)&&(Se(e.property_denylist)?a.property_denylist=e.property_blacklist:rt(e.property_denylist)?a.property_denylist=[...e.property_blacklist,...e.property_denylist]:we.error(zw+e.property_denylist)),a};class W3{constructor(){this.__forceAllowLocalhost=!1}get xi(){return this.__forceAllowLocalhost}set xi(t){we.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class zr{ki(t,n){if(t){var s=this.Si.indexOf(t);s!==-1&&this.Si.splice(s,1)}return this.Si.push(n),n.initialize==null||n.initialize(),n}Ci(){return this.config.cookieless_mode===Us||this.config.cookieless_mode===fa&&this.consent.isRejected()}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new W3,this.Ii=!1,this.version=Zt.LIB_VERSION,this.Ti=new Gg,this.Si=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xy(),this.SentryIntegration=g3,this.sentryIntegration=s=>(function(a,c){var u=fw(a,c);return{name:dw,processEvent:f=>u(f)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ei=!1,this.Mi=null,this.Pi=null,this.Ri=null,this.scrollManager=new P3(this),this.pageViewManager=new ey(this),this.rateLimiter=new N3(this),this.requestRouter=new F3(this),this.consent=new n3(this),this.externalIntegrations=new G3(this);var n=(t=zr.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(s,a,c)=>{var u=Ct(s)?{[s]:a}:s;this.setPersonProperties(u),c==null||c({})},set_once:(s,a,c)=>{var u=Ct(s)?{[s]:a}:s;this.setPersonProperties(void 0,u),c==null||c({})}},this.on("eventCaptured",(s=>we.info('send "'+(s==null?void 0:s.event)+'"',s)))}init(t,n,s){if(s&&s!==bl){var a,c=(a=uc[s])!==null&&a!==void 0?a:new zr;return c._init(t,n,s),uc[s]=c,uc[bl][s]=c,c}return this._init(t,n,s)}_init(t,n,s){var a,c;n===void 0&&(n={});var u=Ct(t)?t.trim():"";if(!u)return we.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Oi(n.debug),this.Li=n,this.Fi=[],n.person_profiles?this.Pi=n.person_profiles:n.process_person&&(this.Pi=n.process_person);var f=xy(n.defaults),h=vy(n),p=Bt({},f,h,{name:s,token:u});Ut(f.rageclick)&&Ut(h.rageclick)&&(p.rageclick=Bt({},f.rageclick,h.rageclick)),Ut(f.session_recording)&&Ut(h.session_recording)&&(p.session_recording=Bt({},f.session_recording,h.session_recording)),this.set_config(p),this.config.on_xhr_error&&we.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:ls.GZipJS;var g=this.Ai();this.persistence=new Pp(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Pp(ye({},this.config,{persistence:"sessionStorage"}),g,!1);var v=ye({},this.persistence.props),y=ye({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.$i=new D3((L=>this.Di(L)),this.config.request_queue_config),this.Ni=new B3(this),this.__request_queue=[];var b=this.Ci();if(b||(this.sessionManager=new fy(this),this.sessionPropsManager=new dy(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(we.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.qi(b)}),0)):(we.info("Initializing extensions synchronously"),this.qi(b)),Zt.DEBUG=Zt.DEBUG||this.config.debug,Zt.DEBUG&&we.info("Starting in debug mode",{this:this,config:n,thisC:ye({},this.config),p:v,s:y}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=ye({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((c=n.bootstrap)==null?void 0:c.distinctID)!==void 0){var _=n.bootstrap.distinctID,j=this.get_distinct_id(),E=this.persistence.get_property(qr);if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&E===cl)this.identify(_);else if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&E===ul)we.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var k=this.config.get_device_id($s()),A=n.bootstrap.isIdentifiedID?k:_;this.persistence.set_property(qr,n.bootstrap.isIdentifiedID?ul:cl),this.register({distinct_id:_,$device_id:A})}}if(b)this.register_once({distinct_id:rd,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id($s());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(qr,cl)}return Xt(se,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(L,B){var D=L.config.segment;if(!D)return B();(function(U,F){var Y=U.config.segment;if(!Y)return F();var O=T=>{var le=()=>T.anonymousId()||$s();U.config.get_device_id=le,T.id()&&(U.register({distinct_id:T.id(),$device_id:le()}),U.persistence.set_property(qr,ul)),F()},I=Y.user();"then"in I&&as(I.then)?I.then(O):O(I)})(L,(()=>{D.register((U=>{typeof Promise<"u"&&Promise.resolve||Bp.warn("This browser does not have Promise support, and can not use the segment integration");var F=(Y,O)=>{if(!O)return Y;Y.event.userId||Y.event.anonymousId===U.get_distinct_id()||(Bp.info("No userId set, resetting PostHog"),U.reset()),Y.event.userId&&Y.event.userId!==U.get_distinct_id()&&(Bp.info("UserId set, identifying with PostHog"),U.identify(Y.event.userId));var I=U.calculateEventProperties(O,Y.event.properties);return Y.event.properties=Object.assign({},I,Y.event.properties),Y};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:Y=>F(Y,Y.event.event),page:Y=>F(Y,vl),identify:Y=>F(Y,Lp),screen:Y=>F(Y,"$screen")}})(L)).then((()=>{B()}))}))})(this,(()=>this.ji())):this.ji(),as(this.config._onCapture)&&this.config._onCapture!==Kd&&(we.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(L=>this.config._onCapture(L.event,L)))),this.config.ip&&we.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Aw.apply(this,arguments)})().then((L=>{L&&this.register({[Rp]:L})})).catch(Kd),this}qi(t){var n,s,a,c,u,f,h,p=performance.now(),g=ye({},zr.__defaultExtensionClasses,this.config.__extensionClasses),v=[];g.featureFlags&&this.Si.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new g.featureFlags(this)),g.exceptions&&this.Si.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new g.exceptions(this)),g.historyAutocapture&&this.Si.push(this.historyAutocapture=new g.historyAutocapture(this)),g.tracingHeaders&&this.Si.push(this.tracingHeaders=new g.tracingHeaders(this)),g.siteApps&&this.Si.push(this.siteApps=new g.siteApps(this)),g.sessionRecording&&!t&&this.Si.push(this.sessionRecording=new g.sessionRecording(this)),this.config.disable_scroll_properties||v.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),g.autocapture&&this.Si.push(this.autocapture=new g.autocapture(this)),g.surveys&&this.Si.push(this.surveys=(a=this.surveys)!==null&&a!==void 0?a:new g.surveys(this)),g.logs&&this.Si.push(this.logs=(c=this.logs)!==null&&c!==void 0?c:new g.logs(this)),g.conversations&&this.Si.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new g.conversations(this)),g.productTours&&this.Si.push(this.productTours=new g.productTours(this)),g.heatmaps&&this.Si.push(this.heatmaps=new g.heatmaps(this)),g.webVitalsAutocapture&&this.Si.push(this.webVitalsAutocapture=new g.webVitalsAutocapture(this)),g.exceptionObserver&&this.Si.push(this.exceptionObserver=new g.exceptionObserver(this)),g.deadClicksAutocapture&&this.Si.push(this.deadClicksAutocapture=new g.deadClicksAutocapture(this,m3)),g.toolbar&&this.Si.push(this.toolbar=(f=this.toolbar)!==null&&f!==void 0?f:new g.toolbar(this)),g.experiments&&this.Si.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new g.experiments(this)),this.Si.forEach((y=>{y.initialize&&v.push((()=>{y.initialize==null||y.initialize()}))})),v.push((()=>{if(this.Bi){var y=this.Bi;this.Bi=void 0,this.pr(y)}})),this.Hi(v,p)}Hi(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Hi(t,n)}),0);var s=t.shift();if(s)try{s()}catch(c){we.error("Error initializing extension:",c)}}var a=Math.round(performance.now()-n);this.register_for_session({[X5]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Q5]:a}),this.config.__preview_deferred_init_extensions&&we.info("PostHog extensions initialized ("+a+"ms)")}pr(t){var n;if(!Ne||!Ne.body)return we.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Bi=t),this.Ui=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ie(t.supportedCompression,ls.GZipJS)?ls.GZipJS:Ie(t.supportedCompression,ls.Base64)?ls.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:rg}),this.Si.forEach((s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(t)))}ji(){try{this.config.loaded(this)}catch(s){we.critical("`loaded` function failed",s)}if(this.zi(),this.config.internal_or_test_user_hostname&&nn!=null&&nn.hostname){var t=nn.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ci())&&this.Vi()}),1),this.Wi=new yw(this),this.Wi.load()}zi(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.$i)==null||t.enable())}_dom_loaded(){this.is_capturing()&&sd(this.__request_queue,(t=>this.Di(t))),this.__request_queue=[],this.zi()}_handle_unload(){var t,n,s,a;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),this.config.request_batching?(this.Gi()&&this.capture(zp),(n=this.logs)==null||n.flushLogs("sendBeacon"),(s=this.$i)==null||s.unload(),(a=this.Ni)==null||a.unload()):this.Gi()&&this.capture(zp,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Lw?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=ye({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(Se(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var s,a,c,u=ye({},n);u.timeout=u.timeout||6e4,u.url=uy(u.url,u.compression);var f=(s=u.transport)!==null&&s!==void 0?s:"fetch",h=jd.filter((g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport))),p=(a=(c=(function(g,v){for(var y=0;g.length>y;y++)if(g[y].transport===f)return g[y]})(h))==null?void 0:c.method)!==null&&a!==void 0?a:h[0].method;if(!p)throw new Error("No available transport method");f!=="sendBeacon"&&u.data&&u.compression===ls.GZipJS&&JN&&typeof Promise<"u"&&!kd?L3(u).then((g=>{p(g)})).catch((g=>{if(Db(g))return kd=!0,void p(ye({},u,{compression:void 0,url:uy(n.url,void 0)}));(v=>{if(!v||typeof v!="object")return!1;var y="name"in v?String(v.name):"";return Db(v)||y===u5})(g)&&(kd=!0),p(u)})):p(u)})(ye({},t,{callback:n=>{var s,a;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(s=(a=this.config).on_request_error)==null||s.call(a,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}Di(t){this.Ni?this.Ni.retriableRequest(t):this._send_request(t)}_execute_array(t){Ip++;try{var n,s=[],a=[],c=[];sd(t,(f=>{if(f)if(rt(n=f[0]))c.push(f);else if(as(f))try{f.call(this)}catch(h){we.error("Error executing queued PostHog call",f,h)}else rt(f)&&n==="alias"?s.push(f):rt(f)&&n.indexOf("capture")!==-1&&as(this[n])?c.push(f):a.push(f)}));var u=function(f,h){sd(f,(function(p){try{if(rt(p[0])){var g=h;Mt(p,(function(v){g=g[v[0]].apply(g,v.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(v){we.error("Error executing queued PostHog call",p,v)}}))};u(s,this),u(a,this),u(c,this)}finally{Ip--}}push(t){if(Ip>0&&rt(t)&&Ct(t[0])){var n=zr.prototype[t[0]];as(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,s){var a,c,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.$i){if(this.is_capturing())if(!Se(t)&&Ct(t)){var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var g=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(g==null||!g.isRateLimited){n!=null&&n.$current_url&&!Ct(n==null?void 0:n.$current_url)&&(we.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||s!=null&&s.Zi||we.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var v=new Date,y=(s==null?void 0:s.timestamp)||v,b=Ub(s==null?void 0:s.uuid,$s),_={uuid:b,event:t,properties:this.calculateEventProperties(t,n||{},y,b)};t===vl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens),s!=null&&s.$set&&(_.$set=s==null?void 0:s.$set);var j=s==null?void 0:s.$unset;j&&(_.$unset=j);var E,k,A,C=this.Qi(s==null?void 0:s.$set_once,t!==Ib,t===Lp);if(C&&(_.$set_once=C),s!=null&&s._noTruncate||(c=this.config.properties_string_max_length,u=_,f=O=>Ct(O)?O.slice(0,c):O,h=new Set,_=(function O(I,T){return I!==Object(I)?f?f(I):I:h.has(I)?void 0:(h.add(I),rt(I)?(le=[],sd(I,(Q=>{le.push(O(Q))}))):(le={},Mt(I,((Q,G)=>{h.has(Q)||(le[G]=O(Q))}))),le);var le})(u)),_.timestamp=y,Se(s==null?void 0:s.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),t===Fs.DISMISSED||t===Fs.SENT){var L=n==null?void 0:n[Up.SURVEY_ID],B=n==null?void 0:n[Up.SURVEY_ITERATION];(O=>{try{var I=(T=>((le,Q)=>{var G=""+fg+Q.id;return Q.current_iteration&&Q.current_iteration>0&&(G=""+fg+Q.id+"_"+Q.current_iteration),G})(0,T))(O);if(localStorage.getItem(I))return;localStorage.setItem(I,"true")}catch(T){Nt.error("Failed to persist survey seen state",T)}})({id:L,current_iteration:B}),_.$set=ye({},_.$set,{[(E={id:L,current_iteration:B},k=t===Fs.SENT?"responded":"dismissed",A="$survey_"+k+"/"+E.id,E.current_iteration&&E.current_iteration>0&&(A="$survey_"+k+"/"+E.id+"/"+E.current_iteration),A)]:!0})}else t===Fs.SHOWN&&(_.$set=ye({},_.$set,{[Up.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===j3.SHOWN){var D=n==null?void 0:n[ny.TOUR_TYPE];D&&(_.$set=ye({},_.$set,{[ny.TOUR_LAST_SEEN_DATE+"/"+D]:new Date().toISOString()}))}var U=ye({},_.properties.$set,_.$set);if(ji(U)||this.setPersonPropertiesForFlags(U),!Qe(this.config.before_send)){var F=this.it(_);if(!F)return;(_=F).uuid=Ub(_.uuid,$s)}this.Ti.emit("eventCaptured",_);var Y={method:"POST",url:(a=s==null?void 0:s._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:s==null?void 0:s._batchKey,transport:s==null?void 0:s.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.Di(Y):this.$i.enqueue(Y),_}we.critical("This capture call is ignored due to client rate limiting.")}}else we.error("No event name provided to posthog.capture")}else we.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,s,a,c){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return n;var u=c?void 0:this.persistence.remove_event_timer(t),f=ye({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.Ci()&&(f.$cookieless_mode=!0),t==="$snapshot"){var h=ye({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!Ct(f.distinct_id)&&!Hn(f.distinct_id)||zm(f.distinct_id))&&we.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(k,A,C,L){var B,D,U,F;if(L===void 0&&(L=!1),!Zn)return{};var Y,O,I,T,le,Q,G,$,z,re=k?[...Al,...A||[]]:[],[me,R]=(function(pe){for(var _e=0;Pb.length>_e;_e++){var[Ce,Ae]=Pb[_e],ze=Ce.exec(pe),De=ze&&(as(Ae)?Ae(ze,pe):Ae);if(De)return De}return["",""]})(Zn),P=(Y=typeof navigator<"u"?navigator:void 0)!=null&&Y.brave?{brave:!0}:{},Z={detectGoogleSearchApp:C},M=Bt(Ug({$os:me,$os_version:R,$browser:z5(Zn,navigator.vendor,P,Z),$device:$b(Zn),$device_type:(I=Zn,T={userAgentDataPlatform:(B=navigator)==null||(B=B.userAgentData)==null?void 0:B.platform,maxTouchPoints:(D=navigator)==null?void 0:D.maxTouchPoints,screenWidth:se==null||(U=se.screen)==null?void 0:U.width,screenHeight:se==null||(F=se.screen)==null?void 0:F.height,devicePixelRatio:se==null?void 0:se.devicePixelRatio},z=$b(I),z===m5||z===p5||z==="Kobo"||z==="Kindle Fire"||z===E5?Nl:z===vc||z===kl||z===bc||z===Dm?"Console":z===x5?"Wearable":z?hr:(T==null?void 0:T.userAgentDataPlatform)==="Android"&&((le=T==null?void 0:T.maxTouchPoints)!==null&&le!==void 0?le:0)>0?600>Math.min((Q=T==null?void 0:T.screenWidth)!==null&&Q!==void 0?Q:0,(G=T==null?void 0:T.screenHeight)!==null&&G!==void 0?G:0)/(($=T==null?void 0:T.devicePixelRatio)!==null&&$!==void 0?$:1)?hr:Nl:"Desktop"),$timezone:bw(),$timezone_offset:_3()}),{$current_url:wc(L?Ei(nn==null?void 0:nn.href):nn==null?void 0:nn.href,re,Sc),$host:nn==null?void 0:nn.host,$pathname:nn==null?void 0:nn.pathname,$raw_user_agent:Zn.length>1e3?Zn.substring(0,997)+"...":Zn,$browser_version:vC(Zn,navigator.vendor,P,Z),$browser_language:ty(),$browser_language_prefix:(O=ty(),typeof O=="string"?O.split("-")[0]:void 0),$screen_height:se==null?void 0:se.screen.height,$screen_width:se==null?void 0:se.screen.width,$viewport_height:se==null?void 0:se.innerHeight,$viewport_width:se==null?void 0:se.innerWidth,$lib:Zt.LIB_NAME,$lib_version:Zt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Zt.SDK_DIST_CHANNEL&&(M.$sdk_dist_channel=Zt.SDK_DIST_CHANNEL),M})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var{sessionId:v,windowId:y}=this.sessionManager.checkAndGetSessionAndWindowId(c,s.getTime());f.$session_id=v,f.$window_id=y}this.sessionPropsManager&&Bt(f,this.sessionPropsManager.getSessionProps());try{var b;this.sessionRecording&&Bt(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(b=this.Ni)==null?void 0:b.length}catch(k){f.$sdk_debug_error_capturing_properties=String(k)}if(this.requestRouter.region===dg&&(f.$lib_custom_api_host=this.config.api_host),p=t!==vl||c?t!==zp||c?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,a),f=Bt(f,p),t===vl&&Ne&&(f.title=Ne.title),!Se(u)){var _=s.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}Zn&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser"),(f=Bt({},g,this.persistence.properties(),this.sessionPersistence.properties(),f)).$is_identified=this._isIdentified(),rt(this.config.property_denylist)?Mt(this.config.property_denylist,(function(k){delete f[k]})):we.error(zw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var j=this.config.sanitize_properties;j&&(we.error(gy),f=j(f,t));var E=this.Ji();return f.$process_person_profile=E,E&&!c&&this.Yi("_calculate_event_properties"),f}Qi(t,n,s){var a;if(n===void 0&&(n=!0),s===void 0&&(s=!1),!this.persistence||!this.Ji()||this.Ii&&!s)return t;var c=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),f=Bt({},c,u||{},t||{}),h=this.config.sanitize_properties;return h&&(we.error(gy),f=h(f,"$set_once")),n&&(this.Ii=!0),ji(f)?void 0:f}register(t,n){var s;(s=this.persistence)==null||s.register(t,n)}register_once(t,n,s){var a;(a=this.persistence)==null||a.register_once(t,n,s)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Ki(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(t,n)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var s;return(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(t,n)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,s){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,s)}updateEarlyAccessFeatureEnrollment(t,n,s){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,s)}getEarlyAccessFeatures(t,n,s){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,s)}on(t,n){return this.Ti.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Io}),()=>{})}onSessionId(t){var n,s;return(n=(s=this.sessionManager)==null?void 0:s.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:Io})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Io})}renderSurvey(t,n){var s;(s=this.surveys)==null||s.renderSurvey(t,n)}displaySurvey(t,n){var s;n===void 0&&(n=I3),(s=this.surveys)==null||s.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,s;return(n=(s=this.surveys)==null?void 0:s.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:Io}}canRenderSurveyAsync(t,n){var s,a;return n===void 0&&(n=!1),(s=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Io})}Xi(t){return!t||zm(t)?(we.critical("Unique user id has not been set in posthog.identify"),!1):t===rd?(we.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(we.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,n,s){if(!this.__loaded||!this.persistence)return we.uninitializedWarning("posthog.identify");if(Hn(t)&&(t=t.toString(),we.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Xi(t)&&this.Yi("posthog.identify")){var a=this.get_distinct_id();this.register({$user_id:t}),this.get_property($d)||this.register_once({$had_persisted_distinct_id:!0,$device_id:a},""),t!==a&&t!==this.get_property(Zo)&&(this.unregister(Zo),this.register({distinct_id:t}));var c,u=(this.persistence.get_property(qr)||cl)===cl;t!==a&&u?(this.persistence.set_property(qr,ul),this.setPersonPropertiesForFlags({$set:n||{},$set_once:s||{}},!1),this.capture(Lp,{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:s||{}}),this.Ri=hy(t,n,s),(c=this.featureFlags)==null||c.setAnonymousDistinctId(a)):(n||s)&&this.setPersonProperties(n,s),t!==a&&(this.reloadFeatureFlags(),this.unregister(lc))}}setPersonProperties(t,n){if((t||n)&&this.Yi("posthog.setPersonProperties")){var s=hy(this.get_distinct_id(),t,n);this.Ri!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Ri=s):we.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,s=(rt(t)?t:[t]).filter((a=>Ct(a)&&a.length>0));s.length!==0&&this.Yi("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Ri=null)}group(t,n,s){if(t&&n){var a=this.getGroups(),c=a[t]!==n;if(c&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ye({},a,{[t]:n})}),c||s){var u={$group_type:t,$group_key:n};s&&(u.$group_set=s),this.capture(Ib,u)}s&&this.setGroupPropertiesForFlags({[t]:s}),c&&!s&&this.reloadFeatureFlags()}else we.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var s;n===void 0&&(n=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,n){var s;n===void 0&&(n=!0),this.Yi("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,s,a,c,u,f,h,p,g;if(we.info("reset"),!this.__loaded)return we.uninitializedWarning("posthog.reset");var v,y=this.get_property($d),b=this.get_property(Rp),_=this.get_property(ma);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(s=this.sessionPersistence)==null||s.clear(),Se(_)||(v=this.persistence)==null||v.register({[ma]:_}),(a=this.surveys)==null||a.reset(),(c=this.Wi)==null||c.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.logs)==null||h.reset(),(p=this.persistence)==null||p.set_property(qr,cl),(g=this.sessionManager)==null||g.resetSessionId(),this.Ri=null,this.config.cookieless_mode===Us)this.register_once({distinct_id:rd,$device_id:null},"");else{var j=this.config.get_device_id($s());this.register_once({distinct_id:j,$device_id:t?j:y},""),t||Se(b)||this.register({[Rp]:b})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,n){var s;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(s=this.conversations)==null||s.en()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.tn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&s){var c,u=(c=t.timestampLookBack)!==null&&c!==void 0?c:10;if(!s)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(H5)?(we.critical("Attempting to create alias for existing People user - aborting."),-2):this.Yi("posthog.alias")?(Se(n)&&(n=this.get_distinct_id()),t!==n?(this.Ki(Zo,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(we.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ye({},this.config);if(Ut(t)){var s,a,c,u,f,h,p,g,v,y,b;Bt(this.config,vy(t));var _=this.Ai();(s=this.persistence)==null||s.update_config(this.config,n,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Pp(ye({},this.config,{persistence:"sessionStorage"}),_,!1);var j=this.Oi(this.config.debug);us(j)&&(this.config.debug=j),us(this.config.debug)&&(this.config.debug?(Zt.DEBUG=!0,At.N()&&At.q("ph_debug",!0),we.info("set_config",{config:t,oldConfig:n,newConfig:ye({},this.config)})):(Zt.DEBUG=!1,At.N()&&At.P("ph_debug"))),(a=this.exceptionObserver)==null||a.onConfigChange(),(c=this.exceptions)==null||c.onConfigChange(),(u=this.sessionRecording)==null||u.startIfEnabledOrStop(),(f=this.tracingHeaders)==null||f.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(p=this.heatmaps)==null||p.startIfEnabled(),(g=this.exceptionObserver)==null||g.startIfEnabledOrStop(),(v=this.deadClicksAutocapture)==null||v.startIfEnabledOrStop(),(y=this.surveys)==null||y.loadIfEnabled(),this.rn(),(b=this.externalIntegrations)==null||b.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){Zt.LIB_NAME=t,Zt.LIB_VERSION=n}startSessionRecording(t){var n,s,a,c,u,f=t===!0,h={sampling:f||!(t==null||!t.sampling),linked_flag:f||!(t==null||!t.linked_flag),url_trigger:f||!(t==null||!t.url_trigger),event_trigger:f||!(t==null||!t.event_trigger)};Object.values(h).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),h.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),h.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),h.url_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("url")),h.event_trigger&&((u=this.sessionRecording)==null||u.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var s=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(ye({},a,n))}}addExceptionStep(t,n){var s;(s=this.exceptions)==null||s.addExceptionStep(t,n)}captureLog(t){var n;(n=this.logs)==null||n.captureLog(t)}get logger(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)!==null&&t!==void 0?t:zr.nn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,s;return(n=(s=this.toolbar)==null?void 0:s.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:bl;return n!==bl&&(n=bl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(qr))===ul||((n=this.sessionPersistence)==null?void 0:n.get_property(qr))===ul}Ji(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===rg&&!this._isIdentified()&&ji(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Zo])&&((n=this.persistence)==null||(n=n.props)==null||!n[Fd]))}Gi(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Ji()||this.Yi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Yi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Yi(t){return this.config.person_profiles==="never"?(we.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ki(Fd,!0),!0)}Ai(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==fa)}rn(){var t,n,s,a,c=this.Ai();return((t=this.persistence)==null?void 0:t.Vt)!==c&&((s=this.persistence)==null||s.set_disabled(c)),((n=this.sessionPersistence)==null?void 0:n.Vt)!==c&&((a=this.sessionPersistence)==null||a.set_disabled(c)),c}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==Us){if(this.Ci()){var s,a,c,u,f;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new fy(this),this.pageViewManager=new ey(this),this.persistence&&(this.sessionPropsManager=new dy(this,this.sessionManager,this.persistence));var h,p=(c=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&c!==void 0?c:(f=zr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.ki(this.sessionRecording,new p(this)),this.Ui&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.Ui)))}var g,v;this.consent.optInOut(!0),this.rn(),this.zi(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==fa&&((g=this.surveys)==null||g.loadIfEnabled()),(Se(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((v=t==null?void 0:t.captureEventName)!==null&&v!==void 0?v:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vi()}else we.warn(my)}opt_out_capturing(){var t,n,s;this.config.cookieless_mode!==Us?(this.config.cookieless_mode===fa&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.rn(),this.config.cookieless_mode===fa&&(this.register({distinct_id:rd,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(n=this.sessionManager)==null||n.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Vi(),this.zi())):we.warn(my)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Us||(this.config.cookieless_mode===fa?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.rn()}_is_bot(){return Un?Tw(Un,this.config.custom_blocked_useragents):void 0}Vi(){Ne&&(Ne.visibilityState==="visible"?this.Ei||(this.Ei=!0,this.capture(vl,{title:Ne.title},{send_instantly:!0}),this.Mi&&(Ne.removeEventListener(Hd,this.Mi),this.Mi=null)):this.Mi||(this.Mi=this.Vi.bind(this),Xt(Ne,Hd,this.Mi)))}debug(t){t===!1?(se==null||se.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(se==null||se.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}mr(){var t,n,s,a,c,u,f=this.Li||{};return"advanced_disable_flags"in f?!!f.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(we.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(s="advanced_disable_decide",a=we,c=(n="advanced_disable_flags")in(t=f)&&!Qe(t[n]),u=s in t&&!Qe(t[s]),c?t[n]:!!u&&(a&&a.warn("Config field '"+s+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[s]))}it(t){var n;if(Qe(this.config.before_send))return t;var s=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(aC),a=rt(this.config.before_send)?this.config.before_send:[this.config.before_send],c=t;for(var u of a){if(c=u(c),Qe(c)){var f="Event '"+t.event+"' was rejected in beforeSend function";return iC(t.event)?we.warn(f+". This can cause unexpected behavior."):we.info(f),null}c.properties&&!ji(c.properties)||we.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of s)if(c.properties&&Qe(c.properties[h]))return we.warn("Event '"+t.event+"' had its '"+h+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return c}getPageViewId(){var t;return(t=this.pageViewManager.Ot)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(s)})}Oi(t){var n=us(t)&&!t,s=At.N()&&At.A("ph_debug")==="true";return!n&&(!!s||t)}}zr.__defaultExtensionClasses={},zr.nn={trace:hl=()=>{},debug:hl,info:hl,warn:hl,error:hl,fatal:hl},(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=YC(e.prototype[t[n]])})(zr,["identify"]);class by{constructor(t){this.disabled=t===!1;var n=Ut(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,s){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>s-a.timestamp){if(this.clicks.push({x:t,y:n,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:s}];return!1}}var qp="$copy_autocapture",Vp=Gt("[AutoCapture]");function Gp(e,t){return t.length>e?t.slice(0,e)+"...":t}function X3(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ti(t));return t}function Q3(e,t){var n,s,{e:a,maskAllElementAttributes:c,maskAllText:u,elementAttributeIgnoreList:f,elementsChainAsString:h,disableCaptureUrlHashes:p}=t;if(!Ti(e))return{props:{}};for(var g=[e],v=e;v.parentNode&&!fr(v,"body");)if(nw(v.parentNode))g.push(v.parentNode.host),v=v.parentNode.host;else{if(!Ti(v.parentNode))break;g.push(v.parentNode),v=v.parentNode}var y,b,_=[],j={},E=!1,k=!1;if(Mt(g,(D=>{var U=ig(D);if(fr(D,"a")){var F=D.getAttribute("href");E=!!(U&&F&&oc(F))&&(p?Ei(F):F)}Ie(Vd(D),"ph-no-capture")&&(k=!0),_.push((function(O,I,T,le,Q){Q===void 0&&(Q=!1);var G=O.tagName.toLowerCase(),$={tag_name:G};Hg.indexOf(G)>-1&&!T&&($.$el_text=G.toLowerCase()==="a"||G.toLowerCase()==="button"?Gp(1024,Kb(O)):Gp(1024,_c(O)));var z=Vd(O);z.length>0&&($.classes=z.filter((function(P){return P!==""}))),Mt(O.attributes,(function(P){var Z;if((!lw(O)||["name","id","class","aria-label"].indexOf(P.name)!==-1)&&(le==null||!le.includes(P.name))&&!I&&oc(P.value)&&(!Ct(Z=P.name)||Z.substring(0,10)!=="_ngcontent"&&Z.substring(0,7)!=="_nghost")){var M=P.value;P.name==="class"&&(M=Fg(M).join(" ")),$["attr__"+P.name]=Gp(1024,P.name==="href"&&Q?Ei(M):M)}}));for(var re=1,me=1,R=O;R=X3(R);)re++,R.tagName===O.tagName&&me++;return $.nth_child=re,$.nth_of_type=me,$})(D,c,u,f,p));var Y=(function(O){if(!ig(O))return{};var I={};return Mt(O.attributes,(function(T){if(T.name&&T.name.indexOf("data-ph-capture-attribute")===0){var le=T.name.replace("data-ph-capture-attribute-",""),Q=T.value;le&&Q&&oc(Q)&&(I[le]=Q)}})),I})(D);Bt(j,Y)})),k)return{props:{},explicitNoCapture:k};if(u||(_[0].$el_text=fr(e,"a")||fr(e,"button")?Kb(e):_c(e)),E){var A,C;_[0].attr__href=E;var L=(A=Gd(E))==null?void 0:A.host,B=se==null||(C=se.location)==null?void 0:C.host;L&&B&&L!==B&&(y=E)}return{props:Bt({$event_type:a.type,$ce_version:1},h?{}:{$elements:_},{$elements_chain:(b=_,(function(D){return D.map((U=>{var F,Y,O="";if(U.tag_name&&(O+=U.tag_name),U.attr_class)for(var I of(U.attr_class.sort(),U.attr_class))O+="."+I.replace(/"/g,"");var T=ye({},U.text?{text:U.text}:{},{"nth-child":(F=U.nth_child)!==null&&F!==void 0?F:0,"nth-of-type":(Y=U.nth_of_type)!==null&&Y!==void 0?Y:0},U.href?{href:U.href}:{},U.attr_id?{attr_id:U.attr_id}:{},U.attributes),le={};return Sd(T).sort(((Q,G)=>{var[$]=Q,[z]=G;return $.localeCompare(z)})).forEach((Q=>{var[G,$]=Q;return le[Zb(G.toString())]=Zb($.toString())})),(O+=":")+Sd(le).map((Q=>{var[G,$]=Q;return G+'="'+$+'"'})).join("")})).join(";")})((function(D){return D.map((U=>{var F,Y,O={text:(F=U.$el_text)==null?void 0:F.slice(0,400),tag_name:U.tag_name,href:(Y=U.attr__href)==null?void 0:Y.slice(0,2048),attr_class:h3(U),attr_id:U.attr__id,nth_child:U.nth_child,nth_of_type:U.nth_of_type,attributes:{}};return Sd(U).filter((I=>{var[T]=I;return T.indexOf("attr__")===0})).forEach((I=>{var[T,le]=I;return O.attributes[T]=le})),O}))})(b)))},(n=_[0])!=null&&n.$el_text?{$el_text:(s=_[0])==null?void 0:s.$el_text}:{},y&&a.type==="click"?{$external_click_url:y}:{},j)}}var qo=Gt("[ExceptionAutocapture]"),K3=Gt("[TracingHeaders]"),ia=Gt("[Web Vitals]"),yy=9e5,_y="disabled",wy="lazy_loading",Vo="awaiting_config",ud="missing_config";Gt("[SessionRecording]"),Gt("[SessionRecording]");var hg="[SessionRecording]",Rs=Gt(hg),Z3=Gt("[Heatmaps]");function Sy(e){return Ut(e)&&"clientX"in e&&"clientY"in e&&Hn(e.clientX)&&Hn(e.clientY)}var Yp=Gt("[Product Tours]"),Wp=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Bg))},J3=["$set_once","$set"],rs=Gt("[SiteApps]"),ky="Error while initializing PostHog app with config id ";function pl(e,t,n){if(Qe(e))return!1;switch(n){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class e4{constructor(t){this.sn=new Gg,this.an=(n,s)=>this.ln(n,s)&&this.un(n,s)&&this.hn(n,s)&&this.dn(n,s),this.ln=(n,s)=>s==null||!s.event||(n==null?void 0:n.event)===(s==null?void 0:s.event),this._instance=t,this.cn=new Set,this.vn=new Set}init(){var t,n;Se((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((s,a)=>{this.on(s,a)}))}register(t){var n,s;if(!Se((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.vn)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this.cn)==null||g.add((p==null?void 0:p.event)||"")}))})),(s=this._instance)!=null&&s.autocapture)){var a,c=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&c.add(h==null?void 0:h.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(c)}}on(t,n){var s;n!=null&&t.length!=0&&(this.cn.has(t)||this.cn.has(n==null?void 0:n.event))&&this.vn&&((s=this.vn)==null?void 0:s.size)>0&&this.vn.forEach((a=>{this.fn(n,a)&&this.sn.emit("actionCaptured",a.name)}))}pn(t){this.onAction("actionCaptured",(n=>t(n)))}fn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var s of n.steps)if(this.an(t,s))return!0;return!1}onAction(t,n){return this.sn.on(t,n)}un(t,n){if(n!=null&&n.url){var s,a=t==null||(s=t.properties)==null?void 0:s.$current_url;if(!a||typeof a!="string"||!pl(a,n.url,n.url_matching||"contains"))return!1}return!0}hn(t,n){return!!this.gn(t,n)&&!!this.mn(t,n)&&!!this.yn(t,n)}gn(t,n){var s;if(n==null||!n.href)return!0;var a=this.bn(t);if(a.length>0)return a.some((f=>pl(f.href,n.href,n.href_matching||"exact")));var c,u=(t==null||(s=t.properties)==null?void 0:s.$elements_chain)||"";return!!u&&pl((c=u.match(/(?::|")href="(.*?)"/))?c[1]:"",n.href,n.href_matching||"exact")}mn(t,n){var s;if(n==null||!n.text)return!0;var a=this.bn(t);if(a.length>0)return a.some((p=>pl(p.text,n.text,n.text_matching||"exact")||pl(p.$el_text,n.text,n.text_matching||"exact")));var c,u,f,h=(t==null||(s=t.properties)==null?void 0:s.$elements_chain)||"";return!!h&&(c=(function(p){for(var g,v=[],y=/(?::|")text="(.*?)"/g;!Qe(g=y.exec(p));)v.includes(g[1])||v.push(g[1]);return v})(h),u=n.text,f=n.text_matching||"exact",c.some((p=>pl(p,u,f))))}yn(t,n){var s,a;if(n==null||!n.selector)return!0;var c=t==null||(s=t.properties)==null?void 0:s.$element_selectors;if(c!=null&&c.includes(n.selector))return!0;var u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}bn(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}dn(t,n){return n==null||!n.properties||n.properties.length===0||Rw(n.properties.reduce(((s,a)=>{var c=rt(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return s[a.key]={values:c,operator:a.operator||"exact"},s}),{}),t==null?void 0:t.properties)}}class t4{constructor(t){this._n=[],this._instance=t,this.wn=new Map,this.xn=new Map,this.kn=new Map}Sn(t,n){return!!t&&Rw(t.propertyFilters,n==null?void 0:n.properties)}Cn(t,n){var s=new Map;return t.forEach((a=>{var c;(c=a.conditions)==null||(c=c[n])==null||(c=c.values)==null||c.forEach((u=>{if(u!=null&&u.name){var f=s.get(u.name)||[];f.push(a.id),s.set(u.name,f)}}))})),s}In(t,n,s){var a=(s===Po.Activation?this.wn:this.xn).get(t),c=[];return this.Tn((u=>{c=u.filter((f=>a==null?void 0:a.includes(f.id)))})),c.filter((u=>{var f,h=(f=u.conditions)==null||(f=f[s])==null||(f=f.values)==null?void 0:f.find((p=>p.name===t));return this.Sn(h,n)}))}register(t){var n;Se((n=this._instance)==null?void 0:n._addCaptureHook)||(this.En(t),this.Mn(t))}Mn(t){var n=t.filter((s=>{var a,c;return((a=s.conditions)==null?void 0:a.actions)&&((c=s.conditions)==null||(c=c.actions)==null||(c=c.values)==null?void 0:c.length)>0}));n.length!==0&&(this.Pn==null&&(this.Pn=new e4(this._instance),this.Pn.init(),this.Pn.pn((s=>{this.onAction(s)}))),n.forEach((s=>{var a,c,u,f,h;s.conditions&&(a=s.conditions)!=null&&a.actions&&(c=s.conditions)!=null&&(c=c.actions)!=null&&c.values&&((u=s.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.Pn)==null||f.register(s.conditions.actions.values),(h=s.conditions)==null||(h=h.actions)==null||(h=h.values)==null||h.forEach((p=>{if(p&&p.name){var g=this.kn.get(p.name);g&&g.push(s.id),this.kn.set(p.name,g||[s.id])}})))})))}En(t){var n,s=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.events)&&((f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),a=t.filter((c=>{var u,f;return((u=c.conditions)==null?void 0:u.cancelEvents)&&((f=c.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));s.length===0&&a.length===0||((n=this._instance)==null||n._addCaptureHook(((c,u)=>{this.onEvent(c,u)})),this.wn=this.Cn(t,Po.Activation),this.xn=this.Cn(t,Po.Cancellation))}onEvent(t,n){var s,a,c=this.Rn(),u=(n==null||(s=n.properties)==null?void 0:s.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.On(t,u);if(f==="consume")return c.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.Ln([u]);if(f==="persist")return c.info("shown item promoted to persisted activation",{event:t,itemId:u}),void this.Fn(u)}if(this.xn.has(t)){var h=this.In(t,n,Po.Cancellation);h.length>0&&(c.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((g=>g.id))}),this.Ln(h.map((g=>g.id))),h.forEach((g=>this.An(g.id))))}if(this.wn.has(t)){c.info("event name matched",{event:t,eventPayload:n,items:this.wn.get(t)});var p=this.In(t,n,Po.Activation);this.$n(p.map((g=>g.id)))}}onAction(t){this.kn.has(t)&&this.$n(this.kn.get(t)||[])}$n(t){t.length!==0&&(this._n=[...new Set([...this._n,...t])],this.Rn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Fn(t){this._n=this._n.filter((s=>s!==t));var n=this.Dn();n.includes(t)||this.Nn([...n,t])}Ln(t){var n=new Set(t);this._n=this._n.filter((c=>!n.has(c)));var s=this.Dn(),a=s.filter((c=>!n.has(c)));a.length!==s.length&&this.Nn(a)}Dn(){var t,n=this.qn();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}getActivatedIds(){return[...new Set([...this.Dn(),...this._n])].filter((t=>!this.jn(t)))}reset(){this._n=[],this.Dn().length>0&&this.Nn([])}getEventToItemsMap(){return this.wn}Bn(){return this.Pn}}class n4 extends t4{constructor(t){super(t)}qn(){return Xm}Hn(){return Fs.SHOWN}Tn(t){var n;(n=this._instance)==null||n.getSurveys(t)}An(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}Rn(){return Nt}Nn(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Xm]:t})}jn(){return!1}On(t,n){var s;this.Tn((c=>{s=c.find((u=>u.id===n))}));var a=!s||(function(c){var u,f,h,p=((u=(f=c.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)!==null&&u!==void 0?u:0)>0;return c.schedule===k3.Always||!((h=c.conditions)==null||(h=h.events)==null||!h.repeatedActivation||!p)})(s);return a?t===Fs.SHOWN?"consume":"ignore":t===Fs.SHOWN?"persist":t===Fs.DISMISSED||t===Fs.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Xp="SDK is not enabled or survey functionality is not yet loaded",jy="Disabled. Not loading surveys.",r4=se!=null&&se.location?Yd(se.location.hash,"__posthog")||Yd(location.hash,"state"):null,Ny="_postHogToolbarParams",Cy=Gt("[Toolbar]"),xn=Gt("[FeatureFlags]"),aa=Gt("[FeatureFlags]",{debugEnabled:!0}),Qp=`" failed. Feature flags didn't load in time.`,Ey=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},Ty=e=>{var t={};for(var[n,s]of Sd(e||{}))s&&(t[n]=s);return t},zs=Gt("[Error tracking]"),Ay="Refusing to render web experiment since the viewer is a likely bot",s4={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Qd(t,e),not_regex:(e,t)=>!Qd(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Mn{get Se(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),n.getWebExperiments((a=>{Mn.Un("retrieved web experiments from the server"),n.zn=new Map,a.forEach((c=>{if(c.feature_flag_key){var u;n.zn&&(Mn.Un("setting flag key ",c.feature_flag_key," to web experiment ",c),(u=n.zn)==null||u.set(c.feature_flag_key,c));var f=n._instance.getFeatureFlag(c.feature_flag_key);Ct(f)&&c.variants[f]&&n.Vn(c.name,f,c.variants[f].transforms)}else if(c.variants)for(var h in c.variants){var p=c.variants[h];Mn.Wn(p,n._instance)&&n.Vn(c.name,h,p.transforms)}}))}),s)},this._instance=t,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Mn.Un(Ay);else if(!this.Se.disable_web_experiments){if(Qe(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Mn.Un("applying feature flags",t),t.forEach((n=>{var s;if(this.zn&&(s=this.zn)!=null&&s.has(n)){var a,c=this._instance.getFeatureFlag(n),u=(a=this.zn)==null?void 0:a.get(n);c&&u!=null&&u.variants[c]&&this.Vn(u.name,c,u.variants[c].transforms)}}))}}previewWebExperiment(){var t=Mn.getWindowLocation();if(t!=null&&t.search){var n=Tl(t==null?void 0:t.search,"__experiment_id"),s=Tl(t==null?void 0:t.search,"__experiment_variant");n&&s&&(Mn.Un("previewing web experiments "+n+" && "+s),this.getWebExperiments((a=>{this.Gn(parseInt(n),s,a)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,s){if(this.Se.disable_web_experiments&&!s)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:c=>t(c.statusCode===200&&c.json&&c.json.experiments||[])})}Gn(t,n,s){var a=s.filter((c=>c.id===t));a&&a.length>0&&(Mn.Un("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.Vn(a[0].name,n,a[0].variants[n].transforms))}static Wn(t,n){return!Qe(t.conditions)&&Mn.Zn(t,n)&&Mn.Qn(t)}static Zn(t,n){var s;if(Qe(t.conditions)||Qe((s=t.conditions)==null?void 0:s.url))return!0;var a=Mn.getWindowLocation();if(a){var c,u,f,h=ew(n,a.href);return(c=t.conditions)==null||!c.url||s4[(u=(f=t.conditions)==null?void 0:f.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return se==null?void 0:se.location}static Qn(t){var n;if(Qe(t.conditions)||Qe((n=t.conditions)==null?void 0:n.utm))return!0;var s=hw();if(s.utm_source){var a,c,u,f,h,p,g,v,y=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_campaign)==s.utm_campaign,b=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_source||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_source)==s.utm_source,_=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_medium||((p=t.conditions)==null||(p=p.utm)==null?void 0:p.utm_medium)==s.utm_medium,j=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((v=t.conditions)==null||(v=v.utm)==null?void 0:v.utm_term)==s.utm_term;return y&&_&&j&&b}return!1}static Un(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;n>a;a++)s[a-1]=arguments[a];we.info("[WebExperiments] "+t,s)}Vn(t,n,s){this._is_bot()?Mn.Un(Ay):n!=="control"?s.forEach((a=>{if(a.selector){var c;Mn.Un("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(c=document)==null?void 0:c.querySelectorAll(a.selector);u==null||u.forEach((f=>{var h=f;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)}))}})):Mn.Un("Control variants leave the page unmodified.")}_is_bot(){return Un&&this._instance?Tw(Un,this.Se.custom_blocked_useragents):void 0}}var Tr=Gt("[Conversations]"),la="Conversations not available yet.",My="console",of={featureFlags:class{constructor(e){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Se(){return this._instance.config}get zr(){return this._instance.persistence}ss(e){return this._instance.get_property(e)}os(){var e,t;return(e=(t=this.zr)==null?void 0:t.Gt(this.Se.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}ls(){return!!this.os()&&(this.ns||this.Kn||(this.ns=!0,xn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}us(){var e,t=(e=this.Se.evaluation_contexts)!==null&&e!==void 0?e:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.rs||(xn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),t!=null&&t.length?t.filter((n=>{var s=n&&typeof n=="string"&&n.trim().length>0;return s||xn.error("Invalid evaluation context found:",n,"Expected non-empty string"),s})):[]}hs(){return this.us().length>0}ds(){var e=this.Se.flag_keys;if(!Se(e)){if(rt(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||xn.error("Invalid flag key found:",t,"Expected non-empty string"),n}));xn.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:n}=this._instance,s=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var a,c,u=(a=(c=n.bootstrap)==null?void 0:c.featureFlagPayloads)!==null&&a!==void 0?a:{},f=Object.keys(s).filter((p=>!!s[p])).reduce(((p,g)=>(p[g]=s[g]||!1,p)),{}),h=Object.keys(u).filter((p=>f[p])).reduce(((p,g)=>(u[g]&&(p[g]=u[g]),p)),{});this.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:h})}}updateFlags(e,t,n){var s,a,c=n!=null&&n.merge&&(s=this.ss(pa))!==null&&s!==void 0?s:{},u=n!=null&&n.merge&&(a=this.ss(wd))!==null&&a!==void 0?a:{},f=ye({},c,e),h=ye({},u,t),p={};for(var[g,v]of Object.entries(f))p[g]={key:g,enabled:Mb(v),variant:Rb(v),reason:void 0,metadata:Se(h==null?void 0:h[g])?void 0:{id:0,version:void 0,description:void 0,payload:h[g]}};this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.ss(Gm),t=this.ss(Bs),n=this.ss(xl);if(!n&&!t)return e||{};var s=Bt({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var c of a){var u,f,h=s[c],p=t==null?void 0:t[c],g=Se(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,v=Se(p)?h.variant:typeof p=="string"?p:void 0,y=n==null?void 0:n[c],b=ye({},h,{enabled:g,variant:g?v??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(b.original_enabled=h==null?void 0:h.enabled),v!==(h==null?void 0:h.variant)&&(b.original_variant=h==null?void 0:h.variant),y&&(b.metadata=ye({},h==null?void 0:h.metadata,{payload:y,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),s[c]=b}return this.Jn||(xn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:s}),this.Jn=!0),s}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var s=e[n];return{key:n,enabled:Mb(s),variant:Rb(s),payload:Ab(t[n])}}))}getFlagVariants(){var e=this.ss(pa),t=this.ss(Bs);if(!t)return e||{};for(var n=Bt({},e),s=Object.keys(t),a=0;s.length>a;a++)n[s[a]]=t[s[a]];return this.Jn||(xn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Jn=!0),n}getFlagPayloads(){var e=this.ss(wd),t=this.ss(xl);if(!t)return e||{};for(var n=Bt({},e||{}),s=Object.keys(t),a=0;s.length>a;a++)n[s[a]]=t[s[a]];return this.Jn||(xn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Jn=!0),n}reloadFeatureFlags(){this.Xn||this.Se.advanced_disable_feature_flags||this.cs||(this._instance.Ti.emit("featureFlagsReloading",!0),this.cs=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.cs),this.cs=void 0}ensureFlagsLoaded(){this.Yn||this.Kn||this.cs||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Xn=e}vs(e){var t;if(this.fs(),!this._instance.mr())if(this.Kn)this.es=!0;else{var n=this.Se.token,s=this.ss($d),a={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ye({},((t=this.zr)==null?void 0:t.get_initial_props())||{},this.ss(ua)||{}),group_properties:this.ss(da),timezone:bw()};Fn(s)||Se(s)||(a.$device_id=s),(e!=null&&e.disableFlags||this.Se.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.hs()&&(a.evaluation_contexts=this.us());var c=this.ds();Se(c)||(a.flag_keys=c);var u=!!this.Se.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:f,data:a,compression:this.Se.disable_compression?void 0:ls.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback:h=>{var p,g,v,y=!0;if(h.statusCode===200&&(this.es||(this.$anon_distinct_id=void 0),y=!1),this.Kn=!1,!a.disable_flags||this.es){this.ts=!y;var b=[];h.error?h.error instanceof Error?b.push(h.error.name==="AbortError"?"timeout":"connection_error"):b.push("unknown_error"):h.statusCode!==200&&b.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&b.push("errors_while_computing_flags");var _,j=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));j&&b.push("quota_limited"),(v=this.zr)==null||v.register({[Km]:b}),j?xn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(a.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},y,{partialResponse:u}),this.es&&(this.es=!1,this.vs()))}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.ts)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var s=this.getFeatureFlagResult(e,t);return(n=s==null?void 0:s.variant)!==null&&n!==void 0?n:s==null?void 0:s.enabled}}else xn.warn('getFeatureFlag for key "'+e+Qp)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.ts)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var n=this.getFlagVariants(),s=e in n,a=n[e],c=this.getFlagPayloads()[e],u=String(a),f=this.ss(Ym)||void 0,h=this.ss(yc)||void 0,p=this.ss(lc)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var g,v=this._instance.get_session_id(),y=this.ss(Qm);v&&v!==y&&(p={},(g=this.zr)==null||g.register({[lc]:p,[Qm]:v}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var b,_,j,E,k,A,C,L,B,D;rt(p[e])?p[e].push(u):p[e]=[u],(b=this.zr)==null||b.register({[lc]:p});var U=this.getFeatureFlagDetails(e),F=[...(_=this.ss(Km))!==null&&_!==void 0?_:[]];Se(a)&&F.push("flag_missing");var Y={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:c||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((j=this.Se.bootstrap)==null||(j=j.featureFlags)==null?void 0:j[e])||null,$feature_flag_bootstrapped_payload:((E=this.Se.bootstrap)==null||(E=E.featureFlagPayloads)==null?void 0:E[e])||null,$used_bootstrap_value:!this.ts};Se(U==null||(k=U.metadata)==null?void 0:k.version)||(Y.$feature_flag_version=U.metadata.version);var O,I=(A=U==null||(C=U.reason)==null?void 0:C.description)!==null&&A!==void 0?A:U==null||(L=U.reason)==null?void 0:L.code;I&&(Y.$feature_flag_reason=I),U!=null&&(B=U.metadata)!=null&&B.id&&(Y.$feature_flag_id=U.metadata.id),Se(U==null?void 0:U.original_variant)&&Se(U==null?void 0:U.original_enabled)||(Y.$feature_flag_original_response=Se(U.original_variant)?U.original_enabled:U.original_variant),U!=null&&(D=U.metadata)!=null&&D.original_payload&&(Y.$feature_flag_original_payload=U==null||(O=U.metadata)==null?void 0:O.original_payload),F.length&&(Y.$feature_flag_error=F.join(",")),this._instance.capture("$feature_flag_called",Y)}if(s)return{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:Ab(c)}}}else xn.warn('getFeatureFlagResult for key "'+e+Qp)}getRemoteConfigPayload(e,t){var n=this.Se.token,s={distinct_id:this._instance.get_distinct_id(),token:n};this.hs()&&(s.evaluation_contexts=this.us());var a=this.ds();Se(a)||(s.flag_keys=a),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Se.disable_compression?void 0:ls.Base64,timeout:this.Se.feature_flag_request_timeout_ms,callback(c){var u,f=(u=c.json)==null?void 0:u.featureFlagPayloads;t((f==null?void 0:f[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.ts){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return Se(n)?void 0:!!n}xn.warn('isFeatureEnabled for key "'+e+Qp)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.zr){this.Yn=!0;var s=this.getFlagVariants(),a=this.getFlagPayloads(),c=this.getFlagsWithDetails();(function(u,f,h,p,g,v){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var y=(F=>{var Y=F.flags;return Y?(F.featureFlags=Object.fromEntries(Object.keys(Y).map((O=>{var I;return[O,(I=Y[O].variant)!==null&&I!==void 0?I:Y[O].enabled]}))),F.featureFlagPayloads=Object.fromEntries(Object.keys(Y).filter((O=>Y[O].enabled)).filter((O=>{var I;return(I=Y[O].metadata)==null?void 0:I.payload})).map((O=>{var I;return[O,(I=Y[O].metadata)==null?void 0:I.payload]})))):F.featureFlags&&xn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),F})(u),b=y.flags,_=y.featureFlags,j=y.featureFlagPayloads;if(_){var E=u.requestId,k=u.evaluatedAt;if(rt(_)){xn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var A={};if(_)for(var C=0;_.length>C;C++)A[_[C]]=!0;f&&f.register({[_d]:_,[pa]:A})}else{var L=_,B=j,D=b;if(v!=null&&v.partialResponse)L=ye({},h,L),B=ye({},p,B),D=ye({},g,D);else if(u.errorsWhileComputingFlags)if(b){var U=new Set(Object.keys(b).filter((F=>{var Y;return!((Y=b[F])!=null&&Y.failed)})));L=ye({},h,Object.fromEntries(Object.entries(L).filter((F=>{var[Y]=F;return U.has(Y)})))),B=ye({},p,Object.fromEntries(Object.entries(B||{}).filter((F=>{var[Y]=F;return U.has(Y)})))),D=ye({},g,Object.fromEntries(Object.entries(D||{}).filter((F=>{var[Y]=F;return U.has(Y)}))))}else L=ye({},h,L),B=ye({},p,B),D=ye({},g,D);f&&f.register(ye({[_d]:Object.keys(Ty(L)),[pa]:L||{},[wd]:B||{},[Gm]:D||{}},E?{[Ym]:E}:{},k?{[yc]:k}:{}))}}})(e,this.zr,s,a,c,n),t||(this.ns=!1),this.ps(t)}}override(e,t){t===void 0&&(t=!1),xn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.zr)return xn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.zr.unregister(Bs),this.zr.unregister(xl),this.ps(),aa.info("All overrides cleared");if(rt(e)){var t=Ey(e);return this.zr.register({[Bs]:t}),this.ps(),aa.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,s=e;if(this.Jn=!!((n=s.suppressWarning)!==null&&n!==void 0&&n),"flags"in s){if(s.flags===!1)this.zr.unregister(Bs),aa.info("Flag overrides cleared");else if(s.flags){if(rt(s.flags)){var a=Ey(s.flags);this.zr.register({[Bs]:a})}else this.zr.register({[Bs]:s.flags});aa.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.zr.unregister(xl),aa.info("Payload overrides cleared")):s.payloads&&(this.zr.register({[xl]:s.payloads}),aa.info("Payload overrides set",{payloads:s.payloads}))),void this.ps()}if(e&&typeof e=="object")return this.zr.register({[Bs]:e}),this.ps(),aa.info("Flag overrides set",{flags:e});xn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Yn){var{flags:t,flagVariants:n}=this.gs();try{e(t,n)}catch(s){xn.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var s,a=(this.ss(ec)||[]).find((h=>h.flagKey===e)),c={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:c};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(c,!1);var f=ye({},this.getFlagVariants(),{[e]:t});(s=this.zr)==null||s.register({[_d]:Object.keys(Ty(f)),[pa]:f}),this.ps()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var s=this.ss(ec),a=n?"&"+n.map((c=>"stage="+c)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+a),method:"GET",callback:c=>{var u,f;if(c.json){var h=c.json.earlyAccessFeatures;return(u=this.zr)==null||u.unregister(ec),(f=this.zr)==null||f.register({[ec]:h}),e(h)}}})}gs(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,s)=>(n[s]=t[s],n)),{})}}ps(e){var{flags:t,flagVariants:n}=this.gs();this.featureFlagEventHandlers.forEach((s=>{try{s(t,n,{errorsLoading:e})}catch(a){xn.error("Error while running feature flags callback",a)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.ss(ua)||{},s=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,c={};if(a)for(var u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(c[u]=a[u]));this._instance.register({[ua]:ye({},n,c,s)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=ye({},this.ss(ua)||{});e.forEach((s=>{delete n[s]})),this._instance.register({[ua]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(ua),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.ss(da)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((s=>{n[s]=ye({},n[s],e[s]),delete e[s]})),this._instance.register({[da]:ye({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.ss(da)||{};this._instance.register({[da]:ye({},t,{[e]:{}})})}else this._instance.unregister(da)}reset(){this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},i4={sessionRecording:class{get Se(){return this._instance.config}get zr(){return this._instance.persistence}get started(){var e;return!((e=this.ys)==null||!e.isStarted)}get status(){var e,t;return this.bs===Vo||this.bs===ud?this.bs:(e=(t=this.ys)==null?void 0:t.status)!==null&&e!==void 0?e:this.bs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=_y,this._s=void 0,this._instance=e,!this._instance.sessionManager)throw Rs.error("started without valid sessionManager"),new Error(hg+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===Us)throw new Error(hg+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get ws(){var e,t=!((e=this._instance.get_property(ma))==null||!e.enabled),n=!this.Se.disable_session_recording,s=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return se&&t&&n&&!s}startIfEnabledOrStop(e){var t;if(!this.ws||(t=this.ys)==null||!t.isStarted){var n=!Se(Object.assign)&&!Se(Array.from);this.ws&&n?(this.xs(e),Rs.info("starting")):(this.bs=_y,this.stopRecording())}}xs(e){var t,n,s;this.ws&&(this.bs!==Vo&&this.bs!==ud&&(this.bs=wy),Le!=null&&(t=Le.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Le.__PosthogExtensions__)!=null&&n.initSessionRecording?this.ks(e):(s=Le.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Ss,(a=>{if(a)return Rs.error("could not load recorder",a);this.ks(e)})))}stopRecording(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.stop()}Cs(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.discard()}Is(){var e,t;(e=this.zr)==null||e.unregister(Pg),(t=this.zr)==null||t.unregister(I5)}Ts(e,t){if(Qe(e))return null;var n,s=Hn(e)?e:parseFloat(e);return typeof(n=s)!="number"||!Number.isFinite(n)||0>n||n>1?(Rs.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}Es(e){if(this.zr){var t,n,s=this.zr,a=()=>{var c,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.Ts((c=this.Se.session_recording)==null?void 0:c.sampleRate,"session_recording.sampleRate"),h=this.Ts(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;Qe(p)&&this.Is();var g=u==null?void 0:u.minimumDurationMilliseconds;s.register({[ma]:ye({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:ye({capturePerformance:e.capturePerformance},u==null?void 0:u.networkPayloadCapture),canvasRecording:{enabled:u==null?void 0:u.recordCanvas,fps:u==null?void 0:u.canvasFps,quality:u==null?void 0:u.canvasQuality},sampleRate:p,minimumDurationMilliseconds:Se(g)?null:g,endpoint:u==null?void 0:u.endpoint,triggerMatchType:u==null?void 0:u.triggerMatchType,masking:u==null?void 0:u.masking,urlTriggers:u==null?void 0:u.urlTriggers,version:u==null?void 0:u.version,triggerGroups:u==null?void 0:u.triggerGroups})})};a(),(t=this._s)==null||t.call(this),this._s=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.Es(e),void this.Cs()):(this.Es(e),void this.startIfEnabledOrStop()):(this.bs===Vo&&(this.bs=ud,Rs.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.ys)!=null&&n.log?this.ys.log(e,t):Rs.warn("log called before recorder was ready")}get Ss(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ma);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Ms(){var e,t,n=this._instance.get_property(ma);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(a){return Rs.warn("persisted remote config for session recording is invalid and will be ignored",a),!1}var s=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-s}ks(e){var t,n;if((t=Le.__PosthogExtensions__)==null||!t.initSessionRecording)return Rs.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[K5]:!0});if(this.ys||(this.ys=(n=Le.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ms())return this.bs===ud||this.bs===Vo?void 0:(this.bs=Vo,Rs.info("persisted remote config is stale, requesting fresh config before starting"),void new yw(this._instance).load());this.bs=wy,this.ys.start(e)}onRRwebEmit(e){var t;(t=this.ys)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ys||(t=this.zr)==null||t.register({[V5]:!0}),(e=this.ys)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ys||(t=this.zr)==null||t.register({[q5]:!0}),(e=this.ys)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.ys||(n=this.zr)==null||n.register({[e==="url"?G5:Y5]:!0}),(t=this.ys)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.ys)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.ys)==null||!n.tryAddCustomEvent(e,t))}}},a4={autocapture:class{constructor(e){this.Ps=!1,this.Rs=null,this.Os=!1,this.instance=e,this.rageclicks=new by(e.config.rageclick),this.Ls=null}initialize(){this.startIfEnabled()}get Se(){var e,t,n=Ut(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((s=>new RegExp(s))),n}Fs(){if(this.isBrowserSupported()){if(se&&Ne){var e=n=>{n=n||(se==null?void 0:se.event);try{this.As(n)}catch(s){Vp.error("Failed to capture event",s)}};if(Xt(Ne,"submit",e,{capture:!0}),Xt(Ne,"change",e,{capture:!0}),Xt(Ne,"click",e,{capture:!0}),this.Se.capture_copied_text){var t=n=>{n=n||(se==null?void 0:se.event);try{this.As(n,qp)}catch(s){Vp.error("Failed to capture copy/cut event",s)}};Xt(Ne,"copy",t,{capture:!0}),Xt(Ne,"cut",t,{capture:!0})}}}else Vp.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ps&&(this.Fs(),this.Ps=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Os=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[$m]:!!e.autocapture_opt_out}),this.Rs=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Ls=e}getElementSelectors(e){var t,n=[];return(t=this.Ls)==null||t.forEach((s=>{var a=Ne==null?void 0:Ne.querySelectorAll(s);a==null||a.forEach((c=>{e===c&&n.push(s)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[$m];if(Fn(this.Rs)&&!us(n)&&!this.instance.mr())return!1;var s=(t=this.Rs)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!s}As(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,s=Op(e);tw(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Qb(s,this.instance.config.rageclick)&&this.As(e,"$rageclick");var a=t===qp;if(s&&(function(v,y,b,_,j,E){var k,A,C,L,B,D;if(b===void 0&&(b=void 0),!se||Ig(v)||(k=b)!=null&&k.url_allowlist&&!Yb(b.url_allowlist,E)||(A=b)!=null&&A.url_ignorelist&&Yb(b.url_ignorelist,E))return!1;if((C=b)!=null&&C.dom_event_allowlist){var U=b.dom_event_allowlist;if(U&&!U.some((T=>y.type===T)))return!1}var{parentIsUsefulElement:F,targetElementList:Y}=aw(v,_);if(!(function(T,le){var Q=le==null?void 0:le.element_allowlist;if(Se(Q))return!0;var G,$=function(re){if(Q.some((me=>re.tagName.toLowerCase()===me)))return{v:!0}};for(var z of T)if(G=$(z))return G.v;return!1})(Y,b)||!sg(Y,(L=b)==null?void 0:L.css_selector_allowlist)||sg(Y,(B=(D=b)==null?void 0:D.css_selector_ignorelist)!==null&&B!==void 0?B:a3))return!1;var O=se.getComputedStyle(v);if(O&&O.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0;var I=v.tagName.toLowerCase();switch(I){case"html":return!1;case"form":return(j||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(y.type)>=0;default:return F?(j||["click"]).indexOf(y.type)>=0:(j||["click"]).indexOf(y.type)>=0&&(Hg.indexOf(I)>-1||v.getAttribute("contenteditable")==="true")}})(s,e,this.Se,a,a?["copy","cut"]:void 0,this.instance)){var{props:c,explicitNoCapture:u}=Q3(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Os,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(u)return!1;var f=this.getElementSelectors(s);if(f&&f.length>0&&(c.$element_selectors=f),t===qp){var h,p=rw(se==null||(h=se.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;c.$selected_content=p,c.$copy_type=g}return this.instance.capture(t,c),!0}}}isBrowserSupported(){return as(Ne==null?void 0:Ne.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.$s=(se==null||(t=se.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(we.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,we.info("History API monitoring stopped")}monitorHistoryChanges(){se&&se.history&&(this.Ns("pushState"),this.Ns("replaceState"),this.qs())}Ns(e){var t;if(se&&((t=se.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(s,a,c){try{if(!(a in s))return()=>{};var u=s[a],f=c(u);return as(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0}})),s[a]=f,()=>{s[a]===f&&(s[a]=u)}}catch{return()=>{}}})(se.history,e,(s=>function(a,c,u){s.call(this,a,c,u),n.js(e)}))}}js(e){try{var t,n=se==null||(t=se.location)==null?void 0:t.pathname;if(!n)return;n!==this.$s&&this.isEnabled&&this._instance.capture(vl,{navigation_type:e}),this.$s=n}catch(s){we.error("Error capturing "+e+" pageview",s)}}qs(){if(!this.Ds){var e=()=>{this.js("popstate")};Xt(se,"popstate",e),this.Ds=()=>{se&&se.removeEventListener("popstate",e)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(e){var t;this.Bs=!1,this.Ps=!1,this.Hs=null,this.instance=e,this.Bs=!((t=this.instance.persistence)==null||!t.props[Um]),this.rageclicks=new by(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Ut(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(e=this.Se.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Qe(this.Se.capture_heatmaps)?Qe(this.Se.enable_heatmaps)?this.Bs:this.Se.enable_heatmaps:this.Se.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Ps)return;Z3.info("starting..."),this.Us(),this.ke()}else{var e;clearInterval((e=this.Hs)!==null&&e!==void 0?e:void 0),this.zs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Um]:t}),this.Bs=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Vs(e){this.fe(e.originalEvent,"deadclick")}ke(){this.Hs&&clearInterval(this.Hs),this.Hs=(Ne==null?void 0:Ne.visibilityState)==="visible"?setInterval(this.Lr.bind(this),this.flushIntervalMilliseconds):null}Us(){se&&Ne&&(this.Ws=this.Lr.bind(this),Xt(se,Id,this.Ws),this.Gs=e=>this.fe(e||(se==null?void 0:se.event)),Xt(Ne,"click",this.Gs,{capture:!0}),this.Zs=e=>this.Qs(e||(se==null?void 0:se.event)),Xt(Ne,"mousemove",this.Zs,{capture:!0}),this.Js=new Jb(this.instance,p3,this.Vs.bind(this)),this.Js.startIfEnabledOrStop(),this.Ys=this.ke.bind(this),Xt(Ne,Hd,this.Ys),this.Ps=!0)}zs(){var e;se&&Ne&&(this.Ws&&se.removeEventListener(Id,this.Ws),this.Gs&&Ne.removeEventListener("click",this.Gs,{capture:!0}),this.Zs&&Ne.removeEventListener("mousemove",this.Zs,{capture:!0}),this.Ys&&Ne.removeEventListener(Hd,this.Ys),clearTimeout(this.Ks),(e=this.Js)==null||e.stop(),this.Ps=!1)}Xs(e,t){var n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),c=(function(u,f,h){for(var p=u;p&&Ti(p)&&!fr(p,"body");){if(p===h)return!1;if(Ie(f,se==null?void 0:se.getComputedStyle(p).position))return!0;p=sw(p)}return!1})(Op(e),["fixed","sticky"],a);return{x:e.clientX+(c?0:s),y:e.clientY+(c?0:n),target_fixed:c,type:t}}fe(e,t){var n;if(t===void 0&&(t="click"),!Gb(e.target)&&Sy(e)){var s=this.Xs(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Qb(Op(e),this.instance.config.rageclick)&&this.eo(ye({},s,{type:"rageclick"})),this.eo(s)}}Qs(e){!Gb(e.target)&&Sy(e)&&(clearTimeout(this.Ks),this.Ks=setTimeout((()=>{this.eo(this.Xs(e,"mousemove"))}),500))}eo(e){if(se){var t=this.Se.disable_capture_url_hashes?Ei(se.location.href):se.location.href,n=this.Se.custom_personal_data_properties,s=this.Se.mask_personal_data_properties?[...Al,...n||[]]:[],a=wc(t,s,Sc);this.R=this.R||{},this.R[a]||(this.R[a]=[]),this.R[a].push(e)}}Lr(){this.R&&!ji(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Jb,webVitalsAutocapture:class{constructor(e){var t;this.Bs=!1,this.Ps=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ro=()=>{clearTimeout(this.io),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,s)=>ye({},n,{["$web_vitals_"+s.name+"_event"]:ye({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.no=n=>{var s;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.so();if(!Se(a))if(Qe(n==null?void 0:n.name)||Qe(n==null?void 0:n.value))ia.error("Invalid metric received",n);else if(!this.oo||this.oo>n.value){this.R.url!==a&&(this.ro(),this.io=setTimeout(this.ro,this.flushToCaptureTimeoutMs)),Se(this.R.url)&&(this.R.url=a),this.R.firstMetricTimestamp=Se(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var c=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),u=ye({},n,{$current_url:a,timestamp:Date.now()});Se(c)||(u.$session_id=c.sessionId,u.$window_id=c.windowId),this.R.metrics.push(u),this.R.metrics.length===this.allowedMetrics.length&&this.ro()}else ia.error("Ignoring metric with value >= "+this.oo,n)},this.ao=()=>{if(!this.Ps){var n,s,a,c,u=Le.__PosthogExtensions__;Se(u)||Se(u.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:s,onFCP:a,onINP:c}=u.postHogWebVitalsCallbacks),n&&s&&a&&c?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.no.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.no.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.no.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&c(this.no.bind(this)),this.Ps=!0):ia.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Bs=!((t=this._instance.persistence)==null||!t.props[qm]),this.startIfEnabled()}get lo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=Ut(this.lo)?(e=this.lo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Qe(n)?((t=this._instance.persistence)==null?void 0:t.props[Vm])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Ut(this.lo)?this.lo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Ut(this.lo)?this.lo.web_vitals_attribution:void 0;return e!=null&&e}get oo(){var e=Ut(this.lo)&&Hn(this.lo.__web_vitals_max_value)?this.lo.__web_vitals_max_value:yy;return e>0&&6e4>=e?yy:e}get isEnabled(){var e=nn==null?void 0:nn.protocol;if(e!=="http:"&&e!=="https:")return ia.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Ut(this.lo)?this.lo.web_vitals:us(this.lo)?this.lo:void 0;return us(t)?t:this.Bs}startIfEnabled(){this.isEnabled&&!this.Ps&&(ia.info("enabled, starting..."),this.Mt(this.ao))}onRemoteConfig(e){if("capturePerformance"in e){var t=Ut(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Ut(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[qm]:t}),this._instance.persistence.register({[Vm]:n})),this.Bs=t,this.startIfEnabled()}}Mt(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(s=>{s?ia.error("failed to load script",s):e()}))}so(){var e=se?this._instance.config.disable_capture_url_hashes?Ei(se.location.href):se.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Al,...t||[]]:[];return wc(e,n,Sc)}ia.error("Could not determine current URL")}}},l4={exceptionObserver:class{constructor(e){var t,n,s;this.ao=()=>{var a;if(se&&this.isEnabled&&(a=Le.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var c=Le.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,u=Le.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,f=Le.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.uo&&this.Se.capture_unhandled_errors&&(this.uo=c(this.captureException.bind(this))),!this.ho&&this.Se.capture_unhandled_rejections&&(this.ho=u(this.captureException.bind(this))),!this.do&&this.Se.capture_console_errors&&(this.do=f(this.captureException.bind(this)))}catch(h){qo.error("failed to start",h),this.co()}}},this._instance=e,this.vo=!((t=this._instance.persistence)==null||!t.props[Fm]),this.fo=new cC({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,Ae:qo}),this.Se=this.po(),this.startIfEnabledOrStop()}po(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ut(e)?t=ye({},t,e):(Se(e)?this.vo:e)&&(t=ye({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(qo.info("enabled"),this.co(),this.Mt(this.ao)):this.co()}Mt(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return qo.error("failed to load script",s);e()}))}co(){var e,t,n;(e=this.uo)==null||e.call(this),this.uo=void 0,(t=this.ho)==null||t.call(this),this.ho=void 0,(n=this.do)==null||n.call(this),this.do=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.vo=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Fm]:this.vo}),this.Se=this.po(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.po()}captureException(e){var t,n,s,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.fo.consumeRateLimit(a)?qo.info("Skipping exception capture because of client rate limiting.",{exception:a}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.mo=[],this.yo=new jC([new zC,new HC,new DC,new LC,new UC,new $C,new BC,new FC],(function(s){for(var a=arguments.length,c=new Array(a>1?a-1:0),u=1;a>u;u++)c[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
|
|
64
|
+
`),v=h;g.length>v;v++){var y=g[v];if(1024>=y.length){var b=Hb.test(y)?y.replace(Hb,"$1"):y;if(!b.match(/\S*Error: /)){for(var _ of c){var j=_(b,s);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(E){if(!E.length)return[];var k=Array.from(E);return k.reverse(),k.slice(0,50).map((A=>{return ye({},A,{filename:A.filename||(C=k,C[C.length-1]||{}).filename,function:A.function||El});var C}))})(p)}})("web:javascript",TC,RC)),this._instance=e,this.mo=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Hm))!==null&&t!==void 0?t:[],this.bo=Pd(this._o()),this.wo=new qC(this.bo)}onConfigChange(){this.bo=Pd(this._o()),this.wo.setConfig(this.bo)}onRemoteConfig(e){var t,n,s;if("errorTracking"in e){var a=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],c=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.mo=a,this._instance.persistence&&this._instance.persistence.register({[Hm]:this.mo,[Im]:c})}}get xo(){var e,t=!!this._instance.get_property(Im),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.yo.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.bo.enabled)try{if(!Ct(e)||e.trim().length===0)return void zs.warn("Ignoring exception step because message must be a non-empty string");var n=this.ko(t),{sanitizedProperties:s,droppedKeys:a}=(function(c){if(!c)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(c).reduce(((f,h)=>IC.has(h)?(u.push(h),f):(f[h]=c[h],f)),{}),droppedKeys:u}})(n);a.length>0&&zs.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.wo.add(ye({[Od]:e,[Bd]:new Date().toISOString()},s))}catch(c){zs.error("Failed to add exception step. Ignoring breadcrumb.",c)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.So(t)){if(this.Co(t))return this.Io("Exception dropped: matched a suppression rule"),void zs.info("Skipping exception capture because a suppression rule matched");if(!this.xo&&this.To(t))return this.Io("Exception dropped: thrown by a browser extension"),void zs.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Eo(t))return this.Io("Exception dropped: thrown by the PostHog SDK"),void zs.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.bo.enabled&&Qe(e.$exception_steps)?this.Mo(e):e;try{var s=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Zi:!0});return s&&this.wo.clear(),s}catch(a){return zs.error("Failed to capture exception event. Dropping this exception.",a),void this.wo.clear()}}catch(a){return void zs.error("Failed to process exception event. Ignoring this exception.",a)}}Mo(e){try{var t=this.wo.getAttachable();return t.length===0?e:ye({},e,{$exception_steps:t})}catch(n){return zs.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}Io(e){this.bo.enabled&&this.wo.add({[Od]:e,[Bd]:new Date().toISOString()})}ko(e){return Ut(e)?ye({},e):{}}_o(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Co(e){if(e.length===0)return!1;var t=e.reduce(((n,s)=>{var{type:a,value:c}=s;return Ct(a)&&a.length>0&&n.$exception_types.push(a),Ct(c)&&c.length>0&&n.$exception_values.push(c),n}),{$exception_types:[],$exception_values:[]});return this.mo.some((n=>{var s=n.values.map((a=>{var c,u=Mw[a.operator],f=rt(a.value)?a.value:[a.value],h=(c=t[a.key])!==null&&c!==void 0?c:[];return f.length>0&&u(f,h)}));return n.type==="OR"?s.some(Boolean):s.every(Boolean)}))}To(e){return e.flatMap((t=>{var n,s;return(n=(s=t.stacktrace)==null?void 0:s.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Eo(e){if(e.length>0){var t,n,s,a,c=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=c[c.length-1];return(s=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}So(e){return!Qe(e)&&rt(e)}}},o4=ye({productTours:class{get zr(){return this._instance.persistence}constructor(e){this.Po=null,this.Ro=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if("productTours"in e){var t,n;if(this.zr&&this.zr.register({[Bg]:!!e.productTours}),!Wp(this._instance))return!this.Po&&Qe((t=this.zr)==null?void 0:t.props[tc])||Yp.info("product tours disabled; stopping and clearing cached tours"),(n=this.Po)==null||n.stop(),this.Po=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Po&&Wp(this._instance)&&this.Mt((()=>this.Oo()))}Mt(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(s=>{s?Yp.error("Could not load product tours script",s):e()}))}Oo(){var e;!this.Po&&(e=Le.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Po=Le.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!rt(this.Ro)||t){var n=this.zr;if(n){var s=n.props[tc];if(rt(s)&&!t)return this.Ro=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:a=>{if(Wp(this._instance)){var c=a.statusCode;if(c!==200||!a.json){var u="Product Tours API could not be loaded, status: "+c;return Yp.error(u),void e([],{isLoaded:!1,error:u})}var f=rt(a.json.product_tours)?a.json.product_tours:[];this.Ro=f,n&&n.register({[tc]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Ro,{isLoaded:!0})}getActiveProductTours(e){Qe(this.Po)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Po.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Po)==null||t.showTourById(e)}previewTour(e){this.Po?this.Po.previewTour(e):this.Mt((()=>{var t;this.Oo(),(t=this.Po)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Po)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Po)==null||e.nextStep()}previousStep(){var e;(e=this.Po)==null||e.previousStep()}clearCache(){var e;this.Ro=null,(e=this.zr)==null||e.unregister(tc)}resetTour(e){var t;(t=this.Po)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Po)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Po)==null||t.cancelPendingTour(e)}}},of),c4={siteApps:class{constructor(e){this.Lo=0,this._instance=e,this.Fo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ao(e,t){if(t){var n=this.globalsForEvent(t);this.Fo.push(n),this.Fo.length>1e3&&(this.Fo=this.Fo.slice(10))}}get siteAppLoaders(){var e;return(e=Le._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Ao.bind(this));this.$o=()=>{e(),this.Fo=[],this.$o=void 0}}}globalsForEvent(e){var t,n,s,a,c,u,f;if(!e)throw new Error("Event payload is required");var h={},p=this._instance.get_property("$groups")||[],g=this._instance.get_property("$stored_group_properties")||{};for(var[v,y]of Object.entries(g))h[v]={id:p[v],type:v,properties:y};var{$set_once:b,$set:_}=e;return{event:ye({},c5(e,J3),{properties:ye({},e.properties,_?{$set:ye({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},b?{$set_once:ye({},(s=(a=e.properties)==null?void 0:a.$set_once)!==null&&s!==void 0?s:{},b)}:{}),elements_chain:(c=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&c!==void 0?c:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}Do(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(rs.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(rs.error("prepare_external_dependency_script returned null"),null):e}No(){var e,t,n,s,a,c,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Ne==null?void 0:Ne.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.Lo++,this.qo)return this.jo();var g=[],v=this,y=new WeakSet,b=(E,k,A)=>{if(E!=null&&E[k]){var C=E[k];E[k]=A(C),g.push((()=>{E[k]=C}))}},_=E=>{if(y.has(E))return E;var k=v.Do(E);return k&&y.add(k),k},j=E=>E.map((k=>typeof k=="string"?k:_(k))).filter((k=>!Fn(k)));return b(p,"appendChild",(E=>function(k){var A=_(k);return A?E.call(this,A):k})),b(p,"insertBefore",(E=>function(k,A){var C=_(k);return C?E.call(this,C,A):k})),b(p,"replaceChild",(E=>function(k,A){var C=_(k);return C?E.call(this,C,A):A})),[(t=h.Element)==null?void 0:t.prototype,(n=h.Document)==null?void 0:n.prototype,(s=h.DocumentFragment)==null?void 0:s.prototype].forEach((E=>{b(E,"append",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),b(E,"prepend",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))}))})),[(a=h.Element)==null?void 0:a.prototype,(c=h.CharacterData)==null?void 0:c.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((E=>{b(E,"before",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),b(E,"after",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),b(E,"replaceWith",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];var B=j(C);return C.length&&!B.length?void 0:k.apply(this,B)}))})),b((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(E=>function(k,A){var C=_(A);return C?E.call(this,k,C):null})),this.qo=()=>{g.forEach((E=>E())),this.qo=void 0},this.jo()}jo(){var e=!1;return()=>{var t;e||(e=!0,this.Lo--,this.Lo===0&&((t=this.qo)==null||t.call(this)))}}Bo(e,t){t===void 0&&(t=!0);var n=this.No();try{var s=e(n);return t&&n(),s}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.Fo.length&&(rs.info("Processing "+this.Fo.length+" events for site app with id "+e.id),this.Fo.forEach((f=>this.Bo((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this.$o)==null||u.call(this))},s=!1,a=u=>{t.errored=!u,t.loaded=!0,rs.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),s&&n()};try{var{processEvent:c}=this.Bo((u=>e.init({posthog:this._instance,callback(f){u(),a(f)}})),!1);c&&(t.processEvent=c),s=!0}catch(u){rs.error(ky+e.id,u),a(!1)}if(s&&t.loaded)try{n()}catch(u){rs.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Ho(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Uo(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),s=function(c){try{t.Bo((()=>c.processEvent==null?void 0:c.processEvent(n)))}catch(u){rs.error("Error while processing event "+e.event+" for site app "+c.id,u)}};for(var a of Object.values(this.apps))s(a)}}onRemoteConfig(e){var t,n,s,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Ho(),void this._instance.on("eventCaptured",(h=>this.Uo(h)))):void rs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.$o)==null||n.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var c=function(h){var p;Le["__$$ph_site_app_"+h]=a._instance,(p=Le.__PosthogExtensions__)==null||p.loadSiteApp==null||p.loadSiteApp(a._instance,f,(g=>{if(g)return rs.error(ky+h,g)}))};for(var{id:u,url:f}of e.siteApps)c(u)}else rs.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},u4={tracingHeaders:class{constructor(e){this.zo=void 0,this.Vo=void 0,this.Wo=void 0,this.ao=()=>{var t,n,s=this.Go();s?(Se(this.zo)&&(this.zo=(t=Le.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Se(this.Vo)&&(this.Vo=(n=Le.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.co()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Mt(e){var t,n;(t=Le.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Le.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return K3.error("failed to load script",s);e()}))}Zo(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Go(){var e=this.Zo();return rt(e)?(rt(this.Wo)?this.Wo.splice(0,this.Wo.length,...e):this.Wo=[...e],e.length>0?this.Wo:void 0):(rt(this.Wo)&&this.Wo.splice(0),this.Wo=e||void 0,this.Wo)}co(){var e,t;(e=this.zo)==null||e.call(this),(t=this.Vo)==null||t.call(this),this.zo=void 0,this.Vo=void 0}startIfEnabledOrStop(){this.Go()?this.Mt(this.ao):this.co()}}},d4=ye({surveys:class{get Se(){return this._instance.config}constructor(e){this.Qo=void 0,this._surveyManager=null,this.Jo=!1,this.Yo=[],this.Ko=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Se.disable_surveys){var t=e.surveys;if(Qe(t))return Nt.warn("Flags not loaded yet. Not loading surveys.");var n=rt(t);this.Qo=n?t.length>0:t,Nt.info("flags response received, isSurveysEnabled: "+this.Qo),this.loadIfEnabled()}}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var s=localStorage.key(n);(s!=null&&s.startsWith(fg)||s!=null&&s.startsWith("inProgressSurvey_"))&&t.push(s)}t.forEach((a=>localStorage.removeItem(a)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.Jo)Nt.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)Nt.info(jy);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())Nt.info("Not loading surveys in cookieless mode without consent.");else{var e=Le==null?void 0:Le.__PosthogExtensions__;if(e){if(!Se(this.Qo)||this.Se.advanced_enable_surveys){var t=this.Qo||this.Se.advanced_enable_surveys;this.Jo=!0;try{var n=e.generateSurveys;if(n)return void this.Xo(n,t);var s=e.loadExternalDependency;if(!s)return void this.ea(ng);s(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.ea("Could not load surveys script",a):this.Xo(e.generateSurveys,t)}))}catch(a){throw this.ea("Error initializing surveys",a),a}finally{this.Jo=!1}}}else Nt.error("PostHog Extensions not found.")}}Xo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new n4(this._instance),Nt.info("Surveys loaded successfully"),this.ta({isLoaded:!0})}ea(e,t){Nt.error(e,t),this.ta({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Yo.push(e),this._surveyManager&&this.ta({isLoaded:!0}),()=>{this.Yo=this.Yo.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Se.disable_surveys)return Nt.info(jy),e([]);var n,s=this._instance.get_property(Wm);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.Ko?this.Ko.then((a=>{var{surveys:c,context:u}=a;return e(c,u)})):(typeof Promise<"u"&&(this.Ko=new Promise((a=>{n=a}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:a=>{var c;this.Ko=null;var u=a.statusCode;if(u!==200||!a.json){var f="Surveys API could not be loaded, status: "+u;Nt.error(f);var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}var p,g=a.json.surveys||[],v=g.filter((b=>(function(_){return!(!_.start_date||_.end_date)})(b)&&((function(_){var j;return!((j=_.conditions)==null||(j=j.events)==null||(j=j.values)==null||!j.length)})(b)||(function(_){var j;return!((j=_.conditions)==null||(j=j.actions)==null||(j=j.values)==null||!j.length)})(b))));v.length>0&&((p=this._surveyEventReceiver)==null||p.register(v)),(c=this._instance.persistence)==null||c.register({[Wm]:g,[$g]:Date.now()});var y={isLoaded:!0};e(g,y),n==null||n({surveys:g,context:y})}}))}ta(e){for(var t of this.Yo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Nt.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!Qe(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Nt.warn("init was not called")}ra(e){var t=null;return this.getSurveys((n=>{var s;t=(s=n.find((a=>a.id===e)))!==null&&s!==void 0?s:null})),t}ia(e){if(Qe(this._surveyManager))return{eligible:!1,reason:Xp};var t=typeof e=="string"?this.ra(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Qe(this._surveyManager))return Nt.warn("init was not called"),{visible:!1,disabledReason:Xp};var t=this.ia(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Qe(this._surveyManager)?(Nt.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Xp})):new Promise((n=>{this.getSurveys((s=>{var a,c=(a=s.find((f=>f.id===e)))!==null&&a!==void 0?a:null;if(c){var u=this.ia(c);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var s;if(Qe(this._surveyManager))Nt.warn("init was not called");else{var a=typeof e=="string"?this.ra(e):e;if(a!=null&&a.id)if(H3.includes(a.type)){var c=Ne==null?void 0:Ne.querySelector(t);if(c)return(s=a.appearance)!=null&&s.surveyPopupDelaySeconds?(Nt.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Nt.info("Rendering survey "+a.id+" with delay of "+((u=a.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(a,c,n),Nt.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,c,n);Nt.warn("Survey element not found")}else Nt.warn("Surveys of type "+a.type+" cannot be rendered in the app");else Nt.warn("Survey not found")}}displaySurvey(e,t){var n;if(Qe(this._surveyManager))Nt.warn("init was not called");else{var s=this.ra(e);if(s){var a=s;if((n=s.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=ye({},s,{appearance:ye({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ag.Popover&&t.initialResponses&&Nt.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var c=this.canRenderSurvey(s);if(!c.visible)return void Nt.warn("Survey is not eligible to be displayed: ",c.disabledReason)}t.displayType!==ag.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else Nt.warn("Survey not found")}}cancelPendingSurvey(e){Qe(this._surveyManager)?Nt.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},of),f4={toolbar:class{constructor(e){this.instance=e}na(e){Le.ph_toolbar_state=e}sa(){var e;return(e=Le.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),Z5(this.instance.config)||!se||!Ne)return!1;e=e??se.location,n=n??se.history;try{if(!t){try{se.localStorage.setItem("test","test"),se.localStorage.removeItem("test")}catch{return!1}t=se==null?void 0:se.localStorage}var s,a=r4||Yd(e.hash,"__posthog")||Yd(e.hash,"state"),c=a?qb((()=>JSON.parse(atob(decodeURIComponent(a)))))||qb((()=>JSON.parse(decodeURIComponent(a)))):null;return c&&c.action==="ph_authorize"?((s=c).source="url",s&&Object.keys(s).length>0&&(c.desiredHash?e.hash=c.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Ny)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}oa(e){var t=Le.ph_load_toolbar||Le.ph_load_editor;!Qe(t)&&as(t)?t(e,this.instance):Cy.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ne==null||!Ne.getElementById(W5));if(!se||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=ye({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(se.localStorage.setItem(Ny,JSON.stringify(ye({},s,{source:void 0}))),this.sa()===2)this.oa(s);else if(this.sa()===0){var a;this.na(1),(a=Le.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(c=>{if(c)return Cy.error("[Toolbar] Failed to load",c),void this.na(0);this.na(2),this.oa(s)})),Xt(se,"turbolinks:load",(()=>{this.na(0),this.loadToolbar(s)}))}return!0}aa(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},h4=ye({experiments:Mn},of),p4=ye({},of,i4,a4,l4,o4,c4,d4,u4,f4,h4,{conversations:class{constructor(e){this.la=void 0,this._conversationsManager=null,this.ua=!1,this.ha=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Qe(t)||(us(t)?this.la=t:(this.la=t.enabled,this.ha=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.la=void 0,this.ha=null}loadIfEnabled(){if(!(this._conversationsManager||this.ua||this._instance.config.disable_conversations||Z5(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Le==null?void 0:Le.__PosthogExtensions__;if(e&&!Se(this.la)&&this.la)if(this.ha&&this.ha.token){this.ua=!0;try{var t=e.initConversations;if(t)return this.da(t),void(this.ua=!1);var n=e.loadExternalDependency;if(!n)return void this.ca(ng);n(this._instance,"conversations",(s=>{s||!e.initConversations?this.ca("Could not load conversations script",s):this.da(e.initConversations),this.ua=!1}))}catch(s){this.ca("Error initializing conversations",s),this.ua=!1}}else Tr.error("Conversations enabled but missing token in remote config.")}}da(e){if(this.ha)try{this._conversationsManager=e(this.ha,this._instance),Tr.info("Conversations loaded successfully")}catch(t){this.ca("Error completing conversations initialization",t)}else Tr.error("Cannot complete initialization: remote config is null")}ca(e,t){Tr.error(e,t),this._conversationsManager=null,this.ua=!1}show(){this._conversationsManager?this._conversationsManager.show():Tr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.la===!0&&!Fn(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var s=this;return vn((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,n):(Tr.warn(la),null)}))()}getMessages(e,t){var n=this;return vn((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Tr.warn(la),null)}))()}markAsRead(e){var t=this;return vn((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Tr.warn(la),null)}))()}getTickets(e){var t=this;return vn((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Tr.warn(la),null)}))()}requestRestoreLink(e){var t=this;return vn((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Tr.warn(la),null)}))()}restoreFromToken(e){var t=this;return vn((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Tr.warn(la),null)}))()}restoreFromUrlToken(){var e=this;return vn((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Tr.warn(la),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}en(){var e;(e=this._conversationsManager)==null||e.setIdentity()}tn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.va=!1,this.fa=!1,this.Ae=Gt("[logs]"),this._r=[],this.pa=[],this.ga=()=>{var n,s;(n=this.ma)==null||n.onReconnect(),(s=this.ya)==null||s.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.va=!0),se&&Xt(se,"online",this.ga)}ba(e,t,n,s){var a,c=(function(u,f){var h,p,g,v,y,b,_,j=(h=u==null?void 0:u.flushIntervalMs)!==null&&h!==void 0?h:3e3,E=(p=u==null?void 0:u.maxBufferSize)!==null&&p!==void 0?p:100,k=f!=null&&f.consoleCapture?void 0:(g=u==null?void 0:u.maxLogsPerInterval)!==null&&g!==void 0?g:1e3,A=Se(k)?Math.max(E,2048):Math.max(E,k),C=u==null?void 0:u.resourceAttributes;return{serviceName:(v=(y=C==null?void 0:C["service.name"])!==null&&y!==void 0?y:u==null?void 0:u.serviceName)!==null&&v!==void 0?v:f==null?void 0:f.serviceNameDefault,serviceVersion:(b=C==null?void 0:C["service.version"])!==null&&b!==void 0?b:u==null?void 0:u.serviceVersion,environment:(_=C==null?void 0:C["deployment.environment"])!==null&&_!==void 0?_:u==null?void 0:u.environment,resourceAttributes:C,beforeSend:u==null?void 0:u.beforeSend,flushIntervalMs:j,maxBufferSize:E,maxQueueSize:A,maxBatchRecordsPerPost:100,rateCapWindowMs:j,maxLogsPerInterval:k,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new SC(this._a(e,t),c,this.Ae,(()=>this.wa()),(u=>u()),void 0,s),c]}xa(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;return this.ma&&this.ka===n||((t=this.ma)==null||t.reset(),this.ka=n,[this.ma,this.Sa]=this.ba((()=>this._r),(s=>{this._r=s}))),this.ma}Ca(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;return this.ya&&this.Ia===n||((t=this.ya)==null||t.reset(),this.Ia=n,[this.ya,this.Ta]=this.ba((()=>this.pa),(s=>{this.pa=s}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},My)),this.ya}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!Qe(n)&&n&&(this.va=!0,this.loadIfEnabled())}reset(){var e,t;this._r=[],(e=this.ma)==null||e.reset(),this.pa=[],(t=this.ya)==null||t.reset()}captureLog(e){this.xa().captureLog(e)}le(e){this.Ca().captureLog(e)}get logger(){return this.Ea||(this.Ea={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Ea}flushLogs(e){e?this.Ma(e):(this.ma&&this.ma.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))),this.ya&&this.ya.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.va&&!this.fa){var e=Le==null?void 0:Le.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var s;n||(s=e.logs)==null||!s.initializeLogs?this.Ae.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.fa=!0)})):this.Ae.error(ng)}else this.Ae.error("PostHog Extensions not found.")}}_a(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:s=>s===Ps.LogsQueue?e():void 0,setPersistedProperty(s,a){var c;s===Ps.LogsQueue&&t((c=a)!==null&&c!==void 0?c:[])},ht:s=>this.ht(s),getLibraryId:()=>Zt.LIB_NAME,getLibraryVersion:()=>Zt.LIB_VERSION}}ht(e){return new Promise((t=>{var n=!1,s=c=>{n||(n=!0,clearTimeout(a),t(c))},a=setTimeout((()=>s({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Pa(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(c){var u=c.statusCode;if(u>=200&&300>u)s({kind:"ok"});else if(u===413)s({kind:"too-large"});else if(u!==0&&u!==429&&500>u)s({kind:"fatal",error:new Error("logs request failed with status "+u)});else{var f;s({kind:"retry-later",error:(f=c.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}))}Ma(e){this._r.length>0&&this.Ra(e,this._r,this.Sa,Zt.LIB_NAME,(t=>{this._r=t})),this.pa.length>0&&this.Ra(e,this.pa,this.Ta,My,(t=>{this.pa=t}))}Ra(e,t,n,s,a){if(t.length!==0){var c=t.map((f=>f.record));a([]);var u=P5(c,B5(n,Zt.LIB_NAME,Zt.LIB_VERSION),s,Zt.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Pa(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}Pa(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}wa(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n,windowId:s,sessionStartTimestamp:a,lastActivityTimestamp:c}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=n,t.windowId=s,Qe(a)||(t.sessionStartTimestamp=a),Qe(c)||(t.lastActivityTimestamp=c)}if(Le!=null&&(e=Le.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ei(Le.location.href):Le.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}});zr.__defaultExtensionClasses=ye({},p4);var kc=(function(){Zt.SDK_DIST_CHANNEL="npm";var e=uc[bl]=new zr;return(function(){function t(){t.done||(t.done=!0,Lw=!1,Mt(uc,(function(n){n._dom_loaded()})))}Ne!=null&&Ne.addEventListener?Ne.readyState==="complete"?t():Xt(Ne,"DOMContentLoaded",t,{capture:!1}):se&&we.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const m4="https://us.i.posthog.com",Dw="cc-telemetry-enabled";let pg=!1,jc=!1;function g4(){return m4}function x4(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(Dw);return e===null?!0:e==="true"}function Ow(e){pg&&(e?(kc.opt_in_capturing({captureEventName:null}),jc=!0):(kc.opt_out_capturing(),jc=!1))}function Gz(e){typeof localStorage<"u"&&localStorage.setItem(Dw,String(e)),Ow(e)}function v4(){const e=void 0;return e?(kc.init(e,{api_host:g4(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),pg=!0,Ow(x4()),!0):(pg=!1,jc=!1,!1)}function Yg(e,t){jc&&kc.capture(e,t)}function Ai(e,t){jc&&kc.captureException(e,t)}function b4(e){Yg("$pageview",{$current_url:e})}const ds="/api",Bw="companion_auth_token";function Mi(){if(typeof window>"u")return{};const e=localStorage.getItem(Bw);return e?{Authorization:`Bearer ${e}`}:{}}function ba(e){e===401&&typeof window<"u"&&(localStorage.removeItem(Bw),er(async()=>{const{useStore:t}=await Promise.resolve().then(()=>Vj);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function un(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Ac(e,t,n,s){Yg("api_request_succeeded",{method:e,path:t,status:s,duration_ms:Math.round(n)})}function fs(e,t,n,s,a){Yg("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:s instanceof Error?s.message:String(s)}),Ai(s,{method:e,path:t,status:a})}async function He(e,t){const n=un();let s=!1;try{const a=await fetch(`${ds}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Mi()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw fs("POST",e,un()-n,u,a.status),s=!0,u}return Ac("POST",e,un()-n,a.status),a.json()}catch(a){throw s||fs("POST",e,un()-n,a),a}}async function Re(e){const t=un();let n=!1;try{const s=await fetch(`${ds}${e}`,{headers:{...Mi()}});if(!s.ok){ba(s.status);const a=await s.json().catch(()=>({error:s.statusText})),c=new Error(a.error||s.statusText);throw fs("GET",e,un()-t,c,s.status),n=!0,c}return Ac("GET",e,un()-t,s.status),s.json()}catch(s){throw n||fs("GET",e,un()-t,s),s}}async function Ar(e,t){const n=un();let s=!1;try{const a=await fetch(`${ds}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Mi()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw fs("PUT",e,un()-n,u,a.status),s=!0,u}return Ac("PUT",e,un()-n,a.status),a.json()}catch(a){throw s||fs("PUT",e,un()-n,a),a}}async function y4(e,t){const n=un();let s=!1;try{const a=await fetch(`${ds}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Mi()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw fs("PATCH",e,un()-n,u,a.status),s=!0,u}return Ac("PATCH",e,un()-n,a.status),a.json()}catch(a){throw s||fs("PATCH",e,un()-n,a),a}}async function Mr(e,t){const n=un();let s=!1;try{const a=await fetch(`${ds}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Mi()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const c=await a.json().catch(()=>({error:a.statusText})),u=new Error(c.error||a.statusText);throw fs("DELETE",e,un()-n,u,a.status),s=!0,u}return Ac("DELETE",e,un()-n,a.status),a.json()}catch(a){throw s||fs("DELETE",e,un()-n,a),a}}async function _4(e,t){const n=await fetch(`${ds}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Mi()},body:JSON.stringify(e??{})});if(!n.ok||!n.body){const f=await n.json().catch(()=>({error:n.statusText}));throw new Error(f.error||n.statusText)}const s=n.body.getReader(),a=new TextDecoder;let c="",u=null;for(;;){const{done:f,value:h}=await s.read();if(f)break;c+=a.decode(h,{stream:!0});const p=c.split(`
|
|
65
65
|
|
|
66
66
|
`);c=p.pop()||"";for(const g of p){if(!g.trim())continue;let v="",y="";for(const _ of g.split(`
|
|
67
|
-
`))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(y=_.slice(5).trim());if(!y)continue;const b=JSON.parse(y);if(v==="progress")t(b);else if(v==="done")u=b;else if(v==="error")throw new Error(b.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function w4(){try{const e=await fetch(`${ds}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function Ry(e){try{const t=await fetch(`${ds}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const ke={getAuthQr:()=>Re("/auth/qr"),getAuthToken:()=>Re("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>Re("/sessions"),discoverClaudeSessions:(e=200)=>Re(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),s=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Re(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(s))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Mr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${ds}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Mi()}});if(!n.ok)throw ba(n.status),new Error(`Export failed (${n.status})`);const s=await n.blob(),c=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(c==null?void 0:c[1])||`session.${t}`;return{blob:s,filename:u}},archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Re(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>y4(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Re(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Re("/fs/home"),listEnvs:()=>Re("/envs"),getEnv:e=>Re(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Ar(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Mr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Re("/sandboxes"),getSandbox:e=>Re(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Ar(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Mr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>Re("/docker/base-image"),getSettings:()=>Re("/settings"),updateSettings:e=>Ar("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getTailscaleStatus:()=>Re("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>Re("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>Ar(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Mr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Re(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Re(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Re(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Re(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Re(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Re(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Ar("/linear/project-mappings",e),removeLinearProjectMapping:e=>Mr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Ar(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Mr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Re(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>He("/linear/issues",e),addLinearComment:(e,t,n)=>He(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Re(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Re(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>Re(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Mr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Re(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Re("/backends"),getBackendModels:e=>Re(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Re("/containers/status"),getContainerImages:()=>Re("/containers/images"),getImageStatus:e=>Re(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Re(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>He(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Re(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Re(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${ds}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Mi()}});if(!t.ok){ba(t.status);const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Ar("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Re(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Re(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Re(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Ar("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Re(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Re("/usage-limits"),getSessionUsageLimits:e=>Re(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Re("/system/memory"),spawnTerminal:(e,t,n,s)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:s==null?void 0:s.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>Re(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Re("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>Re("/claude-compat"),refreshClaudeCompat:()=>He("/claude-compat/refresh"),pinClaudeVersion:e=>He("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>He("/claude-compat/patch"),unpatchClaudeBinary:()=>He("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>He("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Re("/cron/jobs"),getCronJob:e=>Re(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>Ar(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Mr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Re(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Re(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Re("/agents"),getAgent:e=>Re(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>Ar(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Mr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Re(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>Re(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>He(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return Re(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Re(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const s=n.toString();return Re(`/linear/oauth/authorize-url${s?`?${s}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>Re(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Mr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Re("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Ar(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Mr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Re(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Re("/skills"),sendSessionMessage:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const s=n.toString();return Re(`/prompts${s?`?${s}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>Ar(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Mr(`/prompts/${encodeURIComponent(e)}`)};let zy=!1;function Ly(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.position="fixed",s.style.left="-9999px",document.body.appendChild(s),s.select();const a=document.execCommand("copy");if(document.body.removeChild(s),!a){n(new Error("Copy command was rejected"));return}t()}catch(s){n(s instanceof Error?s:new Error("Clipboard copy failed"))}})}function Dy(){return new Promise(()=>{})}function S4(){if(zy||typeof window>"u")return;zy=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async s=>{try{await n(s)}catch{try{await Ly(s)}catch{return Dy()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await Ly(n)}catch{return Dy()}}}})}catch{}}const Oy="#/session/",By="#/agents/";let Py=!1;function Wg(){Py||(S4(),Py=!0)}function Xg(e){if(Wg(),e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(By)){const n=e.slice(By.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(Oy)){const n=e.slice(Oy.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function k4(e){return`#/session/${e}`}function Qg(e,t=!1){Wg();const n=k4(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Kp(e=!1){Wg(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function j4(){const[e,t]=S.useState(""),[n,s]=S.useState(null),[a,c]=S.useState(!1),u=X(g=>g.setAuthToken),f=S.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){s("Please enter a token");return}c(!0),s(null),await Ry(v)?u(v):s("Invalid token"),c(!1)},[e,u]);S.useEffect(()=>{w4().then(g=>{if(g){u(g);return}const y=new URLSearchParams(window.location.search).get("token");y&&(c(!0),Ry(y).then(b=>{if(b){u(y);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else s("Invalid token from URL"),c(!1)}))})},[u]);const[h,p]=S.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:g=>{t(g.target.value),s(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>p(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:a?"Verifying...":"Login"})]}),l.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var Dl=X_();function N4({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:s,archiveTransitionStateName:a,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:l.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:g=>g.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${c?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!c,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),s&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function C4(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function E4({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function T4({type:e}){return e==="codex"?l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function Nd({session:e,isActive:t,isArchived:n,sessionName:s,permCount:a,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:y,editingName:b,setEditingName:_,onConfirmRename:j,onCancelRename:E,editInputRef:k}){const A=e.id.slice(0,8),C=s||e.model||A,L=y===e.id,[B,D]=S.useState(!1),U=S.useRef(null),F=S.useRef(null),Y=n?"exited":C4(e,a),O=e.cwd||"";S.useEffect(()=>{if(!B)return;function T(Q){var G;U.current&&!U.current.contains(Q.target)&&F.current&&!F.current.contains(Q.target)&&(D(!1),(G=F.current)==null||G.focus())}function le(Q){var G,$,z;if(Q.key==="Escape"){D(!1),(G=F.current)==null||G.focus();return}if(Q.key==="Tab"){D(!1);return}if((Q.key==="ArrowDown"||Q.key==="ArrowUp")&&(($=U.current)!=null&&$.contains(document.activeElement)||F.current===document.activeElement)){Q.preventDefault();const re=(z=U.current)==null?void 0:z.querySelectorAll("[role='menuitem']");if(!re||re.length===0)return;const me=document.activeElement,R=Array.from(re).indexOf(me);Q.key==="ArrowDown"?re[R<re.length-1?R+1:0].focus():re[R>0?R-1:re.length-1].focus()}}return document.addEventListener("mousedown",T),document.addEventListener("touchstart",T),document.addEventListener("keydown",le),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("touchstart",T),document.removeEventListener("keydown",le)}},[B]),S.useEffect(()=>{B&&requestAnimationFrame(()=>{var T,le;(le=(T=U.current)==null?void 0:T.querySelector("[role='menuitem']"))==null||le.focus()})},[B]);const I=S.useCallback(T=>{D(!1),T()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:T=>{T.preventDefault(),f(e.id,C)},onKeyDown:T=>{T.key==="F2"&&!L&&(T.preventDefault(),f(e.id,C))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),!L&&l.jsx(E4,{status:Y}),L?l.jsx("input",{ref:k,value:b,onChange:T=>_(T.target.value),onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),j()):T.key==="Escape"&&(T.preventDefault(),E()),T.stopPropagation()},onBlur:j,onClick:T=>T.stopPropagation(),onDoubleClick:T=>T.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:C}),O&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:O})]}),!L&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(T4,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]})]}),!n&&!L&&!B&&l.jsx("button",{onClick:T=>{T.stopPropagation(),h(T,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),l.jsx("button",{ref:F,onClick:T=>{T.stopPropagation(),D(!B)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":B,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),B&&l.jsxs("div",{ref:U,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>I(()=>f(e.id,C)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>p(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),l.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>g(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>h(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function A4({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:s,sessionNames:a,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:j,onConfirmRename:E,onCancelRename:k,editInputRef:A,isFirst:C}){const L=t?e.sessions.slice(0,2).map(B=>a.get(B.id)||B.model||B.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:C?"":"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),l.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&L&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:L}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(B=>{var U;const D=((U=c.get(B.id))==null?void 0:U.size)??0;return l.jsx(Nd,{session:B,isActive:s===B.id,sessionName:a.get(B.id),permCount:D,isRecentlyRenamed:u.has(B.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:j,onConfirmRename:E,onCancelRename:k,editInputRef:A},B.id)})})]})}function M4(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function R4(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function z4(e){const t=new Map;for(const s of e){const a=M4(s.cwd,s.repoRoot||void 0,s.isContainerized),c=R4(a);t.has(a)||t.set(a,{key:a,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);u.sessions.push(s),s.status==="running"&&u.runningCount++,u.permCount+=s.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,s.createdAt)}const n=Array.from(t.values()).sort((s,a)=>s.label.localeCompare(a.label));for(const s of n)s.sessions.sort((a,c)=>c.createdAt-a.createdAt);return n}const L4=[{label:"Documentation",url:"https://docs.thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811V2.828zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 000 2.5v11a.5.5 0 00.707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 00.78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0016 13.5v-11a.5.5 0 00-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z"},{label:"GitHub",url:"https://github.com/The-Vibe-Company/companion",viewBox:"0 0 16 16",iconPath:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"},{label:"Website",url:"https://thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M0 8a8 8 0 1116 0A8 8 0 010 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 005.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 01.64-1.539 6.7 6.7 0 01.597-.933A7.025 7.025 0 002.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 00-.656 2.5h2.49zM4.847 5a12.5 12.5 0 00-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 00-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 00.337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 01-.597-.933A9.268 9.268 0 014.09 12H2.255a7.024 7.024 0 003.072 2.472zM3.82 11a13.652 13.652 0 01-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0013.745 12H11.91a9.27 9.27 0 01-.64 1.539 6.688 6.688 0 01-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 01-.312 2.5zm2.802-3.5a6.959 6.959 0 00-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 00-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 00-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"}],D4=[{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],O4=[{id:"workbench",label:"Workbench",itemIds:["prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],B4=new Map(D4.map(e=>[e.id,e]));function P4(){var Br,Pr;const[e,t]=S.useState(null),[n,s]=S.useState(""),[a,c]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[g,v]=S.useState(null),[y,b]=S.useState(!1),[_,j]=S.useState(null),[E,k]=S.useState(!1),[A,C]=S.useState(()=>typeof window<"u"?window.location.hash:""),L=S.useRef(null),B=S.useRef(null),D=X(te=>te.sessions),U=X(te=>te.sdkSessions),F=X(te=>te.currentSessionId),Y=X(te=>te.cliConnected),O=X(te=>te.cliReconnecting),I=X(te=>te.sessionStatus),T=X(te=>te.removeSession),le=X(te=>te.sessionNames),Q=X(te=>te.recentlyRenamed),G=X(te=>te.clearRecentlyRenamed),$=X(te=>te.pendingPermissions),z=X(te=>te.linkedLinearIssues),re=X(te=>te.collapsedProjects),me=X(te=>te.toggleProjectCollapse),R=Xg(A);S.useEffect(()=>{let te=!0;async function he(){try{const We=await ke.listSessions();if(te){const Dt=X.getState();Dt.setSdkSessions(We);const rn=X.getState(),Tn=new Set(We.map(Ot=>Ot.sessionId));for(const Ot of rn.sessions.keys())!Tn.has(Ot)&&rn.connectionStatus.get(Ot)!=="connected"&&rn.removeSession(Ot);YN(We);for(const Ot of We)if(Ot.name&&(!Dt.sessionNames.has(Ot.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Dt.sessionNames.get(Ot.sessionId)))){const Ln=Dt.sessionNames.get(Ot.sessionId),mr=!!Ln&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Ln);Ln!==Ot.name&&(Dt.setSessionName(Ot.sessionId,Ot.name),mr&&Dt.markRecentlyRenamed(Ot.sessionId))}}}catch{}}he();const ge=setInterval(he,5e3);return()=>{te=!1,clearInterval(ge)}},[]),S.useEffect(()=>{const te=()=>C(window.location.hash);return window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[]);function P(te){Qg(te),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}function Z(){Kp(),X.getState().newSession(),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&L.current&&(L.current.focus(),L.current.select())},[e]);function M(){e&&n.trim()&&(X.getState().setSessionName(e,n.trim()),ke.renameSession(e,n.trim()).catch(()=>{})),t(null),s("")}function pe(){t(null),s("")}function _e(te,he){t(te),s(he)}const Ce=S.useCallback((te,he)=>{te.stopPropagation(),j(he)},[]),Ae=S.useCallback(async te=>{try{Cm(te),await ke.deleteSession(te)}catch{}X.getState().currentSessionId===te&&Kp(),T(te)},[T]),ze=S.useCallback(()=>{_&&(Ae(_),j(null))},[_,Ae]),De=S.useCallback(()=>{j(null)},[]),et=S.useCallback(()=>{k(!0)},[]),xe=S.useCallback(async()=>{k(!1);const te=X.getState(),he=new Set;for(const We of te.sessions.keys())he.add(We);for(const We of te.sdkSessions)he.add(We.sessionId);const ge=Array.from(he).filter(We=>{const Dt=te.sdkSessions.find(rn=>rn.sessionId===We);return(Dt==null?void 0:Dt.archived)??!1});for(const We of ge)await Ae(We)},[Ae]),Pe=S.useCallback(()=>{k(!1)},[]);S.useEffect(()=>{if(!_&&!E)return;requestAnimationFrame(()=>{var he,ge;(ge=(he=B.current)==null?void 0:he.querySelector("button"))==null||ge.focus()});function te(he){var rn;if(he.key==="Escape"){E?Pe():De();return}if(he.key!=="Tab")return;const ge=(rn=B.current)==null?void 0:rn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ge||ge.length===0)return;const We=ge[0],Dt=ge[ge.length-1];he.shiftKey&&document.activeElement===We?(he.preventDefault(),Dt.focus()):!he.shiftKey&&document.activeElement===Dt&&(he.preventDefault(),We.focus())}return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[_,E,De,Pe]);const ft=S.useCallback(async(te,he)=>{te.stopPropagation();const ge=U.find(Ln=>Ln.sessionId===he),We=D.get(he),Dt=(We==null?void 0:We.is_containerized)||!!(ge!=null&&ge.containerId)||!1,rn=z.get(he),Tn=((rn==null?void 0:rn.stateType)||"").toLowerCase();if(rn&&!(Tn==="completed"||Tn==="canceled"||Tn==="cancelled"))try{const Ln=await ke.getArchiveInfo(he);if(Ln.issueNotDone){p(he),v(Ln),b(Dt);return}}catch{}if(Dt){f(he);return}zt(he)},[U,D,z]),zt=S.useCallback(async(te,he,ge)=>{try{Cm(te);const We={};he&&(We.force=!0),ge&&ge!=="none"&&(We.linearTransition=ge),await ke.archiveSession(te,Object.keys(We).length>0?We:void 0)}catch{}X.getState().currentSessionId===te&&(Kp(),X.getState().newSession());try{const We=await ke.listSessions();X.getState().setSdkSessions(We)}catch{}},[]),bt=S.useCallback(()=>{u&&(zt(u,!0),f(null))},[u,zt]),Lt=S.useCallback(()=>{f(null)},[]),dn=S.useCallback((te,he)=>{h&&(zt(h,he,te),p(null),v(null))},[h,zt]),st=S.useCallback(()=>{p(null),v(null)},[]),fn=S.useCallback(async(te,he)=>{te.stopPropagation();try{await ke.unarchiveSession(he)}catch{}try{const ge=await ke.listSessions();X.getState().setSdkSessions(ge)}catch{}},[]),yn=new Set;for(const te of D.keys())yn.add(te);for(const te of U)yn.add(te.sessionId);const je=Array.from(yn).map(te=>{var We;const he=D.get(te),ge=U.find(Dt=>Dt.sessionId===te);return{id:te,model:(he==null?void 0:he.model)||(ge==null?void 0:ge.model)||"",cwd:(he==null?void 0:he.cwd)||(ge==null?void 0:ge.cwd)||"",gitBranch:(he==null?void 0:he.git_branch)||(ge==null?void 0:ge.gitBranch)||"",isContainerized:(he==null?void 0:he.is_containerized)||!!(ge!=null&&ge.containerId)||!1,gitAhead:(he==null?void 0:he.git_ahead)||(ge==null?void 0:ge.gitAhead)||0,gitBehind:(he==null?void 0:he.git_behind)||(ge==null?void 0:ge.gitBehind)||0,linesAdded:(he==null?void 0:he.total_lines_added)||(ge==null?void 0:ge.totalLinesAdded)||0,linesRemoved:(he==null?void 0:he.total_lines_removed)||(ge==null?void 0:ge.totalLinesRemoved)||0,isConnected:Y.get(te)??!1,isReconnecting:O.get(te)??!1,status:I.get(te)??null,sdkState:(ge==null?void 0:ge.state)??null,createdAt:(ge==null?void 0:ge.createdAt)??0,archived:(ge==null?void 0:ge.archived)??!1,backendType:(he==null?void 0:he.backend_type)||(ge==null?void 0:ge.backendType)||"claude",repoRoot:(he==null?void 0:he.repo_root)||"",permCount:((We=$.get(te))==null?void 0:We.size)??0,cronJobId:(he==null?void 0:he.cronJobId)||(ge==null?void 0:ge.cronJobId),cronJobName:(he==null?void 0:he.cronJobName)||(ge==null?void 0:ge.cronJobName),agentId:(he==null?void 0:he.agentId)||(ge==null?void 0:ge.agentId),agentName:(he==null?void 0:he.agentName)||(ge==null?void 0:ge.agentName),userName:ge==null?void 0:ge.userName}}).sort((te,he)=>he.createdAt-te.createdAt),Oe=S.useMemo(()=>Array.from(new Set(je.map(te=>te.userName).filter(te=>!!te))).sort(),[je]),[yt,qe]=S.useState("__all__"),Or=te=>yt==="__all__"?!0:yt==="__none__"?!te.userName:te.userName===yt,ae=je.some(te=>!te.userName),ve=je.filter(Or),W=ve.filter(te=>!te.archived&&!te.cronJobId&&!te.agentId),fe=ve.filter(te=>!te.archived&&!!te.cronJobId),Te=ve.filter(te=>!te.archived&&!!te.agentId),Ye=ve.filter(te=>te.archived),tt=F?je.find(te=>te.id===F):null,nt=(tt==null?void 0:tt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[vt,hn]=S.useState(!0),[Ze,nr]=S.useState(!0),En=S.useMemo(()=>z4(W),[W]),Yr={onSelect:P,onStartRename:_e,onArchive:ft,onUnarchive:fn,onDelete:Ce,onClearRecentlyRenamed:G,editingSessionId:e,editingName:n,setEditingName:s,onConfirmRename:M,onCancelRename:pe,editInputRef:L};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:nt,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),l.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>X.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),Oe.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:yt,onChange:te=>qe(te.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[l.jsx("option",{value:"__all__",children:"All users"}),Oe.map(te=>l.jsx("option",{value:te,children:te},te)),ae&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:Lt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:bt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:W.length===0&&fe.length===0&&Ye.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[En.map((te,he)=>l.jsx(A4,{group:te,isCollapsed:re.has(te.key),onToggleCollapse:me,currentSessionId:F,sessionNames:le,pendingPermissions:$,recentlyRenamed:Q,isFirst:he===0,...Yr},te.key)),fe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>hn(!vt),"aria-expanded":vt,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${vt?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",fe.length,")"]}),vt&&l.jsx("div",{className:"mt-0.5",children:fe.map(te=>{var he;return l.jsx(Nd,{session:te,isActive:F===te.id,sessionName:le.get(te.id),permCount:((he=$.get(te.id))==null?void 0:he.size)??0,isRecentlyRenamed:Q.has(te.id),...Yr},te.id)})})]}),Te.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>nr(!Ze),"aria-expanded":Ze,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${Ze?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Te.length,")"]}),Ze&&l.jsx("div",{className:"mt-0.5",children:Te.map(te=>{var he;return l.jsx(Nd,{session:te,isActive:F===te.id,sessionName:le.get(te.id),permCount:((he=$.get(te.id))==null?void 0:he.size)??0,isRecentlyRenamed:Q.has(te.id),...Yr},te.id)})})]}),Ye.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>c(!a),"aria-expanded":a,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Ye.length,")"]}),a&&Ye.length>1&&l.jsx("button",{onClick:et,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),a&&l.jsx("div",{className:"mt-0.5",children:Ye.map(te=>{var he;return l.jsx(Nd,{session:te,isActive:F===te.id,isArchived:!0,sessionName:le.get(te.id),permCount:((he=$.get(te.id))==null?void 0:he.size)??0,isRecentlyRenamed:Q.has(te.id),...Yr},te.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:O4.map(te=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:te.label}),l.jsx("div",{className:"flex flex-col",children:te.itemIds.map(he=>{const ge=B4.get(he);if(!ge)return null;const We=ge.activePages?ge.activePages.some(Dt=>R.page===Dt):R.page===ge.id;return l.jsxs("button",{onClick:()=>{window.location.hash=ge.hash,window.innerWidth<768&&X.getState().setSidebarOpen(!1)},title:ge.label,"aria-current":We?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${We?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${We?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:ge.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:ge.iconPath,fillRule:ge.fillRule,clipRule:ge.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ge.label})]},ge.id)})})]},te.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:L4.map(te=>l.jsx("a",{href:te.url,target:"_blank",rel:"noopener noreferrer",title:te.label,"aria-label":`Open ${te.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:l.jsx("svg",{viewBox:te.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:te.iconPath})})},te.label))})]})})]}),(_||E)&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:E?Pe:De,children:l.jsxs("div",{ref:B,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:te=>te.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:E?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:E?`This will permanently delete ${Ye.length} archived session${Ye.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:E?Pe:De,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:E?xe:ze,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:E?"Delete all":"Delete"})]})]})}),h&&g&&l.jsx(N4,{issueIdentifier:((Br=g.issue)==null?void 0:Br.identifier)||"",issueStateName:((Pr=g.issue)==null?void 0:Pr.stateName)||"",isContainerized:y,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:dn,onCancel:st})]})}function $4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,F4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,H4={};function $y(e,t){return(H4.jsx?F4:U4).test(e)}const I4=/[ \t\n\f\r]/g;function q4(e){return typeof e=="object"?e.type==="text"?Uy(e.value):!1:Uy(e)}function Uy(e){return e.replace(I4,"")===""}class Mc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Mc.prototype.normal={};Mc.prototype.property={};Mc.prototype.space=void 0;function Pw(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Mc(n,s,t)}function mg(e){return e.toLowerCase()}class tr{constructor(t,n){this.attribute=n,this.property=t}}tr.prototype.attribute="";tr.prototype.booleanish=!1;tr.prototype.boolean=!1;tr.prototype.commaOrSpaceSeparated=!1;tr.prototype.commaSeparated=!1;tr.prototype.defined=!1;tr.prototype.mustUseProperty=!1;tr.prototype.number=!1;tr.prototype.overloadedBoolean=!1;tr.prototype.property="";tr.prototype.spaceSeparated=!1;tr.prototype.space=void 0;let V4=0;const Ve=_a(),cn=_a(),gg=_a(),be=_a(),Tt=_a(),xa=_a(),dr=_a();function _a(){return 2**++V4}const xg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:cn,commaOrSpaceSeparated:dr,commaSeparated:xa,number:be,overloadedBoolean:gg,spaceSeparated:Tt},Symbol.toStringTag,{value:"Module"})),Zp=Object.keys(xg);class Kg extends tr{constructor(t,n,s,a){let c=-1;if(super(t,n),Fy(this,"space",a),typeof s=="number")for(;++c<Zp.length;){const u=Zp[c];Fy(this,Zp[c],(s&xg[u])===xg[u])}}}Kg.prototype.defined=!0;function Fy(e,t,n){n&&(e[t]=n)}function Ol(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const c=new Kg(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),t[s]=c,n[mg(s)]=s,n[mg(c.attribute)]=s}return new Mc(t,n,e.space)}const $w=Ol({properties:{ariaActiveDescendant:null,ariaAtomic:cn,ariaAutoComplete:null,ariaBusy:cn,ariaChecked:cn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Tt,ariaCurrent:null,ariaDescribedBy:Tt,ariaDetails:null,ariaDisabled:cn,ariaDropEffect:Tt,ariaErrorMessage:null,ariaExpanded:cn,ariaFlowTo:Tt,ariaGrabbed:cn,ariaHasPopup:null,ariaHidden:cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tt,ariaLevel:be,ariaLive:null,ariaModal:cn,ariaMultiLine:cn,ariaMultiSelectable:cn,ariaOrientation:null,ariaOwns:Tt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:cn,ariaReadOnly:cn,ariaRelevant:null,ariaRequired:cn,ariaRoleDescription:Tt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:cn,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Uw(e,t){return t in e?e[t]:t}function Fw(e,t){return Uw(e,t.toLowerCase())}const G4=Ol({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:Tt,accessKey:Tt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alpha:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:Tt,autoFocus:Ve,autoPlay:Ve,blocking:Tt,capture:null,charSet:null,checked:Ve,cite:null,className:Tt,closedBy:null,colorSpace:null,cols:be,colSpan:be,command:null,commandFor:null,content:null,contentEditable:cn,controls:Ve,controlsList:Tt,coords:be|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:gg,draggable:cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:Tt,height:be,hidden:gg,high:be,href:null,hrefLang:null,htmlFor:Tt,httpEquiv:Tt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:Tt,itemRef:Tt,itemScope:Ve,itemType:Tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ve,optimum:be,pattern:null,ping:Tt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:Tt,required:Ve,reversed:Ve,rows:be,rowSpan:be,sandbox:Tt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootCustomElementRegistry:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shadowRootSerializable:Ve,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:cn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:cn,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ve,disablePictureInPicture:Ve,disableRemotePlayback:Ve,exportParts:xa,part:Tt,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:Fw}),Y4=Ol({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:dr,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Tt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xa,g2:xa,glyphName:xa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:dr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:be,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:dr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:dr,rev:dr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:dr,requiredFeatures:dr,requiredFonts:dr,requiredFormats:dr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:dr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:dr,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:dr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Uw}),Hw=Ol({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Iw=Ol({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fw}),qw=Ol({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),W4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},X4=/[A-Z]/g,Hy=/-[a-z]/g,Q4=/^data[-\w.:]+$/i;function K4(e,t){const n=mg(t);let s=t,a=tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Q4.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Hy,J4);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Hy.test(c)){let u=c.replace(X4,Z4);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Kg}return new a(s,t)}function Z4(e){return"-"+e.toLowerCase()}function J4(e){return e.charAt(1).toUpperCase()}const eE=Pw([$w,G4,Hw,Iw,qw],"html"),Zg=Pw([$w,Y4,Hw,Iw,qw],"svg");function tE(e){return e.join(" ").trim()}var ml={},Jp,Iy;function nE(){if(Iy)return Jp;Iy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
67
|
+
`))_.startsWith("event:")?v=_.slice(6).trim():_.startsWith("data:")&&(y=_.slice(5).trim());if(!y)continue;const b=JSON.parse(y);if(v==="progress")t(b);else if(v==="done")u=b;else if(v==="error")throw new Error(b.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function w4(){try{const e=await fetch(`${ds}/auth/auto`);if(e.ok){const t=await e.json();if(t.ok&&t.token)return t.token}return null}catch{return null}}async function Ry(e){try{const t=await fetch(`${ds}/auth/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e})});return t.ok?!!(await t.json()).ok:!1}catch{return!1}}const ke={getAuthQr:()=>Re("/auth/qr"),getAuthToken:()=>Re("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>Re("/sessions"),discoverClaudeSessions:(e=200)=>Re(`/claude/sessions/discover?limit=${encodeURIComponent(String(e))}`),getClaudeSessionHistory:(e,t)=>{const n=Math.max(0,Math.floor((t==null?void 0:t.cursor)??0)),s=Math.max(1,Math.floor((t==null?void 0:t.limit)??40));return Re(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(s))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Mr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${ds}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Mi()}});if(!n.ok)throw ba(n.status),new Error(`Export failed (${n.status})`);const s=await n.blob(),c=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(c==null?void 0:c[1])||`session.${t}`;return{blob:s,filename:u}},archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Re(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>y4(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Re(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Re("/fs/home"),listEnvs:()=>Re("/envs"),getEnv:e=>Re(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Ar(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Mr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Re("/sandboxes"),getSandbox:e=>Re(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Ar(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Mr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>Re("/docker/base-image"),getSettings:()=>Re("/settings"),updateSettings:e=>Ar("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getTailscaleStatus:()=>Re("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>Re("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>Ar(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Mr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Re(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Re(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Re(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Re(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Re(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Re(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Ar("/linear/project-mappings",e),removeLinearProjectMapping:e=>Mr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Ar(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Mr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Re(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>He("/linear/issues",e),addLinearComment:(e,t,n)=>He(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Re(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Re(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>Re(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Mr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Re(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Re("/backends"),getBackendModels:e=>Re(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Re("/containers/status"),getContainerImages:()=>Re("/containers/images"),getImageStatus:e=>Re(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Re(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>He(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Re(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Re(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${ds}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Mi()}});if(!t.ok){ba(t.status);const s=await t.json().catch(()=>({error:t.statusText}));throw new Error(s.error||t.statusText)}const n=await t.blob();return URL.createObjectURL(n)},writeFile:(e,t)=>Ar("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Re(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Re(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Re(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Ar("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Re(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Re("/usage-limits"),getSessionUsageLimits:e=>Re(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Re("/system/memory"),spawnTerminal:(e,t,n,s)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:s==null?void 0:s.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>Re(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Re("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>Re("/claude-compat"),refreshClaudeCompat:()=>He("/claude-compat/refresh"),pinClaudeVersion:e=>He("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>He("/claude-compat/patch"),unpatchClaudeBinary:()=>He("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>He("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Re("/cron/jobs"),getCronJob:e=>Re(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>Ar(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Mr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Re(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Re(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Re("/agents"),getAgent:e=>Re(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>Ar(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Mr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Re(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>Re(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>He(`/agents/${encodeURIComponent(e)}/regenerate-secret`),listExecutions:e=>{const t=new URLSearchParams;e!=null&&e.agentId&&t.set("agentId",e.agentId),e!=null&&e.triggerType&&t.set("triggerType",e.triggerType),e!=null&&e.status&&t.set("status",e.status),e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.offset&&t.set("offset",String(e.offset));const n=t.toString();return Re(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Re(`/linear/oauth/status${n?`?${n}`:""}`)},getLinearOAuthAuthorizeUrl:(e,t)=>{const n=new URLSearchParams;e&&n.set("returnTo",e),t&&n.set("stagingId",t);const s=n.toString();return Re(`/linear/oauth/authorize-url${s?`?${s}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>Re(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Mr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Re("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Ar(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Mr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Re(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Re("/skills"),sendSessionMessage:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/message`,{content:t}),listPrompts:(e,t)=>{const n=new URLSearchParams;e&&n.set("cwd",e),t&&n.set("scope",t);const s=n.toString();return Re(`/prompts${s?`?${s}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>Ar(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Mr(`/prompts/${encodeURIComponent(e)}`)};let zy=!1;function Ly(e){return new Promise((t,n)=>{if(typeof document>"u"||typeof document.execCommand!="function"){n(new Error("Clipboard fallback is unavailable"));return}try{const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly",""),s.style.position="fixed",s.style.left="-9999px",document.body.appendChild(s),s.select();const a=document.execCommand("copy");if(document.body.removeChild(s),!a){n(new Error("Copy command was rejected"));return}t()}catch(s){n(s instanceof Error?s:new Error("Clipboard copy failed"))}})}function Dy(){return new Promise(()=>{})}function S4(){if(zy||typeof window>"u")return;zy=!0;const e=window.navigator,t=e.clipboard;if(t!=null&&t.writeText){const n=t.writeText.bind(t);try{t.writeText=async s=>{try{await n(s)}catch{try{await Ly(s)}catch{return Dy()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await Ly(n)}catch{return Dy()}}}})}catch{}}const Oy="#/session/",By="#/agents/";let Py=!1;function Wg(){Py||(S4(),Py=!0)}function Xg(e){if(Wg(),e==="#/settings")return{page:"settings"};if(e==="#/integrations")return{page:"integrations"};if(e==="#/integrations/linear")return{page:"integration-linear"};if(e==="#/integrations/linear-oauth")return{page:"integration-linear-oauth"};if(e==="#/integrations/tailscale")return{page:"integration-tailscale"};if(e==="#/prompts")return{page:"prompts"};if(e==="#/environments")return{page:"environments"};if(e==="#/sandboxes")return{page:"sandboxes"};if(e==="#/scheduled")return{page:"agents"};if(e==="#/runs")return{page:"runs"};if(e==="#/playground")return{page:"playground"};if(e.split("?")[0]==="#/agents")return{page:"agents"};if(e.startsWith(By)){const n=e.slice(By.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(Oy)){const n=e.slice(Oy.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function k4(e){return`#/session/${e}`}function Qg(e,t=!1){Wg();const n=k4(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function Kp(e=!1){Wg(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function j4(){const[e,t]=S.useState(""),[n,s]=S.useState(null),[a,c]=S.useState(!1),u=X(g=>g.setAuthToken),f=S.useCallback(async g=>{g.preventDefault();const v=e.trim();if(!v){s("Please enter a token");return}c(!0),s(null),await Ry(v)?u(v):s("Invalid token"),c(!1)},[e,u]);S.useEffect(()=>{w4().then(g=>{if(g){u(g);return}const y=new URLSearchParams(window.location.search).get("token");y&&(c(!0),Ry(y).then(b=>{if(b){u(y);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else s("Invalid token from URL"),c(!1)}))})},[u]);const[h,p]=S.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.jsx("input",{id:"auth-token",type:h?"text":"password",value:e,onChange:g=>{t(g.target.value),s(null)},placeholder:"Paste your token here",className:"w-full px-3 py-2 pr-16 text-sm bg-cc-hover border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono",autoComplete:"off",disabled:a}),l.jsx("button",{type:"button",onClick:()=>p(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer px-1.5 py-0.5 rounded hover:bg-cc-hover",tabIndex:-1,children:h?"Hide":"Show"})]})]}),n&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!e.trim(),className:"w-full py-2 px-4 text-sm font-medium bg-cc-primary text-white rounded-md hover:opacity-90 disabled:opacity-50 transition-opacity cursor-pointer disabled:cursor-not-allowed",children:a?"Verifying...":"Login"})]}),l.jsx("p",{className:"mt-6 text-[11px] text-cc-muted text-center leading-relaxed",children:"Scan the QR code in Settings with your phone camera to authenticate, or find your token in the server console."})]})})}var Dl=X_();function N4({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:s,archiveTransitionStateName:a,hasBacklogState:c,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:l.jsxs("div",{role:"dialog","aria-label":"Archive session",className:"mx-4 w-full max-w-sm bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:g=>g.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:f,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),n&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${c?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!c,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),s&&a&&l.jsxs("label",{className:"flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border hover:bg-cc-hover/50 transition-colors cursor-pointer",children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:f,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:()=>u(h,n||void 0),className:"px-3 py-1.5 text-xs font-medium rounded-md bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Archive"})]})]})}),document.body)}function C4(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function E4({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function T4({type:e}){return e==="codex"?l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-sky-500/15 text-sky-500 leading-none",children:"CX"}):l.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded bg-cc-success/15 text-cc-success leading-none",children:"CC"})}function Nd({session:e,isActive:t,isArchived:n,sessionName:s,permCount:a,isRecentlyRenamed:c,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:v,editingSessionId:y,editingName:b,setEditingName:_,onConfirmRename:j,onCancelRename:E,editInputRef:k}){const A=e.id.slice(0,8),C=s||e.model||A,L=y===e.id,[B,D]=S.useState(!1),U=S.useRef(null),F=S.useRef(null),Y=n?"exited":C4(e,a),O=e.cwd||"";S.useEffect(()=>{if(!B)return;function T(Q){var G;U.current&&!U.current.contains(Q.target)&&F.current&&!F.current.contains(Q.target)&&(D(!1),(G=F.current)==null||G.focus())}function le(Q){var G,$,z;if(Q.key==="Escape"){D(!1),(G=F.current)==null||G.focus();return}if(Q.key==="Tab"){D(!1);return}if((Q.key==="ArrowDown"||Q.key==="ArrowUp")&&(($=U.current)!=null&&$.contains(document.activeElement)||F.current===document.activeElement)){Q.preventDefault();const re=(z=U.current)==null?void 0:z.querySelectorAll("[role='menuitem']");if(!re||re.length===0)return;const me=document.activeElement,R=Array.from(re).indexOf(me);Q.key==="ArrowDown"?re[R<re.length-1?R+1:0].focus():re[R>0?R-1:re.length-1].focus()}}return document.addEventListener("mousedown",T),document.addEventListener("touchstart",T),document.addEventListener("keydown",le),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("touchstart",T),document.removeEventListener("keydown",le)}},[B]),S.useEffect(()=>{B&&requestAnimationFrame(()=>{var T,le;(le=(T=U.current)==null?void 0:T.querySelector("[role='menuitem']"))==null||le.focus()})},[B]);const I=S.useCallback(T=>{D(!1),T()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:T=>{T.preventDefault(),f(e.id,C)},onKeyDown:T=>{T.key==="F2"&&!L&&(T.preventDefault(),f(e.id,C))},className:`w-full flex items-center gap-2 py-2 pl-2.5 pr-12 min-h-[44px] rounded-lg transition-all duration-100 cursor-pointer relative ${t?"bg-cc-active":"hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-full transition-all duration-150 ${t?"h-5 bg-cc-primary":"h-0 bg-transparent"}`}),!L&&l.jsx(E4,{status:Y}),L?l.jsx("input",{ref:k,value:b,onChange:T=>_(T.target.value),onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),j()):T.key==="Escape"&&(T.preventDefault(),E()),T.stopPropagation()},onBlur:j,onClick:T=>T.stopPropagation(),onDoubleClick:T=>T.stopPropagation(),className:"text-[12.5px] font-medium flex-1 min-w-0 text-cc-fg bg-transparent border border-cc-border rounded-md px-2 py-1 outline-none focus:border-cc-primary/50 focus:ring-1 focus:ring-cc-primary/20"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${c?"animate-name-appear":""}`,onAnimationEnd:()=>v(e.id),children:C}),O&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:O})]}),!L&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(T4,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.jsx("path",{d:"M8 2a6 6 0 100 12A6 6 0 008 2zM0 8a8 8 0 1116 0A8 8 0 010 8zm9-3a1 1 0 10-2 0v3a1 1 0 00.293.707l2 2a1 1 0 001.414-1.414L9 7.586V5z"})})})]})]}),!n&&!L&&!B&&l.jsx("button",{onClick:T=>{T.stopPropagation(),h(T,e.id)},className:"absolute right-7 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-0 pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Archive","aria-label":"Archive session",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})})}),l.jsx("button",{ref:F,onClick:T=>{T.stopPropagation(),D(!B)},className:"absolute right-1 top-1/2 -translate-y-1/2 p-1 rounded-md opacity-100 pointer-events-auto sm:opacity-0 sm:pointer-events-none sm:group-hover:opacity-100 sm:group-hover:pointer-events-auto hover:bg-cc-border text-cc-muted hover:text-cc-fg transition-all cursor-pointer",title:"Session actions","aria-label":"Session actions","aria-haspopup":"true","aria-expanded":B,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),B&&l.jsxs("div",{ref:U,role:"menu","aria-label":"Session actions",className:"absolute right-0 top-full mt-1 w-40 py-1 bg-cc-card border border-cc-border/80 rounded-lg shadow-xl z-10 animate-[menu-appear_150ms_ease-out]",children:[!n&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>I(()=>f(e.id,C)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M12.146.854a.5.5 0 00-.707 0L3.714 8.579a.5.5 0 00-.138.242l-.777 3.11a.5.5 0 00.607.607l3.11-.777a.5.5 0 00.242-.138L14.573 3.854a.5.5 0 000-.708L12.146.854z"})}),"Rename"]}),n?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>p(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.jsx("path",{d:"M8 4a.5.5 0 01.5.5v3.793l1.854-1.853a.5.5 0 01.707.707l-2.828 2.828a.5.5 0 01-.707 0L4.697 7.147a.5.5 0 01.707-.707L7.5 8.293V4.5A.5.5 0 018 4z"}),l.jsx("path",{d:"M2 12.5A1.5 1.5 0 003.5 14h9a1.5 1.5 0 001.5-1.5v-2a.5.5 0 00-1 0v2a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2a.5.5 0 00-1 0v2z"})]}),"Restore"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>g(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-error hover:bg-cc-error/5 transition-colors cursor-pointer flex items-center gap-2",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]}),"Delete"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>h(T,e.id)),className:"w-full px-3 py-1.5 text-[12px] text-left text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.jsx("path",{d:"M2 4a1 1 0 011-1h10a1 1 0 011 1v1H2V4zm1 2h10v6a1 1 0 01-1 1H4a1 1 0 01-1-1V6zm3 2a.5.5 0 000 1h4a.5.5 0 000-1H6z"})}),"Archive"]})]})]})}function A4({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:s,sessionNames:a,pendingPermissions:c,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:j,onConfirmRename:E,onCancelRename:k,editInputRef:A,isFirst:C}){const L=t?e.sessions.slice(0,2).map(B=>a.get(B.id)||B.model||B.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:C?"":"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>n(e.key),"aria-expanded":!t,className:"w-full px-2 py-1 flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer group/header",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${t?"":"rotate-90"}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),l.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&L&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:L}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(B=>{var U;const D=((U=c.get(B.id))==null?void 0:U.size)??0;return l.jsx(Nd,{session:B,isActive:s===B.id,sessionName:a.get(B.id),permCount:D,isRecentlyRenamed:u.has(B.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:v,onClearRecentlyRenamed:y,editingSessionId:b,editingName:_,setEditingName:j,onConfirmRename:E,onCancelRename:k,editInputRef:A},B.id)})})]})}function M4(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function R4(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function z4(e){const t=new Map;for(const s of e){const a=M4(s.cwd,s.repoRoot||void 0,s.isContainerized),c=R4(a);t.has(a)||t.set(a,{key:a,label:c,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);u.sessions.push(s),s.status==="running"&&u.runningCount++,u.permCount+=s.permCount,u.mostRecentActivity=Math.max(u.mostRecentActivity,s.createdAt)}const n=Array.from(t.values()).sort((s,a)=>s.label.localeCompare(a.label));for(const s of n)s.sessions.sort((a,c)=>c.createdAt-a.createdAt);return n}const L4=[{label:"Documentation",url:"https://docs.thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811V2.828zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 000 2.5v11a.5.5 0 00.707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 00.78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0016 13.5v-11a.5.5 0 00-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z"},{label:"GitHub",url:"https://github.com/The-Vibe-Company/companion",viewBox:"0 0 16 16",iconPath:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"},{label:"Website",url:"https://thecompanion.sh",viewBox:"0 0 16 16",iconPath:"M0 8a8 8 0 1116 0A8 8 0 010 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 005.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 01.64-1.539 6.7 6.7 0 01.597-.933A7.025 7.025 0 002.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 00-.656 2.5h2.49zM4.847 5a12.5 12.5 0 00-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 00-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 00.337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 01-.597-.933A9.268 9.268 0 014.09 12H2.255a7.024 7.024 0 003.072 2.472zM3.82 11a13.652 13.652 0 01-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0013.745 12H11.91a9.27 9.27 0 01-.64 1.539 6.688 6.688 0 01-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 01-.312 2.5zm2.802-3.5a6.959 6.959 0 00-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 00-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 00-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"}],D4=[{id:"prompts",label:"Prompts",hash:"#/prompts",viewBox:"0 0 16 16",iconPath:"M3 2.5A1.5 1.5 0 014.5 1h5.879c.398 0 .779.158 1.06.44l1.621 1.62c.281.282.44.663.44 1.061V13.5A1.5 1.5 0 0112 15H4.5A1.5 1.5 0 013 13.5v-11zM4.5 2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5H12a.5.5 0 00.5-.5V4.121a.5.5 0 00-.146-.353l-1.621-1.621A.5.5 0 0010.379 2H4.5zm1.25 4.25a.75.75 0 01.75-.75h3a.75.75 0 010 1.5h-3a.75.75 0 01-.75-.75zm0 3a.75.75 0 01.75-.75h3.5a.75.75 0 010 1.5H6.5a.75.75 0 01-.75-.75z"},{id:"integrations",label:"Integrations",hash:"#/integrations",activePages:["integrations","integration-linear","integration-linear-oauth","integration-tailscale"],viewBox:"0 0 16 16",iconPath:"M2.5 3A1.5 1.5 0 001 4.5v2A1.5 1.5 0 002.5 8h2A1.5 1.5 0 006 6.5v-2A1.5 1.5 0 004.5 3h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zm9 0A1.5 1.5 0 0010 5.5v2A1.5 1.5 0 0011.5 9h2A1.5 1.5 0 0015 7.5v-2A1.5 1.5 0 0013.5 4h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM2.5 10A1.5 1.5 0 001 11.5v2A1.5 1.5 0 002.5 15h2A1.5 1.5 0 006 13.5v-2A1.5 1.5 0 004.5 10h-2zm0 1h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5zM8.5 12a.5.5 0 100 1h5a.5.5 0 100-1h-5zm0-2a.5.5 0 100 1h2a.5.5 0 100-1h-2z"},{id:"environments",label:"Environments",hash:"#/environments",viewBox:"0 0 16 16",iconPath:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z",activePages:["environments"]},{id:"sandboxes",label:"Sandboxes",hash:"#/sandboxes",viewBox:"0 0 16 16",iconPath:"M2 2a2 2 0 012-2h8a2 2 0 012 2v12a2 2 0 01-2 2H4a2 2 0 01-2-2V2zm2-.5a.5.5 0 00-.5.5v12a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V2a.5.5 0 00-.5-.5H4zM6 4.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zM6.5 7a.5.5 0 000 1h3a.5.5 0 000-1h-3z",activePages:["sandboxes"]},{id:"agents",label:"Agents",hash:"#/agents",activePages:["agents","agent-detail"],viewBox:"0 0 16 16",iconPath:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"},{id:"runs",label:"Runs",hash:"#/runs",viewBox:"0 0 16 16",iconPath:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"},{id:"settings",label:"Settings",hash:"#/settings",viewBox:"0 0 20 20",iconPath:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",fillRule:"evenodd",clipRule:"evenodd"}],O4=[{id:"workbench",label:"Workbench",itemIds:["prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],B4=new Map(D4.map(e=>[e.id,e]));function P4(){var Br,Pr;const[e,t]=S.useState(null),[n,s]=S.useState(""),[a,c]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[g,v]=S.useState(null),[y,b]=S.useState(!1),[_,j]=S.useState(null),[E,k]=S.useState(!1),[A,C]=S.useState(()=>typeof window<"u"?window.location.hash:""),L=S.useRef(null),B=S.useRef(null),D=X(te=>te.sessions),U=X(te=>te.sdkSessions),F=X(te=>te.currentSessionId),Y=X(te=>te.cliConnected),O=X(te=>te.cliReconnecting),I=X(te=>te.sessionStatus),T=X(te=>te.removeSession),le=X(te=>te.sessionNames),Q=X(te=>te.recentlyRenamed),G=X(te=>te.clearRecentlyRenamed),$=X(te=>te.pendingPermissions),z=X(te=>te.linkedLinearIssues),re=X(te=>te.collapsedProjects),me=X(te=>te.toggleProjectCollapse),R=Xg(A);S.useEffect(()=>{let te=!0;async function he(){try{const We=await ke.listSessions();if(te){const Dt=X.getState();Dt.setSdkSessions(We);const rn=X.getState(),Tn=new Set(We.map(Ot=>Ot.sessionId));for(const Ot of rn.sessions.keys())!Tn.has(Ot)&&rn.connectionStatus.get(Ot)!=="connected"&&rn.removeSession(Ot);YN(We);for(const Ot of We)if(Ot.name&&(!Dt.sessionNames.has(Ot.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Dt.sessionNames.get(Ot.sessionId)))){const Ln=Dt.sessionNames.get(Ot.sessionId),mr=!!Ln&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Ln);Ln!==Ot.name&&(Dt.setSessionName(Ot.sessionId,Ot.name),mr&&Dt.markRecentlyRenamed(Ot.sessionId))}}}catch{}}he();const ge=setInterval(he,5e3);return()=>{te=!1,clearInterval(ge)}},[]),S.useEffect(()=>{const te=()=>C(window.location.hash);return window.addEventListener("hashchange",te),()=>window.removeEventListener("hashchange",te)},[]);function P(te){Qg(te),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}function Z(){Kp(),X.getState().newSession(),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&L.current&&(L.current.focus(),L.current.select())},[e]);function M(){e&&n.trim()&&(X.getState().setSessionName(e,n.trim()),ke.renameSession(e,n.trim()).catch(()=>{})),t(null),s("")}function pe(){t(null),s("")}function _e(te,he){t(te),s(he)}const Ce=S.useCallback((te,he)=>{te.stopPropagation(),j(he)},[]),Ae=S.useCallback(async te=>{try{Cm(te),await ke.deleteSession(te)}catch{}X.getState().currentSessionId===te&&Kp(),T(te)},[T]),ze=S.useCallback(()=>{_&&(Ae(_),j(null))},[_,Ae]),De=S.useCallback(()=>{j(null)},[]),et=S.useCallback(()=>{k(!0)},[]),xe=S.useCallback(async()=>{k(!1);const te=X.getState(),he=new Set;for(const We of te.sessions.keys())he.add(We);for(const We of te.sdkSessions)he.add(We.sessionId);const ge=Array.from(he).filter(We=>{const Dt=te.sdkSessions.find(rn=>rn.sessionId===We);return(Dt==null?void 0:Dt.archived)??!1});for(const We of ge)await Ae(We)},[Ae]),Pe=S.useCallback(()=>{k(!1)},[]);S.useEffect(()=>{if(!_&&!E)return;requestAnimationFrame(()=>{var he,ge;(ge=(he=B.current)==null?void 0:he.querySelector("button"))==null||ge.focus()});function te(he){var rn;if(he.key==="Escape"){E?Pe():De();return}if(he.key!=="Tab")return;const ge=(rn=B.current)==null?void 0:rn.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ge||ge.length===0)return;const We=ge[0],Dt=ge[ge.length-1];he.shiftKey&&document.activeElement===We?(he.preventDefault(),Dt.focus()):!he.shiftKey&&document.activeElement===Dt&&(he.preventDefault(),We.focus())}return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[_,E,De,Pe]);const ft=S.useCallback(async(te,he)=>{te.stopPropagation();const ge=U.find(Ln=>Ln.sessionId===he),We=D.get(he),Dt=(We==null?void 0:We.is_containerized)||!!(ge!=null&&ge.containerId)||!1,rn=z.get(he),Tn=((rn==null?void 0:rn.stateType)||"").toLowerCase();if(rn&&!(Tn==="completed"||Tn==="canceled"||Tn==="cancelled"))try{const Ln=await ke.getArchiveInfo(he);if(Ln.issueNotDone){p(he),v(Ln),b(Dt);return}}catch{}if(Dt){f(he);return}zt(he)},[U,D,z]),zt=S.useCallback(async(te,he,ge)=>{try{Cm(te);const We={};he&&(We.force=!0),ge&&ge!=="none"&&(We.linearTransition=ge),await ke.archiveSession(te,Object.keys(We).length>0?We:void 0)}catch{}X.getState().currentSessionId===te&&(Kp(),X.getState().newSession());try{const We=await ke.listSessions();X.getState().setSdkSessions(We)}catch{}},[]),bt=S.useCallback(()=>{u&&(zt(u,!0),f(null))},[u,zt]),Lt=S.useCallback(()=>{f(null)},[]),dn=S.useCallback((te,he)=>{h&&(zt(h,he,te),p(null),v(null))},[h,zt]),st=S.useCallback(()=>{p(null),v(null)},[]),fn=S.useCallback(async(te,he)=>{te.stopPropagation();try{await ke.unarchiveSession(he)}catch{}try{const ge=await ke.listSessions();X.getState().setSdkSessions(ge)}catch{}},[]),_n=new Set;for(const te of D.keys())_n.add(te);for(const te of U)_n.add(te.sessionId);const je=Array.from(_n).map(te=>{var We;const he=D.get(te),ge=U.find(Dt=>Dt.sessionId===te);return{id:te,model:(he==null?void 0:he.model)||(ge==null?void 0:ge.model)||"",cwd:(he==null?void 0:he.cwd)||(ge==null?void 0:ge.cwd)||"",gitBranch:(he==null?void 0:he.git_branch)||(ge==null?void 0:ge.gitBranch)||"",isContainerized:(he==null?void 0:he.is_containerized)||!!(ge!=null&&ge.containerId)||!1,gitAhead:(he==null?void 0:he.git_ahead)||(ge==null?void 0:ge.gitAhead)||0,gitBehind:(he==null?void 0:he.git_behind)||(ge==null?void 0:ge.gitBehind)||0,linesAdded:(he==null?void 0:he.total_lines_added)||(ge==null?void 0:ge.totalLinesAdded)||0,linesRemoved:(he==null?void 0:he.total_lines_removed)||(ge==null?void 0:ge.totalLinesRemoved)||0,isConnected:Y.get(te)??!1,isReconnecting:O.get(te)??!1,status:I.get(te)??null,sdkState:(ge==null?void 0:ge.state)??null,createdAt:(ge==null?void 0:ge.createdAt)??0,archived:(ge==null?void 0:ge.archived)??!1,backendType:(he==null?void 0:he.backend_type)||(ge==null?void 0:ge.backendType)||"claude",repoRoot:(he==null?void 0:he.repo_root)||"",permCount:((We=$.get(te))==null?void 0:We.size)??0,cronJobId:(he==null?void 0:he.cronJobId)||(ge==null?void 0:ge.cronJobId),cronJobName:(he==null?void 0:he.cronJobName)||(ge==null?void 0:ge.cronJobName),agentId:(he==null?void 0:he.agentId)||(ge==null?void 0:ge.agentId),agentName:(he==null?void 0:he.agentName)||(ge==null?void 0:ge.agentName),userName:ge==null?void 0:ge.userName}}).sort((te,he)=>he.createdAt-te.createdAt),Oe=S.useMemo(()=>Array.from(new Set(je.map(te=>te.userName).filter(te=>!!te))).sort(),[je]),[yt,qe]=S.useState("__all__"),Or=te=>yt==="__all__"?!0:yt==="__none__"?!te.userName:te.userName===yt,ae=je.some(te=>!te.userName),ve=je.filter(Or),W=ve.filter(te=>!te.archived&&!te.cronJobId&&!te.agentId),fe=ve.filter(te=>!te.archived&&!!te.cronJobId),Te=ve.filter(te=>!te.archived&&!!te.agentId),Ye=ve.filter(te=>te.archived),tt=F?je.find(te=>te.id===F):null,nt=(tt==null?void 0:tt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[vt,hn]=S.useState(!0),[Ze,nr]=S.useState(!0),En=S.useMemo(()=>z4(W),[W]),Yr={onSelect:P,onStartRename:_e,onArchive:ft,onUnarchive:fn,onDelete:Ce,onClearRecentlyRenamed:G,editingSessionId:e,editingName:n,setEditingName:s,onConfirmRename:M,onCancelRename:pe,editInputRef:L};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:nt,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.jsx("span",{className:"text-[9px] font-medium uppercase tracking-[0.14em] rounded-full px-1.5 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20 leading-none","aria-label":"Moritz Edition fork",title:"Moritz Edition fork of the-companion",children:"ME"}),l.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"ml-auto hidden md:flex w-8 h-8 rounded-lg bg-cc-primary hover:bg-cc-primary-hover text-white items-center justify-center transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>X.getState().setSidebarOpen(!1),"aria-label":"Close sidebar",className:"md:hidden ml-auto w-8 h-8 rounded-lg flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.jsx("path",{d:"M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"})})})]})}),Oe.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:yt,onChange:te=>qe(te.target.value),"aria-label":"Filter sessions by user",className:"w-full px-2 py-1.5 text-[12px] bg-cc-card border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary cursor-pointer",children:[l.jsx("option",{value:"__all__",children:"All users"}),Oe.map(te=>l.jsx("option",{value:te,children:te},te)),ae&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.jsx("button",{onClick:Lt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:bt,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-error/10 text-cc-error hover:bg-cc-error/20 transition-colors cursor-pointer",children:"Archive"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:W.length===0&&fe.length===0&&Ye.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[En.map((te,he)=>l.jsx(A4,{group:te,isCollapsed:re.has(te.key),onToggleCollapse:me,currentSessionId:F,sessionNames:le,pendingPermissions:$,recentlyRenamed:Q,isFirst:he===0,...Yr},te.key)),fe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>hn(!vt),"aria-expanded":vt,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${vt?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",fe.length,")"]}),vt&&l.jsx("div",{className:"mt-0.5",children:fe.map(te=>{var he;return l.jsx(Nd,{session:te,isActive:F===te.id,sessionName:le.get(te.id),permCount:((he=$.get(te.id))==null?void 0:he.size)??0,isRecentlyRenamed:Q.has(te.id),...Yr},te.id)})})]}),Te.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>nr(!Ze),"aria-expanded":Ze,className:"w-full px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${Ze?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Te.length,")"]}),Ze&&l.jsx("div",{className:"mt-0.5",children:Te.map(te=>{var he;return l.jsx(Nd,{session:te,isActive:F===te.id,sessionName:le.get(te.id),permCount:((he=$.get(te.id))==null?void 0:he.size)??0,isRecentlyRenamed:Q.has(te.id),...Yr},te.id)})})]}),Ye.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>c(!a),"aria-expanded":a,className:"flex-1 px-2 py-1 text-[11px] font-semibold text-cc-fg/60 uppercase tracking-wide flex items-center gap-1.5 hover:bg-cc-hover rounded-md transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Ye.length,")"]}),a&&Ye.length>1&&l.jsx("button",{onClick:et,className:"px-2 py-0.5 mr-1 text-[10px] text-cc-error/80 hover:text-cc-error hover:bg-cc-error/5 rounded-md transition-colors cursor-pointer",title:"Delete all archived sessions",children:"Delete all"})]}),a&&l.jsx("div",{className:"mt-0.5",children:Ye.map(te=>{var he;return l.jsx(Nd,{session:te,isActive:F===te.id,isArchived:!0,sessionName:le.get(te.id),permCount:((he=$.get(te.id))==null?void 0:he.size)??0,isRecentlyRenamed:Q.has(te.id),...Yr},te.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.jsx("button",{onClick:Z,title:"New Session","aria-label":"New Session",className:"w-12 h-12 rounded-full bg-cc-primary hover:bg-cc-primary-hover text-white flex items-center justify-center shadow-lg transition-colors duration-150 cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:O4.map(te=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:te.label}),l.jsx("div",{className:"flex flex-col",children:te.itemIds.map(he=>{const ge=B4.get(he);if(!ge)return null;const We=ge.activePages?ge.activePages.some(Dt=>R.page===Dt):R.page===ge.id;return l.jsxs("button",{onClick:()=>{window.location.hash=ge.hash,window.innerWidth<768&&X.getState().setSidebarOpen(!1)},title:ge.label,"aria-current":We?"page":void 0,className:`group flex min-h-[44px] md:min-h-[34px] w-full items-center gap-2 rounded-md px-2 py-1 md:py-0.5 text-left transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cc-primary/60 ${We?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${We?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:ge.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:ge.iconPath,fillRule:ge.fillRule,clipRule:ge.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ge.label})]},ge.id)})})]},te.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:L4.map(te=>l.jsx("a",{href:te.url,target:"_blank",rel:"noopener noreferrer",title:te.label,"aria-label":`Open ${te.label.toLowerCase()}`,className:"w-9 h-9 md:w-7 md:h-7 rounded-md flex items-center justify-center text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:l.jsx("svg",{viewBox:te.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:te.iconPath})})},te.label))})]})})]}),(_||E)&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm animate-[fadeIn_150ms_ease-out]",onClick:E?Pe:De,children:l.jsxs("div",{ref:B,role:"alertdialog","aria-modal":"true","aria-labelledby":"delete-dialog-title","aria-describedby":"delete-dialog-desc",className:"mx-4 w-full max-w-[280px] bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5 animate-[menu-appear_150ms_ease-out]",onClick:te=>te.stopPropagation(),children:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.jsx("path",{d:"M5.5 5.5A.5.5 0 016 6v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm2.5 0a.5.5 0 01.5.5v6a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zm3 .5a.5.5 0 00-1 0v6a.5.5 0 001 0V6z"}),l.jsx("path",{fillRule:"evenodd",d:"M14.5 3a1 1 0 01-1 1H13v9a2 2 0 01-2 2H5a2 2 0 01-2-2V4h-.5a1 1 0 010-2H6a1 1 0 011-1h2a1 1 0 011 1h3.5a1 1 0 011 1zM4.118 4L4 4.059V13a1 1 0 001 1h6a1 1 0 001-1V4.059L11.882 4H4.118zM6 2h4v1H6V2z",clipRule:"evenodd"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:E?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:E?`This will permanently delete ${Ye.length} archived session${Ye.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:E?Pe:De,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:E?xe:ze,className:"flex-1 px-3 py-2 text-[12px] font-medium rounded-lg bg-cc-error/15 text-cc-error hover:bg-cc-error/25 transition-colors cursor-pointer",children:E?"Delete all":"Delete"})]})]})}),h&&g&&l.jsx(N4,{issueIdentifier:((Br=g.issue)==null?void 0:Br.identifier)||"",issueStateName:((Pr=g.issue)==null?void 0:Pr.stateName)||"",isContainerized:y,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:dn,onCancel:st})]})}function $4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,F4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,H4={};function $y(e,t){return(H4.jsx?F4:U4).test(e)}const I4=/[ \t\n\f\r]/g;function q4(e){return typeof e=="object"?e.type==="text"?Uy(e.value):!1:Uy(e)}function Uy(e){return e.replace(I4,"")===""}class Mc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Mc.prototype.normal={};Mc.prototype.property={};Mc.prototype.space=void 0;function Pw(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Mc(n,s,t)}function mg(e){return e.toLowerCase()}class tr{constructor(t,n){this.attribute=n,this.property=t}}tr.prototype.attribute="";tr.prototype.booleanish=!1;tr.prototype.boolean=!1;tr.prototype.commaOrSpaceSeparated=!1;tr.prototype.commaSeparated=!1;tr.prototype.defined=!1;tr.prototype.mustUseProperty=!1;tr.prototype.number=!1;tr.prototype.overloadedBoolean=!1;tr.prototype.property="";tr.prototype.spaceSeparated=!1;tr.prototype.space=void 0;let V4=0;const Ve=_a(),cn=_a(),gg=_a(),be=_a(),Tt=_a(),xa=_a(),dr=_a();function _a(){return 2**++V4}const xg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:cn,commaOrSpaceSeparated:dr,commaSeparated:xa,number:be,overloadedBoolean:gg,spaceSeparated:Tt},Symbol.toStringTag,{value:"Module"})),Zp=Object.keys(xg);class Kg extends tr{constructor(t,n,s,a){let c=-1;if(super(t,n),Fy(this,"space",a),typeof s=="number")for(;++c<Zp.length;){const u=Zp[c];Fy(this,Zp[c],(s&xg[u])===xg[u])}}}Kg.prototype.defined=!0;function Fy(e,t,n){n&&(e[t]=n)}function Ol(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const c=new Kg(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),t[s]=c,n[mg(s)]=s,n[mg(c.attribute)]=s}return new Mc(t,n,e.space)}const $w=Ol({properties:{ariaActiveDescendant:null,ariaAtomic:cn,ariaAutoComplete:null,ariaBusy:cn,ariaChecked:cn,ariaColCount:be,ariaColIndex:be,ariaColSpan:be,ariaControls:Tt,ariaCurrent:null,ariaDescribedBy:Tt,ariaDetails:null,ariaDisabled:cn,ariaDropEffect:Tt,ariaErrorMessage:null,ariaExpanded:cn,ariaFlowTo:Tt,ariaGrabbed:cn,ariaHasPopup:null,ariaHidden:cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Tt,ariaLevel:be,ariaLive:null,ariaModal:cn,ariaMultiLine:cn,ariaMultiSelectable:cn,ariaOrientation:null,ariaOwns:Tt,ariaPlaceholder:null,ariaPosInSet:be,ariaPressed:cn,ariaReadOnly:cn,ariaRelevant:null,ariaRequired:cn,ariaRoleDescription:Tt,ariaRowCount:be,ariaRowIndex:be,ariaRowSpan:be,ariaSelected:cn,ariaSetSize:be,ariaSort:null,ariaValueMax:be,ariaValueMin:be,ariaValueNow:be,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Uw(e,t){return t in e?e[t]:t}function Fw(e,t){return Uw(e,t.toLowerCase())}const G4=Ol({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:Tt,accessKey:Tt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alpha:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:Tt,autoFocus:Ve,autoPlay:Ve,blocking:Tt,capture:null,charSet:null,checked:Ve,cite:null,className:Tt,closedBy:null,colorSpace:null,cols:be,colSpan:be,command:null,commandFor:null,content:null,contentEditable:cn,controls:Ve,controlsList:Tt,coords:be|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:gg,draggable:cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:Tt,height:be,hidden:gg,high:be,href:null,hrefLang:null,htmlFor:Tt,httpEquiv:Tt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:Tt,itemRef:Tt,itemScope:Ve,itemType:Tt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:be,manifest:null,max:null,maxLength:be,media:null,method:null,min:null,minLength:be,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ve,optimum:be,pattern:null,ping:Tt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:Tt,required:Ve,reversed:Ve,rows:be,rowSpan:be,sandbox:Tt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootCustomElementRegistry:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shadowRootSerializable:Ve,shape:null,size:be,sizes:null,slot:null,span:be,spellCheck:cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:be,step:null,style:null,tabIndex:be,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:cn,width:be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Tt,axis:null,background:null,bgColor:null,border:be,borderColor:null,bottomMargin:be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:be,leftMargin:be,link:null,longDesc:null,lowSrc:null,marginHeight:be,marginWidth:be,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:be,rules:null,scheme:null,scrolling:cn,standby:null,summary:null,text:null,topMargin:be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:be,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ve,disablePictureInPicture:Ve,disableRemotePlayback:Ve,exportParts:xa,part:Tt,prefix:null,property:null,results:be,security:null,unselectable:null},space:"html",transform:Fw}),Y4=Ol({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:dr,accentHeight:be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:be,amplitude:be,arabicForm:null,ascent:be,attributeName:null,attributeType:null,azimuth:be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:be,by:null,calcMode:null,capHeight:be,className:Tt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:be,diffuseConstant:be,direction:null,display:null,dur:null,divisor:be,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:be,enableBackground:null,end:null,event:null,exponent:be,externalResourcesRequired:null,fill:null,fillOpacity:be,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xa,g2:xa,glyphName:xa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:be,horizOriginX:be,horizOriginY:be,id:null,ideographic:be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:be,k:be,k1:be,k2:be,k3:be,k4:be,kernelMatrix:dr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:be,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:be,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:be,overlineThickness:be,paintOrder:null,panose1:null,path:null,pathLength:be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Tt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:be,pointsAtY:be,pointsAtZ:be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:dr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:dr,rev:dr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:dr,requiredFeatures:dr,requiredFonts:dr,requiredFormats:dr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:be,specularExponent:be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:be,strikethroughThickness:be,string:null,stroke:null,strokeDashArray:dr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:be,strokeOpacity:be,strokeWidth:null,style:null,surfaceScale:be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:dr,tabIndex:be,tableValues:null,target:null,targetX:be,targetY:be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:dr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:be,underlineThickness:be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:be,values:null,vAlphabetic:be,vMathematical:be,vectorEffect:null,vHanging:be,vIdeographic:be,version:null,vertAdvY:be,vertOriginX:be,vertOriginY:be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Uw}),Hw=Ol({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Iw=Ol({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fw}),qw=Ol({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),W4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},X4=/[A-Z]/g,Hy=/-[a-z]/g,Q4=/^data[-\w.:]+$/i;function K4(e,t){const n=mg(t);let s=t,a=tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Q4.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Hy,J4);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Hy.test(c)){let u=c.replace(X4,Z4);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=Kg}return new a(s,t)}function Z4(e){return"-"+e.toLowerCase()}function J4(e){return e.charAt(1).toUpperCase()}const eE=Pw([$w,G4,Hw,Iw,qw],"html"),Zg=Pw([$w,Y4,Hw,Iw,qw],"svg");function tE(e){return e.join(" ").trim()}var ml={},Jp,Iy;function nE(){if(Iy)return Jp;Iy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
68
68
|
`,p="/",g="*",v="",y="comment",b="declaration";function _(E,k){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];k=k||{};var A=1,C=1;function L(Q){var G=Q.match(t);G&&(A+=G.length);var $=Q.lastIndexOf(h);C=~$?Q.length-$:C+Q.length}function B(){var Q={line:A,column:C};return function(G){return G.position=new D(Q),Y(),G}}function D(Q){this.start=Q,this.end={line:A,column:C},this.source=k.source}D.prototype.content=E;function U(Q){var G=new Error(k.source+":"+A+":"+C+": "+Q);if(G.reason=Q,G.filename=k.source,G.line=A,G.column=C,G.source=E,!k.silent)throw G}function F(Q){var G=Q.exec(E);if(G){var $=G[0];return L($),E=E.slice($.length),G}}function Y(){F(n)}function O(Q){var G;for(Q=Q||[];G=I();)G!==!1&&Q.push(G);return Q}function I(){var Q=B();if(!(p!=E.charAt(0)||g!=E.charAt(1))){for(var G=2;v!=E.charAt(G)&&(g!=E.charAt(G)||p!=E.charAt(G+1));)++G;if(G+=2,v===E.charAt(G-1))return U("End of comment missing");var $=E.slice(2,G-2);return C+=2,L($),E=E.slice(G),C+=2,Q({type:y,comment:$})}}function T(){var Q=B(),G=F(s);if(G){if(I(),!F(a))return U("property missing ':'");var $=F(c),z=Q({type:b,property:j(G[0].replace(e,v)),value:$?j($[0].replace(e,v)):v});return F(u),z}}function le(){var Q=[];O(Q);for(var G;G=T();)G!==!1&&(Q.push(G),O(Q));return Q}return Y(),le()}function j(E){return E?E.replace(f,v):v}return Jp=_,Jp}var qy;function rE(){if(qy)return ml;qy=1;var e=ml&&ml.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ml,"__esModule",{value:!0}),ml.default=n;const t=e(nE());function n(s,a){let c=null;if(!s||typeof s!="string")return c;const u=(0,t.default)(s),f=typeof a=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:g}=h;f?a(p,g,h):g&&(c=c||{},c[p]=g)}),c}return ml}var Go={},Vy;function sE(){if(Vy)return Go;Vy=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,c=function(p){return!p||n.test(p)||e.test(p)},u=function(p,g){return g.toUpperCase()},f=function(p,g){return"".concat(g,"-")},h=function(p,g){return g===void 0&&(g={}),c(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(a,f):p=p.replace(s,f),p.replace(t,u))};return Go.camelCase=h,Go}var Yo,Gy;function iE(){if(Gy)return Yo;Gy=1;var e=Yo&&Yo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(rE()),n=sE();function s(a,c){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(f,h){f&&h&&(u[(0,n.camelCase)(f,c)]=h)}),u}return s.default=s,Yo=s,Yo}var aE=iE();const lE=Tg(aE),Vw=Gw("end"),Jg=Gw("start");function Gw(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function oE(e){const t=Jg(e),n=Vw(e);if(t&&n)return{start:t,end:n}}function dc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Yy(e.position):"start"in e||"end"in e?Yy(e):"line"in e||"column"in e?vg(e):""}function vg(e){return Wy(e&&e.line)+":"+Wy(e&&e.column)}function Yy(e){return vg(e&&e.start)+"-"+vg(e&&e.end)}function Wy(e){return e&&typeof e=="number"?e:1}class zn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?a=t:!c.cause&&t&&(u=!0,a=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof s=="string"){const h=s.indexOf(":");h===-1?c.ruleId=s:(c.source=s.slice(0,h),c.ruleId=s.slice(h+1))}if(!c.place&&c.ancestors&&c.ancestors){const h=c.ancestors[c.ancestors.length-1];h&&(c.place=h.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=dc(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}zn.prototype.file="";zn.prototype.name="";zn.prototype.reason="";zn.prototype.message="";zn.prototype.stack="";zn.prototype.column=void 0;zn.prototype.line=void 0;zn.prototype.ancestors=void 0;zn.prototype.cause=void 0;zn.prototype.fatal=void 0;zn.prototype.place=void 0;zn.prototype.ruleId=void 0;zn.prototype.source=void 0;const ex={}.hasOwnProperty,cE=new Map,uE=/[A-Z]/g,dE=new Set(["table","tbody","thead","tfoot","tr"]),fE=new Set(["td","th"]),Yw="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hE(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=_E(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=yE(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Zg:eE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Ww(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function Ww(e,t,n){if(t.type==="element")return pE(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return mE(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return xE(e,t,n);if(t.type==="mdxjsEsm")return gE(e,t);if(t.type==="root")return vE(e,t,n);if(t.type==="text")return bE(e,t)}function pE(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Zg,e.schema=a),e.ancestors.push(t);const c=Qw(e,t.tagName,!1),u=wE(e,t);let f=nx(e,t);return dE.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!q4(h):!0})),Xw(e,u,c,t),tx(u,f),e.ancestors.pop(),e.schema=s,e.create(t,c,u,n)}function mE(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Nc(e,t.position)}function gE(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Nc(e,t.position)}function xE(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Zg,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:Qw(e,t.name,!0),u=SE(e,t),f=nx(e,t);return Xw(e,u,c,t),tx(u,f),e.ancestors.pop(),e.schema=s,e.create(t,c,u,n)}function vE(e,t,n){const s={};return tx(s,nx(e,t)),e.create(t,e.Fragment,s,n)}function bE(e,t){return t.value}function Xw(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function tx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function yE(e,t,n){return s;function s(a,c,u,f){const p=Array.isArray(u.children)?n:t;return f?p(c,u,f):p(c,u)}}function _E(e,t){return n;function n(s,a,c,u){const f=Array.isArray(c.children),h=Jg(s);return t(a,c,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function wE(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&ex.call(t.properties,a)){const c=kE(e,a,t.properties[a]);if(c){const[u,f]=c;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&fE.has(t.tagName)?s=f:n[u]=f}}if(s){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function SE(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const c=s.data.estree.body[0];c.type;const u=c.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else Nc(e,t.position);else{const a=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else Nc(e,t.position);else c=s.value===null?!0:s.value;n[a]=c}return n}function nx(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:cE;for(;++s<t.children.length;){const c=t.children[s];let u;if(e.passKeys){const h=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(h){const p=a.get(h)||0;u=h+"-"+p,a.set(h,p+1)}}const f=Ww(e,c,u);f!==void 0&&n.push(f)}return n}function kE(e,t,n){const s=K4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?$4(n):tE(n)),s.property==="style"){let a=typeof n=="object"?n:jE(e,String(n));return e.stylePropertyNameCase==="css"&&(a=NE(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?W4[s.property]||s.property:s.attribute,n]}}function jE(e,t){try{return lE(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new zn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Yw+"#cannot-parse-style-attribute",a}}function Qw(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let c=-1,u;for(;++c<a.length;){const f=$y(a[c])?{type:"Identifier",name:a[c]}:{type:"Literal",value:a[c]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}s=u}else s=$y(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return ex.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);Nc(e)}function Nc(e,t){const n=new zn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Yw+"#cannot-handle-mdx-estrees-without-createevaluater",n}function NE(e){const t={};let n;for(n in e)ex.call(e,n)&&(t[CE(n)]=e[n]);return t}function CE(e){let t=e.replace(uE,EE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function EE(e){return"-"+e.toLowerCase()}const em={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},TE={};function rx(e,t){const n=TE,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Kw(e,s,a)}function Kw(e,t,n){if(AE(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Xy(e.children,t,n)}return Array.isArray(e)?Xy(e,t,n):""}function Xy(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=Kw(e[a],t,n);return s.join("")}function AE(e){return!!(e&&typeof e=="object")}const Qy=document.createElement("i");function sx(e){const t="&"+e+";";Qy.innerHTML=t;const n=Qy.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function pr(e,t,n,s){const a=e.length;let c=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)u=Array.from(s),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);c<s.length;)u=s.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function Lr(e,t){return e.length>0?(pr(e,e.length,0,t),e):t}const Ky={}.hasOwnProperty;function Zw(e){const t={};let n=-1;for(;++n<e.length;)ME(t,e[n]);return t}function ME(e,t){let n;for(n in t){const a=(Ky.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){Ky.call(a,u)||(a[u]=[]);const f=c[u];RE(a[u],Array.isArray(f)?f:f?[f]:[])}}}function RE(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);pr(e,0,0,s)}function Jw(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Gr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $n=Ri(/[A-Za-z]/),Rn=Ri(/[\dA-Za-z]/),zE=Ri(/[#-'*+\--9=?A-Z^-~]/);function Zd(e){return e!==null&&(e<32||e===127)}const bg=Ri(/\d/),LE=Ri(/[\dA-Fa-f]/),DE=Ri(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}function Rt(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const cf=Ri(new RegExp("\\p{P}|\\p{S}","u")),ya=Ri(/\s/);function Ri(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Bl(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&Rn(e.charCodeAt(n+1))&&Rn(e.charCodeAt(n+2)))a=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(n+1);c<56320&&f>56319&&f<57344?(u=String.fromCharCode(c,f),a=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(s,n),encodeURIComponent(u)),s=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function pt(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(h){return ot(h)?(e.enter(n),f(h)):t(h)}function f(h){return ot(h)&&c++<a?(e.consume(h),f):(e.exit(n),t(h))}}const OE={tokenize:BE};function BE(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),pt(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),c(f)}function c(f){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return $e(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),u)}}const PE={tokenize:$E},Zy={tokenize:UE};function $E(e){const t=this,n=[];let s=0,a,c,u;return f;function f(C){if(s<n.length){const L=n[s];return t.containerState=L[1],e.attempt(L[0].continuation,h,p)(C)}return p(C)}function h(C){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&A();const L=t.events.length;let B=L,D;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){D=t.events[B][1].end;break}k(s);let U=L;for(;U<t.events.length;)t.events[U][1].end={...D},U++;return pr(t.events,B+1,0,t.events.slice(L)),t.events.length=U,p(C)}return f(C)}function p(C){if(s===n.length){if(!a)return y(C);if(a.currentConstruct&&a.currentConstruct.concrete)return _(C);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Zy,g,v)(C)}function g(C){return a&&A(),k(s),y(C)}function v(C){return t.parser.lazy[t.now().line]=s!==n.length,u=t.now().offset,_(C)}function y(C){return t.containerState={},e.attempt(Zy,b,_)(C)}function b(C){return s++,n.push([t.currentConstruct,t.containerState]),y(C)}function _(C){if(C===null){a&&A(),k(0),e.consume(C);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),j(C)}function j(C){if(C===null){E(e.exit("chunkFlow"),!0),k(0),e.consume(C);return}return $e(C)?(e.consume(C),E(e.exit("chunkFlow")),s=0,t.interrupt=void 0,f):(e.consume(C),j)}function E(C,L){const B=t.sliceStream(C);if(L&&B.push(null),C.previous=c,c&&(c.next=C),c=C,a.defineSkip(C.start),a.write(B),t.parser.lazy[C.start.line]){let D=a.events.length;for(;D--;)if(a.events[D][1].start.offset<u&&(!a.events[D][1].end||a.events[D][1].end.offset>u))return;const U=t.events.length;let F=U,Y,O;for(;F--;)if(t.events[F][0]==="exit"&&t.events[F][1].type==="chunkFlow"){if(Y){O=t.events[F][1].end;break}Y=!0}for(k(s),D=U;D<t.events.length;)t.events[D][1].end={...O},D++;pr(t.events,F+1,0,t.events.slice(U)),t.events.length=D}}function k(C){let L=n.length;for(;L-- >C;){const B=n[L];t.containerState=B[1],B[0].exit.call(t,e)}n.length=C}function A(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function UE(e,t,n){return pt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rl(e){if(e===null||Rt(e)||ya(e))return 1;if(cf(e))return 2}function uf(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const c=e[a].resolveAll;c&&!s.includes(c)&&(t=c(t,n),s.push(c))}return t}const yg={name:"attention",resolveAll:FE,tokenize:HE};function FE(e,t){let n=-1,s,a,c,u,f,h,p,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[s][1].end},y={...e[n][1].start};Jy(v,-h),Jy(y,h),u={type:h>1?"strongSequence":"emphasisSequence",start:v,end:{...e[s][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},c={type:h>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[s][1].end={...u.start},e[n][1].start={...f.end},p=[],e[s][1].end.offset-e[s][1].start.offset&&(p=Lr(p,[["enter",e[s][1],t],["exit",e[s][1],t]])),p=Lr(p,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",c,t]]),p=Lr(p,uf(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),p=Lr(p,[["exit",c,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=Lr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,pr(e,s-1,n-s+3,p),n=s+p.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HE(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Rl(s);let c;return u;function u(h){return c=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===c)return e.consume(h),f;const p=e.exit("attentionSequence"),g=Rl(h),v=!g||g===2&&a||n.includes(h),y=!a||a===2&&g||n.includes(s);return p._open=!!(c===42?v:v&&(a||!y)),p._close=!!(c===42?y:y&&(g||!v)),t(h)}}function Jy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const IE={name:"autolink",tokenize:qE};function qE(e,t,n){let s=0;return a;function a(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return $n(b)?(e.consume(b),u):b===64?n(b):p(b)}function u(b){return b===43||b===45||b===46||Rn(b)?(s=1,f(b)):p(b)}function f(b){return b===58?(e.consume(b),s=0,h):(b===43||b===45||b===46||Rn(b))&&s++<32?(e.consume(b),f):(s=0,p(b))}function h(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Zd(b)?n(b):(e.consume(b),h)}function p(b){return b===64?(e.consume(b),g):zE(b)?(e.consume(b),p):n(b)}function g(b){return Rn(b)?v(b):n(b)}function v(b){return b===46?(e.consume(b),s=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Rn(b))&&s++<63){const _=b===45?y:v;return e.consume(b),_}return n(b)}}const Rc={partial:!0,tokenize:VE};function VE(e,t,n){return s;function s(c){return ot(c)?pt(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||$e(c)?t(c):n(c)}}const e2={continuation:{tokenize:YE},exit:WE,name:"blockQuote",tokenize:GE};function GE(e,t,n){const s=this;return a;function a(u){if(u===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return n(u)}function c(u){return ot(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function YE(e,t,n){const s=this;return a;function a(u){return ot(u)?pt(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(e2,t,n)(u)}}function WE(e){e.exit("blockQuote")}const t2={name:"characterEscape",tokenize:XE};function XE(e,t,n){return s;function s(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),a}function a(c){return DE(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const n2={name:"characterReference",tokenize:QE};function QE(e,t,n){const s=this;let a=0,c,u;return f;function f(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),h}function h(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,u=Rn,g(v))}function p(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=LE,g):(e.enter("characterReferenceValue"),c=7,u=bg,g(v))}function g(v){if(v===59&&a){const y=e.exit("characterReferenceValue");return u===Rn&&!sx(s.sliceSerialize(y))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&a++<c?(e.consume(v),g):n(v)}}const e_={partial:!0,tokenize:ZE},t_={concrete:!0,name:"codeFenced",tokenize:KE};function KE(e,t,n){const s=this,a={partial:!0,tokenize:B};let c=0,u=0,f;return h;function h(D){return p(D)}function p(D){const U=s.events[s.events.length-1];return c=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,f=D,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(D)}function g(D){return D===f?(u++,e.consume(D),g):u<3?n(D):(e.exit("codeFencedFenceSequence"),ot(D)?pt(e,v,"whitespace")(D):v(D))}function v(D){return D===null||$e(D)?(e.exit("codeFencedFence"),s.interrupt?t(D):e.check(e_,j,L)(D)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(D))}function y(D){return D===null||$e(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(D)):ot(D)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),pt(e,b,"whitespace")(D)):D===96&&D===f?n(D):(e.consume(D),y)}function b(D){return D===null||$e(D)?v(D):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(D))}function _(D){return D===null||$e(D)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(D)):D===96&&D===f?n(D):(e.consume(D),_)}function j(D){return e.attempt(a,L,E)(D)}function E(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),k}function k(D){return c>0&&ot(D)?pt(e,A,"linePrefix",c+1)(D):A(D)}function A(D){return D===null||$e(D)?e.check(e_,j,L)(D):(e.enter("codeFlowValue"),C(D))}function C(D){return D===null||$e(D)?(e.exit("codeFlowValue"),A(D)):(e.consume(D),C)}function L(D){return e.exit("codeFenced"),t(D)}function B(D,U,F){let Y=0;return O;function O(G){return D.enter("lineEnding"),D.consume(G),D.exit("lineEnding"),I}function I(G){return D.enter("codeFencedFence"),ot(G)?pt(D,T,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):T(G)}function T(G){return G===f?(D.enter("codeFencedFenceSequence"),le(G)):F(G)}function le(G){return G===f?(Y++,D.consume(G),le):Y>=u?(D.exit("codeFencedFenceSequence"),ot(G)?pt(D,Q,"whitespace")(G):Q(G)):F(G)}function Q(G){return G===null||$e(G)?(D.exit("codeFencedFence"),U(G)):F(G)}}}function ZE(e,t,n){const s=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return s.parser.lazy[s.now().line]?n(u):t(u)}}const tm={name:"codeIndented",tokenize:e6},JE={partial:!0,tokenize:t6};function e6(e,t,n){const s=this;return a;function a(p){return e.enter("codeIndented"),pt(e,c,"linePrefix",5)(p)}function c(p){const g=s.events[s.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(p):n(p)}function u(p){return p===null?h(p):$e(p)?e.attempt(JE,u,h)(p):(e.enter("codeFlowValue"),f(p))}function f(p){return p===null||$e(p)?(e.exit("codeFlowValue"),u(p)):(e.consume(p),f)}function h(p){return e.exit("codeIndented"),t(p)}}function t6(e,t,n){const s=this;return a;function a(u){return s.parser.lazy[s.now().line]?n(u):$e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):pt(e,c,"linePrefix",5)(u)}function c(u){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):$e(u)?a(u):n(u)}}const n6={name:"codeText",previous:s6,resolve:r6,tokenize:i6};function r6(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function s6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function i6(e,t,n){let s=0,a,c;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),f(v)}function f(v){return v===96?(e.consume(v),s++,f):(e.exit("codeTextSequence"),h(v))}function h(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),h):v===96?(c=e.enter("codeTextSequence"),a=0,g(v)):$e(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(v))}function p(v){return v===null||v===32||v===96||$e(v)?(e.exit("codeTextData"),h(v)):(e.consume(v),p)}function g(v){return v===96?(e.consume(v),a++,g):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(c.type="codeTextData",p(v))}}class a6{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Wo(this.left,s),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Wo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Wo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Wo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Wo(this.left,n.reverse())}}}function Wo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function r2(e){const t={};let n=-1,s,a,c,u,f,h,p;const g=new a6(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(s=g.get(n),n&&s[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(h=s[1]._tokenizer.events,c=0,c<h.length&&h[c][1].type==="lineEndingBlank"&&(c+=2),c<h.length&&h[c][1].type==="content"))for(;++c<h.length&&h[c][1].type!=="content";)h[c][1].type==="chunkText"&&(h[c][1]._isInFirstContentOfListItem=!0,c++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,l6(g,n)),n=t[n],p=!0);else if(s[1]._container){for(c=n,a=void 0;c--;)if(u=g.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(s[1].end={...g.get(a)[1].start},f=g.slice(a,n),f.unshift(s),g.splice(a,n-a+1,f))}}return pr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function l6(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const c=[];let u=n._tokenizer;u||(u=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,h=[],p={};let g,v,y=-1,b=n,_=0,j=0;const E=[j];for(;b;){for(;e.get(++a)[1]!==b;);c.push(a),b._tokenizer||(g=s.sliceStream(b),b.next||g.push(null),v&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=b,b=b.next}for(b=n;++y<f.length;)f[y][0]==="exit"&&f[y-1][0]==="enter"&&f[y][1].type===f[y-1][1].type&&f[y][1].start.line!==f[y][1].end.line&&(j=y+1,E.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):E.pop(),y=E.length;y--;){const k=f.slice(E[y],E[y+1]),A=c.pop();h.push([A,A+k.length-1]),e.splice(A,2,k)}for(h.reverse(),y=-1;++y<h.length;)p[_+h[y][0]]=_+h[y][1],_+=h[y][1]-h[y][0]-1;return p}const o6={resolve:u6,tokenize:d6},c6={partial:!0,tokenize:f6};function u6(e){return r2(e),e}function d6(e,t){let n;return s;function s(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?c(f):$e(f)?e.check(c6,u,c)(f):(e.consume(f),a)}function c(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function f6(e,t,n){const s=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),pt(e,c,"linePrefix")}function c(u){if(u===null||$e(u))return n(u);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(s.parser.constructs.flow,n,t)(u)}}function s2(e,t,n,s,a,c,u,f,h){const p=h||Number.POSITIVE_INFINITY;let g=0;return v;function v(k){return k===60?(e.enter(s),e.enter(a),e.enter(c),e.consume(k),e.exit(c),y):k===null||k===32||k===41||Zd(k)?n(k):(e.enter(s),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(k))}function y(k){return k===62?(e.enter(c),e.consume(k),e.exit(c),e.exit(a),e.exit(s),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(f),y(k)):k===null||k===60||$e(k)?n(k):(e.consume(k),k===92?_:b)}function _(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!g&&(k===null||k===41||Rt(k))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(s),t(k)):g<p&&k===40?(e.consume(k),g++,j):k===41?(e.consume(k),g--,j):k===null||k===32||k===40||Zd(k)?n(k):(e.consume(k),k===92?E:j)}function E(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function i2(e,t,n,s,a,c){const u=this;let f=0,h;return p;function p(b){return e.enter(s),e.enter(a),e.consume(b),e.exit(a),e.enter(c),g}function g(b){return f>999||b===null||b===91||b===93&&!h||b===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(c),e.enter(a),e.consume(b),e.exit(a),e.exit(s),t):$e(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===null||b===91||b===93||$e(b)||f++>999?(e.exit("chunkString"),g(b)):(e.consume(b),h||(h=!ot(b)),b===92?y:v)}function y(b){return b===91||b===92||b===93?(e.consume(b),f++,v):v(b)}}function a2(e,t,n,s,a,c){let u;return f;function f(y){return y===34||y===39||y===40?(e.enter(s),e.enter(a),e.consume(y),e.exit(a),u=y===40?41:y,h):n(y)}function h(y){return y===u?(e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):(e.enter(c),p(y))}function p(y){return y===u?(e.exit(c),h(u)):y===null?n(y):$e(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),pt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||$e(y)?(e.exit("chunkString"),p(y)):(e.consume(y),y===92?v:g)}function v(y){return y===u||y===92?(e.consume(y),g):g(y)}}function fc(e,t){let n;return s;function s(a){return $e(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):ot(a)?pt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const h6={name:"definition",tokenize:m6},p6={partial:!0,tokenize:g6};function m6(e,t,n){const s=this;let a;return c;function c(b){return e.enter("definition"),u(b)}function u(b){return i2.call(s,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function f(b){return a=Gr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),h):n(b)}function h(b){return Rt(b)?fc(e,p)(b):p(b)}function p(b){return s2(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(p6,v,v)(b)}function v(b){return ot(b)?pt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||$e(b)?(e.exit("definition"),s.parser.defined.push(a),t(b)):n(b)}}function g6(e,t,n){return s;function s(f){return Rt(f)?fc(e,a)(f):n(f)}function a(f){return a2(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return ot(f)?pt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||$e(f)?t(f):n(f)}}const x6={name:"hardBreakEscape",tokenize:v6};function v6(e,t,n){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return $e(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const b6={name:"headingAtx",resolve:y6,tokenize:_6};function y6(e,t){let n=e.length-2,s=3,a,c;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},c={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},pr(e,s,n-s+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])),e}function _6(e,t,n){let s=0;return a;function a(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&s++<6?(e.consume(g),u):g===null||Rt(g)?(e.exit("atxHeadingSequence"),f(g)):n(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),h(g)):g===null||$e(g)?(e.exit("atxHeading"),t(g)):ot(g)?pt(e,f,"whitespace")(g):(e.enter("atxHeadingText"),p(g))}function h(g){return g===35?(e.consume(g),h):(e.exit("atxHeadingSequence"),f(g))}function p(g){return g===null||g===35||Rt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),p)}}const w6=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],n_=["pre","script","style","textarea"],S6={concrete:!0,name:"htmlFlow",resolveTo:N6,tokenize:C6},k6={partial:!0,tokenize:T6},j6={partial:!0,tokenize:E6};function N6(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function C6(e,t,n){const s=this;let a,c,u,f,h;return p;function p(M){return g(M)}function g(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),v}function v(M){return M===33?(e.consume(M),y):M===47?(e.consume(M),c=!0,j):M===63?(e.consume(M),a=3,s.interrupt?t:R):$n(M)?(e.consume(M),u=String.fromCharCode(M),E):n(M)}function y(M){return M===45?(e.consume(M),a=2,b):M===91?(e.consume(M),a=5,f=0,_):$n(M)?(e.consume(M),a=4,s.interrupt?t:R):n(M)}function b(M){return M===45?(e.consume(M),s.interrupt?t:R):n(M)}function _(M){const pe="CDATA[";return M===pe.charCodeAt(f++)?(e.consume(M),f===pe.length?s.interrupt?t:T:_):n(M)}function j(M){return $n(M)?(e.consume(M),u=String.fromCharCode(M),E):n(M)}function E(M){if(M===null||M===47||M===62||Rt(M)){const pe=M===47,_e=u.toLowerCase();return!pe&&!c&&n_.includes(_e)?(a=1,s.interrupt?t(M):T(M)):w6.includes(u.toLowerCase())?(a=6,pe?(e.consume(M),k):s.interrupt?t(M):T(M)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(M):c?A(M):C(M))}return M===45||Rn(M)?(e.consume(M),u+=String.fromCharCode(M),E):n(M)}function k(M){return M===62?(e.consume(M),s.interrupt?t:T):n(M)}function A(M){return ot(M)?(e.consume(M),A):O(M)}function C(M){return M===47?(e.consume(M),O):M===58||M===95||$n(M)?(e.consume(M),L):ot(M)?(e.consume(M),C):O(M)}function L(M){return M===45||M===46||M===58||M===95||Rn(M)?(e.consume(M),L):B(M)}function B(M){return M===61?(e.consume(M),D):ot(M)?(e.consume(M),B):C(M)}function D(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),h=M,U):ot(M)?(e.consume(M),D):F(M)}function U(M){return M===h?(e.consume(M),h=null,Y):M===null||$e(M)?n(M):(e.consume(M),U)}function F(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Rt(M)?B(M):(e.consume(M),F)}function Y(M){return M===47||M===62||ot(M)?C(M):n(M)}function O(M){return M===62?(e.consume(M),I):n(M)}function I(M){return M===null||$e(M)?T(M):ot(M)?(e.consume(M),I):n(M)}function T(M){return M===45&&a===2?(e.consume(M),$):M===60&&a===1?(e.consume(M),z):M===62&&a===4?(e.consume(M),P):M===63&&a===3?(e.consume(M),R):M===93&&a===5?(e.consume(M),me):$e(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(k6,Z,le)(M)):M===null||$e(M)?(e.exit("htmlFlowData"),le(M)):(e.consume(M),T)}function le(M){return e.check(j6,Q,Z)(M)}function Q(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),G}function G(M){return M===null||$e(M)?le(M):(e.enter("htmlFlowData"),T(M))}function $(M){return M===45?(e.consume(M),R):T(M)}function z(M){return M===47?(e.consume(M),u="",re):T(M)}function re(M){if(M===62){const pe=u.toLowerCase();return n_.includes(pe)?(e.consume(M),P):T(M)}return $n(M)&&u.length<8?(e.consume(M),u+=String.fromCharCode(M),re):T(M)}function me(M){return M===93?(e.consume(M),R):T(M)}function R(M){return M===62?(e.consume(M),P):M===45&&a===2?(e.consume(M),R):T(M)}function P(M){return M===null||$e(M)?(e.exit("htmlFlowData"),Z(M)):(e.consume(M),P)}function Z(M){return e.exit("htmlFlow"),t(M)}}function E6(e,t,n){const s=this;return a;function a(u){return $e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return s.parser.lazy[s.now().line]?n(u):t(u)}}function T6(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Rc,t,n)}}const A6={name:"htmlText",tokenize:M6};function M6(e,t,n){const s=this;let a,c,u;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),h}function h(R){return R===33?(e.consume(R),p):R===47?(e.consume(R),B):R===63?(e.consume(R),C):$n(R)?(e.consume(R),F):n(R)}function p(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),c=0,_):$n(R)?(e.consume(R),A):n(R)}function g(R){return R===45?(e.consume(R),b):n(R)}function v(R){return R===null?n(R):R===45?(e.consume(R),y):$e(R)?(u=v,z(R)):(e.consume(R),v)}function y(R){return R===45?(e.consume(R),b):v(R)}function b(R){return R===62?$(R):R===45?y(R):v(R)}function _(R){const P="CDATA[";return R===P.charCodeAt(c++)?(e.consume(R),c===P.length?j:_):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),E):$e(R)?(u=j,z(R)):(e.consume(R),j)}function E(R){return R===93?(e.consume(R),k):j(R)}function k(R){return R===62?$(R):R===93?(e.consume(R),k):j(R)}function A(R){return R===null||R===62?$(R):$e(R)?(u=A,z(R)):(e.consume(R),A)}function C(R){return R===null?n(R):R===63?(e.consume(R),L):$e(R)?(u=C,z(R)):(e.consume(R),C)}function L(R){return R===62?$(R):C(R)}function B(R){return $n(R)?(e.consume(R),D):n(R)}function D(R){return R===45||Rn(R)?(e.consume(R),D):U(R)}function U(R){return $e(R)?(u=U,z(R)):ot(R)?(e.consume(R),U):$(R)}function F(R){return R===45||Rn(R)?(e.consume(R),F):R===47||R===62||Rt(R)?Y(R):n(R)}function Y(R){return R===47?(e.consume(R),$):R===58||R===95||$n(R)?(e.consume(R),O):$e(R)?(u=Y,z(R)):ot(R)?(e.consume(R),Y):$(R)}function O(R){return R===45||R===46||R===58||R===95||Rn(R)?(e.consume(R),O):I(R)}function I(R){return R===61?(e.consume(R),T):$e(R)?(u=I,z(R)):ot(R)?(e.consume(R),I):Y(R)}function T(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,le):$e(R)?(u=T,z(R)):ot(R)?(e.consume(R),T):(e.consume(R),Q)}function le(R){return R===a?(e.consume(R),a=void 0,G):R===null?n(R):$e(R)?(u=le,z(R)):(e.consume(R),le)}function Q(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Rt(R)?Y(R):(e.consume(R),Q)}function G(R){return R===47||R===62||Rt(R)?Y(R):n(R)}function $(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function z(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),re}function re(R){return ot(R)?pt(e,me,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):me(R)}function me(R){return e.enter("htmlTextData"),u(R)}}const ix={name:"labelEnd",resolveAll:D6,resolveTo:O6,tokenize:B6},R6={tokenize:P6},z6={tokenize:$6},L6={tokenize:U6};function D6(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&pr(e,0,e.length,n),e}function O6(e,t){let n=e.length,s=0,a,c,u,f;for(;n--;)if(a=e[n][1],c){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(c=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(u=n);const h={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",p,t]],f=Lr(f,e.slice(c+1,c+s+3)),f=Lr(f,[["enter",g,t]]),f=Lr(f,uf(t.parser.constructs.insideSpan.null,e.slice(c+s+4,u-3),t)),f=Lr(f,[["exit",g,t],e[u-2],e[u-1],["exit",p,t]]),f=Lr(f,e.slice(u+1)),f=Lr(f,[["exit",h,t]]),pr(e,c,e.length,f),e}function B6(e,t,n){const s=this;let a=s.events.length,c,u;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){c=s.events[a][1];break}return f;function f(y){return c?c._inactive?v(y):(u=s.parser.defined.includes(Gr(s.sliceSerialize({start:c.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),h):n(y)}function h(y){return y===40?e.attempt(R6,g,u?g:v)(y):y===91?e.attempt(z6,g,u?p:v)(y):u?g(y):v(y)}function p(y){return e.attempt(L6,g,v)(y)}function g(y){return t(y)}function v(y){return c._balanced=!0,n(y)}}function P6(e,t,n){return s;function s(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return Rt(v)?fc(e,c)(v):c(v)}function c(v){return v===41?g(v):s2(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return Rt(v)?fc(e,h)(v):g(v)}function f(v){return n(v)}function h(v){return v===34||v===39||v===40?a2(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):g(v)}function p(v){return Rt(v)?fc(e,g)(v):g(v)}function g(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function $6(e,t,n){const s=this;return a;function a(f){return i2.call(s,e,c,u,"reference","referenceMarker","referenceString")(f)}function c(f){return s.parser.defined.includes(Gr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function U6(e,t,n){return s;function s(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),a}function a(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const F6={name:"labelStartImage",resolveAll:ix.resolveAll,tokenize:H6};function H6(e,t,n){const s=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):t(f)}}const I6={name:"labelStartLink",resolveAll:ix.resolveAll,tokenize:q6};function q6(e,t,n){const s=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):t(u)}}const nm={name:"lineEnding",tokenize:V6};function V6(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),pt(e,t,"linePrefix")}}const Cd={name:"thematicBreak",tokenize:G6};function G6(e,t,n){let s=0,a;return c;function c(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,f(p)}function f(p){return p===a?(e.enter("thematicBreakSequence"),h(p)):s>=3&&(p===null||$e(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===a?(e.consume(p),s++,h):(e.exit("thematicBreakSequence"),ot(p)?pt(e,f,"whitespace")(p):f(p))}}const Kn={continuation:{tokenize:Q6},exit:Z6,name:"list",tokenize:X6},Y6={partial:!0,tokenize:J6},W6={partial:!0,tokenize:K6};function X6(e,t,n){const s=this,a=s.events[s.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return f;function f(b){const _=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:bg(b)){if(s.containerState.type||(s.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Cd,n,p)(b):p(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(b)}return n(b)}function h(b){return bg(b)&&++u<10?(e.consume(b),h):(!s.interrupt||u<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),p(b)):n(b)}function p(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(Rc,s.interrupt?n:g,e.attempt(Y6,y,v))}function g(b){return s.containerState.initialBlankLine=!0,c++,y(b)}function v(b){return ot(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function Q6(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Rc,a,c);function a(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,pt(e,t,"listItemIndent",s.containerState.size+1)(f)}function c(f){return s.containerState.furtherBlankLines||!ot(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,u(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(W6,t,u)(f))}function u(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,pt(e,e.attempt(Kn,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function K6(e,t,n){const s=this;return pt(e,a,"listItemIndent",s.containerState.size+1);function a(c){const u=s.events[s.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===s.containerState.size?t(c):n(c)}}function Z6(e){e.exit(this.containerState.type)}function J6(e,t,n){const s=this;return pt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const u=s.events[s.events.length-1];return!ot(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const r_={name:"setextUnderline",resolveTo:eT,tokenize:tT};function eT(e,t){let n=e.length,s,a,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",c?(e.splice(a,0,["enter",u,t]),e.splice(c+1,0,["exit",e[s][1],t]),e[s][1].end={...e[c][1].end}):e[s][1]=u,e.push(["exit",u,t]),e}function tT(e,t,n){const s=this;let a;return c;function c(p){let g=s.events.length,v;for(;g--;)if(s.events[g][1].type!=="lineEnding"&&s.events[g][1].type!=="linePrefix"&&s.events[g][1].type!=="content"){v=s.events[g][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||v)?(e.enter("setextHeadingLine"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===a?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),ot(p)?pt(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||$e(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const nT={tokenize:rT};function rT(e){const t=this,n=e.attempt(Rc,s,e.attempt(this.parser.constructs.flowInitial,a,pt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(o6,a)),"linePrefix")));return n;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const sT={resolveAll:o2()},iT=l2("string"),aT=l2("text");function l2(e){return{resolveAll:o2(e==="text"?lT:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],c=n.attempt(a,u,f);return u;function u(g){return p(g)?c(g):f(g)}function f(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),h}function h(g){return p(g)?(n.exit("data"),c(g)):(n.consume(g),h)}function p(g){if(g===null)return!0;const v=a[g];let y=-1;if(v)for(;++y<v.length;){const b=v[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function o2(e){return t;function t(n,s){let a=-1,c;for(;++a<=n.length;)c===void 0?n[a]&&n[a][1].type==="data"&&(c=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==c+2&&(n[c][1].end=n[a-1][1].end,n.splice(c+2,a-c-2),a=c+2),c=void 0);return e?e(n,s):n}}function lT(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let c=a.length,u=-1,f=0,h;for(;c--;){const p=a[c];if(typeof p=="string"){for(u=p.length;p.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(p===-2)h=!0,f++;else if(p!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:s.start._bufferIndex+u,_index:s.start._index+c,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...p.start},s.start.offset===s.end.offset?Object.assign(s,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const oT={42:Kn,43:Kn,45:Kn,48:Kn,49:Kn,50:Kn,51:Kn,52:Kn,53:Kn,54:Kn,55:Kn,56:Kn,57:Kn,62:e2},cT={91:h6},uT={[-2]:tm,[-1]:tm,32:tm},dT={35:b6,42:Cd,45:[r_,Cd],60:S6,61:r_,95:Cd,96:t_,126:t_},fT={38:n2,92:t2},hT={[-5]:nm,[-4]:nm,[-3]:nm,33:F6,38:n2,42:yg,60:[IE,A6],91:I6,92:[x6,t2],93:ix,95:yg,96:n6},pT={null:[yg,sT]},mT={null:[42,95]},gT={null:[]},xT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:mT,contentInitial:cT,disable:gT,document:oT,flow:dT,flowInitial:uT,insideSpan:pT,string:fT,text:hT},Symbol.toStringTag,{value:"Module"}));function vT(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},c=[];let u=[],f=[];const h={attempt:U(B),check:U(D),consume:A,enter:C,exit:L,interrupt:U(D,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:v};let g=t.tokenize.call(p,h);return t.resolveAll&&c.push(t),p;function v(I){return u=Lr(u,I),E(),u[u.length-1]!==null?[]:(F(t,0),p.events=uf(c,p.events,p),p.events)}function y(I,T){return yT(b(I),T)}function b(I){return bT(u,I)}function _(){const{_bufferIndex:I,_index:T,line:le,column:Q,offset:G}=s;return{_bufferIndex:I,_index:T,line:le,column:Q,offset:G}}function j(I){a[I.line]=I.column,O()}function E(){let I;for(;s._index<u.length;){const T=u[s._index];if(typeof T=="string")for(I=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===I&&s._bufferIndex<T.length;)k(T.charCodeAt(s._bufferIndex));else k(T)}}function k(I){g=g(I)}function A(I){$e(I)?(s.line++,s.column=1,s.offset+=I===-3?2:1,O()):I!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===u[s._index].length&&(s._bufferIndex=-1,s._index++)),p.previous=I}function C(I,T){const le=T||{};return le.type=I,le.start=_(),p.events.push(["enter",le,p]),f.push(le),le}function L(I){const T=f.pop();return T.end=_(),p.events.push(["exit",T,p]),T}function B(I,T){F(I,T.from)}function D(I,T){T.restore()}function U(I,T){return le;function le(Q,G,$){let z,re,me,R;return Array.isArray(Q)?Z(Q):"tokenize"in Q?Z([Q]):P(Q);function P(Ce){return Ae;function Ae(ze){const De=ze!==null&&Ce[ze],et=ze!==null&&Ce.null,xe=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(et)?et:et?[et]:[]];return Z(xe)(ze)}}function Z(Ce){return z=Ce,re=0,Ce.length===0?$:M(Ce[re])}function M(Ce){return Ae;function Ae(ze){return R=Y(),me=Ce,Ce.partial||(p.currentConstruct=Ce),Ce.name&&p.parser.constructs.disable.null.includes(Ce.name)?_e():Ce.tokenize.call(T?Object.assign(Object.create(p),T):p,h,pe,_e)(ze)}}function pe(Ce){return I(me,R),G}function _e(Ce){return R.restore(),++re<z.length?M(z[re]):$}}}function F(I,T){I.resolveAll&&!c.includes(I)&&c.push(I),I.resolve&&pr(p.events,T,p.events.length-T,I.resolve(p.events.slice(T),p)),I.resolveTo&&(p.events=I.resolveTo(p.events,p))}function Y(){const I=_(),T=p.previous,le=p.currentConstruct,Q=p.events.length,G=Array.from(f);return{from:Q,restore:$};function $(){s=I,p.previous=T,p.currentConstruct=le,p.events.length=Q,f=G,O()}}function O(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function bT(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,c=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(s,c)];else{if(u=e.slice(n,a),s>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(s):u.shift()}c>0&&u.push(e[a].slice(0,c))}return u}function yT(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
|
|
69
69
|
`;break}case-3:{u=`\r
|
|
70
|
-
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(c)}a=c===-2,s.push(u)}return s.join("")}function _T(e){const s={constructs:Zw([xT,...(e||{}).extensions||[]]),content:a(OE),defined:[],document:a(PE),flow:a(nT),lazy:{},string:a(iT),text:a(aT)};return s;function a(c){return u;function u(f){return vT(s,c,f)}}}function wT(e){for(;!r2(e););return e}const s_=/[\0\t\n\r]/g;function ST(){let e=1,t="",n=!0,s;return a;function a(c,u,f){const h=[];let p,g,v,y,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(s_.lastIndex=v,p=s_.exec(c),y=p&&p.index!==void 0?p.index:c.length,b=c.charCodeAt(y),!p){t=c.slice(v);break}if(b===10&&v===y&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),v<y&&(h.push(c.slice(v,y)),e+=y-v),b){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:s=!0,e=1}v=y+1}return f&&(s&&h.push(-5),t&&h.push(t),h.push(null)),h}}const kT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jT(e){return e.replace(kT,NT)}function NT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),c=a===120||a===88;return Jw(n.slice(c?2:1),c?16:10)}return sx(n)||e}const c2={}.hasOwnProperty;function CT(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),ET(n)(wT(_T(n).document().write(ST()(e,t,!0))))}function ET(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(fn),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:c(bt),blockQuote:c(et),characterEscape:Y,characterReference:Y,codeFenced:c(xe),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(xe,u),codeText:c(Pe,u),codeTextData:Y,data:Y,codeFlowValue:Y,definition:c(ft),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(zt),hardBreakEscape:c(Lt),hardBreakTrailing:c(Lt),htmlFlow:c(dn,u),htmlFlowData:Y,htmlText:c(dn,u),htmlTextData:Y,image:c(st),label:u,link:c(fn),listItem:c(je),listItemValue:y,listOrdered:c(yn,v),listUnordered:c(yn),paragraph:c(Oe),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(bt),strong:c(yt),thematicBreak:c(Or)},exit:{atxHeading:h(),atxHeadingSequence:B,autolink:h(),autolinkEmail:De,autolinkProtocol:ze,blockQuote:h(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Ce,characterReference:Ae,codeFenced:h(E),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:_,codeFlowValue:O,codeIndented:h(k),codeText:h(G),codeTextData:O,data:O,definition:h(),definitionDestinationString:L,definitionLabelString:A,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(T),hardBreakTrailing:h(T),htmlFlow:h(le),htmlFlowData:O,htmlText:h(Q),htmlTextData:O,image:h(z),label:me,labelText:re,lineEnding:I,link:h($),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:pe,resourceDestinationString:R,resourceTitleString:P,resource:Z,setextHeading:h(F),setextHeadingLineSequence:U,setextHeadingText:D,strong:h(),thematicBreak:h()}};u2(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ae){let ve={type:"root",children:[]};const W={stack:[ve],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},fe=[];let Te=-1;for(;++Te<ae.length;)if(ae[Te][1].type==="listOrdered"||ae[Te][1].type==="listUnordered")if(ae[Te][0]==="enter")fe.push(Te);else{const Ye=fe.pop();Te=a(ae,Ye,Te)}for(Te=-1;++Te<ae.length;){const Ye=t[ae[Te][0]];c2.call(Ye,ae[Te][1].type)&&Ye[ae[Te][1].type].call(Object.assign({sliceSerialize:ae[Te][2].sliceSerialize},W),ae[Te][1])}if(W.tokenStack.length>0){const Ye=W.tokenStack[W.tokenStack.length-1];(Ye[1]||i_).call(W,void 0,Ye[0])}for(ve.position={start:Si(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Si(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},Te=-1;++Te<t.transforms.length;)ve=t.transforms[Te](ve)||ve;return ve}function a(ae,ve,W){let fe=ve-1,Te=-1,Ye=!1,tt,nt,vt,hn;for(;++fe<=W;){const Ze=ae[fe];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?Te++:Te--,hn=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(tt&&!hn&&!Te&&!vt&&(vt=fe),hn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:hn=void 0}if(!Te&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||Te===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(tt){let nr=fe;for(nt=void 0;nr--;){const En=ae[nr];if(En[1].type==="lineEnding"||En[1].type==="lineEndingBlank"){if(En[0]==="exit")continue;nt&&(ae[nt][1].type="lineEndingBlank",Ye=!0),En[1].type="lineEnding",nt=nr}else if(!(En[1].type==="linePrefix"||En[1].type==="blockQuotePrefix"||En[1].type==="blockQuotePrefixWhitespace"||En[1].type==="blockQuoteMarker"||En[1].type==="listItemIndent"))break}vt&&(!nt||vt<nt)&&(tt._spread=!0),tt.end=Object.assign({},nt?ae[nt][1].start:Ze[1].end),ae.splice(nt||fe,0,["exit",tt,Ze[2]]),fe++,W++}if(Ze[1].type==="listItemPrefix"){const nr={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};tt=nr,ae.splice(fe,0,["enter",nr,Ze[2]]),fe++,W++,vt=void 0,hn=!0}}}return ae[ve][1]._spread=Ye,W}function c(ae,ve){return W;function W(fe){f.call(this,ae(fe),fe),ve&&ve.call(this,fe)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ae,ve,W){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([ve,W||void 0]),ae.position={start:Si(ve.start),end:void 0}}function h(ae){return ve;function ve(W){ae&&ae.call(this,W),p.call(this,W)}}function p(ae,ve){const W=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==ae.type&&(ve?ve.call(this,ae,fe[0]):(fe[1]||i_).call(this,ae,fe[0]));else throw new Error("Cannot close `"+ae.type+"` ("+dc({start:ae.start,end:ae.end})+"): it’s not open");W.position.end=Si(ae.end)}function g(){return rx(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function y(ae){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=ae}function _(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=ae}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae.replace(/(\r?\n|\r)$/g,"")}function A(ae){const ve=this.resume(),W=this.stack[this.stack.length-1];W.label=ve,W.identifier=Gr(this.sliceSerialize(ae)).toLowerCase()}function C(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ae}function L(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ae}function B(ae){const ve=this.stack[this.stack.length-1];if(!ve.depth){const W=this.sliceSerialize(ae).length;ve.depth=W}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function U(ae){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(ae){const W=this.stack[this.stack.length-1].children;let fe=W[W.length-1];(!fe||fe.type!=="text")&&(fe=qe(),fe.position={start:Si(ae.start),end:void 0},W.push(fe)),this.stack.push(fe)}function O(ae){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ae),ve.position.end=Si(ae.end)}function I(ae){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=ve.children[ve.children.length-1];W.position.end=Si(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(Y.call(this,ae),O.call(this,ae))}function T(){this.data.atHardBreak=!0}function le(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function Q(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function G(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function $(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ve,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function z(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ve,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function re(ae){const ve=this.sliceSerialize(ae),W=this.stack[this.stack.length-2];W.label=jT(ve),W.identifier=Gr(ve).toLowerCase()}function me(){const ae=this.stack[this.stack.length-1],ve=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const fe=ae.children;W.children=fe}else W.alt=ve}function R(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ae}function P(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ae}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function pe(ae){const ve=this.resume(),W=this.stack[this.stack.length-1];W.label=ve,W.identifier=Gr(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function _e(ae){this.data.characterReferenceType=ae.type}function Ce(ae){const ve=this.sliceSerialize(ae),W=this.data.characterReferenceType;let fe;W?(fe=Jw(ve,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=sx(ve);const Te=this.stack[this.stack.length-1];Te.value+=fe}function Ae(ae){const ve=this.stack.pop();ve.position.end=Si(ae.end)}function ze(ae){O.call(this,ae);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(ae)}function De(ae){O.call(this,ae);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(ae)}function et(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function Pe(){return{type:"inlineCode",value:""}}function ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function zt(){return{type:"emphasis",children:[]}}function bt(){return{type:"heading",depth:0,children:[]}}function Lt(){return{type:"break"}}function dn(){return{type:"html",value:""}}function st(){return{type:"image",title:null,url:"",alt:null}}function fn(){return{type:"link",title:null,url:"",children:[]}}function yn(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function je(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function yt(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function Or(){return{type:"thematicBreak"}}}function Si(e){return{line:e.line,column:e.column,offset:e.offset}}function u2(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?u2(e,s):TT(e,s)}}function TT(e,t){let n;for(n in t)if(c2.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function i_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+dc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+dc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+dc({start:t.start,end:t.end})+") is still open")}function AT(e){const t=this;t.parser=n;function n(s){return CT(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function MT(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function RT(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
+
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(c)}a=c===-2,s.push(u)}return s.join("")}function _T(e){const s={constructs:Zw([xT,...(e||{}).extensions||[]]),content:a(OE),defined:[],document:a(PE),flow:a(nT),lazy:{},string:a(iT),text:a(aT)};return s;function a(c){return u;function u(f){return vT(s,c,f)}}}function wT(e){for(;!r2(e););return e}const s_=/[\0\t\n\r]/g;function ST(){let e=1,t="",n=!0,s;return a;function a(c,u,f){const h=[];let p,g,v,y,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),v=0,t="",n&&(c.charCodeAt(0)===65279&&v++,n=void 0);v<c.length;){if(s_.lastIndex=v,p=s_.exec(c),y=p&&p.index!==void 0?p.index:c.length,b=c.charCodeAt(y),!p){t=c.slice(v);break}if(b===10&&v===y&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),v<y&&(h.push(c.slice(v,y)),e+=y-v),b){case 0:{h.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,h.push(-2);e++<g;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:s=!0,e=1}v=y+1}return f&&(s&&h.push(-5),t&&h.push(t),h.push(null)),h}}const kT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jT(e){return e.replace(kT,NT)}function NT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),c=a===120||a===88;return Jw(n.slice(c?2:1),c?16:10)}return sx(n)||e}const c2={}.hasOwnProperty;function CT(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),ET(n)(wT(_T(n).document().write(ST()(e,t,!0))))}function ET(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(fn),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:c(bt),blockQuote:c(et),characterEscape:Y,characterReference:Y,codeFenced:c(xe),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(xe,u),codeText:c(Pe,u),codeTextData:Y,data:Y,codeFlowValue:Y,definition:c(ft),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(zt),hardBreakEscape:c(Lt),hardBreakTrailing:c(Lt),htmlFlow:c(dn,u),htmlFlowData:Y,htmlText:c(dn,u),htmlTextData:Y,image:c(st),label:u,link:c(fn),listItem:c(je),listItemValue:y,listOrdered:c(_n,v),listUnordered:c(_n),paragraph:c(Oe),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(bt),strong:c(yt),thematicBreak:c(Or)},exit:{atxHeading:h(),atxHeadingSequence:B,autolink:h(),autolinkEmail:De,autolinkProtocol:ze,blockQuote:h(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:Ce,characterReference:Ae,codeFenced:h(E),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:_,codeFlowValue:O,codeIndented:h(k),codeText:h(G),codeTextData:O,data:O,definition:h(),definitionDestinationString:L,definitionLabelString:A,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(T),hardBreakTrailing:h(T),htmlFlow:h(le),htmlFlowData:O,htmlText:h(Q),htmlTextData:O,image:h(z),label:me,labelText:re,lineEnding:I,link:h($),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:pe,resourceDestinationString:R,resourceTitleString:P,resource:Z,setextHeading:h(F),setextHeadingLineSequence:U,setextHeadingText:D,strong:h(),thematicBreak:h()}};u2(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ae){let ve={type:"root",children:[]};const W={stack:[ve],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},fe=[];let Te=-1;for(;++Te<ae.length;)if(ae[Te][1].type==="listOrdered"||ae[Te][1].type==="listUnordered")if(ae[Te][0]==="enter")fe.push(Te);else{const Ye=fe.pop();Te=a(ae,Ye,Te)}for(Te=-1;++Te<ae.length;){const Ye=t[ae[Te][0]];c2.call(Ye,ae[Te][1].type)&&Ye[ae[Te][1].type].call(Object.assign({sliceSerialize:ae[Te][2].sliceSerialize},W),ae[Te][1])}if(W.tokenStack.length>0){const Ye=W.tokenStack[W.tokenStack.length-1];(Ye[1]||i_).call(W,void 0,Ye[0])}for(ve.position={start:Si(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:Si(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},Te=-1;++Te<t.transforms.length;)ve=t.transforms[Te](ve)||ve;return ve}function a(ae,ve,W){let fe=ve-1,Te=-1,Ye=!1,tt,nt,vt,hn;for(;++fe<=W;){const Ze=ae[fe];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?Te++:Te--,hn=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(tt&&!hn&&!Te&&!vt&&(vt=fe),hn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:hn=void 0}if(!Te&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||Te===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(tt){let nr=fe;for(nt=void 0;nr--;){const En=ae[nr];if(En[1].type==="lineEnding"||En[1].type==="lineEndingBlank"){if(En[0]==="exit")continue;nt&&(ae[nt][1].type="lineEndingBlank",Ye=!0),En[1].type="lineEnding",nt=nr}else if(!(En[1].type==="linePrefix"||En[1].type==="blockQuotePrefix"||En[1].type==="blockQuotePrefixWhitespace"||En[1].type==="blockQuoteMarker"||En[1].type==="listItemIndent"))break}vt&&(!nt||vt<nt)&&(tt._spread=!0),tt.end=Object.assign({},nt?ae[nt][1].start:Ze[1].end),ae.splice(nt||fe,0,["exit",tt,Ze[2]]),fe++,W++}if(Ze[1].type==="listItemPrefix"){const nr={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};tt=nr,ae.splice(fe,0,["enter",nr,Ze[2]]),fe++,W++,vt=void 0,hn=!0}}}return ae[ve][1]._spread=Ye,W}function c(ae,ve){return W;function W(fe){f.call(this,ae(fe),fe),ve&&ve.call(this,fe)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ae,ve,W){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([ve,W||void 0]),ae.position={start:Si(ve.start),end:void 0}}function h(ae){return ve;function ve(W){ae&&ae.call(this,W),p.call(this,W)}}function p(ae,ve){const W=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==ae.type&&(ve?ve.call(this,ae,fe[0]):(fe[1]||i_).call(this,ae,fe[0]));else throw new Error("Cannot close `"+ae.type+"` ("+dc({start:ae.start,end:ae.end})+"): it’s not open");W.position.end=Si(ae.end)}function g(){return rx(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function y(ae){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=ae}function _(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=ae}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae.replace(/(\r?\n|\r)$/g,"")}function A(ae){const ve=this.resume(),W=this.stack[this.stack.length-1];W.label=ve,W.identifier=Gr(this.sliceSerialize(ae)).toLowerCase()}function C(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ae}function L(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ae}function B(ae){const ve=this.stack[this.stack.length-1];if(!ve.depth){const W=this.sliceSerialize(ae).length;ve.depth=W}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function U(ae){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(ae){const W=this.stack[this.stack.length-1].children;let fe=W[W.length-1];(!fe||fe.type!=="text")&&(fe=qe(),fe.position={start:Si(ae.start),end:void 0},W.push(fe)),this.stack.push(fe)}function O(ae){const ve=this.stack.pop();ve.value+=this.sliceSerialize(ae),ve.position.end=Si(ae.end)}function I(ae){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const W=ve.children[ve.children.length-1];W.position.end=Si(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(Y.call(this,ae),O.call(this,ae))}function T(){this.data.atHardBreak=!0}function le(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function Q(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function G(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.value=ae}function $(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ve,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function z(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=ve,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function re(ae){const ve=this.sliceSerialize(ae),W=this.stack[this.stack.length-2];W.label=jT(ve),W.identifier=Gr(ve).toLowerCase()}function me(){const ae=this.stack[this.stack.length-1],ve=this.resume(),W=this.stack[this.stack.length-1];if(this.data.inReference=!0,W.type==="link"){const fe=ae.children;W.children=fe}else W.alt=ve}function R(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.url=ae}function P(){const ae=this.resume(),ve=this.stack[this.stack.length-1];ve.title=ae}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function pe(ae){const ve=this.resume(),W=this.stack[this.stack.length-1];W.label=ve,W.identifier=Gr(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function _e(ae){this.data.characterReferenceType=ae.type}function Ce(ae){const ve=this.sliceSerialize(ae),W=this.data.characterReferenceType;let fe;W?(fe=Jw(ve,W==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=sx(ve);const Te=this.stack[this.stack.length-1];Te.value+=fe}function Ae(ae){const ve=this.stack.pop();ve.position.end=Si(ae.end)}function ze(ae){O.call(this,ae);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(ae)}function De(ae){O.call(this,ae);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(ae)}function et(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function Pe(){return{type:"inlineCode",value:""}}function ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function zt(){return{type:"emphasis",children:[]}}function bt(){return{type:"heading",depth:0,children:[]}}function Lt(){return{type:"break"}}function dn(){return{type:"html",value:""}}function st(){return{type:"image",title:null,url:"",alt:null}}function fn(){return{type:"link",title:null,url:"",children:[]}}function _n(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function je(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function Oe(){return{type:"paragraph",children:[]}}function yt(){return{type:"strong",children:[]}}function qe(){return{type:"text",value:""}}function Or(){return{type:"thematicBreak"}}}function Si(e){return{line:e.line,column:e.column,offset:e.offset}}function u2(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?u2(e,s):TT(e,s)}}function TT(e,t){let n;for(n in t)if(c2.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function i_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+dc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+dc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+dc({start:t.start,end:t.end})+") is still open")}function AT(e){const t=this;t.parser=n;function n(s){return CT(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function MT(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function RT(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
71
71
|
`}]}function zT(e,t){const n=t.value?t.value+`
|
|
72
72
|
`:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function LT(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DT(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OT(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Bl(s.toLowerCase()),c=e.footnoteOrder.indexOf(s);let u,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),u=e.footnoteOrder.length):u=c+1,f+=1,e.footnoteCounts.set(s,f);const h={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,h);const p={type:"element",tagName:"sup",properties:{},children:[h]};return e.patch(t,p),e.applyData(t,p)}function BT(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PT(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function d2(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),c=a[0];c&&c.type==="text"?c.value="["+c.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=s:a.push({type:"text",value:s}),a}function $T(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return d2(e,t);const a={src:Bl(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const c={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,c),e.applyData(t,c)}function UT(e,t){const n={src:Bl(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function FT(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function HT(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return d2(e,t);const a={href:Bl(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const c={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function IT(e,t){const n={href:Bl(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function qT(e,t,n){const s=e.all(t),a=n?VT(n):f2(t),c={},u=[];if(typeof t.checked=="boolean"){const g=s[0];let v;g&&g.type==="element"&&g.tagName==="p"?v=g:(v={type:"element",tagName:"p",properties:{},children:[]},s.unshift(v)),v.children.length>0&&v.children.unshift({type:"text",value:" "}),v.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const g=s[f];(a||f!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
|
|
73
73
|
`}),g.type==="element"&&g.tagName==="p"&&!a?u.push(...g.children):u.push(g)}const h=s[s.length-1];h&&(a||h.type!=="element"||h.tagName!=="p")&&u.push({type:"text",value:`
|
|
@@ -104,12 +104,12 @@ Details: ${t}`:`Error: ${t}`}function PN(e,t){const n=gc.get(e)||[];n.push(t),gc
|
|
|
104
104
|
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
105
105
|
transition-all duration-200 cursor-pointer
|
|
106
106
|
${t?"ring-1 ring-cc-primary/30":""}
|
|
107
|
-
`,"aria-label":`Activity: ${g} agents running, ${y}/${v} tasks`,children:[j?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&c.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[y,"/",v]}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function hR({sessionId:e}){const t=X(_=>_.pendingPermissions.get(e)),n=X(_=>_.aiResolvedPermissions.get(e)),s=X(_=>_.clearAiResolvedPermissions),a=X(_=>_.connectionStatus.get(e)??"disconnected"),c=X(_=>_.cliConnected.get(e)??!1),u=X(_=>_.cliReconnecting.get(e)??!1),f=X(_=>_.setCliReconnecting),[h,p]=S.useState(null),g=S.useRef(void 0);S.useEffect(()=>{p(null),clearTimeout(g.current)},[e,c]),S.useEffect(()=>()=>clearTimeout(g.current),[]);const v=S.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await ke.relaunchSession(e)}catch(_){Ai(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),y=S.useMemo(()=>t?Array.from(t.values()):[],[t]),b=a==="connected"&&!c;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[b&&l.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:h?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),l.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),a==="disconnected"&&l.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(O7,{sessionId:e}),l.jsx(fR,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(rR,{entry:n[n.length-1],onDismiss:()=>s(e)})}),y.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:y.map(_=>l.jsx(V7,{permission:_,sessionId:e},_.request_id))}),l.jsx(I7,{sessionId:e})]})}function pR({sessionId:e}){const[t,n]=S.useState(!1),s=S.useRef(null),a=X(p=>p.sessions.get(e)),c=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,f=(a==null?void 0:a.aiValidationAutoDeny)??!1;S.useEffect(()=>{if(!t)return;function p(g){s.current&&!s.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,g){const v=!g,y={[p]:v};X.getState().setSessionAiValidation(e,y),ZN(e,y)}return l.jsxs("div",{ref:s,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",c),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function mR({sessionId:e}){const[t,n]=S.useState(!1),[s,a]=S.useState(null),[c,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=v=>{f.current&&!f.current.contains(v.target)&&n(!1)},g=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",g)}},[t]);const h=S.useCallback(async p=>{a(p),u(!1);try{const{blob:g,filename:v}=await ke.exportSession(e,p),y=URL.createObjectURL(g),b=document.createElement("a");b.href=y,b.download=v,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(y),n(!1)}catch(g){Ai(g),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:f,className:"relative",children:[l.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>h("html"),disabled:s!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[s==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>h("txt"),disabled:s!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[s==="txt"?"Exporting…":"Download as Text",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),c&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function gR(){var U;const e=S.useSyncExternalStore(F=>(window.addEventListener("hashchange",F),()=>window.removeEventListener("hashchange",F)),()=>window.location.hash),t=S.useMemo(()=>Xg(e),[e]),n=t.page==="session"||t.page==="home",s=X(F=>F.currentSessionId),a=X(F=>F.cliConnected),c=X(F=>F.sessionStatus),u=X(F=>F.sessionNames),f=X(F=>F.sdkSessions),h=X(F=>F.sidebarOpen),p=X(F=>F.setSidebarOpen),g=X(F=>F.taskPanelOpen),v=X(F=>F.setTaskPanelOpen),y=X(F=>F.activeTab),b=X(F=>F.setActiveTab),_=X(F=>F.markChatTabReentry),j=X(F=>s?F.gitChangedFilesCount.get(s)??0:0),E=s?c.get(s)??null:null,k=s?a.get(s)??!1:!1,A=s?(u==null?void 0:u.get(s))||((U=f.find(F=>F.sessionId===s))==null?void 0:U.name)||`Session ${s.slice(0,8)}`:null,C=!!(s&&n),L=t.page==="session"&&!!s,B=["chat","diff"],D=F=>{F==="chat"&&y!=="chat"&&s&&_(s),b(F)};return S.useEffect(()=>{const F=Y=>{if(!(Y.metaKey||Y.ctrlKey)||Y.key.toLowerCase()!=="j"||!C)return;const O=Y.target;if(O&&(O.tagName==="TEXTAREA"||O.tagName==="INPUT"||O.isContentEditable))return;Y.preventDefault();const I=Math.max(0,B.indexOf(y)),T=Y.shiftKey?-1:1,le=(I+T+B.length)%B.length;D(B[le])};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[C,B,y,b,_,s]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>p(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&l.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[l.jsxs("button",{onClick:()=>D("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:A||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${k?E==="running"?"bg-cc-primary":E==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>D("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&s&&l.jsx(pR,{sessionId:s}),C&&s&&l.jsx(mR,{sessionId:s}),l.jsx(xR,{}),L&&l.jsx("button",{onClick:()=>v(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function xR(){const e=X(n=>n.darkMode),t=S.useCallback(()=>X.getState().toggleDarkMode(),[]);return l.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const sS="cc-recent-dirs";function sf(){try{return JSON.parse(localStorage.getItem(sS)||"[]")}catch{return[]}}function iS(e){const t=sf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(sS,JSON.stringify(t.slice(0,5)))}function vR(){return!1}function aS({onClose:e,embedded:t=!1}){const[n,s]=S.useState([]),[a,c]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[g,v]=S.useState([]),[y,b]=S.useState(""),[_,j]=S.useState(!1),[E,k]=S.useState(""),[A,C]=S.useState([{key:"",value:""}]),[L,B]=S.useState(!1),D=S.useCallback(()=>{ke.listEnvs().then(s).catch(()=>{}).finally(()=>c(!1))},[]);S.useEffect(()=>{D()},[D]);function U(G){f(G.slug),p(G.name);const $=Object.entries(G.variables).map(([z,re])=>({key:z,value:re}));$.length===0&&$.push({key:"",value:""}),v($),b("")}function F(){f(null),b("")}async function Y(){if(!u)return;const G={};for(const $ of g){const z=$.key.trim();z&&(G[z]=$.value)}try{await ke.updateEnv(u,{name:h.trim()||void 0,variables:G}),f(null),b(""),D()}catch($){b($ instanceof Error?$.message:String($))}}async function O(G){try{await ke.deleteEnv(G),u===G&&f(null),D()}catch($){b($ instanceof Error?$.message:String($))}}async function I(){const G=E.trim();if(!G)return;B(!0);const $={};for(const z of A){const re=z.key.trim();re&&($[re]=z.value)}try{await ke.createEnv(G,$),k(""),C([{key:"",value:""}]),j(!1),b(""),D()}catch(z){b(z instanceof Error?z.message:String(z))}finally{B(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:E,onChange:G=>k(G.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:G=>{G.key==="Enter"&&E.trim()&&I()}}),l.jsx(xd,{rows:A,onChange:C}),y&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:I,disabled:!E.trim()||L,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${E.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(G=>{const $=u===G.slug,z=Object.keys(G.variables).length;return $?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:h,onChange:re=>p(re.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(xd,{rows:g,onChange:v})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:F,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:()=>void Y(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},G.slug):l.jsx(bR,{env:G,varCount:z,onStartEdit:()=>U(G),onDelete:()=>void O(G.slug)},G.slug)})}),y&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y})]})});const T=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:E,onChange:G=>k(G.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:G=>{G.key==="Enter"&&E.trim()&&I()}}),l.jsx(xd,{rows:A,onChange:C}),l.jsx("button",{onClick:I,disabled:!E.trim()||L,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${E.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]}),le=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(G=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:G.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(G.variables).length," var",Object.keys(G.variables).length!==1?"s":""]}),u===G.slug?l.jsx("button",{onClick:F,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>U(G),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>O(G.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===G.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,onChange:$=>p($.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(xd,{rows:g,onChange:v})]})}),l.jsx("button",{onClick:Y,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==G.slug&&Object.keys(G.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(G.variables).map(([$,z])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:$}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:z})]},$))})]},G.slug))}),Q=l.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:G=>G.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[y&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),le,T]})]});return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:Q}),document.body)}function bR({env:e,varCount:t,onStartEdit:n,onDelete:s}){return l.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.jsx("button",{onClick:s,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function xd({rows:e,onChange:t}){function n(c,u,f){const h=[...e];h[c]={...h[c],[u]:f},t(h)}function s(c){const u=e.filter((f,h)=>h!==c);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((c,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:c.key,onChange:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:c.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("button",{onClick:()=>s(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const yR=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:aS},Symbol.toStringTag,{value:"Module"}));function _R(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let s="";for(const a of t)s+="/"+a,n.push({label:a,path:s});return n}function wR({initialPath:e,onSelect:t,onClose:n}){const[s,a]=S.useState(""),[c,u]=S.useState([]),[f,h]=S.useState(!0),[p,g]=S.useState(""),[v,y]=S.useState(""),[b,_]=S.useState(!1),[j,E]=S.useState(""),[k,A]=S.useState(-1),[C,L]=S.useState(!1),[B,D]=S.useState(()=>sf()),U=S.useRef(null),F=S.useRef(null),Y=S.useRef(null),O=S.useRef(new Map),I=S.useMemo(()=>{if(!j)return c;const z=j.toLowerCase();return c.filter(re=>re.name.toLowerCase().includes(z))},[c,j]),T=S.useCallback(async z=>{h(!0),g(""),E(""),A(-1);try{const re=await ke.listDirs(z);a(re.path),u(re.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{T(e||void 0)},[]),S.useEffect(()=>{const z=U.current;if(!z)return;function re(R){if(R.key!=="Tab")return;const P=z.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(P.length===0)return;const Z=P[0],M=P[P.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",re);const me=setTimeout(()=>{var R;(R=Y.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",re),clearTimeout(me)}},[]);const le=S.useCallback(()=>{C||(L(!0),setTimeout(n,150))},[n,C]);S.useEffect(()=>{function z(re){if(re.key==="Escape"){if(b)return;le()}}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[b,le]),S.useEffect(()=>{function z(re){var R,P;if(b)return;if(re.key==="Backspace"&&document.activeElement!==Y.current){if(s&&s!=="/"){re.preventDefault();const Z=s.split("/").slice(0,-1).join("/")||"/";T(Z)}return}const me=I.length;if(me!==0){if(re.key==="ArrowDown"){re.preventDefault();const Z=k<me-1?k+1:0;A(Z),(R=O.current.get(Z))==null||R.focus()}else if(re.key==="ArrowUp"){re.preventDefault();const Z=k>0?k-1:me-1;A(Z),(P=O.current.get(Z))==null||P.focus()}}}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[b,I.length,k,s,T]),S.useEffect(()=>{var z;k>=0&&((z=O.current.get(k))==null||z.scrollIntoView({block:"nearest"}))},[k]);function Q(z){iS(z),D(sf()),t(z),n()}const G=_R(s),$=s.split("/").pop()||"/";return Dl.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${C?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:le,children:l.jsxs("div",{ref:U,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${C?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:z=>z.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:le,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),B.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),l.jsx("ul",{className:"list-none m-0 p-0",children:B.map(z=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>Q(z),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[l.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:z.split("/").pop()||z}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:z})]})},z))})]}),l.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:b?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:z=>y(z.target.value),onKeyDown:z=>{z.key==="Enter"&&v.trim()&&Q(v.trim()),z.key==="Escape"&&(z.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:G.map((z,re)=>{const me=re===G.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[re>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{me||T(z.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${me?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":me?"location":void 0,tabIndex:me?-1:0,children:z.label})]},z.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),y(s)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!b&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:l.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),l.jsx("input",{ref:Y,type:"text","aria-label":"Filter directories",value:j,onChange:z=>{E(z.target.value),A(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),l.jsxs("button",{type:"button",onClick:()=>Q(s),"aria-label":`Select ${$}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:$})]})]}),l.jsx("div",{ref:F,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((z,re)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+re*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${re*.1}s infinite`}})]},re))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>T(s||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):I.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>E(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:I.map((z,re)=>l.jsxs("li",{className:`flex items-center transition-colors ${k===re?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:me=>{me?O.current.set(re,me):O.current.delete(re)},onClick:()=>T(z.path),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),Q(z.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:z.path,"aria-label":`Navigate into ${z.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"truncate",children:z.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>Q(z.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${z.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},z.path))})}),l.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function SR(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function kR(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():SR(e.identifier,e.title)}function pc({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),l.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),l.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),l.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function jR({defaultProjectId:e,connectionId:t,onCreated:n,onClose:s}){const[a,c]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(0),[y,b]=S.useState(!0),[_,j]=S.useState([]),[E,k]=S.useState(""),[A,C]=S.useState(""),[L,B]=S.useState(!0),[D,U]=S.useState(!1),[F,Y]=S.useState("");S.useEffect(()=>{let I=!0;return Promise.all([ke.getLinearStates(t),ke.getLinearConnection(t)]).then(([T,le])=>{var G;if(!I)return;j(T.teams),k(le.viewerId);const Q=((G=T.teams[0])==null?void 0:G.id)||"";p(Q)}).catch(T=>{I&&Y(T instanceof Error?T.message:"Failed to load teams")}).finally(()=>{I&&B(!1)}),()=>{I=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){C("");return}const I=_.find(le=>le.id===h),T=I==null?void 0:I.states.find(le=>le.type==="backlog");C((T==null?void 0:T.id)||"")},[h,_]);async function O(){if(!(!a.trim()||!h)){U(!0),Y("");try{const I=await ke.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:y&&E?E:void 0,stateId:A||void 0,connectionId:t});n(I.issue)}catch(I){Y(I instanceof Error?I.message:"Failed to create issue")}finally{U(!1)}}}return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:s,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:I=>I.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick:s,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),F&&l.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:F}),L?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:I=>c(I.target.value),onKeyDown:I=>{I.key==="Enter"&&a.trim()&&h&&!D&&O()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:I=>f(I.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:h,onChange:I=>p(I.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(I=>l.jsxs("option",{value:I.id,children:[I.name," (",I.key,")"]},I.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:g,onChange:I=>v(Number(I.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:y,onChange:I=>b(I.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick:s,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:O,disabled:!a.trim()||!h||D,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:D?"Creating...":"Create Issue"})]})]})]})}),document.body)}function NR({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:s,onIssueSelect:a,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,g]=S.useState(null),[v,y]=S.useState(!1),[b,_]=S.useState(""),[j,E]=S.useState([]),[k,A]=S.useState(!1),[C,L]=S.useState(!1),[B,D]=S.useState(""),[U,F]=S.useState(!1),[Y,O]=S.useState(null),[I,T]=S.useState([]),[le,Q]=S.useState(!1),[G,$]=S.useState(""),[z,re]=S.useState(!1),[me,R]=S.useState([]),[P,Z]=S.useState(!1),[M,pe]=S.useState(""),[_e,Ce]=S.useState(!1),[Ae,ze]=S.useState([]),[De,et]=S.useState(!1),[xe,Pe]=S.useState(!1),ft=S.useRef(null);S.useEffect(()=>{function je(Oe){ft.current&&!ft.current.contains(Oe.target)&&(A(!1),re(!1))}return document.addEventListener("pointerdown",je),()=>document.removeEventListener("pointerdown",je)},[]),S.useEffect(()=>{if(!n){h([]),g(null),y(!1),u(null);return}let je=!0;return ke.listLinearConnections().then(({connections:Oe})=>{je&&(h(Oe),y(!0),Oe.length>0?(g(Oe[0].id),u(Oe[0].id)):(g(null),u(null)))}).catch(()=>{je&&y(!0)}),()=>{je=!1}},[n]);const zt=S.useCallback(je=>{g(je),u(je),a(null),E([]),_(""),D(""),ze([]),pe(""),R([]),Y&&(Q(!0),$(""),ke.getLinearProjectIssues(Y.projectId,10,je).then(({issues:Oe})=>{T(Oe)}).catch(Oe=>{$(Oe instanceof Error?Oe.message:String(Oe))}).finally(()=>{Q(!1)}))},[Y,u,a]);S.useEffect(()=>{if(!t||!n){O(null),T([]);return}let je=!0;return Q(!0),$(""),(async()=>{try{const{mapping:Oe}=await ke.getLinearProjectMapping(t.repoRoot);if(!je)return;if(O(Oe),Oe){const{issues:yt}=await ke.getLinearProjectIssues(Oe.projectId,10,p??void 0);if(!je)return;T(yt)}else T([])}catch(Oe){if(!je)return;$(Oe instanceof Error?Oe.message:String(Oe))}finally{je&&Q(!1)}})(),()=>{je=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const je=b.trim();if(je.length<2){E([]),D(""),L(!1);return}let Oe=!0;L(!0),D("");const yt=setTimeout(()=>{ke.searchLinearIssues(je,8,p??void 0).then(qe=>{Oe&&E(qe.issues)}).catch(qe=>{Oe&&(E([]),D(qe instanceof Error?qe.message:String(qe)))}).finally(()=>{Oe&&L(!1)})},400);return()=>{Oe=!1,clearTimeout(yt)}},[n,b,p]),S.useEffect(()=>{if(!n||!_e){ze([]),et(!1);return}const je=M.trim();if(je.length<2){ze([]),et(!1);return}let Oe=!0;et(!0);const yt=setTimeout(()=>{ke.searchLinearIssues(je,10,p??void 0).then(qe=>{Oe&&ze(qe.issues)}).catch(()=>{Oe&&ze([])}).finally(()=>{Oe&&et(!1)})},400);return()=>{Oe=!1,clearTimeout(yt)}},[n,_e,M,p]);function bt(je,Oe=!1){a(je),_(`${je.identifier} - ${je.title}`);const yt=kR(je);c(yt,!0),Oe&&A(!1)}function Lt(){a(null),_(""),E([]),D("")}async function dn(je){if(t)try{const{mapping:Oe}=await ke.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:je.id,projectName:je.name});O(Oe),re(!1),Q(!0),$("");const{issues:yt}=await ke.getLinearProjectIssues(je.id,10,p??void 0);T(yt)}catch(Oe){$(Oe instanceof Error?Oe.message:String(Oe))}finally{Q(!1)}}async function st(){if(t){try{await ke.removeLinearProjectMapping(t.repoRoot)}catch{}O(null),T([]),a(null),_("")}}function fn(){if(!n){window.location.hash="#/integrations/linear";return}re(!0),me.length===0&&(Z(!0),ke.listLinearProjects(p??void 0).then(({projects:je})=>R(je)).catch(()=>{}).finally(()=>Z(!1)))}function yn(je){Pe(!1),bt(je),Y&&(Q(!0),ke.getLinearProjectIssues(Y.projectId,10,p??void 0).then(({issues:Oe})=>T(Oe)).catch(()=>{}).finally(()=>Q(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:ft,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&f.length>1&&l.jsx("select",{value:p??"",onChange:je=>zt(je.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:f.map(je=>l.jsx("option",{value:je.id,children:je.workspaceName||je.name},je.id))}),Y?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[l.jsx(pc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:Y.projectName}),l.jsx("button",{type:"button",onClick:st,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsxs("button",{type:"button",onClick:()=>Pe(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":k,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}A(!k)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${s?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[l.jsx(pc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:fn,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>Pe(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),Y&&(()=>{const je=M.trim().toLowerCase(),Oe=!_e&&je?I.filter(qe=>qe.identifier.toLowerCase().includes(je)||qe.title.toLowerCase().includes(je)):_e?[]:I,yt=_e?Ae:Oe;return l.jsxs("div",{className:"mt-2",children:[s&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:s.identifier})," - ",s.title]}),l.jsx("button",{type:"button",onClick:Lt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsx("input",{type:"text",value:M,onChange:qe=>pe(qe.target.value),placeholder:_e?"Search all projects...":"Filter issues...",className:"w-full px-2 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),le?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):G?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:G}):De?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&je.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):yt.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:je?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:yt.map(qe=>l.jsxs("button",{type:"button",onClick:()=>bt(qe),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(s==null?void 0:s.id)===qe.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:qe.identifier})," ",qe.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[qe.stateName,qe.priorityLabel].filter(Boolean).join(" - ")})]},qe.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:_e,onChange:qe=>{Ce(qe.target.checked),qe.target.checked||ze([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),z&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>re(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),P?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):me.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:me.map(je=>l.jsx("button",{type:"button",onClick:()=>dn(je),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:je.name})},je.id))})]}),k&&n&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:b,onChange:je=>{_(je.target.value)},onFocus:()=>A(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),l.jsx("button",{type:"button",onClick:()=>{A(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),b.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),b.trim().length>=2&&C&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),b.trim().length>=2&&!C&&B&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:B}),b.trim().length>=2&&!C&&!B&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),b.trim().length>=2&&!C&&!B&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(je=>l.jsxs("button",{type:"button",onClick:()=>bt(je,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:je.identifier})," - ",je.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[je.stateName,je.teamName].filter(Boolean).join(" • ")})]},je.id))})]}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),U&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{F(!1),window.location.hash="#/integrations/linear"},className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:"Configurer Linear"})})]}),xe&&l.jsx(jR,{defaultProjectId:Y==null?void 0:Y.projectId,connectionId:p??void 0,onCreated:yn,onClose:()=>Pe(!1)})]}):null}function CR({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:s,useWorktree:a,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[g,v]=S.useState(!1),[y,b]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function j(E){_.current&&!_.current.contains(E.target)&&v(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),S.useEffect(()=>{t?ke.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&ke.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{ke.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])})}),v(!g),b("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":s?"true":"false",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:y,onChange:j=>b(j.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:j=>{j.key==="Escape"&&v(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=y.toLowerCase().trim(),E=h.filter(L=>!L.isRemote&&(!j||L.name.toLowerCase().includes(j))),k=h.filter(L=>L.isRemote&&(!j||L.name.toLowerCase().includes(j))),A=h.some(L=>L.name.toLowerCase()===j),C=E.length>0||k.length>0;return l.jsxs(l.Fragment,{children:[E.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),E.map(L=>l.jsxs("button",{onClick:()=>{c(L.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[L.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[L.ahead,"↑"]}),L.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[L.behind,"↓"]}),L.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),L.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},L.name))]}),k.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),k.map(L=>l.jsxs("button",{onClick:()=>{c(L.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${L.name}`))]}),!C&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!A&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{c(y.trim(),!0),v(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:y.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const ER=336*60*60*1e3,ca=12,TR=24;function Cg(e){return e.split("/").filter(Boolean).pop()||e}function H_(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Cg(e.cwd)}function AR(e){return e.length>8?e.slice(0,8):e}function MR(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function RR(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const s=Math.floor(n/60);if(s<24)return`${s}h ago`;const a=Math.floor(s/24);if(a<14)return`${a}d ago`;const c=Math.floor(a/7);if(c<8)return`${c}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}function zR(){var Js;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[s,a]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[c,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,g]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,y]=S.useState([]),[b,_]=S.useState(()=>D_(localStorage.getItem("cc-backend")||"claude")),[j,E]=S.useState(()=>O_(localStorage.getItem("cc-backend")||"claude")),[k,A]=S.useState(()=>localStorage.getItem("cc-effort")||""),[C,L]=S.useState(()=>sf()[0]||""),[B,D]=S.useState([]),[U,F]=S.useState(null),[Y,O]=S.useState(!1),[I,T]=S.useState(""),[le,Q]=S.useState(null),[G,$]=S.useState(!1),[z,re]=S.useState(null),[me,R]=S.useState(null),[P,Z]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=le||eS(p),pe=L_(p),_e=F7(p),[Ce,Ae]=S.useState([]),[ze,De]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[et,xe]=S.useState(!1),[Pe,ft]=S.useState(!1),zt=vR(),[bt,Lt]=S.useState(()=>zt),[dn,st]=S.useState([]),[fn,yn]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[je,Oe]=S.useState(!1),yt=S.useRef(null),[qe,Or]=S.useState(null),ae=S.useRef(null),ve=S.useRef(null),[W,fe]=S.useState(!1),[Te,Ye]=S.useState(!1),[tt,nt]=S.useState(!1),[vt,hn]=S.useState(!1),[Ze,nr]=S.useState(!1),[En,Yr]=S.useState(""),[Br,Pr]=S.useState(!0),[te,he]=S.useState([]),[ge,We]=S.useState(!1),[Dt,rn]=S.useState(""),[Tn,Ot]=S.useState(!1),[Ln,mr]=S.useState(ca),[wa,Pl]=S.useState(""),[Dn,zi]=S.useState(null),[$l,Ul]=S.useState(!1),[gr,Ht]=S.useState(""),[_n,rr]=S.useState(!1),[Fl,pf]=S.useState([]),[Li,Di]=S.useState(null),[Wr,Gs]=S.useState(!1),[ps,In]=S.useState(""),[Oi,Xr]=S.useState(0),Yt=S.useRef(null),qn=S.useRef(null),Sa=S.useRef(null),$r=S.useRef(null),Qr=S.useRef(null),Hl=S.useRef(null),Il=X(q=>q.currentSessionId),Wt=nS({text:e,caretPos:Oi,cwd:C||void 0});S.useEffect(()=>{if(Yt.current===null||!qn.current)return;const q=Yt.current;qn.current.setSelectionRange(q,q),Yt.current=null},[e]),S.useEffect(()=>{var de;window.matchMedia("(min-width: 640px)").matches&&((de=qn.current)==null||de.focus())},[]),S.useEffect(()=>{ke.getHome().then(({home:q,cwd:de})=>{C||L(de||q)}).catch(()=>{}),ke.listEnvs().then(Ae).catch(()=>{}),ke.listSandboxes().then(st).catch(()=>{}),ke.getBackends().then(y).catch(()=>{}),ke.getSettings().then(q=>{$(q.linearApiKeyConfigured)}).catch(()=>{})},[]);function mf(q){g(q),localStorage.setItem("cc-backend",q),Q(null),_(D_(q)),E(O_(q)),q!=="claude"&&(nr(!1),he([]),rn(""),We(!1),Ot(!1),mr(ca),Pl(""))}S.useEffect(()=>{if(p!=="codex"){Q(null);return}ke.getBackendModels(p).then(q=>{if(q.length>0){const de=$7(q);Q(de),de.some(Xe=>Xe.value===b)||_(de[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(ae.current&&(clearInterval(ae.current),ae.current=null),Or(null),!bt)return;const q="the-companion:latest",de=()=>{ke.getImageStatus(q).then(Xe=>{Or(Xe),Xe.status==="idle"&&ke.pullImage(q).catch(()=>{}),(Xe.status==="ready"||Xe.status==="error")&&ae.current&&(clearInterval(ae.current),ae.current=null)}).catch(()=>{})};return de(),ae.current=setInterval(de,2e3),()=>{ae.current&&(clearInterval(ae.current),ae.current=null)}},[bt]),S.useEffect(()=>{function q(de){Sa.current&&!Sa.current.contains(de.target)&&fe(!1),$r.current&&!$r.current.contains(de.target)&&Ye(!1),Qr.current&&!Qr.current.contains(de.target)&&nt(!1),Hl.current&&!Hl.current.contains(de.target)&&xe(!1),yt.current&&!yt.current.contains(de.target)&&Oe(!1)}return document.addEventListener("pointerdown",q),()=>document.removeEventListener("pointerdown",q)},[]),S.useEffect(()=>{if(!C){zi(null);return}ke.getRepoInfo(C).then(q=>{zi(q),Ht(q.currentBranch),rr(!1)}).catch(()=>{zi(null),Ht(""),rr(!1)})},[C]);const Bi=M.find(q=>q.value===b)||M[0],ka=pe.find(q=>q.value===j)||pe[0],Ur=_e.find(q=>q.value===k)||_e[0],Vn=p==="codex"?"/logo-codex.svg":"/logo.svg",Dc=C?C.split("/").pop()||C:"Select folder",ql=S.useMemo(()=>En.trim(),[En]),ja=p==="claude"&&Ze&&ql.length>0,Kr=S.useMemo(()=>{const q=Date.now()-ER;return te.filter(de=>de.createdAt>=q)},[te]),Ys=S.useMemo(()=>Tn?te:Kr.length>0?Kr:te,[Tn,Kr,te]),xr=S.useMemo(()=>wa.trim().toLowerCase(),[wa]),Jt=S.useMemo(()=>xr?Ys.filter(q=>{const de=H_(q).toLowerCase(),Xe=Cg(q.cwd).toLowerCase(),ht=(q.gitBranch||"").toLowerCase(),it=q.cwd.toLowerCase(),Fe=q.resumeSessionId.toLowerCase();return de.includes(xr)||Xe.includes(xr)||ht.includes(xr)||it.includes(xr)||Fe.includes(xr)}):Ys,[Ys,xr]),Pi=S.useMemo(()=>Jt.slice(0,Ln),[Jt,Ln]),Oc=Ln<Jt.length,Na=Math.max(0,te.length-Kr.length),Ws=!Tn&&Kr.length>0,Ca=S.useCallback(async()=>{if(p==="claude"){We(!0),rn("");try{const[q,de]=await Promise.all([ke.listSessions(),ke.discoverClaudeSessions(400).then(Fe=>Fe.sessions)]),Xe=new Map,ht=Fe=>{const On=Xe.get(Fe.resumeSessionId);(!On||Fe.createdAt>On.createdAt)&&Xe.set(Fe.resumeSessionId,Fe)};for(const Fe of q)Fe.backendType!=="codex"&&Fe.cliSessionId&&ht({resumeSessionId:Fe.cliSessionId,sessionId:Fe.sessionId,name:Fe.name,model:Fe.model,createdAt:Fe.createdAt,cwd:Fe.cwd,gitBranch:Fe.gitBranch,source:"companion"});for(const Fe of de)ht({resumeSessionId:Fe.sessionId,sessionId:Fe.sessionId,slug:Fe.slug,createdAt:Fe.lastActivityAt,cwd:Fe.cwd,gitBranch:Fe.gitBranch,source:"claude_disk"});const it=Array.from(Xe.values()).sort((Fe,On)=>{const pn=C&&Fe.cwd===C?0:1,yr=C&&On.cwd===C?0:1;return pn!==yr?pn-yr:On.createdAt-Fe.createdAt});he(it),Ot(!1),mr(ca)}catch(q){const de=q instanceof Error?q.message:String(q);rn(de||"Failed to load existing sessions"),he([]),mr(ca)}finally{We(!1)}}},[p,C]);S.useEffect(()=>{p==="claude"&&Ze&&Ca()},[p,Ze,Ca]),S.useEffect(()=>{mr(ca)},[xr,Tn]);async function Vl(q){if(q.length===0)return;const de=[],Xe=[];let ht=B.reduce((it,Fe)=>it+Fe.size,0);for(const it of q){if(it.size>nf){Xe.push(`${it.name} is too large (${Ni(it.size)}, max ${Ni(nf)})`);continue}if(ht+it.size>rf){Xe.push(`${it.name} would exceed the per-message limit (${Ni(rf)})`);continue}const{base64:Fe,mediaType:On}=await H2(it);de.push({name:it.name,base64:Fe,mediaType:On,size:it.size}),ht+=it.size}de.length>0&&D(it=>[...it,...de]),F(Xe.length>0?Xe.join("; "):null)}async function Xs(q){const de=q.target.files;de&&(await Vl(Array.from(de)),q.target.value="")}function gf(q){D(de=>de.filter((Xe,ht)=>ht!==q))}async function Bc(q){var ht;const de=(ht=q.clipboardData)==null?void 0:ht.items;if(!de)return;const Xe=[];for(const it of Array.from(de)){if(it.kind!=="file")continue;const Fe=it.getAsFile();if(!Fe)continue;const On=Fe.name&&Fe.name.length>0?Fe.name:`pasted-${Date.now()}.${(Fe.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Xe.push(new File([Fe],On,{type:Fe.type,lastModified:Fe.lastModified}))}Xe.length>0&&(q.preventDefault(),await Vl(Xe))}function Pc(q){t(q.target.value),Xr(q.target.selectionStart??q.target.value.length);const de=q.target;de.style.height="auto",de.style.height=Math.min(de.scrollHeight,200)+"px"}function Ea(){qn.current&&Xr(qn.current.selectionStart??0)}function $c(q){var Xe;const de=Wt.selectPrompt(q);Yt.current=de.nextCursor,t(de.nextText),Wt.setMentionMenuOpen(!1),Xr(de.nextCursor),(Xe=qn.current)==null||Xe.focus(),qn.current&&(qn.current.style.height="auto",qn.current.style.height=Math.min(qn.current.scrollHeight,200)+"px")}function xf(q){if(Wt.mentionMenuOpen&&q.key==="Escape"){q.preventDefault(),Wt.setMentionMenuOpen(!1);return}if(Wt.mentionMenuOpen&&Wt.filteredPrompts.length>0){if(q.key==="ArrowDown"){q.preventDefault(),Wt.setMentionMenuIndex(de=>(de+1)%Wt.filteredPrompts.length);return}if(q.key==="ArrowUp"){q.preventDefault(),Wt.setMentionMenuIndex(de=>(de-1+Wt.filteredPrompts.length)%Wt.filteredPrompts.length);return}if(q.key==="Tab"&&!q.shiftKey||q.key==="Enter"&&!q.shiftKey){q.preventDefault(),$c(Wt.filteredPrompts[Wt.mentionMenuIndex]);return}}if(Wt.mentionMenuOpen&&Wt.filteredPrompts.length===0&&(q.key==="Enter"&&!q.shiftKey||q.key==="Tab"&&!q.shiftKey)){q.preventDefault();return}if(q.key==="Tab"&&q.shiftKey){q.preventDefault();const de=L_(p),ht=(de.findIndex(it=>it.value===j)+1)%de.length;E(de[ht].value);return}q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),vr())}function Ta(q){const de=s.trim(),Xe=de?`[${de}]: ${q}`:q;if(!z)return Xe;const ht=(z.description??"").trim();return`${["Linear issue context:",`- Identifier: ${z.identifier}`,`- Title: ${z.title}`,z.stateName?`- State: ${z.stateName}`:"",z.priorityLabel?`- Priority: ${z.priorityLabel}`:"",z.teamName?`- Team: ${z.teamName}`:"",`- URL: ${z.url}`,ht?`- Description:
|
|
107
|
+
`,"aria-label":`Activity: ${g} agents running, ${y}/${v} tasks`,children:[j?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.jsx("span",{className:"text-[11px] text-cc-fg/70 font-medium tabular-nums",children:g>0?`${g} agent${g!==1?"s":""}`:`${u.length} done`}),u.length>0&&c.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),c.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[y,"/",v]}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2.5 h-2.5 text-cc-muted/40 transition-transform duration-200 ${t?"rotate-180":""}`,"aria-hidden":!0,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function hR({sessionId:e}){const t=X(_=>_.pendingPermissions.get(e)),n=X(_=>_.aiResolvedPermissions.get(e)),s=X(_=>_.clearAiResolvedPermissions),a=X(_=>_.connectionStatus.get(e)??"disconnected"),c=X(_=>_.cliConnected.get(e)??!1),u=X(_=>_.cliReconnecting.get(e)??!1),f=X(_=>_.setCliReconnecting),[h,p]=S.useState(null),g=S.useRef(void 0);S.useEffect(()=>{p(null),clearTimeout(g.current)},[e,c]),S.useEffect(()=>()=>clearTimeout(g.current),[]);const v=S.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await ke.relaunchSession(e)}catch(_){Ai(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),y=S.useMemo(()=>t?Array.from(t.values()):[],[t]),b=a==="connected"&&!c;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[b&&l.jsx("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-3 animate-[fadeSlideIn_0.3s_ease-out]",children:h?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),l.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-error/12 hover:bg-cc-error/20 text-cc-error transition-all cursor-pointer",children:"Retry"})]}):u?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:v,className:"text-xs font-medium px-3 py-1.5 rounded-lg bg-cc-warning/15 hover:bg-cc-warning/25 text-cc-warning transition-all cursor-pointer",children:"Reconnect"})]})}),a==="disconnected"&&l.jsxs("div",{className:"px-4 py-2.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2 animate-[fadeSlideIn_0.3s_ease-out]",children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(O7,{sessionId:e}),l.jsx(fR,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(rR,{entry:n[n.length-1],onDismiss:()=>s(e)})}),y.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:y.map(_=>l.jsx(V7,{permission:_,sessionId:e},_.request_id))}),l.jsx(I7,{sessionId:e})]})}function pR({sessionId:e}){const[t,n]=S.useState(!1),s=S.useRef(null),a=X(p=>p.sessions.get(e)),c=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,f=(a==null?void 0:a.aiValidationAutoDeny)??!1;S.useEffect(()=>{if(!t)return;function p(g){s.current&&!s.current.contains(g.target)&&n(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[t]);function h(p,g){const v=!g,y={[p]:v};X.getState().setSessionAiValidation(e,y),ZN(e,y)}return l.jsxs("div",{ref:s,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${c?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:c?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.jsx("path",{fillRule:"evenodd",d:"M8 1.246l.542.228c1.926.812 3.732.95 5.408.435l.61-.187v6.528a5.75 5.75 0 01-2.863 4.973L8 15.5l-3.697-2.277A5.75 5.75 0 011.44 8.25V1.722l.61.187c1.676.515 3.482.377 5.408-.435L8 1.246z",clipRule:"evenodd"})})}),t&&l.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-64 bg-cc-bg border border-cc-border rounded-lg shadow-lg p-2 space-y-1",children:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",c),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle AI validation",children:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${c?"text-cc-success":"text-cc-muted"}`,children:c?"On":"Off"})]}),c&&l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoApprove",u),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-approve safe tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationAutoDeny",f),className:"w-full flex items-center justify-between px-2 py-1.5 rounded-md hover:bg-cc-hover text-cc-fg transition-colors cursor-pointer","aria-label":"Toggle auto-deny dangerous tools",children:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function mR({sessionId:e}){const[t,n]=S.useState(!1),[s,a]=S.useState(null),[c,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=v=>{f.current&&!f.current.contains(v.target)&&n(!1)},g=v=>{v.key==="Escape"&&n(!1)};return window.addEventListener("pointerdown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("keydown",g)}},[t]);const h=S.useCallback(async p=>{a(p),u(!1);try{const{blob:g,filename:v}=await ke.exportSession(e,p),y=URL.createObjectURL(g),b=document.createElement("a");b.href=y,b.download=v,document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(y),n(!1)}catch(g){Ai(g),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:f,className:"relative",children:[l.jsx("button",{onClick:()=>n(p=>!p),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${t?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Export session","aria-label":"Export session","aria-haspopup":"menu","aria-expanded":t,children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.jsxs("div",{role:"menu",className:"absolute right-0 top-9 z-50 min-w-[176px] rounded-lg border border-cc-border bg-cc-card shadow-lg py-1 animate-[fadeSlideIn_0.15s_ease-out]",children:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.jsxs("button",{role:"menuitem",onClick:()=>h("html"),disabled:s!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[s==="html"?"Exporting…":"Download as HTML",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.jsxs("button",{role:"menuitem",onClick:()=>h("txt"),disabled:s!==null,className:"w-full text-left px-3 py-2 text-[12px] text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-default",children:[s==="txt"?"Exporting…":"Download as Text",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),c&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function gR(){var U;const e=S.useSyncExternalStore(F=>(window.addEventListener("hashchange",F),()=>window.removeEventListener("hashchange",F)),()=>window.location.hash),t=S.useMemo(()=>Xg(e),[e]),n=t.page==="session"||t.page==="home",s=X(F=>F.currentSessionId),a=X(F=>F.cliConnected),c=X(F=>F.sessionStatus),u=X(F=>F.sessionNames),f=X(F=>F.sdkSessions),h=X(F=>F.sidebarOpen),p=X(F=>F.setSidebarOpen),g=X(F=>F.taskPanelOpen),v=X(F=>F.setTaskPanelOpen),y=X(F=>F.activeTab),b=X(F=>F.setActiveTab),_=X(F=>F.markChatTabReentry),j=X(F=>s?F.gitChangedFilesCount.get(s)??0:0),E=s?c.get(s)??null:null,k=s?a.get(s)??!1:!1,A=s?(u==null?void 0:u.get(s))||((U=f.find(F=>F.sessionId===s))==null?void 0:U.name)||`Session ${s.slice(0,8)}`:null,C=!!(s&&n),L=t.page==="session"&&!!s,B=["chat","diff"],D=F=>{F==="chat"&&y!=="chat"&&s&&_(s),b(F)};return S.useEffect(()=>{const F=Y=>{if(!(Y.metaKey||Y.ctrlKey)||Y.key.toLowerCase()!=="j"||!C)return;const O=Y.target;if(O&&(O.tagName==="TEXTAREA"||O.tagName==="INPUT"||O.isContentEditable))return;Y.preventDefault();const I=Math.max(0,B.indexOf(y)),T=Y.shiftKey?-1:1,le=(I+T+B.length)%B.length;D(B[le])};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[C,B,y,b,_,s]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.jsx("button",{onClick:()=>p(!h),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer shrink-0 ${h?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,"aria-label":"Toggle sidebar",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&l.jsxs("div",{className:"flex-1 flex items-center justify-start md:justify-center gap-0.5 min-w-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[l.jsxs("button",{onClick:()=>D("chat"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:A||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${k?E==="running"?"bg-cc-primary":E==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>D("diff"),className:`h-full px-3 text-[12px] font-medium transition-colors cursor-pointer flex items-center gap-1.5 border-b-[1.5px] shrink-0 ${y==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.jsx("span",{className:"text-[9px] rounded-full min-w-[15px] h-[15px] px-1 flex items-center justify-center font-semibold leading-none bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-300",children:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&s&&l.jsx(pR,{sessionId:s}),C&&s&&l.jsx(mR,{sessionId:s}),l.jsx(xR,{}),L&&l.jsx("button",{onClick:()=>v(!g),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${g?"text-cc-primary bg-cc-active":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Toggle context panel","aria-label":"Toggle context panel",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function xR(){const e=X(n=>n.darkMode),t=S.useCallback(()=>X.getState().toggleDarkMode(),[]);return l.jsx("button",{onClick:t,className:"flex items-center justify-center w-8 h-8 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:e?"Switch to light mode":"Switch to dark mode","aria-label":e?"Switch to light mode":"Switch to dark mode",children:e?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.jsx("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41m11.32-11.32l1.41-1.41"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const sS="cc-recent-dirs";function sf(){try{return JSON.parse(localStorage.getItem(sS)||"[]")}catch{return[]}}function iS(e){const t=sf().filter(n=>n!==e);t.unshift(e),localStorage.setItem(sS,JSON.stringify(t.slice(0,5)))}function vR(){return!1}function aS({onClose:e,embedded:t=!1}){const[n,s]=S.useState([]),[a,c]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[g,v]=S.useState([]),[y,b]=S.useState(""),[_,j]=S.useState(!1),[E,k]=S.useState(""),[A,C]=S.useState([{key:"",value:""}]),[L,B]=S.useState(!1),D=S.useCallback(()=>{ke.listEnvs().then(s).catch(()=>{}).finally(()=>c(!1))},[]);S.useEffect(()=>{D()},[D]);function U(G){f(G.slug),p(G.name);const $=Object.entries(G.variables).map(([z,re])=>({key:z,value:re}));$.length===0&&$.push({key:"",value:""}),v($),b("")}function F(){f(null),b("")}async function Y(){if(!u)return;const G={};for(const $ of g){const z=$.key.trim();z&&(G[z]=$.value)}try{await ke.updateEnv(u,{name:h.trim()||void 0,variables:G}),f(null),b(""),D()}catch($){b($ instanceof Error?$.message:String($))}}async function O(G){try{await ke.deleteEnv(G),u===G&&f(null),D()}catch($){b($ instanceof Error?$.message:String($))}}async function I(){const G=E.trim();if(!G)return;B(!0);const $={};for(const z of A){const re=z.key.trim();re&&($[re]=z.value)}try{await ke.createEnv(G,$),k(""),C([{key:"",value:""}]),j(!1),b(""),D()}catch(z){b(z instanceof Error?z.message:String(z))}finally{B(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${_?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:E,onChange:G=>k(G.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:G=>{G.key==="Enter"&&E.trim()&&I()}}),l.jsx(xd,{rows:A,onChange:C}),y&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:I,disabled:!E.trim()||L,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${E.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(G=>{const $=u===G.slug,z=Object.keys(G.variables).length;return $?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:h,onChange:re=>p(re.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(xd,{rows:g,onChange:v})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:F,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:()=>void Y(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},G.slug):l.jsx(bR,{env:G,varCount:z,onStartEdit:()=>U(G),onDelete:()=>void O(G.slug)},G.slug)})}),y&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y})]})});const T=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:E,onChange:G=>k(G.target.value),placeholder:"Environment name (e.g. production)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",onKeyDown:G=>{G.key==="Enter"&&E.trim()&&I()}}),l.jsx(xd,{rows:A,onChange:C}),l.jsx("button",{onClick:I,disabled:!E.trim()||L,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${E.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]}),le=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(G=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:G.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(G.variables).length," var",Object.keys(G.variables).length!==1?"s":""]}),u===G.slug?l.jsx("button",{onClick:F,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>U(G),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>O(G.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===G.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,onChange:$=>p($.target.value),placeholder:"Environment name",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(xd,{rows:g,onChange:v})]})}),l.jsx("button",{onClick:Y,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"})]}),u!==G.slug&&Object.keys(G.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(G.variables).map(([$,z])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:$}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:z})]},$))})]},G.slug))}),Q=l.jsxs("div",{className:"w-full max-w-lg max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:G=>G.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.jsx("button",{onClick:e,"aria-label":"Close",className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[y&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:y}),le,T]})]});return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:Q}),document.body)}function bR({env:e,varCount:t,onStartEdit:n,onDelete:s}){return l.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.jsx("button",{onClick:n,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.jsx("button",{onClick:s,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function xd({rows:e,onChange:t}){function n(c,u,f){const h=[...e];h[c]={...h[c],[u]:f},t(h)}function s(c){const u=e.filter((f,h)=>h!==c);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((c,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:c.key,onChange:f=>n(u,"key",f.target.value),placeholder:"KEY",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:c.value,onChange:f=>n(u,"value",f.target.value),placeholder:"value",className:"flex-1 min-w-0 px-3 py-2.5 min-h-[44px] text-xs font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),l.jsx("button",{onClick:()=>s(u),"aria-label":"Remove variable",className:"w-10 h-10 min-h-[44px] flex items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const yR=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:aS},Symbol.toStringTag,{value:"Module"}));function _R(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let s="";for(const a of t)s+="/"+a,n.push({label:a,path:s});return n}function wR({initialPath:e,onSelect:t,onClose:n}){const[s,a]=S.useState(""),[c,u]=S.useState([]),[f,h]=S.useState(!0),[p,g]=S.useState(""),[v,y]=S.useState(""),[b,_]=S.useState(!1),[j,E]=S.useState(""),[k,A]=S.useState(-1),[C,L]=S.useState(!1),[B,D]=S.useState(()=>sf()),U=S.useRef(null),F=S.useRef(null),Y=S.useRef(null),O=S.useRef(new Map),I=S.useMemo(()=>{if(!j)return c;const z=j.toLowerCase();return c.filter(re=>re.name.toLowerCase().includes(z))},[c,j]),T=S.useCallback(async z=>{h(!0),g(""),E(""),A(-1);try{const re=await ke.listDirs(z);a(re.path),u(re.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{T(e||void 0)},[]),S.useEffect(()=>{const z=U.current;if(!z)return;function re(R){if(R.key!=="Tab")return;const P=z.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(P.length===0)return;const Z=P[0],M=P[P.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",re);const me=setTimeout(()=>{var R;(R=Y.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",re),clearTimeout(me)}},[]);const le=S.useCallback(()=>{C||(L(!0),setTimeout(n,150))},[n,C]);S.useEffect(()=>{function z(re){if(re.key==="Escape"){if(b)return;le()}}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[b,le]),S.useEffect(()=>{function z(re){var R,P;if(b)return;if(re.key==="Backspace"&&document.activeElement!==Y.current){if(s&&s!=="/"){re.preventDefault();const Z=s.split("/").slice(0,-1).join("/")||"/";T(Z)}return}const me=I.length;if(me!==0){if(re.key==="ArrowDown"){re.preventDefault();const Z=k<me-1?k+1:0;A(Z),(R=O.current.get(Z))==null||R.focus()}else if(re.key==="ArrowUp"){re.preventDefault();const Z=k>0?k-1:me-1;A(Z),(P=O.current.get(Z))==null||P.focus()}}}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[b,I.length,k,s,T]),S.useEffect(()=>{var z;k>=0&&((z=O.current.get(k))==null||z.scrollIntoView({block:"nearest"}))},[k]);function Q(z){iS(z),D(sf()),t(z),n()}const G=_R(s),$=s.split("/").pop()||"/";return Dl.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${C?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:le,children:l.jsxs("div",{ref:U,role:"dialog","aria-modal":"true","aria-label":"Select folder",className:`w-full max-w-lg h-[min(520px,90dvh)] mx-0 sm:mx-4 flex flex-col bg-cc-bg border border-cc-border rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden transition-transform duration-150 ${C?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:z=>z.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4 border-b border-cc-border shrink-0",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.jsx("button",{type:"button","aria-label":"Close",onClick:le,className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),B.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.jsx("div",{className:"px-4 pt-2.5 pb-1 text-[10px] text-cc-muted uppercase tracking-wider font-sans-ui select-none",children:"Recent"}),l.jsx("ul",{className:"list-none m-0 p-0",children:B.map(z=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>Q(z),className:"w-full px-4 py-2 sm:py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-fg group",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted opacity-50 group-hover:opacity-80 transition-opacity shrink-0",children:[l.jsx("path",{d:"M8 3.5a.5.5 0 00-1 0V8a.5.5 0 00.252.434l3.5 2a.5.5 0 00.496-.868L8 7.71V3.5z"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:z.split("/").pop()||z}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:z})]})},z))})]}),l.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:b?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:v,onChange:z=>y(z.target.value),onKeyDown:z=>{z.key==="Enter"&&v.trim()&&Q(v.trim()),z.key==="Escape"&&(z.stopPropagation(),_(!1))},placeholder:"/path/to/project",className:"flex-1 px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:G.map((z,re)=>{const me=re===G.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[re>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{me||T(z.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${me?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":me?"location":void 0,tabIndex:me?-1:0,children:z.label})]},z.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),y(s)},className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer shrink-0",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L3.463 11.098a.25.25 0 00-.064.108l-.563 1.97 1.971-.564a.25.25 0 00.108-.064l8.61-8.61a.25.25 0 000-.354l-1.098-1.097z"})})})]})}),!b&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted absolute left-2 top-1/2 -translate-y-1/2 pointer-events-none",children:l.jsx("path",{d:"M11.5 7a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"})}),l.jsx("input",{ref:Y,type:"text","aria-label":"Filter directories",value:j,onChange:z=>{E(z.target.value),A(-1)},placeholder:"Filter...",className:"w-full pl-7 pr-2 py-1.5 text-base sm:text-xs bg-transparent text-cc-fg font-mono-code placeholder:text-cc-muted/60 focus:outline-none rounded-md border border-transparent focus:border-cc-border transition-colors"})]}),l.jsxs("button",{type:"button",onClick:()=>Q(s),"aria-label":`Select ${$}`,className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-cc-primary text-white hover:bg-cc-primary-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:$})]})]}),l.jsx("div",{ref:F,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((z,re)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.jsx("div",{className:"w-3 h-3 rounded-sm bg-cc-hover shrink-0",style:{background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:"shimmer 1.5s ease-in-out infinite"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+re*17%40}%`,background:"linear-gradient(90deg, var(--color-cc-hover) 25%, var(--color-cc-active) 50%, var(--color-cc-hover) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.5s ease-in-out ${re*.1}s infinite`}})]},re))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>T(s||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):I.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>E(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:I.map((z,re)=>l.jsxs("li",{className:`flex items-center transition-colors ${k===re?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:me=>{me?O.current.set(re,me):O.current.delete(re)},onClick:()=>T(z.path),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),Q(z.path))},className:"flex-1 min-w-0 px-4 py-2 sm:py-1.5 text-xs text-left cursor-pointer font-mono-code flex items-center gap-2 text-cc-fg focus:outline-none",title:z.path,"aria-label":`Navigate into ${z.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"truncate",children:z.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>Q(z.path),className:"shrink-0 w-8 h-8 sm:w-6 sm:h-6 mr-2 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-primary hover:bg-cc-primary/10 transition-colors cursor-pointer","aria-label":`Select ${z.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M12.416 3.376a.75.75 0 01.208 1.04l-5 7.5a.75.75 0 01-1.154.114l-3-3a.75.75 0 011.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 011.04-.207z"})})})]},z.path))})}),l.jsxs("div",{className:"px-4 py-1.5 border-t border-cc-border shrink-0 flex items-center gap-3 text-[10px] text-cc-muted select-none",children:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"esc"})," close"]})]})]})]})}),document.body)}function SR(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function kR(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():SR(e.identifier,e.title)}function pc({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.jsx("path",{d:"M1.22541 61.5228c-.51174-.7989-.43432-1.7526.24387-2.4308L56.4111 3.93536c.6786-.67858 1.6333-.7555 2.4308-.24384l8.676 5.55638c.9876.63266 1.0994 2.01905.2024 2.91604L11.7007 68.1832c-.897.897-2.28339.7852-2.91605-.2024L1.22541 61.5228z",fill:"currentColor"}),l.jsx("path",{d:"M10.3282 73.646c-.69215-.6922-.62695-1.8301.14574-2.4633l10.0851-8.2649c.7722-.6328 1.9083-.5766 2.5354.1253l16.8427 18.8696c.6281.7032.5667 1.8504-.1371 2.5606l-8.2649 8.3441c-.7047.7111-1.8598.7621-2.5605.1133L10.3282 73.646z",fill:"currentColor"}),l.jsx("path",{d:"M44.9498 90.6953c-.4357-.7281-.2507-1.6655.4242-2.1538l7.1957-5.2044c.6744-.4878 1.6108-.3706 2.1413.2682l8.8797 10.6885c.5297.6379.4213 1.5907-.2409 2.1184l-5.1045 4.0706c-.6633.5286-1.627.4453-2.1858-.189L44.9498 90.6953z",fill:"currentColor"}),l.jsx("path",{d:"M67.3964 96.0665c-.2955-.5872-.0617-1.2949.5209-1.5775l4.2152-2.0447c.5843-.2834 1.2962-.0519 1.5873.5167l3.6174 7.0694c.2914.5693.0659 1.2693-.5028 1.5613l-4.2152 2.1643c-.5704.2929-1.2797.0581-1.5788-.5224L67.3964 96.0665z",fill:"currentColor"})]})}function jR({defaultProjectId:e,connectionId:t,onCreated:n,onClose:s}){const[a,c]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(0),[y,b]=S.useState(!0),[_,j]=S.useState([]),[E,k]=S.useState(""),[A,C]=S.useState(""),[L,B]=S.useState(!0),[D,U]=S.useState(!1),[F,Y]=S.useState("");S.useEffect(()=>{let I=!0;return Promise.all([ke.getLinearStates(t),ke.getLinearConnection(t)]).then(([T,le])=>{var G;if(!I)return;j(T.teams),k(le.viewerId);const Q=((G=T.teams[0])==null?void 0:G.id)||"";p(Q)}).catch(T=>{I&&Y(T instanceof Error?T.message:"Failed to load teams")}).finally(()=>{I&&B(!1)}),()=>{I=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){C("");return}const I=_.find(le=>le.id===h),T=I==null?void 0:I.states.find(le=>le.type==="backlog");C((T==null?void 0:T.id)||"")},[h,_]);async function O(){if(!(!a.trim()||!h)){U(!0),Y("");try{const I=await ke.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:y&&E?E:void 0,stateId:A||void 0,connectionId:t});n(I.issue)}catch(I){Y(I instanceof Error?I.message:"Failed to create issue")}finally{U(!1)}}}return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:s,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:I=>I.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.jsx("button",{type:"button",onClick:s,className:"inline-flex h-6 w-6 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),F&&l.jsx("div",{className:"mb-3 px-2.5 py-2 text-xs text-cc-error bg-cc-error/10 border border-cc-error/20 rounded-lg",children:F}),L?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:I=>c(I.target.value),onKeyDown:I=>{I.key==="Enter"&&a.trim()&&h&&!D&&O()},placeholder:"Issue title",autoFocus:!0,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:I=>f(I.target.value),placeholder:"Add details... (Markdown supported)",rows:3,className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60 resize-none"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:h,onChange:I=>p(I.target.value),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:_.map(I=>l.jsxs("option",{value:I.id,children:[I.name," (",I.key,")"]},I.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:g,onChange:I=>v(Number(I.target.value)),className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg cursor-pointer",children:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:y,onChange:I=>b(I.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.jsx("button",{type:"button",onClick:s,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{type:"button",onClick:O,disabled:!a.trim()||!h||D,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg bg-cc-primary text-white hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer",children:D?"Creating...":"Create Issue"})]})]})]})}),document.body)}function NR({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:s,onIssueSelect:a,onBranchFromIssue:c,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,g]=S.useState(null),[v,y]=S.useState(!1),[b,_]=S.useState(""),[j,E]=S.useState([]),[k,A]=S.useState(!1),[C,L]=S.useState(!1),[B,D]=S.useState(""),[U,F]=S.useState(!1),[Y,O]=S.useState(null),[I,T]=S.useState([]),[le,Q]=S.useState(!1),[G,$]=S.useState(""),[z,re]=S.useState(!1),[me,R]=S.useState([]),[P,Z]=S.useState(!1),[M,pe]=S.useState(""),[_e,Ce]=S.useState(!1),[Ae,ze]=S.useState([]),[De,et]=S.useState(!1),[xe,Pe]=S.useState(!1),ft=S.useRef(null);S.useEffect(()=>{function je(Oe){ft.current&&!ft.current.contains(Oe.target)&&(A(!1),re(!1))}return document.addEventListener("pointerdown",je),()=>document.removeEventListener("pointerdown",je)},[]),S.useEffect(()=>{if(!n){h([]),g(null),y(!1),u(null);return}let je=!0;return ke.listLinearConnections().then(({connections:Oe})=>{je&&(h(Oe),y(!0),Oe.length>0?(g(Oe[0].id),u(Oe[0].id)):(g(null),u(null)))}).catch(()=>{je&&y(!0)}),()=>{je=!1}},[n]);const zt=S.useCallback(je=>{g(je),u(je),a(null),E([]),_(""),D(""),ze([]),pe(""),R([]),Y&&(Q(!0),$(""),ke.getLinearProjectIssues(Y.projectId,10,je).then(({issues:Oe})=>{T(Oe)}).catch(Oe=>{$(Oe instanceof Error?Oe.message:String(Oe))}).finally(()=>{Q(!1)}))},[Y,u,a]);S.useEffect(()=>{if(!t||!n){O(null),T([]);return}let je=!0;return Q(!0),$(""),(async()=>{try{const{mapping:Oe}=await ke.getLinearProjectMapping(t.repoRoot);if(!je)return;if(O(Oe),Oe){const{issues:yt}=await ke.getLinearProjectIssues(Oe.projectId,10,p??void 0);if(!je)return;T(yt)}else T([])}catch(Oe){if(!je)return;$(Oe instanceof Error?Oe.message:String(Oe))}finally{je&&Q(!1)}})(),()=>{je=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const je=b.trim();if(je.length<2){E([]),D(""),L(!1);return}let Oe=!0;L(!0),D("");const yt=setTimeout(()=>{ke.searchLinearIssues(je,8,p??void 0).then(qe=>{Oe&&E(qe.issues)}).catch(qe=>{Oe&&(E([]),D(qe instanceof Error?qe.message:String(qe)))}).finally(()=>{Oe&&L(!1)})},400);return()=>{Oe=!1,clearTimeout(yt)}},[n,b,p]),S.useEffect(()=>{if(!n||!_e){ze([]),et(!1);return}const je=M.trim();if(je.length<2){ze([]),et(!1);return}let Oe=!0;et(!0);const yt=setTimeout(()=>{ke.searchLinearIssues(je,10,p??void 0).then(qe=>{Oe&&ze(qe.issues)}).catch(()=>{Oe&&ze([])}).finally(()=>{Oe&&et(!1)})},400);return()=>{Oe=!1,clearTimeout(yt)}},[n,_e,M,p]);function bt(je,Oe=!1){a(je),_(`${je.identifier} - ${je.title}`);const yt=kR(je);c(yt,!0),Oe&&A(!1)}function Lt(){a(null),_(""),E([]),D("")}async function dn(je){if(t)try{const{mapping:Oe}=await ke.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:je.id,projectName:je.name});O(Oe),re(!1),Q(!0),$("");const{issues:yt}=await ke.getLinearProjectIssues(je.id,10,p??void 0);T(yt)}catch(Oe){$(Oe instanceof Error?Oe.message:String(Oe))}finally{Q(!1)}}async function st(){if(t){try{await ke.removeLinearProjectMapping(t.repoRoot)}catch{}O(null),T([]),a(null),_("")}}function fn(){if(!n){window.location.hash="#/integrations/linear";return}re(!0),me.length===0&&(Z(!0),ke.listLinearProjects(p??void 0).then(({projects:je})=>R(je)).catch(()=>{}).finally(()=>Z(!1)))}function _n(je){Pe(!1),bt(je),Y&&(Q(!0),ke.getLinearProjectIssues(Y.projectId,10,p??void 0).then(({issues:Oe})=>T(Oe)).catch(()=>{}).finally(()=>Q(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:ft,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),v&&f.length>1&&l.jsx("select",{value:p??"",onChange:je=>zt(je.target.value),className:"px-1.5 py-1 rounded-md text-[11px] bg-cc-input-bg border border-cc-border text-cc-fg focus:outline-none focus:border-cc-primary/60 cursor-pointer max-w-[140px] truncate",title:"Select Linear workspace",children:f.map(je=>l.jsx("option",{value:je.id,children:je.workspaceName||je.name},je.id))}),Y?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border border-cc-primary/35 bg-cc-primary/10 text-cc-primary",children:[l.jsx(pc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:Y.projectName}),l.jsx("button",{type:"button",onClick:st,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsxs("button",{type:"button",onClick:()=>Pe(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":k,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}A(!k)},className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs border transition-colors cursor-pointer ${s?"border-cc-primary/35 bg-cc-primary/10 text-cc-primary":n?"border-cc-border bg-cc-hover/70 text-cc-fg hover:bg-cc-hover":"border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-300"}`,children:[l.jsx(pc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:fn,className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>Pe(!0),className:"inline-flex items-center gap-1 px-2 py-1.5 rounded-lg text-[11px] border border-dashed border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-primary/40 transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M8 2a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 018 2z"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),Y&&(()=>{const je=M.trim().toLowerCase(),Oe=!_e&&je?I.filter(qe=>qe.identifier.toLowerCase().includes(je)||qe.title.toLowerCase().includes(je)):_e?[]:I,yt=_e?Ae:Oe;return l.jsxs("div",{className:"mt-2",children:[s&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:s.identifier})," - ",s.title]}),l.jsx("button",{type:"button",onClick:Lt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})})]}),l.jsx("input",{type:"text",value:M,onChange:qe=>pe(qe.target.value),placeholder:_e?"Search all projects...":"Filter issues...",className:"w-full px-2 py-1.5 text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),le?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):G?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:G}):De?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):_e&&je.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):yt.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:je?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:yt.map(qe=>l.jsxs("button",{type:"button",onClick:()=>bt(qe),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(s==null?void 0:s.id)===qe.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:qe.identifier})," ",qe.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[qe.stateName,qe.priorityLabel].filter(Boolean).join(" - ")})]},qe.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:_e,onChange:qe=>{Ce(qe.target.checked),qe.target.checked||ze([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),z&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>re(!1),className:"px-2 py-1 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]})}),P?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):me.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:me.map(je=>l.jsx("button",{type:"button",onClick:()=>dn(je),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:je.name})},je.id))})]}),k&&n&&l.jsxs("div",{className:"absolute left-2.5 right-2.5 top-[44px] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-20 overflow-hidden",children:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:b,onChange:je=>{_(je.target.value)},onFocus:()=>A(!0),autoFocus:!0,placeholder:"ENG-123 or issue title",className:"w-full px-2.5 py-2 text-sm bg-cc-input-bg border border-cc-border rounded-md text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),l.jsx("button",{type:"button",onClick:()=>{A(!1)},className:"px-2 py-2 rounded-md text-xs bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Close"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),b.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),b.trim().length>=2&&C&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),b.trim().length>=2&&!C&&B&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:B}),b.trim().length>=2&&!C&&!B&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),b.trim().length>=2&&!C&&!B&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(je=>l.jsxs("button",{type:"button",onClick:()=>bt(je,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:je.identifier})," - ",je.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[je.stateName,je.teamName].filter(Boolean).join(" • ")})]},je.id))})]}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Linear settings",children:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.53 1.53 0 01-2.29.95c-1.35-.8-2.92.77-2.12 2.12.54.9.07 2.04-.95 2.29-1.56.38-1.56 2.6 0 2.98 1.02.25 1.49 1.39.95 2.29-.8 1.35.77 2.92 2.12 2.12.9-.54 2.04-.07 2.29.95.38 1.56 2.6 1.56 2.98 0 .25-1.02 1.39-1.49 2.29-.95 1.35.8 2.92-.77 2.12-2.12-.54-.9-.07-2.04.95-2.29 1.56-.38 1.56-2.6 0-2.98-1.02-.25-1.49-1.39-.95-2.29.8-1.35-.77-2.92-2.12-2.12-.9.54-2.04.07-2.29-.95zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]}),U&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{F(!1),window.location.hash="#/integrations/linear"},className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:"Configurer Linear"})})]}),xe&&l.jsx(jR,{defaultProjectId:Y==null?void 0:Y.projectId,connectionId:p??void 0,onCreated:_n,onClose:()=>Pe(!1)})]}):null}function CR({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:s,useWorktree:a,onBranchChange:c,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[g,v]=S.useState(!1),[y,b]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function j(E){_.current&&!_.current.contains(E.target)&&v(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),S.useEffect(()=>{t?ke.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&ke.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{ke.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])})}),v(!g),b("")},className:"flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer text-cc-muted hover:text-cc-fg hover:bg-cc-hover",title:`Repository: ${e}`,"data-is-new-branch":s?"true":"false",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.378A2.5 2.5 0 007.5 8h1a1 1 0 010 2h-1A2.5 2.5 0 005 12.5v.128a2.25 2.25 0 101.5 0V12.5a1 1 0 011-1h1a2.5 2.5 0 000-5h-1a1 1 0 01-1-1V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5z"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-72 max-w-[calc(100%-2rem)] bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 overflow-hidden",children:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:y,onChange:j=>b(j.target.value),placeholder:"Filter or create branch...",className:"w-full px-2 py-1 text-base sm:text-xs bg-cc-input-bg border border-cc-border rounded-md text-cc-fg font-mono-code placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/50",autoFocus:!0,onKeyDown:j=>{j.key==="Escape"&&v(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=y.toLowerCase().trim(),E=h.filter(L=>!L.isRemote&&(!j||L.name.toLowerCase().includes(j))),k=h.filter(L=>L.isRemote&&(!j||L.name.toLowerCase().includes(j))),A=h.some(L=>L.name.toLowerCase()===j),C=E.length>0||k.length>0;return l.jsxs(l.Fragment,{children:[E.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),E.map(L=>l.jsxs("button",{onClick:()=>{c(L.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[L.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[L.ahead,"↑"]}),L.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[L.behind,"↓"]}),L.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),L.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},L.name))]}),k.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),k.map(L=>l.jsxs("button",{onClick:()=>{c(L.name,!1),v(!1)},className:`w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${L.name}`))]}),!C&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!A&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{c(y.trim(),!0),v(!1)},className:"w-full px-3 py-1.5 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 text-cc-primary",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.jsx("path",{d:"M8 2a.75.75 0 01.75.75v4.5h4.5a.75.75 0 010 1.5h-4.5v4.5a.75.75 0 01-1.5 0v-4.5h-4.5a.75.75 0 010-1.5h4.5v-4.5A.75.75 0 018 2z"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:y.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"bg-cc-primary/15 text-cc-primary font-medium":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:"Create an isolated worktree for this session",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.jsx("path",{d:"M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v5.256a2.25 2.25 0 101.5 0V5.372zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zm7.5-9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V7A2.5 2.5 0 0010 9.5H6a1 1 0 000 2h4a2.5 2.5 0 012.5 2.5v.628a2.25 2.25 0 11-1.5 0V14a1 1 0 00-1-1H6a2.5 2.5 0 01-2.5-2.5V10a2.5 2.5 0 012.5-2.5h4a1 1 0 001-1V5.372a2.25 2.25 0 01-1.5-2.122z"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const ER=336*60*60*1e3,ca=12,TR=24;function Cg(e){return e.split("/").filter(Boolean).pop()||e}function H_(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Cg(e.cwd)}function AR(e){return e.length>8?e.slice(0,8):e}function MR(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function RR(e){if(!Number.isFinite(e)||e<=0)return"Unknown";const t=Date.now()-e;if(t<6e4)return"Just now";const n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;const s=Math.floor(n/60);if(s<24)return`${s}h ago`;const a=Math.floor(s/24);if(a<14)return`${a}d ago`;const c=Math.floor(a/7);if(c<8)return`${c}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}function zR(){var Js;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[s,a]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[c,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,g]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[v,y]=S.useState([]),[b,_]=S.useState(()=>D_(localStorage.getItem("cc-backend")||"claude")),[j,E]=S.useState(()=>O_(localStorage.getItem("cc-backend")||"claude")),[k,A]=S.useState(()=>localStorage.getItem("cc-effort")||""),[C,L]=S.useState(()=>sf()[0]||""),[B,D]=S.useState([]),[U,F]=S.useState(null),[Y,O]=S.useState(!1),[I,T]=S.useState(""),[le,Q]=S.useState(null),[G,$]=S.useState(!1),[z,re]=S.useState(null),[me,R]=S.useState(null),[P,Z]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=le||eS(p),pe=L_(p),_e=F7(p),[Ce,Ae]=S.useState([]),[ze,De]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[et,xe]=S.useState(!1),[Pe,ft]=S.useState(!1),zt=vR(),[bt,Lt]=S.useState(()=>zt),[dn,st]=S.useState([]),[fn,_n]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[je,Oe]=S.useState(!1),yt=S.useRef(null),[qe,Or]=S.useState(null),ae=S.useRef(null),ve=S.useRef(null),[W,fe]=S.useState(!1),[Te,Ye]=S.useState(!1),[tt,nt]=S.useState(!1),[vt,hn]=S.useState(!1),[Ze,nr]=S.useState(!1),[En,Yr]=S.useState(""),[Br,Pr]=S.useState(!0),[te,he]=S.useState([]),[ge,We]=S.useState(!1),[Dt,rn]=S.useState(""),[Tn,Ot]=S.useState(!1),[Ln,mr]=S.useState(ca),[wa,Pl]=S.useState(""),[Dn,zi]=S.useState(null),[$l,Ul]=S.useState(!1),[gr,Ht]=S.useState(""),[wn,rr]=S.useState(!1),[Fl,pf]=S.useState([]),[Li,Di]=S.useState(null),[Wr,Gs]=S.useState(!1),[ps,In]=S.useState(""),[Oi,Xr]=S.useState(0),Yt=S.useRef(null),qn=S.useRef(null),Sa=S.useRef(null),$r=S.useRef(null),Qr=S.useRef(null),Hl=S.useRef(null),Il=X(q=>q.currentSessionId),Wt=nS({text:e,caretPos:Oi,cwd:C||void 0});S.useEffect(()=>{if(Yt.current===null||!qn.current)return;const q=Yt.current;qn.current.setSelectionRange(q,q),Yt.current=null},[e]),S.useEffect(()=>{var de;window.matchMedia("(min-width: 640px)").matches&&((de=qn.current)==null||de.focus())},[]),S.useEffect(()=>{ke.getHome().then(({home:q,cwd:de})=>{C||L(de||q)}).catch(()=>{}),ke.listEnvs().then(Ae).catch(()=>{}),ke.listSandboxes().then(st).catch(()=>{}),ke.getBackends().then(y).catch(()=>{}),ke.getSettings().then(q=>{$(q.linearApiKeyConfigured)}).catch(()=>{})},[]);function mf(q){g(q),localStorage.setItem("cc-backend",q),Q(null),_(D_(q)),E(O_(q)),q!=="claude"&&(nr(!1),he([]),rn(""),We(!1),Ot(!1),mr(ca),Pl(""))}S.useEffect(()=>{if(p!=="codex"){Q(null);return}ke.getBackendModels(p).then(q=>{if(q.length>0){const de=$7(q);Q(de),de.some(Xe=>Xe.value===b)||_(de[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(ae.current&&(clearInterval(ae.current),ae.current=null),Or(null),!bt)return;const q="the-companion:latest",de=()=>{ke.getImageStatus(q).then(Xe=>{Or(Xe),Xe.status==="idle"&&ke.pullImage(q).catch(()=>{}),(Xe.status==="ready"||Xe.status==="error")&&ae.current&&(clearInterval(ae.current),ae.current=null)}).catch(()=>{})};return de(),ae.current=setInterval(de,2e3),()=>{ae.current&&(clearInterval(ae.current),ae.current=null)}},[bt]),S.useEffect(()=>{function q(de){Sa.current&&!Sa.current.contains(de.target)&&fe(!1),$r.current&&!$r.current.contains(de.target)&&Ye(!1),Qr.current&&!Qr.current.contains(de.target)&&nt(!1),Hl.current&&!Hl.current.contains(de.target)&&xe(!1),yt.current&&!yt.current.contains(de.target)&&Oe(!1)}return document.addEventListener("pointerdown",q),()=>document.removeEventListener("pointerdown",q)},[]),S.useEffect(()=>{if(!C){zi(null);return}ke.getRepoInfo(C).then(q=>{zi(q),Ht(q.currentBranch),rr(!1)}).catch(()=>{zi(null),Ht(""),rr(!1)})},[C]);const Bi=M.find(q=>q.value===b)||M[0],ka=pe.find(q=>q.value===j)||pe[0],Ur=_e.find(q=>q.value===k)||_e[0],Vn=p==="codex"?"/logo-codex.svg":"/logo.svg",Dc=C?C.split("/").pop()||C:"Select folder",ql=S.useMemo(()=>En.trim(),[En]),ja=p==="claude"&&Ze&&ql.length>0,Kr=S.useMemo(()=>{const q=Date.now()-ER;return te.filter(de=>de.createdAt>=q)},[te]),Ys=S.useMemo(()=>Tn?te:Kr.length>0?Kr:te,[Tn,Kr,te]),xr=S.useMemo(()=>wa.trim().toLowerCase(),[wa]),Jt=S.useMemo(()=>xr?Ys.filter(q=>{const de=H_(q).toLowerCase(),Xe=Cg(q.cwd).toLowerCase(),ht=(q.gitBranch||"").toLowerCase(),it=q.cwd.toLowerCase(),Fe=q.resumeSessionId.toLowerCase();return de.includes(xr)||Xe.includes(xr)||ht.includes(xr)||it.includes(xr)||Fe.includes(xr)}):Ys,[Ys,xr]),Pi=S.useMemo(()=>Jt.slice(0,Ln),[Jt,Ln]),Oc=Ln<Jt.length,Na=Math.max(0,te.length-Kr.length),Ws=!Tn&&Kr.length>0,Ca=S.useCallback(async()=>{if(p==="claude"){We(!0),rn("");try{const[q,de]=await Promise.all([ke.listSessions(),ke.discoverClaudeSessions(400).then(Fe=>Fe.sessions)]),Xe=new Map,ht=Fe=>{const On=Xe.get(Fe.resumeSessionId);(!On||Fe.createdAt>On.createdAt)&&Xe.set(Fe.resumeSessionId,Fe)};for(const Fe of q)Fe.backendType!=="codex"&&Fe.cliSessionId&&ht({resumeSessionId:Fe.cliSessionId,sessionId:Fe.sessionId,name:Fe.name,model:Fe.model,createdAt:Fe.createdAt,cwd:Fe.cwd,gitBranch:Fe.gitBranch,source:"companion"});for(const Fe of de)ht({resumeSessionId:Fe.sessionId,sessionId:Fe.sessionId,slug:Fe.slug,createdAt:Fe.lastActivityAt,cwd:Fe.cwd,gitBranch:Fe.gitBranch,source:"claude_disk"});const it=Array.from(Xe.values()).sort((Fe,On)=>{const pn=C&&Fe.cwd===C?0:1,yr=C&&On.cwd===C?0:1;return pn!==yr?pn-yr:On.createdAt-Fe.createdAt});he(it),Ot(!1),mr(ca)}catch(q){const de=q instanceof Error?q.message:String(q);rn(de||"Failed to load existing sessions"),he([]),mr(ca)}finally{We(!1)}}},[p,C]);S.useEffect(()=>{p==="claude"&&Ze&&Ca()},[p,Ze,Ca]),S.useEffect(()=>{mr(ca)},[xr,Tn]);async function Vl(q){if(q.length===0)return;const de=[],Xe=[];let ht=B.reduce((it,Fe)=>it+Fe.size,0);for(const it of q){if(it.size>nf){Xe.push(`${it.name} is too large (${Ni(it.size)}, max ${Ni(nf)})`);continue}if(ht+it.size>rf){Xe.push(`${it.name} would exceed the per-message limit (${Ni(rf)})`);continue}const{base64:Fe,mediaType:On}=await H2(it);de.push({name:it.name,base64:Fe,mediaType:On,size:it.size}),ht+=it.size}de.length>0&&D(it=>[...it,...de]),F(Xe.length>0?Xe.join("; "):null)}async function Xs(q){const de=q.target.files;de&&(await Vl(Array.from(de)),q.target.value="")}function gf(q){D(de=>de.filter((Xe,ht)=>ht!==q))}async function Bc(q){var ht;const de=(ht=q.clipboardData)==null?void 0:ht.items;if(!de)return;const Xe=[];for(const it of Array.from(de)){if(it.kind!=="file")continue;const Fe=it.getAsFile();if(!Fe)continue;const On=Fe.name&&Fe.name.length>0?Fe.name:`pasted-${Date.now()}.${(Fe.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Xe.push(new File([Fe],On,{type:Fe.type,lastModified:Fe.lastModified}))}Xe.length>0&&(q.preventDefault(),await Vl(Xe))}function Pc(q){t(q.target.value),Xr(q.target.selectionStart??q.target.value.length);const de=q.target;de.style.height="auto",de.style.height=Math.min(de.scrollHeight,200)+"px"}function Ea(){qn.current&&Xr(qn.current.selectionStart??0)}function $c(q){var Xe;const de=Wt.selectPrompt(q);Yt.current=de.nextCursor,t(de.nextText),Wt.setMentionMenuOpen(!1),Xr(de.nextCursor),(Xe=qn.current)==null||Xe.focus(),qn.current&&(qn.current.style.height="auto",qn.current.style.height=Math.min(qn.current.scrollHeight,200)+"px")}function xf(q){if(Wt.mentionMenuOpen&&q.key==="Escape"){q.preventDefault(),Wt.setMentionMenuOpen(!1);return}if(Wt.mentionMenuOpen&&Wt.filteredPrompts.length>0){if(q.key==="ArrowDown"){q.preventDefault(),Wt.setMentionMenuIndex(de=>(de+1)%Wt.filteredPrompts.length);return}if(q.key==="ArrowUp"){q.preventDefault(),Wt.setMentionMenuIndex(de=>(de-1+Wt.filteredPrompts.length)%Wt.filteredPrompts.length);return}if(q.key==="Tab"&&!q.shiftKey||q.key==="Enter"&&!q.shiftKey){q.preventDefault(),$c(Wt.filteredPrompts[Wt.mentionMenuIndex]);return}}if(Wt.mentionMenuOpen&&Wt.filteredPrompts.length===0&&(q.key==="Enter"&&!q.shiftKey||q.key==="Tab"&&!q.shiftKey)){q.preventDefault();return}if(q.key==="Tab"&&q.shiftKey){q.preventDefault();const de=L_(p),ht=(de.findIndex(it=>it.value===j)+1)%de.length;E(de[ht].value);return}q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),vr())}function Ta(q){const de=s.trim(),Xe=de?`[${de}]: ${q}`:q;if(!z)return Xe;const ht=(z.description??"").trim();return`${["Linear issue context:",`- Identifier: ${z.identifier}`,`- Title: ${z.title}`,z.stateName?`- State: ${z.stateName}`:"",z.priorityLabel?`- Priority: ${z.priorityLabel}`:"",z.teamName?`- Team: ${z.teamName}`:"",`- URL: ${z.url}`,ht?`- Description:
|
|
108
108
|
${ht}`:""].filter(Boolean).join(`
|
|
109
109
|
`)}
|
|
110
110
|
|
|
111
111
|
User request:
|
|
112
|
-
${Xe}`}async function vr(){const q=e.trim();if(!(!q||Y)){if(n&&!s.trim()){T("Please enter your name before starting a session.");return}if(O(!0),T(""),In(""),Dn){const de=gr||Dn.currentBranch;if(de&&de===Dn.currentBranch){const Xe=Fl.find(ht=>ht.name===de&&!ht.isRemote);if(Xe&&Xe.behind>0){Di({behind:Xe.behind,branchName:de});return}}}await Qs(q)}}async function Qs(q,de){const Xe=X.getState();Xe.clearCreation(),Xe.setSessionCreating(!0,p);try{Il&&Cm(Il);const ht=(de==null?void 0:de.resumeSessionAt)||(ja?ql:void 0),it=ht?(de==null?void 0:de.forkSession)??(ja?Br:void 0):void 0,Fe=(de==null?void 0:de.cwd)||C,On=(de==null?void 0:de.branch)!==void 0?de.branch.trim()||void 0:gr.trim()||void 0,pn=(de==null?void 0:de.useWorktree)!==void 0?de.useWorktree:$l,yr=(de==null?void 0:de.createBranch)!==void 0?de.createBranch:!!(On&&_n),ms=await _4({model:b,permissionMode:j,effort:p==="claude"&&k?k:void 0,cwd:Fe||void 0,envSlug:ze||void 0,sandboxEnabled:bt?!0:void 0,sandboxSlug:bt&&fn?fn:void 0,branch:On,createBranch:yr?!0:void 0,useWorktree:pn?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:ht,forkSession:it,userName:s.trim()||void 0,linearConnectionId:z&&me||void 0,linearIssue:z?{identifier:z.identifier,title:z.title,stateName:z.stateName,teamName:z.teamName,url:z.url}:void 0},Zr=>{X.getState().addCreationProgress(Zr)}),mn=ms.sessionId,Hc=X.getState(),Yl=Hc.sdkSessions.filter(Zr=>Zr.sessionId!==mn);Hc.setSdkSessions([...Yl,{sessionId:mn,state:ms.state,cwd:ms.cwd,createdAt:Date.now(),backendType:ms.backendType||p,model:b,permissionMode:j,userName:s.trim()||void 0,resumeSessionAt:ht,forkSession:ht?it===!0:void 0}]);const Wl=new Set(X.getState().sessionNames.values()),Ui=J_(Wl),Fi=c.trim()||s.trim(),Ic=f.trim()||Ui,qc=Fi?`${Fi}_${Ic}`:Ic;X.getState().setSessionName(mn,qc),ke.renameSession(mn,qc).catch(()=>{}),h(""),Fe&&iS(Fe),X.getState().setPreviousPermissionMode(mn,j),Qg(mn,!0),Tc(mn),await WN(mn);const Vc=q.trim();if(Vc.length>0){const Zr=Ta(Vc),Gc=km(),Yc=B.length>0?B.map(Ra=>({name:Ra.name,media_type:Ra.mediaType,data:Ra.base64,size:Ra.size})):void 0;Pn(mn,{type:"user_message",content:Zr,session_id:mn,attachments:Yc,client_msg_id:Gc}),X.getState().appendMessage(mn,{id:Gc,role:"user",content:Zr,attachments:Yc,timestamp:Date.now()})}z&&(ke.linkLinearIssue(mn,z,me||void 0).then(()=>X.getState().setLinkedLinearIssue(mn,z)).catch(()=>{}),ke.transitionLinearIssue(z.id,me||void 0).catch(()=>{})),X.getState().clearCreation()}catch(ht){const it=ht instanceof Error?ht.message:String(ht);T(it),X.getState().setCreationError(it),O(!1)}}async function Aa(q,de){Y||(O(!0),T(""),In(""),L(q.cwd),Ul(!1),rr(!1),Ht(q.gitBranch||""),Yr(q.resumeSessionId),Pr(de),await Qs("",{resumeSessionAt:q.resumeSessionId,forkSession:de,cwd:q.cwd,branch:q.gitBranch,useWorktree:!1,createBranch:!1}))}async function Ks(){if(Li){Gs(!0),In("");try{const q=C||(Dn==null?void 0:Dn.repoRoot);if(!q)throw new Error("No working directory");const de=await ke.gitPull(q);if(!de.success){In(de.output||"Pull failed"),Gs(!1),O(!1);return}Di(null),Gs(!1),await Qs(e.trim())}catch(q){In(q instanceof Error?q.message:String(q)),Gs(!1)}}}function Zs(){const q=e.trim();Di(null),In(""),Qs(q)}function Uc(){Di(null),In(""),O(!1)}const Gl=S.useCallback((q,de)=>{Ht(q),rr(de)},[]),Fc=S.useCallback((q,de)=>{Ht(q),rr(de)},[]),$i=S.useCallback(q=>{pf(q)},[]),br=S.useCallback(q=>{re(q),!q&&Dn&&(Ht(Dn.currentBranch),rr(!1))},[Dn]),Ma=e.trim().length>0&&!Y&&(!n||s.trim().length>0);return l.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[l.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),l.jsxs("div",{className:"w-full max-w-[720px]",children:[l.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[l.jsx("img",{src:Vn,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),l.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",l.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",l.jsx("span",{className:"text-cc-error",children:"*"})]}),l.jsx("input",{type:"text",value:s,onChange:q=>{const de=q.target.value;a(de),localStorage.setItem("cc-user-name",de)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":s.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:c,onChange:q=>{const de=q.target.value;u(de),localStorage.setItem("cc-session-prefix",de)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:f,onChange:q=>h(q.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),l.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",l.jsxs("span",{className:"font-mono-code",children:[c.trim()||s.trim()||"MA","_",f.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:ve,type:"file",multiple:!0,onChange:Xs,className:"hidden","aria-label":"Attach files"}),l.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[l.jsx(tS,{open:Wt.mentionMenuOpen,loading:Wt.promptsLoading,prompts:Wt.filteredPrompts,selectedIndex:Wt.mentionMenuIndex,onSelect:$c,menuRef:Wt.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(z||B.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[z&&l.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[l.jsx("span",{className:"shrink-0",children:"Linear"}),l.jsx("span",{className:"font-mono-code shrink-0",children:z.identifier}),l.jsx("span",{className:"truncate",children:z.title}),l.jsx("button",{type:"button",onClick:()=>br(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),B.map((q,de)=>l.jsx(V2,{name:q.name,mediaType:q.mediaType,base64:q.base64,size:q.size,onRemove:()=>gf(de),className:"w-10 h-10"},de))]}),U&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:U}),l.jsx("textarea",{ref:qn,value:e,onChange:Pc,onKeyDown:xf,onClick:Ea,onKeyUp:Ea,onPaste:Bc,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),l.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[l.jsxs("div",{className:"relative",ref:Sa,children:[l.jsxs("button",{onClick:()=>fe(!W),"aria-expanded":W,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("span",{children:Bi.icon}),l.jsx("span",{children:Bi.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),W&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:M.map(q=>l.jsxs("button",{onClick:()=>{_(q.value),fe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${q.value===b?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:q.icon}),q.label]},q.value))})]}),_e.length>0&&l.jsxs("div",{className:"relative",ref:Qr,children:[l.jsxs("button",{onClick:()=>nt(!tt),"aria-expanded":tt,"aria-label":"Reasoning effort",title:"Reasoning effort",className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 13l3.5-3.5L8 12l5.5-6.5M13.5 5.5h-2.5M13.5 5.5v2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{children:Ur.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),tt&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:_e.map(q=>l.jsx("button",{onClick:()=>{A(q.value),localStorage.setItem("cc-effort",q.value),nt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${q.value===k?"text-cc-primary font-medium":"text-cc-fg"}`,children:q.label},q.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:$r,children:[l.jsxs("button",{onClick:()=>Ye(!Te),"aria-expanded":Te,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),ka.label,l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Te&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:pe.map(q=>l.jsx("button",{onClick:()=>{E(q.value),Ye(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${q.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:q.label},q.value))})]}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>hn(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Dc})]}),vt&&l.jsx(wR,{initialPath:C||"",onSelect:q=>{L(q)},onClose:()=>hn(!1)})]}),l.jsx(CR,{cwd:C,gitRepoInfo:Dn,selectedBranch:gr,isNewBranch:_n,useWorktree:$l,onBranchChange:Gl,onWorktreeChange:Ul,onBranchesLoaded:$i}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{className:"relative",ref:Hl,children:[l.jsxs("button",{onClick:()=>{et||ke.listEnvs().then(Ae).catch(()=>{}),xe(!et)},"aria-expanded":et,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:ze?((Js=Ce.find(q=>q.slug===ze))==null?void 0:Js.name)||"Env":"No env"})]}),et&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[l.jsx("button",{onClick:()=>{De(""),localStorage.setItem("cc-selected-env",""),xe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${ze?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),Ce.map(q=>l.jsxs("button",{onClick:()=>{De(q.slug),localStorage.setItem("cc-selected-env",q.slug),xe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${q.slug===ze?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:q.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(q.variables).length," var",Object.keys(q.variables).length!==1?"s":""]})]},q.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{ft(!0),xe(!1)},className:"w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Manage environments..."})})]})]}),zt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var q;return(q=ve.current)==null?void 0:q.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{onClick:vr,disabled:!Ma,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Ma?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),l.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[v.length>1&&l.jsx("div",{className:"flex items-center justify-center",children:l.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:v.map(q=>l.jsxs("button",{onClick:()=>q.available&&mf(q.id),disabled:!q.available,title:q.available?q.name:`${q.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${q.available?p===q.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[q.name,!q.available&&l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},q.id))})}),p==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>nr(q=>!q),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${Ze?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":Ze,"aria-controls":"branch-from-session-panel",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[l.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),l.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${Ze?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":Ze?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!Ze||void 0,children:l.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>void Ca(),disabled:ge,className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors disabled:opacity-60 cursor-pointer",children:ge?"Refreshing...":"Refresh detected sessions"}),te.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",Pi.length," of ",Jt.length," ",xr?"matching":Ws?"recent":"detected"," Claude session",Jt.length!==1?"s":"","."]}),!Tn&&Na>0&&Kr.length>0&&l.jsxs("button",{type:"button",onClick:()=>{Ot(!0),mr(ca)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Include older (",Na,")"]}),Tn&&Kr.length>0&&l.jsx("button",{type:"button",onClick:()=>{Ot(!1),mr(ca)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsxs("div",{className:"relative",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),l.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),l.jsx("input",{type:"text",value:wa,onChange:q=>Pl(q.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),l.jsxs("p",{className:"text-[11px] text-cc-muted",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",l.jsx("span",{className:"mx-1",children:"•"}),l.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),Dt&&l.jsx("p",{className:"text-[11px] text-cc-error",children:Dt}),!ge&&!Dt&&Jt.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:xr?"No sessions match this search.":"No Claude sessions detected yet."}),Pi.length>0&&l.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[l.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[l.jsx("span",{children:"Session"}),l.jsx("span",{children:"Project"}),l.jsx("span",{children:"Branch"}),l.jsx("span",{children:"Last active"}),l.jsx("span",{className:"text-right",children:"Action"})]}),l.jsx("div",{className:"divide-y divide-cc-border/50",children:Pi.map(q=>{const de=H_(q),Xe=Cg(q.cwd),ht=q.source==="companion"?"Companion":"Claude",it=ql===q.resumeSessionId;return l.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:`text-xs truncate ${it?"text-cc-primary font-medium":"text-cc-fg"}`,children:de}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"font-mono-code text-cc-muted",children:AR(q.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:ht})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:q.cwd,children:[l.jsx("div",{className:"truncate",children:Xe}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:q.cwd,children:MR(q.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:q.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:RR(q.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{Yr(q.resumeSessionId),Pr(!0),Aa(q,!0)},"aria-label":`Fork and open ${de}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${it&&Br?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
|
|
112
|
+
${Xe}`}async function vr(){const q=e.trim();if(!(!q||Y)){if(n&&!s.trim()){T("Please enter your name before starting a session.");return}if(O(!0),T(""),In(""),Dn){const de=gr||Dn.currentBranch;if(de&&de===Dn.currentBranch){const Xe=Fl.find(ht=>ht.name===de&&!ht.isRemote);if(Xe&&Xe.behind>0){Di({behind:Xe.behind,branchName:de});return}}}await Qs(q)}}async function Qs(q,de){const Xe=X.getState();Xe.clearCreation(),Xe.setSessionCreating(!0,p);try{Il&&Cm(Il);const ht=(de==null?void 0:de.resumeSessionAt)||(ja?ql:void 0),it=ht?(de==null?void 0:de.forkSession)??(ja?Br:void 0):void 0,Fe=(de==null?void 0:de.cwd)||C,On=(de==null?void 0:de.branch)!==void 0?de.branch.trim()||void 0:gr.trim()||void 0,pn=(de==null?void 0:de.useWorktree)!==void 0?de.useWorktree:$l,yr=(de==null?void 0:de.createBranch)!==void 0?de.createBranch:!!(On&&wn),ms=await _4({model:b,permissionMode:j,effort:p==="claude"&&k?k:void 0,cwd:Fe||void 0,envSlug:ze||void 0,sandboxEnabled:bt?!0:void 0,sandboxSlug:bt&&fn?fn:void 0,branch:On,createBranch:yr?!0:void 0,useWorktree:pn?!0:void 0,backend:p,codexInternetAccess:p==="codex"?!0:void 0,resumeSessionAt:ht,forkSession:it,userName:s.trim()||void 0,linearConnectionId:z&&me||void 0,linearIssue:z?{identifier:z.identifier,title:z.title,stateName:z.stateName,teamName:z.teamName,url:z.url}:void 0},Zr=>{X.getState().addCreationProgress(Zr)}),mn=ms.sessionId,Hc=X.getState(),Yl=Hc.sdkSessions.filter(Zr=>Zr.sessionId!==mn);Hc.setSdkSessions([...Yl,{sessionId:mn,state:ms.state,cwd:ms.cwd,createdAt:Date.now(),backendType:ms.backendType||p,model:b,permissionMode:j,userName:s.trim()||void 0,resumeSessionAt:ht,forkSession:ht?it===!0:void 0}]);const Wl=new Set(X.getState().sessionNames.values()),Ui=J_(Wl),Fi=c.trim()||s.trim(),Ic=f.trim()||Ui,qc=Fi?`${Fi}_${Ic}`:Ic;X.getState().setSessionName(mn,qc),ke.renameSession(mn,qc).catch(()=>{}),h(""),Fe&&iS(Fe),X.getState().setPreviousPermissionMode(mn,j),Qg(mn,!0),Tc(mn),await WN(mn);const Vc=q.trim();if(Vc.length>0){const Zr=Ta(Vc),Gc=km(),Yc=B.length>0?B.map(Ra=>({name:Ra.name,media_type:Ra.mediaType,data:Ra.base64,size:Ra.size})):void 0;Pn(mn,{type:"user_message",content:Zr,session_id:mn,attachments:Yc,client_msg_id:Gc}),X.getState().appendMessage(mn,{id:Gc,role:"user",content:Zr,attachments:Yc,timestamp:Date.now()})}z&&(ke.linkLinearIssue(mn,z,me||void 0).then(()=>X.getState().setLinkedLinearIssue(mn,z)).catch(()=>{}),ke.transitionLinearIssue(z.id,me||void 0).catch(()=>{})),X.getState().clearCreation()}catch(ht){const it=ht instanceof Error?ht.message:String(ht);T(it),X.getState().setCreationError(it),O(!1)}}async function Aa(q,de){Y||(O(!0),T(""),In(""),L(q.cwd),Ul(!1),rr(!1),Ht(q.gitBranch||""),Yr(q.resumeSessionId),Pr(de),await Qs("",{resumeSessionAt:q.resumeSessionId,forkSession:de,cwd:q.cwd,branch:q.gitBranch,useWorktree:!1,createBranch:!1}))}async function Ks(){if(Li){Gs(!0),In("");try{const q=C||(Dn==null?void 0:Dn.repoRoot);if(!q)throw new Error("No working directory");const de=await ke.gitPull(q);if(!de.success){In(de.output||"Pull failed"),Gs(!1),O(!1);return}Di(null),Gs(!1),await Qs(e.trim())}catch(q){In(q instanceof Error?q.message:String(q)),Gs(!1)}}}function Zs(){const q=e.trim();Di(null),In(""),Qs(q)}function Uc(){Di(null),In(""),O(!1)}const Gl=S.useCallback((q,de)=>{Ht(q),rr(de)},[]),Fc=S.useCallback((q,de)=>{Ht(q),rr(de)},[]),$i=S.useCallback(q=>{pf(q)},[]),br=S.useCallback(q=>{re(q),!q&&Dn&&(Ht(Dn.currentBranch),rr(!1))},[Dn]),Ma=e.trim().length>0&&!Y&&(!n||s.trim().length>0);return l.jsxs("div",{className:"flex-1 h-full flex flex-col items-center px-3 sm:px-6 pb-6 pb-safe overflow-y-auto overscroll-y-contain",children:[l.jsx("div",{className:"shrink-0 h-[12vh] sm:h-[18vh]"}),l.jsxs("div",{className:"w-full max-w-[720px]",children:[l.jsxs("div",{className:"flex flex-col items-center mb-6 sm:mb-10",children:[l.jsx("img",{src:Vn,alt:"The Companion",className:"w-10 h-10 sm:w-12 sm:h-12 mb-3"}),l.jsxs("h1",{className:"text-xl sm:text-2xl font-semibold tracking-tight text-cc-fg flex items-baseline gap-2",children:["The Companion",l.jsx("span",{className:"text-[10px] sm:text-[11px] font-medium uppercase tracking-[0.14em] rounded-full px-2 py-0.5 bg-cc-primary/10 text-cc-primary border border-cc-primary/20","aria-label":"Moritz Edition fork",children:"Moritz Edition"})]})]}),n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-4",children:[l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Your name ",l.jsx("span",{className:"text-cc-error",children:"*"})]}),l.jsx("input",{type:"text",value:s,onChange:q=>{const de=q.target.value;a(de),localStorage.setItem("cc-user-name",de)},placeholder:"e.g. Moritz","aria-label":"Your name","aria-required":"true","aria-invalid":s.trim().length===0,className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]}),l.jsxs("label",{className:"flex-1 flex flex-col gap-1",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Session prefix ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:c,onChange:q=>{const de=q.target.value;u(de),localStorage.setItem("cc-session-prefix",de)},placeholder:"e.g. MA","aria-label":"Session prefix",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"})]})]}),l.jsxs("label",{className:"flex flex-col gap-1 mb-4",children:[l.jsxs("span",{className:"text-[11px] font-medium uppercase tracking-wide text-cc-muted",children:["Topic ",l.jsx("span",{className:"text-cc-muted/60 normal-case",children:"(optional)"})]}),l.jsx("input",{type:"text",value:f,onChange:q=>h(q.target.value),maxLength:50,placeholder:"e.g. InvoicePdf","aria-label":"Session topic",className:"w-full px-3 py-2 text-sm bg-cc-card border border-cc-border rounded-lg focus:outline-none focus:border-cc-primary text-cc-fg placeholder:text-cc-muted/70"}),l.jsxs("span",{className:"text-[10px] text-cc-muted/70 leading-snug",children:["When set, the session is named"," ",l.jsxs("span",{className:"font-mono-code",children:[c.trim()||s.trim()||"MA","_",f.trim()||"InvoicePdf"]}),"."]})]}),l.jsx("input",{ref:ve,type:"file",multiple:!0,onChange:Xs,className:"hidden","aria-label":"Attach files"}),l.jsxs("div",{className:"relative bg-cc-card border border-cc-border rounded-2xl shadow-sm",children:[l.jsx(tS,{open:Wt.mentionMenuOpen,loading:Wt.promptsLoading,prompts:Wt.filteredPrompts,selectedIndex:Wt.mentionMenuIndex,onSelect:$c,menuRef:Wt.mentionMenuRef,className:"absolute left-2 right-2 bottom-full mb-1"}),(z||B.length>0)&&l.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 flex-wrap",children:[z&&l.jsxs("div",{className:"inline-flex max-w-full items-center gap-2 rounded-md border border-cc-border bg-cc-hover/60 px-2.5 py-1.5 text-[11px] text-cc-muted",children:[l.jsx("span",{className:"shrink-0",children:"Linear"}),l.jsx("span",{className:"font-mono-code shrink-0",children:z.identifier}),l.jsx("span",{className:"truncate",children:z.title}),l.jsx("button",{type:"button",onClick:()=>br(null),className:"shrink-0 rounded px-1 text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",title:"Remove Linear issue",children:"×"})]}),B.map((q,de)=>l.jsx(V2,{name:q.name,mediaType:q.mediaType,base64:q.base64,size:q.size,onRemove:()=>gf(de),className:"w-10 h-10"},de))]}),U&&l.jsx("div",{className:"px-4 pt-2 text-[11px] text-cc-error",children:U}),l.jsx("textarea",{ref:qn,value:e,onChange:Pc,onKeyDown:xf,onClick:Ea,onKeyUp:Ea,onPaste:Bc,"aria-label":"Task description",placeholder:"Fix a bug, build a feature, refactor code...",rows:3,className:"w-full px-4 sm:px-5 pt-4 pb-2 text-[15px] sm:text-sm bg-transparent resize-none focus:outline-none text-cc-fg font-sans-ui placeholder:text-cc-muted/70 overflow-y-auto",style:{minHeight:"80px",maxHeight:"200px"}}),l.jsxs("div",{className:"flex items-center gap-1 px-2.5 sm:px-3 py-2 flex-wrap",children:[l.jsxs("div",{className:"relative",ref:Sa,children:[l.jsxs("button",{onClick:()=>fe(!W),"aria-expanded":W,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("span",{children:Bi.icon}),l.jsx("span",{children:Bi.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),W&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-48 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1",children:M.map(q=>l.jsxs("button",{onClick:()=>{_(q.value),fe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${q.value===b?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{children:q.icon}),q.label]},q.value))})]}),_e.length>0&&l.jsxs("div",{className:"relative",ref:Qr,children:[l.jsxs("button",{onClick:()=>nt(!tt),"aria-expanded":tt,"aria-label":"Reasoning effort",title:"Reasoning effort",className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 13l3.5-3.5L8 12l5.5-6.5M13.5 5.5h-2.5M13.5 5.5v2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),l.jsx("span",{children:Ur.label}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),tt&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:_e.map(q=>l.jsx("button",{onClick:()=>{A(q.value),localStorage.setItem("cc-effort",q.value),nt(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${q.value===k?"text-cc-primary font-medium":"text-cc-fg"}`,children:q.label},q.value||"default"))})]}),l.jsxs("div",{className:"relative",ref:$r,children:[l.jsxs("button",{onClick:()=>Ye(!Te),"aria-expanded":Te,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:l.jsx("path",{d:"M2 4h12M2 8h8M2 12h10",strokeLinecap:"round"})}),ka.label,l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 opacity-40",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),Te&&l.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:pe.map(q=>l.jsx("button",{onClick:()=>{E(q.value),Ye(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${q.value===j?"text-cc-primary font-medium":"text-cc-fg"}`,children:q.label},q.value))})]}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{children:[l.jsxs("button",{onClick:()=>hn(!0),className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[140px] truncate font-mono-code",children:Dc})]}),vt&&l.jsx(wR,{initialPath:C||"",onSelect:q=>{L(q)},onClose:()=>hn(!1)})]}),l.jsx(CR,{cwd:C,gitRepoInfo:Dn,selectedBranch:gr,isNewBranch:wn,useWorktree:$l,onBranchChange:Gl,onWorktreeChange:Ul,onBranchesLoaded:$i}),l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30 mx-0.5 hidden sm:block"}),l.jsxs("div",{className:"relative",ref:Hl,children:[l.jsxs("button",{onClick:()=>{et||ke.listEnvs().then(Ae).catch(()=>{}),xe(!et)},"aria-expanded":et,className:"flex items-center gap-1 px-2 py-1 text-[11px] sm:text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M8 1a2 2 0 012 2v1h2a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h2V3a2 2 0 012-2zm0 1.5a.5.5 0 00-.5.5v1h1V3a.5.5 0 00-.5-.5zM4 5.5a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h8a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5H4z"})}),l.jsx("span",{className:"max-w-[80px] sm:max-w-[100px] truncate",children:ze?((Js=Ce.find(q=>q.slug===ze))==null?void 0:Js.name)||"Env":"No env"})]}),et&&l.jsxs("div",{className:"absolute left-0 bottom-full mb-1 w-56 bg-cc-card border border-cc-border rounded-[10px] shadow-lg z-10 py-1 overflow-hidden",children:[l.jsx("button",{onClick:()=>{De(""),localStorage.setItem("cc-selected-env",""),xe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${ze?"text-cc-fg":"text-cc-primary font-medium"}`,children:"No environment"}),Ce.map(q=>l.jsxs("button",{onClick:()=>{De(q.slug),localStorage.setItem("cc-selected-env",q.slug),xe(!1)},className:`w-full px-3 py-2 text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-1 ${q.slug===ze?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate",children:q.name}),l.jsxs("span",{className:"text-cc-muted ml-auto shrink-0",children:[Object.keys(q.variables).length," var",Object.keys(q.variables).length!==1?"s":""]})]},q.slug)),l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsx("button",{onClick:()=>{ft(!0),xe(!1)},className:"w-full px-3 py-2 text-xs text-left text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Manage environments..."})})]})]}),zt,l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:()=>{var q;return(q=ve.current)==null?void 0:q.click()},className:"flex items-center justify-center w-7 h-7 rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Attach file",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M11.5 6.5L7 11a2 2 0 1 1-2.83-2.83l5-5a3.25 3.25 0 1 1 4.6 4.6l-5.7 5.7a4.5 4.5 0 0 1-6.36-6.36L7 2",strokeLinecap:"round",strokeLinejoin:"round"})})}),l.jsx("button",{onClick:vr,disabled:!Ma,className:`flex items-center justify-center w-8 h-8 sm:w-9 sm:h-9 rounded-full transition-colors ${Ma?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,title:"Send message",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M3 2l11 6-11 6V9.5l7-1.5-7-1.5V2z"})})})]})]}),l.jsxs("div",{className:"mt-3 sm:mt-4 space-y-2",children:[v.length>1&&l.jsx("div",{className:"flex items-center justify-center",children:l.jsx("div",{className:"flex items-center bg-cc-hover/50 rounded-lg p-0.5",children:v.map(q=>l.jsxs("button",{onClick:()=>q.available&&mf(q.id),disabled:!q.available,title:q.available?q.name:`${q.name} CLI not found in PATH`,className:`flex items-center gap-1 px-3 py-1.5 text-xs rounded-md transition-colors ${q.available?p===q.id?"bg-cc-card text-cc-fg font-medium shadow-sm cursor-pointer":"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/40 cursor-not-allowed"}`,children:[q.name,!q.available&&l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3 text-cc-error/60",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5.5 5.5l5 5M10.5 5.5l-5 5"})]})]},q.id))})}),p==="claude"&&l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>nr(q=>!q),className:`mx-auto flex items-center gap-1.5 px-2 py-1 text-[11px] sm:text-xs rounded-md transition-colors cursor-pointer ${Ze?"text-cc-primary":"text-cc-muted hover:text-cc-fg"}`,"aria-expanded":Ze,"aria-controls":"branch-from-session-panel",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 opacity-60",children:[l.jsx("path",{d:"M5 3.5a2 2 0 110 4 2 2 0 010-4zm6 5a2 2 0 110 4 2 2 0 010-4z"}),l.jsx("path",{d:"M7 5.5h2.5A1.5 1.5 0 0111 7v1",strokeLinecap:"round"})]}),"Branch from session",l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-3 h-3 opacity-40 transition-transform ${Ze?"rotate-180":""}`,children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l.jsx("div",{className:"accordion-panel","data-open":Ze?"true":"false",children:l.jsx("div",{className:"accordion-inner",inert:!Ze||void 0,children:l.jsxs("div",{id:"branch-from-session-panel",className:"mt-2 px-1 sm:px-2 py-2 space-y-2 rounded-xl border border-cc-border/20 bg-cc-card/30",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("button",{type:"button",onClick:()=>void Ca(),disabled:ge,className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors disabled:opacity-60 cursor-pointer",children:ge?"Refreshing...":"Refresh detected sessions"}),te.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-muted",children:["Showing ",Pi.length," of ",Jt.length," ",xr?"matching":Ws?"recent":"detected"," Claude session",Jt.length!==1?"s":"","."]}),!Tn&&Na>0&&Kr.length>0&&l.jsxs("button",{type:"button",onClick:()=>{Ot(!0),mr(ca)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Include older (",Na,")"]}),Tn&&Kr.length>0&&l.jsx("button",{type:"button",onClick:()=>{Ot(!1),mr(ca)},className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Recent only"})]}),l.jsxs("label",{className:"block",children:[l.jsx("span",{className:"sr-only",children:"Search sessions"}),l.jsxs("div",{className:"relative",children:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-muted absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none",children:[l.jsx("circle",{cx:"7",cy:"7",r:"4.25"}),l.jsx("path",{d:"M10.25 10.25L14 14",strokeLinecap:"round"})]}),l.jsx("input",{type:"text",value:wa,onChange:q=>Pl(q.target.value),placeholder:"Search sessions, branch, folder, or ID",className:"w-full bg-cc-card border border-cc-border rounded-md pl-8 pr-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 focus:border-cc-primary/40"})]})]}),l.jsxs("p",{className:"text-[11px] text-cc-muted",children:[l.jsx("span",{className:"font-medium text-cc-fg",children:"Fork"})," opens a new session that leaves the original untouched.",l.jsx("span",{className:"mx-1",children:"•"}),l.jsx("span",{className:"font-medium text-cc-fg",children:"Continue"})," opens from the same linear thread."]}),Dt&&l.jsx("p",{className:"text-[11px] text-cc-error",children:Dt}),!ge&&!Dt&&Jt.length===0&&l.jsx("p",{className:"text-[11px] text-cc-muted",children:xr?"No sessions match this search.":"No Claude sessions detected yet."}),Pi.length>0&&l.jsxs("div",{className:"rounded-md border border-cc-border overflow-hidden bg-cc-card/50",children:[l.jsxs("div",{className:"hidden sm:grid sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] px-2.5 py-1.5 border-b border-cc-border text-[10px] uppercase tracking-wider text-cc-muted",children:[l.jsx("span",{children:"Session"}),l.jsx("span",{children:"Project"}),l.jsx("span",{children:"Branch"}),l.jsx("span",{children:"Last active"}),l.jsx("span",{className:"text-right",children:"Action"})]}),l.jsx("div",{className:"divide-y divide-cc-border/50",children:Pi.map(q=>{const de=H_(q),Xe=Cg(q.cwd),ht=q.source==="companion"?"Companion":"Claude",it=ql===q.resumeSessionId;return l.jsxs("div",{className:"px-2 py-2 sm:px-2.5 sm:py-2.5 grid grid-cols-1 gap-1.5 sm:gap-2 sm:grid-cols-[minmax(0,1.5fr)_minmax(0,1.2fr)_minmax(0,0.8fr)_minmax(0,0.7fr)_auto] sm:items-center",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:`text-xs truncate ${it?"text-cc-primary font-medium":"text-cc-fg"}`,children:de}),l.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px]",children:[l.jsx("span",{className:"font-mono-code text-cc-muted",children:AR(q.resumeSessionId)}),l.jsx("span",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted",children:ht})]})]}),l.jsxs("div",{className:"min-w-0 text-[11px] text-cc-muted sm:font-mono-code truncate",title:q.cwd,children:[l.jsx("div",{className:"truncate",children:Xe}),l.jsx("div",{className:"mt-0.5 text-[10px] text-cc-muted/70 truncate",title:q.cwd,children:MR(q.cwd)})]}),l.jsx("div",{className:"text-[11px] text-cc-muted sm:font-mono-code truncate",children:q.gitBranch||"—"}),l.jsx("div",{className:"text-[11px] text-cc-muted",children:RR(q.createdAt)}),l.jsxs("div",{className:"sm:text-right flex gap-1.5 sm:justify-end",children:[l.jsx("button",{type:"button",onClick:()=>{Yr(q.resumeSessionId),Pr(!0),Aa(q,!0)},"aria-label":`Fork and open ${de}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${it&&Br?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Fork and open now
|
|
113
113
|
${q.cwd}${q.gitBranch?` (${q.gitBranch})`:""}
|
|
114
114
|
${q.resumeSessionId}`,children:"Fork"}),l.jsx("button",{type:"button",onClick:()=>{Yr(q.resumeSessionId),Pr(!1),Aa(q,!1)},"aria-label":`Continue and open ${de}`,className:`px-2 py-1 rounded-md text-[11px] border transition-colors cursor-pointer ${it&&!Br?"border-cc-primary/40 bg-cc-primary/10 text-cc-primary":"border-cc-border bg-cc-card text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:`Continue and open now
|
|
115
115
|
${q.resumeSessionId}`,children:"Continue"})]})]},`${q.resumeSessionId}-row-${q.sessionId}`)})}),Oc&&l.jsx("div",{className:"px-2.5 py-2 border-t border-cc-border bg-cc-card/40",children:l.jsxs("button",{type:"button",onClick:()=>mr(q=>Math.min(q+TR,Jt.length)),className:"px-2 py-1 rounded-md text-[11px] bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:["Load more (",Jt.length-Ln," remaining)"]})})]}),l.jsx("p",{className:"text-[11px] text-cc-muted",children:"Fork/Continue opens the session immediately, then you can type directly in chat. Send from Home still starts a normal new session with your typed prompt."})]})})})]}),P&&l.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl bg-cc-primary/5 border border-cc-primary/10 text-[11px] text-cc-muted",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-primary/60 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm6.5-.25A.75.75 0 017.25 7h1a.75.75 0 01.75.75v2.75h.25a.75.75 0 010 1.5h-2a.75.75 0 010-1.5h.25v-2h-.25a.75.75 0 01-.75-.75zM8 6a1 1 0 110-2 1 1 0 010 2z"})}),l.jsxs("span",{className:"flex-1",children:["The toolbar sets where your code lives, which model to use, and how the session runs.",p==="claude"&&l.jsxs(l.Fragment,{children:[" ",l.jsx("strong",{className:"text-cc-fg",children:"Branch from session"})," below lets you fork or continue a previous Claude session."]})]}),l.jsx("button",{onClick:()=>{Z(!1),localStorage.setItem("cc-onboarding-dismissed","true")},className:"shrink-0 w-5 h-5 flex items-center justify-center rounded text-cc-muted hover:text-cc-fg transition-colors cursor-pointer","aria-label":"Dismiss onboarding tip",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsx(NR,{cwd:C,gitRepoInfo:Dn,linearConfigured:G,selectedLinearIssue:z,onIssueSelect:br,onBranchFromIssue:Fc,onConnectionSelect:R})]}),Li&&l.jsx("div",{className:"mt-3 p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-amber-500 shrink-0 mt-0.5",children:l.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 00-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 01-1.1 0L7.1 5.995A.905.905 0 018 5zm.002 6a1 1 0 110 2 1 1 0 010-2z"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-xs text-cc-fg leading-snug",children:[l.jsx("span",{className:"font-mono-code font-medium",children:Li.branchName})," is"," ",l.jsxs("span",{className:"font-semibold text-amber-500",children:[Li.behind," commit",Li.behind!==1?"s":""," behind"]})," ","remote. Pull before starting?"]}),ps&&l.jsx("div",{className:"mt-2 px-2 py-1.5 rounded-md bg-cc-error/10 border border-cc-error/20 text-[11px] text-cc-error font-mono-code whitespace-pre-wrap",children:ps}),l.jsxs("div",{className:"flex flex-wrap gap-2 mt-2.5",children:[l.jsx("button",{onClick:Uc,disabled:Wr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Cancel"}),l.jsx("button",{onClick:Zs,disabled:Wr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-hover text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"Continue anyway"}),l.jsx("button",{onClick:Ks,disabled:Wr,className:"px-2.5 py-1 text-[11px] font-medium rounded-md bg-cc-primary/15 text-cc-primary hover:bg-cc-primary/25 transition-colors cursor-pointer flex items-center gap-1.5",children:Wr?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),"Pulling..."]}):"Pull and continue"})]})]})]})}),I&&l.jsxs("div",{className:"mt-3 flex items-center gap-2 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error shrink-0",children:l.jsx("path",{fillRule:"evenodd",d:"M8 15A7 7 0 108 1a7 7 0 000 14zm1-3a1 1 0 11-2 0 1 1 0 012 0zM7.5 5.5a.5.5 0 011 0v3a.5.5 0 01-1 0v-3z",clipRule:"evenodd"})}),l.jsx("p",{className:"text-xs text-cc-error",children:I})]})]}),Pe&&l.jsx(aS,{onClose:()=>{ft(!1),ke.listEnvs().then(Ae).catch(()=>{})}})]})}const LR=[],DR=[],OR={connected:{label:"Connected",badge:"text-cc-success bg-cc-success/10",dot:"bg-cc-success"},connecting:{label:"Connecting",badge:"text-cc-warning bg-cc-warning/10",dot:"bg-cc-warning animate-pulse"},failed:{label:"Failed",badge:"text-cc-error bg-cc-error/10",dot:"bg-cc-error"},disabled:{label:"Disabled",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"}},BR={label:"Unknown",badge:"text-cc-muted bg-cc-hover",dot:"bg-cc-muted opacity-40"};function PR({server:e,sessionId:t}){var f,h;const[n,s]=S.useState(!1),a=OR[e.status]||BR,c=e.status!=="disabled",u=((f=e.tools)==null?void 0:f.length)??0;return l.jsxs("div",{className:"rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${a.dot}`}),l.jsx("button",{onClick:()=>s(!n),className:"flex-1 min-w-0 text-left cursor-pointer",children:l.jsx("span",{className:"text-[12px] font-medium text-cc-fg truncate block",children:e.name})}),l.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${a.badge}`,children:a.label}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[l.jsx("button",{onClick:()=>XN(t,e.name,!c),className:`w-6 h-6 flex items-center justify-center rounded-md transition-colors cursor-pointer ${c?"text-cc-muted hover:text-cc-fg hover:bg-cc-hover":"text-cc-muted/50 hover:text-cc-success hover:bg-cc-success/10"}`,title:c?"Disable server":"Enable server",children:c?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M5 8h6",strokeLinecap:"round"})]}):l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.jsx("path",{d:"M8 5v6M5 8h6",strokeLinecap:"round"})]})}),(e.status==="failed"||e.status==="connected")&&l.jsx("button",{onClick:()=>QN(t,e.name),className:"w-6 h-6 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",title:"Reconnect server",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),n&&l.jsxs("div",{className:"px-2.5 pb-2.5 space-y-1.5 pt-2",children:[l.jsxs("div",{className:"text-[11px] text-cc-muted space-y-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Type:"}),l.jsx("span",{children:e.config.type})]}),e.config.command&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"Cmd:"}),l.jsxs("span",{className:"font-mono text-[10px] break-all",children:[e.config.command,(h=e.config.args)!=null&&h.length?` ${e.config.args.join(" ")}`:""]})]}),e.config.url&&l.jsxs("div",{className:"flex items-start gap-1",children:[l.jsx("span",{className:"text-cc-muted/60 shrink-0",children:"URL:"}),l.jsx("span",{className:"font-mono text-[10px] break-all",children:e.config.url})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-cc-muted/60",children:"Scope:"}),l.jsx("span",{children:e.scope})]})]}),e.error&&l.jsx("div",{className:"text-[11px] text-cc-error bg-cc-error/5 rounded px-2 py-1",children:e.error}),u>0&&l.jsxs("div",{className:"space-y-1",children:[l.jsxs("span",{className:"text-[10px] text-cc-muted uppercase tracking-wider",children:["Tools (",u,")"]}),l.jsx("div",{className:"flex flex-wrap gap-1",children:e.tools.map(p=>l.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-cc-hover text-cc-fg",title:p.annotations&&Object.entries(p.annotations).filter(([,g])=>g).map(([g])=>g).join(", ")||void 0,children:p.name},p.name))})]})]})]})}function $R({sessionId:e,onDone:t}){const[n,s]=S.useState(""),[a,c]=S.useState("stdio"),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,v]=S.useState(""),y=n.trim()&&(a==="stdio"?u.trim():g.trim());function b(_){if(_.preventDefault(),!y)return;const j={type:a};a==="stdio"?(j.command=u.trim(),h.trim()&&(j.args=h.trim().split(/\s+/))):j.url=g.trim(),KN(e,{[n.trim()]:j}),t()}return l.jsxs("form",{onSubmit:b,className:"space-y-2 p-2.5 rounded-lg border border-cc-border bg-cc-bg",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Server Name"}),l.jsx("input",{type:"text",value:n,onChange:_=>s(_.target.value),placeholder:"my-mcp-server",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Type"}),l.jsx("div",{className:"flex gap-1",children:["stdio","sse","http"].map(_=>l.jsx("button",{type:"button",onClick:()=>c(_),className:`text-[11px] px-2 py-1 rounded-md border transition-colors cursor-pointer ${a===_?"border-cc-primary text-cc-primary bg-cc-primary/10":"border-cc-border text-cc-muted hover:text-cc-fg hover:border-cc-muted"}`,children:_},_))})]}),a==="stdio"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Command"}),l.jsx("input",{type:"text",value:u,onChange:_=>f(_.target.value),placeholder:"npx -y @modelcontextprotocol/server-memory",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"Args (space-separated, optional)"}),l.jsx("input",{type:"text",value:h,onChange:_=>p(_.target.value),placeholder:"--port 3000",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]})]}),(a==="sse"||a==="http")&&l.jsxs("div",{children:[l.jsx("label",{className:"text-[10px] text-cc-muted uppercase tracking-wider block mb-0.5",children:"URL"}),l.jsx("input",{type:"text",value:g,onChange:_=>v(_.target.value),placeholder:"http://localhost:3000/mcp",className:"w-full text-[12px] bg-cc-input-bg border border-cc-border rounded px-2 py-1.5 text-cc-fg placeholder:text-cc-muted/40 font-mono focus:outline-none focus:border-cc-primary"})]}),l.jsxs("div",{className:"flex gap-1.5 pt-1",children:[l.jsx("button",{type:"submit",disabled:!y,className:`flex-1 text-[11px] font-medium py-1.5 rounded-md transition-colors ${y?"bg-cc-primary text-white hover:bg-cc-primary-hover cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:"Add Server"}),l.jsx("button",{type:"button",onClick:t,className:"text-[11px] font-medium px-3 py-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"})]})]})}function UR({sessionId:e}){const t=X(f=>f.mcpServers.get(e)||LR),n=X(f=>f.cliConnected.get(e)??!1),[s,a]=S.useState(!1),c=X(f=>{var h;return((h=f.sessions.get(e))==null?void 0:h.mcp_servers)??DR});S.useEffect(()=>{n&&Nb(e)},[e,n]);const u=t.length>0?t:c.map(f=>({name:f.name,status:f.status,config:{type:"unknown"},scope:""}));return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"shrink-0 px-4 py-2.5 flex items-center justify-between",children:[l.jsxs("span",{className:"text-[13px] font-semibold text-cc-fg flex items-center gap-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("path",{d:"M1.5 3A1.5 1.5 0 013 1.5h10A1.5 1.5 0 0114.5 3v1A1.5 1.5 0 0113 5.5H3A1.5 1.5 0 011.5 4V3zm0 5A1.5 1.5 0 013 6.5h10A1.5 1.5 0 0114.5 8v1A1.5 1.5 0 0113 10.5H3A1.5 1.5 0 011.5 9V8zm0 5A1.5 1.5 0 013 11.5h10a1.5 1.5 0 011.5 1.5v1a1.5 1.5 0 01-1.5 1.5H3A1.5 1.5 0 011.5 14v-1z"})}),"MCP Servers"]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{onClick:()=>a(!s),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Add MCP server",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})})}),l.jsx("button",{onClick:()=>Nb(e),disabled:!n,className:`text-[11px] font-medium transition-colors ${n?"text-cc-muted hover:text-cc-fg cursor-pointer":"text-cc-muted/30 cursor-not-allowed"}`,title:"Refresh MCP server status",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M2.5 8a5.5 5.5 0 019.78-3.5M13.5 8a5.5 5.5 0 01-9.78 3.5",strokeLinecap:"round"}),l.jsx("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})]}),s&&l.jsx("div",{className:"px-3 py-2",children:l.jsx($R,{sessionId:e,onDone:()=>a(!1)})}),u.length>0&&l.jsx("div",{className:"px-3 py-2 space-y-1.5",children:u.map(f=>l.jsx(PR,{server:f,sessionId:e},f.name))}),!s&&u.length===0&&l.jsx("div",{className:"px-3 py-3",children:l.jsxs("p",{className:"text-[11px] text-cc-muted text-center",children:["No MCP servers configured."," ",n&&l.jsx("button",{onClick:()=>a(!0),className:"text-cc-primary hover:underline cursor-pointer",children:"Add one"})]})})]})}function FR({cwd:e,open:t,onClose:n}){var I;const[s,a]=S.useState([]),[c,u]=S.useState(!0),[f,h]=S.useState(0),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[j,E]=S.useState(null),[k,A]=S.useState(null),C=S.useCallback(()=>{u(!0),E(null),ke.getClaudeMdFiles(e).then(T=>{a(T.files),T.files.length>0&&(h(0),g(T.files[0].content)),A(null),y(!1),u(!1)}).catch(T=>{E(T.message),u(!1)})},[e]);S.useEffect(()=>{t&&C()},[t,C]);const L=T=>{v&&!confirm("Discard unsaved changes?")||(h(T),g(s[T].content),y(!1),A(null))},B=async()=>{var le;const T=k||((le=s[f])==null?void 0:le.path);if(T){_(!0),E(null);try{await ke.saveClaudeMd(T,p),y(!1),k?C():a(Q=>Q.map((G,$)=>$===f?{...G,content:p}:G))}catch(Q){E(Q instanceof Error?Q.message:"Failed to save")}finally{_(!1)}}},D=T=>{const le=T==="root"?`${e}/CLAUDE.md`:`${e}/.claude/CLAUDE.md`;A(le),g(`# CLAUDE.md
|
|
@@ -123,7 +123,7 @@ ${q.resumeSessionId}`,children:"Continue"})]})]},`${q.resumeSessionId}-row-${q.s
|
|
|
123
123
|
`)})]}),n==="done"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("button",{type:"button",onClick:y,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Done"})})]}),n==="error"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&l.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.jsx("pre",{className:"px-3 py-2 text-[10px] font-mono-code bg-cc-code-bg rounded-lg text-cc-muted max-h-[120px] overflow-auto whitespace-pre-wrap mb-4","data-testid":"pull-progress",children:u.progress.slice(-20).join(`
|
|
124
124
|
`)}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:b,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:"Close"}),l.jsx("button",{type:"button",onClick:g,className:"px-4 py-2 min-h-[40px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Retry"})]})]})]})})}function Qz({phase:e}){return l.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:l.jsxs("div",{className:"bg-cc-bg rounded-xl shadow-xl border border-cc-border w-full max-w-sm mx-4 overflow-hidden",children:[e==="prompt"&&l.jsxs("div",{className:"p-5",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"A new version of The Companion was installed. Would you like to also update the sandbox Docker image?"}),l.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg mb-4",children:[l.jsx("span",{children:"Always update automatically"}),l.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:l.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[l.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.jsx("pre",{className:"px-2 py-1.5 text-[9px] font-mono-code bg-cc-code-bg rounded text-cc-muted max-h-[80px] overflow-auto whitespace-pre-wrap",children:`Pulling the-companion:latest...
|
|
125
125
|
Layer 1/5: abc123 downloading
|
|
126
|
-
Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const vm=["welcome","claude","codex","done"],W_='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function Eg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function jz({onComplete:e}){const[t,n]=S.useState("welcome"),[s,a]=S.useState(""),[c,u]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[j,E]=S.useState(Eg),k=S.useRef(null);S.useEffect(()=>{j||requestAnimationFrame(()=>E(!0))},[j]),S.useEffect(()=>{const I=k.current;if(!I)return;function T(Q){if(Q.key==="Escape"){Q.preventDefault();return}if(Q.key!=="Tab")return;const G=I.querySelectorAll(W_);if(G.length===0)return;const $=G[0],z=G[G.length-1];Q.shiftKey?document.activeElement===$&&(Q.preventDefault(),z.focus()):document.activeElement===z&&(Q.preventDefault(),$.focus())}document.addEventListener("keydown",T);const le=I.querySelector(W_);return le==null||le.focus(),()=>document.removeEventListener("keydown",T)},[t]);const A=S.useCallback(async()=>{if(!s.trim()){n("codex");return}h(!0),g("");try{await ke.updateSettings({claudeCodeOAuthToken:s.trim()}),y(!0),n("codex")}catch(I){g(I instanceof Error?I.message:"Failed to save token")}finally{h(!1)}},[s]),C=S.useCallback(async()=>{h(!0),g("");try{(await ke.getSettings()).codexDeviceAuthConfigured?(_(!0),await B()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(I){g(I instanceof Error?I.message:"Failed to check auth status")}finally{h(!1)}},[]),L=S.useCallback(async()=>{h(!0),g("");try{await ke.updateSettings({openaiApiKey:c.trim()}),_(!0),await B()}catch(I){g(I instanceof Error?I.message:"Failed to save API key")}finally{h(!1)}},[c]),B=S.useCallback(async()=>{try{await ke.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),D=S.useCallback(()=>{e()},[e]),U=S.useCallback(async()=>{await B(),e()},[B,e]),F=S.useCallback(I=>{g(""),n(I)},[]),Y=vm.indexOf(t),O=Eg();return Dl.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:j?1:0,transition:O?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),l.jsxs("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?1:0,transition:O?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${Y+1} of ${vm.length-1}`,children:vm.slice(0,3).map((I,T)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:T===Y?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:T<=Y?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:T<=Y?1:.5}},I))}),l.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&l.jsx(Nz,{onSetupClaude:()=>F("claude"),onSetupCodex:()=>F("codex")}),t==="claude"&&l.jsx(Cz,{token:s,onTokenChange:a,onSave:A,onSkip:()=>F("codex"),saving:f,error:p}),t==="codex"&&l.jsx(Ez,{apiKey:c,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:L,onSkip:()=>B(),onBack:()=>F("claude"),saving:f,error:p}),t==="done"&&l.jsx(Tz,{claudeConfigured:v,codexConfigured:b,onDone:D})]}),t==="welcome"&&l.jsx("button",{onClick:U,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function Nz({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function Cz({token:e,onTokenChange:t,onSave:n,onSkip:s,saving:a,error:c}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(pS,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":c?f:void 0,"aria-invalid":c?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),c&&l.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:c})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsx("button",{onClick:s,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:n,disabled:a,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function Ez({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:s,onSkip:a,onBack:c,saving:u,error:f}){const[h,p]=S.useState(!1),g="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Log in with your ChatGPT account by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(pS,{text:"codex --login"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&l.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:f})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:h?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":f?g:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:c,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:e.trim()?s:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function Tz({claudeConfigured:e,codexConfigured:t,onDone:n}){const s=!e&&!t,a=Eg(),[c,u]=S.useState(a);return S.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:s?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:s?l.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:s?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:s?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function pS({text:e}){const[t,n]=S.useState(!1),s=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:s,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const Az=S.lazy(()=>er(()=>import("./Playground-BqRkgMBH.js"),[]).then(e=>({default:e.Playground}))),Mz=S.lazy(()=>er(()=>import("./SettingsPage-DGA37UhJ.js"),[]).then(e=>({default:e.SettingsPage}))),Rz=S.lazy(()=>er(()=>import("./IntegrationsPage-CY3rD93q.js"),[]).then(e=>({default:e.IntegrationsPage}))),zz=S.lazy(()=>er(()=>import("./LinearSettingsPage-B-9ZMgYC.js"),[]).then(e=>({default:e.LinearSettingsPage}))),Lz=S.lazy(()=>er(()=>import("./LinearOAuthSettingsPage-CaNewlOp.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),Dz=S.lazy(()=>er(()=>import("./TailscalePage-L4M_MY6O.js"),[]).then(e=>({default:e.TailscalePage}))),Oz=S.lazy(()=>er(()=>import("./PromptsPage-BA_qgnJV.js"),[]).then(e=>({default:e.PromptsPage}))),Bz=S.lazy(()=>er(()=>Promise.resolve().then(()=>yR),void 0).then(e=>({default:e.EnvManager}))),Pz=S.lazy(()=>er(()=>import("./SandboxManager-eWZ5PosF.js"),[]).then(e=>({default:e.SandboxManager}))),$z=S.lazy(()=>er(()=>import("./CronManager-CLKlW4pc.js"),[]).then(e=>({default:e.CronManager}))),Uz=S.lazy(()=>er(()=>import("./AgentsPage-D1iuUiHX.js"),[]).then(e=>({default:e.AgentsPage}))),Fz=S.lazy(()=>er(()=>import("./RunsPage-CBmACxTt.js"),[]).then(e=>({default:e.RunsPage})));function Rr(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function Hz(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function Iz(){const e=X(z=>z.isAuthenticated),t=X(z=>z.darkMode),n=X(z=>z.currentSessionId),s=X(z=>z.sidebarOpen),a=X(z=>z.taskPanelOpen),c=X(z=>z.homeResetKey),u=X(z=>z.activeTab),f=X(z=>z.sessionCreating),h=X(z=>z.sessionCreatingBackend),p=X(z=>z.creationProgress),g=X(z=>z.creationError),v=X(z=>z.updateOverlayActive),y=Hz(),b=S.useMemo(()=>Xg(y),[y]),_=b.page==="settings",j=b.page==="prompts",E=b.page==="integrations",k=b.page==="integration-linear",A=b.page==="integration-linear-oauth",C=b.page==="integration-tailscale",L=b.page==="environments",B=b.page==="sandboxes",D=b.page==="scheduled",U=b.page==="agents"||b.page==="agent-detail",F=b.page==="runs",Y=b.page==="session"||b.page==="home";S.useEffect(()=>{b4(y||"#/")},[y]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const O=S.useRef(X.getState().currentSessionId);S.useEffect(()=>{if(O.current!==null&&b.page==="home"){Qg(O.current,!0),O.current=null;return}if(O.current=null,b.page==="session"){const z=X.getState();z.currentSessionId!==b.sessionId&&z.setCurrentSession(b.sessionId),Tc(b.sessionId)}else if(b.page==="home"){const z=X.getState();z.currentSessionId!==null&&z.setCurrentSession(null)}},[b]);const I=X(z=>n?z.changedFilesTick.get(n)??0:0),T=X(z=>z.diffBase),le=X(z=>z.setGitChangedFilesCount),Q=X(z=>{var re,me;return n&&(((re=z.sessions.get(n))==null?void 0:re.cwd)||((me=z.sdkSessions.find(R=>R.sessionId===n))==null?void 0:me.cwd))||null});S.useEffect(()=>{if(!n||!Q)return;let z=!1;return ke.getChangedFiles(Q,T).then(({files:re})=>{if(z)return;const me=`${Q}/`,R=re.filter(P=>P.path===Q||P.path.startsWith(me)).length;le(n,R)}).catch(()=>{}),()=>{z=!0}},[n,Q,T,I,le]),S.useEffect(()=>{const z=()=>{ke.checkForUpdate().then(me=>{X.getState().setUpdateInfo(me)}).catch(()=>{})};z();const re=setInterval(z,300*1e3);return()=>clearInterval(re)},[]),S.useEffect(()=>{const z=()=>{ke.getClaudeCompat().then(me=>{X.getState().setClaudeCompatInfo(me)}).catch(()=>{})};z();const re=setInterval(z,300*1e3);return()=>clearInterval(re)},[]);const[G,$]=S.useState(!1);return S.useEffect(()=>{e&&ke.getSettings().then(z=>{z.publicUrl&&X.getState().setPublicUrl(z.publicUrl),z.onboardingCompleted||$(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?b.page==="playground"?l.jsx(S.Suspense,{fallback:l.jsx(Rr,{}),children:l.jsx(Az,{})}):l.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[s&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>X.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
126
|
+
Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L7 8.94 5.28 7.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l4.25-4.25z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zM5.22 5.22a.75.75 0 0 1 1.06 0L8 6.94l1.72-1.72a.75.75 0 1 1 1.06 1.06L9.06 8l1.72 1.72a.75.75 0 1 1-1.06 1.06L8 9.06l-1.72 1.72a.75.75 0 0 1-1.06-1.06L6.94 8 5.22 6.28a.75.75 0 0 1 0-1.06z"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const vm=["welcome","claude","codex","done"],W_='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function Eg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function jz({onComplete:e}){const[t,n]=S.useState("welcome"),[s,a]=S.useState(""),[c,u]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState(""),[v,y]=S.useState(!1),[b,_]=S.useState(!1),[j,E]=S.useState(Eg),k=S.useRef(null);S.useEffect(()=>{j||requestAnimationFrame(()=>E(!0))},[j]),S.useEffect(()=>{const I=k.current;if(!I)return;function T(Q){if(Q.key==="Escape"){Q.preventDefault();return}if(Q.key!=="Tab")return;const G=I.querySelectorAll(W_);if(G.length===0)return;const $=G[0],z=G[G.length-1];Q.shiftKey?document.activeElement===$&&(Q.preventDefault(),z.focus()):document.activeElement===z&&(Q.preventDefault(),$.focus())}document.addEventListener("keydown",T);const le=I.querySelector(W_);return le==null||le.focus(),()=>document.removeEventListener("keydown",T)},[t]);const A=S.useCallback(async()=>{if(!s.trim()){n("codex");return}h(!0),g("");try{await ke.updateSettings({claudeCodeOAuthToken:s.trim()}),y(!0),n("codex")}catch(I){g(I instanceof Error?I.message:"Failed to save token")}finally{h(!1)}},[s]),C=S.useCallback(async()=>{h(!0),g("");try{(await ke.getSettings()).codexDeviceAuthConfigured?(_(!0),await B()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(I){g(I instanceof Error?I.message:"Failed to check auth status")}finally{h(!1)}},[]),L=S.useCallback(async()=>{h(!0),g("");try{await ke.updateSettings({openaiApiKey:c.trim()}),_(!0),await B()}catch(I){g(I instanceof Error?I.message:"Failed to save API key")}finally{h(!1)}},[c]),B=S.useCallback(async()=>{try{await ke.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),D=S.useCallback(()=>{e()},[e]),U=S.useCallback(async()=>{await B(),e()},[B,e]),F=S.useCallback(I=>{g(""),n(I)},[]),Y=vm.indexOf(t),O=Eg();return Dl.createPortal(l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"linear-gradient(145deg, var(--color-cc-bg) 0%, color-mix(in srgb, var(--color-cc-bg) 94%, var(--color-cc-primary) 6%) 100%)",opacity:j?1:0,transition:O?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"absolute top-0 left-0 right-0 h-[2px]",style:{background:"linear-gradient(90deg, transparent 0%, var(--color-cc-primary) 30%, var(--color-cc-primary) 70%, transparent 100%)",opacity:.6}}),l.jsxs("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?1:0,transition:O?"none":"transform 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms, opacity 400ms cubic-bezier(0.16, 1, 0.3, 1) 100ms"},children:[t!=="done"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${Y+1} of ${vm.length-1}`,children:vm.slice(0,3).map((I,T)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:T===Y?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:T<=Y?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:T<=Y?1:.5}},I))}),l.jsxs("div",{className:"bg-cc-card border border-cc-border overflow-hidden",style:{borderRadius:16,boxShadow:"0 1px 3px var(--color-cc-border), 0 8px 32px var(--color-cc-border)"},children:[t==="welcome"&&l.jsx(Nz,{onSetupClaude:()=>F("claude"),onSetupCodex:()=>F("codex")}),t==="claude"&&l.jsx(Cz,{token:s,onTokenChange:a,onSave:A,onSkip:()=>F("codex"),saving:f,error:p}),t==="codex"&&l.jsx(Ez,{apiKey:c,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:L,onSkip:()=>B(),onBack:()=>F("claude"),saving:f,error:p}),t==="done"&&l.jsx(Tz,{claudeConfigured:v,codexConfigured:b,onDone:D})]}),t==="welcome"&&l.jsx("button",{onClick:U,className:"w-full text-center text-xs text-cc-muted hover:text-cc-fg transition-colors mt-4 min-h-[44px] flex items-center justify-center",children:"Skip setup — I'll configure this later in Settings"})]})]}),document.body)}function Nz({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Connect your AI providers to start coding. Configure one or both."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.jsxs("button",{onClick:e,className:"provider-card--claude group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-primary/10 text-cc-primary",children:"C"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.jsxs("button",{onClick:t,className:"provider-card--codex group w-full flex items-center gap-3.5 p-3.5 min-h-[52px] rounded-xl border border-cc-border bg-cc-bg text-left transition-[transform,border-color,box-shadow] duration-150",children:[l.jsx("div",{className:"w-9 h-9 rounded-lg flex items-center justify-center flex-shrink-0 font-semibold text-sm bg-cc-codex/10 text-cc-codex",children:"X"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.jsx("svg",{className:"w-4 h-4 text-cc-muted flex-shrink-0 transition-transform duration-150 group-hover:translate-x-0.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function Cz({token:e,onTokenChange:t,onSave:n,onSkip:s,saving:a,error:c}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(pS,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.jsx("input",{ref:u,id:"claude-token",type:"password",value:e,onChange:h=>t(h.target.value),placeholder:"Paste the token from your terminal...","aria-describedby":c?f:void 0,"aria-invalid":c?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-primary focus:border-cc-primary font-mono-code transition-shadow duration-150"})]}),c&&l.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:c})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsx("button",{onClick:s,className:"flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:n,disabled:a,className:"btn-primary-aa flex-1 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function Ez({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:s,onSkip:a,onBack:c,saving:u,error:f}){const[h,p]=S.useState(!1),g="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Log in with your ChatGPT account by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(pS,{text:"codex --login"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&l.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.jsxs("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:f})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3 h-3 transition-transform duration-150",style:{transform:h?"rotate(90deg)":"rotate(0deg)"},fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:v=>t(v.target.value),placeholder:"sk-...","aria-describedby":f?g:void 0,"aria-invalid":f?!0:void 0,className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted/60 focus:outline-none focus:ring-1 focus:ring-cc-codex focus:border-cc-codex font-mono-code transition-shadow duration-150"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:c,className:"px-3 py-2.5 min-h-[44px] min-w-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,className:"px-4 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors",children:"Skip"}),l.jsx("button",{onClick:e.trim()?s:n,disabled:u,className:"btn-codex-aa px-5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background,opacity] duration-150 disabled:opacity-50",style:{boxShadow:u?"none":"0 1px 3px var(--color-cc-codex-btn)"},children:u?"Checking...":e.trim()?"Save & Finish":"I've logged in"})]})]})}function Tz({claudeConfigured:e,codexConfigured:t,onDone:n}){const s=!e&&!t,a=Eg(),[c,u]=S.useState(a);return S.useEffect(()=>{c||requestAnimationFrame(()=>u(!0))},[c]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:c?1:0,transform:c?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.jsx("div",{className:"w-14 h-14 mx-auto rounded-2xl flex items-center justify-center mb-5",style:{background:s?"var(--color-cc-hover)":"color-mix(in srgb, var(--color-cc-success) 12%, transparent)"},children:s?l.jsx("svg",{className:"w-6 h-6 text-cc-muted",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.jsx("svg",{className:"w-6 h-6 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:s?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:s?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.jsx("button",{onClick:n,className:"btn-primary-aa w-full px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium text-white transition-[background] duration-150",style:{boxShadow:"0 1px 3px var(--color-cc-primary-btn)"},children:"Get Started"})]})}function pS({text:e}){const[t,n]=S.useState(!1),s=S.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)}).catch(()=>{})},[e]);return l.jsx("button",{onClick:s,className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1 min-h-[44px] min-w-[44px] justify-end","aria-label":"Copy command",children:t?l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:"w-3 h-3 text-cc-success",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const Az=S.lazy(()=>er(()=>import("./Playground-ZMOfN3kG.js"),[]).then(e=>({default:e.Playground}))),Mz=S.lazy(()=>er(()=>import("./SettingsPage-Bc33muUi.js"),[]).then(e=>({default:e.SettingsPage}))),Rz=S.lazy(()=>er(()=>import("./IntegrationsPage-D7He8DJZ.js"),[]).then(e=>({default:e.IntegrationsPage}))),zz=S.lazy(()=>er(()=>import("./LinearSettingsPage-xYU0CnhC.js"),[]).then(e=>({default:e.LinearSettingsPage}))),Lz=S.lazy(()=>er(()=>import("./LinearOAuthSettingsPage-BhbSx1L1.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),Dz=S.lazy(()=>er(()=>import("./TailscalePage-CVXN6STS.js"),[]).then(e=>({default:e.TailscalePage}))),Oz=S.lazy(()=>er(()=>import("./PromptsPage-C-YET0qF.js"),[]).then(e=>({default:e.PromptsPage}))),Bz=S.lazy(()=>er(()=>Promise.resolve().then(()=>yR),void 0).then(e=>({default:e.EnvManager}))),Pz=S.lazy(()=>er(()=>import("./SandboxManager-DNct4A2p.js"),[]).then(e=>({default:e.SandboxManager}))),$z=S.lazy(()=>er(()=>import("./CronManager-CnSV7pph.js"),[]).then(e=>({default:e.CronManager}))),Uz=S.lazy(()=>er(()=>import("./AgentsPage-Chj3i8hp.js"),[]).then(e=>({default:e.AgentsPage}))),Fz=S.lazy(()=>er(()=>import("./RunsPage-D8p_NPsc.js"),[]).then(e=>({default:e.RunsPage})));function Rr(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function Hz(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function Iz(){const e=X(z=>z.isAuthenticated),t=X(z=>z.darkMode),n=X(z=>z.currentSessionId),s=X(z=>z.sidebarOpen),a=X(z=>z.taskPanelOpen),c=X(z=>z.homeResetKey),u=X(z=>z.activeTab),f=X(z=>z.sessionCreating),h=X(z=>z.sessionCreatingBackend),p=X(z=>z.creationProgress),g=X(z=>z.creationError),v=X(z=>z.updateOverlayActive),y=Hz(),b=S.useMemo(()=>Xg(y),[y]),_=b.page==="settings",j=b.page==="prompts",E=b.page==="integrations",k=b.page==="integration-linear",A=b.page==="integration-linear-oauth",C=b.page==="integration-tailscale",L=b.page==="environments",B=b.page==="sandboxes",D=b.page==="scheduled",U=b.page==="agents"||b.page==="agent-detail",F=b.page==="runs",Y=b.page==="session"||b.page==="home";S.useEffect(()=>{b4(y||"#/")},[y]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const O=S.useRef(X.getState().currentSessionId);S.useEffect(()=>{if(O.current!==null&&b.page==="home"){Qg(O.current,!0),O.current=null;return}if(O.current=null,b.page==="session"){const z=X.getState();z.currentSessionId!==b.sessionId&&z.setCurrentSession(b.sessionId),Tc(b.sessionId)}else if(b.page==="home"){const z=X.getState();z.currentSessionId!==null&&z.setCurrentSession(null)}},[b]);const I=X(z=>n?z.changedFilesTick.get(n)??0:0),T=X(z=>z.diffBase),le=X(z=>z.setGitChangedFilesCount),Q=X(z=>{var re,me;return n&&(((re=z.sessions.get(n))==null?void 0:re.cwd)||((me=z.sdkSessions.find(R=>R.sessionId===n))==null?void 0:me.cwd))||null});S.useEffect(()=>{if(!n||!Q)return;let z=!1;return ke.getChangedFiles(Q,T).then(({files:re})=>{if(z)return;const me=`${Q}/`,R=re.filter(P=>P.path===Q||P.path.startsWith(me)).length;le(n,R)}).catch(()=>{}),()=>{z=!0}},[n,Q,T,I,le]),S.useEffect(()=>{const z=()=>{ke.checkForUpdate().then(me=>{X.getState().setUpdateInfo(me)}).catch(()=>{})};z();const re=setInterval(z,300*1e3);return()=>clearInterval(re)},[]),S.useEffect(()=>{const z=()=>{ke.getClaudeCompat().then(me=>{X.getState().setClaudeCompatInfo(me)}).catch(()=>{})};z();const re=setInterval(z,300*1e3);return()=>clearInterval(re)},[]);const[G,$]=S.useState(!1);return S.useEffect(()=>{e&&ke.getSettings().then(z=>{z.publicUrl&&X.getState().setPublicUrl(z.publicUrl),z.onboardingCompleted||$(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?b.page==="playground"?l.jsx(S.Suspense,{fallback:l.jsx(Rr,{}),children:l.jsx(Az,{})}):l.jsxs("div",{className:"fixed inset-0 flex font-sans-ui bg-cc-bg text-cc-fg antialiased pt-safe overflow-hidden overscroll-none",children:[s&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>X.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
127
127
|
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
128
128
|
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
129
129
|
${s?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
@@ -133,4 +133,4 @@ Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",child
|
|
|
133
133
|
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
134
134
|
${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
135
135
|
overflow-hidden
|
|
136
|
-
`,children:l.jsx(pz,{sessionId:n})})]}),l.jsx(Sz,{active:v}),l.jsx(kz,{}),G&&l.jsx(jz,{onComplete:()=>$(!1)})]}):l.jsx(j4,{})}class qz extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Ai(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}v4();wj.createRoot(document.getElementById("root")).render(l.jsx(S.StrictMode,{children:l.jsx(qz,{children:l.jsx(Iz,{})})}));er(()=>import("./sw-register-
|
|
136
|
+
`,children:l.jsx(pz,{sessionId:n})})]}),l.jsx(Sz,{active:v}),l.jsx(kz,{}),G&&l.jsx(jz,{onComplete:()=>$(!1)})]}):l.jsx(j4,{})}class qz extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){Ai(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"mt-4 inline-flex items-center rounded-md bg-cc-primary px-3 py-1.5 text-sm text-white hover:bg-cc-primary-hover cursor-pointer",children:"Reload"})]})}):this.props.children}}v4();wj.createRoot(document.getElementById("root")).render(l.jsx(S.StrictMode,{children:l.jsx(qz,{children:l.jsx(Iz,{})})}));er(()=>import("./sw-register-Gj6h8GCi.js"),[]).catch(()=>{});export{rR as A,$7 as B,hR as C,Ll as D,Wz as E,wR as F,rz as G,Yz as H,pc as L,d7 as M,V7 as P,bz as S,r5 as T,vz as U,er as _,ke as a,Kp as b,Xz as c,Qz as d,b7 as e,y7 as f,x4 as g,pR as h,vR as i,l as j,ez as k,tz as l,Ci as m,Qg as n,jl as o,mc as p,FR as q,S as r,Gz as s,GR as t,X as u,Nd as v,Ec as w,Dl as x,D_ as y,eS as z};
|