critiqs-rails 0.4.0
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.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +140 -0
- data/app/assets/javascripts/critiqs/context.js +21 -0
- data/app/assets/javascripts/critiqs/element.js +657 -0
- data/lib/critiqs/rails/engine.rb +25 -0
- data/lib/critiqs/rails/helper.rb +95 -0
- data/lib/critiqs/rails/version.rb +9 -0
- data/lib/critiqs/rails.rb +13 -0
- data/lib/critiqs-rails.rb +3 -0
- data/lib/generators/critiqs/install/install_generator.rb +218 -0
- data/package.json +14 -0
- metadata +84 -0
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
var o1=Object.defineProperty;var Ov=(e,t,n)=>{for(var r in t)o1(e,r,{get:t[r],set:n[r],enumerable:!0,configurable:!0})};var Ci={};Ov(Ci,{Activity:()=>Qv,Children:()=>Kv,Component:()=>iu,Fragment:()=>su,Profiler:()=>Gv,PureComponent:()=>Yv,StrictMode:()=>Fv,Suspense:()=>Xv,ViewTransition:()=>Wv,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>rl,__COMPILER_RUNTIME:()=>Jv,addTransitionType:()=>Zv,cache:()=>ew,cacheSignal:()=>tw,cloneElement:()=>nw,createContext:()=>Nn,createElement:()=>Na,createRef:()=>rw,forwardRef:()=>ow,isValidElement:()=>aw,lazy:()=>iw,memo:()=>sw,startTransition:()=>lw,unstable_useCacheRefresh:()=>cw,use:()=>uw,useActionState:()=>dw,useCallback:()=>ge,useContext:()=>At,useDebugValue:()=>fw,useDeferredValue:()=>pw,useEffect:()=>_,useEffectEvent:()=>mw,useId:()=>ct,useImperativeHandle:()=>lu,useInsertionEffect:()=>gw,useLayoutEffect:()=>Xt,useMemo:()=>Ee,useOptimistic:()=>hw,useReducer:()=>cu,useRef:()=>O,useState:()=>S,useSyncExternalStore:()=>dn,useTransition:()=>yw,version:()=>uu},{Activity:(Zq)=>Qv=Zq,Children:(Zq)=>Kv=Zq,Component:(Zq)=>iu=Zq,Fragment:(Zq)=>su=Zq,Profiler:(Zq)=>Gv=Zq,PureComponent:(Zq)=>Yv=Zq,StrictMode:(Zq)=>Fv=Zq,Suspense:(Zq)=>Xv=Zq,ViewTransition:(Zq)=>Wv=Zq,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:(Zq)=>rl=Zq,__COMPILER_RUNTIME:(Zq)=>Jv=Zq,addTransitionType:(Zq)=>Zv=Zq,cache:(Zq)=>ew=Zq,cacheSignal:(Zq)=>tw=Zq,cloneElement:(Zq)=>nw=Zq,createContext:(Zq)=>Nn=Zq,createElement:(Zq)=>Na=Zq,createRef:(Zq)=>rw=Zq,forwardRef:(Zq)=>ow=Zq,isValidElement:(Zq)=>aw=Zq,lazy:(Zq)=>iw=Zq,memo:(Zq)=>sw=Zq,startTransition:(Zq)=>lw=Zq,unstable_useCacheRefresh:(Zq)=>cw=Zq,use:(Zq)=>uw=Zq,useActionState:(Zq)=>dw=Zq,useCallback:(Zq)=>ge=Zq,useContext:(Zq)=>At=Zq,useDebugValue:(Zq)=>fw=Zq,useDeferredValue:(Zq)=>pw=Zq,useEffect:(Zq)=>_=Zq,useEffectEvent:(Zq)=>mw=Zq,useId:(Zq)=>ct=Zq,useImperativeHandle:(Zq)=>lu=Zq,useInsertionEffect:(Zq)=>gw=Zq,useLayoutEffect:(Zq)=>Xt=Zq,useMemo:(Zq)=>Ee=Zq,useOptimistic:(Zq)=>hw=Zq,useReducer:(Zq)=>cu=Zq,useRef:(Zq)=>O=Zq,useState:(Zq)=>S=Zq,useSyncExternalStore:(Zq)=>dn=Zq,useTransition:(Zq)=>yw=Zq,version:(Zq)=>uu=Zq});var Bp=Symbol.for("react.transitional.element"),a1=Symbol.for("react.portal"),i1=Symbol.for("react.fragment"),s1=Symbol.for("react.strict_mode"),l1=Symbol.for("react.profiler"),c1=Symbol.for("react.consumer"),u1=Symbol.for("react.context"),d1=Symbol.for("react.forward_ref"),f1=Symbol.for("react.suspense"),p1=Symbol.for("react.memo"),qv=Symbol.for("react.lazy"),m1=Symbol.for("react.activity"),g1=Symbol.for("react.view_transition"),_v=Symbol.iterator;function h1(e){if(e===null||typeof e!=="object")return null;return e=_v&&e[_v]||e["@@iterator"],typeof e==="function"?e:null}var Uv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zv=Object.assign,jv={};function Si(e,t,n){this.props=e,this.context=t,this.refs=jv,this.updater=n||Uv}Si.prototype.isReactComponent={};Si.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Si.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Bv(){}Bv.prototype=Si.prototype;function $p(e,t,n){this.props=e,this.context=t,this.refs=jv,this.updater=n||Uv}var Hp=$p.prototype=new Bv;Hp.constructor=$p;zv(Hp,Si.prototype);Hp.isPureReactComponent=!0;var Pv=Array.isArray;function jp(){}var We={H:null,A:null,T:null,S:null},$v=Object.prototype.hasOwnProperty;function Vp(e,t,n){var r=n.ref;return{$$typeof:Bp,type:e,key:t,ref:r!==void 0?r:null,props:n}}function y1(e,t){return Vp(e.type,t,e.props)}function Qp(e){return typeof e==="object"&&e!==null&&e.$$typeof===Bp}function b1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Dv=/\/+/g;function zp(e,t){return typeof e==="object"&&e!==null&&e.key!=null?b1(""+e.key):t.toString(36)}function v1(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status==="string"?e.then(jp,jp):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Ti(e,t,n,r,o){var a=typeof e;if(a==="undefined"||a==="boolean")e=null;var i=!1;if(e===null)i=!0;else switch(a){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Bp:case a1:i=!0;break;case qv:return i=e._init,Ti(i(e._payload),t,n,r,o)}}if(i)return o=o(e),i=r===""?"."+zp(e,0):r,Pv(o)?(n="",i!=null&&(n=i.replace(Dv,"$&/")+"/"),Ti(o,t,n,"",function(f){return f})):o!=null&&(Qp(o)&&(o=y1(o,n+(o.key==null||e&&e.key===o.key?"":(""+o.key).replace(Dv,"$&/")+"/")+i)),t.push(o)),1;i=0;var s=r===""?".":r+":";if(Pv(e))for(var c=0;c<e.length;c++)r=e[c],a=s+zp(r,c),i+=Ti(r,t,n,a,o);else if(c=h1(e),typeof c==="function")for(e=c.call(e),c=0;!(r=e.next()).done;)r=r.value,a=s+zp(r,c++),i+=Ti(r,t,n,a,o);else if(a==="object"){if(typeof e.then==="function")return Ti(v1(e),t,n,r,o);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return i}function au(e,t,n){if(e==null)return e;var r=[],o=0;return Ti(e,r,"","",function(a){return t.call(n,a,o++)}),r}function w1(e){if(e._status===-1){var t=e._result,n=t();n.then(function(r){if(e._status===0||e._status===-1)e._status=1,e._result=r,n.status===void 0&&(n.status="fulfilled",n.value=r)},function(r){if(e._status===0||e._status===-1)e._status=2,e._result=r,n.status===void 0&&(n.status="rejected",n.reason=r)}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var Lv=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)};function Hv(e){var t=We.T,n={};n.types=t!==null?t.types:null,We.T=n;try{var r=e(),o=We.S;o!==null&&o(n,r),typeof r==="object"&&r!==null&&typeof r.then==="function"&&r.then(jp,Lv)}catch(a){Lv(a)}finally{t!==null&&n.types!==null&&(t.types=n.types),We.T=t}}function Vv(e){var t=We.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else Hv(Vv.bind(null,e))}var k1={map:au,forEach:function(e,t,n){au(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return au(e,function(){t++}),t},toArray:function(e){return au(e,function(t){return t})||[]},only:function(e){if(!Qp(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};var Qv=m1,Kv=k1,iu=Si,su=i1,Gv=l1,Yv=$p,Fv=s1,Xv=f1,Wv=g1,rl=We,Jv={__proto__:null,c:function(e){return We.H.useMemoCache(e)}},Zv=Vv,ew=function(e){return function(){return e.apply(null,arguments)}},tw=function(){return null},nw=function(e,t,n){if(e===null||e===void 0)throw Error("The argument must be a React element, but you passed "+e+".");var r=zv({},e.props),o=e.key;if(t!=null)for(a in t.key!==void 0&&(o=""+t.key),t)!$v.call(t,a)||a==="key"||a==="__self"||a==="__source"||a==="ref"&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var i=Array(a),s=0;s<a;s++)i[s]=arguments[s+2];r.children=i}return Vp(e.type,o,r)},Nn=function(e){return e={$$typeof:u1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:c1,_context:e},e},Na=function(e,t,n){var r,o={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=""+t.key),t)$v.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(o[r]=t[r]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var s=Array(i),c=0;c<i;c++)s[c]=arguments[c+2];o.children=s}if(e&&e.defaultProps)for(r in i=e.defaultProps,i)o[r]===void 0&&(o[r]=i[r]);return Vp(e,a,o)},rw=function(){return{current:null}},ow=function(e){return{$$typeof:d1,render:e}},aw=Qp,iw=function(e){return{$$typeof:qv,_payload:{_status:-1,_result:e},_init:w1}},sw=function(e,t){return{$$typeof:p1,type:e,compare:t===void 0?null:t}},lw=Hv,cw=function(){return We.H.useCacheRefresh()},uw=function(e){return We.H.use(e)},dw=function(e,t,n){return We.H.useActionState(e,t,n)},ge=function(e,t){return We.H.useCallback(e,t)},At=function(e){return We.H.useContext(e)},fw=function(){},pw=function(e,t){return We.H.useDeferredValue(e,t)},_=function(e,t){return We.H.useEffect(e,t)},mw=function(e){return We.H.useEffectEvent(e)},ct=function(){return We.H.useId()},lu=function(e,t,n){return We.H.useImperativeHandle(e,t,n)},gw=function(e,t){return We.H.useInsertionEffect(e,t)},Xt=function(e,t){return We.H.useLayoutEffect(e,t)},Ee=function(e,t){return We.H.useMemo(e,t)},hw=function(e,t){return We.H.useOptimistic(e,t)},cu=function(e,t,n){return We.H.useReducer(e,t,n)},O=function(e){return We.H.useRef(e)},S=function(e){return We.H.useState(e)},dn=function(e,t,n){return We.H.useSyncExternalStore(e,t,n)},yw=function(){return We.H.useTransition()},uu="19.3.0";function sS(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sS)}catch(e){console.error(e)}}var Aa={};Ov(Aa,{unstable_now:()=>lr,unstable_IdlePriority:()=>hu,unstable_ImmediatePriority:()=>yu,unstable_LowPriority:()=>bu,unstable_NormalPriority:()=>Ra,unstable_Profiling:()=>Sw,unstable_UserBlockingPriority:()=>vu,unstable_cancelCallback:()=>wu,unstable_forceFrameRate:()=>Cw,unstable_getCurrentPriorityLevel:()=>ku,unstable_next:()=>Ew,unstable_requestPaint:()=>xu,unstable_runWithPriority:()=>Nw,unstable_scheduleCallback:()=>Ma,unstable_shouldYield:()=>Tu,unstable_wrapCallback:()=>Aw},{unstable_now:(eU)=>lr=eU,unstable_IdlePriority:(eU)=>hu=eU,unstable_ImmediatePriority:(eU)=>yu=eU,unstable_LowPriority:(eU)=>bu=eU,unstable_NormalPriority:(eU)=>Ra=eU,unstable_Profiling:(eU)=>Sw=eU,unstable_UserBlockingPriority:(eU)=>vu=eU,unstable_cancelCallback:(eU)=>wu=eU,unstable_forceFrameRate:(eU)=>Cw=eU,unstable_getCurrentPriorityLevel:(eU)=>ku=eU,unstable_next:(eU)=>Ew=eU,unstable_requestPaint:(eU)=>xu=eU,unstable_runWithPriority:(eU)=>Nw=eU,unstable_scheduleCallback:(eU)=>Ma=eU,unstable_shouldYield:(eU)=>Tu=eU,unstable_wrapCallback:(eU)=>Aw=eU});function Gp(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(0<du(o,t))e[r]=t,e[n]=o,n=r;else break e}}function wr(e){return e.length===0?null:e[0]}function gu(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,a=o>>>1;r<a;){var i=2*(r+1)-1,s=e[i],c=i+1,f=e[c];if(0>du(s,n))c<o&&0>du(f,s)?(e[r]=f,e[c]=n,r=c):(e[r]=s,e[i]=n,r=i);else if(c<o&&0>du(f,n))e[r]=f,e[c]=n,r=c;else break e}}return t}function du(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}var lr=void 0;if(typeof performance==="object"&&typeof performance.now==="function")Yp=performance,lr=function(){return Yp.now()};else fu=Date,Fp=fu.now(),lr=function(){return fu.now()-Fp};var Yp,fu,Fp,to=[],Oo=[],x1=1,Qn=null,Wt=3,Xp=!1,ol=!1,al=!1,Jp=!1,vw=typeof setTimeout==="function"?setTimeout:null,ww=typeof clearTimeout==="function"?clearTimeout:null,bw=typeof setImmediate<"u"?setImmediate:null;function pu(e){for(var t=wr(Oo);t!==null;){if(t.callback===null)gu(Oo);else if(t.startTime<=e)gu(Oo),t.sortIndex=t.expirationTime,Gp(to,t);else break;t=wr(Oo)}}function Zp(e){if(al=!1,pu(e),!ol)if(wr(to)!==null)ol=!0,Ni||(Ni=!0,Ei());else{var t=wr(Oo);t!==null&&em(Zp,t.startTime-e)}}var Ni=!1,il=-1,kw=5,xw=-1;function Tw(){return Jp?!0:Aa.unstable_now()-xw<kw?!1:!0}function Kp(){if(Jp=!1,Ni){var e=Aa.unstable_now();xw=e;var t=!0;try{e:{ol=!1,al&&(al=!1,ww(il),il=-1),Xp=!0;var n=Wt;try{t:{pu(e);for(Qn=wr(to);Qn!==null&&!(Qn.expirationTime>e&&Tw());){var r=Qn.callback;if(typeof r==="function"){Qn.callback=null,Wt=Qn.priorityLevel;var o=r(Qn.expirationTime<=e);if(e=Aa.unstable_now(),typeof o==="function"){Qn.callback=o,pu(e),t=!0;break t}Qn===wr(to)&&gu(to),pu(e)}else gu(to);Qn=wr(to)}if(Qn!==null)t=!0;else{var a=wr(Oo);a!==null&&em(Zp,a.startTime-e),t=!1}}break e}finally{Qn=null,Wt=n,Xp=!1}t=void 0}}finally{t?Ei():Ni=!1}}}var Ei;if(typeof bw==="function")Ei=function(){bw(Kp)};else if(typeof MessageChannel<"u")mu=new MessageChannel,Wp=mu.port2,mu.port1.onmessage=Kp,Ei=function(){Wp.postMessage(null)};else Ei=function(){vw(Kp,0)};var mu,Wp;function em(e,t){il=vw(function(){e(Aa.unstable_now())},t)}var hu=5,yu=1,bu=4,Ra=3,Sw=null,vu=2,wu=function(e){e.callback=null},Cw=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):kw=0<e?Math.floor(1000/e):5},ku=function(){return Wt},Ew=function(e){switch(Wt){case 1:case 2:case 3:var t=3;break;default:t=Wt}var n=Wt;Wt=t;try{return e()}finally{Wt=n}},xu=function(){Jp=!0},Nw=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=Wt;Wt=e;try{return t()}finally{Wt=n}},Ma=function(e,t,n){var r=Aa.unstable_now();switch(typeof n==="object"&&n!==null?(n=n.delay,n=typeof n==="number"&&0<n?r+n:r):n=r,e){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5000}return o=n+o,e={id:x1++,callback:t,priorityLevel:e,startTime:n,expirationTime:o,sortIndex:-1},n>r?(e.sortIndex=n,Gp(Oo,e),wr(to)===null&&e===wr(Oo)&&(al?(ww(il),il=-1):al=!0,em(Zp,n-r))):(e.sortIndex=o,Gp(to,e),ol||Xp||(ol=!0,Ni||(Ni=!0,Ei()))),e},Tu=Tw,Aw=function(e){var t=Wt;return function(){var n=Wt;Wt=t;try{return e.apply(this,arguments)}finally{Wt=n}}};function Rw(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rw)}catch(e){console.error(e)}}function T1(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function _o(){}var S1={d:{f:_o,r:function(){throw Error(T1(522))},D:_o,C:_o,L:_o,m:_o,X:_o,S:_o,M:_o},p:0,findDOMNode:null};var tm=S1;Rw();function P(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function E1(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Xl(e){for(var t=e,n=t;n&&!n.alternate;)t=n,(t.flags&4098)!==0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function fx(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function px(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Mw(e){if(Xl(e)!==e)throw Error(P(188))}function N1(e){var t=e.alternate;if(!t){if(t=Xl(e),t===null)throw Error(P(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var a=o.alternate;if(a===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===a.child){for(a=o.child;a;){if(a===n)return Mw(o),e;if(a===r)return Mw(o),t;a=a.sibling}throw Error(P(188))}if(n.return!==r.return)n=o,r=a;else{for(var i=!1,s=o.child;s;){if(s===n){i=!0,n=o,r=a;break}if(s===r){i=!0,r=o,n=a;break}s=s.sibling}if(!i){for(s=a.child;s;){if(s===n){i=!0,n=a,r=o;break}if(s===r){i=!0,r=a,n=o;break}s=s.sibling}if(!i)throw Error(P(189))}}if(n.alternate!==r)throw Error(P(190))}if(n.tag!==3)throw Error(P(188));return n.stateNode.current===n?e:t}function mx(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=mx(e),t!==null)return t;e=e.sibling}return null}function yn(e,t,n,r,o,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,o,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&yn(e.child,t,n,r,o,a))return!0;e=e.sibling}return!1}function ei(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function Iw(e){var t=!1;for(e=e.return;e!==null;){if(e.tag===4&&(t=!0),e.tag===3||e.tag===5||e.tag===27)break;e=e.return}return t}function gx(e){var t=[null,null],n=ei(e);if(n===null)return t;return hx(t,e,n.child,{foundSelf:!1}),t}function hx(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&hx(e,t,n.child,r))return!0;n=n.sibling}return!1}function Ct(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(P(559))}}var Pi=null,Om=null;function A1(e,t,n){return e===n?!0:e===t?(Pi=e,!0):!1}function R1(e,t,n){return e===n?(Om=e,!1):e===t?(Om!==null&&(Pi=e),!0):!1}function Ow(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e?e:null}function _m(e,t,n){for(var r=0,o=e;o;o=n(o))r++;o=0;for(var a=t;a;a=n(a))o++;for(;0<r-o;)e=n(e),r--;for(;0<o-r;)t=n(t),o--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var Ye=Object.assign,M1=Symbol.for("react.element"),Su=Symbol.for("react.transitional.element"),fl=Symbol.for("react.portal"),Di=Symbol.for("react.fragment"),yx=Symbol.for("react.strict_mode"),Pm=Symbol.for("react.profiler"),bx=Symbol.for("react.consumer"),Er=Symbol.for("react.context"),Qg=Symbol.for("react.forward_ref"),Dm=Symbol.for("react.suspense"),Lm=Symbol.for("react.suspense_list"),Kg=Symbol.for("react.memo"),qo=Symbol.for("react.lazy"),qm=Symbol.for("react.activity"),I1=Symbol.for("react.legacy_hidden"),O1=Symbol.for("react.memo_cache_sentinel"),Um=Symbol.for("react.view_transition"),_1=Symbol.for("react.recoverable"),_w=Symbol.iterator;function sl(e){if(e===null||typeof e!=="object")return null;return e=_w&&e[_w]||e["@@iterator"],typeof e==="function"?e:null}var P1=Symbol.for("react.client.reference");function zm(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===P1?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case Di:return"Fragment";case Pm:return"Profiler";case yx:return"StrictMode";case Dm:return"Suspense";case Lm:return"SuspenseList";case qm:return"Activity";case Um:return"ViewTransition"}if(typeof e==="object")switch(e.$$typeof){case fl:return"Portal";case Er:return e.displayName||"Context";case bx:return(e._context.displayName||"Context")+".Consumer";case Qg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Kg:return t=e.displayName||null,t!==null?t:zm(e.type)||"Memo";case qo:t=e._payload,e=e._init;try{return zm(e(t))}catch(n){}}return null}var pl=Array.isArray,pe=rl,Le=tm,za={pending:!1,data:null,method:null,action:null},jm=[],Li=-1;function _r(e){return{current:e}}function Ht(e){0>Li||(e.current=jm[Li],jm[Li]=null,Li--)}function et(e,t){Li++,jm[Li]=e.current,e.current=t}var Mr=_r(null),Pl=_r(null),Ko=_r(null),sd=_r(null);function ld(e,t){switch(et(Ko,t),et(Pl,e),et(Mr,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)?(e=e.namespaceURI)?Qk(e):0:0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Qk(t),e=zT(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ht(Mr),et(Mr,e)}function ns(){Ht(Mr),Ht(Pl),Ht(Ko)}function Bm(e){var t=e.memoizedState;t!==null&&(fs._currentValue=t.memoizedState,et(sd,e)),t=Mr.current;var n=zT(t,e.type);t!==n&&(et(Pl,e),et(Mr,n))}function cd(e){Pl.current===e&&(Ht(Mr),Ht(Pl)),sd.current===e&&(Ht(sd),fs._currentValue=za)}var nm,Pw;function Do(e){if(nm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);nm=t&&t[1]||"",Pw=-1<n.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+nm+e+Pw}var rm=!1;function om(e,t){if(!e||rm)return"";rm=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(y){var u=y}Reflect.construct(e,[],d)}else{try{d.call()}catch(y){u=y}d=!1;try{var m=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),d=!0,new e}finally{d&&(m!==void 0?Object.defineProperty(e.prototype,"props",m):delete e.prototype.props)}}}else{try{throw Error()}catch(y){u=y}(d=e())&&typeof d.catch==="function"&&d.catch(function(){})}}catch(y){if(y&&u&&typeof y.stack==="string")return[y.stack,u.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=r.DetermineComponentFrameRoot(),i=a[0],s=a[1];if(i&&s){var c=i.split(`
|
|
4
|
+
`),f=s.split(`
|
|
5
|
+
`);for(o=r=0;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;for(;o<f.length&&!f[o].includes("DetermineComponentFrameRoot");)o++;if(r===c.length||o===f.length)for(r=c.length-1,o=f.length-1;1<=r&&0<=o&&c[r]!==f[o];)o--;for(;1<=r&&0<=o;r--,o--)if(c[r]!==f[o]){if(r!==1||o!==1)do if(r--,o--,0>o||c[r]!==f[o]){var p=`
|
|
6
|
+
`+c[r].replace(" at new "," at ");return e.displayName&&p.includes("<anonymous>")&&(p=p.replace("<anonymous>",e.displayName)),p}while(1<=r&&0<=o);break}}}finally{rm=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Do(n):""}function D1(e,t){switch(e.tag){case 26:case 27:case 5:return Do(e.type);case 16:return Do("Lazy");case 13:return e.child!==t&&t!==null?Do("Suspense Fallback"):Do("Suspense");case 19:return Do("SuspenseList");case 0:case 15:return om(e.type,!1);case 11:return om(e.type.render,!1);case 1:return om(e.type,!0);case 31:return Do("Activity");case 30:return Do("ViewTransition");default:return""}}function Dw(e){try{var t="",n=null;do t+=D1(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
|
|
7
|
+
Error generating stack: `+r.message+`
|
|
8
|
+
`+r.stack}}var $m=Object.prototype.hasOwnProperty,Gg=Ma,am=wu,L1=Tu,q1=xu,_n=lr,U1=ku,vx=yu,wx=vu,ud=Ra,z1=bu,kx=hu,j1=void 0,B1=void 0,Wl=null,Pn=null;function jo(e){if(typeof j1==="function"&&B1(e),Pn&&typeof Pn.setStrictMode==="function")try{Pn.setStrictMode(Wl,e)}catch(t){}}var Dn=Math.clz32?Math.clz32:V1,{log:$1,LN2:H1}=Math;function V1(e){return e>>>=0,e===0?32:31-($1(e)/H1|0)|0}var Cu=256,Eu=262144,Nu=4194304;function _a(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ld(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var o=0,a=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s!==0?(r=s&~a,r!==0?o=_a(r):(i&=s,i!==0?o=_a(i):n||(n=s&~e,n!==0&&(o=_a(n))))):(s=r&~a,s!==0?o=_a(s):i!==0?o=_a(i):n||(n=r&~e,n!==0&&(o=_a(n)))),o===0?0:t!==0&&t!==o&&(t&a)===0&&(a=o&-o,n=t&-t,a>=n||a===32&&(n&4194048)!==0)?t:o}function Jl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function xx(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Dn(n),o=1<<r;t|=e[r],n&=~o}return t}function Q1(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+5000;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 Tx(){var e=Nu;return Nu<<=1,(Nu&62914560)===0&&(Nu=4194304),e}function im(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qd(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function K1(e,t,n,r,o,a){var i=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var{entanglements:s,expirationTimes:c,hiddenUpdates:f}=e;for(n=i&~n;0<n;){var p=31-Dn(n),d=1<<p;s[p]=0,c[p]=-1;var u=f[p];if(u!==null)for(f[p]=null,p=0;p<u.length;p++){var m=u[p];m!==null&&(m.lane&=-536870913)}n&=~d}r!==0&&Sx(e,r,0),a!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=a&~(i&~t))}function Sx(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Dn(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Cx(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Dn(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}function Ex(e,t){var n=t&-t;return n=(n&42)!==0?1:Nx(n),(n&(e.suspendedLanes|t))!==0?0:n}function Nx(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Yg(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ax(){var e=Le.p;if(e!==0)return e;return e=window.event,e===void 0?32:aS(e.type)}function Lw(e,t){var n=Le.p;try{return Le.p=e,t()}finally{Le.p=n}}var go=Math.random().toString(36).slice(2),Bt="__reactFiber$"+go,bn="__reactProps$"+go,Zl="__reactContainer$"+go,qw="__reactEvents$"+go,G1="__reactListeners$"+go,Y1="__reactHandles$"+go,Uw="__reactResources$"+go,ec="__reactMarker$"+go,dd="__reactLoad$"+go;function Ud(e){delete e[Bt],delete e[bn],delete e[G1],delete e[Y1]}function qa(e){var t;if(t=e[Bt])return t;for(var n=e.parentNode;n;){if(t=n[Zl]||n[Bt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Zk(e);e!==null;){if(n=e[Bt])return n;e=Zk(e)}return t}e=n,n=e.parentNode}return null}function gs(e){if(e=e[Bt]||e[Zl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ml(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(P(33))}function Ki(e){var t=e[Uw];return t||(t=e[Uw]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function It(e){e[ec]=!0}function Rx(e){e[dd]=void 0}var Mx=new Set,Ix={};function ti(e,t){rs(e,t),rs(e+"Capture",t)}function rs(e,t){Ix[e]=t;for(e=0;e<t.length;e++)Mx.add(t[e])}var F1=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]*$"),zw={},jw={};function X1(e){if($m.call(jw,e))return!0;if($m.call(zw,e))return!1;if(F1.test(e))return jw[e]=!0;return zw[e]=!0,!1}var _e=!1;function Bw(){var e=_e;return _e=!1,e}function Bu(e,t,n){if(X1(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,n)}}function Au(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,n)}}function no(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Rn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ox(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function W1(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get==="function"&&typeof r.set==="function"){var{get:o,set:a}=r;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){n=""+i,a.call(this,i)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(i){n=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Hm(e){if(!e._valueTracker){var t=Ox(e)?"checked":"value";e._valueTracker=W1(e,t,""+e[t])}}function _x(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ox(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}var J1=/[\n"\\]/g;function Xn(e){return e.replace(J1,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Vm(e,t,n,r,o,a,i,s){if(e.name="",i!=null&&typeof i!=="function"&&typeof i!=="symbol"&&typeof i!=="boolean"?e.type=i:e.removeAttribute("type"),t!=null)if(i==="number"){if(t===0&&e.value===""||e.value!=t)e.value=""+Rn(t)}else e.value!==""+Rn(t)&&(e.value=""+Rn(t));else i!=="submit"&&i!=="reset"||e.removeAttribute("value");t!=null?i==="number"&&e.value==t?sm(e,Rn(e.value)):sm(e,Rn(t)):n!=null?sm(e,Rn(n)):r!=null&&e.removeAttribute("value"),o==null&&a!=null&&(e.defaultChecked=!!a),o!=null&&(e.checked=o&&typeof o!=="function"&&typeof o!=="symbol"),s!=null&&typeof s!=="function"&&typeof s!=="symbol"&&typeof s!=="boolean"?e.name=""+Rn(s):e.removeAttribute("name")}function Px(e,t,n,r,o,a,i,s){if(a!=null&&typeof a!=="function"&&typeof a!=="symbol"&&typeof a!=="boolean"&&(e.type=a),t!=null||n!=null){if(!(a!=="submit"&&a!=="reset"||t!==void 0&&t!==null)){Hm(e);return}n=n!=null?""+Rn(n):"",t=t!=null?""+Rn(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r=r!=null?r:o,r=typeof r!=="function"&&typeof r!=="symbol"&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,i!=null&&typeof i!=="function"&&typeof i!=="symbol"&&typeof i!=="boolean"&&(e.name=i),Hm(e)}function sm(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Gi(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{n=""+Rn(n),t=null;for(o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Dx(e,t,n){if(t!=null&&(t=""+Rn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Rn(n):""}function Lx(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(P(92));if(pl(r)){if(1<r.length)throw Error(P(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Rn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),Hm(e)}function os(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Z1=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 $w(e,t,n){var r=t.indexOf("--")===0;n==null||typeof n==="boolean"||n===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,n):typeof n!=="number"||n===0||Z1.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function qx(e,t,n){if(t!=null&&typeof t!=="object")throw Error(P(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="",_e=!0);for(var o in t)r=t[o],t.hasOwnProperty(o)&&n[o]!==r&&($w(e,o,r),_e=!0)}else for(var a in t)t.hasOwnProperty(a)&&$w(e,a,t[a])}function Fg(e){if(e.indexOf("-")===-1)return!1;switch(e){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 eR=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"],["maskType","mask-type"],["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"]]),tR=/^[\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 $u(e){return tR.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Nr(){}var Qm=null;function Xg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qi=null,Yi=null;function Hw(e){var t=gs(e);if(t&&(e=t.stateNode)){var n=e[bn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Vm(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;n=n.querySelectorAll('input[name="'+Xn(""+t)+'"][type="radio"]');for(t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=r[bn]||null;if(!o)throw Error(P(90));Vm(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&_x(r)}break e;case"textarea":Dx(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Gi(e,!!n.multiple,t,!1)}}}var lm=!1;function Ux(e,t,n){if(lm)return e(t,n);lm=!0;try{var r=e(t);return r}finally{if(lm=!1,qi!==null||Yi!==null){if(Jd(),qi&&(t=qi,e=Yi,Yi=qi=null,Hw(t),e))for(t=0;t<e.length;t++)Hw(e[t])}}}function Dl(e,t){var n=e.stateNode;if(n===null)return null;var r=n[bn]||null;if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!=="function")throw Error(P(231,t,typeof n));return n}var lo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Km=!1;if(lo)try{Pa={},Object.defineProperty(Pa,"passive",{get:function(){Km=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch(e){Km=!1}var Pa,Bo=null,Wg=null,Hu=null;function zx(){if(Hu)return Hu;var e,t=Wg,n=t.length,r,o="value"in Bo?Bo.value:Bo.textContent,a=o.length;for(e=0;e<n&&t[e]===o[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===o[a-r];r++);return Hu=o.slice(e,1<r?1-r:void 0)}function Vu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ru(){return!0}function Vw(){return!1}function nn(e){function t(n,r,o,a,i){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=a,this.target=i,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(n=e[s],this[s]=n?n(a):a[s]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Ru:Vw,this.isPropagationStopped=Vw,this}return Ye(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!=="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ru)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!=="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ru)},persist:function(){},isPersistent:Ru}),t}var aa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zd=nn(aa),tc=Ye({},aa,{view:0,detail:0}),nR=nn(tc),cm,um,ll,jd=Ye({},tc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jg,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){if("movementX"in e)return e.movementX;return e!==ll&&(ll&&e.type==="mousemove"?(cm=e.screenX-ll.screenX,um=e.screenY-ll.screenY):um=cm=0,ll=e),cm},movementY:function(e){return"movementY"in e?e.movementY:um}}),Qw=nn(jd),rR=Ye({},jd,{dataTransfer:0}),oR=nn(rR),aR=Ye({},tc,{relatedTarget:0}),dm=nn(aR),iR=Ye({},aa,{animationName:0,elapsedTime:0,pseudoElement:0}),sR=nn(iR),lR=Ye({},aa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),cR=nn(lR),uR=Ye({},aa,{data:0}),Kw=nn(uR),dR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},fR={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"},pR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mR(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=pR[e])?!!t[e]:!1}function Jg(){return mR}var gR=Ye({},tc,{key:function(e){if(e.key){var t=dR[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Vu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?fR[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jg,charCode:function(e){return e.type==="keypress"?Vu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Vu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),hR=nn(gR),yR=Ye({},jd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gw=nn(yR),bR=Ye({},aa,{submitter:0}),vR=nn(bR),wR=Ye({},tc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jg}),kR=nn(wR),xR=Ye({},aa,{propertyName:0,elapsedTime:0,pseudoElement:0}),TR=nn(xR),SR=Ye({},jd,{deltaX:function(e){return"deltaX"in e?e.deltaX:("wheelDeltaX"in e)?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:("wheelDeltaY"in e)?-e.wheelDeltaY:("wheelDelta"in e)?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),CR=nn(SR),ER=Ye({},aa,{newState:0,oldState:0,source:0}),NR=nn(ER),AR=[9,13,27,32],Zg=lo&&"CompositionEvent"in window,kl=null;lo&&"documentMode"in document&&(kl=document.documentMode);var RR=lo&&"TextEvent"in window&&!kl,jx=lo&&(!Zg||kl&&8<kl&&11>=kl),Yw=String.fromCharCode(32),Fw=!1;function Bx(e,t){switch(e){case"keyup":return AR.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $x(e){return e=e.detail,typeof e==="object"&&"data"in e?e.data:null}var Ui=!1;function MR(e,t){switch(e){case"compositionend":return $x(t);case"keypress":if(t.which!==32)return null;return Fw=!0,Yw;case"textInput":return e=t.data,e===Yw&&Fw?null:e;default:return null}}function IR(e,t){if(Ui)return e==="compositionend"||!Zg&&Bx(e,t)?(e=zx(),Hu=Wg=Bo=null,Ui=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return jx&&t.locale!=="ko"?null:t.data;default:return null}}var OR={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 Xw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!OR[e.type]:t==="textarea"?!0:!1}function Hx(e,t,n,r){qi?Yi?Yi.push(r):Yi=[r]:qi=r,t=_d(t,"onChange"),0<t.length&&(n=new zd("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var xl=null,Ll=null;function _R(e){DT(e,0)}function Bd(e){var t=ml(e);if(_x(t))return e}function Ww(e,t){if(e==="change")return t}var Vx=!1;if(lo){if(lo){if(hl="oninput"in document,!hl)Qu=document.createElement("div"),Qu.setAttribute("oninput","return;"),hl=typeof Qu.oninput==="function";gl=hl}else gl=!1;Vx=gl&&(!document.documentMode||9<document.documentMode)}var gl,hl,Qu;function Jw(){xl&&(xl.detachEvent("onpropertychange",Qx),Ll=xl=null)}function Qx(e){if(e.propertyName==="value"&&Bd(Ll)){var t=[];Hx(t,Ll,e,Xg(e)),Ux(_R,t)}}function PR(e,t,n){e==="focusin"?(Jw(),xl=t,Ll=n,xl.attachEvent("onpropertychange",Qx)):e==="focusout"&&Jw()}function DR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Bd(Ll)}function LR(e,t){if(e==="click")return Bd(t)}function qR(e,t){if(e==="input"||e==="change")return Bd(t)}function UR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ln=typeof Object.is==="function"?Object.is:UR;function ql(e,t){if(Ln(e,t))return!0;if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!$m.call(t,o)||!Ln(e[o],t[o]))return!1}return!0}function Gm(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Zw(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ek(e,t){var n=Zw(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Zw(n)}}function Kx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kx(e,t.parentNode):("contains"in e)?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Gx(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Gm(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==="string"}catch(r){n=!1}if(n)e=t.contentWindow;else break;t=Gm(e.document)}return t}function eh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var zR=lo&&"documentMode"in document&&11>=document.documentMode,zi=null,Ym=null,Tl=null,Fm=!1;function tk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fm||zi==null||zi!==Gm(r)||(r=zi,("selectionStart"in r)&&eh(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Tl&&ql(Tl,r)||(Tl=r,r=_d(Ym,"onSelect"),0<r.length&&(t=new zd("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=zi)))}function Ia(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ji={animationend:Ia("Animation","AnimationEnd"),animationiteration:Ia("Animation","AnimationIteration"),animationstart:Ia("Animation","AnimationStart"),transitionrun:Ia("Transition","TransitionRun"),transitionstart:Ia("Transition","TransitionStart"),transitioncancel:Ia("Transition","TransitionCancel"),transitionend:Ia("Transition","TransitionEnd")},fm={},Yx={};lo&&(Yx=document.createElement("div").style,("AnimationEvent"in window)||(delete ji.animationend.animation,delete ji.animationiteration.animation,delete ji.animationstart.animation),("TransitionEvent"in window)||delete ji.transitionend.transition);function ni(e){if(fm[e])return fm[e];if(!ji[e])return e;var t=ji[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Yx)return fm[e]=t[n];return e}var Fx=ni("animationend"),Xx=ni("animationiteration"),Wx=ni("animationstart"),jR=ni("transitionrun"),BR=ni("transitionstart"),$R=ni("transitioncancel"),Jx=ni("transitionend"),Zx=new Map,Xm="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");Xm.push("scrollEnd");function mr(e,t){Zx.set(e,t),ti(t,[e])}var HR=0;function co(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=pr.identifierPrefix;var n=HR++;return e="_"+e+"t_"+n.toString(32)+"_",t.autoName=e}function nk(e){if(e==null||typeof e==="string")return e;var t=null,n=ts;if(n!==null)for(var r=0;r<n.length;r++){var o=e[n[r]];if(o!=null){if(o==="none")return"none";t=t==null?o:t+(" "+o)}}return t==null?e.default:t}function ho(e,t){return e=nk(e),t=nk(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var fd=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)},Gn=[],Bi=0,th=0;function $d(){for(var e=Bi,t=th=Bi=0;t<e;){var n=Gn[t];Gn[t++]=null;var r=Gn[t];Gn[t++]=null;var o=Gn[t];Gn[t++]=null;var a=Gn[t];if(Gn[t++]=null,r!==null&&o!==null){var i=r.pending;i===null?o.next=o:(o.next=i.next,i.next=o),r.pending=o}a!==0&&e0(n,o,a)}}function Hd(e,t,n,r){Gn[Bi++]=e,Gn[Bi++]=t,Gn[Bi++]=n,Gn[Bi++]=r,th|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function nh(e,t,n,r){return Hd(e,t,n,r),pd(e)}function ri(e,t){return Hd(e,null,null,t),pd(e)}function e0(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var o=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(o=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,o&&t!==null&&(o=31-Dn(n),e=a.hiddenUpdates,r=e[o],r===null?e[o]=[t]:r.push(t),t.lane=n|536870912),a):null}function pd(e){if(50<_l)throw _l=0,td=null,Error(P(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $i={};function VR(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gn(e,t,n,r){return new VR(e,t,n,r)}function rh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function io(e,t){var n=e.alternate;return n===null?(n=gn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function t0(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ku(e,t,n,r,o,a){var i=0;if(r=e,typeof r==="function")rh(r)&&(i=1);else if(typeof r==="string")i=vI(e,n,Mr.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(r){case qm:return e=gn(31,n,t,o),e.elementType=qm,e.lanes=a,e;case Di:return ja(n.children,o,a,t);case yx:i=8,o|=24;break;case Pm:return e=gn(12,n,t,o|2),e.elementType=Pm,e.lanes=a,e;case Dm:return e=gn(13,n,t,o),e.elementType=Dm,e.lanes=a,e;case Lm:return e=gn(19,n,t,o),e.elementType=Lm,e.lanes=a,e;case I1:case Um:return e=o|32,e=gn(30,n,t,e),e.elementType=Um,e.lanes=a,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==="object"&&r!==null)switch(r.$$typeof){case Er:i=10;break e;case bx:i=9;break e;case Qg:i=11;break e;case Kg:i=14;break e;case qo:i=16,r=null;break e}i=29,n=Error(P(130,e===null?"null":typeof e,"")),r=null}return t=gn(i,n,t,o),t.elementType=e,t.type=r,t.lanes=a,t}function ja(e,t,n,r){return e=gn(7,e,r,t),e.lanes=n,e}function pm(e,t,n){return e=gn(6,e,null,t),e.lanes=n,e}function n0(e){var t=gn(18,null,null,0);return t.stateNode=e,t}function mm(e,t,n){return t=gn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var rk=new WeakMap;function Wn(e,t){if(typeof e==="object"&&e!==null){var n=rk.get(e);if(n!==void 0)return n;return t={value:e,source:t,stack:Dw(t)},rk.set(e,t),t}return{value:e,source:t,stack:Dw(t)}}var Hi=[],Vi=0,md=null,Ul=0,Yn=[],Fn=0,ea=null,Ar=1,Rr="";function oo(e,t){Hi[Vi++]=Ul,Hi[Vi++]=md,md=e,Ul=t}function r0(e,t,n){Yn[Fn++]=Ar,Yn[Fn++]=Rr,Yn[Fn++]=ea,ea=e;var r=Ar;e=Rr;var o=32-Dn(r)-1;r&=~(1<<o),n+=1;var a=32-Dn(t)+o;if(30<a){var i=o-o%5;a=(r&(1<<i)-1).toString(32),r>>=i,o-=i,Ar=1<<32-Dn(t)+o|n<<o|r,Rr=a+e}else Ar=1<<a|n<<o|r,Rr=e}function Vd(e){e.return!==null&&(oo(e,1),r0(e,1,0))}function oh(e){for(;e===md;)md=Hi[--Vi],Hi[Vi]=null,Ul=Hi[--Vi],Hi[Vi]=null;for(;e===ea;)ea=Yn[--Fn],Yn[Fn]=null,Rr=Yn[--Fn],Yn[Fn]=null,Ar=Yn[--Fn],Yn[Fn]=null}function o0(e,t){Yn[Fn++]=Ar,Yn[Fn++]=Rr,Yn[Fn++]=ea,Ar=t.id,Rr=t.overflow,ea=e}var Ot=null,Ze=null,ke=!1,Go=null,Jn=!1,Wm=Error(P(519));function ta(e){var t=Error(P(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zl(Wn(t,e)),Wm}function ok(e){var{stateNode:t,type:n,memoizedProps:r}=e;switch(t[Bt]=e,t[bn]=r,n){case"dialog":Ne("cancel",t),Ne("close",t);break;case"iframe":case"object":case"embed":Ne("load",t);break;case"video":case"audio":for(n=0;n<Hl.length;n++)Ne(Hl[n],t);break;case"source":Ne("error",t);break;case"img":case"image":case"link":Ne("error",t),Ne("load",t);break;case"details":Ne("toggle",t);break;case"input":Ne("invalid",t),Px(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Ne("invalid",t);break;case"textarea":Ne("invalid",t),Lx(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=="string"&&typeof n!=="number"&&typeof n!=="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||UT(t.textContent,n)?(r.popover!=null&&(Ne("beforetoggle",t),Ne("toggle",t)),r.onScroll!=null&&Ne("scroll",t),r.onScrollEnd!=null&&Ne("scrollend",t),r.onClick!=null&&(t.onclick=Nr),t=!0):t=!1,t||ta(e,!0)}function gd(e){for(Ot=e.return;Ot;)switch(Ot.tag){case 5:case 31:case 13:Jn=!1;return;case 27:case 3:Jn=!0;return;default:Ot=Ot.return}}function Ai(e){if(e!==Ot)return!1;if(!ke)return gd(e),ke=!0,!1;var t=e.tag,n;if(n=t!==3&&t!==27){if(n=t===5)n=e.type,n=!(n!=="form"&&n!=="button")||qg(e.type,e.memoizedProps);n=!n}if(n&&Ze&&ta(e),gd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(P(317));Ze=Jk(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(P(317));Ze=Jk(e)}else t===27?(t=Ze,ia(e.type)?(e=Bg,Bg=null,Ze=e):Ze=t):Ze=Ot?er(e.stateNode.nextSibling):null;return!0}function Ka(){Ze=Ot=null,ke=!1}function gm(){var e=Go;return e!==null&&(pn===null?pn=e:pn.push.apply(pn,e),Go=null),e}function zl(e){Go===null?Go=[e]:Go.push(e)}var Jm=_r(null),oi=null,ao=null;function $o(e,t,n){et(Jm,t._currentValue),t._currentValue=n}function so(e){e._currentValue=Jm.current,Ht(Jm)}function Gu(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Zm(e,t,n,r){var o=e.child;o!==null&&(o.return=e);for(;o!==null;){var a=o.dependencies;if(a!==null){var i=o.child;a=a.firstContext;e:for(;a!==null;){var s=a;a=o;for(var c=0;c<t.length;c++)if(s.context===t[c]){a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),Gu(a.return,n,e),r||(i=null);break e}a=s.next}}else if(o.tag===18){if(i=o.return,i===null)throw Error(P(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Gu(i,n,e),i=null}else o.tag===13&&o.memoizedState!==null&&o.memoizedState.dehydrated===null?(o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),Gu(o.return,n,e),i=o.child,i=i!==null?i.sibling:null):i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===e){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}}function Ga(e,t,n,r){e=null;for(var o=t,a=!1;o!==null;){if(!a){if((o.flags&524288)!==0)a=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var i=o.alternate;if(i===null)throw Error(P(387));if(i=i.memoizedProps,i!==null){var s=o.type;Ln(o.pendingProps.value,i.value)||(e!==null?e.push(s):e=[s])}}else if(o===sd.current){if(i=o.alternate,i===null)throw Error(P(387));i.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(fs):e=[fs])}o=o.return}return e!==null&&Zm(t,e,n,r),t.flags|=262144,e!==null}function hd(e){for(e=e.firstContext;e!==null;){if(!Ln(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ya(e){oi=e,ao=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function $t(e){return a0(oi,e)}function Mu(e,t){return oi===null&&Ya(e),a0(e,t)}function a0(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ao===null){if(e===null)throw Error(P(308));ao=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ao=ao.next=t;return n}var QR=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},KR=Ma,GR=Ra,yt={$$typeof:Er,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ah(){return{controller:new QR,data:new Map,refCount:0}}function nc(e){e.refCount--,e.refCount===0&&KR(GR,function(){e.controller.abort()})}function ak(e,t){if((e.pendingLanes&4194048)!==0){var n=e.transitionTypes;n===null&&(n=e.transitionTypes=[]);for(e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var yl=null;function YR(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Sl=null,eg=0,Fa=0,Fi=null;function FR(e,t){if(Sl===null){var n=Sl=[];eg=0,Fa=_h(),Fi={status:"pending",value:void 0,then:function(r){n.push(r)}}}return eg++,t.then(ik,ik),t}function ik(){if(--eg===0&&(yl=null,Sl!==null)){Fi!==null&&(Fi.status="fulfilled");var e=Sl;Sl=null,Fa=0,Fi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function XR(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(o){n.push(o)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var o=0;o<n.length;o++)(0,n[o])(t)},function(o){r.status="rejected",r.reason=o;for(o=0;o<n.length;o++)(0,n[o])(void 0)}),r}var sk=pe.S;pe.S=function(e,t){if(wT=_n(),typeof t==="object"&&t!==null&&typeof t.then==="function"&&FR(e,t),yl!==null)for(var n=cs;n!==null;)ak(n,yl),n=n.next;if(n=e.types,n!==null){for(var r=cs;r!==null;)ak(r,n),r=r.next;if(Fa!==0){r=yl,r===null&&(r=yl=[]);for(var o=0;o<n.length;o++){var a=n[o];r.indexOf(a)===-1&&r.push(a)}}}sk!==null&&sk(e,t)};var Ba=_r(null);function ih(){var e=Ba.current;return e!==null?e:Ge.pooledCache}function Yu(e,t){t===null?et(Ba,Ba.current):et(Ba,t.pool)}function i0(){var e=ih();return e===null?null:{parent:yt._currentValue,pool:e}}var hs=Error(P(460)),sh=Error(P(474)),Qd=Error(P(542)),yd={then:function(){}};function lk(e){return e=e.status,e==="fulfilled"||e==="rejected"}function s0(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Nr,Nr),t=n),t.status){case"fulfilled":return t.value;case"rejected":if(e=t.reason,uk(e),e===void 0&&!("reason"in t))throw Error(P(600));throw e;default:if(typeof t.status==="string")t.then(Nr,Nr);else{if(e=Ge,e!==null&&100<e.shellSuspendCounter)throw Error(P(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=r}},function(r){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,uk(e),e}throw $a=t,hs}}function Da(e){try{var t=e._init;return t(e._payload)}catch(n){if(n!==null&&typeof n==="object"&&typeof n.then==="function")throw $a=n,hs;throw n}}var $a=null;function ck(){if($a===null)throw Error(P(459));var e=$a;return $a=null,e}function uk(e){if(e===hs||e===Qd)throw Error(P(483))}var Xi=null,jl=0;function Iu(e){var t=jl;return jl+=1,Xi===null&&(Xi=[]),s0(Xi,e,t)}function Po(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ou(e,t){if(t.$$typeof===M1)throw Error(P(525));throw e=Object.prototype.toString.call(t),Error(P(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function l0(e){function t(k,b){if(e){var v=k.deletions;v===null?(k.deletions=[b],k.flags|=16):v.push(b)}}function n(k,b){if(!e)return null;for(;b!==null;)t(k,b),b=b.sibling;return null}function r(k){for(var b=new Map;k!==null;)k.key===null?b.set(k.index,k):b.set(k.key,k),k=k.sibling;return b}function o(k,b){return k=io(k,b),k.index=0,k.sibling=null,k}function a(k,b,v){if(k.index=v,!e)return k.flags|=1048576,b;if(v=k.alternate,v!==null)return v=v.index,v<b?(k.flags|=2,b):v;return k.flags|=134217730,b}function i(k){return e&&k.alternate===null&&(k.flags|=134217730),k}function s(k,b,v,w){if(b===null||b.tag!==6)return b=pm(v,k.mode,w),b.return=k,b;return b=o(b,v),b.return=k,b}function c(k,b,v,w){var T=v.type;if(T===Di)return k=p(k,b,v.props.children,w,v.key),Po(k,v),k;if(b!==null&&(b.elementType===T||typeof T==="object"&&T!==null&&T.$$typeof===qo&&Da(T)===b.type))return b=o(b,v.props),Po(b,v),b.return=k,b;return b=Ku(v.type,v.key,v.props,null,k.mode,w),Po(b,v),b.return=k,b}function f(k,b,v,w){if(b===null||b.tag!==4||b.stateNode.containerInfo!==v.containerInfo||b.stateNode.implementation!==v.implementation)return b=mm(v,k.mode,w),b.return=k,b;return b=o(b,v.children||[]),b.return=k,b}function p(k,b,v,w,T){if(b===null||b.tag!==7)return b=ja(v,k.mode,w,T),b.return=k,b;return b=o(b,v),b.return=k,b}function d(k,b,v){if(typeof b==="string"&&b!==""||typeof b==="number"||typeof b==="bigint")return b=pm(""+b,k.mode,v),b.return=k,b;if(typeof b==="object"&&b!==null){switch(b.$$typeof){case Su:return v=Ku(b.type,b.key,b.props,null,k.mode,v),Po(v,b),v.return=k,v;case fl:return b=mm(b,k.mode,v),b.return=k,b;case qo:return b=Da(b),d(k,b,v)}if(pl(b)||sl(b))return b=ja(b,k.mode,v,null),b.return=k,b;if(typeof b.then==="function")return d(k,Iu(b),v);if(b.$$typeof===Er)return d(k,Mu(k,b),v);Ou(k,b)}return null}function u(k,b,v,w){var T=b!==null?b.key:null;if(typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint")return T!==null?null:s(k,b,""+v,w);if(typeof v==="object"&&v!==null){switch(v.$$typeof){case Su:return v.key===T?c(k,b,v,w):null;case fl:return v.key===T?f(k,b,v,w):null;case qo:return v=Da(v),u(k,b,v,w)}if(pl(v)||sl(v))return T!==null?null:p(k,b,v,w,null);if(typeof v.then==="function")return u(k,b,Iu(v),w);if(v.$$typeof===Er)return u(k,b,Mu(k,v),w);Ou(k,v)}return null}function m(k,b,v,w,T){if(typeof w==="string"&&w!==""||typeof w==="number"||typeof w==="bigint")return k=k.get(v)||null,s(b,k,""+w,T);if(typeof w==="object"&&w!==null){switch(w.$$typeof){case Su:return k=k.get(w.key===null?v:w.key)||null,c(b,k,w,T);case fl:return k=k.get(w.key===null?v:w.key)||null,f(b,k,w,T);case qo:return w=Da(w),m(k,b,v,w,T)}if(pl(w)||sl(w))return k=k.get(v)||null,p(b,k,w,T,null);if(typeof w.then==="function")return m(k,b,v,Iu(w),T);if(w.$$typeof===Er)return m(k,b,v,Mu(b,w),T);Ou(b,w)}return null}function y(k,b,v,w){for(var T=null,C=null,E=b,A=b=0,N=null;E!==null&&A<v.length;A++){E.index>A?(N=E,E=null):N=E.sibling;var R=u(k,E,v[A],w);if(R===null){E===null&&(E=N);break}e&&E&&R.alternate===null&&t(k,E),b=a(R,b,A),C===null?T=R:C.sibling=R,C=R,E=N}if(A===v.length)return n(k,E),ke&&oo(k,A),T;if(E===null){for(;A<v.length;A++)E=d(k,v[A],w),E!==null&&(b=a(E,b,A),C===null?T=E:C.sibling=E,C=E);return ke&&oo(k,A),T}for(E=r(E);A<v.length;A++)N=m(E,k,A,v[A],w),N!==null&&(e&&(R=N.alternate,R!==null&&E.delete(R.key===null?A:R.key)),b=a(N,b,A),C===null?T=N:C.sibling=N,C=N);return e&&E.forEach(function(q){return t(k,q)}),ke&&oo(k,A),T}function g(k,b,v,w){if(v==null)throw Error(P(151));for(var T=null,C=null,E=b,A=b=0,N=null,R=v.next();E!==null&&!R.done;A++,R=v.next()){E.index>A?(N=E,E=null):N=E.sibling;var q=u(k,E,R.value,w);if(q===null){E===null&&(E=N);break}e&&E&&q.alternate===null&&t(k,E),b=a(q,b,A),C===null?T=q:C.sibling=q,C=q,E=N}if(R.done)return n(k,E),ke&&oo(k,A),T;if(E===null){for(;!R.done;A++,R=v.next())R=d(k,R.value,w),R!==null&&(b=a(R,b,A),C===null?T=R:C.sibling=R,C=R);return ke&&oo(k,A),T}for(E=r(E);!R.done;A++,R=v.next())R=m(E,k,A,R.value,w),R!==null&&(e&&(N=R.alternate,N!==null&&E.delete(N.key===null?A:N.key)),b=a(R,b,A),C===null?T=R:C.sibling=R,C=R);return e&&E.forEach(function(X){return t(k,X)}),ke&&oo(k,A),T}function x(k,b,v,w){if(typeof v==="object"&&v!==null&&v.type===Di&&v.key===null&&v.props.ref===void 0&&(v=v.props.children),typeof v==="object"&&v!==null){switch(v.$$typeof){case Su:e:{for(var T=v.key;b!==null;){if(b.key===T){if(T=v.type,T===Di){if(b.tag===7){n(k,b.sibling),w=o(b,v.props.children),Po(w,v),w.return=k,k=w;break e}}else if(b.elementType===T||typeof T==="object"&&T!==null&&T.$$typeof===qo&&Da(T)===b.type){n(k,b.sibling),w=o(b,v.props),Po(w,v),w.return=k,k=w;break e}n(k,b);break}else t(k,b);b=b.sibling}v.type===Di?(w=ja(v.props.children,k.mode,w,v.key),Po(w,v),w.return=k,k=w):(w=Ku(v.type,v.key,v.props,null,k.mode,w),Po(w,v),w.return=k,k=w)}return i(k);case fl:e:{for(T=v.key;b!==null;){if(b.key===T)if(b.tag===4&&b.stateNode.containerInfo===v.containerInfo&&b.stateNode.implementation===v.implementation){n(k,b.sibling),w=o(b,v.children||[]),w.return=k,k=w;break e}else{n(k,b);break}else t(k,b);b=b.sibling}w=mm(v,k.mode,w),w.return=k,k=w}return i(k);case qo:return v=Da(v),x(k,b,v,w)}if(pl(v))return y(k,b,v,w);if(sl(v)){if(T=sl(v),typeof T!=="function")throw Error(P(150));return v=T.call(v),g(k,b,v,w)}if(typeof v.then==="function")return x(k,b,Iu(v),w);if(v.$$typeof===Er)return x(k,b,Mu(k,v),w);Ou(k,v)}return typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint"?(v=""+v,b!==null&&b.tag===6?(n(k,b.sibling),w=o(b,v),w.return=k,k=w):(n(k,b),w=pm(v,k.mode,w),w.return=k,k=w),i(k)):n(k,b)}return function(k,b,v,w){try{jl=0;var T=x(k,b,v,w);return Xi=null,T}catch(E){if(E===hs||E===Qd)throw E;var C=gn(29,E,null,k.mode);return C.lanes=w,C.return=k,C}finally{}}}var Xa=l0(!0),c0=l0(!1),Uo=!1;function lh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function tg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ha(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(De&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=pd(e),e0(e,null,n),t}return Hd(e,r,t,n),pd(e)}function Cl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cx(e,n)}}function hm(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?o=a=i:a=a.next=i,n=n.next}while(n!==null);a===null?o=a=t:a=a.next=t}else o=a=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var ng=!1;function El(){if(ng){var e=Fi;if(e!==null)throw e}}function Nl(e,t,n,r){ng=!1;var o=e.updateQueue;Uo=!1;var{firstBaseUpdate:a,lastBaseUpdate:i}=o,s=o.shared.pending;if(s!==null){o.shared.pending=null;var c=s,f=c.next;c.next=null,i===null?a=f:i.next=f,i=c;var p=e.alternate;p!==null&&(p=p.updateQueue,s=p.lastBaseUpdate,s!==i&&(s===null?p.firstBaseUpdate=f:s.next=f,p.lastBaseUpdate=c))}if(a!==null){var d=o.baseState;i=0,p=f=c=null,s=a;do{var u=s.lane&-536870913,m=u!==s.lane;if(m?(Re&u)===u:(r&u)===u){u!==0&&u===Fa&&(ng=!0),p!==null&&(p=p.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var y=e,g=s;u=t;var x=n;switch(g.tag){case 1:if(y=g.payload,typeof y==="function"){d=y.call(x,d,u);break e}d=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=g.payload,u=typeof y==="function"?y.call(x,d,u):y,u===null||u===void 0)break e;d=Ye({},d,u);break e;case 2:Uo=!0}}u=s.callback,u!==null&&(e.flags|=64,m&&(e.flags|=8192),m=o.callbacks,m===null?o.callbacks=[u]:m.push(u))}else m={lane:u,tag:s.tag,payload:s.payload,callback:s.callback,next:null},p===null?(f=p=m,c=d):p=p.next=m,i|=u;if(s=s.next,s===null)if(s=o.shared.pending,s===null)break;else m=s,s=m.next,m.next=null,o.lastBaseUpdate=m,o.shared.pending=null}while(1);p===null&&(c=d),o.baseState=c,o.firstBaseUpdate=f,o.lastBaseUpdate=p,a===null&&(o.shared.lanes=0),oa|=i,e.lanes=i,e.memoizedState=d}}function u0(e,t){if(typeof e!=="function")throw Error(P(191,e));e.call(t)}function d0(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)u0(n[e],t)}var na=_r(null),bd=_r(0);function dk(e,t){e=mo,et(bd,e),et(na,t),mo=e|t.baseLanes}function rg(){et(bd,mo),et(na,na.current)}function ch(){mo=bd.current,Ht(na),Ht(bd)}var Kt=_r(null),Jt=null;function Yo(e){var t=e.alternate;et(Vt,Vt.current&1),et(Kt,e),Jt===null&&(t===null||na.current!==null?Jt=e:t.memoizedState!==null&&(Jt=e))}function og(e){et(Vt,Vt.current),et(Kt,e),Jt===null&&(Jt=e)}function f0(e){e.tag===22?(et(Vt,Vt.current),et(Kt,e),Jt===null&&(Jt=e)):Fo()}function Fo(){et(Vt,Vt.current),et(Kt,Kt.current)}function Mn(e){Ht(Kt),Jt===e&&(Jt=null),Ht(Vt)}var Vt=_r(0);function Bl(e,t){et(Kt,Kt.current),et(Vt,t)}function uh(e){Ht(Vt),Ht(Kt),Jt===e&&(Jt=null)}function vd(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||jg(n)||Lh(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var uo=0,ye=null,Ke=null,ht=null,wd=!1,Wi=!1,Wa=!1,kd=0,$l=0,Ji=null,WR=0;function ut(){throw Error(P(321))}function dh(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ln(e[n],t[n]))return!1;return!0}function fh(e,t,n,r,o,a){return uo=a,ye=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,pe.H=e===null||e.memoizedState===null?H0:V0,Wa=!1,a=n(r,o),Wa=!1,Wi&&(a=m0(t,n,r,o)),p0(e),a}function p0(e){pe.H=xd;var t=Ke!==null&&Ke.next!==null;if(uo=0,ht=Ke=ye=null,wd=!1,$l=0,Ji=null,t)throw Error(P(300));e===null||bt||(e=e.dependencies,e!==null&&hd(e)&&(bt=!0))}function m0(e,t,n,r){ye=e;var o=0;do{if(Wi&&(Ji=null),$l=0,Wi=!1,25<=o)throw Error(P(301));if(o+=1,ht=Ke=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}pe.H=aM,a=t(n,r)}while(Wi);return a}function JR(){var e=pe.H,t=e.useState()[0];return t=typeof t.then==="function"?rc(t):t,e=e.useState()[0],(Ke!==null?Ke.memoizedState:null)!==e&&(ye.flags|=1024),t}function ph(){var e=kd!==0;return kd=0,e}function mh(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function gh(e){if(wd){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}wd=!1}uo=0,ht=Ke=ye=null,Wi=!1,$l=kd=0,Ji=null}function tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?ye.memoizedState=ht=e:ht=ht.next=e,ht}function mt(){if(Ke===null){var e=ye.alternate;e=e!==null?e.memoizedState:null}else e=Ke.next;var t=ht===null?ye.memoizedState:ht.next;if(t!==null)ht=t,Ke=e;else{if(e===null){if(ye.alternate===null)throw Error(P(467));throw Error(P(310))}Ke=e,e={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},ht===null?ye.memoizedState=ht=e:ht=ht.next=e}return ht}function Kd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rc(e){var t=$l;return $l+=1,Ji===null&&(Ji=[]),e=s0(Ji,e,t),t=ye,(ht===null?t.memoizedState:ht.next)===null&&(t=t.alternate,pe.H=t===null||t.memoizedState===null?H0:V0),e}function Gd(e){if(e!==null&&typeof e==="object"){if(typeof e.then==="function")return rc(e);if(e.$$typeof===_1)return;if(e.$$typeof===Er)return $t(e)}throw Error(P(438,String(e)))}function hh(e){var t=null,n=ye.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=ye.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Kd(),ye.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=O1;return t.index++,n}function fo(e,t){return typeof t==="function"?t(e):t}function Fu(e){var t=mt();return yh(t,Ke,e)}function yh(e,t,n){var r=e.queue;if(r===null)throw Error(P(311));r.lastRenderedReducer=n;var o=e.baseQueue,a=r.pending;if(a!==null){if(o!==null){var i=o.next;o.next=a.next,a.next=i}t.baseQueue=o=a,r.pending=null}if(a=e.baseState,o===null)e.memoizedState=a;else{t=o.next;var s=i=null,c=null,f=t,p=!1;do{var d=f.lane&-536870913;if(d!==f.lane?(Re&d)===d:(uo&d)===d){var u=f.revertLane;if(u===0)c!==null&&(c=c.next={lane:0,revertLane:0,gesture:null,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null}),d===Fa&&(p=!0);else if((uo&u)===u){f=f.next,u===Fa&&(p=!0);continue}else d={lane:0,revertLane:f.revertLane,gesture:null,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null},c===null?(s=c=d,i=a):c=c.next=d,ye.lanes|=u,oa|=u;d=f.action,Wa&&n(a,d),a=f.hasEagerState?f.eagerState:n(a,d)}else u={lane:d,revertLane:f.revertLane,gesture:f.gesture,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null},c===null?(s=c=u,i=a):c=c.next=u,ye.lanes|=d,oa|=d;f=f.next}while(f!==null&&f!==t);if(c===null?i=a:c.next=s,!Ln(a,e.memoizedState)&&(bt=!0,p&&(n=Fi,n!==null)))throw n;e.memoizedState=a,e.baseState=i,e.baseQueue=c,r.lastRenderedState=a}return o===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ym(e){var t=mt(),n=t.queue;if(n===null)throw Error(P(311));n.lastRenderedReducer=e;var{dispatch:r,pending:o}=n,a=t.memoizedState;if(o!==null){n.pending=null;var i=o=o.next;do a=e(a,i.action),i=i.next;while(i!==o);Ln(a,t.memoizedState)||(bt=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function g0(e,t,n){var r=ye,o=mt(),a=ke;if(a){if(n===void 0)throw Error(P(407));n=n()}else n=t();var i=!Ln((Ke||o).memoizedState,n);if(i&&(o.memoizedState=n,bt=!0),o=o.queue,bh(b0.bind(null,r,o,e),[e]),e=o.getSnapshot!==t||i||ht!==null&&(ht.memoizedState.tag&1)!==0,as(e?9:8,{destroy:void 0},y0.bind(null,r,o,n,t),null),e){if(r.flags|=2048,Ge===null)throw Error(P(349));a||(uo&127)!==0||h0(r,t,n)}return n}function h0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ye.updateQueue,t===null?(t=Kd(),ye.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function y0(e,t,n,r){t.value=n,t.getSnapshot=r,v0(t)&&w0(e)}function b0(e,t,n){return n(function(){v0(t)&&w0(e)})}function v0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ln(e,n)}catch(r){return!0}}function w0(e){var t=ri(e,2);t!==null&&hn(t,e,2)}function ag(e){var t=tn();if(typeof e==="function"){var n=e;if(e=n(),Wa){jo(!0);try{n()}finally{jo(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:e},t}function k0(e,t,n,r){return e.baseState=n,yh(e,Ke,typeof r==="function"?r:fo)}function ZR(e,t,n,r,o){if(Fd(e))throw Error(P(485));if(e=t.action,e!==null){var a={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){a.listeners.push(i)}};pe.T!==null?n(!0):a.isTransition=!1,r(a),n=t.pending,n===null?(a.next=t.pending=a,x0(t,a)):(a.next=n.next,t.pending=n.next=a)}}function x0(e,t){var{action:n,payload:r}=t,o=e.state;if(t.isTransition){var a=pe.T,i={};i.types=a!==null?a.types:null,pe.T=i;try{var s=n(o,r),c=pe.S;c!==null&&c(i,s),fk(e,t,s)}catch(f){ig(e,t,f)}finally{a!==null&&i.types!==null&&(a.types=i.types),pe.T=a}}else try{a=n(o,r),fk(e,t,a)}catch(f){ig(e,t,f)}}function fk(e,t,n){n!==null&&typeof n==="object"&&typeof n.then==="function"?n.then(function(r){pk(e,t,r)},function(r){return ig(e,t,r)}):pk(e,t,n)}function pk(e,t,n){t.status="fulfilled",t.value=n,T0(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,x0(e,n)))}function ig(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,T0(t),t=t.next;while(t!==r)}e.action=null}function T0(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function S0(e,t){return t}function mk(e,t){if(ke){var n=Ge.formState;if(n!==null){e:{var r=ye;if(ke){if(Ze){t:{var o=Ze;for(var a=Jn;o.nodeType!==8;){if(!a){o=null;break t}if(o=er(o.nextSibling),o===null){o=null;break t}}a=o.data,o=a==="F!"||a==="F"?o:null}if(o){Ze=er(o.nextSibling),r=o.data==="F!";break e}}ta(r)}r=!1}r&&(t=n[0])}}return n=tn(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:S0,lastRenderedState:t},n.queue=r,n=j0.bind(null,ye,r),r.dispatch=n,r=ag(!1),a=xh.bind(null,ye,!1,r.queue),r=tn(),o={state:t,dispatch:null,action:e,pending:null},r.queue=o,n=ZR.bind(null,ye,o,a,n),o.dispatch=n,r.memoizedState=e,[t,n,!1]}function gk(e){var t=mt();return C0(t,Ke,e)}function C0(e,t,n){if(t=yh(e,t,S0)[0],e=Fu(fo)[0],typeof t==="object"&&t!==null&&typeof t.then==="function")try{var r=rc(t)}catch(i){if(i===hs)throw Qd;throw i}else r=t;t=mt();var o=t.queue,a=o.dispatch;return n!==t.memoizedState&&(ye.flags|=2048,as(9,{destroy:void 0},eM.bind(null,o,n),null)),[r,a,e]}function eM(e,t){e.action=t}function hk(e){var t=mt(),n=Ke;if(n!==null)return C0(t,n,e);mt(),t=t.memoizedState,n=mt();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function as(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=ye.updateQueue,t===null&&(t=Kd(),ye.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function E0(){return mt().memoizedState}function Xu(e,t,n,r){var o=tn();ye.flags|=e,o.memoizedState=as(1|t,{destroy:void 0},n,r===void 0?null:r)}function Yd(e,t,n,r){var o=mt();r=r===void 0?null:r;var a=o.memoizedState.inst;Ke!==null&&r!==null&&dh(r,Ke.memoizedState.deps)?o.memoizedState=as(t,a,n,r):(ye.flags|=e,o.memoizedState=as(1|t,a,n,r))}function yk(e,t){Xu(8390656,8,e,t)}function bh(e,t){Yd(2048,8,e,t)}function tM(e){ye.flags|=4;var t=ye.updateQueue;if(t===null)t=Kd(),ye.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function N0(e){var t=mt().memoizedState;return tM({ref:t,nextImpl:e}),function(){if((De&2)!==0)throw Error(P(440));return t.impl.apply(void 0,arguments)}}function A0(e,t){return Yd(4,2,e,t)}function R0(e,t){return Yd(4,4,e,t)}function M0(e,t){if(typeof t==="function"){e=e();var n=t(e);return function(){typeof n==="function"?n():t(null)}}if(t!==null&&t!==void 0)return e=e(),t.current=e,function(){t.current=null}}function I0(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,Yd(4,4,M0.bind(null,t,e),n)}function vh(){}function O0(e,t){var n=mt();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&dh(t,r[1]))return r[0];return n.memoizedState=[e,t],e}function _0(e,t){var n=mt();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&dh(t,r[1]))return r[0];if(r=e(),Wa){jo(!0);try{e()}finally{jo(!1)}}return n.memoizedState=[r,t],r}function wh(e,t,n){if(n===void 0||(uo&1073741824)!==0&&(Re&261930)===0)return e.memoizedState=t;return e.memoizedState=n,e=xT(),ye.lanes|=e,oa|=e,n}function P0(e,t,n,r){if(Ln(n,t))return n;if(na.current!==null)return e=wh(e,n,r),Ln(e,t)||(bt=!0),e;if((uo&106)===0||(uo&1073741824)!==0&&(Re&261930)===0)return bt=!0,e.memoizedState=n;return e=xT(),ye.lanes|=e,oa|=e,t}function D0(e,t,n,r,o){var a=Le.p;Le.p=a!==0&&8>a?a:8;var i=pe.T,s={};s.types=i!==null?i.types:null,pe.T=s,xh(e,!1,t,n);try{var c=o(),f=pe.S;if(f!==null&&f(s,c),c!==null&&typeof c==="object"&&typeof c.then==="function"){var p=XR(c,r);Al(e,t,p,Zn(e))}else Al(e,t,r,Zn(e))}catch(d){Al(e,t,{then:function(){},status:"rejected",reason:d},Zn())}finally{Le.p=a,i!==null&&s.types!==null&&(i.types=s.types),pe.T=i}}function nM(){}function sg(e,t,n,r){if(e.tag!==5)throw Error(P(476));var o=L0(e).queue;D0(e,o,t,za,n===null?nM:function(){return q0(e),n(r)})}function L0(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:za,baseState:za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:za},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function q0(e){var t=L0(e);t.next===null&&(t=e.alternate.memoizedState),Al(e,t.next.queue,{},Zn())}function kh(){return $t(fs)}function U0(){return mt().memoizedState}function z0(){return mt().memoizedState}function rM(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Zn();e=Ha(n);var r=Va(t,e,n);r!==null&&(hn(r,t,n),Cl(r,t,n)),t={cache:ah()},e.payload=t;return}t=t.return}}function oM(e,t,n){var r=Zn();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fd(e)?B0(t,n):(n=nh(e,t,n,r),n!==null&&(hn(n,e,r),$0(n,t,r)))}function j0(e,t,n){var r=Zn();Al(e,t,n,r)}function Al(e,t,n,r){var o={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fd(e))B0(t,o);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var i=t.lastRenderedState,s=a(i,n);if(o.hasEagerState=!0,o.eagerState=s,Ln(s,i))return Hd(e,t,o,0),Ge===null&&$d(),!1}catch(c){}finally{}if(n=nh(e,t,o,r),n!==null)return hn(n,e,r),$0(n,t,r),!0}return!1}function xh(e,t,n,r){if(r={lane:2,revertLane:_h(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Fd(e)){if(t)throw Error(P(479))}else t=nh(e,n,r,2),t!==null&&hn(t,e,2)}function Fd(e){var t=e.alternate;return e===ye||t!==null&&t===ye}function B0(e,t){Wi=wd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $0(e,t,n){if((n&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cx(e,n)}}var xd={readContext:$t,use:Gd,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useLayoutEffect:ut,useInsertionEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useSyncExternalStore:ut,useId:ut,useHostTransitionStatus:ut,useFormState:ut,useActionState:ut,useOptimistic:ut,useMemoCache:ut,useCacheRefresh:ut,useEffectEvent:ut},H0={readContext:$t,use:Gd,useCallback:function(e,t){return tn().memoizedState=[e,t===void 0?null:t],e},useContext:$t,useEffect:yk,useImperativeHandle:function(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,Xu(4194308,4,M0.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xu(4194308,4,e,t)},useInsertionEffect:function(e,t){Xu(4,2,e,t)},useMemo:function(e,t){var n=tn();t=t===void 0?null:t;var r=e();if(Wa){jo(!0);try{e()}finally{jo(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=tn();if(n!==void 0){var o=n(t);if(Wa){jo(!0);try{n(t)}finally{jo(!1)}}}else o=t;return r.memoizedState=r.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},r.queue=e,e=e.dispatch=oM.bind(null,ye,e),[r.memoizedState,e]},useRef:function(e){var t=tn();return e={current:e},t.memoizedState=e},useState:function(e){e=ag(e);var t=e.queue,n=j0.bind(null,ye,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vh,useDeferredValue:function(e,t){var n=tn();return wh(n,e,t)},useTransition:function(){var e=ag(!1);return e=D0.bind(null,ye,e.queue,!0,!1),tn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=ye,o=tn();if(ke){if(n===void 0)throw Error(P(407));n=n()}else{if(n=t(),Ge===null)throw Error(P(349));(Re&127)!==0||h0(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,yk(b0.bind(null,r,a,e),[e]),r.flags|=2048,as(9,{destroy:void 0},y0.bind(null,r,a,n,t),null),n},useId:function(){var e=tn(),t=Ge.identifierPrefix;if(ke){var n=Rr,r=Ar;n=(r&~(1<<32-Dn(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=kd++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=WR++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:kh,useFormState:mk,useActionState:mk,useOptimistic:function(e){var t=tn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=xh.bind(null,ye,!0,n),n.dispatch=t,[e,t]},useMemoCache:hh,useCacheRefresh:function(){return tn().memoizedState=rM.bind(null,ye)},useEffectEvent:function(e){var t=tn(),n={impl:e};return t.memoizedState=n,function(){if((De&2)!==0)throw Error(P(440));return n.impl.apply(void 0,arguments)}}},V0={readContext:$t,use:Gd,useCallback:O0,useContext:$t,useEffect:bh,useImperativeHandle:I0,useInsertionEffect:A0,useLayoutEffect:R0,useMemo:_0,useReducer:Fu,useRef:E0,useState:function(){return Fu(fo)},useDebugValue:vh,useDeferredValue:function(e,t){var n=mt();return P0(n,Ke.memoizedState,e,t)},useTransition:function(){var e=Fu(fo)[0],t=mt().memoizedState;return[typeof e==="boolean"?e:rc(e),t]},useSyncExternalStore:g0,useId:U0,useHostTransitionStatus:kh,useFormState:gk,useActionState:gk,useOptimistic:function(e,t){var n=mt();return k0(n,Ke,e,t)},useMemoCache:hh,useCacheRefresh:z0,useEffectEvent:N0},aM={readContext:$t,use:Gd,useCallback:O0,useContext:$t,useEffect:bh,useImperativeHandle:I0,useInsertionEffect:A0,useLayoutEffect:R0,useMemo:_0,useReducer:ym,useRef:E0,useState:function(){return ym(fo)},useDebugValue:vh,useDeferredValue:function(e,t){var n=mt();return Ke===null?wh(n,e,t):P0(n,Ke.memoizedState,e,t)},useTransition:function(){var e=ym(fo)[0],t=mt().memoizedState;return[typeof e==="boolean"?e:rc(e),t]},useSyncExternalStore:g0,useId:U0,useHostTransitionStatus:kh,useFormState:hk,useActionState:hk,useOptimistic:function(e,t){var n=mt();if(Ke!==null)return k0(n,Ke,e,t);return n.baseState=e,[e,n.queue.dispatch]},useMemoCache:hh,useCacheRefresh:z0,useEffectEvent:N0};function bm(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n===null||n===void 0?t:Ye({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var lg={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Zn(),o=Ha(r);o.payload=t,n!==void 0&&n!==null&&(o.callback=n),t=Va(e,o,r),t!==null&&(hn(t,e,r),Cl(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Zn(),o=Ha(r);o.tag=1,o.payload=t,n!==void 0&&n!==null&&(o.callback=n),t=Va(e,o,r),t!==null&&(hn(t,e,r),Cl(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Zn(),r=Ha(n);r.tag=2,t!==void 0&&t!==null&&(r.callback=t),t=Va(e,r,n),t!==null&&(hn(t,e,n),Cl(t,e,n))}};function bk(e,t,n,r,o,a,i){return e=e.stateNode,typeof e.shouldComponentUpdate==="function"?e.shouldComponentUpdate(r,a,i):t.prototype&&t.prototype.isPureReactComponent?!ql(n,r)||!ql(o,a):!0}function vk(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&lg.enqueueReplaceState(t,t.state,null)}function Ja(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=Ye({},n));for(var o in e)n[o]===void 0&&(n[o]=e[o])}return n}function iM(e){fd(e)}function sM(e){console.error(e)}function lM(e){fd(e)}function Td(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function wk(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function cg(e,t,n){return n=Ha(n),n.tag=3,n.payload={element:null},n.callback=function(){Td(e,t)},n}function Q0(e){return e=Ha(e),e.tag=3,e}function K0(e,t,n,r){var o=n.type.getDerivedStateFromError;if(typeof o==="function"){var a=r.value;e.payload=function(){return o(a)},e.callback=function(){wk(t,n,r)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch==="function"&&(e.callback=function(){wk(t,n,r),typeof o!=="function"&&(Xo===null?Xo=new Set([this]):Xo.add(this));var s=r.stack;this.componentDidCatch(r.value,{componentStack:s!==null?s:""})})}function cM(e,t,n,r,o){if(n.flags|=32768,r!==null&&typeof r==="object"&&typeof r.then==="function"){if(t=n.alternate,t!==null&&Ga(t,n,o,!0),n=Kt.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Jt===null?Id():n.alternate===null&&dt===0&&(dt=3),n.flags&=-257,n.flags|=65536,n.lanes=o,r===yd?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Cm(e,r,o)),!1;case 22:return n.flags|=65536,r===yd?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Cm(e,r,o)),!1}throw Error(P(435,n.tag))}return Cm(e,r,o),Id(),!1}if(ke)return t=Kt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==Wm&&(e=Error(P(422),{cause:r}),zl(Wn(e,n)))):(r!==Wm&&(t=Error(P(423),{cause:r}),zl(Wn(t,n))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,r=Wn(r,n),o=cg(e.stateNode,r,o),hm(e,o),dt!==4&&(dt=2)),!1;var a=Error(P(520),{cause:r});if(a=Wn(a,n),Ol===null?Ol=[a]:Ol.push(a),dt!==4&&(dt=2),t===null)return!0;r=Wn(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=o&-o,n.lanes|=e,e=cg(n.stateNode,r,e),hm(n,e),!1;case 1:if(t=n.type,a=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError==="function"||a!==null&&typeof a.componentDidCatch==="function"&&(Xo===null||!Xo.has(a))))return n.flags|=65536,o&=-o,n.lanes|=o,o=Q0(o),K0(o,e,n,r),hm(n,o),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Th=Error(P(461)),bt=!1;function St(e,t,n,r){t.child=e===null?c0(t,null,n,r):Xa(t,e.child,n,r)}function kk(e,t,n,r,o){n=n.render;var a=t.ref;if("ref"in r){var i={};for(var s in r)s!=="ref"&&(i[s]=r[s])}else i=r;if(Ya(t),r=fh(e,t,n,i,a,o),s=ph(),e!==null&&!bt)return mh(e,t,o),po(e,t,o);return ke&&s&&Vd(t),t.flags|=1,St(e,t,r,o),t.child}function xk(e,t,n,r,o){if(e===null){var a=n.type;if(typeof a==="function"&&!rh(a)&&a.defaultProps===void 0&&n.compare===null)return t.tag=15,t.type=a,G0(e,t,a,r,o);return e=Ku(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e}if(a=e.child,!Ch(e,o)){var i=a.memoizedProps;if(n=n.compare,n=n!==null?n:ql,n(i,r)&&e.ref===t.ref)return po(e,t,o)}return t.flags|=1,e=io(a,r),e.ref=t.ref,e.return=t,t.child=e}function G0(e,t,n,r,o){if(e!==null){var a=e.memoizedProps;if(ql(a,r)&&e.ref===t.ref)if(bt=!1,t.pendingProps=r=a,Ch(e,o))(e.flags&131072)!==0&&(bt=!0);else return t.lanes=e.lanes,po(e,t,o)}return ug(e,t,n,r,o)}function Y0(e,t,n,r){var o=r.children,a=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(a=a!==null?a.baseLanes|n:n,e!==null){r=t.child=e.child;for(o=0;r!==null;)o=o|r.lanes|r.childLanes,r=r.sibling;r=o&~a}else r=0,t.child=null;return Tk(e,t,a,n,r)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Yu(t,a!==null?a.cachePool:null),a!==null?dk(t,a):rg(),f0(t);else return r=t.lanes=536870912,Tk(e,t,a!==null?a.baseLanes|n:n,n,r)}else a!==null?(Yu(t,a.cachePool),dk(t,a),Fo(),t.memoizedState=null):(e!==null&&Yu(t,null),rg(),Fo());return St(e,t,o,n),t.child}function Rl(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Tk(e,t,n,r,o){var a=ih();return a=a===null?null:{parent:yt._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Yu(t,null),rg(),f0(t),e!==null&&Ga(e,t,r,!0),t.childLanes=o,null}function Wu(e,t){return t=Xd({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Sk(e,t,n){return Xa(t,e.child,null,n),e=Wu(t,t.pendingProps),e.flags|=2,Mn(t),t.memoizedState=null,e}function uM(e,t,n){var r=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(r.mode==="hidden")return e=Wu(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Rl(null,e);if(og(t),(e=Ze)?(e=FT(e,Jn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ea!==null?{id:Ar,overflow:Rr}:null,retryLane:536870912,hydrationErrors:null},n=n0(e),n.return=t,t.child=n,Ot=t,Ze=null)):e=null,e===null)throw ta(t);return t.lanes=536870912,null}return Wu(t,r)}var a=e.memoizedState;if(a!==null){var i=a.dehydrated;if(og(t),o)if(t.flags&256)t.flags&=-257,t=Sk(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(P(558));else if(bt||Ga(e,t,n,!1),o=(n&e.childLanes)!==0,bt||o){if(na.current===null){if(r=Ge,r!==null&&(i=Ex(r,n),i!==0&&i!==a.retryLane))throw a.retryLane=i,ri(e,i),hn(r,e,i),Th;Id()}t=Sk(e,t,n)}else e=a.treeContext,Ze=er(i.nextSibling),Ot=t,ke=!0,Go=null,Jn=!1,e!==null&&o0(t,e),t=Wu(t,r),t.flags|=134221824;return t}return e=io(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Mi(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=="function"&&typeof n!=="object")throw Error(P(284));if(e===null||e.ref!==n)t.flags|=4194816}}function ug(e,t,n,r,o){if(Ya(t),n=fh(e,t,n,r,void 0,o),r=ph(),e!==null&&!bt)return mh(e,t,o),po(e,t,o);return ke&&r&&Vd(t),t.flags|=1,St(e,t,n,o),t.child}function Ck(e,t,n,r,o,a){if(Ya(t),t.updateQueue=null,n=m0(t,r,n,o),p0(e),r=ph(),e!==null&&!bt)return mh(e,t,a),po(e,t,a);return ke&&r&&Vd(t),t.flags|=1,St(e,t,n,a),t.child}function Ek(e,t,n,r,o){if(Ya(t),t.stateNode===null){var a=$i,i=n.contextType;typeof i==="object"&&i!==null&&(a=$t(i)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=lg,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},lh(t),i=n.contextType,a.context=typeof i==="object"&&i!==null?$t(i):$i,a.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i==="function"&&(bm(t,n,i,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==="function"||typeof a.getSnapshotBeforeUpdate==="function"||typeof a.UNSAFE_componentWillMount!=="function"&&typeof a.componentWillMount!=="function"||(i=a.state,typeof a.componentWillMount==="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==="function"&&a.UNSAFE_componentWillMount(),i!==a.state&&lg.enqueueReplaceState(a,a.state,null),Nl(t,r,a,o),El(),a.state=t.memoizedState),typeof a.componentDidMount==="function"&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ja(n,s);a.props=c;var f=a.context,p=n.contextType;i=$i,typeof p==="object"&&p!==null&&(i=$t(p));var d=n.getDerivedStateFromProps;p=typeof d==="function"||typeof a.getSnapshotBeforeUpdate==="function",s=t.pendingProps!==s,p||typeof a.UNSAFE_componentWillReceiveProps!=="function"&&typeof a.componentWillReceiveProps!=="function"||(s||f!==i)&&vk(t,a,r,i),Uo=!1;var u=t.memoizedState;a.state=u,Nl(t,r,a,o),El(),f=t.memoizedState,s||u!==f||Uo?(typeof d==="function"&&(bm(t,n,d,r),f=t.memoizedState),(c=Uo||bk(t,n,c,r,u,f,i))?(p||typeof a.UNSAFE_componentWillMount!=="function"&&typeof a.componentWillMount!=="function"||(typeof a.componentWillMount==="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==="function"&&(t.flags|=4194308)):(typeof a.componentDidMount==="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=i,r=c):(typeof a.componentDidMount==="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,tg(e,t),i=t.memoizedProps,p=Ja(n,i),a.props=p,d=t.pendingProps,u=a.context,f=n.contextType,c=$i,typeof f==="object"&&f!==null&&(c=$t(f)),s=n.getDerivedStateFromProps,(f=typeof s==="function"||typeof a.getSnapshotBeforeUpdate==="function")||typeof a.UNSAFE_componentWillReceiveProps!=="function"&&typeof a.componentWillReceiveProps!=="function"||(i!==d||u!==c)&&vk(t,a,r,c),Uo=!1,u=t.memoizedState,a.state=u,Nl(t,r,a,o),El();var m=t.memoizedState;i!==d||u!==m||Uo||e!==null&&e.dependencies!==null&&hd(e.dependencies)?(typeof s==="function"&&(bm(t,n,s,r),m=t.memoizedState),(p=Uo||bk(t,n,p,r,u,m,c)||e!==null&&e.dependencies!==null&&hd(e.dependencies))?(f||typeof a.UNSAFE_componentWillUpdate!=="function"&&typeof a.componentWillUpdate!=="function"||(typeof a.componentWillUpdate==="function"&&a.componentWillUpdate(r,m,c),typeof a.UNSAFE_componentWillUpdate==="function"&&a.UNSAFE_componentWillUpdate(r,m,c)),typeof a.componentDidUpdate==="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!=="function"||i===e.memoizedProps&&u===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=="function"||i===e.memoizedProps&&u===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),a.props=r,a.state=m,a.context=c,r=p):(typeof a.componentDidUpdate!=="function"||i===e.memoizedProps&&u===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=="function"||i===e.memoizedProps&&u===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Mi(e,t),r=(t.flags&128)!==0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=="function"?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Xa(t,e.child,null,o),t.child=Xa(t,null,n,o)):St(e,t,n,o),t.memoizedState=a.state,e=t.child):e=po(e,t,o),e}function Nk(e,t,n,r){return Ka(),t.flags|=256,St(e,t,n,r),t.child}var dg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fg(e){return{baseLanes:e,cachePool:i0()}}function pg(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=On),e}function F0(e,t,n){var r=t.pendingProps,o=!1,a=(t.flags&128)!==0,i;if((i=a)||(i=e!==null&&e.memoizedState===null?!1:(Vt.current&2)!==0),i&&(o=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(ke){if(o?Yo(t):Fo(),(e=Ze)?(e=FT(e,Jn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ea!==null?{id:Ar,overflow:Rr}:null,retryLane:536870912,hydrationErrors:null},n=n0(e),n.return=t,t.child=n,Ot=t,Ze=null)):e=null,e===null)throw ta(t);return Lh(e)?t.lanes=32:t.lanes=536870912,null}if(a=r.children,r=r.fallback,o)return Fo(),o=t.mode,a=Xd({mode:"hidden",children:a},o),r=ja(r,o,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=fg(n),r.childLanes=pg(e,i,n),t.memoizedState=dg,Rl(null,r);return Yo(t),Sh(t,a)}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return dM(e,t,a,i,r,c,s,n)}if(o)return Fo(),o=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=io(s,{mode:"hidden",children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c!==null?o=io(c,o):(o=ja(o,a,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,Rl(null,r),r=t.child,o=e.child.memoizedState,o===null?o=fg(n):(a=o.cachePool,a!==null?(s=yt._currentValue,a=a.parent!==s?{parent:s,pool:s}:a):a=i0(),o={baseLanes:o.baseLanes|n,cachePool:a}),r.memoizedState=o,r.childLanes=pg(e,i,n),t.memoizedState=dg,Rl(e.child,r);return Yo(t),n=e.child,e=n.sibling,n=io(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=n,t.memoizedState=null,n}function Sh(e,t){return t=Xd({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Xd(e,t){return e=gn(22,e,null,t),e.lanes=0,e}function _u(e,t,n){return Xa(t,e.child,null,n),e=Sh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function dM(e,t,n,r,o,a,i,s){if(n){if(t.flags&256)return Yo(t),t.flags&=-257,_u(e,t,s);if(t.memoizedState!==null)return Fo(),t.child=e.child,t.flags|=128,null;return Fo(),a=o.fallback,i=t.mode,o=Xd({mode:"visible",children:o.children},i),a=ja(a,i,s,null),a.flags|=2,o.return=t,a.return=t,o.sibling=a,t.child=o,Xa(t,e.child,null,s),o=t.child,o.memoizedState=fg(s),o.childLanes=pg(e,r,s),t.memoizedState=dg,Rl(null,o)}if(Yo(t),Lh(a)){if(r=a.nextSibling&&a.nextSibling.dataset,r)var c=r.dgst;return r=c,r!==""&&(o=Error(P(419)),o.stack="",o.digest=r,zl({value:o,source:null,stack:null})),_u(e,t,s)}if(bt||Ga(e,t,s,!1),r=(s&e.childLanes)!==0,bt||r){if(na.current!==null)return _u(e,t,s);if(r=Ge,r!==null&&(o=Ex(r,s),o!==0&&o!==i.retryLane))throw i.retryLane=o,ri(e,o),hn(r,e,o),Th;return jg(a)||Id(),_u(e,t,s)}if(jg(a))return t.flags|=192,t.child=e.child,null;return e=i.treeContext,Ze=er(a.nextSibling),Ot=t,ke=!0,Go=null,Jn=!1,e!==null&&o0(t,e),t=Sh(t,o.children),t.flags|=134221824,t}function Ak(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gu(e.return,t,n)}function Rk(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&vd(n)===null&&(t=e),e=e.sibling}return t}function Pu(e,t,n,r,o,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o,treeForkCount:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o,i.treeForkCount=a)}function vm(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function mg(e,t,n){var r=t.pendingProps,o=r.revealOrder,a=r.tail;r=r.children;var i=Vt.current;if(t.flags&128)return Bl(t,i),null;var s=(i&2)!==0;if(s?(i=i&1|2,t.flags|=128):i&=1,Bl(t,i),o==="backwards"&&e!==null?(vm(e),St(e,t,r,n),vm(e)):St(e,t,r,n),r=ke?Ul:0,!s&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ak(e,n,t);else if(e.tag===19)Ak(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"backwards":n=Rk(t.child),n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null,vm(t)),Pu(t,!0,o,null,a,r);break;case"unstable_legacy-backwards":n=null,o=t.child;for(t.child=null;o!==null;){if(e=o.alternate,e!==null&&vd(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Pu(t,!0,n,null,a,r);break;case"together":Pu(t,!1,null,null,void 0,r);break;case"independent":t.memoizedState=null;break;default:n=Rk(t.child),n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Pu(t,!1,o,n,a,r)}return t.child}function Mk(e,t,n){var r=t.pendingProps;return $o(t,t.type,r.value),St(e,t,r.children,n),t.child}function po(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),oa|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ga(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(P(153));if(t.child!==null){e=t.child,n=io(e,e.pendingProps),t.child=n;for(n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=io(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ch(e,t){if((e.lanes&t)!==0)return!0;return e=e.dependencies,e!==null&&hd(e)?!0:!1}function fM(e,t,n){switch(t.tag){case 3:ld(t,t.stateNode.containerInfo),$o(t,yt,e.memoizedState.cache),Ka();break;case 27:case 5:Bm(t);break;case 4:ld(t,t.stateNode.containerInfo);break;case 10:$o(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,og(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Yo(t),t.flags|=128,null;r=Ga(e,t,n,!1);var o=t.child.childLanes;if(r||(n&o)!==0)return F0(e,t,n);return Yo(t),e=po(e,t,n),e!==null?e.sibling:null}Yo(t);break;case 19:if(t.flags&128)return mg(e,t,n);if(o=(e.flags&128)!==0,r=(n&t.childLanes)!==0,r||(Ga(e,t,n,!1),r=(n&t.childLanes)!==0),o){if(r)return mg(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Bl(t,Vt.current),r)break;else return null;case 22:return t.lanes=0,Y0(e,t,n,t.pendingProps);case 24:$o(t,yt,e.memoizedState.cache)}return po(e,t,n)}function X0(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)bt=!0;else{if(!Ch(e,n)&&(t.flags&128)===0)return bt=!1,fM(e,t,n);bt=(e.flags&131072)!==0?!0:!1}else bt=!1,ke&&(t.flags&1048576)!==0&&r0(t,Ul,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Da(t.elementType),t.type=e,typeof e==="function")rh(e)?(r=Ja(e,r),t.tag=1,t=Ek(null,t,e,r,n)):(t.tag=0,t=ug(null,t,e,r,n));else{if(e!==void 0&&e!==null){var o=e.$$typeof;if(o===Qg){t.tag=11,t=kk(null,t,e,r,n);break e}else if(o===Kg){t.tag=14,t=xk(null,t,e,r,n);break e}else if(o===Er){t.tag=10,t.type=e,t=Mk(null,t,n);break e}}throw t=zm(e)||e,Error(P(306,t,""))}}return t;case 0:return ug(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,o=Ja(r,t.pendingProps),Ek(e,t,r,o,n);case 3:e:{if(ld(t,t.stateNode.containerInfo),e===null)throw Error(P(387));r=t.pendingProps;var a=t.memoizedState;o=a.element,tg(e,t),Nl(t,r,null,n);var i=t.memoizedState;if(r=i.cache,$o(t,yt,r),r!==a.cache&&Zm(t,[yt],n,!0),El(),r=i.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=Nk(e,t,r,n);break e}else if(r!==o){o=Wn(Error(P(424)),t),zl(o),t=Nk(e,t,r,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}Ze=er(e.firstChild),Ot=t,ke=!0,Go=null,Jn=!0,n=c0(t,null,r,n);for(t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(Ka(),r===o){t=po(e,t,n);break e}St(e,t,r,n)}t=t.child}return t;case 26:return Mi(e,t),e===null?(n=tx(t.type,null,t.pendingProps,null))?t.memoizedState=n:ke||(t.stateNode=jT(t.type,t.pendingProps,Ko.current,t)):t.memoizedState=tx(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Bm(t),e===null&&ke&&(r=t.stateNode=XT(t.type,t.pendingProps,Ko.current),Ot=t,Jn=!0,o=Ze,ia(t.type)?(Bg=o,Ze=er(r.firstChild)):Ze=o),St(e,t,t.pendingProps.children,n),Mi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:if(e===null&&ke){if(o=r=Ze)r=oI(r,t.type,t.pendingProps,Jn),r!==null?(t.stateNode=r,Ot=t,Ze=er(r.firstChild),Jn=!1,o=!0):o=!1;o||ta(t)}return Bm(t),o=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,r=a.children,qg(o,a)?r=null:i!==null&&qg(o,i)&&(t.flags|=32),t.memoizedState!==null&&(o=fh(e,t,JR,null,null,n),fs._currentValue=o),Mi(e,t),St(e,t,r,n),t.child;case 6:if(e===null&&ke){if(e=n=Ze)n=aI(n,t.pendingProps,Jn),n!==null?(t.stateNode=n,Ot=t,Ze=null,e=!0):e=!1;e||ta(t)}return null;case 13:return F0(e,t,n);case 4:return ld(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Xa(t,null,r,n):St(e,t,r,n),t.child;case 11:return kk(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Mi(e,t),St(e,t,r,n),t.child;case 8:return St(e,t,t.pendingProps.children,n),t.child;case 12:return St(e,t,t.pendingProps.children,n),t.child;case 10:return Mk(e,t,n);case 9:return o=t.type._context,r=t.pendingProps.children,Ya(t),o=$t(o),r=r(o),t.flags|=1,St(e,t,r,n),t.child;case 14:return xk(e,t,t.type,t.pendingProps,n);case 15:return G0(e,t,t.type,t.pendingProps,n);case 19:return mg(e,t,n);case 31:return uM(e,t,n);case 22:return Y0(e,t,n,t.pendingProps);case 24:return Ya(t),r=$t(yt),e===null?(o=ih(),o===null&&(o=Ge,a=ah(),o.pooledCache=a,a.refCount++,a!==null&&(o.pooledCacheLanes|=n),o=a),t.memoizedState={parent:r,cache:o},lh(t),$o(t,yt,o)):((e.lanes&n)!==0&&(tg(e,t),Nl(t,null,null,n),El()),o=e.memoizedState,a=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),$o(t,yt,r)):(r=a.cache,$o(t,yt,r),r!==o.cache&&Zm(t,[yt],n,!0))),St(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!=="auto"?t.flags|=e===null?18882560:18874368:ke&&Vd(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Mi(e,t),St(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(P(156,t.tag))}function ro(e){e.flags|=4}function wm(e,t,n,r,o){var a;if(a=(e.mode&32)!==0)a=n===null?ox(t,r):ox(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet);if(a){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(CT())e.flags|=8192;else throw $a=yd,sh}else e.flags&=-16777217}function Ik(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!eS(t))if(CT())e.flags|=8192;else throw $a=yd,sh}function Du(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Tx():536870912,e.lanes|=t,is|=t)}function cl(e,t){if(!ke)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:t=e.tail;for(n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function Je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&1206910976,r|=o.flags&1206910976,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function pM(e,t,n){var r=t.pendingProps;switch(oh(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return Je(t),null;case 3:if(n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),so(yt),ns(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),e===null||e.child===null)Ai(t)?ro(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,gm());return Je(t),null;case 26:var{type:o,memoizedState:a}=t;return e===null?(ro(t),a!==null?(Je(t),Ik(t,a)):(Je(t),wm(t,o,null,r,n))):a?a!==e.memoizedState?(ro(t),Je(t),Ik(t,a)):(Je(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&ro(t),Je(t),wm(t,o,e,r,n)),null;case 27:if(cd(t),n=Ko.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ro(t);else{if(!r){if(t.stateNode===null)throw Error(P(166));return Je(t),t.subtreeFlags&=-33554433,null}e=Mr.current,Ai(t)?ok(t,e):(e=XT(o,r,n),t.stateNode=e,ro(t))}return Je(t),t.subtreeFlags&=-33554433,null;case 5:if(cd(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ro(t);else{if(!r){if(t.stateNode===null)throw Error(P(166));return Je(t),t.subtreeFlags&=-33554433,null}if(a=Mr.current,Ai(t))ok(t,a);else{var i=Ql(Ko.current);switch(a){case 1:a=i.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:a=i.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":a=i.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":a=i.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":a=i.createElement("div"),a.innerHTML="<script></script>",a=a.removeChild(a.firstChild);break;case"select":a=typeof r.is==="string"?i.createElement("select",{is:r.is}):i.createElement("select"),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==="string"?i.createElement(o,{is:r.is}):i.createElement(o)}}a[Bt]=t,a[bn]=r;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)a.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=a;e:switch(Qt(a,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ro(t)}}return Je(t),t.subtreeFlags&=-33554433,wm(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ro(t);else{if(typeof r!=="string"&&t.stateNode===null)throw Error(P(166));if(e=Ko.current,Ai(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,o=Ot,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}e[Bt]=t,e=e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||UT(e.nodeValue,n)?!0:!1,e||ta(t,!0)}else e=Ql(e).createTextNode(r),e[Bt]=t,t.stateNode=e}return Je(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ai(t),n!==null){if(e===null){if(!r)throw Error(P(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(P(557));e[Bt]=t}else Ka(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),e=!1}else n=gm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e){if(t.flags&256)return Mn(t),t;return Mn(t),null}if((t.flags&128)!==0)throw Error(P(558))}return Je(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Ai(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(P(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(P(317));o[Bt]=t}else Ka(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),o=!1}else o=gm(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o){if(t.flags&256)return Mn(t),t;return Mn(t),null}}if(Mn(t),(t.flags&128)!==0)return t.lanes=n,t;return n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==o&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Du(t,t.updateQueue),Je(t),null;case 4:return ns(),e===null&<(t.stateNode.containerInfo),t.flags|=67108864,Je(t),null;case 10:return so(t.type),Je(t),null;case 19:if(uh(t),r=t.memoizedState,r===null)return Je(t),null;if(o=(t.flags&128)!==0,a=r.rendering,a===null)if(o)cl(r,!1);else{if(dt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(a=vd(e),a!==null){t.flags|=128,cl(r,!1),e=a.updateQueue,t.updateQueue=e,Du(t,e),t.subtreeFlags=0,e=n;for(n=t.child;n!==null;)t0(n,e),n=n.sibling;return Bl(t,Vt.current&1|2),ke&&oo(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&_n()>Rd&&(t.flags|=128,o=!0,cl(r,!1),t.lanes=4194304)}else{if(!o)if(e=vd(a),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Du(t,e),cl(r,!0),r.tail===null&&r.tailMode!=="collapsed"&&r.tailMode!=="visible"&&!a.alternate&&!ke)return Je(t),null}else 2*_n()-r.renderingStartTime>Rd&&n!==536870912&&(t.flags|=128,o=!0,cl(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e!==null?e.sibling=a:t.child=a,r.last=a)}if(r.tail!==null){e=r.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=_n(),e.sibling=null,a=Vt.current,a=o?a&1|2:a&1,r.tailMode==="visible"||r.tailMode==="collapsed"||!n||ke?Bl(t,a):(n=a,et(Kt,t),et(Vt,n),Jt===null&&(Jt=t)),ke&&oo(t,r.treeForkCount),e}return Je(t),null;case 22:case 23:return Mn(t),ch(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(n&536870912)!==0&&(t.flags&128)===0&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),n=t.updateQueue,n!==null&&Du(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Ht(Ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),so(yt),Je(t),null;case 25:return null;case 30:return t.flags|=33554432,Je(t),null}throw Error(P(156,t.tag))}function mM(e,t){switch(oh(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return so(yt),ns(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return cd(t),null;case 31:if(t.memoizedState!==null){if(Mn(t),t.alternate===null)throw Error(P(340));Ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Mn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(P(340));Ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return uh(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return ns(),null;case 10:return so(t.type),null;case 22:case 23:return Mn(t),ch(),e!==null&&Ht(Ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return so(yt),null;case 25:return null;default:return null}}function W0(e,t){switch(oh(t),t.tag){case 3:so(yt),ns();break;case 26:case 27:case 5:cd(t);break;case 4:ns();break;case 31:t.memoizedState!==null&&Mn(t);break;case 13:Mn(t);break;case 19:uh(t);break;case 10:so(t.type);break;case 22:case 23:Mn(t),ch(),e!==null&&Ht(Ba);break;case 24:so(yt)}}function oc(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var o=r.next;n=o;do{if((n.tag&e)===e){r=void 0;var a=n.create,i=n.inst;r=a(),i.destroy=r}n=n.next}while(n!==o)}}catch(s){Be(t,t.return,s)}}function ra(e,t,n){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var a=o.next;r=a;do{if((r.tag&e)===e){var i=r.inst,s=i.destroy;if(s!==void 0){i.destroy=void 0,o=t;var c=n,f=s;try{f()}catch(p){Be(o,c,p)}}}r=r.next}while(r!==a)}}catch(p){Be(t,t.return,p)}}function J0(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{d0(t,n)}catch(r){Be(e,e.return,r)}}}function Z0(e,t,n){n.props=Ja(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Be(e,t,r)}}function Sr(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var o=e.stateNode,a=co(e.memoizedProps,o);if(o.ref===null||o.ref.name!==a)o.ref=VT(a);r=o.ref;break;case 7:if(e.stateNode===null){var i=new qn(e);yn(e.child,!1,nI,i,void 0,void 0),e.stateNode=i}r=e.stateNode;break;default:r=e.stateNode}typeof n==="function"?e.refCleanup=n(r):n.current=r}}catch(s){Be(e,t,s)}}function jt(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==="function")try{r()}catch(o){Be(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==="function")try{n(null)}catch(o){Be(e,t,o)}else n.current=null}function Sd(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)YT(e.stateNode,t[n])}function Ok(e){for(var t=e.return;t!==null;){if(Nh(t)&&YT(e.stateNode,t.stateNode),Eh(t))break;t=t.return}}function Ml(e){for(var t=e.return;t!==null;){if(Nh(t)&&rI(e.stateNode,t.stateNode),Eh(t))break;t=t.return}}function Eh(e){return e.tag===5||e.tag===3||e.tag===27}function Nh(e){return e&&e.tag===7&&e.stateNode!==null}function gg(e){var{type:t,memoizedProps:n,stateNode:r}=e;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(o){Be(e,e.return,o)}}function km(e,t,n){try{var r=e.stateNode;UM(r,e.type,n,t),r[bn]=t}catch(o){Be(e,e.return,o)}}function eT(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ia(e.type)||e.tag===4}function xm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||eT(e.return))return null;e=e.return}e.sibling.return=e.return;for(e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ia(e.type))continue e;if(e.flags&2)continue e;if(e.child===null||e.tag===4)continue e;else e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function hg(e,t,n,r){var o=e.tag;if(o===5||o===6)o=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(o,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(o),n=n._reactRootContainer,n!==null&&n!==void 0||t.onclick!==null||(t.onclick=Nr)),Sd(e,r),_e=!0;else if(o!==4&&(o===27&&(Sd(e,r),r=null,ia(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(hg(e,t,n,r),e=e.sibling;e!==null;)hg(e,t,n,r),e=e.sibling}function Cd(e,t,n,r){var o=e.tag;if(o===5||o===6)o=e.stateNode,t?n.insertBefore(o,t):n.appendChild(o),Sd(e,r),_e=!0;else if(o!==4&&(o===27&&(Sd(e,r),r=null,ia(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Cd(e,t,n,r),e=e.sibling;e!==null;)Cd(e,t,n,r),e=e.sibling}function tT(e){var{stateNode:t,memoizedProps:n}=e;try{for(var r=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Qt(t,r,n),t[Bt]=e,t[bn]=n}catch(a){Be(e,e.return,a)}}var Ed=!1,In=null;function _k(e){if(e.tag===30||(e.subtreeFlags&33554432)!==0)Ed=!0}var Cr=null;function Pk(){var e=Cr;return Cr=null,e}var mn=0;function ys(e,t,n,r,o){return mn=0,nT(e.child,t,n,r,o)}function nT(e,t,n,r,o){for(var a=!1;e!==null;){if(e.tag===5){var i=e.stateNode;if(r!==null){var s=Ug(i);r.push(s),s.view&&(a=!0)}else a||Ug(i).view&&(a=!0);Ed=!0,BT(i,mn===0?t:t+"_"+mn,n),mn++}else if(e.tag!==22||e.memoizedState===null)e.tag===30&&o||nT(e.child,t,n,r,o)&&(a=!0);e=e.sibling}return a}function Or(e,t){for(;e!==null;){if(e.tag===5)$T(e.stateNode,e.memoizedProps);else if(e.tag!==22||e.memoizedState===null)e.tag===30&&t||Or(e.child,t);e=e.sibling}}function Ju(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(Ju(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(P(544));var n=t.name;t=ho(t.default,t.share),t!=="none"&&(ys(e,n,t,null,!1)||Or(e.child,!1))}}e=e.sibling}}function yg(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,o=co(r,n),a=ho(r.default,n.paired?r.share:r.enter);a!=="none"?ys(e,o,a,null,!1)?(Ju(e),n.paired||t||ss(e,r.onEnter)):Or(e.child,!1):Ju(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)yg(e,t),e=e.sibling;else Ju(e)}function bg(e){if(In!==null&&In.size!==0){var t=In;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.memoizedProps,r=n.name;if(r!=null&&r!=="auto"){var o=t.get(r);if(o!==void 0){var a=ho(n.default,n.share);if(a!=="none"&&(ys(e,r,a,null,!1)?(a=e.stateNode,o.paired=a,a.paired=o,ss(e,n.onShare)):Or(e.child,!1)),t.delete(r),t.size===0)break}}}bg(e)}e=e.sibling}}}function vg(e){if(e.tag===30){var t=e.memoizedProps,n=co(t,e.stateNode),r=In!==null?In.get(n):void 0,o=ho(t.default,r!==void 0?t.share:t.exit);o!=="none"&&(ys(e,n,o,null,!1)?r!==void 0?(o=e.stateNode,r.paired=o,o.paired=r,In.delete(n),ss(e,t.onShare)):ss(e,t.onExit):Or(e.child,!1)),In!==null&&bg(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)vg(e),e=e.sibling;else In!==null&&bg(e)}function rT(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=co(t,e.stateNode);t=ho(t.default,t.update),e.flags&=-5,t!=="none"&&ys(e,n,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&rT(e);e=e.sibling}}function wg(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Or(e.child,!1))}wg(e)}e=e.sibling}}function Zu(e){if(e.tag===30)e.stateNode.paired=null,Or(e.child,!1),wg(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Zu(e),e=e.sibling;else wg(e)}function oT(e){for(e=e.child;e!==null;)e.tag===30?Or(e.child,!1):(e.subtreeFlags&33554432)!==0&&oT(e),e=e.sibling}function Ah(e,t,n,r,o,a,i){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&mn<a.length){var f=a[mn],p=Ug(c);if(f.view||p.view)s=!0;var d;if(d=(e.flags&4)===0)if(p.clip)d=!0;else{d=f.rect;var u=p.rect;d=d.y!==u.y||d.x!==u.x||d.height!==u.height||d.width!==u.width}d&&(e.flags|=4),p.abs?p=!f.abs:(f=f.rect,p=p.rect,p=f.height!==p.height||f.width!==p.width),p&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&BT(c,mn===0?n:n+"_"+mn,o),s&&(e.flags&4)!==0||(Cr===null&&(Cr=[]),Cr.push(c,mn===0?r:r+"_"+mn,t.memoizedProps)),mn++}else if(t.tag!==22||t.memoizedState===null)t.tag===30&&i?e.flags|=t.flags&32:Ah(e,t.child,n,r,o,a,i)&&(s=!0);t=t.sibling}return s}function aT(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,o=co(n,r),a=ho(n.default,n.update);if(t){r=r.clones;var i=r===null?null:r.map(VM)}else i=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;mn=0,o=Ah(r,s,o,o,a,i,!1),(e.flags&4)!==0&&o&&(t||ss(e,n.onUpdate))}else(e.subtreeFlags&33554432)!==0&&aT(e,t);e=e.sibling}}var Rt=!1,qe=!1,kr=!1,Tm=!1,Dk=typeof WeakSet==="function"?WeakSet:Set,Mt=null,xr=!1,bl=!1,Nd=!1,kg=!1;function gM(e,t,n){if(e=e.containerInfo,Dg=ps,e=Gx(e),eh(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var a=o.anchorOffset,i=o.focusNode;o=o.focusOffset;try{r.nodeType,i.nodeType}catch(g){r=null;break e}var s=0,c=-1,f=-1,p=0,d=0,u=e,m=null;t:for(;;){for(var y;;){if(u!==r||a!==0&&u.nodeType!==3||(c=s+a),u!==i||o!==0&&u.nodeType!==3||(f=s+o),u.nodeType===3&&(s+=u.nodeValue.length),(y=u.firstChild)===null)break;m=u,u=y}for(;;){if(u===e)break t;if(m===r&&++p===a&&(c=s),m===i&&++d===o&&(f=s),(y=u.nextSibling)!==null)break;u=m,m=u.parentNode}u=y}r=c===-1||f===-1?null:{start:c,end:f}}else r=null}r=r||{start:0,end:0}}else r=null;Lg={focusedElem:e,selectionRange:r},ps=!1,n=(n&335544064)===n,Mt=t;for(t=n?9270:1024;Mt!==null;){if(e=Mt,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&vg(r[a]);if(e.alternate===null&&(e.flags&2)!==0)n&&_k(e),Lu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&vg(r),Lu(n);continue}else if(r!==null&&r.memoizedState!==null){n&&_k(e),Lu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,Mt=r):(n&&rT(e),Lu(n))}}In=null}function Lu(e){for(;Mt!==null;){var t=Mt,n=e,{alternate:r,flags:o}=t;switch(t.tag){case 0:case 11:case 15:break;case 1:if((o&1024)!==0&&r!==null){n=void 0,o=r.memoizedProps,r=r.memoizedState;var a=t.stateNode;try{var i=Ja(t.type,o);n=a.getSnapshotBeforeUpdate(i,r),a.__reactInternalSnapshotBeforeUpdate=n}catch(s){Be(t,t.return,s)}}break;case 3:if((o&1024)!==0){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)zg(r);else if(n===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":zg(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=co(r.memoizedProps,r.stateNode),o=t.memoizedProps,o=ho(o.default,o.update),o!=="none"&&ys(r,n,o,r.memoizedState=[],!0));break;default:if((o&1024)!==0)throw Error(P(163))}if(r=t.sibling,r!==null){r.return=t.return,Mt=r;break}Mt=t.return}}function iT(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Tr(e,n),r&4&&oc(5,n);break;case 1:if(Tr(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Be(n,n.return,i)}else{var o=Ja(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Be(n,n.return,i)}}r&64&&J0(n),r&512&&Sr(n,n.return);break;case 3:if(Tr(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{d0(e,t)}catch(i){Be(n,n.return,i)}}break;case 27:t===null&&r&4&&tT(n);case 26:case 5:Tr(e,n),t===null&&r&4&&gg(n),r&512&&Sr(n,n.return);break;case 12:Tr(e,n);break;case 31:Tr(e,n),r&4&&uT(e,n);break;case 13:Tr(e,n),r&4&&dT(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=NM.bind(null,n),iI(e,n))));break;case 22:if(r=n.memoizedState!==null||Rt,!r){var a=t!==null&&t.memoizedState!==null||qe;t=Rt,o=qe,Rt=r,(qe=a)&&!o?(r=2,(n.subtreeFlags&8772)!==0&&(r|=1),ur(e,n,r)):Tr(e,n),Rt=t,qe=o}break;case 30:Tr(e,n),r&512&&Sr(n,n.return);break;case 7:r&512&&Sr(n,n.return);default:Tr(e,n)}}function xg(e,t){for(e=e.child;e!==null;)sT(e,t),e=e.sibling}function sT(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==="function"?r.setProperty("display","none","important"):r.display="none"}else{var o=e.stateNode,a=e.memoizedProps.style,i=a!==void 0&&a!==null&&a.hasOwnProperty("display")?a.display:null;o.style.display=i==null||typeof i==="boolean"?"":(""+i).trim()}}catch(c){Be(e,e.return,c)}Tg(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,_e=!0}catch(c){Be(e,e.return,c)}break;case 18:try{var s=e.stateNode;t?Fk(s,!0):Fk(e.stateNode,!1)}catch(c){Be(e,e.return,c)}break;case 22:case 23:e.memoizedState===null&&xg(e,t);break;default:xg(e,t)}}function Tg(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var n=e,r=t;switch(n.tag){case 4:sT(n,r);break e;case 22:n.memoizedState===null&&Tg(n,r);break e;default:Tg(n,r)}}e=e.sibling}}function lT(e){var t=e.alternate;t!==null&&(e.alternate=null,lT(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ud(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ot=null,fn=!1;function cr(e,t,n){for(n=n.child;n!==null;)cT(e,t,n),n=n.sibling}function cT(e,t,n){if(Pn&&typeof Pn.onCommitFiberUnmount==="function")try{Pn.onCommitFiberUnmount(Wl,n)}catch(a){}switch(n.tag){case 26:qe||jt(n,t),cr(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!qe&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:qe||jt(n,t),Ml(n);var r=ot,o=fn;ia(n.type)&&(ot=n.stateNode,fn=!1),cr(e,t,n),WT(n.stateNode,n.type,n.memoizedProps),ot=r,fn=o;break;case 5:qe||jt(n,t),Ml(n);case 6:if(n.tag===6&&Ml(n),r=ot,o=fn,ot=null,cr(e,t,n),ot=r,fn=o,ot!==null)if(fn)try{(ot.nodeType===9?ot.body:ot.nodeName==="HTML"?ot.ownerDocument.body:ot).removeChild(n.stateNode),_e=!0}catch(a){Be(n,t,a)}else try{ot.removeChild(n.stateNode),_e=!0}catch(a){Be(n,t,a)}break;case 18:ot!==null&&(fn?(e=ot,Yk(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),ms(e)):Yk(ot,n.stateNode));break;case 4:r=ot,o=fn,ot=n.stateNode.containerInfo,fn=!0,cr(e,t,n),ot=r,fn=o;break;case 0:case 11:case 14:case 15:ra(2,n,t),qe||ra(4,n,t),cr(e,t,n);break;case 1:qe||(jt(n,t),r=n.stateNode,typeof r.componentWillUnmount==="function"&&Z0(n,t,r)),cr(e,t,n);break;case 21:cr(e,t,n);break;case 22:qe=(r=qe)||n.memoizedState!==null,cr(e,t,n),qe=r;break;case 30:jt(n,t),cr(e,t,n);break;case 7:qe||jt(n,t),cr(e,t,n);break;default:cr(e,t,n)}}function uT(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ms(e)}catch(n){Be(t,t.return,n)}}}function dT(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ms(e)}catch(n){Be(t,t.return,n)}}function hM(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Dk),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Dk),t;default:throw Error(P(435,e.tag))}}function qu(e,t){var n=hM(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var o=AM.bind(null,e,r);r.then(o,o)}})}function Zt(e,t,n){var r=t.deletions;if(r!==null)for(var o=0;o<r.length;o++){var a=r[o],i=e,s=t,c=s;e:for(;c!==null;){switch(c.tag){case 27:if(ia(c.type)){ot=c.stateNode,fn=!1;break e}break;case 5:ot=c.stateNode,fn=!1;break e;case 3:case 4:ot=c.stateNode.containerInfo,fn=!0;break e}c=c.return}if(ot===null)throw Error(P(160));cT(i,s,a),ot=null,fn=!1,i=a.alternate,i!==null&&(i.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fT(t,e,n),t=t.sibling}var dr=null;function fT(e,t,n){var r=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(o&4&&(r=e.updateQueue,r=r!==null?r.events:null,r!==null))for(var a=0;a<r.length;a++){var i=r[a];i.ref.impl=i.nextImpl}Zt(t,e,n),en(e),o&4&&(ra(3,e,e.return),oc(3,e),ra(5,e,e.return));break;case 1:Zt(t,e,n),en(e),o&512&&(qe||r===null||jt(r,r.return)),o&64&&Rt&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(a=dr,Zt(t,e,n),en(e),o&512&&(qe||r===null||jt(r,r.return)),o&4)if(o=r!==null?r.memoizedState:null,n=e.memoizedState,r===null)if(n===null)if(e.stateNode===null)if(Rt)e.stateNode=jT(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,n=e.memoizedProps,o=a.ownerDocument||a;t:switch(t){case"title":if(r=o.getElementsByTagName("title")[0],!r||r[ec]||r[Bt]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))r=o.createElement(t),o.head.insertBefore(r,o.querySelector("head > title"));Qt(r,t,n),r[Bt]=e,It(r),t=r;break e;case"link":if(a=rx("link","href",o).get(t+(n.href||""))){for(i=0;i<a.length;i++)if(r=a[i],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(i,1);break t}}r=o.createElement(t),Qt(r,t,n),o.head.appendChild(r);break;case"meta":if(a=rx("meta","content",o).get(t+(n.content||""))){for(i=0;i<a.length;i++)if(r=a[i],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){a.splice(i,1);break t}}r=o.createElement(t),Qt(r,t,n),o.head.appendChild(r);break;default:throw Error(P(468,t))}r[Bt]=e,It(r),t=r}e.stateNode=t}else Rt||$g(a,e.type,e.stateNode);else e.stateNode=nx(a,n,e.memoizedProps);else o!==n?(o===null?(t=r.stateNode,t===null||qe||t.parentNode.removeChild(t)):o.count--,n===null?Rt||$g(a,e.type,e.stateNode):nx(a,n,e.memoizedProps)):n===null&&e.stateNode!==null&&km(e,e.memoizedProps,r.memoizedProps);break;case 27:Zt(t,e,n),en(e),o&512&&(qe||r===null||jt(r,r.return)),r!==null&&o&4&&km(e,e.memoizedProps,r.memoizedProps);break;case 5:if(a=kr,kr=!1,Zt(t,e,n),kr=a,en(e),o&512&&(qe||r===null||jt(r,r.return)),e.flags&32){t=e.stateNode;try{os(t,""),_e=!0}catch(p){Be(e,e.return,p)}}o&4&&e.stateNode!=null&&(t=e.memoizedProps,km(e,t,r!==null?r.memoizedProps:t)),o&1024&&(Tm=!0);break;case 6:if(Zt(t,e,n),en(e),o&4){if(e.stateNode===null)throw Error(P(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,_e=!0}catch(p){Be(e,e.return,p)}}break;case 3:if(_e=!1,rd=null,a=dr,dr=Kl(t.containerInfo),Zt(t,e,n),dr=a,en(e),o&4&&r!==null&&r.memoizedState.isDehydrated)try{ms(t.containerInfo)}catch(p){Be(e,e.return,p)}Tm&&(Tm=!1,pT(e)),_e=!1;break;case 4:o=kr,kr=Rt,r=Bw(),a=dr,dr=Kl(e.stateNode.containerInfo),Zt(t,e,n),en(e),dr=a,_e&&bl&&(Nd=!0),_e=r,kr=o;break;case 12:Zt(t,e,n),en(e);break;case 31:Zt(t,e,n),en(e),o&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,qu(e,t)));break;case 13:Zt(t,e,n),en(e),e.child.flags&8192&&e.memoizedState!==null!==(r!==null&&r.memoizedState!==null)&&(Wd=_n()),o&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,qu(e,t)));break;case 22:a=e.memoizedState!==null,i=r!==null&&r.memoizedState!==null;var s=Rt,c=qe,f=kr;Rt=s||a,kr=f||a,qe=c||i,Zt(t,e,n),qe=c,kr=f,Rt=s,en(e),o&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,!a||r===null||i||Rt||qe||(t=i||qe,n=Rt,r=qe,Rt=a||Rt,qe=t,Lo(e,2),Rt=n,qe=r),!a&&kr||xg(e,a)),o&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,qu(e,n))));break;case 19:Zt(t,e,n),en(e),o&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,qu(e,t)));break;case 30:o&512&&(qe||r===null||jt(r,r.return)),o=Bw(),a=bl,i=(n&335544064)===n,s=e.memoizedProps,bl=i&&ho(s.default,s.update)!=="none",Zt(t,e,n),en(e),i&&r!==null&&_e&&(e.flags|=4),bl=a,_e=o;break;case 21:break;case 7:o&512&&(qe||r===null||jt(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Zt(t,e,n),en(e)}}function en(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(eT(r)){n=r;break}r=r.return}r=null;for(var o=e.return;o!==null;){if(Nh(o)){var a=o.stateNode;r===null?r=[a]:r.push(a)}if(Eh(o))break;o=o.return}var i=r;if(n==null)throw Error(P(160));switch(n.tag){case 27:var s=n.stateNode,c=xm(e);Cd(e,c,s,i);break;case 5:var f=n.stateNode;n.flags&32&&(os(f,""),n.flags&=-33);var p=xm(e);Cd(e,p,f,i);break;case 3:case 4:var d=n.stateNode.containerInfo,u=xm(e);hg(e,u,d,i);break;default:throw Error(P(161))}}catch(m){Be(e,e.return,m)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pT(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;pT(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,ps=!0,t.reset(),ps=!1),e=e.sibling}}function Ri(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)mT(t,e),t=t.sibling;else aT(t,!1)}function mT(e,t){var n=e.alternate;if(n===null)yg(e,!1);else switch(e.tag){case 3:if(kg=xr=!1,Pk(),Ri(t,e),!xr&&!Nd){if(e=Cr,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var o=e[r+1];$T(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+o+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),kg=!0}Cr=null;break;case 5:Ri(t,e);break;case 4:r=xr,xr=!1,Ri(t,e),xr&&(Nd=!0),xr=r;break;case 22:e.memoizedState===null&&(n.memoizedState!==null?yg(e,!1):Ri(t,e));break;case 30:r=xr,o=Pk(),xr=!1,Ri(t,e),xr&&(e.flags|=4);var a=e.memoizedProps,i=e.stateNode;t=co(a,i),i=co(n.memoizedProps,i);var s=ho(a.default,a.update);s==="none"?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,mn=0,t=Ah(e,n,t,i,s,a,!0),mn!==(a===null?0:a.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(ss(e,e.memoizedProps.onUpdate),Cr=o):o!==null&&(o.push.apply(o,Cr),Cr=o),xr=(e.flags&32)!==0?!0:r;break;default:Ri(t,e)}}function Tr(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)iT(e,t.alternate,t),t=t.sibling}function Lo(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:ra(4,n,n.return),Lo(n,r);break;case 1:jt(n,n.return);var o=n.stateNode;typeof o.componentWillUnmount==="function"&&Z0(n,n.return,o),Lo(n,r);break;case 27:(r&2)!==0&&WT(n.stateNode,n.type,n.memoizedProps);case 5:jt(n,n.return),n.tag!==5&&n.tag!==27||Ml(n),Lo(n,r);break;case 6:Ml(n);break;case 26:jt(n,n.return),o=n.stateNode,n.memoizedState!==null||o===null||qe||o.parentNode.removeChild(o),Lo(n,r);break;case 22:n.memoizedState===null&&Lo(n,r);break;case 30:jt(n,n.return),Lo(n,r);break;case 7:jt(n,n.return);default:Lo(n,r)}e=e.sibling}}function ur(e,t,n){n=(t.subtreeFlags&8772)!==0?n:n&-2;for(t=t.child;t!==null;){var r=t.alternate,o=e,a=t,i=a.flags,s=(n&1)!==0;switch(a.tag){case 0:case 11:case 15:ur(o,a,n),oc(4,a);break;case 1:if(ur(o,a,n),r=a,o=r.stateNode,typeof o.componentDidMount==="function")try{o.componentDidMount()}catch(p){Be(r,r.return,p)}if(r=a,o=r.updateQueue,o!==null){var c=r.stateNode;try{var f=o.shared.hiddenCallbacks;if(f!==null)for(o.shared.hiddenCallbacks=null,o=0;o<f.length;o++)u0(f[o],c)}catch(p){Be(r,r.return,p)}}s&&i&64&&J0(a),Sr(a,a.return);break;case 27:(n&2)!==0&&tT(a);case 5:a.tag!==5&&a.tag!==27||Ok(a),ur(o,a,n),s&&r===null&&i&4&&gg(a),Sr(a,a.return);break;case 6:Ok(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Rt||$g(Kl(c.ownerDocument),a.type,c),ur(o,a,n),s&&r===null&&i&4&&gg(a),Sr(a,a.return);break;case 12:ur(o,a,n);break;case 31:ur(o,a,n),s&&i&4&&uT(o,a);break;case 13:ur(o,a,n),s&&i&4&&dT(o,a);break;case 22:a.memoizedState===null&&ur(o,a,n),Sr(a,a.return);break;case 30:ur(o,a,n),Sr(a,a.return);break;case 7:Sr(a,a.return);default:ur(o,a,n)}t=t.sibling}}function Rh(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&nc(n))}function Mh(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&nc(e))}function Kn(e,t,n,r){var o=(n&335544064)===n;if(t.subtreeFlags&(o?10262:10256))for(t=t.child;t!==null;)gT(e,t,n,r),t=t.sibling;else o&&oT(t)}function gT(e,t,n,r){var o=(n&335544064)===n;o&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Zu(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Kn(e,t,n,r),a&2048&&oc(9,t);break;case 1:Kn(e,t,n,r);break;case 3:Kn(e,t,n,r),o&&kg&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&nc(a)));break;case 12:if(a&2048){Kn(e,t,n,r),a=t.stateNode;try{var i=t.memoizedProps,s=i.id,c=i.onPostCommit;typeof c==="function"&&c(s,t.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(f){Be(t,t.return,f)}}else Kn(e,t,n,r);break;case 31:Kn(e,t,n,r);break;case 13:Kn(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,s=t.alternate,t.memoizedState!==null?(o&&s!==null&&s.memoizedState===null&&Zu(s),i._visibility&2?Kn(e,t,n,r):Il(e,t)):(o&&s!==null&&s.memoizedState!==null&&Zu(t),i._visibility&2?Kn(e,t,n,r):(i._visibility|=2,Ii(e,t,n,r,(t.subtreeFlags&10256)!==0||!1))),a&2048&&Rh(s,t);break;case 24:Kn(e,t,n,r),a&2048&&Mh(t.alternate,t);break;case 30:o&&(a=t.alternate,a!==null&&(Or(a.child,!0),Or(t.child,!0))),Kn(e,t,n,r);break;default:Kn(e,t,n,r)}}function Ii(e,t,n,r,o){o=o&&((t.subtreeFlags&10256)!==0||!1);for(t=t.child;t!==null;){var a=e,i=t,s=n,c=r,f=i.flags;switch(i.tag){case 0:case 11:case 15:Ii(a,i,s,c,o),oc(8,i);break;case 23:break;case 22:var p=i.stateNode;i.memoizedState!==null?p._visibility&2?Ii(a,i,s,c,o):Il(a,i):(p._visibility|=2,Ii(a,i,s,c,o)),o&&f&2048&&Rh(i.alternate,i);break;case 24:Ii(a,i,s,c,o),o&&f&2048&&Mh(i.alternate,i);break;default:Ii(a,i,s,c,o)}t=t.sibling}}function Il(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,o=r.flags;switch(r.tag){case 22:Il(n,r),o&2048&&Rh(r.alternate,r);break;case 24:Il(n,r),o&2048&&Mh(r.alternate,r);break;default:Il(n,r)}t=t.sibling}}var La=8192;function Oa(e,t,n){if(e.subtreeFlags&La)for(e=e.child;e!==null;)hT(e,t,n),e=e.sibling}function hT(e,t,n){switch(e.tag){case 26:Oa(e,t,n),e.flags&La&&(e.memoizedState!==null?wI(n,dr,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&ax(n,e)));break;case 5:Oa(e,t,n),e.flags&La&&(e=e.stateNode,(t&335544128)===t&&ax(n,e));break;case 3:case 4:var r=dr;dr=Kl(e.stateNode.containerInfo),Oa(e,t,n),dr=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=La,La=16777216,Oa(e,t,n),La=r):Oa(e,t,n));break;case 30:if((e.flags&La)!==0&&(r=e.memoizedProps.name,r!=null&&r!=="auto")){var o=e.stateNode;o.paired=null,In===null&&(In=new Map),In.set(r,o)}Oa(e,t,n);break;default:Oa(e,t,n)}}function yT(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function ul(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Mt=r,vT(r,e)}yT(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)bT(e),e=e.sibling}function bT(e){switch(e.tag){case 0:case 11:case 15:ul(e),e.flags&2048&&ra(9,e,e.return);break;case 3:ul(e);break;case 12:ul(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ed(e)):ul(e);break;default:ul(e)}}function ed(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Mt=r,vT(r,e)}yT(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ra(8,t,t.return),ed(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,ed(t));break;default:ed(t)}e=e.sibling}}function vT(e,t){for(;Mt!==null;){var n=Mt;switch(n.tag){case 0:case 11:case 15:ra(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:nc(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Mt=r;else e:for(n=e;Mt!==null;){r=Mt;var o=r.sibling,a=r.return;if(lT(r),r===n){Mt=null;break e}if(o!==null){o.return=a,Mt=o;break e}Mt=a}}}var yM={getCacheForType:function(e){var t=$t(yt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return $t(yt).controller.signal}},bM=typeof WeakMap==="function"?WeakMap:Map,De=0,Ge=null,Ae=null,Re=0,ze=0,An=null,Ho=!1,bs=!1,Ih=!1,mo=0,dt=0,oa=0,Qa=0,Ad=0,On=0,is=0,Ol=null,pn=null,Sg=!1,Wd=0,wT=0,Rd=1/0,Md=null,Xo=null,st=0,pr=null,Za=null,Ir=0,Cg=0,Eg=null,kT=null,Zi=null,es=null,ts=null,_l=0,td=null;function Zn(){return(De&2)!==0&&Re!==0?Re&-Re:pe.T!==null?_h():Ax()}function xT(){if(On===0)if((Re&536870912)===0||ke){var e=Eu;Eu<<=1,(Eu&3932160)===0&&(Eu=262144),On=e}else On=536870912;return e=Kt.current,e!==null&&(e.flags|=32),On}function ss(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=VT(co(e.memoizedProps,n))),es===null&&(es=[]),es.push(t.bind(null,r))}}function hn(e,t,n){if(e===Ge&&(ze===2||ze===9)||e.cancelPendingCommit!==null)ls(e,0),Vo(e,Re,On,!1);if(qd(e,n),(De&2)===0||e!==Ge)e===Ge&&((De&2)===0&&(Qa|=n),dt===4&&Vo(e,Re,On,!1)),yo(e)}function TT(e,t,n){if((De&6)!==0)throw Error(P(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Jl(e,t),o=r?kM(e,t):Sm(e,t,!0),a=r;do{if(o===0){bs&&!r&&Vo(e,t,0,!1);break}else{if(n=e.current.alternate,a&&!vM(n)){o=Sm(e,t,!1),a=!1;continue}if(o===2){if(a=t,e.errorRecoveryDisabledLanes&a)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var s=e;o=Ol;var c=s.current.memoizedState.isDehydrated;if(c&&(ls(s,i).flags|=256),i=Sm(s,i,!1),i!==2&&i!==6){if(Ih&&!c){s.errorRecoveryDisabledLanes|=a,Qa|=a,o=4;break e}a=pn,pn=o,a!==null&&(pn===null?pn=a:pn.push.apply(pn,a))}o=i}if(a=!1,o!==2)continue}}if(o===1){ls(e,0),Vo(e,t,0,!0);break}e:{switch(r=e,a=o,a){case 0:case 1:throw Error(P(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Vo(r,t,On,!Ho);break e;case 2:pn=null;break;case 3:case 5:break;default:throw Error(P(329))}if((t&62914560)===t&&(o=Wd+300-_n(),10<o)){if(Vo(r,t,On,!Ho),Ld(r,0,!0)!==0)break e;Ir=t,r.timeoutHandle=Ph(Lk.bind(null,r,n,pn,Md,Sg,t,On,Qa,is,Ho,a,"Throttled",-0,0),o);break e}Lk(r,n,pn,Md,Sg,t,On,Qa,is,Ho,a,null,-0,0)}}break}while(1);yo(e)}function Lk(e,t,n,r,o,a,i,s,c,f,p,d,u,m){e.timeoutHandle=-1;var y=t.subtreeFlags,g=(a&335544064)===a;if(d=null,g||y&8192||(y&16785408)===16785408){if(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Nr},In=null,hT(t,a,d),g&&(y=d,g=e.containerInfo,g=(g.nodeType===9?g:g.ownerDocument).__reactViewTransition,g!=null&&(y.count++,y.waitingForViewTransition=!0,y=Gl.bind(y),g.finished.then(y,y))),y=(a&62914560)===a?Wd-_n():(a&4194048)===a?wT-_n():0,y=kI(d,y),y!==null){Ir=a,e.cancelPendingCommit=y(Uk.bind(null,e,t,a,n,r,o,i,s,c,f,p,d,null,u,m)),Vo(e,a,i,!f);return}}Uk(e,t,a,n,r,o,i,s,c,f,p,d)}function vM(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var o=n[r],a=o.getSnapshot;o=o.value;try{if(!Ln(a(),o))return!1}catch(i){return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Vo(e,t,n,r){t=xx(e,t),t&=~Ad,t&=~Qa,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var o=t;0<o;){var a=31-Dn(o),i=1<<a;r[a]=-1,o&=~i}n!==0&&Sx(e,n,t)}function Jd(){return(De&6)===0?(ac(0,!1),!1):!0}function Oh(){if(Ae!==null){if(ze===0)var e=Ae.return;else e=Ae,ao=oi=null,gh(e),Xi=null,jl=0,e=Ae;for(;e!==null;)W0(e.alternate,e),e=e.return;Ae=null}}function ls(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,BM(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ir=0,Oh(),Ge=e,Ae=n=io(e.current,null),Re=t,ze=0,An=null,Ho=!1,bs=Jl(e,t),Ih=!1,is=On=Ad=Qa=oa=dt=0,pn=Ol=null,Sg=!1,mo=xx(e,t),$d(),n}function ST(e,t){ye=null,pe.H=xd,t===hs||t===Qd?(t=ck(),ze=3):t===sh?(t=ck(),ze=4):ze=t===Th?8:t!==null&&typeof t==="object"&&typeof t.then==="function"?6:1,An=t,Ae===null&&(dt=1,Td(e,Wn(t,e.current)))}function CT(){var e=Kt.current;return e===null?!0:(Re&4194048)===Re?Jt===null?!0:!1:(Re&62914560)===Re||(Re&536870912)!==0?e===Jt:!1}function ET(){var e=pe.H;return pe.H=xd,e===null?xd:e}function NT(){var e=pe.A;return pe.A=yM,e}function Id(){dt=4,Ho||(Re&4194048)!==Re&&Kt.current!==null||(bs=!0),(oa&134217727)===0&&(Qa&134217727)===0||Ge===null||Vo(Ge,Re,On,!1)}function Sm(e,t,n){var r=De;De|=2;var o=ET(),a=NT();if(Ge!==e||Re!==t)Md=null,ls(e,t);t=!1;var i=dt;e:do try{if(ze!==0&&Ae!==null){var s=Ae,c=An;switch(ze){case 8:Oh(),i=6;break e;case 3:case 2:case 9:case 6:Kt.current===null&&(t=!0);var f=ze;if(ze=0,An=null,Qi(e,s,c,f),n&&bs){i=0;break e}break;default:f=ze,ze=0,An=null,Qi(e,s,c,f)}}wM(),i=dt;break}catch(p){ST(e,p)}while(1);return t&&e.shellSuspendCounter++,ao=oi=null,De=r,pe.H=o,pe.A=a,Ae===null&&(Ge=null,Re=0,$d()),i}function wM(){for(;Ae!==null;)AT(Ae)}function kM(e,t){var n=De;De|=2;var r=ET(),o=NT();Ge!==e||Re!==t?(Md=null,Rd=_n()+500,ls(e,t)):bs=Jl(e,t);e:do try{if(ze!==0&&Ae!==null){t=Ae;var a=An;t:switch(ze){case 1:ze=0,An=null,Qi(e,t,a,1);break;case 2:case 9:if(lk(a)){ze=0,An=null,qk(t);break}t=function(){ze!==2&&ze!==9||Ge!==e||(ze=7),yo(e)},a.then(t,t);break e;case 3:ze=7;break e;case 4:ze=5;break e;case 7:lk(a)?(ze=0,An=null,qk(t)):(ze=0,An=null,Qi(e,t,a,7));break;case 5:var i=null;switch(Ae.tag){case 26:i=Ae.memoizedState;case 5:case 27:var s=Ae;if(i?eS(i):s.stateNode.complete){ze=0,An=null;var c=s.sibling;if(c!==null)Ae=c;else{var f=s.return;f!==null?(Ae=f,Zd(f)):Ae=null}break t}}ze=0,An=null,Qi(e,t,a,5);break;case 6:ze=0,An=null,Qi(e,t,a,6);break;case 8:Oh(),dt=6;break e;default:throw Error(P(462))}}xM();break}catch(p){ST(e,p)}while(1);if(ao=oi=null,pe.H=r,pe.A=o,De=n,Ae!==null)return 0;return Ge=null,Re=0,$d(),dt}function xM(){for(;Ae!==null&&!L1();)AT(Ae)}function AT(e){var t=X0(e.alternate,e,mo);e.memoizedProps=e.pendingProps,t===null?Zd(e):Ae=t}function qk(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Ck(n,t,t.pendingProps,t.type,void 0,Re);break;case 11:t=Ck(n,t,t.pendingProps,t.type.render,t.ref,Re);break;case 5:gh(t);var r=t;r===Ot&&(ke?(gd(r),r.tag===5&&r.stateNode!=null&&(Ze=r.stateNode)):(gd(r),ke=!0));default:W0(n,t),t=Ae=t0(t,mo),t=X0(n,t,mo)}e.memoizedProps=e.pendingProps,t===null?Zd(e):Ae=t}function Qi(e,t,n,r){ao=oi=null,gh(t),Xi=null,jl=0;var o=t.return;try{if(cM(e,o,t,n,Re)){dt=1,Td(e,Wn(n,e.current)),Ae=null;return}}catch(a){if(o!==null)throw Ae=o,a;dt=1,Td(e,Wn(n,e.current)),Ae=null;return}if(t.flags&32768){if(ke||r===1)e=!0;else if(bs||(Re&536870912)!==0)e=!1;else if(Ho=e=!0,r===2||r===9||r===3||r===6)r=Kt.current,r!==null&&r.tag===13&&(r.flags|=16384);RT(t,e)}else Zd(t)}function Zd(e){var t=e;do{if((t.flags&32768)!==0){RT(t,Ho);return}e=t.return;var n=pM(t.alternate,t,mo);if(n!==null){Ae=n;return}if(t=t.sibling,t!==null){Ae=t;return}Ae=t=e}while(t!==null);dt===0&&(dt=5)}function RT(e,t){do{var n=mM(e.alternate,e);if(n!==null){n.flags&=32767,Ae=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ae=e;return}Ae=e=n}while(e!==null);dt=6,Ae=null}function Uk(e,t,n,r,o,a,i,s,c,f,p,d){e.cancelPendingCommit=null;do ef();while(st!==0);if((De&6)!==0)throw Error(P(327));if(t!==null){if(t===e.current)throw Error(P(177));e===Ge&&(Ae=Ge=null,Re=0),Za=t,pr=e,Ir=n,Eg=o,kT=r,TM(e,t,n,i,s,c,d)}}function TM(e,t,n,r,o,a,i){var s=t.lanes|t.childLanes;if(Cg=s,s|=th,K1(e,n,s,r,o,a),es=null,(n&335544064)===n?(ts=YR(e),r=10262):(ts=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,RM(ud,function(){return Mg(),null})):(e.callbackNode=null,e.callbackPriority=0),Ed=!1,r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=pe.T,pe.T=null,o=Le.p,Le.p=2,a=De,De|=4;try{gM(e,t,n)}finally{De=a,Le.p=o,pe.T=r}}st=1,Ed?Zi=GM(i,e.containerInfo,ts,Ng,Ag,CM,Rg,Mg,SM,null,null):(Ng(),Ag(),Rg())}function SM(e){if(st!==0){var t=pr.onRecoverableError;t(e,{componentStack:null})}}function CM(){st===3&&(st=0,mT(Za,pr),st=4)}function Ng(){if(st===1){st=0;var e=pr,t=Za,n=Ir,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=pe.T,pe.T=null;var o=Le.p;Le.p=2;var a=De;De|=4;try{bl=Nd=!1,fT(t,e,n),n=Lg;var i=Gx(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(i!==s&&s&&s.ownerDocument&&Kx(s.ownerDocument.documentElement,s)){if(c!==null&&eh(s)){var{start:f,end:p}=c;if(p===void 0&&(p=f),"selectionStart"in s)s.selectionStart=f,s.selectionEnd=Math.min(p,s.value.length);else{var d=s.ownerDocument||document,u=d&&d.defaultView||window;if(u.getSelection){var m=u.getSelection(),y=s.textContent.length,g=Math.min(c.start,y),x=c.end===void 0?g:Math.min(c.end,y);!m.extend&&g>x&&(i=x,x=g,g=i);var k=ek(s,g),b=ek(s,x);if(k&&b&&(m.rangeCount!==1||m.anchorNode!==k.node||m.anchorOffset!==k.offset||m.focusNode!==b.node||m.focusOffset!==b.offset)){var v=d.createRange();v.setStart(k.node,k.offset),m.removeAllRanges(),g>x?(m.addRange(v),m.extend(b.node,b.offset)):(v.setEnd(b.node,b.offset),m.addRange(v))}}}}d=[];for(m=s;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});typeof s.focus==="function"&&s.focus();for(s=0;s<d.length;s++){var w=d[s];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}ps=!!Dg,Lg=Dg=null}finally{De=a,Le.p=o,pe.T=r}}e.current=t,st=2}}function Ag(){if(st===2){st=0;var e=pr,t=Za,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=pe.T,pe.T=null;var r=Le.p;Le.p=2;var o=De;De|=4;try{iT(e,t.alternate,t)}finally{De=o,Le.p=r,pe.T=n}}st=3}}function Rg(){if(st===4||st===3){st=0;var e=Zi;Zi=null,q1();var t=pr,n=Za,r=Ir,o=kT,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?st=5:(st=0,Za=pr=null,MT(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Xo=null),Yg(r),n=n.stateNode,Pn&&typeof Pn.onCommitFiberRoot==="function")try{Pn.onCommitFiberRoot(Wl,n,void 0,(n.current.flags&128)===128)}catch(f){}if(o!==null){n=pe.T,a=Le.p,Le.p=2,pe.T=null;try{for(var i=t.onRecoverableError,s=0;s<o.length;s++){var c=o[s];i(c.value,{componentStack:c.stack})}}finally{pe.T=n,Le.p=a}}if(o=es,i=ts,ts=null,o!==null&&(es=null,i===null&&(i=[]),e!==null))for(c=0;c<o.length;c++)n=(0,o[c])(i),n!==void 0&&e.finished.finally(n);(Ir&3)!==0&&ef(),yo(t),a=t.pendingLanes,(r&261930)!==0&&(a&42)!==0?t===td?_l++:(_l=0,td=t):(_l=0,td=null),ac(0,!1)}}function MT(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,nc(t)))}function ef(){return Zi!==null&&(Zi.skipTransition(),Zi=null),Ng(),Ag(),Rg(),Mg()}function Mg(){if(st!==5)return!1;var e=pr,t=Cg;Cg=0;var n=Yg(Ir),r=pe.T,o=Le.p;try{Le.p=32>n?32:n,pe.T=null,n=Eg,Eg=null;var a=pr,i=Ir;if(st=0,Za=pr=null,Ir=0,(De&6)!==0)throw Error(P(331));var s=De;if(De|=4,bT(a.current),gT(a,a.current,i,n),De=s,ac(0,!1),Pn&&typeof Pn.onPostCommitFiberRoot==="function")try{Pn.onPostCommitFiberRoot(Wl,a)}catch(c){}return!0}finally{Le.p=o,pe.T=r,MT(e,t)}}function zk(e,t,n){t=Wn(n,t),t=cg(e.stateNode,t,2),e=Va(e,t,2),e!==null&&(qd(e,2),yo(e))}function Be(e,t,n){if(e.tag===3)zk(e,e,n);else for(;t!==null;){if(t.tag===3){zk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==="function"||typeof r.componentDidCatch==="function"&&(Xo===null||!Xo.has(r))){e=Wn(n,e),n=Q0(2),r=Va(t,n,2),r!==null&&(K0(n,r,t,e),qd(r,2),yo(r));break}}t=t.return}}function Cm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new bM;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(Ih=!0,o.add(n),e=EM.bind(null,e,t,n),t.then(e,e))}function EM(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ge===e&&(Re&n)===n&&(dt===4||dt===3&&(Re&62914560)===Re&&300>_n()-Wd?(De&2)===0?ls(e,0):Ad|=n:Ad|=n,is===Re&&(is=0)),yo(e)}function IT(e,t){t===0&&(t=Tx()),e=ri(e,t),e!==null&&(qd(e,t),yo(e))}function NM(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),IT(e,n)}function AM(e,t){var n=0;switch(e.tag){case 31:case 13:var{stateNode:r,memoizedState:o}=e;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(P(314))}r!==null&&r.delete(t),IT(e,n)}function RM(e,t){return Gg(e,t)}var cs=null,Oi=null,Ig=!1,Od=!1,Em=!1,Qo=0;function yo(e){e!==Oi&&e.next===null&&(Oi===null?cs=Oi=e:Oi=Oi.next=e),Od=!0,Ig||(Ig=!0,IM())}function ac(e,t){if(!Em&&Od){Em=!0;do{var n=!1;for(var r=cs;r!==null;){if(!t)if(e!==0){var o=r.pendingLanes;if(o===0)var a=0;else{var i=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Dn(42|e)+1)-1,a&=o&~(i&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,jk(r,a))}else a=Re,a=Ld(r,r===Ge?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(a&3)===0||Jl(r,a)||(n=!0,jk(r,a));r=r.next}}while(n);Em=!1}}function MM(){OT()}function OT(){Od=Ig=!1;var e=0;Qo!==0&&jM()&&(e=Qo);for(var t=_n(),n=null,r=cs;r!==null;){var o=r.next,a=_T(r,t);if(a===0)r.next=null,n===null?cs=o:n.next=o,o===null&&(Oi=n);else if(n=r,e!==0||(a&3)!==0)Od=!0;r=o}st!==0&&st!==5||ac(e,!1),Qo!==0&&(Qo=0)}function _T(e,t){for(var{suspendedLanes:n,pingedLanes:r,expirationTimes:o}=e,a=e.pendingLanes&-62914561;0<a;){var i=31-Dn(a),s=1<<i,c=o[i];if(c===-1){if((s&n)===0||(s&r)!==0)o[i]=Q1(s,t)}else c<=t&&(e.expiredLanes|=s);a&=~s}if(t=Ge,n=Re,n=Ld(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(ze===2||ze===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&am(r),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Jl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&am(r),Yg(n)){case 2:case 8:n=wx;break;case 32:n=ud;break;case 268435456:n=kx;break;default:n=ud}return r=PT.bind(null,e),n=Gg(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&am(r),e.callbackPriority=2,e.callbackNode=null,2}function PT(e,t){if(st!==0&&st!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ef()&&e.callbackNode!==n)return null;var r=Re;if(r=Ld(e,e===Ge?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0)return null;return TT(e,r,t),_T(e,_n()),e.callbackNode!=null&&e.callbackNode===n?PT.bind(null,e):null}function jk(e,t){if(ef())return null;TT(e,t,!0)}function IM(){$M(function(){(De&6)!==0?Gg(vx,MM):OT()})}function _h(){if(Qo===0){var e=Fa;e===0&&(e=Cu,Cu<<=1,(Cu&261888)===0&&(Cu=256)),Qo=e}return Qo}function Bk(e){return e==null||typeof e==="symbol"||typeof e==="boolean"?null:typeof e==="function"?e:$u(e)}function OM(e,t,n,r,o){if(t==="submit"&&n&&n.stateNode===o){var a=Bk((o[bn]||null).action),i=r.submitter;i&&(t=(t=i[bn]||null)?Bk(t.formAction):i.getAttribute("formAction"),t!==null&&(a=t,i=null));var s=new zd("action","action",null,r,o);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Qo!==0){var c=new FormData(o,i);sg(n,{pending:!0,data:c,method:o.method,action:a},null,c)}}else typeof a==="function"&&(s.preventDefault(),c=new FormData(o,i),sg(n,{pending:!0,data:c,method:o.method,action:a},a,c))},currentTarget:o}]})}}for(vl=0;vl<Xm.length;vl++)wl=Xm[vl],Og=wl.toLowerCase(),_g=wl[0].toUpperCase()+wl.slice(1),mr(Og,"on"+_g);var wl,Og,_g,vl;mr(Fx,"onAnimationEnd");mr(Xx,"onAnimationIteration");mr(Wx,"onAnimationStart");mr("dblclick","onDoubleClick");mr("focusin","onFocus");mr("focusout","onBlur");mr(jR,"onTransitionRun");mr(BR,"onTransitionStart");mr($R,"onTransitionCancel");mr(Jx,"onTransitionEnd");rs("onMouseEnter",["mouseout","mouseover"]);rs("onMouseLeave",["mouseout","mouseover"]);rs("onPointerEnter",["pointerout","pointerover"]);rs("onPointerLeave",["pointerout","pointerover"]);ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ti("onBeforeInput",["compositionend","keypress","textInput","paste"]);ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hl="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(" "),_M=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hl));function DT(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],c=s.instance,f=s.currentTarget;if(s=s.listener,c!==a&&o.isPropagationStopped())break e;a=s,o.currentTarget=f;try{a(o)}catch(p){fd(p)}o.currentTarget=null,a=c}else for(i=0;i<r.length;i++){if(s=r[i],c=s.instance,f=s.currentTarget,s=s.listener,c!==a&&o.isPropagationStopped())break e;a=s,o.currentTarget=f;try{a(o)}catch(p){fd(p)}o.currentTarget=null,a=c}}}}function Ne(e,t){var n=t[qw];n===void 0&&(n=t[qw]=new Set);var r=e+"__bubble";n.has(r)||(qT(t,e,2,!1),n.add(r))}function Nm(e,t,n){var r=0;t&&(r|=4),qT(n,e,r,t)}var Uu="_reactListening"+Math.random().toString(36).slice(2);function LT(e){if(!e[Uu]){e[Uu]=!0,Mx.forEach(function(n){n!=="selectionchange"&&(_M.has(n)||Nm(n,!1,e),Nm(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uu]||(t[Uu]=!0,Nm("selectionchange",!1,t))}}function qT(e,t,n,r){switch(aS(t)){case 2:var o=NI;break;case 8:o=AI;break;default:o=jh}n=o.bind(null,t,n,e),o=void 0,!Km||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Am(e,t,n,r,o){var a=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var s=r.stateNode.containerInfo;if(s===o)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===o)return;i=i.return}for(;s!==null;){if(i=qa(s),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){r=a=i;continue e}s=s.parentNode}}r=r.return}Ux(function(){var f=a,p=Xg(n),d=[];e:{var u=Zx.get(e);if(u!==void 0){var m=zd,y=e;switch(e){case"keypress":if(Vu(n)===0)break e;case"keydown":case"keyup":m=hR;break;case"focusin":y="focus",m=dm;break;case"focusout":y="blur",m=dm;break;case"beforeblur":case"afterblur":m=dm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=Qw;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=oR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=kR;break;case Fx:case Xx:case Wx:m=sR;break;case Jx:m=TR;break;case"scroll":case"scrollend":m=nR;break;case"wheel":m=CR;break;case"copy":case"cut":case"paste":m=cR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Gw;break;case"submit":m=vR;break;case"toggle":case"beforetoggle":m=NR}var g=(t&4)!==0,x=!g&&(e==="scroll"||e==="scrollend"),k=g?u!==null?u+"Capture":null:u;g=[];for(var b=f,v;b!==null;){var w=b;if(v=w.stateNode,w=w.tag,w!==5&&w!==26&&w!==27||v===null||k===null||(w=Dl(b,k),w!=null&&g.push(Vl(b,w,v))),x)break;b=b.return}0<g.length&&(u=new m(u,y,null,n,p),d.push({event:u,listeners:g}))}}if((t&7)===0){e:{if(m=e==="mouseover"||e==="pointerover",u=e==="mouseout"||e==="pointerout",m&&n!==Qm&&(y=n.relatedTarget||n.fromElement)&&(qa(y)||y[Zl]))break e;if(u||m){if(y=p.window===p?p:(m=p.ownerDocument)?m.defaultView||m.parentWindow:window,u){if(m=n.relatedTarget||n.toElement,u=f,m=m?qa(m):null,m!==null&&(x=Xl(m),g=m.tag,m!==x||g!==5&&g!==27&&g!==6))m=null}else u=null,m=f;if(u!==m){if(g=Qw,w="onMouseLeave",k="onMouseEnter",b="mouse",e==="pointerout"||e==="pointerover")g=Gw,w="onPointerLeave",k="onPointerEnter",b="pointer";x=u==null?y:ml(u),v=m==null?y:ml(m),y=new g(w,b+"leave",u,n,p),y.target=x,y.relatedTarget=v,w=null,qa(p)===f&&(g=new g(k,b+"enter",m,n,p),g.target=v,g.relatedTarget=x,w=g),x=w,g=u&&m?_m(u,m,PM):null,u!==null&&$k(d,y,u,g,!1),m!==null&&x!==null&&$k(d,x,m,g,!0)}}}e:{if(u=f?ml(f):window,m=u.nodeName&&u.nodeName.toLowerCase(),m==="select"||m==="input"&&u.type==="file")var T=Ww;else if(Xw(u))if(Vx)T=qR;else{T=DR;var C=PR}else m=u.nodeName,!m||m.toLowerCase()!=="input"||u.type!=="checkbox"&&u.type!=="radio"?f&&Fg(f.elementType)&&(T=Ww):T=LR;if(T&&(T=T(e,f))){Hx(d,T,n,p);break e}C&&C(e,u,f)}switch(C=f?ml(f):window,e){case"focusin":if(Xw(C)||C.contentEditable==="true")zi=C,Ym=f,Tl=null;break;case"focusout":Tl=Ym=zi=null;break;case"mousedown":Fm=!0;break;case"contextmenu":case"mouseup":case"dragend":Fm=!1,tk(d,n,p);break;case"selectionchange":if(zR)break;case"keydown":case"keyup":tk(d,n,p)}var E;if(Zg)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Ui?Bx(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");if(A&&(jx&&n.locale!=="ko"&&(Ui||A!=="onCompositionStart"?A==="onCompositionEnd"&&Ui&&(E=zx()):(Bo=p,Wg=("value"in Bo)?Bo.value:Bo.textContent,Ui=!0)),C=_d(f,A),0<C.length&&(A=new Kw(A,e,null,n,p),d.push({event:A,listeners:C}),E?A.data=E:(E=$x(n),E!==null&&(A.data=E)))),E=RR?MR(e,n):IR(e,n))A=_d(f,"onBeforeInput"),0<A.length&&(C=new Kw("onBeforeInput","beforeinput",null,n,p),d.push({event:C,listeners:A}),C.data=E);OM(d,e,f,n,p)}DT(d,t)})}function Vl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function _d(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,a=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||a===null||(o=Dl(e,n),o!=null&&r.unshift(Vl(e,o,a)),o=Dl(e,t),o!=null&&r.push(Vl(e,o,a))),e.tag===3)return r;e=e.return}return[]}function PM(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e?e:null}function $k(e,t,n,r,o){for(var a=t._reactName,i=[];n!==null&&n!==r;){var s=n,c=s.alternate,f=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||f===null||(c=f,o?(f=Dl(n,a),f!=null&&i.unshift(Vl(n,f,c))):o||(f=Dl(n,a),f!=null&&i.push(Vl(n,f,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var DM=/\r\n?/g,LM=/\u0000|\uFFFD/g;function Hk(e){return(typeof e==="string"?e:""+e).replace(DM,`
|
|
9
|
+
`).replace(LM,"")}function UT(e,t){return t=Hk(t),Hk(e)===t?!0:!1}function je(e,t,n,r,o,a){switch(n){case"children":if(typeof r==="string")t==="body"||t==="textarea"&&r===""||os(e,r);else if(typeof r==="number"||typeof r==="bigint")t!=="body"&&os(e,""+r);else return;break;case"className":Au(e,"class",r);break;case"tabIndex":Au(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Au(e,n,r);break;case"style":qx(e,r,a);return;case"data":if(t!=="object"){Au(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r==="function"||typeof r==="symbol"||typeof r==="boolean"){e.removeAttribute(n);break}r=$u(r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r==="function"){e.setAttribute(n,"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 a==="function"&&(n==="formAction"?(t!=="input"&&je(e,t,"name",o.name,o,null),je(e,t,"formEncType",o.formEncType,o,null),je(e,t,"formMethod",o.formMethod,o,null),je(e,t,"formTarget",o.formTarget,o,null)):(je(e,t,"encType",o.encType,o,null),je(e,t,"method",o.method,o,null),je(e,t,"target",o.target,o,null)));if(r==null||typeof r==="symbol"||typeof r==="boolean"){e.removeAttribute(n);break}r=$u(r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=Nr);return;case"onScroll":r!=null&&Ne("scroll",e);return;case"onScrollEnd":r!=null&&Ne("scrollend",e);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!=="object"||!("__html"in r))throw Error(P(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(P(60));(a!=null?a.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"multiple":e.multiple=r&&typeof r!=="function"&&typeof r!=="symbol";break;case"muted":e.muted=r&&typeof r!=="function"&&typeof r!=="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r==="function"||typeof r==="boolean"||typeof r==="symbol"){e.removeAttribute("xlink:href");break}n=$u(r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!=="function"&&typeof r!=="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":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":r&&typeof r!=="function"&&typeof r!=="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!=="function"&&typeof r!=="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!=="function"&&typeof r!=="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r==="function"||typeof r==="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Ne("beforetoggle",e),Ne("toggle",e),Bu(e,"popover",r);break;case"xlinkActuate":no(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":no(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":no(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":no(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":no(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":no(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":no(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":no(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":no(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Bu(e,"is",r);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=eR.get(n)||n,Bu(e,n,r);else return}_e=!0}function Pg(e,t,n,r,o,a){switch(n){case"style":qx(e,r,a);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!=="object"||!("__html"in r))throw Error(P(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(P(60));(a!=null?a.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"children":if(typeof r==="string")os(e,r);else if(typeof r==="number"||typeof r==="bigint")os(e,""+r);else return;break;case"onScroll":r!=null&&Ne("scroll",e);return;case"onScrollEnd":r!=null&&Ne("scrollend",e);return;case"onClick":r!=null&&(e.onclick=Nr);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Ix.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),a=n.slice(2,o?n.length-7:void 0),t=e[bn]||null,t=t!=null?t[n]:null,typeof t==="function"&&e.removeEventListener(a,t,o),typeof r==="function")){typeof t!=="function"&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,r,o);break e}_e=!0,n in e?e[n]=r:r===!0?e.setAttribute(n,""):Bu(e,n,r)}return}_e=!0}function Qt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ne("error",e),Ne("load",e);var r=!1,o=!1,a;for(a in n)if(n.hasOwnProperty(a)){var i=n[a];if(i!=null)switch(a){case"src":r=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(P(137,t));default:je(e,t,a,i,n,null)}}o&&je(e,t,"srcSet",n.srcSet,n,null),r&&je(e,t,"src",n.src,n,null);return;case"input":Ne("invalid",e);var s=a=i=o=null,c=null,f=null;for(r in n)if(n.hasOwnProperty(r)){var p=n[r];if(p!=null)switch(r){case"name":o=p;break;case"type":i=p;break;case"checked":c=p;break;case"defaultChecked":f=p;break;case"value":a=p;break;case"defaultValue":s=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(P(137,t));break;default:je(e,t,r,p,n,null)}}Px(e,a,s,c,f,i,o,!1);return;case"select":Ne("invalid",e),r=i=a=null;for(o in n)if(n.hasOwnProperty(o)&&(s=n[o],s!=null))switch(o){case"value":a=s;break;case"defaultValue":i=s;break;case"multiple":r=s;default:je(e,t,o,s,n,null)}t=a,n=i,e.multiple=!!r,t!=null?Gi(e,!!r,t,!1):n!=null&&Gi(e,!!r,n,!0);return;case"textarea":Ne("invalid",e),a=o=r=null;for(i in n)if(n.hasOwnProperty(i)&&(s=n[i],s!=null))switch(i){case"value":r=s;break;case"defaultValue":o=s;break;case"children":a=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(P(91));break;default:je(e,t,i,s,n,null)}Lx(e,r,o,a);return;case"option":for(c in n)if(n.hasOwnProperty(c)&&(r=n[c],r!=null))switch(c){case"selected":e.selected=r&&typeof r!=="function"&&typeof r!=="symbol";break;default:je(e,t,c,r,n,null)}return;case"dialog":Ne("beforetoggle",e),Ne("toggle",e),Ne("cancel",e),Ne("close",e);break;case"iframe":case"object":Ne("load",e);break;case"video":case"audio":for(r=0;r<Hl.length;r++)Ne(Hl[r],e);break;case"image":Ne("error",e),Ne("load",e);break;case"details":Ne("toggle",e);break;case"embed":case"source":case"link":Ne("error",e),Ne("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(f in n)if(n.hasOwnProperty(f)&&(r=n[f],r!=null))switch(f){case"children":case"dangerouslySetInnerHTML":throw Error(P(137,t));default:je(e,t,f,r,n,null)}return;default:if(Fg(t)){for(p in n)n.hasOwnProperty(p)&&(r=n[p],r!==void 0&&Pg(e,t,p,r,n,void 0));return}}for(s in n)n.hasOwnProperty(s)&&(r=n[s],r!=null&&je(e,t,s,r,n,null))}var qM={};function UM(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,a=null,i=null,s=null,c=null,f=null,p=null;for(m in n){var d=n[m];if(n.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":c=d;default:r.hasOwnProperty(m)||je(e,t,m,null,r,d)}}for(var u in r){var m=r[u];if(d=n[u],r.hasOwnProperty(u)&&(m!=null||d!=null))switch(u){case"type":m!==d&&(_e=!0),a=m;break;case"name":m!==d&&(_e=!0),o=m;break;case"checked":m!==d&&(_e=!0),f=m;break;case"defaultChecked":m!==d&&(_e=!0),p=m;break;case"value":m!==d&&(_e=!0),i=m;break;case"defaultValue":m!==d&&(_e=!0),s=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(P(137,t));break;default:m!==d&&je(e,t,u,m,r,d)}}Vm(e,i,s,c,f,p,a,o);return;case"select":m=i=s=u=null;for(a in n)if(c=n[a],n.hasOwnProperty(a)&&c!=null)switch(a){case"value":break;case"multiple":m=c;default:r.hasOwnProperty(a)||je(e,t,a,null,r,c)}for(o in r)if(a=r[o],c=n[o],r.hasOwnProperty(o)&&(a!=null||c!=null))switch(o){case"value":a!==c&&(_e=!0),u=a;break;case"defaultValue":a!==c&&(_e=!0),s=a;break;case"multiple":a!==c&&(_e=!0),i=a;default:a!==c&&je(e,t,o,a,r,c)}t=s,n=i,r=m,u!=null?Gi(e,!!n,u,!1):!!r!==!!n&&(t!=null?Gi(e,!!n,t,!0):Gi(e,!!n,n?[]:"",!1));return;case"textarea":m=u=null;for(s in n)if(o=n[s],n.hasOwnProperty(s)&&o!=null&&!r.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:je(e,t,s,null,r,o)}for(i in r)if(o=r[i],a=n[i],r.hasOwnProperty(i)&&(o!=null||a!=null))switch(i){case"value":o!==a&&(_e=!0),u=o;break;case"defaultValue":o!==a&&(_e=!0),m=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(P(91));break;default:o!==a&&je(e,t,i,o,r,a)}Dx(e,u,m);return;case"option":for(var y in n)if(u=n[y],n.hasOwnProperty(y)&&u!=null&&!r.hasOwnProperty(y))switch(y){case"selected":e.selected=!1;break;default:je(e,t,y,null,r,u)}for(c in r)if(u=r[c],m=n[c],r.hasOwnProperty(c)&&u!==m&&(u!=null||m!=null))switch(c){case"selected":u!==m&&(_e=!0),e.selected=u&&typeof u!=="function"&&typeof u!=="symbol";break;default:je(e,t,c,u,r,m)}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 g in n)u=n[g],n.hasOwnProperty(g)&&u!=null&&!r.hasOwnProperty(g)&&je(e,t,g,null,r,u);for(f in r)if(u=r[f],m=n[f],r.hasOwnProperty(f)&&u!==m&&(u!=null||m!=null))switch(f){case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(P(137,t));break;default:je(e,t,f,u,r,m)}return;default:if(Fg(t)){for(var x in n)u=n[x],n.hasOwnProperty(x)&&u!==void 0&&!r.hasOwnProperty(x)&&Pg(e,t,x,void 0,r,u);for(p in r)u=r[p],m=n[p],!r.hasOwnProperty(p)||u===m||u===void 0&&m===void 0||Pg(e,t,p,u,r,m);return}}for(var k in n)u=n[k],n.hasOwnProperty(k)&&u!=null&&!r.hasOwnProperty(k)&&je(e,t,k,null,r,u);for(d in r)u=r[d],m=n[d],!r.hasOwnProperty(d)||u===m||u==null&&m==null||je(e,t,d,u,r,m)}function Vk(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zM(){if(typeof performance.getEntriesByType==="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var o=n[r],{transferSize:a,initiatorType:i,duration:s}=o;if(a&&s&&Vk(i)){i=0,s=o.responseEnd;for(r+=1;r<n.length;r++){var c=n[r],f=c.startTime;if(f>s)break;var p=c.transferSize,d=c.initiatorType;p&&Vk(d)&&(c=c.responseEnd,i+=p*(c<s?1:(s-f)/(c-f)))}if(--r,t+=8*(a+i)/(o.duration/1000),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==="number")?e:5}var Dg=null,Lg=null;function Ql(e){return e.nodeType===9?e:e.ownerDocument}function Qk(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function zT(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function jT(e,t,n,r){return n=Ql(n).createElement(e),n[Bt]=r,n[bn]=t,Qt(n,e,t),It(n),n}function qg(e,t){return e==="textarea"||e==="noscript"||typeof t.children==="string"||typeof t.children==="number"||typeof t.children==="bigint"||typeof t.dangerouslySetInnerHTML==="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Rm=null;function jM(){var e=window.event;if(e&&e.type==="popstate"){if(e===Rm)return!1;return Rm=e,!0}return Rm=null,!1}var Ph=typeof setTimeout==="function"?setTimeout:void 0,BM=typeof clearTimeout==="function"?clearTimeout:void 0,Kk=typeof Promise==="function"?Promise:void 0,Gk=typeof requestAnimationFrame==="function"?requestAnimationFrame:Ph,$M=typeof queueMicrotask==="function"?queueMicrotask:typeof Kk<"u"?function(e){return Kk.resolve(null).then(e).catch(HM)}:Ph;function HM(e){setTimeout(function(){throw e})}function ia(e){return e==="head"}function Yk(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(o),ms(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Im(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Im(n);for(var a=n.firstChild;a;){var i=a.nextSibling,s=a.nodeName;a[ec]||s==="SCRIPT"||s==="STYLE"||s==="LINK"&&a.rel.toLowerCase()==="stylesheet"||n.removeChild(a),a=i}}else n==="body"&&Im(e.ownerDocument.body);n=o}while(n);ms(t)}function Fk(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$")if(e===0)break;else e--;else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=r}while(n)}function BT(e,t,n){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display==="inline"){if(t=e.getClientRects(),t.length===1)var r=1;else for(var o=r=0;o<t.length;o++){var a=t[o];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+n.paddingTop,e.marginBottom="-"+n.paddingBottom)}}function $T(e,t){e=e.style,t=t.style;var n=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=n==null||typeof n==="boolean"?"":(""+n).trim(),n=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=n==null||typeof n==="boolean"?"":(""+n).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(n=t.display,e.display=n==null||typeof n==="boolean"?"":n,n=t.margin,n!=null?e.margin=n:(n=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=n==null||typeof n==="boolean"?"":n,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t==="boolean"?"":t)))}function HT(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Ug(e){var t=e.getBoundingClientRect(),n=getComputedStyle(e);return HT(t,n,e)}function VM(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+20000,t.y+20000,t.width,t.height);var n=getComputedStyle(e);return HT(t,n,e)}function QM(e){return e.documentElement.clientHeight}function KM(e){this.addEventListener("load",e),this.addEventListener("error",e)}function GM(e,t,n,r,o,a,i,s,c){var f=t.nodeType===9?t:t.ownerDocument;try{var p=f.startViewTransition({update:function(){var u=f.defaultView,m=u.navigation&&u.navigation.transition,y=f.fonts.status;r();var g=[];if(y==="loaded"&&(QM(f),f.fonts.status==="loading"&&g.push(f.fonts.ready)),y=g.length,e!==null)for(var x=e.suspenseyImages,k=0,b=0;b<x.length;b++){var v=x[b];if(!v.complete){var w=v.getBoundingClientRect();if(0<w.bottom&&0<w.right&&w.top<u.innerHeight&&w.left<u.innerWidth){if(k+=tS(v),k>od){g.length=y;break}v=new Promise(KM.bind(v)),g.push(v)}}}if(0<g.length)return u=Promise.race([Promise.all(g),new Promise(function(T){return setTimeout(T,500)})]).then(o,o),(m?Promise.allSettled([m.finished,u]):u).then(a,a);if(o(),m)return m.finished.then(a,a);a()},types:n});f.__reactViewTransition=p;var d=[];return p.ready.then(function(){for(var u=f.documentElement.getAnimations({subtree:!0}),m=0;m<u.length;m++){var y=u[m],g=y.effect,x=g.pseudoElement;if(x!=null&&x.startsWith("::view-transition")){d.push(y),y=g.getKeyframes();for(var k=x=void 0,b=!0,v=0;v<y.length;v++){var w=y[v],T=w.width;if(x===void 0)x=T;else if(x!==T){b=!1;break}if(T=w.height,k===void 0)k=T;else if(k!==T){b=!1;break}delete w.width,delete w.height,w.transform==="none"&&delete w.transform}b&&x!==void 0&&k!==void 0&&(g.setKeyframes(y),b=getComputedStyle(g.target,g.pseudoElement),b.width!==x||b.height!==k)&&(b=y[0],b.width=x,b.height=k,b=y[y.length-1],b.width=x,b.height=k,g.setKeyframes(y))}}i()},function(u){f.__reactViewTransition===p&&(f.__reactViewTransition=null);try{if(typeof u==="object"&&u!==null)switch(u.name){case"InvalidStateError":if(u.message==="View transition was skipped because document visibility state is hidden."||u.message==="Skipping view transition because document visibility state has become hidden."||u.message==="Skipping view transition because viewport size changed."||u.message==="Transition was aborted because of invalid state")u=null}u!==null&&c(u)}finally{r(),o(),i()}}),p.finished.finally(function(){for(var u=0;u<d.length;u++)d[u].cancel();f.__reactViewTransition===p&&(f.__reactViewTransition=null),s()}),p}catch(u){return r(),o(),i(),null}}function Ua(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}Ua.prototype.animate=function(e,t){return t=typeof t==="number"?{duration:t}:Ye({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)};Ua.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],o=0;o<n.length;o++){var a=n[o].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[o])}return r};Ua.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function VT(e){return{name:e,group:new Ua("group",e),imagePair:new Ua("image-pair",e),old:new Ua("old",e),new:new Ua("new",e)}}function qn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}qn.prototype.addEventListener=function(e,t,n){var r=null,o=null;if(n!=null&&typeof n!=="boolean"&&(r=n.signal||null,r!==null&&r.aborted))return;this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(QT(a,e,t,n)===-1){var i=this,s=t;n!=null&&typeof n!=="boolean"&&n.once===!0&&(s=function(c){i.removeEventListener(e,t,n),typeof t==="function"?t.call(this,c):t.handleEvent(c)}),r!==null&&(o=i.removeEventListener.bind(i,e,t,n),r.addEventListener("abort",o,{once:!0}),o=r.removeEventListener.bind(r,"abort",o)),r=us(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:o}),yn(this._fragmentFiber.child,!1,YM,e,s,r)}this._eventListeners=a};function YM(e,t,n,r){return Ct(e).addEventListener(t,n,r),!1}qn.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=QT(r,e,t,n),t!==-1)){var o=r[t];n=o.attachedListener;var a=o.cleanup;o=us(o.optionsOrUseCapture),yn(this._fragmentFiber.child,!1,FM,e,n,o),r.splice(t,1),a!==null&&a()}};function FM(e,t,n,r){return Ct(e).removeEventListener(t,n,r),!1}function us(e){return e!=null&&typeof e!=="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Xk(e){return e==null?"c=0":typeof e==="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function QT(e,t,n,r){if(e.length===0)return-1;r=Xk(r);for(var o=0;o<e.length;o++){var a=e[o];if(a.type===t&&a.listener===n&&Xk(a.optionsOrUseCapture)===r)return o}return-1}qn.prototype.dispatchEvent=function(e){var t=ei(this._fragmentFiber);if(t===null)return!0;t=Ct(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(""):document.createTextNode("");if(n)for(var o=0;o<n.length;o++){var a=n[o];r.addEventListener(a.type,a.attachedListener,us(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(o=0;o<n.length;o++)a=n[o],r.removeEventListener(a.type,a.attachedListener,us(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)};qn.prototype.focus=function(e){yn(this._fragmentFiber.child,!0,KT,e,void 0,void 0)};function KT(e,t){if(e.tag===6)return!1;return e=Ct(e),sI(e,t)}qn.prototype.focusLast=function(e){var t=[];yn(this._fragmentFiber.child,!0,Dh,t,void 0,void 0);for(var n=t.length-1;0<=n&&!KT(t[n],e);n--);};function Dh(e,t){return t.push(e),!1}qn.prototype.blur=function(){var e=ei(this._fragmentFiber);e!==null&&(e=Ct(e),e=Ql(e).activeElement,e!==null&&yn(this._fragmentFiber.child,!1,XM,e,void 0,void 0))};function XM(e,t){if(e.tag===6)return!1;return e=Ct(e),e===t||e.contains(t)?(t.blur(),!0):!1}qn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),yn(this._fragmentFiber.child,!1,WM,e,void 0,void 0)};function WM(e,t){if(e.tag===6)return!1;return e=Ct(e),t.observe(e),!1}qn.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),yn(this._fragmentFiber.child,!1,JM,e,void 0,void 0);for(var n=t=0;n<fr.length;n++){var r=fr[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):fr[t++]=r}fr.length=t}};function JM(e,t){if(e.tag===6)return!1;return e=Ct(e),t.unobserve(e),!1}var fr=[],Mm=!1;function ZM(e,t,n){fr.push({fragmentInstance:e,observer:t,instance:n}),Mm||(Mm=!0,lI(function(){Mm=!1;var r=fr;fr=[];for(var o=0;o<r.length;o++){var a=r[o];a.observer.unobserve(a.instance)}}))}qn.prototype.getClientRects=function(){var e=[];return yn(this._fragmentFiber.child,!1,eI,e,void 0,void 0),e};function eI(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=Ct(e),t.push.apply(t,e.getClientRects());return!1}qn.prototype.getRootNode=function(e){var t=ei(this._fragmentFiber);return t===null?this:Ct(t).getRootNode(e)};qn.prototype.compareDocumentPosition=function(e){var t=ei(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];yn(this._fragmentFiber.child,!1,Dh,n,void 0,void 0);var r=Ct(t);if(n.length===0){if(n=r,Iw(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var o=r=n.compareDocumentPosition(e);return n===e?o=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=gx(t)[1],n===null?o=Node.DOCUMENT_POSITION_PRECEDING:(e=Ct(n).compareDocumentPosition(e),o=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),o|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=Ct(n[0]),o=Ct(n[n.length-1]);var a=Iw(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY;var i=t.compareDocumentPosition(e),s=o.compareDocumentPosition(e),c=i&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&i&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&o===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&o===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:i,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||tI(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function tI(e,t,n,r,o){var a=qa(o);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)e:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break e}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=o.ownerDocument,o===a||o===a.documentElement||o===a.body;e:{a=t;for(t=ei(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break e}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=_m(n,a,Ow),t===null?t=!1:(yn(t,!0,A1,a,n),a=Pi,Pi=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=_m(r,a,Ow),t===null?t=!1:(yn(t,!0,R1,a,r),a=Pi,Om=Pi=null,t=a!==null)),t):!1}function Wk(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}qn.prototype.scrollIntoView=function(e){if(typeof e==="object")throw Error(P(566));var t=[];yn(this._fragmentFiber.child,!1,Dh,t,void 0,void 0);var n=e!==!1;if(t.length===0){var r=gx(this._fragmentFiber);if(r=n?r[1]||r[0]||ei(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=Ct(r),Wk(e,n);return}if(r=Ct(r),r.nodeType!==9){if(r.nodeType===11){n="host"in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var o=t[r];o.tag===6?(o=Ct(o),Wk(o,n)):Ct(o).scrollIntoView(e),r+=n?-1:1}};function nI(e,t){return e=Ct(e),GT(e,t),!1}function GT(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function YT(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];e.addEventListener(o.type,o.attachedListener,us(o.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(a){for(var i=0,s=0;s<fr.length;s++){var c=fr[s];if(c.fragmentInstance!==t||c.observer!==a||c.instance!==e)fr[i++]=c}fr.length=i,a.observe(e)}),GT(e,t))}function rI(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];e.removeEventListener(o.type,o.attachedListener,us(o.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(a){typeof a.rootMargin==="string"?ZM(t,a,e):a.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function zg(e){var t=e.firstChild;t&&t.nodeType===10&&(t=t.nextSibling);for(;t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":zg(n),Ud(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function oI(e,t,n,r){for(;e.nodeType===1;){var o=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(!r)if(t==="input"&&e.type==="hidden"){var a=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===a)return e}else return e;else if(!e[ec])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(a=e.getAttribute("rel"),a==="stylesheet"&&e.hasAttribute("data-precedence"))break;else if(a!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(a=e.getAttribute("src"),(a!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&a&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}if(e=er(e.nextSibling),e===null)break}return null}function aI(e,t,n){if(t==="")return null;for(;e.nodeType!==3;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n)return null;if(e=er(e.nextSibling),e===null)return null}return e}function FT(e,t){for(;e.nodeType!==8;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t)return null;if(e=er(e.nextSibling),e===null)return null}return e}function jg(e){return e.data==="$?"||e.data==="$~"}function Lh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function iI(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function er(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Bg=null;function Jk(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return er(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Zk(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function sI(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener("focus",n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",n,!0)}return r}function lI(e){Gk(function(){Gk(function(t){return e(t)})})}function XT(e,t,n){switch(t=Ql(n),e){case"html":if(e=t.documentElement,!e)throw Error(P(452));return e;case"head":if(e=t.head,!e)throw Error(P(453));return e;case"body":if(e=t.body,!e)throw Error(P(454));return e;default:throw Error(P(451))}}function WT(e,t,n){for(var r in n){var o=n[r];n.hasOwnProperty(r)&&o!=null&&je(e,t,r,null,qM,o)}n.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Nr&&(e.onclick=null),Ud(e)}function Im(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ud(e)}var tr=new Map,ex=new Set;function Kl(e){if(typeof e.getRootNode==="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var bo=Le.d;Le.d={f:cI,r:uI,D:dI,C:fI,L:pI,m:mI,X:hI,S:gI,M:yI};function cI(){var e=bo.f(),t=Jd();return e||t}function uI(e){var t=gs(e);t!==null&&t.tag===5&&t.type==="form"?q0(t):bo.r(e)}var vs=typeof document>"u"?null:document;function JT(e,t,n){var r=vs;if(r&&typeof t==="string"&&t){var o=Xn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof n==="string"&&(o+='[crossorigin="'+n+'"]'),ex.has(o)||(ex.add(o),e={rel:e,crossOrigin:n,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),Qt(t,"link",e),It(t),r.head.appendChild(t)))}}function dI(e){bo.D(e),JT("dns-prefetch",e,null)}function fI(e,t){bo.C(e,t),JT("preconnect",e,t)}function pI(e,t,n){bo.L(e,t,n);var r=vs;if(r&&e&&t){var o='link[rel="preload"][as="'+Xn(t)+'"]';t==="image"?n&&n.imageSrcSet?(o+='[imagesrcset="'+Xn(n.imageSrcSet)+'"]',typeof n.imageSizes==="string"&&(o+='[imagesizes="'+Xn(n.imageSizes)+'"]')):o+='[href="'+Xn(e)+'"]':o+='[href="'+Xn(e)+'"]';var a=o;switch(t){case"style":a=ds(e);break;case"script":a=ws(e)}if(!(tr.has(a)||(e=Ye({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),tr.set(a,e),r.querySelector(o)!==null||t==="style"&&r.querySelector(ic(a))||t==="script"&&r.querySelector(sc(a))))){var i=r.createElement("link");Qt(i,"link",e),t==="style"&&(i[dd]=!0,i.onload=i.onerror=function(){Rx(i)}),It(i),r.head.appendChild(i)}}}function mI(e,t){bo.m(e,t);var n=vs;if(n&&e){var r=t&&typeof t.as==="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Xn(r)+'"][href="'+Xn(e)+'"]',a=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":a=ws(e)}if(!tr.has(a)&&(e=Ye({rel:"modulepreload",href:e},t),tr.set(a,e),n.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(sc(a)))return}r=n.createElement("link"),Qt(r,"link",e),It(r),n.head.appendChild(r)}}}function gI(e,t,n){bo.S(e,t,n);var r=vs;if(r&&e){var o=Ki(r).hoistableStyles,a=ds(e);t=t||"default";var i=o.get(a);if(!i){var s={loading:0,preload:null};if(i=r.querySelector(ic(a)))s.loading=5;else{e=Ye({rel:"stylesheet",href:e,"data-precedence":t},n),(n=tr.get(a))&&qh(e,n);var c=i=r.createElement("link");It(c),Qt(c,"link",e),c._p=new Promise(function(f,p){c.onload=f,c.onerror=p}),c.addEventListener("load",function(){s.loading|=1}),c.addEventListener("error",function(){s.loading|=2}),s.loading|=4,nd(i,t,r)}i={type:"stylesheet",instance:i,count:1,state:s},o.set(a,i)}}}function hI(e,t){bo.X(e,t);var n=vs;if(n&&e){var r=Ki(n).hoistableScripts,o=ws(e),a=r.get(o);a||(a=n.querySelector(sc(o)),a||(e=Ye({src:e,async:!0},t),(t=tr.get(o))&&Uh(e,t),a=n.createElement("script"),It(a),Qt(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},r.set(o,a))}}function yI(e,t){bo.M(e,t);var n=vs;if(n&&e){var r=Ki(n).hoistableScripts,o=ws(e),a=r.get(o);a||(a=n.querySelector(sc(o)),a||(e=Ye({src:e,async:!0,type:"module"},t),(t=tr.get(o))&&Uh(e,t),a=n.createElement("script"),It(a),Qt(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},r.set(o,a))}}function tx(e,t,n,r){var o=(o=Ko.current)?Kl(o):null;if(!o)throw Error(P(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence==="string"&&typeof n.href==="string"?(n=ds(n.href),t=Ki(o).hoistableStyles,r=t.get(n),r||(r={type:"style",instance:null,count:0,state:null},t.set(n,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href==="string"&&typeof n.precedence==="string"){e=ds(n.href);var a=Ki(o).hoistableStyles,i=a.get(e);if(i||(o=o.ownerDocument||o,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},a.set(e,i),(a=o.querySelector(ic(e)))?a._p||(i.instance=a,i.state.loading=5):(a=tr.get(e),a||(a={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},tr.set(e,a)),bI(o,e,a,i.state))),t&&r===null)throw Error(P(528,""));return i}if(t&&r!==null)throw Error(P(529,""));return null;case"script":return t=n.async,n=n.src,typeof n==="string"&&t&&typeof t!=="function"&&typeof t!=="symbol"?(n=ws(n),t=Ki(o).hoistableScripts,r=t.get(n),r||(r={type:"script",instance:null,count:0,state:null},t.set(n,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(P(444,e))}}function ds(e){return'href="'+Xn(e)+'"'}function ic(e){return'link[rel="stylesheet"]['+e+"]"}function ZT(e){return Ye({},e,{"data-precedence":e.precedence,precedence:null})}function bI(e,t,n,r){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[dd]!==!0){r.loading=1;return}}else t=e.createElement("link"),t[dd]=!0,t.onload=t.onerror=Rx.bind(null,t),Qt(t,"link",n),It(t),e.head.appendChild(t);r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2})}function ws(e){return'[src="'+Xn(e)+'"]'}function sc(e){return"script[async]"+e}function nx(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Xn(n.href)+'"]');if(r)return t.instance=r,It(r),r;var o=Ye({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),It(r),Qt(r,"style",o),nd(r,n.precedence,e),t.instance=r;case"stylesheet":o=ds(n.href);var a=e.querySelector(ic(o));if(a)return t.state.loading|=4,t.instance=a,It(a),a;r=ZT(n),(o=tr.get(o))&&qh(r,o),a=(e.ownerDocument||e).createElement("link"),It(a);var i=a;return i._p=new Promise(function(s,c){i.onload=s,i.onerror=c}),Qt(a,"link",r),t.state.loading|=4,nd(a,n.precedence,e),t.instance=a;case"script":if(a=ws(n.src),o=e.querySelector(sc(a)))return t.instance=o,It(o),o;if(r=n,o=tr.get(a))r=Ye({},n),Uh(r,o);return e=e.ownerDocument||e,o=e.createElement("script"),It(o),Qt(o,"link",r),e.head.appendChild(o),t.instance=o;case"void":return null;default:throw Error(P(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,nd(r,n.precedence,e));return t.instance}function nd(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,a=o,i=0;i<r.length;i++){var s=r[i];if(s.dataset.precedence===t)a=s;else if(a!==o)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function qh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Uh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var rd=null;function rx(e,t,n){if(rd===null){var r=new Map,o=rd=new Map;o.set(n,r)}else o=rd,r=o.get(n),r||(r=new Map,o.set(n,r));if(r.has(e))return r;r.set(e,null),n=n.getElementsByTagName(e);for(o=0;o<n.length;o++){var a=n[o];if(!(a[ec]||a[Bt]||e==="link"&&a.getAttribute("rel")==="stylesheet")&&a.namespaceURI!=="http://www.w3.org/2000/svg"){var i=a.getAttribute(t)||"";i=e+i;var s=r.get(i);s?s.push(a):r.set(i,[a])}}return r}function $g(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function vI(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!=="string"||typeof t.href!=="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!=="string"||typeof t.href!=="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence==="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!=="function"&&typeof t.async!=="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==="string")return!0}return!1}function ox(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function eS(e){return e.type==="stylesheet"&&(e.state.loading&3)===0?!1:!0}function tS(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==="number"?devicePixelRatio:1)*0.25}function ax(e,t){typeof t.decode==="function"&&(e.imgCount++,t.complete||(e.imgBytes+=tS(t),e.suspenseyImages.push(t)),e=xI.bind(e),t.decode().then(e,e))}function wI(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!=="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=ds(r.href),a=t.querySelector(ic(o));if(a){t=a._p,t!==null&&typeof t==="object"&&typeof t.then==="function"&&(e.count++,e=Gl.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,It(a);return}a=t.ownerDocument||t,r=ZT(r),(o=tr.get(o))&&qh(r,o),a=a.createElement("link"),It(a);var i=a;i._p=new Promise(function(s,c){i.onload=s,i.onerror=c}),Qt(a,"link",r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Gl.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var od=0;function kI(e,t){return e.stylesheets&&e.count===0&&ad(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ad(e,e.stylesheets),e.unsuspend){var a=e.unsuspend;e.unsuspend=null,a()}},60000+t);0<e.imgBytes&&od===0&&(od=62500*zM());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ad(e,e.stylesheets),e.unsuspend)){var a=e.unsuspend;e.unsuspend=null,a()}},(e.imgBytes>od?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function nS(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ad(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Gl(){this.count--,nS(this)}function xI(){this.imgCount--,nS(this)}var Pd=null;function ad(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Pd=new Map,t.forEach(TI,e),Pd=null,Gl.call(e))}function TI(e,t){if(!(t.state.loading&4)){var n=Pd.get(e);if(n)var r=n.get(null);else{n=new Map,Pd.set(e,n);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a<o.length;a++){var i=o[a];if(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")n.set(i.dataset.precedence,i),r=i}r&&n.set(null,r)}o=t.instance,i=o.getAttribute("data-precedence"),a=n.get(i)||r,a===r&&n.set(null,o),n.set(i,o),this.count++,r=Gl.bind(this),o.addEventListener("load",r),o.addEventListener("error",r),a?a.parentNode.insertBefore(o,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var fs={$$typeof:Er,Provider:null,Consumer:null,_currentValue:za,_currentValue2:za,_threadCount:0};function SI(e,t,n,r,o,a,i,s,c){this.tag=1,this.containerInfo=e,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=im(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=im(0),this.hiddenUpdates=im(null),this.identifierPrefix=r,this.onUncaughtError=o,this.onCaughtError=a,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function CI(e,t,n,r,o,a,i,s,c,f,p,d){return e=new SI(e,t,n,i,c,f,p,d,s),t=1,a===!0&&(t|=24),a=gn(3,null,null,t),e.current=a,a.stateNode=e,t=ah(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},lh(a),e}function EI(e){if(!e)return $i;return e=$i,e}function rS(e,t,n,r,o,a){o=EI(o),r.context===null?r.context=o:r.pendingContext=o,r=Ha(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Va(e,r,t),n!==null&&(hn(n,e,t),Cl(n,e,t))}function ix(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function zh(e,t){ix(e,t),(e=e.alternate)&&ix(e,t)}function oS(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&hn(t,e,67108864),zh(e,67108864)}}function sx(e){if(e.tag===13||e.tag===31){var t=Zn();t=Nx(t);var n=ri(e,t);n!==null&&hn(n,e,t),zh(e,t)}}var ps=!0;function NI(e,t,n,r){var o=pe.T;pe.T=null;var a=Le.p;try{Le.p=2,jh(e,t,n,r)}finally{Le.p=a,pe.T=o}}function AI(e,t,n,r){var o=pe.T;pe.T=null;var a=Le.p;try{Le.p=8,jh(e,t,n,r)}finally{Le.p=a,pe.T=o}}function jh(e,t,n,r){if(ps){var o=Hg(r);if(o===null)Am(e,t,r,Dd,n),lx(e,r);else if(MI(o,e,t,n,r))r.stopPropagation();else if(lx(e,r),t&4&&-1<RI.indexOf(e)){for(;o!==null;){var a=gs(o);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var i=_a(a.pendingLanes);if(i!==0){var s=a;s.pendingLanes|=2;for(s.entangledLanes|=2;i;){var c=1<<31-Dn(i);s.entanglements[1]|=c,i&=~c}yo(a),(De&6)===0&&(Rd=_n()+500,ac(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&hn(s,a,2),Jd(),zh(a,2)}if(a=Hg(r),a===null&&Am(e,t,r,Dd,n),a===o)break;o=a}o!==null&&r.stopPropagation()}else Am(e,t,r,null,n)}}function Hg(e){return e=Xg(e),Bh(e)}var Dd=null;function Bh(e){if(Dd=null,e=qa(e),e!==null){var t=Xl(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=fx(t),e!==null)return e;e=null}else if(n===31){if(e=px(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Dd=e,null}function aS(e){switch(e){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"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"fullscreenerror":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"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(U1()){case vx:return 2;case wx:return 8;case ud:case z1:return 32;case kx:return 268435456;default:return 32}default:return 32}}var Vg=!1,Wo=null,Jo=null,Zo=null,Yl=new Map,Fl=new Map,zo=[],RI="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 lx(e,t){switch(e){case"focusin":case"focusout":Wo=null;break;case"dragenter":case"dragleave":Jo=null;break;case"mouseover":case"mouseout":Zo=null;break;case"pointerover":case"pointerout":Yl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fl.delete(t.pointerId)}}function dl(e,t,n,r,o,a){if(e===null||e.nativeEvent!==a)return e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[o]},t!==null&&(t=gs(t),t!==null&&oS(t)),e;return e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e}function MI(e,t,n,r,o){switch(t){case"focusin":return Wo=dl(Wo,e,t,n,r,o),!0;case"dragenter":return Jo=dl(Jo,e,t,n,r,o),!0;case"mouseover":return Zo=dl(Zo,e,t,n,r,o),!0;case"pointerover":var a=o.pointerId;return Yl.set(a,dl(Yl.get(a)||null,e,t,n,r,o)),!0;case"gotpointercapture":return a=o.pointerId,Fl.set(a,dl(Fl.get(a)||null,e,t,n,r,o)),!0}return!1}function iS(e){var t=qa(e.target);if(t!==null){var n=Xl(t);if(n!==null){if(t=n.tag,t===13){if(t=fx(n),t!==null){e.blockedOn=t,Lw(e.priority,function(){sx(n)});return}}else if(t===31){if(t=px(n),t!==null){e.blockedOn=t,Lw(e.priority,function(){sx(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function id(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Hg(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qm=r,n.target.dispatchEvent(r),Qm=null}else return t=gs(n),t!==null&&oS(t),e.blockedOn=n,!1;t.shift()}return!0}function cx(e,t,n){id(e)&&n.delete(t)}function II(){Vg=!1,Wo!==null&&id(Wo)&&(Wo=null),Jo!==null&&id(Jo)&&(Jo=null),Zo!==null&&id(Zo)&&(Zo=null),Yl.forEach(cx),Fl.forEach(cx)}function zu(e,t){e.blockedOn===t&&(e.blockedOn=null,Vg||(Vg=!0,Ma(Ra,II)))}var ju=null;function ux(e){ju!==e&&(ju=e,Ma(Ra,function(){ju===e&&(ju=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],o=e[t+2];if(typeof r!=="function")if(Bh(r||n)===null)continue;else break;var a=gs(n);a!==null&&(e.splice(t,3),t-=3,sg(a,{pending:!0,data:o,method:n.method,action:r},r,o))}}))}function ms(e){function t(c){return zu(c,e)}Wo!==null&&zu(Wo,e),Jo!==null&&zu(Jo,e),Zo!==null&&zu(Zo,e),Yl.forEach(t),Fl.forEach(t);for(var n=0;n<zo.length;n++){var r=zo[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<zo.length&&(n=zo[0],n.blockedOn===null);)iS(n),n.blockedOn===null&&zo.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var o=n[r],a=n[r+1],i=o[bn]||null;if(typeof a==="function")i||ux(n);else if(i){var s=null;if(a&&a.hasAttribute("formAction")){if(o=a,i=a[bn]||null)s=i.formAction;else if(Bh(o)!==null)continue}else s=i.action;typeof s==="function"?n[r+1]=s:(n.splice(r,3),r-=3),ux(n)}}}function OI(){function e(a){a.canIntercept&&a.info==="react-transition"&&a.intercept({handler:function(){return new Promise(function(i){return o=i})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var a=navigation.currentEntry;a&&a.url!=null&&navigation.navigate(a.url,{state:a.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation==="object"){var r=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function $h(e){this._internalRoot=e}Hh.prototype.render=$h.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(P(409));var n=t.current,r=Zn();rS(n,r,e,t,null,null)};Hh.prototype.unmount=$h.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rS(e.current,2,null,e,null,null),Jd(),t[Zl]=null}};function Hh(e){this._internalRoot=e}Hh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ax();e={blockedOn:null,target:e,priority:t};for(var n=0;n<zo.length&&t!==0&&t<zo[n].priority;n++);zo.splice(n,0,e),n===0&&iS(e)}};var dx=uu;if(dx!=="19.3.0")throw Error(P(527,dx,"19.3.0"));Le.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0){if(typeof e.render==="function")throw Error(P(188));throw e=Object.keys(e).join(","),Error(P(268,e))}return e=N1(t),e=e!==null?mx(e):null,e=e===null?null:e.stateNode,e};var _I={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:pe,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){if(_i=__REACT_DEVTOOLS_GLOBAL_HOOK__,!_i.isDisabled&&_i.supportsFiber)try{Wl=_i.inject(_I),Pn=_i}catch(e){}}var _i;var lc=function(e,t){if(!E1(e))throw Error(P(299));var n=!1,r="",o=iM,a=sM,i=lM;return t!==null&&t!==void 0&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=CI(e,1,!1,null,null,n,r,null,o,a,i,OI),e[Zl]=t.current,LT(e),new $h(t)};sS();var lS=["\uD83D\uDC4D","❤️","\uD83C\uDF89","\uD83D\uDC40","✅","\uD83D\uDE04"];function cS(e,t){let n=e.closest("[data-critiqs-id]")??e;return{element:n,target:{purposeId:n.getAttribute("data-critiqs-id"),recordKey:ai(n),clues:uS(n,t)}}}function cc(e,t,n,r=()=>!0){if(e.purposeId===null)return LI(e,t,n,r);let o=Array.from(n.querySelectorAll("[data-critiqs-id]")).filter((i)=>i.getAttribute("data-critiqs-id")===e.purposeId&&r(i));if(o.length===0)return{status:"not-found"};if(t==="shared")return{status:"found",elements:o};let a=o.filter((i)=>ai(i)===e.recordKey);if(a.length===0)return{status:"wrong-record"};if(a.length>1)return{status:"ambiguous",candidates:a.length};return{status:"found",elements:a}}function LI(e,t,n,r){let o=jI(e.clues.path,n),a=o!==null&&r(o)&&qI(e.clues,uS(o,n))?o:null;if(a===null)return{status:"not-found"};if(t==="record"&&ai(a)!==e.recordKey)return{status:"wrong-record"};return{status:"found",elements:[a]}}function qI(e,t){return e.tagName===t.tagName&&e.role===t.role&&e.label===t.label}function ai(e){return e.closest("[data-critiqs-record]")?.getAttribute("data-critiqs-record")??null}function uS(e,t){return{tagName:e.tagName.toLowerCase(),role:e.getAttribute("role"),label:UI(e),path:zI(e,t)}}function UI(e){let n=(e.getAttribute("aria-label")??e.textContent??"").replace(/\s+/g," ").trim();return n===""?null:n.slice(0,80)}function zI(e,t){let n=[],r=e;while(r!==null&&r!==t){let o=r.tagName,a=r.parentElement?Array.from(r.parentElement.children).filter((i)=>i.tagName===o):[r];n.unshift(`${o.toLowerCase()}:${a.indexOf(r)+1}`),r=r.parentElement}return n.join("/")}function jI(e,t){if(e==="")return t;let n=t;for(let r of e.split("/")){let[o,a]=r.split(":");if(n===null||o===void 0||a===void 0)return null;n=Array.from(n.children).filter((s)=>s.tagName.toLowerCase()===o)[Number(a)-1]??null}return n}var Vh=30,Qh=50;var BI=/[\s\p{Ps}\p{Pi}]/u,$I=/\p{L}/u,HI=/[\p{L}\p{N}\p{M}_-]/u;function ks(e){let t=[],n=Array.from(e),r=0,o=[];for(let a of n)o.push(r),r+=a.length;o.push(r);for(let a=0;a<n.length;a++){if(n[a]!=="#")continue;if(a>0&&!BI.test(n[a-1]))continue;let i=n[a+1];if(i===void 0||!$I.test(i))continue;let s=a+1;while(s<n.length&&HI.test(n[s]))s++;let c=s;while(c>a+2&&/[_-]/.test(n[c-1]))c--;if(c-(a+1)<=50){let p=n.slice(a+1,c).join("");t.push({key:lt(p),label:p,start:o[a],end:o[c]})}a=s-1}return t}function lt(e){return e.replace(/^#/,"").normalize("NFKC").toLowerCase().trim().replace(/[\s_]+/g,"-")}function VI(e){let t=e.replace(/^#/,"").normalize("NFC").replace(/\s+/g," ").trim();if(t===""||Array.from(t).length>50)return null;if(/[\p{Cc}\p{Cf}#]/u.test(t))return null;return t}function tf(e){let t=VI(e);if(t===null)return null;let n=`#${t.replace(/\s+/g,"-")}`,[r,...o]=ks(n);return r!==void 0&&o.length===0&&r.start===0&&r.end===n.length?t:null}var nf={status:"open",unreadOnly:!1,tags:[],screens:"all"},QI=["current-view","other-view","other-screen"];function dS(e,t,n=nf){let r=new Map;for(let o of e){if(!GI(o,n,t.currentScreen))continue;let a=KI(o,t);r.set(a,[...r.get(a)??[],o])}return QI.flatMap((o)=>{let a=r.get(o);if(a===void 0)return[];return[{placement:o,threads:a.sort((i,s)=>s.lastActivityAt-i.lastActivityAt)}]})}function KI(e,t){if(e.screen!==t.currentScreen)return"other-screen";return t.isLive(e.id)?"current-view":"other-view"}function GI(e,t,n){if(e.status==="deleted")return!1;if(t.status!=="all"&&e.status!==t.status)return!1;if(t.unreadOnly&&!e.unread)return!1;if(t.hasTicket===!0&&e.hasTicket!==!0)return!1;if(t.tags.length>0){let r=new Set(t.tags.map(lt));if(!e.tags.some((o)=>r.has(lt(o))))return!1}if(t.screens==="current"&&e.screen!==n)return!1;return!0}function fS(e,t){let n=e.groups??[];if(n.length===0)return e;let r=new Map(e.tags.map((a)=>[lt(a),a]));for(let a of n)for(let i of t(a))if(!r.has(lt(i)))r.set(lt(i),i);let o=[...r.values()];return{...e,tags:o.length===0?["\x00no-tags"]:o,groups:[]}}var fU=[/$^/,/^<(?:script|pre|textarea|style)(?:[ \t]|>|$)/i,/^<!--/,/^<[?]/,/^<![A-Za-z]/,/^<!\[CDATA\[/,new RegExp("^</?(?: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|h[1-6]|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)(?:[ \\t]|/?>|$)","i"),new RegExp(`^(?:<[A-Za-z][A-Za-z0-9-]*(?:[ \\t\\v\\f]+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:[ \\t\\v\\f]*=[ \\t\\v\\f]*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*[ \\t\\v\\f]*/?>|</[A-Za-z][A-Za-z0-9-]*[ \\t\\v\\f]*>)[ \\t\\v\\f]*$`,"i")];function YI(e){return String(e).replace(/\s+/g," ").trim()}var FI=/[!-/:-@[-`{-~]/,XI=/[\p{L}\p{N}]/u,WI=/\s/u,JI=new Set(["`","[","]","|","$"]);function ZI(e){if(/^#{1,6}(?:\s|$)/.test(e)||e.startsWith(">")||/^[-+*](?:\s|$)/.test(e)||e.startsWith("+++")||/^[-:\s]*-[-:\s]*$/.test(e)||/^=+$/.test(e))return 0;let t=/^\d{1,9}[.)](?:\s|$)/.exec(e);return t===null?-1:t[0].trimEnd().length-1}function eO(e,t){let n=e[t],r=e[t-1],o=e[t+1],a=(s)=>s!==void 0&&WI.test(s),i=(s)=>s!==void 0&&XI.test(s);if(JI.has(n))return!0;switch(n){case"\\":return o===void 0||FI.test(o);case"*":case"~":return!(a(r)&&a(o));case"_":return!(i(r)&&i(o)||a(r)&&a(o));case"<":return o===void 0||/[A-Za-z/!?]/.test(o);case"&":return/^&(?:#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[A-Za-z][A-Za-z0-9]{0,31})(?:;|$)|^&#?\w+;/.test(e.slice(t).join(""));case".":return i(o)||o==="-"||o==="_"||/www$/i.test(e.slice(Math.max(0,t-3),t).join(""));case":":return r!==void 0&&/[A-Za-z]/.test(r)&&(o===void 0?/(?:mailto|xmpp)$/i.test(e.slice(Math.max(0,t-6),t).join("")):!a(o));case"/":return o==="/";case"@":return r!==void 0&&!a(r)&&(i(o)||o==="-"||o==="_"||o===".");case"(":return r==="]";case"#":return(r===void 0||a(r))&&e.slice(t).every((s)=>s==="#");default:return!1}}var tO="";function nO(e,t){let n=e[t+1];if(n===void 0)return!1;let r=(o)=>e.slice(Math.max(0,t-o),t).join("");switch(e[t]){case"@":return/[A-Za-z0-9]/.test(n);case"#":return/[0-9]/.test(n);case"-":return/[0-9]/.test(n)&&/gh$/i.test(r(2));case"/":return/[0-9]/.test(n)&&/(?:issues|pulls?|discussions)$/i.test(r(11));case":":return/^[A-Za-z0-9_+-]+(?::|$)/.test(e.slice(t+1,t+66).join(""));default:return!1}}function Kh(e){let t=Array.from(YI(e)),n=ZI(t.join(""));return t.map((r,o)=>`${o===n||eO(t,o)?`\\${r}`:r}${nO(t,o)?tO:""}`).join("")}function Gh(e,t){let n=t.replaceAll("&","&").replace(/[<>\\\s]/g,(r)=>encodeURIComponent(r));return`[${Kh(e)}](<${n}>)`}function Fh(e){let t=e.split(`
|
|
10
|
+
`)[0]?.trim()??"";return t.length>72?`${t.slice(0,71)}…`:t||"(empty comment)"}function Xh(e){return new Date(e).toISOString()}function pS(e){return e.map((t)=>`> ${t}`)}function Yh(e){return String(e).replace(/\s+/g," ").trim()}var Wh={text:Yh,code:(e)=>`\`${Yh(e)}\``,lines:(e)=>e.split(/\r\n|\r|\n/),page:Yh};function Jh(e,t,n){let o=[`- Link: ${n.linkText===void 0?n.link:n.link===null?"none; this project has no review address and this Critiqs has no website, so tickets don't link to its threads":Gh(n.linkText,n.link)}`,...n.status?[`- Status: ${e.status}`]:[],`- Tags: ${e.tags.length>0?e.tags.map(t.text).join(", "):"none"}`,`- Screen: ${t.text(e.screen)}`,`- Target: ${rO(e,t)}${e.reattached?" (reattached)":""}`,`- Scope: ${e.scope==="shared"?"shared across records":"this record only"}`,`- Revision: ${e.revision===null?"unknown":t.text(e.revision)}`,`- Page: ${t.page(e.pageUrl)} at ${e.viewport.width}×${e.viewport.height}`];if(e.persona!==null)o.push(`- Demo persona: ${t.text(e.persona)}`);let a=Object.entries(e.viewState);if(a.length>0)o.push(`- View state: ${a.map(([i,s])=>`${t.text(i)}=${t.text(s)}`).join(", ")}`);return o.push(`- Capture: ${n.capture}`),o}function Zh(e,t){let n=[];for(let r of e.messages){let o=r.editedAt===null?"":" (edited)",a=r.via==="agent"?" via coding agent":"";n.push("",`**${t.text(r.author)}**${a}, ${Xh(r.createdAt)}${o}, revision ${r.revision===null?"unknown":t.text(r.revision)}:`,"",...pS(t.lines(r.body)))}return n}function rO(e,t){let n=[e.target.purposeId===null?null:t.code(e.target.purposeId),e.target.label===null?null:`"${t.text(e.target.label)}"`,e.target.recordKey===null?null:`record ${t.text(e.target.recordKey)}`].filter((r)=>r!==null);return n.length>0?n.join(", "):"unknown"}var vn=[{id:"linear",label:"Linear"},{id:"github",label:"GitHub Issues"},{id:"jira",label:"Jira"}],mS={id:256,key:256,name:200,title:255,status:100,address:2048,list:500,templateText:50000};var CU={sections:["Summary","Steps to reproduce","Expected","Actual","Context"].map((e)=>({name:e,heading:`## ${e}`})),keepEmpty:!1};var oO=1;function gS(e,t){let{evidence:n}=e.anchor,{screen:r,viewState:o,scope:a,target:i}=e.location??e.anchor;return{id:e._id,link:t(null),status:e.status==="resolved"?"resolved":"open",tags:e.tags,screen:r,viewState:o,scope:a,target:{purposeId:i.purposeId,recordKey:i.recordKey,label:i.clues.label},revision:n.revision,pageUrl:n.url,viewport:n.viewport,persona:n.persona,reattached:e.location!==null,hasCapture:e.hasCapture,...e.tickets===void 0?{}:{tickets:e.tickets.map(({tracker:s,key:c,title:f,status:p,lastKnown:d,url:u})=>({tracker:s,key:c,title:f,status:p,...d===void 0?{}:{lastKnown:d},url:u}))},messages:e.messages.map((s)=>({id:s._id,link:t(s._id),author:s.author,createdAt:s.createdAt,editedAt:s.editedAt,body:s.body,revision:s.revision,...s.via===void 0?{}:{via:s.via}}))}}function hS(e){return JSON.stringify({schemaVersion:oO,...e},null,2)}function yS(e){let t=[`# ${e.title}`,"",`Project: ${e.projectName} `,`Exported: ${Xh(e.exportedAt)} `,`Threads: ${e.threads.length}`];for(let n of e.threads)t.push("",...aO(n));return`${t.join(`
|
|
11
|
+
`)}
|
|
12
|
+
`}function aO(e){let[t]=e.messages;return[`## ${t===void 0?"(no messages)":Fh(t.body)}`,"",...Jh(e,Wh,{link:e.link,status:!0,capture:e.hasCapture?"saved; open the link to view it":"none"}),...iO(e),"","### Discussion",...Zh(e,Wh)]}function iO(e){if(e.tickets===void 0)return[];if(e.tickets.length===0)return["- Tickets: none"];let t=(n)=>n.replace(/\s+/g," ").trim();return e.tickets.map((n)=>{let r=vn.find((a)=>a.id===n.tracker)?.label??n.tracker,o=n.status===null?"status unknown":`${t(n.status.label)}${n.lastKnown===!0?" · last known":""}`;return`- Ticket: ${r} ${t(n.key)} · ${o}, "${t(n.title)}", ${t(n.url)}`})}async function rf(e,t,n,r){let o={projectName:"",threads:[]},a=[...new Set(n)];for(let i=0;i<a.length;i++){let s=null,c=null;while(!0){if(r())throw Error("Export cancelled");let f=await e({projectId:t,threadIds:a,threadIndex:i,paginationOpts:{numItems:40,cursor:s}});if(o.projectName=f.projectName,f.thread===null){c=null;break}if(c??={...f.thread,messages:[]},c.messages.push(...f.page),f.isDone)break;if(f.continueCursor===s)throw Error("Export pagination did not advance.");s=f.continueCursor}if(c!==null)o.threads.push(c)}return o}function bS(e){if(e.length>2048)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="https:"&&t.protocol!=="http:")return null;if(t.username!==""||t.password!=="")return null;return t.href.length>2048?null:t.href}var ey="critiqs";function vS(e,t,n){let r=new URL(t,e),o=new URL(e);o.pathname=r.pathname,o.search=r.search,o.hash=r.hash;let a=n.messageId===null?n.threadId:`${n.threadId}.${n.messageId}`;return o.searchParams.set("critiqs",a),o.toString()}function of(e){let t=new URL(e).searchParams.get("critiqs");if(t===null||t==="")return null;let[n,r]=t.split(".");if(n===void 0||n==="")return null;return{threadId:n,messageId:r===void 0||r===""?null:r}}function xs(e){let t=new URL(e);return t.searchParams.delete("critiqs"),t.toString()}var sO="t",lO=/^[A-Za-z0-9_-]{22}$/;function cO(e){return lO.test(e)}function uO(e){let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")throw Error("A website address starts with https:// or http://.");return{origin:t.origin,path:t.pathname.replace(/\/+$/,"")}}function wS(e,t){if(!cO(t))throw Error("Not a thread page key.");let{origin:n,path:r}=uO(e);return`${n}${r}/${sO}#${t}`}function af(e){let t=e.trim();if(t===""||/[/\\?#@\s]/.test(t))return null;if(/^\[[^\]]*\]./.test(t))return null;let n;try{n=new URL(`http://${t.startsWith("[")||!t.includes(":")?t:`[${t}]`}/`)}catch{return null}if(n.port!==""||n.username!==""||n.password!=="")return null;let r=n.hostname;if(r.startsWith("["))return r.slice(1,-1);if(r.endsWith("."))r=r.slice(0,-1);if(r===""||r.split(".").some((o)=>o===""))return null;return r}function kS(e){let t=e.split(".").map(Number);if(t.length!==4||t.some((o)=>!Number.isInteger(o)||o<0||o>255))return!1;let[n,r]=t;return n===0||n===10||n===127||n===100&&r>=64&&r<=127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===198&&(r===18||r===19)||n>=224}function dO(e){if(e==="::"||e==="::1")return!0;let t=e.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/);if(t){let r=Number.parseInt(t[1],16),o=Number.parseInt(t[2],16);return kS(`${r>>8}.${r&255}.${o>>8}.${o&255}`)}let n=Number.parseInt(e.split(":")[0],16);return(n&65024)===64512||(n&65472)===65152||(n&65280)===65280}function ty(e){let t=af(e);if(t===null)return!0;if(t.includes(":"))return dO(t);if(/^\d+(?:\.\d+){3}$/.test(t))return kS(t);return t==="localhost"||!t.includes(".")||/\.(localhost|local|internal|home\.arpa|ts\.net)$/.test(t)}var xS=2000;function ny(e){if(e.length>xS)return null;try{let t=new URL(e),n=t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname.endsWith(".localhost");if(t.protocol!=="https:"&&!(t.protocol==="http:"&&n))return null;if(t.username!==""||t.password!=="")return null;if(t.searchParams.has(ey))t.searchParams.delete(ey);let r=t.toString();return r.length>xS?null:r}catch{return null}}function uc(e){try{return ty(new URL(e).hostname)}catch{return!1}}var fO=50;function TS(e,t,n,{timeoutMs:r=3000,signal:o,isCandidate:a,ready:i}={}){return new Promise((s)=>{let c=()=>i===void 0||i(),f=cc(e,t,n,a);if(f.status==="found"&&c()||o?.aborted)return s(f);let p=()=>{if(f=cc(e,t,n,a),f.status==="found"&&c())d()},d=()=>{u.disconnect(),clearTimeout(y),clearInterval(m),o?.removeEventListener("abort",d),s(f)},u=new MutationObserver(p);u.observe(n,{childList:!0,subtree:!0,attributes:!0});let m=i===void 0?void 0:setInterval(p,fO),y=setTimeout(d,r);o?.addEventListener("abort",d)})}var dc=[{id:"openai",label:"OpenAI",needsKey:!0,address:"optional"},{id:"anthropic",label:"Anthropic",needsKey:!0,address:"optional"},{id:"google",label:"Google Gemini",needsKey:!0,address:"optional"},{id:"openrouter",label:"OpenRouter",needsKey:!0,address:"fixed"},{id:"gateway",label:"Vercel AI Gateway",needsKey:!0,address:"optional"},{id:"compatible",label:"OpenAI-compatible endpoint",needsKey:!1,address:"required"}],SS=["openai","anthropic","google","gateway","compatible"];var ii="data-critiqs-node";var oy={editsPerVersion:400,htmlChars:20000,cssChars:20000,textChars:20000,versionBytes:262144,linkedThreads:20};var pO=/^[a-zA-Z_:][-a-zA-Z0-9_:.]*$/,mO=new Set(["href","src","action","formaction","xlink:href","poster","background","cite","data","ping"]),ay=["xmp","noembed","noframes","plaintext"];var HU=new Set([...ay,"script","iframe","frame","frameset","object","embed","applet","portal","base","meta","link","style","template","noscript","animate","animatemotion","animatetransform","set"]);var gO=/^data:image\/(png|jpeg|gif|webp|avif)[;,]/;function hO(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=1}function NS(e,t){if(!pO.test(e))return`"${e}" isn't an attribute name.`;let n=e.toLowerCase();if(n.startsWith("on")||n==="srcdoc")return`"${e}" would run code.`;if(n==="data-critiqs-node")return"Element numbers can't be changed.";if(t===null)return null;if(mO.has(n)&&yO(t))return`"${e}" would run code.`;if(n==="style")return AS(t);return null}function yO(e){let t=e.replace(/[\u0000- ]/g,"").toLowerCase(),n=t.split(/[/?#]/,1)[0]??"",r=n.indexOf(":");if(r!==-1&&n.slice(0,r).includes("&"))return!0;if(t.startsWith("data:"))return!gO.test(t);return t.startsWith("javascript:")||t.startsWith("vbscript:")}function AS(e){let t=e.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(r,o)=>String.fromCodePoint(Math.min(Number.parseInt(o,16),1114111))).replace(/\\(.)/g,"$1").toLowerCase();if(t.includes("</style"))return"CSS can't close its style element.";if(t.includes("@import"))return"CSS can't import other stylesheets.";if(t.includes("expression(")||t.includes("javascript:"))return"CSS can't run code.";let n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="\\")r++;else if(o==="/"&&e[r+1]==="*"){let a=e.indexOf("*/",r+2);if(a===-1)return"CSS has an unclosed comment.";r=a+1}else if(o==='"'||o==="'"){let a=r+1;while(a<e.length&&e[a]!==o&&e[a]!==`
|
|
13
|
+
`)a+=e[a]==="\\"?2:1;if(e[a]!==o)return"CSS has an unclosed string.";r=a}else if(o==="{")n++;else if(o==="}"&&--n<0)return"CSS closes a block it didn't open."}return n===0?null:"CSS has an unclosed block."}var bO=new Set([...ay,"script","iframe","frame","frameset","object","embed","applet","portal","base","meta","link","style","template","noscript","animate","animatemotion","animatetransform","set"]),vO=new Set(["href","xlink:href","src","action","formaction"]);function CS(e,t){let n=t.createElement("template");n.innerHTML=e;for(let r of Array.from(n.content.querySelectorAll("*"))){if(bO.has(r.localName)||wO(r)){r.remove();continue}for(let o of r.getAttributeNames())if(NS(o,r.getAttribute(o))!==null)r.removeAttribute(o)}return n.content}function wO(e){let t=e.getAttribute("attributeName")?.trim().toLowerCase();return t!==void 0&&(vO.has(t)||t.startsWith("on"))}function RS(e,t){let n=new Map,r=0;for(let c of Array.from(e.querySelectorAll("[data-critiqs-node]"))){let f=Number(c.getAttribute("data-critiqs-node"));if(!hO(f))continue;if(!n.has(f))n.set(f,c);r=Math.max(r,f)}let o=(c)=>{for(let f of Array.from(c.querySelectorAll("*")))r++,f.setAttribute("data-critiqs-node",String(r)),n.set(r,f);return c},a=[],i=[];t.forEach((c,f)=>{try{let p=s(c);if(p!==null)i.push({index:f,reason:p})}catch(p){i.push({index:f,reason:p instanceof Error?p.message:String(p)})}});function s(c){if(c.kind==="css"){let d=AS(c.css);if(d===null)a.push(c.css);return d}let f=n.get(c.node);if(f===void 0||!f.isConnected)return`Element #${c.node} isn't on the page.`;let p=f===e.body;switch(c.kind){case"text":if(p)return"The page's body can't be replaced with text.";if(ay.includes(f.localName))return`Text in <${f.localName}> can't be changed.`;return f.textContent=c.text,null;case"attribute":{let d=NS(c.name,c.value);if(d!==null)return d;if(c.value===null)f.removeAttribute(c.name);else f.setAttribute(c.name,c.value);return null}case"insert":{if(p&&(c.position==="before"||c.position==="after"))return"Nothing can go outside the page's body.";let d=o(CS(c.html,e));if(c.position==="before")f.before(d);else if(c.position==="after")f.after(d);else if(c.position==="prepend")f.prepend(d);else f.append(d);return null}case"replace":if(p)return"The page's body can't be replaced.";return f.replaceWith(o(CS(c.html,e))),null;case"remove":if(p)return"The page's body can't be removed.";return f.remove(),null;default:return"Unknown change."}}for(let c of Array.from(e.querySelectorAll("style[data-critiqs-mockup]")))c.remove();if(a.length>0){let c=e.createElement("style");c.setAttribute("data-critiqs-mockup",""),c.textContent=a.join(`
|
|
14
|
+
`),(e.head??e.documentElement).append(c)}return{skipped:i}}function MS(e){let t=e.querySelector("style[data-critiqs-mockup]")?.sheet;if(t)IS(t.cssRules)}function IS(e){for(let t of Array.from(e)){if(t.type===kO){let{style:r}=t;for(let o of Array.from(r))r.setProperty(o,r.getPropertyValue(o),"important")}let n=t.cssRules;if(n!==void 0&&t.type!==xO)IS(n)}}var kO=1,xO=7,OS=new Set(["script","style","template","noscript","link","meta","base"]),sf=3;function iy(e,t){let n=e.defaultView,r=n?.scrollY??0,o=t.top+t.height,a=[],i={length:0,outOfBudget:!1,collapsed:!1,nextTop:null},s=(m,y)=>{let g=`${" ".repeat(m)}${y}`;if(i.length+g.length+1>t.budget)return i.outOfBudget=!0,!1;return a.push(g),i.length+=g.length+1,!0},c=(m)=>{if(m>=t.top)i.nextTop=i.nextTop===null?m:Math.min(i.nextTop,m)},f=(m)=>{let y=m.getBoundingClientRect(),g=y.top+r;if(y.width<=0||y.height<=0)return{at:"unknown",top:g,rect:y};if(g>o)return{at:"below",top:g,rect:y};return{at:y.bottom+r<t.top?"above":"inside",top:g,rect:y}},p=(m,y,g)=>{let{at:x,top:k,rect:b}=f(m),v=TO(m);if(x==="above"||x==="below"){if(i.collapsed=!0,x==="below")c(k);s(y,`${v} [${x}${ES(lf(m))}]`);return}let w=n?.getComputedStyle(m);if(w?.display==="none"){s(y,`${v} [hidden${ES(lf(m))}]`);return}if(!s(y,`${v}${x==="inside"&&w!==void 0?EO(w,b,g):""}`)){c(k);return}if(m.localName==="svg"){let E=lf(m);if(E>0)s(y+1,`[${E} drawing elements]`);return}let T=w===void 0?g:{color:w.color,fontSize:w.fontSize,fontWeight:w.fontWeight},C=Array.from(m.children).filter((E)=>!OS.has(E.localName));for(let E=0;E<C.length&&!i.outOfBudget;E++){let A=d(C,E);if(A.length<=sf){p(C[E],y+1,T);continue}for(let L of A.slice(0,sf))p(L,y+1,T);let R=A.slice(sf).map(f).filter((L)=>L.at==="below");for(let L of R)c(L.top);let q=A.slice(sf),X=q.reduce((L,F)=>L+1+lf(F),0);s(y+1,`… ${q.length} more siblings ${ry(q[0])}–${ry(q.at(-1))} [${R.length>0?"below":"above"}, ${X} elements]`),E+=A.length-1}},d=(m,y)=>{let g=[];for(let x=y;x<m.length;x++){let k=f(m[x]).at;if(k!=="above"&&k!=="below")break;g.push(m[x])}return g};if(e.body!==null)p(e.body,0,null);let u=i.nextTop;if(u!==null&&u<=t.top)u=o;if(u!==null&&u>=e.documentElement.scrollHeight)u=null;return{text:a.join(`
|
|
15
|
+
`),complete:!i.outOfBudget&&!i.collapsed,nextTop:u}}function ES(e){return e>0?`, ${e} inside`:""}function TO(e){let t=[e.localName,ry(e)],n=e.getAttribute("id");if(n)t.push(`id=${fc(n,40)}`);let r=Array.from(e.classList).slice(0,4).map((a)=>fc(a,32));if(r.length>0)t.push(`.${r.join(".")}${e.classList.length>4?"…":""}`);for(let a of["role","aria-label","type","alt","placeholder","value","href","src"]){let i=e.getAttribute(a);if(i===null||i==="")continue;t.push(`${a}=${JSON.stringify(a==="href"||a==="src"?CO(i):fc(i,60))}`)}for(let a of["checked","selected","disabled"])if(e.hasAttribute(a))t.push(a);let o=SO(e);if(o!=="")t.push(JSON.stringify(fc(o,80)));return t.join(" ")}function ry(e){let t=e.getAttribute("data-critiqs-node");return t===null?"#?":`#${t}`}function SO(e){let t="",n=!1;for(let r of Array.from(e.childNodes))if(r.nodeType===3)t+=r.textContent??"",n||=(r.textContent??"").trim()!=="";else if(r.nodeType===1&&!OS.has(r.localName))t+=" … ";return n?t.replace(/\s+/g," ").replace(/(… )+…/g,"…").trim():""}function lf(e){return e.getElementsByTagName("*").length}function fc(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function CO(e){if(e.startsWith("data:"))return`${e.slice(0,e.indexOf(",")+1||20)}…`;return fc(e.replace(/^https?:\/\/[^/]+/,""),60)||"/"}function EO(e,t,n){let r=[],o=(i,s,c)=>{if(s!==""&&!c(s))r.push(`${i}:${NO(s)}`)},a=(i)=>/^(0px ?)+$/.test(i);if(e.display!=="block"&&e.display!=="inline")r.push(e.display);return o("pos",e.position,(i)=>i==="static"),o("color",e.color,(i)=>i===n?.color),o("bg",e.backgroundColor,(i)=>i==="transparent"||i==="rgba(0, 0, 0, 0)"),o("font",e.fontSize,(i)=>i===n?.fontSize),o("weight",e.fontWeight,(i)=>i===n?.fontWeight),o("pad",e.padding,a),o("margin",e.margin,a),o("radius",e.borderRadius,a),o("gap",e.gap,(i)=>i==="normal"||i==="normal normal"),r.push(`${Math.round(t.width)}x${Math.round(t.height)}`),` {${r.join("; ")}}`}function NO(e){return e.replace(/rgb\((\d+), (\d+), (\d+)\)/g,(t,n,r,o)=>`#${[n,r,o].map((a)=>Number(a).toString(16).padStart(2,"0")).join("")}`)}var AO=["script","style","textarea","title","iframe","noembed","noframes","xmp"],QU=new Map(AO.map((e)=>[e,new RegExp(`</${e}(?=[\\t\\n\\f\\r />]|$)`,"gi")]));var KU=new Set("b big blockquote body br center code dd div dl dt em embed h1 h2 h3 h4 h5 h6 head hr i img li listing menu meta nobr ol p pre ruby s small span strong strike sub sup table tt u ul var".split(" "));var RO=[{id:"react",label:"React (Vite)",install:"npm install critiqs-react",backend:"component"},{id:"next",label:"Next.js",install:"npm install critiqs-react",backend:"component"},{id:"vue",label:"Vue",install:"npm install critiqs-vue",backend:"component"},{id:"nuxt",label:"Nuxt",install:"npm install critiqs-nuxt",backend:"nuxt"},{id:"svelte",label:"Svelte",install:"npm install critiqs-svelte",backend:"component"},{id:"sveltekit",label:"SvelteKit",install:"npm install critiqs-svelte",backend:"component"},{id:"angular",label:"Angular",install:"npm install critiqs-angular",backend:"angular"},{id:"astro",label:"Astro",install:"npm install critiqs-astro",backend:"astro"},{id:"solid",label:"Solid",install:"npm install critiqs-solid",backend:"component"},{id:"rails",label:"Rails",install:"bundle add critiqs-rails",backend:"rails"},{id:"django",label:"Django",install:"pip install django-critiqs",backend:"django"},{id:"flask",label:"Flask",install:"pip install flask-critiqs",backend:"flask"},{id:"gatsby",label:"Gatsby",install:null,backend:"script"},{id:"laravel",label:"Laravel",install:null,backend:"script"},{id:"remix",label:"Remix or React Router",install:null,backend:"script"},{id:"wordpress",label:"WordPress",install:null,backend:"script"}],t3=RO.map(({id:e,label:t,install:n})=>({id:e,label:t,installable:n!==null}));var Gt=(e,...t)=>({in:"element",tag:e,attributes:t}),_t=(e,t)=>({name:e,value:t}),sy=(e)=>({in:"script",text:e}),ly=(e,t)=>({in:"header",name:e,value:t}),cy=(e)=>({in:"cookie",name:typeof e==="string"?sa(e):e}),sa=(e)=>(t)=>t===e,_S=(e)=>(t)=>t.replace(/[A-Z]/g,(n)=>n.toLowerCase())===e,MO=(e)=>(t)=>t.trim().toLowerCase().startsWith(e.toLowerCase()),dy=(e)=>(t)=>t.split(/[?#]/,1)[0].includes(e),Ts=(e)=>[Gt("script",_t("src",dy(e))),Gt("link",_t("href",dy(e)))],uy=(e)=>Gt("meta",_t("name",_S("generator")),_t("content",MO(e)));var n3=[{stack:"next",any:[Gt("script",_t("id",sa("__NEXT_DATA__"))),...Ts("/_next/"),ly("x-powered-by",/next\.js/i)]},{stack:"nuxt",any:[sy(/window\.__NUXT__\s*=/),Gt("script",_t("id",sa("__NUXT_DATA__"))),...Ts("/_nuxt/")]},{stack:"sveltekit",any:[sy(/__sveltekit_[a-z0-9]+\s*=/),Gt(null,_t((e)=>e.startsWith("data-sveltekit-")&&e.length>15)),...Ts("/_app/immutable/")]},{stack:"astro",any:[Gt("astro-island"),...Ts("/_astro/"),uy("Astro")]},{stack:"remix",any:[sy(/window\.__(?:remix|reactRouter)Context\s*=/)]},{stack:"gatsby",any:[Gt(null,_t("id",sa("___gatsby"))),uy("Gatsby")]},{stack:"angular",any:[Gt(null,_t("ng-version"))]},{stack:"wordpress",any:[...Ts("/wp-content/"),...Ts("/wp-includes/"),uy("WordPress"),ly("link",/api\.w\.org/)]},{stack:"rails",any:[Gt("meta",_t("name",sa("csrf-param")),_t("content",sa("authenticity_token")))]},{stack:"django",any:[Gt("input",_t("name",sa("csrfmiddlewaretoken"))),cy("csrftoken")]},{stack:"laravel",all:[cy("XSRF-TOKEN"),cy((e)=>e.length>8&&e.endsWith("_session"))]},{stack:"flask",any:[ly("server",/^werkzeug\//i)]},{stack:"vue",any:[Gt(null,_t((e)=>/^data-v-(?:app|[0-9a-f]{8})$/.test(e)))]},{stack:"svelte",any:[Gt(null,_t("data-svelte-h"))]},{stack:"solid",any:[Gt(null,_t("data-hk"))]}];var IO=Gt("input",_t("type",_S("password"))),r3=Gt("iframe",_t("src",dy("/_Incapsula_Resource")));var o3=Gt("input",...IO.attributes,_t("name",sa("_vercel_password")));var a3={"just-me":1,"2-5":5,"6-20":20,"21-100":100,"over-100":Number.POSITIVE_INFINITY};var pc="https://brazen-snail-591.convex.cloud";var fy=20,OO=200;var cf="critiqswildcard";function PS(e){return _O(e,OO)}function _O(e,t){let n=e.trim(),r=(x)=>({error:`${JSON.stringify(n.slice(0,80))} ${x}`}),o=`is longer than ${t} characters.`;if(n.length>t)return r(o);if(/[\s\u0000-\u001f\u007f]/.test(n))return r("can't include a space or line break.");let a=/^([a-z][a-z0-9+.-]*):\/\/([^/?#\\]*)\/?$/i.exec(n);if(a===null)return r("isn't an address such as https://acme-proto.vercel.app, without a path, ? or #.");if(a[2].includes("@"))return r("can't include a username or password.");let i=a[1].toLowerCase();if(i!=="https"&&i!=="http")return r("must start with https://.");let s=n.split("*").length-1;if(s>1)return r("can have only one *.");if(s===1&&n.toLowerCase().includes(cf))return r("isn't a valid address.");let c;try{c=new URL(s===1?n.replace("*",cf):n)}catch{return r("isn't a valid address.")}if(!c.hostname.startsWith("[")){let x=af(c.hostname);if(x===null)return r("has a host name that isn't valid.");if(x!==c.hostname)c.hostname=x}let f=c.hostname.replace(cf,"*"),p=c.origin.replace(cf,"*");if(f==="")return r("isn't a valid address.");if(c.pathname!=="/"||c.search!==""||c.hash!=="")return r("isn't an address such as https://acme-proto.vercel.app, without a path, ? or #.");let d=s===1?f.replace("*","x"):f;if(i==="http"&&!uc(`http://${PO(d)}`))return r("must start with https://. Plain http:// works only on this computer or a private network.");let u=d.startsWith("[")||/^\d+(?:\.\d+){3}$/.test(d);if(!u&&!d.split(".").every((x)=>/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(x)))return r("has a host name that isn't valid.");if(p.length>t)return r(o);if(s===0)return{address:p,exact:!0,key:p};let[m,...y]=f.split("."),g=a[2].split(".")[0].toLowerCase();if(u||!m.includes("*"))return r("can have * only in the leftmost part of the host, such as https://*-acme.vercel.app.");if(g!==m||!/^[a-z0-9-]*\*[a-z0-9-]*$/.test(m))return r("can use only letters a to z, digits, and hyphens around its *.");if(y.length<2)return r("matches too much: put * in front of a site's name, such as https://*.acme.com.");return{address:p,exact:!1,key:p.replace(`//${m}.`,"//*.")}}function PO(e){return e.includes(":")&&!e.startsWith("[")?`[${e}]`:e}var DS=200;class Un extends Error{name="ProtocolError"}var Pt=(e,t)=>{throw new Un(`${e||"message"} must be ${t}.`)},$e=(e=4096)=>(t,n)=>typeof t==="string"&&t.length<=e?t:Pt(n,Number.isFinite(e)?`text of at most ${e} characters`:"text"),py=["http:","https:","file:","about:"],LS=(e,t=py)=>(n,r)=>{let o=$e(e)(n,r),a=null;try{a=new URL(o)}catch{}return a!==null&&t.includes(a.protocol)?o:Pt(r,`a page's ${t.map((i)=>i.slice(0,-1)).join(", ")} address`)},rn=(e,t)=>typeof e==="number"&&Number.isFinite(e)?e:Pt(t,"a finite number"),Pr=(e,t)=>typeof e==="number"&&Number.isSafeInteger(e)&&e>=0?e:Pt(t,"a whole number"),vo=(e,t)=>typeof e==="boolean"?e:Pt(t,"true or false"),Dr=(e)=>(t,n)=>t===e?e:Pt(n,JSON.stringify(e)),mc=(e)=>(t,n)=>e.includes(t)?t:Pt(n,`one of ${e.join(", ")}`),my=(e,t)=>e===null?null:Pt(t,"null"),at=(e)=>(t,n)=>t===null?null:e(t,n),qS=(e,t)=>typeof Blob<"u"&&e instanceof Blob?e:Pt(t,"an image"),gc=(e,t=1e6)=>(n,r)=>{if(!Array.isArray(n)||n.length>t)return Pt(r,`a list of at most ${t} entries`);return n.map((o,a)=>e(o,`${r}[${a}]`))};function Ss(e){if(typeof e!=="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}var gy=(e,t=1e6,n=Number.POSITIVE_INFINITY)=>(r,o)=>{if(!Ss(r))return Pt(o,"an object");let a=Object.entries(r);if(a.length>t)return Pt(o,`an object of at most ${t} entries`);let i=Object.create(null);for(let[s,c]of a){if(s.length>n)return Pt(o,`an object whose keys have at most ${n} characters`);i[s]=e(c,`${o}.${s.slice(0,64)}`)}return i},be=(e)=>(t,n)=>{if(!Ss(t))return Pt(n,"an object");for(let o of Object.keys(t))if(!Object.hasOwn(e,o))Pt(`${n}.${o}`,"left out (unknown field)");let r={};for(let o of Object.keys(e)){if(!Object.hasOwn(t,o))Pt(`${n}.${o}`,"present");r[o]=e[o](t[o],`${n}.${o}`)}return r},uf=(e,t)=>(n,r)=>{if(!Ss(n))return Pt(r,"an object");let o=n[e],a=typeof o==="string"&&Object.hasOwn(t,o)?t[o]:void 0;return a===void 0?Pt(`${r}.${e}`,`one of ${Object.keys(t).join(", ")}`):a(n,r)};var Lr=1,by="critiqs:page-layer",ff={text:Number.POSITIVE_INFINITY,url:Number.POSITIVE_INFINITY,copy:Number.POSITIVE_INFINITY,viewStateKeys:Number.POSITIVE_INFINITY,occurrences:1e5,located:1e6,totalOccurrences:Number.POSITIVE_INFINITY,keyLength:Number.POSITIVE_INFINITY,schemes:py,image:Number.POSITIVE_INFINITY};var Cs=$e(256),df=$e(64),hy=be({x:rn,y:rn,width:rn,height:rn}),US=be({width:rn,height:rn}),DO=mc(["shared","record"]),yy=be({}),LO=40,qO=(e)=>(t,n)=>{let r=qS(t,n);if(r.size>e)throw new Un(`${n} must be an image of at most ${e} bytes.`);return r};function UO(e){let t=e.text,n=LS(e.url,e.schemes),o=gy((g,x)=>g===null||typeof g==="boolean"?g:typeof g==="number"?rn(g,x):$e(t)(g,x),e.viewStateKeys,e.keyLength),a=be({purposeId:at($e(t)),recordKey:at($e(t)),clues:be({tagName:$e(256),role:at($e(256)),label:at($e(t)),path:$e(t)})}),i=be({screen:$e(t),viewState:o,target:a,scope:DO}),s=be({screen:$e(t),viewState:o,persona:at($e(t))}),c=be({ref:df,recordKey:at($e(t))}),f=uf("status",{found:be({status:Dr("found"),occurrences:gc(c,e.occurrences)}),"not-found":be({status:Dr("not-found")}),ambiguous:be({status:Dr("ambiguous"),candidates:Pr}),"wrong-record":be({status:Dr("wrong-record")})}),p=be({document:$e(256),version:Pr,url:n,context:s,viewport:US,restores:vo,located:(g,x)=>{let k=gy(at(f),e.located,e.keyLength)(g,x),b=0;for(let v of Object.values(k))if(v?.status==="found")b+=v.occurrences.length;if(b>e.totalOccurrences)throw new Un(`${x} must have at most ${e.totalOccurrences} occurrences in all.`);return k}}),d=be({label:$e(t),category:mc(["open","started","done","canceled","unknown"])}),u=be({tracker:mc(["linear","github","jira"]),key:$e(mS.key),status:at(d)}),m=be({hidden:vo,exposedRight:at(rn),watch:gc(be({threadId:Cs,location:i})),pins:gc(be({threadId:Cs,authorName:$e(t),unread:vo,resolved:vo,tickets:gc(u,LO)})),selected:at(be({threadId:Cs,ref:at(df)})),highlight:at(be({id:Pr,location:i})),picking:at(be({hint:at($e(t)),paused:vo})),picked:at(df)}),y=qO(e.image);return{params:{connect:be({protocol:Dr(Lr)}),display:m,reveal:be({threadId:Cs,location:i,chosen:at(c)}),showPage:be({threadId:Cs,screen:$e(t),viewState:o,recordKey:at($e(t))}),measure:be({ref:at(df)}),capture:be({marker:at(hy),image:at(y)}),conceal:be({concealed:vo}),copyPage:yy,removeLink:yy},results:{connect:be({protocol:Pr,state:p}),display:p,reveal:uf("status",{shown:be({status:Dr("shown"),occurrence:c,rect:hy}),failed:be({status:Dr("failed"),reason:$e(t),keepOccurrence:vo})}),showPage:be({shown:vo}),measure:be({context:s,url:n,viewport:US,marker:at(hy),userAgent:$e(t)}),capture:uf("status",{captured:be({status:Dr("captured"),image:y}),failed:be({status:Dr("failed"),reason:$e(t)})}),conceal:my,copyPage:be({html:$e(e.copy),width:rn,height:rn,viewportWidth:rn,viewportHeight:rn,scrollY:rn,capturedAt:rn,url:n,context:s,recordKey:at($e(t))}),removeLink:my},events:{ready:be({protocol:Pr}),state:p,picked:be({occurrence:c,target:a,context:s}),outsideClick:yy,pin:be({threadId:Cs,occurrence:c})},message:$e(t)}}var zS=new WeakMap;function vy(e){let t=zS.get(e);if(t===void 0)t=UO(e),zS.set(e,t);return t}var wy=vy(ff),{params:jS,results:h3,events:zO}=wy;function BS(e){return vy(e).results}var jO=["bad-request","unknown-method","unsupported-version","cancelled","closed","gone","timeout","failed"];function ky(e,t,n=ff){if(!Ss(e)||e.tag!==by||e.channel!==t)return{ok:!1,ignore:!0};let r=typeof e.id==="number"&&Number.isSafeInteger(e.id)?e.id:null,o=e.kind==="request"?"request":e.kind==="result"||e.kind==="error"?"answer":null;if(e.v!==Lr)return{ok:!1,ignore:!1,reply:o,id:r,code:"unsupported-version",reason:`This page layer speaks version ${Lr} of Critiqs's page protocol, not ${String(e.v)}.`};try{return{ok:!0,message:BO(e,t,vy(n))}}catch(a){if(!(a instanceof Un))throw a;let i=e.kind==="request"&&!(typeof e.method==="string"&&Object.hasOwn(jS,e.method));return{ok:!1,ignore:!1,reply:o,id:r,code:i?"unknown-method":"bad-request",reason:a.message}}}function BO(e,t,n){let r={tag:by,v:Lr,channel:t},o=(a)=>{for(let i of Object.keys(e))if(!["tag","v","channel","kind",...a].includes(i))throw new Un(`${i} isn't part of a ${String(e.kind)} message.`)};switch(e.kind){case"request":{o(["id","method","params","document"]);let a=e.method;if(typeof a!=="string"||!Object.hasOwn(jS,a))throw new Un(`There is no request named ${JSON.stringify(a)}.`);let i=n.params[a];return{...r,kind:"request",id:Pr(e.id,"id"),method:a,params:i(e.params,"params"),document:at($e(256))(e.document,"document")}}case"result":return o(["id","result"]),{...r,kind:"result",id:Pr(e.id,"id"),result:e.result};case"error":{o(["id","error"]);let a=be({code:mc(jO),message:n.message})(e.error,"error");return{...r,kind:"error",id:Pr(e.id,"id"),error:a}}case"cancel":return o(["id"]),{...r,kind:"cancel",id:Pr(e.id,"id")};case"event":{o(["event","data"]);let a=e.event;if(typeof a!=="string"||!Object.hasOwn(zO,a))throw new Un(`There is no event named ${JSON.stringify(a)}.`);let i=n.events[a];return{...r,kind:"event",event:a,data:i(e.data,"data")}}default:throw new Un("kind must be request, result, error, cancel, or event.")}}function Es(e,t){return{tag:by,v:Lr,channel:e,...t}}function $O(){let e=new Set;return{add(t){return e.add(t),()=>void e.delete(t)},run(){let t=[...e];e.clear();for(let n of t)n()}}}function $S(){let e=[new Set,new Set],t={value:!1},n=$O(),r=(o)=>({send(a){if(t.value)return;for(let i of[...e[o===0?1:0]])i(a)},listen(a){return e[o].add(a),()=>e[o].delete(a)},onClose:n.add,close(){if(t.value)return;t.value=!0,e[0].clear(),e[1].clear(),n.run()}});return[r(0),r(1)]}class qr extends Error{code;name="PageLayerError";constructor(e,t){super(t);this.code=e}}function VS(e,{channel:t,limits:n=ff}){let r=BS(n),o=1,a=!1,i=new Map,s=new Map,c=e.listen((u)=>{let m=ky(u,t,n);if(!m.ok){if(!m.ignore){let x=m.reply==="answer"&&m.id!==null?i.get(m.id):void 0;if(x!==void 0)p(m.id,()=>x.reject(new qr(m.code,m.reason)));else console.warn(`Critiqs: ignored a page layer message: ${m.reason}`)}return}let y=m.message;if(y.kind==="event"){for(let x of[...s.get(y.event)??[]])x(y.data);return}if(y.kind!=="result"&&y.kind!=="error")return;let g=i.get(y.id);if(g===void 0)return;if(y.kind==="error"){p(y.id,()=>g.reject(new qr(y.error.code,y.error.message)));return}try{let x=r[g.method](y.result,"result");p(y.id,()=>g.resolve(x))}catch(x){if(!(x instanceof Un))throw x;p(y.id,()=>g.reject(new qr("bad-request",`The page layer's answer to ${g.method} can't be read: ${x.message}`)))}}),f=e.onClose(()=>d("The page layer connection closed.")),p=(u,m)=>{if(!i.delete(u))return;m()};return{request(u,m,{signal:y,timeoutMs:g,document:x=null}={}){return new Promise((k,b)=>{if(a)return b(new qr("closed","The page layer connection is closed."));if(y?.aborted)return b(new qr("cancelled",`${u} was cancelled.`));let v=o++,w,T=(A,N)=>{let R=i.get(v);if(R===void 0)return;e.send(Es(t,{kind:"cancel",id:v})),p(v,()=>R.reject(new qr(A,N)))},C=()=>T("cancelled",`${u} was cancelled.`),E=()=>{clearTimeout(w),y?.removeEventListener("abort",C)};if(i.set(v,{method:u,resolve:(A)=>{E(),k(A)},reject:(A)=>{E(),b(A)}}),y?.addEventListener("abort",C),g!==void 0)w=setTimeout(()=>T("timeout",`The page layer didn't answer ${u} in time.`),g);e.send(Es(t,{kind:"request",id:v,method:u,params:m,document:x}))})},on(u,m){let y=s.get(u)??new Set;return s.set(u,y),y.add(m),()=>y.delete(m)},close:()=>d("The page layer connection closed.")};function d(u){if(a)return;a=!0;for(let m of i.keys())e.send(Es(t,{kind:"cancel",id:m}));c(),f();for(let[m,y]of[...i])p(m,()=>y.reject(new qr("closed",u)));s.clear()}}function QS(e,{channel:t,handlers:n,document:r=null}){let o=!1,a=new Map,i=(p,d)=>{if(o)return;e.send(Es(t,"result"in d?{kind:"result",id:p,result:d.result}:{kind:"error",id:p,error:d.error}))},s=e.listen((p)=>{let d=ky(p,t);if(!d.ok){if(d.ignore)return;if(d.reply==="request"&&d.id!==null)i(d.id,{error:{code:d.code,message:d.reason}});else console.warn(`Critiqs: ignored a panel message: ${d.reason}`);return}let u=d.message;if(u.kind==="cancel"){a.get(u.id)?.abort();return}if(u.kind!=="request")return;let{id:m}=u;if(u.document!==null&&r!==null&&u.document!==r){i(m,{error:{code:"gone",message:"That page is gone: the prototype showed another one."}});return}if(a.has(m)){i(m,{error:{code:"bad-request",message:`Request ${m} is already running.`}});return}let y=new AbortController;a.set(m,y);let g=(b)=>{if(a.get(m)!==y)return;a.delete(m),i(m,y.signal.aborted?{error:{code:"cancelled",message:`${u.method} was cancelled.`}}:b)},x=n[u.method],k;try{k=x(u.params,y.signal)}catch(b){g({error:{code:"failed",message:HS(b)}});return}if(k instanceof Promise)k.then((b)=>g({result:b}),(b)=>g({error:{code:"failed",message:HS(b)}}));else g({result:k})}),c=()=>{if(o)return;for(let p of a.values())p.abort();a.clear(),o=!0,s(),f()},f=e.onClose(c);return{emit(p,d){if(!o)e.send(Es(t,{kind:"event",event:p,data:d}))},close:c}}function HS(e){return((e instanceof Error?e.message:String(e))||"The page layer couldn't finish this request.").slice(0,4000)}var HO=Symbol.for("critiqs.review-frame");function KS(e=globalThis){return e[HO]===!0}var pf=new Set;function GS(e,t,{fetchFn:n=(i,s)=>fetch(i,s),location:r=globalThis.location,storage:o=VO(),now:a=Date.now()}={}){if(r===void 0||r.protocol!=="https:"&&r.protocol!=="http:")return;let i=`critiqs:connected:${e}:${t}`;if(pf.has(i)||a<QO(o,i)+3600000)return;pf.add(i),n(`${e}/critiqs/connected`,{method:"POST",body:t,keepalive:!0}).then((s)=>{if(s.ok)KO(o,i,a);else pf.delete(i)},()=>pf.delete(i))}function VO(){try{return globalThis.localStorage??null}catch{return null}}function QO(e,t){try{let n=Number(e?.getItem(t)??0);return Number.isFinite(n)&&n>1?n:0}catch{return 0}}function KO(e,t,n){try{e?.setItem(t,String(n))}catch{}}var mf=Nn(null);function se(){let e=At(mf);if(e===null)throw Error("Critiqs's interface needs a backend transport.");return e}class hc extends Error{code;constructor(e,t){super(t);this.code=e}}function zn(e){if(e instanceof hc)return{status:"error",code:e.code,message:e.message};if(e instanceof qr){let n=e.code==="failed"?e.message:e.code==="cancelled"?"The prototype changed pages before this finished. Try again.":"The prototype's page didn't answer. Check that it is still open with Critiqs on it, then try again.";return{status:"error",code:`page-${e.code}`,message:n}}let t=e?.data;if(typeof t==="object"&&t!==null){let{code:n,message:r}=t;return{status:"error",code:n??"error",message:r??"Something went wrong."}}if(e instanceof Error&&/ArgumentValidationError|Invalid argument|not a valid ID/i.test(e.message))return{status:"error",code:"not-found",message:"This item does not exist."};return{status:"error",code:"error",message:"Something went wrong. Try again."}}function ne(e){return zn(e).message}function Ur(e,t,n){let[r,o]=S(e),a=O(e);return a.current=e,_(()=>{if(!t)return;let i=0,s=()=>{let c=a.current();o((f)=>n(f,c)?f:c),i=requestAnimationFrame(s)};return s(),()=>cancelAnimationFrame(i)},[t,n]),r}function jn(e,t){let n=()=>{try{let s=window.localStorage.getItem(e);return s===null?t:JSON.parse(s)}catch{return t}},[r,o]=S(()=>({key:e,value:n()})),a=r.key===e?r.value:n();if(r.key!==e)o({key:e,value:a});return[a,(s)=>{o((c)=>c.key===e&&Object.is(c.value,s)?c:{key:e,value:s});try{window.localStorage.setItem(e,JSON.stringify(s))}catch{}}]}function gf(e){let t=e.composedPath()[0];if(!(t instanceof HTMLElement))return!1;return t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)}function si(){let e=()=>new Date().toISOString().slice(0,10),[t,n]=S(e);return _(()=>{let r=new Date,o=Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()+1),a=setTimeout(()=>n(e()),o-r.getTime()+1000);return()=>clearTimeout(a)},[t]),t}function YS(e){if(e.isComposing||e.repeat||e.altKey||!(e.ctrlKey||e.metaKey))return!1;return e.code==="Backslash"||e.key==="\\"||e.key==="|"}function Bn(e,t=Date.now()){let n=Math.max(0,t-e);if(n<60000)return"now";if(n<3600000)return`${Math.floor(n/60000)}m`;if(n<86400000)return`${Math.floor(n/3600000)}h`;if(n<604800000)return`${Math.floor(n/86400000)}d`;return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function on(e){return new Date(e).toLocaleString()}function Ns(e){let t=e.trim().split(/\s+/).filter(Boolean);return(t.length>1?`${t[0][0]}${t[t.length-1][0]}`:(t[0]??"?").slice(0,2)).toUpperCase()}var FS=["#7c3aed","#0d9488","#db2777","#2563eb","#ea580c","#4f46e5","#059669","#b45309"];function WS(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;return FS[t%FS.length]}var XS=60;function gr(e){return Object.entries(e).filter(([,t])=>t!==null&&t!==!1&&t!=="").map(([t,n])=>n===!0?t:`${t}: ${GO(String(n))}`).join(", ")}function GO(e){return e.length>XS?`${e.slice(0,XS-1)}…`:e}function JS(e){if(e===null)return null;let t=/(Edg|Firefox|Chrome|Safari)\/(\d+)/.exec(e);if(t===null)return e.slice(0,60);let n={Edg:"Edge",Firefox:"Firefox",Chrome:"Chrome",Safari:"Safari"}[t[1]]??t[1],r=t[1]==="Safari"?/Version\/(\d+)/.exec(e)?.[1]??t[2]:t[2];return`${n} ${r}`}function yc(e){let{screen:t,viewState:n,target:r,scope:o}=e.reattachment?.location??e.location??e.anchor;return{screen:t,viewState:n,target:r,scope:o}}function xy(e){if(typeof e.checkVisibility==="function")return e.checkVisibility({checkVisibilityCSS:!0,visibilityProperty:!0});return e.getClientRects().length>0}function As(e){return cc(e.target,e.scope,document.body,xy)}function bc(e){let t=e.located;if(t===null)return"other-screen";switch(t.status){case"found":return"live";case"wrong-record":return"other-record";case"ambiguous":return"ambiguous";case"not-found":return Object.keys(e.location.viewState).length>0&&!e.sameView?"other-view":"missing"}}function hf(e){let{location:t}=e;switch(bc(e)){case"live":return"In this view";case"other-screen":return`On ${t.screen}`;case"other-view":return`In another view (${gr(t.viewState)})`;case"other-record":return`Its record (${t.target.recordKey}) isn't shown here`;case"ambiguous":return"Matches several elements; Critiqs won't guess";case"missing":return"Not shown in this view; it may be hidden, changed, or removed"}}var aC="[modern-screenshot]",la=typeof window<"u",YO=la&&"Worker"in window,dz=la&&"atob"in window,fz=la&&"btoa"in window,Cy=la?window.navigator?.userAgent:"",iC=Cy.includes("Chrome"),yf=Cy.includes("AppleWebKit")&&!iC,Ey=Cy.includes("Firefox"),FO=(e)=>e&&("__CONTEXT__"in e),XO=(e)=>e.constructor.name==="CSSFontFaceRule",WO=(e)=>e.constructor.name==="CSSImportRule",JO=(e)=>e.constructor.name==="CSSLayerBlockRule",zr=(e)=>e.nodeType===1,xc=(e)=>typeof e.className==="object",sC=(e)=>e.tagName==="image",ZO=(e)=>e.tagName==="use",wc=(e)=>zr(e)&&typeof e.style<"u"&&!xc(e),e_=(e)=>e.nodeType===8,t_=(e)=>e.nodeType===3,Rs=(e)=>e.tagName==="IMG",vf=(e)=>e.tagName==="VIDEO",n_=(e)=>e.tagName==="CANVAS",r_=(e)=>e.tagName==="TEXTAREA",o_=(e)=>e.tagName==="INPUT",a_=(e)=>e.tagName==="STYLE",i_=(e)=>e.tagName==="SCRIPT",s_=(e)=>e.tagName==="SELECT",l_=(e)=>e.tagName==="SLOT",c_=(e)=>e.tagName==="IFRAME",u_=(...e)=>console.warn(aC,...e);function d_(e){let t=e?.createElement?.("canvas");if(t)t.height=t.width=1;return Boolean(t)&&"toDataURL"in t&&Boolean(t.toDataURL("image/webp").includes("image/webp"))}var Ty=(e)=>e.startsWith("data:");function lC(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(la&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;if(!la)return e;let n=wf().implementation.createHTMLDocument(),r=n.createElement("base"),o=n.createElement("a");if(n.head.appendChild(r),n.body.appendChild(o),t)r.href=t;return o.href=e,o.href}function wf(e){return(e&&zr(e)?e?.ownerDocument:e)??window.document}var Ny="http://www.w3.org/2000/svg";function f_(e,t,n){let r=wf(n).createElementNS(Ny,"svg");return r.setAttributeNS(null,"width",e.toString()),r.setAttributeNS(null,"height",t.toString()),r.setAttributeNS(null,"viewBox",`0 0 ${e} ${t}`),r}function p_(e,t){return new Promise((n,r)=>{let o=new FileReader;if(o.onload=()=>n(o.result),o.onerror=()=>r(o.error),o.onabort=()=>r(Error(`Failed read blob to ${t}`)),t==="dataUrl")o.readAsDataURL(e);else if(t==="arrayBuffer")o.readAsArrayBuffer(e)})}var m_=(e)=>p_(e,"dataUrl");function vc(e,t){let n=wf(t).createElement("img");return n.decoding="sync",n.loading="eager",n.src=e,n}function bf(e,t){return new Promise((n)=>{let{timeout:r,ownerDocument:o,onError:a,onWarn:i}=t??{},s=typeof e==="string"?vc(e,wf(o)):e,c=null,f=null;function p(){n(s),c&&clearTimeout(c),f?.()}if(r)c=setTimeout(p,r);if(vf(s)){let d=s.currentSrc||s.src;if(!d){if(s.poster)return bf(s.poster,t).then(n);return p()}if(s.readyState>=2)return p();let u=p,m=(y)=>{i?.("Failed video load",d,y),a?.(y),p()};f=()=>{s.removeEventListener("loadeddata",u),s.removeEventListener("error",m)},s.addEventListener("loadeddata",u,{once:!0}),s.addEventListener("error",m,{once:!0})}else{let d=sC(s)?s.href.baseVal:s.currentSrc||s.src;if(!d)return p();let u=async()=>{if(Rs(s)&&"decode"in s)try{await s.decode()}catch(y){i?.("Failed to decode image, trying to render anyway",s.dataset.originalSrc||d,y)}p()},m=(y)=>{i?.("Failed image load",s.dataset.originalSrc||d,y),p()};if(Rs(s)&&s.complete)return u();f=()=>{s.removeEventListener("load",u),s.removeEventListener("error",m)},s.addEventListener("load",u,{once:!0}),s.addEventListener("error",m,{once:!0})}})}async function g_(e,t){if(wc(e))if(Rs(e)||vf(e))await bf(e,t);else await Promise.all(["img","video"].flatMap((n)=>Array.from(e.querySelectorAll(n)).map((r)=>bf(r,t))))}var cC=function(){let t=0,n=()=>`0000${(Math.random()*1679616<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${n()}${t}`)}();function uC(e){return e?.split(",").map((t)=>t.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}var ZS=0;function h_(e){let t=`${aC}[#${ZS}]`;return ZS++,{time:(n)=>e&&console.time(`${t} ${n}`),timeEnd:(n)=>e&&console.timeEnd(`${t} ${n}`),warn:(...n)=>e&&u_(...n)}}function y_(e){return{cache:e?"no-cache":"force-cache"}}async function b_(e,t){return FO(e)?e:Ay(e,{...t,autoDestruct:!0})}async function Ay(e,t){let{scale:n=1,workerUrl:r,workerNumber:o=1}=t||{},a=Boolean(t?.debug),i=t?.features??!0,s=e.ownerDocument??(la?window.document:void 0),c=e.ownerDocument?.defaultView??(la?window:void 0),f=new Map,p={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:30000,progress:null,debug:a,fetch:{requestInit:y_(t?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:o,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...t,__CONTEXT__:!0,log:h_(a),node:e,ownerDocument:s,ownerWindow:c,dpi:n===1?null:96*n,svgStyleElement:v_(s),svgDefsElement:s?.createElementNS(Ny,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:YO&&r&&o?o:0})].map(()=>{try{let m=new Worker(r);return m.onmessage=async(y)=>{let{url:g,result:x}=y.data;if(x)f.get(g)?.resolve?.(x);else f.get(g)?.reject?.(Error(`Error receiving message from worker: ${g}`))},m.onmessageerror=(y)=>{let{url:g}=y.data;f.get(g)?.reject?.(Error(`Error receiving message from worker: ${g}`))},m}catch(m){return p.log.warn("Failed to new Worker",m),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[d_(s)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:f,drawImageCount:0,tasks:[],features:i,isEnable:(m)=>{if(m==="restoreScrollPosition")return typeof i==="boolean"?!1:i[m]??!1;if(typeof i==="boolean")return i;return i[m]??!0},shadowRoots:[]};p.log.time("wait until load"),await g_(e,{timeout:p.timeout,onWarn:p.log.warn}),p.log.timeEnd("wait until load");let{width:d,height:u}=w_(e,p);return p.width=d,p.height=u,p}function v_(e){if(!e)return;let t=e.createElement("style"),n=t.ownerDocument.createTextNode(`
|
|
16
|
+
.______background-clip--text {
|
|
17
|
+
background-clip: text;
|
|
18
|
+
-webkit-background-clip: text;
|
|
19
|
+
}
|
|
20
|
+
`);return t.appendChild(n),t}function w_(e,t){let{width:n,height:r}=t;if(zr(e)&&(!n||!r)){let o=e.getBoundingClientRect();n=n||o.width||Number(e.getAttribute("width"))||0,r=r||o.height||Number(e.getAttribute("height"))||0}return{width:n,height:r}}function dC(e,t){if(e.ownerDocument)try{let a=e.toDataURL();if(a!=="data:,")return vc(a,e.ownerDocument)}catch(a){t.log.warn("Failed to clone canvas",a)}let n=e.cloneNode(!1),r=e.getContext("2d"),o=n.getContext("2d");try{if(r&&o)o.putImageData(r.getImageData(0,0,e.width,e.height),0,0);return n}catch(a){t.log.warn("Failed to clone canvas",a)}return n}function k_(e,t){try{if(e?.contentDocument?.documentElement)return Ry(e.contentDocument.documentElement,t)}catch(n){t.log.warn("Failed to clone iframe",n)}return e.cloneNode(!1)}function x_(e){let t=e.cloneNode(!1);if(e.currentSrc&&e.currentSrc!==e.src)t.src=e.currentSrc,t.srcset="";if(t.loading==="lazy")t.loading="eager";return t}async function T_(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return vc(e.poster,e.ownerDocument);let n=e.cloneNode(!1);if(n.crossOrigin="anonymous",e.currentSrc&&e.currentSrc!==e.src)n.src=e.currentSrc;let r=n.ownerDocument;if(r){let o=!0;if(await bf(n,{onError:()=>o=!1,onWarn:t.log.warn}),!o){if(e.poster)return vc(e.poster,e.ownerDocument);return n}n.currentTime=e.currentTime,await new Promise((i)=>{n.addEventListener("seeked",i,{once:!0})});let a=r.createElement("canvas");a.width=e.offsetWidth,a.height=e.offsetHeight;try{let i=a.getContext("2d");if(i)i.drawImage(n,0,0,a.width,a.height)}catch(i){if(t.log.warn("Failed to clone video",i),e.poster)return vc(e.poster,e.ownerDocument);return n}return dC(a,t)}return n}function S_(e,t){if(n_(e))return dC(e,t);if(c_(e))return k_(e,t);if(Rs(e))return x_(e);if(vf(e))return T_(e,t);return e.cloneNode(!1)}function C_(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{if(n)t=n.createElement("iframe"),t.id=`__SANDBOX__${cC()}`,t.width="0",t.height="0",t.style.visibility="hidden",t.style.position="fixed",n.body.appendChild(t),t.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',e.sandbox=t}catch(r){e.log.warn("Failed to getSandBox",r)}}return t}var E_=["width","height","-webkit-text-fill-color"],N_=["stroke","fill"];function fC(e,t,n){let{defaultComputedStyles:r}=n,o=e.nodeName.toLowerCase(),a=xc(e)&&o!=="svg",i=a?N_.map((g)=>[g,e.getAttribute(g)]).filter(([,g])=>g!==null):[],s=[a&&"svg",o,i.map((g,x)=>`${g}=${x}`).join(","),t].filter(Boolean).join(":");if(r.has(s))return r.get(s);let f=C_(n)?.contentWindow;if(!f)return new Map;let p=f?.document,d,u;if(a)d=p.createElementNS(Ny,"svg"),u=d.ownerDocument.createElementNS(d.namespaceURI,o),i.forEach(([g,x])=>{u.setAttributeNS(null,g,x)}),d.appendChild(u);else d=u=p.createElement(o);u.textContent=" ",p.body.appendChild(d);let m=f.getComputedStyle(u,t),y=new Map;for(let g=m.length,x=0;x<g;x++){let k=m.item(x);if(E_.includes(k))continue;y.set(k,m.getPropertyValue(k))}return p.body.removeChild(d),r.set(s,y),y}function pC(e,t,n){let r=new Map,o=[],a=new Map;if(n)for(let s of n)i(s);else for(let s=e.length,c=0;c<s;c++){let f=e.item(c);i(f)}for(let s=o.length,c=0;c<s;c++)a.get(o[c])?.forEach((f,p)=>r.set(p,f));function i(s){let c=e.getPropertyValue(s),f=e.getPropertyPriority(s),p=s.lastIndexOf("-"),d=p>-1?s.substring(0,p):void 0;if(d){let u=a.get(d);if(!u)u=new Map,a.set(d,u);u.set(s,[c,f])}if(t.get(s)===c&&!f)return;if(d)o.push(d);else r.set(s,[c,f])}return r}function A_(e,t,n,r){let{ownerWindow:o,includeStyleProperties:a,currentParentNodeStyle:i}=r,s=t.style,c=o.getComputedStyle(e),f=fC(e,null,r);i?.forEach((d,u)=>{f.delete(u)});let p=pC(c,f,a);if(p.delete("transition-property"),p.delete("all"),p.delete("d"),p.delete("content"),n)p.delete("position"),p.delete("margin-top"),p.delete("margin-right"),p.delete("margin-bottom"),p.delete("margin-left"),p.delete("margin-block-start"),p.delete("margin-block-end"),p.delete("margin-inline-start"),p.delete("margin-inline-end"),p.set("box-sizing",["border-box",""]);if(p.get("background-clip")?.[0]==="text")t.classList.add("______background-clip--text");if(iC){if(!p.has("font-kerning"))p.set("font-kerning",["normal",""]);if((p.get("overflow-x")?.[0]==="hidden"||p.get("overflow-y")?.[0]==="hidden")&&p.get("text-overflow")?.[0]==="ellipsis"&&e.scrollWidth===e.clientWidth)p.set("text-overflow",["clip",""])}for(let d=s.length,u=0;u<d;u++)s.removeProperty(s.item(u));return p.forEach(([d,u],m)=>{s.setProperty(m,d,u)}),p}function R_(e,t){if(r_(e)||o_(e)||s_(e))t.setAttribute("value",e.value)}var M_=["::before","::after"],I_=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"];function O_(e,t,n,r,o){let{ownerWindow:a,svgStyleElement:i,svgStyles:s,currentNodeStyle:c}=r;if(!i||!a)return;function f(p){let d=a.getComputedStyle(e,p),u=d.getPropertyValue("content");if(!u||u==="none")return;o?.(u),u=u.replace(/(')|(")|(counter\(.+\))/g,"");let m=[cC()],y=fC(e,p,r);c?.forEach((v,w)=>{y.delete(w)});let g=pC(d,y,r.includeStyleProperties);if(g.delete("content"),g.delete("-webkit-locale"),g.get("background-clip")?.[0]==="text")t.classList.add("______background-clip--text");let x=[`content: '${u}';`];if(g.forEach(([v,w],T)=>{x.push(`${T}: ${v}${w?" !important":""};`)}),x.length===1)return;try{t.className=[t.className,...m].join(" ")}catch(v){r.log.warn("Failed to copyPseudoClass",v);return}let k=x.join(`
|
|
21
|
+
`),b=s.get(k);if(!b)b=[],s.set(k,b);b.push(`.${m[0]}${p}`)}if(M_.forEach(f),n)I_.forEach(f)}var eC=new Set(["symbol"]);async function tC(e,t,n,r,o){if(zr(n)&&(a_(n)||i_(n)))return;if(r.filter&&!r.filter(n))return;if(eC.has(t.nodeName)||eC.has(n.nodeName))r.currentParentNodeStyle=void 0;else r.currentParentNodeStyle=r.currentNodeStyle;let a=await Ry(n,r,!1,o);if(r.isEnable("restoreScrollPosition"))__(e,a);t.appendChild(a)}async function nC(e,t,n,r){let o=e.firstChild;if(zr(e)){if(e.shadowRoot)o=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot)}for(let a=o;a;a=a.nextSibling){if(e_(a))continue;if(zr(a)&&l_(a)&&typeof a.assignedNodes==="function"){let i=a.assignedNodes();for(let s=0;s<i.length;s++)await tC(e,t,i[s],n,r)}else await tC(e,t,a,n,r)}}function __(e,t){if(!wc(e)||!wc(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:o}=t.style,a=new DOMMatrix(o),{a:i,b:s,c,d:f}=a;a.a=1,a.b=0,a.c=0,a.d=1,a.translateSelf(-r,-n),a.a=i,a.b=s,a.c=c,a.d=f,t.style.transform=a.toString()}function P_(e,t){let{backgroundColor:n,width:r,height:o,style:a}=t,i=e.style;if(n)i.setProperty("background-color",n,"important");if(r)i.setProperty("width",`${r}px`,"important");if(o)i.setProperty("height",`${o}px`,"important");if(a)for(let s in a)i[s]=a[s]}var D_=/^[\w-:]+$/;async function Ry(e,t,n=!1,r){let{ownerDocument:o,ownerWindow:a,fontFamilies:i,onCloneEachNode:s}=t;if(o&&t_(e)){if(r&&/\S/.test(e.data))r(e.data);return o.createTextNode(e.data)}if(o&&a&&zr(e)&&(wc(e)||xc(e))){let f=await S_(e,t);if(t.isEnable("removeAbnormalAttributes")){let g=f.getAttributeNames();for(let x=g.length,k=0;k<x;k++){let b=g[k];if(!D_.test(b))f.removeAttribute(b)}}let p=t.currentNodeStyle=A_(e,f,n,t);if(n)P_(f,t);let d=!1;if(t.isEnable("copyScrollbar")){let g=[p.get("overflow-x")?.[0],p.get("overflow-y")?.[0]];d=g.includes("scroll")||(g.includes("auto")||g.includes("overlay"))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)}let u=p.get("text-transform")?.[0],m=uC(p.get("font-family")?.[0]),y=m?(g)=>{if(u==="uppercase")g=g.toUpperCase();else if(u==="lowercase")g=g.toLowerCase();else if(u==="capitalize")g=g[0].toUpperCase()+g.substring(1);m.forEach((x)=>{let k=i.get(x);if(!k)i.set(x,k=new Set);g.split("").forEach((b)=>k.add(b))})}:void 0;if(O_(e,f,d,t,y),R_(e,f),!vf(e))await nC(e,f,t,y);return await s?.(f),f}let c=e.cloneNode(!1);return await nC(e,c,t),await s?.(c),c}function kf(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove()}catch(t){e.log.warn("Failed to destroyContext",t)}e.sandbox=void 0}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[]}function L_(e){let{url:t,timeout:n,responseType:r,...o}=e,a=new AbortController,i=n?setTimeout(()=>a.abort(),n):void 0;return fetch(t,{signal:a.signal,...o}).then((s)=>{if(!s.ok)throw Error("Failed fetch, not 2xx response",{cause:s});switch(r){case"arrayBuffer":return s.arrayBuffer();case"dataUrl":return s.blob().then(m_);case"text":default:return s.text()}}).finally(()=>clearTimeout(i))}function kc(e,t){let{url:n,requestType:r="text",responseType:o="text",imageDom:a}=t,i=n,{timeout:s,acceptOfImage:c,requests:f,fetchFn:p,fetch:{requestInit:d,bypassingCache:u,placeholderImage:m},font:y,workers:g,fontFamilies:x}=e;if(r==="image"&&(yf||Ey))e.drawImageCount++;let k=f.get(n);if(!k){if(u){if(u instanceof RegExp&&u.test(i))i+=(/\?/.test(i)?"&":"?")+new Date().getTime()}let b=r.startsWith("font")&&y&&y.minify,v=new Set;if(b)r.split(";")[1].split(",").forEach((E)=>{if(!x.has(E))return;x.get(E).forEach((A)=>v.add(A))});let w=b&&v.size,T={url:i,timeout:s,responseType:w?"arrayBuffer":o,headers:r==="image"?{accept:c}:void 0,...d};k={type:r,resolve:void 0,reject:void 0,response:null},k.response=(async()=>{if(p&&r==="image"){let C=await p(n);if(C)return C}if(!yf&&n.startsWith("http")&&g.length)return new Promise((C,E)=>{g[f.size&g.length-1].postMessage({rawUrl:n,...T}),k.resolve=C,k.reject=E});return L_(T)})().catch((C)=>{if(f.delete(n),r==="image"&&m)return e.log.warn("Failed to fetch image base64, trying to use placeholder image",i),typeof m==="string"?m:m(a);throw C}),f.set(n,k)}return k.response}async function mC(e,t,n,r){if(!gC(e))return e;for(let[o,a]of q_(e,t))try{let i=await kc(n,{url:a,requestType:r?"image":"text",responseType:"dataUrl"});e=e.replace(U_(o),`$1${i}$3`)}catch(i){n.log.warn("Failed to fetch css data url",o,i)}return e}function gC(e){return/url\((['"]?)([^'"]+?)\1\)/.test(e)}var hC=/url\((['"]?)([^'"]+?)\1\)/g;function q_(e,t){let n=[];return e.replace(hC,(r,o,a)=>(n.push([a,lC(a,t)]),r)),n.filter(([r])=>!Ty(r))}function U_(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}var z_=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function j_(e,t){return z_.map((n)=>{let r=e.getPropertyValue(n);if(!r||r==="none")return null;if(yf||Ey)t.drawImageCount++;return mC(r,null,t,!0).then((o)=>{if(!o||r===o)return;e.setProperty(n,o,e.getPropertyPriority(n))})}).filter(Boolean)}function B_(e,t){if(Rs(e)){let n=e.currentSrc||e.src;if(!Ty(n))return[kc(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then((r)=>{if(!r)return;e.srcset="",e.dataset.originalSrc=n,e.src=r||""})];if(yf||Ey)t.drawImageCount++}else if(xc(e)&&!Ty(e.href.baseVal)){let n=e.href.baseVal;return[kc(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then((r)=>{if(!r)return;e.dataset.originalSrc=n,e.href.baseVal=r||""})]}return[]}function $_(e,t){let{ownerDocument:n,svgDefsElement:r}=t,o=e.getAttribute("href")??e.getAttribute("xlink:href");if(!o)return[];let[a,i]=o.split("#");if(i){let s=`#${i}`,c=t.shadowRoots.reduce((f,p)=>f??p.querySelector(`svg ${s}`),n?.querySelector(`svg ${s}`));if(a)e.setAttribute("href",s);if(r?.querySelector(s))return[];if(c)return r?.appendChild(c.cloneNode(!0)),[];else if(a)return[kc(t,{url:a,responseType:"text"}).then((f)=>{r?.insertAdjacentHTML("beforeend",f)})]}return[]}function yC(e,t){let{tasks:n}=t;if(zr(e)){if(Rs(e)||sC(e))n.push(...B_(e,t));if(ZO(e))n.push(...$_(e,t))}if(wc(e))n.push(...j_(e.style,t));e.childNodes.forEach((r)=>{yC(r,t)})}async function H_(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:o,fontCssTexts:a,tasks:i,font:s}=t;if(!n||!r||!o.size)return;if(s&&s.cssText){let c=oC(s.cssText,t);r.appendChild(n.createTextNode(`${c}
|
|
22
|
+
`))}else{let c=Array.from(n.styleSheets).filter((m)=>{try{return"cssRules"in m&&Boolean(m.cssRules.length)}catch(y){return t.log.warn(`Error while reading CSS rules from ${m.href}`,y),!1}}),f=n.implementation.createHTMLDocument(""),p=f.createElement("style");f.head.appendChild(p);let d=p.sheet;if(await Promise.all(c.flatMap((m)=>Array.from(m.cssRules).map(async(y)=>{if(WO(y)){let g=y.href,x="";try{x=await kc(t,{url:g,requestType:"text",responseType:"text"})}catch(b){t.log.warn(`Error fetch remote css import from ${g}`,b)}let k=x.replace(hC,(b,v,w)=>b.replace(w,lC(w,g)));for(let b of Q_(k))try{d.insertRule(b,d.cssRules.length)}catch(v){t.log.warn("Error inserting rule from remote css import",{rule:b,error:v})}}}))),d.cssRules.length)c.push(d);let u=[];c.forEach((m)=>{Sy(m.cssRules,u)}),u.filter((m)=>XO(m)&&gC(m.style.getPropertyValue("src"))&&uC(m.style.getPropertyValue("font-family"))?.some((y)=>o.has(y))).forEach((m)=>{let y=m,g=a.get(y.cssText);if(g)r.appendChild(n.createTextNode(`${g}
|
|
23
|
+
`));else i.push(mC(y.cssText,y.parentStyleSheet?y.parentStyleSheet.href:null,t).then((x)=>{x=oC(x,t),a.set(y.cssText,x),r.appendChild(n.createTextNode(`${x}
|
|
24
|
+
`))}))})}}var V_=/(\/\*[\s\S]*?\*\/)/g,rC=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function Q_(e){if(e==null)return[];let t=[],n=e.replace(V_,"");while(!0){let a=rC.exec(n);if(!a)break;t.push(a[0])}n=n.replace(rC,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");while(!0){let a=r.exec(n);if(!a)if(a=o.exec(n),!a)break;else r.lastIndex=o.lastIndex;else o.lastIndex=r.lastIndex;t.push(a[0])}return t}var K_=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,G_=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function oC(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(G_,(o)=>{while(!0){let[a,,i]=K_.exec(o)||[];if(!i)return"";if(i===r)return`src: ${a};`}}):e}function Sy(e,t=[]){for(let n of Array.from(e))if(JO(n))t.push(...Sy(n.cssRules));else if("cssRules"in n)Sy(n.cssRules,t);else t.push(n);return t}var Y_=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function F_(e){return Y_.test(e.innerHTML)}async function bC(e,t){let n=await b_(e,t);if(zr(n.node)&&xc(n.node)&&!F_(n.node))return n.node;let{ownerDocument:r,log:o,tasks:a,svgStyleElement:i,svgDefsElement:s,svgStyles:c,font:f,progress:p,autoDestruct:d,onCloneNode:u,onEmbedNode:m,onCreateForeignObjectSvg:y}=n;o.time("clone node");let g=await Ry(n.node,n,!0);if(i&&r){let w="";c.forEach((T,C)=>{w+=`${T.join(`,
|
|
25
|
+
`)} {
|
|
26
|
+
${C}
|
|
27
|
+
}
|
|
28
|
+
`}),i.appendChild(r.createTextNode(w))}if(o.timeEnd("clone node"),await u?.(g),f!==!1&&zr(g))o.time("embed web font"),await H_(g,n),o.timeEnd("embed web font");o.time("embed node"),yC(g,n);let x=a.length,k=0,b=async()=>{while(!0){let w=a.pop();if(!w)break;try{await w}catch(T){n.log.warn("Failed to run task",T)}p?.(++k,x)}};p?.(k,x),await Promise.all([...Array.from({length:4})].map(b)),o.timeEnd("embed node"),await m?.(g);let v=X_(g,n);return s&&v.insertBefore(s,v.children[0]),i&&v.insertBefore(i,v.children[0]),d&&kf(n),await y?.(v),v}function X_(e,t){let{width:n,height:r}=t,o=f_(n,r,e.ownerDocument),a=o.ownerDocument.createElementNS(o.namespaceURI,"foreignObject");return a.setAttributeNS(null,"x","0%"),a.setAttributeNS(null,"y","0%"),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.append(e),o.appendChild(a),o}var wo="data-critiqs-mask",nr="critiqs-root";var W_=1e4,J_=30,Z_=8388608,eP="#0d63f3",vC="#6b7280",My="The capture took too long.";async function xC(e,t,n=W_){let r={context:null},o;try{let a=await Promise.race([tP(e,t,performance.now()+n,r),new Promise((i,s)=>{o=setTimeout(()=>s(Error(My)),n)})]);if(a.size>Z_)return{status:"failed",reason:"The capture was too large to save."};return{status:"captured",image:a}}catch(a){return{status:"failed",reason:lP(a)}}finally{if(clearTimeout(o),r.context!==null)kf(r.context)}}async function tP(e,t,n,r){let{scrollX:o,scrollY:a,innerWidth:i,innerHeight:s}=window,c=Math.min(window.devicePixelRatio||1,2),f=()=>{if(performance.now()>n)throw Error(My)},p=performance.now(),d=async(b)=>{if(xf(b)&&b.hasAttribute(wo))iP(b);if(f(),performance.now()-p<J_)return;await wC(0),p=performance.now(),f()},u=document.createElement("iframe"),m=await Ay(document.documentElement,{scale:c,backgroundColor:getComputedStyle(document.body).backgroundColor||"#ffffff",filter:(b)=>{if(b===e||b===u||sP(b)||aP(b))return!1;if(xf(b)&&b.hasAttribute(wo)&&/^(canvas|video|iframe)$/.test(b.localName))throw Error("The browser could not safely hide the private media in this page.");return!0},features:{restoreScrollPosition:!0},timeout:Math.max(0,n-performance.now()),includeStyleProperties:oP(),onCloneEachNode:d,onCloneNode:f,onEmbedNode:f,onCreateForeignObjectSvg:f}),y;try{r.context=m,f(),m.sandbox=u,await nP(u,n),f(),y=await rP(await bC(m),n),f()}finally{kf(m)}let g=document.createElement("canvas");g.width=Math.round(i*c),g.height=Math.round(s*c);let x=g.getContext("2d");if(x===null)throw Error("The browser could not create a drawing surface.");let k=()=>{x.clearRect(0,0,g.width,g.height),x.drawImage(y,0,0,m.width*c,m.height*c)};k();for(let b=0;b<m.drawImageCount;b++)await wC(b+100),f(),k();if(x.scale(c,c),t!==null)x.strokeStyle=eP,x.lineWidth=3,x.strokeRect(t.x-o-2,t.y-a-2,t.width+4,t.height+4);return await new Promise((b,v)=>{g.toBlob((w)=>w===null?v(Error("The capture could not be encoded.")):b(w),"image/png")})}function nP(e,t){return new Promise((n)=>{let r=setTimeout(n,Math.max(0,t-performance.now()));e.addEventListener("load",()=>{clearTimeout(r),n()},{once:!0}),e.width="0",e.height="0",e.tabIndex=-1,e.setAttribute("aria-hidden","true"),e.style.cssText="position: fixed; visibility: hidden; border: 0;",e.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',document.body.appendChild(e)})}async function rP(e,t){let n=new XMLSerializer().serializeToString(e).replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF]/gu,""),r=new Image;r.decoding="sync",r.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;let o;try{await Promise.race([r.decode().catch(()=>{throw Error("The browser could not draw the copied page.")}),new Promise((a,i)=>{o=setTimeout(()=>{r.src="",i(Error(My))},Math.max(0,t-performance.now()))})])}finally{clearTimeout(o)}return r}function oP(){let e=getComputedStyle(document.documentElement),t=[];for(let n=0;n<e.length;n++){let r=e.item(n);if(!r.startsWith("--"))t.push(r)}return t}function wC(e){return new Promise((t)=>setTimeout(t,e))}function aP(e){for(let t=kC(e);t!==null;t=kC(t))if(xf(t)&&t.hasAttribute(wo))return!0;return!1}function kC(e){let t=e.assignedSlot;if(t)return t;let n=e.parentNode;return n?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in n?n.host:n}function iP(e){e.replaceChildren();for(let n of e.getAttributeNames())if(n!=="style")e.removeAttribute(n);let t=e.style;t.setProperty("background",vC,"important"),t.setProperty("color","transparent","important"),t.setProperty("-webkit-text-fill-color","transparent","important"),t.setProperty("border-color",vC,"important"),t.setProperty("box-shadow","none","important"),t.setProperty("text-shadow","none","important"),t.setProperty("outline","none","important")}function sP(e){return xf(e)&&e.localName===nr}function xf(e){return e?.nodeType===Node.ELEMENT_NODE}function lP(e){let t=e instanceof Error?e.message:String(e);if(/tainted|SecurityError|cross-origin/i.test(t))return"The page shows content from another site that the browser does not allow Critiqs to capture.";return t===""?"The page could not be captured.":t}var cP="#0d63f3",uP=8388608;function Iy(e=document){let t=(n)=>{for(let r of Array.from(n.querySelectorAll("*"))){if(r.localName===nr)continue;if(r.hasAttribute(wo))return!0;if(r.shadowRoot!==null&&t(r.shadowRoot))return!0}return!1};return t(e)}async function TC(e,{marker:t,scroll:n,viewport:r}){try{let o=await createImageBitmap(e),a=document.createElement("canvas");a.width=o.width,a.height=o.height;let i=a.getContext("2d");if(i===null)return{status:"failed",reason:"The browser could not create a drawing surface."};i.drawImage(o,0,0),o.close();let s=a.width/Math.max(1,r.width);if(i.scale(s,s),t!==null)i.strokeStyle=cP,i.lineWidth=3,i.strokeRect(t.x-n.x-2,t.y-n.y-2,t.width+4,t.height+4);let c=await new Promise((f)=>a.toBlob(f,"image/png"));if(c===null)return{status:"failed",reason:"The capture could not be encoded."};if(c.size>uP)return{status:"failed",reason:"The capture was too large to save."};return{status:"captured",image:c}}catch{return{status:"failed",reason:"The supplied screenshot couldn't be read."}}}function SC(e){let t={};try{t=e?.()??{}}catch(n){console.error("Critiqs: getContext failed",n)}return{screen:t.screen??window.location.pathname,viewState:t.viewState??{},persona:t.persona??null}}var Tf="data-critiqs-scroll",dP="#6b7280",fP="#e5e7eb",pP=new Set([nr,"script","noscript","template"]),mP=new Set(["iframe","frame","object","embed"]),gP=new Set(["viewport","color-scheme","supported-color-schemes","referrer","format-detection"]),Oy={"data-page":void 0,"data-phx-session":void 0,"data-phx-static":void 0,"wire:snapshot":void 0,"wire:effects":void 0,"wire:initial-data":void 0,"signed-stream-name":"turbo-cable-stream-source",props:"astro-island"},hP=100,yP=["position","top","right","bottom","left","float","margin","flex-grow","flex-shrink","flex-basis","align-self","justify-self","grid-area","vertical-align","z-index","border-radius"];async function NC(e={}){let t=e.document??document,n=t.defaultView??window,r=Date.now(),o=t.implementation.createHTMLDocument(""),a=new IC(t.baseURI),i=o.importNode(t.documentElement,!0);AC(t.documentElement,i,{inert:o,sheets:a,view:n});let s=i.querySelector("head")??i.insertBefore(o.createElement("head"),i.firstChild);for(let d of t.adoptedStyleSheets??[])s.append(_y(o,a.text(d),d.media.mediaText));for(let d of Array.from(s.querySelectorAll("base")))d.remove();for(let d of Array.from(i.querySelectorAll("meta[content]")))if(!gP.has((d.getAttribute("name")??"").toLowerCase()))d.setAttribute("content","");bP(i);let c=o.createElement("base");if(c.setAttribute("href",t.baseURI),s.prepend(c),s.querySelector('meta[name="viewport"]')===null){let d=o.createElement("meta");d.setAttribute("name","viewport"),d.setAttribute("content","width=device-width, initial-scale=1"),c.after(d)}let f=i.querySelector("body");if(f!==null)[f,...Array.from(f.querySelectorAll("*"))].filter((u)=>u.localName!=="template").forEach((u,m)=>u.setAttribute(ii,String(m+1)));let p=t.documentElement;return{html:`${t.compatMode==="BackCompat"?"":"<!DOCTYPE html>"}${i.outerHTML}`,width:Math.max(p.scrollWidth,t.body?.scrollWidth??0),height:Math.max(p.scrollHeight,t.body?.scrollHeight??0),viewportWidth:n.innerWidth,scrollY:n.scrollY,viewportHeight:n.innerHeight,capturedAt:r}}function AC(e,t,n){for(let s of t.getAttributeNames())if(/^on/i.test(s)||s==="autofocus"||s===ii)t.removeAttribute(s);if((e.scrollLeft!==0||e.scrollTop!==0)&&e!==e.ownerDocument.documentElement)t.setAttribute(Tf,`${Math.round(e.scrollLeft)},${Math.round(e.scrollTop)}`);wP(e,t,n);let o=Array.from(t.children),a=e.shadowRoot;if(a!==null&&e.localName!==nr){let s=n.inert.createElement("template");if(s.setAttribute("shadowrootmode","open"),a.delegatesFocus)s.setAttribute("shadowrootdelegatesfocus","");for(let c of Array.from(a.childNodes)){let f=n.inert.importNode(c,!0);if(s.content.append(f),c.nodeType===1)CC(c,f,n)}for(let c of a.adoptedStyleSheets??[])s.content.append(_y(n.inert,n.sheets.text(c),c.media.mediaText));t.prepend(s)}let i=e.children;for(let s=0;s<i.length;s++){let c=o[s];if(c!==void 0)CC(i[s],c,n)}}function CC(e,t,n){let r=e.localName;if(pP.has(r)||r==="meta"&&e.hasAttribute("http-equiv"))t.remove();else if(e.hasAttribute(wo))t.replaceWith(TP(e,n));else if(mP.has(r))t.replaceWith(MC(e,n));else if(r==="style"||r==="link"){let o=e.sheet,a=o?n.sheets.text(o):void 0,i=e.getAttribute("media")??"";if(a===void 0)t.remove();else if(a===null){let s=n.inert.createElement("link");if(s.setAttribute("rel","stylesheet"),s.setAttribute("href",o.href??""),i!=="")s.setAttribute("media",i);t.replaceWith(s)}else t.replaceWith(_y(n.inert,a,i))}else if(r==="canvas")t.replaceWith(xP(e,t,n));else AC(e,t,n)}function RC(e){return[e,...Array.from(e.querySelectorAll("*"))].flatMap((t)=>t.localName==="template"?[t,...Array.from(t.content.children).flatMap(RC)]:[t])}function bP(e){let t=RC(e),n=t.flatMap((o)=>(o.localName==="style"?[o.textContent??""]:[]).concat(o.getAttribute("style")??[])).join(`
|
|
29
|
+
`),r=(o)=>n.includes(o)||n.includes(o.replace(/:/g,"\\:"));for(let o of t){for(let a of Array.from(o.childNodes))if(a.nodeType===8)a.remove();for(let a of o.getAttributeNames())if(a in Oy&&(Oy[a]===void 0||Oy[a]===o.localName))o.setAttribute(a,"");else if(vP(a,o.getAttribute(a)??"")&&!r(a))o.setAttribute(a,"")}}function vP(e,t){if(!(e.startsWith("data-")?!e.startsWith("data-critiqs"):/^(?!xml|xlink)[^:]+:/.test(e))||t==="")return!1;if(/csrf|xsrf/.test(e))return!0;if(t.length<hP)return!1;if(/^[\w+/=.:%~-]+$/.test(t))return!0;if(!/^\s*[[{]/.test(t))return!1;try{return JSON.parse(t),!0}catch{return!1}}function wP(e,t,n){switch(e.localName){case"input":{let r=e;if(r.type==="checkbox"||r.type==="radio")EC(t,"checked",r.checked);else if(r.type==="password")t.setAttribute("value",r.value===""?"":"••••••••");else if(r.type==="hidden"||r.hidden&&n.view.getComputedStyle(r).display==="none")t.setAttribute("value","");else if(r.type!=="file")t.setAttribute("value",r.value);break}case"textarea":t.textContent=e.value;break;case"option":EC(t,"selected",e.selected);break;case"img":{let r=e;if(r.currentSrc!==""&&!r.currentSrc.startsWith("blob:"))t.setAttribute("src",r.currentSrc);t.removeAttribute("loading");break}case"video":case"audio":{t.removeAttribute("autoplay");let r=e.localName==="video"?kP(e,n):null;if(r!==null)t.setAttribute("poster",r);break}}}function EC(e,t,n){if(n)e.setAttribute(t,"");else e.removeAttribute(t)}function kP(e,t){if(e.readyState<2||e.videoWidth===0)return null;try{let n=t.view.document.createElement("canvas");return n.width=e.videoWidth,n.height=e.videoHeight,n.getContext("2d")?.drawImage(e,0,0),n.toDataURL("image/jpeg",0.85)}catch{return null}}function xP(e,t,n){let r;try{r=e.toDataURL("image/png")}catch{return MC(e,n)}let o=n.inert.createElement("img");for(let a of t.getAttributeNames())if(!/^on/i.test(a))o.setAttribute(a,t.getAttribute(a));return o.setAttribute("src",r),o.setAttribute("width",String(e.width)),o.setAttribute("height",String(e.height)),o}function MC(e,t){let n=t.inert.createElement("div");for(let o of["id","class","style"]){let a=e.getAttribute(o);if(a!==null)n.setAttribute(o,a)}let r=e.getBoundingClientRect();return n.style.setProperty("display","inline-block"),n.style.setProperty("width",`min(${r.width}px, 100%)`),n.style.setProperty("height",`${r.height}px`),n.style.setProperty("background",fP),n.style.setProperty("border","0"),n}function TP(e,t){let n=t.inert.createElement("div");n.setAttribute(wo,"");let r=t.view.getComputedStyle(e);for(let i of yP)n.style.setProperty(i,r.getPropertyValue(i));let o=r.display;n.style.setProperty("display",o==="inline"?"inline-block":o==="contents"?"block":o);let a=e.getBoundingClientRect();return n.style.setProperty("box-sizing","border-box"),n.style.setProperty("width",`min(${a.width}px, 100%)`),n.style.setProperty("height",`${a.height}px`),n.style.setProperty("background",dP),n}function _y(e,t,n){let r=e.createElement("style");if(n!=="")r.setAttribute("media",n);return r.textContent=(t??"").replace(/<\/(style)/gi,"<\\/$1"),r}class IC{baseUrl;texts=new Map;constructor(e){this.baseUrl=e}text(e){if(e.disabled)return;if(!this.texts.has(e))this.texts.set(e,this.read(e));return this.texts.get(e)}read(e){let t;try{t=e.cssRules}catch{return null}let n=e.href??this.baseUrl,r=[],o=[];for(let a of Array.from(t)){if(!SP(a)){o.push(EP(a.cssText,n));continue}let i=a.styleSheet===null?null:this.read(a.styleSheet),s=a.media.mediaText;if(i===null){r.push(`@import url(${JSON.stringify(OC(a.href,n))})${s===""?"":` ${s}`};`);continue}let c=i;if(s!=="")c=`@media ${s} {
|
|
30
|
+
${c}
|
|
31
|
+
}`;if(a.layerName!=null)c=`@layer ${a.layerName} {
|
|
32
|
+
${c}
|
|
33
|
+
}`;o.push(c)}return[...r,...o].join(`
|
|
34
|
+
`)}}function SP(e){return"styleSheet"in e&&"href"in e}var CP=/url\(\s*(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|([^)"'\s]+))\s*\)/g;function EP(e,t){if(!e.includes("url("))return e;return e.replace(CP,(n,r,o,a)=>{let i=r??o??a??"";if(i.startsWith("#")||i.startsWith("data:"))return n;return`url(${JSON.stringify(OC(i,t))})`})}function OC(e,t){try{return new URL(e,t).href}catch{return e}}function Tc(e){let t=new Set;for(let n of Array.from(e.querySelectorAll("[data-critiqs-record]"))){if(n.closest(nr)!==null)continue;let r=n.getAttribute("data-critiqs-record");if(r)t.add(r)}return t.size===1?[...t][0]:null}async function _C(e,t,n){let r=Date.now()+n,o=new Set;while(!t.aborted){if(Date.now()>=r)return null;let a=e();if(a===null)return null;a.getBoundingClientRect();let i=new Set;for(let c=a;c!==null;c=c.parentElement)for(let f of c.getAnimations?.()??[])if(f.playState==="running"&&Number.isFinite(f.effect?.getComputedTiming().endTime)){let p=f.finished;if(!o.has(p))i.add(p)}let s=r-Date.now();if(s<=0)return null;if(i.size===0)return a;if(!await NP(i,t,s))return null;for(let c of i)o.add(c)}return null}function NP(e,t,n){if(t.aborted)return Promise.resolve(!1);return new Promise((r)=>{let o=(s)=>{clearTimeout(i),t.removeEventListener("abort",a),r(s)},a=()=>o(!1),i=setTimeout(()=>o(!1),n);t.addEventListener("abort",a,{once:!0}),Promise.allSettled(e).then(()=>o(!t.aborted))})}var AP=Symbol.for("react.transitional.element"),RP=Symbol.for("react.fragment");function PC(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var o in t)o!=="key"&&(n[o]=t[o])}else n=t;return t=n.ref,{$$typeof:AP,type:e,key:r,ref:t!==void 0?t:null,props:n}}var G=RP,l=PC,h=PC;var Dt={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"},DC=()=>l("svg",{...Dt,"aria-hidden":"true",children:l("path",{d:"M3 2.5l9.5 5-4 1.2-1.8 3.8z"})}),Sf=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("path",{d:"M8 13.5c3.3 0 6-2.3 6-5.2S11.3 3 8 3 2 5.4 2 8.3c0 1.3.5 2.4 1.4 3.3L3 14l2.8-1z"}),l("path",{d:"M8 6v4M6 8h4"})]}),LC=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("rect",{x:"2",y:"3",width:"12",height:"10",rx:"1.5"}),l("path",{d:"M10 3v10"})]}),wn=()=>l("svg",{...Dt,"aria-hidden":"true",children:l("path",{d:"M4 4l8 8M12 4l-8 8"})}),qC=()=>l("svg",{...Dt,"aria-hidden":"true",children:l("path",{d:"M6 3.5L10.5 8 6 12.5"})}),UC=()=>l("svg",{...Dt,"aria-hidden":"true",children:l("path",{d:"M4 6l4 4 4-4"})}),Cf=()=>l("svg",{...Dt,"aria-hidden":"true",children:l("path",{d:"M10 3L5 8l5 5"})}),zC=()=>l("svg",{...Dt,"aria-hidden":"true",children:l("path",{d:"M2.5 4h11M4.5 8h7M6.5 12h3"})}),Py=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("circle",{cx:"3.5",cy:"8",r:".8",fill:"currentColor"}),l("circle",{cx:"8",cy:"8",r:".8",fill:"currentColor"}),l("circle",{cx:"12.5",cy:"8",r:".8",fill:"currentColor"})]});var jC=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("circle",{cx:"8",cy:"8",r:"6"}),l("path",{d:"M5.5 8.2l1.8 1.8 3.3-3.6"})]}),BC=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("rect",{x:"2.5",y:"2.5",width:"11",height:"11",rx:"2"}),l("path",{d:"M5.5 8l2 2 3-4"})]}),$C=()=>h("svg",{width:"6",height:"14",viewBox:"0 0 6 14",fill:"currentColor","aria-hidden":"true",children:[l("circle",{cx:"1.5",cy:"2",r:"1"}),l("circle",{cx:"4.5",cy:"2",r:"1"}),l("circle",{cx:"1.5",cy:"7",r:"1"}),l("circle",{cx:"4.5",cy:"7",r:"1"}),l("circle",{cx:"1.5",cy:"12",r:"1"}),l("circle",{cx:"4.5",cy:"12",r:"1"})]}),HC=()=>l("svg",{...Dt,"aria-hidden":"true",children:l("path",{d:"M6 4l4 4-4 4"})}),VC=()=>l("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:l("path",{d:"M9 15.5c3.9 0 7-2.7 7-6.1S12.9 3.2 9 3.2 2 6 2 9.4c0 1.5.6 2.9 1.6 3.9L3.2 16l3.3-1.1c.8.4 1.6.6 2.5.6z",fill:"currentColor"})}),QC=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("circle",{cx:"8",cy:"8",r:"6"}),l("path",{d:"M5.8 9.6c.5.7 1.3 1.1 2.2 1.1s1.7-.4 2.2-1.1"}),l("path",{d:"M6 6.4v.2M10 6.4v.2"})]}),KC=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("circle",{cx:"7",cy:"7",r:"4.5"}),l("path",{d:"M10.4 10.4L14 14"})]}),GC=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("path",{d:"M2.5 2.5h5l6 6-5 5-6-6z"}),l("circle",{cx:"5.5",cy:"5.5",r:".8",fill:"currentColor"})]}),YC=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("circle",{cx:"8",cy:"8",r:"6"}),l("path",{d:"M8 7v4M8 4.8v.2"})]}),FC=()=>h("svg",{...Dt,"aria-hidden":"true",children:[l("path",{d:"M8.5 2.5h-4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2v-4"}),l("path",{d:"M12 2l.7 1.6L14.3 4.3l-1.6.7L12 6.6l-.7-1.6-1.6-.7 1.6-.7z"}),l("path",{d:"M5.5 10.5l2-2.5 1.5 1.5"})]}),li=({size:e=16})=>h("svg",{...Dt,width:e,height:e,"aria-hidden":"true",children:[l("path",{d:"M2.5 4.5h11v2a1.5 1.5 0 0 0 0 3v2h-11v-2a1.5 1.5 0 0 0 0-3z"}),l("path",{d:"M9.5 5v6",strokeDasharray:"1 1.5"})]});var Dy=Nn(!1),jr=()=>At(Dy);function vt({name:e,imageUrl:t,large:n}){return l("span",{className:`avatar${n?" large":""}`,style:{background:WS(e)},title:e,children:t?l("img",{src:t,alt:"",referrerPolicy:"no-referrer"}):Ns(e)})}function kn({anchor:e,onClose:t,children:n,placement:r="below",matchWidth:o=!1}){let a=O(null),[i,s]=S(null);Xt(()=>{let d=a.current;if(d===null)return;let u=e.getBoundingClientRect(),{offsetWidth:m,offsetHeight:y}=d,g=o?Math.min(u.left,u.right-m):u.right-m,x=Math.min(Math.max(8,g),window.innerWidth-m-8),k=r==="above"?u.top-y-6:Math.min(u.bottom+6,window.innerHeight-y-8);s({left:x,top:Math.max(8,k)})},[e,r,o]);let c=i!==null;_(()=>{if(!c)return;(a.current?.querySelector("[role='menuitemradio'][aria-checked='true']")??a.current?.querySelector("[role^='menuitem'], button"))?.focus({preventScroll:!0})},[c]);let f=O(!1);_(()=>()=>{if(f.current||!e.isConnected)return;let d=e.getRootNode(),u=d instanceof ShadowRoot?d.activeElement:document.activeElement;if(u!==null&&u!==document.body&&u.isConnected)return;e.focus({preventScroll:!0})},[e]);let p=jr();return _(()=>{if(p)return;let d=(m)=>{let y=m.composedPath();if(!y.includes(a.current)&&!y.includes(e))f.current=!0,t()},u=(m)=>{if(m.key==="Escape")m.stopImmediatePropagation(),t()};return window.addEventListener("pointerdown",d,!0),window.addEventListener("keydown",u,!0),()=>{window.removeEventListener("pointerdown",d,!0),window.removeEventListener("keydown",u,!0)}},[e,t,p]),l("div",{ref:a,className:"menu",role:"menu",style:i===null?{visibility:"hidden",left:0,top:0,...o?{minWidth:e.offsetWidth}:{}}:{...i,...o?{minWidth:e.offsetWidth}:{}},onKeyDown:(d)=>{let u=[...a.current?.querySelectorAll("[role^='menuitem']:not(:disabled)")??[]],m=u.indexOf(d.target),y=d.key==="ArrowDown"?(m+1)%u.length:d.key==="ArrowUp"?(m-1+u.length)%u.length:d.key==="Home"?0:d.key==="End"?u.length-1:null;if(y===null||u.length===0)return;d.preventDefault(),u[y].focus()},children:n})}function ve({onSelect:e,checked:t,selected:n,detail:r,danger:o,children:a}){let i=t??n;return h("button",{type:"button",role:n!==void 0?"menuitemradio":t!==void 0?"menuitemcheckbox":"menuitem","aria-checked":i,className:`menu-item${o?" danger":""}`,onClick:e,children:[i!==void 0&&l("span",{className:"check",children:i?"✓":""}),a,r!==void 0&&l("span",{className:"detail",children:r})]})}function xn(){let[e,t]=S(null),n=ge(()=>t(null),[]),r=ge((o)=>{let a=o.currentTarget;t((i)=>i===null?a:null)},[]);return{anchor:e,open:e!==null,toggle:r,close:n}}function He({label:e,onClose:t,bare:n,returnFocus:r,children:o}){let a=O(null),i=O(r),s=O(!1);_(()=>{let f=a.current,p=f?.getRootNode(),d=p instanceof ShadowRoot?p.activeElement:document.activeElement,u=d instanceof HTMLElement?d:null;return(f?.querySelector("button, input, textarea, [tabindex]")??f)?.focus(),()=>(u?.isConnected?u:i.current)?.focus()},[]);let c=jr();return s.current=c,_(()=>{if(c)return;let f=(p)=>{if(p.key==="Escape"&&a.current?.querySelector(".menu")==null)p.stopImmediatePropagation(),t()};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[t,c]),l("div",{className:`scrim${n?" lightbox":""}`,onPointerDown:(f)=>f.target===f.currentTarget&&t(),children:l("div",{ref:a,className:n?void 0:"dialog",role:"dialog","aria-modal":"true","aria-label":e,tabIndex:-1,onBlur:(f)=>{if(f.relatedTarget!==null||s.current)return;let p=f.currentTarget;setTimeout(()=>{if(s.current||!p.isConnected)return;let d=p.getRootNode(),u=d instanceof ShadowRoot?d.activeElement:document.activeElement;if(u===null||u===document.body||!p.contains(u))p.focus({preventScroll:!0})})},children:o})})}function XC(){let[e,t]=S([]),n=O(1),r=ge((a)=>t((i)=>i.filter((s)=>s.id!==a)),[]),o=ge((a,i,s=5000)=>{let c=n.current++;t((f)=>[...f.slice(-2),{id:c,message:a,action:i}]),setTimeout(()=>r(c),s)},[r]);return{toasts:e,show:o,dismiss:r}}function WC({toasts:e,dismiss:t}){return l("div",{className:"toasts",role:"status","aria-live":"polite",children:e.map((n)=>h("div",{className:"toast",children:[l("span",{children:n.message}),n.action&&l("button",{type:"button",className:"link-btn",onClick:()=>{n.action.run(),t(n.id)},children:n.action.label})]},n.id))})}async function ca(e){if(typeof e!=="string"){if(typeof ClipboardItem<"u"&&typeof navigator.clipboard?.write==="function"){let t=e.then((n)=>new Blob([n],{type:"text/plain"}));t.catch(()=>{return});try{return await navigator.clipboard.write([new ClipboardItem({"text/plain":t})]),!0}catch{}}e=await e}try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{n=!1}return t.remove(),n}}function Ms(e){return[...e?.querySelectorAll(".menu, [role='dialog']")??[]].some((t)=>t.closest("[hidden]")===null)}function tt({title:e,onBack:t,onClose:n,step:r}){return h("div",{className:"ds-dialog-header",children:[t!==void 0&&l("button",{type:"button",className:"icon-btn","aria-label":"Back",onClick:t,children:l(Cf,{})}),l("h3",{children:e}),r!==void 0&&l(MP,{current:r.current,count:r.count}),n!==void 0&&l("button",{type:"button",className:"icon-btn","aria-label":"Close",onClick:n,children:l(wn,{})})]})}function Tn(e,t,{initial:n=!1}={}){let r=O(!0);_(()=>{if(r.current&&!n){r.current=!1;return}r.current=!1;let o=e.current;if(o===null)return;(o.querySelector("input:not(:disabled)")??o.querySelector(".ds-select:not(:disabled), [role='switch']:not(:disabled), .ds-nav-row:not(:disabled)")??o.querySelector("button:not(:disabled)"))?.focus({preventScroll:!0})},[t])}function MP({current:e,count:t}){return l("span",{className:"ds-steps",role:"img","aria-label":`Step ${e} of ${t}`,children:Array.from({length:t},(n,r)=>l("i",{className:r+1===e?"on":void 0},r))})}function he({label:e,children:t}){let n=ct();return h("div",{className:"ds-row",children:[l("span",{className:"ds-row-label",id:n,children:e}),l("div",{className:"ds-row-control",children:t(n)})]})}function Ue({label:e,value:t,onClick:n,disabled:r=!1}){return h("button",{type:"button",className:"ds-nav-row",disabled:r,onClick:n,children:[l("span",{className:"label",children:e}),t!==void 0&&l("span",{className:"value",children:t}),l(qC,{})]})}function nt({value:e,options:t,onChange:n,labelledBy:r,disabled:o=!1}){let a=xn(),i=ct(),s=t.find((c)=>c.value===e);return h(G,{children:[h("button",{id:i,type:"button",className:"ds-select","aria-haspopup":"menu","aria-expanded":a.open,"aria-labelledby":`${r} ${i}`,disabled:o,onClick:a.toggle,children:[l("span",{children:s?.label??"Choose"}),l(UC,{})]}),a.open&&l(kn,{anchor:a.anchor,onClose:a.close,matchWidth:!0,children:t.map((c)=>l(ve,{selected:c.value===e,detail:c.detail,onSelect:()=>{if(a.close(),c.value!==e)n(c.value)},children:c.label},c.value))})]})}function ko({checked:e,onChange:t,labelledBy:n,disabled:r=!1}){return l("button",{type:"button",role:"switch",className:"ds-switch","aria-checked":e,"aria-labelledby":n,disabled:r,onClick:()=>t(!e),children:l("span",{})})}var Sc=0.8;function Is({value:e,max:t,label:n,ceiling:r=t,valueText:o}){let a=t<=0?1:Math.min(1,e/t);return l("div",{className:`ds-meter${e>=r?" full":a>=Sc?" high":""}`,role:"meter","aria-label":n,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":Math.min(e,t),"aria-valuetext":o,children:e>0&&l("span",{style:{width:`${Math.round(a*100)}%`}})})}var Ef={view:"list",frozen:null,drafting:!1,selection:null,visit:null};function Ly(e,t){switch(t.type){case"frozen":return e.view==="list"?{...e,frozen:t.frozen}:e;case"list":return Ef;case"new-thread":return e.view==="list"&&e.visit===null?{...e,drafting:!0}:e;case"end-draft":return e.view==="list"?{...e,drafting:!1,selection:null}:e;case"open":return{view:"thread",mockupId:t.mockupId,threadId:t.threadId,snapshotId:t.snapshotId??null,viewing:"head"};case"ask-visit":return e.view==="list"&&!e.drafting?{...e,selection:null,visit:{...t.visit,status:"asking"}}:e;case"visit-going":return e.view==="list"&&e.visit!==null?{...e,visit:{...e.visit,status:"going"}}:e;case"cancel-visit":if(e.view!=="list"||e.visit===null)return e;return{...e,visit:null,frozen:e.visit.status==="going"?null:e.frozen};case"show-copy":return e.view==="thread"?{...e,snapshotId:t.snapshotId}:e;case"view":return e.view==="thread"?{...e,viewing:t.version}:e;case"select":return e.view==="list"&&e.drafting?{...e,selection:t.choice}:e;case"deselect":return e.view==="list"?{...e,selection:null}:e;case"escape":return e.view==="list"&&e.selection!==null?{...e,selection:null}:e}}function tE(e){return e.view==="list"&&e.selection!==null?"selection":"panel"}function Nf(e){return e.threads??[]}function qy(e,t){let n=new Map;for(let i of e)for(let s of Nf(i)){let c=n.get(i.source.screen)??[];c.push({mockup:i,thread:s}),n.set(i.source.screen,c)}let r=(i)=>i.mockup.listedAt??0,o=(i,s)=>r(s)-r(i)||s.thread.lastMessageAt-i.thread.lastMessageAt,a=(i)=>Math.max(...i.map(r));return[...n].map(([i,s])=>({screen:i,here:i===t,rows:s.sort(o)})).sort((i,s)=>Number(s.here)-Number(i.here)||a(s.rows)-a(i.rows))}var JC=80;function nE(e){let t=e.replace(/\s+/g," ").trim();return t.length<=JC?t:`${t.slice(0,JC-1).trimEnd()}…`}function Os(e){return e.versions.at(-1)?.number??0}function rE(e,t){let n=Os(e);return t==="head"||t>n||t<0?n:t}function Cc(e,t,n){if(n===0)return[];return e.versions.find((r)=>r.number===n)?.edits[t]??[]}var ZC=768,IP=0.15;function eE(e,t){return e<ZC!==t<ZC||Math.abs(e-t)>=t*IP}function Uy(e,t){let n=null;for(let r of e)if(n===null||Math.abs(r.width-t)<Math.abs(n.width-t))n=r;return n}function oE(e,t,n){if(!eE(n,t.width))return null;let r=e.filter((a)=>a._id!==t._id&&!eE(n,a.width)),o=Uy(r,n);return o!==null?{kind:"switch",snapshot:o}:{kind:"take",width:n}}var _s=360,aE=300,OP=720,iE=24,By="critiqs:sidebar-width",_P=160;function sE(){let e=Math.max(aE,Math.min(OP,window.innerWidth-_P));return{min:Math.min(aE,window.innerWidth),max:Math.min(e,window.innerWidth)}}function lE(e){let{min:t,max:n}=sE();return Math.round(Math.min(n,Math.max(t,e)))}function PP(){try{let e=Number(localStorage.getItem(By));return Number.isFinite(e)&&e>0?e:_s}catch{return _s}}var Ec=null,jy=new Set;function Ps(){return Ec??=PP(),lE(Ec)}function zy(e){Ec=lE(e);try{localStorage.setItem(By,String(Ec))}catch{}for(let t of jy)t()}function DP(e){jy.add(e);let t=(n)=>{if(n.key!==By&&n.key!==null)return;Ec=null,e()};return window.addEventListener("resize",e),window.addEventListener("storage",t),()=>{jy.delete(e),window.removeEventListener("resize",e),window.removeEventListener("storage",t)}}function LP(e){return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}function Nc(){return dn(LP,()=>window.innerWidth,()=>0)}function ua(){return dn(DP,Ps,()=>_s)}function Af(){let e=ua();Nc();let t=O(null);_(()=>()=>t.current?.(),[]);let{min:n,max:r}=sE();return l("div",{className:"sidebar-resize",role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar","aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":e,tabIndex:0,title:"Drag to resize. Double-click to reset.",onPointerDown:(i)=>{if(i.button!==0||!i.isPrimary)return;i.preventDefault(),t.current?.();let{currentTarget:s,pointerId:c}=i;try{s.setPointerCapture(c)}catch{}s.classList.add("dragging");let f=(u)=>{if(u.pointerId===c)zy(window.innerWidth-u.clientX)},p=()=>{t.current=null,s.classList.remove("dragging"),s.removeEventListener("pointermove",f),s.removeEventListener("lostpointercapture",d);for(let u of["pointerup","pointercancel"])window.removeEventListener(u,d,!0);try{if(s.hasPointerCapture?.(c))s.releasePointerCapture(c)}catch{}},d=(u)=>{if(u.pointerId===c)p()};t.current=p,s.addEventListener("pointermove",f),s.addEventListener("lostpointercapture",d);for(let u of["pointerup","pointercancel"])window.addEventListener(u,d,!0)},onKeyDown:(i)=>{let s=i.key==="ArrowLeft"?e+iE:i.key==="ArrowRight"?e-iE:i.key==="Home"?n:i.key==="End"?r:null;if(s===null)return;i.preventDefault(),i.stopPropagation(),zy(s)},onDoubleClick:()=>zy(_s)})}function dE(e){let t=[],n=0;for(let r of ks(e)){if(r.start>n)t.push({text:e.slice(n,r.start),tag:!1});t.push({text:e.slice(r.start,r.end),tag:!0}),n=r.end}if(n<e.length)t.push({text:e.slice(n),tag:!1});return t}var fE="tag-pill",qP=/^(DIV|P|LI|PRE|BLOCKQUOTE|H[1-6])$/;function $y(e){let t="",n=new Map,r=new Map,o=null,a=(i)=>{for(let s of Array.from(i.childNodes)){if(s.nodeType===Node.ELEMENT_NODE&&qP.test(s.nodeName)&&t!==""&&!t.endsWith(`
|
|
35
|
+
`))t+=`
|
|
36
|
+
`;if(n.set(s,t.length),o=null,s.nodeType===Node.TEXT_NODE)t+=s.data;else if(s.nodeName==="BR")t+=`
|
|
37
|
+
`,o=s;else if(s.nodeType===Node.ELEMENT_NODE)a(s);r.set(s,t.length)}};if(a(e),r.set(e,t.length),o!==null)t=t.slice(0,-1);return{text:t,before:n,after:r}}function Ds(e){return $y(e).text}function pE(e,t){let n=Array.from(e.childNodes),r=dE(t),o=t.endsWith(`
|
|
38
|
+
`)?1:0;if(n.length!==r.length+o)return!1;if(o===1&&n.at(-1).nodeName!=="BR")return!1;return r.every((a,i)=>{let s=n[i];if(!a.tag)return s.nodeType===Node.TEXT_NODE&&s.data===a.text;return s instanceof HTMLElement&&s.className===fE&&s.childNodes.length===1&&s.firstChild.nodeType===Node.TEXT_NODE&&s.firstChild.data===a.text})}function Hy(e,t){let n=e.ownerDocument;if(e.replaceChildren(...dE(t).map((r)=>{if(!r.tag)return n.createTextNode(r.text);let o=n.createElement("span");return o.className=fE,o.textContent=r.text,o})),t.endsWith(`
|
|
39
|
+
`))e.append(n.createElement("br"))}function cE(e,t,n,r=$y(e)){let o;if(t.nodeType===Node.TEXT_NODE)o=(r.before.get(t)??0)+n;else{let a=t.childNodes[n];o=a===void 0?r.after.get(t):r.before.get(a)}return Math.min(o??r.text.length,r.text.length)}function uE(e,t){let n=0,r=null,o=Array.from(e.childNodes);for(let[a,i]of o.entries()){let s=i.nodeType===Node.TEXT_NODE?i:i.firstChild?.nodeType===Node.TEXT_NODE?i.firstChild:null;if(s===null)continue;let c=n+s.data.length;if(t>=n&&t<=c){if(s===i||t>n&&t<c)return[s,t-n];if(t===n)return[e,a];r=[e,a+1]}n=c}return r??[e,0]}function mE(e){let t=e.getRootNode();return(typeof t.getSelection==="function"?t.getSelection():null)??document.getSelection()}function Ls(e){let t=mE(e);if(t===null||t.rangeCount===0)return null;let n=t.getRangeAt(0),r=e.getRootNode();if(!e.contains(n.startContainer)&&r instanceof ShadowRoot&&typeof t.getComposedRanges==="function"){let a=[];try{a=t.getComposedRanges({shadowRoots:[r]})}catch{a=t.getComposedRanges(r)}if(a[0]!==void 0)n=a[0]}if(!e.contains(n.startContainer)||!e.contains(n.endContainer))return null;let o=$y(e);return[cE(e,n.startContainer,n.startOffset,o),cE(e,n.endContainer,n.endOffset,o)]}function Rf(e,[t,n]){let r=mE(e);if(r===null)return;let[o,a]=uE(e,t),[i,s]=t===n?[o,a]:uE(e,n);r.setBaseAndExtent(o,a,i,s);let c=e.ownerDocument.createRange();c.setStart(i,s),c.collapse(!0);let f=c.getBoundingClientRect();if(f.height===0){let y=i===e?e.childNodes[s]:i.nextSibling;if(y instanceof Element&&y.tagName==="BR")f=y.getBoundingClientRect();else if(i.nodeType===Node.ELEMENT_NODE){let g=i.childNodes[s],x=g??i.childNodes[s-1];if(x!==void 0){let k=e.ownerDocument.createTreeWalker(x,NodeFilter.SHOW_TEXT),b=x.nodeType===Node.TEXT_NODE?x:k.nextNode();if(g===void 0&&b!==null&&b!==x)for(let v=k.nextNode();v!==null;v=k.nextNode())b=v;if(b!==null)c.setStart(b,g===void 0?b.textContent.length:0),c.collapse(!0),f=c.getBoundingClientRect()}}}if(f.height===0)return;let p=e.getBoundingClientRect(),d=getComputedStyle(e),u=p.top+e.clientTop+(parseFloat(d.paddingTop)||0),m=p.top+e.clientTop+e.clientHeight-(parseFloat(d.paddingBottom)||0);if(f.bottom>m)e.scrollTop+=f.bottom-m;else if(f.top<u)e.scrollTop-=u-f.top}var UP=1000,zP=200;class Vy{steps;index=0;merging=null;at=0;constructor(e){this.steps=[e]}reset(e){this.steps=[e],this.index=0,this.merging=null}record(e,t,n=Date.now()){let r=this.steps[this.index];if(e.text===r.text){r.selection=e.selection;return}if(t!==null&&t===this.merging&&n-this.at<UP&&this.index>0)this.steps[this.index]=e;else this.steps=[...this.steps.slice(Math.max(0,this.index+2-zP),this.index+1),e],this.index=this.steps.length-1;this.merging=t,this.at=n}moved(e){let t=this.steps[this.index];if(t.selection[0]===e[0]&&t.selection[1]===e[1])return;t.selection=e,this.merging=null}undo(){if(this.index===0)return null;return this.merging=null,this.steps[--this.index]}redo(){if(this.index===this.steps.length-1)return null;return this.merging=null,this.steps[++this.index]}}var Ac={text:"",mentions:[]};function Rc(e){return e.mentions.filter((t)=>e.text.includes(`@${t.label}`)).map((t)=>({userId:t._id,label:t.label}))}function jP(e,t){let n=e.slice(0,t),r=n.lastIndexOf("@");if(r===-1||t-r>40)return null;if(r>0&&!/\s/.test(n[r-1]))return null;let o=n.slice(r+1);if(/[\n@]/.test(o)||/\s\s/.test(o))return null;return{start:r,query:o}}function BP(e,t){let n=e.slice(0,t),r=n.lastIndexOf("#");if(r===-1)return null;if(r>0&&!/[\s\p{Ps}\p{Pi}]/u.test(n[r-1]))return null;let o=n.slice(r+1);if(o.length>50||o!==""&&!/^\p{L}[\p{L}\p{N}\p{M}_-]*$/u.test(o))return null;return{start:r,query:o}}function Qy(e){return e.trim().replace(/\s+/g,"-")}function xo(e){return`#${Qy(e.trim().replace(/^#+/,""))}`}var $P=8;function Mc({projectId:e,threadId:t=null,value:n,onChange:r,onKeyDown:o,placeholder:a,autoFocus:i,className:s,...c}){let f=O(null),[p,d]=S(0),[u,m]=S(null),[y,g]=S(0),x=ct(),k=jP(n.text,p),b=k!==null&&n.mentions.some((I)=>n.text.startsWith(`@${I.label}`,k.start)&&k.query.trimEnd()===I.label),v=BP(n.text,p),w=b?null:k,T=v!==null&&(w===null||v.start>w.start)?{...v,kind:"tag"}:w===null?null:{...w,kind:"person"},C=T!==null&&u!==T.start&&e!==null,E=se(),A=E.useParticipants(C&&T.kind==="person"?e:null,T?.kind==="person"?T.query:"",t),N=E.useTags(C&&T.kind==="tag"?e:null),R=!C?[]:T.kind==="person"?(A.status==="ready"?A.data:[]).map((I)=>({kind:"person",person:I})):(N.status==="ready"?N.data.tags:[]).filter((I)=>{let Y=lt(T.query);return I.key.startsWith(Y)&&!(Y!==""&&I.key===Y&&T.query===Qy(I.label))}).slice(0,$P).map((I)=>({kind:"tag",tag:I}));_(()=>g(0),[T?.query,T?.kind]);let q=O(null),[X,L]=S(null),F=C&&R.length>0;Xt(()=>{if(!F||f.current===null)return L(null);let I=0,Y="",Z=()=>{if(I=requestAnimationFrame(Z),f.current===null)return;let J=f.current.getBoundingClientRect(),fe=window.innerHeight-J.bottom-8,rt=J.top-8,Ve=Math.min(220,q.current?.scrollHeight??220),Pe=fe>=Ve||fe>=rt?{left:J.left,width:J.width,top:J.bottom+4,maxHeight:Math.max(80,Math.min(220,fe))}:{left:J.left,width:J.width,bottom:window.innerHeight-J.top+4,maxHeight:Math.max(80,Math.min(220,rt))},Se=JSON.stringify(Pe);if(Se!==Y)Y=Se,L(Pe)};return Z(),()=>cancelAnimationFrame(I)},[F]),_(()=>{q.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})},[y]);let ce=O(null);ce.current??=new Vy({text:n.text,selection:[n.text.length,n.text.length]});let ue=O(n.text),re=O(!1),B=()=>{let I=f.current?.getRootNode();return I!==void 0&&I.activeElement===f.current},W=(I,Y,Z,J=n.mentions)=>{ue.current=I,ce.current.record({text:I,selection:Y},Z),d(Y[0]),r({text:I,mentions:J})},U=(I,Y,Z)=>{if(Hy(I,Y),B())Rf(I,Z)},ie=(I,Y,Z)=>{let J=f.current;if(J===null)return;let fe=Ds(J),[rt,Ve]=Y??Ls(J)??[fe.length,fe.length],Pe=rt+I.length,Se=fe.slice(0,rt)+I+fe.slice(Ve);U(J,Se,[Pe,Pe]),W(Se,[Pe,Pe],null,Z)},V=(I)=>{let Y=f.current;if(I===null||Y===null)return;U(Y,I.text,I.selection),ue.current=I.text,d(I.selection[0]),m(null),r({text:I.text,mentions:n.mentions})};Xt(()=>{let I=f.current;if(I===null||re.current)return;if(n.text!==ue.current)ue.current=n.text,ce.current.reset({text:n.text,selection:[n.text.length,n.text.length]});if(pE(I,n.text))return;let Y=B()?Ls(I):null;if(Hy(I,n.text),Y!==null){let Z=n.text.length;Rf(I,[Math.min(Y[0],Z),Math.min(Y[1],Z)])}}),_(()=>{let I=f.current;if(I===null||!i)return;I.focus();let Y=Ds(I).length;Rf(I,[Y,Y]),d(Y)},[]);let K=O({replace:ie,goTo:V});K.current={replace:ie,goTo:V},_(()=>{let I=f.current;if(I===null)return;let Y=(J)=>{if(J.inputType==="insertParagraph"||J.inputType==="insertLineBreak")J.preventDefault(),K.current.replace(`
|
|
40
|
+
`);else if(J.inputType==="historyUndo"||J.inputType==="historyRedo")J.preventDefault(),K.current.goTo(J.inputType==="historyUndo"?ce.current.undo():ce.current.redo())},Z=()=>{if(re.current||!B()||Ds(I)!==ue.current)return;let J=Ls(I);if(J===null)return;ce.current.moved(J),d(J[0])};return I.addEventListener("beforeinput",Y),document.addEventListener("selectionchange",Z),()=>{I.removeEventListener("beforeinput",Y),document.removeEventListener("selectionchange",Z)}},[]);let oe=(I)=>{if(T===null)return;let Y=I.kind==="person"?`@${I.person.name} `:`#${Qy(I.tag.label)} `,Z=I.kind==="person"?I.person:null,J=Z===null||n.mentions.some((fe)=>fe._id===Z._id&&fe.label===Z.name)?n.mentions:[...n.mentions,{_id:Z._id,name:Z.name,label:Z.name}];ie(Y,[T.start,p],J),m(T.start)},H=(I)=>{if(I.nativeEvent.isComposing)return;if(C&&R.length>0){if(I.key==="ArrowDown"||I.key==="ArrowUp"){I.preventDefault();let Z=I.key==="ArrowDown"?1:-1;g((J)=>(J+Z+R.length)%R.length);return}if(I.key==="Enter"||I.key==="Tab"){if(!(I.metaKey||I.ctrlKey)){I.preventDefault(),oe(R[Math.min(y,R.length-1)]);return}}}if(C&&I.key==="Escape"){I.preventDefault(),I.stopPropagation(),m(T.start);return}let Y=I.key.toLowerCase();if((I.metaKey||I.ctrlKey)&&!I.altKey&&(Y==="z"||Y==="y"&&I.ctrlKey)){I.preventDefault(),V(Y==="y"||I.shiftKey?ce.current.redo():ce.current.undo());return}if(I.key==="Enter"&&(I.metaKey||I.ctrlKey))I.preventDefault();o?.(I)},le=new Set(ks(n.text).map((I)=>I.key)).size,Q=le>Vh;return h("div",{className:"mention-input",children:[h("div",{className:"tag-editor",children:[n.text===""&&a!==void 0&&l("div",{className:"tag-placeholder","aria-hidden":"true",children:a}),l("div",{...c,ref:f,className:s===void 0?"tag-field":`tag-field ${s}`,contentEditable:"plaintext-only",suppressContentEditableWarning:!0,role:"combobox","aria-multiline":"true","aria-placeholder":a,"aria-expanded":F,"aria-controls":x,"aria-autocomplete":"list","aria-activedescendant":F?`${x}-${y}`:void 0,onInput:(I)=>{let Y=I.currentTarget,Z=Ds(Y),J=Ls(Y)??[Z.length,Z.length];if(re.current){ue.current=Z,d(J[0]),r({text:Z,mentions:n.mentions});return}m(null);let fe=I.nativeEvent.inputType??"";W(Z,J,fe.startsWith("insertText")?"insert":fe.startsWith("delete")?fe:null)},onCompositionStart:()=>{re.current=!0},onCompositionEnd:(I)=>{re.current=!1;let Y=I.currentTarget,Z=Ds(Y);m(null),W(Z,Ls(Y)??[Z.length,Z.length],null)},onPaste:(I)=>{I.preventDefault(),ie(I.clipboardData.getData("text/plain").replace(/\r\n?/g,`
|
|
41
|
+
`))},onKeyDown:H})]}),Q&&h("div",{className:"error tag-limit",role:"status",children:["A message can use up to ",Vh," different hashtags; this one uses ",le,". Remove some to post it."]}),F&&l("ul",{ref:q,className:"mention-suggestions",role:"listbox",id:x,"aria-label":T.kind==="person"?"People to mention":"Tags",style:X===null?{visibility:"hidden"}:X,children:R.map((I,Y)=>l("li",{id:`${x}-${Y}`,role:"option","aria-selected":Y===y,onPointerDown:(Z)=>{Z.preventDefault(),oe(I)},onPointerEnter:()=>g(Y),children:I.kind==="person"?h(G,{children:[l(vt,{name:I.person.name,imageUrl:I.person.imageUrl}),l("span",{children:I.person.name})]}):h(G,{children:[l("span",{className:"tag-chip",children:xo(I.tag.label)}),I.tag.preset&&l("span",{className:"note",children:"project tag"})]})},I.kind==="person"?I.person._id:I.tag.key))})]})}function Ic({body:e,mentions:t,onTag:n}){let r=new Map(t.map((c)=>[`@${c.label}`,c])),o=[...r.keys()].sort((c,f)=>f.length-c.length),a=o.length===0?null:new RegExp(`(${o.map((c)=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")})`,"g"),i=a===null?[e]:e.split(a),s=0;return l(G,{children:i.map((c)=>{let f=r.get(c);if(f!==void 0)return l("span",{className:"mention",title:f.name===f.label?void 0:`Now ${f.name}`,children:c},s++);let p=[],d=0;for(let u of ks(c)){if(u.start>d)p.push(c.slice(d,u.start));let m=c.slice(u.start,u.end);p.push(n===void 0?l("span",{className:"hashtag",children:m},s++):l("button",{type:"button",className:"hashtag",title:`Show threads tagged ${m}`,onClick:()=>n(u.label),children:m},s++)),d=u.end}if(d<c.length)p.push(c.slice(d));return p.length===1&&typeof p[0]==="string"?p[0]:l("span",{children:p},s++)})})}var ci="Critiqs AI";function gE({threadId:e,versions:t,head:n,shown:r,turn:o,onView:a,onRestore:i,onRetry:s,retryDisabled:c,onOpenAiSettings:f,onSetUpAi:p}){let{useThread:d,markRead:u}=se(),m=d(e),y=m.status==="ready"?m.data:null;_(()=>{if(y===null)return;let k=y.readState;if(k!==null&&!k.manualUnread&&k.lastReadAt>=y.lastMessageAt)return;u({threadId:e,seenThrough:y.lastMessageAt}).catch(()=>{return})},[y?.lastMessageAt,y?.readState?.lastReadAt,e,u]);let g=O(null),x=`${y?.messages.length??0}:${t.length}:${o?.status??""}:${o?.status==="working"?`${o.round}${o.step}`:""}`;return _(()=>{let k=g.current?.closest(".sidebar-body");if(k instanceof HTMLElement)k.scrollTop=k.scrollHeight},[x]),h("div",{className:"mockup-thread",children:[y?.status==="resolved"&&l("div",{className:"note pad",children:"This thread is resolved."}),m.status==="loading"&&l("div",{className:"empty",children:"Loading…"}),m.status==="error"&&l("div",{className:"empty",children:m.message}),y!==null&&l("div",{className:"messages",children:VP(y.messages,t).map((k)=>k.kind==="message"?l(HP,{message:k.message,head:n,shown:r,onView:a,onRestore:i},k.message._id):l(QP,{version:k.version,head:n,shown:r,onView:a,onRestore:i},`version:${k.version.number}`))}),o!==void 0&&l(KP,{turn:o,onRetry:s,retryDisabled:c,onOpenAiSettings:f,onSetUpAi:p}),l("div",{ref:g})]})}function HP({message:e,head:t,shown:n,onView:r,onRestore:o}){let a=e.via==="ai",i=a?ci:e.author.name,s=e.mockupVersion;if(e.via!=="ai"&&e.via!=="agent")return h("div",{className:"message from-person","data-created":e.createdAt,children:[h("div",{className:"said",children:[h("div",{className:"meta",children:[l("span",{className:"time",title:on(e.createdAt),children:Bn(e.createdAt)}),l("span",{className:"author",children:i})]}),l("div",{className:"bubble",children:l(Ic,{body:e.body,mentions:e.mentions})}),s!==void 0&&l(Ky,{version:s,head:t,shown:n,onView:r,onRestore:o})]}),l(vt,{name:i,imageUrl:e.author.imageUrl,large:!0})]});return h("div",{className:`message${a?" from-ai":""}`,"data-created":e.createdAt,children:[l(vt,{name:i,imageUrl:a?null:e.author.imageUrl,large:!0}),h("div",{className:"grow",children:[h("div",{className:"meta",children:[l("span",{className:"author",children:i}),a&&l("span",{className:"badge ai",title:"Written by Critiqs AI",children:"AI"}),e.via==="agent"&&l("span",{className:"via",children:"via coding agent"}),l("span",{className:"time",title:on(e.createdAt),children:Bn(e.createdAt)})]}),l("div",{className:"body",children:l(Ic,{body:e.body,mentions:e.mentions})}),s!==void 0&&l(Ky,{version:s,head:t,shown:n,onView:r,onRestore:o})]})]})}function VP(e,t){let n=new Set(e.flatMap((o)=>o.mockupVersion===void 0?[]:[o.mockupVersion])),r=e.map((o)=>({kind:"message",message:o}));for(let o of t){if(n.has(o.number))continue;let a=r.findIndex((i)=>(i.kind==="message"?i.message.createdAt:i.version.createdAt)>o.createdAt);r.splice(a===-1?r.length:a,0,{kind:"version",version:o})}return r}function QP({version:e,head:t,shown:n,onView:r,onRestore:o}){let a=e.byAi?ci:e.authorName,i=e.restoredFrom===null?`${a} saved Version ${e.number}${e.summary===""?"":`: ${e.summary}`}`:`${a} restored ${e.restoredFrom===0?"the original copy":`Version ${e.restoredFrom}`} as Version ${e.number}`;return h("div",{className:"version-event","data-created":e.createdAt,children:[h("div",{className:"meta",children:[l("span",{children:i}),l("span",{className:"time",title:on(e.createdAt),children:Bn(e.createdAt)})]}),l(Ky,{version:e.number,head:t,shown:n,onView:r,onRestore:o})]})}function Ky({version:e,head:t,shown:n,onView:r,onRestore:o}){return h("div",{className:`version-card${e===n?" shown":""}`,role:"group","aria-label":`Version ${e}`,children:[h("span",{children:["Version ",e,e===t?" · latest":""]}),e===n?l("span",{className:"note",children:"On the copy"}):l("button",{type:"button",className:"link-btn",onClick:()=>r(e),children:"View"}),e!==t&&l("button",{type:"button",className:"link-btn",onClick:()=>o(e),children:"Restore"})]})}function KP({turn:e,onRetry:t,retryDisabled:n,onOpenAiSettings:r,onSetUpAi:o}){if(e.status==="failed")return h("div",{className:"ai-status failed",role:"status",children:[l("div",{className:"warning",children:e.message}),h("div",{className:"row wrap",children:[e.kind==="setup-ai"&&o!==null&&l("button",{type:"button",className:"btn small",onClick:o,children:"Set up your AI"}),e.kind==="unavailable"&&r!==null&&l("button",{type:"button",className:"btn small",onClick:r,children:"Open AI settings"}),e.kind==="unavailable"&&r===null&&l("span",{className:"note",children:"The project's owner can set up AI in its settings."}),l("button",{type:"button",className:"btn small",disabled:n,onClick:t,children:"Try again"})]})]});return l(GP,{turn:e})}function GP({turn:e}){let t=YP(e.since),n=[{label:"Read the page",state:e.step==="reading"&&e.round===0?"now":"done"}];if(e.round>0||e.step==="editing")n.push({label:"Change the HTML and CSS",state:e.round===0?"now":"done"});if(e.round>0)n.push({label:`Continue further down the page${e.round>1?` (part ${e.round+1})`:""}`,state:"now"});return h("div",{className:"message from-ai ai-working",role:"status",children:[l(vt,{name:ci,imageUrl:null,large:!0}),h("div",{className:"grow",children:[h("div",{className:"meta",children:[l("span",{className:"author",children:ci}),l("span",{className:"badge ai",children:"AI"}),h("span",{className:"time","aria-hidden":"true",children:[t,"s"]})]}),l("ol",{className:"ai-steps",children:n.map((r)=>h("li",{className:r.state,children:[r.state==="now"?l("span",{className:"spinner","aria-hidden":"true"}):l("span",{className:"step-done","aria-hidden":"true",children:"✓"}),h("span",{children:[r.label,r.state==="now"&&l("span",{className:"ai-dots","aria-hidden":"true"})]})]},r.label))})]})]})}function YP(e){let[t,n]=S(()=>Date.now());return _(()=>{n(Date.now());let r=setInterval(()=>n(Date.now()),1000);return()=>clearInterval(r)},[e]),Math.max(0,Math.floor((t-e)/1000))}function Oc({hidden:e=!1,header:t,tools:n,footer:r,children:o}){let a=ua();return h("aside",{className:"sidebar mockup-panel","aria-label":"Mockup",hidden:e,style:{width:a},children:[l(Af,{}),l("div",{className:"sidebar-header",children:t}),n,l("div",{className:"sidebar-body",children:o}),r!==void 0&&r!==null&&l("div",{className:"sidebar-footer",children:r})]})}function _c({onClose:e}){return l("button",{type:"button",className:"icon-btn","aria-label":"Close sidebar",title:"Close (Esc)",onClick:e,children:l(wn,{})})}function Yy({onBack:e,disabled:t}){return l("button",{type:"button",className:"icon-btn","aria-label":"All mockup threads",title:"All mockup threads",onClick:e,disabled:t,children:l(Cf,{})})}function Mf(e){let t=gr(e.viewState);return t===""?e.screen:`${e.screen} · ${t}`}var Fy=20;function hE(e){return h(G,{children:[l(Gy,{label:"this page's mockup threads",children:l(FP,{...e})},`here ${e.projectId} ${e.screen}`),l(Gy,{label:"other pages' mockup threads",children:l(XP,{...e})},`elsewhere ${e.projectId} ${e.screen}`)]})}function FP({mockups:e,projectId:t,screen:n,turns:r,onOpen:o}){let a=e.useMockupPage(t,{screen:n},Fy),i=qy(a.results,n).find((s)=>s.here)?.rows??[];return h("section",{"aria-label":"This page",children:[l("div",{className:"group-title",children:"This page"}),a.status==="LoadingFirstPage"?l("div",{className:"note pad",children:"Loading mockup threads…"}):i.length>0?i.map((s)=>l(bE,{row:s,turn:r[s.thread._id],onOpen:()=>o(s)},s.thread._id)):a.status==="Exhausted"&&l("div",{className:"note pad",children:"No mockup threads on this page yet. Ask for a change below, or select an element on the page."}),l(yE,{list:a,where:"on this page"})]})}function XP({mockups:e,projectId:t,screen:n,turns:r,onOpen:o}){let a=e.useMockupPage(t,{otherThan:n},Fy);if(a.status==="LoadingFirstPage")return null;let i=qy(a.results,n).filter((s)=>!s.here);return h(G,{children:[i.map((s)=>h("section",{"aria-label":`Page ${s.screen}`,children:[l("div",{className:"group-title",children:s.screen}),s.rows.map((c)=>l(bE,{row:c,turn:r[c.thread._id],onOpen:()=>o(c)},c.thread._id))]},s.screen)),l(yE,{list:a,where:"from other pages"})]})}function yE({list:e,where:t}){if(e.status!=="CanLoadMore"&&e.status!=="LoadingMore")return null;let n=e.status==="LoadingMore";return l("div",{className:"list-more",children:l("button",{type:"button",className:"btn small ghost","aria-label":`Show more ${t}`,disabled:n,onClick:()=>e.loadMore(Fy),children:n?"Loading…":"Show more"})})}class Gy extends iu{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(!this.state.failed)return this.props.children;return l("div",{className:"empty",children:h("span",{children:["Couldn't load ",this.props.label," ·"," ",l("button",{type:"button",className:"link-btn",onClick:()=>this.setState({failed:!1}),children:"Try again"})]})})}}function bE({row:e,turn:t,onOpen:n}){let{mockup:r,thread:o}=e,a=o.preview?.authorName??"Unknown",i=o.messageCount-1;return h("button",{type:"button",className:`entry mockup-entry${o.unread?" unread":""}`,onClick:n,children:[l(vt,{name:a,imageUrl:o.preview?.authorImageUrl}),h("span",{className:"grow",children:[h("span",{className:"meta",children:[l("span",{className:"author",children:a}),l("span",{className:"time",title:on(o.lastMessageAt),children:Bn(o.lastMessageAt)})]}),l("span",{className:"excerpt",children:o.preview?.body??r.title}),h("span",{className:"details",children:[l("span",{className:"page-label",children:Mf(r.source)}),l("span",{children:r.versionCount===0?"No changes yet":`v${r.versionCount}`}),i>0&&l("span",{children:i===1?"1 reply":`${i} replies`}),o.status==="resolved"&&l("span",{className:"resolved-tag",children:"Resolved"}),t!==void 0&&t.status!=="failed"&&h("span",{className:"ai-tag",children:[ci," is working…"]}),t?.status==="failed"&&h("span",{className:"status-tag",children:[ci," couldn't answer"]})]})]}),o.unread&&l("span",{className:"unread-dot","aria-label":"Unread"})]})}function vE({visit:e,onGo:t,onCancel:n}){let r=e.status==="going";return h(He,{label:`Go to ${e.screen}?`,onClose:n,children:[h("h3",{children:["Go to ",e.screen,"?"]}),h("p",{children:["This mockup thread is on ",Mf(e),". The prototype opens that page, so you can compare the mockup with it."]}),h("div",{className:"row end",children:[l("button",{type:"button",className:"btn",onClick:n,children:"Cancel"}),l("button",{type:"button",className:"btn primary",disabled:r,onClick:t,children:r?`Opening ${e.screen}…`:`Go to ${e.screen}`})]})]})}function If({models:e,value:t,onChange:n}){let r=e.find((a)=>a.id===t),o=r?.credits===void 0?"":`: ${r.estimated?"about ":""}${r.credits===1?"1 credit":`${r.credits} credits`} per request`;return l("select",{className:"model-choice","aria-label":"Model",title:`The model Critiqs AI answers with${o}`,value:t,onChange:(a)=>n(a.target.value),children:e.map((a)=>l("option",{value:a.id,children:a.label},a.id))})}function wE({draft:e,onDraft:t,sending:n,disabled:r,onSend:o,addComment:a,comments:i,hasComments:s=!1,modelChoice:c}){let f=(p)=>{if(p.preventDefault(),(e.trim()!==""||s)&&!n&&!r)o()};return h("form",{className:"ask-composer",onSubmit:f,"aria-label":"Start a mockup thread",children:[h("div",{className:"composer-context",role:"group","aria-label":"Comments",children:[a,i]}),l("textarea",{className:"field","aria-label":"Ask for a change",placeholder:"Ask Critiqs AI for a change to this page…",value:e,onChange:(p)=>t(p.target.value),onKeyDown:(p)=>{if(p.key==="Enter"&&(p.metaKey||p.ctrlKey))f(p)}}),h("div",{className:"row end",children:[c,l("button",{type:"submit",className:"btn primary",disabled:e.trim()===""&&!s||n||r,children:n?"Sending…":"Send"})]})]})}function kE({value:e,onChange:t,sending:n,disabled:r,onSend:o,addComment:a,comments:i,hasComments:s=!1,modelChoice:c}){let f=()=>{if((e.trim()!==""||s)&&!n&&!r)o()};return h("form",{className:"ask-composer",onSubmit:(p)=>{p.preventDefault(),f()},children:[h("div",{className:"composer-context",role:"group","aria-label":"Comments",children:[a,i]}),l("textarea",{className:"field","aria-label":"Reply",placeholder:"Reply, or ask for another change…",value:e,onChange:(p)=>t(p.target.value),onKeyDown:(p)=>{if(p.key==="Enter"&&(p.metaKey||p.ctrlKey))f()}}),h("div",{className:"row end",children:[c,l("button",{type:"submit",className:"btn primary",disabled:e.trim()===""&&!s||n||r,children:n?"Sending…":"Reply"})]})]})}var WP=50;function Xy({comments:e,screen:t,added:n,onAdd:r}){let[o,a]=S(!1),[i,s]=S(""),c=O(null),f=O(null);_(()=>{if(o)c.current?.focus()},[o]);let p=()=>{a(!1),s(""),f.current?.focus()},d=n.size>=oy.linkedThreads,u=Ee(()=>{let m=i.toLowerCase().split(/\s+/).filter(Boolean),y=(g)=>`${g.summary.preview?.body??""} ${g.summary.preview?.authorName??""} ${g.location.screen}`.toLowerCase();return e.filter((g)=>!n.has(g.summary._id)&&m.every((x)=>y(g).includes(x))).sort((g,x)=>Number(x.location.screen===t)-Number(g.location.screen===t)||x.summary.lastMessageAt-g.summary.lastMessageAt)},[e,n,i,t]);return h(G,{children:[l("button",{ref:f,type:"button",className:"chip add-comment","aria-expanded":o,onClick:()=>o?p():a(!0),children:"+ Add existing comment"}),o&&h("div",{className:"comment-picker",role:"dialog","aria-label":"Add a comment",onKeyDown:(m)=>{if(m.key==="Escape")m.stopPropagation(),p()},children:[h("div",{className:"row",children:[l("input",{ref:c,type:"search",className:"field","aria-label":"Search comments",placeholder:"Search comments…",value:i,onChange:(m)=>s(m.target.value)}),l("button",{type:"button",className:"icon-btn","aria-label":"Close",onClick:p,children:l(wn,{})})]}),h("div",{className:"comment-options",children:[d&&h("div",{className:"note pad",children:["A mockup links up to ",oy.linkedThreads," comments. Remove one to add another."]}),!d&&u.length===0&&l("div",{className:"note pad",children:i.trim()===""?"No comments to add.":"No comments match."}),(d?[]:u.slice(0,WP)).map((m)=>{let{summary:y,location:g}=m,x=y.preview?.authorName??"Unknown";return h("button",{type:"button",className:"entry",onClick:()=>{r(y._id),p()},children:[l(vt,{name:x,imageUrl:y.preview?.authorImageUrl}),h("span",{className:"grow",children:[h("span",{className:"meta",children:[l("span",{className:"author",children:x}),l("span",{className:"time",children:Bn(y.lastMessageAt)})]}),l("span",{className:"excerpt",children:y.preview?.body??""}),h("span",{className:"details",children:[g.screen!==t&&h("span",{children:["On ",g.screen]}),y.status==="resolved"&&l("span",{className:"resolved-tag",children:"Resolved"})]})]})]},y._id)})]})]})]})}function Wy({ids:e,comments:t,onRemove:n}){if(e.length===0)return null;return l(G,{children:e.map((r)=>{let o=t.find((s)=>s.summary._id===r)?.summary,a=o?.preview?.body??"Comment",i=(o?.tickets??[]).map(da).join(", ");return h("span",{className:"chip comment-chip",title:i===""?a:`${a}
|
|
42
|
+
${i}`,children:[l(Sf,{}),l("span",{className:"chip-text",children:a}),i!==""&&h("span",{className:"chip-tickets",children:[l(li,{size:12}),i]}),l("button",{type:"button",className:"chip-remove","aria-label":`Remove comment: ${a}`,onClick:()=>n(r),children:"×"})]},r)})})}function xE({onHold:e,disabled:t}){return l("button",{type:"button",className:"btn small hold",disabled:t,title:t?"The live page is another page, so it can't be compared here":"Hold to show the live page (or hold O)",onPointerDown:(n)=>{n.currentTarget.setPointerCapture(n.pointerId),e(!0)},onPointerUp:()=>e(!1),onPointerCancel:()=>e(!1),onKeyDown:(n)=>{if((n.key===" "||n.key==="Enter")&&!n.repeat)e(!0)},onKeyUp:()=>e(!1),onBlur:()=>e(!1),children:"Hold to compare"})}function TE({snapshots:e,snapshotId:t,onCopy:n}){if(e.length<2)return null;return l("div",{className:"mockup-tools",children:l("div",{className:"segmented copy-tabs",role:"group","aria-label":"Page copies",children:e.map((r)=>h("button",{type:"button","aria-pressed":r._id===t,title:`Taken at ${r.width} px by ${r.createdByName}, ${on(r.capturedAt)}`,onClick:()=>n(r._id),children:[r.width," px"]},r._id))})})}function SE({version:e,onLatest:t}){return h("div",{className:"mockup-banner",role:"status",children:[l("span",{children:e===0?"Viewing the original copy":`Viewing version ${e}`}),l("span",{"aria-hidden":"true",children:"·"}),l("button",{type:"button",className:"link-btn",onClick:t,children:"Back to latest"})]})}function CE({hint:e,shownWidth:t,busy:n,onTake:r,onSwitch:o}){return h("div",{className:"mockup-banner hint",role:"status",children:[h("span",{children:["This copy was taken at ",t," px."]}),e.kind==="switch"?h("button",{type:"button",className:"link-btn",onClick:()=>o(e.snapshot._id),children:["Show the ",e.snapshot.width," px copy"]}):l("button",{type:"button",className:"link-btn",disabled:n,onClick:r,children:n?"Taking a copy…":`Take a copy at ${e.width} px`})]})}var $n=(e)=>vn.find((t)=>t.id===e)?.label??e,qs={linear:"Team",github:"Repository",jira:"Project and type"};function da(e){return e.status===null?e.key:`${e.key} · ${e.status.label}${e.lastKnown===!0?" · last known":""}`}function Of(e,t){return e.trackers.flatMap(({id:n})=>t.filter((r)=>r.tracker===n))}function EE({status:e}){return l("span",{className:`ticket-dot ${e?.category??"unknown"}`,"aria-hidden":"true"})}function JP(e){let t=$n(e.tracker),n=`${e.title} (${t}, linked by ${e.linkedByName})`;if(e.statusStale!==!0||e.status===null)return n;let r=e.statusCheckedAt===null?"":` from ${on(e.statusCheckedAt)}`;return`${n}. Last known status${r}: Critiqs can't check it with ${e.linkedByName}'s ${t} account.`}function NE({tickets:e,onUnlink:t,onAddLinkBack:n}){let[r,o]=S(null);if(e.length===0)return null;let a=(i)=>{o(i._id),n(i).finally(()=>o(null))};return l("ul",{className:"ticket-chips","aria-label":"Linked tickets",children:e.map((i)=>{let s=JP(i),c=h(G,{children:[l(li,{size:14}),l("span",{className:"key",children:i.key}),i.status!==null&&h("span",{className:i.statusStale===!0?"status stale":"status",children:[l(EE,{status:i.status}),i.status.label,i.statusStale===!0&&l("span",{className:"stale-note",children:"· last known"})]})]}),f=bS(i.url);return h("li",{className:"ticket-chip",children:[f===null?l("span",{title:s,children:c}):l("a",{href:f,target:"_blank",rel:"noreferrer noopener",title:s,children:c}),i.canAddLinkBack&&l("button",{type:"button",className:"link-btn",disabled:r===i._id,title:`${$n(i.tracker)} didn't add the link back to this thread`,onClick:()=>a(i),children:r===i._id?"Adding link back…":"Add link back"}),i.canUnlink&&l("button",{type:"button",className:"icon-btn","aria-label":`Unlink ${i.key}`,title:"Unlink",onClick:()=>t(i),children:l(wn,{})})]},i._id)})})}function AE({tickets:e}){if(e===void 0||e.length===0)return null;return l(G,{children:e.map((t)=>h("span",{className:"ticket-badge",title:`${$n(t.tracker)} ticket`,children:[l(li,{size:12}),da(t)]},`${t.tracker}:${t.key}`))})}function _f({accounts:e,value:t,onChange:n,disabled:r}){if(e.length<2)return null;return l(he,{label:"Tracker",children:(o)=>l(nt,{value:t,labelledBy:o,disabled:r,options:e.map((a)=>({value:a.tracker,label:$n(a.tracker),detail:a.accountName})),onChange:(a)=>n(a)})})}var fa="";function Jy(e,t){let[n,r]=S(null);return[n?.tracker===e?n.on:t,(o)=>r({tracker:e,on:o})]}function ZP(e){if(e?.credits===void 0)return null;return`${e.estimated?"About ":""}${e.credits===1?"1 credit":`${e.credits} credits`}`}function RE({threadId:e,projectId:t,personId:n,accounts:r,drafting:o=!1,modelLists:a=!1,onSetUpAi:i=null,installUrls:s={},onClose:c,onCreated:f,returnFocus:p}){let d=se(),u=d.tickets,[m,y]=S(r[0].tracker),[g,x]=S({tracker:m,loaded:{status:"loading"}}),k=g.tracker===m?g.loaded:{status:"loading"},[b,v]=jn(`critiqs:ticket-destination:${t}:${n}:${m}`,null),[w,T]=S(null),[C,E]=S(""),[A,N]=S(""),[R,q]=S(null),[X,L]=Jy(m,R?.tracker===m?R.on:(r.find((ae)=>ae.tracker===m)??r[0]).attribution),F=O(new Map),[ce,ue]=S(!1),[re,B]=S("plain"),[W,U]=S(!0),[ie,V]=S(!1),[K,oe]=S(null),[H,le]=S({templates:[],labels:[]}),[Q,I]=S(fa),[Y,Z]=S(null),[J,fe]=S([]),[rt,Ve]=S({}),[Pe,Se]=S(null),ee=O(0),xe=ct(),Fe=ct(),qt=d.useAiChoice(o&&a?t:null),Ut=qt.status==="ready"?qt.data:null,[hr,Qe]=jn(`critiqs:ticket-model:${t}`,null),it=Ut?.models??[],pt=it.find((ae)=>ae.id===hr)??it.find((ae)=>ae.id===Ut?.defaultModel)??it[0],or=!a||Ut!==null;_(()=>{let ae=!1;return x({tracker:m,loaded:{status:"loading"}}),u.listTicketDestinations(m).then((Te)=>!ae&&x({tracker:m,loaded:{status:"ready",data:Te}}),(Te)=>!ae&&x({tracker:m,loaded:{status:"error",message:ne(Te)}})),()=>{ae=!0}},[u,m]);function sn(ae,Te,zt,ka){let gi=++ee.current;B(ae),oe(null),Te().then((Hn)=>{if(ee.current!==gi)return;E(Hn.title),N(Hn.body),U(!1),zt?.(Hn),B(null)},(Hn)=>{if(ee.current!==gi)return;oe(ne(Hn)),ka?.(),B(null)})}function yr(ae,Te){U(!0),sn("plain",()=>u.ticketDraft(e,m),(zt)=>{if(zt.resumeSubmissionId!==null)F.current.set(m,zt.resumeSubmissionId);ue(zt.resumeSubmissionId!==null),ae?.(zt)},Te)}_(()=>(ue(!1),I(fa),Z(null),Se(null),yr((ae)=>{q({tracker:m,on:ae.createdFromCritiqs}),T({tracker:m,id:ae.projectDestinationId??null})},()=>T({tracker:m,id:null})),()=>{ee.current++}),[u,e,m]);let ln=k.status==="ready"?k.data:[],va=w?.tracker===m?w.id:void 0,ar=ln.find((ae)=>ae.id===b)??(va===void 0?null:ln.find((ae)=>ae.id===va)??ln[0]??null),Ft=ar?.id??null;_(()=>{if(le({templates:[],labels:[]}),fe([]),Ve({}),!o||Ft===null)return;let ae=!1;return u.ticketDraftOptions(e,m,Ft).then((Te)=>{if(ae)return;le(Te),fe(Te.labels)},()=>{return}),()=>{ae=!0}},[u,o,e,m,Ft]);let br=(ae)=>{if(v(ae),Y!==null||Q!==fa)Z(null),I(fa),Se(null),yr()},Xs=(ae)=>{if(Ft===null)return;Z(ae),sn("plain",()=>u.ticketDraft(e,m,ae===fa?void 0:{destinationId:Ft,templateId:ae}),()=>{I(ae),Se(null),Z(null)},()=>Z(null))},wa=()=>{if(Ft===null||!or)return;Se(null),sn("ai",()=>u.draftTicketWithAi({threadId:e,tracker:m,destinationId:Ft,templateId:Q===fa?null:Q,...pt===void 0?{}:{model:pt.id}}),(ae)=>Se({text:ae.notice??"Drafted by Critiqs AI from the thread. Check it before creating.",setUpAi:ae.noticeCode==="setup-ai"}))},Fr=H.fields??[],Cn=H.unsupportedFields??[],Xr=Fr.every((ae)=>{let Te=rt[ae.id];return Array.isArray(Te)?Te.length>0:Te!==void 0&&Te.trim()!==""}),Wr=ar!==null&&re===null&&!W&&!ie&&C.trim()!==""&&Cn.length===0&&Xr,mi=ZP(pt),Eo=async()=>{if(!Wr)return;V(!0),oe(null);let ae=F.current.get(m)??crypto.randomUUID();F.current.set(m,ae);try{let Te=await u.createTicket({threadId:e,submissionId:ae,tracker:m,destinationId:ar.id,title:C,body:A,createdFromCritiqs:X,...Q===fa?{}:{templateId:Q},...J.length===0?{}:{labelIds:J.map((zt)=>zt.id)},...Fr.length===0?{}:{fields:Object.fromEntries(Fr.map((zt)=>[zt.id,rt[zt.id]]))}});v(ar.id),f(Te)}catch(Te){oe(ne(Te)),V(!1)}};return l(He,{label:"Create ticket",onClose:c,returnFocus:p,children:h("form",{className:"ds-page ticket-dialog",onSubmit:(ae)=>{ae.preventDefault(),Eo()},children:[l(tt,{title:"Create ticket",onClose:c}),ce&&h("p",{className:"note",children:["Finishing the ticket you started earlier. If ",$n(m)," already created it, Critiqs links it instead of creating another."]}),h("div",{className:"ds-group",children:[l(_f,{accounts:r,value:m,disabled:ie,onChange:y}),l(he,{label:qs[m],children:(ae)=>k.status==="error"?l("span",{className:"error",children:k.message}):l(nt,{value:ar?.id??"",labelledBy:ae,disabled:ie||k.status==="loading"||ln.length===0,options:ln.map((Te)=>({value:Te.id,label:Te.name,...Te.key===null?{}:{detail:Te.key}})),onChange:br})}),k.status==="ready"&&ln.length===0&&h("p",{className:"note",children:["You have no ",qs[m].toLowerCase()," here that takes new tickets.",s[m]!==void 0&&h(G,{children:[" ",l("a",{className:"link-btn",href:s[m],target:"_blank",rel:"noreferrer noopener",children:"Install Critiqs on your repositories in GitHub"})]})]}),H.templates.length>0&&l(he,{label:"Template",children:(ae)=>l(nt,{value:Y??Q,labelledBy:ae,disabled:ie||re!==null,options:[{value:fa,label:"Critiqs's standard format"},...H.templates.map((Te)=>({value:Te.id,label:Te.name}))],onChange:Xs})})]}),h("label",{className:"stacked",htmlFor:xe,children:[l("span",{className:"field-label",children:"Title"}),l("input",{id:xe,className:"field",value:C,disabled:re!==null||ie,placeholder:re!==null?"Filling from the thread…":"",onChange:(ae)=>E(ae.target.value)})]}),h("label",{className:"stacked",htmlFor:Fe,children:[l("span",{className:"field-label",children:"Text"}),l("textarea",{id:Fe,className:"field ticket-body",rows:9,value:A,disabled:re!==null||ie,onChange:(ae)=>N(ae.target.value)})]}),o&&h("div",{className:"ticket-ai",children:[l("button",{type:"button",className:"btn small",disabled:ie||re!==null||ar===null||!or,onClick:wa,children:re==="ai"?"Drafting…":"Draft with Critiqs AI"}),it.length>1&&pt!==void 0&&l(If,{models:it,value:pt.id,onChange:Qe}),mi!==null&&l("span",{className:"note",children:mi}),qt.status==="error"&&l("span",{className:"note",children:"Couldn't load the AI's models."})]}),Pe!==null&&(Pe.setUpAi&&i!==null?h("div",{className:"note row between",children:[l("span",{role:"status",children:Pe.text}),l("button",{type:"button",className:"btn small",onClick:()=>{c(),i()},children:"Set up your AI"})]}):l("p",{className:"note",role:"status",children:Pe.text})),J.length>0&&h("div",{className:"ticket-labels",children:[l("span",{className:"field-label",id:`${xe}-labels`,children:"Labels"}),l("ul",{"aria-labelledby":`${xe}-labels`,children:J.map((ae)=>h("li",{className:"ticket-label",children:[ae.name,l("button",{type:"button",className:"icon-btn","aria-label":`Remove label ${ae.name}`,disabled:ie,onClick:()=>fe(J.filter((Te)=>Te.id!==ae.id)),children:l(wn,{})})]},ae.id))})]}),Fr.length>0&&l(eD,{fields:Fr,values:rt,disabled:ie,onChange:(ae,Te)=>Ve((zt)=>({...zt,[ae]:Te}))}),Cn.length>0&&h("p",{className:"error",role:"alert",children:["This ",qs[m].toLowerCase()," needs ",Cn.join(", "),", which Critiqs can't fill yet. Choose another, or create this ticket in ",$n(m),"."]}),h("label",{className:"ticket-check",children:[l("input",{type:"checkbox",checked:X,disabled:ie,onChange:(ae)=>L(ae.target.checked)}),"Created from Critiqs"]}),K!==null&&l("p",{className:"error",role:"alert",children:K}),W&&re===null&&h("div",{className:"note row between",children:[h("span",{children:["Create waits until the draft for this ",qs[m].toLowerCase()," loads."]}),l("button",{type:"button",className:"btn small",disabled:ie,onClick:()=>yr(),children:"Try again"})]}),l("div",{className:"ds-actions",children:l("button",{type:"submit",className:"btn primary",disabled:!Wr,children:ie?"Creating…":"Create"})})]})})}function eD({fields:e,values:t,disabled:n,onChange:r}){let o=ct();return l("div",{className:"ticket-fields",role:"group","aria-label":"Required fields",children:e.map((a,i)=>{let s=`${o}-${i}`,c=t[a.id],f=typeof c==="string"?c:"";switch(a.kind){case"choice":return l(he,{label:a.name,children:(p)=>l(nt,{value:f,labelledBy:p,disabled:n,options:[{value:"",label:"Choose…"},...a.options.map((d)=>({value:d.id,label:d.name}))],onChange:(d)=>r(a.id,d)})},a.id);case"choices":{let p=Array.isArray(c)?c:[];return h("fieldset",{className:"stacked",children:[l("legend",{className:"field-label",children:a.name}),a.options.map((d)=>h("label",{className:"ticket-check",children:[l("input",{type:"checkbox",checked:p.includes(d.id),disabled:n,onChange:(u)=>r(a.id,u.target.checked?[...p,d.id]:p.filter((m)=>m!==d.id))}),d.name]},d.id))]},a.id)}case"paragraph":return h("label",{className:"stacked",htmlFor:s,children:[l("span",{className:"field-label",children:a.name}),l("textarea",{id:s,className:"field",rows:3,value:f,disabled:n,onChange:(p)=>r(a.id,p.target.value)})]},a.id);default:return h("label",{className:"stacked",htmlFor:s,children:[l("span",{className:"field-label",children:a.name}),l("input",{id:s,className:"field",type:a.kind==="number"?"number":a.kind==="date"?"date":"text",value:f,disabled:n,onChange:(p)=>r(a.id,p.target.value)})]},a.id)}})})}var tD=300;function ME({threadId:e,accounts:t,linked:n,onClose:r,onLinked:o,returnFocus:a}){let i=se().tickets,[s,c]=S(t[0].tracker),[f,p]=S(""),[d,u]=S(null),[m,y]=S(null),[g,x]=S(!1),[k,b]=S(!1),[v,w]=S(null),T=ct(),C=O(0);_(()=>{let R=f.trim(),q=++C.current;if(y(null),u(R===""?null:{status:"loading"}),R==="")return;let X=setTimeout(()=>{i.searchTickets(s,R).then((L)=>C.current===q&&u({status:"ready",data:L}),(L)=>C.current===q&&u({status:"error",message:ne(L)}))},tD);return()=>clearTimeout(X)},[i,s,f]);let E=d?.status==="ready"?d.data:[],A=E.find((R)=>R.externalId===m)??null,N=async()=>{if(A===null||k)return;b(!0),w(null);try{o(await i.linkTicket({threadId:e,tracker:s,externalId:A.externalId,comment:g}))}catch(R){w(ne(R)),b(!1)}};return l(He,{label:"Link ticket",onClose:r,returnFocus:a,children:h("form",{className:"ds-page ticket-dialog",onSubmit:(R)=>{R.preventDefault(),N()},children:[l(tt,{title:"Link ticket",onClose:r}),l(_f,{accounts:t,value:s,disabled:k,onChange:c}),h("label",{className:"stacked",htmlFor:T,children:[h("span",{className:"field-label",children:["Search ",$n(s)]}),l("input",{id:T,className:"field",type:"search",value:f,placeholder:"Key, such as ENG-123, or words",autoComplete:"off",onChange:(R)=>p(R.target.value)})]}),d?.status==="loading"&&l("p",{className:"note",children:"Searching…"}),d?.status==="error"&&l("p",{className:"error",children:d.message}),d?.status==="ready"&&E.length===0&&l("p",{className:"note",children:"No tickets match."}),E.length>0&&l("div",{className:"ticket-results",role:"radiogroup","aria-label":"Tickets found",children:E.map((R)=>{let q=n.some((X)=>X.tracker===R.tracker&&X.externalId===R.externalId);return h("label",{className:`ticket-result${R.externalId===m?" chosen":""}`,children:[l("input",{type:"radio",name:`${T}-ticket`,checked:R.externalId===m,disabled:k||q,onChange:()=>y(R.externalId)}),l("span",{className:"key",children:R.key}),l("span",{className:"title",children:R.title}),h("span",{className:"status",children:[l(EE,{status:R.status}),q?"Linked":R.status.label]})]},R.externalId)})}),h("label",{className:"ticket-check",children:[l("input",{type:"checkbox",checked:g,disabled:k,onChange:(R)=>x(R.target.checked)}),"Add a comment with the thread's summary"]}),v!==null&&l("p",{className:"error",role:"alert",children:v}),l("div",{className:"ds-actions",children:l("button",{type:"submit",className:"btn primary",disabled:A===null||k,children:k?"Linking…":"Link"})})]})})}var Pc=22;function OE({targets:e,selectedThreadId:t,selectedElement:n,exposedRight:r,onSelect:o}){let a=ge(()=>{let c=[],f=new Map;for(let p of e)p.elements.forEach((d,u)=>{let m=Pf(d,r);if(m===null)return;let y=f.get(d)??0;f.set(d,y+1);let g=Math.max(1,Math.floor((m.right-16)/Pc)+1),x=m.right-y%g*Pc,k=Math.floor(y/g),b=Math.max(0,Math.floor((window.innerHeight-16-m.top)/Pc)),v=k<=b?m.top+k*Pc:m.top-(k-b)*Pc;c.push({key:`${p.threadId}:${u}`,threadId:p.threadId,element:d,x,y:v})});return c},[e,r]),i=Ur(a,e.length>0,nD),s=new Map(e.map((c)=>[c.threadId,c]));return l(G,{children:i.map((c)=>{let f=s.get(c.threadId);if(f===void 0)return null;let p=c.threadId===t&&c.element===n,d=["pin",f.unread&&"unread",f.resolved&&"resolved",p&&"selected"],u=f.tickets??[],m=u.map((g)=>`${$n(g.tracker)} ${da(g)}`).join(", "),y=`comment by ${f.authorName}${f.unread?", unread":""}${m===""?"":`, ticket ${m}`}`;return h("button",{type:"button",className:d.filter(Boolean).join(" "),style:{left:Math.min(c.x,r-16),top:Math.max(c.y,16)},title:`Comment by ${f.authorName}${f.unread?" (unread)":""}${m===""?"":`
|
|
43
|
+
${u.map(da).join(`
|
|
44
|
+
`)}`}`,"aria-label":`Open ${y}`,"aria-expanded":p,onClick:()=>o(c.threadId,c.element),children:[Ns(f.authorName),u.length>0&&l("span",{className:"pin-ticket","aria-hidden":"true",children:l(li,{size:9})})]},c.key)})})}function Pf(e,t=window.innerWidth){if(!e.isConnected)return null;let n=e.getBoundingClientRect();if(n.width===0&&n.height===0)return null;let r=t,{left:o,top:a,bottom:i}=n;t=n.right;for(let s=e.parentElement;s!==null&&s!==document.body;s=s.parentElement){let c=getComputedStyle(s);if(!IE.test(c.overflowX)&&!IE.test(c.overflowY))continue;let f=s.getBoundingClientRect();o=Math.max(o,f.left),a=Math.max(a,f.top),t=Math.min(t,f.right),i=Math.min(i,f.bottom)}if(o=Math.max(o,0),a=Math.max(a,0),t=Math.min(t,window.innerWidth,r),i=Math.min(i,window.innerHeight),t<=o||i<=a)return null;return new DOMRect(o,a,t-o,i-a)}var IE=/^(hidden|clip|scroll|auto)$/;function nD(e,t){return e.length===t.length&&e.every((n,r)=>n.key===t[r].key&&n.element===t[r].element&&n.x===t[r].x&&n.y===t[r].y)}function _E({location:e,onDone:t}){let[n,r]=S(!0);_(()=>{let i=setTimeout(()=>{r(!1),t()},2600);return()=>clearTimeout(i)},[e,t]);let o=ge(()=>{let i=As(e);if(i.status!=="found")return[];return i.elements.flatMap((s)=>{let c=Pf(s);return c===null?[]:[{x:c.x,y:c.y,width:c.width,height:c.height}]})},[e]),a=Ur(o,n,rD);if(!n)return null;return l(G,{children:a.map((i,s)=>l("div",{className:"highlight passive",style:{left:i.x-4,top:i.y-4,width:i.width+8,height:i.height+8}},s))})}function rD(e,t){return e.length===t.length&&e.every((n,r)=>n.x===t[r].x&&n.y===t[r].y&&n.width===t[r].width&&n.height===t[r].height)}function PE({host:e,hint:t,onPick:n,paused:r,onOutsideClick:o,exposedRight:a}){let[i,s]=S(null),c=O(n);c.current=n;let f=O(o);f.current=o,_(()=>{if(r)s(null);let u=(w)=>w.composedPath().includes(e),m=(w)=>{let T=document.elementFromPoint(w.clientX,w.clientY);if(T===null||T===e||T===document.documentElement||T===document.body)return null;let{target:C,element:E}=cS(T,document.body);return{element:E,target:C}},y=(w)=>{if(r||u(w))return s(null);s(m(w))},g=(w)=>{if(u(w))return;if(w.preventDefault(),w instanceof KeyboardEvent&&Ms(e.shadowRoot))w.stopPropagation();else w.stopImmediatePropagation()},x=(w)=>{if(u(w))return;if(g(w),r)return f.current?.();let T=m(w);if(T!==null)c.current(T)},k=["pointerdown","pointerup","mousedown","mouseup","dblclick","contextmenu","submit","keydown","keyup","keypress"],b=document.activeElement;if(b instanceof HTMLElement&&b!==e&&b!==document.body)b.blur();window.addEventListener("pointermove",y,!0),window.addEventListener("click",x,!0);for(let w of k)window.addEventListener(w,g,!0);let v=document.documentElement.style.cursor;return document.documentElement.style.cursor="crosshair",()=>{window.removeEventListener("pointermove",y,!0),window.removeEventListener("click",x,!0);for(let w of k)window.removeEventListener(w,g,!0);document.documentElement.style.cursor=v}},[e,r]);let p=Lf(i?.element??null),d=i?.target.purposeId??i?.target.clues.label??i?.target.clues.tagName;return h(G,{children:[t!==null&&l("div",{className:"mode-hint passive",style:a===void 0?void 0:{left:a/2,maxWidth:Math.max(0,a-24)},children:t}),p!==null&&i!==null&&h(G,{children:[l("div",{className:"target-box passive",style:DE(p)}),d&&l("div",{className:"target-label passive",style:{left:p.x,top:Math.max(16,p.y)},children:d})]})]})}function DE(e){return{left:e.x-2,top:e.y-2,width:e.width+4,height:e.height+4}}var oD=(e,t)=>e===t||e!==null&&t!==null&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function Lf(e){let t=ge(()=>{if(e===null||!e.isConnected)return null;let{x:n,y:r,width:o,height:a}=e.getBoundingClientRect();return o===0&&a===0?null:{x:n,y:r,width:o,height:a}},[e]);return Ur(t,e!==null,oD)}function eb(e){return{body:Ac,tags:[],scope:e.target.recordKey===null?"shared":"record"}}function LE({dismissHelpRef:e,picked:t,comment:n,onChange:r,context:o,projectId:a,reviewer:i,signInOnPost:s=!1,saving:c,error:f,onSignIn:p,onSubmit:d,onCancel:u,rightEdge:m,ticketOffer:y=!1}){let g=Lf(t.element),{body:x,scope:k}=n,b=t.target.recordKey,v=O(null),w=O(null),T=O(null),C=ct(),[E,A]=S(null),N=E!==null,R=(B)=>A((W)=>W===B?null:W),q=jr(),X=(B)=>r({...n,body:B}),L=(B)=>r({...n,scope:B});_(()=>{let B=N?()=>A(null):null;return e.current=B,()=>{if(e.current===B)e.current=null}},[N,e]);let F=Ur(()=>{if(!N||w.current===null||T.current===null)return null;let B=w.current.getBoundingClientRect(),W=T.current,U=Math.max(0,window.innerHeight-B.bottom-8),ie=Math.max(0,B.top-8),V=W.scrollHeight+2,K=U>=V||U>=ie,oe=K?U:ie;return{left:Math.max(8,Math.min(B.left,window.innerWidth-W.offsetWidth-8)),top:K?B.bottom:B.top-Math.min(V,oe),maxHeight:oe}},N&&!q,iD);_(()=>{if(!N||q)return;let B=(W)=>{if(w.current!==null&&!W.composedPath().includes(w.current))A(null)};return window.addEventListener("pointerdown",B,!0),()=>window.removeEventListener("pointerdown",B,!0)},[N,q]);let ce=()=>{if(x.text.trim()!==""&&!c)d()},ue=gr(o.viewState),re=cD(g,v.current?.offsetHeight??260,m,window.innerHeight);return h(G,{children:[g!==null&&l("div",{className:"target-box passive",style:DE(g)}),h("form",{ref:v,className:"popover",style:re,"aria-label":"New comment",onSubmit:(B)=>{B.preventDefault(),ce()},onKeyDown:(B)=>{if(B.key==="Escape")B.stopPropagation(),u();if(B.key==="Enter"&&(B.metaKey||B.ctrlKey))ce()},children:[l("div",{className:"context-line",title:"Saved with the comment",children:[o.screen,ue,o.persona&&`viewing as ${o.persona}`].filter(Boolean).join(" · ")}),i===null&&!s?h(G,{children:[l("p",{className:"note",children:"Sign in to comment. Your selection stays here."}),h("div",{className:"row end",children:[l("button",{type:"button",className:"btn",onClick:u,children:"Cancel"}),l("button",{type:"button",className:"btn primary",onClick:p,children:"Sign in"})]})]}):h(G,{children:[l(Mc,{projectId:a,className:"field",placeholder:"Add a comment. Type @ to mention someone, # to tag.","aria-label":"Comment",value:x,autoFocus:!0,onChange:X}),b!==null&&l("div",{className:"scope-choice",role:"group","aria-label":"Comment placement",children:aD.map((B)=>h("div",{className:k===B.scope?"scope-option selected":"scope-option",children:[l("button",{type:"button","aria-pressed":k===B.scope,onClick:()=>L(B.scope),children:B.label}),h("span",{ref:E===B.scope?w:void 0,className:"scope-info",onPointerOver:(W)=>{if(!(W.relatedTarget instanceof Node)||!W.currentTarget.contains(W.relatedTarget))A(B.scope)},onPointerOut:(W)=>{let U=W.currentTarget;if(W.relatedTarget instanceof Node&&U.contains(W.relatedTarget))return;let ie=U.getRootNode(),V=ie instanceof ShadowRoot?ie.activeElement:document.activeElement;if(V===null||!U.contains(V))R(B.scope)},onBlur:(W)=>{if(!W.currentTarget.contains(W.relatedTarget))R(B.scope)},children:[l("button",{type:"button",className:"icon-btn","aria-label":B.about,"aria-expanded":E===B.scope,"aria-describedby":E===B.scope?C:void 0,onFocus:()=>A(B.scope),onClick:()=>A(B.scope),children:l(YC,{})}),E===B.scope&&l("div",{ref:T,id:C,className:"scope-help",role:"tooltip",style:F===null?{visibility:"hidden"}:F,children:B.help})]})]},B.scope))}),s&&l("p",{className:"note",children:"You'll sign in with your email when you post. Your comment stays here."}),y&&h("label",{className:"ticket-check",children:[l("input",{type:"checkbox",checked:n.ticket===!0,onChange:(B)=>r({...n,ticket:B.target.checked})}),"Also create a ticket"]}),f!==null&&l("div",{className:"error",children:f}),h("div",{className:"row end",children:[l("button",{type:"button",className:"btn",onClick:u,children:"Cancel"}),l("button",{type:"submit",className:"btn primary",disabled:x.text.trim()===""||c,children:c?"Saving…":"Comment"})]})]})]})]})}var aD=[{scope:"record",label:"This component",about:"About commenting on this component",help:"Feedback for this component here only, such as this button’s spacing or placement."},{scope:"shared",label:"Matching components",about:"About commenting on matching components",help:"One shared discussion for this same component wherever your app shows it for other records, such as this button’s label everywhere it appears. "+"Your app decides which components are the same; who can read the comment doesn’t change."}],iD=(e,t)=>e===t||e!==null&&t!==null&&e.left===t.left&&e.top===t.top&&e.maxHeight===t.maxHeight,sD=72,lD=320,Df=12,Zy=8;function cD(e,t,n,r){return tb(e,{width:lD,height:t},{left:0,top:0,right:n,bottom:r-sD})}function tb(e,t,n){let{width:r,height:o}=t,a=n.left+Zy,i=n.right-r-Zy,s=n.top+Zy,c=(y)=>Math.max(s,Math.min(y,n.bottom-o));if(e===null)return{left:Math.max(a,(n.left+n.right)/2-r/2),top:c(n.top+(n.bottom-n.top)/3)};let f=e.x+e.width+Df,p=f<=i?f:e.x-r-Df;if(p>=a&&p<=i)return{left:p,top:c(e.y)};let d=Math.max(a,Math.min(e.x,i)),u=e.y+e.height+Df,m=e.y-Df-o;if(u>=s&&u+o<=n.bottom)return{left:d,top:u};if(m>=s&&m+o<=n.bottom)return{left:d,top:m};return{left:d,top:c(u)}}var qf=3000;function pa(e,t,{restored:n=!1}={}){return[...n?Object.keys(e):new Set([...Object.keys(e),...Object.keys(t)])].every((o)=>(e[o]??null)===(t[o]??null))}function qE(e,t){if(e.screen!==t.screen)return`This comment is on ${e.screen}, and this prototype doesn't restore views automatically.`;if(!pa(e.viewState,t.viewState))return`This comment was left in another view (${gr(e.viewState)||"default view"}), and this prototype doesn't restore views automatically.`;return"This element isn't in the current view, and this prototype doesn't restore views automatically."}function UE(e,t){if(e.screen!==t.screen)return`The prototype didn't open ${e.screen}.`;return`The prototype didn't open the saved view (${gr(e.viewState)||"default view"}).`}var zE={hidden:!1,exposedRight:null,watch:[],pins:[],selected:null,highlight:null,picking:null,picked:null};function BE({transport:e,channel:t,host:n,container:r,pageHost:o={}}){let a=o,i=typeof crypto.randomUUID==="function"?crypto.randomUUID():`${Date.now()}-${Math.random()}`,s=null,c=0,f=()=>void c++,p=zE,d=!1,u=0,m=!1,y=new Map,g,x=0,k=new WeakMap,b=new Map,v=(V)=>{let K=k.get(V);if(K===void 0)K=`e${++x}`,k.set(V,K),b.set(K,new WeakRef(V));return K},w=(V)=>{if(V===null)return null;let K=b.get(V)?.deref()??null;if(K===null)b.delete(V);return K},T=(V)=>({ref:v(V),recordKey:ai(V)}),C=()=>{if(b.size<1000)return;for(let[V,K]of b)if(K.deref()===void 0)b.delete(V)},E=()=>dD(SC(a.getContext)),A=()=>{let V=E();y=new Map(p.watch.map(({threadId:oe,location:H})=>[oe,H.screen===V.screen?As(H):null])),C();let K={};for(let[oe,H]of y)K[oe]=H===null?null:N(H);return g={document:i,version:++u,url:window.location.href,context:V,viewport:{width:window.innerWidth,height:window.innerHeight},restores:a.restoreContext!==void 0,located:K},g},N=(V)=>V.status==="found"?{status:"found",occurrences:V.elements.map(T)}:V,R=lc(r),q=()=>{if(m)return;let V=p.pins.flatMap((K)=>{let oe=y.get(K.threadId);return oe?.status==="found"?[{...K,elements:oe.elements}]:[]});R.render(l(pD,{host:n,display:p,concealed:d,pins:V,selectedElement:w(p.selected?.ref??null),picked:w(p.picked),onPin:(K,oe)=>ce.emit("pin",{threadId:K,occurrence:T(oe)}),onPick:(K)=>ce.emit("picked",{occurrence:T(K.element),target:K.target,context:E()}),onOutsideClick:()=>ce.emit("outsideClick",{})}))},X=()=>{if(m)return;ce.emit("state",A()),q()},L={connect:()=>({protocol:Lr,state:g}),display(V){return p=V,X(),g},reveal:({threadId:V,location:K,chosen:oe},H)=>F(V,K,oe,H),showPage:async({threadId:V,screen:K,viewState:oe,recordKey:H},le)=>{let{restoreContext:Q}=a;if(Q===void 0)return{shown:!1};if(await Q({threadId:V,screen:K,viewState:oe,recordKey:H,scope:H===null?"shared":"record",signal:le})===!1)return{shown:!1};let Y=Date.now()+qf;for(;;){let Z=E(),J=H===null||Tc(document.body)===H;if(Z.screen===K&&pa(oe,Z.viewState,{restored:!0})&&J)return{shown:!0};if(le.aborted||Date.now()>Y)return{shown:!1};await new Promise((fe)=>setTimeout(fe,50))}},measure({ref:V}){let K=w(V),oe=K?.isConnected?K.getBoundingClientRect():null,H=oe===null?null:{x:oe.x+window.scrollX,y:oe.y+window.scrollY,width:oe.width,height:oe.height};return{context:E(),url:window.location.href,viewport:{width:window.innerWidth,height:window.innerHeight},marker:H,userAgent:navigator.userAgent}},async capture({marker:V,image:K}){let oe=s;s=null;let H=oe!==null&&oe.changes===c&&!Iy(document)&&uD(oe.view,jE());if(K===null||!H)return await xC(n,V);return await TC(K,{marker:V,...oe.view})},async conceal({concealed:V}){if(d=V,q(),!V)return null;return await new Promise((K)=>requestAnimationFrame(()=>requestAnimationFrame(K))),s=Iy(document)?null:{view:jE(),changes:c},null},async copyPage(){let V=E(),K=window.location.href,oe=Tc(document.body);return{...await NC(),url:K,context:V,recordKey:oe}},removeLink(){let V=xs(window.location.href);if(V!==window.location.href)window.history.replaceState(window.history.state,"",V);return null}};async function F(V,K,oe,H){let le=({restored:J=!1}={})=>{let fe=E();return fe.screen===K.screen&&pa(K.viewState,fe.viewState,{restored:J})},Q=()=>le({restored:!0}),I=(J,fe)=>({status:"failed",reason:J,keepOccurrence:fe}),Y=()=>I("The reviewer moved on.",!0),Z=le()?As(K):{status:"not-found"};if(Z.status!=="found"){let{restoreContext:J}=a;if(J===void 0)return I(qE(K,E()),!0);try{let fe=await J({threadId:V,screen:K.screen,viewState:K.viewState,recordKey:K.target.recordKey,scope:K.scope,signal:H});if(H.aborted)return Y();if(fe===!1)return I("The prototype couldn't show this view right now.",!0)}catch(fe){if(H.aborted)return Y();return I(`The prototype couldn't show this view${fe instanceof Error?`: ${fe.message}`:"."}`,!0)}if(Z=await TS(K.target,K.scope,document.body,{timeoutMs:qf,signal:H,isCandidate:xy,ready:Q}),H.aborted)return Y();if(!Q())return I(UE(K,E()),!1)}if(Z.status==="found"){let J=oe===null?null:{element:w(oe.ref),recordKey:oe.recordKey},fe=()=>{let xe=As(K);return xe.status==="found"?fD(J,xe.elements)??xe.elements[0]:null},rt=await _C(fe,H,qf);if(H.aborted)return Y();if(rt===null||!Q()||fe()!==rt)return I("The prototype is still changing its view. Try showing this comment again once it has settled.",!1);rt.scrollIntoView({block:"center",inline:"nearest",behavior:"instant"});let{x:Ve,y:Pe,width:Se,height:ee}=rt.getBoundingClientRect();return{status:"shown",occurrence:T(rt),rect:{x:Ve,y:Pe,width:Se,height:ee}}}return I({"not-found":"The element couldn't be found after restoring the view. It may have changed or been removed.","wrong-record":`This comment is about record ${K.target.recordKey}, which isn't shown.`,ambiguous:"Several elements match, so Critiqs won't guess which one."}[Z.status],!1)}let ce=QS(e,{channel:t,handlers:L,document:i}),ue=e.onClose(()=>{p=zE,d=!1,s=null,q()});A(),q();let re=0,B=()=>{if(re!==0||m)return;re=requestAnimationFrame(()=>{re=0,X()})},W=new MutationObserver(()=>{f(),B()});W.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),window.addEventListener("popstate",B),window.addEventListener("hashchange",B),window.addEventListener("resize",B),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f);let U=window.location.href,ie=setInterval(()=>{if(window.location.href===U)return;U=window.location.href,B()},500);return ce.emit("ready",{protocol:Lr}),{setHost(V){a=V,X()},state:()=>g,element:(V)=>w(V),destroy(){if(m)return;m=!0,ue(),ce.close(),clearInterval(ie),cancelAnimationFrame(re),W.disconnect(),window.removeEventListener("popstate",B),window.removeEventListener("hashchange",B),window.removeEventListener("resize",B),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f),queueMicrotask(()=>R.unmount())}}}function jE(){return{scroll:{x:window.scrollX,y:window.scrollY},viewport:{width:window.innerWidth,height:window.innerHeight}}}function uD(e,t){return JSON.stringify(e)===JSON.stringify(t)}function dD(e){let t=Object.fromEntries(Object.entries(e.viewState??{}).map(([n,r])=>[n,r===null||typeof r==="string"||typeof r==="boolean"?r:typeof r==="number"&&Number.isFinite(r)?r:null]));return{screen:String(e.screen),viewState:t,persona:typeof e.persona==="string"?e.persona:null}}function fD(e,t){if(e===null)return t[0]??null;if(e.element!==null&&t.includes(e.element))return e.element;return t.find((n)=>ai(n)===e.recordKey)??null}function pD({host:e,display:t,concealed:n,pins:r,selectedElement:o,picked:a,onPin:i,onPick:s,onOutsideClick:c}){let f=gD(t.highlight),p=t.exposedRight;return h("div",{className:"layer page-layer","aria-hidden":t.hidden||n||void 0,style:t.hidden||n?{visibility:"hidden"}:void 0,children:[l(OE,{targets:r,selectedThreadId:t.selected?.threadId??null,selectedElement:o,exposedRight:p??window.innerWidth,onSelect:i}),f!==null&&l(_E,{location:f.location,onDone:f.done},f.id),t.picking!==null&&l(PE,{host:e,exposedRight:p??void 0,hint:t.picking.hint,paused:t.picking.paused,onPick:s,onOutsideClick:c}),a!==null&&l(mD,{element:a})]})}function mD({element:e}){let t=Lf(e);if(t===null)return null;return l("div",{className:"target-box passive",style:{left:t.x-2,top:t.y-2,width:t.width+4,height:t.height+4}})}function gD(e){let[t,n]=S(null),[r,o]=S(null);if(e===null&&t!==null)n(null);if(e!==null&&t?.id!==e.id)n(e);let a=t?.id??null,i=ge(()=>o(a),[a]);if(t===null||r===t.id)return null;return{id:t.id,location:t.location,done:i}}var hD={hidden:!1,exposedRight:null,watch:[],pins:[],selected:null,highlight:null,picking:null,picked:null};class nb{endpoint;#e;#r=new Set;#n=null;#t="";#o=[];#a=!1;#l=new Set;#i=new Set;constructor(e,{initial:t=null,element:n=null}={}){this.endpoint=e;this.#e=t,this.element=n,this.#o.push(e.on("state",(r)=>this.#s(r))),this.#o.push(e.on("ready",()=>void this.connect().catch(()=>{return})))}element;get overPage(){return this.element!==null}async connect(e){let{state:t}=await this.endpoint.request("connect",{protocol:Lr},e);if(this.#t="",this.#s(t),this.#n!==null)this.display(this.#n);return t}subscribe=(e)=>(this.#r.add(e),()=>this.#r.delete(e));getState=()=>{if(this.#e===null)throw Error("Critiqs: the panel isn't connected to a page layer yet.");return this.#e};display(e){if(e===this.#n&&this.#t!=="")return;this.#n=e;let t=JSON.stringify(e);if(t===this.#t||this.#a)return;this.#t=t,this.endpoint.request("display",e,{document:this.#e?.document??null}).then((n)=>this.#s(n),(n)=>{if(this.#t="",!this.#a)console.warn("Critiqs: the page layer didn't take the panel's display",n)})}async request(e,t,{signal:n,timeoutMs:r}={}){let o=new AbortController,a=()=>o.abort();if(n?.addEventListener("abort",a),n?.aborted)o.abort();this.#i.add(o);try{let i=this.#e?.document??null;return await this.endpoint.request(e,t,{signal:o.signal,document:i,...r===void 0?{}:{timeoutMs:r}})}finally{this.#i.delete(o),n?.removeEventListener("abort",a)}}on(e,t){return this.endpoint.on(e,t)}close(){if(!this.#a&&this.#e!==null)this.endpoint.request("display",hD).catch(()=>{return});this.#a=!0;for(let e of this.#o)e();this.endpoint.close()}#s(e){if(this.#e!==null&&e.document===this.#e.document&&e.version<=this.#e.version)return;if(this.#l.has(e.document))return;if(this.#e!==null&&e.document!==this.#e.document){this.#l.add(this.#e.document);for(let t of[...this.#i])t.abort();this.#i.clear()}this.#e=e;for(let t of[...this.#r])t()}}var $E="in-document";function HE(e,t){let[n,r]=$S(),o=document.createElement("div");(e.shadowRoot??e).append(o);let a=BE({transport:r,channel:$E,host:e,container:o,pageHost:t}),i=new nb(VS(n,{channel:$E}),{initial:a.state(),element:a.element});return{layer:a,link:i,destroy(){i.close(),a.destroy(),n.close(),queueMicrotask(()=>o.remove())}}}var Dc=1e4,rb=30000;var Uf=new Map;async function ob(e,t,n,r=()=>!1){let a=(Uf.get(e)??Promise.resolve()).catch(()=>{return}).then(async()=>{if(typeof navigator.locks?.request==="function")return await navigator.locks.request(e,n);if(typeof indexedDB>"u")throw Error("This browser cannot safely refresh a shared Critiqs session.");let i=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t)),s=Array.from(new Uint8Array(i),(c)=>c.toString(16).padStart(2,"0")).join("");return await yD(`${e}:${s}`,n,r)});Uf.set(e,a);try{return await a}finally{if(Uf.get(e)===a)Uf.delete(e)}}async function yD(e,t,n){let r=await bD(),o=crypto.randomUUID(),a=Date.now()+30000;try{while(!await vD(r,e,o)){if(Date.now()>=a){if(n())return await t();throw Error("Critiqs session refresh is pending in another tab. Retry, or sign in again if that tab was closed.")}await new Promise((i)=>setTimeout(i,100))}return await t()}finally{await wD(r,e,o),r.close()}}function bD(){return new Promise((e,t)=>{let n=indexedDB.open("critiqs-session-locks",1);n.onupgradeneeded=()=>n.result.createObjectStore("leases"),n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function vD(e,t,n){return new Promise((r,o)=>{let a=e.transaction("leases","readwrite"),i=a.objectStore("leases"),s=i.get(t),c=!1;s.onsuccess=()=>{if(s.result===void 0)i.put({owner:n},t),c=!0},a.oncomplete=()=>r(c),a.onabort=()=>o(a.error),a.onerror=()=>o(a.error)})}function wD(e,t,n){return new Promise((r,o)=>{let a=e.transaction("leases","readwrite"),i=a.objectStore("leases"),s=i.get(t);s.onsuccess=()=>{if(s.result?.owner===n)i.delete(t)},a.oncomplete=()=>r(),a.onabort=()=>o(a.error)})}class Br extends Error{reason;constructor(e,t){super(t);this.reason=e}}var kD=60000;class ab{signInUrl;storage;fetchFn;storageKey;listeners=new Set;refreshing=null;snapshot={reviewer:null};constructor(e,t=window.localStorage,n=(r,o)=>fetch(r,o)){this.signInUrl=e;this.storage=t;this.fetchFn=n;this.storageKey=`critiqs:session:${e}`,this.snapshot={reviewer:zf(this.read())}}getSnapshot=()=>this.snapshot;subscribe=(e)=>{this.listeners.add(e);let t=(r)=>{if(r.key===this.storageKey)this.changed()},n=(r)=>{let o=r.detail;if(o.key===this.storageKey&&o.source!==this)this.changed()};return window.addEventListener("storage",t),window.addEventListener("critiqs:session-changed",n),()=>{this.listeners.delete(e),window.removeEventListener("storage",t),window.removeEventListener("critiqs:session-changed",n)}};signIn(){let e=TD(),t=new URL("/auth/start",this.signInUrl);t.search=new URLSearchParams({origin:window.location.origin,state:e}).toString();let n=window.open(t.toString(),"critiqs-sign-in","popup,width=480,height=640");if(n===null)return Promise.reject(new Br("popup-blocked","Your browser blocked the sign-in window. Allow pop-ups for this site and try again."));let r=new URL(this.signInUrl).origin;return new Promise((o,a)=>{let i=!1,s=(p)=>{if(i)return;if(i=!0,window.removeEventListener("message",c),clearInterval(f),p===void 0)o();else a(p)},c=(p)=>{let d=p.data;if(p.source!==n||p.origin!==r||d?.type!=="critiqs:sign-in"||d.state!==e)return;if(typeof d.accessToken!=="string"||typeof d.refreshToken!=="string")return s(new Br("cancelled","Sign-in was cancelled."));this.write({accessToken:d.accessToken,refreshToken:d.refreshToken,expiresAt:Number(d.expiresAt)}),s()},f=setInterval(()=>{if(!n.closed)return;clearInterval(f),setTimeout(()=>s(new Br("closed","The sign-in window was closed.")),500)},500);window.addEventListener("message",c)})}acceptPanelSignIn(e){if(typeof e.accessToken!=="string"||typeof e.refreshToken!=="string"||!Number.isFinite(e.expiresAt))throw Error("Critiqs: those sign-in tokens aren't complete.");this.write({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt})}async signOut(){let e=this.read();if(this.write(null),e===null)return;let t=[e.refreshToken,...e.nextRefreshToken===void 0?[]:[e.nextRefreshToken]];await Promise.all(t.map((n)=>this.fetchFn(new URL("/auth/sign-out",this.signInUrl),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:n})}).catch(()=>{return})))}async setDisplayName(e){let t=this.read();if(t===null)throw Error("Sign in to change your name.");let n=zf(t)?.id,r=(o)=>zf(o)?.id===n;await this.refreshing;for(let o=0;o<5;o++){let a=this.read();if(a===null||!r(a))throw Error("You signed out, so your name wasn't changed.");let i=await ob(this.storageKey,a.refreshToken,async()=>{let s=this.read();if(s===null||!r(s))throw Error("You signed out, so your name wasn't changed.");if(s.refreshToken!==a.refreshToken)return"rotated";if(s.nextRefreshToken!==void 0){if(await this.refresh(s),this.read()?.refreshToken===s.refreshToken)throw Error("Your name couldn't be changed. Check your connection and try again.");return"rotated"}let c=await this.fetchFn(new URL("/auth/profile",this.signInUrl),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:s.refreshToken,name:e})});if(c.status===400){let{error:f}=await c.json().catch(()=>({}));throw Error(f??"Use a name of 1 to 60 characters.")}if(c.status===401)throw Error("Your sign-in has ended. Sign in again to change your name.");if(!c.ok)throw Error("Your name couldn't be changed. Try again.");return await this.refresh(s)!==null});if(i!=="rotated")return i}throw Error("Your name couldn't be changed while another tab was signing in. Try again.")}fetchAccessToken=async({forceRefreshToken:e})=>{let t=this.read();if(t===null)return null;if(!e&&t.expiresAt-Date.now()>kD)return t.accessToken;let n=()=>{let r=this.read();return r?.refreshToken===t.refreshToken&&r.nextRefreshToken!==void 0};return this.refreshing??=ob(this.storageKey,t.refreshToken,async()=>{let r=this.read();if(r===null)return null;if(r.refreshToken!==t.refreshToken)return r.accessToken;return await this.refresh(r)},n).catch(()=>null).finally(()=>{this.refreshing=null}),await this.refreshing};async refresh(e){let t=this.read();if(t?.refreshToken!==e.refreshToken)return t?.accessToken??null;let n=t.nextRefreshToken??xD();if(t.nextRefreshToken===void 0)this.storage.setItem(this.storageKey,JSON.stringify({...t,nextRefreshToken:n}));let r;try{r=await this.fetchFn(new URL("/auth/refresh",this.signInUrl),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t.refreshToken,nextRefreshToken:n}),signal:AbortSignal.timeout(15000)})}catch{return null}let o=()=>this.read()?.refreshToken===t.refreshToken;if(r.status===401){if(o())this.write(null);return null}if(!r.ok)return null;let a;try{a=await r.json()}catch{return null}if(typeof a.accessToken!=="string"||typeof a.refreshToken!=="string"||!Number.isFinite(a.expiresAt))return null;if(!o()){let f=this.read();if(f?.refreshToken===a.refreshToken)return f.accessToken;return await this.fetchFn(new URL("/auth/sign-out",this.signInUrl),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:a.refreshToken,onlyIfCurrent:!0})}).catch(()=>{return}),this.read()?.accessToken??null}let{accessToken:i,refreshToken:s,expiresAt:c}=a;return this.write({accessToken:i,refreshToken:s,expiresAt:c}),i}read(){try{let e=this.storage.getItem(this.storageKey);return e===null?null:JSON.parse(e)}catch{return null}}write(e){if(e===null)this.storage.removeItem(this.storageKey);else this.storage.setItem(this.storageKey,JSON.stringify(e));window.dispatchEvent(new CustomEvent("critiqs:session-changed",{detail:{key:this.storageKey,source:this}})),this.changed()}changed(){let e=zf(this.read());if(JSON.stringify(e)!==JSON.stringify(this.snapshot.reviewer))this.snapshot={reviewer:e};for(let t of this.listeners)t()}}function zf(e){if(e===null)return null;try{let t=e.accessToken.split(".")[1]??"",n=decodeURIComponent(Array.from(atob(t.replace(/-/g,"+").replace(/_/g,"/")),(o)=>`%${o.charCodeAt(0).toString(16).padStart(2,"0")}`).join("")),r=JSON.parse(n);return{id:r.sub??"",name:r.name??"Reviewer",email:r.email??"",pictureUrl:r.picture??null}}catch{return null}}function xD(){let e=crypto.getRandomValues(new Uint8Array(32));return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function TD(){return Array.from(crypto.getRandomValues(new Uint8Array(16)),(e)=>e.toString(16).padStart(2,"0")).join("")}function VE({projectId:e,threadIds:t,linkFor:n,onClose:r,notify:o}){let[a,i]=S("markdown"),[s,c]=S(`Feedback handoff, ${new Date().toLocaleDateString()}`),f=se(),[p,d]=S({status:"loading"});_(()=>{let g=!1;return d({status:"loading"}),f.exportThreads(e,t,()=>g).then((x)=>{if(!g)d({status:"ready",data:x})},(x)=>{if(!g)d(zn(x))}),()=>{g=!0}},[f,e,JSON.stringify(t)]);let u=(()=>{if(p.status!=="ready")return null;let g={title:s,projectName:p.data.projectName,exportedAt:Date.now(),threads:p.data.threads.map((x)=>gS(x,(k)=>n(x.anchor.evidence.url,x._id,k)))};return a==="markdown"?yS(g):hS(g)})(),m=p.status==="ready"?p.data.threads.length:t.length,y=()=>{if(u===null)return;let g=new Blob([u],{type:a==="markdown"?"text/markdown":"application/json"}),x=document.createElement("a");x.href=URL.createObjectURL(g),x.download=`${s.replace(/[^\w-]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"feedback"}.${a==="markdown"?"md":"json"}`,x.click(),setTimeout(()=>URL.revokeObjectURL(x.href),1000)};return h(He,{label:"Export feedback",onClose:r,children:[h("h3",{children:["Export ",m," ",m===1?"thread":"threads"]}),l("p",{className:"note",children:"Includes each full discussion, links, tags, version, target, and context. Excludes sign-in details, other app data, and images; open a thread's link to see its capture."}),l("input",{className:"field","aria-label":"Collection title",value:s,onChange:(g)=>c(g.target.value)}),l("div",{className:"row between",children:h("div",{className:"segmented",role:"group","aria-label":"Format",children:[l("button",{type:"button","aria-pressed":a==="markdown",onClick:()=>i("markdown"),children:"Markdown, for people"}),l("button",{type:"button","aria-pressed":a==="json",onClick:()=>i("json"),children:"JSON, for tools"})]})}),l("pre",{"aria-label":"Preview",children:u??(p.status==="error"?p.message:"Preparing…")}),h("div",{className:"row end",children:[l("button",{type:"button",className:"btn",onClick:r,children:"Close"}),l("button",{type:"button",className:"btn",disabled:u===null,onClick:y,children:"Download"}),l("button",{type:"button",className:"btn primary",disabled:u===null,onClick:async()=>{await ca(u),o("Export copied")},children:"Copy"})]})]})}function QE({current:e,onSave:t,onClose:n}){let[r,o]=S(e),[a,i]=S(!1),[s,c]=S(null),f=r.trim(),p=async()=>{if(f===""||a)return;i(!0),c(null);try{await t(f),n()}catch(d){c(d instanceof Error?d.message:"Your name couldn't be changed. Try again."),i(!1)}};return l(He,{label:"Change display name",onClose:n,children:h("form",{onSubmit:(d)=>{d.preventDefault(),p()},style:{display:"flex",flexDirection:"column",gap:12},children:[l("h3",{children:"Change display name"}),l("p",{children:"Everyone in your projects sees this name on your comments. Your email address is never shown."}),l("input",{className:"field","aria-label":"Display name",value:r,maxLength:60,onChange:(d)=>o(d.target.value)}),s!==null&&l("div",{className:"error",children:s}),h("div",{className:"row end",children:[l("button",{type:"button",className:"btn",onClick:n,children:"Cancel"}),l("button",{type:"submit",className:"btn primary",disabled:f===""||f===e||a,children:a?"Saving…":"Save"})]})]})})}function KE({projectId:e,projectName:t,onClose:n}){let r=se(),o=r.useNotificationSettings(e),[a,i]=S(null),s=(c)=>{i(null),r.setNotificationSettings({projectId:e,...c}).catch((f)=>i(ne(f)))};return h(He,{label:"Email notifications",onClose:n,children:[l("h3",{children:"Email notifications"}),l("p",{children:"Critiqs emails you when someone mentions you, or replies in a thread you started, replied to, or were mentioned in. Emails show the thread's image and whole discussion, and link to the comment."}),o.status==="ready"?h("div",{className:"settings",children:[h("label",{className:"row",children:[l("input",{type:"checkbox",checked:o.data.mentionEmails,onChange:(c)=>s({mentionEmails:c.target.checked})}),"Email me when someone mentions me"]}),o.data.replyEmails!==void 0&&h("label",{className:"row",children:[l("input",{type:"checkbox",checked:o.data.replyEmails,onChange:(c)=>s({replyEmails:c.target.checked})}),"Email me about new replies in threads I'm in"]}),h("label",{className:"row",children:[l("input",{type:"checkbox",checked:o.data.projectMuted,disabled:!o.data.mentionEmails&&o.data.replyEmails===!1,onChange:(c)=>s({projectMuted:c.target.checked})}),"Mute ",t]})]}):l("p",{className:"note",children:o.status==="error"?o.message:"Loading…"}),a!==null&&l("div",{className:"error",children:a}),l("div",{className:"row end",children:l("button",{type:"button",className:"btn",onClick:n,children:"Done"})})]})}var ib=[{id:"start",title:"Getting started",summary:"Critiqs adds a toolbar to this prototype so reviewers can leave feedback on its elements and discuss it in threads.",steps:["Click Sign in on the toolbar and sign in with a verified email in the window that opens. If nothing opens, allow pop-ups for this site.","Everyone in the project sees your display name, never your email. Change it from your avatar menu: Change display name….","Your AI…, in your avatar menu where the Critiqs backend offers it, connects your own AI; see Critiqs AI.","Your trackers…, in your avatar menu where the Critiqs backend offers it, connects your own Linear, GitHub, or Jira account; see Your trackers.","Sign out from your avatar menu."]},{id:"toolbar",title:"Toolbar and modes",summary:"The toolbar at the bottom of the page switches between three modes and opens each mode's side panel.",steps:["Browse mode (V): use the prototype normally. Its side panel shows the project.","Comment mode (C): select an element to comment on it. Its side panel lists the comments.","Mockup mode (M): freeze the page into a copy and ask Critiqs AI to change it. Offered only where the Critiqs backend stores mockups.","The panel button opens or closes the current mode's side panel. Its badge counts unread comments.","Drag a side panel's left edge to make it wider or narrower, or focus the edge and use the arrow keys. Double-click the edge to reset it. Every panel keeps the width you choose.","Escape closes what is open, innermost first, ending with the side panel. It never changes the mode.","Drag the grip to move the toolbar sideways, or collapse it with the arrow. It moves to the top when it would cover what you are commenting on.","Ctrl or Cmd + \\ hides all of Critiqs, even while typing, and shows it again. Drafts and open windows are kept."]},{id:"project",title:"The Project panel",summary:"In Browse mode, the side panel shows the project: its name, its comments at a glance, who has access, and its settings.",steps:["Comments: how many threads are open and unread. Show comments switches to Comment mode.","Who has access: anyone who signs in while using this prototype can see and add comments, unless the project's owners limited it to members of its organization in Project setup. You and the people who commented most recently are listed.","Your email notifications: choose which emails you get about this project.","Plan usage: the project's usage against its plan, such as comments this month and Critiqs AI credits today, shown to the project's owners: its organization's admins, and the person who created it.","Project ID: copy it, or open Project setup."]},{id:"comment",title:"Leaving a comment",summary:"Point at the exact element your feedback is about; Critiqs saves where it is, what the page showed, and a screenshot.",steps:["Press C or click Comment mode, then click an element. The prototype doesn't react to clicks while you choose.","Write in the box beside it and click Comment, or press Ctrl or Cmd + Enter.","Type @ to mention someone; they get an email. Type # to add a tag.","When the element shows one record among many, such as a row in a list, choose This component for that one or Matching components for every one like it. Each choice has its own help.","If you leave Comment mode with text in a new comment, it is kept: press C to go back to it.","A screenshot is taken automatically. If that fails, the thread offers Attach a screenshot."]},{id:"threads",title:"Pins and threads",summary:"Each comment starts a thread, shown by a pin beside its element.",steps:["Click a pin to open its thread beside the element. A click in the prototype closes it.","Reply in the box at the bottom, with @ mentions and # tags.","Resolve a thread when it is addressed; Undo or Reopen brings it back.","More actions: Copy link, Mark unread, Create ticket… and Link ticket… (where your Critiqs backend offers tickets; see Tickets), and Delete thread….","On each message: Add reaction, and Message actions to copy its link or edit your own message.","Saved context shows the screenshot and details of where the comment was left. Show in prototype takes the prototype back there.","When the element isn't shown as it was, Reattach… lets you select its replacement. Escape cancels."]},{id:"list",title:"The comments list",summary:"In Comment mode, the side panel lists the project's threads.",steps:["Threads are grouped: In this view, Other views on this screen, and Other screens. A dot marks unread threads.","Click a thread to open it beside its element.","Filter shows open or resolved threads, unread only, this screen or all screens, and threads with chosen tags or tag groups. Reset clears the filters.","Click a tag on a thread to show only threads with that tag."]},{id:"search",title:"Search and questions",summary:"The search box at the top of the comments list finds threads, and with Critiqs AI answers questions about the feedback.",steps:["Type words or #tags to find threads. Search follows the list's status and screen filters.","With AI on, ask a question in plain words. Insights answer it and cite the threads they come from; click one to open it.","Without AI, search matches words and tags and is labeled Basic search.","When the project needs your own AI for questions, search runs as Basic search and offers Set up your AI, which opens Your AI."]},{id:"tags",title:"Tags and tag groups",summary:"Tags sort feedback; groups gather related tags so everyone can filter by them.",steps:["Type # in a comment to pick one of the project's tags or write a new one.","The person who created the project manages its tags: Tags and AI in the comments list's header, then Tags.","Typing # suggests the tags reviewers used most recently, then the preset tags no one has used yet, in their order. Add preset adds one; Change… moves, renames, or removes one. Threads that already have a renamed or removed preset keep it.","Create group adds one. Change… renames, merges, or deletes a group; deleting keeps its tags. Groups… on a tag chooses its groups.","With Critiqs AI, new tags are grouped automatically, never overriding a person's choice."]},{id:"export",title:"Exporting feedback",summary:"Hand a set of threads to someone else, or to a tool.",steps:["In the comments list, click Select threads to export, then tick threads, or Select all.","Click Export…, name the collection, and choose Markdown, for people, or JSON, for tools.","Download or Copy it. Each thread's full discussion, links, tags, and context are included; images are not."]},{id:"links",title:"Links and notifications",summary:"Share a thread or a message, and choose which emails you get.",steps:["Copy link on a thread, or Copy link to message on a message. Whoever opens it signs in and lands on that message.","Email notifications…, in your avatar menu or the Project panel: emails when someone mentions you, emails about new replies in threads you're in, or mute the project."]},{id:"mockup",title:"Mockup mode",summary:"Show a change during a review without touching code: Critiqs AI edits a copy of the page while you talk it through.",steps:["Press M or click Mockup mode. The page is frozen into a copy, and the panel lists mockup threads: this page's first, then other pages'. Show more loads more.","Click New thread. Ask for a change to the page in the box, or select an element of the copy to ask about it. + Add existing comment, above the box, adds the project's comments for Critiqs AI to read; each shows as a chip there, with × to remove it. With comments added, you can send without typing: Critiqs AI makes the changes they ask for.","Your messages and other people's sit on the right; Critiqs AI's answers sit on the left.","A new thread is saved with its first message; going back before sending one saves nothing.","Each Critiqs AI reply makes a version of the copy. View an earlier one, or Restore it as a new version; Back to latest returns.","Hold to compare, or hold O, shows the live page instead of the copy, when the prototype shows the thread's page.","For another screen width, resize the window and take a copy at that width when offered.","A thread from another page asks to go there first.","When your AI offers several models, the Model menu beside Send chooses which one answers. Your choice is remembered for the project.","When the project needs your own AI, Critiqs AI's reply offers Set up your AI, which opens Your AI; then click Try again.","Escape closes the panel and keeps the thread; V leaves Mockup mode."]},{id:"ai",title:"Critiqs AI",summary:"Optional AI that groups tags, answers questions about the feedback, and makes mockups.",steps:["Critiqs AI works without setup, on your plan's credits. Your AI…, in your avatar menu, chooses its model; the menu shows what one request costs. Upgrade, beside your plan, opens Plan and billing where the deployment takes payment, or the deployment's plan page where it names one.","Use your own API key sets up OpenAI, Anthropic, Google Gemini, OpenRouter, Vercel AI Gateway, or an OpenAI-compatible endpoint in three steps: the provider, the key, then the models to offer. Your own key costs no credits.","Use Critiqs AI instead removes your key and goes back to Critiqs AI.","The project's creator sets the project's AI in Tags and AI, under AI: AI for this project, Model, and Who pays: Project pays, personal allowed (the default: the project pays unless someone chooses their own AI), Project pays, or Each person pays (Critiqs AI on each person's plan, or their own key). Automatic grouping always uses the project's AI.","Allowed models limits which Critiqs AI models requests using the project's AI may choose. The project's own model is always allowed.","Changes save at once. When a request needs Your AI first, it says so and offers Set up your AI, which opens Your AI.","Keys are stored encrypted and never shown again; only their last four characters are.","Without AI, commenting, replies, mentions, and tags work as usual."]},{id:"trackers",title:"Your trackers",summary:"Connects your own account in your team's tracker, Linear, GitHub Issues, or Jira, so tickets made from comments are created as you.",steps:["Open it from your avatar menu: Your trackers…, or from Project setup. It appears where the Critiqs backend offers tickets.","Connect Linear opens Linear's sign-in in a window; allow Critiqs there. If nothing opens, allow pop-ups for this site.","Where the deployment has no Linear sign-in, Connect Linear asks for a personal API key instead: Open Linear settings, create a key, and paste it.","Connect GitHub Issues opens GitHub's sign-in for the deployment's GitHub App. Critiqs then reaches the repositories where your organization installed the app; Choose repositories in GitHub installs it on more. Without the app, paste a fine-grained personal access token with read and write access to Issues and read access to Contents.","Connect Jira asks for your Jira Cloud site, such as your-team.atlassian.net, then opens Atlassian's sign-in for it; allow Critiqs, and choose that site if Atlassian asks. Jira connects through Atlassian sign-in only, where the deployment has an Atlassian app configured.","Signing in connects only an account that uses your Critiqs email address (GitHub: any of its verified addresses; Jira: your Atlassian account's). Otherwise nothing is connected; for Linear or GitHub, use a key or token instead.","Created from Critiqs: whether your new tickets say they came from Critiqs, with a link to the comment. It is on until you turn it off.","Disconnect removes your account and its key from Critiqs, and ends Critiqs's sign-in in the tracker. Tickets already linked keep their links. If the tracker can't be told, or you pasted an API key, Your trackers says what still works there and how to end it.","Only you see or change your connections. Keys are stored encrypted and never shown again."]},{id:"tickets",title:"Tickets",summary:"Turn a thread into a ticket in your tracker, or link it to one that exists. Linked tickets show on the thread for everyone in the project.",steps:["In a thread, More actions → Create ticket… or Link ticket…. With no tracker connected, they open Your trackers first.","Also create a ticket, in the new-comment box, opens Create ticket for the thread once the comment is saved.","Create tickets for several threads: in the comments list, Select threads, choose them, then Create tickets…. Each thread gets its own ticket, filled from the thread, in the team or repository you choose; threads that already have one are skipped. Up to 20 at a time. If some aren't created, the dialog says which and why, and Try again retries only those. At the limit of tickets a minute, the rest wait and continue on their own a minute later while the dialog stays open.","Create ticket: choose the team or repository (Critiqs remembers your last one for this project; until you choose one, it starts with the project's default), then edit the title and text, filled from the thread. The capture is added to the ticket; GitHub has no way to add images, so there the ticket links to the thread to see it. Created from Critiqs adds a line saying it came from Critiqs, by your name; the link to the thread stays either way.","Template: where the project's owner turned on the team's templates, choose one to fill the draft from it; Critiqs's standard format is the default. Another team goes back to the standard format; if its draft can't load, Create waits, and Try again loads it.","Draft with Critiqs AI writes the title and text from the thread, and the template if you chose one, for you to check and edit. It writes plain text, which Critiqs arranges under the template's headings; anything in it that looks like a link or Markdown shows as written. Its cost shows beside it; your own key costs no credits. When AI is off or out of credits, or the provider fails, the draft is filled from the thread without AI and says why. When the project needs your own AI, it offers Set up your AI, which opens Your AI.","Labels: the team's labels that match the thread's tags are added to the ticket. Remove any you don't want.","In Jira, choose a project and issue type. The fields that issue type requires show under the text, and Create waits until each has a value. A required field Critiqs can't fill, such as a person, is named, and that issue type can't take tickets from Critiqs yet. The capture is attached to the issue, and the thread is added to it as a link. Jira keeps no templates of its own: the project's creator pastes a template's text for a Jira project and issue type in Tags and AI, under Tickets.","The project's creator chooses ticket templates in Tags and AI, under Tickets: Use the team's ticket templates is off until turned on; then turn on each of your Linear teams' templates (a workspace's templates, under Workspace templates, are offered for every team), or your GitHub repositories' issue templates and issue forms (a repository without its own uses its organization's public .github repository's), that Create ticket should offer, or paste a template's text for a Jira project and issue type.","Link ticket: search by key, such as ENG-123, acme/web#12, or WEB-12 in Jira, by an issue's address, or by words; you see only tickets you can see in your tracker. Critiqs adds the thread's link to the ticket (on GitHub, as a comment; on Jira, as a remote link), and, if you choose, a comment with the thread's summary.","Linked tickets show under the thread's header with their key and status; click one to open it. The person who linked it, or the project's owner, can unlink it; the ticket stays in the tracker.","If the tracker creates your ticket but doesn't add its link to the thread, Critiqs says so, and the ticket's chip offers Add link back until it is added.","The comments list shows each thread's ticket key and status, and a pin with a ticket has a small ticket mark. Filter → Has ticket shows only threads linked to a ticket.","Status comes back from the tracker: Linear and GitHub tell Critiqs when a ticket changes where the deployment is set up for it, and Jira does for people who connected Jira by signing in. Opening a thread checks tickets whose status is more than 5 minutes old, using the account of the person who linked each one. If they disconnect, or the ticket is hidden from them, the chip shows the last status Critiqs knew, marked last known.","Default destination: the project's creator can choose, in Tags and AI, under Tickets, the team, repository, or Jira project and issue type each tracker's new tickets start with, among their own. Each tracker has its own section there, with its default and its templates.","Resolve when done: the project's creator can turn on Resolve threads when their tickets are done, in Tags and AI, under Tickets. A thread then resolves when every ticket linked to it is done or canceled, and says it was resolved when its tickets were done. Reopening a ticket doesn't reopen the thread. It is off by default.","A thread links to at most 20 tickets. Trying Create again in the same dialog never makes a second ticket, and if a ticket you started on a thread didn't finish, the next Create ticket there finishes it instead of making another. Tickets can't be created from mockup threads yet; a comment added to a mockup shows its tickets on its chip."]},{id:"setup",title:"Project setup",summary:"Connects this prototype to its Critiqs project, and sets where emails link to.",steps:["Open it from the Project panel or your avatar menu: Project setup. A prototype without a project shows Set up Critiqs.","To set up: sign in, name the project, then run npx critiqs init with its ID in the prototype's folder, or give the Critiqs component or tag that project ID.","If you are in more than one organization, choose which one the project goes in; it starts as your own.","The project ID names the project; it is not a secret.","Review address: the page mention emails link to. The person who created the project can change it here.","Who can review: Anyone who signs in, the default, lets anyone with the project ID read and add feedback, so share the prototype's link with clients freely. Organization members limits the project to its organization: invite reviewers to the organization, and they join when they sign in. Only the project's owners change it; everyone else sees it.","Those who manage the project see its plan: Critiqs AI credits, and any other limit near full. All usage lists the rest; Plan and billing, where offered, changes the plan."]},{id:"organization",title:"Organization",summary:"Your organization owns its projects and their plan. Open it from your avatar menu: Organization.",steps:["Admins manage the organization's members, its plan, and every project in it; members create projects and manage the ones they created.","Admins invite people by email, as a member or an admin. The person joins when they sign in to Critiqs with that address. Invited shows invites no one has accepted yet; Withdraw cancels one.","Admins open a member to change their role or remove them. An organization always keeps at least one admin.","Members see who is in the organization, and can leave it."]},{id:"agents",title:"Coding agents",summary:"Coding agents read feedback and mockups through Critiqs's MCP tools, to fix what reviewers asked for.",steps:["critiqs_comments and critiqs_thread read threads with their context; critiqs_screenshot returns a thread's screenshot.","critiqs_reply answers in a thread as you, marked via coding agent.","critiqs_mockups lists mockups, and critiqs_mockup reads one version's changes to build it in code.","critiqs_sign_in signs the computer in; critiqs_doctor checks the setup."]},{id:"keys",title:"Keyboard shortcuts",summary:"Shortcuts work when you aren't typing in a field.",steps:["C: Comment mode. V: Browse mode. M: Mockup mode.","O, held: compare with the live page, in a Mockup thread on the page shown.","Escape: close what is open, ending with the side panel.","Ctrl or Cmd + Enter: send a comment, reply, or request.","Ctrl or Cmd + \\: hide or show Critiqs."]}];function GE({onClose:e}){let[t,n]=S(""),r=t.trim().toLowerCase(),o=r===""?ib:ib.filter((a)=>[a.title,a.summary,...a.steps].some((i)=>i.toLowerCase().includes(r)));return h("div",{className:"docs",children:[l("input",{type:"search",className:"field","aria-label":"Search the documentation",placeholder:"Search the documentation",value:t,onChange:(a)=>n(a.target.value),onKeyDown:(a)=>{if(a.key!=="Escape")return;if(a.preventDefault(),t!=="")n("");else e()}}),o.length===0&&h("p",{className:"note",children:["Nothing in the documentation matches “",t.trim(),"”."]}),o.map((a)=>h("details",{className:"doc-topic",open:r!==""||void 0,children:[l("summary",{children:a.title}),l("p",{children:a.summary}),l("ul",{children:a.steps.map((i)=>l("li",{children:i},i))})]},a.id))]})}var sb={projects:"Projects",threads:"Threads",messages:"Comments",reviewers:"Reviewers",captureBytes:"Images stored",mentionEmails:"Mention emails",aiRequests:"Critiqs AI credits",aiCredits:"Critiqs AI credits"},SD={total:"",month:" this month",day:" today"},Lc=({metric:e,period:t})=>`${sb[e]}${SD[t]}`;function ma(e,t){if(e!=="captureBytes")return t.toLocaleString("en-US");return t>=1073741824?`${(t/1073741824).toFixed(1)} GB`:`${Math.round(t/1048576)} MB`}function jf(e){if(e.overage===void 0)return e.max;return e.overage.cap===null?Number.POSITIVE_INFINITY:e.max+e.overage.cap}function Bf(e,t=()=>""){let n=`${ma(e.metric,e.used)} of ${ma(e.metric,e.max)}`;if(e.overage===void 0)return e.used>=e.max?{text:`${n}, limit reached`,tone:"error"}:{text:n,tone:"note"};let{cap:r}=e.overage,o=e.used-e.max;if(o<0)return{text:n,tone:"note"};let a=o===0?n:`${n} · ${ma(e.metric,o)} extra${t(o)}`;if(r!==null&&o>=r)return{text:`${a}, cap reached`,tone:"error"};if(o===0)return{text:`${n} · included credits used, extra allowed`,tone:"note"};if(r===null)return{text:`${a}, no cap`,tone:"note"};let i=`${a}, ${ma(e.metric,r-o)} left`;return o>=r*Sc?{text:`${i}, near cap`,tone:"caution"}:{text:i,tone:"note"}}var $f=["free","plus","pro"],CD=60000,ui=Nn(null);function Kf({upgradeUrl:e,organizationId:t,className:n}){let r=At(ui),o=se().billing;if(r!==null){let a=t??r.organizationId;if(o===void 0||a===null)return null;return l(ND,{billing:o,organizationId:a,children:l("button",{type:"button",className:n,onClick:()=>r.open(a),children:"Upgrade"})})}if(e===void 0)return null;return l("a",{className:n,href:e,target:"_blank",rel:"noreferrer noopener",children:"Upgrade"})}function JE(e,t){let n=Yf(e);if(t===n&&n!=="free")return"current";if(t===e.plan)return e.plan===n?"current":"set-by-critiqs";if(t===(e.subscription?.scheduledPlan??null))return"scheduled";if(t==="free"&&n==="free")return null;return $f.indexOf(t)>$f.indexOf(n==="free"?e.plan:n)?"upgrade":"switch"}var ED=(e)=>$f.some((t)=>JE(e,t)==="upgrade");function ND({billing:e,organizationId:t,children:n}){let r=e.useStatus(t);return r.status==="ready"&&r.data!==null&&ED(r.data)?n:null}var cb="critiqs-billing";function AD(e,t,n){let r=new URL(e);return r.searchParams.set(cb,n===null?t:`${t}.${n}`),r.toString()}function ZE(e){let t=new URL(e).searchParams.get(cb);if(t===null||t==="")return null;let[n,r]=t.split(".");return n===void 0||n===""?null:{organizationId:n,awaiting:r==="plus"||r==="pro"||r==="storage"?r:null}}function ub(e){let t=new URL(e);return t.searchParams.delete(cb),t.toString()}var ga={name:"main"},Us=(e)=>`$${e.toLocaleString("en-US",{minimumFractionDigits:Number.isInteger(e)?0:2,maximumFractionDigits:2})}`,eN=(e)=>e.prices?.plans[e.plan].extraCredits??null,db=(e,t)=>Us(t*e.amount/e.credits),Hf=(e,t)=>e===null?null:`${Us(e.plans[t].monthly)} a month`,$r=(e)=>e.toLocaleString("en-US"),RD=1048576,YE=1073741824,zs=(e)=>e>=YE?`${$r(Math.round(e/YE*10)/10)} GB`:`${$r(Math.round(e/RD))} MB`,MD={aiCredits:["AI credit","AI credits"],aiRequests:["AI credit","AI credits"],projects:["project","projects"],threads:["thread","threads"],captureBytes:["image storage","image storage"],reviewers:["reviewer","reviewers"],messages:["comment","comments"],mentionEmails:["mention email","mention emails"]},ID={total:"",month:" a month",day:" a day"},OD=(e)=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Vf(e){let t=[],n=[];for(let{metric:r,period:o,max:a}of e.limits){let[i,s]=MD[r];if(a===null)n.push(s);else t.push(r==="captureBytes"?`${zs(a)} of image storage`:`${$r(a)} ${a===1?i:s}${ID[o]}`)}return[t.join(", "),n.length===0?"":`unlimited ${OD(n)}`].filter((r)=>r!=="").join("; ")}function Qf(e){let t=e.plans.pro.limits.find((n)=>n.metric==="captureBytes");return{base:t?.max??null,addOn:t?.addOn??null}}var qc="Prices can't be shown right now, so plan changes are paused. Try again shortly.",Gf=(e)=>new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}),lb=(e)=>e===null?"at the end of this billing period":`on ${Gf(e)}`;function FE(e,t){if(t===null)return!0;if(t==="storage")return e.storageAddOns>0;return(e.subscription?.plan??"free")===t}var Yf=(e)=>e.subscription?.plan??"free";function tN(e){let t=e.subscription;if(t===null||!t.cancelAtPeriodEnd&&t.scheduledPlan===null)return null;let n=e.plans[t.plan].label;return t.scheduledPlan===null||t.scheduledPlan==="free"?`${n} cancels ${lb(t.currentPeriodEnd)}.`:`${n} changes to ${e.plans[t.scheduledPlan].label} ${lb(t.currentPeriodEnd)}.`}function nN({billing:e,organizationId:t,awaiting:n=null,onClose:r,notify:o}){let i=se().useMyOrganizations(!0),[s,c]=S(null),f=i.status==="ready"?i.data:[],p=f.find((U)=>U.id===s)??f.find((U)=>U.id===t)??f[0]??null,d=p?.id??null,u=e.useStatus(d),m=e.useUsage(d),[y,g]=S({name:"main"}),[x,k]=S(n),[b,v]=S(!1),[w,T]=S(!1),C=O(!1),[E,A]=S(null),N=O(null);Tn(N,y.name);let R=u.status==="ready"&&u.data!==null?u.data:null,q=R!==null&&!FE(R,x),X=O(!1);_(()=>{if(R===null||R.prices!==null||X.current)return;X.current=!0,e.loadPrices().catch(()=>{return})},[R]),_(()=>{if(!q)return;let U=setTimeout(()=>v(!0),CD);return()=>clearTimeout(U)},[q]),_(()=>{if(R===null||x===null||!FE(R,x))return;o(x==="storage"?"Extra storage added":`${p?.name??"The organization"} is on ${R.plans[x].label}`),k(null)},[R,x]);let L=y.name!=="main"&&y.organizationId!==d;_(()=>{if(!L)return;g(ga),A(null)},[L]);let F=(U)=>{A(null),g(U.name==="main"||d===null?ga:{...U,organizationId:d})},ce=async(U,ie)=>{if(C.current)return;C.current=!0,T(!0),A(null);try{let{url:V}=await U();if(V!==null){window.location.assign(V);return}o(ie),g(ga)}catch(V){A(ne(V))}C.current=!1,T(!1)},ue=(U,ie,V)=>l(He,{label:"Plan and billing",onClose:r,children:h("div",{ref:N,className:"ds-page",children:[l(tt,{title:U,onBack:V,onClose:r}),E!==null&&l("p",{className:"error",role:"alert",children:E}),ie]})});if(i.status==="error")return ue("Plan and billing",l("p",{className:"error",children:i.message}));if(i.status==="loading")return ue("Plan and billing",l("p",{className:"note",children:"Loading…"}));if(p===null)return ue("Plan and billing",l("p",{className:"note",children:"Plans belong to organizations. Yours is created with your first project."}));if(u.status==="error")return ue("Plan and billing",l("p",{className:"error",children:u.message}));if(m.status==="error")return ue("Plan and billing",l("p",{className:"error",children:m.message}));if(R===null||m.status==="loading")return ue("Plan and billing",l("p",{className:"note",children:"Loading…"}));let re=(U)=>AD(ub(window.location.href),p.id,U),B={organization:p,status:R,usage:m.data,locked:w||q,act:ce,go:F,billing:e,returnUrl:re},W=L?ga:y;if(W.name==="plans")return ue("Change plan",l(LD,{...B}),()=>F(ga));if(W.name==="cap")return ue("Cap on extra credits",l(UD,{...B,notify:o}),()=>F(ga));if(W.name==="confirm")return ue(rN(W.change,R),l(qD,{...B,change:W.change}),()=>F(W.change.kind.endsWith("storage")?ga:{name:"plans"}));return ue("Plan and billing",h(G,{children:[f.length>1&&l(he,{label:"Organization",children:(U)=>l(nt,{value:p.id,options:f.map((ie)=>({value:ie.id,label:ie.name,detail:ie.role==="admin"?"Admin":"Member"})),labelledBy:U,disabled:w,onChange:(ie)=>{c(ie),k(null),A(null)}})}),q&&l("p",{className:b?"warning":"note",role:"status",children:b?`${x==="storage"?"Extra storage":R.plans[x].label} hasn't reached Critiqs yet. Payments can take a few minutes; this page updates when it arrives.`:"Updating your plan… You can change it again once it arrives."}),l(_D,{...B})]}))}function _D({organization:e,status:t,usage:n,locked:r,act:o,go:a,billing:i,returnUrl:s}){let c=t.plans[t.plan],f=t.subscription,p=f===null?null:t.plans[f.plan],d=t.plan!==Yf(t),u=t.canManage,m=tN(t),y=()=>void o(()=>i.changePlan({organizationId:e.id,from:f.plan,plan:f.plan,returnUrl:s(null)}),`Keeping ${p.label}`),g=()=>void o(async()=>await i.openPortal({organizationId:e.id,returnUrl:s(null)}),""),x=n?.rows.find((w)=>w.metric==="aiCredits"),k=DD(t),b=eN(t),v=Hf(t.prices,t.plan);return h(G,{children:[f?.status==="past_due"&&h("div",{className:"warning row between",role:"status",children:[h("span",{children:["The last payment for ",p.label," didn't go through. Update the payment method to keep ",p.label,"."]}),u&&l("button",{type:"button",className:"btn small",disabled:r,onClick:g,children:"Manage billing"})]}),m!==null&&h("div",{className:"warning row between",role:"status",children:[l("span",{children:m}),u&&l("button",{type:"button",className:"btn small",disabled:r,onClick:y,children:"Keep my plan"})]}),h("div",{className:"ds-group",children:[l(he,{label:"Plan",children:()=>l("span",{children:d?`${c.label} · set by Critiqs`:v===null||t.plan==="free"?c.label:`${c.label} · ${v}`})}),f?.currentPeriodEnd!=null&&l(he,{label:m!==null?"Period ends":"Renews",children:()=>l("span",{children:Gf(f.currentPeriodEnd)})}),u&&l(Ue,{label:t.plan==="free"?"Upgrade":"Change plan",disabled:r,onClick:()=>a({name:"plans"})}),u&&f!==null&&l(Ue,{label:"Manage billing",value:"Payment method and invoices",disabled:r,onClick:g})]}),u&&f!==null&&t.prices===null&&l("p",{className:"note",children:qc}),d&&l("p",{className:"note",children:p===null?`Critiqs set this plan for ${e.name}, at no charge. Buying a plan starts a subscription, paid on Stripe Checkout, that replaces it.`:`Critiqs set this plan for ${e.name}; the subscription pays for ${p.label}.`}),n!==null&&h(G,{children:[l("hr",{className:"ds-divider"}),h("div",{className:"ds-group billing-usage",children:[n.rows.map((w)=>l(PD,{row:w,creditPrice:b},`${w.metric}-${w.period}`)),n.unlimited?.map((w)=>l(he,{label:sb[w.metric],children:()=>h("span",{className:"note",children:[ma(w.metric,w.used)," · Unlimited"]})},`${w.metric}-${w.period}`)),x?.overage!==void 0&&(u?l(Ue,{label:"Cap on extra credits",value:XE(x.overage.cap,b),disabled:r,onClick:()=>a({name:"cap"})}):l(he,{label:"Cap on extra credits",children:()=>l("span",{className:"note",children:XE(x.overage.cap,b)})})),f?.plan==="pro"&&(u?l(Ue,{label:"Extra storage",value:WE(t),disabled:r||t.storageAddOns===0&&t.prices===null,onClick:()=>a({name:"confirm",change:{kind:t.storageAddOns>0?"remove-storage":"add-storage"}})}):l(he,{label:"Extra storage",children:()=>l("span",{className:"note",children:WE(t)})}))]}),k!==null&&l("p",{className:"note",children:k})]}),!u&&h("p",{className:"note",children:["Only admins of ",e.name," can change its plan."]})]})}function PD({row:e,creditPrice:t}){let n=Lc(e),{text:r,tone:o}=Bf(e,(a)=>t===null?"":` (${db(t,a)})`);return h("div",{className:"billing-usage-row",children:[h("div",{className:"row between",children:[l("span",{children:n}),l("span",{className:o,children:r})]}),l(Is,{value:e.used,max:e.max,ceiling:jf(e),label:n,valueText:r})]})}var XE=(e,t)=>e===null?"No cap":e===0?"None":t===null?$r(e):`${$r(e)} · up to ${db(t,e)}`;function WE(e){let t=e.storageAddOns;if(t===0)return"Off";let{addOn:n}=Qf(e),r=n===null?`${t} add-on${t===1?"":"s"}`:zs(t*n);return e.prices===null?r:`${r} · ${Us(t*e.prices.storageAddOn.monthly)} a month`}function DD(e){let t=e.endingStorageAddOns??[],{addOn:n}=Qf(e);if(t.length===0||n===null)return null;let r=e.subscription?.scheduledPlan??null,o=r===null?void 0:e.subscription?.currentPeriodEnd??null,a=(f,p)=>{let d=e.plans[f].limits.find((u)=>u.metric==="captureBytes");return d===void 0||d.max===null?null:d.max+(d.addOn??0)*p},i=(f)=>{if(f===null){if(o!==void 0||t.length>1||t.some((u)=>u.endsAt!==null))return null;return{before:a(e.plan,e.storageAddOns+t.length),after:a(e.plan,e.storageAddOns)}}if(o===null||t.some((u)=>u.endsAt===null))return null;let p=(u)=>u?r:e.plan,d=(u)=>e.storageAddOns+t.filter((m)=>u(m.endsAt)).length;return{before:a(p(o!==void 0&&o<f),d((u)=>u>=f)),after:a(p(o!==void 0&&o<=f),d((u)=>u>f))}},s=[...new Set(t.map((f)=>f.endsAt))].sort((f,p)=>(f??Number.POSITIVE_INFINITY)-(p??Number.POSITIVE_INFINITY));return s.map((f)=>{let p=t.filter((x)=>x.endsAt===f).length,d=i(f),u=f===null?"until the end of its billing period":`until ${Gf(f)}`,m=s.length===1&&e.storageAddOns===0?"Extra storage":`${zs(p*n)} of extra storage`,y=d?.after??null;return y!==null&&(d.before===null||y<d.before)?`${m} stays ${u}, then image storage goes down to ${zs(y)}.`:`${m} stays ${u}.`}).join(" ")}function LD({organization:e,status:t,locked:n,act:r,go:o,billing:a,returnUrl:i}){let[s,c]=S(null),f=Yf(t),p=(u,m)=>{if(f==="free"){c(u),r(()=>a.changePlan({organizationId:e.id,from:"free",plan:u,returnUrl:i(u)}),`Moved to ${t.plans[u].label}`);return}if(u==="free")o({name:"confirm",change:{kind:"cancel"}});else o({name:"confirm",change:{kind:m==="upgrade"?"upgrade":"downgrade",plan:u}})},d=(u)=>{let m=JE(t,u);if(m===null)return null;if(m==="current")return l("span",{className:"note",children:"Current plan"});if(m==="set-by-critiqs")return l("span",{className:"note",children:"Set by Critiqs"});if(m==="scheduled")return h("span",{className:"note",children:["From ",t.subscription?.currentPeriodEnd==null?"next period":Gf(t.subscription.currentPeriodEnd)]});let y=`${m==="upgrade"?"Upgrade to":"Switch to"} ${t.plans[u].label}`;return l("button",{type:"button",className:"btn small",disabled:n||f!=="free"&&u!=="free"&&t.prices===null,onClick:()=>p(u,m),children:n&&s===u?"Opening checkout…":y})};return h(G,{children:[l("div",{className:"ds-group billing-plans",children:$f.map((u)=>{let m=t.plans[u],y=Hf(t.prices,u);return l(he,{label:h("span",{className:"stacked billing-plan",children:[l("span",{children:m.label}),l("span",{className:"note",children:y===null?Vf(m):`${y} · ${Vf(m)}`})]}),children:()=>d(u)},u)})}),t.prices===null&&l("p",{className:"note",children:f==="free"?"Prices can't be shown right now. Stripe Checkout shows the price before you pay.":qc})]})}function rN(e,t){switch(e.kind){case"upgrade":return`Upgrade to ${t.plans[e.plan].label}`;case"downgrade":return`Switch to ${t.plans[e.plan].label}`;case"cancel":return`Switch to ${t.plans.free.label}`;case"add-storage":return"Add extra storage";case"remove-storage":return"Remove extra storage"}}function qD({organization:e,status:t,locked:n,act:r,billing:o,returnUrl:a,change:i}){let s=Yf(t),c=t.plans[s],f=lb(t.subscription?.currentPeriodEnd??null),p=s==="pro"&&t.storageAddOns>0?` Extra storage ends with ${t.plans.pro.label}.`:"",d=tN(t),{id:u,name:m}=e,{prices:y}=t,[g,x,k]=(()=>{switch(i.kind){case"upgrade":{if(y===null)return[qc,null,""];let v=t.plans[i.plan];return[`${m} moves to ${v.label} now, at ${Hf(y,i.plan)}. You'll be charged a prorated amount now for the rest of this billing period, on the card on file.`,()=>o.changePlan({organizationId:u,from:s,plan:i.plan,returnUrl:a(i.plan)}),`Upgraded to ${v.label}`]}case"downgrade":{if(y===null)return[qc,null,""];let v=t.plans[i.plan];return[`${m} changes to ${v.label} ${f}. ${c.label} stays until then; from then ${v.label} is ${Hf(y,i.plan)}, with ${Vf(v)}.${p}`,()=>o.changePlan({organizationId:u,from:s,plan:i.plan,returnUrl:a(null)}),`Changes to ${v.label} ${f}`]}case"cancel":return[`${c.label} ends ${f}, then ${m} moves to ${t.plans.free.label}: ${Vf(t.plans.free)}. You won't be charged for the plan again; extra credits used before then are on the last invoice.${p}`,()=>o.changePlan({organizationId:u,from:s,plan:"free",returnUrl:a(null)}),`${c.label} cancels ${f}`];case"add-storage":{if(d!==null)return[`${d} Keep ${t.plans.pro.label} first, then add storage.`,null,""];if(y===null)return[qc,null,""];let{addOn:v}=Qf(t);return[`Adds ${v===null?"extra image storage":`${zs(v)} of image storage`} to ${m} for ${Us(y.storageAddOn.monthly)} a month. You'll be charged a prorated amount now for the rest of this billing period, on the card on file.`,()=>o.setStorageAddOn({organizationId:u,enabled:!0,returnUrl:a("storage")}),"Extra storage added"]}case"remove-storage":{let v=t.storageAddOns,{base:w,addOn:T}=Qf(t),C=w===null?null:zs(w+(T??0)*(v-1)),E=()=>o.setStorageAddOn({organizationId:u,enabled:!1,returnUrl:a(null)}),A="Extra storage ends at the end of this billing period";if(v>1)return[`One of ${m}'s ${v} storage add-ons stays until the end of this billing period${C===null?"":`, then image storage goes down to ${C}`}. You won't be charged for that one again.`,E,"Extra storage ends at the end of this billing period"];return[`${m}'s extra storage stays until the end of this billing period${C===null?"":`, then image storage goes back to ${C}`}. You won't be charged for it again.`,E,"Extra storage ends at the end of this billing period"]}}})(),b=rN(i,t);return h(G,{children:[l("p",{className:"billing-confirm",children:g}),x!==null&&l("div",{className:"ds-actions",children:l("button",{type:"button",className:"btn primary",disabled:n,onClick:()=>void r(x,k),children:n?"Working…":b})})]})}function UD({organization:e,status:t,usage:n,locked:r,notify:o,go:a}){let i=se(),s=n?.rows.find((N)=>N.metric==="aiCredits"),c=n?.extraCredits,f=s?.overage?.cap??null,[p,d]=S(c?.usesDefault!==!1?"default":f===null?"none":"number"),[u,m]=S(f===null?"":String(f)),[y,g]=S(!1),x=O(!1),[k,b]=S(null);if(s===void 0||c===void 0)return null;let v=/^\d+$/.test(u.trim())?Number(u.trim()):null,w=p==="default"?"default":p==="none"?null:v??void 0,T=async()=>{if(w===void 0||x.current||r)return;x.current=!0,g(!0),b(null);try{await i.setOverageCap({organizationId:e.id,cap:w}),o("Cap saved"),a(ga)}catch(N){b(ne(N)),x.current=!1,g(!1)}},C=p==="default"?c.defaultCap:p==="number"?v:null,E=eN(t),A=E===null?null:`each ${$r(E.credits)} credits cost ${Us(E.amount)}`;return h("form",{className:"ds-page",onSubmit:(N)=>{N.preventDefault(),T()},children:[h("p",{className:"note",children:["The plan includes ",$r(s.max)," credits a month. Past them, ",A??"extra credits are billed",", up to the cap."]}),k!==null&&l("p",{className:"error",role:"alert",children:k}),h("div",{className:"ds-group",children:[l(he,{label:"Cap",children:(N)=>l(nt,{value:p,labelledBy:N,options:[{value:"default",label:"Plan default",detail:`${$r(c.defaultCap)} credits`},{value:"none",label:"No cap"},{value:"number",label:"Set a number"}],onChange:(R)=>d(R)})}),p==="number"&&l(he,{label:"Extra credits",children:(N)=>l("input",{className:"field billing-cap-field",inputMode:"numeric","aria-labelledby":N,value:u,onChange:(R)=>m(R.target.value)})})]}),l("p",{className:p==="number"&&v===null?"error":"note",role:"status",children:p==="number"&&v===null?"Enter a whole number of credits, such as 5000.":C===null?`Extra credits have no cap${E===null?"":`; each ${$r(E.credits)} cost ${Us(E.amount)}`}.`:C===0?"AI stops when the included credits run out.":`Up to ${$r(C)} extra credits${E===null?"":`, at most ${db(E,C)}`} a month.`}),l("div",{className:"ds-actions",children:l("button",{type:"submit",className:"btn primary",disabled:y||r||w===void 0,children:y?"Saving…":"Save cap"})})]})}function oN({reviewer:e,signedIn:t,organizations:n=!1,addressEdits:r=!1,addressNotes:o=!1,onSignIn:a,configuredProjectId:i,browserProjectId:s,onUseProject:c,onDone:f,backLabel:p,notify:d,reviewLinksAt:u=null,trackers:m}){let y=i??s;if(e===null||!t)return h("div",{className:"setup",children:[l("h3",{children:"Set up Critiqs for this prototype"}),l("p",{children:"Setup creates a shared feedback project. Reviewers then comment directly on the prototype's elements."}),h(di,{number:1,title:"Sign in",children:[l("p",{children:"Sign in with a verified email address to create the project."}),l("div",{children:l("button",{type:"button",className:"btn primary",onClick:a,disabled:e!==null,children:e===null?"Sign in":"Signing in…"})})]}),l(di,{number:2,title:"Name the project"}),l(di,{number:3,title:"Add the project ID to the prototype"})]});if(y===null)return l(jD,{organizations:n,onCreated:c});return l(BD,{projectId:y,configured:i!==null,addressEdits:r,addressNotes:o,onChange:()=>c(null),onDone:f,backLabel:p,notify:d,reviewLinksAt:u,...m===void 0?{}:{trackers:m}})}function di({number:e,title:t,done:n,children:r}){return h("div",{className:`step${n?" done":""}`,children:[l("span",{className:"num",children:n?"✓":e}),h("div",{className:"grow",style:{display:"flex",flexDirection:"column",gap:8},children:[l("strong",{children:t}),r]})]})}function zD(e){return e.find((t)=>t.home)??e[0]}function jD({organizations:e,onCreated:t}){let n=se(),r=n.useMyProjects(!0),o=n.useMyOrganizations(e),a=o.status==="ready"?o.data:[],[i,s]=S(null),c=a.find((w)=>w.id===i)?.id??zD(a)?.id,f=ct(),[p,d]=S(""),[u,m]=S(""),[y,g]=S(!1),[x,k]=S(null),b=pb(u),v=async()=>{if(p.trim()===""||b===void 0)return;g(!0),k(null);try{t(await n.createProject(p,b,c))}catch(w){k(ne(w)),g(!1)}};return h("div",{className:"setup",children:[l("h3",{children:"Set up Critiqs for this prototype"}),l("p",{children:"Setup creates a shared feedback project. Reviewers then comment directly on the prototype's elements."}),l(di,{number:1,title:"Sign in",done:!0}),h(di,{number:2,title:"Name the project",children:[h("form",{className:"setup-form",onSubmit:(w)=>{w.preventDefault(),v()},children:[h("label",{className:"stacked",children:[l("span",{className:"note",children:"Project name"}),l("input",{className:"field",placeholder:"For example, Admin console prototype",value:p,maxLength:DS,autoFocus:!0,onChange:(w)=>d(w.target.value)})]}),l(iN,{label:"Review address (optional)",value:u,onChange:m,owner:!0}),a.length>1&&c!==void 0&&h("div",{className:"stacked",children:[l("span",{className:"note",id:f,children:"Organization"}),l(nt,{value:c,options:a.map((w)=>({value:w.id,label:w.name})),labelledBy:f,onChange:s})]}),l("div",{children:l("button",{type:"submit",className:"btn primary",disabled:y||p.trim()===""||b===void 0,children:y?"Creating…":"Create project"})})]}),x!==null&&l("div",{className:"error",children:x}),r.status==="ready"&&r.data.length>0&&h(G,{children:[l("span",{className:"note",children:"Or reconnect a project you created:"}),l("div",{className:"project-list",children:r.data.map((w)=>h("button",{type:"button",onClick:()=>t(w._id),children:[w.name,h("span",{className:"note",children:[" · created ",new Date(w.createdAt).toLocaleDateString()]})]},w._id))})]})]}),l(di,{number:3,title:"Add the project ID to the prototype"})]})}function BD({projectId:e,configured:t,addressEdits:n,addressNotes:r,onChange:o,onDone:a,backLabel:i,notify:s,reviewLinksAt:c=null,trackers:f}){let p=se().useProject(e),d=`npx critiqs init ${e}`,u=async(y,g)=>{await ca(y),s(`${g} copied`)};if(p.status==="error"&&p.code==="forbidden")return h("div",{className:"setup",children:[l("h3",{children:"No access to this project"}),l("p",{children:p.message})]});if(p.status==="error")return h("div",{className:"setup",children:[l("h3",{children:"Project not found"}),l("p",{children:t?"The project ID in this prototype's code is not known to this Critiqs backend. Check the ID, or the backend it points to.":"The project remembered in this browser no longer exists."}),!t&&l("div",{children:l("button",{type:"button",className:"btn",onClick:o,children:"Set up a new project"})})]});let m=p.status==="ready"?p.data.name:"…";return h("div",{className:"setup",children:[l("h3",{children:t?`Connected to ${m}`:`${m} is ready`}),t?l($D,{projectId:e,copy:u}):h(G,{children:[h("div",{className:"step done",children:[l("span",{className:"num",children:"✓"}),h("div",{className:"grow row between wrap",children:[l("strong",{children:"Project created"}),l("button",{type:"button",className:"link-btn",onClick:o,children:"Use a different project"})]})]}),h(di,{number:2,title:"Add the project ID to the prototype",children:[l("span",{className:"note",children:"Run this in the prototype's folder:"}),h("div",{className:"code",children:[l("code",{children:d}),l("button",{type:"button",className:"btn small",onClick:()=>u(d,"Command"),children:"Copy"})]}),l("span",{className:"note",children:"Or give the prototype's Critiqs component or tag this project ID, keeping its other settings:"}),h("div",{className:"code",children:[l("code",{children:e}),l("button",{type:"button",className:"btn small",onClick:()=>u(e,"Project ID"),children:"Copy"})]}),l("span",{className:"note",children:"Until then, only this browser uses the project."})]})]}),p.status==="ready"&&l(VD,{project:p.data,notify:s}),p.status==="ready"&&l(KD,{project:p.data,notify:s}),p.status==="ready"&&p.data.isOwner&&n&&l(QD,{projectId:e,notes:r,notify:s}),p.status==="ready"&&l(mb,{project:p.data,className:"setup-section"}),p.status==="ready"&&p.data.isOwner===!0&&c!==null&&h("div",{className:"setup-section",children:[l("strong",{children:"Review links"}),l("span",{className:"note",children:"Send reviewers a link that opens the prototype with Critiqs, with nothing to install. The project's owners create and remove them."}),l("div",{children:l("a",{className:"btn small",href:c(e),target:"_blank",rel:"noreferrer noopener",children:"Manage review links"})})]}),p.status==="ready"&&f!==void 0&&l(XD,{offered:f.offered,onOpen:f.onOpen}),l("p",{className:"note",children:p.status==="ready"&&p.data.reviewAccess==="organization"?"Only members of the project's organization see its feedback.":"Anyone who can open the prototype and sign in sees its feedback."}),l("div",{children:l("button",{type:"button",className:"btn primary",onClick:a,children:t?i:"Start commenting"})})]})}function $D({projectId:e,copy:t}){let[n,r]=S(!1),o=ct();return h("div",{className:"step done",children:[l("span",{className:"num",children:"✓"}),h("div",{className:"grow setup-details",children:[h("div",{className:"row between wrap",children:[l("strong",{children:"Project is set up"}),l("button",{type:"button",className:"link-btn","aria-expanded":n,"aria-controls":n?o:void 0,onClick:()=>r(!n),children:n?"Hide details":"Details"})]}),n&&h("div",{id:o,className:"setup-details",children:[l("span",{className:"note",children:"The prototype's code names this project, so every copy (local, preview, and deployed) shows its comments."}),h("div",{className:"code light",children:[l("code",{children:e}),l("button",{type:"button",className:"btn small",onClick:()=>t(e,"Project ID"),children:"Copy"})]})]})]})]})}function HD(){return ny(window.location.href)}function pb(e){let t=e.trim();return t===""?null:ny(t)??void 0}function aN({owner:e}){return h("div",{className:"warning",role:"note",children:["Only people on this computer or its private network (such as a Tailscale network) can open this address, so reviewers elsewhere can't follow mention emails to it.",e?" If reviewers use a deployed copy, enter that address instead.":" The project's owner can change it."]})}function iN({label:e,value:t,onChange:n,owner:r,autoFocus:o}){let a=pb(t),i=HD();return h("div",{className:"stacked",children:[h("label",{className:"stacked",children:[l("span",{className:"note",children:e}),l("input",{className:"field",inputMode:"url",spellCheck:!1,autoCapitalize:"none",placeholder:"https://your-team.github.io/prototype/",value:t,autoFocus:o,onChange:(s)=>n(s.target.value)})]}),l("span",{className:"note",children:"The page reviewers open, such as the deployed prototype. Mention emails open it, and Critiqs then shows the comment."}),i!==null&&t.trim()!==i&&h("span",{className:"note review-address-page",children:[l("button",{type:"button",className:"link-btn",onClick:()=>n(i),children:"Use this page"})," ","(",i,")"]}),a===void 0&&l("div",{className:"error",children:"Enter the full address, starting with https:// (or http://localhost while testing)."}),typeof a==="string"&&uc(a)&&l(aN,{owner:r})]})}function VD({project:e,notify:t}){let n=se(),[r,o]=S(null),[a,i]=S(!1),[s,c]=S(null),f=O(null),p=O(!1),d=r!==null,u=r===null?null:pb(r);_(()=>{if(!d&&p.current)f.current?.focus();p.current=d},[d]);let m=async()=>{if(typeof u!=="string")return;i(!0),c(null);try{await n.setReviewUrl({projectId:e._id,reviewUrl:u}),o(null),t("Review address saved")}catch(y){c(ne(y))}finally{i(!1)}};return h("section",{className:"setup-section review-address-section","aria-label":"Review address",children:[h("div",{className:"row between",children:[l("strong",{children:"Review address"}),e.isOwner&&r===null&&l("button",{ref:f,type:"button",className:"link-btn",onClick:()=>o(e.reviewUrl??""),children:e.reviewUrl===null?"Add the address":"Change"})]}),r===null?h(G,{children:[l("span",{className:"note",children:e.reviewUrl===null?"None yet, so mention emails can't link to comments.":`Mention emails open ${e.reviewUrl}`}),e.reviewUrl!==null&&uc(e.reviewUrl)&&l(aN,{owner:e.isOwner})]}):h("form",{className:"setup-form",onSubmit:(y)=>{y.preventDefault(),m()},children:[l(iN,{label:"Address",value:r,onChange:o,owner:!0,autoFocus:!0}),l("span",{className:"note",children:"Emails sent from now on use it; links in emails already sent don't change."}),h("div",{className:"row",children:[l("button",{type:"submit",className:"btn small primary",disabled:a||typeof u!=="string",children:a?"Saving…":"Save"}),l("button",{type:"button",className:"btn small",onClick:()=>o(null),children:"Cancel"})]})]}),s!==null&&l("div",{className:"error",children:s})]})}function QD({projectId:e,notes:t,notify:n}){let r=se(),o=r.useProjectAddresses(e),a=r.useProjectAddressNotes(t?e:null),i=(v)=>a.status==="ready"?a.data.find((w)=>w.address===v)?.note:void 0,s=ct(),[c,f]=S(""),[p,d]=S(null),[u,m]=S(null),y=O(null);if(o.status==="loading")return null;if(o.status==="error")return h("section",{className:"setup-section","aria-label":"Extension addresses",children:[l("strong",{children:"Extension addresses"}),l("div",{className:"error",children:o.message})]});let g=o.data,x=g.length>=fy,k=async()=>{let v=PS(c);if("error"in v)return m(v.error);d("add"),m(null);try{await r.addProjectAddress({projectId:e,address:v.address}),f(""),n("Address added"),y.current?.focus()}catch(w){m(ne(w))}finally{d(null)}},b=async(v)=>{d(v),m(null);try{await r.removeProjectAddress({projectId:e,address:v}),n(`${v} removed`),y.current?.focus()}catch(w){m(ne(w))}finally{d(null)}};return h("section",{className:"setup-section address-list","aria-label":"Extension addresses",children:[l("strong",{children:"Extension addresses"}),l("span",{className:"note",children:g.length===0?"None yet. The Critiqs extension finds this project on the sites listed here, for people who can already open it.":"The Critiqs extension finds this project on these sites, for people who can already open it."}),g.length>0&&l("ul",{className:"address-rows",children:g.map((v)=>{let w=i(v);return h("li",{className:w===void 0?"row between":"row between inert",children:[l("code",{children:v}),l("button",{type:"button",className:"link-btn",disabled:p!==null,"aria-label":`Remove ${v}`,onClick:()=>void b(v),children:p===v?"Removing…":"Remove"}),w!==void 0&&l("span",{className:"note address-note",children:w})]},v)})}),x?h("span",{className:"note",children:["A project can list up to ",fy," addresses. Remove one to add another."]}):h("form",{className:"row",onSubmit:(v)=>{v.preventDefault(),k()},children:[l("input",{ref:y,id:s,"aria-label":"Address or pattern to add",className:"grow",type:"text",inputMode:"url",autoCapitalize:"off",spellCheck:!1,placeholder:"https://*-acme.vercel.app",value:c,"aria-invalid":u!==null,"aria-describedby":u===null?`${s}-hint`:`${s}-error`,onChange:(v)=>{f(v.target.value),m(null)}}),l("button",{type:"submit",className:"btn small",disabled:p!==null||c.trim()==="",children:p==="add"?"Adding…":"Add"})]}),u===null?!x&&l("span",{className:"note",id:`${s}-hint`,children:"An origin, such as https://acme-proto.vercel.app, or one * for many, such as https://*-acme.vercel.app."}):l("div",{className:"error",id:`${s}-error`,role:"alert",children:u})]})}var fb={anyone:"Anyone who signs in",organization:"Organization members"};function KD({project:e,notify:t}){let n=se(),[r,o]=S(null),[a,i]=S(null);if(e.reviewAccess===void 0)return null;let s=r??e.reviewAccess,c=[{value:"anyone",label:fb.anyone,detail:"Anyone with the project ID"},{value:"organization",label:fb.organization,detail:e.organization?.name??"Invite reviewers to it"}],f=async(p)=>{o(p),i(null);try{await n.setReviewAccess({projectId:e._id,reviewAccess:p}),t(p==="organization"?"Only organization members can review now":"Anyone who signs in can review now")}catch(d){i(ne(d))}finally{o(null)}};return h("section",{className:"setup-section","aria-label":"Who can review",children:[a!==null&&l("div",{className:"error",children:a}),l("div",{className:"ds-group",children:l(he,{label:"Who can review",children:(p)=>e.isOwner?l(nt,{value:s,options:c,labelledBy:p,disabled:r!==null,onChange:(d)=>void f(d)}):l("span",{"aria-labelledby":p,children:fb[s]})})})]})}var sN=["aiCredits","aiRequests"],GD="projects";function YD(e){return sN.includes(e.metric)||e.metric!==GD&&e.used>=e.max*Sc}function FD({row:e}){let t=Lc(e),{text:n,tone:r}=Bf(e);return h("div",{className:"usage-meter",children:[h("div",{className:"row between",children:[l("span",{children:t}),l("span",{className:r,children:n})]}),l(Is,{value:e.used,max:e.max,ceiling:jf(e),label:t,valueText:n})]})}function mb({project:e,className:t}){let n=se().useUsage(e.isOwner?e._id:null),r=At(ui),[o,a]=S(!1),i=ct();if(n.status!=="ready"||n.data===null)return null;let{plan:s,rows:c,unlimited:f,upgradeUrl:p}=n.data;return h("section",{className:`${t} plan-usage`,"aria-label":"Plan",children:[h("div",{className:"row between",children:[h("strong",{children:[s," plan"]}),r!==null?l("button",{type:"button",className:"link-btn",onClick:()=>r.open(),children:"Plan and billing"}):p!==void 0&&l("a",{className:"link-btn",href:p,target:"_blank",rel:"noreferrer noopener",children:"Upgrade"})]}),h("div",{id:i,className:"plan-usage-rows",children:[(o?c:c.filter(YD)).map((d)=>l(FD,{row:d},`${d.metric}-${d.period}`)),(o?f:f?.filter((d)=>sN.includes(d.metric)))?.map((d)=>h("div",{className:"row between usage-unlimited",children:[l("span",{children:Lc(d)}),h("span",{className:"note",children:[ma(d.metric,d.used)," · Unlimited"]})]},`${d.metric}-${d.period}`)),o&&l("p",{className:"note",children:"Projects, images, and Critiqs AI credits count for the whole organization."})]}),l("div",{children:l("button",{type:"button",className:"link-btn","aria-expanded":o,"aria-controls":i,onClick:()=>a(!o),children:o?"Less":"All usage"})})]})}function XD({offered:e,onOpen:t}){let n=se().tickets?.useTrackerAccounts(!0),r=e.trackers.map(({id:a})=>vn.find((i)=>i.id===a)?.label??a),o=n?.status==="ready"?e.trackers.filter(({id:a})=>n.data.some((i)=>i.tracker===a)).map(({id:a})=>vn.find((i)=>i.id===a)?.label??a):null;return h("section",{className:"setup-section","aria-label":"Your trackers",children:[l("div",{className:"ds-group",children:l(Ue,{label:"Your trackers",value:o===null?"":o.length===0?"None connected":o.join(", "),onClick:t})}),h("p",{className:"note",children:["Connect ",r.length===1?r[0]:`${r.slice(0,-1).join(", ")}, or ${r.at(-1)}`," to turn comments into tickets, as you."]})]})}function lN({project:e,reviewer:t,openCount:n,unreadCount:r,onShowComments:o,onNotifications:a,onSetup:i,onDocs:s,notify:c}){let f=se().useParticipants(e._id,""),p=f.status==="ready"?f.data:[],d=async()=>{await ca(e._id),c("Project ID copied")};return h("div",{className:"setup project-panel",children:[h("section",{className:"review-address","aria-label":"Comments",children:[l("strong",{children:"Comments"}),h("span",{className:"note",children:[n===1?"1 open thread":`${n} open threads`,r>0&&` · ${r} unread`]}),l("div",{children:l("button",{type:"button",className:"link-btn",onClick:o,children:"Show comments"})})]}),h("section",{className:"review-address","aria-label":"Who has access",children:[l("strong",{children:"Who has access"}),l("span",{className:"note",children:e.reviewAccess==="organization"?"Only members of the project's organization can see and add comments. Invite people to the organization to let them review.":"Anyone who signs in while using this prototype can see and add comments. Control access by controlling who can reach the prototype."}),h("ul",{className:"people",children:[h("li",{children:[l(vt,{name:t.name,imageUrl:t.pictureUrl}),h("span",{children:[t.name," ",h("span",{className:"note",children:["(you",e.isOwner?", project owner":"",")"]})]})]}),p.map((u)=>h("li",{children:[l(vt,{name:u.name,imageUrl:u.imageUrl}),l("span",{children:u.name})]},u._id))]}),p.length>0&&l("span",{className:"note",children:"People who commented most recently."})]}),h("section",{className:"review-address","aria-label":"Your email notifications",children:[l("strong",{children:"Your email notifications"}),l("span",{className:"note",children:"Choose which emails you get about this project."}),l("div",{children:l("button",{type:"button",className:"link-btn",onClick:a,children:"Email notifications…"})})]}),h("section",{className:"review-address","aria-label":"Documentation",children:[l("strong",{children:"Documentation"}),l("span",{className:"note",children:"What each part of Critiqs does and how to use it."}),l("div",{children:l("button",{type:"button",className:"link-btn",onClick:s,children:"Open documentation"})})]}),l(mb,{project:e,className:"review-address"}),h("section",{className:"review-address","aria-label":"Project ID",children:[l("strong",{children:"Project ID"}),h("div",{className:"code light",children:[l("code",{children:e._id}),l("button",{type:"button",className:"btn small",onClick:()=>void d(),children:"Copy"})]}),l("div",{children:l("button",{type:"button",className:"link-btn",onClick:i,children:"Project setup"})})]})]})}function cN({projectId:e,scope:t,state:n,onState:r}){let o=se(),[a,i]=S(n.status==="idle"?"":n.question),s=O(0),c=async(p)=>{p.preventDefault();let d=a.trim();if(d==="")return;let u=++s.current;r({status:"searching",question:d});try{let m=await o.search({projectId:e,question:d,scope:t});if(u===s.current)r({status:"done",question:d,response:m})}catch(m){if(u===s.current)r({status:"failed",question:d,message:ne(m)})}},f=()=>{s.current++,i(""),r({status:"idle"})};return h("form",{className:"search-box",role:"search",onSubmit:(p)=>void c(p),children:[l(KC,{}),l("input",{type:"search",className:"field","aria-label":"Search feedback",placeholder:"Search, or ask about the feedback",value:a,maxLength:500,onChange:(p)=>i(p.target.value),onKeyDown:(p)=>{if(p.key==="Escape"&&n.status!=="idle")p.stopPropagation(),f()}}),n.status!=="idle"&&l("button",{type:"button",className:"icon-btn","aria-label":"Clear search",title:"Clear search",onClick:f,children:l(wn,{})})]})}function uN({state:e,tags:t,onOpen:n,onTag:r,onSetUpAi:o=null}){if(e.status==="searching")return l("div",{className:"empty",role:"status",children:"Searching…"});if(e.status==="failed")return h("div",{className:"empty",role:"alert",children:[l("strong",{children:"Search failed"}),l("span",{children:e.message})]});let{response:a}=e,i=new Map(a.results.map((f)=>[f.threadId,f])),s=(f)=>t?.groups.find((p)=>p._id===f)?.name??"a group",c=[...a.query.terms.map((f)=>`“${f}”`),...a.query.tags.map((f)=>`#${f}`),...a.query.groupIds.map((f)=>`group ${s(f)}`),a.query.status==="all"?"open and resolved":a.query.status,a.query.screen===null?"all screens":`screen ${a.query.screen}`,a.query.since!==null&&`since ${new Date(a.query.since).toISOString().slice(0,10)}`,a.query.until!==null&&`until ${new Date(a.query.until).toISOString().slice(0,10)}`].filter(Boolean);return h("div",{className:"search-results","aria-label":"Search results",children:[h("div",{className:"search-summary",children:[l("span",{className:`badge ${a.mode}`,children:a.mode==="ai"?"AI search":"Basic search"}),h("span",{children:[a.results.length===1?"1 thread":`${a.results.length} threads`,a.truncated?" (more matched; refine the search to see them)":""]})]}),a.notice!==null&&(a.noticeCode==="setup-ai"&&o!==null?h("div",{className:"search-notice row between",children:[l("span",{children:a.notice}),l("button",{type:"button",className:"btn small",onClick:o,children:"Set up your AI"})]}):l("p",{className:"search-notice",children:a.notice})),h("div",{className:"search-filters note",title:"What was searched",children:["Searched ",c.join(" · ")]}),a.insights.length>0&&h("section",{className:"insights","aria-label":"Insights",children:[l("div",{className:"group-title",children:"Insights"}),a.insights.map((f,p)=>h("article",{className:"insight",children:[l("strong",{children:f.title}),l("p",{children:f.detail}),l("div",{className:"sources","aria-label":"Sources",children:f.threadIds.map((d)=>{let u=i.get(d);if(u===void 0)return null;return h("button",{type:"button",className:"source",onClick:()=>n(d,null),title:"Open this thread",children:[u.preview?.authorName??"Thread",": ",WD(u.preview?.body??"")]},d)})})]},p))]}),a.insightNotice!==null&&a.results.length>0&&l("p",{className:"note search-insight-note",children:a.insightNotice}),a.results.length===0?h("div",{className:"empty",children:[l("strong",{children:"No threads match"}),l("span",{children:"Try other words, or clear the search to see every thread."})]}):h("section",{"aria-label":"Matching threads",children:[l("div",{className:"group-title",children:"Threads"}),a.results.map((f)=>l("button",{type:"button",className:"entry",onClick:()=>n(f.threadId,f.matches[0]?.messageId??null),children:h("span",{className:"grow",children:[h("span",{className:"meta",children:[l("span",{className:"author",children:f.preview?.authorName??"Unknown"}),l("span",{className:"time",children:Bn(f.lastMessageAt)})]}),l("span",{className:"excerpt",children:f.preview?.body??""}),f.matches.filter((p)=>p.excerpt!=="").slice(0,2).map((p)=>l("span",{className:"match",children:p.excerpt},p.messageId)),h("span",{className:"details",children:[f.messageCount>1&&l("span",{children:f.messageCount-1===1?"1 reply":`${f.messageCount-1} replies`}),f.status==="resolved"&&l("span",{className:"resolved-tag",children:"Resolved"}),l("span",{children:f.screen}),f.tags.map((p)=>l("span",{className:"tag-chip clickable",title:`Show threads tagged ${p}`,onClick:(d)=>{d.stopPropagation(),r(p)},children:xo(p)},p))]})]})},f.threadId))]})]})}function WD(e){let t=e.replace(/\s+/g," ").trim();return t.length>60?`${t.slice(0,59)}…`:t}var dN=50,JD=200;function Ff(e){let t=e.deployment.managedModels??[],n=t.some((r)=>r.id===e.managedModel)?e.managedModel:t[0]?.id??"";return{enabled:e.enabled,mode:e.mode,managedModel:n,provider:e.provider??"",model:e.model??"",models:e.models!==void 0&&e.models.length>0?e.models:e.model?[e.model]:[],baseUrl:e.baseUrl??"",apiKey:""}}var mN=(e)=>dc.find((t)=>t.id===e)?.address==="fixed";function yb(e){if(mN(e.provider))return null;return e.baseUrl.trim().replace(/\/+$/,"")||null}function gN(e,t){return e.provider!==null&&t.provider===e.provider&&yb(t)===(e.baseUrl?.replace(/\/+$/,"")||null)}function gb(e,t){if(!gN(e,t)||e.model===null)return{model:"",models:[]};return{model:e.model,models:e.models!==void 0&&e.models.length>0?e.models:[e.model]}}function Xf(e,t,{withModels:n=!1}={}){if(!e.enabled){let r=t.mode==="own"&&t.provider!==null;return{enabled:!1,mode:t.mode,...r?{provider:t.provider,model:t.model,baseUrl:t.baseUrl}:{}}}return{enabled:e.enabled,mode:e.mode,...e.mode==="managed"?ZD(e,t):{},...e.mode==="own"?{provider:e.provider===""?null:e.provider,model:e.model.trim()===""?null:e.model.trim(),...n&&e.provider!==""?{models:e.models}:{},baseUrl:e.baseUrl.trim()===""||mN(e.provider)?null:e.baseUrl.trim(),...e.apiKey.trim()===""?{}:{apiKey:e.apiKey.trim()}}:{}}}function ZD(e,t){let n=(t.deployment.managedModels??[]).map((o)=>o.id);if(n.length>1)return e.managedModel===""?{}:{managedModel:e.managedModel};return n.length===1&&t.managedModel!=null&&!n.includes(t.managedModel)?{managedModel:null}:{}}function bb(e){let t=e.credits===1?"1 credit":`${e.credits} credits`;return e.estimated?`about ${t}`:t}function Wf(e){return e.map((t)=>({value:t.id,label:t.label,detail:bb(t)}))}var hN=(e)=>dc.find((t)=>t.id===e)?.label??e,Jf=(e)=>e==="compatible"?"Your endpoint":`${hN(e)} key`,fN={openai:"https://platform.openai.com/api-keys",anthropic:"https://console.anthropic.com/settings/keys",google:"https://aistudio.google.com/apikey",openrouter:"https://openrouter.ai/keys"},yN={day:"today",month:"this month",total:"in total"},pN=["day","month","total"],hb=(e)=>e.overage===void 0?e.max:e.overage.cap===null?null:e.max+e.overage.cap;function e2(e){let t=`${e.used.toLocaleString("en-US")} of ${e.max.toLocaleString("en-US")} ${e.max===1?"credit":"credits"} used ${yN[e.period]}`;if(e.overage===void 0)return t;let n=Math.max(0,e.used-e.max).toLocaleString("en-US");return`${t} · ${n} extra, ${e.overage.cap===null?"no cap":`up to ${e.overage.cap.toLocaleString("en-US")}`}`}function Zf({plan:e,rows:t,upgradeUrl:n,organizationId:r,whose:o}){let a=t.some((p)=>hb(p)===0),i=[...t].sort((p,d)=>pN.indexOf(p.period)-pN.indexOf(d.period)),s=i.map((p)=>({row:p,of:hb(p)??p.max})),c=s.length===0?null:s.reduce((p,d)=>d.row.used/d.of>p.row.used/p.of?d:p),f=!a&&t.some((p)=>p.used>=(hb(p)??Number.POSITIVE_INFINITY));return h("div",{className:"ds-group",children:[l(he,{label:`${e} plan`,children:()=>l(Kf,{upgradeUrl:n,organizationId:r,className:"btn small"})}),a?l("p",{className:"warning",role:"status",children:o==="person"?`The ${e} plan doesn't include your own Critiqs AI.`:`The ${e} plan doesn't include Critiqs AI.`}):c!==null&&h("div",{className:"stacked",children:[l(Is,{value:c.row.used,max:c.of,label:`Credits used ${yN[c.row.period]}`}),l("span",{className:f?"error":"note",role:f?"status":void 0,children:i.map(e2).join(" · ")})]})]})}function ep({view:e,draft:t,onSave:n,onExit:r,loadModels:o,busy:a,error:i,clearError:s}){let c=e.deployment.providers??SS,f=dc.filter((L)=>c.includes(L.id)||L.id===t.provider),[p,d]=S(t.mode==="own"&&t.provider!==""?2:1),[u,m]=S({provider:t.provider,baseUrl:t.baseUrl,apiKey:"",model:t.model,models:t.models}),[y,g]=S(null),[x,k]=S(!1),b=O(0),v=o===void 0?2:3,w=O(null);Tn(w,p,{initial:!0});let T=dc.find((L)=>L.id===u.provider),C=e.keyHint!==null&&gN(e,u),E=u.provider==="compatible"||T?.address==="optional"&&(e.deployment.allowedEndpoints.length>0||u.baseUrl!==""),A=T?.address==="required"&&yb(u)===null,N=T?.needsKey===!0&&u.apiKey.trim()===""&&!C,R=(L)=>n({...t,enabled:!0,mode:"own",...u,...L}),q=(L)=>{s(),d(L)},X=()=>{b.current++,k(!1),g(null)};if(p===1)return h("div",{ref:w,className:"ds-page",children:[l(tt,{title:"Choose a provider",onBack:r,step:{current:1,count:v}}),l("div",{className:"ds-group",children:f.map((L)=>l(Ue,{label:L.id==="compatible"?"Other (OpenAI-compatible)":L.label,onClick:()=>{if(L.id!==u.provider){let F=L.address!=="fixed"&&L.id===e.provider?e.baseUrl??"":"";m({provider:L.id,baseUrl:F,apiKey:"",...gb(e,{provider:L.id,baseUrl:F})})}X(),q(2)}},L.id))})]});if(p===2){let L=async()=>{if(A||N||x||a||o===void 0&&u.model.trim()==="")return;if(o===void 0)return R({model:u.model.trim(),models:u.model.trim()===""?[]:[u.model.trim()]});let F=++b.current;k(!0);let ce;try{ce=await o({provider:u.provider,baseUrl:yb(u),...u.apiKey.trim()===""?{}:{apiKey:u.apiKey.trim()}})}catch(ue){ce={ok:!1,code:"unknown",message:ne(ue)}}if(F!==b.current)return;if(k(!1),g(ce),ce.ok||ce.code==="capability")q(3)};return l("div",{ref:w,children:h("form",{className:"ds-page",onSubmit:(F)=>{F.preventDefault(),L()},children:[l(tt,{title:u.provider==="compatible"?"Connect your endpoint":`Add your ${hN(u.provider)} key`,onBack:()=>{X(),q(1)},step:{current:2,count:v}}),E&&u.provider==="compatible"&&h("label",{className:"stacked",children:[l("span",{className:"field-label",children:"Endpoint address"}),l("input",{className:"field",value:u.baseUrl,placeholder:"https://llm.example.com/v1",onChange:(F)=>{m({...u,baseUrl:F.target.value,...gb(e,{provider:u.provider,baseUrl:F.target.value})}),X()}})]}),h("label",{className:"stacked",children:[h("span",{className:"field-label",children:["API key",T?.needsKey?"":" (if it needs one)"]}),l("input",{className:"field",type:"password",autoComplete:"off",value:u.apiKey,disabled:!e.deployment.keysStorable,placeholder:C?`Saved key ending in ${e.keyHint}`:"Paste the key",onChange:(F)=>{m({...u,apiKey:F.target.value}),X()}})]}),E&&u.provider!=="compatible"&&h("label",{className:"stacked",children:[l("span",{className:"field-label",children:"Endpoint address (optional)"}),l("input",{className:"field",value:u.baseUrl,placeholder:"https://llm.example.com/v1",onChange:(F)=>{m({...u,baseUrl:F.target.value,...gb(e,{provider:u.provider,baseUrl:F.target.value})}),X()}})]}),!e.deployment.keysStorable&&l("p",{className:"warning",children:"This deployment can't store keys until its operator sets CRITIQS_AI_ENCRYPTION_KEY."}),o===void 0&&h("label",{className:"stacked",children:[l("span",{className:"field-label",children:"Model"}),l("input",{className:"field",value:u.model,maxLength:200,placeholder:"gpt-6.2-sol",onChange:(F)=>m({...u,model:F.target.value})})]}),y?.ok===!1&&l("p",{className:"error",role:"status",children:y.message}),i!==null&&l("p",{className:"error",role:"alert",children:i}),h("div",{className:"ds-actions between",children:[fN[u.provider]!==void 0?l("a",{className:"link-btn",href:fN[u.provider],target:"_blank",rel:"noreferrer noopener",children:"Get a key"}):l("span",{}),h("div",{className:"row",children:[y?.ok===!1&&l("button",{type:"button",className:"btn",onClick:()=>q(3),children:"Name models instead"}),l("button",{type:"submit",className:"btn primary",disabled:A||N||x||a||o===void 0&&u.model.trim()==="",children:x?"Checking…":o===void 0?a?"Saving…":"Save key":"Continue"})]})]})]})})}return h("div",{ref:w,className:"ds-page",children:[l(tt,{title:"Choose models",onBack:()=>q(2),step:{current:3,count:v}}),y?.ok!==!0&&l("p",{className:"note",children:"Add the names of the models to offer."}),l(t2,{picked:u.models,listed:y?.ok===!0?y:null,onChange:(L)=>m({...u,models:L,model:L.includes(u.model)?u.model:L[0]??""})}),i!==null&&l("p",{className:"error",role:"alert",children:i}),l("div",{className:"ds-actions",children:l("button",{type:"button",className:"btn primary",disabled:u.models.length===0||a,onClick:()=>R({model:u.model,models:u.models}),children:a?"Saving…":"Save key"})})]})}function t2({picked:e,listed:t,onChange:n}){let[r,o]=S(""),[a,i]=S(""),s=e.length>=dN,c=t?.models??[],f=new Map(c.map((x)=>[x.id,x.label])),p=[...e,...c.map((x)=>x.id).filter((x)=>!e.includes(x))],d=r.trim().toLowerCase(),u=d===""?p:p.filter((x)=>x.toLowerCase().includes(d)||(f.get(x)??"").toLowerCase().includes(d)),m=u.slice(0,JD),y=(x)=>n(e.includes(x)?e.filter((k)=>k!==x):s?e:[...e,x]),g=()=>{let x=a.trim();if(x===""||s)return;if(!e.includes(x))n([...e,x]);i("")};return h(G,{children:[c.length>8&&l("input",{className:"field",type:"search","aria-label":"Search models",placeholder:`Search ${c.length} models`,value:r,onChange:(x)=>o(x.target.value)}),p.length>0&&h("div",{className:"model-list",role:"group","aria-label":"Models to offer",children:[m.map((x)=>h("label",{className:"row",children:[l("input",{type:"checkbox",checked:e.includes(x),disabled:!e.includes(x)&&s,onChange:()=>y(x)}),l("span",{className:"grow",children:f.get(x)??x})]},x)),u.length===0&&l("span",{className:"note",children:"No models match."}),u.length>m.length&&h("span",{className:"note",children:["Search to see the other ",u.length-m.length,"."]})]}),t?.truncated&&h("span",{className:"note",children:["The provider listed more; search finds the first ",c.length," by name."]}),s&&h("span",{className:"note",children:["At most ",dN," models."]}),h("div",{className:"row",children:[l("input",{className:"field","aria-label":"Model name",value:a,maxLength:200,placeholder:"Add a model by name",onChange:(x)=>i(x.target.value),onKeyDown:(x)=>{if(x.key==="Enter")x.preventDefault(),g()}}),l("button",{type:"button",className:"btn",disabled:a.trim()===""||s,onClick:g,children:"Add"})]})]})}function bN({projectId:e,notify:t}){return h("div",{className:"ds-page",children:[l("div",{className:"ds-group",children:l(n2,{projectId:e,notify:t})}),l("p",{className:"note",children:"Canceled tickets count as done. Reopening a ticket doesn't reopen its thread."})]})}function n2({projectId:e,notify:t}){let n=se().tickets,r=n?.useTicketSettings(e,!0),o=r?.status==="ready"?r.data.resolveWhenDone:void 0,[a,i]=S(null),[s,c]=S(!1),[f,p]=S(null);if(_(()=>{if(!s&&a!==null&&o===a)i(null)},[s,a,o]),n===void 0||r===void 0)return null;if(r.status==="error")return l("p",{className:"error",children:r.message});if(r.status!=="ready")return l("p",{className:"note",children:"Loading…"});let d=async(u)=>{if(s)return;c(!0),i(u),p(null);try{await n.setResolveWhenDone(e,u),t(u?"Threads now resolve when their tickets are done":"Threads no longer resolve when their tickets are done")}catch(m){i(null),p(ne(m))}finally{c(!1)}};return h(G,{children:[f!==null&&l("p",{className:"error",role:"alert",children:f}),l(he,{label:"Resolve threads when their tickets are done",children:(u)=>l(ko,{checked:a??r.data.resolveWhenDone,labelledBy:u,onChange:(m)=>void d(m)})})]})}function vN({projectId:e,notify:t,templates:n,resolveWhenDone:r,defaults:o=!1}){let i=se().tickets.useTrackerAccounts(n||o),s=i.status==="ready"?vn.map((p)=>p.id).filter((p)=>i.data.some((d)=>d.tracker===p)):[],c=i2(e,t,n),f=c.settings?.on===!0;return h("div",{className:"ds-page",children:[n&&l(s2,{state:c}),r&&l(bN,{projectId:e,notify:t}),(o||n&&f)&&i.status==="ready"&&s.length===0&&l("p",{className:"note",children:o?"Connect Linear, GitHub Issues, or Jira in Your trackers to choose where tickets go and your teams' templates.":"Connect Linear, GitHub Issues, or Jira in Your trackers to choose your teams' templates."}),s.map((p)=>!o&&!(f&&n)?null:h("section",{className:"ds-section","aria-label":Uc(p),children:[l("h4",{className:"ds-section-title",children:Uc(p)}),o&&l(o2,{projectId:e,tracker:p,notify:t}),n&&f&&c.settings!==null&&(p==="jira"?l(c2,{settings:c.settings,busy:c.busy,onSave:c.save}):l(l2,{projectId:e,tracker:p,state:c}))]},p))]})}var r2={linear:"team",github:"repository",jira:"project and issue type"};function o2({projectId:e,tracker:t,notify:n}){let r=se().tickets,o=r.useTicketSettings(e,!0),[a,i]=S({status:"loading"}),[s,c]=S(null),[f,p]=S(!1),[d,u]=S(null);_(()=>{let w=!1;return i({status:"loading"}),r.listTicketDestinations(t).then((T)=>!w&&i({status:"ready",data:T}),(T)=>!w&&i({status:"error",message:ne(T)})),()=>{w=!0}},[r,t]);let m=o.status==="ready"?(o.data.defaults??[]).find((w)=>w.tracker===t):void 0,y=m?.destinationId??"";_(()=>{if(!f&&s!==null&&y===s)c(null)},[f,s,y]);let g=r2[t],x=`Default ${g}`;if(o.status==="error")return l("p",{className:"error",children:o.message});let k=a.status==="ready"?a.data:[],b=[{value:"",label:"None",detail:"Each person's last choice"},...m!==void 0&&!k.some((w)=>w.id===m.destinationId)?[{value:m.destinationId,label:m.name}]:[],...k.map((w)=>({value:w.id,label:w.name}))],v=async(w)=>{if(f||w===(s??y))return;p(!0),c(w),u(null);try{await r.setTicketDefaultDestination(e,t,w===""?null:w);let T=b.find((C)=>C.value===w)?.label;n(w===""?`New ${Uc(t)} tickets have no default ${g}`:`New ${Uc(t)} tickets go to ${T} by default`)}catch(T){c(null),u(ne(T))}finally{p(!1)}};return h("div",{className:"ds-group",children:[d!==null&&l("p",{className:"error",role:"alert",children:d}),l(he,{label:x,children:(w)=>l(nt,{value:s??y,labelledBy:w,disabled:f||o.status!=="ready"||a.status!=="ready",options:b,onChange:(T)=>void v(T)})}),a.status==="error"&&l("p",{className:"error",children:a.message}),h("p",{className:"note",children:["Create ticket starts here, unless the person chose another ",g," for this project before."]})]})}var a2={linear:{none:"Your Linear teams have no issue templates yet.",offer:"for their team"},github:{none:"Your GitHub repositories have no issue templates or issue forms yet.",offer:"in their repository"}},tp=(e,t)=>e.tracker===t.tracker&&e.destinationId===t.destinationId&&e.templateId===t.templateId;function i2(e,t,n){let r=se().tickets,o=r.useTicketTemplateSettings(n?e:null),[a,i]=S(null),[s,c]=S(!1),[f,p]=S(null),d=o.status==="ready"?o.data:null;_(()=>i(null),[d]);let u=async(m,y)=>{c(!0),p(null);try{i(await r.saveTicketTemplateSettings(e,m)),t(y)}catch(g){p(ne(g))}finally{c(!1)}};return{settings:a??d,error:f,loadError:o.status==="error"?o.message:null,busy:s,save:u}}function s2({state:e}){let{settings:t,busy:n,save:r}=e;if(e.loadError!==null)return l("p",{className:"error",children:e.loadError});if(t===null)return l("p",{className:"note",children:"Loading…"});return h("div",{className:"ds-group",children:[e.error!==null&&l("p",{className:"error",role:"alert",children:e.error}),l(he,{label:"Use the team's ticket templates",children:(o)=>l(ko,{checked:t.on,labelledBy:o,disabled:n,onChange:(a)=>void r({on:a,templates:t.templates},a?"Ticket templates turned on":"Ticket templates turned off")})})]})}function l2({projectId:e,tracker:t,state:n}){let r=se().tickets,[o,a]=S({status:"loading"});_(()=>{let f=!1;return a({status:"loading"}),r.listTrackerTemplates(e,t).then((p)=>!f&&a({status:"ready",data:p}),(p)=>!f&&a({status:"error",message:ne(p)})),()=>{f=!0}},[r,e,t]);let i=n.settings,s=a2[t],c=(f,p,d)=>{let u={tracker:t,destinationId:f.destination.id,templateId:p.id,name:p.name},m=d?[...i.templates.filter((y)=>!tp(y,u)),u]:i.templates.filter((y)=>!tp(y,u));n.save({on:!0,templates:m},d?`Offering ${p.name}`:`No longer offering ${p.name}`)};return h("div",{className:"ds-page",role:"group","aria-label":`${Uc(t)} templates`,children:[o.status==="loading"&&l("p",{className:"note",children:"Loading templates…"}),o.status==="error"&&l("p",{className:"error",children:o.message}),o.status==="ready"&&o.data.length===0&&l("p",{className:"note",children:s.none}),o.status==="ready"&&o.data.length>0&&h(G,{children:[h("p",{className:"note",children:["Create ticket offers the templates turned on here, ",s.offer,"."]}),o.data.map((f)=>h("div",{className:"ds-group",role:"group","aria-label":f.destination.name,children:[l("div",{className:"ds-group-label",children:f.destination.name}),f.from!==void 0&&h("p",{className:"note",children:["From ",f.from,": this repository has no templates of its own, so GitHub uses these."]}),f.templates.map((p)=>l(he,{label:p.name,children:(d)=>l(ko,{checked:i.templates.some((u)=>tp(u,{tracker:t,destinationId:f.destination.id,templateId:p.id})),labelledBy:d,disabled:n.busy,onChange:(u)=>c(f,p,u)})},p.id))]},f.destination.id))]})]})}var Uc=(e)=>vn.find((t)=>t.id===e)?.label??e;function c2({settings:e,busy:t,onSave:n}){let r=se().tickets,[o,a]=S({status:"loading"}),[i,s]=S(""),[c,f]=S(""),[p,d]=S(""),u=ct(),m=ct();_(()=>{let v=!1;return r.listTicketDestinations("jira").then((w)=>!v&&a({status:"ready",data:w}),(w)=>!v&&a({status:"error",message:ne(w)})),()=>{v=!0}},[r]);let y=e.templates.filter((v)=>v.tracker==="jira"),g=o.status==="ready"?o.data:[],x=g.find((v)=>v.id===i)??g[0]??null,k=(v)=>g.find((w)=>w.id===v)?.name??"A Jira project",b=async()=>{if(x===null||c.trim()===""||p.trim()==="")return;let v={tracker:"jira",destinationId:x.id,templateId:`pasted-${crypto.randomUUID()}`,name:c.trim(),body:p};await n({on:!0,templates:[...e.templates,v]},`Offering ${v.name}`),f(""),d("")};return h("div",{className:"ds-group",role:"group","aria-label":"Jira templates",children:[l("div",{className:"ds-group-label",children:"Templates"}),l("p",{className:"note",children:"Jira has no ticket templates of its own. Paste your team's description template for a project and issue type; Create ticket offers it there."}),y.map((v)=>h("div",{className:"ds-row",children:[h("span",{className:"ds-row-label stacked",children:[l("span",{className:"ellipsis",children:v.name}),l("span",{className:"note ellipsis",children:k(v.destinationId)})]}),l("button",{type:"button",className:"btn small",disabled:t,onClick:()=>void n({on:!0,templates:e.templates.filter((w)=>!tp(w,v))},`No longer offering ${v.name}`),children:"Remove"})]},v.templateId)),o.status==="error"&&l("p",{className:"error",children:o.message}),o.status==="ready"&&h("form",{className:"stacked",onSubmit:(v)=>{v.preventDefault(),b()},children:[l(he,{label:"Project and type",children:(v)=>l(nt,{value:x?.id??"",labelledBy:v,disabled:t||g.length===0,options:g.map((w)=>({value:w.id,label:w.name})),onChange:s})}),h("label",{className:"stacked",htmlFor:u,children:[l("span",{className:"field-label",children:"Template name"}),l("input",{id:u,className:"field",value:c,disabled:t,placeholder:"Bug report",onChange:(v)=>f(v.target.value)})]}),h("label",{className:"stacked",htmlFor:m,children:[l("span",{className:"field-label",children:"Template text"}),l("textarea",{id:m,className:"field",rows:5,value:p,disabled:t,placeholder:`## What happened
|
|
45
|
+
|
|
46
|
+
## Expected`,onChange:(v)=>d(v.target.value)})]}),l("div",{className:"ds-actions",children:l("button",{type:"submit",className:"btn small",disabled:t||x===null||c.trim()===""||p.trim()==="",children:"Add template"})})]})]})}var u2={pending:"Waiting for automatic grouping",ai:"Grouped automatically",starter:"Starter group",human:"Set by you",none:"Not grouped"};function wN({projectId:e,initialTab:t,onClose:n,notify:r,modelLists:o=!1,presetTags:a=!1,tickets:i}){let s=i!==void 0&&(i.templates||i.resolveWhenDone||i.defaults===!0),[c,f]=S(t==="tickets"&&!s?"groups":t),p={groups:"Tags",ai:"AI",tickets:"Tickets"}[c];return h(He,{label:"Tags and AI",onClose:n,children:[h("div",{className:"row between",children:[l("h3",{children:"Tags and AI"}),h("div",{className:"segmented",role:"tablist","aria-label":"Settings",children:[l("button",{type:"button",role:"tab","aria-selected":c==="groups","aria-pressed":c==="groups",onClick:()=>f("groups"),children:"Tags"}),l("button",{type:"button",role:"tab","aria-selected":c==="ai","aria-pressed":c==="ai",onClick:()=>f("ai"),children:"AI"}),s&&l("button",{type:"button",role:"tab","aria-selected":c==="tickets","aria-pressed":c==="tickets",onClick:()=>f("tickets"),children:"Tickets"})]})]}),l("div",{className:"dialog-scroll",role:"tabpanel","aria-label":p,children:c==="groups"?l(d2,{projectId:e,notify:r,presetTags:a}):c==="ai"?l(b2,{projectId:e,notify:r,modelLists:o}):l(vN,{projectId:e,notify:r,templates:i?.templates===!0,resolveWhenDone:i?.resolveWhenDone===!0,defaults:i?.defaults===!0})}),l("div",{className:"row end",children:l("button",{type:"button",className:"btn",onClick:n,children:"Done"})})]})}function d2({projectId:e,notify:t,presetTags:n}){let r=se(),o=r.useTags(e),[a,i]=S(""),[s,c]=S(null),f=(y,g)=>y.then(()=>g&&t(g)).catch((x)=>t(ne(x)));if(o.status==="loading")return l("p",{className:"note",children:"Loading tags…"});if(o.status==="error")return l("p",{className:"error",children:o.message});let{tags:p,groups:d}=o.data,u=(y)=>p.filter((g)=>g.groupIds.includes(y));return h("div",{className:"settings",children:[n&&l(f2,{projectId:e,notify:t}),l("div",{className:"menu-label",children:"Groups"}),l("p",{className:"note",children:"Groups gather related tags, so filtering by a group shows threads with any of its tags. Everyone in the project uses them. Automatic grouping places new tags; your choices are never changed automatically."}),h("form",{className:"row",onSubmit:(y)=>{if(y.preventDefault(),a.trim()==="")return;f(r.createTagGroup({projectId:e,name:a}),`Group “${a.trim()}” created`).then(()=>i(""))},children:[l("input",{className:"field","aria-label":"New group name",placeholder:"New group, such as Visual design",value:a,maxLength:60,onChange:(y)=>i(y.target.value)}),l("button",{type:"submit",className:"btn",disabled:a.trim()==="",children:"Create group"})]}),d.length===0?l("p",{className:"note",children:"No groups yet."}):l("ul",{className:"group-list",children:d.map((y)=>h("li",{children:[s?.id===y._id?h("form",{className:"row",onSubmit:(g)=>{g.preventDefault(),f(r.renameTagGroup({projectId:e,groupId:y._id,name:s.name})).then(()=>c(null))},children:[l("input",{className:"field","aria-label":"Group name",value:s.name,maxLength:60,autoFocus:!0,onChange:(g)=>c({id:y._id,name:g.target.value})}),l("button",{type:"submit",className:"btn small",children:"Save"}),l("button",{type:"button",className:"btn small",onClick:()=>c(null),children:"Cancel"})]}):h("div",{className:"row between",children:[h("strong",{children:[y.name,y.origin!=="human"&&h("span",{className:"note",children:[" · ",y.origin==="ai"?"created automatically":"starter"]})]}),l(m2,{groupName:y.name,others:d.filter((g)=>g._id!==y._id),onRename:()=>c({id:y._id,name:y.name}),onMerge:(g)=>void f(r.mergeTagGroups({projectId:e,groupId:y._id,intoGroupId:g}),"Groups merged"),onDelete:()=>void f(r.deleteTagGroup({projectId:e,groupId:y._id}),`Group “${y.name}” deleted; its tags remain`)})]}),l("div",{className:"row wrap",children:u(y._id).length===0?l("span",{className:"note",children:"No tags yet"}):u(y._id).map((g)=>l("span",{className:"tag-chip",children:xo(g.label)},g.key))})]},y._id))}),l("div",{className:"menu-label",children:"Tags"}),p.length===0?l("p",{className:"note",children:"No tags yet. Tags appear as reviewers use them, such as by writing #wording in a comment."}):l("ul",{className:"tag-list",children:p.map((y)=>l(g2,{tag:y,groups:d,onChange:(g,x)=>void f(r.setTagGroups({projectId:e,tag:y.key,groupIds:g,automatic:x}))},y.key))})]})}function f2({projectId:e,notify:t}){let n=se(),r=n.useProject(e),[o,a]=S(""),[i,s]=S(null),[c,f]=S(!1);if(r.status==="loading")return l("p",{className:"note",children:"Loading preset tags…"});if(r.status==="error")return l("p",{className:"error",children:r.message});let p=r.data.tags,d=(b)=>p.findIndex((v)=>lt(v)===b),u=(b,v)=>{let w=tf(b);if(w===null)return"Use 1 to 50 letters, numbers, spaces, - or _, starting with a letter.";let T=p.findIndex((C,E)=>E!==v&<(C)===lt(w));return T===-1?null:`“${p[T]}” is already a preset.`},m=(b,v)=>(f(!0),n.setPresetTags({projectId:e,tags:b,previous:p}).then(()=>(t(v),!0)).catch((w)=>(t(ne(w)),!1)).finally(()=>f(!1))),y=(b,v)=>{let w=d(b);if(w===-1||w+v<0||w+v>=p.length)return;let T=[...p];[T[w],T[w+v]]=[T[w+v],T[w]],m(T,`Moved “${p[w]}” ${v<0?"up":"down"}`)},g=(b)=>{if(b.preventDefault(),u(o,null)!==null)return;m([...p,o],`Preset “${tf(o)}” added`).then((v)=>v&&a(""))},x=o.trim()===""?null:u(o,null),k=p.length>=Qh;return h("section",{className:"settings","aria-label":"Preset tags",children:[l("div",{className:"menu-label",children:"Preset tags"}),l("p",{className:"note",children:"Typing # suggests the tags reviewers used most recently, then these presets that no one has used yet, in this order. Renaming or removing one leaves the threads that already have it as they are; their tag stays in filters, and a group can gather it with the new one."}),p.length===0?l("p",{className:"note",children:"No preset tags. Typing # suggests only tags reviewers have used."}):l("ol",{className:"tag-list preset-list",children:p.map((b,v)=>i?.key===lt(b)?h("li",{children:[h("form",{className:"row",onSubmit:(w)=>{w.preventDefault();let T=d(i.key);if(T===-1||u(i.label,T)!==null)return;let C=p.map((E,A)=>A===T?i.label:E);m(C,`Renamed “${b}” to “${tf(i.label)}”`).then((E)=>E&&s(null))},children:[l("input",{className:"field","aria-label":`New name for ${b}`,value:i.label,autoFocus:!0,"aria-invalid":u(i.label,v)!==null,onChange:(w)=>s({key:i.key,label:w.target.value})}),l("button",{type:"submit",className:"btn small",disabled:c||u(i.label,v)!==null,children:"Save"}),l("button",{type:"button",className:"btn small",onClick:()=>s(null),children:"Cancel"})]}),u(i.label,v)!==null&&i.label.trim()!==""&&l("p",{className:"error",children:u(i.label,v)})]},b):h("li",{className:"row between",children:[l("span",{className:"tag-chip",children:xo(b)}),l(p2,{label:b,disabled:c,first:v===0,last:v===p.length-1,onMove:(w)=>y(lt(b),w),onRename:()=>s({key:lt(b),label:b}),onRemove:()=>void m(p.filter((w)=>lt(w)!==lt(b)),`Preset “${b}” removed; threads keep it`)})]},b))}),h("form",{className:"row",onSubmit:g,children:[l("input",{className:"field","aria-label":"New preset tag",placeholder:k?`Up to ${Qh} preset tags`:"New preset, such as Accessibility",value:o,disabled:k,"aria-invalid":x!==null,onChange:(b)=>a(b.target.value)}),l("button",{type:"submit",className:"btn",disabled:c||k||o.trim()===""||x!==null,children:"Add preset"})]}),x!==null&&l("p",{className:"error",children:x})]})}function p2({label:e,disabled:t,first:n,last:r,onMove:o,onRename:a,onRemove:i}){let s=xn(),c=(f)=>()=>{s.close(),f()};return h(G,{children:[l("button",{type:"button",className:"btn small","aria-haspopup":"menu","aria-label":`Change preset ${e}`,disabled:t,onClick:s.toggle,children:"Change…"}),s.open&&h(kn,{anchor:s.anchor,onClose:s.close,children:[!n&&l(ve,{onSelect:c(()=>o(-1)),children:"Move up"}),!r&&l(ve,{onSelect:c(()=>o(1)),children:"Move down"}),l(ve,{onSelect:c(a),children:"Rename"}),l("hr",{}),l(ve,{danger:!0,onSelect:c(i),children:"Remove preset"})]})]})}function m2({groupName:e,others:t,onRename:n,onMerge:r,onDelete:o}){let a=xn();return h(G,{children:[l("button",{type:"button",className:"btn small","aria-haspopup":"menu","aria-label":`Change group ${e}`,onClick:a.toggle,children:"Change…"}),a.open&&h(kn,{anchor:a.anchor,onClose:a.close,children:[l(ve,{onSelect:()=>{a.close(),n()},children:"Rename"}),t.length>0&&l("div",{className:"menu-label",children:"Merge into"}),t.map((i)=>l(ve,{onSelect:()=>{a.close(),r(i._id)},children:i.name},i._id)),l("hr",{}),l(ve,{danger:!0,onSelect:()=>{a.close(),o()},children:"Delete group"})]})]})}function g2({tag:e,groups:t,onChange:n}){let r=xn(),o=e.groupIds.map((a)=>t.find((i)=>i._id===a)?.name).filter(Boolean);return h("li",{className:"row between",children:[h("span",{className:"grow",children:[l("span",{className:"tag-chip",children:xo(e.label)})," ",h("span",{className:"note",children:[o.length>0?o.join(", "):"No group"," · ",u2[e.grouping]]})]}),l("button",{type:"button",className:"btn small","aria-haspopup":"menu","aria-label":`Groups for ${e.label}`,onClick:r.toggle,children:"Groups…"}),r.open&&h(kn,{anchor:r.anchor,onClose:r.close,children:[h("div",{className:"menu-label",children:["Groups for ",e.label]}),t.length===0&&l("div",{className:"note",style:{padding:"2px 8px 6px"},children:"Create a group first."}),t.map((a)=>l(ve,{checked:e.groupIds.includes(a._id),onSelect:()=>n(e.groupIds.includes(a._id)?e.groupIds.filter((i)=>i!==a._id):[...e.groupIds,a._id]),children:a.name},a._id)),l("hr",{}),l(ve,{onSelect:()=>{r.close(),n([])},children:"No group"}),l(ve,{onSelect:()=>{r.close(),n([],!0)},children:"Let automatic grouping decide"})]})]})}var h2=[{value:"either",label:"Project pays, personal allowed"},{value:"project",label:"Project pays"},{value:"personal",label:"Each person pays"}];function y2(e){let t=(e.deployment.managedModels??[]).map((s)=>s.id),n=e.allowedModels??[],r=t.filter((s)=>n.includes(s)),o=n.length===0?t:r.length>0?r:t.slice(0,1),a=e.managedModel??t[0],i=a!==void 0&&o.includes(a)?a:o[0]??"";return{connection:{...Ff(e),managedModel:i},rule:e.rule??"either",allowed:o}}function vb(e,t,n){return n.filter((r)=>e.includes(r)||r===t)}function b2({projectId:e,notify:t,modelLists:n}){let r=se(),o=r.useAiSettings(e),a=r.useUsage(e),i=r.useProject(e),[s,c]=S(null),[f,p]=S("main"),[d,u]=S(!1),[m,y]=S(null),[g,x]=S(!1),k=O(null),b=O(null),v=O(!1);_(()=>{if(g)k.current?.focus();else if(v.current)b.current?.querySelector(".ds-nav-row")?.focus();v.current=g},[g]);let w=O(null);if(Tn(w,f),o.status==="error")return l("p",{className:"error",children:o.message});if(o.status==="loading")return l("p",{className:"note",children:"Loading…"});let T=s!==null&&s.over===o.data?s.view:o.data,C=y2(T),E=T.deployment.managedModels??null,A=(E??[]).map((H)=>H.id),N=A.length>1,R=T.deployment.managed,q=T.enabled,X=C.connection.mode==="own"&&T.provider!==null,L=R&&C.connection.mode==="managed",F=a.status==="ready"?a.data:null,ce=F?.rows.some((H)=>H.metric==="aiCredits")?"aiCredits":"aiRequests",ue=F?.rows.filter((H)=>H.metric===ce)??[],re=(H)=>{let le=vb(H.allowed,H.connection.managedModel,A),Q=H.connection.enabled&&H.connection.mode==="managed",I=T.allowedModels??[],Y=A.length===1&&I.length>0&&!I.includes(A[0]);return{projectId:e,...Xf(H.connection,T,{withModels:n}),...T.rule===void 0?{}:{rule:H.rule},...Q&&N?{allowedModels:le.length===A.length?[]:le}:{},...Q&&Y?{allowedModels:[A[0]]}:{}}},B=async(H)=>{if(d)return!1;u(!0),y(null);try{let le=await r.saveAiSettings(re(H));return c({view:le,over:o.data}),t(le.status.ready||!le.enabled?"AI settings saved":`AI settings saved. ${le.status.reason}`),!0}catch(le){return y(ne(le)),!1}finally{u(!1)}},W=(H)=>{let le={...C.connection,...H};return B({...C,connection:le,allowed:vb(C.allowed,le.managedModel,A)})},U=(H)=>{y(null),x(!1),p(H)},ie=m!==null&&l("p",{className:"error",role:"alert",children:m});if(f==="key")return l(ep,{view:T,draft:C.connection,busy:d,error:m,clearError:()=>y(null),loadModels:n?(H)=>r.listAiModels(e,H):void 0,onExit:()=>U("main"),onSave:(H)=>void B({...C,connection:H}).then((le)=>le&&p("main"))});if(f==="models"&&E!==null)return h("div",{ref:w,className:"ds-page",children:[l(tt,{title:"Allowed models",onBack:()=>U("main")}),ie,l("div",{className:"ds-group",role:"group","aria-label":"Allowed models",children:E.map((H)=>{let le=H.id===C.connection.managedModel,Q=C.allowed.includes(H.id);return h("label",{className:"ds-row",children:[h("span",{className:"row",children:[l("input",{type:"checkbox",checked:Q,disabled:le,onChange:()=>void B({...C,allowed:vb(Q?C.allowed.filter((I)=>I!==H.id):[...C.allowed,H.id],C.connection.managedModel,A)})}),H.label]}),l("span",{className:"note",children:le?"This project's model":bb(H)})]},H.id)})})]});let V=R?{label:"Use Critiqs AI instead",confirm:"Remove the project's key and use Critiqs AI?",change:{mode:"managed",apiKey:""}}:T.deployment.defaultProvider!==null?{label:"Use this deployment's provider",confirm:"Remove the project's key and use this deployment's provider?",change:{mode:"own",provider:"",baseUrl:"",apiKey:"",model:"",models:[]}}:null,K=(E??[]).find((H)=>H.id===C.connection.managedModel),oe=q&&!T.status.ready&&C.connection.mode==="managed"&&R&&K!==void 0;return h("div",{ref:w,className:"ds-page",children:[l("div",{className:"ds-group",children:l(he,{label:"AI for this project",children:(H)=>l(ko,{checked:q,labelledBy:H,onChange:(le)=>void W({enabled:le,apiKey:""})})})}),q&&!T.status.ready&&h("div",{className:"warning row between",role:"status",children:[l("span",{children:T.status.reason}),oe&&h("button",{type:"button",className:"btn small",disabled:d,onClick:()=>void B(C),children:["Use ",K.label]})]}),ie,q&&h(G,{children:[(X||L||T.rule!==void 0)&&h("div",{className:"ds-group",children:[X?h(G,{children:[l(he,{label:"Model",children:(H)=>l(nt,{value:C.connection.model,options:C.connection.models.map((le)=>({value:le,label:le})),labelledBy:H,onChange:(le)=>void W({model:le})})}),l(Ue,{label:Jf(T.provider),value:T.keyHint===null?void 0:`····${T.keyHint}`,onClick:()=>U("key")})]}):L&&E!==null&&E.length>0&&l(he,{label:"Model",children:(H)=>N?l(nt,{value:C.connection.managedModel,options:Wf(E),labelledBy:H,onChange:(le)=>void W({mode:"managed",managedModel:le})}):l("span",{"aria-labelledby":H,children:E[0].label})}),T.rule!==void 0&&l(he,{label:"Who pays",children:(H)=>l(nt,{value:C.rule,options:h2,labelledBy:H,onChange:(le)=>void B({...C,rule:le})})})]}),L&&F!==null&&l(Zf,{plan:F.plan,rows:ue,upgradeUrl:F.upgradeUrl,organizationId:i.status==="ready"?i.data.organization?.id:void 0,whose:"project"}),(!X||V!==null)&&h("div",{ref:b,className:"ds-group",children:[l("hr",{className:"ds-divider"}),L&&N&&E!==null&&l(Ue,{label:"Allowed models",value:C.allowed.length===A.length?"All":`${C.allowed.length} of ${A.length}`,onClick:()=>U("models")}),!X?h(G,{children:[l(Ue,{label:"Use your own API key",onClick:()=>U("key")}),R&&!L&&l(Ue,{label:"Use Critiqs AI instead",onClick:()=>void W({mode:"managed",apiKey:""})})]}):V!==null&&(g?h("div",{className:"warning stacked",role:"alert",children:[l("span",{children:V.confirm}),h("div",{className:"row end",children:[l("button",{ref:k,type:"button",className:"btn small",disabled:d,onClick:()=>x(!1),children:"Keep key"}),l("button",{type:"button",className:"btn small danger solid",disabled:d,onClick:()=>void W(V.change).then((H)=>H&&x(!1)),children:d?"Removing…":"Remove key"})]})]}):l(Ue,{label:V.label,onClick:()=>x(!0)}))]})]})]})}var TN=[{value:"member",label:"Member"},{value:"admin",label:"Admin"}],np=(e)=>e==="admin"?"Admin":"Member";function v2(e,t){if(t.status==="member")return`${e} is already a member`;if(t.status==="pending")return`${e} is already invited`;if(t.email==="sent")return`Invite sent to ${e}`;if(t.email==="not-sent")return`${e} is invited and joins by signing in to Critiqs with that address`;return`Invited ${e}`}function SN({projectOrganizationId:e,projectId:t,onClose:n,notify:r}){let o=se(),a=o.useMyOrganizations(!0),[i,s]=S(null),[c,f]=S(null),p=a.status==="ready"?a.data:[],d=p.length>1,u=p.find((v)=>v.id===i)?.id??(d?null:p[0]?.id??null),m=o.useOrganization(u),y=u===null?{kind:"list"}:c?.organizationId===u?c.page:{kind:"organization"},g=O(0);_(()=>()=>{g.current++},[]);let x=()=>{g.current++,s(null),f(null)},k=O(null);Tn(k,y.kind==="member"?`member:${y.userId}`:y.kind);let b=(()=>{if(a.status==="error")return l("p",{className:"error",children:a.message});if(a.status==="loading")return l("p",{className:"note",children:"Loading…"});if(p.length===0)return l("p",{className:"note",children:"You aren't in an organization yet. Setting up a project creates one, and invites from others appear here once you accept them by signing in."});if(y.kind==="list"){let v=p.find((T)=>T.id===e),w=v===void 0?p:[v,...p.filter((T)=>T!==v)];return l("div",{className:"ds-group",children:w.map((T)=>l(Ue,{label:T.name,value:np(T.role),onClick:()=>{g.current++,s(T.id)}},T.id))})}if(m.status==="error")return l("p",{className:"error",children:m.message});if(m.status==="loading")return l("p",{className:"note",children:"Loading…"});return null})();if(b!==null||m.status!=="ready")return l(He,{label:"Organization",onClose:n,children:h("div",{ref:k,className:"ds-page",children:[l(tt,{title:y.kind==="list"?"Organizations":"Organization",onBack:y.kind!=="list"&&d?x:void 0,onClose:n}),b]})});return l(He,{label:"Organization",onClose:n,children:l("div",{ref:k,children:l(w2,{organization:m.data,page:y,setPage:(v)=>f({organizationId:m.data.id,page:v}),onBackToList:d?x:void 0,visit:g,onLeft:()=>{if(r(`You left ${m.data.name}`),d)x();else n()},projectId:t,onClose:n,notify:r},m.data.id)})})}function w2({organization:e,page:t,setPage:n,onBackToList:r,visit:o,onLeft:a,projectId:i,onClose:s,notify:c}){let f=se(),p=e.role==="admin",[d,u]=S(!1),[m,y]=S(null),[g,x]=S(!1),k=At(ui),b=(N)=>{o.current++,y(null),x(!1),n(N)},v=()=>{y(null),x(!0)},w=(N,R,q,X)=>{if(d)return;let L=o.current;u(!0),y(null),q().then((F)=>{if(u(!1),o.current===L)X(F)},(F)=>{if(u(!1),o.current===L)y({action:N,target:R,message:ne(F)})})},T=(N,...R)=>m!==null&&m.target===N&&R.includes(m.action)&&l("p",{className:"error",role:"alert",children:m.message}),C=e.members.find((N)=>N.you),E=(N)=>w("leave",N,()=>f.removeMember({organizationId:e.id,userId:C.userId}),a);if(t.kind==="name"&&p)return l(k2,{current:e.name,busy:d,error:T("name","name"),onBack:()=>b({kind:"organization"}),onClose:s,onSave:(N)=>w("name","name",()=>f.renameOrganization(e.id,N),()=>{c("Organization renamed"),b({kind:"organization"})})});if(t.kind==="invite"&&p)return l(x2,{busy:d,error:T("invite","invite"),onBack:()=>b({kind:"organization"}),onClose:s,onSend:(N,R)=>w("invite","invite",()=>f.inviteMember({organizationId:e.id,email:N,role:R,...i===null?{}:{projectId:i}}),(q)=>{c(v2(N.trim(),q)),b({kind:"organization"})})});let A=t.kind==="member"?e.members.find((N)=>N.userId===t.userId):void 0;if(A!==void 0&&p){let N=`member:${A.userId}`;return h("div",{className:"ds-page",children:[l(tt,{title:A.you?`${A.name} (you)`:A.name,onBack:()=>b({kind:"organization"}),onClose:s}),A.email!==null&&l("p",{className:"note",children:A.email}),T(N,"role"),l("div",{className:"ds-group",children:l(he,{label:"Role",children:(R)=>l(nt,{value:A.role,options:TN,labelledBy:R,disabled:d,onChange:(q)=>w("role",N,()=>f.setMemberRole({organizationId:e.id,userId:A.userId,role:q}),()=>c(`${A.you?"You are":`${A.name} is`} now ${q==="admin"?"an admin":"a member"}`))})})}),h("div",{className:"ds-group",children:[l("hr",{className:"ds-divider"}),g?l(xN,{question:A.you?`Leave ${e.name}?`:`Remove ${A.name} from ${e.name}?`,keep:A.you?"Stay":`Keep ${A.name}`,act:A.you?"Leave":"Remove",busy:d,onKeep:()=>x(!1),onAct:()=>A.you?E(N):w("remove",N,()=>f.removeMember({organizationId:e.id,userId:A.userId}),()=>{c(`${A.name} was removed`),b({kind:"organization"})})}):l(Ue,{label:A.you?"Leave organization":"Remove from organization",onClick:v}),T(N,"leave","remove")]})]})}return h("div",{className:"ds-page",children:[l(tt,{title:e.name,onBack:r,onClose:s}),h("div",{className:"ds-group",children:[p?l(Ue,{label:"Name",value:e.name,onClick:()=>b({kind:"name"})}):l(he,{label:"Name",children:(N)=>l("span",{"aria-labelledby":N,children:e.name})}),e.plan!==null&&(k!==null?l(Ue,{label:"Plan",value:e.plan,onClick:()=>k.open(e.id)}):l(he,{label:"Plan",children:(N)=>h("span",{className:"row","aria-labelledby":N,children:[e.plan,l(Kf,{upgradeUrl:e.upgradeUrl,className:"btn small"})]})}))]}),h("div",{className:"ds-group",role:"group","aria-label":"Members",children:[l("h4",{className:"ds-group-label",children:"Members"}),e.members.map((N)=>p?l(Ue,{label:l(kN,{member:N}),value:np(N.role),onClick:()=>b({kind:"member",userId:N.userId})},N.userId):h("div",{className:"ds-row",children:[l(kN,{member:N}),l("span",{className:"note",children:np(N.role)})]},N.userId)),p&&l(Ue,{label:"Invite by email",onClick:()=>b({kind:"invite"})})]}),p&&e.invites.length>0&&h("div",{className:"ds-group",role:"group","aria-label":"Invited",children:[l("h4",{className:"ds-group-label",children:"Invited"}),e.invites.map((N)=>h(su,{children:[h("div",{className:"ds-row",children:[h("span",{className:"ds-row-label stacked",children:[l("span",{className:"ellipsis",children:N.email}),h("span",{className:"note",children:[np(N.role)," · invited by ",N.invitedBy]})]}),l("button",{type:"button",className:"btn small ghost",disabled:d,"aria-label":`Withdraw the invite to ${N.email}`,onClick:()=>w("withdraw",`invite:${N._id}`,()=>f.revokeInvite(N._id),()=>c(`Invite to ${N.email} withdrawn`)),children:"Withdraw"})]}),T(`invite:${N._id}`,"withdraw")]},N._id))]}),!p&&C!==void 0&&h("div",{className:"ds-group",children:[l("hr",{className:"ds-divider"}),g?l(xN,{question:`Leave ${e.name}?`,keep:"Stay",act:"Leave",busy:d,onKeep:()=>x(!1),onAct:()=>E("organization")}):l(Ue,{label:"Leave organization",onClick:v}),T("organization","leave")]})]})}function kN({member:e}){return h("span",{className:"ds-person",children:[l(vt,{name:e.name,imageUrl:e.imageUrl}),h("span",{className:"stacked",children:[h("span",{className:"ellipsis",children:[e.name,e.you&&l("span",{className:"note",children:" (you)"})]}),e.email!==null&&l("span",{className:"note ellipsis",children:e.email})]})]})}function xN({question:e,keep:t,act:n,busy:r,onKeep:o,onAct:a}){let i=O(null);return _(()=>i.current?.focus(),[]),h("div",{className:"warning stacked",role:"alert",children:[l("span",{children:e}),h("div",{className:"row end",children:[l("button",{ref:i,type:"button",className:"btn small",disabled:r,onClick:o,children:t}),l("button",{type:"button",className:"btn small danger solid",disabled:r,onClick:a,children:r?`${n}…`:n})]})]})}function k2({current:e,busy:t,error:n,onBack:r,onClose:o,onSave:a}){let[i,s]=S(e),c=i.trim()===""||i.trim()===e;return h("form",{className:"ds-page",onSubmit:(f)=>{if(f.preventDefault(),!c)a(i)},children:[l(tt,{title:"Organization name",onBack:r,onClose:o}),h("label",{className:"stacked",children:[l("span",{className:"field-label",children:"Name"}),l("input",{className:"field",value:i,maxLength:80,onChange:(f)=>s(f.target.value)})]}),n,l("div",{className:"ds-actions",children:l("button",{type:"submit",className:"btn primary",disabled:t||c,children:t?"Saving…":"Save name"})})]})}function x2({busy:e,error:t,onBack:n,onClose:r,onSend:o}){let[a,i]=S(""),[s,c]=S("member");return h("form",{className:"ds-page",onSubmit:(f)=>{if(f.preventDefault(),a.trim()!=="")o(a,s)},children:[l(tt,{title:"Invite by email",onBack:n,onClose:r}),l("p",{className:"note",children:"They join when they sign in to Critiqs with this address."}),h("label",{className:"stacked",children:[l("span",{className:"field-label",children:"Email"}),l("input",{className:"field",type:"email",autoComplete:"off",placeholder:"name@company.com",value:a,onChange:(f)=>i(f.target.value)})]}),l("div",{className:"ds-group",children:l(he,{label:"Role",children:(f)=>l(nt,{value:s,options:TN,labelledBy:f,onChange:(p)=>c(p)})})}),t,l("div",{className:"ds-actions",children:l("button",{type:"submit",className:"btn primary",disabled:e||a.trim()==="",children:e?"Sending…":"Send invite"})})]})}function CN({onClose:e,notify:t,modelLists:n=!1}){let r=se(),o=r.usePersonalAiSettings(!0),a=r.usePersonalAiUsage(!0),[i,s]=S(null),[c,f]=S("main"),[p,d]=S(!1),[u,m]=S(null),[y,g]=S(!1),x=O(null),k=O(null),b=O(!1);_(()=>{if(y)x.current?.focus();else if(b.current)k.current?.querySelector(".ds-nav-row")?.focus();b.current=y},[y]);let v=O(null);Tn(v,c);let w=(()=>{if(o.status==="error")return l("p",{className:"error",children:o.message});if(o.status==="loading")return l("p",{className:"note",children:"Loading…"});let T=i!==null&&i.over===o.data?i.view:o.data,C=T2(T),E=T.deployment.managed,A=T.deployment.managedModels??[],N=T.mode==="own"&&T.provider!==null,R=a.status==="ready"?a.data:null,q=(re)=>s({view:re,over:o.data}),X=async(re)=>{if(p)return!1;d(!0),m(null);try{let B=await r.savePersonalAiSettings(Xf(re,T,{withModels:n}));return q(B),t(B.status.ready?"Your AI saved":`Your AI saved. ${B.status.reason}`),!0}catch(B){return m(ne(B)),!1}finally{d(!1)}},L=(re)=>{m(null),g(!1),f(re)},F=async()=>{d(!0),m(null);try{q(await r.removePersonalAiSettings()),b.current=!1,g(!1),t(E?"Your key was removed. Critiqs AI is back on.":"Your key was removed."),k.current?.closest('[role="dialog"]')?.focus()}catch(re){m(ne(re))}finally{d(!1)}};if(c==="key")return l(ep,{view:T,draft:C,busy:p,error:u,clearError:()=>m(null),loadModels:n?(re)=>r.listPersonalAiModels(re):void 0,onExit:()=>L("main"),onSave:(re)=>void X(re).then((B)=>B&&f("main"))});let ce=A.find((re)=>re.id===C.managedModel),ue=T.saved&&T.enabled&&!T.status.ready&&T.mode==="managed"&&E&&ce!==void 0;return h("div",{ref:v,className:"ds-page",children:[l(tt,{title:"Your AI",onClose:e}),T.saved&&!T.enabled&&h("div",{className:"warning row between",role:"status",children:[l("span",{children:"Your AI is off."}),l("button",{type:"button",className:"btn small",disabled:p,onClick:()=>void X(C),children:"Turn on"})]}),T.saved&&T.enabled&&!T.status.ready&&h("div",{className:"warning row between",role:"status",children:[l("span",{children:T.status.reason}),ue&&h("button",{type:"button",className:"btn small",disabled:p,onClick:()=>void X(C),children:["Use ",ce.label]})]}),u!==null&&l("p",{className:"error",role:"alert",children:u}),N?h("div",{className:"ds-group",children:[l(he,{label:"Model",children:(re)=>l(nt,{value:C.model,options:C.models.map((B)=>({value:B,label:B})),labelledBy:re,onChange:(B)=>void X({...C,model:B})})}),l(Ue,{label:Jf(T.provider),value:T.keyHint===null?void 0:`····${T.keyHint}`,onClick:()=>L("key")})]}):E&&h("div",{className:"ds-group",children:[l(he,{label:"Model",children:(re)=>A.length>1?l(nt,{value:C.managedModel,options:Wf(A),labelledBy:re,onChange:(B)=>void X({...C,mode:"managed",managedModel:B})}):l("span",{"aria-labelledby":re,children:A[0]?.label??"Critiqs AI"})}),R!==null&&l(Zf,{plan:R.plan,rows:R.rows,upgradeUrl:R.upgradeUrl,organizationId:R.organizationId,whose:"person"})]}),h("div",{ref:k,className:"ds-group",children:[(N||E)&&l("hr",{className:"ds-divider"}),!N?l(Ue,{label:"Use your own API key",onClick:()=>L("key")}):y?h("div",{className:"warning stacked",role:"alert",children:[l("span",{children:E?"Remove your key and use Critiqs AI?":"Remove your key?"}),h("div",{className:"row end",children:[l("button",{ref:x,type:"button",className:"btn small",disabled:p,onClick:()=>g(!1),children:"Keep key"}),l("button",{type:"button",className:"btn small danger solid",disabled:p,onClick:()=>void F(),children:p?"Removing…":"Remove key"})]})]}):l(Ue,{label:E?"Use Critiqs AI instead":"Remove key",onClick:()=>g(!0)})]})]})})();return l(He,{label:"Your AI",onClose:e,children:o.status==="ready"?w:h("div",{className:"ds-page",children:[l(tt,{title:"Your AI",onClose:e}),w]})})}function T2(e){return{...Ff(e),enabled:!0}}var EN={linear:"https://linear.app/settings/account/security",github:"https://github.com/settings/personal-access-tokens/new"},AN=(e)=>e==="jira",NN=(e)=>e==="jira",S2={github:{field:"Personal access token",instead:"Use a personal access token instead",help:"Create a fine-grained personal access token for the repositories you want, with read and write access to Issues and read access to Contents, then paste it here.",settings:"Open GitHub token settings"},jira:{field:"API token",instead:"Use an API token instead",help:"Create an API token in your Atlassian account's security settings, then paste it here with your Jira site and the email you sign in to Atlassian with.",settings:"Open Atlassian settings"}};function rp(e){let t=an(e);return S2[e]??{field:"API key",instead:"Use an API key instead",help:`Create a personal API key in ${t}'s settings, then paste it here.`,settings:`Open ${t} settings`}}var an=(e)=>vn.find((t)=>t.id===e)?.label??e,wb={github:"GitHub"};function C2(e,t,n){let r=an(e);if(n==="kept"&&t==="oauth")return{text:`Critiqs removed its webhooks from ${r}, but Atlassian offers no way for Critiqs to end its sign-in: it works until it expires, or until you remove Critiqs from your Atlassian account's connected apps.`,alert:!1};if(n==="kept"){let o=rp(e).field,a=/^[A-Z][a-z]/.test(o)?o[0].toLowerCase()+o.slice(1):o,i=o.split(" ").at(-1);return{text:`Critiqs no longer has your ${r} ${a}, but the ${i} still works in ${r} until you delete it there.`,alert:!1}}if(n==="shared")return{text:`${r} is disconnected here. Another Critiqs account is still connected to the same ${wb[e]??r} account, which shares Critiqs's access at ${wb[e]??r}, so that access stays until it disconnects too, or you remove Critiqs in ${wb[e]??r}'s settings.`,alert:!1};if(n==="failed")return{text:`${r} is disconnected here, but Critiqs couldn't tell ${r} to end its access, so Critiqs can still reach your ${r} account. Critiqs will try again for about an hour; to end it now, remove Critiqs in ${r}'s settings.`,alert:!0};return null}var RN="critiqs-tracker-sign-in",E2=5000;function N2(e,t){try{return new URL(e).origin===t}catch{return!1}}function A2(e,t){let n=document.createElement("form");n.method="POST",n.action=e.url,n.target=RN,n.hidden=!0;for(let[r,o]of[["state",e.state],["binding",e.binding]]){let a=document.createElement("input");a.type="hidden",a.name=r,a.value=o,n.append(a)}t.append(n);try{n.submit()}finally{n.remove()}}function MN({offered:e,onClose:t,notify:n}){let r=se().tickets,o=r.useTrackerAccounts(!0),[a,i]=S({kind:"main"}),[s,c]=S(!1),[f,p]=S(null),[d,u]=S(null),[m,y]=S(null),[g,x]=S(null),k=O(null);Tn(k,a.kind);let b=O(null);_(()=>()=>b.current?.(),[]);let v=o.status==="ready"?o.data:[],w=m!==null&&v.some((N)=>N.tracker===m);_(()=>{if(!w)return;n(`${an(m)} connected`),y(null)},[w]);let T=async(N)=>{if(s)return!1;c(!0),p(null),u(null);try{return await N(),!0}catch(R){return p(ne(R)),!1}finally{c(!1)}},C=(N,R)=>{let q=window.open("",RN,"popup,width=520,height=720");if(q===null)return p("Your browser blocked the sign-in window. Allow pop-ups for this site and try again."),Promise.resolve(!1);return T(async()=>{try{let X=await r.startTrackerSignIn(N,R);E(N,q,X.url),A2(X,k.current??document.body),y(N)}catch(X){throw q.close(),X}})},E=(N,R,q)=>{b.current?.();let X=new URL(q).origin,L=(ue)=>{if(ue.effectiveDirective!=="form-action"||ue.disposition!=="enforce"||!N2(ue.blockedURI,X))return;ce(),R.close(),y(null),p(NN(N)?`This page doesn't allow the ${an(N)} sign-in window. Connect ${an(N)} from Your trackers on Critiqs's website instead.`:`This page doesn't allow the ${an(N)} sign-in window. ${rp(N).instead}.`)},F=setTimeout(()=>ce(),E2),ce=()=>{clearTimeout(F),document.removeEventListener("securitypolicyviolation",L),b.current=null};document.addEventListener("securitypolicyviolation",L),b.current=ce},A=(N)=>{p(null),x(null),i(N)};if(a.kind==="site")return l(He,{label:"Your trackers",onClose:t,children:l(I2,{tracker:a.tracker,busy:s,onBack:()=>A({kind:"main"}),error:f,onSignIn:(N)=>{C(a.tracker,N).then((R)=>R&&i({kind:"main"}))}})});if(a.kind==="token")return l(He,{label:"Your trackers",onClose:t,children:l(M2,{tracker:a.tracker,tickets:r,onBack:()=>A({kind:"main"}),onConnected:(N)=>{n(`${an(N.tracker)} connected`),A({kind:"main"})}})});return l(He,{label:"Your trackers",onClose:t,children:h("div",{ref:k,className:"ds-page",children:[l(tt,{title:"Your trackers",onClose:t}),o.status==="error"&&l("p",{className:"error",children:o.message}),o.status==="loading"&&l("p",{className:"note",children:"Loading…"}),f!==null&&l("p",{className:"error",role:"alert",children:f}),d!==null&&l("p",{className:d.alert?"error":"note",role:d.alert?"alert":"status",children:d.text}),m!==null&&h("p",{className:"note",role:"status",children:["Finish connecting in the ",an(m)," window."]}),o.status==="ready"&&e.trackers.map(({id:N,signIn:R,installUrl:q})=>{let X=v.find((L)=>L.tracker===N);return h("div",{className:"ds-group",role:"group","aria-label":an(N),children:[l("h4",{className:"ds-group-label",children:an(N)}),X===void 0?h(G,{children:[l(Ue,{label:`Connect ${an(N)}`,disabled:s,onClick:()=>R!=="oauth"?A({kind:"token",tracker:N}):AN(N)?A({kind:"site",tracker:N}):void C(N)}),R==="oauth"&&!NN(N)&&l("div",{className:"row",children:l("button",{type:"button",className:"link-btn",disabled:s,onClick:()=>A({kind:"token",tracker:N}),children:rp(N).instead})})]}):l(R2,{account:X,installUrl:X.method==="oauth"?q??null:null,busy:s,confirming:g===N,onConfirm:(L)=>x(L?N:null),onAttribution:(L)=>void T(()=>r.setTrackerAttribution(N,L)).then((F)=>F&&n(L?"New tickets say they came from Critiqs":"New tickets won't say they came from Critiqs")),onDisconnect:()=>{let L="none";T(async()=>{L=await r.disconnectTracker(N)}).then((F)=>{if(!F)return;x(null),u(C2(N,X.method,L)),n(`${an(N)} disconnected`),k.current?.closest('[role="dialog"]')?.focus()})}})]},N)})]})})}function R2({account:e,installUrl:t,busy:n,confirming:r,onConfirm:o,onAttribution:a,onDisconnect:i}){let s=O(null);_(()=>{if(r)s.current?.focus()},[r]);let c=an(e.tracker);return h(G,{children:[l("div",{className:"ds-row",children:h("span",{className:"ds-row-label stacked",children:[l("span",{className:"ellipsis",children:e.accountName}),e.site!==null&&l("span",{className:"note ellipsis",children:e.site})]})}),t!==null&&l("div",{className:"row",children:l("a",{className:"link-btn",href:t,target:"_blank",rel:"noreferrer noopener",children:"Choose repositories in GitHub"})}),l(he,{label:"Created from Critiqs",children:(f)=>l(ko,{checked:e.attribution,labelledBy:f,disabled:n,onChange:a})}),r?h("div",{className:"warning stacked",role:"alert",children:[h("span",{children:["Disconnect ",c,"? Tickets already linked keep their links."]}),e.tracker==="github"&&e.method==="oauth"&&h("span",{children:["At GitHub, this ends Critiqs's access to the GitHub account ",e.accountName,", unless another Critiqs account is connected to it: GitHub gives Critiqs one access per GitHub account, so it stays until the last Critiqs account connected to it disconnects."]}),h("div",{className:"row end",children:[h("button",{ref:s,type:"button",className:"btn small",disabled:n,onClick:()=>o(!1),children:["Keep ",c]}),l("button",{type:"button",className:"btn small danger solid",disabled:n,onClick:i,children:n?"Disconnecting…":"Disconnect"})]})]}):l(Ue,{label:"Disconnect",onClick:()=>o(!0)})]})}function M2({tracker:e,tickets:t,onBack:n,onConnected:r}){let[o,a]=S(""),[i,s]=S(""),[c,f]=S(""),p=AN(e),d=o.trim()!==""&&(!p||i.trim()!==""&&c.trim()!==""),[u,m]=S(!1),[y,g]=S(null),x=O(null);Tn(x,e,{initial:!0});let k=an(e),b=rp(e),v=async()=>{if(u||!d)return;m(!0),g(null);try{r(await(p?t.connectTrackerWithToken(e,o,{email:c,site:i}):t.connectTrackerWithToken(e,o)))}catch(w){g(ne(w)),m(!1)}};return l("div",{ref:x,children:h("form",{className:"ds-page",onSubmit:(w)=>{w.preventDefault(),v()},children:[l(tt,{title:`Connect ${k}`,onBack:n}),l("p",{className:"note",children:b.help}),p&&h(G,{children:[h("label",{className:"stacked",children:[l("span",{className:"field-label",children:"Jira site"}),l("input",{className:"field",autoComplete:"url",value:i,placeholder:"your-team.atlassian.net",onChange:(w)=>s(w.target.value)})]}),h("label",{className:"stacked",children:[l("span",{className:"field-label",children:"Atlassian email"}),l("input",{className:"field",type:"email",autoComplete:"email",value:c,placeholder:"you@example.com",onChange:(w)=>f(w.target.value)})]})]}),h("label",{className:"stacked",children:[l("span",{className:"field-label",children:b.field}),l("input",{className:"field",type:"password",autoComplete:"off",value:o,placeholder:`Paste the ${b.field==="API key"?"key":"token"}`,onChange:(w)=>a(w.target.value)})]}),y!==null&&l("p",{className:"error",role:"alert",children:y}),h("div",{className:"ds-actions between",children:[EN[e]!==void 0?l("a",{className:"link-btn",href:EN[e],target:"_blank",rel:"noreferrer noopener",children:b.settings}):l("span",{}),l("button",{type:"submit",className:"btn primary",disabled:u||!d,children:u?"Connecting…":"Connect"})]})]})})}function I2({tracker:e,busy:t,error:n,onBack:r,onSignIn:o}){let[a,i]=S(""),s=O(null);return Tn(s,e,{initial:!0}),l("div",{ref:s,children:h("form",{className:"ds-page",onSubmit:(c)=>{if(c.preventDefault(),!t&&a.trim()!=="")o(a.trim())},children:[l(tt,{title:`Connect ${an(e)}`,onBack:r}),l("p",{className:"note",children:"Enter your Jira site's address, then sign in with Atlassian and allow Critiqs. If Atlassian asks which site to use, choose this one."}),h("label",{className:"stacked",children:[l("span",{className:"field-label",children:"Jira site"}),l("input",{className:"field",autoComplete:"url",value:a,placeholder:"your-team.atlassian.net",onChange:(c)=>i(c.target.value)})]}),n!==null&&l("p",{className:"error",role:"alert",children:n}),l("div",{className:"ds-actions end",children:l("button",{type:"submit",className:"btn primary",disabled:t||a.trim()==="",children:"Sign in with Atlassian"})})]})})}var IN={"current-view":"In this view","other-view":"Other views on this screen","other-screen":"Other screens"},O2={status:"all",unreadOnly:!1,tags:[],groups:[],screens:"all"};function op(e,t){return(e?.tags??[]).filter((n)=>n.groupIds.includes(t)).map((n)=>n.label)}function ON({threads:e,currentScreen:t,filters:n,defaultFilters:r,onFilters:o,selectedId:a,onSelect:i,selecting:s,checked:c,onCheck:f,onStartCommenting:p,commenting:d,tags:u,onTag:m}){let y=Ee(()=>new Map(e.map((w)=>[w.summary._id,w])),[e]),g=Ee(()=>e.map((w)=>({id:w.summary._id,status:w.summary.status,screen:w.location.screen,tags:w.summary.tags,lastActivityAt:w.summary.lastMessageAt,unread:w.summary.unread,hasTicket:(w.summary.tickets?.length??0)>0})),[e]),x=Ee(()=>({currentScreen:t,isLive:(w)=>y.get(w)?.located?.status==="found"}),[y,t]),k=dS(g,x,fS(n,(w)=>op(u,w))),b=k.reduce((w,T)=>w+T.threads.length,0),v=e.length-b;return h(G,{children:[l(P2,{filters:n,defaultFilters:r,hidden:v,onFilters:o,tags:u}),b===0?l(D2,{total:e.length,filters:n,onClear:()=>o(O2),onShowAll:()=>o({...n,unreadOnly:!1}),onStartCommenting:p,commenting:d}):k.map((w)=>h("section",{"aria-label":IN[w.placement],children:[l("div",{className:"group-title",children:IN[w.placement]}),w.threads.map((T)=>l(_2,{thread:y.get(T.id),selected:T.id===a,selecting:s,checked:c.has(T.id),onCheck:(C)=>f(T.id,C),onSelect:()=>i(T.id),onTag:m},T.id))]},w.placement))]})}function _2({thread:e,selected:t,selecting:n,checked:r,onCheck:o,onSelect:a,onTag:i}){let{summary:s}=e,c=s.preview?.authorName??"Unknown",f=s.messageCount-1,p=bc(e),d=["entry",s.unread&&"unread",t&&"selected"].filter(Boolean).join(" "),u=h(G,{children:[l(vt,{name:c,imageUrl:s.preview?.authorImageUrl}),h("span",{className:"grow",children:[h("span",{className:"meta",children:[l("span",{className:"author",children:c}),l("span",{className:"time",title:new Date(s.lastMessageAt).toLocaleString(),children:Bn(s.lastMessageAt)})]}),l("span",{className:"excerpt",children:s.preview?.body??""}),h("span",{className:"details",children:[f>0&&l("span",{children:f===1?"1 reply":`${f} replies`}),s.status==="resolved"&&l("span",{className:"resolved-tag",children:"Resolved"}),p!=="live"&&l("span",{className:"status-tag",children:hf(e)}),l(AE,{tickets:s.tickets}),s.tags.map((m)=>l("span",{className:"tag-chip clickable",title:`Show threads tagged ${m}`,onClick:(y)=>{y.preventDefault(),y.stopPropagation(),i(m)},children:xo(m)},m))]})]}),s.unread&&l("span",{className:"unread-dot","aria-label":"Unread"})]});if(n)return h("label",{className:d,children:[l("input",{type:"checkbox",checked:r,onChange:(m)=>o(m.target.checked)}),u]});return l("button",{type:"button",className:d,onClick:a,"aria-current":t||void 0,children:u})}function P2({filters:e,defaultFilters:t,hidden:n,onFilters:r,tags:o}){let a=(e.groups??[]).map((c)=>{let f=o?.groups.find((d)=>d._id===c)?.name??"Group",p=op(o,c);return`${f} (${p.length===0?"no tags yet":p.join(", ")})`}),i=[{open:"Open",resolved:"Resolved",all:"Open and resolved"}[e.status],e.screens==="current"?"this screen":"all screens",e.unreadOnly&&"unread",e.hasTicket===!0&&"has ticket",e.tags.length>0&&e.tags.join(", "),...a].filter(Boolean),s=e.status===t.status&&e.screens===t.screens&&e.unreadOnly===t.unreadOnly&&e.hasTicket===!0===(t.hasTicket===!0)&&e.tags.length===0&&(e.groups??[]).length===0;return h("div",{className:"filter-summary",children:[l("span",{children:i.join(" · ")}),n>0&&h("span",{children:["· ",n," hidden by filters"]}),!s&&l("button",{type:"button",className:"link-btn",onClick:()=>r(t),children:"Reset"})]})}function _N({filters:e,tags:t,groups:n,onFilters:r,tickets:o=!1}){let a=xn(),i=(s)=>r({...e,...s});return h(G,{children:[l("button",{type:"button",className:"icon-btn",title:"Filter and sort","aria-label":"Filter","aria-haspopup":"menu","aria-pressed":a.open,onClick:a.toggle,children:l(zC,{})}),a.open&&h(kn,{anchor:a.anchor,onClose:a.close,children:[l("div",{className:"menu-label",children:"Status"}),l(ve,{checked:e.status==="open",onSelect:()=>i({status:"open"}),children:"Open"}),l(ve,{checked:e.status==="resolved",onSelect:()=>i({status:"resolved"}),children:"Resolved"}),l(ve,{checked:e.status==="all",onSelect:()=>i({status:"all"}),children:"Open and resolved"}),l("hr",{}),l("div",{className:"menu-label",children:"Show"}),l(ve,{checked:e.unreadOnly,onSelect:()=>i({unreadOnly:!e.unreadOnly}),children:"Unread only"}),o&&l(ve,{checked:e.hasTicket===!0,onSelect:()=>i({hasTicket:e.hasTicket!==!0}),children:"Has ticket"}),l(ve,{checked:e.screens==="current",onSelect:()=>i({screens:"current"}),children:"This screen"}),l(ve,{checked:e.screens==="all",onSelect:()=>i({screens:"all"}),children:"All screens"}),n.length>0&&h(G,{children:[l("hr",{}),l("div",{className:"menu-label",children:"Tag groups"}),n.map((s)=>{let c=(e.groups??[]).includes(s._id);return l(ve,{checked:c,onSelect:()=>i({groups:c?(e.groups??[]).filter((f)=>f!==s._id):[...e.groups??[],s._id]}),children:h("span",{className:"grow",children:[s.name,h("span",{className:"note",children:[" ",s.members.length===0?"no tags yet":s.members.join(", ")]})]})},s._id)})]}),t.length>0&&h(G,{children:[l("hr",{}),l("div",{className:"menu-label",children:"Tags"}),l("div",{className:"menu-scroll",children:t.map((s)=>{let c=e.tags.some((f)=>lt(f)===lt(s));return l(ve,{checked:c,onSelect:()=>i({tags:c?e.tags.filter((f)=>lt(f)!==lt(s)):[...e.tags,s]}),children:s},s)})})]}),l("hr",{}),l("div",{className:"menu-label",children:"Sort"}),l("div",{className:"note",style:{padding:"2px 8px 6px"},children:"Newest activity first in each group"})]})]})}function D2({total:e,filters:t,onClear:n,onShowAll:r,onStartCommenting:o,commenting:a}){if(e===0)return h("div",{className:"empty",children:[l("strong",{children:"No comments yet"}),a?l("span",{children:"Select an element in the prototype to leave feedback."}):h(G,{children:[l("span",{children:"Switch to Comment mode and select an element to leave feedback."}),l("button",{type:"button",className:"btn primary",onClick:o,children:"Start commenting"})]})]});if(t.hasTicket===!0&&t.tags.length===0&&(t.groups??[]).length===0&&!t.unreadOnly)return h("div",{className:"empty",children:[l("strong",{children:"No threads with tickets"}),l("span",{children:"Create or link a ticket from a thread's More actions menu."}),l("button",{type:"button",className:"btn",onClick:n,children:"Clear filters"})]});if(t.unreadOnly)return h("div",{className:"empty",children:[l("strong",{children:"No unread threads"}),l("span",{children:"You're all caught up."}),l("button",{type:"button",className:"btn",onClick:r,children:"Show read threads"})]});return h("div",{className:"empty",children:[l("strong",{children:"No threads match these filters"}),h("span",{children:[e===1?"1 thread is":`${e} threads are`," hidden."]}),l("button",{type:"button",className:"btn",onClick:n,children:"Clear filters"})]})}var PN=20,DN=61000,L2=3,LN=(e)=>e.length>60?`${e.slice(0,59)}…`:e||"(empty comment)";function qN({projectId:e,personId:t,threads:n,accounts:r,drafting:o=!1,onClose:a,onDone:i}){let s=se().tickets,[c]=S(n),[f,p]=S(r[0].tracker),d=r.find((ee)=>ee.tracker===f)??r[0],[u,m]=Jy(f,d.attribution),[y,g]=S({tracker:f,loaded:{status:"loading"}}),[x,k]=jn(`critiqs:ticket-destination:${e}:${t}:${f}`,null),[b,v]=S(null),[w,T]=S(null),[C,E]=S(null),[A,N]=S({}),[R,q]=S(!1),X=O(new Map),[L,F]=S(null),[ce,ue]=S(!1),re=O({timer:null,count:0}),B=()=>{if(re.current.timer!==null)clearTimeout(re.current.timer);re.current.timer=null,F(null)};_(()=>()=>{if(re.current.timer!==null)clearTimeout(re.current.timer)},[]);let W=c.filter((ee)=>ee.tickets.length===0),U=W.length>PN;_(()=>{let ee=!1;g({tracker:f,loaded:{status:"loading"}}),s.listTicketDestinations(f).then((Fe)=>!ee&&g({tracker:f,loaded:{status:"ready",data:Fe}}),(Fe)=>!ee&&g({tracker:f,loaded:{status:"error",message:zn(Fe).message}}));let xe=W[0];if(xe===void 0)v({tracker:f,id:null});else s.ticketDraft(xe.id,f).then((Fe)=>!ee&&v({tracker:f,id:Fe.projectDestinationId??null}),()=>!ee&&v({tracker:f,id:null}));return()=>{ee=!0}},[s,f]);let ie=y.tracker===f?y.loaded:{status:"loading"},V=ie.status==="ready"?ie.data:[],K=b?.tracker===f?b.id:void 0,oe=V.find((ee)=>ee.id===w)??V.find((ee)=>ee.id===x)??(K===void 0?null:V.find((ee)=>ee.id===K)??V[0]??null),H=oe?.id??null;_(()=>{if(E(null),!o||H===null||W[0]===void 0)return;let ee=!1;return s.ticketDraftOptions(W[0].id,f,H).then((xe)=>!ee&&E({destinationId:H,fields:[...(xe.fields??[]).map((Fe)=>Fe.name),...xe.unsupportedFields??[]]}),()=>!ee&&E({destinationId:H,fields:[]})),()=>{ee=!0}},[s,o,f,H]);let le=C?.destinationId===H?C.fields:null,Q=!o||le!==null,I=(ee,xe)=>N((Fe)=>({...Fe,[ee]:xe})),Y=async(ee,xe=!1)=>{if(oe===null||R)return;if(B(),!xe)re.current.count=0;ue(!1),q(!0);for(let Qe of ee)I(Qe.id,{state:"waiting"});let Fe=0,qt=null,Ut=[];for(let Qe of ee){if(qt!==null){Ut.push(Qe);continue}I(Qe.id,{state:"creating"});try{let it=await s.ticketDraft(Qe.id,f),pt=it.resumeSubmissionId??X.current.get(Qe.id)??crypto.randomUUID();X.current.set(Qe.id,pt);let or=await s.createTicket({threadId:Qe.id,submissionId:pt,tracker:f,destinationId:oe.id,title:it.title,body:it.body,createdFromCritiqs:u});I(Qe.id,{state:"created",ticket:or}),Fe++}catch(it){let{code:pt,message:or}=zn(it);if(pt==="limit")qt=or,Ut.push(Qe);else I(Qe.id,{state:"failed",reason:or})}}k(oe.id);let hr=qt!==null&&re.current.count<L2;if(hr){for(let Qe of Ut)I(Qe.id,{state:"paused"});re.current.count++,F(Date.now()+DN),re.current.timer=setTimeout(()=>{re.current.timer=null,Y(Ut,!0)},DN)}else if(qt!==null){ue(!0);for(let Qe of Ut)I(Qe.id,{state:"failed",reason:qt})}if(q(!1),!hr)i(Fe,ee.length-Fe)},Z=Object.keys(A).length>0,J=W.filter((ee)=>A[ee.id]?.state==="failed"),fe=W.filter((ee)=>A[ee.id]?.state==="paused"),rt=W.filter((ee)=>A[ee.id]?.state==="created").length,Ve=W.filter((ee)=>A[ee.id]?.state==="created"||A[ee.id]?.state==="failed").length,Pe=!R&&!Z&&oe!==null&&!U&&W.length>0&&Q&&(le??[]).length===0,Se=qs[f];return l(He,{label:"Create tickets",onClose:R?()=>{return}:a,children:h("div",{className:"ds-page ticket-dialog",children:[l(tt,{title:"Create tickets",onClose:R?()=>{return}:a}),h("p",{className:"note",children:["One ticket per thread in ",$n(f),", each filled from its thread as Create ticket fills it. Threads that already have a ticket are skipped."]}),h("div",{className:"ds-group",children:[l(_f,{accounts:r,value:f,disabled:R||Z,onChange:(ee)=>{p(ee),T(null)}}),l(he,{label:Se,children:(ee)=>ie.status==="error"?l("span",{className:"error",children:ie.message}):l(nt,{value:oe?.id??"",labelledBy:ee,disabled:R||Z||ie.status==="loading"||V.length===0,options:V.map((xe)=>({value:xe.id,label:xe.name,...xe.key===null?{}:{detail:xe.key}})),onChange:T})})]}),h("label",{className:"ticket-check",children:[l("input",{type:"checkbox",checked:u,disabled:R||Z,onChange:(ee)=>m(ee.target.checked)}),"Created from Critiqs"]}),U&&h("p",{className:"warning",role:"alert",children:["Create tickets works on up to ",PN," threads at a time; ",W.length," are selected without a ticket. Select fewer."]}),le!==null&&le.length>0&&h("p",{className:"warning",role:"alert",children:["This ",Se.toLowerCase()," needs ",le.join(", ")," on each ticket. Choose another, or create these tickets one at a time."]}),l("ol",{className:"bulk-tickets","aria-label":"Threads",children:c.map((ee)=>{let xe=ee.tickets.length>0?{state:"skipped",reason:`Has ${ee.tickets.map((Fe)=>Fe.key).join(", ")}`}:A[ee.id]??{state:"waiting"};return h("li",{className:`bulk-ticket ${xe.state}`,children:[l("span",{className:"grow ellipsis",children:LN(ee.title)}),l("span",{className:"bulk-state",children:xe.state==="waiting"?Z?"Waiting":"":xe.state==="creating"?"Creating…":xe.state==="paused"?"Waiting for the limit of tickets a minute":xe.state==="created"?`Created ${da(xe.ticket)}`:xe.state==="skipped"?`Skipped: ${xe.reason}`:`Not created: ${xe.reason}`})]},ee.id)})}),l("p",{className:"note",role:"status","aria-live":"polite",children:R?`Creating ${Math.min(Ve+1,W.length)} of ${W.length}…`:Z?J.length===0&&fe.length===0?`Created ${rt} ${rt===1?"ticket":"tickets"}.`:[`Created ${rt} of ${W.length}.`,...fe.length>0&&L!==null?[`Paused at the limit of tickets a minute: ${fe.length} more continue on their own at ${new Date(L).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",second:"2-digit"})} while this stays open.`]:[],...ce?["The limit of tickets a minute was reached again: press Try again in a minute."]:[],...J.length>0?[`${J.length===1?"1 thread has":`${J.length} threads have`} no ticket: ${J.map((ee)=>`“${LN(ee.title)}”`).join(", ")}.`]:[]].join(" "):W.length===0?"Every selected thread already has a ticket.":`Creates ${W.length} ${W.length===1?"ticket":"tickets"}${oe===null?"":` in ${oe.name}`}.`}),h("div",{className:"ds-actions",children:[Z&&!R&&J.length>0&&l("button",{type:"button",className:"btn",onClick:()=>void Y([...J,...fe]),children:"Try again"}),Z?l("button",{type:"button",className:"btn primary",disabled:R,onClick:a,children:"Done"}):h("button",{type:"button",className:"btn primary",disabled:!Pe,onClick:()=>void Y(W),children:["Create ",W.length===1?"ticket":"tickets"]})]})]})})}function zN(e){let t=se().useThread(e.threadId);if(t.status==="loading")return h(G,{children:[l(ap,{onClose:e.onClose,title:"Comment"}),l("div",{className:"empty",children:"Loading…"})]});if(t.status==="error"||t.data.projectId!==e.projectId){let r=t.status==="ready"?"This comment belongs to another Critiqs project.":t.code==="unavailable"?"This thread was deleted.":t.code==="not-found"?"This comment does not exist. It may belong to another project or backend.":t.message;return h(G,{children:[l(ap,{onClose:e.onClose,title:"Comment unavailable"}),h("div",{className:"empty",children:[l("strong",{children:"Can't open this comment"}),l("span",{children:r}),l("button",{type:"button",className:"btn",onClick:e.onClose,children:"Close"})]})]})}let n=t.data.mockup;if(n!==void 0&&e.onOpenMockup!==void 0)return l(q2,{mockupId:n.mockupId,threadId:t.data._id,onOpen:e.onOpenMockup,onClose:e.onClose});return l(z2,{...e,thread:t.data})}function q2({mockupId:e,threadId:t,onOpen:n,onClose:r}){return _(()=>n(e,t),[e,t]),h(G,{children:[l(ap,{onClose:r,title:"Mockup thread"}),l("div",{className:"empty",children:"Opening its mockup…"})]})}function U2({threadId:e,onOpen:t}){let n=se().mockups?.useMockupsForThread(e);if(n?.status!=="ready"||n.data.length===0)return null;return l("div",{className:"linked-mockups row wrap",children:n.data.map((r)=>h("button",{type:"button",className:"btn small",onClick:()=>t(r._id,null),children:["Open mockup: ",r.title]},r._id))})}function ap({onClose:e,title:t,children:n}){return h("div",{className:"window-header",children:[l("h2",{children:t}),n,l("button",{type:"button",className:"icon-btn","aria-label":"Close comment",title:"Close",onClick:e,children:l(wn,{})})]})}function z2(e){let{thread:t}=e,n=t._id,r=se(),{setStatus:o,remove:a,markRead:i,markUnread:s}=r,c=xn(),f=O(null),[p,d]=S(!1),u=t.mockup===void 0?e.tickets:void 0,m=r.tickets?.useTrackerAccounts(u!==void 0),y=u!==void 0&&m?.status==="ready"?Of(u.offered,m.data):[],[g,x]=S(null),k=(U)=>{if(c.close(),y.length===0)u?.onYourTrackers();else x(U)},b=m?.status==="ready"||m?.status==="error";_(()=>{if(e.startCreateTicket!==!0||!b)return;if(e.onCreateTicketStarted?.(),u!==void 0)k("create")},[e.startCreateTicket,b]);let v=async(U)=>{try{await r.tickets?.addTicketLinkBack(U._id),e.notify(`Added the link back to ${U.key}`)}catch(ie){e.notify(ne(ie))}},w=(U)=>{r.tickets?.unlinkTicket(U._id).then(()=>e.notify(`Unlinked ${U.key}`),(ie)=>e.notify(ne(ie)))},T=e.ticketStatus===!0&&(t.tickets?.length??0)>0;_(()=>{if(T)r.tickets?.checkTicketStatus(n).catch(()=>{return})},[T,n,r]);let{draft:C,sending:E,error:A}=e.reply,N=O(null);if(N.current?.threadId!==n){let U=t.readState,ie=U!==null&&U.lastReadAt<t.lastMessageAt?U.lastReadAt:null;N.current={threadId:n,after:ie}}let R=O(null),q=$2(R,t.messages.length),X=jr();_(()=>{if(q===null||X)return;let U=t.readState;if(U!==null&&!U.manualUnread&&U.lastReadAt>=q)return;i({threadId:n,seenThrough:q}).catch(()=>{return})},[n,q,t.readState,i,X]);let L=O(!1);_(()=>{if(L.current)return;if(L.current=!0,e.focusMessageId===null)jN(R.current?.querySelector(".new-divider")??null,"start")},[e.focusMessageId]);let F=async(U)=>{try{if(await o({threadId:n,status:U}),U==="resolved")e.notify("Thread resolved",{label:"Undo",run:()=>void o({threadId:n,status:"open"})})}catch(ie){e.notify(ne(ie))}},ce=()=>{if(C.text.trim()!==""&&!E)e.onSend()},ue=async(U)=>{let ie=U===null?e.shareLink(t.anchor.evidence.url):e.linkFor(t.anchor.evidence.url,U),V;try{V=await ca(ie)}catch(K){e.notify(ne(K));return}if(!V)e.notify(`Couldn't copy the link. Here it is: ${await ie}`);else e.notify(U===null?"Link to thread copied":"Link to reply copied")},re=t.messages[0]?.revision??null,B=N.current.after,W=B===null?null:t.messages.find((U)=>U.createdAt>B)?._id;return h(G,{children:[h(ap,{onClose:e.onClose,title:t.status==="resolved"?"Resolved comment":"Comment",children:[t.status==="open"?h("button",{type:"button",className:"btn small",title:"Resolve thread",onClick:()=>F("resolved"),children:[l(jC,{})," Resolve"]}):l("button",{type:"button",className:"btn small",onClick:()=>F("open"),children:"Reopen"}),l("button",{ref:f,type:"button",className:"icon-btn","aria-label":"More actions","aria-haspopup":"menu",onClick:c.toggle,children:l(Py,{})}),c.open&&h(kn,{anchor:c.anchor,onClose:c.close,children:[l(ve,{onSelect:()=>{c.close(),ue(null)},children:"Copy link"}),l(ve,{onSelect:()=>{c.close(),e.onClose(),s(n).catch((U)=>e.notify(ne(U)))},children:"Mark unread"}),u!==void 0&&h(G,{children:[l("hr",{}),l(ve,{onSelect:()=>k("create"),children:"Create ticket…"}),l(ve,{onSelect:()=>k("link"),children:"Link ticket…"})]}),t.canDelete!==!1&&h(G,{children:[l("hr",{}),l(ve,{danger:!0,onSelect:()=>{c.close(),d(!0)},children:"Delete thread…"})]})]})]}),h("div",{className:"window-body",ref:R,children:[t.status==="resolved"&&h("div",{className:"status-banner",children:["Resolved",t.resolvedByTickets===!0?" when its tickets were done":t.statusChangedByName?` by ${t.statusChangedByName}`:"",t.statusChangedAt?`, ${on(t.statusChangedAt)}`:"",". Resolved threads stay as an archive."]}),t.tickets!==void 0&&l(NE,{tickets:t.tickets,onUnlink:w,onAddLinkBack:v}),e.onOpenMockup!==void 0&&l(U2,{threadId:n,onOpen:e.onOpenMockup}),e.targetShown?h("details",{className:"saved-context",children:[l("summary",{children:"Saved context"}),l(UN,{...e,thread:t})]}):l(UN,{...e,thread:t}),l("div",{className:"messages",children:t.messages.map((U)=>h("div",{children:[U._id===W&&l("div",{className:"new-divider",children:"New messages"}),l(H2,{message:U,onTag:e.onTag,projectId:e.projectId,threadId:n,focused:U._id===e.focusMessageId,selectionId:e.selectionId,showRevision:U.revision!==re,onCopyLink:()=>ue(U._id),notify:e.notify})]},U._id))})]}),h("form",{className:"window-footer",onSubmit:(U)=>{U.preventDefault(),ce()},children:[l(Mc,{projectId:e.projectId,threadId:n,className:"field",placeholder:"Reply. Type @ to mention someone, # to tag.","aria-label":"Reply",value:C,onChange:e.onDraft,onKeyDown:(U)=>{if(U.key==="Enter"&&(U.metaKey||U.ctrlKey))ce()}}),A!==null&&l("div",{className:"error",children:A}),l("div",{className:"row end",style:{marginTop:8},children:l("button",{type:"submit",className:"btn primary",disabled:C.text.trim()===""||E,children:E?"Sending…":"Reply"})})]}),g==="create"&&u!==void 0&&y.length>0&&l(RE,{threadId:n,projectId:e.projectId,personId:u.personId,accounts:y,drafting:u.offered.drafting===!0,modelLists:u.modelLists===!0,onSetUpAi:u.onSetUpAi??null,installUrls:Object.fromEntries(u.offered.trackers.flatMap((U)=>U.installUrl===void 0?[]:[[U.id,U.installUrl]])),returnFocus:f.current,onClose:()=>x(null),onCreated:(U)=>{if(x(null),U.canAddLinkBack)e.notify(`Created ${U.key}, but ${$n(U.tracker)} didn't add the link back to this thread.`,{label:"Add link back",run:()=>void v(U)});else e.notify(`Created ${U.key}`,{label:"Open",run:()=>window.open(U.url,"_blank","noopener,noreferrer")})}}),g==="link"&&y.length>0&&l(ME,{threadId:n,accounts:y,linked:t.tickets??[],returnFocus:f.current,onClose:()=>x(null),onLinked:(U)=>{x(null),e.notify(`Linked ${U.key}`)}}),p&&h(He,{label:"Delete thread",onClose:()=>d(!1),returnFocus:f.current,children:[l("h3",{children:"Delete this thread?"}),l("p",{children:"The whole discussion is removed for everyone, and links to it will report it unavailable. To keep it as an archive, resolve it instead."}),h("div",{className:"row end",children:[l("button",{type:"button",className:"btn",onClick:()=>d(!1),children:"Cancel"}),t.status==="open"&&l("button",{type:"button",className:"btn",onClick:()=>{d(!1),F("resolved")},children:"Resolve instead"}),l("button",{type:"button",className:"btn danger solid",onClick:()=>{d(!1),a(n).then(()=>{e.onClose(),e.notify("Thread deleted")}).catch((U)=>e.notify(ne(U)))},children:"Delete"})]})]})]})}function UN(e){let{thread:t,live:n,reveal:r}=e,{evidence:o}=t.anchor,a=yc(t),i=B2(se(),t._id,t.capture.status),[s,c]=S(!1),f=n===void 0?null:bc(n),p=gr(a.viewState),d=JS(o.userAgent),u=(()=>{try{let m=new URL(o.url);return`${m.pathname}${m.search}`}catch{return o.url}})();return h("div",{className:"thread-context",children:[t.capture.status!=="failed"&&i!==null&&l("img",{className:"capture",src:i,alt:"Capture from when the comment was left",onClick:()=>c(!0)}),t.capture.status==="failed"&&l(j2,{...e,reason:t.capture.failureReason}),t.capture.status==="supplied"&&l("div",{className:"capture-missing note",children:"Screenshot supplied after automatic capture failed."}),h("details",{className:"context-details",children:[l("summary",{children:"Details"}),h("dl",{children:[l("dt",{children:"Screen"}),l("dd",{children:a.screen}),p!==""&&h(G,{children:[l("dt",{children:"View"}),l("dd",{children:p})]}),a.target.recordKey!==null&&h(G,{children:[l("dt",{children:"Record"}),l("dd",{children:a.target.recordKey})]}),l("dt",{children:"Applies to"}),l("dd",{children:a.scope==="record"?"This record only":"Every record showing this element"}),l("dt",{children:"Element"}),l("dd",{children:a.target.purposeId??a.target.clues.label??a.target.clues.tagName}),o.persona!==null&&h(G,{children:[l("dt",{children:"Viewing as"}),h("dd",{children:[o.persona," (demo persona)"]})]}),l("dt",{children:"Version"}),l("dd",{children:o.revision??"Unknown"}),l("dt",{children:"Page"}),l("dd",{children:u}),l("dt",{children:"Browser"}),h("dd",{children:[o.viewport.width,"×",o.viewport.height,d!==null?`, ${d}`:""]}),l("dt",{children:"Left"}),l("dd",{children:on(o.capturedAt)}),t.reattachment!==void 0&&h(G,{children:[l("dt",{children:"Reattached"}),h("dd",{children:["by ",t.reattachedByName??"Unknown",", ",on(t.reattachment.reattachedAt),". Originally"," ",t.anchor.target.purposeId??t.anchor.target.clues.label??t.anchor.target.clues.tagName," on"," ",t.anchor.screen,"."]})]})]})]}),h("div",{className:"target-status",children:[l("span",{className:`dot${f==="live"?" live":f===null?"":" warn"}`}),h("div",{className:"grow",children:[l("div",{children:n===void 0?"Finding the element…":hf(n)}),r.status==="restoring"&&l("div",{className:"note",children:"Restoring the view…"}),r.status==="failed"&&h("div",{className:"note",children:[r.reason," The saved ",t.capture.status==="failed"?"context is":"capture and context are"," shown above."]}),h("div",{className:"row wrap",style:{marginTop:6},children:[l("button",{type:"button",className:"btn small",onClick:e.onShow,disabled:r.status==="restoring",children:"Show in prototype"}),f!=="live"&&l("button",{type:"button",className:"btn small",onClick:e.onReattach,title:"Point this thread at a replacement element",children:"Reattach…"})]})]})]}),s&&i!==null&&l(He,{label:"Capture",onClose:()=>c(!1),bare:!0,children:l("img",{src:i,alt:"Capture from when the comment was left",onClick:()=>c(!1)})})]})}function j2(e){let{uploadImage:t,attachScreenshot:n}=se(),[r,o]=S(!1),a=O(null),i=async(s)=>{o(!0);try{let c=await t(e.thread.projectId,s);await n({threadId:e.thread._id,fileId:c}),e.notify("Screenshot attached")}catch(c){e.notify(c instanceof Error&&!("data"in c)?c.message:ne(c))}finally{o(!1)}};return h("div",{className:"capture-missing",children:[h("div",{className:"warning",children:["Automatic capture failed: ",e.reason," The comment was saved without an image."]}),h("div",{className:"row",style:{marginTop:8},children:[l("button",{type:"button",className:"btn small",disabled:r,onClick:()=>a.current?.click(),children:r?"Uploading…":"Attach a screenshot"}),l("input",{ref:a,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",hidden:!0,onChange:(s)=>{let c=s.target.files?.[0];if(c!==void 0)i(c);s.target.value=""}})]})]})}function B2(e,t,n){let[r,o]=S(null);return _(()=>{if(n==="failed")return o(null);let a=null,i=!1;return(async()=>{let s=await e.loadCapture(t);if(s===null||i)return;if(a=URL.createObjectURL(s),i)URL.revokeObjectURL(a);else o(a)})().catch(()=>{return}),()=>{if(i=!0,a!==null)URL.revokeObjectURL(a)}},[e,t,n]),r}function $2(e,t){let[n,r]=S(null),o=jr();return _(()=>{let a=e.current;if(a===null||o)return;let i=0,s=()=>{if(i=0,document.visibilityState!=="visible")return;let p=a.getBoundingClientRect(),d={top:Math.max(p.top,0),bottom:Math.min(p.bottom,window.innerHeight)},u=null;for(let m of a.querySelectorAll(".message[data-created]")){let y=m.getBoundingClientRect(),g=Math.min(y.bottom,d.bottom)-Math.max(y.top,d.top);if(g<=0||g<y.height/2&&g<120)continue;let x=Number(m.dataset.created);if(u===null||x>u)u=x}if(u!==null)r((m)=>m===null||u>m?u:m)},c=()=>{if(i===0)i=requestAnimationFrame(s)};c();let f=new ResizeObserver(c);f.observe(a);for(let p of a.children)f.observe(p);for(let p of a.querySelectorAll(".message"))f.observe(p);return a.addEventListener("scroll",c,{passive:!0}),document.addEventListener("visibilitychange",c),()=>{cancelAnimationFrame(i),f.disconnect(),a.removeEventListener("scroll",c),document.removeEventListener("visibilitychange",c)}},[e,t,o]),n}function H2({message:e,onTag:t,projectId:n,threadId:r,focused:o,selectionId:a,showRevision:i,onCopyLink:s,notify:c}){let{editMessage:f,toggleReaction:p}=se(),[d,u]=S(null),[m,y]=S(!1),g=xn(),x=xn(),k=O(null);_(()=>{if(o)jN(k.current,"center")},[o,a]);let b=async()=>{if(d===null||d.text.trim()==="")return;y(!0);try{await f({messageId:e._id,body:d.text,mentions:Rc(d)}),u(null)}catch(w){c(ne(w))}finally{y(!1)}},v=(w)=>p({messageId:e._id,emoji:w}).catch((T)=>c(ne(T)));return h("div",{ref:k,className:`message${o?" focused":""}`,id:`critiqs-message-${e._id}`,"data-created":e.createdAt,children:[l(vt,{name:e.author.name,imageUrl:e.author.imageUrl,large:!0}),h("div",{className:"grow",children:[h("div",{className:"meta",children:[l("span",{className:"author",children:e.author.name}),e.via==="agent"&&l("span",{className:"via",title:`A coding agent wrote this for ${e.author.name}`,children:"via coding agent"}),l("span",{className:"time",title:on(e.createdAt),children:Bn(e.createdAt)}),e.editedAt!==null&&l("span",{className:"edited",title:`Edited ${on(e.editedAt)}`,children:"(edited)"}),i&&h("span",{className:"time",children:["· version ",e.revision??"unknown"]}),h("span",{className:"actions row",children:[l("button",{type:"button",className:"icon-btn","aria-label":"Add reaction",title:"Add reaction",onClick:g.toggle,children:l(QC,{})}),l("button",{type:"button",className:"icon-btn","aria-label":"Message actions","aria-haspopup":"menu",onClick:x.toggle,children:l(Py,{})})]})]}),d===null?l("div",{className:"body",children:l(Ic,{body:e.body,mentions:e.mentions,onTag:t})}):h("form",{onSubmit:(w)=>{w.preventDefault(),b()},children:[l(Mc,{projectId:n,threadId:r,className:"field","aria-label":"Edit message",value:d,autoFocus:!0,onChange:u,onKeyDown:(w)=>{if(w.key==="Escape")w.stopPropagation(),u(null);if(w.key==="Enter"&&(w.metaKey||w.ctrlKey))b()}}),h("div",{className:"row end",style:{marginTop:6},children:[l("button",{type:"button",className:"btn small",onClick:()=>u(null),children:"Cancel"}),l("button",{type:"submit",className:"btn small primary",disabled:m||d.text.trim()==="",children:"Save"})]})]}),e.reactions.length>0&&l("div",{className:"reactions",children:e.reactions.map((w)=>h("button",{type:"button",className:"reaction","aria-pressed":w.mine,"aria-label":`${w.emoji} ${w.count}${w.mine?", including you":""}`,onClick:()=>v(w.emoji),children:[w.emoji," ",w.count]},w.emoji))})]}),g.open&&l(kn,{anchor:g.anchor,onClose:g.close,children:l("div",{className:"emoji-picker",children:lS.map((w)=>l("button",{type:"button","aria-label":`React ${w}`,onClick:()=>{g.close(),v(w)},children:w},w))})}),x.open&&h(kn,{anchor:x.anchor,onClose:x.close,children:[l(ve,{onSelect:()=>{x.close(),s()},children:"Copy link to message"}),e.isMine&&l(ve,{onSelect:()=>{x.close(),u({text:e.body,mentions:e.mentions})},children:"Edit"})]})]})}function jN(e,t){let n=e?.closest(".window-body");if(!(e instanceof HTMLElement)||!(n instanceof HTMLElement))return;let r=e.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=t==="start"?r:r-(n.clientHeight-e.offsetHeight)/2}var kb=340,V2=640,js=8,Q2=280,ip=13;function BN({anchor:e,sidebarOpen:t,host:n,selectionId:r,returnFocus:o,onClose:a,children:i}){let s=O(null),[c,f]=S(0),p=ge(()=>({anchor:e===null?null:Pf(e,t?window.innerWidth-Ps():window.innerWidth),pin:F2(n.shadowRoot?.querySelector('.pin[aria-expanded="true"]')??null),toolbar:n.shadowRoot?.querySelector(".toolbar")?.getBoundingClientRect()??null,width:window.innerWidth,height:window.innerHeight,keyboard:X2(),sidebar:Ps()}),[e,n,t]),d=Ur(p,!0,W2);_(()=>{let k=s.current;if(k===null)return;let b=()=>f(k.offsetHeight);b();let v=new ResizeObserver(b);return v.observe(k),()=>v.disconnect()},[]);let u=O(a);u.current=a;let m=jr();_(()=>{if(m)return;let k=(b)=>{if(!b.composedPath().includes(n))u.current()};return window.addEventListener("pointerdown",k,!0),()=>window.removeEventListener("pointerdown",k,!0)},[n,m]);let y=O(o);_(()=>{y.current=o,s.current?.focus({preventScroll:!0})},[r]),_(()=>{let k=s.current;return()=>{let v=n.shadowRoot?.activeElement??null;if((v===null||k?.contains(v)===!0||!v.isConnected)&&y.current?.isConnected)y.current.focus({preventScroll:!0})}},[n]);let{mode:g,style:x}=K2(d,t,c);return l("section",{ref:s,className:`thread-window${g==="beside"?"":` ${g}`}`,style:x,"aria-label":"Comment thread",tabIndex:-1,onKeyDown:(k)=>{if(k.key!=="Escape"||k.defaultPrevented)return;k.stopPropagation(),a()},children:i(d.anchor!==null)})}function K2(e,t,n){let r=Y2(e,t),o=r.right-r.left;if(e.width<V2||o<kb+2*js){let d=o>=Q2?e.width-r.right:0,u=Math.max(e.keyboard,e.height-r.bottom),m=Math.round((e.height-u-r.top)*0.75);return{mode:"panel",style:{left:0,right:d,bottom:u,maxHeight:m}}}let a=Math.max(160,r.bottom-r.top-2*js);if(e.anchor===null)return{mode:"docked",style:{left:r.right-kb-js,top:r.top+js,maxHeight:a}};let{x:i,y:s,width:c}=e.anchor,f=e.pin??{x:i+c-ip,y:s-ip,width:2*ip,height:2*ip},p={width:kb,height:Math.min(n,a)};return{mode:"beside",style:{...tb(f,p,r),maxHeight:a}}}var G2=0;function Y2(e,t){let n={left:0,top:G2,right:t?e.width-(e.sidebar??_s):e.width,bottom:e.height},r=e.toolbar;if(r!==null&&r.width>0)if(r.y+r.height/2>e.height/2)n.bottom=Math.min(n.bottom,r.y-js);else n.top=Math.max(n.top,r.y+r.height+js);return n}function F2(e){let t=e?.getBoundingClientRect();return t===void 0||t.width===0&&t.height===0?null:t}function X2(){let e=window.visualViewport;if(e==null)return 0;return Math.max(0,Math.round(window.innerHeight-e.offsetTop-e.height))}var xb=(e,t)=>e===t||e!==null&&t!==null&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function W2(e,t){return xb(e.anchor,t.anchor)&&xb(e.pin,t.pin)&&xb(e.toolbar,t.toolbar)&&e.width===t.width&&e.height===t.height&&e.keyboard===t.keyboard&&e.sidebar===t.sidebar}var Bs=16;function $N(e){let t=O(null),[n,r]=jn("critiqs:toolbar-offset",0),[o,a]=jn("critiqs:toolbar-collapsed",!1),[i,s]=S(null),[c,f]=S(!1),p=xn();_(()=>{if(e.avoid===null||t.current===null)return f(!1);let w=t.current.getBoundingClientRect(),T={top:window.innerHeight-Bs-w.height,bottom:window.innerHeight-Bs},C=e.avoid.x<w.right&&e.avoid.x+e.avoid.width>w.left,E=e.avoid.y<T.bottom&&e.avoid.y+e.avoid.height>T.top-8;f(C&&E)},[e.avoid]);let[d,u]=S(0),m=Nc();Xt(()=>{let w=t.current;if(w===null)return;let T=()=>u(w.offsetWidth);T();let C=new ResizeObserver(T);return C.observe(w),()=>C.disconnect()},[o]);let y=e.sidebarLeft!==void 0&&d>0&&e.sidebarLeft>=d+2*Bs?e.sidebarLeft:m,g=(w)=>{let T=Math.max(0,y/2-d/2-Bs);return Math.max(-T,Math.min(T,w))},x={left:`${y/2+g(n)}px`,transform:"translateX(-50%)",...c?{top:Bs}:{bottom:Bs}},k={onPointerDown:(w)=>{w.currentTarget.setPointerCapture(w.pointerId),s({startX:w.clientX,startOffset:n})},onPointerMove:(w)=>{if(i!==null)r(g(i.startOffset+w.clientX-i.startX))},onPointerUp:()=>s(null)};if(o)return l("div",{ref:t,className:"toolbar collapsed",style:x,role:"toolbar","aria-label":"Critiqs",children:h("button",{type:"button",className:"icon-btn",title:"Show Critiqs toolbar","aria-label":"Show Critiqs toolbar",onClick:()=>a(!1),children:[l(VC,{}),e.unreadCount>0&&l("span",{className:"badge",children:e.unreadCount})]})});let b=e.mode==="browse"?"Project":e.mode==="mockup"?"Mockup":"Comments",v=e.unreadCount===1?"1 unread comment":`${e.unreadCount} unread comments`;return h(G,{children:[h("div",{ref:t,className:"toolbar",style:x,role:"toolbar","aria-label":"Critiqs",children:[l("span",{className:"handle",title:"Drag to move",...k,children:l($C,{})}),e.needsSetup?l("button",{type:"button",className:"setup-btn",onClick:e.onSetup,children:"Set up Critiqs"}):h(G,{children:[l("button",{type:"button",className:"icon-btn","aria-pressed":e.mode==="browse",title:"Browse mode: use the prototype (V)","aria-label":"Browse mode",onClick:()=>e.onMode("browse"),children:l(DC,{})}),l("button",{type:"button",className:"icon-btn","aria-pressed":e.mode==="comment",title:"Comment mode: select an element to comment on (C)","aria-label":"Comment mode",onClick:()=>e.onMode(e.mode==="comment"?"browse":"comment"),children:l(Sf,{})}),e.mockupAvailable&&l("button",{type:"button",className:"icon-btn","aria-pressed":e.mode==="mockup",title:"Mockup mode: freeze the page and ask Critiqs AI for changes (M)","aria-label":"Mockup mode",onClick:()=>e.onMode(e.mode==="mockup"?"browse":"mockup"),children:l(FC,{})}),l("span",{className:"divider"}),h("button",{type:"button",className:"icon-btn","aria-pressed":e.sidebarOpen,title:e.unreadCount>0?`${b} (${v})`:b,"aria-label":e.unreadCount>0?`${b}, ${v}`:b,onClick:e.onToggleSidebar,children:[l(LC,{}),e.unreadCount>0&&l("span",{className:"badge",children:e.unreadCount})]})]}),l("span",{className:"divider"}),e.reviewer===null?l("button",{type:"button",className:"sign-in",onClick:e.onSignIn,children:"Sign in"}):l("button",{type:"button",className:"who",title:`Signed in as ${e.reviewer.name}`,"aria-label":`Signed in as ${e.reviewer.name}`,"aria-haspopup":"menu",onClick:p.toggle,children:l(vt,{name:e.reviewer.name,imageUrl:e.reviewer.pictureUrl})}),l("button",{type:"button",className:"icon-btn",title:"Collapse toolbar","aria-label":"Collapse toolbar",onClick:()=>a(!0),children:l(HC,{})})]}),p.open&&e.reviewer!==null&&h(kn,{anchor:p.anchor,onClose:p.close,placement:c?"below":"above",children:[h("div",{className:"identity",children:[l("div",{className:"name",children:e.reviewer.name}),l("div",{className:"email",children:e.reviewer.email})]}),l("hr",{}),!e.needsSetup&&l(ve,{onSelect:()=>{p.close(),e.onSetup()},children:"Project setup"}),l(ve,{onSelect:()=>{p.close(),e.onRename()},children:"Change display name…"}),e.onYourAi!==null&&l(ve,{onSelect:()=>{p.close(),e.onYourAi?.()},children:"Your AI…"}),e.onYourTrackers!==null&&l(ve,{onSelect:()=>{p.close(),e.onYourTrackers?.()},children:"Your trackers…"}),e.onOrganization!==null&&l(ve,{onSelect:()=>{p.close(),e.onOrganization?.()},children:"Organization…"}),e.onBilling!==null&&l(ve,{onSelect:()=>{p.close(),e.onBilling?.()},children:"Plan and billing…"}),e.onNotifications!==null&&l(ve,{onSelect:()=>{p.close(),e.onNotifications?.()},children:"Email notifications…"}),l(ve,{onSelect:()=>{p.close(),e.onSignOut()},children:"Sign out"}),l("hr",{}),h("div",{className:"shortcuts","aria-label":"Keyboard shortcuts",children:[l("div",{className:"menu-label",children:"Shortcuts"}),h("dl",{children:[l("dt",{children:l("kbd",{children:"C"})}),l("dd",{children:"Comment mode"}),l("dt",{children:l("kbd",{children:"V"})}),l("dd",{children:"Browse mode"}),e.mockupAvailable&&h(G,{children:[l("dt",{children:l("kbd",{children:"M"})}),l("dd",{children:"Mockup mode"}),l("dt",{children:l("kbd",{children:"O"})}),l("dd",{children:"Hold to compare with the live page, in Mockup mode"})]}),l("dt",{children:l("kbd",{children:"Esc"})}),l("dd",{children:"Close or cancel"}),h("dt",{children:[l("kbd",{children:J2()?"⌘":"Ctrl"})," ",l("kbd",{children:"\\"})]}),l("dd",{children:"Hide or show Critiqs"})]})]})]})]})}function J2(){return/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)}var Z2=5;async function HN(e){let t=e.snapshotIds.map((o)=>[o,null]),n=[],r=Date.now();for(let o=0;o<Z2&&t.length>0;o++){let a=t.map(([c])=>c);e.onProgress({status:"working",round:o,step:"reading",since:r,snapshotIds:a});let i=[];for(let[c,f]of t)i.push([c,await e.describe({snapshotId:c,top:f,round:o})]);e.onProgress({status:"working",round:o,step:"editing",since:r,snapshotIds:a});let s=await e.reply({threadId:e.threadId,snapshots:i.map(([c,f])=>({snapshotId:c,description:f.text,complete:f.complete})),continuation:o>0,...e.model===void 0?{}:{model:e.model}});if(n.push(s),!s.remaining)break;t=i.flatMap(([c,f])=>f.nextTop===null?[]:[[c,f.nextTop]])}return{rounds:n.length,replies:n}}function VN(e){let{code:t,message:n}=zn(e);if(t==="invalid"&&/version/i.test(n))return{status:"failed",kind:"moved",message:"Someone changed this mockup meanwhile. Ask again."};if(t==="unavailable")return{status:"failed",kind:"unavailable",message:n};if(t==="setup-ai")return{status:"failed",kind:"setup-ai",message:n};return{status:"failed",kind:"other",message:n}}var eL=1e4;async function sp(e,t,n,r){let o=new DOMParser().parseFromString(t,"text/html"),{skipped:a}=RS(o,n),i=r??e.contentWindow?.scrollY??0;e.setAttribute("sandbox","allow-same-origin"),await new Promise((c)=>{let f=setTimeout(c,eL);e.addEventListener("load",()=>{clearTimeout(f),c()},{once:!0}),e.srcdoc=`${o.doctype===null?"":"<!DOCTYPE html>"}${o.documentElement.outerHTML}`});let s=e.contentDocument;if(s!==null){MS(s);for(let c of Array.from(s.querySelectorAll(`[${Tf}]`))){let[f=0,p=0]=(c.getAttribute(Tf)??"").split(",").map(Number);c.scrollTo(f,p)}s.defaultView?.scrollTo(0,i)}return{skipped:a}}var QN=60000;function KN(e,t){let n=e.defaultView;return iy(e,{top:t??n?.scrollY??0,height:n?.innerHeight??window.innerHeight,budget:QN})}async function GN(e,t,n){let r=document.createElement("iframe");r.setAttribute("aria-hidden","true"),r.tabIndex=-1;let o=r.style;o.setProperty("position","fixed"),o.setProperty("left","0"),o.setProperty("top","0"),o.setProperty("width",`${t.width}px`),o.setProperty("height",`${window.innerHeight}px`),o.setProperty("border","0"),o.setProperty("visibility","hidden"),o.setProperty("pointer-events","none"),e.appendChild(r);try{await sp(r,t.html,t.edits,0);let a=r.contentDocument;if(a===null)throw Error("The page copy couldn't be laid out.");return iy(a,{top:n,height:window.innerHeight,budget:QN})}finally{r.remove()}}function FN({content:e,hidden:t,choosing:n,onChoose:r,pins:o,selectedThreadId:a,onPin:i,exposedRight:s,working:c,handle:f}){let p=[O(null),O(null)],[d,u]=S({index:0,key:null}),m=O(d);m.current=d;let[y,g]=S(null),x=O({choosing:n,onChoose:r});x.current={choosing:n,onChoose:r};let k=ge(()=>p[m.current.index].current?.contentDocument??null,[]);lu(f,()=>({documentFor:(E)=>m.current.key===E?k():null}),[k]);let b=O(null);_(()=>{if(e===null)return;let E=!1,A=m.current.key===null?m.current.index:1-m.current.index,N=p[A].current;if(N===null)return;let q=b.current===e.copyKey?k()?.defaultView?.scrollY??e.scrollY:e.scrollY;return sp(N,e.html,e.edits,q).then(()=>{if(E)return;let X=N.contentDocument;if(X!==null)nL(X,(L)=>v(L,N),g);b.current=e.copyKey,g(null),u({index:A,key:e.key})}),()=>{E=!0}},[e?.key]);let v=(E,A)=>{let{choosing:N,onChoose:R}=x.current;if(!N)return;let q=Number(E.getAttribute(ii));R({node:q,label:rL(E),rect:Tb(E,A)})},w=ge(()=>{let E=k(),A=p[m.current.index].current;if(E===null||A===null||t)return[];let N=[],R=new Map;for(let q of o){let X=E.querySelector(`[${ii}="${q.node}"]`);if(X===null)continue;let L=Tb(X,A);if(L.width<=0||L.height<=0)continue;let F=R.get(q.node)??0;R.set(q.node,F+1);let ce=Math.min(L.x+L.width,s-16)-F*22;if(L.y+L.height<0||L.y>window.innerHeight||ce<0)continue;N.push({threadId:q.threadId,x:ce,y:Math.max(L.y,16)})}return N},[o,t,s,k]),T=Ur(w,o.length>0&&d.key!==null,tL),C=n&&!t?y:null;return h("div",{className:`mockup-canvas${t?" original":""}`,"data-testid":"mockup-canvas",children:[p.map((E,A)=>l("iframe",{ref:E,title:A===d.index?"Page copy":"Next page copy",sandbox:"allow-same-origin","aria-hidden":A!==d.index||void 0,className:A===d.index&&d.key!==null?"shown":void 0,tabIndex:A===d.index?0:-1},A)),c&&!t&&d.key!==null&&l("div",{className:"ai-scan",style:{width:s},"aria-hidden":"true",children:h("div",{className:"ai-scan-chip",children:[l("span",{className:"spinner"}),"Critiqs AI is editing this copy"]})}),C!==null&&C.x<s&&l("div",{className:"target-box",style:{left:C.x,top:C.y,width:Math.min(C.width,s-C.x),height:C.height}}),!t&&T.map(({threadId:E,x:A,y:N})=>{let R=o.find((X)=>X.threadId===E);if(R===void 0)return null;let q=["pin",R.unread&&"unread",R.resolved&&"resolved",E===a&&"selected"].filter(Boolean).join(" ");return l("button",{type:"button",className:q,style:{left:A,top:N},"aria-label":`Mockup thread by ${R.authorName}`,title:R.authorName,onClick:()=>i(E),children:Ns(R.authorName)},E)})]})}function tL(e,t){return e.length===t.length&&e.every((n,r)=>n.threadId===t[r].threadId&&n.x===t[r].x&&n.y===t[r].y)}function nL(e,t,n){let r=e.defaultView?.frameElement,o=(a)=>{a.preventDefault(),a.stopPropagation()};for(let a of["mousedown","submit","auxclick","dblclick","contextmenu","dragstart"])e.addEventListener(a,o,!0);e.addEventListener("click",(a)=>{o(a);let i=YN(a.target);if(i!==null)t(i)},!0),e.addEventListener("mousemove",(a)=>{let i=YN(a.target);n(i===null||r===null?null:Tb(i,r))}),e.addEventListener("mouseleave",()=>n(null)),e.defaultView?.addEventListener("scroll",()=>n(null),{passive:!0});for(let a of["keydown","keyup"])e.addEventListener(a,(i)=>{let s=new KeyboardEvent(a,{key:i.key,code:i.code,repeat:i.repeat,shiftKey:i.shiftKey,altKey:i.altKey,ctrlKey:i.ctrlKey,metaKey:i.metaKey,bubbles:!0,cancelable:!0});if(!window.dispatchEvent(s))i.preventDefault()})}function YN(e){let n=(e instanceof Element||e!==null&&e.nodeType===1?e:null)?.closest(`[${ii}]`)??null;if(n===null||n.localName==="body")return null;return n}function Tb(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:n.x+r.x,y:n.y+r.y,width:n.width,height:n.height}}function rL(e){let t=(e.getAttribute("aria-label")??e.getAttribute("alt")??e.textContent??"").replace(/\s+/g," ").trim(),n=t.length>40?`${t.slice(0,39)}…`:t;return n===""?e.localName:`${e.localName} "${n}"`}var XN="Make the changes these comments ask for.";function eA(e){let{host:t,projectId:n,context:r,notify:o}=e,a=se(),i=a.mockups,[s,c]=cu(Ly,e.request,(z)=>z?.threadId==null?Ef:Ly(Ef,{type:"open",mockupId:z.mockupId,threadId:z.threadId})),f=O(s);f.current=s;let[p,d]=S(!1),[u,m]=S({}),y=Object.values(u).some((z)=>z.status==="working"),g=O(y);g.current=y;let x=O(new Map),[k,b]=S(""),[v,w]=S([]),[T,C]=S({}),[E,A]=S(!1),[N,R]=S(!1),[q,X]=S(()=>window.innerWidth),L=ua(),F=O(null),ce=a.useAiChoice(e.modelLists===!0?n:null),ue=ce.status==="ready"&&ce.data.models.length>1?ce.data.models:[],[re,B]=jn(`critiqs:mockup-model:${n}`,null),W=ue.length===0?void 0:ue.some((z)=>z.id===re)?re:(ce.status==="ready"?ce.data.defaultModel:null)??ue[0].id,U=O(W);U.current=W;let ie=W===void 0?void 0:l(If,{models:ue,value:W,onChange:B}),V=O(new Map),K=O(!1),oe=O(null);_(()=>()=>{K.current=!0,oe.current?.abort()},[]);let H=s.view==="thread"?s:null,le=i.useMockup(H?.mockupId??null),Q=le.status==="ready"&&le.data._id===H?.mockupId?le.data:null,I=O(Q);I.current=Q;let Y=H?.snapshotId??null,Z=Q?.snapshots.find((z)=>z._id===Y)??null,J=Q===null?0:Os(Q),fe=Q===null||H===null?0:rE(Q,H.viewing),rt=H===null?void 0:u[H.threadId],Ve=rt?.status==="working"&&Y!==null&&rt.snapshotIds.includes(Y)&&fe===J,Pe=(Q===null?[]:Nf(Q)).find((z)=>z._id===H?.threadId)??null,Se=Q!==null&&ZN(Q.source,r.screen),ee=e.livePage!==!1,xe=ee&&(H===null||Se),Fe=O(xe);Fe.current=xe;let qt=s.view==="list"&&s.frozen===null,Ut=O(e.version);Ut.current=e.version;let{copyPage:hr}=e;_(()=>{if(!qt)return;let z=!1;return hr().then(({url:te,context:me,recordKey:we,...Me})=>{if(z)return;let Et={url:xs(te),screen:me.screen,viewState:me.viewState,revision:Ut.current,persona:me.persona,recordKey:we};c({type:"frozen",frozen:{page:Me,source:Et}})}).catch((te)=>!z&&o(`The page couldn't be frozen: ${ne(te)}`)),()=>{z=!0}},[qt,hr,o]);let Qe=O(e.request?.threadId===null?e.request.mockupId:null);_(()=>{let z=Qe.current;if(z===null)return;Qe.current=null,i.getMockup(z).then((te)=>{let me=Nf(te)[0];if(K.current)return;if(me===void 0)o("This mockup has no thread yet.");else c({type:"open",mockupId:z,threadId:me._id})}).catch((te)=>o(ne(te)))},[i,o]),_(()=>{if(Q===null||Q.snapshots.length===0||Y!==null)return;let z=Q.snapshots.find((te)=>te._id===Pe?.mockup?.snapshotId);c({type:"show-copy",snapshotId:(z??Uy(Q.snapshots,window.innerWidth))._id})},[Q,Y,Pe]),_(()=>{let z=()=>X(window.innerWidth);return window.addEventListener("resize",z),()=>window.removeEventListener("resize",z)},[]);let it=oL(i,Y,o),pt=Ee(()=>{if(s.view==="list"){if(s.frozen===null)return null;let{page:z}=s.frozen,te=`draft:${z.capturedAt}`;return{key:te,copyKey:te,html:z.html,edits:[],scrollY:z.scrollY}}if(Q===null||Y===null||it?.snapshotId!==Y)return null;return{key:`${Y}:${fe}`,copyKey:Y,html:it.html,edits:Cc(Q,Y,fe),scrollY:V.current.get(Y)??0}},[s,Q,Y,it,fe]),or=Ee(()=>{let z=Pe?.mockup;if(Pe===null||z?.node==null||z.snapshotId!==Y)return[];return[{threadId:Pe._id,node:z.node,authorName:Pe.preview?.authorName??"Unknown",unread:Pe.unread,resolved:Pe.status==="resolved"}]},[Pe,Y]),sn=O(new Map),yr=ge((z,te,me)=>{let we=async({snapshotId:Et,top:xt,round:cn})=>{if(K.current)throw Error("Mockup was closed.");let Tt=cn===0&&I.current?._id===te?I.current:await i.getMockup(te),No=Os(Tt),ir=F.current?.documentFor(`${Et}:${No}`)??null;if(ir!==null)return KN(ir,xt);let Ws=Tt.snapshots.find((Cp)=>Cp._id===Et);return await GN(t.shadowRoot??document.body,{html:await i.loadSnapshot(Et),edits:Cc(Tt,Et,No),width:Ws?.width??window.innerWidth},xt??V.current.get(Et)??0)},Me=()=>{let Et=Symbol(z);x.current.set(z,Et);let xt=(cn)=>{if(K.current||x.current.get(z)!==Et)return;m((Tt)=>{let{[z]:No,...ir}=Tt;return cn===null?ir:{...ir,[z]:cn}})};g.current=!0,HN({threadId:z,snapshotIds:me,describe:we,reply:i.mockupReply,model:U.current,onProgress:xt}).then(()=>xt(null)).catch((cn)=>xt(VN(cn)))};sn.current.set(z,Me),Me()},[i,t]),ln=(z)=>z.snapshots.map((te)=>te._id),va=async(z,te)=>{let me=f.current,we=e.pageThreads.find((cn)=>cn.summary._id===v[0])?.summary.preview?.body,Me=z.trim()===""&&v.length>0?XN:z;if(Me.trim()===""||E||g.current||me.view!=="list"||!me.drafting||me.frozen===null)return!1;let{page:Et,source:xt}=me.frozen;A(!0);try{let cn=await i.uploadSnapshot(n,Et.html),Tt=await i.create({projectId:n,title:nE(z.trim()===""&&we!==void 0?we:Me),source:xt,snapshot:{storageId:cn,...WN(Et)},linkedThreadIds:v});V.current.set(Tt.snapshotId,Et.scrollY);let No={mockupId:Tt.mockupId,snapshotId:te===null?null:Tt.snapshotId,node:te?.node??null},ir=await a.createThread({projectId:n,anchor:aL(xt,te?.label??null,e.version),body:Me,tags:[],capture:{status:"failed",failureReason:"Mockup threads have no capture."},mentions:[],mockup:No});if(K.current)return!0;return w([]),c({type:"open",mockupId:Tt.mockupId,threadId:ir,snapshotId:Tt.snapshotId}),yr(ir,Tt.mockupId,[Tt.snapshotId]),!0}catch(cn){return o(ne(cn)),!1}finally{if(!K.current)A(!1)}},Co=async(z)=>{let te=T[z]??"",me=I.current,we=te.trim()===""&&(me?.linkedThreadIds.length??0)>0?XN:te;if(we.trim()===""||E||g.current||me===null)return;A(!0);try{await a.reply({threadId:z,body:we,revision:e.version,mentions:[]}),C((Me)=>({...Me,[z]:Me[z]===te?"":Me[z]??""})),yr(z,me._id,ln(me))}catch(Me){o(ne(Me))}finally{if(!K.current)A(!1)}},ar=async(z)=>{let te=I.current;if(te===null)return;try{let me=await i.restore({mockupId:te._id,number:z,expectedHead:Os(te)});c({type:"view",version:"head"}),o(z===0?`Original copy restored as Version ${me}`:`Version ${z} restored as Version ${me}`)}catch(me){o(ne(me))}},Ft=async()=>{let z=I.current;if(z===null||N)return;R(!0);try{let te=await hr(),me=await i.uploadSnapshot(n,te.html),we=WN(te),Me=await i.addSnapshot({mockupId:z._id,snapshot:{storageId:me,...we}});if(V.current.set(Me,te.scrollY),!K.current)c({type:"show-copy",snapshotId:Me});o(Os(z)>0?`Copy taken at ${we.width} px. It starts without this mockup's changes; ask in the thread to bring them to it.`:`Copy taken at ${we.width} px.`)}catch(te){o(ne(te))}finally{if(!K.current)R(!1)}},br=(z,te)=>{if(H===null)return;(te?i.link:i.unlink)({mockupId:H.mockupId,threadId:z}).catch((me)=>o(ne(me)))},Xs=({mockup:z,thread:te})=>{let me={mockupId:z._id,threadId:te._id};if(ZN(z.source,r.screen))return c({type:"open",...me});if(e.showPage===null)return c({type:"open",...me});c({type:"ask-visit",visit:{...me,screen:z.source.screen,viewState:z.source.viewState,recordKey:z.source.recordKey??null}})},wa=async()=>{let z=f.current;if(z.view!=="list"||z.visit===null||z.visit.status==="going"||e.showPage===null)return;let{visit:te}=z;c({type:"visit-going"});let me=new AbortController;oe.current=me;let we=await e.showPage({threadId:te.threadId,screen:te.screen,viewState:te.viewState,recordKey:te.recordKey,signal:me.signal}).catch(()=>!1);if(me.signal.aborted||K.current)return;if(oe.current=null,!we)o(`The prototype couldn't open ${te.screen}, so comparing with the live page isn't available.`);c({type:"open",mockupId:te.mockupId,threadId:te.threadId})},Fr=()=>{oe.current?.abort(),oe.current=null,c({type:"cancel-visit"})};Xt(()=>(e.escapeRef.current=()=>{if(tE(f.current)==="panel")return!1;return c({type:"escape"}),!0},()=>{e.escapeRef.current=null}),[e.escapeRef]),_(()=>{let z=(Me)=>Me.key==="o"||Me.key==="O",te=(Me)=>{if(!z(Me)||Me.metaKey||Me.ctrlKey||Me.altKey||gf(Me)||!Fe.current)return;if(Ms(t.shadowRoot))return;Me.preventDefault(),d(!0)},me=(Me)=>{if(z(Me))d(!1)},we=()=>d(!1);return window.addEventListener("keydown",te,!0),window.addEventListener("keyup",me,!0),window.addEventListener("blur",we),()=>{window.removeEventListener("keydown",te,!0),window.removeEventListener("keyup",me,!0),window.removeEventListener("blur",we)}},[t]);let Cn=e.panelOpen?q-L:q,Xr=s.view==="list"?s.selection:null,Wr=!ee||Z===null||Q===null||!Se?null:oE(Q.snapshots,Z,q),mi=(z)=>{if(E||g.current)return;let te=sn.current.get(z);if(te!==void 0)return te();if(Q===null)return;yr(z,Q._id,ln(Q))},Eo=s.view==="list"&&!s.drafting,ae=s.view==="list"&&s.drafting,Te=new Set(v),zt=l(Oc,{hidden:!Eo,header:h(G,{children:[l("h2",{className:"grow",children:"Mockup"}),l("button",{type:"button",className:"btn small primary",onClick:()=>c({type:"new-thread"}),children:"New thread"}),l(_c,{onClose:e.onClose})]}),children:l(hE,{mockups:i,projectId:n,screen:r.screen,turns:u,onOpen:Xs})}),ka=ae&&l(Oc,{header:h(G,{children:[l(Yy,{onBack:()=>c({type:"end-draft"}),disabled:E}),l("h2",{className:"grow",children:"New thread"}),l(_c,{onClose:e.onClose})]}),footer:l(wE,{draft:k,onDraft:b,sending:E,disabled:s.frozen===null||y,onSend:()=>void va(k,null).then((z)=>z&&b("")),addComment:l(Xy,{comments:e.pageThreads,screen:r.screen,added:Te,onAdd:(z)=>w((te)=>[...te,z])}),comments:l(Wy,{ids:v,comments:e.pageThreads,onRemove:(z)=>w((te)=>te.filter((me)=>me!==z))}),hasComments:v.length>0,modelChoice:ie}),children:h("div",{className:"empty",children:[l("strong",{children:"Start a new thread"}),l("span",{children:"Ask Critiqs AI for a change to this page below, or select an element on the copy to ask about it. Add comments for Critiqs AI to read. The thread is saved when you send its first message."})]})}),gi=(()=>{if(s.view==="list")return ka;let{threadId:z}=s,te=l(Yy,{onBack:()=>c({type:"list"})});if(le.status==="error"||Q===null)return l(Oc,{header:h(G,{children:[te,l("h2",{children:"Mockup"}),l(_c,{onClose:e.onClose})]}),children:le.status==="error"?h("div",{className:"empty",children:[l("strong",{children:"Can't open this mockup thread"}),l("span",{children:le.message})]}):l("div",{className:"empty",children:"Loading…"})});let me=Q.linkedThreadIds;return l(Oc,{header:h(G,{children:[te,h("div",{className:"grow thread-heading",children:[l("h2",{title:Q.title,children:Q.title}),l("span",{className:"note",children:Mf(Q.source)})]}),ee&&l(xE,{onHold:d,disabled:!Se}),l(_c,{onClose:e.onClose})]}),tools:h(G,{children:[l(TE,{snapshots:Q.snapshots,snapshotId:Y,onCopy:(we)=>c({type:"show-copy",snapshotId:we})}),!Se&&h("div",{className:"mockup-banner hint",role:"status",children:[Q.source.screen===r.screen?`This mockup thread is on another record of ${Q.source.screen}.`:`This mockup thread is on ${Q.source.screen}.`," ","Comparing with the live page isn't available here."]}),fe!==J&&l(SE,{version:fe,onLatest:()=>c({type:"view",version:"head"})}),fe===J&&Z!==null&&sL(Q,Z._id,J)&&l("div",{className:"mockup-banner",role:"status",children:"Earlier changes were made on other copies. Ask in this thread to bring them to this one."}),Wr!==null&&Z!==null&&l(CE,{hint:Wr,shownWidth:Z.width,busy:N,onTake:()=>void Ft(),onSwitch:(we)=>c({type:"show-copy",snapshotId:we})})]}),footer:l(kE,{value:T[z]??"",onChange:(we)=>C((Me)=>({...Me,[z]:we})),sending:E,disabled:y,onSend:()=>void Co(z),addComment:l(Xy,{comments:e.pageThreads,screen:Q.source.screen,added:new Set(me),onAdd:(we)=>br(we,!0)}),comments:l(Wy,{ids:me,comments:e.pageThreads,onRemove:(we)=>br(we,!1)}),hasComments:me.length>0,modelChoice:ie}),children:l(gE,{threadId:z,versions:Q.versions,head:J,shown:fe,turn:u[z],onView:(we)=>c({type:"view",version:we===J?"head":we}),onRestore:(we)=>void ar(we),onRetry:()=>mi(z),retryDisabled:y||E,onOpenAiSettings:e.onOpenAiSettings,onSetUpAi:e.onSetUpAi})})})(),Hn=s.view==="list"?ae?e.panelOpen?"Mockup mode: select an element to ask about it · V to leave":"Mockup mode · V to leave":"Mockup mode: open a thread or start a new one · V to leave":Se&&ee?"Mockup mode: hold O to compare with the live page · V to leave":"Mockup mode · V to leave";return h(G,{children:[l(FN,{handle:F,content:pt,hidden:p,choosing:ae&&e.panelOpen&&Xr===null&&!E,onChoose:(z)=>c({type:"select",choice:z}),pins:or,selectedThreadId:H?.threadId??null,onPin:()=>{return},exposedRight:Cn,working:Ve}),Xr===null&&!p&&pt!==null&&l("div",{className:"mode-hint",style:{left:Cn/2,maxWidth:Math.max(0,Cn-24)},children:Hn}),qt&&l("div",{className:"mode-hint",style:{left:Cn/2,maxWidth:Math.max(0,Cn-24)},children:"Freezing the page…"}),Xr!==null&&e.panelOpen&&!p&&l(iL,{choice:Xr,rightEdge:Cn,sending:E,disabled:y,modelChoice:ie,onCancel:()=>c({type:"deselect"}),onSend:async(z)=>{if(await va(z,Xr))c({type:"deselect"})}}),e.panelOpen&&gi,e.panelOpen&&zt,s.view==="list"&&s.visit!==null&&l(vE,{visit:s.visit,onGo:()=>void wa(),onCancel:Fr})]})}function WN(e){return{width:e.viewportWidth,height:e.height,scrollY:e.scrollY,viewportHeight:e.viewportHeight,capturedAt:e.capturedAt}}function oL(e,t,n){let[r,o]=S(null);return _(()=>{if(t===null)return;let a=!1;return e.loadSnapshot(t).then((i)=>!a&&o({snapshotId:t,html:i})).catch((i)=>!a&&n(ne(i))),()=>{a=!0}},[e,t,n]),r}function aL(e,t,n){return{screen:e.screen,viewState:e.viewState,scope:"shared",target:{purposeId:null,recordKey:null,clues:{tagName:"body",role:null,label:t,path:""}},evidence:{url:e.url,viewport:{width:window.innerWidth,height:window.innerHeight},marker:null,capturedAt:Date.now(),revision:n,persona:e.persona,userAgent:navigator.userAgent}}}var JN=320;function iL({choice:e,rightEdge:t,sending:n,disabled:r,modelChoice:o,onCancel:a,onSend:i}){let[s,c]=S(""),f=O(null);_(()=>f.current?.focus({preventScroll:!0}),[e.node]);let{rect:p}=e,d=p.x+p.width+12+JN<=t-8,u=d?p.x+p.width+12:Math.max(8,Math.min(p.x,t-JN-8)),m=d?Math.max(8,p.y):p.y+p.height+8,y=()=>{if(s.trim()!==""&&!n&&!r)i(s)};return h(G,{children:[l("div",{className:"target-box chosen",style:{left:p.x,top:p.y,width:p.width,height:p.height}}),h("form",{className:"popover","aria-label":"Ask about this element",style:{left:u,top:Math.min(m,window.innerHeight-180)},onSubmit:(g)=>{g.preventDefault(),y()},children:[l("div",{className:"context-line",title:e.label,children:e.label}),l("textarea",{ref:f,className:"field","aria-label":"Ask for a change to this element",placeholder:"Ask for a change to this element…",value:s,onChange:(g)=>c(g.target.value),onKeyDown:(g)=>{if(g.key==="Enter"&&(g.metaKey||g.ctrlKey))y();if(g.key==="Escape")g.stopPropagation(),a()}}),h("div",{className:"row end",children:[o,l("span",{className:"grow"}),l("button",{type:"button",className:"btn",onClick:a,children:"Cancel"}),l("button",{type:"submit",className:"btn primary",disabled:s.trim()===""||n||r,children:n?"Sending…":"Send"})]})]})]})}function sL(e,t,n){if(e.snapshots.length<2||Cc(e,t,n).length>0)return!1;return e.snapshots.some((r)=>r._id!==t&&Cc(e,r._id,n).length>0)}function ZN(e,t){let n=e.recordKey??null;return e.screen===t&&(n===null||n===Tc(document.body))}function tA(e=globalThis){try{return e.matchMedia?.("(hover: none) and (pointer: coarse)").matches??!1}catch{return!1}}function nA(e,t){if(e)return t?"Tap the replacement element":"Select the replacement element · Esc to cancel";return t?"Comment mode: tap an element to comment on it":"Comment mode: select an element · V to leave"}var rA=Nn(null);function lL(e){return(e??[]).map(({tracker:t,key:n,status:r})=>({tracker:t,key:n,status:r}))}function Cb({page:e,...t}){let n=cL(e===void 0?t.host:null,t.props),r=e??n;return r===null?null:l(uL,{...t,page:r})}function cL(e,t){let[n,r]=S(null),{getContext:o,restoreContext:a}=t,i=O({getContext:o,restoreContext:a});return i.current={getContext:o,restoreContext:a},Xt(()=>{if(e===null)return;let s=HE(e,i.current);return r(s),()=>{s.destroy(),r((c)=>c===s?null:c)}},[e]),Xt(()=>{n?.layer.setHost({getContext:o,restoreContext:a})},[n,o,a]),n?.link??null}function uL({props:e,deployment:t,session:n,host:r,page:o,supplyCapture:a,openThread:i,mockups:s,review:c}){let f=O(c);f.current=c;let p=se(),{reviewer:d}=dn(n.subscribe,n.getSnapshot),{isAuthenticated:u,rejected:m}=p.useAuth(),{toasts:y,show:g,dismiss:x}=XC(),[k,b]=jn(`critiqs:project:${t.backendUrl}`,null),v=e.requireProjectId===!0,w=v?null:k,T=e.projectId??null,C=T??w,[E,A]=S("browse"),N=s?.kind==="window"?"mockup":c?.mode??E,R=O(N);R.current=N;let q=ge((M)=>{let D=typeof M==="function"?M(R.current):M,de=f.current;if(de===void 0)return A(D);if(D==="mockup"||D===R.current)return;R.current=D,de.onModeChange(D)},[]),[X,L]=jn("critiqs:sidebar-open",!1),F=c===void 0?null:c.panel??{layout:"side"},ce=F?.layout==="sheet",ue=F===null?X:F.layout==="side"||F.open,re=ue&&!ce,B=ua(),W=Nc(),U=O({open:ue,setOpen:L});U.current={open:ue,setOpen:L};let[ie,V]=S("comments"),[K,oe]=S(nf),[H,le]=S(null),[Q,I]=S(null),Y=O(Q),Z=O(0);Y.current=Q;let[J,fe]=S({}),rt=O(J);rt.current=J;let[Ve,Pe]=S(null),[Se,ee]=S(null),[xe,Fe]=S(!1),[qt,Ut]=S(!1),[hr,Qe]=S(null),[it,pt]=S(null),[or,sn]=S({status:"idle"}),[yr,ln]=S(null),va=O(0),[Co,ar]=S(!1),[Ft,br]=S(new Set),[Xs,wa]=S(!1),[Fr,Cn]=S(!1),[Xr,Wr]=S(!1),[mi,Eo]=S(!1),[ae,Te]=S(!1),[zt,ka]=S(!1),[gi,Hn]=S(!1),[z,te]=S(null),[me,we]=S(null),[Me,Et]=S({status:"idle"}),[xt,cn]=S(!1),[Tt,No]=S(()=>of(o.getState().url)??(i===void 0?null:{threadId:i,messageId:null})),[ir,Ws]=S(()=>s?.kind==="window"&&s.request!==null?{id:1,...s.request}:null),Cp=O(1),[Vc,Qc]=S(!0),av=O(null),xa=dn(o.subscribe,o.getState),{context:hi}=xa,Ce=d!==null&&u,yi=C===null&&c===void 0,Ta=d?.id??null,Kc=d!==null&&m,Jr=Kc?null:Ta,Vn=O({reviewerId:Jr});if(Vn.current.reviewerId!==Jr)Vn.current={reviewerId:Jr};let Xe=p.useProject(Ce?C:null),iv=Xe.status==="error",Js=iv&&Xe.code!=="forbidden";_(()=>{if(v&&Js)console.warn(`Critiqs: the project ${T} isn't available on the Critiqs backend at ${t.backendUrl}. Check this app's project ID setting, or run npx critiqs doctor.`)},[v,Js,T,t.backendUrl]);let Zs=p.useThreads(Ce&&Xe.status==="ready"?C:null),sv=Zs.status==="ready"?Zs.data:fL,GA=Xe.status==="ready"?Xe.data.tags:pL,lv=p.useTags(Ce&&Xe.status==="ready"?C:null),bi=lv.status==="ready"?lv.data:null,vi=Ee(()=>sv.filter((M)=>M.mockup===void 0),[sv]),Ao=Ee(()=>vi.map((M)=>{let D=yc(M),de=D.screen===hi.screen?xa.located[M._id]??null:null,Ie=pa(D.viewState,hi.viewState);return{summary:M,location:D,located:de,sameView:Ie}}),[vi,xa]),Sa=Ee(()=>new Map(Ao.map((M)=>[M.summary._id,M])),[Ao]),el=p.mockups!==void 0&&t.mockups===!0&&(o.overPage||s!==void 0)&&!yi&&!Kc&&!iv,cv=el&&Ce&&Xe.status==="ready",En=N==="mockup"&&cv,tl=Ce&&t.personalAi===!0?()=>Te(!0):null,Nt=p.tickets!==void 0&&t.tickets!=null?t.tickets:null,Zr=Ce&&Nt!==null?()=>ka(!0):null,uv=p.tickets?.useTrackerAccounts(Ce&&Nt?.threadTickets===!0&&Co),Ep=Nt!==null&&uv?.status==="ready"?Of(Nt,uv.data):[],YA=()=>{if(Ep.length===0)Zr?.();else Cn(!0)},dv=t.organizationMembers===!0,fv=Ce&&dv?()=>Hn(!0):null,Gc=Ce&&t.billing===!0&&p.billing!==void 0,Np=Xe.status==="ready"?Xe.data.organization?.id??null:null,Yc=Ee(()=>Gc?{open:(M)=>{Te(!1),we(null),Hn(!1),te({organizationId:M??Np,awaiting:null})},organizationId:Np}:null,[Gc,Np]),pv=Ao.filter((M)=>M.summary.unread&&M.summary.status==="open").length,Ca=ge(()=>{if(f.current!==void 0)return void f.current.ensureReviewer().catch(()=>!1);n.signIn().catch((M)=>{if(M instanceof Br&&M.reason==="closed")return;g(M instanceof Error?M.message:"Sign-in failed.")})},[n,g]),Ap=ge((M)=>{if(s?.kind==="window"){if(M!=="mockup")s.leave();return}if(M==="mockup"&&s?.kind==="elsewhere"){if(Ce)s.open(null);else Ca();return}if(M==="mockup")Ws(null);if(q(M),(M==="comment"||M==="mockup")&&!Ce&&f.current===void 0)Ca()},[Ce,Ca,q,s]),Ro=O(null);_(()=>()=>Ro.current?.abort(),[]);let Fc=O(Jr);_(()=>{if(Jr!==null&&Fc.current===Jr)return;if(f.current!==void 0&&Fc.current===null){Fc.current=Jr;return}Fc.current=Jr,Ro.current?.abort(),I(null),fe({}),wa(!1),Wr(!1),Eo(!1),Te(!1),ka(!1),Hn(!1),te(null),we(null),Et({status:"idle"}),ar(!1),br(new Set),Pe(null),ee(null),Qe(null),Fe(!1),pt(null),sn({status:"idle"}),ln(null),q("browse")},[Jr]);let Xc=xa.document,mv=O(Xc),Wc=O(!1);_(()=>{if(mv.current===Xc)return;if(mv.current=Xc,Ro.current?.abort(),sn({status:"idle"}),ln(null),pt(null),I((D)=>D===null?null:{...D,anchor:null}),Wc.current)return;let M=wi.current;if(Ut(!1),Pe(null),Qe(null),Fe(!1),f.current!==void 0&&M!==null&&M.body.text.trim()!==""){g("The prototype showed another page, so select the element again. Your comment's text is kept.");return}if(ee(null),M!==null&&M.body.text.trim()!=="")g("The prototype showed another page, so the new comment was discarded. Select the element again to comment on it.")},[Xc,g]);let Rp=d?.name??null;_(()=>{if(!Ce||Rp===null)return;let M=!1;return(async()=>{for(let D=0;D<5&&!M;D++){let de=await p.syncReviewer().catch(()=>null);if(M||de===Rp)return;await new Promise((Ie)=>setTimeout(Ie,500*(D+1)))}})(),()=>{M=!0}},[Ce,Rp,p]);let gv=t.connections===!0&&c===void 0;_(()=>{if(gv&&C!==null)GS(t.siteUrl,C)},[gv,C,t.siteUrl]);let hv=ge(()=>{Ro.current?.abort(),I(null),q("browse"),n.signOut()},[n]),Mp=ge(async(M)=>{Ro.current?.abort();let D=new AbortController;Ro.current=D;let{location:de}=M,Ie=(sr,{keepOccurrence:r1})=>{if(!r1)I((Up)=>Up?.threadId===M._id?{...Up,anchor:null}:Up);sn({status:"failed",reason:sr})},Oe=o.getState();if(!(Oe.located[M._id]?.status==="found"&&Oe.context.screen===de.screen&&pa(de.viewState,Oe.context.viewState))&&Oe.restores)sn({status:"restoring"});let xi=Y.current?.threadId===M._id?Y.current.anchor:null,eo;try{eo=await o.request("reveal",{threadId:M._id,location:de,chosen:xi},{signal:D.signal})}catch(sr){if(D.signal.aborted)return;Ie(ne(sr),{keepOccurrence:!0});return}if(D.signal.aborted)return;if(eo.status==="failed"){Ie(eo.reason,{keepOccurrence:eo.keepOccurrence});return}if(o.overPage&&U.current.open&&eo.rect.x>=window.innerWidth-Ps())U.current.setOpen(!1);let Ea=eo.occurrence;I((sr)=>sr?.threadId===M._id?{...sr,anchor:Ea}:sr),ln({id:++va.current,location:{...de}}),sn({status:"shown"})},[o]),vr=ge((M,D={})=>{Ro.current?.abort(),sn({status:"idle"}),ln(null);let de=r.shadowRoot?.activeElement;I({id:++Z.current,threadId:M,messageId:D.messageId??null,reveal:D.reveal??!0,anchor:D.anchor??null,returnFocus:de instanceof HTMLElement?de:null}),V("comments")},[r]),Mo=ge(()=>{Ro.current?.abort(),I(null),sn({status:"idle"})},[]);_(()=>{if(Q===null||!Q.reveal)return;let M=Sa.get(Q.threadId);if(M===void 0)return;I({...Q,reveal:!1});let D=f.current?.onThreadOpened?.(M.summary.anchor.evidence.viewport.width);Promise.resolve(D).catch(()=>{return}).then(()=>Mp({_id:Q.threadId,location:M.location}))},[Q,Sa,Mp]);let yv=xa.url;_(()=>{let M=of(yv);if(M===null)return;No((D)=>D?.threadId===M.threadId&&D.messageId===M.messageId?D:M)},[yv]),_(()=>{if(!Gc)return;let M=ZE(window.location.href);if(M===null)return;te(M),window.history.replaceState(window.history.state,"",ub(window.location.href))},[xa.version,Gc]),_(()=>{if(Tt===null)return;if(!Ce||C===null){L(!0);return}if(vr(Tt.threadId,{messageId:Tt.messageId}),oe((M)=>({...M,status:"all"})),No(null),of(o.getState().url)!==null)o.request("removeLink",{}).catch((M)=>console.warn("Critiqs: the link couldn't be taken out of the page's address",M))},[Tt,Ce,C,vr,L,o]);let Jc=ge((M,D,de)=>vS(new URL(o.getState().url).origin,M,{threadId:D,messageId:de}),[o]),Ip=t.website,FA=ge(async(M,D)=>Ip===void 0?Jc(M,D,null):wS(Ip,await p.threadPageKey(D)),[Ip,p,Jc]),nl=ge((M,D)=>{fe((de)=>({...de,[M]:D(de[M]??Sb)}))},[]),XA=ge(async(M)=>{let{draft:D,sending:de}=rt.current[M]??Sb;if(D.text.trim()===""||de)return;let Ie=Vn.current;nl(M,(Oe)=>({...Oe,sending:!0,error:null}));try{let Oe=Rc(D);if(await p.reply({threadId:M,body:D.text,revision:e.version??null,mentions:Oe}),Vn.current!==Ie)return;nl(M,(un)=>({draft:un.draft.text===D.text?Ac:un.draft,sending:!1,error:null}))}catch(Oe){if(Vn.current!==Ie)return;nl(M,(un)=>({...un,sending:!1,error:ne(Oe)}))}},[p,e.version,nl]),bv=ge((M)=>{if(it!==null){let de=Vn.current,Ie=it,Oe=M.context,un=M.target.recordKey===null?"shared":Sa.get(Ie)?.location.scope??"record";pt(null),q("browse"),p.reattach({threadId:Ie,location:{screen:Oe.screen,viewState:Oe.viewState,target:M.target,scope:un}}).then(()=>{if(Vn.current!==de||de.reviewerId===null)return;g("Thread reattached. Its original capture and context are kept."),vr(Ie,{anchor:M.occurrence})}).catch((ou)=>g(ne(ou)));return}Mo(),Pe({occurrence:M.occurrence,target:M.target});let D=f.current!==void 0&&wi.current!==null&&wi.current.body.text.trim()!==""?wi.current.body:null;ee(D===null?eb(M):{...eb(M),body:D}),Qe(null)},[it,Sa,p,g,vr,Mo]),Io=ge(()=>{Pe(null),ee(null),Qe(null)},[]),vv=ge(async(M)=>{if(a===void 0)return await o.request("capture",{marker:M,image:null},{timeoutMs:rb});await o.request("conceal",{concealed:!0},{timeoutMs:Dc});let D;try{D=await a()}catch{D=null}finally{await o.request("conceal",{concealed:!1},{timeoutMs:Dc}).catch(()=>{return})}return await o.request("capture",{marker:M,image:D},{timeoutMs:rb})},[o,a]),Op=ge(async()=>{let M=Vn.current;if(c!==void 0&&(!Ce||M.reviewerId===null||C===null)){if(Ve===null||Se===null)return;if(Ut(!0),Qe(null),!await c.ensureReviewer().catch(()=>!1))Ut(!1);return}if(!Ce||M.reviewerId===null||Ve===null||Se===null||C===null)return;let D=o.getState().document,de=()=>Vn.current===M&&o.getState().document===D;Fe(!0),Qe(null);try{let Ie=await o.request("measure",{ref:Ve.occurrence.ref},{timeoutMs:Dc});if(!de())return;let Oe=Ie.context,{marker:un}=Ie,ou={screen:Oe.screen,viewState:Oe.viewState,target:Ve.target,scope:Se.scope,evidence:{url:xs(Ie.url),viewport:Ie.viewport,marker:un,capturedAt:Date.now(),revision:e.version??null,persona:Oe.persona,userAgent:Ie.userAgent}},xi=await vv(un);if(!de())return;let eo=(await o.request("measure",{ref:null},{timeoutMs:Dc})).context;if(eo.screen!==Oe.screen||!pa(Oe.viewState,eo.viewState))xi={status:"failed",reason:"The view changed while it was being captured."};let Ea;if(xi.status==="captured")try{Ea={status:"captured",fileId:await p.uploadImage(C,xi.image)}}catch{Ea={status:"failed",failureReason:"The capture could not be uploaded."}}else Ea={status:"failed",failureReason:xi.reason};if(!de())return;Wc.current=!0;let sr;try{sr=await p.createThread({projectId:C,anchor:ou,body:Se.body.text,tags:Se.tags,capture:Ea,mentions:Rc(Se.body)})}finally{Wc.current=!1}if(Vn.current!==M)return;if(Io(),o.getState().document!==D){g(Se.ticket===!0?"Comment saved. The prototype showed another page meanwhile, so it isn't open here; open it to create its ticket.":"Comment saved. The prototype showed another page meanwhile, so it isn't open here.");return}if(vr(sr,{reveal:!1,anchor:Ve.occurrence}),Se.ticket===!0)le(sr);if(Ea.status==="failed")g("Comment saved. Automatic capture failed; you can attach a screenshot in the thread.")}catch(Ie){if(Vn.current===M&&(Wc.current||o.getState().document===D))Qe(ne(Ie))}finally{if(Vn.current===M)Fe(!1)}},[c,Ce,Ve,Se,C,e.version,o,vv,p,Io,vr,g]);_(()=>{if(!qt||!Ce||C===null)return;Ut(!1),Op()},[qt,Ce,C,Op]);let _p=O(null),Zc=O({mode:N,reattaching:it,picked:Ve,needsSetup:yi,cancelComment:Io,closeThread:Mo,hidden:xt,unavailable:v&&Js,inMockup:En,mockupsOffered:el,chooseMode:Ap});Zc.current={mode:N,reattaching:it,picked:Ve,needsSetup:yi,cancelComment:Io,closeThread:Mo,hidden:xt,unavailable:v&&Js,inMockup:En,mockupsOffered:el,chooseMode:Ap},_(()=>{let M=(D)=>{if(Zc.current.unavailable)return;if(YS(D)){D.preventDefault(),D.stopImmediatePropagation(),cn((un)=>!un);return}if(Zc.current.hidden)return;if(D.key==="Escape"&&_p.current!==null){D.preventDefault(),D.stopImmediatePropagation(),_p.current();return}if(D.defaultPrevented||D.metaKey||D.ctrlKey||D.altKey||gf(D))return;let de=Zc.current,Ie=de.mode==="comment"||de.reattaching!==null,Oe=D.key.length===1?D.key.toLowerCase():D.key;if(Ms(r.shadowRoot)){if(Ie&&(Oe==="c"||Oe==="v"))D.preventDefault(),D.stopImmediatePropagation();return}if(Ie&&(Oe==="Escape"||Oe==="c"||Oe==="v"))D.preventDefault(),D.stopImmediatePropagation();if(Oe==="v"&&(Ie||de.inMockup))pt(null),de.chooseMode("browse");else if(Oe==="Escape"&&de.inMockup){if(D.preventDefault(),av.current?.()!==!0)Qc(!1)}else if(Oe==="Escape"){if(de.mode==="comment"&&de.picked!==null)return de.cancelComment();if(de.reattaching!==null)return pt(null);if(Y.current!==null)return de.closeThread();U.current.setOpen(!1)}else if(Oe==="c"&&!de.needsSetup)D.preventDefault(),q((un)=>un==="comment"?"browse":"comment");else if(Oe==="m"&&de.mockupsOffered)D.preventDefault(),de.chooseMode(de.mode==="mockup"?"browse":"mockup")};return window.addEventListener("keydown",M,!0),()=>window.removeEventListener("keydown",M,!0)},[r]);let wi=O(Se);wi.current=Se,_(()=>{if(N!=="browse")return;let M=wi.current;if(M!==null&&M.body.text.trim()!==""){g("Comment draft kept. Press C to go back to it.");return}Io()},[N,Io,g]);let eu=O(null);Xt(()=>{if(xt){let D=r.shadowRoot?.activeElement;eu.current=D instanceof HTMLElement?D:null,eu.current?.blur(),r.style.setProperty("display","none","important");return}r.style.removeProperty("display");let M=eu.current;if(eu.current=null,M?.isConnected)M.focus({preventScroll:!0})},[xt,r]),_(()=>{if(!En)return;Mo(),pt(null)},[En,Mo]),_(()=>{if(N!=="mockup")Ws(null)},[N]);let WA=ge(()=>o.request("copyPage",{}),[o]),JA=ge(async({threadId:M,screen:D,viewState:de,recordKey:Ie,signal:Oe})=>(await o.request("showPage",{threadId:M,screen:D,viewState:de,recordKey:Ie},{signal:Oe}).catch(()=>({shown:!1}))).shown,[o]),ZA=ge((M,D)=>{if(s?.kind==="elsewhere")return s.open({mockupId:M,threadId:D});Ws({id:++Cp.current,mockupId:M,threadId:D}),Qc(!0),q("mockup")},[s]),Pp=ge((M)=>{oe((D)=>({...D,tags:[M],groups:[],screens:"all"})),Et({status:"idle"}),q("comment"),L(!0)},[L]),wv=Ee(()=>vi.flatMap((M)=>{let D=M._id===Q?.threadId;if(K.status!=="all"&&M.status!==K.status&&!D)return[];return[{threadId:M._id,authorName:M.preview?.authorName??"Unknown",unread:M.unread,resolved:M.status==="resolved",tickets:lL(M.tickets)}]}),[vi,K.status,Q?.threadId]),kv=Ee(()=>vi.map((M)=>({threadId:M._id,location:yc(M)})),[vi]),Dp=ie==="setup"||yi,xv=(()=>{if(Q===null||Q.anchor===null)return null;let M=Sa.get(Q.threadId)?.located;return dL(Q.anchor,M?.status==="found"?M.occurrences:[])})(),e1=N==="comment"&&!yi||it!==null,Lp=Ve!==null&&Se!==null&&N==="comment",Tv=(M)=>M===null||o.element===null?null:o.element(M.ref),Sv=Lp?Tv(Ve.occurrence):null,Cv=xv?.ref??null,Ev=o.overPage&&re?W-B:null,Nv=Ce&&!Dp&&!En,Av=(Ce||c!==void 0)&&e1&&!xt,Rv=Ve!==null?null:nA(it!==null,tA()),Mv=!o.overPage&&Lp?Ve.occurrence.ref:null,Iv=Ee(()=>({hidden:xt,exposedRight:Ev,watch:kv,pins:Nv?wv:[],selected:Q===null?null:{threadId:Q.threadId,ref:Cv},highlight:Ce&&!En?yr:null,picking:Av?{hint:Rv,paused:Ve!==null}:null,picked:Mv}),[xt,Ev,kv,Nv,wv,Q?.threadId,Cv,Ce,En,yr,Av,Rv,Ve,Mv]);Xt(()=>o.display(Iv),[o,Iv]);let tu=O({pick:bv,select:vr,outsideClick:()=>{}});tu.current={pick:bv,select:vr,outsideClick:()=>{if(Se?.body.text.trim()==="")Io()}},_(()=>{let M=[o.on("picked",(D)=>tu.current.pick(D)),o.on("outsideClick",()=>tu.current.outsideClick()),o.on("pin",({threadId:D,occurrence:de})=>tu.current.select(D,{anchor:de,reveal:!1}))];return()=>M.forEach((D)=>D())},[o]);let t1={status:K.status,screen:K.screens==="current"?hi.screen:null},qp=Xe.status==="ready"&&Xe.data.isOwner,ki=N==="browse",nu=ki?"Project":"Comments",ru=ki?"Critiqs project":"Critiqs comments",n1=(()=>{if(Kc)return l(ha,{title:nu,label:ru,onClose:()=>L(!1),children:h("div",{className:"empty",children:[l("strong",{children:"Sign-in not accepted"}),l("span",{children:"This Critiqs backend did not accept your sign-in. It may trust a different sign-in service."}),l("button",{type:"button",className:"btn",onClick:hv,children:"Sign out"})]})});if(Dp)return l(ha,{title:"Project setup",onClose:()=>L(!1),children:l(oN,{reviewer:d,signedIn:Ce,organizations:dv,addressEdits:t.addressEdits===!0,addressNotes:t.addressNotes===!0,onSignIn:Ca,configuredProjectId:T,browserProjectId:w,onUseProject:(M)=>{b(M),V("setup")},onDone:()=>{if(V("comments"),T===null)q("comment")},backLabel:ki?"Back to project":"Back to comments",notify:g,reviewLinksAt:t.website!==void 0&&t.reviewLinks===!0?(M)=>`${t.website.replace(/\/$/,"")}/review-links/${encodeURIComponent(M)}`:null,...Nt!==null&&Zr!==null?{trackers:{offered:Nt,onOpen:Zr}}:{}})});if(ie==="docs")return l(ha,{title:"Documentation",label:"Critiqs documentation",onClose:()=>L(!1),actions:l("button",{type:"button",className:"btn small",onClick:()=>V("comments"),children:ki?"Back to project":"Back to comments"}),children:l(GE,{onClose:()=>L(!1)})});if(!Ce)return l(ha,{title:nu,label:ru,onClose:()=>L(!1),children:h("div",{className:"empty",children:[l("strong",{children:Tt!==null?"Sign in to open the linked comment":ki?"Sign in to see this project":"Sign in to see feedback"}),l("span",{children:"Reviewers sign in with a verified email so everyone knows who wrote what."}),l("button",{type:"button",className:"btn primary",onClick:Ca,disabled:d!==null,children:d!==null?"Signing in…":"Sign in"})]})});if(Xe.status==="error"&&Xe.code==="forbidden")return l(ha,{title:nu,label:ru,onClose:()=>L(!1),children:h("div",{className:"empty",children:[l("strong",{children:"No access to this project"}),l("span",{children:Xe.message})]})});if(Xe.status==="error")return l(ha,{title:nu,label:ru,onClose:()=>L(!1),children:h("div",{className:"empty",children:[l("strong",{children:"Project not found"}),l("span",{children:T!==null?"The project ID in this prototype's code isn't known to this Critiqs backend.":"The project remembered in this browser no longer exists."}),!v&&l("button",{type:"button",className:"btn",onClick:()=>V("setup"),children:"Open project setup"})]})});if(ki)return l(ha,{title:Xe.status==="ready"?Xe.data.name:"Project",label:"Critiqs project",onClose:()=>L(!1),children:Xe.status!=="ready"||d===null?l("div",{className:"empty",children:"Loading…"}):l(lN,{project:Xe.data,reviewer:d,openCount:Ao.filter((M)=>M.summary.status==="open").length,unreadCount:pv,onShowComments:()=>q("comment"),onNotifications:()=>Eo(!0),onSetup:()=>V("setup"),onDocs:()=>V("docs"),notify:g})});return h(ha,{title:"Comments",onClose:()=>L(!1),actions:h(G,{children:[qp&&l("button",{type:"button",className:"icon-btn",title:"Tags and AI","aria-label":"Tags and AI settings",onClick:()=>we("groups"),children:l(GC,{})}),l("button",{type:"button",className:"icon-btn","aria-pressed":Co,title:"Select threads to export","aria-label":"Select threads to export",onClick:()=>{ar(!Co),br(new Set)},children:l(BC,{})}),l(_N,{filters:K,tags:bi===null?GA:bi.tags.map((M)=>M.label),groups:(bi?.groups??[]).map((M)=>({...M,members:op(bi,M._id)})),onFilters:oe,tickets:Nt!==null})]}),footer:Co?h("div",{className:"selection-footer",children:[h("div",{className:"row",children:[h("span",{className:"note",children:[Ft.size," selected"]}),l("button",{type:"button",className:"link-btn",onClick:()=>br(new Set(Ao.map((M)=>M.summary._id))),children:"Select all"}),l("button",{type:"button",className:"link-btn",onClick:()=>br(new Set),children:"Clear"})]}),h("div",{className:"row selection-actions",children:[Nt?.threadTickets===!0&&Zr!==null&&Ta!==null&&l("button",{type:"button",className:"btn small",disabled:Ft.size===0,onClick:YA,children:"Create tickets…"}),l("button",{type:"button",className:"btn primary small",disabled:Ft.size===0,onClick:()=>wa(!0),children:"Export…"})]})]}):null,children:[T===null&&h("p",{className:"banner",children:["This project is remembered only in this browser until its ID is in the prototype's code."," ",l("button",{type:"button",className:"link-btn",onClick:()=>V("setup"),children:"Finish setup"})]}),C!==null&&l(cN,{projectId:C,scope:t1,state:Me,onState:Et}),Me.status!=="idle"?l(uN,{state:Me,tags:bi,onOpen:(M,D)=>vr(M,{messageId:D}),onTag:Pp,onSetUpAi:tl}):Zs.status==="loading"?l("div",{className:"empty",children:"Loading…"}):Zs.status==="error"?l("div",{className:"empty",children:Zs.message}):l(ON,{tags:bi,onTag:Pp,threads:Ao,currentScreen:hi.screen,filters:K,defaultFilters:nf,onFilters:oe,selectedId:Q?.threadId??null,onSelect:(M)=>vr(M),selecting:Co,checked:Ft,onCheck:(M,D)=>br((de)=>{let Ie=new Set(de);if(D)Ie.add(M);else Ie.delete(M);return Ie}),onStartCommenting:()=>q("comment"),commenting:N==="comment"})]})})();if(v&&Js)return null;return l(rA.Provider,{value:F,children:l(Dy.Provider,{value:xt,children:l(ui.Provider,{value:Yc,children:h("div",{className:"layer","aria-hidden":xt||void 0,children:[En&&C!==null&&l(eA,{host:r,projectId:C,context:hi,copyPage:WA,version:e.version??null,pageThreads:Ao,request:ir,panelOpen:Vc,escapeRef:av,showPage:xa.restores?JA:null,onClose:()=>Qc(!1),onOpenAiSettings:qp?()=>we("ai"):null,onSetUpAi:tl,modelLists:t.modelLists===!0,livePage:s?.kind!=="window",notify:g},ir?.id??0),ue&&!En&&n1,Ce&&!Dp&&!Kc&&!En&&Q!==null&&C!==null&&Xe.status==="ready"&&l(BN,{selectionId:Q.id,anchor:Tv(xv),sidebarOpen:re,host:r,returnFocus:Q.returnFocus,onClose:Mo,children:(M)=>l(zN,{threadId:Q.threadId,focusMessageId:Q.messageId,selectionId:Q.id,projectId:C,live:Sa.get(Q.threadId),version:e.version??null,reveal:or,linkFor:(D,de)=>Jc(D,Q.threadId,de),shareLink:(D)=>FA(D,Q.threadId),targetShown:M,reply:J[Q.threadId]??Sb,onDraft:(D)=>nl(Q.threadId,(de)=>({...de,draft:D})),onSend:()=>void XA(Q.threadId),onClose:Mo,onShow:()=>{let D=Sa.get(Q.threadId);if(D!==void 0)Mp({_id:Q.threadId,location:D.location})},onReattach:()=>{pt(Q.threadId),g("Select the element this comment should point to. Press Escape to cancel.")},notify:g,onTag:Pp,onOpenMockup:cv?ZA:void 0,tickets:Nt?.threadTickets===!0&&Zr!==null&&Ta!==null?{offered:Nt,onYourTrackers:Zr,personId:Ta,modelLists:t.modelLists===!0,onSetUpAi:tl}:void 0,ticketStatus:Nt?.ticketStatus===!0&&Ta!==null,startCreateTicket:H===Q.threadId,onCreateTicketStarted:()=>le(null)})},Q.threadId),(Ce||c!==void 0)&&Lp&&l(LE,{dismissHelpRef:_p,picked:{element:Sv,target:Ve.target},comment:Se,onChange:ee,context:hi,projectId:Ce?C:null,reviewer:Ce?d:null,signInOnPost:c!==void 0&&!Ce,saving:xe||qt,error:hr,onSignIn:Ca,onSubmit:()=>void Op(),onCancel:Io,rightEdge:re?W-B:W,ticketOffer:Nt?.threadTickets===!0&&Zr!==null}),c===void 0&&l($N,{mode:N==="mockup"&&!el?"browse":N,onMode:Ap,mockupAvailable:el,sidebarOpen:En?Vc:ue,onToggleSidebar:()=>En?Qc(!Vc):L(!ue),unreadCount:pv,reviewer:d,onSignIn:Ca,onSignOut:hv,onRename:()=>Wr(!0),onYourAi:tl,onYourTrackers:Zr,onOrganization:fv,onBilling:Yc===null?null:()=>Yc.open(),onNotifications:Ce&&Xe.status==="ready"?()=>Eo(!0):null,needsSetup:yi,onSetup:()=>{V("setup"),L(!0)},avoid:Sv?.getBoundingClientRect()??null,sidebarLeft:(En?Vc:ue)?W-B:void 0}),Ce&&Fr&&C!==null&&Ta!==null&&Ep.length>0&&l(qN,{projectId:C,personId:Ta,accounts:Ep,drafting:Nt?.drafting===!0,threads:Ao.filter((M)=>Ft.has(M.summary._id)).map((M)=>({id:M.summary._id,title:(M.summary.preview?.body??"").split(`
|
|
47
|
+
`)[0].trim(),tickets:M.summary.tickets??[]})),onClose:()=>Cn(!1),onDone:(M,D)=>g(D===0?`Created ${M} ${M===1?"ticket":"tickets"}`:`Created ${M}; ${D} ${D===1?"thread has":"threads have"} no ticket`)}),Ce&&Xs&&C!==null&&l(VE,{projectId:C,threadIds:[...Ft],linkFor:Jc,onClose:()=>wa(!1),notify:g}),d!==null&&Xr&&l(QE,{current:d.name,onSave:async(M)=>{let D=await n.setDisplayName(M);g(D?"Display name changed":"Name saved. It will show once Critiqs reconnects.")},onClose:()=>Wr(!1)}),Ce&&mi&&C!==null&&Xe.status==="ready"&&l(KE,{projectId:C,projectName:Xe.data.name,onClose:()=>Eo(!1)}),gi&&fv!==null&&l(SN,{projectOrganizationId:Xe.status==="ready"?Xe.data.organization?.id??null:null,projectId:C,onClose:()=>Hn(!1),notify:g}),ae&&tl!==null&&l(CN,{onClose:()=>Te(!1),notify:g,modelLists:t.modelLists===!0}),zt&&Zr!==null&&Nt!==null&&l(MN,{offered:Nt,onClose:()=>ka(!1),notify:g}),Ce&&me!==null&&qp&&C!==null&&l(wN,{projectId:C,initialTab:me,onClose:()=>we(null),notify:g,modelLists:t.modelLists===!0,presetTags:t.presetTags===!0,tickets:{templates:Nt?.drafting===!0&&p.tickets!==void 0,resolveWhenDone:Nt?.ticketStatus===!0,defaults:Nt?.defaultDestinations===!0&&p.tickets?.setTicketDefaultDestination!==void 0}}),z!==null&&Yc!==null&&p.billing!==void 0&&l(nN,{billing:p.billing,organizationId:z.organizationId,awaiting:z.awaiting,onClose:()=>te(null),notify:g}),l(WC,{toasts:y,dismiss:x})]})})})})}function dL(e,t){return t.find((n)=>n.ref===e.ref)??t.find((n)=>n.recordKey===e.recordKey)??null}var fL=[],pL=[],Sb={draft:Ac,sending:!1,error:null};function ha({title:e,label:t="Critiqs comments",onClose:n,actions:r,footer:o,children:a}){let i=ua(),s=At(rA),c=s?.layout==="sheet"?s:null;return h("aside",{className:c!==null?"sidebar sheet":"sidebar","aria-label":t,style:c!==null?void 0:{width:i},children:[c===null&&l(Af,{}),h("div",{className:"sidebar-header",children:[l("h2",{children:e}),r,(s===null||c!==null)&&l("button",{type:"button",className:"icon-btn","aria-label":c!==null?"Close comments":"Close sidebar",title:"Close",onClick:c!==null?()=>c.onClose():n,children:l(wn,{})})]}),l("div",{className:"sidebar-body",children:a}),o&&l("div",{className:"sidebar-footer",children:o})]})}var Hr=[],rr=[],mL=Uint8Array,Eb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ya=0,Nb=Eb.length;ya<Nb;++ya)Hr[ya]=Eb[ya],rr[Eb.charCodeAt(ya)]=ya;var ya,Nb;rr[45]=62;rr[95]=63;function gL(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");if(n===-1)n=t;var r=n===t?0:4-n%4;return[n,r]}function hL(e,t,n){return(t+n)*3/4-n}function $s(e){var t,n=gL(e),r=n[0],o=n[1],a=new mL(hL(e,r,o)),i=0,s=o>0?r-4:r,c;for(c=0;c<s;c+=4)t=rr[e.charCodeAt(c)]<<18|rr[e.charCodeAt(c+1)]<<12|rr[e.charCodeAt(c+2)]<<6|rr[e.charCodeAt(c+3)],a[i++]=t>>16&255,a[i++]=t>>8&255,a[i++]=t&255;if(o===2)t=rr[e.charCodeAt(c)]<<2|rr[e.charCodeAt(c+1)]>>4,a[i++]=t&255;if(o===1)t=rr[e.charCodeAt(c)]<<10|rr[e.charCodeAt(c+1)]<<4|rr[e.charCodeAt(c+2)]>>2,a[i++]=t>>8&255,a[i++]=t&255;return a}function yL(e){return Hr[e>>18&63]+Hr[e>>12&63]+Hr[e>>6&63]+Hr[e&63]}function bL(e,t,n){var r,o=[];for(var a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),o.push(yL(r));return o.join("")}function Hs(e){var t,n=e.length,r=n%3,o=[],a=16383;for(var i=0,s=n-r;i<s;i+=a)o.push(bL(e,i,i+a>s?s:i+a));if(r===1)t=e[n-1],o.push(Hr[t>>2]+Hr[t<<4&63]+"==");else if(r===2)t=(e[n-2]<<8)+e[n-1],o.push(Hr[t>>10]+Hr[t>>4&63]+Hr[t<<2&63]+"=");return o.join("")}function Vr(e){if(e===void 0)return{};if(!Rb(e))throw Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function oA(e){if(typeof e>"u")throw Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!=="string")throw Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function Rb(e){let t=typeof e==="object",n=Object.getPrototypeOf(e),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return t&&r}var sA=!0,Vs=BigInt("-9223372036854775808"),Pb=BigInt("9223372036854775807"),Ob=BigInt("0"),vL=BigInt("8"),wL=BigInt("256"),Mb="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.";class cp{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw Error(Mb)}valueOf(){throw Error(Mb)}toJSON(){throw Error(Mb)}toString(){return"[unresolved commit timestamp]"}}var kL=new cp;function lA(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function xL(e){if(e<Ob)e-=Vs+Vs;let t=e.toString(16);if(t.length%2===1)t="0"+t;let n=new Uint8Array(new ArrayBuffer(8)),r=0;for(let o of t.match(/.{2}/g).reverse())n.set([parseInt(o,16)],r++),e>>=vL;return Hs(n)}function TL(e){let t=$s(e);if(t.byteLength!==8)throw Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let n=Ob,r=Ob;for(let o of t)n+=BigInt(o)*wL**r,r++;if(n>Pb)n+=Vs+Vs;return n}function SL(e){if(e<Vs||Pb<e)throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Hs(new Uint8Array(t))}function CL(e){let t=$s(e);if(t.byteLength!==8)throw Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}var EL=DataView.prototype.setBigInt64?SL:xL,NL=DataView.prototype.getBigInt64?CL:TL,aA=1024;function _b(e){if(e.length>aA)throw Error(`Field name ${e} exceeds maximum field name length ${aA}.`);if(e.startsWith("$"))throw Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n<32||n>=127)throw Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function To(e){if(e===null)return e;if(typeof e==="boolean")return e;if(typeof e==="number")return e;if(typeof e==="string")return e;if(Array.isArray(e))return e.map((r)=>To(r));if(typeof e!=="object")throw Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let r=t[0][0];if(r==="$bytes"){if(typeof e.$bytes!=="string")throw Error(`Malformed $bytes field on ${e}`);return $s(e.$bytes).buffer}if(r==="$integer"){if(typeof e.$integer!=="string")throw Error(`Malformed $integer field on ${e}`);return NL(e.$integer)}if(r==="$float"){if(typeof e.$float!=="string")throw Error(`Malformed $float field on ${e}`);let o=$s(e.$float);if(o.byteLength!==8)throw Error(`Received ${o.byteLength} bytes, expected 8 for $float`);let i=new DataView(o.buffer).getFloat64(0,sA);if(!lA(i))throw Error(`Float ${i} should be encoded as a number`);return i}if(r==="$commitTs"){if(e.$commitTs!==null)throw Error(`Malformed $commitTs field on ${e}`);return kL}if(r==="$set")throw Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw Error("Received a Map which is no longer supported as a Convex type.")}let n={};for(let[r,o]of Object.entries(e))_b(r),n[r]=To(o);return n}var iA=16384;function fi(e){let t=JSON.stringify(e,(n,r)=>{if(r===void 0)return"undefined";if(typeof r==="bigint")return`${r.toString()}n`;return r});if(t.length>iA){let r=iA-14,o=t.codePointAt(r-1);if(o!==void 0&&o>65535)r-=1;return t.substring(0,r)+"[...truncated]"}return t}function lp(e,t,n,r){if(e===void 0){let i=n&&` (present at path ${n} in original object ${fi(t)})`;throw Error(`undefined is not a valid Convex value${i}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e==="bigint"){if(e<Vs||Pb<e)throw Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:EL(e)}}if(typeof e==="number")if(lA(e)){let i=new ArrayBuffer(8);return new DataView(i).setFloat64(0,e,sA),{$float:Hs(new Uint8Array(i))}}else return e;if(typeof e==="boolean")return e;if(typeof e==="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Hs(new Uint8Array(e))};if(e instanceof cp)return{$commitTs:null};if(Array.isArray(e))return e.map((i,s)=>lp(i,t,n+`[${s}]`,!1));if(e instanceof Set)throw Error(Ib(n,"Set",[...e],t));if(e instanceof Map)throw Error(Ib(n,"Map",[...e],t));if(!Rb(e)){let i=e?.constructor?.name,s=i?`${i} `:"";throw Error(Ib(n,s,e,t))}let o={},a=Object.entries(e);a.sort(([i,s],[c,f])=>i===c?0:i<c?-1:1);for(let[i,s]of a)if(s!==void 0)_b(i),o[i]=lp(s,t,n+`.${i}`,!1);else if(r)_b(i),o[i]=AL(s,t,n+`.${i}`);return o}function Ib(e,t,n,r){if(e)return`${t}${fi(n)} is not a supported Convex type (present at path ${e} in original object ${fi(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`;else return`${t}${fi(n)} is not a supported Convex type.`}function AL(e,t,n){if(e===void 0)return{$undefined:null};else{if(t===void 0)throw Error(`Programming error. Current value is ${fi(e)} but original value is undefined`);return lp(e,t,n,!1)}}function Lt(e){return lp(e,e,"",!1)}var RL=Object.defineProperty,ML=(e,t,n)=>(t in e)?RL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Db=(e,t,n)=>ML(e,typeof t!=="symbol"?t+"":t,n),cA,uA,IL=Symbol.for("ConvexError");class Qr extends(uA=Error,cA=IL,uA){constructor(e){super(typeof e==="string"?e:fi(e));Db(this,"name","ConvexError"),Db(this,"data"),Db(this,cA,!0),this.data=e}}var Lb="1.46.0";var OL=Object.defineProperty,_L=(e,t,n)=>(t in e)?OL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dA=(e,t,n)=>_L(e,typeof t!=="symbol"?t+"":t,n),PL="color:rgb(0, 145, 255)";function fA(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class qb{constructor(e){dA(this,"_onLogLineFuncs"),dA(this,"_verbose"),this._onLogLineFuncs={},this._verbose=e.verbose}addLogLineListener(e){let t=Math.random().toString(36).substring(2,15);for(let n=0;n<10;n++){if(this._onLogLineFuncs[t]===void 0)break;t=Math.random().toString(36).substring(2,15)}return this._onLogLineFuncs[t]=e,()=>{delete this._onLogLineFuncs[t]}}logVerbose(...e){if(this._verbose)for(let t of Object.values(this._onLogLineFuncs))t("debug",`${new Date().toISOString()}`,...e)}log(...e){for(let t of Object.values(this._onLogLineFuncs))t("info",...e)}warn(...e){for(let t of Object.values(this._onLogLineFuncs))t("warn",...e)}error(...e){for(let t of Object.values(this._onLogLineFuncs))t("error",...e)}}function up(e){let t=new qb(e);return t.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),t}function dp(e){return new qb(e)}function Qs(e,t,n,r,o){let a=fA(n);if(typeof o==="object")o=`ConvexError ${JSON.stringify(o.errorData,null,2)}`;if(t==="info"){let i=o.match(/^\[.*?\] /);if(i===null){e.error(`[CONVEX ${a}(${r})] Could not parse console.log`);return}let s=o.slice(1,i[0].length-2),c=o.slice(i[0].length);e.log(`%c[CONVEX ${a}(${r})] [${s}]`,PL,c)}else e.error(`[CONVEX ${a}(${r})] ${o}`)}function pA(e,t){let n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),Error(n)}function ba(e,t,n){return`[CONVEX ${fA(e)}(${t})] ${n.errorMessage}
|
|
48
|
+
Called by client`}function zc(e,t){return t.data=e.errorData,t}function Kr(e){let t=e.split(":"),n,r;if(t.length===1)n=t[0],r="default";else n=t.slice(0,t.length-1).join(":"),r=t[t.length-1];if(n.endsWith(".js"))n=n.slice(0,-3);return`${n}:${r}`}function Gr(e,t){return JSON.stringify({udfPath:Kr(e),args:Lt(t)})}function Ub(e,t,n){let{initialNumItems:r,id:o}=n;return JSON.stringify({type:"paginated",udfPath:Kr(e),args:Lt(t),options:Lt({initialNumItems:r,id:o})})}var DL=Object.defineProperty,LL=(e,t,n)=>(t in e)?DL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yr=(e,t,n)=>LL(e,typeof t!=="symbol"?t+"":t,n);class zb{constructor(){Yr(this,"nextQueryId"),Yr(this,"querySetVersion"),Yr(this,"querySet"),Yr(this,"queryIdToToken"),Yr(this,"identityVersion"),Yr(this,"auth"),Yr(this,"outstandingQueriesOlderThanRestart"),Yr(this,"outstandingAuthOlderThanRestart"),Yr(this,"paused"),Yr(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(e,t,n,r){let o=Kr(e),a=Gr(o,t),i=this.querySet.get(a);if(i!==void 0)return i.numSubscribers+=1,{queryToken:a,modification:null,unsubscribe:()=>this.removeSubscriber(a)};else{let s=this.nextQueryId++,c={id:s,canonicalizedUdfPath:o,args:t,numSubscribers:1,journal:n,componentPath:r};this.querySet.set(a,c),this.queryIdToToken.set(s,a);let f=this.querySetVersion,p=this.querySetVersion+1,d={type:"Add",queryId:s,udfPath:o,args:[Lt(t)],journal:n,componentPath:r};if(this.paused)this.pendingQuerySetModifications.set(s,d);else this.querySetVersion=p;return{queryToken:a,modification:{type:"ModifyQuerySet",baseVersion:f,newVersion:p,modifications:[d]},unsubscribe:()=>this.removeSubscriber(a)}}}transition(e){for(let t of e.modifications)switch(t.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(t.queryId);let n=t.journal;if(n!==void 0){let r=this.queryIdToToken.get(t.queryId);if(r!==void 0)this.querySet.get(r).journal=n}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(t.queryId);break}default:throw Error(`Invalid modification ${t.type}`)}}queryId(e,t){let n=Kr(e),r=Gr(n,t),o=this.querySet.get(r);if(o!==void 0)return o.id;return null}isCurrentOrNewerAuthVersion(e){return e>=this.identityVersion}getAuth(){return this.auth}setAuth(e){this.auth={tokenType:"User",value:e};let t=this.identityVersion;if(!this.paused)this.identityVersion=t+1;return{type:"Authenticate",baseVersion:t,...this.auth}}setAdminAuth(e,t){let n={tokenType:"Admin",value:e,impersonating:t};this.auth=n;let r=this.identityVersion;if(!this.paused)this.identityVersion=r+1;return{type:"Authenticate",baseVersion:r,...n}}clearAuth(){this.auth=void 0,this.markAuthCompletion();let e=this.identityVersion;if(!this.paused)this.identityVersion=e+1;return{type:"Authenticate",tokenType:"None",baseVersion:e}}hasAuth(){return!!this.auth}isNewAuth(e){return this.auth?.value!==e}queryPath(e){let t=this.queryIdToToken.get(e);if(t)return this.querySet.get(t).canonicalizedUdfPath;return null}queryArgs(e){let t=this.queryIdToToken.get(e);if(t)return this.querySet.get(t).args;return null}queryToken(e){return this.queryIdToToken.get(e)??null}queryJournal(e){return this.querySet.get(e)?.journal}restart(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();let e=[];for(let r of this.querySet.values()){let o={type:"Add",queryId:r.id,udfPath:r.canonicalizedUdfPath,args:[Lt(r.args)],journal:r.journal,componentPath:r.componentPath};e.push(o),this.outstandingQueriesOlderThanRestart.add(r.id)}this.querySetVersion=1;let t={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:e};if(!this.auth)return this.identityVersion=0,[t,void 0];this.outstandingAuthOlderThanRestart=!0;let n={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[t,n]}pause(){this.paused=!0}resume(){let e=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,t=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[e,t]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(e){let t=this.querySet.get(e);if(t.numSubscribers>1)return t.numSubscribers-=1,null;else{this.querySet.delete(e),this.queryIdToToken.delete(t.id),this.outstandingQueriesOlderThanRestart.delete(t.id);let n=this.querySetVersion,r=this.querySetVersion+1,o={type:"Remove",queryId:t.id};if(this.paused)if(this.pendingQuerySetModifications.has(t.id))this.pendingQuerySetModifications.delete(t.id);else this.pendingQuerySetModifications.set(t.id,o);else this.querySetVersion=r;return{type:"ModifyQuerySet",baseVersion:n,newVersion:r,modifications:[o]}}}}var qL=Object.defineProperty,UL=(e,t,n)=>(t in e)?qL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fp=(e,t,n)=>UL(e,typeof t!=="symbol"?t+"":t,n);class jb{constructor(e,t){this.logger=e,this.markConnectionStateDirty=t,fp(this,"inflightRequests"),fp(this,"requestsOlderThanRestart"),fp(this,"inflightMutationsCount",0),fp(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,t){let n=new Promise((r)=>{let o=t?"Requested":"NotSent";if(this.inflightRequests.set(e.requestId,{message:e,status:{status:o,requestedAt:new Date,onResult:r}}),e.type==="Mutation")this.inflightMutationsCount++;else if(e.type==="Action")this.inflightActionsCount++});return this.markConnectionStateDirty(),n}onResponse(e){let t=this.inflightRequests.get(e.requestId);if(t===void 0)return null;if(t.status.status==="Completed")return null;let n=t.message.type==="Mutation"?"mutation":"action",r=t.message.udfPath;for(let s of e.logLines)Qs(this.logger,"info",n,r,s);let o=t.status,a,i;if(e.success)a={success:!0,logLines:e.logLines,value:To(e.result)},i=()=>o.onResult(a);else{let s=e.result,{errorData:c}=e;Qs(this.logger,"error",n,r,s),a={success:!1,errorMessage:s,errorData:c!==void 0?To(c):void 0,logLines:e.logLines},i=()=>o.onResult(a)}if(e.type==="ActionResponse"||!e.success){if(i(),this.inflightRequests.delete(e.requestId),this.requestsOlderThanRestart.delete(e.requestId),t.message.type==="Action")this.inflightActionsCount--;else if(t.message.type==="Mutation")this.inflightMutationsCount--;return this.markConnectionStateDirty(),{requestId:e.requestId,result:a}}return t.status={status:"Completed",result:a,ts:e.ts,onResolve:i},null}removeCompleted(e){let t=new Map;for(let[n,r]of this.inflightRequests.entries()){let o=r.status;if(o.status==="Completed"&&o.ts.lessThanOrEqual(e)){if(o.onResolve(),t.set(n,o.result),r.message.type==="Mutation")this.inflightMutationsCount--;else if(r.message.type==="Action")this.inflightActionsCount--;this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n)}}if(t.size>0)this.markConnectionStateDirty();return t}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());let e=[];for(let[t,n]of this.inflightRequests){if(n.status.status==="NotSent"){n.status.status="Requested",e.push(n.message);continue}if(n.message.type==="Mutation")e.push(n.message);else if(n.message.type==="Action"){if(this.inflightRequests.delete(t),this.requestsOlderThanRestart.delete(t),this.inflightActionsCount--,n.status.status==="Completed")throw Error("Action should never be in 'Completed' state");n.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),e}resume(){let e=[];for(let[,t]of this.inflightRequests)if(t.status.status==="NotSent"){t.status.status="Requested",e.push(t.message);continue}return e}hasIncompleteRequests(){for(let e of this.inflightRequests.values())if(e.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let e=Date.now();for(let t of this.inflightRequests.values())if(t.status.status!=="Completed"){if(t.status.requestedAt.getTime()<e)e=t.status.requestedAt.getTime()}return new Date(e)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}var Ks=Symbol.for("functionName");var Bb=Symbol.for("toReferencePath");function zL(e){return e[Bb]??null}function jL(e){return e.startsWith("function://")}function $b(e){let t;if(typeof e==="string")if(jL(e))t={functionHandle:e};else t={name:e};else if(e[Ks])t={name:e[Ks]};else{let n=zL(e);if(!n)throw Error(`${e} is not a functionReference`);t={reference:n}}return t}function ft(e){let t=$b(e);if(t.name===void 0){if(t.functionHandle!==void 0)throw Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`);else if(t.reference!==void 0)throw Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`);throw Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`)}if(typeof e==="string")return e;let n=e[Ks];if(!n)throw Error(`${e} is not a functionReference`);return n}function mA(e=[]){return new Proxy({},{get(n,r){if(typeof r==="string"){let o=[...e,r];return mA(o)}else if(r===Ks){if(e.length<2){let i=["api",...e].join(".");throw Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${i}\``)}let o=e.slice(0,-1).join("/"),a=e[e.length-1];if(a==="default")return o;else return o+":"+a}else if(r===Symbol.toStringTag)return"FunctionReference";else return}})}var Hb=mA();var BL=Object.defineProperty,$L=(e,t,n)=>(t in e)?BL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pp=(e,t,n)=>$L(e,typeof t!=="symbol"?t+"":t,n);class jc{constructor(e){pp(this,"queryResults"),pp(this,"modifiedQueries"),this.queryResults=e,this.modifiedQueries=[]}getQuery(e,...t){let n=Vr(t[0]),r=ft(e),o=this.queryResults.get(Gr(r,n));if(o===void 0)return;return jc.queryValue(o.result)}getAllQueries(e){let t=[],n=ft(e);for(let r of this.queryResults.values())if(r.udfPath===Kr(n))t.push({args:r.args,value:jc.queryValue(r.result)});return t}setQuery(e,t,n){let r=Vr(t),o=ft(e),a=Gr(o,r),i;if(n===void 0)i=void 0;else i={success:!0,value:n,logLines:[]};let s={udfPath:o,args:r,result:i};this.queryResults.set(a,s),this.modifiedQueries.push(a)}static queryValue(e){if(e===void 0)return;else if(e.success)return e.value;else return}}class Vb{constructor(){pp(this,"queryResults"),pp(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,t){this.optimisticUpdates=this.optimisticUpdates.filter((a)=>!t.has(a.mutationId));let n=this.queryResults;this.queryResults=new Map(e);let r=new jc(this.queryResults);for(let a of this.optimisticUpdates)a.update(r);let o=[];for(let[a,i]of this.queryResults){let s=n.get(a);if(s===void 0||s.result!==i.result)o.push(a)}return o}applyOptimisticUpdate(e,t){this.optimisticUpdates.push({update:e,mutationId:t});let n=new jc(this.queryResults);return e(n),n.modifiedQueries}rawQueryResult(e){let t=this.queryResults.get(e);if(t===void 0)return;return t.result}queryResult(e){let t=this.queryResults.get(e);if(t===void 0)return;let n=t.result;if(n===void 0)return;else if(n.success)return n.value;else{if(n.errorData!==void 0)throw zc(n,new Qr(ba("query",t.udfPath,n)));throw Error(ba("query",t.udfPath,n))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}}var HL=Object.defineProperty,VL=(e,t,n)=>(t in e)?HL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qb=(e,t,n)=>VL(e,typeof t!=="symbol"?t+"":t,n);class Yt{constructor(e,t){Qb(this,"low"),Qb(this,"high"),Qb(this,"__isUnsignedLong__"),this.low=e|0,this.high=t|0,this.__isUnsignedLong__=!0}static isLong(e){return(e&&e.__isUnsignedLong__)===!0}static fromBytesLE(e){return new Yt(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24)}toBytesLE(){let e=this.high,t=this.low;return[t&255,t>>>8&255,t>>>16&255,t>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]}static fromNumber(e){if(isNaN(e))return gA;if(e<0)return gA;if(e>=QL)return KL;return new Yt(e%Bc|0,e/Bc|0)}toString(){return(BigInt(this.high)*BigInt(Bc)+BigInt(this.low)).toString()}equals(e){if(!Yt.isLong(e))e=Yt.fromValue(e);if(this.high>>>31===1&&e.high>>>31===1)return!1;return this.high===e.high&&this.low===e.low}notEquals(e){return!this.equals(e)}comp(e){if(!Yt.isLong(e))e=Yt.fromValue(e);if(this.equals(e))return 0;return e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(e){return this.comp(e)<=0}static fromValue(e){if(typeof e==="number")return Yt.fromNumber(e);return new Yt(e.low,e.high)}}var gA=new Yt(0,0),hA=65536,Bc=hA*hA,QL=Bc*Bc,KL=new Yt(-1,-1);var GL=Object.defineProperty,YL=(e,t,n)=>(t in e)?GL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t,n)=>YL(e,typeof t!=="symbol"?t+"":t,n);class gp{constructor(e,t){mp(this,"version"),mp(this,"remoteQuerySet"),mp(this,"queryPath"),mp(this,"logger"),this.version={querySet:0,ts:Yt.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=e,this.logger=t}transition(e){let t=e.startVersion;if(this.version.querySet!==t.querySet||this.version.ts.notEquals(t.ts)||this.version.identity!==t.identity)throw Error(`Invalid start version: ${t.ts.toString()}:${t.querySet}:${t.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(let n of e.modifications)switch(n.type){case"QueryUpdated":{let r=this.queryPath(n.queryId);if(r)for(let a of n.logLines)Qs(this.logger,"info","query",r,a);let o=To(n.value??null);this.remoteQuerySet.set(n.queryId,{success:!0,value:o,logLines:n.logLines});break}case"QueryFailed":{let r=this.queryPath(n.queryId);if(r)for(let a of n.logLines)Qs(this.logger,"info","query",r,a);let{errorData:o}=n;this.remoteQuerySet.set(n.queryId,{success:!1,errorMessage:n.errorMessage,errorData:o!==void 0?To(o):void 0,logLines:n.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(n.queryId);break}default:throw Error(`Invalid modification ${n.type}`)}this.version=e.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function Kb(e){let t=$s(e);return Yt.fromBytesLE(Array.from(t))}function FL(e){let t=new Uint8Array(e.toBytesLE());return Hs(t)}function Gb(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":if(e.success)return{...e,ts:Kb(e.ts)};else return{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:Kb(e.startVersion.ts)},endVersion:{...e.endVersion,ts:Kb(e.endVersion.ts)}};default:}return}function yA(e){switch(e.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...e};case"Connect":if(e.maxObservedTimestamp!==void 0)return{...e,maxObservedTimestamp:FL(e.maxObservedTimestamp)};else return{...e,maxObservedTimestamp:void 0};default:}return}var XL=Object.defineProperty,WL=(e,t,n)=>(t in e)?XL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wt=(e,t,n)=>WL(e,typeof t!=="symbol"?t+"":t,n),JL=1000,ZL=1001,eq=1005,tq=4040,hp;function Gs(){if(hp===void 0)hp=Date.now();if(typeof performance>"u"||!performance.now)return Date.now();return Math.round(hp+performance.now())}function bA(){return`t=${Math.round((Gs()-hp)/100)/10}s`}var vA={InternalServerError:{timeout:1000},SubscriptionsWorkerFullError:{timeout:3000},TooManyConcurrentRequests:{timeout:3000},CommitterFullError:{timeout:3000},AwsTooManyRequestsException:{timeout:3000},ExecuteFullError:{timeout:3000},SystemTimeoutError:{timeout:3000},ExpiredInQueue:{timeout:3000},VectorIndexesUnavailable:{timeout:1000},SearchIndexesUnavailable:{timeout:1000},TableSummariesUnavailable:{timeout:1000},VectorIndexTooLarge:{timeout:3000},SearchIndexTooLarge:{timeout:3000},TooManyWritesInTimePeriod:{timeout:3000}};function nq(e){if(e===void 0)return"Unknown";for(let t of Object.keys(vA))if(e.startsWith(t))return t;return"Unknown"}class Yb{constructor(e,t,n,r,o,a){this.markConnectionStateDirty=o,this.debug=a,wt(this,"socket"),wt(this,"connectionCount"),wt(this,"_hasEverConnected",!1),wt(this,"lastCloseReason"),wt(this,"transitionChunkBuffer",null),wt(this,"defaultInitialBackoff"),wt(this,"maxBackoff"),wt(this,"retries"),wt(this,"serverInactivityThreshold"),wt(this,"reconnectDueToServerInactivityTimeout"),wt(this,"scheduledReconnect",null),wt(this,"networkOnlineHandler",null),wt(this,"pendingNetworkRecoveryInfo",null),wt(this,"uri"),wt(this,"onOpen"),wt(this,"onResume"),wt(this,"onMessage"),wt(this,"webSocketConstructor"),wt(this,"logger"),wt(this,"onServerDisconnectError"),this.webSocketConstructor=n,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1000,this.maxBackoff=16000,this.retries=0,this.serverInactivityThreshold=60000,this.reconnectDueToServerInactivityTimeout=null,this.uri=e,this.onOpen=t.onOpen,this.onResume=t.onResume,this.onMessage=t.onMessage,this.onServerDisconnectError=t.onServerDisconnectError,this.logger=r,this.setupNetworkListener(),this.connect()}setSocketState(e){this.socket=e,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){if(typeof window>"u"||typeof window.addEventListener!=="function")return;if(this.networkOnlineHandler!==null)return;this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered")}cleanupNetworkListener(){if(this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener==="function")window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed")}assembleTransition(e){if(e.partNumber<0||e.partNumber>=e.totalParts||e.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==e.totalParts||this.transitionChunkBuffer.transitionId!==e.transitionId))throw this.transitionChunkBuffer=null,Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null)this.transitionChunkBuffer={chunks:[],totalParts:e.totalParts,transitionId:e.transitionId};if(e.partNumber!==this.transitionChunkBuffer.chunks.length){let t=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,Error(`TransitionChunk received out of order: expected part ${t}, got ${e.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(e.chunk),this.transitionChunkBuffer.chunks.length===e.totalParts){let t=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;let n=Gb(JSON.parse(t));if(n.type!=="Transition")throw Error(`Expected Transition, got ${n.type} after assembling chunks`);return n}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw Error("Didn't start connection from disconnected state: "+this.socket.state);let e=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:e,paused:"no"}),this.resetServerInactivityTimeout(),e.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:e,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no")this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Gs()});if(this.lastCloseReason!=="InitialConnect")if(this.lastCloseReason)this.logger.log("WebSocket reconnected at",bA(),"after disconnect due to",this.lastCloseReason);else this.logger.log("WebSocket reconnected at",bA());if(this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){let{timeSavedMs:t}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:t}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(t/1000)}s of waiting`)}},e.onerror=(t)=>{this.transitionChunkBuffer=null;let n=t.message;if(n)this.logger.log(`WebSocket error message: ${n}`)},e.onmessage=(t)=>{this.resetServerInactivityTimeout();let n=t.data.length,r=Gb(JSON.parse(t.data));if(this._logVerbose(`received ws message with type ${r.type}`),r.type==="Ping")return;if(r.type==="TransitionChunk"){let a=this.assembleTransition(r);if(!a)return;r=a,this._logVerbose(`assembled full ws message of type ${r.type}`)}if(this.transitionChunkBuffer!==null)this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${r.type} while buffering TransitionChunks`);if(r.type==="Transition")this.reportLargeTransition({messageLength:n,transition:r});if(this.onMessage(r).hasSyncedPastLastReconnect)this.retries=0,this.markConnectionStateDirty()},e.onclose=(t)=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null)this.lastCloseReason=t.reason||`closed with code ${t.code}`;if(t.code!==JL&&t.code!==ZL&&t.code!==eq&&t.code!==tq){let r=`WebSocket closed with code ${t.code}`;if(t.reason)r+=`: ${t.reason}`;if(this.logger.log(r),this.onServerDisconnectError&&t.reason)this.onServerDisconnectError(r)}let n=nq(t.reason);this.scheduleReconnect(n);return}}socketState(){return this.socket.state}sendMessage(e){let t={type:e.type,...e.type==="Authenticate"&&e.tokenType==="User"?{value:`...${e.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){let n=yA(e),r=JSON.stringify(n),o=!1;try{this.socket.ws.send(r),o=!0}catch(a){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${a}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${o?"sent":"failed to send"} message with type ${e.type}: ${JSON.stringify(t)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(t)}`),!1}resetServerInactivityTimeout(){if(this.socket.state==="terminated")return;if(this.reconnectDueToServerInactivityTimeout!==null)clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null;this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold)}scheduleReconnect(e){if(this.scheduledReconnect)clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null;this.socket={state:"disconnected"};let t=this.nextBackoff(e);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(t)}ms`);let n=Gs(),r=setTimeout(()=>{if(this.scheduledReconnect?.timeout===r)this.scheduledReconnect=null,this.connect()},t);this.scheduledReconnect={timeout:r,scheduledAt:n,backoffMs:t}}closeAndReconnect(e){switch(this._logVerbose(`begin closeAndReconnect with reason ${e}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=e,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{let e=this.socket.ws;return e.onmessage=(t)=>{this._logVerbose("Ignoring message received after close")},new Promise((t)=>{e.onclose=()=>{this._logVerbose("Closed after connecting"),t()},e.onopen=()=>{this._logVerbose("Opened after connecting"),e.close()}})}case"ready":{this._logVerbose("ws.close called");let e=this.socket.ws;e.onmessage=(n)=>{this._logVerbose("Ignoring message received after close")};let t=new Promise((n)=>{e.onclose=()=>{n()}});return e.close(),t}default:return this.socket,Promise.resolve()}}terminate(){if(this.reconnectDueToServerInactivityTimeout)clearTimeout(this.reconnectDueToServerInactivityTimeout);if(this.scheduledReconnect)clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null;switch(this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{let e=this.close();return this.setSocketState({state:"terminated"}),e}default:throw this.socket,Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();let e=this.close();return this.socket={state:"stopped"},e}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let e=null;if(this.scheduledReconnect){let t=Gs()-this.scheduledReconnect.scheduledAt;e=Math.max(0,this.scheduledReconnect.backoffMs-t),this._logVerbose(`would have waited ${Math.round(e)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(t)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=e!==null?{timeSavedMs:e}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":if(this.socket.paused==="uninitialized")this.socket={...this.socket,paused:"no"},this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Gs()});else if(this.socket.paused==="yes")this.socket={...this.socket,paused:"no"},this.onResume();return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(e){this.logger.logVerbose(e)}nextBackoff(e){let n=(e==="client"?100:e==="Unknown"?this.defaultInitialBackoff:vA[e].timeout)*Math.pow(2,this.retries);this.retries+=1;let r=Math.min(n,this.maxBackoff),o=r*(Math.random()-0.5);return r+o}reportLargeTransition({transition:e,messageLength:t}){if(e.clientClockSkew===void 0||e.serverTs===void 0)return;let n=Gs()-e.clientClockSkew-e.serverTs/1e6,r=`${Math.round(n)}ms`,o=`${Math.round(t/1e4)/100}MB`,a=t/(n/1000),i=`${Math.round(a/1e4)/100}MB per second`;if(this._logVerbose(`received ${o} transition in ${r} at ${i}`),t>20000000)this.logger.log(`received query results totaling more that 20MB (${o}) which will take a long time to download on slower connections`);else if(n>20000)this.logger.log(`received query results totaling ${o} which took more than 20s to arrive (${r})`);if(this.debug)this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:n,messageLength:t}})}}function wA(){return rq()}function rq(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e)=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}class Ys extends Error{}Ys.prototype.name="InvalidTokenError";function oq(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();if(r.length<2)r="0"+r;return"%"+r}))}function aq(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{return oq(t)}catch{return atob(t)}}function yp(e,t){if(typeof e!=="string")throw new Ys("Invalid token specified: must be a string");t||(t={});let n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!=="string")throw new Ys(`Invalid token specified: missing part #${n+1}`);let o;try{o=aq(r)}catch(a){throw new Ys(`Invalid token specified: invalid base64 for part #${n+1} (${a.message})`)}try{return JSON.parse(o)}catch(a){throw new Ys(`Invalid token specified: invalid json for part #${n+1} (${a.message})`)}}var iq=Object.defineProperty,sq=(e,t,n)=>(t in e)?iq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sn=(e,t,n)=>sq(e,typeof t!=="symbol"?t+"":t,n),lq=1728000000,kA=2;class Fb{constructor(e,t,n){Sn(this,"authState",{state:"noAuth"}),Sn(this,"configVersion",0),Sn(this,"syncState"),Sn(this,"authenticate"),Sn(this,"stopSocket"),Sn(this,"tryRestartSocket"),Sn(this,"pauseSocket"),Sn(this,"resumeSocket"),Sn(this,"clearAuth"),Sn(this,"logger"),Sn(this,"refreshTokenLeewaySeconds"),Sn(this,"initialAuthTokenReuse"),Sn(this,"lastRefreshChange"),Sn(this,"tokenConfirmationAttempts",0),this.syncState=e,this.authenticate=t.authenticate,this.stopSocket=t.stopSocket,this.tryRestartSocket=t.tryRestartSocket,this.pauseSocket=t.pauseSocket,this.resumeSocket=t.resumeSocket,this.clearAuth=t.clearAuth,this.logger=n.logger,this.refreshTokenLeewaySeconds=n.refreshTokenLeewaySeconds,this.initialAuthTokenReuse=n.initialAuthTokenReuse,this.lastRefreshChange=!1}notifyRefreshChange(e){if(this.authState.state!=="noAuth"&&this.authState.state!=="initialRefetch"&&this.authState.config.onRefreshChange&&this.lastRefreshChange!==e)this.lastRefreshChange=e,this.authState.config.onRefreshChange(e)}async setConfig(e,t,n){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();let r=await this.fetchTokenAndGuardAgainstRace(e,{forceRefreshToken:!1});if(r.isFromOutdatedConfig)return;let o={fetchToken:e,onAuthChange:t,onRefreshChange:n};if(r.value)this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:o,hasRetried:!1}),this.authenticate(r.value);else this.setAuthState({state:"initialRefetch",config:o}),await this.refetchToken();this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket()}onTransition(e){if(!this.syncState.isCurrentOrNewerAuthVersion(e.endVersion.identity))return;if(e.endVersion.identity<=e.startVersion.identity)return;if(this._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid");let t=this.syncState.getAuth()?.value;if(this.initialAuthTokenReuse&&t)this.scheduleTokenRefetch(t,e.clientClockSkew);else this.refetchToken();this.authState.config.onAuthChange(!0);return}if(this.authState.state==="waitingForServerConfirmationOfFreshToken"){if(this._logVerbose("server confirmed new auth token is valid"),this.notifyRefreshChange(!1),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,!this.authState.hadAuth)this.authState.config.onAuthChange(!0)}}onAuthError(e){if(e.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}let{baseVersion:t}=e;if(!this.syncState.isCurrentOrNewerAuthVersion(t+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(e);return}async tryToReauthenticate(e){if(this._logVerbose(`attempting to reauthenticate: ${e.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=kA){if(this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`),this.syncState.hasAuth())this.syncState.clearAuth();if(this.authState.state!=="noAuth")this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}if(this.authState.state==="waitingForServerConfirmationOfFreshToken")this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${kA-this.tokenConfirmationAttempts} attempts remaining`);if(this.notifyRefreshChange(!0),await this.stopSocket(),this.authState.state==="noAuth")return;let t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});if(t.isFromOutdatedConfig)return;if(t.value&&this.syncState.isNewAuth(t.value))this.authenticate(t.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:t.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"});else{if(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth())this.syncState.clearAuth();this.setAndReportAuthFailed(this.authState.config.onAuthChange)}this.tryRestartSocket()}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");let e=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});if(e.isFromOutdatedConfig)return;if(e.value)if(this.syncState.isNewAuth(e.value))this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:e.value,config:this.authState.config}),this.authenticate(e.value);else this.setAuthState({state:"notRefetching",config:this.authState.config});else{if(this._logVerbose("refetching token failed"),this.syncState.hasAuth())this.clearAuth();this.setAndReportAuthFailed(this.authState.config.onAuthChange)}this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket()}scheduleTokenRefetch(e,t){if(this.authState.state==="noAuth")return;let n=this.decodeToken(e);if(!n){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}let{iat:r,exp:o}=n;if(!r||!o){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}let a=o-r;if(a<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let i;if(t!==void 0){let f=(Date.now()-t)/1000;if(i=o-f,i<=0)i=0}else i=a;let s=Math.min(lq,(i-this.refreshTokenLeewaySeconds)*1000);if(s<=0)this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${i}s`),s=0;let c=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},s);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:c,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${s}ms`)}async fetchTokenAndGuardAgainstRace(e,t){let n=++this.configVersion;this._logVerbose(`fetching token with config version ${n}`);let r=await e(t);if(this.configVersion!==n)return this._logVerbose(`stale config version, expected ${n}, got ${this.configVersion}`),{isFromOutdatedConfig:!0};return{isFromOutdatedConfig:!1,value:r}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(e){e(!1),this.resetAuthState()}resetAuthState(){this.notifyRefreshChange(!1),this.setAuthState({state:"noAuth"})}setAuthState(e){let t=e.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:e.hadAuth,state:e.state,token:`...${e.token.slice(-7)}`}:{state:e.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(t)}`),e.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break;case"waitingForServerConfirmationOfFreshToken":case"waitingForServerConfirmationOfCachedToken":case"initialRefetch":break;default:}if(this.authState.state==="waitingForScheduledRefetch")clearTimeout(this.authState.refetchTokenTimeoutId);this.authState=e}decodeToken(e){try{return yp(e)}catch(t){return this._logVerbose(`Error decoding token: ${t instanceof Error?t.message:"Unknown error"}`),null}}_logVerbose(e){this.logger.logVerbose(`${e} [v${this.configVersion}]`)}}var cq=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function xA(e,t){let n={sessionId:t};if(typeof performance>"u"||!performance.mark)return;performance.mark(e,{detail:n})}function uq(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function TA(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];let t=[];for(let n of cq){let r=performance.getEntriesByName(n).filter((o)=>o.entryType==="mark").filter((o)=>o.detail.sessionId===e);t.push(...r)}return t.map(uq)}var dq=Object.defineProperty,fq=(e,t,n)=>(t in e)?dq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kt=(e,t,n)=>fq(e,typeof t!=="symbol"?t+"":t,n);class bp{constructor(e,t,n){if(kt(this,"address"),kt(this,"state"),kt(this,"requestManager"),kt(this,"webSocketManager"),kt(this,"authenticationManager"),kt(this,"remoteQuerySet"),kt(this,"optimisticQueryResults"),kt(this,"_transitionHandlerCounter",0),kt(this,"_nextRequestId"),kt(this,"_onTransitionFns",new Map),kt(this,"_sessionId"),kt(this,"firstMessageReceived",!1),kt(this,"debug"),kt(this,"logger"),kt(this,"maxObservedTimestamp"),kt(this,"connectionStateSubscribers",new Map),kt(this,"nextConnectionStateSubscriberId",0),kt(this,"_lastPublishedConnectionState"),kt(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{let u=this.connectionState();if(JSON.stringify(u)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=u;for(let m of this.connectionStateSubscribers.values())m(u)}})}),kt(this,"mark",(u)=>{if(this.debug)xA(u,this.sessionId)}),typeof e==="object")throw Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");if(n?.skipConvexDeploymentUrlCheck!==!0)oA(e);n={...n};let r=n.authRefreshTokenLeewaySeconds??10,o=n.webSocketConstructor;if(!o&&typeof WebSocket>"u")throw Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");o=o||WebSocket,this.debug=n.reportDebugInfoToConvex??!1,this.address=e,this.logger=n.logger===!1?dp({verbose:n.verbose??!1}):n.logger!==!0&&n.logger?n.logger:up({verbose:n.verbose??!1});let a=e.search("://");if(a===-1)throw Error("Provided address was not an absolute URL.");let i=e.substring(a+3),s=e.substring(0,a),c;if(s==="http")c="ws";else if(s==="https")c="wss";else throw Error(`Unknown parent protocol ${s}`);let f=`${c}://${i}/api/${Lb}/sync`;this.state=new zb,this.remoteQuerySet=new gp((u)=>this.state.queryPath(u),this.logger),this.requestManager=new jb(this.logger,this.markConnectionStateDirty);let p=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new Fb(this.state,{authenticate:(u)=>{let m=this.state.setAuth(u);return this.webSocketManager.sendMessage(m),m.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:p,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:r,initialAuthTokenReuse:n.initialAuthTokenReuse??!1}),this.optimisticQueryResults=new Vb,this.addOnTransitionHandler((u)=>{t(u.queries.map((m)=>m.token))}),this._nextRequestId=0,this._sessionId=wA();let{unsavedChangesWarning:d}=n;if(typeof window>"u"||typeof window.addEventListener>"u"){if(d===!0)throw Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else if(d!==!1)window.addEventListener("beforeunload",(u)=>{if(this.requestManager.hasIncompleteRequests()){u.preventDefault();let m="Are you sure you want to leave? Your changes may not be saved.";return(u||window.event).returnValue=m,m}});if(this.webSocketManager=new Yb(f,{onOpen:(u)=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...u,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new gp((g)=>this.state.queryPath(g),this.logger);let[m,y]=this.state.restart();if(y)this.webSocketManager.sendMessage(y);this.webSocketManager.sendMessage(m);for(let g of this.requestManager.restart())this.webSocketManager.sendMessage(g)},onResume:()=>{let[u,m]=this.state.resume();if(m)this.webSocketManager.sendMessage(m);if(u)this.webSocketManager.sendMessage(u);for(let y of this.requestManager.resume())this.webSocketManager.sendMessage(y)},onMessage:(u)=>{if(!this.firstMessageReceived)this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks();switch(u.type){case"Transition":{this.observedTimestamp(u.endVersion.ts),this.authenticationManager.onTransition(u),this.remoteQuerySet.transition(u),this.state.transition(u);let m=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(m);break}case"MutationResponse":{if(u.success)this.observedTimestamp(u.ts);let m=this.requestManager.onResponse(u);if(m!==null)this.notifyOnQueryResultChanges(new Map([[m.requestId,m.result]]));break}case"ActionResponse":{this.requestManager.onResponse(u);break}case"AuthError":{this.authenticationManager.onAuthError(u);break}case"FatalError":{let m=pA(this.logger,u.error);throw this.webSocketManager.terminate(),m}default:}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:n.onServerDisconnectError},o,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),n.expectAuth)p()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()&&this.state.hasSyncedPastLastReconnect()}observedTimestamp(e){if(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(e))this.maxObservedTimestamp=e}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(e){let t=this.remoteQuerySet.remoteQueryResults(),n=new Map;for(let[o,a]of t){let i=this.state.queryToken(o);if(i!==null){let s={result:a,udfPath:this.state.queryPath(o),args:this.state.queryArgs(o)};n.set(i,s)}}let r=this.optimisticQueryResults.ingestQueryResultsFromServer(n,new Set(e.keys()));this.handleTransition({queries:r.map((o)=>{let a=this.optimisticQueryResults.rawQueryResult(o);return{token:o,modification:{kind:"Updated",result:a}}}),reflectedMutations:Array.from(e).map(([o,a])=>({requestId:o,result:a})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(e){for(let t of this._onTransitionFns.values())t(e)}addOnTransitionHandler(e){let t=this._transitionHandlerCounter++;return this._onTransitionFns.set(t,e),()=>this._onTransitionFns.delete(t)}getCurrentAuthClaims(){let e=this.state.getAuth(),t={};if(e&&e.tokenType==="User")try{t=e?yp(e.value):{}}catch{t={}}else return;return{token:e.value,decoded:t}}setAuth(e,t,n){this.authenticationManager.setConfig(e,t,n)}hasAuth(){return this.state.hasAuth()}setAdminAuth(e,t){let n=this.state.setAdminAuth(e,t);this.webSocketManager.sendMessage(n)}clearAuth(){let e=this.state.clearAuth();this.webSocketManager.sendMessage(e)}subscribe(e,t,n){let r=Vr(t),{modification:o,queryToken:a,unsubscribe:i}=this.state.subscribe(e,r,n?.journal,n?.componentPath);if(o!==null)this.webSocketManager.sendMessage(o);return{queryToken:a,unsubscribe:()=>{let s=i();if(s)this.webSocketManager.sendMessage(s)}}}localQueryResult(e,t){let n=Vr(t),r=Gr(e,n);return this.optimisticQueryResults.queryResult(r)}localQueryResultByToken(e){return this.optimisticQueryResults.queryResult(e)}hasLocalQueryResultByToken(e){return this.optimisticQueryResults.hasQueryResult(e)}localQueryLogs(e,t){let n=Vr(t),r=Gr(e,n);return this.optimisticQueryResults.queryLogs(r)}queryJournal(e,t){let n=Vr(t),r=Gr(e,n);return this.state.queryJournal(r)}connectionState(){let e=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:e.isConnected,hasEverConnected:e.hasEverConnected,connectionCount:e.connectionCount,connectionRetries:e.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(e){let t=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(t,e),()=>{this.connectionStateSubscribers.delete(t)}}async mutation(e,t,n){let r=await this.mutationInternal(e,t,n);if(!r.success){if(r.errorData!==void 0)throw zc(r,new Qr(ba("mutation",e,r)));throw Error(ba("mutation",e,r))}return r.value}async mutationInternal(e,t,n,r){let{mutationPromise:o}=this.enqueueMutation(e,t,n,r);return o}enqueueMutation(e,t,n,r){let o=Vr(t);this.tryReportLongDisconnect();let a=this.nextRequestId;if(this._nextRequestId++,n!==void 0){let f=n.optimisticUpdate;if(f!==void 0){let p=(m)=>{if(f(m,o)instanceof Promise)this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},u=this.optimisticQueryResults.applyOptimisticUpdate(p,a).map((m)=>{let y=this.localQueryResultByToken(m);return{token:m,modification:{kind:"Updated",result:y===void 0?void 0:{success:!0,value:y,logLines:[]}}}});this.handleTransition({queries:u,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}let i={type:"Mutation",requestId:a,udfPath:e,componentPath:r,args:[Lt(o)]},s=this.webSocketManager.sendMessage(i),c=this.requestManager.request(i,s);return{requestId:a,mutationPromise:c}}async action(e,t){let n=await this.actionInternal(e,t);if(!n.success){if(n.errorData!==void 0)throw zc(n,new Qr(ba("action",e,n)));throw Error(ba("action",e,n))}return n.value}async actionInternal(e,t,n){let r=Vr(t),o=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();let a={type:"Action",requestId:o,udfPath:e,componentPath:n,args:[Lt(r)]},i=this.webSocketManager.sendMessage(a);return this.requestManager.request(a,i)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){let e=TA(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:e})}}tryReportLongDisconnect(){if(!this.debug)return;let e=this.connectionState().timeOfOldestInflightRequest;if(e===null||Date.now()-e.getTime()<=60000)return;let t=`${this.address}/api/debug_event`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${Lb}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then((n)=>{if(!n.ok)this.logger.warn("Analytics request failed with response:",n.body)}).catch((n)=>{this.logger.warn("Analytics response failed with error:",n)})}}function SA({getCurrentValue:e,subscribe:t}){let[n,r]=S(()=>({getCurrentValue:e,subscribe:t,value:e()})),o=n.value;if(n.getCurrentValue!==e||n.subscribe!==t)o=e(),r({getCurrentValue:e,subscribe:t,value:o});return _(()=>{let a=!1,i=()=>{if(a)return;r((c)=>{if(c.getCurrentValue!==e||c.subscribe!==t)return c;let f=e();if(c.value===f)return c;return{...c,value:f}})},s=t(i);return i(),()=>{a=!0,s()}},[e,t]),o}function vp(e){if(typeof e!=="object"||e===null||!Array.isArray(e.page)||typeof e.isDone!=="boolean"||typeof e.continueCursor!=="string")throw Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var pq=Object.defineProperty,mq=(e,t,n)=>(t in e)?pq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CA=(e,t,n)=>mq(e,typeof t!=="symbol"?t+"":t,n);class Xb{constructor(e,t){this.client=e,this.onTransition=t,CA(this,"paginatedQuerySet",new Map),CA(this,"lastTransitionTs"),this.lastTransitionTs=Yt.fromNumber(0),this.client.addOnTransitionHandler((n)=>this.onBaseTransition(n))}subscribe(e,t,n){let r=Kr(e),o=Ub(r,t,n),a=()=>this.removePaginatedQuerySubscriber(o),i=this.paginatedQuerySet.get(o);if(i)return i.numSubscribers+=1,{paginatedQueryToken:o,unsubscribe:a};return this.paginatedQuerySet.set(o,{token:o,canonicalizedUdfPath:r,args:t,numSubscribers:1,options:{initialNumItems:n.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:n.id}),this.addPageToPaginatedQuery(o,null,n.initialNumItems),{paginatedQueryToken:o,unsubscribe:a}}localQueryResult(e,t,n){let r=Kr(e),o=Ub(r,t,n);return this.localQueryResultByToken(o)}localQueryResultByToken(e){let t=this.paginatedQuerySet.get(e);if(!t)return;let n=this.activePageQueryTokens(t);if(n.length===0)return{results:[],status:"LoadingFirstPage",loadMore:(s)=>this.loadMoreOfPaginatedQuery(e,s)};let r=[],o=!1,a=!1;for(let s of n){let c=this.client.localQueryResultByToken(s);if(c===void 0){o=!0,a=!1;continue}let f=vp(c);r=r.concat(f.page),a=!!f.isDone}let i;if(o)i=r.length===0?"LoadingFirstPage":"LoadingMore";else if(a)i="Exhausted";else i="CanLoadMore";return{results:r,status:i,loadMore:(s)=>this.loadMoreOfPaginatedQuery(e,s)}}onBaseTransition(e){let t=e.queries.map((a)=>a.token),n=this.queriesContainingTokens(t),r=[];if(n.length>0)this.processPaginatedQuerySplits(n,(a)=>this.client.localQueryResultByToken(a)),r=n.map((a)=>({token:a,modification:{kind:"Updated",result:this.localQueryResultByToken(a)}}));let o={...e,paginatedQueries:r};this.onTransition(o)}loadMoreOfPaginatedQuery(e,t){this.mustGetPaginatedQuery(e);let n=this.queryTokenForLastPageOfPaginatedQuery(e),r=this.client.localQueryResultByToken(n);if(!r)return!1;let o=vp(r);if(o.isDone)return!1;this.addPageToPaginatedQuery(e,o.continueCursor,t);let a={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:e,modification:{kind:"Updated",result:this.localQueryResultByToken(e)}}]};return this.onTransition(a),!0}queriesContainingTokens(e){if(e.length===0)return[];let t=[],n=new Set(e);for(let[r,o]of this.paginatedQuerySet)for(let a of this.allQueryTokens(o))if(n.has(a)){t.push(r);break}return t}processPaginatedQuerySplits(e,t){for(let n of e){let r=this.mustGetPaginatedQuery(n),{ongoingSplits:o,pageKeyToQuery:a,pageKeys:i}=r;for(let[s,[c,f]]of o)if(t(a.get(c).queryToken)!==void 0&&t(a.get(f).queryToken)!==void 0)this.completePaginatedQuerySplit(r,s,c,f);for(let s of i){if(o.has(s))continue;let c=a.get(s);if(!c)throw Error(`No page query for active pageKey ${s}`);let f=t(c.queryToken);if(!f)continue;let p=vp(f);if(p.splitCursor&&(p.pageStatus==="SplitRecommended"||p.pageStatus==="SplitRequired"||p.page.length>r.options.initialNumItems*2))this.splitPaginatedQueryPage(r,s,c.cursor,p.splitCursor,p.continueCursor)}}}splitPaginatedQueryPage(e,t,n,r,o){let a=e.nextPageKey++,i=e.nextPageKey++,s={numItems:e.options.initialNumItems,id:e.id},c=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...s,cursor:n,endCursor:r}});e.pageKeyToQuery.set(a,{...c,cursor:n});let f=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...s,cursor:r,endCursor:o}});e.pageKeyToQuery.set(i,{...f,cursor:r}),e.ongoingSplits.set(t,[a,i])}addPageToPaginatedQuery(e,t,n){let r=this.mustGetPaginatedQuery(e),o=r.nextPageKey++,a={cursor:t,numItems:n,id:r.id},i={...r.args,paginationOpts:a},s=this.client.subscribe(r.canonicalizedUdfPath,i);return r.pageKeys.push(o),r.pageKeyToQuery.set(o,{...s,cursor:t}),s}removePaginatedQuerySubscriber(e){let t=this.paginatedQuerySet.get(e);if(!t)return;if(t.numSubscribers-=1,t.numSubscribers>0)return;for(let n of t.pageKeyToQuery.values())n.unsubscribe();this.paginatedQuerySet.delete(e)}completePaginatedQuerySplit(e,t,n,r){let o=e.pageKeyToQuery.get(t);e.pageKeyToQuery.delete(t);let a=e.pageKeys.indexOf(t);e.pageKeys.splice(a,1,n,r),e.ongoingSplits.delete(t),o.unsubscribe()}activePageQueryTokens(e){return e.pageKeys.map((t)=>e.pageKeyToQuery.get(t).queryToken)}allQueryTokens(e){return Array.from(e.pageKeyToQuery.values()).map((t)=>t.queryToken)}queryTokenForLastPageOfPaginatedQuery(e){let t=this.mustGetPaginatedQuery(e),n=t.pageKeys[t.pageKeys.length-1];if(n===void 0)throw Error(`No pages for paginated query ${e}`);return t.pageKeyToQuery.get(n).queryToken}mustGetPaginatedQuery(e){let t=this.paginatedQuerySet.get(e);if(!t)throw Error("paginated query no longer exists for token "+e);return t}}var hq=Object.defineProperty,yq=(e,t,n)=>(t in e)?hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,So=(e,t,n)=>yq(e,typeof t!=="symbol"?t+"":t,n),bq=5000;if(typeof Ci>"u")throw Error("Required dependency 'react' not found");class wp{constructor(e,t){if(So(this,"address"),So(this,"cachedSync"),So(this,"cachedPaginatedQueryClient"),So(this,"listeners"),So(this,"options"),So(this,"closed",!1),So(this,"_logger"),So(this,"adminAuth"),So(this,"fakeUserIdentity"),e===void 0)throw Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof e!=="string")throw Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof e} instead.`);if(!e.includes("://"))throw Error("Provided address was not an absolute URL.");this.address=e,this.listeners=new Map,this._logger=t?.logger===!1?dp({verbose:t?.verbose??!1}):t?.logger!==!0&&t?.logger?t.logger:up({verbose:t?.verbose??!1}),this.options={...t,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw Error("ConvexReactClient has already been closed.");if(this.cachedSync)return this.cachedSync;if(this.cachedSync=this.options.baseClient??new bp(this.address,()=>{},this.options),this.adminAuth)this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity);return this.cachedPaginatedQueryClient=new Xb(this.cachedSync,(e)=>this.handleTransition(e)),this.cachedSync}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw Error("Should already be instantiated")}setAuth(e,t,n){if(typeof e==="string")throw Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(e,t??(()=>{}),n)}clearAuth(){this.sync.clearAuth()}setAdminAuth(e,t){if(this.adminAuth=e,this.fakeUserIdentity=t,this.closed)throw Error("ConvexReactClient has already been closed.");if(this.cachedSync)this.sync.setAdminAuth(e,t)}watchQuery(e,...t){let[n,r]=t,o=ft(e);return{onUpdate:(a)=>{let{queryToken:i,unsubscribe:s}=this.sync.subscribe(o,n,r),c=this.listeners.get(i);if(c!==void 0)c.add(a);else this.listeners.set(i,new Set([a]));return()=>{if(this.closed)return;let f=this.listeners.get(i);if(f.delete(a),f.size===0)this.listeners.delete(i);s()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(o,n);return},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(o,n);return},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(o,n);return}}}prewarmQuery(e){let t=e.extendSubscriptionFor??bq,r=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(r,t)}watchPaginatedQuery(e,t,n){let r=ft(e);return{onUpdate:(o)=>{let{paginatedQueryToken:a,unsubscribe:i}=this.paginatedQueryClient.subscribe(r,t||{},n),s=this.listeners.get(a);if(s!==void 0)s.add(o);else this.listeners.set(a,new Set([o]));return()=>{if(this.closed)return;let c=this.listeners.get(a);if(c.delete(o),c.size===0)this.listeners.delete(a);i()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(r,t,n)}}mutation(e,...t){let[n,r]=t,o=ft(e);return this.sync.mutation(o,n,r)}action(e,...t){let n=ft(e);return this.sync.action(n,...t)}query(e,...t){let n=this.watchQuery(e,...t),r=n.localQueryResult();if(r!==void 0)return Promise.resolve(r);return new Promise((o,a)=>{let i=n.onUpdate(()=>{i();try{o(n.localQueryResult())}catch(s){a(s)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(e){return this.sync.subscribeToConnectionState(e)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient)this.cachedPaginatedQueryClient=void 0;if(this.cachedSync){let e=this.cachedSync;this.cachedSync=void 0,await e.close()}}handleTransition(e){let t=e.queries.map((r)=>r.token),n=e.paginatedQueries.map((r)=>r.token);this.transition([...t,...n])}transition(e){for(let t of e){let n=this.listeners.get(t);if(n)for(let r of n)r()}}}var EA=Nn(void 0);function $c(){return At(EA)}var Wb=({client:e,children:t})=>Na(EA.Provider,{value:e},t);var vq=Object.defineProperty,wq=(e,t,n)=>(t in e)?vq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jb=(e,t,n)=>wq(e,typeof t!=="symbol"?t+"":t,n);class Zb{constructor(e){Jb(this,"createWatch"),Jb(this,"queries"),Jb(this,"listeners"),this.createWatch=e,this.queries={},this.listeners=new Set}setQueries(e){for(let t of Object.keys(e)){let{query:n,args:r,paginationOptions:o}=e[t];if(ft(n),this.queries[t]===void 0)this.addQuery(t,n,r,o?{paginationOptions:o}:{});else{let a=this.queries[t];if(ft(n)!==ft(a.query)||JSON.stringify(Lt(r))!==JSON.stringify(Lt(a.args))||JSON.stringify(o)!==JSON.stringify(a.paginationOptions))this.removeQuery(t),this.addQuery(t,n,r,o?{paginationOptions:o}:{})}}for(let t of Object.keys(this.queries))if(e[t]===void 0)this.removeQuery(t)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getLocalResults(e){let t={};for(let n of Object.keys(e)){let{query:r,args:o}=e[n],a=e[n].paginationOptions;ft(r);let i=this.createWatch(r,o,a?{paginationOptions:a}:{}),s;try{s=i.localQueryResult()}catch(c){if(c instanceof Error)s=c;else throw c}t[n]=s}return t}setCreateWatch(e){this.createWatch=e;for(let t of Object.keys(this.queries)){let{query:n,args:r,watch:o,paginationOptions:a}=this.queries[t],i="journal"in o?o.journal():void 0;this.removeQuery(t),this.addQuery(t,n,r,{...i?{journal:i}:[],...a?{paginationOptions:a}:{}})}}destroy(){for(let e of Object.keys(this.queries))this.removeQuery(e);this.listeners=new Set}addQuery(e,t,n,{paginationOptions:r,journal:o}){if(this.queries[e]!==void 0)throw Error(`Tried to add a new query with identifier ${e} when it already exists.`);let a=this.createWatch(t,n,{...o?{journal:o}:[],...r?{paginationOptions:r}:{}}),i=a.onUpdate(()=>this.notifyListeners());this.queries[e]={query:t,args:n,watch:a,unsubscribe:i,...r?{paginationOptions:r}:{}}}removeQuery(e){let t=this.queries[e];if(t===void 0)throw Error(`No query found with identifier ${e}.`);t.unsubscribe(),delete this.queries[e]}notifyListeners(){for(let e of this.listeners)e()}}function Fs(e){let t=$c();if(t===void 0)throw Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");let n=Ee(()=>(r,o,{journal:a,paginationOptions:i})=>{if(i)return t.watchPaginatedQuery(r,o,i);else return t.watchQuery(r,o,a?{journal:a}:{})},[t]);return kq(e,n)}function kq(e,t){let[n]=S(()=>new Zb(t));if(n.createWatch!==t)n.setCreateWatch(t);_(()=>()=>n.destroy(),[n]);let r=Ee(()=>({getCurrentValue:()=>n.getLocalResults(e),subscribe:(o)=>(n.setQueries(e),n.subscribe(o))}),[n,e]);return SA(r)}var xq=(e,t,n)=>(r)=>{let o={...r.queries},a=r.nextPageKey,i=r.nextPageKey+1,s=r.nextPageKey+2;o[a]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,endCursor:t}}},o[i]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,cursor:t,endCursor:n}}};let c={...r.ongoingSplits};return c[e]=[a,i],{...r,nextPageKey:s,queries:o,ongoingSplits:c}},Tq=(e)=>(t)=>{let n=t.ongoingSplits[e];if(n===void 0)return t;let r={...t.queries};delete r[e];let o={...t.ongoingSplits};delete o[e];let a=t.pageKeys.slice(),i=t.pageKeys.findIndex((s)=>s===e);if(i>=0)a=[...t.pageKeys.slice(0,i),...n,...t.pageKeys.slice(i+1)];return{...t,queries:r,pageKeys:a,ongoingSplits:o}};function ev(e,t,n){let{user:r}=Eq(e,t,n,!0);return r}var Sq=Symbol("includePageKeys"),Cq=Symbol("page");function Eq(e,t,n,r=!0){if(typeof n?.initialNumItems!=="number"||n.initialNumItems<0)throw Error(`\`options.initialNumItems\` must be a positive number. Received \`${n?.initialNumItems}\`.`);let o=t==="skip",a=o?{}:t,i=ft(e),s=Ee(()=>()=>{let v=Nq();return{query:e,args:a,id:v,nextPageKey:1,pageKeys:o?[]:[0],queries:o?{}:{0:{query:e,args:{...a,paginationOpts:{numItems:n.initialNumItems,cursor:null,id:v}}}},ongoingSplits:{},skip:o}},[JSON.stringify(Lt(a)),i,n.initialNumItems,o]),[c,f]=S(s),p=c;if(ft(e)!==ft(c.query)||JSON.stringify(Lt(a))!==JSON.stringify(Lt(c.args))||o!==c.skip)p=s(),f(p);let u=$c().logger,m=Fs(p.queries),y=n[Sq]??!1,[g,x,k]=Ee(()=>{let v=void 0,w=[];for(let T of p.pageKeys){if(v=m[T],v===void 0)break;if(v instanceof Error)if(v.message.includes("InvalidCursor")||v instanceof Qr&&typeof v.data==="object"&&v.data?.isConvexSystemError===!0&&v.data?.paginationError==="InvalidCursor")return u.warn("usePaginatedQuery hit error, resetting pagination state: "+v.message),f(s),[[],void 0,void 0];else{if(r)throw v;return[w,void 0,v]}let C=p.ongoingSplits[T];if(C!==void 0){if(m[C[0]]!==void 0&&m[C[1]]!==void 0)f(Tq(T))}else if(v.splitCursor&&(v.pageStatus==="SplitRecommended"||v.pageStatus==="SplitRequired"||v.page.length>n.initialNumItems*2))f(xq(T,v.splitCursor,v.continueCursor));if(v.pageStatus==="SplitRequired")return[w,void 0,void 0];w.push(...y?v.page.map((E)=>({...E,[Cq]:T.toString()})):v.page)}return[w,v,void 0]},[m,p.pageKeys,p.ongoingSplits,n.initialNumItems,s,u,y,r]),b=Ee(()=>{if(k!==void 0)return{status:"Error",isLoading:!1,error:k,loadMore:()=>{}};if(x===void 0)if(p.nextPageKey===1)return{status:"LoadingFirstPage",isLoading:!0,loadMore:()=>{}};else return{status:"LoadingMore",isLoading:!0,loadMore:(T)=>{}};if(x.isDone)return{status:"Exhausted",isLoading:!1,loadMore:(T)=>{}};let v=x.continueCursor,w=!1;return{status:"CanLoadMore",isLoading:!1,loadMore:(T)=>{if(!w)w=!0,f((C)=>{let E=[...C.pageKeys,C.nextPageKey],A={...C.queries};return A[C.nextPageKey]={query:C.query,args:{...C.args,paginationOpts:{numItems:T,cursor:v,id:C.id}}},{...C,nextPageKey:C.nextPageKey+1,pageKeys:E,queries:A}})}}},[k,x,p.nextPageKey]);return{user:{results:g,...b},internal:{state:p}}}var NA=0;function Nq(){return NA++,NA}var AA=Nn(void 0);function RA(){let e=At(AA);if(e===void 0)throw Error("Could not find `ConvexProviderWithAuth` (or `ConvexProviderWithClerk` or `ConvexProviderWithAuth0`) as an ancestor component. This component may be missing, or you might have two instances of the `convex/react` module loaded in your project.");return e}function MA({children:e,client:t,useAuth:n}){let{isLoading:r,isAuthenticated:o,fetchAccessToken:a}=n(),[i,s]=S(null),[c,f]=S(!1);if(r&&i!==null)s(null),f(!1);if(!r&&!o&&i!==!1)s(!1),f(!1);let p=o&&(i??!1),d=i===null,u=c&&p,m=Ee(()=>({isLoading:d,isAuthenticated:p,isRefreshing:u}),[d,p,u]);return Na(AA.Provider,{value:m},Na(Aq,{authProviderAuthenticated:o,fetchAccessToken:a,authProviderLoading:r,client:t,setIsConvexAuthenticated:s,setIsRefreshing:f}),Na(Wb,{client:t},e),Na(Rq,{authProviderAuthenticated:o,fetchAccessToken:a,authProviderLoading:r,client:t,setIsConvexAuthenticated:s,setIsRefreshing:f}))}function Aq({authProviderAuthenticated:e,fetchAccessToken:t,authProviderLoading:n,client:r,setIsConvexAuthenticated:o,setIsRefreshing:a}){return _(()=>{let i=!0;if(e)return r.setAuth(t,(s)=>{if(i)o(()=>s)},(s)=>{if(i)a(s)}),()=>{i=!1,o((s)=>s?!1:null),a(!1)}},[e,t,n,r,o,a]),null}function Rq({authProviderAuthenticated:e,fetchAccessToken:t,authProviderLoading:n,client:r,setIsConvexAuthenticated:o,setIsRefreshing:a}){return _(()=>{if(e)return()=>{r.clearAuth(),o(()=>null),a(!1)}},[e,t,n,r,o,a]),null}function IA(e,t={}){return new wp(e,{...t,initialAuthTokenReuse:!0})}function OA(e,t){return new Proxy({},{get(r,o){if(typeof o==="string"){let a=[...t,o];return OA(e,a)}else if(o===Bb){if(t.length<1){let a=[e,...t].join(".");throw Error(`API path is expected to be of the form \`${e}.childComponent.functionName\`. Found: \`${a}\``)}return"_reference/childComponent/"+t.join("/")}else return}})}var tv=()=>OA("components",[]);var j=Hb;var SV=tv();var Mq=5,Iq=4;function Oq(e){if(e.threadPages!==!0||typeof e.website!=="string")return;try{let t=new URL(e.website);return t.protocol==="https:"||t.protocol==="http:"?e.website:void 0}catch{return}}function _q(e){let t=new URL(e);if(t.pathname!=="/"&&!t.hostname.endsWith(".convex.cloud"))return`${t.origin}${t.pathname.replace(/\/$/,"")}`;if(t.hostname.endsWith(".convex.cloud"))t.hostname=t.hostname.replace(/\.convex\.cloud$/,".convex.site");else if(t.port!=="")t.port=String(Number(t.port)+1);return t.origin}async function _A(e,t,n,r=Mq){let o=await t(`${e}/critiqs/config`).catch(()=>{throw Error(`${n}.`)});if(!o.ok)throw Error(`${n} (${o.status}).`);let a=await o.json();return{signInUrl:a.signInUrl.replace(/\/$/,""),current:typeof a.protocol==="number"&&a.protocol>=r,transport:a.transport==="http"?"http":"convex",signIn:a.signIn??null,mockups:a.mockups===!0,personalAi:a.personalAi===!0,modelLists:a.modelLists===!0,organizations:a.organizations===!0,organizationMembers:a.organizationMembers===!0,overageCap:a.overageCap===!0,billing:a.billing===!0,website:Oq(a),addressLists:a.addressLists===!0,addressEdits:a.addressEdits===!0,addressNotes:a.addressNotes===!0,createKeys:a.createKeys===!0,presetTags:a.presetTags===!0,connections:a.connections===!0,threadMadeWith:a.threadMadeWith===!0,threadMentions:a.threadMentions===!0,reviewLinks:typeof a.reviewLinks==="object"&&a.reviewLinks!==null&&a.reviewLinks.live===!0,tickets:Pq(a.tickets)}}function Pq(e){if(typeof e!=="object"||e===null||!Array.isArray(e.trackers))return null;let t=new Set(vn.map((a)=>a.id)),n=e.trackers.flatMap((a)=>{let{id:i,signIn:s,installUrl:c}=typeof a==="object"&&a!==null?a:{};if(typeof i!=="string"||!t.has(i)||s!=="oauth"&&s!=="token")return[];let f=typeof c==="string"&&/^https?:\/\//.test(c)?{installUrl:c}:{};return[{id:i,signIn:s,...f}]});if(n.length===0)return null;let r=e,o=(...a)=>Object.fromEntries(a.filter((i)=>r[i]===!0).map((i)=>[i,!0]));if(r.threadTickets!==!0)return{trackers:n,...o("ticketStatus")};return{trackers:n,threadTickets:!0,...o("drafting","ticketStatus","defaultDestinations")}}async function PA(e,t=fetch){let n=new URL(e,globalThis.location?.href).toString().replace(/\/$/,""),r=_q(n),o=n.replace(/\/$/,"")===pc,a=await _A(r,t,`Critiqs can't reach its backend at ${n}`);if(!a.current)throw Error(o?"Critiqs Cloud isn't ready for this version of Critiqs yet.":`The Critiqs backend at ${n} runs an older version. Deploy the current Critiqs functions to it.`);if(a.transport==="convex"&&new URL(a.signInUrl).origin!==r){if(!(await _A(new URL(a.signInUrl).origin,t,`Critiqs can't reach its sign-in service at ${a.signInUrl}`,Iq)).current)throw Error(`Critiqs's sign-in service at ${a.signInUrl} isn't ready for this version of Critiqs yet.`)}return{backendUrl:n,siteUrl:r,signInUrl:a.signInUrl,transport:a.transport,signIn:a.signIn,mockups:a.mockups,personalAi:a.personalAi,modelLists:a.modelLists,organizations:a.organizations,organizationMembers:a.organizationMembers,overageCap:a.overageCap,billing:a.billing,addressLists:a.addressLists,addressEdits:a.addressEdits,addressNotes:a.addressNotes,createKeys:a.createKeys,presetTags:a.presetTags,connections:a.connections,threadMadeWith:a.threadMadeWith,threadMentions:a.threadMentions,reviewLinks:a.reviewLinks,tickets:a.tickets,...a.website===void 0?{}:{website:a.website}}}function kp(e,t){return e.threadMentions===!0&&t!==null?{threadId:t}:{}}function xp(e){return e.overageCap===!0?{aiCredits:!0}:{}}function Tp(e,t=globalThis.location){return e.threadMadeWith===!0&&t?.protocol==="chrome-extension:"?{madeWith:"extension"}:{}}var DA=/^([a-z0-9]{16,64}|p_[0-9a-f]{32})$/;async function LA(e,t,n=fetch){try{let r=await n(`${e.siteUrl}/critiqs/health?projectId=${encodeURIComponent(t)}`);if(!r.ok)return"unknown";let o=await r.json();return o.project==="found"||o.project==="missing"?o.project:"unknown"}catch{return"unknown"}}var Dq=["/capture/upload","/mockup/upload"];async function nv(e,t,n,r,o=fetch,a){let i=new URL(e),s=Dq.includes(i.pathname),c=s&&i.origin===new URL(t).origin;if(i.username||i.password||s&&!c)throw Error(`The ${a} upload address is not trusted.`);let f={"Content-Type":n.type};if(c){let u=await r();if(u===null)throw Error(`Sign in again to upload the ${a}.`);f.Authorization=`Bearer ${u}`}let p=await o(i,{method:"POST",headers:f,body:n,redirect:"error"});if(!p.ok)throw Error(`The ${a} could not be uploaded.`);let d=await p.json();if(typeof d.storageId!=="string"||d.storageId==="")throw Error(`The ${a} could not be uploaded.`);return d.storageId}async function qA(e,t,n,r,o=fetch){return await nv(e,t,n,r,o,"screenshot")}function UA(e,t){let n=[],r=[null],o=null,a=!1;for(let i=0;i<e.length;i++){let s=t[String(i)];if(s instanceof Error){o=s;break}if(s===void 0)break;if(n.push(s),s.isDone){a=!0;break}if(s.continueCursor===""||r.includes(s.continueCursor)){o=Error("Pagination did not advance. Try again.");break}if(r.push(s.continueCursor),e[i+1]!==s.continueCursor)break}return{pages:n,next:r,failure:o,complete:a}}function gt(e,t){let n=ft(e),r=t==="skip"?"skip":JSON.stringify(t),o=Ee(()=>t==="skip"?{}:{result:{query:e,args:t}},[n,r]),a=Fs(o).result;if(t==="skip"||a===void 0)return{status:"loading"};if(a instanceof Error)return zn(a);return{status:"ready",data:a}}function Hc(e,t){let n=ft(e),r=t==="skip"?"skip":JSON.stringify(t),o=O(null),[a,i]=S({key:r,cursors:[null]}),s=a.key===r?a.cursors:[null],c=Ee(()=>t==="skip"?{}:Object.fromEntries(s.map((g,x)=>[String(x),{query:e,args:{...t,paginationOpts:{numItems:40,cursor:g}}}])),[n,r,JSON.stringify(s)]),f=Fs(c),{pages:p,next:d,failure:u,complete:m}=UA(s,f),y=JSON.stringify(d);if(_(()=>{if(t==="skip"){if(a.key!==r)i({key:r,cursors:[null]});return}if(u===null&&(a.key!==r||JSON.stringify(a.cursors)!==y))i({key:r,cursors:d})},[r,y,u]),u!==null)return zn(u);if(t==="skip")o.current=null;else if(m)o.current={key:r,data:p};return t!=="skip"&&o.current?.key===r?{status:"ready",data:o.current.data}:{status:"loading"}}function jA(e,t,n){let r=!1,o=async(d)=>{let u=await n.fetchAccessToken(d);return r=u!==null,u};function a(){let{reviewer:d}=dn(n.subscribe,n.getSnapshot),u=d?.name,m=ge((y)=>o(y),[u]);return{isLoading:!1,isAuthenticated:d!==null,fetchAccessToken:m}}let i=e.mutation.bind(e),s=(d)=>d.then(()=>{return}),c=Uq(),f=async(d,u)=>{let m=await i(j.captures.generateUploadUrl,{projectId:d}),y=await qA(m,t.siteUrl,u,()=>n.fetchAccessToken({forceRefreshToken:!1}));return c.set(y,{projectId:d,image:u}),y},p=(d,u)=>i(j.threads.create,{projectId:d.projectId,anchor:d.anchor,body:d.body,tags:d.tags,mentions:d.mentions.map(({userId:m,label:y})=>({userId:m,label:y})),capture:u.status==="captured"?{status:"captured",storageId:u.fileId}:u,...Tp(t),...d.mockup===void 0?{}:{mockup:{mockupId:d.mockup.mockupId,snapshotId:d.mockup.snapshotId,node:d.mockup.node}}});return{wrap:(d)=>l(MA,{client:e,useAuth:a,children:d}),useAuth:()=>{let{isLoading:d,isAuthenticated:u}=RA();return{isLoading:d,isAuthenticated:u,rejected:!d&&!u&&r}},useProject:(d)=>gt(j.projects.get,d===null?"skip":{projectId:d}),useMyProjects:(d)=>zA(Hc(j.projects.listMine,d?{}:"skip")),useMyOrganizations:(d)=>gt(j.organizations.mine,d?{}:"skip"),useOrganization:(d)=>gt(j.organizations.get,d===null?"skip":{organizationId:d}),renameOrganization:(d,u)=>s(i(j.organizations.rename,{organizationId:d,name:u})),inviteMember:(d)=>i(j.organizations.invite,d),revokeInvite:(d)=>s(i(j.organizations.revokeInvite,{inviteId:d})),setMemberRole:(d)=>s(i(j.organizations.setRole,d)),removeMember:(d)=>s(i(j.organizations.removeMember,d)),useThreads:(d)=>zA(Hc(j.threads.list,d===null?"skip":{projectId:d})),useParticipants:(d,u,m=null)=>{let y=kp(t,m);return gt(j.projects.participants,d===null?"skip":{projectId:d,query:u,...y.threadId===void 0?{}:{threadId:y.threadId}})},useNotificationSettings:(d)=>gt(j.notifications.settings,d===null?"skip":{projectId:d}),useUsage:(d)=>{let u=si();return gt(j.projects.usage,d===null?"skip":{projectId:d,day:u,...xp(t)})},setNotificationSettings:({projectId:d,...u})=>s(i(j.notifications.setSettings,{projectId:d,...u})),useThread:(d)=>{let u={threadId:d};return zq(Hc(j.threads.get,u),Hc(j.threads.listReactions,u))},syncReviewer:()=>i(j.users.sync,{}),createProject:(d,u,m)=>i(j.projects.create,{name:d,reviewUrl:u,...m===void 0?{}:{organizationId:m}}),setReviewUrl:({projectId:d,reviewUrl:u})=>s(i(j.projects.setReviewUrl,{projectId:d,reviewUrl:u})),setReviewAccess:({projectId:d,reviewAccess:u})=>s(i(j.projects.setReviewAccess,{projectId:d,reviewAccess:u})),recordProjectOpened:(d)=>s(i(j.projects.recordOpened,{projectId:d})),useProjectAddresses:(d)=>gt(j.projects.addresses,d===null?"skip":{projectId:d}),useProjectAddressNotes:(d)=>gt(j.projects.addressNotes,d===null?"skip":{projectId:d}),addProjectAddress:({projectId:d,address:u})=>i(j.projects.addAddress,{projectId:d,address:u}),removeProjectAddress:({projectId:d,address:u})=>i(j.projects.removeAddress,{projectId:d,address:u}),setOverageCap:({organizationId:d,cap:u})=>s(i(j.organizations.setOverageCap,{organizationId:d,cap:u})),uploadImage:f,createThread:async(d)=>{let{capture:u}=d;if(u.status==="failed")return await p(d,u);try{return await Sp(u.fileId,c,(m)=>p(d,{status:"captured",fileId:m}),(m)=>f(m.projectId,m.image))}finally{c.delete(u.fileId)}},reply:({threadId:d,body:u,revision:m,mentions:y})=>i(j.threads.reply,{threadId:d,body:u,revision:m,mentions:y.map(({userId:g,label:x})=>({userId:g,label:x}))}),editMessage:({messageId:d,body:u,mentions:m})=>s(i(j.threads.editMessage,{messageId:d,body:u,mentions:m.map(({userId:y,label:g})=>({userId:y,label:g}))})),toggleReaction:({messageId:d,emoji:u})=>s(i(j.threads.toggleReaction,{messageId:d,emoji:u})),setStatus:({threadId:d,status:u})=>s(i(j.threads.setStatus,{threadId:d,status:u})),remove:(d)=>s(i(j.threads.remove,{threadId:d})),setTags:({threadId:d,tags:u})=>s(i(j.threads.setTags,{threadId:d,tags:u})),reattach:({threadId:d,location:u})=>s(i(j.threads.reattach,{threadId:d,location:u})),attachScreenshot:async({threadId:d,fileId:u})=>{let m=(y)=>s(i(j.threads.attachScreenshot,{threadId:d,storageId:y}));try{return await Sp(u,c,m,(y)=>f(y.projectId,y.image))}finally{c.delete(u)}},markRead:({threadId:d,seenThrough:u})=>s(i(j.threads.markRead,{threadId:d,seenThrough:u})),markUnread:(d)=>s(i(j.threads.markUnread,{threadId:d})),threadPageKey:(d)=>i(j.threads.pageKey,{threadId:d}),exportThreads:(d,u,m)=>rf(({projectId:y,threadIds:g,threadIndex:x,paginationOpts:k})=>e.query(j.threads.exportThreads,{projectId:y,threadIds:g,threadIndex:x,paginationOpts:k}),d,u,m),useTags:(d)=>gt(j.tags.list,d===null?"skip":{projectId:d}),createTagGroup:({projectId:d,name:u})=>i(j.tags.createGroup,{projectId:d,name:u}),renameTagGroup:({projectId:d,...u})=>s(i(j.tags.renameGroup,{projectId:d,...u})),deleteTagGroup:({projectId:d,...u})=>s(i(j.tags.deleteGroup,{projectId:d,...u})),mergeTagGroups:({projectId:d,...u})=>s(i(j.tags.mergeGroups,{projectId:d,...u})),setTagGroups:({projectId:d,...u})=>s(i(j.tags.setTagGroups,{projectId:d,...u})),setPresetTags:({projectId:d,...u})=>s(i(j.tags.setPresets,{projectId:d,...u})),search:({projectId:d,...u})=>e.action(j.ai.search,{projectId:d,...u}),useAiSettings:(d)=>gt(j.aiSettings.get,d===null?"skip":{projectId:d}),saveAiSettings:({projectId:d,...u})=>e.action(j.ai.saveSettings,{projectId:d,...u}),testAiConnection:(d,u)=>e.action(j.ai.testSettings,{projectId:d,...u===void 0?{}:{draft:{...u,projectId:d}}}),usePersonalAiSettings:(d)=>gt(j.aiSettings.getPersonal,d?{}:"skip"),savePersonalAiSettings:(d)=>e.action(j.ai.savePersonalSettings,d),testPersonalAiConnection:(d)=>e.action(j.ai.testPersonalSettings,d===void 0?{}:{draft:d}),removePersonalAiSettings:()=>i(j.aiSettings.removePersonal,{}),usePersonalAiUsage:(d)=>{let u=si();return gt(j.aiSettings.myUsage,d?{day:u}:"skip")},listAiModels:(d,u)=>e.action(j.ai.listModels,{projectId:d,...u===void 0?{}:{draft:u}}),listPersonalAiModels:(d)=>e.action(j.ai.listPersonalModels,d===void 0?{}:{draft:d}),useAiChoice:(d)=>gt(j.aiSettings.myChoice,d===null?"skip":{projectId:d}),loadCapture:async(d)=>{let u=await n.fetchAccessToken({forceRefreshToken:!1});if(u===null)return null;let m=await fetch(`${t.siteUrl}/capture?threadId=${encodeURIComponent(d)}`,{headers:{Authorization:`Bearer ${u}`}});return m.ok?await m.blob():null},mockups:Lq(e,t,n),billing:{useStatus:(d)=>gt(j.billing.status,d===null?"skip":{organizationId:d}),useUsage:(d)=>{let u=si();return gt(j.organizations.usage,d===null?"skip":{organizationId:d,day:u})},changePlan:(d)=>e.action(j.billing.changePlan,d),setStorageAddOn:(d)=>e.action(j.billing.setStorageAddOn,d),openPortal:(d)=>e.action(j.billing.portal,d),loadPrices:async()=>{await e.action(j.billing.loadPrices,{})}},tickets:{useTrackerAccounts:(d)=>gt(j.trackers.mine,d?{}:"skip"),connectTrackerWithToken:(d,u,m)=>e.action(j.trackers.connectWithToken,{tracker:d,token:u,...m}),startTrackerSignIn:(d,u)=>e.action(j.trackers.startSignIn,{tracker:d,...u===void 0?{}:{site:u}}),disconnectTracker:(d)=>e.action(j.trackers.disconnect,{tracker:d}),setTrackerAttribution:(d,u)=>s(i(j.trackers.setAttribution,{tracker:d,attribution:u})),listTicketDestinations:(d)=>e.action(j.tickets.destinations,{tracker:d}),searchTickets:(d,u)=>e.action(j.tickets.search,{tracker:d,query:u}),ticketDraft:(d,u,m)=>e.action(j.tickets.draft,{threadId:d,tracker:u,...m}),ticketDraftOptions:(d,u,m)=>e.action(j.tickets.options,{threadId:d,tracker:u,destinationId:m}),draftTicketWithAi:({threadId:d,...u})=>e.action(j.ai.draftTicket,{threadId:d,...u}),useTicketTemplateSettings:(d)=>gt(j.tickets.templateSettings,d===null?"skip":{projectId:d}),saveTicketTemplateSettings:(d,u)=>i(j.tickets.saveTemplateSettings,{projectId:d,...u}),listTrackerTemplates:(d,u)=>e.action(j.tickets.trackerTemplates,{projectId:d,tracker:u}),createTicket:({threadId:d,...u})=>e.action(j.tickets.create,{threadId:d,...u}),linkTicket:({threadId:d,...u})=>e.action(j.tickets.link,{threadId:d,...u}),addTicketLinkBack:(d)=>e.action(j.tickets.addLinkBack,{linkId:d}),unlinkTicket:(d)=>s(i(j.tickets.unlink,{linkId:d})),checkTicketStatus:async(d)=>void await i(j.ticketStatus.checkStatus,{threadId:d}),useTicketSettings:(d,u)=>gt(j.ticketStatus.settings,u?{projectId:d}:"skip"),setResolveWhenDone:(d,u)=>s(i(j.ticketStatus.setResolveWhenDone,{projectId:d,on:u})),setTicketDefaultDestination:(d,u,m)=>s(e.action(j.tickets.setDefaultDestination,{projectId:d,tracker:u,destinationId:m}))}}}function Lq(e,t,n){let r=e.mutation.bind(e),o=(d)=>d.then(()=>{return}),a=new Map,i=new Map,s=(d,u)=>{let m=i.get(u);if(i.delete(u),m!==void 0)a.set(d,Promise.resolve(m))},c=(d)=>({...d,storageId:d.storageId}),f=async(d,u)=>{let m=await r(j.mockups.generateUploadUrl,{projectId:d}),y=new Blob([u],{type:"text/html"}),g=await nv(m,t.siteUrl,y,()=>n.fetchAccessToken({forceRefreshToken:!1}),fetch,"page copy");return i.set(g,u),g},p=(d)=>e.query(j.mockups.get,{mockupId:d});return{useMockupPage:(d,u,m)=>ev(j.mockups.listPage,d===null?"skip":{projectId:d,scope:u},{initialNumItems:m}),useMockup:(d)=>gt(j.mockups.get,d===null?"skip":{mockupId:d}),useMockupsForThread:(d)=>gt(j.mockups.forThread,{threadId:d}),getMockup:p,uploadSnapshot:f,create:async({projectId:d,title:u,source:m,snapshot:y,linkedThreadIds:g=[]})=>{let x=y.storageId,k=await Sp(y.storageId,i,(v)=>(x=v,e.action(j.mockups.create,{projectId:d,title:u,source:m,snapshot:c({...y,storageId:v}),...g.length===0?{}:{linkedThreadIds:g}})),(v)=>f(d,v)),b=(await p(k)).snapshots[0]._id;return s(b,x),{mockupId:k,snapshotId:b}},addSnapshot:async({mockupId:d,snapshot:u})=>{let m=u.storageId,y=await Sp(u.storageId,i,(g)=>(m=g,e.action(j.mockups.addSnapshot,{mockupId:d,snapshot:c({...u,storageId:g})})),async(g)=>f((await p(d)).projectId,g));return s(y,m),y},loadSnapshot:(d)=>{let u=a.get(d);if(u!==void 0)return u;let m=(async()=>{let y=await n.fetchAccessToken({forceRefreshToken:!1});if(y===null)throw Error("Sign in again to open this mockup.");let g=await fetch(`${t.siteUrl}/mockup/snapshot?snapshotId=${encodeURIComponent(d)}`,{headers:{Authorization:`Bearer ${y}`}});if(!g.ok)throw Error("This page copy couldn't be loaded.");return await g.text()})();return a.set(d,m),m.catch(()=>a.delete(d)),m},link:({mockupId:d,threadId:u})=>o(r(j.mockups.link,{mockupId:d,threadId:u})),unlink:({mockupId:d,threadId:u})=>o(r(j.mockups.unlink,{mockupId:d,threadId:u})),remove:(d)=>o(r(j.mockups.remove,{mockupId:d})),restore:({mockupId:d,...u})=>r(j.mockups.restore,{mockupId:d,...u}),mockupReply:({threadId:d,snapshots:u,continuation:m,model:y})=>e.action(j.ai.mockupReply,{threadId:d,snapshots:u.map((g)=>({...g,snapshotId:g.snapshotId})),continuation:m,...y===void 0?{}:{model:y}})}}function qq(e){return e instanceof Qr&&e.data?.reupload===!0}async function Sp(e,t,n,r){try{return await n(e)}catch(o){let a=t.get(e);if(!qq(o)||a===void 0)throw o;return t.delete(e),await n(await r(a))}}function Uq(e=4){let t=new Map,n=t.set.bind(t);return t.set=(r,o)=>{n(r,o);for(let a of t.keys()){if(t.size<=e)break;t.delete(a)}return t},t}function zA(e){return e.status==="ready"?{status:"ready",data:e.data.flatMap((t)=>t.page)}:e}function zq(e,t){if(e.status!=="ready")return e;if(t.status!=="ready")return t;let n=t.data.flatMap((s)=>s.page),{page:r,isDone:o,continueCursor:a,...i}=e.data[0];return{status:"ready",data:{...i,messages:e.data.flatMap((s)=>s.page).map((s)=>{let c=new Map;for(let f of n){if(f.messageId!==s._id)continue;let p=c.get(f.emoji)??{emoji:f.emoji,count:0,mine:!1};p.count++,p.mine||=f.mine,c.set(f.emoji,p)}return{...s,reactions:[...c.values()]}})}}}var pi={"X-Critiqs-Request":"1"};class rv{baseUrl;mode;fetchFn;snapshot={reviewer:null};listeners=new Set;loaded=!1;constructor(e,t,n=(r,o)=>fetch(r,o)){this.baseUrl=e;this.mode=t;this.fetchFn=n}getSnapshot=()=>this.snapshot;subscribe=(e)=>(this.listeners.add(e),()=>this.listeners.delete(e));async refresh(){let e=await this.fetchFn(`${this.baseUrl}/me`,{credentials:"same-origin",headers:pi});if(!e.ok)return;let{reviewer:t}=await e.json();if(this.loaded=!0,JSON.stringify(t)===JSON.stringify(this.snapshot.reviewer))return;this.snapshot={reviewer:t};for(let n of this.listeners)n()}signIn(){if(this.mode==="host")return Promise.reject(new Br("cancelled","Sign in to this app to comment."));let e=crypto.randomUUID(),t=window.open(`${this.baseUrl}/auth/start?state=${encodeURIComponent(e)}`,"critiqs-sign-in","popup,width=480,height=640");if(t===null)return Promise.reject(new Br("popup-blocked","Your browser blocked the sign-in window. Allow pop-ups for this site and try again."));return new Promise((n,r)=>{let o=!1,a=(c)=>{if(o)return;if(o=!0,window.removeEventListener("message",i),clearInterval(s),c===void 0)this.refresh().then(n,r);else r(c)},i=(c)=>{let f=c.data;if(c.source!==t||c.origin!==window.location.origin||f?.type!=="critiqs:sign-in"||f.state!==e)return;a()},s=setInterval(()=>{if(!t.closed)return;clearInterval(s),setTimeout(()=>a(new Br("closed","The sign-in window was closed.")),500)},500);window.addEventListener("message",i)})}async signOut(){await this.fetchFn(`${this.baseUrl}/auth/sign-out`,{method:"POST",credentials:"same-origin",headers:pi}).catch(()=>{return}),await this.refresh().catch(()=>{return})}async setDisplayName(e){let t=await this.fetchFn(`${this.baseUrl}/auth/profile`,{method:"POST",credentials:"same-origin",headers:{...pi,"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok){let{error:n}=await t.json().catch(()=>({}));throw Error(n?.message??"Your name couldn't be changed.")}return await this.refresh(),!0}}var jq=3000;function BA(e,t,n=(r,o)=>fetch(r,o)){let r=e.backendUrl,o=0,a=new Set,i=()=>{o++;for(let g of a)g()},s=null,c=new Set,f=null,p=async()=>{if(typeof document<"u"&&document.visibilityState==="hidden")return;try{let g=await n(`${r}/changes`,{credentials:"same-origin",headers:pi});if(!g.ok)return;let{version:x}=await g.json();if(s===null||x!==s)i();s=x;let k=[...c];c.clear();for(let b of k)b();await t.refresh()}catch{}},d=(g)=>{if(a.add(g),f===null)p(),f=setInterval(p,jq);return()=>{if(a.delete(g),a.size===0&&f!==null)clearInterval(f),f=null}};t.subscribe(i);async function u(g,x){let k=await n(`${r}/api/${g}`,{method:"POST",credentials:"same-origin",headers:{...pi,"Content-Type":"application/json"},body:JSON.stringify(x)}),b=await k.json().catch(()=>null);if(!k.ok||b===null||b.error!==void 0)throw new hc(b?.error?.code??"error",b?.error?.message??"Something went wrong. Try again.");return b.value}async function m(g,x){try{return await u(g,x)}finally{i()}}function y(g,x){let k=dn(d,()=>o),b=x==="skip"?"skip":`${g}:${JSON.stringify(x)}`,[v,w]=S({key:b,value:{status:"loading"}}),T=O(0),[C,E]=S(0);if(_(()=>{if(x==="skip")return;let A=++T.current,N=null;return u(g,x).then((R)=>A===T.current&&w({key:b,value:{status:"ready",data:R}}),(R)=>{if(A!==T.current)return;w({key:b,value:zn(R)}),N=()=>E((q)=>q+1),c.add(N)}),()=>{if(N!==null)c.delete(N)}},[b,k,C]),x==="skip"||v.key!==b)return{status:"loading"};return v.value}return{wrap:(g)=>g,useAuth:()=>{let{reviewer:g}=dn(t.subscribe,t.getSnapshot);return dn(d,()=>o),{isLoading:!t.loaded,isAuthenticated:g!==null,rejected:!1}},useProject:(g)=>y("project",g===null?"skip":{projectId:g}),useMyProjects:(g)=>y("myProjects",g?{}:"skip"),useMyOrganizations:(g)=>y("myOrganizations",g?{}:"skip"),useOrganization:(g)=>y("organization",g===null?"skip":{organizationId:g}),renameOrganization:(g,x)=>m("renameOrganization",{organizationId:g,name:x}),inviteMember:(g)=>m("inviteMember",g),revokeInvite:(g)=>m("revokeInvite",{inviteId:g}),setMemberRole:(g)=>m("setMemberRole",g),removeMember:(g)=>m("removeMember",g),useThreads:(g)=>y("threads",g===null?"skip":{projectId:g}),useThread:(g)=>y("thread",{threadId:g}),useParticipants:(g,x,k=null)=>y("participants",g===null?"skip":{projectId:g,query:x,...kp(e,k)}),useNotificationSettings:(g)=>y("notificationSettings",g===null?"skip":{projectId:g}),useUsage:(g)=>{let x=si();return y("usage",g===null?"skip":{projectId:g,day:x,...xp(e)})},setNotificationSettings:(g)=>m("setNotificationSettings",g),syncReviewer:()=>u("sync",{}),createProject:(g,x,k)=>m("createProject",{name:g,reviewUrl:x,...k===void 0?{}:{organizationId:k}}),setReviewUrl:(g)=>m("setReviewUrl",g),setReviewAccess:(g)=>m("setReviewAccess",g),recordProjectOpened:async(g)=>void await u("recordProjectOpened",{projectId:g}),useProjectAddresses:(g)=>y("projectAddresses",g===null?"skip":{projectId:g}),useProjectAddressNotes:(g)=>y("projectAddressNotes",g===null?"skip":{projectId:g}),addProjectAddress:(g)=>m("addProjectAddress",g),removeProjectAddress:(g)=>m("removeProjectAddress",g),setOverageCap:(g)=>m("setOverageCap",g),uploadImage:async(g,x)=>{let k=await n(`${r}/upload?projectId=${encodeURIComponent(g)}`,{method:"POST",credentials:"same-origin",headers:{...pi,"Content-Type":x.type},body:x}),b=await k.json().catch(()=>null);if(!k.ok||typeof b?.fileId!=="string")throw new hc(b?.error?.code??"error",b?.error?.message??"The image could not be uploaded.");return b.fileId},createThread:(g)=>m("createThread",{...g,...Tp(e)}),reply:(g)=>m("reply",g),editMessage:(g)=>m("editMessage",g),toggleReaction:(g)=>m("toggleReaction",g),setStatus:(g)=>m("setStatus",g),remove:(g)=>m("remove",{threadId:g}),setTags:(g)=>m("setTags",g),reattach:(g)=>m("reattach",g),attachScreenshot:(g)=>m("attachScreenshot",g),markRead:(g)=>m("markRead",g),markUnread:(g)=>m("markUnread",{threadId:g}),threadPageKey:(g)=>u("threadPageKey",{threadId:g}),exportThreads:(g,x,k)=>rf((b)=>u("exportPage",b),g,x,k),loadCapture:async(g)=>{let x=await n(`${r}/capture?threadId=${encodeURIComponent(g)}`,{credentials:"same-origin"});return x.ok?await x.blob():null},useTags:(g)=>y("tags",g===null?"skip":{projectId:g}),createTagGroup:(g)=>m("createTagGroup",g),renameTagGroup:(g)=>m("renameTagGroup",g),deleteTagGroup:(g)=>m("deleteTagGroup",g),mergeTagGroups:(g)=>m("mergeTagGroups",g),setTagGroups:(g)=>m("setTagGroups",g),setPresetTags:(g)=>m("setPresetTags",g),search:(g)=>u("search",g),useAiSettings:(g)=>y("aiSettings",g===null?"skip":{projectId:g}),saveAiSettings:(g)=>m("saveAiSettings",{...g}),testAiConnection:(g,x)=>u("testAiConnection",x===void 0?{projectId:g}:{projectId:g,draft:x}),usePersonalAiSettings:(g)=>y("personalAiSettings",g?{}:"skip"),savePersonalAiSettings:(g)=>m("savePersonalAiSettings",{...g}),testPersonalAiConnection:(g)=>u("testPersonalAiConnection",g===void 0?{}:{draft:g}),removePersonalAiSettings:()=>m("removePersonalAiSettings",{}),usePersonalAiUsage:(g)=>{let x=si();return y("personalAiUsage",g?{day:x}:"skip")},listAiModels:(g,x)=>u("listAiModels",x===void 0?{projectId:g}:{projectId:g,draft:x}),listPersonalAiModels:(g)=>u("listPersonalAiModels",g===void 0?{}:{draft:g}),useAiChoice:(g)=>y("aiChoice",g===null?"skip":{projectId:g})}}var ov=`
|
|
49
|
+
:host {
|
|
50
|
+
all: initial;
|
|
51
|
+
--accent: #0d63f3;
|
|
52
|
+
--accent-soft: #e8f0fe;
|
|
53
|
+
--accent-strong: #0b4fc2;
|
|
54
|
+
/* One look for a tag wherever it appears: typed, posted, or listed. */
|
|
55
|
+
--tag-bg: #edf3fe;
|
|
56
|
+
--tag-border: #c3d5f8;
|
|
57
|
+
--tag-text: var(--accent-strong);
|
|
58
|
+
--tag-hover-bg: #dde8fc;
|
|
59
|
+
--text: #1a1a1a;
|
|
60
|
+
--muted: #6b7280;
|
|
61
|
+
--faint: #9ca3af;
|
|
62
|
+
--border: #e5e7eb;
|
|
63
|
+
--hover: #f3f4f6;
|
|
64
|
+
--surface: #ffffff;
|
|
65
|
+
--danger: #c62828;
|
|
66
|
+
--success: #15803d;
|
|
67
|
+
--warning-bg: #fff7e0;
|
|
68
|
+
--warning-text: #7a5300;
|
|
69
|
+
--shadow: 0 8px 24px rgb(0 0 0 / 0.14), 0 1px 3px rgb(0 0 0 / 0.1);
|
|
70
|
+
/* Design system scales (docs/design-system.md). */
|
|
71
|
+
--space-1: 4px;
|
|
72
|
+
--space-2: 8px;
|
|
73
|
+
--space-3: 12px;
|
|
74
|
+
--space-4: 16px;
|
|
75
|
+
--space-6: 24px;
|
|
76
|
+
--radius-s: 6px;
|
|
77
|
+
--radius-m: 8px;
|
|
78
|
+
--radius-l: 12px;
|
|
79
|
+
--text-xs: 11px;
|
|
80
|
+
--text-s: 12px;
|
|
81
|
+
--text-m: 13px;
|
|
82
|
+
--text-l: 15px;
|
|
83
|
+
--control-height: 32px;
|
|
84
|
+
--row-height: 40px;
|
|
85
|
+
--caution: #d97706;
|
|
86
|
+
--switch-off: #d1d5db;
|
|
87
|
+
}
|
|
88
|
+
/* The host element is reset inline (see Critiqs.tsx), so the base font is set here. */
|
|
89
|
+
.layer { font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text);
|
|
90
|
+
text-align: left; letter-spacing: normal; text-transform: none; }
|
|
91
|
+
*, *::before, *::after { box-sizing: border-box; }
|
|
92
|
+
button, input, textarea, select { font: inherit; color: inherit; }
|
|
93
|
+
button { cursor: pointer; }
|
|
94
|
+
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
95
|
+
|
|
96
|
+
.layer { position: fixed; inset: 0; pointer-events: none; z-index: 2147483000; }
|
|
97
|
+
.layer > * { pointer-events: auto; }
|
|
98
|
+
.layer > .passive { pointer-events: none; }
|
|
99
|
+
/* What the page layer draws (pins, outlines, Comment mode's selection) stays under the panel's toolbar, sidebar, and windows. */
|
|
100
|
+
.layer.page-layer { z-index: 2147482999; }
|
|
101
|
+
|
|
102
|
+
/* Buttons */
|
|
103
|
+
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
|
|
104
|
+
border-radius: 6px; padding: 5px 10px; font-weight: 500; line-height: 18px; white-space: nowrap; }
|
|
105
|
+
.btn:hover { background: var(--hover); }
|
|
106
|
+
.btn:disabled { opacity: 0.5; cursor: default; }
|
|
107
|
+
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
|
|
108
|
+
.btn.primary:hover { filter: brightness(1.08); }
|
|
109
|
+
.btn.danger { color: var(--danger); }
|
|
110
|
+
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
|
|
111
|
+
.btn.ghost { border-color: transparent; background: transparent; }
|
|
112
|
+
.btn.ghost:hover { background: var(--hover); }
|
|
113
|
+
.btn.small { padding: 2px 8px; font-size: 12px; }
|
|
114
|
+
a.btn { color: var(--text); text-decoration: none; }
|
|
115
|
+
a.link-btn { text-decoration: none; }
|
|
116
|
+
a.link-btn:hover { text-decoration: underline; }
|
|
117
|
+
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px;
|
|
118
|
+
background: transparent; color: var(--muted); padding: 0; }
|
|
119
|
+
.icon-btn:hover { background: var(--hover); color: var(--text); }
|
|
120
|
+
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
|
|
121
|
+
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; }
|
|
122
|
+
.link-btn:hover { text-decoration: underline; }
|
|
123
|
+
|
|
124
|
+
/* Toolbar */
|
|
125
|
+
.toolbar { position: fixed; display: flex; align-items: center; gap: 2px; padding: 4px; background: #1f2023; color: #f3f4f6;
|
|
126
|
+
border-radius: 12px; box-shadow: var(--shadow); user-select: none; transition: top 0.2s, bottom 0.2s; }
|
|
127
|
+
.toolbar .icon-btn { color: #c7c9cf; width: 32px; height: 32px; border-radius: 8px; position: relative; }
|
|
128
|
+
.toolbar .icon-btn:hover { background: #34363b; color: #fff; }
|
|
129
|
+
.toolbar .icon-btn[aria-pressed="true"] { background: #fff; color: #1f2023; }
|
|
130
|
+
.toolbar .divider { width: 1px; align-self: stretch; margin: 4px 3px; background: #3a3c42; }
|
|
131
|
+
.toolbar .handle { width: 14px; height: 32px; display: grid; place-items: center; cursor: grab; color: #6b6e76; }
|
|
132
|
+
.toolbar .handle:active { cursor: grabbing; }
|
|
133
|
+
.toolbar .badge { position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
|
|
134
|
+
background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; }
|
|
135
|
+
.toolbar .setup-btn { border: 0; background: var(--accent); color: #fff; border-radius: 8px; height: 32px; padding: 0 12px; font-weight: 600; }
|
|
136
|
+
.toolbar .who { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; border-radius: 8px; padding: 0; }
|
|
137
|
+
.toolbar .who:hover { background: #34363b; }
|
|
138
|
+
.toolbar .sign-in { border: 0; background: transparent; color: #f3f4f6; height: 32px; padding: 0 10px; border-radius: 8px; font-weight: 500; }
|
|
139
|
+
.toolbar .sign-in:hover { background: #34363b; }
|
|
140
|
+
.toolbar .hint { padding: 0 8px; color: #c7c9cf; font-size: 12px; }
|
|
141
|
+
.toolbar.collapsed { padding: 4px; border-radius: 22px; }
|
|
142
|
+
|
|
143
|
+
.menu { position: fixed; min-width: 220px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
|
|
144
|
+
border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 2; }
|
|
145
|
+
.menu .menu-label { padding: 6px 8px 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
|
|
146
|
+
.menu .menu-item { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: none; text-align: left;
|
|
147
|
+
padding: 6px 8px; border-radius: 6px; }
|
|
148
|
+
.menu .menu-item:hover { background: var(--hover); }
|
|
149
|
+
.menu .menu-item .check { width: 14px; color: var(--accent); }
|
|
150
|
+
.menu .menu-item .detail { margin-left: auto; padding-left: var(--space-4); color: var(--muted); font-size: var(--text-s); white-space: nowrap; }
|
|
151
|
+
.menu .menu-item.danger { color: var(--danger); }
|
|
152
|
+
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
|
|
153
|
+
.menu .identity { padding: 6px 8px; }
|
|
154
|
+
.menu .identity .name { font-weight: 600; }
|
|
155
|
+
.menu .identity .email { color: var(--muted); font-size: 12px; }
|
|
156
|
+
|
|
157
|
+
/* Avatars */
|
|
158
|
+
.avatar { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
|
|
159
|
+
color: #fff; font-size: 11px; font-weight: 700; overflow: hidden; }
|
|
160
|
+
.avatar img { width: 100%; height: 100%; object-fit: cover; }
|
|
161
|
+
.avatar.large { width: 28px; height: 28px; font-size: 12px; }
|
|
162
|
+
|
|
163
|
+
/* Picking a target in Comment mode */
|
|
164
|
+
.target-box { position: fixed; border: 2px solid var(--accent); border-radius: 4px; background: rgb(13 99 243 / 0.06);
|
|
165
|
+
pointer-events: none; transition: all 60ms ease-out; }
|
|
166
|
+
.target-label { position: fixed; transform: translateY(-100%); background: var(--accent); color: #fff; font-size: 11px;
|
|
167
|
+
font-weight: 600; padding: 1px 6px; border-radius: 4px 4px 0 0; pointer-events: none; white-space: nowrap; max-width: 320px;
|
|
168
|
+
overflow: hidden; text-overflow: ellipsis; }
|
|
169
|
+
.highlight { position: fixed; border: 2px solid var(--accent); border-radius: 6px; pointer-events: none;
|
|
170
|
+
box-shadow: 0 0 0 4px rgb(13 99 243 / 0.2); animation: critiqs-pulse 1.2s ease-out 2; }
|
|
171
|
+
@keyframes critiqs-pulse { 0% { box-shadow: 0 0 0 0 rgb(13 99 243 / 0.45); } 100% { box-shadow: 0 0 0 12px rgb(13 99 243 / 0); } }
|
|
172
|
+
.mode-hint { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); background: #1f2023; color: #fff; padding: 6px 12px;
|
|
173
|
+
border-radius: 8px; font-size: 12px; box-shadow: var(--shadow); pointer-events: none; text-align: center; }
|
|
174
|
+
|
|
175
|
+
/* Pins */
|
|
176
|
+
.pin { position: fixed; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50% 50% 50% 4px; border: 2px solid #fff;
|
|
177
|
+
background: #1f2023; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; padding: 0;
|
|
178
|
+
box-shadow: 0 2px 6px rgb(0 0 0 / 0.3); transform-origin: bottom left; transition: transform 0.1s; }
|
|
179
|
+
.pin:hover { transform: scale(1.12); }
|
|
180
|
+
.pin.unread { background: var(--accent); }
|
|
181
|
+
.pin.resolved { background: #8b8f97; }
|
|
182
|
+
.pin.selected { outline: 3px solid rgb(13 99 243 / 0.35); transform: scale(1.12); }
|
|
183
|
+
|
|
184
|
+
/* Popover composer */
|
|
185
|
+
.popover { position: fixed; width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
|
|
186
|
+
box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
|
|
187
|
+
.popover .context-line { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
188
|
+
textarea.field, input.field, .tag-field.field { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface);
|
|
189
|
+
resize: vertical; min-height: 36px; }
|
|
190
|
+
textarea.field, .tag-field.field { min-height: 64px; }
|
|
191
|
+
textarea.field:focus, input.field:focus, .tag-field.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
|
|
192
|
+
.row { display: flex; align-items: center; gap: 8px; }
|
|
193
|
+
.row.end { justify-content: flex-end; }
|
|
194
|
+
.row.between { justify-content: space-between; }
|
|
195
|
+
/* The selection's footer: the count and its links on one line, the actions beside them, or on the next line, right-aligned, when the sidebar is narrow; no label wraps. */
|
|
196
|
+
.selection-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
197
|
+
.selection-footer > .row { white-space: nowrap; }
|
|
198
|
+
.selection-actions { margin-left: auto; }
|
|
199
|
+
.wrap { flex-wrap: wrap; }
|
|
200
|
+
.grow { flex: 1; min-width: 0; }
|
|
201
|
+
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px;
|
|
202
|
+
font-size: 12px; background: var(--surface); color: var(--muted); }
|
|
203
|
+
button.chip:hover { background: var(--hover); }
|
|
204
|
+
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: #b9d0fb; color: var(--accent); }
|
|
205
|
+
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
|
|
206
|
+
.segmented button { border: 0; background: none; border-radius: 6px; padding: 3px 8px; font-size: 12px; color: var(--muted); }
|
|
207
|
+
.segmented button[aria-pressed="true"] { background: var(--hover); color: var(--text); font-weight: 600; }
|
|
208
|
+
.note { font-size: 12px; color: var(--muted); }
|
|
209
|
+
.warning { background: var(--warning-bg); color: var(--warning-text); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
|
|
210
|
+
.error { color: var(--danger); font-size: 12px; }
|
|
211
|
+
.caution { color: var(--warning-text); font-size: 12px; }
|
|
212
|
+
kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--muted); }
|
|
213
|
+
|
|
214
|
+
/* Sidebar */
|
|
215
|
+
.sidebar { position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 100vw; background: var(--surface);
|
|
216
|
+
border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgb(0 0 0 / 0.08); display: flex; flex-direction: column; }
|
|
217
|
+
.sidebar[hidden] { display: none; }
|
|
218
|
+
/* A review link's page on a narrow screen: the sidebar is a sheet over the frame's lower part. */
|
|
219
|
+
.sidebar.sheet { top: auto; left: 0; width: auto; max-width: none; height: min(70vh, 600px); border-left: 0; border-top: 1px solid var(--border);
|
|
220
|
+
border-radius: 14px 14px 0 0; box-shadow: 0 -12px 32px rgb(0 0 0 / 0.18); }
|
|
221
|
+
/* The sidebar's left edge, dragged to resize it (sidebar-width.tsx). */
|
|
222
|
+
.sidebar-resize { position: absolute; top: 0; bottom: 0; left: -4px; width: 8px; z-index: 2; cursor: col-resize; touch-action: none; }
|
|
223
|
+
.sidebar-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background 0.15s; }
|
|
224
|
+
.sidebar-resize:hover::after, .sidebar-resize.dragging::after, .sidebar-resize:focus-visible::after { background: var(--accent); }
|
|
225
|
+
.sidebar-resize:focus-visible { outline: none; }
|
|
226
|
+
@media (prefers-reduced-motion: reduce) { .sidebar-resize::after { transition: none; } }
|
|
227
|
+
.sidebar-header { display: flex; align-items: center; gap: 4px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); min-height: 49px; }
|
|
228
|
+
.sidebar-header h2 { font-size: 14px; font-weight: 600; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
229
|
+
.project-panel .people { list-style: none; margin: 6px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
|
|
230
|
+
.docs { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
|
|
231
|
+
.docs .field { width: 100%; box-sizing: border-box; }
|
|
232
|
+
.doc-topic { border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; }
|
|
233
|
+
.doc-topic summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
|
|
234
|
+
.doc-topic p { margin: 0 0 6px; color: var(--muted); }
|
|
235
|
+
.doc-topic ul { margin: 0 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
|
|
236
|
+
.code.light { background: var(--hover); color: var(--text); border: 1px solid var(--border); }
|
|
237
|
+
.code.light .btn { background: var(--surface); border-color: var(--border); color: var(--text); }
|
|
238
|
+
.project-panel .people li { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
239
|
+
.project-panel .people li > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
240
|
+
.sidebar-body { flex: 1; overflow-y: auto; }
|
|
241
|
+
.sidebar-footer { border-top: 1px solid var(--border); padding: 10px 12px; }
|
|
242
|
+
.filter-summary { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--border);
|
|
243
|
+
font-size: 12px; color: var(--muted); }
|
|
244
|
+
.group-title { padding: 12px 16px 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
|
|
245
|
+
.entry { display: flex; gap: 10px; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--border); background: none;
|
|
246
|
+
text-align: left; position: relative; }
|
|
247
|
+
.entry:hover { background: #fafafa; }
|
|
248
|
+
.entry.selected { background: var(--accent-soft); }
|
|
249
|
+
.entry .meta { display: flex; align-items: baseline; gap: 6px; }
|
|
250
|
+
.entry .author { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
251
|
+
.entry .time { color: var(--faint); font-size: 12px; white-space: nowrap; }
|
|
252
|
+
.entry .excerpt { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
|
|
253
|
+
.entry .details { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12px; color: var(--muted); }
|
|
254
|
+
.entry .status-tag { color: var(--warning-text); }
|
|
255
|
+
.entry .resolved-tag { color: var(--success); }
|
|
256
|
+
.unread-dot { position: absolute; top: 16px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
|
|
257
|
+
.entry.unread .author { color: var(--text); }
|
|
258
|
+
.entry input[type="checkbox"] { margin: 4px 0 0; flex: none; accent-color: var(--accent); }
|
|
259
|
+
.empty { padding: 40px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
|
|
260
|
+
.empty strong { color: var(--text); font-size: 14px; }
|
|
261
|
+
|
|
262
|
+
/* Thread window: beside its pin, or beside the sidebar when the target can't be shown */
|
|
263
|
+
.thread-window { position: fixed; width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
|
|
264
|
+
box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; z-index: 1; }
|
|
265
|
+
.thread-window:focus { outline: none; }
|
|
266
|
+
.thread-window.panel { width: auto; border-radius: 12px 12px 0 0; border-bottom: 0; }
|
|
267
|
+
.window-header { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); min-height: 45px; flex: none; }
|
|
268
|
+
.window-header h2 { font-size: 14px; font-weight: 600; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
269
|
+
.window-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
|
|
270
|
+
.window-footer { flex: none; border-top: 1px solid var(--border); padding: 10px 12px; }
|
|
271
|
+
.window-footer .tag-field.field { min-height: 48px; max-height: 160px; }
|
|
272
|
+
.saved-context { margin: 10px 14px 0; }
|
|
273
|
+
.saved-context summary { cursor: pointer; font-size: 12px; color: var(--muted); padding: 2px 0; }
|
|
274
|
+
.saved-context .thread-context { margin: 6px 0 0; }
|
|
275
|
+
.thread-window .thread-context .capture { max-height: 140px; }
|
|
276
|
+
.context-details summary { cursor: pointer; padding: 8px 12px; font-size: 12px; color: var(--muted); }
|
|
277
|
+
.context-details[open] summary { padding-bottom: 0; }
|
|
278
|
+
|
|
279
|
+
/* Mentions */
|
|
280
|
+
.mention-input { position: relative; }
|
|
281
|
+
.tag-editor { position: relative; }
|
|
282
|
+
/* An editable box holding plain text; a little more line height leaves room between wrapped pills. */
|
|
283
|
+
.tag-field { display: block; overflow-x: hidden; overflow-y: auto; max-height: 240px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere;
|
|
284
|
+
cursor: text; }
|
|
285
|
+
.tag-placeholder { position: absolute; top: 9px; left: 11px; right: 11px; line-height: 20px; color: var(--faint);
|
|
286
|
+
pointer-events: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
287
|
+
/* Draft hashtags: pills with real side padding, in the same tag colors as posted tags and sidebar chips;
|
|
288
|
+
mentions stay plain bold text. The weight matches the surrounding text so a word never reflows as it
|
|
289
|
+
becomes a tag. A tag too long for its line breaks open-ended rather than padding past the box's edge. */
|
|
290
|
+
.tag-pill { padding: 1px 6px; margin: 0 1px; border-radius: 999px; background: var(--tag-bg); color: var(--tag-text);
|
|
291
|
+
box-shadow: inset 0 0 0 1px var(--tag-border); }
|
|
292
|
+
.mention-suggestions { position: fixed; z-index: 3; list-style: none; margin: 0; padding: 4px;
|
|
293
|
+
background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; }
|
|
294
|
+
.mention-suggestions li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
|
|
295
|
+
.mention-suggestions li[aria-selected="true"] { background: var(--accent-soft); }
|
|
296
|
+
.mention { color: var(--accent); font-weight: 600; }
|
|
297
|
+
/* Tags in lists and posted text: the same pill and colors as while typing. */
|
|
298
|
+
.tag-chip { display: inline-block; border: 0; border-radius: 999px; padding: 1px 7px; font-size: 12px; font-weight: 500;
|
|
299
|
+
line-height: 18px; background: var(--tag-bg); color: var(--tag-text); box-shadow: inset 0 0 0 1px var(--tag-border);
|
|
300
|
+
white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
|
301
|
+
.tag-chip.clickable { cursor: pointer; }
|
|
302
|
+
.tag-chip.clickable:hover, button.hashtag:hover { background: var(--tag-hover-bg); }
|
|
303
|
+
.hashtag { display: inline; border: 0; border-radius: 999px; padding: 1px 6px; margin: 0 1px; font: inherit; font-weight: 500;
|
|
304
|
+
background: var(--tag-bg); color: var(--tag-text); box-shadow: inset 0 0 0 1px var(--tag-border); }
|
|
305
|
+
button.hashtag { cursor: pointer; }
|
|
306
|
+
@media (forced-colors: active) { .tag-pill, .tag-chip, .hashtag { border: 1px solid CanvasText; } }
|
|
307
|
+
.tag-limit { margin-top: 6px; }
|
|
308
|
+
/* Two placement choices, each with its help button on its right. Labels never wrap; where the
|
|
309
|
+
fonts are too wide for one row, the second choice takes its own. The chosen one is filled in the
|
|
310
|
+
accent with a ring drawn inside it, so choosing changes neither size nor weight. Keyboard focus
|
|
311
|
+
rings the whole choice, just outside that edge. */
|
|
312
|
+
.scope-choice { display: flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
|
|
313
|
+
.scope-option { flex: 1 1 auto; display: flex; align-items: center; border-radius: 6px; }
|
|
314
|
+
.scope-option.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
|
|
315
|
+
.scope-option > button { flex: 1; border: 0; background: none; border-radius: 6px; padding: 3px 2px 3px 8px;
|
|
316
|
+
font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; white-space: nowrap; }
|
|
317
|
+
.scope-option.selected > button { color: var(--accent-strong); }
|
|
318
|
+
.scope-option.selected .scope-info .icon-btn { color: var(--accent-strong); }
|
|
319
|
+
.scope-option.selected .scope-info .icon-btn:hover { background: rgb(13 99 243 / 0.12); }
|
|
320
|
+
@supports selector(:has(*)) {
|
|
321
|
+
.scope-option > button:focus-visible { outline: none; }
|
|
322
|
+
.scope-option:has(> button:focus-visible) { outline: 2px solid var(--accent); outline-offset: 0; }
|
|
323
|
+
}
|
|
324
|
+
@media (forced-colors: active) { .scope-option.selected { outline: 2px solid Highlight; outline-offset: -2px; } }
|
|
325
|
+
.scope-info { display: inline-flex; flex: none; }
|
|
326
|
+
.scope-info .icon-btn { width: 24px; height: 24px; }
|
|
327
|
+
.scope-help { position: fixed; z-index: 4; width: 280px; max-width: calc(100vw - 48px); overflow-y: auto;
|
|
328
|
+
padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
|
|
329
|
+
box-shadow: var(--shadow); font-size: 12px; color: var(--text); }
|
|
330
|
+
.scope-help p { margin: 0; }
|
|
331
|
+
.scope-help p + p { margin-top: 8px; }
|
|
332
|
+
/* Search */
|
|
333
|
+
.search-box { display: flex; align-items: center; gap: 6px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
|
|
334
|
+
.search-box input.field { padding: 5px 8px; min-height: 30px; }
|
|
335
|
+
.search-box input::-webkit-search-cancel-button { display: none; }
|
|
336
|
+
.search-results .search-summary { display: flex; align-items: center; gap: 8px; padding: 10px 16px 0; font-size: 12px; color: var(--muted); }
|
|
337
|
+
.badge { border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600; }
|
|
338
|
+
.badge.ai { background: var(--accent-soft); color: var(--accent); }
|
|
339
|
+
.badge.basic { background: var(--hover); color: var(--text); }
|
|
340
|
+
.search-notice { margin: 8px 16px 0; padding: 6px 10px; border-radius: 8px; background: var(--warning-bg); color: var(--warning-text); font-size: 12px; }
|
|
341
|
+
.search-filters { padding: 6px 16px 0; overflow-wrap: anywhere; }
|
|
342
|
+
.search-insight-note { padding: 4px 16px 0; }
|
|
343
|
+
.insights { padding-bottom: 4px; }
|
|
344
|
+
.insight { margin: 4px 16px 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; gap: 4px; }
|
|
345
|
+
.insight p { margin: 0; color: #444; }
|
|
346
|
+
.insight .sources { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
|
|
347
|
+
.insight .source { border: 0; background: none; padding: 2px 0; text-align: left; color: var(--accent); font-size: 12px; }
|
|
348
|
+
.insight .source:hover { text-decoration: underline; }
|
|
349
|
+
.entry .match { margin-top: 2px; font-size: 12px; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
|
|
350
|
+
/* Tags and AI settings */
|
|
351
|
+
.dialog-scroll { max-height: min(60vh, 560px); overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
|
|
352
|
+
.group-list, .tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
353
|
+
.group-list li { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
|
|
354
|
+
.tag-list li { gap: 8px; }
|
|
355
|
+
.stacked { display: flex; flex-direction: column; gap: 4px; }
|
|
356
|
+
.choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
|
|
357
|
+
.choices input, .settings input[type="radio"] { accent-color: var(--accent); }
|
|
358
|
+
/* A choice with a line explaining it, such as who pays for AI. */
|
|
359
|
+
.choices .row.top { align-items: flex-start; }
|
|
360
|
+
.choices .row.top input { margin-top: 3px; }
|
|
361
|
+
.choices .row.top .stacked { gap: 1px; }
|
|
362
|
+
.success { color: var(--success); font-size: 12px; margin: 0; }
|
|
363
|
+
.dialog .error, .dialog .warning, .dialog .note { margin: 0; }
|
|
364
|
+
/* Dialog paragraphs are dark gray; notices keep their own color. */
|
|
365
|
+
.dialog .error { color: var(--danger); }
|
|
366
|
+
.dialog .note { color: var(--muted); }
|
|
367
|
+
.dialog .warning { color: var(--warning-text); }
|
|
368
|
+
.menu-scroll { max-height: 240px; overflow-y: auto; }
|
|
369
|
+
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; padding: 2px 8px 6px; font-size: 12px; }
|
|
370
|
+
.shortcuts dd { margin: 0; color: var(--muted); }
|
|
371
|
+
.review-address { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
|
|
372
|
+
.review-address .note { overflow-wrap: anywhere; }
|
|
373
|
+
.setup-form { display: flex; flex-direction: column; gap: 10px; }
|
|
374
|
+
.review-address-page { overflow-wrap: anywhere; }
|
|
375
|
+
.setup-section { display: flex; flex-direction: column; gap: var(--space-1); padding-top: var(--space-3); border-top: 1px solid var(--border); }
|
|
376
|
+
.setup-section .row.between { flex-wrap: wrap; column-gap: var(--space-3); }
|
|
377
|
+
.setup-section .note { overflow-wrap: anywhere; }
|
|
378
|
+
.address-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
|
|
379
|
+
.address-rows li { min-height: 32px; border-bottom: 1px solid var(--border); }
|
|
380
|
+
.address-rows code { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
|
|
381
|
+
.address-rows li.inert code { color: var(--muted); text-decoration: line-through; }
|
|
382
|
+
.address-rows .address-note { flex-basis: 100%; padding-bottom: 6px; color: var(--warning-text); }
|
|
383
|
+
.setup-details { display: flex; flex-direction: column; gap: var(--space-2); }
|
|
384
|
+
.step.done .row.between { column-gap: var(--space-3); }
|
|
385
|
+
.plan-usage-rows { display: flex; flex-direction: column; }
|
|
386
|
+
.plan-usage-rows .note { margin: var(--space-1) 0 0; }
|
|
387
|
+
.usage-meter { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-1) 0; font-size: var(--text-s); }
|
|
388
|
+
.usage-meter .row { flex-wrap: wrap; column-gap: var(--space-3); row-gap: 0; }
|
|
389
|
+
.usage-unlimited { font-size: var(--text-s); flex-wrap: wrap; column-gap: var(--space-3); padding: var(--space-1) 0; }
|
|
390
|
+
.settings { display: flex; flex-direction: column; gap: 8px; }
|
|
391
|
+
/* A provider's models to tick, with the picked ones first. */
|
|
392
|
+
.model-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
|
|
393
|
+
.model-list .note { overflow-wrap: anywhere; }
|
|
394
|
+
.settings input[type="checkbox"] { accent-color: var(--accent); }
|
|
395
|
+
.field-label { font-size: var(--text-s); font-weight: 600; color: var(--text); padding: 0; }
|
|
396
|
+
|
|
397
|
+
/* Design system (docs/design-system.md): settings rows, selects, switches, meters, and dialog headers. */
|
|
398
|
+
.ds-dialog-header { display: flex; align-items: center; gap: var(--space-2); min-height: 28px; }
|
|
399
|
+
.ds-dialog-header h3 { flex: 1; min-width: 0; margin: 0; font-size: var(--text-l); }
|
|
400
|
+
.ds-dialog-header > .icon-btn:first-child { margin-left: calc(-1 * var(--space-2)); }
|
|
401
|
+
.ds-dialog-header > .icon-btn:last-child { margin-right: calc(-1 * var(--space-2)); }
|
|
402
|
+
.ds-page { display: flex; flex-direction: column; gap: var(--space-4); }
|
|
403
|
+
.ds-group { display: flex; flex-direction: column; }
|
|
404
|
+
.ds-divider { border: 0; border-top: 1px solid var(--border); margin: 0; }
|
|
405
|
+
.ds-divider + .warning { margin-top: var(--space-2); }
|
|
406
|
+
.ds-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--row-height); }
|
|
407
|
+
.ds-row-label { min-width: 0; }
|
|
408
|
+
.ds-row-control { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
|
|
409
|
+
.ds-nav-row { display: flex; align-items: center; gap: var(--space-2); min-height: var(--row-height); width: calc(100% + 2 * var(--space-2));
|
|
410
|
+
margin: 0 calc(-1 * var(--space-2)); padding: 0 var(--space-2); border: 0; border-radius: var(--radius-m); background: none; text-align: left; }
|
|
411
|
+
.ds-nav-row:hover:not(:disabled) { background: var(--hover); }
|
|
412
|
+
.ds-nav-row:disabled { opacity: 0.5; cursor: default; }
|
|
413
|
+
.ds-nav-row .label { flex: 1; min-width: 0; }
|
|
414
|
+
.ds-nav-row .value { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
415
|
+
.ds-nav-row svg { flex: none; color: var(--faint); }
|
|
416
|
+
.ds-select { display: inline-flex; align-items: center; justify-content: space-between; gap: var(--space-2); height: var(--control-height);
|
|
417
|
+
min-width: 176px; max-width: 100%; padding: 0 var(--space-2) 0 var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-m);
|
|
418
|
+
background: var(--surface); font-weight: 500; }
|
|
419
|
+
.ds-select:hover:not(:disabled) { background: var(--hover); }
|
|
420
|
+
.ds-select:disabled { opacity: 0.5; cursor: default; }
|
|
421
|
+
.ds-select span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
422
|
+
.ds-select svg { flex: none; color: var(--muted); }
|
|
423
|
+
.ds-switch { position: relative; flex: none; width: 32px; height: 18px; padding: 2px; border: 0; border-radius: 9px; background: var(--switch-off); }
|
|
424
|
+
.ds-switch span { display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); transition: transform 0.15s; }
|
|
425
|
+
.ds-switch[aria-checked="true"] { background: var(--accent); }
|
|
426
|
+
.ds-switch[aria-checked="true"] span { transform: translateX(14px); }
|
|
427
|
+
.ds-switch:disabled { opacity: 0.5; cursor: default; }
|
|
428
|
+
@media (prefers-reduced-motion: reduce) { .ds-switch span { transition: none; } }
|
|
429
|
+
.ds-meter { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
|
|
430
|
+
.ds-meter span { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
|
|
431
|
+
.ds-meter.high span { background: var(--caution); }
|
|
432
|
+
.ds-meter.full span { background: var(--danger); }
|
|
433
|
+
.ds-steps { display: inline-flex; gap: var(--space-1); }
|
|
434
|
+
.ds-steps i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
|
|
435
|
+
.ds-steps i.on { background: var(--accent); }
|
|
436
|
+
.ds-group-label { margin: 0 0 var(--space-1); font-size: var(--text-s); font-weight: 600; color: var(--muted); }
|
|
437
|
+
.ds-section { display: flex; flex-direction: column; gap: var(--space-3); }
|
|
438
|
+
.ds-section + .ds-section, .ds-group + .ds-section, .note + .ds-section, .ds-page + .ds-section { padding-top: var(--space-4); border-top: 1px solid var(--border); }
|
|
439
|
+
.ds-section-title { margin: 0; font-size: var(--text-m); font-weight: 600; color: var(--text); }
|
|
440
|
+
.ds-person { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
|
|
441
|
+
.ds-person .stacked { gap: 0; min-width: 0; }
|
|
442
|
+
.ds-person .ellipsis, .ds-row .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
443
|
+
.ds-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
|
|
444
|
+
.ds-actions.between { justify-content: space-between; }
|
|
445
|
+
.billing-usage { gap: var(--space-1); }
|
|
446
|
+
.billing-usage-row { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-2) 0; }
|
|
447
|
+
.billing-usage-row .row { flex-wrap: wrap; column-gap: var(--space-3); row-gap: 0; }
|
|
448
|
+
.billing-plan { gap: 1px; padding: var(--space-2) 0; }
|
|
449
|
+
.billing-plans .ds-row-control { flex: none; }
|
|
450
|
+
.billing-confirm { margin: 0; line-height: 1.5; }
|
|
451
|
+
.billing-cap-field { width: 120px; text-align: right; }
|
|
452
|
+
|
|
453
|
+
/* Thread view */
|
|
454
|
+
.thread-context { margin: 12px 16px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
|
|
455
|
+
.thread-context .capture { display: block; width: 100%; max-height: 220px; object-fit: contain; background: #f6f7f9; border-bottom: 1px solid var(--border); cursor: zoom-in; }
|
|
456
|
+
.thread-context .capture-missing { padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fafafa; }
|
|
457
|
+
.thread-context dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; padding: 10px 12px; font-size: 12px; }
|
|
458
|
+
.thread-context dt { color: var(--muted); }
|
|
459
|
+
.thread-context dd { margin: 0; overflow-wrap: anywhere; }
|
|
460
|
+
.target-status { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; }
|
|
461
|
+
.target-status .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--faint); }
|
|
462
|
+
.target-status .dot.live { background: var(--success); }
|
|
463
|
+
.target-status .dot.warn { background: #d97706; }
|
|
464
|
+
.messages { padding: 4px 0 8px; }
|
|
465
|
+
.message { padding: 10px 16px; display: flex; gap: 10px; position: relative; }
|
|
466
|
+
.message.focused { background: #fff8db; transition: background 2s; }
|
|
467
|
+
.message .body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
|
|
468
|
+
/* The author line starts at the avatar's top: the message's actions float over the row's end rather than sizing it. */
|
|
469
|
+
.message .meta { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; line-height: 18px; padding-right: 60px; min-height: 18px; }
|
|
470
|
+
.message .author { font-weight: 600; }
|
|
471
|
+
.message .time, .message .edited { color: var(--faint); font-size: 12px; }
|
|
472
|
+
.message .via { color: var(--muted); font-size: 12px; white-space: nowrap; }
|
|
473
|
+
.message .actions { position: absolute; top: 6px; right: 10px; gap: 2px; opacity: 0; background: var(--surface); border-radius: 6px; }
|
|
474
|
+
.message.focused .actions { background: #fff8db; }
|
|
475
|
+
.message:hover .actions, .message:focus-within .actions { opacity: 1; }
|
|
476
|
+
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
|
|
477
|
+
.reaction { border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; background: var(--surface); font-size: 12px; line-height: 20px; }
|
|
478
|
+
.reaction[aria-pressed="true"] { background: var(--accent-soft); border-color: #b9d0fb; color: var(--accent); }
|
|
479
|
+
.emoji-picker { display: flex; gap: 2px; padding: 4px; }
|
|
480
|
+
.emoji-picker button { border: 0; background: none; font-size: 16px; padding: 2px 4px; border-radius: 6px; }
|
|
481
|
+
.emoji-picker button:hover { background: var(--hover); }
|
|
482
|
+
.new-divider { display: flex; align-items: center; gap: 8px; padding: 4px 16px; color: var(--danger); font-size: 11px; font-weight: 600; }
|
|
483
|
+
.new-divider::after { content: ""; flex: 1; border-top: 1px solid var(--danger); }
|
|
484
|
+
.status-banner { margin: 12px 16px 0; padding: 8px 10px; border-radius: 8px; background: #ecfdf3; color: var(--success); font-size: 12px; }
|
|
485
|
+
|
|
486
|
+
/* Mockup mode: the page copy covers the prototype beneath Critiqs's panels */
|
|
487
|
+
.mockup-canvas { position: fixed; inset: 0; background: #fff; }
|
|
488
|
+
.mockup-canvas iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; visibility: hidden; background: #fff; }
|
|
489
|
+
.mockup-canvas iframe.shown { visibility: visible; }
|
|
490
|
+
/* Holding Original shows the live prototype through the copy, which still takes the pointer. */
|
|
491
|
+
.mockup-canvas.original { background: transparent; }
|
|
492
|
+
.mockup-canvas.original iframe { visibility: hidden; }
|
|
493
|
+
.target-box.chosen { transition: none; }
|
|
494
|
+
.mockup-panel .sidebar-header { gap: 6px; }
|
|
495
|
+
.thread-heading { min-width: 0; display: flex; flex-direction: column; }
|
|
496
|
+
.thread-heading h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
497
|
+
.thread-heading .note { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
498
|
+
.mockup-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border); }
|
|
499
|
+
.copy-tabs button { white-space: nowrap; }
|
|
500
|
+
.btn.hold { user-select: none; touch-action: none; }
|
|
501
|
+
.btn.hold:active { background: var(--accent-soft); border-color: #b9d0fb; color: var(--accent); }
|
|
502
|
+
.mockup-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; font-size: 12px;
|
|
503
|
+
background: var(--accent-soft); color: var(--accent-strong); border-bottom: 1px solid #c3d5f8; }
|
|
504
|
+
.mockup-banner.hint { background: var(--warning-bg); color: var(--warning-text); border-bottom-color: #f3e1b0; }
|
|
505
|
+
.mockup-banner .link-btn { font-size: 12px; }
|
|
506
|
+
.linked-mockups { margin: 10px 14px 0; }
|
|
507
|
+
|
|
508
|
+
/* Tickets linked to threads: chips in the thread window, badges on list rows and pins, and their dialogs. */
|
|
509
|
+
.ticket-chips { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1) 6px; margin: 10px 14px 0; padding: 0; }
|
|
510
|
+
.ticket-chip { display: inline-flex; align-items: center; max-width: 100%; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--text-s); }
|
|
511
|
+
.ticket-chip a { display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 2px var(--space-2); border-radius: 999px; color: var(--text); text-decoration: none; }
|
|
512
|
+
.ticket-chip a:hover { background: var(--hover); }
|
|
513
|
+
.ticket-chip a svg { flex: none; color: var(--muted); }
|
|
514
|
+
.ticket-chip .key { font-weight: 600; white-space: nowrap; }
|
|
515
|
+
.ticket-chip .status { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
516
|
+
.ticket-chip .status.stale .ticket-dot { opacity: 0.45; }
|
|
517
|
+
.ticket-chip .stale-note { color: var(--faint); }
|
|
518
|
+
.ticket-chip .icon-btn { width: 20px; height: 20px; margin: 0 2px 0 -4px; border-radius: 50%; }
|
|
519
|
+
.ticket-chip .icon-btn svg { width: 12px; height: 12px; }
|
|
520
|
+
.ticket-chip .link-btn { padding: 2px var(--space-2) 2px 2px; font-size: var(--text-s); white-space: nowrap; }
|
|
521
|
+
.ticket-chip .link-btn:disabled { color: var(--muted); text-decoration: none; }
|
|
522
|
+
.ticket-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--faint); }
|
|
523
|
+
.ticket-dot.open { box-shadow: inset 0 0 0 1.5px var(--muted); }
|
|
524
|
+
.ticket-dot.started { background: var(--accent); box-shadow: none; }
|
|
525
|
+
.ticket-dot.done { background: var(--success); box-shadow: none; }
|
|
526
|
+
.ticket-badge { display: inline-flex; align-items: center; gap: 3px; font-weight: 500; white-space: nowrap; }
|
|
527
|
+
.ticket-badge svg { flex: none; }
|
|
528
|
+
.pin-ticket { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 13px; height: 13px; border-radius: 50%;
|
|
529
|
+
background: #fff; color: #1f2023; box-shadow: 0 1px 2px rgb(0 0 0 / 0.35); }
|
|
530
|
+
.ticket-dialog .ticket-body { min-height: 168px; font-size: var(--text-s); line-height: 1.45; resize: vertical; }
|
|
531
|
+
.ticket-ai { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
|
|
532
|
+
.ticket-labels { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
|
|
533
|
+
.ticket-labels ul { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-1) 6px; margin: 0; padding: 0; }
|
|
534
|
+
.ticket-label { display: inline-flex; align-items: center; gap: 2px; padding: 1px 2px 1px var(--space-2); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--text-s); }
|
|
535
|
+
.ticket-label .icon-btn { width: 20px; height: 20px; border-radius: 50%; }
|
|
536
|
+
.ticket-label .icon-btn svg { width: 12px; height: 12px; }
|
|
537
|
+
.ticket-check { display: flex; align-items: center; gap: var(--space-2); }
|
|
538
|
+
.bulk-tickets { margin: 0; padding: 0; list-style: none; max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-m); }
|
|
539
|
+
.bulk-ticket { display: flex; align-items: center; gap: var(--space-3); min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-s); }
|
|
540
|
+
.bulk-ticket + .bulk-ticket { border-top: 1px solid var(--border); }
|
|
541
|
+
.bulk-ticket .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
|
|
542
|
+
.bulk-state { flex: none; max-width: 55%; color: var(--muted); text-align: right; overflow-wrap: anywhere; }
|
|
543
|
+
.bulk-ticket.created .bulk-state { color: var(--success); }
|
|
544
|
+
.bulk-ticket.failed .bulk-state { color: var(--danger); }
|
|
545
|
+
.ticket-fields { display: flex; flex-direction: column; gap: var(--space-2); }
|
|
546
|
+
.ticket-fields fieldset { border: 0; margin: 0; padding: 0; gap: var(--space-1); }
|
|
547
|
+
.ticket-check input { margin: 0; accent-color: var(--accent); }
|
|
548
|
+
.ticket-results { display: flex; flex-direction: column; max-height: 232px; overflow-y: auto; margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) 0; }
|
|
549
|
+
.ticket-result { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); min-height: var(--row-height);
|
|
550
|
+
padding: 0 var(--space-2); border-radius: var(--radius-m); cursor: pointer; }
|
|
551
|
+
.ticket-result:hover { background: var(--hover); }
|
|
552
|
+
.ticket-result.chosen { background: var(--accent-soft); }
|
|
553
|
+
.ticket-result input { margin: 0; accent-color: var(--accent); }
|
|
554
|
+
.ticket-result .key { font-weight: 600; white-space: nowrap; }
|
|
555
|
+
.ticket-result .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
556
|
+
.ticket-result .status { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--muted); font-size: var(--text-s); white-space: nowrap; }
|
|
557
|
+
@media (forced-colors: active) { .ticket-dot { border: 1px solid CanvasText; } }
|
|
558
|
+
.note.pad { padding: 4px 16px 10px; }
|
|
559
|
+
.list-more { padding: 2px 10px 8px; }
|
|
560
|
+
.mockup-entry .page-label { font-weight: 500; }
|
|
561
|
+
/* Above the composer's field: "+ Add existing comment" and the comments added, as short chips, like a chat's added context. */
|
|
562
|
+
/* Many comments scroll here instead of growing the composer; the padding keeps focus rings inside the scroll area. */
|
|
563
|
+
.composer-context { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); min-width: 0; max-height: 84px; overflow-y: auto;
|
|
564
|
+
padding: 3px; margin: -3px; }
|
|
565
|
+
.composer-context .chip { height: 24px; max-width: 100%; padding: 0 2px 0 8px; font-size: var(--text-s); }
|
|
566
|
+
.composer-context .chip.comment-chip { gap: var(--space-1); background: var(--accent-soft); border-color: var(--tag-border); color: var(--accent-strong); font-weight: 500; }
|
|
567
|
+
.composer-context .chip.comment-chip svg { flex: none; width: 13px; height: 13px; }
|
|
568
|
+
.composer-context .chip.comment-chip .chip-tickets { display: inline-flex; align-items: center; gap: 3px; flex: none; color: var(--muted); font-weight: 500; white-space: nowrap; }
|
|
569
|
+
.composer-context .chip.comment-chip .chip-tickets svg { width: 12px; height: 12px; }
|
|
570
|
+
.composer-context .chip.add-comment { padding: 0 8px; margin-right: var(--space-2); background: var(--surface); border: 1px dashed var(--border); color: var(--muted); }
|
|
571
|
+
.composer-context .chip.add-comment:hover { color: var(--text); border-color: var(--faint); }
|
|
572
|
+
.composer-context .chip-remove { color: var(--accent-strong); }
|
|
573
|
+
.composer-context .chip-remove:hover { background: var(--tag-hover-bg); }
|
|
574
|
+
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 104px; }
|
|
575
|
+
.chip-remove { border: 0; background: none; border-radius: 999px; width: 18px; height: 18px; line-height: 16px; padding: 0; color: var(--muted); }
|
|
576
|
+
.chip-remove:hover { background: var(--hover); color: var(--text); }
|
|
577
|
+
/* "+ Add existing comment" opens its picker above the composer, over the conversation. */
|
|
578
|
+
.mockup-panel .sidebar-footer { position: relative; }
|
|
579
|
+
.comment-picker { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); z-index: 1; display: flex; flex-direction: column;
|
|
580
|
+
gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
|
|
581
|
+
.comment-picker input.field { padding: 5px 8px; min-height: 30px; }
|
|
582
|
+
.comment-options { max-height: 240px; overflow-y: auto; margin: 0 -8px -8px; border-top: 1px solid var(--border); }
|
|
583
|
+
.comment-options .entry { padding: 8px 12px; }
|
|
584
|
+
.comment-options .entry:last-child { border-bottom: 0; }
|
|
585
|
+
.entry .ai-tag { color: var(--accent); }
|
|
586
|
+
.ask-composer { display: flex; flex-direction: column; gap: 8px; }
|
|
587
|
+
.ask-composer textarea.field { min-height: 56px; }
|
|
588
|
+
/* Which model Critiqs AI answers with, beside Send, when the connection offers several. */
|
|
589
|
+
.model-choice { min-width: 0; max-width: 150px; font-size: 12px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
|
|
590
|
+
.subheader { display: flex; align-items: center; gap: 4px; padding: 8px 12px 4px 8px; }
|
|
591
|
+
.subheader h3 { margin: 0; font-size: 13px; font-weight: 600; }
|
|
592
|
+
.message .badge.ai { padding: 0 6px; font-size: 10px; line-height: 16px; }
|
|
593
|
+
/* Mockup threads read as a chat: people's messages on the right in a bubble, Critiqs AI's on the left. */
|
|
594
|
+
.mockup-thread .message .meta { padding-right: 0; }
|
|
595
|
+
.mockup-thread .message.from-person { justify-content: flex-end; padding-left: 48px; }
|
|
596
|
+
.mockup-thread .message.from-person .said { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1); min-width: 0; }
|
|
597
|
+
.mockup-thread .message.from-person .meta { justify-content: flex-end; }
|
|
598
|
+
.mockup-thread .message.from-person .bubble { max-width: 100%; padding: var(--space-2) var(--space-3); border-radius: 14px 14px 4px 14px; background: var(--accent-soft);
|
|
599
|
+
white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
600
|
+
.version-card { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 10px; border: 1px solid var(--border);
|
|
601
|
+
border-radius: 8px; font-size: 12px; color: var(--muted); }
|
|
602
|
+
.version-card.shown { border-color: #b9d0fb; background: var(--accent-soft); color: var(--accent-strong); }
|
|
603
|
+
.version-card .link-btn, .version-card .note { font-size: 12px; }
|
|
604
|
+
.version-event { padding: 6px 16px 6px 54px; color: var(--muted); font-size: 12px; }
|
|
605
|
+
.version-event .meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
|
|
606
|
+
.ai-status { display: flex; align-items: center; gap: 8px; margin: 0 16px 12px; font-size: 12px; color: var(--muted); }
|
|
607
|
+
.ai-status.failed { flex-direction: column; align-items: stretch; }
|
|
608
|
+
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
|
|
609
|
+
animation: critiqs-spin 0.8s linear infinite; flex: none; }
|
|
610
|
+
@keyframes critiqs-spin { to { transform: rotate(360deg); } }
|
|
611
|
+
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
|
|
612
|
+
/* Critiqs AI at work: its steps where its answer will appear, and a light sweeping over the copy it is changing. */
|
|
613
|
+
.ai-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
|
|
614
|
+
.ai-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
|
|
615
|
+
.ai-steps li.now { color: var(--text); font-weight: 500; }
|
|
616
|
+
.ai-steps .step-done { width: 12px; flex: none; color: var(--accent); font-size: 12px; line-height: 12px; text-align: center; }
|
|
617
|
+
.ai-dots::after { content: "…"; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; animation: critiqs-dots 1.2s steps(4, end) infinite; }
|
|
618
|
+
@keyframes critiqs-dots { from { width: 0; } to { width: 1.2em; } }
|
|
619
|
+
.mockup-canvas .ai-scan { position: absolute; top: 0; bottom: 0; left: 0; pointer-events: none; overflow: hidden;
|
|
620
|
+
background: rgb(13 99 243 / 0.06); box-shadow: inset 0 0 0 2px rgb(13 99 243 / 0.55); }
|
|
621
|
+
.mockup-canvas .ai-scan::before { content: ""; position: absolute; left: 0; right: 0; height: 160px; top: -160px;
|
|
622
|
+
background: linear-gradient(180deg, rgb(13 99 243 / 0) 0%, rgb(13 99 243 / 0.16) 85%, rgb(13 99 243 / 0.5) 100%);
|
|
623
|
+
animation: critiqs-scan 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
|
|
624
|
+
@keyframes critiqs-scan { to { transform: translateY(calc(100vh + 160px)); } }
|
|
625
|
+
.ai-scan-chip { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
|
|
626
|
+
padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 500;
|
|
627
|
+
box-shadow: var(--shadow); white-space: nowrap; }
|
|
628
|
+
@media (prefers-reduced-motion: reduce) { .mockup-canvas .ai-scan::before, .ai-dots::after { animation: none; } .mockup-canvas .ai-scan::before { display: none; } .ai-dots::after { width: 1.2em; } }
|
|
629
|
+
|
|
630
|
+
/* Dialogs and toasts */
|
|
631
|
+
.scrim { position: fixed; inset: 0; z-index: 3; background: rgb(0 0 0 / 0.32); display: grid; place-items: center; }
|
|
632
|
+
.dialog { width: min(440px, calc(100vw - 32px)); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 20px;
|
|
633
|
+
display: flex; flex-direction: column; gap: 12px; }
|
|
634
|
+
.dialog h3 { margin: 0; font-size: 15px; }
|
|
635
|
+
.dialog p { margin: 0; color: #444; }
|
|
636
|
+
.dialog pre { margin: 0; max-height: 200px; overflow: auto; background: #f6f7f9; border-radius: 8px; padding: 10px; font-size: 11px; white-space: pre-wrap; }
|
|
637
|
+
.lightbox img { max-width: calc(100vw - 48px); max-height: calc(100vh - 48px); border-radius: 8px; box-shadow: var(--shadow); background: #fff; }
|
|
638
|
+
.toasts { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
|
|
639
|
+
.toast { display: flex; align-items: center; gap: 12px; background: #1f2023; color: #fff; border-radius: 8px; padding: 8px 12px; box-shadow: var(--shadow); }
|
|
640
|
+
.toast .link-btn { color: #8ab4ff; }
|
|
641
|
+
|
|
642
|
+
/* Setup */
|
|
643
|
+
.setup { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
|
|
644
|
+
.setup h3 { margin: 0; font-size: 15px; }
|
|
645
|
+
.setup p { margin: 0; color: #444; }
|
|
646
|
+
.step { display: flex; gap: 10px; }
|
|
647
|
+
.step .num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--hover); color: var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
|
|
648
|
+
.step.done .num { background: #dcfce7; color: var(--success); }
|
|
649
|
+
.code { display: flex; align-items: center; gap: 8px; background: #1f2023; color: #e5e7eb; border-radius: 8px; padding: 8px 8px 8px 12px; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
|
|
650
|
+
.code code { flex: 1; overflow-x: auto; white-space: nowrap; }
|
|
651
|
+
.code .btn { background: #34363b; border-color: #34363b; color: #fff; }
|
|
652
|
+
.project-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
|
|
653
|
+
.project-list button { border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; padding: 8px 12px; }
|
|
654
|
+
.project-list button:last-child { border-bottom: 0; }
|
|
655
|
+
.project-list button:hover { background: var(--hover); }
|
|
656
|
+
.banner { margin: 0; padding: 8px 16px; background: var(--warning-bg); color: var(--warning-text); font-size: 12px; border-bottom: 1px solid #f3e1b0; }
|
|
657
|
+
`;function Bq(e){if("adoptedStyleSheets"in ShadowRoot.prototype&&"replaceSync"in CSSStyleSheet.prototype){let n=new CSSStyleSheet;n.replaceSync(ov),e.adoptedStyleSheets=[n];return}let t=document.createElement("style");t.textContent=ov,e.prepend(t)}function $A(){let{host:e,container:t}=$q(document.body);return{root:lc(t),host:e}}function $q(e){let t=document.createElement(nr);t.style.setProperty("all","initial","important"),t.setAttribute("data-turbo-permanent",""),e.appendChild(t);let n=t.attachShadow({mode:"open"}),r=document.createElement("div");n.append(r),Bq(n);let o=(a)=>a.stopPropagation();for(let a of["keydown","keyup","keypress"])n.addEventListener(a,o);return{host:t,container:r}}function HA({props:e,host:t,page:n,supplyCapture:r,session:o,openThread:a,mockups:i,review:s}){let c=e.backend??pc,f=e.requireProjectId===!0,p=f?e.projectId:void 0,[d,u]=S(null);if(_(()=>{let m=!1;return u(null),(async()=>{let y=await PA(c);if(p!==void 0&&await LA(y,p)==="missing")throw Error(`The project ${p} doesn't exist on the Critiqs backend at ${y.backendUrl}. Check this app's project ID setting and backend.`);return y})().then((y)=>!m&&u(y)).catch((y)=>{if(m)return;let g=y instanceof Error?y.message:String(y);if(f)console.warn(`Critiqs: ${g} Critiqs stays hidden; run npx critiqs doctor to check the setup.`);u({error:g})}),()=>{m=!0}},[c,f,p]),d===null)return null;if("error"in d)return f?null:l(Kq,{message:d.error});return l(Hq,{props:e,host:t,deployment:d,page:n,supplyCapture:r,session:o,openThread:a,mockups:i,review:s})}function Hq(e){return e.deployment.transport==="http"?l(Vq,{...e}):l(Qq,{...e})}function Vq({props:e,host:t,deployment:n,page:r,supplyCapture:o,review:a}){let i=Ee(()=>new rv(n.backendUrl,n.signIn),[n.backendUrl,n.signIn]),s=Ee(()=>BA(n,i),[n,i]);return _(()=>{i.refresh().catch(()=>{return})},[i]),l(mf.Provider,{value:s,children:l(Cb,{props:e,deployment:n,session:i,host:t,page:r,supplyCapture:o,review:a})})}function Qq({props:e,host:t,deployment:n,page:r,supplyCapture:o,session:a,openThread:i,mockups:s,review:c}){let f=Ee(()=>a??new ab(n.signInUrl),[a,n.signInUrl]),[p,d]=S(null);_(()=>{let m=IA(n.backendUrl);return d(m),()=>void setTimeout(()=>void m.close())},[n.backendUrl]);let u=Ee(()=>p===null?null:jA(p,n,f),[p,n,f]);if(u===null)return null;return l(mf.Provider,{value:u,children:u.wrap(l(Cb,{props:e,deployment:n,session:f,host:t,page:r,supplyCapture:o,openThread:i,mockups:s,review:c}))})}function Kq({message:e}){return l("div",{className:"layer",children:l("div",{className:"toolbar",style:{left:"50%",bottom:16,transform:"translateX(-50%)"},role:"status",children:l("span",{className:"hint",children:e})})})}function VA(e={}){if(typeof document>"u")throw Error("Critiqs: mountCritiqs runs only in the browser. Call it once the page has loaded, such as in a component's mounted hook.");let t=null,n=null,r=!1,o=e,a={},i=!1;document.addEventListener("turbo:before-render",Xq);let s=()=>{if(t===null)return;let{root:f,host:p}=t;t=null,setTimeout(()=>{f.unmount(),p.remove()})},c=()=>{if(r)return;if(KS())return s();let f=o.requireProjectId===!0,p=f?Fq(o.projectId):o.projectId,d=!f||p!==void 0,u=f&&!d&&typeof o.projectId==="string"&&o.projectId.trim()!==""?o.projectId:null;if(u!==n){if(n=u,u!==null)console.warn(`Critiqs: ${JSON.stringify(u.slice(0,80))} is not a Critiqs project ID, so Critiqs stays hidden. Set this app's project ID setting to the ID from project setup in the Critiqs sidebar, or run npx critiqs doctor.`)}if(!d){s();return}if(t===null&&document.body===null){if(!i)i=!0,document.addEventListener("DOMContentLoaded",()=>{i=!1,c()},{once:!0});return}t??=$A();let m=Gq(a,o.getContext);t.root.render(l(HA,{props:{...o,getContext:m,...f?{projectId:p}:{}},host:t.host}))};return c(),{update(f){o=f,c()},setContext(f){a={...f},c()},destroy(){s(),r=!0}}}function Gq(e,t){if(Object.keys(e).length===0)return t;if(t===void 0)return()=>e;return()=>{let n={};try{n=t()??{}}catch(o){console.error("Critiqs: getContext failed",o)}let r={...e};if(n.screen!==void 0)r.screen=n.screen;if(n.persona!==void 0)r.persona=n.persona;if(n.viewState!=null)r.viewState={...e.viewState,...Yq(n.viewState)};return r}}function Yq(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Fq(e){let t=typeof e==="string"?e.trim():"";return DA.test(t)?t:void 0}function Xq(e){let t=e.detail?.newBody;if(t instanceof Element)for(let n of t.querySelectorAll(nr))n.remove()}var QA="critiqs-app",Wq=typeof HTMLElement>"u"?class{}:HTMLElement;class KA extends Wq{static observedAttributes=["project-id","backend","version","require-project-id"];#e=null;#r;#n;#t={};get getContext(){return this.#r}set getContext(e){this.#r=e,this.#o()}get restoreContext(){return this.#n}set restoreContext(e){this.#n=e,this.#o()}setContext(e){this.#t={...e},this.#e?.setContext(this.#t)}connectedCallback(){this.style.display="none";for(let e of["getContext","restoreContext"]){if(!Object.hasOwn(this,e))continue;let t=this[e];delete this[e],this[e]=t}if(this.#e!==null)return;if(this.#e=VA(this.#a()),Object.keys(this.#t).length>0)this.#e.setContext(this.#t)}disconnectedCallback(){this.#e?.destroy(),this.#e=null}attributeChangedCallback(){this.#o()}#o(){this.#e?.update(this.#a())}#a(){let e=(t)=>this.getAttribute(t)??void 0;return{projectId:e("project-id"),requireProjectId:this.hasAttribute("require-project-id"),backend:e("backend"),version:e("version"),getContext:this.#r,restoreContext:this.#n}}}if(typeof customElements<"u"&&customElements.get(QA)===void 0)customElements.define(QA,KA);export{KA as CritiqsElement,QA as ELEMENT_TAG};
|