shapewall 0.2.4 → 0.3.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +35 -1
  3. package/dist/agent/package-lock.json +2 -2
  4. package/dist/client/assets/BoardChat-CupOxioV.js +27 -0
  5. package/dist/client/assets/{BuzzDialog-CZdwIQLF.js → BuzzDialog-Ds7Thpfe.js} +1 -1
  6. package/dist/client/assets/ChecksPanel-BqrS02Ih.js +1 -0
  7. package/dist/client/assets/History-CQG3NQOC.js +1 -0
  8. package/dist/client/assets/{LocalSettings-B5gtfKEl.js → LocalSettings-CSNMhNyV.js} +1 -1
  9. package/dist/client/assets/{Management-BxEUZAmI.js → Management-CJVNAqAW.js} +1 -1
  10. package/dist/client/assets/QuickConnect-B-4pUgXH.js +1 -0
  11. package/dist/client/assets/{ShareDialog-CdVAreaw.js → ShareDialog-BouvNraR.js} +2 -2
  12. package/dist/client/assets/{app-update-dialog-BONq9YFp.js → app-update-dialog-rhaw0MRk.js} +1 -1
  13. package/dist/client/assets/{circle-x-BmT6vHKl.js → circle-x-PRxj7kPi.js} +1 -1
  14. package/dist/client/assets/index-CXtuJi1K.css +2 -0
  15. package/dist/client/assets/index-DKOCIQiq.js +37 -0
  16. package/dist/client/assets/{refresh-cw-ugt3cWKH.js → refresh-cw-aeOBDuGQ.js} +1 -1
  17. package/dist/client/assets/{square-_KG6tM5A.js → shield-check-DuPBJ6H_.js} +1 -1
  18. package/dist/client/assets/ui-Cg4TTrec.js +41 -0
  19. package/dist/client/build-info.json +1 -1
  20. package/dist/client/index.html +3 -3
  21. package/dist/client/sw.js +2 -2
  22. package/dist/console/assets/LocalAccountsApp-DOKZI6Lt.js +1 -0
  23. package/dist/console/assets/LocalConsole-DXzldLW9.js +1 -0
  24. package/dist/console/assets/{app-update-dialog-o4QY_jL9.js → app-update-dialog-CrqIMEwN.js} +1 -1
  25. package/dist/console/assets/console-76WovHlh.js +55 -0
  26. package/dist/console/assets/console-Fp4k9iyx.css +2 -0
  27. package/dist/console/build-info.json +1 -1
  28. package/dist/console/console.html +2 -2
  29. package/docs/agent-hardening.md +19 -0
  30. package/docs/agent-workflow.md +33 -0
  31. package/docs/agents.md +112 -0
  32. package/docs/config.md +41 -0
  33. package/docs/deployment.md +3 -0
  34. package/docs/hosted.md +10 -0
  35. package/docs/pull-requests.md +192 -0
  36. package/package.json +2 -1
  37. package/src/agent/backends/acp.js +23 -6
  38. package/src/agent/batch-fixes.js +45 -0
  39. package/src/agent/batch-queue.js +204 -0
  40. package/src/agent/branch-mode.js +753 -0
  41. package/src/agent/config.js +6 -0
  42. package/src/agent/fix-prompt.js +5 -0
  43. package/src/agent/routes.js +850 -185
  44. package/src/agent/run.js +8 -1
  45. package/src/agent/settings-routes.js +69 -1
  46. package/src/agent/starter/worktree.js +254 -25
  47. package/src/agent/threads.js +2 -7
  48. package/src/agent/tools.js +51 -0
  49. package/src/agent/user-settings.js +33 -2
  50. package/src/ci/capture.js +103 -0
  51. package/src/ci/compare.js +267 -0
  52. package/src/ci/github.js +307 -0
  53. package/src/ci/images.js +76 -0
  54. package/src/ci/settings.js +211 -0
  55. package/src/ci/start.js +148 -0
  56. package/src/ci/summary.js +262 -0
  57. package/src/ci/workflow.js +238 -0
  58. package/src/cli/args.js +24 -1
  59. package/src/cli/ci.js +229 -0
  60. package/src/cli/help.js +23 -1
  61. package/src/cli/init.js +33 -1
  62. package/src/cli.js +6 -2
  63. package/src/comment-drawing.js +161 -0
  64. package/src/comment-fields.js +51 -0
  65. package/src/comment-media.js +528 -0
  66. package/src/config.js +7 -0
  67. package/src/doctor.js +23 -0
  68. package/src/export.js +8 -0
  69. package/src/feedback.js +89 -12
  70. package/src/github.js +3 -3
  71. package/src/hosted/admin.js +36 -4
  72. package/src/hosted/app.js +5 -0
  73. package/src/hosted/board-routes.js +63 -7
  74. package/src/hosted/clean-worker.js +22 -4
  75. package/src/hosted/cleaner.js +4 -1
  76. package/src/hosted/comment-files.js +200 -0
  77. package/src/hosted/comments.js +68 -15
  78. package/src/hosted/db.js +32 -0
  79. package/src/hosted/guest-view.js +9 -0
  80. package/src/hosted/import.js +213 -18
  81. package/src/hosted/operator.js +3 -1
  82. package/src/hosted/projects.js +3 -2
  83. package/src/hosted/push.js +6 -3
  84. package/src/hosted/retention.js +18 -0
  85. package/src/hosted/tenancy.js +1 -0
  86. package/src/hosted/token-api.js +110 -9
  87. package/src/image-sniff.js +11 -0
  88. package/src/mcp.js +48 -3
  89. package/src/remote/remote-mcp.js +2 -2
  90. package/src/remote/remote.js +6 -2
  91. package/src/remote/share.js +77 -7
  92. package/src/server/app.js +18 -1
  93. package/src/store.js +119 -33
  94. package/src/watch.js +4 -0
  95. package/dist/client/assets/BoardChat-C0a3DDjv.js +0 -28
  96. package/dist/client/assets/ChecksPanel-BHWgwJWO.js +0 -1
  97. package/dist/client/assets/History-C01qLFpP.js +0 -1
  98. package/dist/client/assets/QuickConnect-BzTM3UNO.js +0 -1
  99. package/dist/client/assets/index-C1IsGdGs.js +0 -29
  100. package/dist/client/assets/index-DnsWelgZ.css +0 -2
  101. package/dist/client/assets/ui-BAGBTB_P.js +0 -41
  102. package/dist/console/assets/LocalAccountsApp-DtfTDbQg.js +0 -1
  103. package/dist/console/assets/LocalConsole-BPpsxDq_.js +0 -1
  104. package/dist/console/assets/console-DeOji9Zv.css +0 -2
  105. package/dist/console/assets/console-MvFrlUCC.js +0 -51
@@ -0,0 +1,37 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app-update-dialog-rhaw0MRk.js","./ui-Cg4TTrec.js","./refresh-cw-aeOBDuGQ.js","./ChecksPanel-BqrS02Ih.js","./shield-check-DuPBJ6H_.js","./circle-x-PRxj7kPi.js","./BoardChat-CupOxioV.js","./QuickConnect-B-4pUgXH.js","./History-CQG3NQOC.js","./ShareDialog-BouvNraR.js","./LocalSettings-CSNMhNyV.js","./BuzzDialog-Ds7Thpfe.js","./Management-CJVNAqAW.js"])))=>i.map(i=>d[i]);
2
+ import{$t as e,A as t,At as n,B as r,Bt as i,C as a,Ct as o,D as s,Dt as c,E as l,Et as u,F as d,Ft as f,G as p,Gt as m,H as h,Ht as g,I as _,It as v,J as y,Jt as b,K as x,Kt as S,L as C,Lt as w,M as T,Mt as E,N as D,Nt as O,O as k,P as A,Pt as j,R as M,Rt as N,S as P,St as F,T as ee,Tt as I,U as L,Ut as R,V as z,Vt as B,W as V,Wt as H,X as U,Xt as te,Y as ne,Yt as re,Z as ie,Zt as ae,_ as W,_t as G,a as oe,at as se,b as ce,bt as le,c as ue,ct as K,d as de,dt as fe,f as pe,ft as me,g as he,gt as ge,h as _e,ht as ve,i as ye,it as be,j as xe,jt as Se,k as Ce,kt as we,l as Te,lt as Ee,m as De,mt as Oe,n as ke,o as Ae,ot as je,p as Me,pt as Ne,q as Pe,qt as q,r as Fe,rt as Ie,s as Le,st as Re,t as ze,tt as Be,u as Ve,ut as He,v as Ue,vt as We,w as Ge,wt as Ke,x as qe,xt as Je,y as Ye,yt as Xe,z as Ze,zt as Qe}from"./ui-Cg4TTrec.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var $e=ae((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=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`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),et=ae(((e,t)=>{t.exports=$e()})),tt=ae((e=>{var t=et(),n=te(),r=re();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(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 c(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 l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(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 m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(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)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(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||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),A=Symbol.for(`react.profiler`),j=Symbol.for(`react.consumer`),M=Symbol.for(`react.context`),N=Symbol.for(`react.forward_ref`),P=Symbol.for(`react.suspense`),F=Symbol.for(`react.suspense_list`),ee=Symbol.for(`react.memo`),I=Symbol.for(`react.lazy`),L=Symbol.for(`react.activity`),R=Symbol.for(`react.legacy_hidden`),z=Symbol.for(`react.memo_cache_sentinel`),B=Symbol.for(`react.view_transition`),V=Symbol.for(`react.recoverable`),H=Symbol.iterator;function U(e){return typeof e!=`object`||!e?null:(e=H&&e[H]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function ie(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case A:return`Profiler`;case k:return`StrictMode`;case P:return`Suspense`;case F:return`SuspenseList`;case L:return`Activity`;case B:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case M:return e.displayName||`Context`;case j:return(e._context.displayName||`Context`)+`.Consumer`;case N:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ee:return t=e.displayName||null,t===null?ie(e.type)||`Memo`:t;case I:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}var ae=Array.isArray,W=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},se=[],ce=-1;function le(e){return{current:e}}function ue(e){0>ce||(e.current=se[ce],se[ce]=null,ce--)}function K(e,t){ce++,se[ce]=e.current,e.current=t}var de=le(null),fe=le(null),pe=le(null),me=le(null);function he(e,t){switch(K(pe,t),K(fe,e),K(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ue(de),K(de,e)}function ge(){ue(de),ue(fe),ue(pe)}function _e(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,K(me,e)),t=de.current;var n=dp(t,e.type);t!==n&&(K(fe,e),K(de,n))}function ve(e){fe.current===e&&(ue(de),ue(fe)),me.current===e&&(ue(me),sh._currentValue=oe)}var ye,be;function xe(e){if(ye===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ye=t&&t[1]||``,be=-1<e.stack.indexOf(`
3
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
+ `+ye+e+be}var Se=!1;function Ce(e,t){if(!e||Se)return``;Se=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
+ `),l=s.split(`
6
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Se=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?xe(n):``}function we(e,t){switch(e.tag){case 26:case 27:case 5:return xe(e.type);case 16:return xe(`Lazy`);case 13:return e.child!==t&&t!==null?xe(`Suspense Fallback`):xe(`Suspense`);case 19:return xe(`SuspenseList`);case 0:case 15:return Ce(e.type,!1);case 11:return Ce(e.type.render,!1);case 1:return Ce(e.type,!0);case 31:return xe(`Activity`);case 30:return xe(`ViewTransition`);default:return``}}function Te(e){try{var t=``,n=null;do t+=we(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
+ Error generating stack: `+e.message+`
9
+ `+e.stack}}var Ee=Object.prototype.hasOwnProperty,De=t.unstable_scheduleCallback,Oe=t.unstable_cancelCallback,ke=t.unstable_shouldYield,Ae=t.unstable_requestPaint,je=t.unstable_now,Me=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,Pe=t.unstable_UserBlockingPriority,q=t.unstable_NormalPriority,Fe=t.unstable_LowPriority,Ie=t.unstable_IdlePriority,Le=t.log,Re=t.unstable_setDisableYieldValue,ze=null,Be=null;function Ve(e){if(typeof Le==`function`&&Re(e),Be&&typeof Be.setStrictMode==`function`)try{Be.setStrictMode(ze,e)}catch{}}var He=Math.clz32?Math.clz32:Ge,Ue=Math.log,We=Math.LN2;function Ge(e){return e>>>=0,e===0?32:31-(Ue(e)/We|0)|0}var Ke=256,qe=262144,Je=4194304;function Ye(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 Xe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ye(n))):i=Ye(o):i=Ye(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ye(n))):i=Ye(o)):i=Ye(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ze(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Qe(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-He(n),i=1<<r;t|=e[r],n&=~i}return t}function $e(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+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function tt(){var e=Je;return Je<<=1,!(Je&62914560)&&(Je=4194304),e}function nt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function J(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rt(e,t,n,r,i,a){var o=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 s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-He(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Y(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Y(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-He(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function it(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-He(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function at(e,t){var n=t&-t;return n=n&42?1:ot(n),(n&(e.suspendedLanes|t))===0?n:0}function ot(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 st(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ct(){var e=G.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function lt(e,t){var n=G.p;try{return G.p=e,t()}finally{G.p=n}}var ut=Math.random().toString(36).slice(2),dt=`__reactFiber$`+ut,ft=`__reactProps$`+ut,pt=`__reactContainer$`+ut,mt=`__reactEvents$`+ut,ht=`__reactListeners$`+ut,gt=`__reactHandles$`+ut,_t=`__reactResources$`+ut,vt=`__reactMarker$`+ut,yt=`__reactLoad$`+ut;function bt(e){delete e[dt],delete e[ft],delete e[ht],delete e[gt]}function xt(e){var t;if(t=e[dt])return t;for(var n=e.parentNode;n;){if(t=n[pt]||n[dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[dt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function St(e){if(e=e[dt]||e[pt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ct(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function wt(e){var t=e[_t];return t||=e[_t]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Tt(e){e[vt]=!0}function Et(e){e[yt]=void 0}var Dt=new Set,Ot={};function kt(e,t){At(e,t),At(e+`Capture`,t)}function At(e,t){for(Ot[e]=t,e=0;e<t.length;e++)Dt.add(t[e])}var jt=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]*$`),Mt={},Nt={};function Pt(e){return Ee.call(Nt,e)?!0:Ee.call(Mt,e)?!1:jt.test(e)?Nt[e]=!0:(Mt[e]=!0,!1)}var X=!1;function Ft(){var e=X;return X=!1,e}function It(e,t,n){if(Pt(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 Lt(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 Rt(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 zt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Bt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Vt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ht(e){if(!e._valueTracker){var t=Bt(e)?`checked`:`value`;e._valueTracker=Vt(e,t,``+e[t])}}function Ut(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Bt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Wt=/[\n"\\]/g;function Gt(e){return e.replace(Wt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Kt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+zt(t)):e.value!==``+zt(t)&&(e.value=``+zt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Jt(e,zt(n)):o===`number`&&e.value==t?Jt(e,zt(e.value)):Jt(e,zt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+zt(s):e.removeAttribute(`name`)}function qt(e,t,n,r,i,a,o,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!=null)){Ht(e);return}n=n==null?``:``+zt(n),t=t==null?n:``+zt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Ht(e)}function Jt(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function Yt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+zt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Xt(e,t,n){t!=null&&(t=``+zt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+zt(n)}function Zt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ae(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=zt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ht(e)}function Qt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $t=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 en(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||$t.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function tn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(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]=``,X=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(en(e,a,r),X=!0)}else for(var o in t)t.hasOwnProperty(o)&&en(e,o,t[o])}function nn(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 rn=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`]]),an=/^[\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 on(e){return an.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function sn(){}var cn=null;function ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var un=null,dn=null;function fn(e){var t=St(e);if(t&&(e=t.stateNode)){var n=e[ft]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Kt(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;for(n=n.querySelectorAll(`input[name="`+Gt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ft]||null;if(!a)throw Error(i(90));Kt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ut(r)}break a;case`textarea`:Xt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Yt(e,!!n.multiple,t,!1)}}}var pn=!1;function mn(e,t,n){if(pn)return e(t,n);pn=!0;try{return e(t)}finally{if(pn=!1,(un!==null||dn!==null)&&(Id(),un&&(t=un,e=dn,dn=un=null,fn(t),e)))for(t=0;t<e.length;t++)fn(e[t])}}function hn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ft]||null;if(r===null)return null;n=r[t];a: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 a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var gn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,_n=!1;if(gn)try{var vn={};Object.defineProperty(vn,"passive",{get:function(){_n=!0}}),window.addEventListener(`test`,vn,vn),window.removeEventListener(`test`,vn,vn)}catch{_n=!1}var yn=null,bn=null,xn=null;function Sn(){if(xn)return xn;var e,t=bn,n=t.length,r,i=`value`in yn?yn.value:yn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return xn=i.slice(e,1<r?1-r:void 0)}function Cn(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 wn(){return!0}function Tn(){return!1}function En(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?wn:Tn,this.isPropagationStopped=Tn,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=wn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=wn)},persist:function(){},isPersistent:wn}),t}var Dn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},On=En(Dn),kn=w({},Dn,{view:0,detail:0}),An=En(kn),jn,Mn,Nn,Pn=w({},kn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gn,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){return`movementX`in e?e.movementX:(e!==Nn&&(Nn&&e.type===`mousemove`?(jn=e.screenX-Nn.screenX,Mn=e.screenY-Nn.screenY):Mn=jn=0,Nn=e),jn)},movementY:function(e){return`movementY`in e?e.movementY:Mn}}),Fn=En(Pn),In=En(w({},Pn,{dataTransfer:0})),Ln=En(w({},kn,{relatedTarget:0})),Rn=En(w({},Dn,{animationName:0,elapsedTime:0,pseudoElement:0})),zn=En(w({},Dn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Bn=En(w({},Dn,{data:0})),Vn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Hn={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`},Un={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Wn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Un[e])?!!t[e]:!1}function Gn(){return Wn}var Kn=En(w({},kn,{key:function(e){if(e.key){var t=Vn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Cn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Hn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gn,charCode:function(e){return e.type===`keypress`?Cn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Cn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),qn=En(w({},Pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Jn=En(w({},Dn,{submitter:0})),Yn=En(w({},kn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gn})),Xn=En(w({},Dn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Zn=En(w({},Pn,{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})),Qn=En(w({},Dn,{newState:0,oldState:0,source:0})),$n=[9,13,27,32],er=gn&&`CompositionEvent`in window,tr=null;gn&&`documentMode`in document&&(tr=document.documentMode);var nr=gn&&`TextEvent`in window&&!tr,rr=gn&&(!er||tr&&8<tr&&11>=tr),ir=` `,ar=!1;function or(e,t){switch(e){case`keyup`:return $n.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function sr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var cr=!1;function lr(e,t){switch(e){case`compositionend`:return sr(t);case`keypress`:return t.which===32?(ar=!0,ir):null;case`textInput`:return e=t.data,e===ir&&ar?null:e;default:return null}}function ur(e,t){if(cr)return e===`compositionend`||!er&&or(e,t)?(e=Sn(),xn=bn=yn=null,cr=!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 rr&&t.locale!==`ko`?null:t.data;default:return null}}var dr={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 fr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!dr[e.type]:t===`textarea`}function pr(e,t,n,r){un?dn?dn.push(r):dn=[r]:un=r,t=qf(t,`onChange`),0<t.length&&(n=new On(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var mr=null,hr=null;function gr(e){zf(e,0)}function _r(e){if(Ut(Ct(e)))return e}function vr(e,t){if(e===`change`)return t}var yr=!1;if(gn){var br;if(gn){var xr=`oninput`in document;if(!xr){var Sr=document.createElement(`div`);Sr.setAttribute(`oninput`,`return;`),xr=typeof Sr.oninput==`function`}br=xr}else br=!1;yr=br&&(!document.documentMode||9<document.documentMode)}function Cr(){mr&&(mr.detachEvent(`onpropertychange`,wr),hr=mr=null)}function wr(e){if(e.propertyName===`value`&&_r(hr)){var t=[];pr(t,hr,e,ln(e)),mn(gr,t)}}function Tr(e,t,n){e===`focusin`?(Cr(),mr=t,hr=n,mr.attachEvent(`onpropertychange`,wr)):e===`focusout`&&Cr()}function Er(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return _r(hr)}function Dr(e,t){if(e===`click`)return _r(t)}function Or(e,t){if(e===`input`||e===`change`)return _r(t)}function kr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ar=typeof Object.is==`function`?Object.is:kr;function jr(e,t){if(Ar(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)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 i=n[r];if(!Ee.call(t,i)||!Ar(e[i],t[i]))return!1}return!0}function Mr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Nr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Pr(e,t){var n=Nr(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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Nr(n)}}function Fr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ir(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mr(e.document)}return t}function Lr(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 Rr=gn&&`documentMode`in document&&11>=document.documentMode,zr=null,Br=null,Vr=null,Hr=!1;function Ur(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hr||zr==null||zr!==Mr(r)||(r=zr,`selectionStart`in r&&Lr(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}),Vr&&jr(Vr,r)||(Vr=r,r=qf(Br,`onSelect`),0<r.length&&(t=new On(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=zr)))}function Wr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Gr={animationend:Wr(`Animation`,`AnimationEnd`),animationiteration:Wr(`Animation`,`AnimationIteration`),animationstart:Wr(`Animation`,`AnimationStart`),transitionrun:Wr(`Transition`,`TransitionRun`),transitionstart:Wr(`Transition`,`TransitionStart`),transitioncancel:Wr(`Transition`,`TransitionCancel`),transitionend:Wr(`Transition`,`TransitionEnd`)},Kr={},qr={};gn&&(qr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Gr.animationend.animation,delete Gr.animationiteration.animation,delete Gr.animationstart.animation),`TransitionEvent`in window||delete Gr.transitionend.transition);function Jr(e){if(Kr[e])return Kr[e];if(!Gr[e])return e;var t=Gr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in qr)return Kr[e]=t[n];return e}var Yr=Jr(`animationend`),Xr=Jr(`animationiteration`),Zr=Jr(`animationstart`),Qr=Jr(`transitionrun`),$r=Jr(`transitionstart`),ei=Jr(`transitioncancel`),ti=Jr(`transitionend`),ni=new Map,ri=`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(` `);ri.push(`scrollEnd`);function ii(e,t){ni.set(e,t),kt(t,[e])}var ai=0;function oi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=_d.identifierPrefix;var n=ai++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function si(e){if(e==null||typeof e==`string`)return e;var t=null,n=Td;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function ci(e,t){return e=si(e),t=si(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var li=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&&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)},ui=[],di=0,fi=0;function pi(){for(var e=di,t=fi=di=0;t<e;){var n=ui[t];ui[t++]=null;var r=ui[t];ui[t++]=null;var i=ui[t];ui[t++]=null;var a=ui[t];if(ui[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&_i(n,i,a)}}function mi(e,t,n,r){ui[di++]=e,ui[di++]=t,ui[di++]=n,ui[di++]=r,fi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function hi(e,t,n,r){return mi(e,t,n,r),vi(e)}function gi(e,t){return mi(e,null,null,t),vi(e)}function _i(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!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||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-He(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function vi(e){if(50<Ed)throw Ed=0,Dd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var yi={};function bi(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 xi(e,t,n,r){return new bi(e,t,n,r)}function Si(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ci(e,t){var n=e.alternate;return n===null?(n=xi(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 wi(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 Ti(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Si(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,de.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case L:return e=xi(31,n,t,a),e.elementType=L,e.lanes=o,e;case O:return Ei(n.children,a,o,t);case k:s=8,a|=24;break;case A:return e=xi(12,n,t,a|2),e.elementType=A,e.lanes=o,e;case P:return e=xi(13,n,t,a),e.elementType=P,e.lanes=o,e;case F:return e=xi(19,n,t,a),e.elementType=F,e.lanes=o,e;case R:case B:return e=a|32,e=xi(30,n,t,e),e.elementType=B,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case M:s=10;break a;case j:s=9;break a;case N:s=11;break a;case ee:s=14;break a;case I:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=xi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Ei(e,t,n,r){return e=xi(7,e,r,t),e.lanes=n,e}function Di(e,t,n){return e=xi(6,e,null,t),e.lanes=n,e}function Oi(e){var t=xi(18,null,null,0);return t.stateNode=e,t}function ki(e,t,n){return t=xi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ai=new WeakMap;function ji(e,t){if(typeof e==`object`&&e){var n=Ai.get(e);return n===void 0?(t={value:e,source:t,stack:Te(t)},Ai.set(e,t),t):n}return{value:e,source:t,stack:Te(t)}}var Mi=[],Ni=0,Pi=null,Fi=0,Ii=[],Li=0,Ri=null,zi=1,Bi=``;function Vi(e,t){Mi[Ni++]=Fi,Mi[Ni++]=Pi,Pi=e,Fi=t}function Hi(e,t,n){Ii[Li++]=zi,Ii[Li++]=Bi,Ii[Li++]=Ri,Ri=e;var r=zi;e=Bi;var i=32-He(r)-1;r&=~(1<<i),n+=1;var a=32-He(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,zi=1<<32-He(t)+i|n<<i|r,Bi=a+e}else zi=1<<a|n<<i|r,Bi=e}function Ui(e){e.return!==null&&(Vi(e,1),Hi(e,1,0))}function Wi(e){for(;e===Pi;)Pi=Mi[--Ni],Mi[Ni]=null,Fi=Mi[--Ni],Mi[Ni]=null;for(;e===Ri;)Ri=Ii[--Li],Ii[Li]=null,Bi=Ii[--Li],Ii[Li]=null,zi=Ii[--Li],Ii[Li]=null}function Gi(e,t){Ii[Li++]=zi,Ii[Li++]=Bi,Ii[Li++]=Ri,zi=t.id,Bi=t.overflow,Ri=e}var Ki=null,qi=null,Ji=!1,Yi=null,Xi=!1,Zi=Error(i(519));function Qi(e){throw ia(ji(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Zi}function $i(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[dt]=e,t[ft]=r,n){case`dialog`:Bf(`cancel`,t),Bf(`close`,t);break;case`iframe`:case`object`:case`embed`:Bf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Lf.length;n++)Bf(Lf[n],t);break;case`source`:Bf(`error`,t);break;case`img`:case`image`:case`link`:Bf(`error`,t),Bf(`load`,t);break;case`details`:Bf(`toggle`,t);break;case`input`:Bf(`invalid`,t),qt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Bf(`invalid`,t);break;case`textarea`:Bf(`invalid`,t),Zt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||$f(t.textContent,n)?(r.popover!=null&&(Bf(`beforetoggle`,t),Bf(`toggle`,t)),r.onScroll!=null&&Bf(`scroll`,t),r.onScrollEnd!=null&&Bf(`scrollend`,t),r.onClick!=null&&(t.onclick=sn),t=!0):t=!1,t||Qi(e,!0)}function ea(e){for(Ki=e.return;Ki;)switch(Ki.tag){case 5:case 31:case 13:Xi=!1;return;case 27:case 3:Xi=!0;return;default:Ki=Ki.return}}function ta(e){if(e!==Ki)return!1;if(!Ji)return ea(e),Ji=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&qi&&Qi(e),ea(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));qi=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));qi=dm(e)}else t===27?(t=qi,Sp(e.type)?(e=um,um=null,qi=e):qi=t):qi=Ki?lm(e.stateNode.nextSibling):null;return!0}function na(){qi=Ki=null,Ji=!1}function ra(){var e=Yi;return e!==null&&(ld===null?ld=e:ld.push.apply(ld,e),Yi=null),e}function ia(e){Yi===null?Yi=[e]:Yi.push(e)}var aa=le(null),oa=null,sa=null;function ca(e,t,n){K(aa,t._currentValue),t._currentValue=n}function la(e){e._currentValue=aa.current,ue(aa)}function ua(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function da(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),ua(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ua(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),ua(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function fa(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Ar(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===me.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}a=a.return}return e!==null&&da(t,e,n,r),t.flags|=262144,e!==null}function pa(e){for(e=e.firstContext;e!==null;){if(!Ar(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ma(e){oa=e,sa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ha(e){return _a(oa,e)}function ga(e,t){return oa===null&&ma(e),_a(e,t)}function _a(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},sa===null){if(e===null)throw Error(i(308));sa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else sa=sa.next=t;return n}var va=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ya=t.unstable_scheduleCallback,ba=t.unstable_NormalPriority,xa={$$typeof:M,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Sa(){return{controller:new va,data:new Map,refCount:0}}function Ca(e){e.refCount--,e.refCount===0&&ya(ba,function(){e.controller.abort()})}function wa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Ta=null;function Ea(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Da=null,Oa=0,ka=0,Aa=null;function ja(e,t){if(Da===null){var n=Da=[];Oa=0,ka=Mf(),Aa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Oa++,t.then(Ma,Ma),t}function Ma(){if(--Oa===0&&(Ta=null,Da!==null)){Aa!==null&&(Aa.status=`fulfilled`);var e=Da;Da=null,ka=0,Aa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Na(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Pa=W.S;W.S=function(e,t){if(fd=je(),typeof t==`object`&&t&&typeof t.then==`function`&&ja(e,t),Ta!==null)for(var n=vf;n!==null;)wa(n,Ta),n=n.next;if(n=e.types,n!==null){for(var r=vf;r!==null;)wa(r,n),r=r.next;if(ka!==0){r=Ta,r===null&&(r=Ta=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Pa!==null&&Pa(e,t)};var Fa=le(null);function Ia(){var e=Fa.current;return e===null?qu.pooledCache:e}function La(e,t){t===null?K(Fa,Fa.current):K(Fa,t.pool)}function Ra(){var e=Ia();return e===null?null:{parent:xa._currentValue,pool:e}}var za=Error(i(460)),Ba=Error(i(474)),Va=Error(i(542)),Ha={then:function(){}};function Ua(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Wa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(sn,sn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ja(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(sn,sn);else{if(e=qu,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ja(e),e}throw Ka=t,za}}function Ga(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ka=e,za):e}}var Ka=null;function qa(){if(Ka===null)throw Error(i(459));var e=Ka;return Ka=null,e}function Ja(e){if(e===za||e===Va)throw Error(i(483))}var Ya=null,Xa=0;function Za(e){var t=Xa;return Xa+=1,Ya===null&&(Ya=[]),Wa(Ya,e,t)}function Qa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function $a(e,t){throw t.$$typeof===T?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function eo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Ci(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Di(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===O?(e=d(e,t,n.props.children,r,n.key),Qa(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===I&&Ga(i)===t.type)?(t=a(t,n.props),Qa(t,n),t.return=e,t):(t=Ti(n.type,n.key,n.props,null,e.mode,r),Qa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ki(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Ei(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Di(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case E:return n=Ti(t.type,t.key,t.props,null,e.mode,n),Qa(n,t),n.return=e,n;case D:return t=ki(t,e.mode,n),t.return=e,t;case I:return t=Ga(t),f(e,t,n)}if(ae(t)||U(t))return t=Ei(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Za(t),n);if(t.$$typeof===M)return f(e,ga(e,t),n);$a(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case E:return n.key===i?l(e,t,n,r):null;case D:return n.key===i?u(e,t,n,r):null;case I:return n=Ga(n),p(e,t,n,r)}if(ae(n)||U(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Za(n),r);if(n.$$typeof===M)return p(e,t,ga(e,n),r);$a(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case E:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case D:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case I:return r=Ga(r),m(e,t,n,r,i)}if(ae(r)||U(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Za(r),i);if(r.$$typeof===M)return m(e,t,n,ga(t,r),i);$a(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ji&&Vi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ji&&Vi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ji&&Vi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ji&&Vi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ji&&Vi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ji&&Vi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===O&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case E:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===O){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),Qa(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===I&&Ga(l)===r.type){n(e,r.sibling),c=a(r,o.props),Qa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===O?(c=Ei(o.props.children,e.mode,c,o.key),Qa(c,o),c.return=e,e=c):(c=Ti(o.type,o.key,o.props,null,e.mode,c),Qa(c,o),c.return=e,e=c)}return s(e);case D:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ki(o,e.mode,c),c.return=e,e=c}return s(e);case I:return o=Ga(o),_(e,r,o,c)}if(ae(o))return h(e,r,o,c);if(U(o)){if(l=U(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,Za(o),c);if(o.$$typeof===M)return _(e,r,ga(e,o),c);$a(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Xa=0;var i=_(e,t,n,r);return Ya=null,i}catch(t){if(t===za||t===Va)throw t;var a=xi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var to=eo(!0),no=eo(!1),ro=!1;function io(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ao(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 oo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ku&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=vi(e),_i(e,null,n),t}return mi(e,r,t,n),vi(e)}function co(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,it(e,n)}}function lo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var uo=!1;function fo(){if(uo){var e=Aa;if(e!==null)throw e}}function po(e,t,n,r){uo=!1;var i=e.updateQueue;ro=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Yu&f)===f:(r&f)===f){f!==0&&f===ka&&(uo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=w({},d,f);break a;case 2:ro=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),rd|=o,e.lanes=o,e.memoizedState=d}}function mo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function ho(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)mo(n[e],t)}var go=le(null),_o=le(0);function vo(e,t){e=td,K(_o,e),K(go,t),td=e|t.baseLanes}function yo(){K(_o,td),K(go,go.current)}function bo(){td=_o.current,ue(go),ue(_o)}var xo=le(null),So=null;function Co(e){var t=e.alternate;K(Oo,Oo.current&1),K(xo,e),So===null&&(t===null||go.current!==null||t.memoizedState!==null)&&(So=e)}function wo(e){K(Oo,Oo.current),K(xo,e),So===null&&(So=e)}function To(e){e.tag===22?(K(Oo,Oo.current),K(xo,e),So===null&&(So=e)):Eo()}function Eo(){K(Oo,Oo.current),K(xo,xo.current)}function Do(e){ue(xo),So===e&&(So=null),ue(Oo)}var Oo=le(0);function ko(e,t){K(xo,xo.current),K(Oo,t)}function Ao(e){ue(Oo),ue(xo),So===e&&(So=null)}function jo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)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 Mo=0,Z=null,No=null,Po=null,Fo=!1,Io=!1,Lo=!1,Ro=0,zo=0,Bo=null,Vo=0;function Ho(){throw Error(i(321))}function Uo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ar(e[n],t[n]))return!1;return!0}function Wo(e,t,n,r,i,a){return Mo=a,Z=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,W.H=e===null||e.memoizedState===null?oc:sc,Lo=!1,a=n(r,i),Lo=!1,Io&&(a=Ko(t,n,r,i)),Go(e),a}function Go(e){W.H=ac;var t=No!==null&&No.next!==null;if(Mo=0,Po=No=Z=null,Fo=!1,zo=0,Bo=null,t)throw Error(i(300));e===null||wc||(e=e.dependencies,e!==null&&pa(e)&&(wc=!0))}function Ko(e,t,n,r){Z=e;var a=0;do{if(Io&&(Bo=null),zo=0,Io=!1,25<=a)throw Error(i(301));if(a+=1,Po=No=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}W.H=cc,o=t(n,r)}while(Io);return o}function qo(){var e=W.H,t=e.useState()[0];return t=typeof t.then==`function`?es(t):t,e=e.useState()[0],(No===null?null:No.memoizedState)!==e&&(Z.flags|=1024),t}function Jo(){var e=Ro!==0;return Ro=0,e}function Yo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Xo(e){if(Fo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Fo=!1}Mo=0,Po=No=Z=null,Io=!1,zo=Ro=0,Bo=null}function Zo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Po===null?Z.memoizedState=Po=e:Po=Po.next=e,Po}function Qo(){if(No===null){var e=Z.alternate;e=e===null?null:e.memoizedState}else e=No.next;var t=Po===null?Z.memoizedState:Po.next;if(t!==null)Po=t,No=e;else{if(e===null)throw Z.alternate===null?Error(i(467)):Error(i(310));No=e,e={memoizedState:No.memoizedState,baseState:No.baseState,baseQueue:No.baseQueue,queue:No.queue,next:null},Po===null?Z.memoizedState=Po=e:Po=Po.next=e}return Po}function $o(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function es(e){var t=zo;return zo+=1,Bo===null&&(Bo=[]),e=Wa(Bo,e,t),t=Z,(Po===null?t.memoizedState:Po.next)===null&&(t=t.alternate,W.H=t===null||t.memoizedState===null?oc:sc),e}function ts(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return es(e);if(e.$$typeof===V)return;if(e.$$typeof===M)return ha(e)}throw Error(i(438,String(e)))}function ns(e){var t=null,n=Z.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Z.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=$o(),Z.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]=z;return t.index++,n}function rs(e,t){return typeof t==`function`?t(e):t}function is(e){return as(Qo(),No,e)}function as(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Mo&f)===f:(Yu&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ka&&(d=!0);else if((Mo&p)===p){u=u.next,p===ka&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,Z.lanes|=p,rd|=p;f=u.action,Lo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,Z.lanes|=f,rd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Ar(o,e.memoizedState)&&(wc=!0,d&&(n=Aa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function os(e){var t=Qo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Ar(o,t.memoizedState)||(wc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ss(e,t,n){var r=Z,a=Qo(),o=Ji;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Ar((No||a).memoizedState,n);if(s&&(a.memoizedState=n,wc=!0),a=a.queue,Ms(us.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Po!==null&&!!(Po.memoizedState.tag&1),Ds(e?9:8,{destroy:void 0},ls.bind(null,r,a,n,t),null),e){if(r.flags|=2048,qu===null)throw Error(i(349));o||Mo&127||cs(r,t,n)}return n}function cs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Z.updateQueue,t===null?(t=$o(),Z.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ls(e,t,n,r){t.value=n,t.getSnapshot=r,ds(t)&&fs(e)}function us(e,t,n){return n(function(){ds(t)&&fs(e)})}function ds(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ar(e,n)}catch{return!0}}function fs(e){var t=gi(e,2);t!==null&&jd(t,e,2)}function ps(e){var t=Zo();if(typeof e==`function`){var n=e;if(e=n(),Lo){Ve(!0);try{n()}finally{Ve(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:e},t}function ms(e,t,n,r){return e.baseState=n,as(e,No,typeof r==`function`?r:rs)}function hs(e,t,n,r,a){if(nc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};W.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,gs(t,o)):(o.next=n.next,t.pending=n.next=o)}}function gs(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=W.T,o={};o.types=a===null?null:a.types,W.T=o;try{var s=n(i,r),c=W.S;c!==null&&c(o,s),_s(e,t,s)}catch(n){ys(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),W.T=a}}else try{a=n(i,r),_s(e,t,a)}catch(n){ys(e,t,n)}}function _s(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){vs(e,t,n)},function(n){return ys(e,t,n)}):vs(e,t,n)}function vs(e,t,n){t.status=`fulfilled`,t.value=n,bs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,gs(e,n)))}function ys(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,bs(t),t=t.next;while(t!==r)}e.action=null}function bs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function xs(e,t){return t}function Ss(e,t){if(Ji){var n=qu.formState;if(n!==null){a:{var r=Z;if(Ji){if(qi){b:{for(var i=qi,a=Xi;i.nodeType!==8;)if(!a||(i=lm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){qi=lm(i.nextSibling),r=i.data===`F!`;break a}}Qi(r)}r=!1}r&&(t=n[0])}}return n=Zo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xs,lastRenderedState:t},n.queue=r,n=$s.bind(null,Z,r),r.dispatch=n,r=ps(!1),a=tc.bind(null,Z,!1,r.queue),r=Zo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=hs.bind(null,Z,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Cs(e){return ws(Qo(),No,e)}function ws(e,t,n){if(t=as(e,t,xs)[0],e=is(rs)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=es(t)}catch(e){throw e===za?Va:e}else r=t;t=Qo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Z.flags|=2048,Ds(9,{destroy:void 0},Ts.bind(null,i,n),null)),[r,a,e]}function Ts(e,t){e.action=t}function Es(e){var t=Qo(),n=No;if(n!==null)return ws(t,n,e);Qo(),t=t.memoizedState,n=Qo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ds(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Z.updateQueue,t===null&&(t=$o(),Z.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 Os(){return Qo().memoizedState}function ks(e,t,n,r){var i=Zo();Z.flags|=e,i.memoizedState=Ds(1|t,{destroy:void 0},n,r===void 0?null:r)}function As(e,t,n,r){var i=Qo();r=r===void 0?null:r;var a=i.memoizedState.inst;No!==null&&r!==null&&Uo(r,No.memoizedState.deps)?i.memoizedState=Ds(t,a,n,r):(Z.flags|=e,i.memoizedState=Ds(1|t,a,n,r))}function js(e,t){ks(8390656,8,e,t)}function Ms(e,t){As(2048,8,e,t)}function Ns(e){Z.flags|=4;var t=Z.updateQueue;if(t===null)t=$o(),Z.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ps(e){var t=Qo().memoizedState;return Ns({ref:t,nextImpl:e}),function(){if(Ku&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Fs(e,t){return As(4,2,e,t)}function Is(e,t){return As(4,4,e,t)}function Ls(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rs(e,t,n){n=n==null?null:n.concat([e]),As(4,4,Ls.bind(null,t,e),n)}function zs(){}function Bs(e,t){var n=Qo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Uo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Vs(e,t){var n=Qo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Uo(t,r[1]))return r[0];if(r=e(),Lo){Ve(!0);try{e()}finally{Ve(!1)}}return n.memoizedState=[r,t],r}function Hs(e,t,n){return n===void 0||Mo&1073741824&&!(Yu&261930)?e.memoizedState=t:(e.memoizedState=n,e=kd(),Z.lanes|=e,rd|=e,n)}function Us(e,t,n,r){return Ar(n,t)?n:go.current===null?!(Mo&106)||Mo&1073741824&&!(Yu&261930)?(wc=!0,e.memoizedState=n):(e=kd(),Z.lanes|=e,rd|=e,t):(e=Hs(e,n,r),Ar(e,t)||(wc=!0),e)}function Ws(e,t,n,r,i){var a=G.p;G.p=a!==0&&8>a?a:8;var o=W.T,s={};s.types=o===null?null:o.types,W.T=s,tc(e,!1,t,n);try{var c=i(),l=W.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ec(e,t,Na(c,r),Od(e)):ec(e,t,r,Od(e))}catch(n){ec(e,t,{then:function(){},status:`rejected`,reason:n},Od())}finally{G.p=a,o!==null&&s.types!==null&&(o.types=s.types),W.T=o}}function Gs(){}function Ks(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=qs(e).queue;Ws(e,a,t,oe,n===null?Gs:function(){return Js(e),n(r)})}function qs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:oe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:rs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Js(e){var t=qs(e);t.next===null&&(t=e.alternate.memoizedState),ec(e,t.next.queue,{},Od())}function Q(){return ha(sh)}function Ys(){return Qo().memoizedState}function Xs(){return Qo().memoizedState}function Zs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Od();e=oo(n);var r=so(t,e,n);r!==null&&(jd(r,t,n),co(r,t,n)),t={cache:Sa()},e.payload=t;return}t=t.return}}function Qs(e,t,n){var r=Od();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},nc(e)?rc(t,n):(n=hi(e,t,n,r),n!==null&&(jd(n,e,r),ic(n,t,r)))}function $s(e,t,n){ec(e,t,n,Od())}function ec(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(nc(e))rc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Ar(s,o))return mi(e,t,i,0),qu===null&&pi(),!1}catch{}if(n=hi(e,t,i,r),n!==null)return jd(n,e,r),ic(n,t,r),!0}return!1}function tc(e,t,n,r){if(r={lane:2,revertLane:Mf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},nc(e)){if(t)throw Error(i(479))}else t=hi(e,n,r,2),t!==null&&jd(t,e,2)}function nc(e){var t=e.alternate;return e===Z||t!==null&&t===Z}function rc(e,t){Io=Fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ic(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,it(e,n)}}var ac={readContext:ha,use:ts,useCallback:Ho,useContext:Ho,useEffect:Ho,useImperativeHandle:Ho,useLayoutEffect:Ho,useInsertionEffect:Ho,useMemo:Ho,useReducer:Ho,useRef:Ho,useState:Ho,useDebugValue:Ho,useDeferredValue:Ho,useTransition:Ho,useSyncExternalStore:Ho,useId:Ho,useHostTransitionStatus:Ho,useFormState:Ho,useActionState:Ho,useOptimistic:Ho,useMemoCache:Ho,useCacheRefresh:Ho,useEffectEvent:Ho},oc={readContext:ha,use:ts,useCallback:function(e,t){return Zo().memoizedState=[e,t===void 0?null:t],e},useContext:ha,useEffect:js,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ks(4194308,4,Ls.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ks(4194308,4,e,t)},useInsertionEffect:function(e,t){ks(4,2,e,t)},useMemo:function(e,t){var n=Zo();t=t===void 0?null:t;var r=e();if(Lo){Ve(!0);try{e()}finally{Ve(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Zo();if(n!==void 0){var i=n(t);if(Lo){Ve(!0);try{n(t)}finally{Ve(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Qs.bind(null,Z,e),[r.memoizedState,e]},useRef:function(e){var t=Zo();return e={current:e},t.memoizedState=e},useState:function(e){e=ps(e);var t=e.queue,n=$s.bind(null,Z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:zs,useDeferredValue:function(e,t){return Hs(Zo(),e,t)},useTransition:function(){var e=ps(!1);return e=Ws.bind(null,Z,e.queue,!0,!1),Zo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Z,a=Zo();if(Ji){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),qu===null)throw Error(i(349));Yu&127||cs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,js(us.bind(null,r,o,e),[e]),r.flags|=2048,Ds(9,{destroy:void 0},ls.bind(null,r,o,n,t),null),n},useId:function(){var e=Zo(),t=qu.identifierPrefix;if(Ji){var n=Bi,r=zi;n=(r&~(1<<32-He(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Ro++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Vo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Q,useFormState:Ss,useActionState:Ss,useOptimistic:function(e){var t=Zo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=tc.bind(null,Z,!0,n),n.dispatch=t,[e,t]},useMemoCache:ns,useCacheRefresh:function(){return Zo().memoizedState=Zs.bind(null,Z)},useEffectEvent:function(e){var t=Zo(),n={impl:e};return t.memoizedState=n,function(){if(Ku&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},sc={readContext:ha,use:ts,useCallback:Bs,useContext:ha,useEffect:Ms,useImperativeHandle:Rs,useInsertionEffect:Fs,useLayoutEffect:Is,useMemo:Vs,useReducer:is,useRef:Os,useState:function(){return is(rs)},useDebugValue:zs,useDeferredValue:function(e,t){return Us(Qo(),No.memoizedState,e,t)},useTransition:function(){var e=is(rs)[0],t=Qo().memoizedState;return[typeof e==`boolean`?e:es(e),t]},useSyncExternalStore:ss,useId:Ys,useHostTransitionStatus:Q,useFormState:Cs,useActionState:Cs,useOptimistic:function(e,t){return ms(Qo(),No,e,t)},useMemoCache:ns,useCacheRefresh:Xs,useEffectEvent:Ps},cc={readContext:ha,use:ts,useCallback:Bs,useContext:ha,useEffect:Ms,useImperativeHandle:Rs,useInsertionEffect:Fs,useLayoutEffect:Is,useMemo:Vs,useReducer:os,useRef:Os,useState:function(){return os(rs)},useDebugValue:zs,useDeferredValue:function(e,t){var n=Qo();return No===null?Hs(n,e,t):Us(n,No.memoizedState,e,t)},useTransition:function(){var e=os(rs)[0],t=Qo().memoizedState;return[typeof e==`boolean`?e:es(e),t]},useSyncExternalStore:ss,useId:Ys,useHostTransitionStatus:Q,useFormState:Es,useActionState:Es,useOptimistic:function(e,t){var n=Qo();return No===null?(n.baseState=e,[e,n.queue.dispatch]):ms(n,No,e,t)},useMemoCache:ns,useCacheRefresh:Xs,useEffectEvent:Ps};function lc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var uc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Od(),i=oo(r);i.payload=t,n!=null&&(i.callback=n),t=so(e,i,r),t!==null&&(jd(t,e,r),co(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Od(),i=oo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=so(e,i,r),t!==null&&(jd(t,e,r),co(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Od(),r=oo(n);r.tag=2,t!=null&&(r.callback=t),t=so(e,r,n),t!==null&&(jd(t,e,n),co(t,e,n))}};function dc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!jr(n,r)||!jr(i,a):!0}function fc(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&&uc.enqueueReplaceState(t,t.state,null)}function pc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=w({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function mc(e){li(e)}function hc(e){console.error(e)}function gc(e){li(e)}function _c(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function vc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function yc(e,t,n){return n=oo(n),n.tag=3,n.payload={element:null},n.callback=function(){_c(e,t)},n}function bc(e){return e=oo(e),e.tag=3,e}function xc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){vc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){vc(t,n,r),typeof i!=`function`&&(hd===null?hd=new Set([this]):hd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Sc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&fa(t,n,a,!0),n=xo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return So===null?Ud():n.alternate===null&&nd===0&&(nd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ha?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),ff(e,r,a)),!1;case 22:return n.flags|=65536,r===Ha?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)),ff(e,r,a)),!1}throw Error(i(435,n.tag))}return ff(e,r,a),Ud(),!1}if(Ji)return t=xo.current,t===null?(r!==Zi&&(t=Error(i(423),{cause:r}),ia(ji(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ji(r,n),a=yc(e.stateNode,r,a),lo(e,a),nd!==4&&(nd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Zi&&(e=Error(i(422),{cause:r}),ia(ji(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ji(o,n),cd===null?cd=[o]:cd.push(o),nd!==4&&(nd=2),t===null)return!0;r=ji(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=yc(n.stateNode,r,e),lo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(hd===null||!hd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=bc(a),xc(a,e,n,r),lo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Cc=Error(i(461)),wc=!1;function Tc(e,t,n,r){t.child=e===null?no(t,null,n,r):to(t,e.child,n,r)}function Ec(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ma(t),r=Wo(e,t,n,o,a,i),s=Jo(),e!==null&&!wc?(Yo(e,t,i),el(e,t,i)):(Ji&&s&&Ui(t),t.flags|=1,Tc(e,t,r,i),t.child)}function Dc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Si(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Oc(e,t,a,r,i)):(e=Ti(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!tl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?jr:n,n(o,r)&&e.ref===t.ref)return el(e,t,i)}return t.flags|=1,e=Ci(a,r),e.ref=t.ref,e.return=t,t.child=e}function Oc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(jr(a,r)&&e.ref===t.ref){if(wc=!1,t.pendingProps=r=a,tl(e,i))e.flags&131072&&(wc=!0);else return t.lanes=e.lanes,el(e,t,i)}}return Ic(e,t,n,r,i)}function kc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return jc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&La(t,a===null?null:a.cachePool),a===null?yo():vo(t,a),To(t);else return r=t.lanes=536870912,jc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&La(t,null),yo(),Eo()):(La(t,a.cachePool),vo(t,a),Eo(),t.memoizedState=null);return Tc(e,t,i,n),t.child}function Ac(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function jc(e,t,n,r,i){var a=Ia();return a=a===null?null:{parent:xa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&La(t,null),yo(),To(t),e!==null&&fa(e,t,r,!0),t.childLanes=i,null}function Mc(e,t){return t=Gc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Nc(e,t,n){return to(t,e.child,null,n),e=Mc(t,t.pendingProps),e.flags|=2,Do(t),t.memoizedState=null,e}function Pc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ji){if(r.mode===`hidden`)return e=Mc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Ac(null,e);if(wo(t),(e=qi)?(e=am(e,Xi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ri===null?null:{id:zi,overflow:Bi},retryLane:536870912,hydrationErrors:null},n=Oi(e),n.return=t,t.child=n,Ki=t,qi=null)):e=null,e===null)throw Qi(t);return t.lanes=536870912,null}return Mc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(wo(t),a){if(t.flags&256)t.flags&=-257,t=Nc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(wc||fa(e,t,n,!1),a=(n&e.childLanes)!==0,wc||a){if(go.current===null){if(r=qu,r!==null&&(s=at(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,gi(e,s),jd(r,e,s),Cc;Ud()}t=Nc(e,t,n)}else e=o.treeContext,qi=lm(s.nextSibling),Ki=t,Ji=!0,Yi=null,Xi=!1,e!==null&&Gi(t,e),t=Mc(t,r),t.flags|=134221824;return t}return e=Ci(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Fc(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(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Ic(e,t,n,r,i){return ma(t),n=Wo(e,t,n,r,void 0,i),r=Jo(),e!==null&&!wc?(Yo(e,t,i),el(e,t,i)):(Ji&&r&&Ui(t),t.flags|=1,Tc(e,t,n,i),t.child)}function Lc(e,t,n,r,i,a){return ma(t),t.updateQueue=null,n=Ko(t,r,n,i),Go(e),r=Jo(),e!==null&&!wc?(Yo(e,t,a),el(e,t,a)):(Ji&&r&&Ui(t),t.flags|=1,Tc(e,t,n,a),t.child)}function Rc(e,t,n,r,i){if(ma(t),t.stateNode===null){var a=yi,o=n.contextType;typeof o==`object`&&o&&(a=ha(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=uc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},io(t),o=n.contextType,a.context=typeof o==`object`&&o?ha(o):yi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(lc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&uc.enqueueReplaceState(a,a.state,null),po(t,r,a,i),fo(),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=pc(n,s);a.props=c;var l=a.context,u=n.contextType;o=yi,typeof u==`object`&&u&&(o=ha(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&fc(t,a,r,o),ro=!1;var f=t.memoizedState;a.state=f,po(t,r,a,i),fo(),l=t.memoizedState,s||f!==l||ro?(typeof d==`function`&&(lc(t,n,d,r),l=t.memoizedState),(c=ro||dc(t,n,c,r,f,l,o))?(u||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=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,ao(e,t),o=t.memoizedProps,u=pc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=yi,typeof l==`object`&&l&&(c=ha(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&fc(t,a,r,c),ro=!1,f=t.memoizedState,a.state=f,po(t,r,a,i),fo();var p=t.memoizedState;o!==d||f!==p||ro||e!==null&&e.dependencies!==null&&pa(e.dependencies)?(typeof s==`function`&&(lc(t,n,s,r),p=t.memoizedState),(u=ro||dc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&pa(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Fc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=to(t,e.child,null,i),t.child=to(t,null,n,i)):Tc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=el(e,t,i),e}function zc(e,t,n,r){return na(),t.flags|=256,Tc(e,t,n,r),t.child}var Bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vc(e){return{baseLanes:e,cachePool:Ra()}}function Hc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=od),e}function Uc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Oo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(Ji){if(i?Co(t):Eo(),(e=qi)?(e=am(e,Xi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ri===null?null:{id:zi,overflow:Bi},retryLane:536870912,hydrationErrors:null},n=Oi(e),n.return=t,t.child=n,Ki=t,qi=null)):e=null,e===null)throw Qi(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Eo(),i=t.mode,a=Gc({mode:`hidden`,children:a},i),r=Ei(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Vc(n),r.childLanes=Hc(e,o,n),t.memoizedState=Bc,Ac(null,r)):(Co(t),Wc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return qc(e,t,a,o,r,c,s,n)}return i?(Eo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Ci(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Ei(i,a,n,null),i.flags|=2):i=Ci(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Ac(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Vc(n):(a=i.cachePool,a===null?a=Ra():(s=xa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Hc(e,o,n),t.memoizedState=Bc,Ac(e.child,r)):(Co(t),n=e.child,e=n.sibling,n=Ci(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Wc(e,t){return t=Gc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Gc(e,t){return e=xi(22,e,null,t),e.lanes=0,e}function Kc(e,t,n){return to(t,e.child,null,n),e=Wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qc(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Co(t),t.flags&=-257,Kc(e,t,c)):t.memoizedState===null?(Eo(),o=a.fallback,s=t.mode,a=Gc({mode:`visible`,children:a.children},s),o=Ei(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,to(t,e.child,null,c),a=t.child,a.memoizedState=Vc(c),a.childLanes=Hc(e,r,c),t.memoizedState=Bc,Ac(null,a)):(Eo(),t.child=e.child,t.flags|=128,null);if(Co(t),sm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,ia({value:a,source:null,stack:null})),Kc(e,t,c)}if(wc||fa(e,t,c,!1),r=(c&e.childLanes)!==0,wc||r){if(go.current!==null)return Kc(e,t,c);if(r=qu,r!==null&&(a=at(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,gi(e,a),jd(r,e,a),Cc;return om(o)||Ud(),Kc(e,t,c)}return om(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,qi=lm(o.nextSibling),Ki=t,Ji=!0,Yi=null,Xi=!1,e!==null&&Gi(t,e),t=Wc(t,a.children),t.flags|=134221824,t)}function Jc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ua(e.return,t,n)}function Yc(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&jo(n)===null&&(t=e),e=e.sibling}return t}function Xc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Zc(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 Qc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Oo.current;if(t.flags&128)return ko(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,ko(t,o),i===`backwards`&&e!==null?(Zc(e),Tc(e,t,r,n),Zc(e)):Tc(e,t,r,n),r=Ji?Fi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Jc(e,n,t);else if(e.tag===19)Jc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=Yc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,Zc(t)),Xc(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&jo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Xc(t,!0,n,null,a,r);break;case`together`:Xc(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=Yc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Xc(t,!1,i,n,a,r)}return t.child}function $c(e,t,n){var r=t.pendingProps;return ca(t,t.type,r.value),Tc(e,t,r.children,n),t.child}function el(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(fa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Ci(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ci(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function tl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&pa(e)))}function nl(e,t,n){switch(t.tag){case 3:he(t,t.stateNode.containerInfo),ca(t,xa,e.memoizedState.cache),na();break;case 27:case 5:_e(t);break;case 4:he(t,t.stateNode.containerInfo);break;case 10:ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,wo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Co(t),t.flags|=128,null;r=fa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Uc(e,t,n):(Co(t),e=el(e,t,n),e===null?null:e.sibling)}Co(t);break;case 19:if(t.flags&128)return Qc(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(fa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Qc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ko(t,Oo.current),r)break;return null;case 22:return t.lanes=0,kc(e,t,n,t.pendingProps);case 24:ca(t,xa,e.memoizedState.cache)}return el(e,t,n)}function rl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)wc=!0;else{if(!tl(e,n)&&!(t.flags&128))return wc=!1,nl(e,t,n);wc=!!(e.flags&131072)}}else wc=!1,Ji&&t.flags&1048576&&Hi(t,Fi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ga(t.elementType),t.type=e,typeof e==`function`)Si(e)?(r=pc(e,r),t.tag=1,t=Rc(null,t,e,r,n)):(t.tag=0,t=Ic(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===N){t.tag=11,t=Ec(null,t,e,r,n);break a}if(a===ee){t.tag=14,t=Dc(null,t,e,r,n);break a}if(a===M){t.tag=10,t.type=e,t=$c(null,t,n);break a}}throw t=ie(e)||e,Error(i(306,t,``))}}return t;case 0:return Ic(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=pc(r,t.pendingProps),Rc(e,t,r,a,n);case 3:a:{if(he(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,ao(e,t),po(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ca(t,xa,r),r!==o.cache&&da(t,[xa],n,!0),fo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=zc(e,t,r,n);break a}if(r!==a){a=ji(Error(i(424)),t),ia(a),t=zc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(qi=lm(e.firstChild),Ki=t,Ji=!0,Yi=null,Xi=!0,n=no(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(na(),r===a){t=el(e,t,n);break a}Tc(e,t,r,n)}t=t.child}return t;case 26:return Fc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ji||(t.stateNode=fp(t.type,t.pendingProps,pe.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return _e(t),e===null&&Ji&&(r=t.stateNode=hm(t.type,t.pendingProps,pe.current),Ki=t,Xi=!0,a=qi,Sp(t.type)?(um=a,qi=lm(r.firstChild)):qi=a),Tc(e,t,t.pendingProps.children,n),Fc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ji&&((a=r=qi)&&(r=rm(r,t.type,t.pendingProps,Xi),r===null?a=!1:(t.stateNode=r,Ki=t,qi=lm(r.firstChild),Xi=!1,a=!0)),a||Qi(t)),_e(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,pp(a,o)?r=null:s!==null&&pp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Wo(e,t,qo,null,null,n),sh._currentValue=a),Fc(e,t),Tc(e,t,r,n),t.child;case 6:return e===null&&Ji&&((e=n=qi)&&(n=im(n,t.pendingProps,Xi),n===null?e=!1:(t.stateNode=n,Ki=t,qi=null,e=!0)),e||Qi(t)),null;case 13:return Uc(e,t,n);case 4:return he(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=to(t,null,r,n):Tc(e,t,r,n),t.child;case 11:return Ec(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Fc(e,t),Tc(e,t,r,n),t.child;case 8:return Tc(e,t,t.pendingProps.children,n),t.child;case 12:return Tc(e,t,t.pendingProps.children,n),t.child;case 10:return $c(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,ma(t),a=ha(a),r=r(a),t.flags|=1,Tc(e,t,r,n),t.child;case 14:return Dc(e,t,t.type,t.pendingProps,n);case 15:return Oc(e,t,t.type,t.pendingProps,n);case 19:return Qc(e,t,n);case 31:return Pc(e,t,n);case 22:return kc(e,t,n,t.pendingProps);case 24:return ma(t),r=ha(xa),e===null?(a=Ia(),a===null&&(a=qu,o=Sa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},io(t),ca(t,xa,a)):((e.lanes&n)!==0&&(ao(e,t),po(t,null,null,n),fo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ca(t,xa,r),r!==a.cache&&da(t,[xa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ca(t,xa,r))),Tc(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:Ji&&Ui(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Fc(e,t),Tc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function il(e){e.flags|=4}function al(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Bd())e.flags|=8192;else throw Ka=Ha,Ba}}else e.flags&=-16777217}function ol(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Bd())e.flags|=8192;else throw Ka=Ha,Ba}}function sl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:tt(),e.lanes|=t,sd|=t)}function cl(e,t){if(!Ji)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:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function ll(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ul(e,t,n){var r=t.pendingProps;switch(Wi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ll(t),null;case 1:return ll(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),la(xa),ge(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ta(t)?il(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ra())),ll(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(il(t),o===null?(ll(t),al(t,a,null,r,n)):(ll(t),ol(t,o))):o?o===e.memoizedState?(ll(t),t.flags&=-16777217):(il(t),ll(t),ol(t,o)):(e=e.memoizedProps,e!==r&&il(t),ll(t),al(t,a,e,r,n)),null;case 27:if(ve(t),n=pe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&il(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return ll(t),t.subtreeFlags&=-33554433,null}e=de.current,ta(t)?$i(t,e):(e=hm(a,r,n),t.stateNode=e,il(t))}return ll(t),t.subtreeFlags&=-33554433,null;case 5:if(ve(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&il(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return ll(t),t.subtreeFlags&=-33554433,null}if(o=de.current,ta(t))$i(t,o);else{var s=lp(pe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[dt]=t,o[ft]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&il(t)}}return ll(t),t.subtreeFlags&=-33554433,al(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&il(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=pe.current,ta(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ki,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[dt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||$f(e.nodeValue,n)),e||Qi(t,!0)}else e=lp(e).createTextNode(r),e[dt]=t,t.stateNode=e}return ll(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ta(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[dt]=t}else na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ll(t),e=!1}else n=ra(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Do(t),t):(Do(t),null);if(t.flags&128)throw Error(i(558))}return ll(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ta(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[dt]=t}else na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ll(t),a=!1}else a=ra(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Do(t),t):(Do(t),null)}return Do(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),sl(t,t.updateQueue),ll(t),null);case 4:return ge(),e===null&&Uf(t.stateNode.containerInfo),t.flags|=67108864,ll(t),null;case 10:return la(t.type),ll(t),null;case 19:if(Ao(t),r=t.memoizedState,r===null)return ll(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)cl(r,!1);else{if(nd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=jo(e),o!==null){for(t.flags|=128,cl(r,!1),e=o.updateQueue,t.updateQueue=e,sl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)wi(n,e),n=n.sibling;return ko(t,Oo.current&1|2),Ji&&Vi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&je()>pd&&(t.flags|=128,a=!0,cl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=jo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,sl(t,e),cl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!Ji)return ll(t),null}else 2*je()-r.renderingStartTime>pd&&n!==536870912&&(t.flags|=128,a=!0,cl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=je(),e.sibling=null,o=Oo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||Ji?ko(t,o):(n=o,K(xo,t),K(Oo,n),So===null&&(So=t)),Ji&&Vi(t,r.treeForkCount),e}return ll(t),null;case 22:case 23:return Do(t),bo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(ll(t),t.subtreeFlags&6&&(t.flags|=8192)):ll(t),n=t.updateQueue,n!==null&&sl(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&&ue(Fa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),la(xa),ll(t),null;case 25:return null;case 30:return t.flags|=33554432,ll(t),null}throw Error(i(156,t.tag))}function dl(e,t){switch(Wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return la(xa),ge(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ve(t),null;case 31:if(t.memoizedState!==null){if(Do(t),t.alternate===null)throw Error(i(340));na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Do(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ao(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 ge(),null;case 10:return la(t.type),null;case 22:case 23:return Do(t),bo(),e!==null&&ue(Fa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return la(xa),null;case 25:return null;default:return null}}function fl(e,t){switch(Wi(t),t.tag){case 3:la(xa),ge();break;case 26:case 27:case 5:ve(t);break;case 4:ge();break;case 31:t.memoizedState!==null&&Do(t);break;case 13:Do(t);break;case 19:Ao(t);break;case 10:la(t.type);break;case 22:case 23:Do(t),bo(),e!==null&&ue(Fa);break;case 24:la(xa)}}function pl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){df(t,t.return,e)}}function ml(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){df(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){df(t,t.return,e)}}function hl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{ho(t,n)}catch(t){df(e,e.return,t)}}}function gl(e,t,n){n.props=pc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){df(e,t,n)}}function _l(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 i=e.stateNode,a=oi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);f(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){df(e,t,n)}}function vl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){df(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){df(e,t,n)}else n.current=null}}function yl(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++)em(e.stateNode,t[n])}function bl(e){for(var t=e.return;t!==null&&(Cl(t)&&em(e.stateNode,t.stateNode),!Sl(t));)t=t.return}function xl(e){for(var t=e.return;t!==null&&(Cl(t)&&tm(e.stateNode,t.stateNode),!Sl(t));)t=t.return}function Sl(e){return e.tag===5||e.tag===3||e.tag===27}function Cl(e){return e&&e.tag===7&&e.stateNode!==null}function wl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){df(e,e.return,t)}}function Tl(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[ft]=t}catch(t){df(e,e.return,t)}}function El(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Dl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||El(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ol(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sn)),yl(e,r),X=!0;else if(i!==4&&(i===27&&(yl(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Ol(e,t,n,r),e=e.sibling;e!==null;)Ol(e,t,n,r),e=e.sibling}function kl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),yl(e,r),X=!0;else if(i!==4&&(i===27&&(yl(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(kl(e,t,n,r),e=e.sibling;e!==null;)kl(e,t,n,r),e=e.sibling}function Al(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[dt]=e,t[ft]=n}catch(t){df(e,e.return,t)}}var jl=!1,Ml=null;function Nl(e){(e.tag===30||e.subtreeFlags&33554432)&&(jl=!0)}var Pl=null;function Fl(){var e=Pl;return Pl=null,e}var Il=0;function Ll(e,t,n,r,i){return Il=0,Rl(e.child,t,n,r,i)}function Rl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);jl=!0,Tp(o,Il===0?t:t+`_`+Il,n),Il++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Rl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function zl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||zl(e.child,t),e=e.sibling}function Bl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Bl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=ci(t.default,t.share),t!==`none`&&(Ll(e,n,t,null,!1)||zl(e.child,!1))}e=e.sibling}}function Vl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=oi(r,n),a=ci(r.default,n.paired?r.share:r.enter);a===`none`?Bl(e):Ll(e,i,a,null,!1)?(Bl(e),n.paired||t||Ad(e,r.onEnter)):zl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Vl(e,t),e=e.sibling;else Bl(e)}function Hl(e){if(Ml!==null&&Ml.size!==0){var t=Ml;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=ci(n.default,n.share);if(a!==`none`&&(Ll(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Ad(e,n.onShare)):zl(e.child,!1)),t.delete(r),t.size===0)break}}}Hl(e)}e=e.sibling}}}function Ul(e){if(e.tag===30){var t=e.memoizedProps,n=oi(t,e.stateNode),r=Ml===null?void 0:Ml.get(n),i=ci(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Ll(e,n,i,null,!1)?r===void 0?Ad(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ml.delete(n),Ad(e,t.onShare)):zl(e.child,!1)),Ml!==null&&Hl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ul(e),e=e.sibling;else Ml!==null&&Hl(e)}function Wl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=oi(t,e.stateNode);t=ci(t.default,t.update),e.flags&=-5,t!==`none`&&Ll(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Wl(e);e=e.sibling}}function Gl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,zl(e.child,!1))}Gl(e)}e=e.sibling}}function Kl(e){if(e.tag===30)e.stateNode.paired=null,zl(e.child,!1),Gl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Kl(e),e=e.sibling;else Gl(e)}function ql(e){for(e=e.child;e!==null;)e.tag===30?zl(e.child,!1):e.subtreeFlags&33554432&&ql(e),e=e.sibling}function Jl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Il<a.length){var l=a[Il],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,Il===0?n:n+`_`+Il,i),s&&e.flags&4||(Pl===null&&(Pl=[]),Pl.push(c,Il===0?r:r+`_`+Il,t.memoizedProps)),Il++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Jl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Yl(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=oi(n,r),a=ci(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Il=0,i=Jl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Ad(e,n.onUpdate))}else e.subtreeFlags&33554432&&Yl(e,t);e=e.sibling}}var Xl=!1,Zl=!1,Ql=!1,$l=!1,eu=typeof WeakSet==`function`?WeakSet:Set,tu=null,nu=!1,ru=!1,iu=!1,au=!1;function ou(e,t,n){if(e=e.containerInfo,sp=gh,e=Ir(e),Lr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,tu=t,t=n?9270:1024;tu!==null;){if(e=tu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Ul(r[a]);if(e.alternate===null&&e.flags&2)n&&Nl(e),su(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Ul(r),su(n);continue}if(r!==null&&r.memoizedState!==null){n&&Nl(e),su(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,tu=r):(n&&Wl(e),su(n))}}Ml=null}function su(e){for(;tu!==null;){var t=tu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=pc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){df(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(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=oi(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=ci(a.default,a.update),a!==`none`&&Ll(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,tu=r;break}tu=t.return}}function cu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ou(e,n),r&4&&pl(5,n);break;case 1:if(Ou(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){df(n,n.return,e)}else{var i=pc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){df(n,n.return,e)}}}r&64&&hl(n),r&512&&_l(n,n.return);break;case 3:if(Ou(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{ho(e,t)}catch(e){df(n,n.return,e)}}break;case 27:t===null&&r&4&&Al(n);case 26:case 5:Ou(e,n),t===null&&r&4&&wl(n),r&512&&_l(n,n.return);break;case 12:Ou(e,n);break;case 31:Ou(e,n),r&4&&_u(e,n);break;case 13:Ou(e,n),r&4&&vu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hf.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||Xl,!r){var a=t!==null&&t.memoizedState!==null||Zl;t=Xl,i=Zl,Xl=r,(Zl=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Au(e,n,r)):Ou(e,n),Xl=t,Zl=i}break;case 30:Ou(e,n),r&512&&_l(n,n.return);break;case 7:r&512&&_l(n,n.return);default:Ou(e,n)}}function lu(e,t){for(e=e.child;e!==null;)uu(e,t),e=e.sibling}function uu(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 i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){df(e,e.return,t)}du(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,X=!0}catch(t){df(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){df(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&lu(e,t);break;default:lu(e,t)}}function du(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:uu(n,r);break a;case 22:n.memoizedState===null&&du(n,r);break a;default:du(n,r)}}e=e.sibling}}function fu(e){var t=e.alternate;t!==null&&(e.alternate=null,fu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&bt(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 pu=null,mu=!1;function hu(e,t,n){for(n=n.child;n!==null;)gu(e,t,n),n=n.sibling}function gu(e,t,n){if(Be&&typeof Be.onCommitFiberUnmount==`function`)try{Be.onCommitFiberUnmount(ze,n)}catch{}switch(n.tag){case 26:Zl||vl(n,t),hu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Zl&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zl||vl(n,t),xl(n);var r=pu,i=mu;Sp(n.type)&&(pu=n.stateNode,mu=!1),hu(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),pu=r,mu=i;break;case 5:Zl||vl(n,t),xl(n);case 6:if(n.tag===6&&xl(n),r=pu,i=mu,pu=null,hu(e,t,n),pu=r,mu=i,pu!==null){if(mu)try{(pu.nodeType===9?pu.body:pu.nodeName===`HTML`?pu.ownerDocument.body:pu).removeChild(n.stateNode),X=!0}catch(e){df(n,t,e)}else try{pu.removeChild(n.stateNode),X=!0}catch(e){df(n,t,e)}}break;case 18:pu!==null&&(mu?(e=pu,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(pu,n.stateNode));break;case 4:r=pu,i=mu,pu=n.stateNode.containerInfo,mu=!0,hu(e,t,n),pu=r,mu=i;break;case 0:case 11:case 14:case 15:ml(2,n,t),Zl||ml(4,n,t),hu(e,t,n);break;case 1:Zl||(vl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&gl(n,t,r)),hu(e,t,n);break;case 21:hu(e,t,n);break;case 22:Zl=(r=Zl)||n.memoizedState!==null,hu(e,t,n),Zl=r;break;case 30:vl(n,t),hu(e,t,n);break;case 7:Zl||vl(n,t),hu(e,t,n);break;default:hu(e,t,n)}}function _u(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){df(t,t.return,e)}}}function vu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){df(t,t.return,e)}}function yu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new eu),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new eu),t;default:throw Error(i(435,e.tag))}}function bu(e,t){var n=yu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=gf.bind(null,e,t);t.then(r,r)}})}function xu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){pu=l.stateNode,mu=!1;break a}break;case 5:pu=l.stateNode,mu=!1;break a;case 3:case 4:pu=l.stateNode.containerInfo,mu=!0;break a}l=l.return}if(pu===null)throw Error(i(160));gu(s,c,o),pu=null,mu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Cu(t,e,n),t=t.sibling}var Su=null;function Cu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}xu(t,e,n),wu(e),a&4&&(ml(3,e,e.return),pl(3,e),ml(5,e,e.return));break;case 1:xu(t,e,n),wu(e),a&512&&(Zl||r===null||vl(r,r.return)),a&64&&Xl&&(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(o=Su,xu(t,e,n),wu(e),a&512&&(Zl||r===null||vl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(Xl)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[vt]||r[dt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),np(r,t,n),r[dt]=e,Tt(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],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)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Gm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],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)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[dt]=e,Tt(r),t=r}e.stateNode=t}}else Xl||Km(o,e.type,e.stateNode)}else e.stateNode=Bm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Tl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||Zl||t.parentNode.removeChild(t)):a.count--,n===null?Xl||Km(o,e.type,e.stateNode):Bm(o,n,e.memoizedProps))}break;case 27:xu(t,e,n),wu(e),a&512&&(Zl||r===null||vl(r,r.return)),r!==null&&a&4&&Tl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=Ql,Ql=!1,xu(t,e,n),Ql=o,wu(e),a&512&&(Zl||r===null||vl(r,r.return)),e.flags&32){t=e.stateNode;try{Qt(t,``),X=!0}catch(t){df(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Tl(e,t,r===null?t:r.memoizedProps)),a&1024&&($l=!0);break;case 6:if(xu(t,e,n),wu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,X=!0}catch(t){df(e,e.return,t)}}break;case 3:if(X=!1,Wm=null,o=Su,Su=bm(t.containerInfo),xu(t,e,n),Su=o,wu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){df(e,e.return,t)}$l&&($l=!1,Tu(e)),X=!1;break;case 4:a=Ql,Ql=Xl,r=Ft(),o=Su,Su=bm(e.stateNode.containerInfo),xu(t,e,n),wu(e),Su=o,X&&ru&&(iu=!0),X=r,Ql=a;break;case 12:xu(t,e,n),wu(e);break;case 31:xu(t,e,n),wu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 13:xu(t,e,n),wu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(dd=je()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=Xl,l=Zl,u=Ql;Xl=c||o,Ql=u||o,Zl=l||s,xu(t,e,n),Zl=l,Ql=u,Xl=c,wu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||Xl||Zl||(t=s||Zl,n=Xl,r=Zl,Xl=o||Xl,Zl=t,ku(e,2),Xl=n,Zl=r),!o&&Ql||lu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,bu(e,n))));break;case 19:xu(t,e,n),wu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,bu(e,t)));break;case 30:a&512&&(Zl||r===null||vl(r,r.return)),a=Ft(),o=ru,s=(n&335544064)===n,c=e.memoizedProps,ru=s&&ci(c.default,c.update)!==`none`,xu(t,e,n),wu(e),s&&r!==null&&X&&(e.flags|=4),ru=o,X=a;break;case 21:break;case 7:a&512&&(Zl||r===null||vl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:xu(t,e,n),wu(e)}}function wu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(El(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Cl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Sl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;kl(e,Dl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(Qt(l,``),n.flags&=-33),kl(e,Dl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Ol(e,Dl(e),u,s);break;default:throw Error(i(161))}}catch(t){df(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Tu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Tu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Eu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Du(t,e),t=t.sibling;else Yl(t,!1)}function Du(e,t){var n=e.alternate;if(n===null)Vl(e,!1);else switch(e.tag){case 3:if(au=nu=!1,Fl(),Eu(t,e),!nu&&!iu){if(e=Pl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(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(`+i+`)`})}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`})),au=!0}Pl=null;break;case 5:Eu(t,e);break;case 4:r=nu,nu=!1,Eu(t,e),nu&&(iu=!0),nu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Eu(t,e):Vl(e,!1));break;case 30:r=nu,i=Fl(),nu=!1,Eu(t,e),nu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=oi(a,o),o=oi(n.memoizedProps,o);var s=ci(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Il=0,t=Jl(e,n,t,o,s,a,!0),Il!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Ad(e,e.memoizedProps.onUpdate),Pl=i):i!==null&&(i.push.apply(i,Pl),Pl=i),nu=e.flags&32?!0:r;break;default:Eu(t,e)}}function Ou(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cu(e,t.alternate,t),t=t.sibling}function ku(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:ml(4,n,n.return),ku(n,r);break;case 1:vl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&gl(n,n.return,i),ku(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:vl(n,n.return),n.tag!==5&&n.tag!==27||xl(n),ku(n,r);break;case 6:xl(n);break;case 26:vl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||Zl||i.parentNode.removeChild(i),ku(n,r);break;case 22:n.memoizedState===null&&ku(n,r);break;case 30:vl(n,n.return),ku(n,r);break;case 7:vl(n,n.return);default:ku(n,r)}e=e.sibling}}function Au(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Au(i,a,n),pl(4,a);break;case 1:if(Au(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){df(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)mo(l[i],c)}catch(e){df(r,r.return,e)}}s&&o&64&&hl(a),_l(a,a.return);break;case 27:n&2&&Al(a);case 5:a.tag!==5&&a.tag!==27||bl(a),Au(i,a,n),s&&r===null&&o&4&&wl(a),_l(a,a.return);break;case 6:bl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Xl||Km(bm(c.ownerDocument),a.type,c),Au(i,a,n),s&&r===null&&o&4&&wl(a),_l(a,a.return);break;case 12:Au(i,a,n);break;case 31:Au(i,a,n),s&&o&4&&_u(i,a);break;case 13:Au(i,a,n),s&&o&4&&vu(i,a);break;case 22:a.memoizedState===null&&Au(i,a,n),_l(a,a.return);break;case 30:Au(i,a,n),_l(a,a.return);break;case 7:_l(a,a.return);default:Au(i,a,n)}t=t.sibling}}function ju(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&&Ca(n))}function Mu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ca(e))}function Nu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Pu(e,t,n,r),t=t.sibling;else i&&ql(t)}function Pu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Kl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Nu(e,t,n,r),a&2048&&pl(9,t);break;case 1:Nu(e,t,n,r);break;case 3:Nu(e,t,n,r),i&&au&&(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&&Ca(a)));break;case 12:if(a&2048){Nu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){df(t,t.return,e)}}else Nu(e,t,n,r);break;case 31:Nu(e,t,n,r);break;case 13:Nu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Kl(t),o._visibility&2?Nu(e,t,n,r):(o._visibility|=2,Fu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Kl(s),o._visibility&2?Nu(e,t,n,r):Iu(e,t)),a&2048&&ju(s,t);break;case 24:Nu(e,t,n,r),a&2048&&Mu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(zl(a.child,!0),zl(t.child,!0))),Nu(e,t,n,r);break;default:Nu(e,t,n,r)}}function Fu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Fu(a,o,s,c,i),pl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Fu(a,o,s,c,i)):u._visibility&2?Fu(a,o,s,c,i):Iu(a,o),i&&l&2048&&ju(o.alternate,o);break;case 24:Fu(a,o,s,c,i),i&&l&2048&&Mu(o.alternate,o);break;default:Fu(a,o,s,c,i)}t=t.sibling}}function Iu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Iu(n,r),i&2048&&ju(r.alternate,r);break;case 24:Iu(n,r),i&2048&&Mu(r.alternate,r);break;default:Iu(n,r)}t=t.sibling}}var Lu=8192;function Ru(e,t,n){if(e.subtreeFlags&Lu)for(e=e.child;e!==null;)zu(e,t,n),e=e.sibling}function zu(e,t,n){switch(e.tag){case 26:Ru(e,t,n),e.flags&Lu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,Su,e.memoizedState,e.memoizedProps));break;case 5:Ru(e,t,n),e.flags&Lu&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=Su;Su=bm(e.stateNode.containerInfo),Ru(e,t,n),Su=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Lu,Lu=16777216,Ru(e,t,n),Lu=r):Ru(e,t,n));break;case 30:if((e.flags&Lu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ml===null&&(Ml=new Map),Ml.set(r,i)}Ru(e,t,n);break;default:Ru(e,t,n)}}function Bu(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 Vu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tu=r,Uu(r,e)}Bu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hu(e),e=e.sibling}function Hu(e){switch(e.tag){case 0:case 11:case 15:Vu(e),e.flags&2048&&ml(9,e,e.return);break;case 3:Vu(e);break;case 12:Vu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$(e)):Vu(e);break;default:Vu(e)}}function $(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];tu=r,Uu(r,e)}Bu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ml(8,t,t.return),$(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,$(t));break;default:$(t)}e=e.sibling}}function Uu(e,t){for(;tu!==null;){var n=tu;switch(n.tag){case 0:case 11:case 15:ml(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:Ca(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,tu=r;else a:for(n=e;tu!==null;){r=tu;var i=r.sibling,a=r.return;if(fu(r),r===n){tu=null;break a}if(i!==null){i.return=a,tu=i;break a}tu=a}}}var Wu={getCacheForType:function(e){var t=ha(xa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ha(xa).controller.signal}},Gu=typeof WeakMap==`function`?WeakMap:Map,Ku=0,qu=null,Ju=null,Yu=0,Xu=0,Zu=null,Qu=!1,$u=!1,ed=!1,td=0,nd=0,rd=0,id=0,ad=0,od=0,sd=0,cd=null,ld=null,ud=!1,dd=0,fd=0,pd=1/0,md=null,hd=null,gd=0,_d=null,vd=null,yd=0,bd=0,xd=null,Sd=null,Cd=null,wd=null,Td=null,Ed=0,Dd=null;function Od(){return Ku&2&&Yu!==0?Yu&-Yu:W.T===null?ct():Mf()}function kd(){if(od===0){if(!(Yu&536870912)||Ji){var e=qe;qe<<=1,!(qe&3932160)&&(qe=262144),od=e}else od=536870912}return e=xo.current,e!==null&&(e.flags|=32),od}function Ad(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(oi(e.memoizedProps,n))),wd===null&&(wd=[]),wd.push(t.bind(null,r))}}function jd(e,t,n){(e===qu&&(Xu===2||Xu===9)||e.cancelPendingCommit!==null)&&(Rd(e,0),Fd(e,Yu,od,!1)),J(e,n),Ku&2&&e===qu||(e===qu&&(!(Ku&2)&&(id|=n),nd===4&&Fd(e,Yu,od,!1)),wf(e))}function Md(e,t,n){if(Ku&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ze(e,t),a=r?Kd(e,t):Wd(e,t,!0),o=r;do{if(a===0){$u&&!r&&Fd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Pd(n))a=Wd(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=cd;var l=c.current.memoizedState.isDehydrated;if(l&&(Rd(c,s).flags|=256),s=Wd(c,s,!1),s!==2&&s!==6){if(ed&&!l){c.errorRecoveryDisabledLanes|=o,id|=o,a=4;break a}o=ld,ld=a,o!==null&&(ld===null?ld=o:ld.push.apply(ld,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Rd(e,0),Fd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Fd(r,t,od,!Qu);break a;case 2:ld=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=dd+300-je(),10<a)){if(Fd(r,t,od,!Qu),Xe(r,0,!0)!==0)break a;yd=t,r.timeoutHandle=gp(Nd.bind(null,r,n,ld,md,ud,t,od,id,sd,Qu,o,`Throttled`,-0,0),a);break a}Nd(r,n,ld,md,ud,t,od,id,sd,Qu,o,null,-0,0)}break}}while(1);wf(e)}function Nd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:sn},Ml=null,zu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?dd-je():(a&4194048)===a?fd-je():0,m=eh(d,m),m!==null)?(yd=a,e.cancelPendingCommit=m($d.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Fd(e,a,o,!l)):$d(e,t,a,n,r,i,o,s,c,l,u,d)}function Pd(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 i=n[r],a=i.getSnapshot;i=i.value;try{if(!Ar(a(),i))return!1}catch{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 Fd(e,t,n,r){t=Qe(e,t),t&=~ad,t&=~id,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-He(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Y(e,n,t)}function Id(){return Ku&6?!0:(Tf(0,!1),!1)}function Ld(){if(Ju!==null){if(Xu===0)var e=Ju.return;else e=Ju,sa=oa=null,Xo(e),Ya=null,Xa=0,e=Ju;for(;e!==null;)fl(e.alternate,e),e=e.return;Ju=null}}function Rd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),yd=0,Ld(),qu=e,Ju=n=Ci(e.current,null),Yu=t,Xu=0,Zu=null,Qu=!1,$u=Ze(e,t),ed=!1,sd=od=ad=id=rd=nd=0,ld=cd=null,ud=!1,td=Qe(e,t),pi(),n}function zd(e,t){Z=null,W.H=ac,t===za||t===Va?(t=qa(),Xu=3):t===Ba?(t=qa(),Xu=4):Xu=t===Cc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Zu=t,Ju===null&&(nd=1,_c(e,ji(t,e.current)))}function Bd(){var e=xo.current;return e===null?!0:(Yu&4194048)===Yu?So===null:(Yu&62914560)===Yu||Yu&536870912?e===So:!1}function Vd(){var e=W.H;return W.H=ac,e===null?ac:e}function Hd(){var e=W.A;return W.A=Wu,e}function Ud(){nd=4,Qu||(Yu&4194048)!==Yu&&xo.current!==null||($u=!0),!(rd&134217727)&&!(id&134217727)||qu===null||Fd(qu,Yu,od,!1)}function Wd(e,t,n){var r=Ku;Ku|=2;var i=Vd(),a=Hd();(qu!==e||Yu!==t)&&(md=null,Rd(e,t)),t=!1;var o=nd;a:do try{if(Xu!==0&&Ju!==null){var s=Ju,c=Zu;switch(Xu){case 8:Ld(),o=6;break a;case 3:case 2:case 9:case 6:xo.current===null&&(t=!0);var l=Xu;if(Xu=0,Zu=null,Xd(e,s,c,l),n&&$u){o=0;break a}break;default:l=Xu,Xu=0,Zu=null,Xd(e,s,c,l)}}Gd(),o=nd;break}catch(t){zd(e,t)}while(1);return t&&e.shellSuspendCounter++,sa=oa=null,Ku=r,W.H=i,W.A=a,Ju===null&&(qu=null,Yu=0,pi()),o}function Gd(){for(;Ju!==null;)Jd(Ju)}function Kd(e,t){var n=Ku;Ku|=2;var r=Vd(),a=Hd();qu!==e||Yu!==t?(md=null,pd=je()+500,Rd(e,t)):$u=Ze(e,t);a:do try{if(Xu!==0&&Ju!==null){t=Ju;var o=Zu;b:switch(Xu){case 1:Xu=0,Zu=null,Xd(e,t,o,1);break;case 2:case 9:if(Ua(o)){Xu=0,Zu=null,Yd(t);break}t=function(){Xu!==2&&Xu!==9||qu!==e||(Xu=7),wf(e)},o.then(t,t);break a;case 3:Xu=7;break a;case 4:Xu=5;break a;case 7:Ua(o)?(Xu=0,Zu=null,Yd(t)):(Xu=0,Zu=null,Xd(e,t,o,7));break;case 5:var s=null;switch(Ju.tag){case 26:s=Ju.memoizedState;case 5:case 27:var c=Ju;if(s?Ym(s):c.stateNode.complete){Xu=0,Zu=null;var l=c.sibling;if(l!==null)Ju=l;else{var u=c.return;u===null?Ju=null:(Ju=u,Zd(u))}break b}}Xu=0,Zu=null,Xd(e,t,o,5);break;case 6:Xu=0,Zu=null,Xd(e,t,o,6);break;case 8:Ld(),nd=6;break a;default:throw Error(i(462))}}qd();break}catch(t){zd(e,t)}while(1);return sa=oa=null,W.H=r,W.A=a,Ku=n,Ju===null?(qu=null,Yu=0,pi(),nd):0}function qd(){for(;Ju!==null&&!ke();)Jd(Ju)}function Jd(e){var t=rl(e.alternate,e,td);e.memoizedProps=e.pendingProps,t===null?Zd(e):Ju=t}function Yd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Lc(n,t,t.pendingProps,t.type,void 0,Yu);break;case 11:t=Lc(n,t,t.pendingProps,t.type.render,t.ref,Yu);break;case 5:Xo(t);var r=t;r===Ki&&(Ji?(ea(r),r.tag===5&&r.stateNode!=null&&(qi=r.stateNode)):(ea(r),Ji=!0));default:fl(n,t),t=Ju=wi(t,td),t=rl(n,t,td)}e.memoizedProps=e.pendingProps,t===null?Zd(e):Ju=t}function Xd(e,t,n,r){sa=oa=null,Xo(t),Ya=null,Xa=0;var i=t.return;try{if(Sc(e,i,t,n,Yu)){nd=1,_c(e,ji(n,e.current)),Ju=null;return}}catch(t){if(i!==null)throw Ju=i,t;nd=1,_c(e,ji(n,e.current)),Ju=null;return}t.flags&32768?(Ji||r===1?e=!0:$u||Yu&536870912?e=!1:(Qu=e=!0,(r===2||r===9||r===3||r===6)&&(r=xo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Qd(t,e)):Zd(t)}function Zd(e){var t=e;do{if(t.flags&32768){Qd(t,Qu);return}e=t.return;var n=ul(t.alternate,t,td);if(n!==null){Ju=n;return}if(t=t.sibling,t!==null){Ju=t;return}Ju=t=e}while(t!==null);nd===0&&(nd=5)}function Qd(e,t){do{var n=dl(e.alternate,e);if(n!==null){n.flags&=32767,Ju=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ju=e;return}Ju=e=n}while(e!==null);nd=6,Ju=null}function $d(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do cf();while(gd!==0);if(Ku&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===qu&&(Ju=qu=null,Yu=0),vd=t,_d=e,yd=n,xd=a,Sd=r,ef(e,t,n,s,c,l,f)}}function ef(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(bd=s,s|=fi,rt(e,n,s,r,i,a),wd=null,(n&335544064)===n?(Td=Ea(e),r=10262):(Td=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,_f(q,function(){return lf(),null})):(e.callbackNode=null,e.callbackPriority=0),jl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=W.T,W.T=null,i=G.p,G.p=2,a=Ku,Ku|=4;try{ou(e,t,n)}finally{Ku=a,G.p=i,W.T=r}}gd=1,jl?Cd=Mp(o,e.containerInfo,Td,rf,af,nf,of,lf,tf,null,null):(rf(),af(),of())}function tf(e){if(gd!==0){var t=_d.onRecoverableError;t(e,{componentStack:null})}}function nf(){gd===3&&(gd=0,Du(vd,_d),gd=4)}function rf(){if(gd===1){gd=0;var e=_d,t=vd,n=yd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=W.T,W.T=null;var i=G.p;G.p=2;var a=Ku;Ku|=4;try{ru=iu=!1,Cu(t,e,n),n=cp;var o=Ir(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Fr(s.ownerDocument.documentElement,s)){if(c!==null&&Lr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Pr(s,h),v=Pr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{Ku=a,G.p=i,W.T=r}}e.current=t,gd=2}}function af(){if(gd===2){gd=0;var e=_d,t=vd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=W.T,W.T=null;var r=G.p;G.p=2;var i=Ku;Ku|=4;try{cu(e,t.alternate,t)}finally{Ku=i,G.p=r,W.T=n}}gd=3}}function of(){if(gd===4||gd===3){gd=0;var e=Cd;Cd=null,Ae();var t=_d,n=vd,r=yd,i=Sd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?gd=5:(gd=0,vd=_d=null,sf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(hd=null),st(r),n=n.stateNode,Be&&typeof Be.onCommitFiberRoot==`function`)try{Be.onCommitFiberRoot(ze,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=W.T,a=G.p,G.p=2,W.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{W.T=n,G.p=a}}if(i=wd,o=Td,Td=null,i!==null&&(wd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);yd&3&&cf(),wf(t),a=t.pendingLanes,r&261930&&a&42?t===Dd?Ed++:(Ed=0,Dd=t):(Ed=0,Dd=null),Tf(0,!1)}}function sf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ca(t)))}function cf(){return Cd!==null&&(Cd.skipTransition(),Cd=null),rf(),af(),of(),lf()}function lf(){if(gd!==5)return!1;var e=_d,t=bd;bd=0;var n=st(yd),r=W.T,a=G.p;try{G.p=32>n?32:n,W.T=null,n=xd,xd=null;var o=_d,s=yd;if(gd=0,vd=_d=null,yd=0,Ku&6)throw Error(i(331));var c=Ku;if(Ku|=4,Hu(o.current),Pu(o,o.current,s,n),Ku=c,Tf(0,!1),Be&&typeof Be.onPostCommitFiberRoot==`function`)try{Be.onPostCommitFiberRoot(ze,o)}catch{}return!0}finally{G.p=a,W.T=r,sf(e,t)}}function uf(e,t,n){t=ji(n,t),t=yc(e.stateNode,t,2),e=so(e,t,2),e!==null&&(J(e,2),wf(e))}function df(e,t,n){if(e.tag===3)uf(e,e,n);else for(;t!==null;){if(t.tag===3){uf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(hd===null||!hd.has(r))){e=ji(n,e),n=bc(2),r=so(t,n,2),r!==null&&(xc(n,r,t,e),J(r,2),wf(r));break}}t=t.return}}function ff(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Gu;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ed=!0,i.add(n),e=pf.bind(null,e,t,n),t.then(e,e))}function pf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,qu===e&&(Yu&n)===n&&(nd===4||nd===3&&(Yu&62914560)===Yu&&300>je()-dd?Ku&2?ad|=n:Rd(e,0):ad|=n,sd===Yu&&(sd=0)),wf(e)}function mf(e,t){t===0&&(t=tt()),e=gi(e,t),e!==null&&(J(e,t),wf(e))}function hf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mf(e,n)}function gf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),mf(e,n)}function _f(e,t){return De(e,t)}var vf=null,yf=null,bf=!1,xf=!1,Sf=!1,Cf=0;function wf(e){e!==yf&&e.next===null&&(yf===null?vf=yf=e:yf=yf.next=e),xf=!0,bf||(bf=!0,jf())}function Tf(e,t){if(!Sf&&xf){Sf=!0;do for(var n=!1,r=vf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-He(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Af(r,a))}else a=Yu,a=Xe(r,r===qu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ze(r,a)||(n=!0,Af(r,a))}r=r.next}while(n);Sf=!1}}function Ef(){Df()}function Df(){xf=bf=!1;var e=0;Cf!==0&&hp()&&(e=Cf);for(var t=je(),n=null,r=vf;r!==null;){var i=r.next,a=Of(r,t);a===0?(r.next=null,n===null?vf=i:n.next=i,i===null&&(yf=n)):(n=r,(e!==0||a&3)&&(xf=!0)),r=i}gd!==0&&gd!==5||Tf(e,!1),Cf!==0&&(Cf=0)}function Of(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-He(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=$e(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=qu,n=Yu,n=Xe(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Xu===2||Xu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Oe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ze(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Oe(r),st(n)){case 2:case 8:n=Pe;break;case 32:n=q;break;case 268435456:n=Ie;break;default:n=q}return r=kf.bind(null,e),n=De(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Oe(r),e.callbackPriority=2,e.callbackNode=null,2}function kf(e,t){if(gd!==0&&gd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(cf()&&e.callbackNode!==n)return null;var r=Yu;return r=Xe(e,e===qu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Md(e,r,t),Of(e,je()),e.callbackNode!=null&&e.callbackNode===n?kf.bind(null,e):null)}function Af(e,t){if(cf())return null;Md(e,t,!0)}function jf(){bp(function(){Ku&6?De(Ne,Ef):Df()})}function Mf(){if(Cf===0){var e=ka;e===0&&(e=Ke,Ke<<=1,!(Ke&261888)&&(Ke=256)),Cf=e}return Cf}function Nf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:on(e)}function Pf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Nf((i[ft]||null).action),o=r.submitter;o&&(t=(t=o[ft]||null)?Nf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new On(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Cf!==0){var e=new FormData(i,o);Ks(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Ks(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Ff=0;Ff<ri.length;Ff++){var If=ri[Ff];ii(If.toLowerCase(),`on`+(If[0].toUpperCase()+If.slice(1)))}ii(Yr,`onAnimationEnd`),ii(Xr,`onAnimationIteration`),ii(Zr,`onAnimationStart`),ii(`dblclick`,`onDoubleClick`),ii(`focusin`,`onFocus`),ii(`focusout`,`onBlur`),ii(Qr,`onTransitionRun`),ii($r,`onTransitionStart`),ii(ei,`onTransitionCancel`),ii(ti,`onTransitionEnd`),At(`onMouseEnter`,[`mouseout`,`mouseover`]),At(`onMouseLeave`,[`mouseout`,`mouseover`]),At(`onPointerEnter`,[`pointerout`,`pointerover`]),At(`onPointerLeave`,[`pointerout`,`pointerover`]),kt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),kt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),kt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),kt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),kt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),kt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Lf=`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(` `),Rf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Lf));function zf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){li(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){li(e)}i.currentTarget=null,a=c}}}}function Bf(e,t){var n=t[mt];n===void 0&&(n=t[mt]=new Set);var r=e+`__bubble`;n.has(r)||(Wf(t,e,2,!1),n.add(r))}function Vf(e,t,n){var r=0;t&&(r|=4),Wf(n,e,r,t)}var Hf=`_reactListening`+Math.random().toString(36).slice(2);function Uf(e){if(!e[Hf]){e[Hf]=!0,Dt.forEach(function(t){t!==`selectionchange`&&(Rf.has(t)||Vf(t,!1,e),Vf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hf]||(t[Hf]=!0,Vf(`selectionchange`,!1,t))}}function Wf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!_n||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Gf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=xt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}mn(function(){var r=a,i=ln(n),s=[];a:{var c=ni.get(e);if(c!==void 0){var l=On,u=e;switch(e){case`keypress`:if(Cn(n)===0)break a;case`keydown`:case`keyup`:l=Kn;break;case`focusin`:u=`focus`,l=Ln;break;case`focusout`:u=`blur`,l=Ln;break;case`beforeblur`:case`afterblur`:l=Ln;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Fn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=In;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Yn;break;case Yr:case Xr:case Zr:l=Rn;break;case ti:l=Xn;break;case`scroll`:case`scrollend`:l=An;break;case`wheel`:l=Zn;break;case`copy`:case`cut`:case`paste`:l=zn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=qn;break;case`submit`:l=Jn;break;case`toggle`:case`beforetoggle`:l=Qn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=hn(m,p),g!=null&&d.push(Kf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==cn&&(u=n.relatedTarget||n.fromElement)&&(xt(u)||u[pt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?xt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Fn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=qn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Ct(c),h=l==null?u:Ct(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,xt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?C(c,l,Jf):null,c!==null&&Yf(s,u,c,d,!1),l!==null&&f!==null&&Yf(s,f,l,d,!0)))}a:{if(c=r?Ct(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=vr;else if(fr(c)){if(yr)_=Or;else{_=Er;var v=Tr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&nn(r.elementType)&&(_=vr):_=Dr;if(_&&=_(e,r)){pr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Ct(r):window,e){case`focusin`:(fr(v)||v.contentEditable===`true`)&&(zr=v,Br=r,Vr=null);break;case`focusout`:Vr=Br=zr=null;break;case`mousedown`:Hr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Hr=!1,Ur(s,n,i);break;case`selectionchange`:if(Rr)break;case`keydown`:case`keyup`:Ur(s,n,i)}var y;if(er)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else cr?or(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(rr&&n.locale!==`ko`&&(cr||b!==`onCompositionStart`?b===`onCompositionEnd`&&cr&&(y=Sn()):(yn=i,bn=`value`in yn?yn.value:yn.textContent,cr=!0)),v=qf(r,b),0<v.length&&(b=new Bn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=sr(n),y!==null&&(b.data=y)))),(y=nr?lr(e,n):ur(e,n))&&(b=qf(r,`onBeforeInput`),0<b.length&&(v=new Bn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Pf(s,e,r,n,i)}zf(s,t)})}function Kf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=hn(e,n),i!=null&&r.unshift(Kf(e,i,a)),i=hn(e,t),i!=null&&r.push(Kf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Jf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=hn(n,a),l!=null&&o.unshift(Kf(n,l,c))):i||(l=hn(n,a),l!=null&&o.push(Kf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Xf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function Qf(e){return(typeof e==`string`?e:``+e).replace(Xf,`
10
+ `).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||Qt(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&Qt(e,``+r);else return;break;case`className`:Lt(e,`class`,r);break;case`tabIndex`:Lt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Lt(e,n,r);break;case`style`:tn(e,r,o);return;case`data`:if(t!==`object`){Lt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=on(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}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,a.name,a,null),ep(e,t,`formEncType`,a.formEncType,a,null),ep(e,t,`formMethod`,a.formMethod,a,null),ep(e,t,`formTarget`,a.formTarget,a,null)):(ep(e,t,`encType`,a.encType,a,null),ep(e,t,`method`,a.method,a,null),ep(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=on(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=sn);return;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==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=on(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`:!0===r?e.setAttribute(n,``):!1!==r&&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`:Bf(`beforetoggle`,e),Bf(`toggle`,e),It(e,`popover`,r);break;case`xlinkActuate`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:It(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=rn.get(n)||n,It(e,n,r);else return}X=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:tn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)Qt(e,r);else if(typeof r==`number`||typeof r==`bigint`)Qt(e,``+r);else return;break;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=sn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Ot.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[ft]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}X=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):It(e,n,r)}return}X=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Bf(`error`,e),Bf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,o,s,n,null)}}a&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:Bf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ep(e,t,r,d,n,null)}}qt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Bf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Yt(e,!!r,n,!0):Yt(e,!!r,t,!1);return;case`textarea`:for(s in Bf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ep(e,t,s,c,n,null)}Zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:Bf(`beforetoggle`,e),Bf(`toggle`,e),Bf(`cancel`,e),Bf(`close`,e);break;case`iframe`:case`object`:Bf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Lf.length;r++)Bf(Lf[r],e);break;case`image`:Bf(`error`,e),Bf(`load`,e);break;case`details`:Bf(`toggle`,e);break;case`embed`:case`source`:case`link`:Bf(`error`,e),Bf(`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(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,u,r,n,null)}return;default:if(nn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(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 a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(X=!0),o=m;break;case`name`:m!==f&&(X=!0),a=m;break;case`checked`:m!==f&&(X=!0),u=m;break;case`defaultChecked`:m!==f&&(X=!0),d=m;break;case`value`:m!==f&&(X=!0),s=m;break;case`defaultValue`:m!==f&&(X=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}Kt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ep(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(X=!0),p=o;break;case`defaultValue`:o!==l&&(X=!0),c=o;break;case`multiple`:o!==l&&(X=!0),s=o;default:o!==l&&ep(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Yt(e,!!n,n?[]:``,!1):Yt(e,!!n,t,!0)):Yt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(X=!0),p=a;break;case`defaultValue`:a!==o&&(X=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ep(e,t,s,a,r,o)}Xt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(X=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,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)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(nn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(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 dp(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 fp(e,t,n,r){return n=lp(n).createElement(e),n[dt]=r,n[ft]=t,np(n,e,t),Tt(n),n}function pp(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 mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[vt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(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;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),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 i=r=0;i<t.length;i++){var a=t[i];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 Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]: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?(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):e.margin=n))}function Dp(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 Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:w({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return _(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return _(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=_(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 i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=_(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=_(e),e=lp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag===6||(e=_(e),t.observe(e)),!1}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag===6||(e=_(e),t.unobserve(e)),!1}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(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=_(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=_(t);if(n.length===0){if(n=r,m(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=h(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=_(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=_(n[0]),i=_(n[n.length-1]);var a=m(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(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=xt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=p(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=C(n,a,S),t===null?t=!1:(f(t,!0,b,a,n),a=v,v=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=C(r,a,S),t===null?t=!1:(f(t,!0,x,a,r),a=v,y=v=null,t=a!==null)),t):!1}function Zp(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)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=h(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=_(r),Zp(e,n);return}if(r=_(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 a=t[r];a.tag===6?(a=_(a),Zp(a,n)):_(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=_(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),bt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=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=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[vt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(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 lm(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 um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(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 pm(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 mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===sn&&(e.onclick=null),bt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);bt(e)}var vm=new Map,ym=new Set;function bm(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 xm=G.d;G.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Id();return e||t}function Cm(e){var t=St(e);t!==null&&t.tag===5&&t.type===`form`?Js(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=Gt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Tt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Gt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Gt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Gt(n.imageSizes)+`"]`)):i+=`[href="`+Gt(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=w({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[yt]=!0,o.onload=o.onerror=function(){Et(o)}),Tt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Gt(r)+`"][href="`+Gt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=w({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Tt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=wt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=w({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Tt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=wt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Tt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=wt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=w({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Tt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=pe.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=wt(a).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=Pm(n.href);var o=wt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=wt(a).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(i(444,e))}}function Pm(e){return`href="`+Gt(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[yt]){r.loading=1;return}}else t=e.createElement(`link`),t[yt]=!0,t.onload=t.onerror=Et.bind(null,t),np(t,`link`,n),Tt(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 Rm(e){return`[src="`+Gt(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Gt(n.href)+`"]`);if(r)return t.instance=r,Tt(r),r;var a=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Tt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,Tt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),Tt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,Tt(a),a):(r=n,(a=vm.get(o))&&(r=w({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Tt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[vt]||a[dt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(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 Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Tt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Tt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(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)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:M,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function ch(e,t,n,r,i,a,o,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=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=xi(3,null,null,t),e.current=a,a.stateNode=e,t=Sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},io(a),e}function uh(e){return e?(e=yi,e):yi}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=oo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=so(e,r,t),n!==null&&(jd(n,e,t),co(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=gi(e,67108864);t!==null&&jd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=Od();t=ot(t);var n=gi(e,t);n!==null&&jd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=W.T;W.T=null;var a=G.p;try{G.p=2,yh(e,t,n,r)}finally{G.p=a,W.T=i}}function vh(e,t,n,r){var i=W.T;W.T=null;var a=G.p;try{G.p=8,yh(e,t,n,r)}finally{G.p=a,W.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=St(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ye(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-He(o);s.entanglements[1]|=c,o&=~c}wf(a),!(Ku&6)&&(pd=je()+500,Tf(0,!1))}}break;case 31:case 13:s=gi(a,2),s!==null&&jd(s,a,2),Id(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=ln(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=xt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 xh=e,null}function Ch(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(Me()){case Ne:return 2;case Pe:return 8;case q:case Fe:return 32;case Ie:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`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 Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=St(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=xt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,lt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,lt(e.priority,function(){hh(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 Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);cn=r,n.target.dispatchEvent(r),cn=null}else return t=St(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=St(n);a!==null&&(e.splice(t,3),t-=3,Ks(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[ft]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ft]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=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),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,Od(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Id(),t[pt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ct();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.1`)throw Error(i(527,Kh,`19.3.1`));G.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:W,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{ze=Jh.inject(qh),Be=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=mc,s=hc,c=gc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[pt]=t.current,Uf(e),new Wh(t)}})),nt=ae(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=tt()})),J=e(te(),1),rt=nt(),Y=b();function it(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=it(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var at={value:()=>{}};function ot(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new st(n)}function st(e){this._=e}function ct(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}st.prototype=ot.prototype={constructor:st,on:function(e,t){var n=this._,r=ct(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=lt(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=ut(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ut(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new st(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function lt(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function ut(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=at,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var dt=`http://www.w3.org/1999/xhtml`,ft={svg:`http://www.w3.org/2000/svg`,xhtml:dt,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function pt(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),ft.hasOwnProperty(t)?{space:ft[t],local:e}:e}function mt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===dt&&t.documentElement.namespaceURI===dt?t.createElement(e):t.createElementNS(n,e)}}function ht(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function gt(e){var t=pt(e);return(t.local?ht:mt)(t)}function _t(){}function vt(e){return e==null?_t:function(){return this.querySelector(e)}}function yt(e){typeof e!=`function`&&(e=vt(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new sr(r,this._parents)}function bt(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xt(){return[]}function St(e){return e==null?xt:function(){return this.querySelectorAll(e)}}function Ct(e){return function(){return bt(e.apply(this,arguments))}}function wt(e){e=typeof e==`function`?Ct(e):St(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new sr(r,i)}function Tt(e){return function(){return this.matches(e)}}function Et(e){return function(t){return t.matches(e)}}var Dt=Array.prototype.find;function Ot(e){return function(){return Dt.call(this.children,e)}}function kt(){return this.firstElementChild}function At(e){return this.select(e==null?kt:Ot(typeof e==`function`?e:Et(e)))}var jt=Array.prototype.filter;function Mt(){return Array.from(this.children)}function Nt(e){return function(){return jt.call(this.children,e)}}function Pt(e){return this.selectAll(e==null?Mt:Nt(typeof e==`function`?e:Et(e)))}function X(e){typeof e!=`function`&&(e=Tt(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new sr(r,this._parents)}function Ft(e){return Array(e.length)}function It(){return new sr(this._enter||this._groups.map(Ft),this._parents)}function Lt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Lt.prototype={constructor:Lt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Rt(e){return function(){return e}}function zt(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Lt(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Bt(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Lt(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Vt(e){return e.__data__}function Ht(e,t){if(!arguments.length)return Array.from(this,Vt);var n=t?Bt:zt,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Rt(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Ut(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new sr(o,r),o._enter=s,o._exit=c,o}function Ut(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Wt(){return new sr(this._exit||this._groups.map(Ft),this._parents)}function Gt(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Kt(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new sr(s,this._parents)}function qt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Jt(e){e||=Yt;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new sr(i,this._parents).order()}function Yt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Xt(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Zt(){return Array.from(this)}function Qt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function $t(){let e=0;for(let t of this)++e;return e}function en(){return!this.node()}function tn(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function nn(e){return function(){this.removeAttribute(e)}}function rn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function an(e,t){return function(){this.setAttribute(e,t)}}function on(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sn(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function cn(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ln(e,t){var n=pt(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?rn:nn:typeof t==`function`?n.local?cn:sn:n.local?on:an)(n,t))}function un(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function dn(e){return function(){this.style.removeProperty(e)}}function fn(e,t,n){return function(){this.style.setProperty(e,t,n)}}function pn(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function mn(e,t,n){return arguments.length>1?this.each((t==null?dn:typeof t==`function`?pn:fn)(e,t,n??``)):hn(this.node(),e)}function hn(e,t){return e.style.getPropertyValue(t)||un(e).getComputedStyle(e,null).getPropertyValue(t)}function gn(e){return function(){delete this[e]}}function _n(e,t){return function(){this[e]=t}}function vn(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function yn(e,t){return arguments.length>1?this.each((t==null?gn:typeof t==`function`?vn:_n)(e,t)):this.node()[e]}function bn(e){return e.trim().split(/^|\s+/)}function xn(e){return e.classList||new Sn(e)}function Sn(e){this._node=e,this._names=bn(e.getAttribute(`class`)||``)}Sn.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function Cn(e,t){for(var n=xn(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function wn(e,t){for(var n=xn(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Tn(e){return function(){Cn(this,e)}}function En(e){return function(){wn(this,e)}}function Dn(e,t){return function(){(t.apply(this,arguments)?Cn:wn)(this,e)}}function On(e,t){var n=bn(e+``);if(arguments.length<2){for(var r=xn(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Dn:t?Tn:En)(n,t))}function kn(){this.textContent=``}function An(e){return function(){this.textContent=e}}function jn(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Mn(e){return arguments.length?this.each(e==null?kn:(typeof e==`function`?jn:An)(e)):this.node().textContent}function Nn(){this.innerHTML=``}function Pn(e){return function(){this.innerHTML=e}}function Fn(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function In(e){return arguments.length?this.each(e==null?Nn:(typeof e==`function`?Fn:Pn)(e)):this.node().innerHTML}function Ln(){this.nextSibling&&this.parentNode.appendChild(this)}function Rn(){return this.each(Ln)}function zn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bn(){return this.each(zn)}function Vn(e){var t=typeof e==`function`?e:gt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Hn(){return null}function Un(e,t){var n=typeof e==`function`?e:gt(e),r=t==null?Hn:typeof t==`function`?t:vt(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Wn(){var e=this.parentNode;e&&e.removeChild(this)}function Gn(){return this.each(Wn)}function Kn(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qn(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Jn(e){return this.select(e?qn:Kn)}function Yn(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Xn(e){return function(t){e.call(this,t,this.__data__)}}function Zn(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Qn(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function $n(e,t,n){return function(){var r=this.__on,i,a=Xn(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function er(e,t,n){var r=Zn(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}}else{for(s=t?$n:Qn,i=0;i<a;++i)this.each(s(r[i],t,n));return this}}function tr(e,t,n){var r=un(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function nr(e,t){return function(){return tr(this,e,t)}}function rr(e,t){return function(){return tr(this,e,t.apply(this,arguments))}}function ir(e,t){return this.each((typeof t==`function`?rr:nr)(e,t))}function*ar(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var or=[null];function sr(e,t){this._groups=e,this._parents=t}function cr(){return new sr([[document.documentElement]],or)}function lr(){return this}sr.prototype=cr.prototype={constructor:sr,select:yt,selectAll:wt,selectChild:At,selectChildren:Pt,filter:X,data:Ht,enter:It,exit:Wt,join:Gt,merge:Kt,selection:lr,order:qt,sort:Jt,call:Xt,nodes:Zt,node:Qt,size:$t,empty:en,each:tn,attr:ln,style:mn,property:yn,classed:On,text:Mn,html:In,raise:Rn,lower:Bn,append:Vn,insert:Un,remove:Gn,clone:Jn,datum:Yn,on:er,dispatch:ir,[Symbol.iterator]:ar};function ur(e){return typeof e==`string`?new sr([[document.querySelector(e)]],[document.documentElement]):new sr([[e]],or)}var dr=0;function fr(){return new pr}function pr(){this._=`@`+(++dr).toString(36)}pr.prototype=fr.prototype={constructor:pr,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};function mr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function hr(e,t){if(e=mr(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var gr={passive:!1},_r={capture:!0,passive:!1};function vr(e){e.stopImmediatePropagation()}function yr(e){e.preventDefault(),e.stopImmediatePropagation()}function br(e){var t=e.document.documentElement,n=ur(e).on(`dragstart.drag`,yr,_r);`onselectstart`in t?n.on(`selectstart.drag`,yr,_r):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function xr(e,t){var n=e.document.documentElement,r=ur(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,yr,_r),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Sr=e=>()=>e;function Cr(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Cr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wr(e){return!e.ctrlKey&&!e.button}function Tr(){return this.parentNode}function Er(e,t){return t??{x:e.x,y:e.y}}function Dr(){return navigator.maxTouchPoints||`ontouchstart`in this}function Or(){var e=wr,t=Tr,n=Er,r=Dr,i={},a=ot(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,gr).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!u&&e.call(this,n,r)){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(ur(n.view).on(`mousemove.drag`,m,_r).on(`mouseup.drag`,h,_r),br(n.view),vr(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(yr(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){ur(e.view).on(`mousemove.drag mouseup.drag`,null),xr(e.view,l),yr(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r))for(var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s=0,c;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(vr(n),c(`start`,n,i[s]))}function _(e){for(var t=e.changedTouches,n=t.length,r=0,a;r<n;++r)(a=i[t[r].identifier])&&(yr(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(vr(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=hr(l||r,t),p,m,h;if((h=n.call(e,new Cr(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=hr(l||a,t),_=o}u.call(r,e,new Cr(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Sr(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:Sr(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:Sr(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:Sr(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function kr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ar(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function jr(){}var Mr=.7,Nr=1/Mr,Pr=`\\s*([+-]?\\d+)\\s*`,Fr=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Ir=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,Lr=/^#([0-9a-f]{3,8})$/,Rr=RegExp(`^rgb\\(${Pr},${Pr},${Pr}\\)$`),zr=RegExp(`^rgb\\(${Ir},${Ir},${Ir}\\)$`),Br=RegExp(`^rgba\\(${Pr},${Pr},${Pr},${Fr}\\)$`),Vr=RegExp(`^rgba\\(${Ir},${Ir},${Ir},${Fr}\\)$`),Hr=RegExp(`^hsl\\(${Fr},${Ir},${Ir}\\)$`),Ur=RegExp(`^hsla\\(${Fr},${Ir},${Ir},${Fr}\\)$`),Wr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};kr(jr,Yr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Gr,formatHex:Gr,formatHex8:Kr,formatHsl:qr,formatRgb:Jr,toString:Jr});function Gr(){return this.rgb().formatHex()}function Kr(){return this.rgb().formatHex8()}function qr(){return ci(this).formatHsl()}function Jr(){return this.rgb().formatRgb()}function Yr(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=Lr.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Xr(t):n===3?new ei(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Zr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Zr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Rr.exec(e))?new ei(t[1],t[2],t[3],1):(t=zr.exec(e))?new ei(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Br.exec(e))?Zr(t[1],t[2],t[3],t[4]):(t=Vr.exec(e))?Zr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Hr.exec(e))?si(t[1],t[2]/100,t[3]/100,1):(t=Ur.exec(e))?si(t[1],t[2]/100,t[3]/100,t[4]):Wr.hasOwnProperty(e)?Xr(Wr[e]):e===`transparent`?new ei(NaN,NaN,NaN,0):null}function Xr(e){return new ei(e>>16&255,e>>8&255,e&255,1)}function Zr(e,t,n,r){return r<=0&&(e=t=n=NaN),new ei(e,t,n,r)}function Qr(e){return e instanceof jr||(e=Yr(e)),e?(e=e.rgb(),new ei(e.r,e.g,e.b,e.opacity)):new ei}function $r(e,t,n,r){return arguments.length===1?Qr(e):new ei(e,t,n,r??1)}function ei(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}kr(ei,$r,Ar(jr,{brighter(e){return e=e==null?Nr:Nr**+e,new ei(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mr:Mr**+e,new ei(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ei(ai(this.r),ai(this.g),ai(this.b),ii(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ti,formatHex:ti,formatHex8:ni,formatRgb:ri,toString:ri}));function ti(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}`}function ni(){return`#${oi(this.r)}${oi(this.g)}${oi(this.b)}${oi((isNaN(this.opacity)?1:this.opacity)*255)}`}function ri(){let e=ii(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ai(this.r)}, ${ai(this.g)}, ${ai(this.b)}${e===1?`)`:`, ${e})`}`}function ii(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ai(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function oi(e){return e=ai(e),(e<16?`0`:``)+e.toString(16)}function si(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ui(e,t,n,r)}function ci(e){if(e instanceof ui)return new ui(e.h,e.s,e.l,e.opacity);if(e instanceof jr||(e=Yr(e)),!e)return new ui;if(e instanceof ui)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new ui(o,s,c,e.opacity)}function li(e,t,n,r){return arguments.length===1?ci(e):new ui(e,t,n,r??1)}function ui(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}kr(ui,li,Ar(jr,{brighter(e){return e=e==null?Nr:Nr**+e,new ui(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mr:Mr**+e,new ui(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new ei(pi(e>=240?e-240:e+120,i,r),pi(e,i,r),pi(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new ui(di(this.h),fi(this.s),fi(this.l),ii(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=ii(this.opacity);return`${e===1?`hsl(`:`hsla(`}${di(this.h)}, ${fi(this.s)*100}%, ${fi(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function di(e){return e=(e||0)%360,e<0?e+360:e}function fi(e){return Math.max(0,Math.min(1,e||0))}function pi(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var mi=Math.PI/180,hi=180/Math.PI,gi=18,_i=.96422,vi=1,yi=.82521,bi=4/29,xi=6/29,Si=3*xi*xi,Ci=xi*xi*xi;function wi(e){if(e instanceof Ei)return new Ei(e.l,e.a,e.b,e.opacity);if(e instanceof Ni)return Pi(e);e instanceof ei||(e=Qr(e));var t=Ai(e.r),n=Ai(e.g),r=Ai(e.b),i=Di((.2225045*t+.7168786*n+.0606169*r)/vi),a,o;return t===n&&n===r?a=o=i:(a=Di((.4360747*t+.3850649*n+.1430804*r)/_i),o=Di((.0139322*t+.0971045*n+.7141733*r)/yi)),new Ei(116*i-16,500*(a-i),200*(i-o),e.opacity)}function Ti(e,t,n,r){return arguments.length===1?wi(e):new Ei(e,t,n,r??1)}function Ei(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}kr(Ei,Ti,Ar(jr,{brighter(e){return new Ei(this.l+gi*(e??1),this.a,this.b,this.opacity)},darker(e){return new Ei(this.l-gi*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=_i*Oi(t),e=vi*Oi(e),n=yi*Oi(n),new ei(ki(3.1338561*t-1.6168667*e-.4906146*n),ki(-.9787684*t+1.9161415*e+.033454*n),ki(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function Di(e){return e>Ci?e**(1/3):e/Si+bi}function Oi(e){return e>xi?e*e*e:Si*(e-bi)}function ki(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function Ai(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function ji(e){if(e instanceof Ni)return new Ni(e.h,e.c,e.l,e.opacity);if(e instanceof Ei||(e=wi(e)),e.a===0&&e.b===0)return new Ni(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*hi;return new Ni(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Mi(e,t,n,r){return arguments.length===1?ji(e):new Ni(e,t,n,r??1)}function Ni(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function Pi(e){if(isNaN(e.h))return new Ei(e.l,0,0,e.opacity);var t=e.h*mi;return new Ei(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}kr(Ni,Mi,Ar(jr,{brighter(e){return new Ni(this.h,this.c,this.l+gi*(e??1),this.opacity)},darker(e){return new Ni(this.h,this.c,this.l-gi*(e??1),this.opacity)},rgb(){return Pi(this).rgb()}}));var Fi=-.14861,Ii=1.78277,Li=-.29227,Ri=-.90649,zi=1.97294,Bi=zi*Ri,Vi=zi*Ii,Hi=Ii*Li-Ri*Fi;function Ui(e){if(e instanceof Gi)return new Gi(e.h,e.s,e.l,e.opacity);e instanceof ei||(e=Qr(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(Hi*r+Bi*t-Vi*n)/(Hi+Bi-Vi),a=r-i,o=(zi*(n-i)-Li*a)/Ri,s=Math.sqrt(o*o+a*a)/(zi*i*(1-i)),c=s?Math.atan2(o,a)*hi-120:NaN;return new Gi(c<0?c+360:c,s,i,e.opacity)}function Wi(e,t,n,r){return arguments.length===1?Ui(e):new Gi(e,t,n,r??1)}function Gi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}kr(Gi,Wi,Ar(jr,{brighter(e){return e=e==null?Nr:Nr**+e,new Gi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mr:Mr**+e,new Gi(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*mi,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new ei(255*(t+n*(Fi*r+Ii*i)),255*(t+n*(Li*r+Ri*i)),255*(t+zi*r*n),this.opacity)}}));var Ki=e=>()=>e;function qi(e,t){return function(n){return e+n*t}}function Ji(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Yi(e,t){var n=t-e;return n?qi(e,n>180||n<-180?n-360*Math.round(n/360):n):Ki(isNaN(e)?t:e)}function Xi(e){return(e=+e)==1?Zi:function(t,n){return n-t?Ji(t,n,e):Ki(isNaN(t)?n:t)}}function Zi(e,t){var n=t-e;return n?qi(e,n):Ki(isNaN(e)?t:e)}var Qi=(function e(t){var n=Xi(t);function r(e,t){var r=n((e=$r(e)).r,(t=$r(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Zi(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function $i(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function ea(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ta(e,t){for(var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o=0;o<r;++o)i[o]=ua(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function na(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ra(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ia(e,t){var n={},r={},i;for(i in typeof e==`object`&&e||(e={}),typeof t==`object`&&t||(t={}),t)i in e?n[i]=ua(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var aa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oa=new RegExp(aa.source,`g`);function sa(e){return function(){return e}}function ca(e){return function(t){return e(t)+``}}function la(e,t){var n=aa.lastIndex=oa.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=aa.exec(e))&&(i=oa.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:ra(r,i)})),n=oa.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?ca(c[0].x):sa(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function ua(e,t){var n=typeof t,r;return t==null||n===`boolean`?Ki(t):(n===`number`?ra:n===`string`?(r=Yr(t))?(t=r,Qi):la:t instanceof Yr?Qi:t instanceof Date?na:ea(t)?$i:Array.isArray(t)?ta:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?ia:ra)(e,t)}var da=180/Math.PI,fa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pa(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*da,skewX:Math.atan(c)*da,scaleX:o,scaleY:s}}var ma;function ha(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?fa:pa(t.a,t.b,t.c,t.d,t.e,t.f)}function ga(e){return e==null||(ma||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),ma.setAttribute(`transform`,e),!(e=ma.transform.baseVal.consolidate()))?fa:(e=e.matrix,pa(e.a,e.b,e.c,e.d,e.e,e.f))}function _a(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:ra(e,i)},{i:c-2,x:ra(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:ra(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:ra(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:ra(e,n)},{i:s-2,x:ra(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var va=_a(ha,`px, `,`px)`,`deg)`),ya=_a(ga,`, `,`)`,`)`),ba=1e-12;function xa(e){return((e=Math.exp(e))+1/e)/2}function Sa(e){return((e=Math.exp(e))-1/e)/2}function Ca(e){return((e=Math.exp(2*e))-1)/(e+1)}var wa=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<ba)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=xa(y),c=s/(n*g)*(i*Ca(t*r+y)-Sa(y));return[a+c*d,o+c*f,s*i/xa(t*r+y)]}}return m.duration=Math.abs(h)*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4);function Ta(e){return(function t(n){n=+n;function r(t,r){var i=e((t=Wi(t)).h,(r=Wi(r)).h),a=Zi(t.s,r.s),o=Zi(t.l,r.l),s=Zi(t.opacity,r.opacity);return function(e){return t.h=i(e),t.s=a(e),t.l=o(e**+n),t.opacity=s(e),t+``}}return r.gamma=t,r})(1)}Ta(Yi),Ta(Zi);var Ea=0,Da=0,Oa=0,ka=1e3,Aa,ja,Ma=0,Na=0,Pa=0,Fa=typeof performance==`object`&&performance.now?performance:Date,Ia=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function La(){return Na||=(Ia(Ra),Fa.now()+Pa)}function Ra(){Na=0}function za(){this._call=this._time=this._next=null}za.prototype=Ba.prototype={constructor:za,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?La():+n)+(t==null?0:+t),!this._next&&ja!==this&&(ja?ja._next=this:Aa=this,ja=this),this._call=e,this._time=n,Ga()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ga())}};function Ba(e,t,n){var r=new za;return r.restart(e,t,n),r}function Va(){La(),++Ea;for(var e=Aa,t;e;)(t=Na-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ea}function Ha(){Na=(Ma=Fa.now())+Pa,Ea=Da=0;try{Va()}finally{Ea=0,Wa(),Na=0}}function Ua(){var e=Fa.now(),t=e-Ma;t>ka&&(Pa-=t,Ma=e)}function Wa(){for(var e,t=Aa,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Aa=n);ja=e,Ga(r)}function Ga(e){Ea||(Da&&=clearTimeout(Da),e-Na>24?(e<1/0&&(Da=setTimeout(Ha,Math.ceil(e-Fa.now()-Pa)+1)),Oa&&=clearInterval(Oa)):(Oa||=(Ma=Fa.now(),setInterval(Ua,ka)),Ea=1,Ia(Ha)))}function Ka(e,t,n){var r=new za;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}function qa(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ja=3;(function e(t){t=+t;function n(e){return e**+t}return n.exponent=e,n})(Ja),(function e(t){t=+t;function n(e){return 1-(1-e)**t}return n.exponent=e,n})(Ja),(function e(t){t=+t;function n(e){return((e*=2)<=1?e**+t:2-(2-e)**t)/2}return n.exponent=e,n})(Ja);function Ya(e){return(2**(-10*e)-.0009765625)*1.0009775171065494}var Xa=4/11;1/Xa/Xa;var Za=1.70158;(function e(t){t=+t;function n(e){return(e=+e)*e*(t*(e-1)+e)}return n.overshoot=e,n})(Za),(function e(t){t=+t;function n(e){return--e*e*((e+1)*t+e)+1}return n.overshoot=e,n})(Za),(function e(t){t=+t;function n(e){return((e*=2)<1?e*e*((t+1)*e-t):(e-=2)*e*((t+1)*e+t)+2)/2}return n.overshoot=e,n})(Za);var Qa=2*Math.PI,$a=1,eo=.3;(function e(t,n){var r=Math.asin(1/(t=Math.max(1,t)))*(n/=Qa);function i(e){return t*Ya(- --e)*Math.sin((r-e)/n)}return i.amplitude=function(t){return e(t,n*Qa)},i.period=function(n){return e(t,n)},i})($a,eo),(function e(t,n){var r=Math.asin(1/(t=Math.max(1,t)))*(n/=Qa);function i(e){return 1-t*Ya(e=+e)*Math.sin((e+r)/n)}return i.amplitude=function(t){return e(t,n*Qa)},i.period=function(n){return e(t,n)},i})($a,eo),(function e(t,n){var r=Math.asin(1/(t=Math.max(1,t)))*(n/=Qa);function i(e){return((e=e*2-1)<0?t*Ya(-e)*Math.sin((r-e)/n):2-t*Ya(e)*Math.sin((r+e)/n))/2}return i.amplitude=function(t){return e(t,n*Qa)},i.period=function(n){return e(t,n)},i})($a,eo);var to=ot(`start`,`end`,`cancel`,`interrupt`),no=[],ro=0,io=1,ao=2,oo=3,so=4,co=5,lo=6;function uo(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;ho(e,n,{name:t,index:r,group:i,on:to,tween:no,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:ro})}function fo(e,t){var n=mo(e,t);if(n.state>ro)throw Error(`too late; already scheduled`);return n}function po(e,t){var n=mo(e,t);if(n.state>oo)throw Error(`too late; already running`);return n}function mo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function ho(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Ba(a,0,n.time);function a(e){n.state=io,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==io)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===oo)return Ka(o);f.state===so?(f.state=lo,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=lo,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Ka(function(){n.state===oo&&(n.state=so,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=ao,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===ao){for(n.state=oo,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=co,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===co&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=lo,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function go(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n)(r=n[o]).name===t?(i=r.state>ao&&r.state<co,r.state=lo,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]):a=!1;a&&delete e.__transition}}function _o(e){return this.each(function(){go(this,e)})}function vo(e,t){var n,r;return function(){var i=po(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function yo(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=po(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function bo(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=mo(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?vo:yo)(n,e,t))}function xo(e,t,n){var r=e._id;return e.each(function(){var e=po(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return mo(e,r).value[t]}}function So(e,t){var n;return(typeof t==`number`?ra:t instanceof Yr?Qi:(n=Yr(t))?(t=n,Qi):la)(e,t)}function Co(e){return function(){this.removeAttribute(e)}}function wo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function To(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Eo(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Do(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Oo(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function ko(e,t){var n=pt(e),r=n===`transform`?ya:So;return this.attrTween(e,typeof t==`function`?(n.local?Oo:Do)(n,r,xo(this,`attr.`+e,t)):t==null?(n.local?wo:Co)(n):(n.local?Eo:To)(n,r,t))}function Ao(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function jo(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Mo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&jo(e,i)),n}return i._value=t,i}function Z(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ao(e,i)),n}return i._value=t,i}function No(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=pt(e);return this.tween(n,(r.local?Mo:Z)(r,t))}function Po(e,t){return function(){fo(this,e).delay=+t.apply(this,arguments)}}function Fo(e,t){return t=+t,function(){fo(this,e).delay=t}}function Io(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Po:Fo)(t,e)):mo(this.node(),t).delay}function Lo(e,t){return function(){po(this,e).duration=+t.apply(this,arguments)}}function Ro(e,t){return t=+t,function(){po(this,e).duration=t}}function zo(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Lo:Ro)(t,e)):mo(this.node(),t).duration}function Bo(e,t){if(typeof t!=`function`)throw Error();return function(){po(this,e).ease=t}}function Vo(e){var t=this._id;return arguments.length?this.each(Bo(t,e)):mo(this.node(),t).ease}function Ho(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();po(this,e).ease=n}}function Uo(e){if(typeof e!=`function`)throw Error();return this.each(Ho(this._id,e))}function Wo(e){typeof e!=`function`&&(e=Tt(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new ys(r,this._parents,this._name,this._id)}function Go(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new ys(o,this._parents,this._name,this._id)}function Ko(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function qo(e,t,n){var r,i,a=Ko(t)?fo:po;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function Jo(e,t){var n=this._id;return arguments.length<2?mo(this.node(),n).on.on(e):this.each(qo(n,e,t))}function Yo(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Xo(){return this.on(`end.remove`,Yo(this._id))}function Zo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=vt(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,uo(l[f],t,n,f,l,mo(u,n)));return new ys(a,this._parents,t,n)}function Qo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=St(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=mo(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&uo(p,t,n,h,f,m);a.push(f),o.push(u)}return new ys(a,o,t,n)}var $o=cr.prototype.constructor;function es(){return new $o(this._groups,this._parents)}function ts(e,t){var n,r,i;return function(){var a=hn(this,e),o=(this.style.removeProperty(e),hn(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function ns(e){return function(){this.style.removeProperty(e)}}function rs(e,t,n){var r,i=n+``,a;return function(){var o=hn(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function is(e,t,n){var r,i,a;return function(){var o=hn(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),hn(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function as(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=po(this,e),l=c.on,u=c.value[a]==null?s||=ns(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function os(e,t,n){var r=(e+=``)==`transform`?va:So;return t==null?this.styleTween(e,ts(e,r)).on(`end.style.`+e,ns(e)):typeof t==`function`?this.styleTween(e,is(e,r,xo(this,`style.`+e,t))).each(as(this._id,e)):this.styleTween(e,rs(e,r,t),n).on(`end.style.`+e,null)}function ss(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function cs(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&ss(e,a,n)),r}return a._value=t,a}function ls(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,cs(e,t,n??``))}function us(e){return function(){this.textContent=e}}function ds(e){return function(){var t=e(this);this.textContent=t??``}}function fs(e){return this.tween(`text`,typeof e==`function`?ds(xo(this,`text`,e)):us(e==null?``:e+``))}function ps(e){return function(t){this.textContent=e.call(this,t)}}function ms(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ps(r)),t}return r._value=e,r}function hs(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,ms(e))}function gs(){for(var e=this._name,t=this._id,n=bs(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=mo(c,t);uo(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ys(r,this._parents,e,n)}function _s(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=po(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var vs=0;function ys(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function bs(){return++vs}var xs=cr.prototype;ys.prototype={constructor:ys,select:Zo,selectAll:Qo,selectChild:xs.selectChild,selectChildren:xs.selectChildren,filter:Wo,merge:Go,selection:es,transition:gs,call:xs.call,nodes:xs.nodes,node:xs.node,size:xs.size,empty:xs.empty,each:xs.each,on:Jo,attr:ko,attrTween:No,style:os,styleTween:ls,text:fs,textTween:hs,remove:Xo,tween:bo,delay:Io,duration:zo,ease:Vo,easeVarying:Uo,end:_s,[Symbol.iterator]:xs[Symbol.iterator]};var Ss={time:null,delay:0,duration:250,ease:qa};function Cs(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function ws(e){var t,n;e instanceof ys?(t=e._id,e=e._name):(t=bs(),(n=Ss).time=La(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&uo(c,e,t,l,o,n||Cs(c,t));return new ys(r,this._parents,e,t)}cr.prototype.interrupt=_o,cr.prototype.transition=ws;var Ts=e=>()=>e;function Es(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ds(e,t,n){this.k=e,this.x=t,this.y=n}Ds.prototype={constructor:Ds,scale:function(e){return e===1?this:new Ds(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ds(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Os=new Ds(1,0,0);ks.prototype=Ds.prototype;function ks(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Os;return e.__zoom}function As(e){e.stopImmediatePropagation()}function js(e){e.preventDefault(),e.stopImmediatePropagation()}function Ms(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Ns(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ps(){return this.__zoom||Os}function Fs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Is(){return navigator.maxTouchPoints||`ontouchstart`in this}function Ls(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Rs(){var e=Ms,t=Ns,n=Ls,r=Fs,i=Is,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=wa,l=ot(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Ps).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Ps),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Os.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Ds(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Ds(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Ds(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=ur(this.that).datum();l.call(e,this.that,new Es(e,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=hr(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],go(this),s.start();js(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=ur(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=hr(t,i),l=t.clientX,u=t.clientY;br(t.view),As(t),a.mouse=[c,this.__zoom.invert(c)],go(this),a.start();function d(e){if(js(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=hr(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),xr(e.view,a.moved),js(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=hr(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);js(r),s>0?ur(this).transition().duration(s).call(x,d,c,r):ur(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(As(t),s=0;s<i;++s)c=r[s],l=hr(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),go(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(js(e),s=0;s<a;++s)c=i[s],l=hr(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(As(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=hr(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=ur(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Ts(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Ts(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Ts(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Ts([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var zs={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Bs=[[-1/0,-1/0],[1/0,1/0]],Vs=[`Enter`,` `,`Escape`],Hs={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},Us;(function(e){e.Strict=`strict`,e.Loose=`loose`})(Us||={});var Ws;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Ws||={});var Gs;(function(e){e.Partial=`partial`,e.Full=`full`})(Gs||={});var Ks={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},qs;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(qs||={});var Js;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(Js||={});var Q;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Q||={});var Ys={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top},Xs=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,Zs=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),Qs=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),$s=(e,t=[0,0])=>{let{width:n,height:r}=Nc(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},ec=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((e,r)=>{let i=typeof r==`string`,a=!t.nodeLookup&&!i?r:void 0;return t.nodeLookup&&(a=i?t.nodeLookup.get(r):Qs(r)?r:t.nodeLookup.get(r.id)),a?(n=!0,pc(e,_c(a,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?hc(r):{x:0,y:0,width:0,height:0}},tc=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=pc(n,_c(e)),r=!0)}),r?hc(n):{x:0,y:0,width:0,height:0}},nc=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=yc(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},rc=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function ic(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=Nc(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function ac({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=Ac(tc(ic(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function oc({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent){if(!s)a?.(`005`,zs.error005());else{let{width:e,height:t}=Nc(s);e&&t&&(d=[[c,l],[c+e,l+t]])}}else s&&Mc(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=Mc(d)?lc(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,zs.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function sc({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=rc(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var cc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lc=(e={x:0,y:0},t,n)=>({x:cc(e.x,t[0][0],t[1][0]-(n?.width??0)),y:cc(e.y,t[0][1],t[1][1]-(n?.height??0))});function uc(e,t,n){let{width:r,height:i}=Nc(n),{x:a,y:o}=n.internals.positionAbsolute;return lc(e,[[a,o],[a+r,o+i]],t)}var dc=(e,t,n)=>e<t?cc(Math.abs(e-t),1,t)/t:e>n?-cc(Math.abs(e-n),1,t)/t:0,fc=(e,t,n=15,r=40)=>[dc(e.x,r,t.width-r)*n,dc(e.y,r,t.height-r)*n],pc=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),mc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),hc=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),gc=(e,t=[0,0])=>{let{x:n,y:r}=Qs(e)?e.internals.positionAbsolute:$s(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},_c=(e,t=[0,0])=>{let{x:n,y:r}=Qs(e)?e.internals.positionAbsolute:$s(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},vc=(e,t)=>hc(pc(mc(e),mc(t))),yc=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},bc=(e,t)=>yc(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),xc=e=>Sc(e.width)&&Sc(e.height)&&Sc(e.x)&&Sc(e.y),Sc=e=>!isNaN(e)&&isFinite(e),Cc=(e,t)=>(e,t)=>{},wc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Tc=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?wc(s,o):s},Ec=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Dc(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Oc(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=Dc(e,n),i=Dc(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=Dc(e.top??e.y??0,n),i=Dc(e.bottom??e.y??0,n),a=Dc(e.left??e.x??0,t),o=Dc(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function kc(e,t,n,r,i,a){let{x:o,y:s}=Ec(e,[t,n,r]),{x:c,y:l}=Ec({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var Ac=(e,t,n,r,i,a)=>{let o=Oc(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=cc(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=kc(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},jc=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function Mc(e){return e!=null&&e!==`parent`}function Nc(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Pc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Fc(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function Ic(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Lc(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Rc(e){return{...Hs,...e||{}}}function zc(e){return e===null?null:e?`valid`:`invalid`}function Bc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Kc(e),s=Tc({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?wc(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var Vc=e=>({width:e.offsetWidth,height:e.offsetHeight}),Hc=e=>e?.getRootNode?.()||window?.document,Uc=[`INPUT`,`SELECT`,`TEXTAREA`];function Wc(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Uc.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Gc=e=>`clientX`in e,Kc=(e,t)=>{let n=Gc(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},qc=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Vc(t)}})};function Jc({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function Yc(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Xc({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Q.Left:return[t-Yc(t-r,a),n];case Q.Right:return[t+Yc(r-t,a),n];case Q.Top:return[t,n-Yc(n-i,a)];case Q.Bottom:return[t,n+Yc(i-n,a)]}}function Zc({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){let[s,c]=Xc({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Xc({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Jc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Qc({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function $c({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function el({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=pc(_c(e),_c(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),bc({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},hc(a))>0}var tl=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,nl=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),rl=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,zs.error006()),t;let r=n.getEdgeId||tl,i;return i=Xs(e)?{...e}:{...e,id:r(e)},nl(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function il({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Qc({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var al={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},ol=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},sl=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),cl=(e,t,n)=>e.x===t.x&&t.x===n.x&&(t.y-e.y)*(n.y-t.y)>=0||e.y===t.y&&t.y===n.y&&(t.x-e.x)*(n.x-t.x)>=0;function ll({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:i,offset:a,stepPosition:o}){let s=al[t],c=al[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=ol({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=Qc({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y},C=[];for(let t of[e,x,...m,S,n]){let[e,n]=C.slice(-2);n&&cl(e,n,t)&&C.pop(),C.push(t)}return[C,h,g,y,b]}function ul(e,t,n,r){let i=Math.min(sl(e,t)/2,sl(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function dl({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=ll({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=ul(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function fl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pl(e){let{sourceNode:t,targetNode:n}=e;if(!fl(t)||!fl(n))return null;let r=t.internals.handleBounds||ml(t.handles),i=n.internals.handleBounds||ml(n.handles),a=gl(r?.source??[],e.sourceHandle),o=gl(e.connectionMode===Us.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,zs.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||Q.Bottom,c=o?.position||Q.Top,l=hl(t,a,s),u=hl(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function ml(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function hl(e,t,n=Q.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??Nc(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function gl(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function _l(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function vl(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=_l(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var yl=1e3,bl=10,xl={nodeOrigin:[0,0],nodeExtent:Bs,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},Sl={...xl,checkEquality:!0};function Cl(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function wl(e,t,n){let r=Cl(xl,n);for(let n of e.values())if(n.parentId)kl(n,e,t,r);else{let e=lc($s(n,r.nodeOrigin),Mc(n.extent)?n.extent:r.nodeExtent,Nc(n));n.internals.positionAbsolute=e}}function Tl(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function El(e){return e===`manual`}function Dl(e,t,n,r={}){let i=Cl(Sl,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!El(i.zIndexMode)?yl:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=lc($s(u,i.nodeOrigin),Mc(u.extent)?u.extent:i.nodeExtent,Nc(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:Tl(u,e),z:Al(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}e.measured!==void 0&&e.measured.width!==void 0&&e.measured.height!==void 0||e.hidden||(c=!1),u.parentId&&kl(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Ol(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function kl(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=Cl(xl,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ol(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*bl),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=jl(e,u,o,s,a&&!El(c)?yl:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function Al(e,t,n){let r=Sc(e.zIndex)?e.zIndex:0;return El(n)?r:r+(e.selected?t:0)}function jl(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=Nc(e),l=$s(e,n),u=Mc(e.extent)?lc(l,e.extent,c):l,d=lc({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=uc(d,c,t));let f=Al(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function Ml(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=vc(a.get(n.parentId)?.expandedRect??gc(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=Nc(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function Nl(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=Vc(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=Mc(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=uc(h,s,n))}else m&&(h=lc(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:qc(`source`,r.nodeElement,p,d,e.id),target:qc(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&kl(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:gc(g,i)}))}}if(f.length>0){let e=Ml(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function Pl({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function Fl(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function Il(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;Fl(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),Fl(`target`,s,c,e,i,o),t.set(r.id,r)}}function Ll(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Ll(n,t):!1}function Rl(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function zl(e,t,n,r,i){let a=new Map;for(let[o,s]of e)if((i?s.id===r:s.selected||s.id===r)&&(i||!s.parentId||!Ll(s,e))&&(s.draggable||t&&s.draggable===void 0)){let t=e.get(o);t&&a.set(o,{id:o,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return a}function Bl({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function Vl({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=wc(a,t);return{x:o.x-a.x,y:o.y-a.y}}function Hl({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=ur(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?mc(tc(s)):null,x=v&&l?Vl({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:wc(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=oc({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=Bl({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=fc(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0;let v=!!b&&!o&&!i.get(b)?.selected;m&&y||o||!b||i.get(b)?.selected||_(),y&&m&&b&&e?.(b);let x=Bc(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=x,s=zl(i,c,x,b,v),s.size>0&&(n||h||!b&&g)){let[e,t]=Bl({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Or().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=Bc(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Kc(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=Bc(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=Kc(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=Kc(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p)p&&s.size>0&&t().updateNodePositions(s,!1);else if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=Bl({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!Rl(t,`.${g}`,v))&&(!_||Rl(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function Ul(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())bc(i,gc(e))>0&&r.push(e);return r}var Wl=250;function Gl(e,t,n,r){let i=[],a=1/0,o=Ul(e,n,t+Wl);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=hl(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function Kl(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...hl(o,c,c.position,!0)}:c}function ql(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Jl(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Yl=()=>!0;function Xl(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Yl,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=Hc(e.target),E=0,D,{x:O,y:k}=Kc(e),A=ql(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=Kl(i,A,r,c,t);if(!N)return;let P=Kc(e,j),F=!1,ee=null,I=!1,L=null;function R(){if(!u||!j)return;let[e,t]=fc(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(R)}let z={...N,nodeId:i,type:A,position:N.position},B=c.get(i),V={inProgress:!0,isValid:null,from:hl(B,z,Q.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:B,to:P,toHandle:null,toPosition:Ys[z.position],toNode:null,pointer:P};function H(){M=!0,y(V),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&H();function U(e){if(!M){let{x:t,y:n}=Kc(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;H()}if(!x()||!z){te(e);return}let a=b();P=Kc(e,j),D=Gl(Tc(P,a,!1,[1,1]),n,c,z),F||=(R(),!0);let s=Zl(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,ee=s.connection,I=Jl(!!D,s.isValid);let u=c.get(i),f=u?hl(u,z,Q.Left,!0):V.from,p={...V,from:f,isValid:I,to:s.toHandle&&I?Ec({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:Ys[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),V=p}function te(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&ee&&I&&h?.(ee);let{inProgress:t,...n}=V,r={...n,toPosition:V.toHandle?V.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,I=!1,ee=null,L=null,T.removeEventListener(`mousemove`,U),T.removeEventListener(`mouseup`,te),T.removeEventListener(`touchmove`,U),T.removeEventListener(`touchend`,te)}}T.addEventListener(`mousemove`,U),T.addEventListener(`mouseup`,te),T.addEventListener(`touchmove`,U),T.addEventListener(`touchend`,te)}function Zl(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Yl,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Kc(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=ql(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===Us.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=Kl(t,e,a,u,n,!0)}return _}var Ql={onPointerDown:Xl,isValid:Zl};function $l({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=ur(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&jc()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=Rs().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:hr}}var eu=e=>({x:e.x,y:e.y,zoom:e.k}),tu=({x:e,y:t,zoom:n})=>Os.translate(e,t).scale(n),nu=(e,t)=>e.target.closest(`.${t}`),ru=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),iu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,au=(e,t=0,n=iu,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},ou=e=>{let t=e.ctrlKey&&jc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function su({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(nu(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=hr(u),t=d*2**ou(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Ws.Vertical?0:u.deltaX*f,m=i===Ws.Horizontal?0:u.deltaY*f;!jc()&&u.shiftKey&&i!==Ws.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=eu(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function cu({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=nu(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function lu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=eu(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function uu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&ru(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,eu(a.transform))}}function du({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&ru(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=eu(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function fu({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:o,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:d}){return f=>{let p=t||n,m=r&&f.ctrlKey,h=f.type===`wheel`;if(f.button===1&&f.type===`mousedown`&&(nu(f,`${u}-flow__node`)||nu(f,`${u}-flow__edge`)||nu(f,`${u}-flow__selection`)||nu(f,`${u}-flow__nodesselection`)))return!0;if(!i&&!p&&!a&&!o&&!r||s||d&&!h||nu(f,c)&&h||nu(f,l)&&(!h||a&&h&&!t)||!r&&f.ctrlKey&&h)return!1;if(!r&&f.type===`touchstart`&&f.touches?.length>1)return f.preventDefault(),!1;if(!p&&!a&&!m&&h||!i&&(f.type===`mousedown`||f.type===`touchstart`)||Array.isArray(i)&&!i.includes(f.button)&&f.type===`mousedown`)return!1;let g=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h||e)&&g}}function pu({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]],f=typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t?.contentRect&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);let p=Rs().extent(()=>d).scaleExtent([t,n]).translateExtent(r),m=ur(e).call(p);b({x:i.x,y:i.y,zoom:cc(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let h=m.on(`wheel.zoom`),g=m.on(`dblclick.zoom`);p.wheelDelta(ou);async function _(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?ua:wa).transform(au(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function v({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:f,preventScrolling:_,zoomOnPinch:v,zoomOnScroll:y,zoomOnDoubleClick:b,panActivationKeyPressed:x=!1,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&p.on(`zoom`,null);let O=i&&!S&&!r;p.clickDistance(D?1/0:!Sc(E)||E<0?0:E);let k=O?su({zoomPanValues:l,noWheelClassName:e,d3Selection:m,d3Zoom:p,panOnScrollMode:d,panOnScrollSpeed:f,zoomOnPinch:v,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):cu({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:h});m.on(`wheel.zoom`,k,{passive:!1});let A=lu({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});p.on(`start`,A);let j=uu({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});p.on(`zoom`,j);let M=du({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});p.on(`end`,M);let N=fu({panActivationKeyPressed:x,zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:y,panOnScroll:i,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});p.filter(N),b?m.on(`dblclick.zoom`,g):m.on(`dblclick.zoom`,null)}function y(){p.on(`zoom`,null),f?.disconnect()}async function b(e,t,n){let r=tu(e),i=p?.constrain()(r,t,n);return i&&await _(i),i}async function x(e,t){let n=tu(e);return await _(n,t),n}function S(e){if(m){let t=tu(e),n=m.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&p?.transform(m,t,null,{sync:!0})}}function C(){let e=m?ks(m.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function w(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?ua:wa).scaleTo(au(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function T(e,t){return m?new Promise(n=>{p?.interpolate(t?.interpolate===`linear`?ua:wa).scaleBy(au(m,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function E(e){p?.scaleExtent(e)}function D(e){p?.translateExtent(e)}function O(e){let t=!Sc(e)||e<0?0:e;p?.clickDistance(t)}return{update:v,destroy:y,setViewport:x,setViewportConstrained:b,getViewport:C,scaleTo:w,scaleBy:T,setScaleExtent:E,setTranslateExtent:D,syncViewport:S,setClickDistance:O}}var mu;(function(e){e.Line=`line`,e.Handle=`handle`})(mu||={});function hu({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function gu(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function _u(e,t){return Math.max(0,t-e)}function vu(e,t){return Math.max(0,e-t)}function yu(e,t,n){return Math.max(0,t-e,e-n)}function bu(e,t){return e?!t:t}function xu(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=yu(E,h,g),j=yu(D,_,v);if(o){let e=0,t=0;c&&w<0?e=_u(y+w+O,o[0][0]):!c&&w>0&&(e=vu(y+E+O,o[1][0])),l&&T<0?t=_u(b+T+k,o[0][1]):!l&&T>0&&(t=vu(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=vu(y+w,s[0][0]):!c&&w<0&&(e=_u(y+E,s[1][0])),l&&T>0?t=vu(b+T,s[0][1]):!l&&T<0&&(t=_u(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=yu(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?vu(b+k+E/C,o[1][1])*C:_u(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?_u(b+E/C,s[1][1])*C:vu(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=yu(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?vu(y+D*C+O,o[1][0])/C:_u(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?_u(y+D*C,s[1][0])/C:vu(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(bu(c,l)?-w:w)/C:w=(bu(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Su={width:0,height:0,x:0,y:0},Cu={...Su,pointerX:0,pointerY:0,aspectRatio:1};function wu(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function Tu({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=ur(e),o={controlDirection:gu(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...Su},h={...Cu};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:gu(e)};let g,_=null,v=[],y,b,x,S=Or().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=Bc(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=Mc(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=wu(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=Bc(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:S,height:C}=m,w={},T=g.origin??s,{width:E,height:D,x:O,y:k}=xu(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,T,b,x),A=E!==S,j=D!==C,M=O!==u&&A,N=k!==f&&j;if(!M&&!N&&!A&&!j)return;let P={prevValues:{...m},startX:h.x,startY:h.y,childNodes:v.map(e=>({...e,position:{...e.position}}))};if((M||N||T[0]===1||T[1]===1)&&(w.x=M?O:m.x,w.y=N?k:m.y,m.x=w.x,m.y=w.y,v.length>0)){let e=O-u,t=k-f;for(let n of v)n.position={x:n.position.x-e+T[0]*(E-S),y:n.position.y-t+T[1]*(D-C)},l.push(n)}if((A||j)&&(w.width=A&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?E:m.width,w.height=j&&(!o.resizeDirection||o.resizeDirection===`vertical`)?D:m.height,m.width=w.width,m.height=w.height),y&&g.expandParent){let e=T[0]*(w.width??0);w.x&&w.x<e&&(m.x=e,h.x-=w.x-e);let t=T[1]*(w.height??0);w.y&&w.y<t&&(m.y=t,h.y-=w.y-t)}let F=hu({width:m.width,prevWidth:S,height:m.height,prevHeight:C,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),ee={...m,direction:F};p?.(e,ee)===!1?(m=P.prevValues,h.x=P.startX,h.y=P.startY,v.forEach((e,t)=>{e.position=P.childNodes[t].position})):(d?.(e,ee),r(w,l))}).on(`end`,e=>{f?.(e,{...m}),i?.({...m})});a.call(S)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var Eu=ae((e=>{var t=te();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Du=ae(((e,t)=>{t.exports=Eu()})),Ou=ae((e=>{var t=te(),n=Du();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),ku=e(ae(((e,t)=>{t.exports=Ou()}))(),1),Au=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},ju=e=>e?Au(e):Au,{useDebugValue:Mu}=J.default,{useSyncExternalStoreWithSelector:Nu}=ku.default,Pu=e=>e;function Fu(e,t=Pu,n){let r=Nu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Mu(r),r}var Iu=(e,t)=>{let n=ju(e),r=(e,r=t)=>Fu(n,e,r);return Object.assign(r,n),r},Lu=(e,t)=>e?Iu(e,t):Iu;function Ru(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var zu=e(re()),Bu=(0,J.createContext)(null),Vu=Bu.Provider,Hu=zs.error001(`react`);function $(e,t){let n=(0,J.useContext)(Bu);if(n===null)throw Error(Hu);return Fu(n,e,t)}function Uu(){let e=(0,J.useContext)(Bu);if(e===null)throw Error(Hu);return(0,J.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var Wu={display:`none`},Gu={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},Ku=`react-flow__node-desc`,qu=`react-flow__edge-desc`,Ju=`react-flow__aria-live`,Yu=e=>e.ariaLiveMessage,Xu=e=>e.ariaLabelConfig;function Zu({rfId:e}){let t=$(Yu);return(0,Y.jsx)(`div`,{id:`${Ju}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Gu,children:t})}function Qu({rfId:e,disableKeyboardA11y:t}){let n=$(Xu);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{id:`${Ku}-${e}`,style:Wu,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,Y.jsx)(`div`,{id:`${qu}-${e}`,style:Wu,children:n[`edge.a11yDescription.default`]}),!t&&(0,Y.jsx)(Zu,{rfId:e})]})}var $u=(0,J.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>{let o=`${e}`.split(`-`);return(0,Y.jsx)(`div`,{className:it([`react-flow__panel`,n,...o]),style:r,ref:a,...i,children:t})});$u.displayName=`Panel`;var ed=`https://reactflow.dev?utm_source=attribution`;function td({proOptions:e,position:t=`bottom-right`}){return(0,J.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,Y.jsx)($u,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ed}`,children:(0,Y.jsx)(`a`,{href:ed,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var nd=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},rd=e=>e.id;function id(e,t){return Ru(e.selectedNodes.map(rd),t.selectedNodes.map(rd))&&Ru(e.selectedEdges.map(rd),t.selectedEdges.map(rd))}function ad({onSelectionChange:e}){let t=Uu(),{selectedNodes:n,selectedEdges:r}=$(nd,id);return(0,J.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var od=e=>!!e.onSelectionChangeHandlers;function sd({onSelectionChange:e}){let t=$(od);return e||t?(0,Y.jsx)(ad,{onSelectionChange:e}):null}var cd=[0,0],ld={x:0,y:0,zoom:1},ud=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],dd=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),fd={translateExtent:Bs,nodeOrigin:cd,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function pd(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=$(dd,Ru),l=Uu();(0,J.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=fd,s()}),[]);let u=(0,J.useRef)(fd);return(0,J.useEffect)(()=>{for(let s of ud){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:Rc(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},ud.map(t=>e[t])),null}function md(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function hd(e){let[t,n]=(0,J.useState)(e===`system`?null:e);return(0,J.useEffect)(()=>{if(e!==`system`){n(e);return}let t=md(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?md()?.matches?`dark`:`light`:t}var gd=typeof document<`u`?document:null;function _d(e=null,t={target:gd,actInsideInputWithModifier:!0}){let[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(!1),a=(0,J.useRef)(new Set([])),[o,s]=(0,J.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(/\+/g,`
11
+ `).replace(`
12
+
13
+ `,`
14
+ +`).split(`
15
+ `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,J.useEffect)(()=>{let n=t?.target??gd,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&Wc(e))return!1;let n=yd(e.code,s);if(a.current.add(e[n]),vd(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=yd(e.code,s);vd(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function vd(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function yd(e,t){return t.includes(e)?`code`:`key`}var bd=()=>{let e=Uu();return(0,J.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=Ac(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return Tc(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=Ec(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function xd(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)Sd(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function Sd(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing)}}function Cd(e,t){return xd(e,t)}function wd(e,t){return xd(e,t)}function Td(e,t){return{id:e,type:`select`,selected:t}}function Ed(e,t=new Set){let n=[];for(let[r,i]of e){let e=t.has(r);(i.selected!==void 0||e)&&i.selected!==e&&n.push(Td(i.id,e))}return n}function Dd({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function Od(e){return{id:e.id,type:`remove`}}var kd=Cc(`React Flow`,`https://reactflow.dev/`);function Ad(e,t,n={}){return rl(e,t,{...n,onError:n.onError??kd})}var jd=e=>Zs(e),Md=e=>Xs(e);function Nd(e){return(0,J.forwardRef)(e)}var Pd=typeof window<`u`?J.useLayoutEffect:J.useEffect;function Fd(e){let[t,n]=(0,J.useState)(BigInt(0)),[r]=(0,J.useState)(()=>Id(()=>n(e=>e+BigInt(1))));return Pd(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Id(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Ld=(0,J.createContext)(null);function Rd({children:e}){let t=Uu(),n=Fd((0,J.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=Dd({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=Fd((0,J.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(Dd({items:s,lookup:o}))},[])),i=(0,J.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,Y.jsx)(Ld.Provider,{value:i,children:e})}function zd(){let e=(0,J.useContext)(Ld);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Bd=e=>!!e.panZoom;function Vd(){let e=bd(),t=Uu(),n=zd(),r=$(Bd),i=(0,J.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=jd(e)?e:n.get(e.id),a=i.parentId?Fc(i.position,i.measured,i.parentId,n,r):i.position;return gc({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height},i.parentId?void 0:r)},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&jd(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Md(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await sc({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Od);o?.(f),c(e)}if(m){let e=d.map(Od);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=xc(e),o=i?e:a(e),s=r!==void 0;if(!o)return[];let{nodeOrigin:c}=t.getState();return(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let l=gc(s?r:a,c),u=bc(l,o);return n&&u>0||u>=l.width*l.height||u>=o.width*o.height})},isNodeIntersecting:(e,t,n=!0)=>{let r=xc(e)?e:a(e);if(!r)return!1;let i=bc(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return ec(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??Lc();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,J.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Hd=e=>e.selected,Ud=typeof window<`u`?window:void 0;function Wd({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=Uu(),{deleteElements:r}=Vd(),i=_d(e,{actInsideInputWithModifier:!1}),a=_d(t,{target:Ud});(0,J.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Hd),edges:e.filter(Hd)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,J.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function Gd(e){let t=Uu();(0,J.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Vc(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,zs.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t.disconnect()}}},[])}var Kd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},qd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Jd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panActivationKeyPressed:i,panOnScrollSpeed:a=.5,panOnScrollMode:o=Ws.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:m=!0,children:h,noWheelClassName:g,noPanClassName:_,onViewportChange:v,isControlledViewport:y,paneClickDistance:b,selectionOnDrag:x}){let S=Uu(),C=(0,J.useRef)(null),{userSelectionActive:w,lib:T,connectionInProgress:E}=$(qd,Ru),D=_d(p),O=(0,J.useRef)();Gd(C);let k=(0,J.useCallback)(e=>{v?.({x:e[0],y:e[1],zoom:e[2]}),y||S.setState({transform:e})},[v,y]);return(0,J.useEffect)(()=>{if(C.current){O.current=pu({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:l,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=S.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=S.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=S.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=O.current.getViewport();return S.setState({panZoom:O.current,transform:[e,t,n],domNode:C.current.closest(`.react-flow`)}),()=>{O.current?.destroy()}}},[]),(0,J.useEffect)(()=>{O.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panActivationKeyPressed:i,panOnScrollSpeed:a,panOnScrollMode:o,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:D,preventScrolling:m,noPanClassName:_,userSelectionActive:w,noWheelClassName:g,lib:T,onTransformChange:k,connectionInProgress:E,selectionOnDrag:x,paneClickDistance:b})},[e,t,n,r,i,a,o,s,c,D,m,_,w,g,T,k,E,x,b]),(0,Y.jsx)(`div`,{className:`react-flow__renderer`,ref:C,style:Kd,children:h})}var Yd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Xd(){let{userSelectionActive:e,userSelectionRect:t}=$(Yd,Ru);return e&&t?(0,Y.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var Zd=(e,t)=>n=>{n.target===t.current&&e?.(n)},Qd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function $d({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Gs.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,J.useRef)(0),_=Uu(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=$(Qd,Ru),C=y&&(e||v),w=(0,J.useRef)(null),T=(0,J.useRef)(),E=(0,J.useRef)(new Set),D=(0,J.useRef)(new Set),O=(0,J.useRef)(!1),k=(0,J.useRef)(!1),A=(0,J.useRef)({x:0,y:0}),j=(0,J.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}let{connectionClickStartHandle:t,connection:n,onClickConnectEnd:r,resetSelectedElements:i}=_.getState();if(t){let t=structuredClone(n);delete t.inProgress,t.toPosition=t.toHandle?t.toHandle.position:null,r?.(e.nativeEvent,t),_.setState({connectionClickStartHandle:null})}l?.(e),i(),_.setState({nodesSelectionActive:!1})},N=e=>{Array.isArray(r)&&r?.includes(2)?e.preventDefault():u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},ee=n=>{if(n.pointerType===`touch`&&r!==!1&&!t)return;let{domNode:i,transform:a}=_.getState();if(T.current=i?.getBoundingClientRect(),!T.current)return;let s=n.target===w.current;if(!s&&n.target.closest(`.nokey`)||!e||!(o&&s||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:c,y:l}=Kc(n.nativeEvent,T.current),u=Tc({x:c,y:l},a);_.setState({userSelectionRect:{width:0,height:0,startX:u.x,startY:u.y,x:c,y:l}}),s||(n.stopPropagation(),n.preventDefault())};function I(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=Ec(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(nc(a,m,i,n===Gs.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}Ic(h,E.current)||c(Ed(a,E.current)),Ic(g,D.current)||l(Ed(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!T.current)return;let[e,t]=fc(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=A.current;I(t,n),g.current=requestAnimationFrame(L)})}let R=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};(0,J.useEffect)(()=>()=>R(),[]);let z=e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=Kc(e.nativeEvent,T.current);A.current={x:o,y:c};let l=Ec({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(L(),!0),I(o,c)},B=e=>{C?e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),R()):e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0)},V=e=>{e.target?.releasePointerCapture?.(e.pointerId),R()},H=r===!0||Array.isArray(r)&&r.includes(0);return(0,Y.jsxs)(`div`,{className:it([`react-flow__pane`,{draggable:H,dragging:b,selection:e}]),onClick:C?void 0:Zd(M,w),onContextMenu:Zd(N,w),onWheel:Zd(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?z:p,onPointerUp:B,onPointerCancel:C?V:void 0,onPointerDownCapture:C?ee:void 0,onClickCapture:C?F:void 0,onPointerLeave:m,ref:w,style:Kd,children:[h,(0,Y.jsx)(Xd,{})]})}function ef({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);l?(t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])):c?.(`012`,zs.error012(e))}function tf({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=Uu(),[c,l]=(0,J.useState)(!1),u=(0,J.useRef)();return(0,J.useEffect)(()=>{if(!t)return u.current=Hl({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{ef({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,J.useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var nf=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function rf(){let e=Uu();return(0,J.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=nf(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=wc(t,i));let{position:a,positionAbsolute:s}=oc({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var af=(0,J.createContext)(null),of=af.Provider;af.Consumer;var sf=()=>(0,J.useContext)(af),cf=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),lf=(0,J.createContext)(null);function uf({children:e}){let t=$(cf,Ru);return(0,Y.jsx)(lf.Provider,{value:t,children:e})}function df(){let e=(0,J.useContext)(lf);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var ff={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},pf=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return ff;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===Us.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function mf({type:e=`source`,position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=Uu(),_=sf(),{connectOnClick:v,noPanClassName:y,rfId:b}=df(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=$(pf(_,m,e),Ru);_||g.getState().onError?.(`010`,zs.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(Ad(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Gc(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Ql.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,Y.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:it([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=Hc(t.target),h=n||c,{connection:v,isValid:y}=Ql.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var hf=(0,J.memo)(Nd(mf));function gf({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[e?.label,(0,Y.jsx)(hf,{type:`source`,position:n,isConnectable:t})]})}function _f({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(hf,{type:`target`,position:n,isConnectable:t}),e?.label,(0,Y.jsx)(hf,{type:`source`,position:r,isConnectable:t})]})}function vf(){return null}function yf({data:e,isConnectable:t,targetPosition:n=Q.Top}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(hf,{type:`target`,position:n,isConnectable:t}),e?.label]})}var bf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},xf={input:gf,default:_f,output:yf,group:vf};function Sf(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Cf=e=>{let{width:t,height:n,x:r,y:i}=tc(e.nodeLookup,{filter:e=>!!e.selected});return{width:Sc(t)?t:null,height:Sc(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function wf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=Uu(),{width:i,height:a,transformString:o,userSelectionActive:s}=$(Cf,Ru),c=rf(),l=(0,J.useRef)(null);(0,J.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(tf({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,Y.jsx)(`div`,{className:it([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,Y.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(bf,e.key)&&(e.preventDefault(),c({direction:bf[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var Tf=typeof window<`u`?window:void 0,Ef=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Df({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:ee}){let{nodesSelectionActive:I,userSelectionActive:L}=$(Ef,Ru),R=_d(l,{target:Tf}),z=_d(h,{target:Tf}),B=z||w,V=z||b,H=u&&B!==!0,U=R||L||H;return Wd({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,Y.jsx)(Jd,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:V,panActivationKeyPressed:z,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!R&&B,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:ee,paneClickDistance:s,selectionOnDrag:H,children:(0,Y.jsxs)($d,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:B,autoPanOnSelection:T,isSelecting:!!U,selectionMode:d,selectionKeyPressed:R,paneClickDistance:s,selectionOnDrag:H,children:[e,I&&(0,Y.jsx)(wf,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}Df.displayName=`FlowRenderer`;var Of=(0,J.memo)(Df),kf=e=>t=>e?nc(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function Af(e){return $((0,J.useCallback)(kf(e),[e]),Ru)}var jf=e=>e.updateNodeInternals;function Mf(){let e=$(jf),[t]=(0,J.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,J.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Nf({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=Uu(),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(e.sourcePosition),c=(0,J.useRef)(e.targetPosition),l=(0,J.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,J.useEffect)(()=>{!a.current||e.hidden||u&&o.current===a.current||(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,J.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,J.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Pf({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=$(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},Ru),S=y.type||`default`,C=g?.[S]||xf[S];C===void 0&&(v?.(`003`,zs.error003(S)),S=`default`,C=g?.default||xf.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=Uu(),k=Pc(y),A=Nf({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=tf({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=rf();if(y.hidden)return null;let N=Nc(y),P=Sf(y),F=T||w||t||n||r||i,ee=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,R=a?e=>a(e,{...b.userNode}):void 0,z=o?e=>o(e,{...b.userNode}):void 0,B=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&ef({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},V=t=>{if(!(Wc(t.nativeEvent)||m)){if(Vs.includes(t.key)&&T){let n=t.key===`Escape`;ef({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(bf,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:bf[t.key],factor:t.shiftKey?4:1})}}},H=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(nc(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,Y.jsx)(`div`,{className:it([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:ee,onMouseMove:I,onMouseLeave:L,onContextMenu:R,onClick:B,onDoubleClick:z,onKeyDown:D?V:void 0,tabIndex:D?0:void 0,onFocus:D?H:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${Ku}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,Y.jsx)(of,{value:e,children:(0,Y.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var Ff=(0,J.memo)(Pf),If=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Lf(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=$(If,Ru),a=Af(e.onlyRenderVisibleElements),o=Mf();return(0,Y.jsx)(`div`,{className:`react-flow__nodes`,style:Kd,children:a.map(a=>(0,Y.jsx)(Ff,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}Lf.displayName=`NodeRenderer`;var Rf=(0,J.memo)(Lf);function zf(e){return $((0,J.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&el({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),Ru)}var Bf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e}};return(0,Y.jsx)(`polyline`,{className:`arrow`,style:n,strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`})},Vf=({color:e=`none`,strokeWidth:t=1})=>{let n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,Y.jsx)(`polyline`,{className:`arrowclosed`,style:n,strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`})},Hf={[Js.Arrow]:Bf,[Js.ArrowClosed]:Vf};function Uf(e){let t=Uu();return(0,J.useMemo)(()=>Object.prototype.hasOwnProperty.call(Hf,e)?Hf[e]:(t.getState().onError?.(`009`,zs.error009(e)),null),[e])}var Wf=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Uf(t);return c?(0,Y.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,Y.jsx)(c,{color:n,strokeWidth:o})}):null},Gf=({defaultColor:e,rfId:t})=>{let n=$(e=>e.edges),r=$(e=>e.defaultEdgeOptions),i=(0,J.useMemo)(()=>vl(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,Y.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,Y.jsx)(`defs`,{children:i.map(e=>(0,Y.jsx)(Wf,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Gf.displayName=`MarkerDefinitions`;var Kf=(0,J.memo)(Gf);function qf({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,J.useState)({x:1,y:0,width:0,height:0}),p=it([`react-flow__edge-textwrapper`,l]),m=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,Y.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,Y.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,Y.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}qf.displayName=`EdgeText`;var Jf=(0,J.memo)(qf);function Yf({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`path`,{...u,d:e,fill:`none`,className:it([`react-flow__edge-path`,u.className])}),l?(0,Y.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&Sc(t)&&Sc(n)?(0,Y.jsx)(Jf,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Xf({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Zf({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:i,targetPosition:a=Q.Top}){let[o,s]=Xf({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Xf({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Jc({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Qf(e){return(0,J.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Zf({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),x=e.isInternal?void 0:t;return(0,Y.jsx)(Yf,{id:x,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var $f=Qf({isInternal:!1}),ep=Qf({isInternal:!0});$f.displayName=`SimpleBezierEdge`,ep.displayName=`SimpleBezierEdgeInternal`;function tp(e){return(0,J.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=Q.Bottom,targetPosition:m=Q.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=dl({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition}),S=e.isInternal?void 0:t;return(0,Y.jsx)(Yf,{id:S,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var np=tp({isInternal:!1}),rp=tp({isInternal:!0});np.displayName=`SmoothStepEdge`,rp.displayName=`SmoothStepEdgeInternal`;function ip(e){return(0,J.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,Y.jsx)(np,{...n,id:r,pathOptions:(0,J.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var ap=ip({isInternal:!1}),op=ip({isInternal:!0});ap.displayName=`StepEdge`,op.displayName=`StepEdgeInternal`;function sp(e){return(0,J.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=il({sourceX:n,sourceY:r,targetX:i,targetY:a}),y=e.isInternal?void 0:t;return(0,Y.jsx)(Yf,{id:y,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var cp=sp({isInternal:!1}),lp=sp({isInternal:!0});cp.displayName=`StraightEdge`,lp.displayName=`StraightEdgeInternal`;function up(e){return(0,J.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Zc({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature}),S=e.isInternal?void 0:t;return(0,Y.jsx)(Yf,{id:S,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var dp=up({isInternal:!1}),fp=up({isInternal:!0});dp.displayName=`BezierEdge`,fp.displayName=`BezierEdgeInternal`;var pp={default:fp,straight:lp,step:op,smoothstep:rp,simplebezier:ep},mp={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},hp=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,gp=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,_p=`react-flow__edgeupdater`;function vp({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,Y.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:it([_p,`${_p}-${s}`]),cx:hp(t,r,e),cy:gp(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function yp({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=Uu(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;Ql.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,Y.jsxs)(Y.Fragment,{children:[(e===!0||e===`source`)&&(0,Y.jsx)(vp,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,Y.jsx)(vp,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function bp({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=$(t=>t.edgeLookup.get(e)),b=$(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||pp[x];S===void 0&&(_?.(`011`,zs.error011(x)),x=`default`,S=h?.default||pp.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,J.useRef)(null),[D,O]=(0,J.useState)(!1),[k,A]=(0,J.useState)(!1),j=Uu(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L}=$((0,J.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return mp;let i=pl({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=$c({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||mp,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex,_]),Ru),R=(0,J.useMemo)(()=>y.markerStart?`url('#${_l(y.markerStart,m)}')`:void 0,[y.markerStart,m]),z=(0,J.useMemo)(()=>y.markerEnd?`url('#${_l(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||ee===null)return null;let B=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},V=a?e=>{a(e,{...y})}:void 0,H=o?e=>{o(e,{...y})}:void 0,U=s?e=>{s(e,{...y})}:void 0,te=c?e=>{c(e,{...y})}:void 0,ne=l?e=>{l(e,{...y})}:void 0;return(0,Y.jsx)(`svg`,{style:{zIndex:M},children:(0,Y.jsxs)(`g`,{className:it([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:B,onDoubleClick:V,onContextMenu:H,onMouseEnter:U,onMouseMove:te,onMouseLeave:ne,onKeyDown:C?t=>{if(!v&&Vs.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${qu}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,Y.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:R,markerEnd:z,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,Y.jsx)(yp,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:ee,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var xp=(0,J.memo)(bp),Sp=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Cp({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=$(Sp,Ru),b=zf(t);return(0,Y.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,Y.jsx)(Kf,{defaultColor:e,rfId:n}),b.map(e=>(0,Y.jsx)(xp,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}Cp.displayName=`EdgeRenderer`;var wp=(0,J.memo)(Cp),Tp=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Ep({children:e}){let t=Uu(),n=(0,J.useRef)(null),[r]=(0,J.useState)(()=>t.getState().transform);return Pd(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=Tp(r)))};return r(),t.subscribe(r)},[t]),(0,Y.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:Tp(r)},children:e})}function Dp(e){let t=Vd(),n=(0,J.useRef)(!1);(0,J.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var Op=e=>e.panZoom?.syncViewport;function kp(e){let t=$(Op),n=Uu();return(0,J.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Ap(e){return e.connection.inProgress?{...e.connection,to:Tc(e.connection.to,e.transform)}:{...e.connection}}function jp(e){return e?t=>e(Ap(t)):Ap}function Mp(e){return $(jp(e),Ru)}var Np=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Pp({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=$(Np,Ru);return a&&i&&c?(0,Y.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,Y.jsx)(`g`,{className:it([`react-flow__connection`,zc(s)]),children:(0,Y.jsx)(Fp,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Fp=({style:e,type:t=qs.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=Mp();if(!i)return;if(n)return(0,Y.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:zc(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case qs.Bezier:[m]=Zc(h);break;case qs.SimpleBezier:[m]=Zf(h);break;case qs.Step:[m]=dl({...h,borderRadius:0});break;case qs.SmoothStep:[m]=dl(h);break;default:[m]=il(h)}return(0,Y.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};Fp.displayName=`ConnectionLine`;var Ip={};function Lp(e=Ip){(0,J.useRef)(e),Uu(),(0,J.useEffect)(()=>{},[e])}function Rp(){Uu(),(0,J.useRef)(!1),(0,J.useEffect)(()=>{},[])}function zp({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:ee,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:R,autoPanOnSelection:z,onPaneClick:B,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneScroll:te,onPaneContextMenu:ne,paneClickDistance:re,nodeClickDistance:ie,onEdgeContextMenu:ae,onEdgeMouseEnter:W,onEdgeMouseMove:G,onEdgeMouseLeave:oe,reconnectRadius:se,onReconnect:ce,onReconnectStart:le,onReconnectEnd:ue,noDragClassName:K,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:pe,nodeExtent:me,rfId:he,viewport:ge,onViewportChange:_e,nodesDraggable:ve}){return Lp(e),Lp(t),Rp(),Dp(n),kp(ge),(0,Y.jsx)(Of,{onPaneClick:B,onPaneMouseEnter:V,onPaneMouseMove:H,onPaneMouseLeave:U,onPaneContextMenu:ne,onPaneScroll:te,paneClickDistance:re,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:F,panOnScrollSpeed:ee,panOnScrollMode:I,panOnDrag:R,autoPanOnSelection:z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:K,noWheelClassName:de,noPanClassName:fe,disableKeyboardA11y:pe,onViewportChange:_e,isControlledViewport:!!ge,children:(0,Y.jsxs)(Ep,{children:[(0,Y.jsx)(wp,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ce,onReconnectStart:le,onReconnectEnd:ue,onlyRenderVisibleElements:T,onEdgeContextMenu:ae,onEdgeMouseEnter:W,onEdgeMouseMove:G,onEdgeMouseLeave:oe,reconnectRadius:se,defaultMarkerColor:M,noPanClassName:fe,disableKeyboardA11y:pe,rfId:he}),(0,Y.jsx)(Pp,{style:h,type:m,component:g,containerStyle:_}),(0,Y.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,Y.jsx)(Rf,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ie,onlyRenderVisibleElements:T,noPanClassName:fe,noDragClassName:K,disableKeyboardA11y:pe,nodeExtent:me,rfId:he,nodesDraggable:ve}),(0,Y.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}zp.displayName=`GraphView`;var Bp=(0,J.memo)(zp),Vp=Cc(`React Flow`,`https://reactflow.dev/`),Hp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??Bs;Il(h,g,_);let{nodesInitialized:x}=Dl(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=Ac(tc(p,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:Bs,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Us.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Ks},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Vp,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:Hs,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},Up=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>Lu((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await ac({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...Hp({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,fitViewQueued:o,zIndexMode:s,nodesSelectionActive:c}=m(),{nodesInitialized:l,hasSelectedNodes:u}=Dl(e,t,n,{nodeOrigin:r,nodeExtent:i,elevateNodesOnSelect:a,checkEquality:!0,zIndexMode:s}),d=c&&u;o&&l?(h(),p({nodes:e,nodesInitialized:l,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:d})):p({nodes:e,nodesInitialized:l,nodesSelectionActive:d})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();Il(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=Nl(e,n,r,i,a,o,l);d&&(wl(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=hl(e,o.fromHandle,Q.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=Ml(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(Cd(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(wd(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?i(e.map(e=>Td(e,!0))):(i(Ed(r,new Set([...e]))),a(Ed(n)))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();t?a(e.map(e=>Td(e,!0))):(a(Ed(n,new Set([...e]))),i(Ed(r,new Set)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s)e.selected&&l.push(Td(e.id,!1));let u=[];for(let e of c)e.selected&&u.push(Td(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,Td(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,Td(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();(e[0][0]!==o[0][0]||e[0][1]!==o[0][1]||e[1][0]!==o[1][0]||e[1][1]!==o[1][1])&&(Dl(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return Pl({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...Ks}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...Hp()})}},Object.is);function Wp({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,J.useState)(()=>Up({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,Y.jsx)(Vu,{value:m,children:(0,Y.jsx)(Rd,{children:(0,Y.jsx)(uf,{children:p})})})}function Gp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,J.useContext)(Bu)?(0,Y.jsx)(Y.Fragment,{children:e}):(0,Y.jsx)(Wp,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var Kp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function qp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:ee,connectionMode:I,connectionLineType:L=qs.Bezier,connectionLineStyle:R,connectionLineComponent:z,connectionLineContainerStyle:B,deleteKeyCode:V=`Backspace`,selectionKeyCode:H=`Shift`,selectionOnDrag:U=!1,selectionMode:te=Gs.Full,panActivationKeyCode:ne=`Space`,multiSelectionKeyCode:re=jc()?`Meta`:`Control`,zoomActivationKeyCode:ie=jc()?`Meta`:`Control`,snapToGrid:ae,snapGrid:W,onlyRenderVisibleElements:G=!1,selectNodesOnDrag:oe,nodesDraggable:se,autoPanOnNodeFocus:ce,nodesConnectable:le,nodesFocusable:ue,nodeOrigin:K=cd,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:pe=!0,defaultViewport:me=ld,minZoom:he=.5,maxZoom:ge=2,translateExtent:_e=Bs,preventScrolling:ve=!0,nodeExtent:ye,defaultMarkerColor:be=`#b1b1b7`,zoomOnScroll:xe=!0,zoomOnPinch:Se=!0,panOnScroll:Ce=!1,panOnScrollSpeed:we=.5,panOnScrollMode:Te=Ws.Free,zoomOnDoubleClick:Ee=!0,panOnDrag:De=!0,onPaneClick:Oe,onPaneMouseEnter:ke,onPaneMouseMove:Ae,onPaneMouseLeave:je,onPaneScroll:Me,onPaneContextMenu:Ne,paneClickDistance:Pe=1,nodeClickDistance:q=0,children:Fe,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:He,onEdgeMouseLeave:Ue,reconnectRadius:We=10,onNodesChange:Ge,onEdgesChange:Ke,noDragClassName:qe=`nodrag`,noWheelClassName:Je=`nowheel`,noPanClassName:Ye=`nopan`,fitView:Xe,fitViewOptions:Ze,connectOnClick:Qe,attributionPosition:$e,proOptions:et,defaultEdgeOptions:tt,elevateNodesOnSelect:nt=!0,elevateEdgesOnSelect:rt=!1,disableKeyboardA11y:at=!1,autoPanOnConnect:ot,autoPanOnNodeDrag:st,autoPanOnSelection:ct=!0,autoPanSpeed:lt,connectionRadius:ut,isValidConnection:dt,onError:ft,style:pt,id:mt,nodeDragThreshold:ht,connectionDragThreshold:gt,viewport:_t,onViewportChange:vt,width:yt,height:bt,colorMode:xt=`light`,debug:St,onScroll:Ct,ariaLabelConfig:wt,zIndexMode:Tt=`basic`,...Et},Dt){let Ot=mt||`1`,kt=hd(xt),At=(0,J.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Ct?.(e)},[Ct]);return(0,Y.jsx)(`div`,{"data-testid":`rf__wrapper`,...Et,onScroll:At,style:{...pt,...Kp},ref:Dt,className:it([`react-flow`,i,kt]),id:mt,role:`application`,children:(0,Y.jsxs)(Gp,{nodes:e,edges:t,width:yt,height:bt,fitView:Xe,fitViewOptions:Ze,minZoom:he,maxZoom:ge,nodeOrigin:K,nodeExtent:ye,zIndexMode:Tt,children:[(0,Y.jsx)(pd,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:se,autoPanOnNodeFocus:ce,nodesConnectable:le,nodesFocusable:ue,edgesFocusable:de,edgesReconnectable:fe,elementsSelectable:pe,elevateNodesOnSelect:nt,elevateEdgesOnSelect:rt,minZoom:he,maxZoom:ge,nodeExtent:ye,onNodesChange:Ge,onEdgesChange:Ke,snapToGrid:ae,snapGrid:W,connectionMode:I,translateExtent:_e,connectOnClick:Qe,defaultEdgeOptions:tt,fitView:Xe,fitViewOptions:Ze,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:Ye,nodeOrigin:K,rfId:Ot,autoPanOnConnect:ot,autoPanOnNodeDrag:st,autoPanSpeed:lt,onError:ft,connectionRadius:ut,isValidConnection:dt,selectNodesOnDrag:oe,nodeDragThreshold:ht,connectionDragThreshold:gt,onBeforeDelete:ee,debug:St,ariaLabelConfig:wt,zIndexMode:Tt}),(0,Y.jsx)(Bp,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:R,connectionLineComponent:z,connectionLineContainerStyle:B,selectionKeyCode:H,selectionOnDrag:U,selectionMode:te,deleteKeyCode:V,multiSelectionKeyCode:re,panActivationKeyCode:ne,zoomActivationKeyCode:ie,onlyRenderVisibleElements:G,defaultViewport:me,translateExtent:_e,minZoom:he,maxZoom:ge,preventScrolling:ve,zoomOnScroll:xe,zoomOnPinch:Se,zoomOnDoubleClick:Ee,panOnScroll:Ce,panOnScrollSpeed:we,panOnScrollMode:Te,panOnDrag:De,autoPanOnSelection:ct,onPaneClick:Oe,onPaneMouseEnter:ke,onPaneMouseMove:Ae,onPaneMouseLeave:je,onPaneScroll:Me,onPaneContextMenu:Ne,paneClickDistance:Pe,nodeClickDistance:q,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ie,onReconnectStart:Le,onReconnectEnd:Re,onEdgeContextMenu:ze,onEdgeDoubleClick:Be,onEdgeMouseEnter:Ve,onEdgeMouseMove:He,onEdgeMouseLeave:Ue,reconnectRadius:We,defaultMarkerColor:be,noDragClassName:qe,noWheelClassName:Je,noPanClassName:Ye,rfId:Ot,disableKeyboardA11y:at,nodeExtent:ye,viewport:_t,onViewportChange:vt,nodesDraggable:se}),(0,Y.jsx)(sd,{onSelectionChange:k}),Fe,(0,Y.jsx)(td,{proOptions:et,position:$e}),(0,Y.jsx)(Qu,{rfId:Ot,disableKeyboardA11y:at})]})})}var Jp=Nd(qp),Yp=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Xp({children:e}){let t=$(Yp);return t?(0,zu.createPortal)(e,t):null}var Zp=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function Qp(){return $(Zp,Ru)}function $p(e){let[t,n]=(0,J.useState)(e);return[t,n,(0,J.useCallback)(e=>n(t=>Cd(e,t)),[])]}function em({onStart:e,onChange:t,onEnd:n}){let r=Uu();(0,J.useEffect)(()=>{r.setState({onViewportChangeStart:e})},[e]),(0,J.useEffect)(()=>{r.setState({onViewportChange:t})},[t]),(0,J.useEffect)(()=>{r.setState({onViewportChangeEnd:n})},[n])}var tm=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(let[,{internals:e}]of t.nodeLookup)if(e.handleBounds===void 0||!Pc(e.userNode))return!1;return!0};function nm(e={includeHiddenNodes:!1}){return $(tm(e))}zs.error014();function rm(e){return $((0,J.useCallback)(t=>t.nodeLookup.get(e),[e]),Ru)}function im({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,Y.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:it([`react-flow__background-pattern`,n,r])})}function am({radius:e,className:t}){return(0,Y.jsx)(`circle`,{cx:e,cy:e,r:e,className:it([`react-flow__background-pattern`,`dots`,t])})}var om;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(om||={});var sm={[om.Dots]:1,[om.Lines]:1,[om.Cross]:6},cm=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function lm({id:e,variant:t=om.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,J.useRef)(null),{transform:f,patternId:p}=$(cm,Ru),m=r||sm[t],h=t===om.Dots,g=t===om.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]+x[0]/2,b[1]*f[2]+x[1]/2],C=`${p}${e||``}`;return(0,Y.jsxs)(`svg`,{className:it([`react-flow__background`,l]),style:{...c,...Kd,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,Y.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,Y.jsx)(am,{radius:y/2,className:u}):(0,Y.jsx)(im,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,Y.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}lm.displayName=`Background`;var um=(0,J.memo)(lm);function dm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,Y.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function fm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,Y.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function pm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,Y.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function mm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function hm(){return(0,Y.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,Y.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function gm({children:e,className:t,...n}){return(0,Y.jsx)(`button`,{type:`button`,className:it([`react-flow__controls-button`,t]),...n,children:e})}var _m=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function vm({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=Uu(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=$(_m,Ru),{zoomIn:y,zoomOut:b,fitView:x}=Vd();return(0,Y.jsxs)($u,{className:it([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(gm,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,Y.jsx)(dm,{})}),(0,Y.jsx)(gm,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,Y.jsx)(fm,{})})]}),n&&(0,Y.jsx)(gm,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,Y.jsx)(pm,{})}),r&&(0,Y.jsx)(gm,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,Y.jsx)(hm,{}):(0,Y.jsx)(mm,{})}),u]})}vm.displayName=`Controls`,(0,J.memo)(vm);function ym({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,Y.jsx)(`rect`,{className:it([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var bm=(0,J.memo)(ym),xm=e=>e.nodes.map(e=>e.id),Sm=e=>e instanceof Function?e:()=>e;function Cm({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=bm,onClick:o}){let s=$(xm,Ru),c=Sm(t),l=Sm(e),u=Sm(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,Y.jsx)(Y.Fragment,{children:s.map(e=>(0,Y.jsx)(Tm,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function wm({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=$(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=Nc(r);return{node:r,x:i,y:a,width:o,height:s}},Ru);return!l||l.hidden||!Pc(l)?null:(0,Y.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var Tm=(0,J.memo)(wm),Em=(0,J.memo)(Cm),Dm=200,Om=150,km=e=>!e.hidden,Am=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},n=!1;for(let t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?vc(tc(e.nodeLookup,{filter:km}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},jm=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Mm=(e,t)=>jm(e.viewBB,t.viewBB)&&jm(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,Nm=`react-flow__minimap-desc`;function Pm({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=Uu(),S=(0,J.useRef)(null),{boundingRect:C,panZoom:w,viewBB:T,rfId:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=$(Am,Mm),j=e?.width??Dm,M=e?.height??Om,N=C.width/j,P=C.height/M,F=Math.max(N,P),ee=F*j,I=F*M,L=b*F,R=C.x-(ee-C.width)/2-L,z=C.y-(I-C.height)/2-L,B=ee+L*2,V=I+L*2,H=`${Nm}-${E}`,U=(0,J.useRef)(0),te=(0,J.useRef)();U.current=F,(0,J.useEffect)(()=>{let e=x.getState().panZoom;if(S.current&&e)return te.current=$l({domNode:S.current,panZoom:e,getTransform:()=>x.getState().transform,getViewScale:()=>U.current}),()=>{te.current?.destroy()}},[w]),(0,J.useEffect)(()=>{te.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ne=p?e=>{let[t,n]=te.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,re=(0,J.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m?.(e,n)},[m]),ie=m?re:void 0,ae=_??A[`minimap.ariaLabel`];return(0,Y.jsx)($u,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:it([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,Y.jsxs)(`svg`,{width:j,height:M,viewBox:`${R} ${z} ${B} ${V}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":H,ref:S,onClick:ne,children:[ae&&(0,Y.jsx)(`title`,{id:H,children:ae}),(0,Y.jsx)(Em,{onClick:ie,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,Y.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${R-L},${z-L}h${B+L*2}v${V+L*2}h${-B-L*2}z
16
+ M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}Pm.displayName=`MiniMap`;var Fm=(0,J.memo)(Pm),Im=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Lm={[mu.Line]:`right`,[mu.Handle]:`bottom-right`};function Rm({nodeId:e,position:t,variant:n=mu.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=sf(),y=typeof e==`string`?e:v,b=Uu(),x=(0,J.useRef)(null),S=n===mu.Handle,C=$((0,J.useCallback)(Im(S&&p),[S,p]),Ru),w=(0,J.useRef)(null),T=t??Lm[n];(0,J.useEffect)(()=>{if(x.current&&y)return w.current||=Tu({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=Ml([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...Fc({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]);let E=T.split(`-`);return(0,Y.jsx)(`div`,{className:it([`react-flow__resize-control`,`nodrag`,...E,n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,J.memo)(Rm);var zm={name:`arrow-left-right`,size:24,node:[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]};zm.node;var Bm=q(zm),Vm={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};Vm.node;var Hm=q(Vm),Um={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Um.node;var Wm=q(Um),Gm={name:`brush`,size:24,node:[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]};Gm.node;var Km=q(Gm),qm={name:`building-complex`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]],aliases:[`building-2`]};qm.node;var Jm=q(qm),Ym={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};Ym.node;var Xm=q(Ym),Zm={name:`check-check`,size:24,node:[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]};Zm.node;var Qm=q(Zm),$m={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};$m.node;var eh=q($m),th={name:`circle-dot`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};th.node;var nh=q(th),rh={name:`circle-slash`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]};rh.node;var ih=q(rh),ah={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};ah.node;var oh=q(ah),sh={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};sh.node;var ch=q(sh),lh={name:`columns-2`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]],aliases:[`columns`]};lh.node;var uh=q(lh),dh={name:`corner-down-left`,size:24,node:[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]};dh.node;var fh=q(dh),ph={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};ph.node;var mh=q(ph),hh={name:`diff`,size:24,node:[[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 10h14`,key:`elsbfy`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]};hh.node;var gh=q(hh),_h={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};_h.node;var vh=q(_h),yh={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};yh.node;var bh=q(yh),xh={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};xh.node;var Sh=q(xh),Ch={name:`face-slightly-smiling`,size:24,node:[[`path`,{d:`M15 10V9`,key:`4dkmfx`}],[`path`,{d:`M16.472 15a6 6 0 01-8.943 0`,key:`7qomzy`}],[`path`,{d:`M9 10V9`,key:`1lazqi`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],aliases:[`smile`]};Ch.node;var wh=q(Ch),Th={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};Th.node;var Eh=q(Th),Dh={name:`files`,size:24,node:[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]};Dh.node;var Oh=q(Dh),kh={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};kh.node;var Ah=q(kh),jh={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};jh.node;var Mh=q(jh),Nh={name:`git-compare`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]};Nh.node;var Ph=q(Nh),Fh={name:`git-fork`,size:24,node:[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]};Fh.node;var Ih=q(Fh),Lh={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};Lh.node;var Rh=q(Lh),zh={name:`git-pull-request-closed`,size:24,node:[[`path`,{d:`m15.5 3.5 5 5`,key:`1kmx7t`}],[`path`,{d:`m15.5 8.5 5-5`,key:`saftza`}],[`path`,{d:`M18 11.62V15`,key:`1greaj`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}]]};zh.node;var Bh=q(zh),Vh={name:`git-pull-request`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};Vh.node;var Hh=q(Vh),Uh={name:`image-off`,size:24,node:[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]};Uh.node;var Wh=q(Uh),Gh={name:`image-plus`,size:24,node:[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};Gh.node;var Kh=q(Gh),qh={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};qh.node;var Jh=q(qh),Yh={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};Yh.node;var Xh=q(Yh),Zh={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Zh.node;var Qh=q(Zh),$h={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};$h.node;var eg=q($h),tg={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};tg.node;var ng=q(tg),rg={name:`link-2-off`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]};rg.node;var ig=q(rg),ag={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};ag.node;var og=q(ag),sg={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};sg.node;var cg=q(sg),lg={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};lg.node;var ug=q(lg),dg={name:`locate-fixed`,size:24,node:[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};dg.node;var fg=q(dg),pg={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};pg.node;var mg=q(pg),hg={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};hg.node;var gg=q(hg),_g={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};_g.node;var vg=q(_g),yg={name:`maximize`,size:24,node:[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]};yg.node;var bg=q(yg),xg={name:`message-square-plus`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]};xg.node;var Sg=q(xg),Cg={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};Cg.node;var wg=q(Cg),Tg={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};Tg.node;var Eg=q(Tg),Dg={name:`monitor-play`,size:24,node:[[`path`,{d:`M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z`,key:`vbtd3f`}],[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`rect`,{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`,key:`x3v2xh`}]]};Dg.node;var Og=q(Dg),kg={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};kg.node;var Ag=q(kg),jg={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};jg.node;var Mg=q(jg),Ng={name:`mouse-pointer-2`,size:24,node:[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]};Ng.node;var Pg=q(Ng),Fg={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};Fg.node;var Ig=q(Fg),Lg={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};Lg.node;var Rg=q(Lg),zg={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};zg.node;var Bg=q(zg),Vg={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Vg.node;var Hg=q(Vg),Ug={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};Ug.node;var Wg=q(Ug),Gg={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};Gg.node;var Kg=q(Gg),qg={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};qg.node;var Jg=q(qg),Yg={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};Yg.node;var Xg=q(Yg),Zg={name:`route`,size:24,node:[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]};Zg.node;var Qg=q(Zg),$g={name:`rows-2`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]],aliases:[`rows`]};$g.node;var e_=q($g),t_={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};t_.node;var n_=q(t_),r_={name:`settings-2`,size:24,node:[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]};r_.node;var i_=q(r_),a_={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};a_.node;var o_=q(a_),s_={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};s_.node;var c_=q(s_),l_={name:`shield-question-mark`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`shield-question`]};l_.node;var u_=q(l_),d_={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};d_.node;var f_=q(d_),p_={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};p_.node;var m_=q(p_),h_={name:`square-dashed-text`,size:24,node:[[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 14v1`,key:`169vum`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M9 3h1`,key:`1yesri`}]],aliases:[`text-selection`,`text-select`]};h_.node;var g_=q(h_),__={name:`square-split-horizontal`,size:24,node:[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3`,key:`saxlbk`}],[`path`,{d:`M8 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3`,key:`m1vog4`}]],aliases:[`split-square-horizontal`]};__.node;var v_=q(__),y_={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};y_.node;var b_=q(y_),x_={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};x_.node;var S_=q(x_),C_={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};C_.node;var w_=q(C_),T_={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};T_.node;var E_=q(T_),D_={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};D_.node;var O_=q(D_),k_={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};k_.node;var A_=q(k_),j_={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};j_.node;var M_=q(j_),N_={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};N_.node;var P_=q(N_),F_={name:`waypoints`,size:24,node:[[`path`,{d:`m10.586 5.414-5.172 5.172`,key:`4mc350`}],[`path`,{d:`m18.586 13.414-5.172 5.172`,key:`8c96vv`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`circle`,{cx:`12`,cy:`20`,r:`2`,key:`144qzu`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}],[`circle`,{cx:`20`,cy:`12`,r:`2`,key:`1xzzfp`}],[`circle`,{cx:`4`,cy:`12`,r:`2`,key:`1hvhnz`}]]};F_.node;var I_=q(F_),L_={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};L_.node;var R_=q(L_),z_=[[`left-[4%] top-[8%]`,4,2],[`left-[38%] top-[8%]`,2,1],[`left-[4%] top-[50%]`,4,2],[`left-[38%] top-[42%]`,4,2]];function B_(){return(0,Y.jsxs)(`div`,{className:`flex h-full flex-col bg-sunken`,"data-sw-board-loading":!0,children:[(0,Y.jsx)(`span`,{role:`status`,className:`sr-only`,children:`Loading the board`}),E?(0,Y.jsxs)(`div`,{className:`flex h-[2.8125rem] shrink-0 items-center gap-2 border-b border-line bg-surface px-2 sm:px-3 lg:h-9`,"aria-hidden":`true`,"data-sw-board-loading-demo":!0,children:[(0,Y.jsx)(Te,{className:`h-5 w-14 rounded-full`}),(0,Y.jsx)(Te,{className:`h-3.5 w-40 max-sm:w-24`}),(0,Y.jsx)(Te,{className:`ml-auto h-3.5 w-14`})]}):null,(0,Y.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center gap-3 border-b border-line bg-surface px-3 lg:px-4`,"aria-hidden":`true`,children:[(0,Y.jsx)(Te,{className:`h-8 w-8 rounded-lg`}),(0,Y.jsx)(Te,{className:`hidden h-4 w-24 sm:block`}),(0,Y.jsx)(Te,{className:`h-8 w-40 max-sm:flex-1`}),(0,Y.jsx)(`div`,{className:`hidden flex-1 items-center justify-center gap-2 lg:flex`,children:(0,Y.jsx)(Te,{className:`h-8 w-56`})}),(0,Y.jsx)(Te,{className:`hidden h-8 w-24 lg:block`}),(0,Y.jsx)(Te,{className:`hidden h-8 w-48 lg:block`}),(0,Y.jsx)(Te,{className:`h-8 w-8 rounded-full`})]}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`relative min-w-0 flex-1 overflow-hidden`,"aria-hidden":`true`,children:[z_.map(([e,t,n],r)=>(0,Y.jsxs)(`div`,{className:`absolute ${e} rounded-xl border border-line-strong/60 bg-surface/40 p-3 max-sm:hidden`,children:[(0,Y.jsx)(Te,{className:`mb-3 h-3 w-20`}),(0,Y.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(${t}, 3.5rem)`},children:Array.from({length:t*n},(e,t)=>(0,Y.jsx)(Te,{className:`h-24 rounded-md shadow-thumb`},t))})]},r)),(0,Y.jsx)(`div`,{className:`flex flex-col gap-4 p-4 sm:hidden`,children:[3,2].map((e,t)=>(0,Y.jsxs)(`div`,{className:`rounded-xl border border-line-strong/60 bg-surface/40 p-3`,children:[(0,Y.jsx)(Te,{className:`mb-3 h-3 w-20`}),(0,Y.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:Array.from({length:e},(e,t)=>(0,Y.jsx)(Te,{className:`h-28 rounded-md shadow-thumb`},t))})]},t))})]}),(0,Y.jsxs)(`div`,{className:`hidden w-80 shrink-0 flex-col gap-4 border-l border-line bg-surface p-4 lg:flex`,"aria-hidden":`true`,children:[(0,Y.jsx)(Te,{className:`h-5 w-28`}),(0,Y.jsx)(Te,{className:`h-9 w-full`}),[0,1,2,3].map(e=>(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Y.jsx)(Te,{className:`h-8 w-8 shrink-0 rounded-full`}),(0,Y.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,Y.jsx)(Te,{className:`h-3 w-1/2`}),(0,Y.jsx)(Te,{className:`h-3 w-full`}),(0,Y.jsx)(Te,{className:`h-3 w-3/4`})]})]},e))]})]})]})}function V_({heading:e=!0}){return(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-sw-chat-loading":!0,children:[(0,Y.jsx)(`span`,{role:`status`,className:`sr-only`,children:`Loading chat`}),e?(0,Y.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-b border-line px-3`,"aria-hidden":`true`,children:[(0,Y.jsx)(Te,{className:`h-4 w-16`}),(0,Y.jsx)(Te,{className:`h-5 w-28 rounded-full`}),(0,Y.jsx)(Te,{className:`ml-auto h-7 w-7`})]}):null,(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-hidden p-3`,"aria-hidden":`true`,children:[(0,Y.jsx)(Te,{className:`ml-auto h-9 w-3/5 rounded-2xl`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(Te,{className:`h-6 w-6 shrink-0 rounded-full`}),(0,Y.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,Y.jsx)(Te,{className:`h-10 w-full rounded-lg`}),(0,Y.jsx)(Te,{className:`h-3 w-full`}),(0,Y.jsx)(Te,{className:`h-3 w-5/6`}),(0,Y.jsx)(Te,{className:`h-3 w-2/3`})]})]})]}),(0,Y.jsx)(`div`,{className:`shrink-0 p-3`,"aria-hidden":`true`,children:(0,Y.jsx)(Te,{className:`h-24 w-full rounded-xl`})})]})}function H_(e){let t=e?.status;return t===401||t===403?`You may need to sign in again, or ask for access to this board.`:t===404?`This board may have moved or been removed.`:typeof navigator<`u`&&navigator.onLine===!1?`You seem to be offline. Check your connection, then retry.`:`Shapewall could not fetch this board's data. That is usually temporary, so try again in a moment.`}function U_({error:e,onRetry:t,extra:n=null}){let[i,a]=(0,J.useState)(!1),o=async()=>{a(!0);try{await t?.()}finally{a(!1)}},s=[e?.message,e?.status?`Status ${e.status}`:null].filter(Boolean).join(`
17
+ `);return(0,Y.jsx)(`div`,{className:`flex h-full overflow-y-auto bg-sunken`,role:`alert`,"data-sw-board-error":!0,children:(0,Y.jsx)(k,{size:`lg`,tone:`bad`,icon:ch,title:`This board did not load`,details:s||null,action:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(r,{size:`touch`,variant:`default`,className:`lg:h-10`,onClick:o,disabled:i,"data-sw-board-retry":!0,children:[i?(0,Y.jsx)(ue,{}):(0,Y.jsx)(Xg,{size:15,"aria-hidden":`true`}),` Retry`]}),n]}),children:H_(e)})})}function W_(e){let t=new Map;return(e||[]).forEach((e,n)=>{t.has(e)||t.set(e,[]),t.get(e).push(n+1)}),t}function G_(e,t,n=null){let r=0;for(let[i,a]of Object.entries(e||{}))t.has(i)&&(r+=a.filter(e=>t.has(e)&&!n?.has(e)).length);return r}function K_(e,t){let n=Object.entries(e||{}).filter(([e,n])=>t.has(e)&&n.some(e=>t.has(e)));if(n.length<3)return new Set;let r=new Map;for(let[e,i]of n)for(let n of new Set(i))n!==e&&t.has(n)&&r.set(n,(r.get(n)||0)+1);let i=Math.max(3,Math.ceil(n.length*.5));return new Set([...r].filter(([,e])=>e>=i).map(([e])=>e))}function q_({links:e={},showLinks:t=!1,activePage:n=null,journeySteps:r=null,journeyRoute:i=null,currentStep:a=0,present:o,idleMax:s=150,hideTargets:c=null}){let l=[],u=[],d=e=>o.has(e),f=new Set;if(i){let e=new Map(i.graph.nodes.map(e=>[e.key,e.pageId])),t=new Map;i.path.forEach((e,n)=>{n&&t.set(`${i.path[n-1]}>${e}`,n)});let n=[];for(let r of i.graph.edges){let i=e.get(r.from),o=e.get(r.to);if(i===o||!d(i)||!d(o))continue;let s=t.get(`${r.from}>${r.to}`);f.add(`${i}>${o}`);let c={source:i,target:o,sourceHandle:`right`,targetHandle:`left`,type:`flow`};s===void 0?n.push({...c,id:`journey-alt:${r.from}>${r.to}`,data:{tone:`alt`,...r.label?{branch:r.label}:{},bend:.22}}):l.push({...c,id:`journey:${s}`,data:{tone:a&&s+1<=a?`done`:`journey`,label:String(s+1),...r.label?{branch:r.label}:{},bend:.16}})}l.unshift(...n)}else if(r?.length)for(let e=0;e<r.length-1;e+=1){let t=r[e],n=r[e+1];t!==n&&d(t)&&d(n)&&(f.add(`${t}>${n}`),l.push({id:`journey:${e+1}`,source:t,target:n,sourceHandle:`right`,targetHandle:`left`,type:`flow`,data:{tone:a&&e+2<=a?`done`:`journey`,label:String(e+2),bend:.16}}))}if(t&&(n||G_(e,o,c)<=s)){for(let[t,r]of Object.entries(e))if(d(t))for(let e of r){if(!d(e)||f.has(`${t}>${e}`)||c?.has(e))continue;let r=`idle`;if(n){if(t===n)r=`out`;else if(e===n)r=`in`;else continue}u.push({id:`link:${t}>${e}`,source:t,target:e,sourceHandle:`right`,targetHandle:`left`,type:`flow`,data:{tone:r}})}}return[...u,...l]}function J_(e,t){let n=Math.round(Number(e));return t?!Number.isFinite(n)||n<1?1:Math.min(n,t):0}function Y_(e,t){if(e?.status!==`ok`)return null;if(typeof e.version==`string`)return e.version;let n=Date.parse(t?.capturedAt||``);return Number.isFinite(n)?new Date(n).toISOString().replace(/[-:]/g,``).replace(/\.(\d{3})Z$/,`$1Z`):null}function X_(e,t){return[e,...e.replies||[]].filter(e=>e?.drawing?.shapes?.length&&e.drawing.captureVersion===t).flatMap(e=>e.drawing.shapes)}function Z_(e,t){return[e,...e.replies||[]].filter(e=>e?.drawing?.shapes?.length&&e.drawing.captureVersion&&e.drawing.captureVersion!==t).map(e=>e.drawing.captureVersion).sort().at(-1)||null}function Q_(e,{manifest:t,captures:n,versions:r}){if(!e||String(e.pageId).startsWith(`variant:`))return null;let{pageId:i,viewport:a}=e,o=t?.pages?.[i]?.[a],s=Y_(o,t),c=e.status===`resolved`||e.agentStatus===`done`,l=Z_(e,s),u=c?e.captureVersion:l;if(!u)return null;let d=n?.[i]?.[a]?.file||null,f=d?{kind:`captures`,file:d,version:s||`current`}:null;if(u===s)return{before:f,after:null,reason:`not-recaptured`};let p=(r?.[i]?.[a]||[]).find(e=>e.version===u),m=X_(e,u);return{before:p?{kind:`versions`,file:p.file,version:p.version}:null,after:f,reason:p?null:`pruned`,...m.length?{drawn:m}:{}}}function $_(e,t,n,{minWidth:r=320,share:i=.45,aspect:a=.66}={}){let o=Math.min(e.width,Math.max(r,Math.round(e.width*i))),s=Math.min(e.height,Math.round(o*a)),c=e.width*t/100,l=e.height*n/100;return{left:Math.round(Math.max(0,Math.min(e.width-o,c-o/2))),top:Math.round(Math.max(0,Math.min(e.height-s,l-s/2))),width:o,height:s}}function ev(e,t){let n=e?.pages?.[t];if(!n)return null;let r=Object.values(n).filter(e=>e.status===`ok`).map(e=>e.percent);return r.length?Math.max(...r):null}function tv(e,t){let n=e?.pages?.[t];if(!n)return null;let r=null;for(let[e,t]of Object.entries(n))t?.status===`ok`&&(!r||t.percent>r.percent)&&(r={viewport:e,percent:t.percent});return r}function nv(e){let t=/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})(\d{3})Z/.exec(String(e||``));if(!t)return null;let[,n,r,i,a,o,s,c]=t,l=Date.UTC(Number(n),Number(r)-1,Number(i),Number(a),Number(o),Number(s),Number(c));return Number.isFinite(l)?new Date(l).toISOString():null}function rv({pageId:e,viewport:t,manifest:n,captures:r,versions:i}){let a=[],o=r?.[e]?.[t],s=n?.pages?.[e]?.[t];if(o?.file){let e=Y_(s,n)||`current`;a.push({version:e,kind:`captures`,file:o.file,thumb:o.thumb||o.file,current:!0,at:s?.capturedAt||nv(e)||n?.capturedAt||null})}for(let n of i?.[e]?.[t]||[])n.file&&!a.some(e=>e.version===n.version)&&a.push({version:n.version,kind:`versions`,file:n.file,thumb:n.thumb||n.file,current:!1,at:nv(n.version)});return a}function iv(e,t){let n=e?.[t];return n?Math.max(0,...Object.values(n).map(e=>e.length)):0}var av=[{id:`agent-queued`,label:`Agent queued`},{id:`agent-working`,label:`Agent working`},{id:`agent-done`,label:`Agent done`},{id:`agent-branch`,label:`Fix ready on branch`},{id:`needs-human`,label:`Needs a person`},{id:`reopened`,label:`Reopened`},{id:`replies`,label:`With replies`},{id:`unanchored`,label:`Pinned by position`}];function ov(e,t){switch(t){case`agent-queued`:return e.agentStatus===`queued`;case`agent-working`:return e.agentStatus===`working`;case`agent-done`:return e.agentStatus===`done`;case`agent-branch`:return e.agentStatus===`branch-ready`;case`needs-human`:return e.agentStatus===`needs-human`;case`reopened`:return e.status===`open`&&e.reopenCount>0;case`replies`:return(e.replies?.length||0)>0;case`unanchored`:return!e.anchor;default:return!0}}function sv(e,{query:t=``,state:n=null,mention:r=null,titleOf:i=()=>``}={}){let a=String(t||``).toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if(n&&!ov(e,n)||r&&!(e.mentions||[]).includes(r))return!1;if(!a.length)return!0;let t=[`#${e.id}`,e.body,e.author,e.viewport,i(e.pageId),e.resolution,e.fixRef,...(e.replies||[]).flatMap(e=>[e.body,e.author])].filter(Boolean).join(`
18
+ `).toLowerCase();return a.every(e=>t.includes(e))})}var cv=[`responses`,`http4xx`,`http5xx`,`apiErrors`,`rateLimited`,`apiRateLimited`,`failedRequests`];function lv(e){return!e||e.schemaVersion!==1||e.window!==`navigation-through-screenshot`||typeof e.capped!=`boolean`||cv.some(t=>!Number.isInteger(e[t])||e[t]<0||e[t]>1e4)||e.responses+e.failedRequests>1e4||e.http4xx+e.http5xx>e.responses||e.apiErrors>e.http4xx+e.http5xx||e.rateLimited>e.http4xx||e.apiRateLimited>Math.min(e.rateLimited,e.apiErrors)?null:{schemaVersion:1,window:`navigation-through-screenshot`,...Object.fromEntries(cv.map(t=>[t,e[t]])),capped:e.capped}}function uv(e){let t=lv(e);if(!t)return``;let n=[];t.rateLimited&&n.push(`${t.rateLimited} HTTP 429${t.apiRateLimited?` (${t.apiRateLimited} API)`:``}`);let r=t.http4xx+t.http5xx-t.rateLimited;return r&&n.push(`${r} other HTTP error${r===1?``:`s`}`),t.failedRequests&&n.push(`${t.failedRequests} failed request${t.failedRequests===1?``:`s`}`),t.capped&&n.push(`observation limit reached`),n.join(`; `)}var dv={desktop:Ag,tablet:w_,phone:f_},fv=(e,t=Ag)=>dv[e]||dv[String(e).split(`-`)[0]]||t,pv=e=>e[0].toUpperCase()+e.slice(1).replace(/-/g,` `);function mv(e){let t=e.lastIndexOf(`|`);return{targetId:e.slice(0,t),viewport:e.slice(t+1)}}function hv({pageId:e,title:t,entries:n,viewports:r}){let[i,a]=(0,J.useState)(!1),o=r.map(e=>({name:e,text:n?.[e]?.status===`ok`?uv(n[e].networkSummary):``})).filter(e=>e.text);return o.length?(0,Y.jsxs)(Ye,{open:i,onOpenChange:a,children:[(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`nodrag nopan relative inline-flex h-5 items-center gap-1 rounded-full bg-warn/15 px-1.5 text-[10px] font-medium text-fg transition-colors hover:bg-warn/25 focus-visible:outline-2 focus-visible:outline-accent [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-3 [@media(pointer:coarse)]:before:content-['']`,"aria-label":`Capture network warnings for ${t}`,"data-sw-capture-warning":e,onClick:e=>e.stopPropagation(),children:[(0,Y.jsx)(O_,{size:10,className:`shrink-0 text-warn`,"aria-hidden":`true`}),`Network`]})}),(0,Y.jsxs)(qe,{className:`w-80 max-w-[calc(100vw-1.5rem)] p-0 text-xs`,"aria-label":`Capture network warnings`,"data-sw-capture-warning-details":!0,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-line py-2 pr-1.5 pl-3`,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-warn/15 text-warn`,children:(0,Y.jsx)(O_,{size:13,"aria-hidden":`true`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-fg`,children:`Capture network warnings`}),(0,Y.jsx)(`p`,{className:`mt-0.5 truncate text-muted`,children:t})]}),(0,Y.jsx)(z,{size:`icon-sm`,className:`[@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11`,label:`Close`,tooltip:``,onClick:()=>a(!1),children:(0,Y.jsx)(g,{size:14,"aria-hidden":`true`})})]}),(0,Y.jsxs)(`div`,{className:`space-y-2.5 px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-muted`,children:`Screenshots were saved. These requests had problems during capture.`}),(0,Y.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:o.map(e=>{let t=fv(e.name);return(0,Y.jsxs)(`li`,{className:`flex items-start gap-2 px-2.5 py-2`,children:[(0,Y.jsx)(t,{size:13,className:`mt-0.5 shrink-0 text-faint`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium text-fg capitalize`,children:e.name}),(0,Y.jsx)(`span`,{className:`block break-words text-muted`,children:e.text})]})]},e.name)})}),(0,Y.jsx)(`p`,{className:`text-faint`,children:`Counts only requests that failed before the screenshot. Normal page redirects aren’t counted; failed API calls are.`})]})]})]}):null}var gv=400;function _v({content:e,side:t=`top`,align:n=`center`,children:r}){let[i,a]=(0,J.useState)(!1),o=(0,J.useRef)(null),s=(0,J.useRef)(0);if((0,J.useEffect)(()=>()=>window.clearTimeout(s.current),[]),!e)return r;let c=e=>{window.clearTimeout(s.current),s.current=window.setTimeout(()=>a(!0),e)},l=()=>{window.clearTimeout(s.current),a(!1)},u=r.props,d=(0,J.cloneElement)(r,{ref:e=>{o.current=e,typeof u.ref==`function`?u.ref(e):u.ref&&(u.ref.current=e)},onPointerEnter:e=>{u.onPointerEnter?.(e),e.pointerType!==`touch`&&c(gv)},onPointerLeave:e=>{u.onPointerLeave?.(e),l()},onPointerDown:e=>{u.onPointerDown?.(e),l()},onFocus:e=>{u.onFocus?.(e),e.target.matches?.(`:focus-visible`)&&c(0)},onBlur:e=>{u.onBlur?.(e),l()}});return(0,Y.jsxs)(Y.Fragment,{children:[d,i?(0,Y.jsxs)(Ye,{open:!0,onOpenChange:e=>e?null:l(),history:!1,children:[(0,Y.jsx)(ce,{virtualRef:o}),(0,Y.jsx)(qe,{role:`tooltip`,side:t,align:n,sideOffset:6,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),className:`pointer-events-none z-[70] max-w-64 animate-fade-in rounded-md border-0 bg-fg px-2 py-1 text-xs font-medium text-surface select-none`,"data-sw-card-tip":`true`,children:e})]}):null]})}var vv=(0,J.createContext)(null),yv=8,bv=26,xv=12,Sv=72,Cv=112,wv=72,Tv=260,Ev=64,Dv=40,Ov=4,kv=160;function Av(e,t){return Math.max(e.w,e.h)*t<kv}function jv(e,t){let n=Object.keys(t);return e===`all`?n:[n.includes(e)?e:n[0]]}function Mv(e,t,n=null){let r=jv(e,t),i=Array.isArray(n)&&n.length?n.filter(e=>t[e]):null;if(!i?.length)return r;let a=r.filter(e=>i.includes(e));return a.length?a:[Object.keys(t).find(e=>i.includes(e))]}function Nv(e,t,n=null){let r=e[t],i=n?.[t];return r&&i&&i!==r.height?{...r,height:i}:r}function Pv(e,t,n=null,r=null,i=null){let a=yv,o=Mv(e,t,r),s=n||e===`all`&&Object.keys(t).length>1?bv:yv,c=o.flatMap(e=>{let r=Nv(t,e,i),o=r.frameScale||.25;return(n||[null]).map(n=>{let i={viewport:e,x:a,y:s,w:Math.round(r.width*o),h:Math.round(r.height*o)};return r!==t[e]&&(i.native=r),n&&(i.env=n),a+=i.w+xv,i})});return{frames:c,width:a-xv+yv,height:s+Math.max(...c.map(e=>e.h))+yv}}function Fv(e,t,n,r,i=null){let a=e.files&&typeof e.files==`object`?Object.keys(e.files).filter(e=>n[e]):null;if(!a?.length)return{frames:r.frames,height:r.height,only:null};let o=jv(t,n).filter(e=>a.includes(e));if(!o.length)return{frames:[],height:52,only:a};let s=Pv(t,n,null,o,i);return{frames:s.frames,height:s.height,only:null}}function Iv({pages:e,groups:t,variants:n,viewports:r,mode:i,compare:a=null}){let{width:o}=Pv(i,r,a),s=new Map,c=e=>{let t=`${(e.viewports||[]).join(`,`)}|${JSON.stringify(e.frameHeight||null)}`;return s.has(t)||s.set(t,Pv(i,r,a,e.viewports,e.frameHeight)),s.get(t)},l=new Map;for(let e of n||[])l.has(e.pageId)||l.set(e.pageId,[]),l.get(e.pageId).push(e);let u=[...new Set([...t||[],...e.map(e=>e.group)])],d=[],f=[],p={},m=Ov*(o+Sv),h=[];for(let t of u){let n=e.filter(e=>e.group===t);if(!n.length)continue;let r=[],i=0,a=0,o=0,s=0;for(let e of n){let t=c(e),n=l.get(e.id)?.length||0,u=t.width+n*(t.width+wv);i>0&&i+u>m&&(i=0,a+=s+Cv,s=0),r.push({page:e,shape:t,x:i+Ev,y:a+Ev+Dv}),i+=u+Sv,o=Math.max(o,i-Sv),s=Math.max(s,t.height)}h.push({group:t,placed:r,width:o+128,height:a+s+Dv+128})}let g=h.reduce((e,t)=>e+(t.width+Tv)*(t.height+Tv),0),_=Math.max(...h.map(e=>e.width),Math.sqrt(g*1.6)),v=0,y=0,b=0;for(let e of h)v>0&&v+e.width>_&&(v=0,y+=b+Tv,b=0),e.x=v,e.y=y,v+=e.width+Tv,b=Math.max(b,e.height);for(let e of h){d.push({id:`group:${e.group}`,type:`groupFrame`,position:{x:e.x,y:e.y},data:{group:e.group,count:e.placed.length},style:{width:e.width,height:e.height},width:e.width,height:e.height,selectable:!1,draggable:!1,focusable:!1,zIndex:-1});for(let{page:t,shape:n,x:a,y:o}of e.placed){let{frames:s,width:c,height:u}=n,m=Math.round(e.x+a),h=Math.round(e.y+o);d.push({id:t.id,type:`page`,position:{x:m,y:h},data:{page:t,frames:s},style:{width:c,height:u},width:c,height:u,ariaLabel:`${t.title}, ${t.group} page. Arrow keys: its comments and buttons. Enter: its actions.`}),p[t.id]={x:m,y:h,w:c,h:u,frames:s,nodeId:t.id};let g=l.get(t.id)||[];g.forEach((e,a)=>{let o=m+(a+1)*(c+wv),s=`variant:${e.id}`,l=Fv(e,i,r,n,t.frameHeight);d.push({id:s,type:`variant`,position:{x:o,y:h},data:{variant:e,frames:l.frames,only:l.only},ariaLabel:`Variant: ${e.title}. Arrow keys: its comments and buttons. Enter: its actions.`,style:{width:c,height:l.height},width:c,height:l.height}),p[s]={x:o,y:h,w:c,h:l.height,frames:l.frames,nodeId:s},f.push({id:`edge:${s}`,source:a===0?t.id:`variant:${g[a-1].id}`,sourceHandle:`right`,target:s,targetHandle:`left`,type:`straight`,className:`sw-edge-variant`,style:{strokeDasharray:`6 6`},ariaLabel:`Variant of ${t.title}: ${e.title}`})})}}return{nodes:d,edges:f,targets:p}}var Lv=5;function Rv(e){let t=e.anchor;if(!t||!(t.w>0)||!(t.h>0))return null;let n=e.x-t.dx*t.w*100,r=e.y-t.dy*t.h*100;return{left:n,top:r,right:n+t.w*100,bottom:r+t.h*100}}function zv(e,t=null){let n=t?.box||Rv(e);if(!n)return{x:t?t.x:e.x,y:t?t.y:e.y,flipX:!1,flipY:!1};let r=e=>Math.max(0,Math.min(100,e)),i=n.right>95,a=i&&n.left>=Lv?n.left:n.right,o=n.top<Lv,s=o&&n.bottom<=95?n.bottom:n.top;return{x:r(a),y:r(s),flipX:i,flipY:o}}function Bv(e,t){let n=e[t.pageId];if(!n)return null;let r=n.frames.find(e=>e.viewport===t.viewport);return r?{x:n.x+r.x+r.w*t.x/100,y:n.y+r.y+r.h*t.y/100,nodeId:n.nodeId}:null}var Vv=typeof Document>`u`?null:Document.prototype,Hv=e=>Vv?Object.getOwnPropertyDescriptor(Vv,e)?.get:null,Uv={documentElement:Hv(`documentElement`),body:Hv(`body`),defaultView:Hv(`defaultView`)},Wv=typeof Node>`u`?null:Object.getOwnPropertyDescriptor(Node.prototype,`nodeType`)?.get;function Gv(e){if(!Vv||!Wv||!e||typeof e!=`object`)return!1;try{return Wv.call(e)===9}catch{return!1}}var Kv={documentElement:e=>Gv(e)?Uv.documentElement.call(e):null,body:e=>Gv(e)?Uv.body.call(e):null,defaultView:e=>Gv(e)?Uv.defaultView.call(e):null,querySelector:(e,t)=>Vv.querySelector.call(e,t),querySelectorAll:(e,t)=>Vv.querySelectorAll.call(e,t),elementFromPoint:(e,t,n)=>Gv(e)?Vv.elementFromPoint.call(e,t,n):null,addEventListener:(e,...t)=>EventTarget.prototype.addEventListener.call(e,...t),removeEventListener:(e,...t)=>EventTarget.prototype.removeEventListener.call(e,...t)},qv=600,Jv=2e3,Yv=String.raw`(?:#(?:[A-Za-z0-9_\u0080-￿-]|\\[0-9a-fA-F]{6} ?|\\[0-9a-fA-F]{1,5}(?![0-9a-fA-F]) ?|\\[^0-9a-fA-F\n\r\f])+|[a-z][a-z0-9-]{0,40}(?:\[(?:data-testid|aria-label)="(?:[^"\\\n]|\\.){0,200}"\]|:nth-of-type\([1-9][0-9]{0,4}\)))`,Xv=RegExp(`^${Yv}(?: > ${Yv}){0,79}$`),Zv=80,Qv=`a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"], [role="menuitem"], img`;function $v(e){if(!e)return``;let t=e.innerText||e.textContent||e.getAttribute?.(`aria-label`)||e.getAttribute?.(`alt`)||e.getAttribute?.(`placeholder`)||``;return String(t).replace(/\s+/g,` `).trim()}function ey(e,t){let n=typeof CSS<`u`?CSS:null;return n?.escape?n.escape(t):String(t).replace(/[^a-zA-Z0-9_-]/g,e=>`\\${e}`)}function ty(e){return String(e).replace(/["\\]/g,`\\$&`)}function ny(e,t){try{return Kv.querySelectorAll(e,t).length===1}catch{return!1}}function ry(e,t){let n=[],r=t,i=Kv.documentElement(e);for(;r&&r.nodeType===1&&r!==i;){let t=r.tagName.toLowerCase();if(r.id&&ny(e,`#${ey(e,r.id)}`)){n.unshift(`#${ey(e,r.id)}`);break}let i=r.getAttribute(`data-testid`);if(i&&ny(e,`${t}[data-testid="${ty(i)}"]`)){n.unshift(`${t}[data-testid="${ty(i)}"]`);break}let a=r.getAttribute(`aria-label`);if(a&&a.length<=80&&ny(e,`${t}[aria-label="${ty(a)}"]`)){n.unshift(`${t}[aria-label="${ty(a)}"]`);break}let o=1,s=r;for(;s=s.previousElementSibling;)s.tagName===r.tagName&&(o+=1);n.unshift(`${t}:nth-of-type(${o})`),r=r.parentElement}let a=n.join(` > `);for(;a.length>qv&&n.length>1;)n.shift(),a=n.join(` > `);return a.length>qv?``:a}function iy(e,t,n){let r=Kv.elementFromPoint(e,t,n);if(!r||r===Kv.documentElement(e)||r===Kv.body(e))return null;let i=r.closest?.(Qv)||r,a=i.getBoundingClientRect();return a.width&&a.height?i:null}var ay=(e,t)=>e.length>t?`${e.slice(0,t-3)}...`:e;function oy(e,t,n){let r=ry(e,t),i=r?r.split(` > `).pop():t.tagName.toLowerCase(),a=$v(t),o=t.getBoundingClientRect(),s=n?.width&&n?.height?o.width*o.height/(n.width*n.height):0;return{label:`${ay(i,48)}${a?` "${ay(a,28)}"`:``}`,large:s>.2,rect:{left:o.left,top:o.top,width:o.width,height:o.height}}}function sy(e,t,n,r=null){let i=iy(e,t,n);if(!i)return null;let a=i.getBoundingClientRect(),o=e=>Math.max(0,Math.min(1,e)),s=ry(e,i);if(!s||!Xv.test(s))return null;let c=e=>Math.round(o(e)*1e4)/1e4;return{selector:s,text:$v(i).slice(0,Zv),dx:c((t-a.left)/a.width),dy:c((n-a.top)/a.height),...r?.width&&r?.height?{w:c(a.width/r.width),h:c(a.height/r.height)}:{}}}function cy(e){let t=String(e).split(`>`).pop().trim(),n=/^([a-z][a-z0-9-]*)/i.exec(t);return n?n[1].toLowerCase():null}function ly(e,t,n){let r=Kv.body(e);if(!r||!t?.selector||!n||!Xv.test(t.selector))return null;let i=String(t.text||``),a=e=>{if(!i)return!0;let t=$v(e);return t===i||t.startsWith(i)},o=null;try{o=Kv.querySelector(e,t.selector)}catch{o=null}o&&!a(o)&&(o=null);let s=cy(t.selector);if(!o&&i&&s){let e=null,t=1/0,n=Element.prototype.getElementsByTagName.call(r,s);for(let r=0;r<n.length&&r<Jv;r+=1){let a=n[r];if($v(a)!==i)continue;let o=a.getBoundingClientRect(),s=o.width*o.height;s>0&&s<t&&(e=a,t=s)}o=e}if(!o)return null;let c=o.getBoundingClientRect();if(!c.width&&!c.height)return null;let l=(e,t)=>Math.max(0,Math.min(100,e/t*100));return{x:l(c.left+t.dx*c.width,n.width),y:l(c.top+t.dy*c.height,n.height),box:{left:l(c.left,n.width),top:l(c.top,n.height),right:l(c.right,n.width),bottom:l(c.bottom,n.height)}}}var uy={elements:8e3,bytes:3145728,text:80,attr:200,selector:600,size:1e4},dy=`a, button, input, select, textarea, label, summary, [role="button"], [role="link"], [role="tab"], [role="menuitem"], img`,fy=String.raw`(?:[A-Za-z0-9_\u0080-\uffff-]|\\[0-9a-fA-F]{6} ?|\\[0-9a-fA-F]{1,5}(?![0-9a-fA-F]) ?|\\[^0-9a-fA-F\n\r\f])+`,py=String.raw`(?:[^"\\\n]|\\.){0,200}`,my=String.raw`(?:#${fy}|[a-z][a-z0-9-]{0,40}(?:\[(?:data-testid|aria-label)="${py}"\]|:nth-of-type\([1-9][0-9]{0,4}\)))`,hy=RegExp(`^${my}(?: > ${my}){0,79}$`),gy=RegExp(`^${my}$`),_y=/^[a-z][a-z0-9-]{0,40}$/;function vy(e){let t=document,n=t.documentElement,r=t.body,i=Math.round(innerWidth),a=Math.round(innerHeight);if(!r)return{v:1,width:i,height:a,elements:[]};let o=e=>{let t=e.innerText||e.textContent||e.getAttribute(`aria-label`)||e.getAttribute(`alt`)||e.getAttribute(`placeholder`)||``;return String(t).replace(/\s+/g,` `).trim()},s=e=>String(e).replace(/["\\]/g,`\\$&`),c=e=>{try{return t.querySelectorAll(e).length===1}catch{return!1}},l=e=>Math.round(e*10)/10,u=e=>!!(e&&e.width&&e.height),d=[r,...Array.from(r.querySelectorAll(`*`))],f=new Map,p=new Set;for(let e of d){let t=e.getBoundingClientRect();if(f.set(e,t),!(!u(t)||t.right<=0||t.bottom<=0||t.left>=i||t.top>=a))for(let t=e;t&&t!==n&&!p.has(t);t=t.parentElement)p.add(t)}let m=d.filter(e=>p.has(e)),h=m.slice(0,e.elements),g=new Map(h.map((e,t)=>[e,t])),_=new Map,v=e=>{let t=_.get(e);return t||(t=getComputedStyle(e),_.set(e,t)),t},y=e=>{let t=0,r=0;for(let i=e;i&&i!==n;i=i.parentElement){let e=v(i);if(e.position!==`static`){r=1;let n=parseInt(e.zIndex,10);Number.isFinite(n)&&(t=n)}}return[t,r]},b=(e,t)=>{let r=t.left,i=t.top,a=t.right,o=t.bottom;if(v(e).position===`fixed`)return null;for(let t=e.parentElement;t&&t!==n;t=t.parentElement){let e=v(t);if(e.overflowX!==`visible`||e.overflowY!==`visible`){let e=f.get(t)||t.getBoundingClientRect();r=Math.max(r,e.left),i=Math.max(i,e.top),a=Math.min(a,e.right),o=Math.min(o,e.bottom)}if(e.position===`fixed`)break}return r===t.left&&i===t.top&&a===t.right&&o===t.bottom?null:[l(r),l(i),l(Math.max(0,a-r)),l(Math.max(0,o-i))]},x=[],S=[];h.forEach((t,n)=>{let i=t.tagName.toLowerCase(),a=f.get(t),d=1,p=t;for(;p=p.previousElementSibling;)p.tagName===t.tagName&&(d+=1);let m={t:i,n:d,p:t===r?-1:g.get(t.parentElement),b:[l(a.left),l(a.top),l(a.width),l(a.height)]},h=t.id,_=t.getAttribute(`data-testid`),C=t.getAttribute(`aria-label`);h&&c(`#${CSS.escape(h)}`)?m.h=`#${CSS.escape(h)}`:_&&c(`${i}[data-testid="${s(_)}"]`)?m.h=`${i}[data-testid="${s(_)}"]`:C&&C.length<=80&&c(`${i}[aria-label="${s(C)}"]`)&&(m.h=`${i}[aria-label="${s(C)}"]`),h&&h.length<=e.attr&&(m.i=h),_&&_.length<=e.attr&&(m.d=_),C&&C.length<=e.attr&&(m.r=C);let w=o(t);w&&(m.x=w.slice(0,e.text),w.length>e.text&&(m.l=1));let T=v(t);if(t!==r&&u(a)&&T.visibility===`visible`&&T.pointerEvents!==`none`){S.push({position:n,key:y(t)});let r=b(t,a);r&&(m.c=r);let i=t.closest(e.preferred)||t;i!==t&&(m.a=g.has(i)&&u(f.get(i))?g.get(i):-1)}x.push(m)}),S.sort((e,t)=>e.key[0]-t.key[0]||e.key[1]-t.key[1]||e.position-t.position),S.forEach((e,t)=>{x[e.position].z=t});let C={v:1,width:i,height:a,elements:x};return m.length>h.length&&(C.truncated=!0),C}`${vy.toString()}${JSON.stringify({elements:uy.elements,text:uy.text,attr:uy.attr,preferred:dy})}`;var yy=class extends Error{},by=/[\u0000-\u001f\u007f]/,xy=1e5;function Sy(e,t){if(!Array.isArray(e)||e.length!==4)throw new yy(`${t}: a box is four numbers`);let n=e.map(e=>{if(typeof e!=`number`||!Number.isFinite(e)||Math.abs(e)>xy)throw new yy(`${t}: a box is four numbers`);return Math.round(e*10)/10});if(n[2]<0||n[3]<0)throw new yy(`${t}: a box has no negative size`);return n}function Cy(e,t,n){if(typeof e!=`string`||!e||e.length>t||by.test(e))throw new yy(`${n}: up to ${t} printable characters`);return e}function wy(e){let t=uy;if(!e||typeof e!=`object`||Array.isArray(e))throw new yy(`an element map is an object`);if(e.v!==1)throw new yy(`unknown element map version`);let n=(e,n)=>{if(!Number.isInteger(e)||e<1||e>t.size)throw new yy(`${n}: 1 to ${t.size}`);return e},r=n(e.width,`width`),i=n(e.height,`height`);if(!Array.isArray(e.elements)||e.elements.length>t.elements)throw new yy(`elements: a list of at most ${t.elements}`);let a=e.elements.length,o=new Set,s={v:1,width:r,height:i,elements:e.elements.map((e,n)=>{let r=`elements[${n}]`;if(!e||typeof e!=`object`||Array.isArray(e))throw new yy(`${r}: an object`);if(typeof e.t!=`string`||!_y.test(e.t))throw new yy(`${r}.t: a tag name`);if(!Number.isInteger(e.n)||e.n<1||e.n>99999)throw new yy(`${r}.n: 1 to 99999`);if(!Number.isInteger(e.p)||e.p>=n||e.p<-1||e.p===-1!=(n===0))throw new yy(`${r}.p: an earlier element`);let i={t:e.t,n:e.n,p:e.p,b:Sy(e.b,`${r}.b`)};if(e.h!==void 0){if(typeof e.h!=`string`||e.h.length>t.selector||!gy.test(e.h))throw new yy(`${r}.h: one selector step`);i.h=e.h}for(let n of[`i`,`d`,`r`])e[n]!==void 0&&(i[n]=Cy(e[n],t.attr,`${r}.${n}`));if(e.x!==void 0&&(i.x=Cy(e.x,t.text,`${r}.x`)),e.l!==void 0){if(e.l!==1||i.x===void 0)throw new yy(`${r}.l: 1 with a text`);i.l=1}if(e.z!==void 0){if(!Number.isInteger(e.z)||e.z<0||e.z>=a||o.has(e.z))throw new yy(`${r}.z: a distinct rank`);o.add(e.z),i.z=e.z}if(e.c!==void 0&&(i.c=Sy(e.c,`${r}.c`)),e.a!==void 0){if(!Number.isInteger(e.a)||e.a<-1||e.a>=a)throw new yy(`${r}.a: an element or -1`);i.a=e.a}return i})};return e.truncated===!0&&(s.truncated=!0),s}var Ty=(e,t)=>e.length>t?`${e.slice(0,t-3)}...`:e;function Ey(e,t){let n=[],r=t,i=0;for(;r>=0&&i<1e4;){let t=e.elements[r];if(!t)break;if(t.h){n.unshift(t.h);break}n.unshift(`${t.t}:nth-of-type(${t.n})`),r=t.p,i+=1}let a=n.join(` > `);for(;a.length>uy.selector&&n.length>1;)n.shift(),a=n.join(` > `);return a.length>uy.selector?``:a}function Dy(e,t,n){let r=-1,i=-1,a=e?.elements||[];for(let e=0;e<a.length;e+=1){let o=a[e];if(o.z===void 0||o.z<=i)continue;let[s,c,l,u]=o.c||o.b;t>=s&&t<s+l&&n>=c&&n<c+u&&(r=e,i=o.z)}if(r<0)return-1;let o=a[r].a;return o===void 0?r:o}function Oy(e,t,n){let r=e.elements[t],i=Ey(e,t),a=i?i.split(` > `).pop():r.t,o=r.x||``,[s,c,l,u]=r.b,d=n?.width&&n?.height?l*u/(n.width*n.height):0;return{label:`${Ty(a,48)}${o?` "${Ty(o,28)}"`:``}`,large:d>.2,rect:{left:s,top:c,width:l,height:u}}}function ky(e,t,n,r=null){let i=Dy(e,t,n);if(i<0)return null;let a=e.elements[i],[o,s,c,l]=a.b;if(!c||!l)return null;let u=Ey(e,i);if(!u||!hy.test(u))return null;let d=e=>Math.max(0,Math.min(1,e)),f=e=>Math.round(d(e)*1e4)/1e4;return{selector:u,text:a.x||``,dx:f((t-o)/c),dy:f((n-s)/l),...r?.width&&r?.height?{w:f(c/r.width),h:f(l/r.height)}:{}}}function Ay(e){return e.replace(/\\(?:([0-9a-fA-F]{1,6}) ?|([^\n\r\f]))/g,(e,t,n)=>{if(t===void 0)return n;let r=parseInt(t,16);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}var jy={id:RegExp(`#(${fy})`,`y`),tag:/([a-z][a-z0-9-]{0,40})/y,attr:RegExp(`\\[(data-testid|aria-label)="(${py})"\\]`,`y`),nth:/:nth-of-type\(([1-9][0-9]{0,4})\)/y,join:/ > /y};function My(e){if(typeof e!=`string`||!hy.test(e))return null;let t=[],n=0,r=t=>{t.lastIndex=n;let r=t.exec(e);return r&&(n=t.lastIndex),r};for(;n<e.length;){if(t.length&&!r(jy.join))return null;let e=r(jy.id);if(e){t.push({id:Ay(e[1])});continue}if(e=r(jy.tag),!e)return null;let n=e[1];if(e=r(jy.attr),e)t.push({tag:n,[e[1]===`data-testid`?`testId`:`label`]:Ay(e[2])});else{if(e=r(jy.nth),!e)return null;t.push({tag:n,nth:Number(e[1])})}}return t}function Ny(e,t){return t.id===void 0?e.t===t.tag?t.testId===void 0?t.label===void 0?e.n===t.nth:e.r===t.label:e.d===t.testId:!1:e.i===t.id}function Py(e,t){let n=My(t);if(!n?.length)return-1;let r=e?.elements||[],i=n[n.length-1];for(let e=0;e<r.length;e+=1){if(!Ny(r[e],i))continue;let t=r[e].p,a=!0;for(let e=n.length-2;e>=0;--e){if(t<0||!Ny(r[t],n[e])){a=!1;break}t=r[t].p}if(a)return e}return-1}function Fy(e){let t=String(e).split(`>`).pop().trim(),n=/^([a-z][a-z0-9-]*)/i.exec(t);return n?n[1].toLowerCase():null}function Iy(e,t,n){if(!e?.elements?.length||!t?.selector||!n||!hy.test(t.selector))return null;let r=String(t.text||``),i=e.elements,a=Py(e,t.selector);a>=0&&r&&!(i[a].x||``).startsWith(r)&&(a=-1);let o=Fy(t.selector);if(a<0&&r&&o){let e=1/0;for(let t=0;t<i.length;t+=1){let n=i[t];if(n.t!==o||n.l||n.x!==r)continue;let s=n.b[2]*n.b[3];s>0&&s<e&&(a=t,e=s)}}if(a<0)return null;let[s,c,l,u]=i[a].b;if(!l&&!u)return null;let d=(e,t)=>Math.max(0,Math.min(100,e/t*100)),f=Number.isFinite(t.dx)?t.dx:.5,p=Number.isFinite(t.dy)?t.dy:.5;return{x:d(s+f*l,n.width),y:d(c+p*u,n.height),box:{left:d(s,n.width),top:d(c,n.height),right:d(s+l,n.width),bottom:d(c+u,n.height)}}}var Ly=12,Ry=new Map;function zy(e){if(Ry.has(e)){let t=Ry.get(e);return Ry.delete(e),Ry.set(e,t),t}let t=fetch(e,{headers:{Accept:`application/json`},credentials:`same-origin`}).then(e=>e.ok?e.json():null).then(e=>e?wy(e):null).catch(()=>null);for(t.then(t=>{t||Ry.delete(e)}),Ry.set(e,t);Ry.size>Ly;)Ry.delete(Ry.keys().next().value);return t}function By(e){let[t,n]=(0,J.useState)({url:null,map:null,state:`off`});return(0,J.useEffect)(()=>{if(!e)return;let t=!0;return zy(e).then(r=>{t&&n({url:e,map:r,state:r?`ready`:`failed`})}),()=>{t=!1}},[e]),e?t.url===e?t:{map:null,state:`loading`}:{map:null,state:`off`}}function Vy(e){try{let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)?t.href:null}catch{return null}}function Hy({value:e,touch:t}){if(!e)return null;let n=Vy(e);return(0,Y.jsxs)(`p`,{className:`mt-1 flex min-w-0 items-center gap-1 text-xs text-muted`,"data-sw-fix-ref":`true`,children:[(0,Y.jsx)(Hh,{size:12,className:`shrink-0`,"aria-hidden":`true`}),` `,(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Fixed in`}),` `,n?(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer noopener`,className:K(`truncate text-accent hover:underline`,t&&`py-2`),children:e}):(0,Y.jsx)(`code`,{className:`truncate font-mono text-[11px] text-fg`,children:e})]})}var Uy={open:Hh,merged:Rh,closed:Bh};function Wy({github:e,touch:t}){let n=e?.issue,r=e?.pulls||[];if(!n&&!r.length)return null;let i=K(`inline-flex min-w-0 items-center gap-1 text-accent hover:underline`,t&&`min-h-11`);return(0,Y.jsxs)(`p`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-muted`,"data-sw-github":`true`,children:[n&&Vy(n.url)?(0,Y.jsxs)(`a`,{href:Vy(n.url),target:`_blank`,rel:`noreferrer noopener`,className:i,"data-sw-github-issue-link":n.number,children:[(0,Y.jsx)(nh,{size:12,className:`shrink-0`,"aria-hidden":`true`}),` Issue #`,n.number]}):null,r.map(e=>{let t=Uy[e.state]||Hh,n=Vy(e.url);return n?(0,Y.jsxs)(`a`,{href:n,target:`_blank`,rel:`noreferrer noopener`,className:i,"aria-label":e.title?`PR #${e.number} ${e.state}: ${e.title}`:void 0,"data-sw-github-pull":e.number,"data-sw-github-pull-state":e.state,children:[(0,Y.jsx)(t,{size:12,className:`shrink-0`,"aria-hidden":`true`}),` PR #`,e.number,(0,Y.jsx)(`span`,{className:`text-faint`,children:e.state})]},e.number):null})]})}var Gy={queued:{label:`Queued`,tone:`neutral`},working:{label:`Agent working`,tone:`accent`},done:{label:`Agent done`,tone:`ok`},"needs-human":{label:`Needs a person`,tone:`warn`},"branch-ready":{label:`Fix ready on branch`,tone:`accent`}};function Ky({status:e,at:t=null,branch:n=null}){let r=Gy[e];if(!r)return null;let i=e===`branch-ready`&&n,a=i?`${r.label} ${n}`:r.label;return(0,Y.jsxs)(Be,{tone:r.tone,"aria-label":t?`Agent status: ${a} (${Ee(t)})`:`Agent status: ${a}`,"data-sw-agent-status":e,className:i?`max-w-full`:void 0,children:[(0,Y.jsx)(S,{size:10,"aria-hidden":`true`}),` `,i?(0,Y.jsxs)(Y.Fragment,{children:[r.label,` `,(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:n})]}):a]})}function qy({comment:e}){return e.status!==`open`||!e.reopenCount?null:(0,Y.jsxs)(Be,{tone:`bad`,"data-sw-reopened":e.reopenCount,children:[(0,Y.jsx)(Jg,{size:10,"aria-hidden":`true`}),` Reopened`,e.reopenCount>1?` ${e.reopenCount}x`:``]})}function Jy({name:e,handle:t,agent:n}){return n===!0||n===void 0&&!t&&/agent|bot/i.test(e||``)}function Yy({name:e,handle:t,agent:n,className:r}){let i=Jy({name:e,handle:t,agent:n});return(0,Y.jsxs)(`span`,{className:K(`inline-flex min-w-0 items-center gap-1`,r),children:[(0,Y.jsx)(`span`,{className:`truncate font-semibold text-fg`,"data-sw-author":i?`agent`:`person`,children:e}),t?(0,Y.jsxs)(`span`,{className:`shrink-0 text-faint`,children:[`@`,t]}):null,n===!0?(0,Y.jsx)(Be,{shape:`tag`,className:`bg-line text-fg`,children:`agent`}):null]})}var Xy=({name:e,handle:t})=>String(e||t||``).toLowerCase();function Zy({name:e,handle:t,agent:n,size:r=`md`,className:i}){return(0,Y.jsx)(se,{person:!0,agent:Jy({name:e,handle:t,agent:n}),name:e,colorKey:Xy({name:e,handle:t}),size:r,className:i})}var Qy=e=>({name:e.author,handle:e.authorHandle,agent:e.authorAgent}),$y=e=>({name:e.author,handle:e.handle,agent:e.agent}),eb=e=>`${e} ${e===1?`reply`:`replies`}`,tb={a:`link`,button:`button`,input:`field`,textarea:`text box`,select:`menu`,img:`image`,svg:`icon`,h1:`heading`,h2:`heading`,h3:`heading`,h4:`heading`,p:`text`,li:`list item`,label:`label`,nav:`navigation`,table:`table`,th:`column header`,td:`table cell`,form:`form`,header:`header`,footer:`footer`};function nb(e){if(!e)return null;let t=String(e.selector||``).split(` > `).pop(),n=tb[/^([a-z][a-z0-9-]*)/i.exec(t)?.[1]?.toLowerCase()||``]||`element`,r=String(e.text||``).replace(/\s+/g,` `).trim();if(r){let e=r.length>48?`${r.slice(0,47)}…`:r;return n===`text`||n===`element`?`“${e}”`:`the “${e}” ${n}`}let i=(/\[(?:data-testid|aria-label|name|id)="([^"]+)"\]/.exec(t)?.[1]||/#([\w-]+)/.exec(t)?.[1]||``).replace(/[-_]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase().trim();return i?`the ${i} ${n}`:`a ${n}`}function rb(e){let t=new Date(Ne(e));return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}):``}var ib=(0,J.createContext)([]);function ab({text:e,className:t,plain:n=!1}){let r=(0,J.useContext)(ib),a=(0,J.useMemo)(()=>n?[{text:String(e??``)}]:B(e),[e,n]);return(0,Y.jsx)(`span`,{className:t,children:a.map((e,t)=>e.handle&&i(e.handle,r)?(0,Y.jsxs)(`span`,{className:K(`inline-flex items-baseline gap-0.5 rounded px-1 font-medium`,Qe(e.handle)?`bg-warn/15 text-fg`:`bg-accent/10 text-accent`),"data-sw-mention":e.handle,children:[Qe(e.handle)?(0,Y.jsx)(S,{size:11,className:`self-center`,"aria-hidden":`true`}):null,e.text]},t):(0,Y.jsx)(`span`,{children:e.text},t))})}function ob(e,t){let n=/(^|[^\w@.])@([\w.-]{0,40})$/.exec(e.slice(0,t));return n?{query:n[2].toLowerCase(),start:t-n[2].length-1}:null}function sb({value:e,onChange:t,people:n,className:r,onKeyDown:i,size:a,...o}){let s=(0,J.useRef)(null),c=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let t=s.current,n=c.current;t&&n!==null&&t.value===e&&(c.current=null,t.focus(),t.setSelectionRange(n,n))},[e]);let l=(0,J.useId)(),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(0),m=(0,J.useMemo)(()=>{if(!u)return[];let{query:e}=u,t=e=>[e.handle,...e.aliases||[]],r=n.filter(e=>e.known!==!1).filter(n=>t(n).some(t=>t.startsWith(e))||n.name.toLowerCase().includes(e)).map(n=>({...n,exact:!!e&&t(n).includes(e)}));return[...r.filter(e=>e.exact),...r.filter(e=>!e.exact)].slice(0,6)},[n,u]),h=m.length>0,g=e=>{let t=ob(e.value,e.selectionStart??e.value.length);d(t),p(0)},_=n=>{let r=s.current;if(!r||!u)return;let i=r.selectionStart??e.length,a=`@${n.handle} `;t(`${e.slice(0,u.start)}${a}${e.slice(i)}`),d(null),c.current=u.start+a.length};return(0,Y.jsxs)(Ye,{open:h,onOpenChange:e=>e?null:d(null),history:!1,children:[(0,Y.jsx)(ce,{asChild:!0,children:(0,Y.jsx)(Fe,{ref:s,size:a,value:e,onChange:e=>{t(e.target.value),g(e.target)},onClick:e=>g(e.currentTarget),onBlur:()=>window.setTimeout(()=>d(null),150),onKeyDown:e=>{if(h&&!e.nativeEvent.isComposing){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),p(t=>(t+(e.key===`ArrowDown`?1:m.length-1))%m.length);return}if(e.key===`Enter`&&f===0&&m[0].exact)d(null);else if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),_(m[f]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation?.(),d(null);return}}i?.(e)},className:r,"aria-autocomplete":`list`,"aria-expanded":h,"aria-controls":h?l:void 0,"aria-activedescendant":h?`${l}-${f}`:void 0,...o})}),(0,Y.jsx)(qe,{id:l,role:`listbox`,"aria-label":`Mention someone`,side:`bottom`,className:`max-h-56 w-[var(--radix-popover-trigger-width)] overflow-y-auto`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{e.target===s.current&&e.preventDefault()},"data-sw-mention-list":`true`,children:m.map((e,t)=>(0,Y.jsx)(`div`,{id:`${l}-${t}`,role:`option`,"aria-selected":t===f,children:(0,Y.jsxs)(`button`,{type:`button`,tabIndex:-1,onMouseDown:t=>{t.preventDefault(),_(e)},className:K(`flex w-full min-w-0 items-center gap-2 rounded-md px-2 text-left text-[13px]`,`h-11 lg:h-8`,t===f?`bg-accent/10 text-fg`:`text-muted hover:bg-surface-2`,`transition-colors`),"data-sw-mention-option":e.handle,children:[(0,Y.jsx)(se,{person:!0,agent:!!e.agent,name:e.name,colorKey:Xy(e),size:`sm`,className:`shrink-0`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-medium text-fg`,children:e.agent?`@`+e.handle:e.name}),(0,Y.jsx)(`span`,{className:`min-w-0 shrink truncate text-xs text-faint`,children:e.agent?e.name===e.handle?`agent`:e.name:`@`+e.handle})]})},e.handle))})]})}var cb={"false,false":`rounded-bl-none`,"true,false":`rounded-br-none`,"false,true":`rounded-tl-none`,"true,true":`rounded-tr-none`},lb=`[@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-2 [@media(pointer:coarse)]:before:content-['']`;function ub(e,t,n,r,i=!1){let a=e=>Math.round(e*8)/8,o=t*e;if(o<150&&!i)return`dot:${a(Math.min(60,1/e))}`;let s=n?28:Math.max(18,Math.min(28,o/14));return`full:${a(Math.min(r,Math.max(.3,s/28/e)))||.125}`}function db(e){return e.status===`resolved`?`resolved`:e.agentStatus||(e.reopenCount?`reopened`:`open`)}var fb={resolved:`border-ok`,"needs-human":`border-warn`,"branch-ready":`border-accent`,reopened:`border-bad`};function pb(e,t,n=1){return{left:`${e.x}%`,top:`${e.y}%`,transform:`translate(${e.flipX?`-100%`:`0`}, ${e.flipY?`0`:`-100%`}) scale(${t*n})`,transformOrigin:`${e.flipY?`top`:`bottom`} ${e.flipX?`right`:`left`}`}}var mb=e=>String(e||``).split(`
19
+ `)[0];function hb({comment:e,moved:t}){let n=Qy(e),r=e.replies?.length||0;return(0,Y.jsxs)(`div`,{"data-sw-pin-preview":e.id,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Y.jsx)(Zy,{...n,size:`sm`}),(0,Y.jsx)(Yy,{...n}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-faint`,children:Ee(e.createdAt)})]}),(0,Y.jsx)(ab,{text:mb(e.body),plain:!!e.authorGuest,className:`mt-1.5 line-clamp-2 block text-ui break-words text-fg`}),(0,Y.jsxs)(`p`,{className:`mt-1.5 flex flex-wrap items-center gap-x-2 text-xs text-muted`,children:[(0,Y.jsx)(`span`,{children:r?eb(r):`No replies yet`}),e.status===`resolved`?(0,Y.jsx)(`span`,{className:`text-fg`,children:`Resolved`}):null,t?(0,Y.jsx)(`span`,{className:`text-fg`,children:`Its element is not on the page anymore`}):null]})]})}function gb({dot:e=!1}){return(0,Y.jsx)(`span`,{className:K(`pointer-events-none absolute rounded-full ring-2 ring-accent motion-safe:animate-ping`,e?`-inset-1`:`-inset-1.5`),"aria-hidden":`true`,"data-sw-pin-working":`true`})}function _b({comment:e,spot:t,scale:n,selected:r,unread:i,working:a,onSelect:o,onHover:s,touch:c,label:l}){let u=Qy(e),d=Jy(u);return(0,Y.jsx)(`button`,{type:`button`,tabIndex:-1,className:K(`nodrag nopan absolute z-10 h-2.5 w-2.5 rounded-full border border-white shadow-card`,c&&`pointer-events-none`,e.status===`resolved`&&!r&&`opacity-60`,r?`z-20 ring-2 ring-accent`:i?`ring-2 ring-accent/70`:null,`data-[sw-pin-hover=true]:z-20 data-[sw-pin-hover=true]:ring-2 data-[sw-pin-hover=true]:ring-accent/60`),style:{left:`${t.x}%`,top:`${t.y}%`,transform:`translate(-50%, -50%) scale(${n})`,background:d?be:Re(u.name)},onClick:t=>{t.stopPropagation(),o(e)},onMouseEnter:s?()=>s(e.id):void 0,onMouseLeave:s?()=>s(null):void 0,"aria-label":l,"aria-pressed":r,"data-sw-pin":e.id,"data-sw-pin-look":`dot`,"data-sw-pin-state":db(e),"data-sw-pin-unread":i?`true`:void 0,children:a?(0,Y.jsx)(gb,{dot:!0}):null})}function vb({comment:e,position:t,scale:n,compact:r=!1,selected:i,unread:a,working:o=!1,onSelect:c,onHover:u,touch:d}){let f=zv(e,t),p=!!t?.moved,h=Qy(e),g=Jy(h),_=db(e),v=1+(e.replies?.length||0),y=e.status===`resolved`,b=f.flipX?`-left-1.5`:`-right-1.5`,x=f.flipY?`-bottom-1.5`:`-top-1.5`,C=f.flipX?`-right-0.5`:`-left-0.5`,w=`Comment ${e.id} by ${h.name}${v>1?`, ${eb(v-1)}`:``}${y?`, resolved`:``}${a?`, unread`:``}${p?` (its element moved)`:``}${o?`, an agent is working on it`:``}: ${e.body.slice(0,60)}`,T=r?(0,Y.jsx)(_b,{comment:e,spot:f,scale:n,selected:i,unread:a,working:o,onSelect:c,onHover:u,touch:d,label:w}):(0,Y.jsxs)(`button`,{type:`button`,tabIndex:-1,className:K(`nodrag nopan absolute z-10 flex h-7 w-7 items-center justify-center rounded-full border-2 border-white text-[11px] leading-none font-semibold text-white shadow-pop transition-[box-shadow,opacity] select-none`,cb[`${f.flipX},${f.flipY}`],fb[_],lb,p&&`outline-2 outline-offset-2 outline-warn outline-dashed`,y&&!i&&`opacity-75`,i?`z-20 ring-[3px] ring-accent`:`data-[sw-pin-hover=true]:z-20 data-[sw-pin-hover=true]:ring-[3px] data-[sw-pin-hover=true]:ring-accent/60`),style:{...pb(f,n,i?1.15:1),background:g?be:Re(h.name)},onClick:t=>{t.stopPropagation(),c(e)},onMouseEnter:u?()=>u(e.id):void 0,onMouseLeave:u?()=>u(null):void 0,"aria-label":w,"aria-pressed":i,"data-sw-pin":e.id,"data-sw-pin-state":_,"data-sw-pin-anchor":e.anchor?t?p?`moved`:`element`:`xy`:`none`,"data-sw-pin-unread":a?`true`:void 0,"data-sw-pin-count":v,"data-sw-pin-look":`full`,children:[o?(0,Y.jsx)(gb,{}):null,g?(0,Y.jsx)(S,{size:14,"aria-hidden":`true`}):(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:je(h.name)}),y?(0,Y.jsx)(`span`,{className:K(`absolute flex h-4 w-4 items-center justify-center rounded-full border border-white bg-ok text-ok-fg`,b,x),"aria-hidden":`true`,children:(0,Y.jsx)(m,{size:10,strokeWidth:3})}):v>1?(0,Y.jsx)(`span`,{className:K(`absolute flex h-4 min-w-4 items-center justify-center rounded-full border border-white bg-fg px-1 text-[9px] font-bold text-surface tabular`,b,x),"aria-hidden":`true`,children:v}):null,a?(0,Y.jsx)(`span`,{className:K(`absolute h-2.5 w-2.5 rounded-full border-2 border-white bg-accent`,C,f.flipY?`-bottom-0.5`:`-top-0.5`),"aria-hidden":`true`,"data-sw-pin-dot":`true`}):null]});return d||i?T:(0,Y.jsxs)(ee,{children:[(0,Y.jsx)(s,{asChild:!0,children:T}),(0,Y.jsx)(l,{side:f.flipX?`left`:`right`,align:`start`,children:(0,Y.jsx)(hb,{comment:e,moved:p})})]})}function yb({items:e,scale:t,compact:n=!1,touch:r=!1,working:i=!1,onOpen:a}){let o=e[0].spot,s=e.some(e=>e.unread);return n?(0,Y.jsxs)(`button`,{type:`button`,tabIndex:-1,className:K(`tabular nodrag nopan absolute z-10 flex h-3.5 min-w-3.5 items-center justify-center rounded-full border border-white bg-fg px-0.5 text-[8px] leading-none font-bold text-surface shadow-card`,r&&`pointer-events-none`,s&&`ring-2 ring-accent/70`),style:{left:`${o.x}%`,top:`${o.y}%`,transform:`translate(-50%, -50%) scale(${t})`},onClick:t=>{t.stopPropagation(),a(e)},"aria-label":`${e.length} comments here${s?`, some unread`:``}: zoom in`,"data-sw-pin-cluster":e.map(e=>e.comment.id).join(`,`),"data-sw-pin-look":`dot`,children:[e.length,i?(0,Y.jsx)(gb,{dot:!0}):null]}):(0,Y.jsxs)(`button`,{type:`button`,tabIndex:-1,className:K(`nodrag nopan absolute z-10 flex h-8 min-w-8 items-center justify-center rounded-full border-2 border-white bg-fg px-1.5 text-xs font-bold text-surface shadow-pop tabular`,cb[`${o.flipX},${o.flipY}`],lb),style:pb(o,t),onClick:t=>{t.stopPropagation(),a(e)},"aria-label":`${e.length} comments here${s?`, some unread`:``}: zoom in`,"data-sw-pin-cluster":e.map(e=>e.comment.id).join(`,`),children:[e.length,i?(0,Y.jsx)(gb,{}):null,s?(0,Y.jsx)(`span`,{className:`absolute -top-0.5 -left-0.5 h-2.5 w-2.5 rounded-full border-2 border-white bg-accent`,"aria-hidden":`true`}):null]})}function bb(e,t,n,r=null,i=30){let a=[];for(let o of e){let e=o.spot.x/100*t.w*n,s=o.spot.y/100*t.h*n;if(o.comment.id===r){a.push({items:[o],px:e,py:s,alone:!0});continue}let c=a.find(t=>!t.alone&&Math.hypot(t.px-e,t.py-s)<i);c?c.items.push(o):a.push({items:[o],px:e,py:s,alone:!1})}return a}function xb({draft:e,scale:t,name:n,colorKey:r}){let i=zv(e);return(0,Y.jsx)(`span`,{className:K(`pointer-events-none absolute z-20 flex h-7 w-7 items-center justify-center rounded-full border-2 border-white text-[11px] font-semibold text-white shadow-pop ring-[3px] ring-accent`,cb[`${i.flipX},${i.flipY}`]),style:{...pb(i,t),background:Re(r||n||`you`)},"aria-hidden":`true`,"data-sw-draft-pin":`true`,children:je(n||`You`)})}var Sb=new Set,Cb={focusedKey:null,selectingKey:null,settledZoom:null,selectedComment:null,draftSpot:null,unread:Sb,liveKeys:Sb,hoveredId:null};function wb(e=null){let t={...Cb,...e},n=new Set;return{get:()=>t,set(e){let r=null;for(let n of Object.keys(e))Object.is(t[n],e[n])||(r||={...t},r[n]=e[n]);if(r){t=r;for(let e of[...n])e()}},subscribe(e){return n.add(e),()=>n.delete(e)}}}var Tb=wb(),Eb=(0,J.createContext)(Tb),Db=()=>(0,J.useContext)(Eb);function Ob(e){let t=(0,J.useContext)(Eb),n=(0,J.useCallback)(()=>e(t.get()),[t,e]);return(0,J.useSyncExternalStore)(t.subscribe,n,n)}var kb=String.raw`(?:#(?:[A-Za-z0-9_\u0080-￿-]|\\[0-9a-fA-F]{6} ?|\\[0-9a-fA-F]{1,5}(?![0-9a-fA-F]) ?|\\[^0-9a-fA-F\n\r\f])+|[a-z][a-z0-9-]{0,40}(?:\[(?:data-testid|aria-label)="(?:[^"\\\n]|\\.){0,200}"\]|:nth-of-type\([1-9][0-9]{0,4}\)))`;RegExp(`^${kb}(?: > ${kb}){0,79}$`);var Ab=5242880,jb={"image/png":`png`,"image/jpeg":`jpg`,"image/webp":`webp`,"image/gif":`gif`},Mb=5242880,Nb=[`image/png`,`image/jpeg`,`image/webp`,`image/gif`],Pb=1600;function Fb(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}async function Ib(e,t,n=null){let r=await Fb(e);return{id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:t,mediaType:e.type,data:r.split(`,`)[1],preview:r,source:n}}function Lb(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The image could not be loaded.`)),r.src=e})}function Rb(e,t,n,r=`image/png`){let i=Math.min(1,n/Math.max(t.width,t.height)),a=document.createElement(`canvas`);return a.width=Math.max(1,Math.round(t.width*i)),a.height=Math.max(1,Math.round(t.height*i)),a.getContext(`2d`).drawImage(e,t.x,t.y,t.width,t.height,0,0,a.width,a.height),new Promise((e,t)=>a.toBlob(n=>n?e(n):t(Error(`Could not crop the screenshot.`)),r,.9))}async function zb(e){let t=e.name||`That image`;if(!Nb.includes(e.type))throw Error(`${t} is not a PNG, JPEG, WebP or GIF image.`);if(e.size<=Mb)return Ib(e,e.name||`pasted-image.png`);let n=URL.createObjectURL(e);try{let r=await Lb(n),i=await Rb(r,{x:0,y:0,width:r.naturalWidth,height:r.naturalHeight},2048,`image/jpeg`);if(i.size>Mb)throw Error(`${t} is larger than 5 MB.`);return Ib(i,`${(e.name||`image`).replace(/\.\w+$/,``)}.jpg`)}finally{URL.revokeObjectURL(n)}}async function Bb(e,{name:t,point:n=null,source:r}){let i=await Lb(e),a=i.naturalWidth,o=i.naturalHeight,s={x:0,y:0,width:a,height:o};if(n){let e=Math.min(a,900),t=Math.min(o,700),r=n.x/100*a,i=n.y/100*o;s={x:Math.round(Math.min(Math.max(0,r-e/2),a-e)),y:Math.round(Math.min(Math.max(0,i-t/2),o-t)),width:e,height:t}}return Ib(await Rb(i,s,n?900:Pb,n?`image/png`:`image/jpeg`),t,r)}function Vb(e){return[...e||[]].filter(e=>e.type?.startsWith(`image/`))}var Hb=Object.keys(jb).join(`,`),Ub=Ab/1048576,Wb=2560;async function Gb(e){let t=await createImageBitmap(e,{imageOrientation:`from-image`});try{let n=Math.min(1,Wb/Math.max(t.width,t.height)),r=document.createElement(`canvas`);r.width=Math.max(1,Math.round(t.width*n)),r.height=Math.max(1,Math.round(t.height*n)),r.getContext(`2d`).drawImage(t,0,0,r.width,r.height);let i=await new Promise((e,t)=>r.toBlob(n=>n?e(n):t(Error(`The photo could not be read.`)),`image/jpeg`,.9));return new File([i],e.name||`photo.jpg`,{type:`image/jpeg`})}finally{t.close?.()}}async function Kb(e){let t=e.name?`"${e.name}"`:`That image`;if(!jb[e.type])throw Error(`${t} is not a PNG, JPEG, WebP or GIF image.`);let n=e;if(e.type===`image/jpeg`&&typeof createImageBitmap==`function`)try{n=await Gb(e)}catch{throw Error(`${t} could not be read as an image.`)}let r=await zb(n).catch(e=>{throw Error(e.message?.includes(`5 MB`)?`${t} is larger than ${Ub} MB.`:e.message||`${t} could not be read.`)});if(r.data.length*3/4>5242880)throw Error(`${t} is larger than ${Ub} MB.`);return r}var qb=e=>e.filter(e=>e.state===`ready`).map(({name:e,mediaType:t,data:n})=>({name:e,mediaType:t,data:n}));function Jb({enabled:e=!0,max:t=4}={}){let[n,r]=(0,J.useState)([]),[i,a]=(0,J.useState)(null),o=(0,J.useRef)(0);return o.current=n.length,{images:n,error:i,setError:a,add:(0,J.useCallback)(async n=>{let i=[...n||[]];if(!e||!i.length)return;let s=t-o.current;if(s<=0)a(`A comment holds at most ${t} images.`);else{a(i.length>s?`Only ${s===1?`one more image fits`:`${s} more images fit`}: a comment holds ${t}.`:null);for(let e of i.slice(0,s)){let t=`img-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;o.current+=1,r(n=>[...n,{id:t,name:e.name||`pasted image`,preview:null,state:`reading`}]);try{let n=await Kb(e);r(e=>e.map(e=>e.id===t?{...n,id:t,state:`ready`}:e))}catch(e){--o.current,r(e=>e.filter(e=>e.id!==t)),a(e.message)}}}},[e,t]),remove:(0,J.useCallback)(e=>{r(t=>t.filter(t=>t.id!==e)),a(null)},[]),clear:(0,J.useCallback)(()=>{r([]),a(null)},[]),reading:n.some(e=>e.state===`reading`)}}function Yb(e){return[...e?.files||[]].filter(e=>e.type?.startsWith(`image/`))}var Xb=[`accent`,`bad`,`warn`],Zb=2e3,Qb=8e-4;function $b([e,t],[n,r],[i,a]){let o=i-n,s=a-r,c=o*o+s*s,l=c?Math.max(0,Math.min(1,((e-n)*o+(t-r)*s)/c)):0,u=n+l*o-e,d=r+l*s-t;return Math.sqrt(u*u+d*d)}function ex(e,t=Qb){if(e.length<=2)return e.slice();let n=new Uint8Array(e.length);n[0]=1,n[e.length-1]=1;let r=[[0,e.length-1]];for(;r.length;){let[i,a]=r.pop(),o=-1,s=-1;for(let t=i+1;t<a;t+=1){let n=$b(e[t],e[i],e[a]);n>o&&(o=n,s=t)}s!==-1&&o>t&&(n[s]=1,r.push([i,s],[s,a]))}let i=e.filter((e,t)=>n[t]);return i.filter((e,t)=>t===0||e[0]!==i[t-1][0]||e[1]!==i[t-1][1])}function tx(e){let t=1,n=1,r=0,i=0;for(let a of e?.shapes||[])for(let[e,o]of a.points)t=Math.min(t,e),n=Math.min(n,o),r=Math.max(r,e),i=Math.max(i,o);return r<t||i<n?null:{x:t,y:n,width:r-t,height:i-n}}var nx={accent:`Accent`,bad:`Red`,warn:`Orange`},rx=.004,ix=null,ax=new Set,ox=()=>ax.forEach(e=>e()),sx={get:()=>ix,start(e,t){(ix?.key!==e||ix.owner!==t)&&(ix={key:e,owner:t,tool:null,ink:Xb[0],shapes:[]},ox())},moveTo(e,t){ix?.owner===t&&(ix.key!==e&&(ix={...ix,key:e,shapes:[]}),ox())},set(e){ix&&(ix={...ix,...e},ox())},add(e){!ix||ix.shapes.length>=40||(ix={...ix,shapes:[...ix.shapes,e]},ox())},undo(){ix?.shapes.length&&(ix={...ix,shapes:ix.shapes.slice(0,-1)},ox())},clear(){ix?.shapes.length&&(ix={...ix,shapes:[]},ox())},end(e){ix&&(!e||ix.owner===e)&&(ix=null,ox())},subscribe(e){return ax.add(e),()=>ax.delete(e)}};function cx(e=e=>e){return(0,J.useSyncExternalStore)(sx.subscribe,()=>e(ix),()=>e(null))}function lx(e){return e?.length?{shapes:e}:void 0}var ux=e=>Math.min(1,Math.max(0,e)),dx=e=>Math.round(e*1e4)/1e4,fx=(e,t)=>[dx(ux((t.clientX-e.left)/e.width)),dx(ux((t.clientY-e.top)/e.height))];function px(e,t,n){if(!n.length)return null;if(e===`pen`){let r=ex(n.slice(0,Zb));return r.length<2?null:{tool:e,ink:t,width:4,points:r}}let[r,i]=[n[0],n.at(-1)];return Math.hypot(i[0]-r[0],i[1]-r[1])<rx?null:{tool:e,ink:t,width:4,points:[r,i]}}function mx(e,t,n){let r=e.points.map(([e,r])=>[e*t,r*n]);if(e.tool===`box`){let[[e,t],[n,i]]=r;return[`M${e} ${t}H${n}V${i}H${e}Z`]}let i=`M${r.map(([e,t])=>`${e} ${t}`).join(`L`)}`;if(e.tool!==`arrow`)return[i];let[[a,o],[s,c]]=r,l=Math.atan2(c-o,s-a),u=Math.max(10,e.width*5),d=e=>`${s+Math.cos(l+e)*u} ${c+Math.sin(l+e)*u}`;return[i,`M${d(Math.PI*.82)}L${s} ${c}L${d(-Math.PI*.82)}`]}function hx(e,t){let n=[],r=0;for(let i of[e,...e?.replies||[]]){if(!i?.drawing?.shapes?.length)continue;let e=i.drawing.captureVersion;!e||!t||e===t?n.push(...i.drawing.shapes):r+=1}return{shapes:n,previous:r}}var gx=e=>[e,...e?.replies||[]].some(e=>e?.drawing?.shapes?.length),_x=[{id:`box`,label:`Box`,icon:b_},{id:`arrow`,label:`Arrow`,icon:Hm},{id:`pen`,label:`Pen`,icon:Km}],vx={accent:`bg-accent`,bad:`bg-bad`,warn:`bg-warn`},yx={accent:`var(--accent)`,bad:`var(--bad)`,warn:`var(--warn)`};function bx({shapes:e,width:t,height:n,crop:r=null,className:i,...a}){if(!e?.length)return null;let o=r?`${r.left} ${r.top} ${r.width} ${r.height}`:`0 0 ${t} ${n}`;return(0,Y.jsx)(`svg`,{className:K(`pointer-events-none absolute inset-0 h-full w-full`,r?`overflow-hidden`:`overflow-visible`,i),viewBox:o,preserveAspectRatio:`none`,"aria-hidden":`true`,...a,children:e.map((e,r)=>mx(e,t,n).map((t,n)=>(0,Y.jsx)(`path`,{d:t,fill:`none`,stroke:yx[e.ink]||yx.accent,strokeWidth:e.width,strokeLinecap:`round`,strokeLinejoin:`round`},`${r}-${n}`)))})}function xx({tool:e,ink:t,width:n,height:r,className:i,children:a}){let[o,s]=(0,J.useState)(null),c=(0,J.useRef)([]),l=(0,J.useRef)(null),u=e=>fx(l.current.getBoundingClientRect(),e),d=(n,r)=>{if(!c.current.length)return;n.currentTarget.releasePointerCapture?.(n.pointerId);let i=r?px(e,t,c.current):null;c.current=[],s(null),i&&sx.add(i)};return(0,Y.jsxs)(`div`,{ref:l,className:K(`nodrag nopan absolute inset-0 z-[25] cursor-crosshair touch-none select-none`,i),onPointerDown:n=>{n.button===0&&(n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture?.(n.pointerId),c.current=[u(n)],s({tool:e,ink:t,width:4,points:[c.current[0],c.current[0]]}))},onPointerMove:n=>{if(!c.current.length)return;n.stopPropagation();let r=u(n);e===`pen`?c.current.push(r):c.current=[c.current[0],r],s({tool:e,ink:t,width:4,points:e===`pen`?[...c.current]:c.current})},onPointerUp:e=>d(e,!0),onPointerCancel:e=>d(e,!1),onClick:e=>e.stopPropagation(),"data-sw-draw-input":e,children:[a,o?(0,Y.jsx)(bx,{shapes:[o],width:n,height:r}):null]})}function Sx({frameKey:e,native:t,shown:n}){let r=cx(t=>t?.key===e?t:null);return!r&&!n?.shapes.length?null:(0,Y.jsxs)(Y.Fragment,{children:[n?.shapes.length?(0,Y.jsx)(bx,{shapes:n.shapes,width:t.width,height:t.height,className:`z-[6]`,"data-sw-drawing":n.id}):null,r?(0,Y.jsx)(bx,{shapes:r.shapes,width:t.width,height:t.height,className:`z-[6]`,"data-sw-drawing":`draft`}):null,r?.tool?(0,Y.jsx)(xx,{tool:r.tool,ink:r.ink,width:t.width,height:t.height}):null]})}function Cx(e){(0,J.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),sx.set({tool:null}))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e])}function wx({touch:e,label:t,tooltip:n,narrow:i,className:a,...o}){return e?(0,Y.jsx)(r,{variant:`ghost`,size:`icon`,"aria-label":t,className:K(i?`w-8`:`w-10`,a),...o}):(0,Y.jsx)(z,{size:`icon-sm`,label:t,tooltip:n,className:K(i?`w-6`:`w-7`,a),...o})}var Tx=({touch:e})=>(0,Y.jsx)(`span`,{className:K(`h-4 w-px shrink-0 bg-line`,e?`mx-1`:`mx-0.5`),"aria-hidden":`true`});function Ex({owner:e,touch:t,onTool:n=null,leading:r=null,compact:i=!1,showCount:a=!0,className:o}){let s=cx(t=>t?.owner===e?t:null);Cx(!!s?.tool);let c=s?.shapes.length||0,l=!i||!!s?.tool||c>0;return(0,Y.jsxs)(`div`,{className:K(`flex min-w-0 flex-nowrap items-center`,o),role:`group`,"aria-label":`Draw on the page`,"data-sw-draw-tools":e,children:[r?(0,Y.jsxs)(Y.Fragment,{children:[r,(0,Y.jsx)(Tx,{touch:t})]}):null,_x.map(e=>{let r=s?.tool===e.id;return(0,Y.jsx)(wx,{touch:t,variant:r?`soft`:`ghost`,"aria-pressed":r,className:K(r&&`ring-1 ring-accent/50`),label:r?`${e.label}: on. Draw on the page, Esc stops`:`Draw a ${e.label.toLowerCase()} on the page`,tooltip:r&&!t?`${e.label} (Esc stops drawing)`:e.label,onClick:()=>{sx.set({tool:r?null:e.id}),r||n?.(e.id)},"data-sw-draw-tool":e.id,children:(0,Y.jsx)(e.icon,{size:15,"aria-hidden":`true`})},e.id)}),l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Tx,{touch:t}),Xb.map(e=>{let n=(s?.ink||Xb[0])===e;return(0,Y.jsx)(wx,{touch:t,narrow:!0,"aria-pressed":n,label:`${nx[e]} ink`,tooltip:`${nx[e]} ink`,onClick:()=>sx.set({ink:e}),"data-sw-draw-ink":e,children:(0,Y.jsx)(`span`,{className:K(`block h-3.5 w-3.5 rounded-full`,vx[e],n?`ring-2 ring-fg ring-offset-1 ring-offset-surface`:``),"aria-hidden":`true`})},e)}),(0,Y.jsx)(Tx,{touch:t}),(0,Y.jsx)(wx,{touch:t,label:`Undo the last shape`,tooltip:`Undo`,disabled:!c,onClick:()=>sx.undo(),"data-sw-draw-undo":`true`,children:(0,Y.jsx)(A_,{size:15,"aria-hidden":`true`})}),(0,Y.jsx)(wx,{touch:t,label:`Clear the drawing`,tooltip:`Clear`,disabled:!c,onClick:()=>sx.clear(),"data-sw-draw-clear":`true`,children:(0,Y.jsx)(E_,{size:15,"aria-hidden":`true`})})]}):null,a&&c?(0,Y.jsx)(Dx,{count:c,className:`ml-auto pl-1`}):null]})}function Dx({count:e,className:t}){return(0,Y.jsxs)(`span`,{className:K(`shrink-0 text-caption whitespace-nowrap text-faint tabular-nums`,t),"aria-live":`polite`,"data-sw-draw-count":e,children:[e,` `,e===1?`shape`:`shapes`]})}function Ox({owner:e}){return(0,Y.jsxs)(`div`,{className:`pointer-events-auto flex max-w-full items-center gap-1 rounded-full border border-line bg-surface py-1 pr-1 pl-2 shadow-pop`,role:`toolbar`,"aria-label":`Drawing on the page`,"data-sw-draw-bar":e,children:[(0,Y.jsx)(Ex,{owner:e,touch:!1}),(0,Y.jsx)(r,{size:`xs`,className:`ml-1 shrink-0 rounded-full`,onClick:()=>sx.set({tool:null}),"data-sw-draw-bar-done":`true`,children:`Done (Esc)`})]})}function kx({open:e,onClose:t,owner:n,src:i,native:a,title:o}){let s=cx(e=>e?.owner===n?e:null);if((0,J.useEffect)(()=>{e&&s&&!s.tool&&sx.set({tool:`box`})},[e]),!a)return null;let c=()=>{sx.set({tool:null}),t()};return(0,Y.jsxs)(M,{open:e,onClose:c,title:`Draw on the page`,description:o,size:`lg`,className:`max-h-[100dvh] rounded-none sm:rounded-xl`,footer:(0,Y.jsxs)(`div`,{className:`flex w-full items-center gap-3 sm:w-auto`,children:[s?.shapes.length?(0,Y.jsx)(Dx,{count:s.shapes.length}):null,(0,Y.jsx)(r,{size:`touch`,className:`flex-1 sm:flex-none`,onClick:c,"data-sw-draw-done":`true`,children:`Done`})]}),children:[(0,Y.jsx)(`div`,{className:`sticky top-0 z-10 border-b border-line bg-surface px-2 py-1`,children:(0,Y.jsx)(Ex,{owner:n,touch:!0,showCount:!1})}),(0,Y.jsx)(`div`,{className:`p-3`,children:(0,Y.jsxs)(`div`,{className:`relative w-full overflow-hidden rounded-md border border-line bg-surface-2`,style:{aspectRatio:`${a.width} / ${a.height}`},"data-sw-draw-sheet":`true`,children:[i?(0,Y.jsx)(`img`,{src:i,alt:`The page this comment is on`,className:`block h-full w-full object-cover object-top select-none`,draggable:!1}):null,(0,Y.jsx)(bx,{shapes:s?.shapes,width:a.width,height:a.height}),s?.tool?(0,Y.jsx)(xx,{tool:s.tool,ink:s.ink,width:a.width,height:a.height}):null]})})]})}function Ax({draft:e,touch:t,disabled:n}){let r=(0,J.useRef)(null),i=e.images.length>=4;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(z,{size:t?`icon`:`icon-sm`,className:t?void 0:`w-7`,label:i?`Attach an image (4 is the most)`:`Attach an image`,tooltip:i?`4 images is the most`:`Attach an image (or paste one)`,disabled:n||i,onClick:()=>r.current?.click(),"data-sw-attach-image":`true`,children:(0,Y.jsx)(Kh,{size:16,"aria-hidden":`true`})}),(0,Y.jsx)(`input`,{ref:r,type:`file`,accept:Hb,multiple:!0,hidden:!0,tabIndex:-1,"aria-hidden":`true`,onChange:t=>{e.add(t.target.files),t.target.value=``},"data-sw-attach-input":`true`})]})}function jx(e,t){return t?{onPaste:t=>{let n=Yb(t.clipboardData);n.length&&(t.preventDefault(),e.add(n))},onDragOver:e=>{[...e.dataTransfer?.types||[]].includes(`Files`)&&e.preventDefault()},onDrop:t=>{let n=Yb(t.dataTransfer);n.length&&(t.preventDefault(),e.add(n))}}:{}}function Mx({draft:e,touch:t,id:n}){return!e.images.length&&!e.error?null:(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[e.images.length?(0,Y.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,"aria-label":`Images to attach`,"data-sw-composer-images":e.images.length,children:e.images.map(n=>(0,Y.jsxs)(`li`,{className:K(`relative overflow-hidden rounded-md border border-line bg-surface-2`,t?`h-16 w-16`:`h-14 w-14`),"data-sw-composer-image":n.state,children:[n.preview?(0,Y.jsx)(`img`,{src:n.preview,alt:n.name,className:`h-full w-full object-cover`,draggable:!1}):(0,Y.jsx)(`span`,{className:`flex h-full w-full items-center justify-center text-faint`,role:`status`,"aria-label":`Reading ${n.name}`,children:(0,Y.jsx)(ug,{size:16,className:`animate-spin motion-reduce:animate-none`,"aria-hidden":`true`})}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>e.remove(n.id),className:K(`absolute top-0 right-0 flex items-center justify-center rounded-bl-md bg-black/60 text-white outline-none hover:bg-black/75 focus-visible:ring-2 focus-visible:ring-accent`,t?`h-7 w-7`:`h-5 w-5`),"aria-label":`Remove ${n.name}`,"data-sw-composer-image-remove":n.id,children:(0,Y.jsx)(g,{size:t?14:12,"aria-hidden":`true`})})]},n.id))}):null,e.error?(0,Y.jsx)(`p`,{id:n,className:`text-xs text-bad`,role:`alert`,"data-sw-image-error":`true`,children:e.error}):null]})}function Nx({boardId:e,images:t,touch:n,label:r}){let[i,a]=(0,J.useState)(null);if((0,J.useEffect)(()=>{if(i===null)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),a(null))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i]),!t?.length)return null;let o=i===null?null:t[i],s=e=>a(n=>(n+e+t.length)%t.length);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`ul`,{className:`mt-1.5 flex flex-wrap gap-1.5`,"aria-label":`${r}: images`,"data-sw-message-images":t.length,children:t.map((r,i)=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(`button`,{type:`button`,onClick:()=>a(i),className:K(`block overflow-hidden rounded-md border border-line bg-surface-2 outline-none hover:border-line-strong focus-visible:ring-2 focus-visible:ring-accent`,n?`h-16 w-16`:`h-14 w-14`),"aria-label":`Open image ${i+1} of ${t.length}: ${r.name}`,"data-sw-message-image":r.file,children:(0,Y.jsx)(`img`,{src:I(e,r.file),alt:``,className:`h-full w-full object-cover`,loading:`lazy`,draggable:!1})})},r.file))}),(0,Y.jsx)(M,{open:o!==null,onClose:()=>a(null),title:o?.name||`Image`,description:o?`Image ${i+1} of ${t.length}${o.width?`, ${o.width} by ${o.height} pixels`:``}`:``,size:`lg`,children:o?(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-4`,onKeyDown:e=>{if(!(t.length<2)){if(e.key===`ArrowRight`)s(1);else if(e.key===`ArrowLeft`)s(-1);else return;e.preventDefault()}},"data-sw-lightbox":o.file,children:[(0,Y.jsx)(`img`,{src:I(e,o.file),alt:o.name,className:`max-h-[70dvh] max-w-full rounded-md border border-line bg-surface-2 object-contain`,draggable:!1}),t.length>1?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(z,{size:n?`icon`:`icon-sm`,label:`Previous image`,onClick:()=>s(-1),"data-sw-lightbox-prev":`true`,children:(0,Y.jsx)(eh,{size:16,"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`text-caption text-muted tabular-nums`,children:[i+1,` of `,t.length]}),(0,Y.jsx)(z,{size:n?`icon`:`icon-sm`,label:`Next image`,onClick:()=>s(1),"data-sw-lightbox-next":`true`,children:(0,Y.jsx)(R,{size:16,"aria-hidden":`true`})})]}):null]}):null})]})}var Px=typeof window<`u`?Math.min(window.devicePixelRatio||1,2):1;function Fx(e,t,n){return!t||!n?!1:e.w*t*Px>n.width*(n.thumbScale||.25)*1.05}function Ix({src:e,viewport:t,native:n,frame:r,selecting:i,opaque:a,onReady:o}){let s=r.w/n.width,c=(0,J.useRef)(null),[l,u]=(0,J.useState)(!1);return(0,J.useEffect)(()=>()=>o(null),[o]),(0,Y.jsx)(`iframe`,{ref:c,src:e,title:`Live ${t} page`,sandbox:a?``:`allow-same-origin`,referrerPolicy:`no-referrer`,tabIndex:i?0:-1,onLoad:()=>{if(a){u(!0),o(!0);return}let e=c.current?.contentDocument;if(!e)return;let t=e=>e.preventDefault();Kv.addEventListener(e,`click`,t,!0),Kv.addEventListener(e,`submit`,t,!0),Kv.addEventListener(e,`auxclick`,t,!0),u(!0),o(e)},className:K(`absolute top-0 left-0 origin-top-left border-0 bg-white transition-opacity duration-(--motion-base)`,l?`opacity-100`:`opacity-0`,i?`nodrag nopan nowheel`:`pointer-events-none`),style:{width:n.width,height:n.height,transform:`scale(${s})`},"data-sw-live-frame":t})}function Lx(e,t){return t.agentStatus===`working`||!!e.agentWorking?.has(t.id)}function Rx({targetId:e,frame:t,image:n,kind:r,version:i,emptyText:a,note:o}){let s=(0,J.useContext)(vv),c=t.native||s.viewports[t.viewport],l=s.touch?50:6,{viewport:u}=t,d=`${e}|${u}`,f=!!s.compare,p=Ob(t=>{let n=t.selectedComment;return!f&&n&&n.pageId===e&&n.viewport===u?n:null}),m=s.pinsFor(e,u),h=(0,J.useMemo)(()=>p&&!m.includes(p)?[...m,p]:m,[m,p]),g=p?.id??null,_=Ob(e=>f||e.hoveredId===null?null:h.find(t=>t.id===e.hoveredId&&gx(t))||null),v=p&&gx(p)?p:_,y=(0,J.useMemo)(()=>{if(!v)return null;let t=String(e).startsWith(`variant:`)?null:Y_(s.manifest?.pages?.[e]?.[u],s.manifest);return{id:v.id,...hx(v,t)}},[v,e,u,s.manifest]),b=Ob(t=>{let n=t.draftSpot;return n&&n.pageId===e&&n.viewport===u?n:null}),x=Ob(e=>!!n?.live&&e.liveKeys.has(d)),S=h.length>0||!!b||s.commentMode&&x,C=$(e=>S?ub(e.transform[2],t.w,s.touch,l,!!b):`full:1`),w=C.startsWith(`dot:`),T=Number(C.slice(C.indexOf(`:`)+1)),E=$(e=>h.length>1?Math.round(e.transform[2]*20)/20:1),D=Ob(e=>e.selectingKey===d)&&x,O=Ob(e=>e.focusedKey===d),k=n?.live&&n.elements||null,A=!!k||!s.domFallback,{map:j,state:M}=By(x&&k?s.elementsUrl(r,k,i):null),[N,P]=(0,J.useState)(!1),[F,ee]=(0,J.useState)(null),[I,L]=(0,J.useState)(0),R=x&&(A?N&&M!==`loading`:!!F),z=x&&A?j:null,B=(0,J.useMemo)(()=>{if(!x||!(z||F))return null;let e=new Map;for(let t of h){if(!t.anchor)continue;let n=z?Iy(z,t.anchor,c):ly(F,t.anchor,c);e.set(t.id,n||{x:t.x,y:t.y,moved:!0})}return e},[x,z,F,h,c,I]),V=Ob(e=>h.length?h.filter(t=>e.unread.has(t.id)).map(e=>e.id).join(`,`):``),H=(0,J.useMemo)(()=>{let e=new Set(V?V.split(`,`):[]);return bb(h.map(t=>{let n=B?.get(t.id)||null;return{comment:t,position:n,spot:zv(t,n),unread:e.has(String(t.id))}}),t,E,g,w?12:void 0)},[h,B,V,t,E,g,w]);(0,J.useEffect)(()=>{let e=Kv.defaultView(F);if(!e)return;let t=()=>L(e=>e+1);Kv.addEventListener(e,`resize`,t);let n=typeof ResizeObserver<`u`?new ResizeObserver(t):null;return n?.observe(Kv.documentElement(F)),()=>{Kv.removeEventListener(e,`resize`,t),n?.disconnect()}},[F]);let{setLiveReady:U}=s,te=(0,J.useCallback)(e=>{P(!!e),ee(e&&e!==!0?e:null)},[]);(0,J.useEffect)(()=>{U(d,R)},[d,R,U]),(0,J.useEffect)(()=>()=>U(d,!1),[d,U]);let ne=Ob(e=>Fx(t,e.settledZoom,c)),re=!n?.thumb||x||ne,ie=n?s.imageUrl(r,re?n.file:n.thumb,i):null,[ae,W]=(0,J.useState)(null),G=(0,J.useRef)(0),oe=s.commentMode&&x&&!!(z||F)&&!s.touch;return(0,J.useEffect)(()=>{oe||W(null)},[oe]),(0,J.useEffect)(()=>()=>window.cancelAnimationFrame(G.current),[]),(0,Y.jsxs)(Y.Fragment,{children:[t.y>12?(0,Y.jsxs)(zx,{frame:t,children:[t.viewport,x?(0,Y.jsx)(`span`,{className:`text-accent`,children:` · live`}):null]}):null,(0,Y.jsxs)(`div`,{className:K(`absolute overflow-hidden rounded-sm border border-line bg-surface-2`,s.commentMode&&`nodrag nopan cursor-crosshair`,x&&`border-accent/60`,O&&`outline-2 outline-offset-2 outline-accent`),style:{left:t.x,top:t.y,width:t.w,height:t.h},onClick:n=>{if(n.stopPropagation(),!s.commentMode){s.onFocusFrame(e,t.viewport);return}let r=n.currentTarget.getBoundingClientRect(),i=(n.clientX-r.left)/r.width,a=(n.clientY-r.top)/r.height,o={pageId:e,viewport:t.viewport,x:Math.max(0,Math.min(100,i*100)),y:Math.max(0,Math.min(100,a*100))};if(x&&(z||F)){let e=i*c.width,t=a*c.height,n=z?ky(z,e,t,c):sy(F,e,t,c);n&&(o.anchor=n)}W(null),s.onPin(o)},onMouseMove:oe?e=>{if(!oe)return;let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width*c.width,r=(e.clientY-t.top)/t.height*c.height;window.cancelAnimationFrame(G.current),G.current=window.requestAnimationFrame(()=>{if(z){let e=Dy(z,n,r);W(e>=0?Oy(z,e,c):null);return}let e=iy(F,n,r);W(e?oy(F,e,c):null)})}:void 0,onMouseLeave:oe?()=>W(null):void 0,"data-sw-frame":`${e}:${t.viewport}`,"data-sw-image":ie?re?`full`:`thumb`:`none`,"data-sw-live":x?R?`ready`:`loading`:`off`,"data-sw-live-anchors":x?A?z?`map`:`none`:`dom`:void 0,children:[ie?(0,Y.jsx)(`img`,{src:ie,alt:`${t.viewport} screenshot`,loading:`lazy`,decoding:`async`,draggable:!1,onError:s.onImageError,className:`pointer-events-none block h-full w-full object-cover object-top select-none`}):(0,Y.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-4 text-center`,children:[(0,Y.jsx)(Wh,{size:22,className:`text-faint`,"aria-hidden":`true`}),(0,Y.jsx)(`p`,{className:`text-[11px] leading-4 text-muted`,children:a})]}),x?(0,Y.jsx)(Ix,{src:s.liveUrl(r,n.live,i),viewport:t.viewport,native:c,frame:t,selecting:D&&!s.commentMode,opaque:A,onReady:te},A?`opaque`:`dom`):null,o&&!x?(0,Y.jsxs)(`p`,{className:`pointer-events-none absolute inset-x-0 bottom-0 flex items-start gap-1 bg-surface/90 px-1.5 py-1 text-[9.5px] leading-[13px] text-muted`,"data-sw-page-note":`true`,children:[(0,Y.jsx)(Xh,{size:10,className:`mt-px shrink-0`,"aria-hidden":`true`}),` `,o]}):null,ae&&oe?(0,Y.jsx)(Bx,{hover:ae,native:c,scale:T}):null,H.map(n=>n.items.length===1?(0,Y.jsx)(vb,{comment:n.items[0].comment,position:n.items[0].position,scale:T,compact:w,selected:g===n.items[0].comment.id,unread:n.items[0].unread,working:Lx(s,n.items[0].comment),onSelect:s.onSelectComment,onHover:s.onHoverComment,touch:s.touch},n.items[0].comment.id):(0,Y.jsx)(yb,{items:n.items,compact:w,touch:s.touch,working:n.items.some(e=>Lx(s,e.comment)),scale:T,onOpen:n=>s.onOpenCluster(e,t.viewport,n)},`cluster-${n.items[0].comment.id}`)),f?null:(0,Y.jsx)(Sx,{frameKey:d,native:c,shown:y}),b?(0,Y.jsx)(xb,{draft:b,scale:T,name:s.me?.name,colorKey:s.me?.name}):null]})]})}function zx({frame:e,children:t}){return(0,Y.jsx)(`span`,{className:`pointer-events-none absolute z-10 flex origin-bottom-left items-center gap-1 truncate text-[10.5px] leading-4 font-semibold tracking-wide text-muted uppercase`,style:{left:e.x,top:e.y-19,width:`calc(${e.w}px / var(--sw-label-scale, 1))`,transform:`scale(var(--sw-label-scale, 1))`},"data-sw-frame-label":e.env?`${e.viewport}:${e.env}`:e.viewport,children:t})}function Bx({hover:e,native:t,scale:n}){let{rect:r}=e,i=(e,t)=>`${e/t*100}%`,a=r.top/t.height<.04;return(0,Y.jsx)(`div`,{className:K(`pointer-events-none absolute z-[5] rounded-[2px] border-accent bg-accent/5`,e.large?`border-dashed`:`border-solid`),style:{left:i(r.left,t.width),top:i(r.top,t.height),width:i(r.width,t.width),height:i(r.height,t.height),borderWidth:2*n},"data-sw-hover-outline":e.large?`large`:`element`,children:(0,Y.jsxs)(`span`,{className:`absolute left-0 max-w-[320px] truncate rounded-sm bg-accent px-1 font-mono text-[10px] leading-4 whitespace-nowrap text-accent-fg`,style:{[a?`top`:`bottom`]:`100%`,transform:`scale(${n})`,transformOrigin:a?`top left`:`bottom left`,marginTop:a?2*n:0,marginBottom:a?0:2*n},"data-sw-hover-label":`true`,children:[e.label,e.large?` · whole section`:``]})})}function Vx({pageId:e,frame:t}){let n=(0,J.useContext)(vv),{compare:r}=n,i=t.native||n.viewports[t.viewport],a=r.files?.[t.env]?.[e]?.[t.viewport],o=Ob(e=>Fx(t,e.settledZoom,i)),s=a&&(!a.thumb||o),c=a?n.imageUrl(r.kindOf(t.env),s?a.file:a.thumb,r.versionOf(t.env)):null,l=r.pages?.[e]?.[t.viewport],u=a?null:r.failures?.[t.env]?.[e]?.[t.viewport]||null,d=t.env===r.b,f=d&&r.showDiff&&l?.status===`ok`&&l.percent>0?l.diff:null;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(zx,{frame:t,children:[t.viewport,` · `,r.titleOf(t.env),d&&l?.status===`ok`?(0,Y.jsxs)(`span`,{className:`text-accent`,children:[` · `,l.percent,`% changed`]}):null]}),(0,Y.jsxs)(`div`,{className:`absolute overflow-hidden rounded-sm border border-line bg-surface-2`,style:{left:t.x,top:t.y,width:t.w,height:t.h},"data-sw-frame":`${e}:${t.viewport}:${t.env}`,"data-sw-image":c?s?`full`:`thumb`:`none`,children:[c?(0,Y.jsx)(`img`,{src:c,alt:`${t.viewport} screenshot, ${r.titleOf(t.env)}`,loading:`lazy`,decoding:`async`,draggable:!1,onError:n.onImageError,className:`pointer-events-none block h-full w-full object-cover object-top select-none`}):(0,Y.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-4 text-center`,children:[(0,Y.jsx)(Wh,{size:22,className:`text-faint`,"aria-hidden":`true`}),(0,Y.jsx)(`p`,{className:`text-[11px] leading-4 text-muted`,"data-sw-compare-failed":u?`true`:void 0,children:u?`Capture failed: ${u}`:`Not captured in ${r.titleOf(t.env)} yet.`})]}),f?(0,Y.jsx)(`img`,{src:n.imageUrl(r.diffKind,f,r.diffVersion),alt:``,draggable:!1,className:`pointer-events-none absolute inset-0 block h-full w-full object-cover object-top opacity-80 select-none`,"data-sw-diff-overlay":`true`}):null]})]})}var Hx=`[@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:-inset-3 [@media(pointer:coarse)]:before:content-['']`;function Ux(){return(0,Y.jsxs)(`span`,{className:`inline-flex h-4 shrink-0 items-center gap-1 rounded-full bg-accent/10 px-1.5 text-[10px] leading-4 font-semibold text-accent`,"data-sw-live-chip":`true`,children:[(0,Y.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`sr-only @min-[260px]:not-sr-only`,children:`Live`})]})}function Wx(e,t,n){let r=t.length===1&&!t[0].env&&!(t[0].y>12)&&n?.[t[0].viewport]?.live?`${e}|${t[0].viewport}`:null;return Ob(e=>r!==null&&e.liveKeys.has(r))}function Gx({change:e,named:t}){if(!e)return null;let{percent:n,viewport:r}=e,i=n>0?`${n}%${t?` ${r}`:``}`:`Same`;return(0,Y.jsx)(_v,{content:n>0?`Most changed: the ${r} capture, ${n}% of its pixels`:`No visual change`,children:(0,Y.jsxs)(`span`,{tabIndex:-1,className:K(Ie({shape:`count`}),`tabular pointer-events-auto absolute -top-2.5 -right-2.5 z-20 origin-top-right shadow-pop`,n>0?`bg-accent text-accent-fg`:`bg-surface-2 text-muted`),style:{transform:`scale(min(var(--sw-inv, 1), 14))`},"data-sw-change":n,"data-sw-change-viewport":r,children:[(0,Y.jsx)(gh,{size:10,"aria-hidden":`true`}),` `,i]})})}function Kx({steps:e,current:t}){return e?.length?(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-0.5`,"data-sw-steps":e.join(`,`),children:e.map(e=>(0,Y.jsx)(`span`,{className:K(`tabular inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-1 text-[10.5px] leading-none font-bold`,e===t?`bg-accent text-accent-fg ring-2 ring-accent/30`:`bg-fg text-surface`),children:e},e))}):null}function qx(){return(0,Y.jsx)(_v,{content:`An agent is working on a comment here`,children:(0,Y.jsxs)(`span`,{tabIndex:-1,className:`pointer-events-auto inline-flex h-5 items-center gap-1 rounded-full bg-accent/10 px-1.5 text-[11px] font-semibold text-accent`,"data-sw-card-agent-working":`true`,children:[(0,Y.jsxs)(`span`,{className:`relative flex h-2 w-2`,"aria-hidden":`true`,children:[(0,Y.jsx)(`span`,{className:`absolute inline-flex h-full w-full rounded-full bg-accent opacity-60 motion-safe:animate-ping`}),(0,Y.jsx)(`span`,{className:`relative inline-flex h-2 w-2 rounded-full bg-accent`})]}),(0,Y.jsx)(S,{size:12,"aria-label":`Agent working`})]})})}function Jx({count:e}){if(!e?.open)return null;let t=`${e.open} open comment${e.open===1?``:`s`}`;return(0,Y.jsx)(_v,{content:t,children:(0,Y.jsxs)(`span`,{tabIndex:-1,className:`tabular pointer-events-auto inline-flex h-5 items-center gap-1 rounded-full px-1 text-[11px] font-semibold text-fg`,children:[(0,Y.jsx)(wg,{size:12,className:`text-muted`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-label":t,children:e.open})]})})}function Yx({pageId:e,title:t}){let n=(0,J.useContext)(vv),r=n.onChecks?n.checksCount(e):0;if(!r)return null;let i=`${r} check${r===1?``:`s`} need attention`;return(0,Y.jsx)(_v,{content:i,children:(0,Y.jsxs)(`button`,{type:`button`,tabIndex:-1,className:K(`tabular nodrag nopan pointer-events-auto relative inline-flex h-5 items-center gap-1 rounded-full px-1 text-[11px] font-semibold text-fg hover:bg-surface-2`,Hx),"aria-label":`${r} checks need attention across captured screen sizes for ${t}`,onClick:t=>{t.stopPropagation(),n.onChecks(e)},"data-sw-checks-badge":e,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-warn`,"aria-hidden":`true`}),` `,r]})})}function Xx({pageId:e}){let t=(0,J.useContext)(vv),n=t.historyCount(e);return!n||t.compare?null:(0,Y.jsx)(_v,{content:`${n+1} captures: open the page history`,children:(0,Y.jsxs)(`button`,{type:`button`,className:K(`tabular nodrag nopan pointer-events-auto relative inline-flex h-5 items-center gap-1 rounded-full px-1 text-[11px] font-semibold text-muted hover:bg-surface-2 hover:text-fg`,Hx),tabIndex:-1,onClick:n=>{n.stopPropagation(),t.onHistory(e)},"aria-label":`Page history, ${n} earlier capture${n===1?``:`s`}`,"data-sw-history-badge":e,children:[(0,Y.jsx)(Kg,{size:12,"aria-hidden":`true`}),` `,n+1]})})}var Zx=`var(--sw-title-scale, 1)`;function Qx({title:e,path:t,note:n}){return(0,Y.jsxs)(`span`,{className:`block`,children:[(0,Y.jsx)(`span`,{className:`block font-semibold`,children:e}),t?(0,Y.jsx)(`span`,{className:`block font-mono text-[11px] opacity-80`,children:t}):null,n?(0,Y.jsx)(`span`,{className:`mt-0.5 block font-normal opacity-80`,children:n}):null]})}function $x({width:e,title:t,tip:n,path:r,steps:i,current:a,only:o,tag:s,badges:c,onTitle:l,accent:u=!1}){return(0,Y.jsx)(`div`,{className:`@container pointer-events-none absolute bottom-full left-0 z-10 origin-bottom-left pb-1`,style:{width:`calc(${e}px / ${Zx})`,transform:`scale(${Zx})`,opacity:`var(--sw-title-fade, 1)`},"data-sw-card-header":`true`,children:(0,Y.jsxs)(`div`,{className:`flex h-6 min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(Kx,{steps:i,current:a}),(0,Y.jsx)(_v,{content:n,side:`top`,align:`start`,children:(0,Y.jsxs)(`p`,{className:K(`nodrag nopan pointer-events-auto min-w-0 shrink cursor-default truncate text-[12.5px] leading-6 font-semibold`,u?`text-accent`:`text-fg`),onClick:l,"data-sw-card-title":`true`,children:[t,r?(0,Y.jsx)(`span`,{className:`ml-1.5 hidden font-mono text-[11px] font-normal text-faint group-hover/card:@min-[200px]:inline`,children:r}):null]})}),o?(0,Y.jsx)(`span`,{className:`hidden shrink-0 rounded bg-surface-2 px-1 text-[10px] leading-4 font-medium text-muted @min-[150px]:block`,"data-sw-only":!0,children:o}):null,s?(0,Y.jsx)(`span`,{className:`hidden shrink-0 rounded bg-surface-2 px-1 text-[10px] leading-4 font-medium text-muted @min-[200px]:block`,children:s}):null,(0,Y.jsx)(`span`,{className:`ml-auto hidden shrink-0 items-center gap-0.5 @min-[130px]:flex`,"data-sw-card-badges":`true`,children:c})]})})}var eS=`!h-1 !w-1 !min-w-0 !border-0 !bg-transparent`;function tS(e,t,n){return t?.[n]?.status===`failed`?`Capture failed: ${t[n].error}`:e.manifest?`No capture for this screen size.`:e.domFallback?`Not captured yet. Run "shapewall capture".`:`Not captured yet.`}function nS(e,t){let n=Object.keys(t||{});if(!Array.isArray(e)||!e.length||n.every(t=>e.includes(t)))return null;let r=n.filter(t=>e.includes(t)).map(e=>e.replace(/-/g,` `)).join(` and `);return`${r.charAt(0).toUpperCase()}${r.slice(1)} only`}var rS={page:(0,J.memo)(function({data:e,width:t}){let n=(0,J.useContext)(vv),{page:r,frames:i}=e,a=n.captures[r.id]||{},o=n.manifest?.pages?.[r.id],s=n.journey?.steps.get(r.id)||null,c=!s&&!!n.journey?.offPath?.has(r.id),l=!!n.journey&&!s&&!c,u=n.journey?.currentPage===r.id,d=nS(r.viewports,n.viewports),f=n.compare?tv(n.compare,r.id):null,p=f?.percent>0,m=!!n.compare&&f&&!p,h=n.agentWorkingPages?.has(r.id),g=Wx(r.id,i,a),_=e=>{e.stopPropagation(),i[0]&&!i[0].env&&n.onFocusFrame(r.id,i[0].viewport)};return(0,Y.jsxs)(`div`,{className:K(`group/card relative h-full w-full rounded-lg border border-line bg-surface shadow-card transition-[opacity,outline-color] duration-(--motion-base)`,l&&`opacity-25`,c&&`opacity-60 outline-2 outline-offset-4 outline-faint/60 outline-dashed`,s&&`outline-offset-4 outline-accent/40`,u&&`outline-accent`,p&&`outline-offset-2 outline-accent`,m&&`opacity-50`),style:{...s||p?{outlineWidth:`calc(${u?3:2}px * min(var(--sw-inv, 1), 12))`,outlineStyle:`solid`}:null,...h?{boxShadow:`0 0 0 calc(4px * min(var(--sw-inv, 1), 12)) color-mix(in srgb, var(--accent) 35%, transparent)`}:null},"data-sw-node":r.id,"data-sw-faded":l?`true`:void 0,"data-sw-off-path":c?`true`:void 0,"data-sw-current-step":u?`true`:void 0,"data-sw-changed":n.compare?p?`true`:`false`:void 0,"data-sw-agent-working":h?`true`:void 0,children:[(0,Y.jsx)(hf,{type:`source`,position:Q.Right,id:`right`,className:eS,isConnectable:!1}),(0,Y.jsx)(hf,{type:`target`,position:Q.Left,id:`left`,className:eS,isConnectable:!1}),n.compare?(0,Y.jsx)(Gx,{change:f,named:Object.keys(n.viewports||{}).length>1}):null,(0,Y.jsx)($x,{width:t||i.reduce((e,t)=>Math.max(e,t.x+t.w),0)+8,title:r.title,tip:(0,Y.jsx)(Qx,{title:r.title,path:r.path,note:r.note}),path:r.path,steps:s,current:n.journey?.currentStep,only:d,accent:u,onTitle:_,badges:(0,Y.jsxs)(Y.Fragment,{children:[g?(0,Y.jsx)(Ux,{}):null,h?(0,Y.jsx)(qx,{}):null,(0,Y.jsx)(Jx,{count:n.counts[r.id]}),(0,Y.jsx)(Yx,{pageId:r.id,title:r.title}),(0,Y.jsx)(`span`,{className:`pointer-events-auto inline-flex`,children:(0,Y.jsx)(hv,{pageId:r.id,title:r.title,entries:o,viewports:Object.keys(n.viewports)})}),(0,Y.jsx)(Xx,{pageId:r.id}),r.url?(0,Y.jsx)(_v,{content:`Open the page in a new tab`,children:(0,Y.jsx)(`a`,{href:r.url,target:`_blank`,rel:`noreferrer`,tabIndex:-1,className:K(`nodrag nopan pointer-events-auto relative hidden h-5 w-5 items-center justify-center rounded-full text-muted hover:bg-surface-2 hover:text-fg @min-[200px]:inline-flex`,Hx),"aria-label":`Open ${r.title} in a new tab`,children:(0,Y.jsx)(bh,{size:12})})}):null]})}),i.map(e=>e.env?n.compare?(0,Y.jsx)(Vx,{pageId:r.id,frame:e},`${e.viewport}:${e.env}`):null:(0,Y.jsx)(Rx,{targetId:r.id,frame:e,kind:`captures`,image:a[e.viewport],note:r.note,emptyText:tS(n,o,e.viewport)},e.viewport))]})}),variant:(0,J.memo)(function({data:e,width:t}){let n=(0,J.useContext)(vv),{variant:r,frames:i,only:a}=e,o=`variant:${r.id}`,s=Wx(o,i,r.files);return(0,Y.jsxs)(`div`,{className:K(`group/card relative h-full w-full rounded-lg border border-dashed border-faint/60 bg-surface shadow-card transition-opacity duration-(--motion-base)`,n.journey&&`opacity-25`),"data-sw-node":o,children:[(0,Y.jsx)(hf,{type:`target`,position:Q.Left,id:`left`,className:eS,isConnectable:!1}),(0,Y.jsx)(hf,{type:`source`,position:Q.Right,id:`right`,className:eS,isConnectable:!1}),(0,Y.jsx)($x,{width:t||200,title:(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(ng,{size:12,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:r.title})]}),tip:(0,Y.jsx)(Qx,{title:`Variant: ${r.title}`,path:r.source,note:r.note}),tag:`Variant`,badges:(0,Y.jsxs)(Y.Fragment,{children:[s?(0,Y.jsx)(Ux,{}):null,(0,Y.jsx)(Jx,{count:n.counts[o]})]}),onTitle:e=>{e.stopPropagation(),i[0]&&n.onFocusFrame(o,i[0].viewport)}}),a?(0,Y.jsxs)(`div`,{className:`flex h-11 items-center gap-2 px-2.5 text-[11px] text-muted`,"data-sw-variant-collapsed":a.join(`,`),children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[a.map(e=>e[0].toUpperCase()+e.slice(1)).join(` and `),` only`]}),n.onShowViewport?(0,Y.jsxs)(`button`,{type:`button`,tabIndex:-1,className:K(`nodrag nopan relative rounded px-1.5 py-0.5 font-semibold text-accent hover:bg-surface-2`,Hx),onClick:e=>{e.stopPropagation(),n.onShowViewport(a[0])},"data-sw-variant-show":a[0],children:[`Show `,a[0]]}):null]}):null,i.map(e=>(0,Y.jsx)(Rx,{targetId:o,frame:e,kind:`variants`,version:r.createdAt,image:r.files?.[e.viewport],emptyText:`No ${e.viewport} version of this variant.`},e.viewport))]})}),groupFrame:(0,J.memo)(function({data:e,width:t}){let n=`var(--sw-group-scale, 1)`;return(0,Y.jsx)(`div`,{className:`pointer-events-none relative h-full w-full rounded-2xl border border-fg/10 bg-fg/[0.025]`,"data-sw-group":e.group,children:(0,Y.jsxs)(`p`,{className:`@container absolute bottom-full left-0 flex origin-bottom-left items-baseline gap-1.5 pb-1.5 pl-1 text-ui font-semibold whitespace-nowrap text-fg`,style:{width:`calc(${t||600}px / ${n})`,transform:`scale(${n})`},"data-sw-group-label":`true`,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:e.group}),(0,Y.jsxs)(`span`,{className:`tabular hidden shrink-0 text-xs font-medium text-faint @min-[120px]:inline`,children:[e.count,` page`,e.count===1?``:`s`]})]})})})};function iS(e,t,n){let r=e.x+e.w/2,i=e.y+e.h/2,a=t-r,o=n-i;if(!a&&!o)return{x:r,y:i};let s=Math.min(a?e.w/2/Math.abs(a):1/0,o?e.h/2/Math.abs(o):1/0);return{x:r+a*s,y:i+o*s}}function aS(e){if(!e)return null;let{x:t,y:n}=e.internals.positionAbsolute,r=e.measured?.width??e.width??0,i=e.measured?.height??e.height??0;return r&&i?{x:t,y:n,w:r,h:i}:null}function oS(e,t,{bend:n=.12,gap:r=6}={}){let i={x:e.x+e.w/2,y:e.y+e.h/2},a={x:t.x+t.w/2,y:t.y+t.h/2},o=iS(e,a.x,a.y),s=iS(t,i.x,i.y),c=s.x-o.x,l=s.y-o.y,u=Math.hypot(c,l)||1,d=c/u,f=l/u,p={x:s.x-d*r,y:s.y-f*r},m={x:(o.x+p.x)/2+f*u*n,y:(o.y+p.y)/2-d*u*n},h={x:(o.x+2*m.x+p.x)/4,y:(o.y+2*m.y+p.y)/4},g=p.x-m.x,_=p.y-m.y,v=Math.hypot(g,_)||1;return{path:`M ${o.x} ${o.y} Q ${m.x} ${m.y} ${p.x} ${p.y}`,end:p,dir:{x:g/v,y:_/v},mid:h}}var sS={idle:{stroke:`var(--faint)`,width:1.25,opacity:.35},out:{stroke:`var(--accent)`,width:2,opacity:.95},in:{stroke:`var(--muted)`,width:1.5,opacity:.7},journey:{stroke:`var(--accent)`,width:3,opacity:.95},done:{stroke:`var(--accent)`,width:2.5,opacity:.45},alt:{stroke:`var(--faint)`,width:2,opacity:.6,dash:3}},cS={flow:(0,J.memo)(function({id:e,source:t,target:n,data:r}){let i=rm(t),a=rm(n),o=$(e=>Math.min(40,Math.max(.25,Math.round(1/e.transform[2]*8)/8))),s=aS(i),c=aS(a);if(!s||!c)return null;let l=sS[r?.tone]||sS.idle,{path:u,end:d,dir:f,mid:p}=oS(s,c,{bend:r?.bend??.12,gap:4*o}),m=(l.width*2.5+5)*o,h=-f.y,g=f.x,_=[`${d.x},${d.y}`,`${d.x-f.x*m+h*m*.55},${d.y-f.y*m+g*m*.55}`,`${d.x-f.x*m-h*m*.55},${d.y-f.y*m-g*m*.55}`].join(` `);return(0,Y.jsxs)(`g`,{className:`sw-flow-edge`,"data-sw-edge":e,"data-sw-edge-tone":r?.tone||`idle`,style:{opacity:l.opacity},children:[(0,Y.jsx)(`path`,{d:u,fill:`none`,stroke:l.stroke,strokeWidth:l.width*o,strokeLinecap:`round`,strokeDasharray:l.dash?`${l.dash*l.width*o} ${l.dash*l.width*o}`:void 0}),(0,Y.jsx)(`polygon`,{points:_,fill:l.stroke}),r?.label||r?.branch?(0,Y.jsx)(Xp,{children:(0,Y.jsxs)(`span`,{className:`nodrag nopan pointer-events-none absolute flex items-center gap-1`,style:{transform:`translate(-50%, -50%) translate(${p.x}px, ${p.y}px) scale(${Math.min(o,2)})`},children:[r.label?(0,Y.jsx)(`span`,{className:`flex h-6 min-w-6 items-center justify-center rounded-full border-2 border-surface bg-accent px-1 text-[11px] font-bold text-accent-fg shadow-pop`,"data-sw-edge-label":r.label,children:r.label}):null,r.branch?(0,Y.jsx)(`span`,{className:K(`flex h-6 max-w-48 items-center truncate rounded-full border-2 px-2 text-[11px] font-semibold whitespace-nowrap shadow-pop`,r.tone===`alt`?`border-line bg-surface text-muted`:`border-surface bg-accent text-accent-fg`),"data-sw-edge-branch":r.branch,children:r.branch}):null]})}):null]})})},lS=.02,uS=16,dS=(e,t,n)=>Math.min(n,Math.max(t,e));function fS({deltaX:e=0,deltaY:t=0,deltaMode:n=0},r=800){let i=n===1?uS:n===2?r:1;return{dx:e*i,dy:t*i}}function pS(e,t,n,{minZoom:r,maxZoom:i}){let a=dS(e.zoom*n,r,i),o=a/e.zoom;return{x:t.x-(t.x-e.x)*o,y:t.y-(t.y-e.y)*o,zoom:a}}function mS(e,t,n,{minZoom:r,maxZoom:i,pageHeight:a}={}){let{dx:o,dy:s}=fS(t,a);if(t.ctrlKey||t.metaKey){if(!s)return null;let t=pS(e,n,2**(-dS(s,-20,20)*lS),{minZoom:r,maxZoom:i});return t.zoom===e.zoom?null:t}return t.shiftKey&&Math.abs(s)>Math.abs(o)&&(o=s,s=0),!o&&!s?null:{x:e.x-o,y:e.y-s,zoom:e.zoom}}function hS(e,t,n){return{x:e.x+t,y:e.y+n,zoom:e.zoom}}var gS=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`,`date`,`time`,`datetime-local`,`month`,`week`]),_S=`button, a[href], select, summary, [role="button"], [role="link"], [role="menuitem"], [role="menuitemradio"], [role="option"], [role="tab"], [role="checkbox"], [role="radio"], [role="switch"], [role="slider"]`;function vS(e){if(!e||e.nodeType!==1)return!1;if(e.isContentEditable)return!0;let t=e.tagName;return t===`TEXTAREA`||t===`SELECT`||t===`INPUT`&&gS.has((e.getAttribute(`type`)||``).toLowerCase())}function yS(e,{clicked:t=null}={}){return!e||e.nodeType!==1?!0:vS(e)||e.closest?.(`[role="dialog"]:not([data-sw-thread-popover]), [role="menu"], [role="listbox"]`)?!1:!e.matches?.(_S)||e===t}function bS({canvasRef:e,flow:t,minZoom:n,maxZoom:r,onRest:i,enabled:a=!0}){let o=(0,J.useRef)({moving:!1}),s=(0,J.useRef)(i);return(0,J.useEffect)(()=>{s.current=i},[i]),(0,J.useEffect)(()=>{let i=e.current;if(!a||!i||!t)return;let c=o.current,l=0,u=!1,d=!1,f=null,p=!1,m=0,h=1,g=null,_=0,v=e=>!!e?.closest?.(`.react-flow__renderer`),y=e=>{let t=i.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},b=()=>{window.clearTimeout(l),c.moving=!1,s.current?.(t.getViewport())},x=()=>{window.clearTimeout(l),l=window.setTimeout(b,150)},S=e=>{c.moving=!0,t.setViewport(e)},C=e=>{u=e,i.classList.toggle(`sw-space-pan`,e)},w=e=>{if(e.target?.closest?.(`.nowheel`)){e.ctrlKey&&e.preventDefault();return}if(!v(e.target))return;e.preventDefault(),e.stopPropagation();let a=mS(t.getViewport(),e,y(e),{minZoom:n,maxZoom:r,pageHeight:i.clientHeight});a&&(S(a),x())},T=e=>{m||(e.preventDefault(),h=1)},E=e=>{if(m||!v(e.target))return;e.preventDefault();let i=e.scale/h;h=e.scale,!Number.isFinite(i)||i<=0||(S(pS(t.getViewport(),y(e),i,{minZoom:n,maxZoom:r})),x())},D=e=>{m=e.touches.length},O=e=>{e.code!==`Space`&&e.key!==` `||e.altKey||e.ctrlKey||e.metaKey||(u?e.preventDefault():!e.repeat&&d&&yS(e.target,{clicked:g})&&(e.preventDefault(),C(!0)))},k=e=>{(e.code===`Space`||e.key===` `)&&u&&(e.preventDefault(),C(!1))},A=()=>{C(!1),f&&N()},j=e=>{if(e.pointerType!==`mouse`)return;let n=e.button===1;if((n||e.button===0&&u)&&v(e.target)){e.preventDefault(),e.stopPropagation(),window.clearTimeout(l),f={id:e.pointerId,x:e.clientX,y:e.clientY,start:t.getViewport(),moved:!1,middle:n},p=!1;try{i.setPointerCapture(e.pointerId)}catch{}i.classList.add(`sw-panning`)}},M=e=>{if(d=!0,!f||e.pointerId!==f.id)return;e.preventDefault(),e.stopPropagation();let t=e.clientX-f.x,n=e.clientY-f.y;!f.moved&&Math.abs(t)+Math.abs(n)<2||(f.moved=!0,S(hS(f.start,t,n)))},N=()=>{let e=f;if(f=null,i.classList.remove(`sw-panning`),e){try{i.hasPointerCapture(e.id)&&i.releasePointerCapture(e.id)}catch{}p=!0,window.setTimeout(()=>p=!1,0),e.moved&&b()}},P=e=>{f&&e.pointerId===f.id&&(e.preventDefault(),e.stopPropagation(),N())},F=e=>{p&&(p=!1,e.preventDefault(),e.stopPropagation())},ee=()=>{_=Date.now()},I=e=>{g=Date.now()-_<500?e.target:null},L=()=>{d=!0},R=()=>{f||(d=!1)},z={capture:!0},B={capture:!0,passive:!1};return i.addEventListener(`wheel`,w,B),i.addEventListener(`gesturestart`,T,B),i.addEventListener(`gesturechange`,E,B),i.addEventListener(`touchstart`,D,{capture:!0,passive:!0}),i.addEventListener(`touchend`,D,{capture:!0,passive:!0}),i.addEventListener(`touchcancel`,D,{capture:!0,passive:!0}),i.addEventListener(`pointerdown`,j,z),i.addEventListener(`pointermove`,M,z),i.addEventListener(`pointerup`,P,z),i.addEventListener(`pointercancel`,P,z),i.addEventListener(`pointerenter`,L),i.addEventListener(`pointerleave`,R),window.addEventListener(`click`,F,z),window.addEventListener(`auxclick`,F,z),window.addEventListener(`keydown`,O,z),window.addEventListener(`keyup`,k,z),window.addEventListener(`blur`,A),window.addEventListener(`pointerdown`,ee,z),window.addEventListener(`focusin`,I,z),()=>{window.clearTimeout(l),c.moving&&b(),C(!1),i.classList.remove(`sw-panning`),i.removeEventListener(`wheel`,w,B),i.removeEventListener(`gesturestart`,T,B),i.removeEventListener(`gesturechange`,E,B),i.removeEventListener(`touchstart`,D,{capture:!0}),i.removeEventListener(`touchend`,D,{capture:!0}),i.removeEventListener(`touchcancel`,D,{capture:!0}),i.removeEventListener(`pointerdown`,j,z),i.removeEventListener(`pointermove`,M,z),i.removeEventListener(`pointerup`,P,z),i.removeEventListener(`pointercancel`,P,z),i.removeEventListener(`pointerenter`,L),i.removeEventListener(`pointerleave`,R),window.removeEventListener(`click`,F,z),window.removeEventListener(`auxclick`,F,z),window.removeEventListener(`keydown`,O,z),window.removeEventListener(`keyup`,k,z),window.removeEventListener(`blur`,A),window.removeEventListener(`pointerdown`,ee,z),window.removeEventListener(`focusin`,I,z)}},[e,a,t,r,n]),(0,J.useMemo)(()=>({moving:()=>o.current.moving}),[])}function xS(e,t){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=e.target.closest?.(`.react-flow__node`);if(!n||n.classList.contains(`react-flow__node-groupFrame`))return;let r=e.target===n,i=[...n.querySelectorAll(`button, a[href]`)].filter(e=>!e.disabled&&e.getClientRects().length);if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(e.key)){if(!i.length)return;e.preventDefault();let t=e.key===`ArrowRight`||e.key===`ArrowDown`,n=i.indexOf(e.target);i[r||n<0?t?0:i.length-1:(n+(t?1:-1)+i.length)%i.length].focus()}else e.key===`Escape`&&!r?(e.preventDefault(),n.focus()):(e.key===`Enter`||e.key===` `)&&r&&(e.preventDefault(),t(n.getAttribute(`data-id`)))}function SS({icon:e,title:t,onClose:n,closeLabel:r,closeProps:i,className:a,children:o}){return(0,Y.jsxs)(`div`,{className:K(`flex h-12 shrink-0 items-center gap-1.5 px-3`,a),children:[(0,Y.jsxs)(`h2`,{className:`flex shrink-0 items-center gap-1.5 text-sm font-semibold text-fg`,children:[e?(0,Y.jsx)(e,{size:15,className:`text-muted`,"aria-hidden":`true`}):null,t]}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:o}),n?(0,Y.jsx)(z,{label:r,onClick:n,...i,children:(0,Y.jsx)(g,{size:15,"aria-hidden":`true`})}):null]})}var CS=6e3,wS=new Map,TS=new Set,ES=new Map;function DS(){for(let e of TS)e()}function OS(e,t,n){if(!e)return;if(window.clearTimeout(ES.get(e)),ES.delete(e),t==null||!n){if(!wS.has(e))return;wS.delete(e),DS();return}let r=wS.get(e);if(r?.commentId===t&&r.state===n)return;let i={commentId:t,state:n,since:r?.commentId===t?r.since:Date.now()};wS.set(e,i),DS(),(n===`done`||n===`stopped`)&&ES.set(e,window.setTimeout(()=>{wS.get(e)===i&&OS(e,null,null)},CS))}function kS(e){return TS.add(e),()=>TS.delete(e)}function AS(e){return(0,J.useSyncExternalStore)(kS,()=>{for(let t of wS.values())if(t.commentId===e)return t;return null},()=>null)}function jS(e,t=void 0){let n=(0,J.useSyncExternalStore)(kS,()=>wS.get(e)||null,()=>null);return t===void 0||n&&n.commentId===t?n:null}var MS=new Set,NS=new Set,PS=null,FS=null,IS=2e3,LS=6e4;function RS(e=`event`){for(let t of[...MS])try{t(e)}catch{}}function zS(){document.visibilityState!==`visible`||FS||(FS=window.setTimeout(()=>{FS=null,RS(`shown`),QS(null)},50))}function BS(){return typeof document<`u`&&document.querySelector(`meta[name="shapewall-local-console"]`)?`/api/agent/events`:`api/agent/events`}var VS=null,HS=!1;function US(e){let t=e===!0;t!==VS&&(VS=t,HS&&WS())}function WS(){GS(),VS!==!0||E||o||typeof window.fetch!=`function`||typeof window.TextDecoder!=`function`||Object.keys(Se()).length&&(PS={controller:null,timer:null,delay:IS},JS(PS))}function GS(){PS&&(window.clearTimeout(PS.timer),PS.controller?.abort()),PS=null}function KS(){HS=!0,window.addEventListener(`focus`,zS),document.addEventListener(`visibilitychange`,zS),WS()}function qS(e){let t=`message`,n=``;for(let r of e.split(`
20
+ `))r.startsWith(`event:`)?t=r.slice(6).trim():r.startsWith(`data:`)&&(n+=r.slice(5).trim());if(t===`agents`&&RS(`event`),t===`batch`)try{QS(JSON.parse(n).board)}catch{}}async function JS(e){let t=new AbortController;e.controller=t;let n=Date.now(),r=!1;try{let e=await window.fetch(BS(),{headers:{Accept:`text/event-stream`,...Se()},credentials:`same-origin`,cache:`no-store`,signal:t.signal});if(!e.ok||!e.body||!/text\/event-stream/.test(e.headers.get(`content-type`)||``)){r=e.status!==503;return}let n=e.body.getReader(),i=new window.TextDecoder,a=``;for(;;){let{value:e,done:t}=await n.read();if(t)break;a+=i.decode(e,{stream:!0}).replace(/\r\n?/g,`
21
+ `);let r;for(;(r=a.indexOf(`
22
+
23
+ `))>=0;)qS(a.slice(0,r)),a=a.slice(r+2)}}catch{}finally{PS===e&&!t.signal.aborted&&!r&&(e.delay=Date.now()-n>LS?IS:Math.min(e.delay*2,LS),e.timer=window.setTimeout(()=>PS===e&&JS(e),e.delay))}}function YS(){HS=!1,window.removeEventListener(`focus`,zS),document.removeEventListener(`visibilitychange`,zS),FS&&window.clearTimeout(FS),FS=null,GS()}var XS=()=>MS.size+NS.size;function ZS(e){return typeof window>`u`?()=>{}:(MS.add(e),XS()===1&&KS(),()=>{MS.delete(e)&&XS()===0&&YS()})}function QS(e){for(let t of[...NS])try{t(e)}catch{}}function $S(e,t,n=!0){let r=(0,J.useRef)(t);r.current=t,(0,J.useEffect)(()=>{if(!n||typeof window>`u`)return;let t=t=>{(t===e||t===null)&&r.current?.()};return NS.add(t),XS()===1&&KS(),()=>{NS.delete(t),XS()===0&&YS()}},[e,n])}function eC(e,t=!0){let n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>{if(t)return ZS(e=>n.current?.(e))},[t])}var tC=encodeURIComponent,nC=(e,t)=>`api/agent/boards/${tC(e)}/threads/${tC(t)}`,rC=(e,t)=>E?O.get(t)||iC:`api/agent/boards/${tC(e)}/files/${tC(t)}`,iC=`data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22160%22%20height%3D%22100%22%3E%3Crect%20width%3D%22160%22%20height%3D%22100%22%20fill%3D%22%238885%22%2F%3E%3C%2Fsvg%3E`;async function aC(e,t,r,{onEvent:i,signal:a}={}){let o=await fetch(`${nC(e,t)}/messages`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`,...Se()},body:JSON.stringify(r),cache:`no-store`,signal:a});if(!o.ok||!String(o.headers.get(`content-type`)).includes(`text/event-stream`)){let e=null;try{e=await o.json()}catch{e=null}throw n(o.status,e)}let s=o.body.getReader(),c=new TextDecoder,l=``;for(;;){let{value:e,done:t}=await s.read();if(t)break;l+=c.decode(e,{stream:!0});let n;for(;(n=l.indexOf(`
24
+
25
+ `))>=0;){let e=l.slice(0,n);l=l.slice(n+2);let t=/^event: (.*)$/m.exec(e)?.[1],r=/^data: (.*)$/m.exec(e)?.[1];if(!t||r===void 0)continue;let a;try{a=JSON.parse(r)}catch{continue}i?.(t,a)}}}var oC=(e,t,n,r)=>Ke.post(`${nC(e,t)}/permissions/${tC(n)}`,{optionId:r}),sC=(e,t)=>Ke.post(`${nC(e,t)}/stop`,{}),cC=(e,t,n)=>Ke.post(`${nC(e,t)}/messages/${tC(n)}/undo`,{}),lC=(e,t)=>Ke.post(`/api/agent/branches/${tC(e)}/${t}`,{}),uC={"+":`bg-ok/10 text-fg`,"-":`bg-bad/10 text-fg`,"@":`text-faint`,"-file":`font-medium text-fg`},dC=/… \[line cut: \d+ characters in all\]$/;function fC({line:e}){let t=e.match(dC);return t?(0,Y.jsxs)(Y.Fragment,{children:[e.slice(0,t.index),(0,Y.jsx)(`span`,{className:`text-warn italic`,"data-sw-chat-diff-cut":`true`,children:t[0]})]}):e||` `}function pC({diff:e}){let[t,n]=(0,J.useState)(!1);if(typeof e?.preview!=`string`)return null;let i=t&&e.full?e.full:e.preview,a=i?i.split(`
26
+ `):[];return(0,Y.jsxs)(`div`,{className:`mt-1.5 space-y-1`,"data-sw-chat-diff":e.path||`diff`,children:[(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[11px] text-muted`,children:[(0,Y.jsx)(h,{content:e.path||null,children:(0,Y.jsx)(`span`,{className:K(`min-w-0 font-mono`,e.outside?`break-all`:`truncate`),children:e.path||`Changes`})}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-ok`,children:[`+`,e.added]}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-bad`,children:[`-`,e.removed]}),e.created?(0,Y.jsx)(`span`,{className:`shrink-0`,children:`(new file)`}):null]}),e.outside?(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[11px] text-warn`,"data-sw-chat-diff-outside":`true`,children:[(0,Y.jsx)(O_,{size:12,className:`shrink-0`,"aria-hidden":`true`}),`Outside the project: check the whole path above.`]}):null,a.length?(0,Y.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-md border border-line bg-sunken py-1 font-mono text-[11px] leading-4`,"data-sw-chat-diff-lines":a.length,children:a.map((e,t)=>{let n=e.startsWith(`--- `)?uC[`-file`]:uC[e[0]];return(0,Y.jsx)(`div`,{className:K(`px-2 whitespace-pre-wrap break-all`,n||`text-muted`),children:(0,Y.jsx)(fC,{line:e})},t)})}):(0,Y.jsx)(`p`,{className:`text-[11px] text-faint`,children:`No change to the text.`}),e.full?(0,Y.jsx)(r,{variant:`ghost`,size:`xs`,className:`-ml-2 font-normal text-muted`,"aria-expanded":t,onClick:()=>n(e=>!e),"data-sw-chat-diff-expand":`true`,children:t?`Show less`:`Show the whole diff`}):null,t&&e.truncated?(0,Y.jsx)(`p`,{className:`text-[11px] text-faint`,children:`The diff is cut here: it is too long to show in full.`}):null]})}function mC({card:e}){return(0,Y.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md border border-warn/40 bg-warn/10 px-2 py-1.5 text-xs text-fg`,"data-sw-chat-card":`note`,children:[(0,Y.jsx)(Xh,{size:13,className:`mt-px shrink-0 text-warn`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]})}var hC=encodeURIComponent,gC=e=>`api/agent/boards/${hC(e)}/batch`,_C=new Set([`running`,`waiting`]),vC=e=>!!(e&&_C.has(e.state)),yC=e=>e.status===`open`&&![`queued`,`working`,`branch-ready`].includes(e.agentStatus)&&!e.authorGuest;function bC({boardId:e,enabled:t,onProgress:n=null}){let[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)([]),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),p=(0,J.useRef)(n);p.current=n;let m=(0,J.useRef)(null),h=(0,J.useCallback)(async()=>{if(t)try{let t=await Ke.get(gC(e));i(t);let n=t?.batch?.updatedAt||null;n!==m.current&&(m.current=n,t?.batch&&p.current?.())}catch{i(null)}},[e,t]);(0,J.useEffect)(()=>{h()},[h]),$S(e,h,t),eC(h,t);let g=vC(r?.batch);(0,J.useEffect)(()=>{if(!g)return;let e=window.setInterval(h,3e3);return()=>window.clearInterval(e)},[g,h]);let _=r?.settings||null,v=!!(t&&_?.enabled);return(0,J.useEffect)(()=>{v||(o(!1),c([]))},[v]),{offered:v,max:_?.max||5,batch:t&&r?.batch||null,running:g,selecting:a,setSelecting:e=>{o(e),e||c([])},selected:s,setSelected:c,toggle:e=>c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),start:async t=>{f(!0),u(null);try{let n=await Ke.post(gC(e),{commentIds:t});return i(e=>({...e||{},batch:n.batch})),o(!1),c([]),p.current?.(),!0}catch(e){return u(e.message||`The batch did not start.`),!1}finally{f(!1)}},cancel:async()=>{u(null);try{let t=await Ke.post(`${gC(e)}/cancel`,{});i(e=>({...e||{},batch:t.batch}))}catch(e){u(e.message||`Not cancelled.`),h()}},dismiss:async()=>{try{await Ke.delete(gC(e)),i(e=>({...e||{},batch:null}))}catch{h()}},error:l,setError:u,busy:d,refresh:h}}function xC({checked:e,onChange:t,label:n,disabled:r=!1,touch:i=!1,...a}){return(0,Y.jsx)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":n,disabled:r,onClick:()=>t(!e),className:K(`inline-flex shrink-0 items-center justify-center rounded-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-40`,i?`size-11`:`size-7`),...a,children:(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:K(`inline-flex size-4.5 items-center justify-center rounded border transition-colors`,e?`border-accent bg-accent text-accent-fg`:`border-line-strong bg-surface`),children:e?(0,Y.jsx)(m,{size:12,strokeWidth:3}):null})})}var SC=e=>String(e||``).split(`
27
+ `).map(e=>e.trim()).find(Boolean)||`No text`;function CC({open:e,onClose:t,ids:n,comments:i,max:a,agentName:o,targetTitle:s,onStart:c,busy:l,error:u,touch:d}){let f=(0,J.useMemo)(()=>new Map(i.map(e=>[e.id,e])),[i]),p=n.slice(0,a),m=n.length-p.length;return(0,Y.jsx)(M,{open:e,onClose:t,title:`Fix ${p.length} ${p.length===1?`comment`:`comments`} with ${o}`,description:`One at a time, in this order. Each is a normal fix you can review and undo.`,wrapDescription:!0,size:`md`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r,{variant:`secondary`,size:d?`touch`:`sm`,onClick:t,children:`Cancel`}),(0,Y.jsxs)(r,{variant:`default`,size:d?`touch`:`sm`,disabled:l||!p.length,onClick:()=>c(n),"data-sw-batch-start":`true`,children:[l?(0,Y.jsx)(ug,{size:14,className:`motion-safe:animate-spin`,"aria-hidden":`true`}):(0,Y.jsx)(m_,{size:14,"aria-hidden":`true`}),` `,`Start`]})]}),children:(0,Y.jsxs)(`div`,{className:`space-y-3`,"data-sw-batch-confirm":p.length,children:[m>0?(0,Y.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-warn/40 bg-warn/10 px-3 py-2 text-xs text-fg`,role:`note`,"data-sw-batch-over":m,children:[(0,Y.jsx)(O_,{size:14,className:`mt-px shrink-0 text-warn`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{children:[`You chose `,n.length,`. Only the first `,a,` will run; the batch limit is set in Agents.`]})]}):null,(0,Y.jsx)(`ol`,{className:`max-h-72 divide-y divide-line overflow-y-auto rounded-md border border-line`,children:p.map((e,t)=>{let n=f.get(e);return(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2.5 px-3 py-2 text-ui`,"data-sw-batch-confirm-item":e,children:[(0,Y.jsxs)(`span`,{className:`w-5 shrink-0 text-right text-xs text-faint tabular-nums`,children:[t+1,`.`]}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`block truncate text-fg`,"data-sw-batch-confirm-title":e,children:[(0,Y.jsxs)(`span`,{className:`text-muted tabular-nums`,children:[`#`,e]}),` `,SC(n?.body)]}),(0,Y.jsx)(`span`,{className:`block truncate text-xs text-muted`,children:n?s(n.pageId):`comment`})]})]},e)})}),u?(0,Y.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,"data-sw-batch-error":`true`,children:u}):null]})})}var wC={waiting:{label:`Waiting`,tone:`neutral`,icon:oh},running:{label:`Running`,tone:`accent`,icon:ug},fixed:{label:`Fixed`,tone:`ok`,icon:m},failed:{label:`Failed`,tone:`bad`,icon:O_},skipped:{label:`Skipped`,tone:`neutral`,icon:ih}};function TC(e){let t=e.items.length,n=e.items.filter(e=>![`waiting`,`running`].includes(e.state)).length;if(e.state===`waiting`)return`Waiting for your OK on #${e.waiting?.commentId}`;if(e.state===`running`)return`Fixing ${Math.min(n+1,t)} of ${t}`;let{fixed:r=0,failed:i=0,skipped:a=0}=e.counts||{},o=[`${r} fixed`,i?`${i} failed`:null,a?`${a} skipped`:null].filter(Boolean).join(`, `);return e.state===`cancelled`?`Cancelled: ${o}`:e.state===`stopped`?e.stopReason===`failures`?`Stopped after 2 failures in a row: ${o}`:`Stopped: ${o}`:`Done: ${o}`}function EC({batch:e,boardId:t,comments:n=[],onOpenThread:i,onCancel:a,onDismiss:o,touch:s=!1,compact:c=!1,className:l}){let[u,d]=(0,J.useState)(!c),f=(0,J.useMemo)(()=>new Map((n||[]).map(e=>[e.id,e.body])),[n]),[p,m]=(0,J.useState)(null),[h,_]=(0,J.useState)(null);if(!e)return null;let v=vC(e),y=s?`touch`:`xs`,b=e.items.length,x=e.items.filter(e=>![`waiting`,`running`].includes(e.state)).length,S=async n=>{if(e.waiting){m(n??`deny`),_(null);try{await oC(t,e.waiting.threadId,e.waiting.card.id,n)}catch(e){_(e.message)}finally{m(null)}}},C=(e.waiting?.card?.options||[]).filter(e=>e&&e.optionId);return(0,Y.jsxs)(`section`,{className:K(`space-y-2`,l),"aria-label":`Batch of fixes`,"data-sw-batch":e.state,"data-sw-batch-compact":c?`true`:void 0,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[v?e.state===`waiting`?(0,Y.jsx)(u_,{size:15,className:`shrink-0 text-warn`,"aria-hidden":`true`}):(0,Y.jsx)(ug,{size:15,className:`shrink-0 text-accent motion-safe:animate-spin`,"aria-hidden":`true`}):(0,Y.jsx)(Qh,{size:15,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-ui font-semibold text-fg`,role:`status`,"data-sw-batch-headline":`true`,children:TC(e)}),c?(0,Y.jsx)(r,{variant:`ghost`,size:y,className:`text-fg`,onClick:()=>d(e=>!e),"aria-expanded":u,"data-sw-batch-toggle":`true`,children:u?`Hide`:`Show`}):null,v?(0,Y.jsx)(r,{variant:`secondary`,size:y,onClick:a,disabled:e.cancelling,"data-sw-batch-cancel":`true`,children:`Cancel`}):o?(0,Y.jsx)(r,{variant:`ghost`,size:s?`icon`:`icon-xs`,onClick:o,"aria-label":`Close the summary`,"data-sw-batch-dismiss":`true`,children:(0,Y.jsx)(g,{size:14,"aria-hidden":`true`})}):null]}),(0,Y.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-2`,role:`progressbar`,"aria-label":`Fixes finished`,"aria-valuemin":0,"aria-valuemax":b,"aria-valuenow":x,children:(0,Y.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-[width] duration-(--motion-base)`,style:{width:`${x/Math.max(1,b)*100}%`}})}),e.state===`waiting`&&e.waiting?(0,Y.jsxs)(`div`,{className:`space-y-1.5 rounded-md border border-warn/40 bg-warn/10 px-2.5 py-2`,"data-sw-batch-waiting":e.waiting.commentId,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-fg`,children:[`The agent asks before it goes on: `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.waiting.card.label||`an action`}),`. The batch waits for your answer.`]}),e.waiting.card.detail?(0,Y.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded bg-surface px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap text-fg`,"data-sw-batch-waiting-detail":`true`,children:e.waiting.card.detail}):null,e.waiting.card.diff?(0,Y.jsx)(pC,{diff:e.waiting.card.diff}):null,(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[C.map(e=>(0,Y.jsx)(r,{size:y,variant:/reject|deny/i.test(e.kind||``)?`secondary`:`default`,disabled:!!p,onClick:()=>S(e.optionId),"data-sw-batch-answer":e.optionId,children:e.name||e.optionId},e.optionId)),C.length?null:(0,Y.jsx)(r,{size:y,variant:`secondary`,onClick:()=>i?.(e.waiting.commentId),children:`Review in the chat`})]}),h?(0,Y.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,children:h}):null]}):null,u?(0,Y.jsx)(`ol`,{className:`divide-y divide-line rounded-md border border-line bg-surface`,"data-sw-batch-items":b,children:e.items.map(e=>{let t=wC[e.state]||wC.waiting,n=t.icon;return(0,Y.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 px-2 py-1`,"data-sw-batch-item":e.commentId,"data-sw-batch-item-state":e.state,children:[(0,Y.jsxs)(r,{variant:`link`,size:y,className:`shrink-0 px-1 shadow-none tabular-nums`,onClick:()=>i?.(e.commentId),"aria-label":`Open comment #${e.commentId}`,"data-sw-batch-open":e.commentId,children:[`#`,e.commentId]}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,"data-sw-batch-item-title":e.commentId,children:[f.has(e.commentId)?(0,Y.jsx)(`span`,{className:`text-fg`,children:SC(f.get(e.commentId))}):null,e.message?(0,Y.jsxs)(`span`,{className:`text-muted`,children:[f.has(e.commentId)?` · `:``,e.message]}):null]}),(0,Y.jsxs)(Be,{tone:t.tone,className:`shrink-0`,children:[(0,Y.jsx)(n,{size:10,className:e.state===`running`?`motion-safe:animate-spin`:void 0,"aria-hidden":`true`}),` `,t.label]})]},e.commentId)})}):null,!v&&e.requested>b?(0,Y.jsxs)(`p`,{className:`text-xs text-muted`,children:[e.requested-b,` more `,e.requested-b===1?`was`:`were`,` chosen but not run (the limit is `,e.max,`).`]}):null]})}var DC=`__any`,OC=[{id:`open`,label:`Open`},{id:`resolved`,label:`Resolved`},{id:`all`,label:`All`}];function kC(e){let t=[...e.reactions||[],...(e.replies||[]).flatMap(e=>e.reactions||[])],n=new Map;for(let e of t)n.set(e.emoji,(n.get(e.emoji)||0)+e.count);return[...n.entries()].slice(0,3)}function AC({comment:e}){let t=AS(e.id);return e.status===`resolved`?(0,Y.jsxs)(Be,{tone:`ok`,"data-sw-comment-state":`resolved`,children:[(0,Y.jsx)(m,{size:10,"aria-hidden":`true`}),` Resolved`]}):t?.state===`working`||t?.state===`waiting`?(0,Y.jsxs)(Be,{tone:t.state===`waiting`?`warn`:`accent`,"data-sw-agent-live":t.state,children:[(0,Y.jsx)(ug,{size:10,className:`motion-safe:animate-spin`,"aria-hidden":`true`}),t.state===`waiting`?`Needs your OK`:`Agent working`]}):e.agentStatus?(0,Y.jsx)(Ky,{status:e.agentStatus,at:e.agentStatusAt}):(0,Y.jsx)(qy,{comment:e})}function jC({comment:e,title:t,selected:n,unread:r,touch:i,onFocus:a,onHover:o,pick:s=null}){let c=Ob(t=>t.hoveredId===e.id),l=Qy(e),u=e.replies?.length||0,d=kC(e),f=[e,...e.replies||[]],p=f.reduce((e,t)=>e+(t.images?.length||0),0),m=f.some(e=>e.drawing?.shapes?.length),h=fv(e.viewport);return(0,Y.jsxs)(`li`,{className:K(`relative`,n?`bg-accent/10 shadow-[inset_3px_0_0_var(--accent)]`:c?`bg-surface-2`:``,e.status===`resolved`&&!n&&`opacity-80`,s&&`flex items-start`),"data-sw-batch-row":s?e.id:void 0,children:[s?(0,Y.jsx)(`span`,{className:K(`flex shrink-0 items-center`,i?`pt-1.5 pl-1`:`pt-3 pl-1.5`),children:(0,Y.jsx)(xC,{checked:s.checked,onChange:s.onChange,disabled:s.disabled,touch:i,label:`Select comment #${e.id}`,"data-sw-batch-select":e.id})}):null,(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>a(e),onMouseEnter:o?()=>o(e.id):void 0,onMouseLeave:o?()=>o(null):void 0,onFocus:o?()=>o(e.id):void 0,onBlur:o?()=>o(null):void 0,"aria-current":n?`true`:void 0,className:K(`sw-gutter-pad flex w-full gap-2.5 px-3 py-3 text-left transition-colors hover:bg-surface-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent`,i&&`min-h-11`,s&&`min-w-0 flex-1 pl-1.5`),"data-sw-comment":e.id,"data-sw-comment-unread":r?`true`:void 0,"data-sw-comment-selected":n?`true`:void 0,children:[(0,Y.jsx)(Zy,{...l,size:i?`lg`:`md`,className:`mt-0.5`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-ui`,children:[(0,Y.jsx)(`span`,{className:K(`min-w-0 truncate text-fg`,r?`font-bold`:`font-semibold`),children:l.name}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-faint`,children:Ee(e.createdAt)}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[(0,Y.jsx)(AC,{comment:e}),r?(0,Y.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-accent`,"aria-label":`Unread`,role:`img`,"data-sw-unread-dot":`true`}):null]})]}),(0,Y.jsx)(ab,{text:e.body,plain:!!e.authorGuest,className:`mt-0.5 line-clamp-2 block text-ui break-words text-fg`}),(0,Y.jsxs)(`span`,{className:`mt-1.5 flex min-w-0 items-center gap-2 text-xs text-muted`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex h-5 min-w-0 items-center gap-1 rounded bg-surface-2 px-1.5 text-[11px] text-muted`,"data-sw-comment-page":`true`,children:[(0,Y.jsxs)(`span`,{className:`shrink-0 font-semibold text-fg/70 tabular`,children:[`#`,e.id]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Y.jsx)(h,{size:11,className:`shrink-0 text-faint`,"aria-label":e.viewport,role:`img`})]}),u?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 tabular`,"aria-label":`${u} ${u===1?`reply`:`replies`}`,children:[(0,Y.jsx)(wg,{size:11,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:u})]}):null,p?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 tabular`,"aria-label":`${p} ${p===1?`image`:`images`}`,"data-sw-comment-images":p,children:[(0,Y.jsx)(Jh,{size:11,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:p})]}):null,m?(0,Y.jsx)(`span`,{className:`inline-flex shrink-0 items-center`,"aria-label":`Has a drawing`,role:`img`,"data-sw-comment-drawn":`true`,children:(0,Y.jsx)(Km,{size:11,"aria-hidden":`true`})}):null,d.map(([e,t])=>(0,Y.jsxs)(`span`,{className:`shrink-0`,"aria-label":`${t} ${e}`,children:[e,t>1?(0,Y.jsx)(`span`,{className:`ml-0.5 tabular`,children:t}):null]},e)),e.agentStatus&&e.reopenCount>0&&e.status===`open`?(0,Y.jsx)(qy,{comment:e}):null]}),e.orphanReason?(0,Y.jsx)(`span`,{className:`mt-1 block text-xs text-muted`,children:e.orphanReason}):null,e.imported&&e.agentStatus?(0,Y.jsx)(`span`,{className:`mt-1 block text-xs text-faint`,children:`Imported history`}):null]})]})]})}function MC({comments:e,filter:t,counts:n,onFilter:i,selectedId:a=null,onFocus:o,onHover:s=null,unread:c=new Set,onMarkAllRead:l=null,canAct:u,targetTitle:d,touch:f,journeyFilter:p=null,heading:m=!0,onClose:h=null,onResetBrowserComments:_=null,people:v=[],narrow:y=null,batch:b=null}){let x=(0,J.useRef)(null);(0,J.useEffect)(()=>{a!==null&&(x.current?.querySelector(`[data-sw-comment="${a}"]`))?.scrollIntoView?.({block:`nearest`})},[a,e.length]);let S=Db();(0,J.useEffect)(()=>{if(f)return;let e=S.get().hoveredId;return S.subscribe(()=>{let{hoveredId:t}=S.get();t!==e&&(e=t,t!==null&&x.current?.querySelector(`[data-sw-comment="${t}"]`)?.scrollIntoView?.({block:`nearest`}))})},[f,S]);let C=!!(y&&(y.query||y.state||y.mention)),w=e.filter(e=>c.has(e.id)).length,T=!!b?.offered,E=T&&b.selecting,D=E?e.filter(yC):[],O=E?b.selected.filter(e=>D.some(t=>t.id===e)):[],A=f?`touch`:`xs`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-line`,children:[m?(0,Y.jsx)(SS,{icon:wg,title:`Comments`,onClose:h,closeLabel:`Close comments`,closeProps:{"data-sw-comments-close":`true`}}):null,(0,Y.jsx)(`div`,{className:K(`px-3 pb-2.5`,m?``:`pt-2.5`),children:(0,Y.jsx)(ze,{label:`Show comments`,value:t,onChange:i,large:f,className:`w-full`,options:OC.map(e=>({...e,count:e.id===`all`?n.open+n.resolved:n[e.id]}))})})]}),y?(0,Y.jsxs)(`div`,{className:`space-y-1.5 border-b border-line px-3 py-2`,"data-sw-comment-narrow":`true`,children:[(0,Y.jsx)(Ge,{type:`search`,icon:n_,size:f?`touch`:`xs`,value:y.query,onChange:e=>y.onQuery(e.target.value.slice(0,120)),placeholder:`Search text, people, pages, #id`,"aria-label":`Search comments`,"data-sw-comment-search":`true`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsxs)(Ve,{value:y.state||DC,onValueChange:e=>y.onState(e===DC?null:e),children:[(0,Y.jsx)(he,{size:f?`touch`:`xs`,className:`flex-1`,"aria-label":`Comment state`,"data-sw-comment-state":`true`,children:(0,Y.jsx)(W,{})}),(0,Y.jsxs)(de,{children:[(0,Y.jsx)(Me,{value:DC,children:`Any state`}),(0,Y.jsx)(_e,{}),av.map(e=>(0,Y.jsx)(Me,{value:e.id,children:e.label},e.id))]})]}),(0,Y.jsxs)(Ve,{value:y.mention||DC,onValueChange:e=>y.onMention(e===DC?null:e),children:[(0,Y.jsx)(he,{size:f?`touch`:`xs`,className:`flex-1`,"aria-label":`Mentioning`,"data-sw-comment-mention":`true`,children:(0,Y.jsx)(W,{})}),(0,Y.jsxs)(de,{children:[(0,Y.jsx)(Me,{value:DC,children:`Anyone mentioned`}),v.length?(0,Y.jsx)(_e,{}):null,v.map(e=>(0,Y.jsxs)(Me,{value:e.handle,children:[`@`,e.handle]},e.handle))]})]}),C?(0,Y.jsx)(z,{size:f?`icon`:`icon-xs`,onClick:y.onClear,label:`Clear search and filters`,"data-sw-comment-narrow-clear":`true`,children:(0,Y.jsx)(g,{size:14,"aria-hidden":`true`})}):null]})]}):null,_?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line bg-surface-2/60 px-3 py-2 text-xs text-muted`,"data-sw-browser-comments":`true`,children:[(0,Y.jsx)(Xh,{size:13,className:`shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Demo: comments you add stay in this browser.`}),(0,Y.jsx)(r,{variant:`ghost`,size:f?`touch`:`xs`,className:`text-fg`,onClick:_,"data-sw-browser-comments-reset":`true`,children:`Reset`})]}):null,p?(0,Y.jsx)(`div`,{className:`border-b border-line px-3 py-2`,children:(0,Y.jsxs)(ke,{variant:`pill`,size:f?`touch`:`xs`,pressed:p.on,onPressedChange:p.onToggle,"data-sw-journey-filter":p.on?`on`:`off`,children:[(0,Y.jsx)(Qg,{size:12,className:`shrink-0 text-warn`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[`Only `,p.name]})]})}):null,T&&t!==`resolved`?(0,Y.jsx)(`div`,{className:K(`flex flex-wrap items-center gap-1.5 border-b border-line px-3 py-1.5 text-xs text-muted`,E&&`bg-accent/5`),"data-sw-batch-bar":E?`selecting`:`off`,children:E?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-nowrap tabular-nums`,role:`status`,"data-sw-batch-count":O.length,children:[O.length,` selected`]}),(0,Y.jsxs)(r,{variant:`ghost`,size:A,className:`text-fg`,disabled:!D.length,onClick:()=>b.setSelected(D.slice(0,b.max).map(e=>e.id)),"data-sw-batch-select-all":`true`,children:[`Select all`,D.length>b.max?` (first ${b.max})`:``]}),(0,Y.jsx)(r,{variant:`ghost`,size:A,className:`text-fg`,onClick:()=>b.setSelecting(!1),"data-sw-batch-select-done":`true`,children:`Cancel`}),O.length>b.max?(0,Y.jsxs)(`p`,{className:`basis-full text-xs text-fg`,"data-sw-batch-over":`true`,children:[`Only the first `,b.max,` will run (the limit on the Agents page).`]}):null,(0,Y.jsxs)(r,{variant:`default`,size:A,className:`w-full`,disabled:!O.length||vC(b.batch),onClick:()=>b.onConfirm(O),"data-sw-batch-fix":O.length,children:[(0,Y.jsx)(m_,{size:13,"aria-hidden":`true`}),` Fix `,O.length||``,` with `,b.agentName]})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Fix several open comments in one go.`}),(0,Y.jsxs)(r,{variant:`ghost`,size:A,className:`text-fg`,disabled:vC(b.batch),onClick:()=>b.setSelecting(!0),"data-sw-batch-select-mode":`true`,children:[(0,Y.jsx)(cg,{size:13,"aria-hidden":`true`}),` Select`]})]})}):null,T&&b.batch?(0,Y.jsx)(`div`,{className:`sticky top-0 z-10 border-b border-line bg-surface px-3 py-2`,"data-sw-batch-strip":`true`,children:(0,Y.jsx)(EC,{batch:b.batch,boardId:b.boardId,comments:e,compact:!0,touch:f,onOpenThread:b.onOpenThread,onCancel:b.cancel,onDismiss:b.dismiss})}):null,w&&l?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line px-3 py-1.5 text-xs text-muted`,"data-sw-unread-bar":`true`,children:[(0,Y.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-accent`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[w,` with new activity`]}),(0,Y.jsxs)(r,{variant:`ghost`,size:f?`touch`:`xs`,className:`text-fg`,onClick:l,"data-sw-mark-all-read":`true`,children:[(0,Y.jsx)(Qm,{size:13,"aria-hidden":`true`}),` Mark all read`]})]}):null,(0,Y.jsx)(`ul`,{ref:x,className:`min-h-0 flex-1 divide-y divide-line overflow-y-auto`,"data-sw-comment-list":`true`,children:e.length?e.map(e=>(0,Y.jsx)(jC,{comment:e,title:d(e.pageId),selected:a===e.id,unread:c.has(e.id),touch:f,onFocus:o,onHover:s,pick:E&&e.status===`open`?{checked:O.includes(e.id),disabled:!yC(e),onChange:()=>b.toggle(e.id)}:null},e.id)):(0,Y.jsx)(`li`,{children:C?(0,Y.jsx)(k,{icon:n_,title:`No comments match`,children:(0,Y.jsx)(r,{variant:`link`,size:f?`touch`:`xs`,className:`shadow-none`,onClick:y.onClear,children:`Clear the search and filters`})}):(0,Y.jsx)(k,{icon:wg,title:t===`resolved`?`Nothing resolved yet`:t===`open`?`No open comments`:`No comments yet`,children:u?f?`Tap Comment, then tap a page to pin a note.`:`Press C or turn on Comment, then click a page to pin a note.`:`This board is read-only.`})})})]})}function NC({label:e,keyName:t}){return(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e,` `,(0,Y.jsx)(a,{children:t})]})}function PC({route:e,step:t,pageTitle:n,onStep:r,touch:i}){let a=new Map(e.forks.map((e,t)=>[e.afterStep,{...e,index:t}])),o=i?`h-11 min-w-8`:`h-6 min-w-6`;return(0,Y.jsxs)(`ol`,{className:K(`flex max-w-full min-w-0 items-center overflow-x-auto py-1`,i?`gap-0.5 px-1`:`gap-0.5`),"aria-label":`Steps`,"data-sw-journey-rail":`true`,children:[e.steps.map((e,s)=>{let c=s+1,l=a.get(c),u=c===t,d=c<t;return(0,Y.jsxs)(J.Fragment,{children:[s>0?(0,Y.jsx)(`li`,{"aria-hidden":`true`,className:K(`h-0.5 w-3 shrink-0 rounded-full`,c<=t?`bg-accent/60`:`bg-line`)}):null,(0,Y.jsx)(`li`,{className:`shrink-0`,children:(0,Y.jsx)(h,{content:(0,Y.jsxs)(`span`,{children:[`Step `,c,`: `,n(e.pageId),e.branch?(0,Y.jsxs)(`span`,{className:`opacity-75`,children:[` (`,e.branch,`)`]}):null]}),side:`top`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(c),className:K(`group/dot inline-flex items-center justify-center rounded-full outline-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-accent`,o),"aria-current":u?`step`:void 0,"aria-label":`Step ${c}: ${n(e.pageId)}${e.branch?` (${e.branch})`:``}`,"data-sw-journey-dot":c,children:(0,Y.jsx)(`span`,{className:K(`tabular inline-flex items-center justify-center rounded-full px-1 text-[11px] leading-none font-semibold`,i?`h-7 min-w-7`:`h-6 min-w-6`,u?`bg-accent text-accent-fg shadow-card ring-4 ring-accent/20`:d?`bg-accent/15 text-accent group-hover/dot:bg-accent/25`:`border border-line bg-surface text-muted group-hover/dot:border-faint group-hover/dot:text-fg`,e.branch&&!u&&`border-dashed`),"aria-hidden":`true`,children:c})})})}),l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`li`,{"aria-hidden":`true`,className:K(`h-0.5 w-2 shrink-0 rounded-full`,c<t?`bg-accent/60`:`bg-line`)}),(0,Y.jsx)(`li`,{className:`shrink-0`,children:(0,Y.jsx)(h,{content:`The journey forks here: ${l.options.map(e=>e.label).join(` or `)}`,side:`top`,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r(c),className:K(`inline-flex items-center gap-1 rounded-full border px-1.5 text-[11px] font-medium outline-none focus-visible:outline-2 focus-visible:outline-accent`,i?`h-11`:`h-6`,c===t?`border-accent bg-accent/10 text-accent`:`border-line bg-surface-2 text-muted hover:text-fg`),"aria-label":`Fork after step ${c}: ${l.options.find(e=>e.id===l.chosen)?.label||``} taken`,"data-sw-journey-rail-fork":l.index,children:[(0,Y.jsx)(Ih,{size:12,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`max-w-24 truncate`,children:l.options.find(e=>e.id===l.chosen)?.label})]})})})]}):null]},e.key||s)}),e.ended?(0,Y.jsx)(`li`,{className:`ml-1 shrink-0 text-[11px] font-medium text-faint`,"data-sw-journey-rail-end":`true`,children:`ends`}):null]})}function FC({journey:e,route:t,step:n,pageTitle:i,onStep:a,onChoose:o,onClose:s,onEdit:c,onDelete:l,canEdit:u,busy:d,touch:f}){let[p,m]=(0,J.useState)(!1),_=t.steps.length,v=t.steps[n-1],y=t.forks.findIndex(e=>e.afterStep===n),b=y>=0?t.forks[y]:null,x=f?`touch`:`sm`,S=(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-[13px] font-semibold text-fg`,children:[(0,Y.jsx)(Qg,{size:14,className:`shrink-0 text-accent`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.name})]});return(0,Y.jsxs)(`div`,{className:K(`pointer-events-auto absolute z-30 flex flex-col gap-1.5 rounded-xl border border-line bg-surface/95 shadow-pop backdrop-blur`,f?`inset-x-2 bottom-2 p-2`:`bottom-4 left-1/2 w-max max-w-[min(760px,calc(100%-2rem))] min-w-[440px] -translate-x-1/2 px-3 py-2`),role:`region`,"aria-label":`Journey: ${e.name}`,"data-sw-journey-bar":e.id,"data-sw-journey-path":t.forks.map(e=>e.chosen).join(`,`),children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 px-0.5`,children:[e.description&&!f?(0,Y.jsx)(h,{content:e.description,side:`top`,align:`start`,children:(0,Y.jsx)(`span`,{tabIndex:0,className:`block min-w-0 rounded outline-none focus-visible:outline-2 focus-visible:outline-accent`,"data-sw-journey-description":`true`,children:S})}):S,(0,Y.jsxs)(`p`,{className:`truncate text-xs text-muted`,"aria-live":`polite`,"data-sw-journey-step":n,children:[(0,Y.jsxs)(`span`,{className:`tabular font-medium text-fg`,children:[`Step `,n,` of `,_]}),v?.branch?(0,Y.jsxs)(`span`,{"data-sw-journey-branch-now":v.branch,children:[` (`,v.branch,`)`]}):null,`:`,` `,i(v?.pageId),t.ended&&n===_?`, where this branch ends`:``]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(h,{content:f?null:(0,Y.jsx)(NC,{label:`Previous step`,keyName:`←`}),children:(0,Y.jsx)(r,{size:f?`icon`:`icon-sm`,disabled:n<=1,onClick:()=>a(n-1),"aria-label":`Previous step`,"data-sw-journey-prev":`true`,children:(0,Y.jsx)(eh,{size:16,"aria-hidden":`true`})})}),(0,Y.jsx)(h,{content:f?null:(0,Y.jsx)(NC,{label:`Next step`,keyName:`→`}),children:(0,Y.jsxs)(r,{size:f?`touch`:`sm`,variant:`default`,className:`px-2.5`,disabled:n>=_,onClick:()=>a(n+1),"aria-label":`Next step`,"data-sw-journey-next":`true`,children:[`Next `,(0,Y.jsx)(R,{size:16,"aria-hidden":`true`})]})}),u?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`mx-0.5 h-5 w-px bg-line`,"aria-hidden":`true`}),c?(0,Y.jsx)(z,{size:f?`icon`:`icon-sm`,onClick:c,disabled:d,label:`Edit this journey`,children:(0,Y.jsx)(Bg,{size:14,"aria-hidden":`true`})}):null,p?(0,Y.jsxs)(r,{size:x,variant:`danger`,disabled:d,onClick:l,"data-sw-journey-delete-confirm":`true`,children:[(0,Y.jsx)(E_,{size:14,"aria-hidden":`true`}),` Delete`]}):(0,Y.jsx)(z,{size:f?`icon`:`icon-sm`,disabled:d,onClick:()=>m(!0),label:`Delete this journey`,children:(0,Y.jsx)(E_,{size:14,"aria-hidden":`true`})})]}):null,(0,Y.jsx)(z,{size:f?`icon`:`icon-sm`,onClick:s,label:`Close the journey`,tooltip:f?null:(0,Y.jsx)(NC,{label:`Close the journey`,keyName:`Esc`}),"data-sw-journey-close":`true`,children:(0,Y.jsx)(g,{size:16,"aria-hidden":`true`})})]})]}),(0,Y.jsx)(PC,{route:t,step:n,pageTitle:i,onStep:a,touch:f}),b?(0,Y.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-1.5 border-t border-line pt-2`,role:`group`,"aria-label":`The journey forks here. Which way?`,"data-sw-journey-fork":y,children:[(0,Y.jsxs)(`span`,{className:K(`flex items-center gap-1 text-xs font-medium text-muted`,f&&`w-full px-1`),children:[(0,Y.jsx)(Ih,{size:13,className:`shrink-0 text-accent`,"aria-hidden":`true`}),` Which way?`]}),b.options.map(e=>{let t=e.id===b.chosen;return(0,Y.jsxs)(r,{size:x,variant:t?`default`:`secondary`,className:K(`max-w-full min-w-0`,f&&`flex-1`),"aria-pressed":t,onClick:()=>o(y,e.id),"data-sw-journey-branch":e.id,children:[(0,Y.jsx)(`span`,{className:`truncate`,children:e.label}),e.end?(0,Y.jsx)(`span`,{className:`text-[11px] opacity-75`,children:`(ends)`}):null]},e.id)})]}):null]})}function IC({draft:e,onChange:t,onSave:n,onCancel:i,pageTitle:a,busy:o,touch:s}){let c=s?`touch`:`sm`,l=e.steps,u=e.into||null,d=RC(l),f=BC(l),p=e.name.trim()&&d>=2&&!f&&!o,m=l[l.length-1],_=n=>{let r=structuredClone(l),i=n(r);t({...e,steps:r,into:i===void 0?u:i})};return(0,Y.jsxs)(`div`,{className:K(`pointer-events-auto absolute z-30 flex max-h-[70%] flex-col gap-2 overflow-y-auto rounded-xl border border-accent/50 bg-surface/95 p-3 shadow-pop backdrop-blur`,s?`inset-x-2 bottom-2`:`bottom-4 left-1/2 w-[min(680px,calc(100%-2rem))] -translate-x-1/2`),role:`region`,"aria-label":e.id?`Edit journey`:`New journey`,"data-sw-journey-builder":`true`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Qg,{size:15,className:`shrink-0 text-accent`,"aria-hidden":`true`}),(0,Y.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Journey name`}),(0,Y.jsx)(Ge,{size:s?`touch`:`sm`,value:e.name,onChange:n=>t({...e,name:n.target.value.slice(0,120)}),placeholder:`Name this journey, e.g. Sign up`,"data-sw-journey-name":`true`})]})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted`,"data-sw-journey-into":u?`${u.fork}:${u.branch}`:`main`,children:[s?`Tap`:`Click`,` pages in the order people visit them`,u?(0,Y.jsxs)(Y.Fragment,{children:[` `,`-- adding to `,(0,Y.jsx)(`span`,{className:`font-semibold text-fg`,children:l[u.fork]?.branches?.[u.branch]?.label||`the branch`}),`.`]}):`.`]}),(0,Y.jsxs)(`ol`,{className:`flex flex-wrap items-start gap-1.5`,"data-sw-journey-draft":zC(l),children:[l.map((n,i)=>typeof n==`string`?(0,Y.jsx)(LC,{number:i+1,title:a(n),touch:s,onRemove:()=>_(e=>(e.splice(i,1),null))},`${n}-${i}`):(0,Y.jsxs)(`li`,{className:`w-full rounded-lg border border-line bg-surface-2/50 p-2`,"data-sw-journey-draft-fork":i,children:[(0,Y.jsxs)(`p`,{className:`mb-1.5 flex items-center gap-1 text-xs font-medium text-muted`,children:[(0,Y.jsx)(Ih,{size:13,className:`shrink-0 text-accent`,"aria-hidden":`true`}),` Fork: which way?`]}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:n.branches.map((o,c)=>{let l=u?.fork===i&&u?.branch===c;return(0,Y.jsxs)(`div`,{className:K(`flex flex-wrap items-center gap-1.5 rounded-md p-1`,l&&`bg-accent/10 ring-1 ring-accent/50`),"data-sw-journey-draft-branch":c,children:[(0,Y.jsx)(Ge,{size:s?`touch`:`xs`,className:`w-36`,value:o.label,"aria-label":`Branch ${c+1} name`,onChange:e=>_(t=>{t[i].branches[c].label=e.target.value.slice(0,60)})}),o.steps.map((e,t)=>typeof e==`string`?(0,Y.jsx)(LC,{title:a(e),touch:s,onRemove:()=>_(e=>{e[i].branches[c].steps.splice(t,1)})},`${e}-${t}`):(0,Y.jsx)(`span`,{className:`text-xs text-faint`,children:`(a nested fork, edit it in the config)`},`nested-`+t)),(0,Y.jsx)(r,{size:s?`touch`:`xs`,variant:l?`default`:`ghost`,"aria-pressed":l,onClick:()=>t({...e,into:{fork:i,branch:c}}),"data-sw-journey-fill-branch":c,children:l?`Adding here`:`Add pages here`}),(0,Y.jsx)(r,{size:s?`touch`:`xs`,variant:o.end?`default`:`ghost`,"aria-pressed":!!o.end,onClick:()=>_(e=>{e[i].branches[c].end?delete e[i].branches[c].end:e[i].branches[c].end=!0}),"data-sw-journey-branch-end":c,children:o.end?`Ends here`:`Rejoins`}),n.branches.length>2?(0,Y.jsx)(z,{className:K(`rounded-full`,s?`h-11 w-11`:`h-6 w-6`),onClick:()=>_(e=>(e[i].branches.splice(c,1),u?.fork===i?{fork:i,branch:0}:u)),label:`Remove branch ${c+1}`,tooltip:`Remove the branch`,children:(0,Y.jsx)(g,{size:12,"aria-hidden":`true`})}):null]},c)})}),(0,Y.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-1.5`,children:[n.branches.length<6?(0,Y.jsxs)(r,{size:s?`touch`:`xs`,variant:`ghost`,onClick:()=>_(e=>(e[i].branches.push({label:`Branch ${e[i].branches.length+1}`,steps:[]}),{fork:i,branch:e[i].branches.length-1})),"data-sw-journey-add-branch":`true`,children:[(0,Y.jsx)(Hg,{size:13,"aria-hidden":`true`}),` Branch`]}):null,u?.fork===i?(0,Y.jsx)(r,{size:s?`touch`:`xs`,variant:`ghost`,onClick:()=>t({...e,into:null}),"data-sw-journey-main":`true`,children:`Back to the main line`}):null]})]},`fork-${i}`)),l.length?null:(0,Y.jsx)(`li`,{className:`text-xs text-faint`,children:`No steps yet.`})]}),f?(0,Y.jsx)(`p`,{className:`text-xs text-warn`,"data-sw-journey-problem":`true`,children:f}):null,(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,Y.jsx)(h,{content:s?null:`Split the journey here into branches`,children:(0,Y.jsxs)(r,{size:c,variant:`ghost`,className:`mr-auto`,disabled:typeof m!=`string`||o,onClick:()=>_(e=>(e.push({branches:[{label:`Branch 1`,steps:[]},{label:`Branch 2`,steps:[]}]}),{fork:e.length-1,branch:0})),"data-sw-journey-fork-add":`true`,children:[(0,Y.jsx)(Ih,{size:14,"aria-hidden":`true`}),` Fork here`]})}),(0,Y.jsxs)(r,{size:c,variant:`ghost`,disabled:!l.length||o,onClick:()=>_(e=>{let t=u?e[u.fork]?.branches?.[u.branch]?.steps:e;return t?.length?(t.pop(),u):u?e[u.fork].branches.every(e=>!e.steps.length)?(e.splice(u.fork,1),null):u:null}),children:[(0,Y.jsx)(A_,{size:14,"aria-hidden":`true`}),` Undo`]}),(0,Y.jsx)(r,{size:c,onClick:i,disabled:o,children:`Cancel`}),(0,Y.jsx)(r,{size:c,variant:`default`,onClick:n,disabled:!p,"data-sw-journey-save":`true`,children:o?`Saving...`:`Save journey`})]})]})}function LC({number:e,title:t,touch:n,onRemove:r}){return(0,Y.jsxs)(`li`,{className:`inline-flex items-center gap-1 rounded-full bg-accent/10 py-0.5 pr-0.5 pl-2 text-xs font-medium text-fg`,children:[e?(0,Y.jsx)(`span`,{className:`font-bold text-accent`,children:e}):null,` `,t,(0,Y.jsx)(z,{className:K(`rounded-full`,n?`h-9 w-9`:`h-5 w-5`),onClick:r,label:e?`Remove step ${e}`:`Remove ${t}`,tooltip:`Remove`,children:(0,Y.jsx)(g,{size:12,"aria-hidden":`true`})})]})}function RC(e){return e.reduce((e,t)=>e+(typeof t==`string`?1:t.branches.reduce((e,t)=>e+t.steps.length,0)),0)}function zC(e){return e.map(e=>typeof e==`string`?e:`[${e.branches.map(e=>`${e.label}:${e.steps.join(`+`)}${e.end?`!`:``}`).join(`|`)}]`).join(`,`)}function BC(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(typeof n==`string`)continue;let r=t<e.length-1,i=new Set;for(let e of n.branches){let t=e.label.trim();if(!t)return`Every branch needs a name.`;if(i.has(t.toLowerCase()))return`Two branches are called "${t}".`;if(i.add(t.toLowerCase()),!e.steps.length&&(e.end||!r))return`"${t}" has no pages: add some, or add a step after the fork for it to skip to.`}if(n.branches.every(e=>e.end)&&r)return`Every branch ends, so nothing can follow the fork.`}return null}function VC({environments:e,pair:t,loading:n,error:i,changedPages:a,totalPages:o=0,changedOnly:s,showDiff:c,canCapture:l,captureBusy:u,touch:d,onPair:f,onChangedOnly:p,onShowDiff:m,onCapture:h,onClose:_}){let[v,y]=t,b=(t,n,r,i,a=null)=>(0,Y.jsxs)(`span`,{className:K(`flex min-w-0 items-center gap-1 text-xs text-muted`,d&&`min-w-28 flex-1`),children:[d||!a?null:(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:a}),(0,Y.jsxs)(Ve,{value:t,onValueChange:n,children:[(0,Y.jsx)(he,{size:d?`touch`:`sm`,className:d?`flex-1`:`max-w-48`,"aria-label":r,"data-sw-compare-env":i,children:(0,Y.jsx)(W,{})}),(0,Y.jsx)(de,{children:e.map(e=>(0,Y.jsx)(Me,{value:e.id,children:e.title},e.id))})]})]}),x=e.filter(e=>t.includes(e.id)&&!e.capturedAt);return(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-line bg-surface px-3 py-2`,role:`region`,"aria-label":`Compare environments`,"data-sw-compare-bar":t.join(`_`),children:[(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 pr-1 text-[13px] font-semibold text-fg`,children:[(0,Y.jsx)(Ph,{size:15,className:`shrink-0 text-accent`,"aria-hidden":`true`}),d?null:`Compare`]}),b(v,e=>f(e===y?[e,v]:[e,y]),`Compare`,`a`),(0,Y.jsx)(z,{size:d?`icon`:`icon-sm`,onClick:()=>f([y,v]),label:`Swap the environments`,children:(0,Y.jsx)(Bm,{size:14,"aria-hidden":`true`})}),b(y,e=>f(e===v?[y,e]:[v,e]),`with`,`b`,`with`),(0,Y.jsx)(z,{size:d?`icon`:`icon-sm`,className:K(`ml-auto`,!d&&`order-last`),onClick:_,label:`Leave compare mode`,"data-sw-compare-close":`true`,children:(0,Y.jsx)(g,{size:16,"aria-hidden":`true`})}),(0,Y.jsx)(ke,{size:d?`touch`:`sm`,pressed:c,onPressedChange:m,children:`Diff overlay`}),(0,Y.jsx)(ke,{size:d?`touch`:`sm`,pressed:s,onPressedChange:p,"data-sw-changed-only":s?`on`:`off`,children:`Changed pages only`}),(0,Y.jsx)(`span`,{className:`text-xs text-muted`,"aria-live":`polite`,"data-sw-compare-status":n?`loading`:`ready`,children:n?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Y.jsx)(ue,{size:12}),` Comparing`]}):i?(0,Y.jsx)(`span`,{className:`text-bad`,children:i}):(0,Y.jsxs)(`span`,{className:K(`tabular inline-flex h-6 items-center rounded-full px-2 font-medium`,a?`bg-accent/10 text-accent`:`bg-surface-2 text-muted`),children:[a,o?` of ${o}`:``,` page`,(o||a)===1?``:`s`,` changed`]})}),l?x.map(e=>(0,Y.jsxs)(r,{size:d?`touch`:`sm`,disabled:u,onClick:()=>h(e.id),children:[(0,Y.jsx)(Xm,{size:14,"aria-hidden":`true`}),` Capture `,e.title]},e.id)):null]})}var HC=2e3,UC=(e,t)=>e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&!t;function WC({draft:e,onChange:t,onSubmit:n,onCancel:i,busy:o,people:s,touch:c,hosted:l,signedInAs:u,description:d,media:f}){let p=e?.body||``,m=Math.min(8,Math.max(c?3:2,p.split(`
28
+ `).length)),[h,g]=(0,J.useState)(!1),_=cx(e=>e?.owner===`composer`?e.shapes.length:0),v=f?.images,y=!!(f?.attach&&v),b=!!f?.draw,x=!!v?.reading;return(0,Y.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),n()},...jx(v,y),"data-sw-composer":`true`,children:[d?(0,Y.jsx)(`p`,{className:`truncate text-xs text-muted`,"data-sw-composer-target":`true`,children:d}):null,(0,Y.jsxs)(`label`,{className:`block`,children:[(0,Y.jsx)(`span`,{className:`sr-only`,children:`Comment`}),(0,Y.jsx)(sb,{size:c?`touch`:`sm`,rows:m,value:p,people:s,className:`resize-none`,onChange:e=>t({body:e.slice(0,HC)}),onKeyDown:e=>{UC(e,c)&&(e.preventDefault(),n())},autoFocus:!0,placeholder:`Add a comment. @ to mention someone or @agent`,"aria-describedby":v?.error?`sw-composer-image-error`:void 0,"data-sw-comment-input":`true`})]}),y?(0,Y.jsx)(Mx,{draft:v,touch:c,id:`sw-composer-image-error`}):null,y||b||f?.attachNote?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-0.5`,"data-sw-composer-media":`true`,children:[b&&!c?(0,Y.jsx)(Ex,{owner:`composer`,touch:!1,compact:!0,className:`flex-1`,leading:y?(0,Y.jsx)(Ax,{draft:v,touch:!1,disabled:o}):null}):y?(0,Y.jsx)(Ax,{draft:v,touch:c,disabled:o}):null,b&&c&&f.page?(0,Y.jsxs)(r,{size:`touch`,variant:`ghost`,onClick:()=>g(!0),"data-sw-draw-open":`true`,children:[(0,Y.jsx)(Km,{size:16,"aria-hidden":`true`}),` `,_?`Drawing (${_})`:`Draw on the page`]}):null,f?.attachNote?(0,Y.jsx)(`p`,{className:`w-full text-caption text-faint`,"data-sw-attach-note":`true`,children:f.attachNote}):null]}):null,c&&b&&f.page?(0,Y.jsx)(kx,{open:h,onClose:()=>g(!1),owner:`composer`,src:f.page.src,native:f.page.native,title:f.pageTitle}):null,l?null:(0,Y.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Your name`}),(0,Y.jsx)(Ge,{size:c?`touch`:`xs`,value:e?.author||``,onChange:e=>t({author:e.target.value.slice(0,60)}),placeholder:`optional`,className:`flex-1`,"data-sw-comment-author":`true`})]}),c?null:(0,Y.jsxs)(`p`,{className:`flex items-center gap-1 overflow-hidden text-[11px] whitespace-nowrap text-faint`,"data-sw-composer-keys":`true`,children:[(0,Y.jsx)(a,{children:`Enter`}),` posts, `,(0,Y.jsx)(a,{children:`Shift`}),`+`,(0,Y.jsx)(a,{children:`Enter`}),` new line, `,(0,Y.jsx)(a,{children:`Esc`}),` cancels`]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-faint`,children:p.length>1800?(0,Y.jsxs)(`span`,{className:`tabular`,children:[p.length,`/`,HC]}):l&&u?`As ${u}`:null}),(0,Y.jsx)(r,{size:c?`touch`:`xs`,variant:`ghost`,onClick:i,disabled:o,"data-sw-composer-cancel":`true`,children:`Cancel`}),(0,Y.jsx)(r,{size:c?`touch`:`xs`,variant:`default`,type:`submit`,disabled:o||x||!p.trim(),"data-sw-save-comment":`true`,children:o?v?.images.length?`Uploading...`:`Posting...`:`Post`})]})]})}function GC({before:e,after:t,label:n=`Before and after`,beforeLabel:r=`Before`,afterLabel:i=`After`,start:a=50,className:o,children:s,...c}){let[l,u]=(0,J.useState)(a),d=(0,J.useRef)(null),f=(0,J.useRef)(!1),p=e=>{let t=d.current?.getBoundingClientRect();t?.width&&u(Math.min(100,Math.max(0,(e-t.left)/t.width*100)))};return(0,Y.jsxs)(`div`,{ref:d,className:K(`relative touch-pan-y overflow-hidden select-none`,o),onPointerDown:e=>{e.button===0&&(f.current=!0,e.currentTarget.setPointerCapture?.(e.pointerId),p(e.clientX))},onPointerMove:e=>f.current&&p(e.clientX),onPointerUp:()=>{f.current=!1},onPointerCancel:()=>{f.current=!1},"data-sw-compare-slider":Math.round(l),...c,children:[(0,Y.jsx)(`div`,{className:`absolute inset-0 z-[1]`,style:{clipPath:`inset(0 ${100-l}% 0 0)`},children:e}),t,(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[2]`,children:s}),(0,Y.jsx)(`span`,{className:`pointer-events-none absolute top-1.5 left-1.5 z-[3] rounded bg-black/60 px-1.5 text-[10px] leading-4 font-medium text-white`,children:r}),(0,Y.jsx)(`span`,{className:`pointer-events-none absolute top-1.5 right-1.5 z-[3] rounded bg-black/60 px-1.5 text-[10px] leading-4 font-medium text-white`,children:i}),(0,Y.jsxs)(`div`,{role:`slider`,tabIndex:0,"aria-label":n,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l),"aria-valuetext":`${Math.round(l)}% ${r.toLowerCase()}`,onKeyDown:e=>{let t=e.shiftKey?20:5;if(e.key===`ArrowLeft`||e.key===`ArrowDown`)u(e=>Math.max(0,e-t));else if(e.key===`ArrowRight`||e.key===`ArrowUp`)u(e=>Math.min(100,e+t));else if(e.key===`Home`)u(0);else if(e.key===`End`)u(100);else return;e.preventDefault(),e.stopPropagation()},className:`group absolute inset-y-0 z-[3] w-8 -translate-x-1/2 cursor-ew-resize outline-none`,style:{left:`${l}%`},"data-sw-compare-handle":`true`,children:[(0,Y.jsx)(`span`,{className:`absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 bg-white shadow-[0_0_0_1px_rgb(0_0_0/0.25)]`}),(0,Y.jsx)(`span`,{className:`absolute top-1/2 left-1/2 flex h-7 w-7 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border border-line bg-surface text-muted shadow-pop group-focus-visible:ring-2 group-focus-visible:ring-accent`,children:(0,Y.jsx)(v_,{size:13,"aria-hidden":`true`})})]})]})}function KC({url:e,native:t,crop:n,label:r,comment:i,onImageError:a,shapes:o=null}){let s=n||{left:0,top:0,width:t.width,height:t.height};if(!e)return(0,Y.jsx)(`div`,{className:`h-full w-full bg-surface-2`});let c=o?.length?(0,Y.jsx)(bx,{shapes:o,width:t.width,height:t.height,crop:n,className:`z-[1]`,"data-sw-before-drawing":`true`}):null;if(c&&!n)return(0,Y.jsxs)(`div`,{className:`relative w-full`,children:[(0,Y.jsx)(KC,{url:e,native:t,crop:null,label:r,comment:i,onImageError:a}),c]});let l=(0,Y.jsx)(`img`,{src:e,alt:`${r}: ${i.viewport} capture`,draggable:!1,onError:a,className:K(`block max-w-none select-none`,n?`absolute`:`w-full`),style:n?{width:`${t.width/s.width*100}%`,left:`${-s.left/s.width*100}%`,top:`${-s.top/s.height*100}%`}:void 0});return c?(0,Y.jsxs)(Y.Fragment,{children:[l,c]}):l}function qC({native:e,crop:t,comment:n}){if(!t)return null;let r=(e.width*n.x/100-t.left)/t.width,i=(e.height*n.y/100-t.top)/t.height;return r<0||r>1||i<0||i>1?null:(0,Y.jsx)(`span`,{className:`pointer-events-none absolute h-5 w-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-accent shadow-pop`,style:{left:`${r*100}%`,top:`${i*100}%`},"aria-hidden":`true`})}function JC({url:e,native:t,crop:n,comment:r,label:i,onImageError:a,shapes:o=null}){let s=n||{left:0,top:0,width:t.width,height:t.height};return(0,Y.jsxs)(`figure`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`figcaption`,{className:`mb-1 text-[11px] font-medium tracking-wide text-faint uppercase`,children:i}),(0,Y.jsxs)(`div`,{className:K(`relative w-full overflow-hidden rounded-md border border-line bg-surface-2`,!n&&`max-h-80 overflow-y-auto`),style:n?{aspectRatio:`${s.width} / ${s.height}`}:void 0,children:[(0,Y.jsx)(KC,{url:e,native:t,crop:n,label:i,comment:r,onImageError:a,shapes:o}),(0,Y.jsx)(qC,{native:t,crop:n,comment:r})]})]})}var YC=[{id:`near`,label:`Near the pin`},{id:`whole`,label:`Whole frame`}],XC=[{id:`near`,label:`Near the drawing`},{id:`whole`,label:`Whole frame`}],ZC=[{id:`slider`,label:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(v_,{size:13,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Slider`})]})},{id:`split`,label:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(uh,{size:13,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Side by side`})]})}],QC=[{id:`before`,label:`Before`},{id:`after`,label:`After`}];function $C({comment:e,pair:t,native:n,urlFor:r,touch:i,onImageError:a}){let[o,s]=(0,J.useState)(`near`),[c,l]=(0,J.useState)(`slider`),u=t?.drawn||null,[d,f]=(0,J.useState)(u?`before`:`after`),p=(0,J.useRef)(null);if(!t||!n||!t.before&&!t.after)return null;if(!t.after||!t.before)return(0,Y.jsx)(`p`,{className:`mt-2 rounded-md bg-surface-2 px-2 py-1.5 text-xs text-muted`,"data-sw-before-after":t.reason,children:t.reason===`not-recaptured`?`Not recaptured since this comment. Recapture the page to see before and after.`:`The capture this comment was made on is no longer kept, so there is no before to show.`});let m=u?tx({shapes:u}):null,h=m?[(m.x+m.width/2)*100,(m.y+m.height/2)*100]:[e.x,e.y],g=o===`near`?$_(n,h[0],h[1]):null,_=g||{left:0,top:0,width:n.width,height:n.height},v={native:n,crop:g,comment:e,onImageError:a},y=u?(0,Y.jsx)(`p`,{className:`text-xs text-muted`,"data-sw-drawn-previous":`true`,children:`The drawing shows on Before, over the page as it was.`}):null,b=(0,Y.jsx)(ze,{label:`Zoom`,options:m?XC:YC,value:o,onChange:s,large:i,className:i?`flex-1`:``});if(!i)return(0,Y.jsxs)(`div`,{className:`mt-2.5 space-y-2`,"data-sw-before-after":`ready`,children:[y,(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b,(0,Y.jsx)(`span`,{className:`flex-1`}),(0,Y.jsx)(ze,{label:`Layout`,options:ZC,value:c,onChange:l,itemClassName:`px-2`})]}),c===`slider`?(0,Y.jsx)(`div`,{className:K(`rounded-md border border-line bg-surface-2`,!g&&`max-h-80 overflow-y-auto`),children:(0,Y.jsx)(GC,{start:u?85:50,className:`w-full`,style:g?{aspectRatio:`${_.width} / ${_.height}`}:void 0,label:`Before and after comment ${e.id}`,before:(0,Y.jsx)(`div`,{className:`relative h-full w-full bg-surface-2`,children:(0,Y.jsx)(KC,{url:r(t.before),label:`Before`,...v,shapes:u})}),after:(0,Y.jsx)(`div`,{className:K(`relative w-full bg-surface-2`,g&&`h-full`),children:(0,Y.jsx)(KC,{url:r(t.after),label:`After`,...v})}),children:(0,Y.jsx)(qC,{native:n,crop:g,comment:e})},u?`drawn`:`plain`)}):(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(JC,{url:r(t.before),label:`Before`,...v,shapes:u}),(0,Y.jsx)(JC,{url:r(t.after),label:`After`,...v})]})]});let x=(0,Y.jsx)(JC,{url:r(t.before),label:`Before`,...v,shapes:u}),S=(0,Y.jsx)(JC,{url:r(t.after),label:`After`,...v});return(0,Y.jsxs)(ye,{value:d,onValueChange:f,className:`mt-2.5 space-y-2`,"data-sw-before-after":`ready`,children:[y,(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(Ae,{"aria-label":`Show`,className:`flex-1`,children:QC.map(e=>(0,Y.jsx)(Le,{value:e.id,large:!0,children:e.label},e.id))}),b]}),(0,Y.jsxs)(`div`,{onTouchStart:e=>{p.current=e.touches[0]?.clientX??null},onTouchEnd:e=>{let t=p.current,n=e.changedTouches[0]?.clientX;p.current=null,t===null||n===void 0||Math.abs(n-t)<40||f(n<t?`after`:`before`)},"data-sw-before-after-side":d,children:[(0,Y.jsx)(oe,{value:`before`,children:x}),(0,Y.jsx)(oe,{value:`after`,children:S})]})]})}function ew(e,t){return t?e.by.some(e=>t.handle&&e.handle?e.handle===t.handle:String(e.name).toLowerCase()===String(t.name||`anonymous`).toLowerCase()):!1}function tw(e,t){let n=w[e.emoji]||e.emoji;if(!e.by.length)return`${e.count} ${e.count===1?`person`:`people`} reacted with ${n}`;let r=e.by.map(e=>ew({by:[e]},t)?`You`:e.name);return`${r.length>1?`${r.slice(0,-1).join(`, `)} and ${r.at(-1)}`:r[0]} reacted with ${n}`}function nw({reactions:e=[],canReact:t,me:n,onToggle:r,touch:i}){let[a,o]=(0,J.useState)(!1);if(!e.length&&!t)return null;let s=K(`inline-flex items-center gap-1 rounded-full border px-1.5 text-xs leading-none tabular`,i?`h-11 min-w-11 justify-center`:`h-6`);return(0,Y.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-sw-reactions":`true`,children:[e.map(e=>{let i=ew(e,n),a=tw(e,n);return(0,Y.jsx)(h,{content:a,children:t?(0,Y.jsxs)(`button`,{type:`button`,className:K(s,`transition-colors focus-visible:outline-2 focus-visible:outline-accent`,i?`border-accent/35 bg-accent/5 text-fg hover:border-accent/60`:`border-line bg-surface-2 text-fg hover:border-faint`),"aria-pressed":i,"aria-label":`${a}. ${i?`Remove your reaction`:`Add yours`}`,onClick:()=>r(e.emoji),"data-sw-reaction":e.emoji,"data-sw-reaction-mine":i?`true`:`false`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:e.emoji}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`font-medium`,children:e.count})]}):(0,Y.jsxs)(`span`,{className:K(s,`border-line bg-surface-2 text-fg`),"aria-label":a,role:`img`,"data-sw-reaction":e.emoji,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:e.emoji}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`font-medium`,children:e.count})]})},e.emoji)}),t?(0,Y.jsxs)(Ye,{open:a,onOpenChange:o,children:[(0,Y.jsx)(h,{content:`Add a reaction`,children:(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,className:K(s,i?`px-0`:`w-6 justify-center px-0`,`border-transparent text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-2 focus-visible:outline-accent`,!i&&!e.length&&`opacity-0 group-focus-within/message:opacity-100 group-hover/message:opacity-100`,a&&`opacity-100`),"aria-label":`Add a reaction`,"data-sw-reaction-add":`true`,children:(0,Y.jsx)(wh,{size:15,"aria-hidden":`true`})})})}),(0,Y.jsx)(qe,{side:i?`bottom`:`right`,align:`start`,sideOffset:6,collisionPadding:12,className:`flex gap-0.5 p-1`,"aria-label":`Reactions`,"data-sw-reaction-picker":`true`,children:v.map(e=>(0,Y.jsx)(`button`,{type:`button`,className:K(`inline-flex items-center justify-center rounded-md text-lg hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-accent`,i?`h-11 w-11`:`h-8 w-8`),"aria-label":`React with ${w[e]}`,onClick:()=>{o(!1),r(e)},"data-sw-reaction-pick":e,children:e},e))})]}):null]})}function rw(e){let t=Array.isArray(e?.profiles)?e.profiles:[],n=e?.profileId||`default`,r=t.find(e=>e.id==="default"),i=r?.sameAs||`default`,a=t.filter(e=>!(e.id==="default"&&e.sameAs)).map(e=>({id:e.id,label:e.label||(e.id==="default"?`Default connection`:e.id),configured:e.configured!==!1,state:e.configured===!1?`unavailable`:e.state||`ready`,loginHint:e.loginHint||null,isDefault:e.id===i})),o=n==="default"&&r?.sameAs?r.sameAs:n,s=a.some(e=>e.id===o);return{show:t.length>0&&(a.length>1||!s),value:o,known:s,options:a}}function iw(e,t){let{value:n}=rw(e);return t===n?null:t}function aw(e){let{value:t,options:n}=rw(e);return n.find(e=>e.id!==t&&e.configured)||null}var ow={ready:`Ready`,login:`Not signed in`,starting:`Starting`,"not-responding":`Not responding`,unavailable:`Not set up`},sw={ready:`bg-ok`,login:`bg-warn`,starting:`bg-accent motion-safe:animate-pulse`,"not-responding":`bg-bad`,unavailable:`bg-faint`};function cw(e){return e?`Sign in: ${String(e).split(/, or /)[0]}`:null}function lw(e){let t=ow[e?.state]||ow.ready;return e?.state===`login`&&e.loginHint?`${t}. ${cw(e.loginHint)}`:t}function uw(e){let t=String(e||`?`).trim().split(/\s+/).filter(Boolean);if(!t.length)return`?`;if(t.length>1)return(t[0][0]+t[1][0]).toUpperCase();let n=t[0];return n[0].toUpperCase()+(n[1]||``).toLowerCase()}function dw(e){return`Switched to ${e}. It starts fresh and can read this chat.`}function fw(e){if(!e?.configured)return{name:null,options:[],defaultId:null};let t=Array.isArray(e.profiles)?e.profiles:[],{options:n}=rw({profileId:`default`,profiles:t}),r=n.filter(e=>e.configured),i=t.find(e=>e.id==="default")?.sameAs||`default`;return{name:e.label||r.find(e=>e.isDefault)?.label||null,options:r.length>1?r:[],defaultId:i}}function pw({threadProfile:e=`default`,wanted:t,defaultId:n}){let r=e=>e==="default"||e===n,i=e||`default`;return i===t||r(i)&&r(t)?null:t}function mw({again:e,name:t}){return e?`Fix again`:t?`Fix with ${t}`:`Fix with agent`}function hw({label:e,state:t=`ready`,size:n=`md`,className:r}){return(0,Y.jsxs)(`span`,{className:K(`relative inline-flex shrink-0 items-center justify-center rounded-md border border-line bg-surface-2 font-semibold text-fg`,n===`sm`?`h-5 w-5 text-[9px]`:`h-7 w-7 text-[11px]`,r),"aria-hidden":`true`,children:[uw(e),(0,Y.jsx)(`span`,{className:K(`absolute -right-0.5 -bottom-0.5 rounded-full ring-2 ring-surface`,n===`sm`?`h-1.5 w-1.5`:`h-2 w-2`,sw[t]||sw.ready)})]})}function gw({text:e}){return String(e).split(/(`[^`]+`)/).map((e,t)=>e.startsWith("`")&&e.endsWith("`")?(0,Y.jsx)(`code`,{className:`font-mono text-[10.5px] text-fg`,children:e.slice(1,-1)},t):e)}function _w({options:e,value:n=null,onChoose:r,onConnect:i=null,settingsHref:a=null,disabledReason:o=null,heading:s=null,align:c=`start`,touch:l=!1,children:u,...f}){let p=(0,Y.jsx)(C,{asChild:!0,"aria-disabled":o?`true`:void 0,onPointerDown:o?e=>e.preventDefault():void 0,onKeyDown:o?e=>[`Enter`,` `,`ArrowDown`,`ArrowUp`].includes(e.key)&&e.preventDefault():void 0,children:u});return(0,Y.jsxs)(Ce,{modal:!1,children:[o?(0,Y.jsx)(h,{content:o,children:p}):p,(0,Y.jsxs)(t,{align:c,className:K(`w-[min(20rem,calc(100vw-1.5rem))]`,l&&`p-1.5`),"data-sw-agent-menu":`true`,...f,children:[s?(0,Y.jsx)(D,{className:`normal-case tracking-normal`,children:s}):null,(0,Y.jsx)(A,{value:n??``,onValueChange:e=>r?.(e),children:e.map(e=>(0,Y.jsxs)(d,{value:e.id,disabled:!e.configured,textValue:e.label,className:`h-auto min-h-11 items-start py-2 lg:h-auto lg:min-h-11`,"aria-label":`${e.label}${e.isDefault?`, default`:``}, ${lw(e)}`,"data-sw-agent-option":e.id,"data-sw-agent-state":e.state,children:[(0,Y.jsx)(hw,{label:e.label,state:e.state,className:`mt-0.5`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.label}),e.isDefault?(0,Y.jsx)(`span`,{className:`shrink-0 rounded-full border border-line px-1.5 text-[10px] leading-4 font-medium text-muted`,"data-sw-agent-default":`true`,children:`Default`}):null]}),(0,Y.jsx)(`span`,{className:K(`line-clamp-2 text-[11.5px] leading-4 font-normal`,e.state===`login`?`text-fg`:e.state===`not-responding`?`text-bad`:`text-muted`),children:(0,Y.jsx)(gw,{text:lw(e)})})]})]},e.id))}),i||a?(0,Y.jsx)(_,{}):null,i?(0,Y.jsxs)(T,{onSelect:i,"data-sw-agent-connect":`true`,children:[(0,Y.jsx)(Wg,{size:14,"aria-hidden":`true`}),` Connect another agent...`]}):null,a?(0,Y.jsx)(T,{asChild:!0,children:(0,Y.jsxs)(`a`,{href:a,"data-sw-agent-settings":`true`,children:[(0,Y.jsx)(i_,{size:14,"aria-hidden":`true`}),` Agent settings`]})}):null]})]})}var vw=e=>`comment-${e}`,yw=/^chat-[a-z0-9]{16}$/,bw=e=>yw.test(String(e||``)),xw=e=>e===`board`?`board`:String(e||``).startsWith(`comment-`)?`comment`:`chat`;function Sw(){let e=new Uint8Array(16);return globalThis.crypto.getRandomValues(e),`chat-${[...e].map(e=>`abcdefghijklmnopqrstuvwxyz0123456789`[e%36]).join(``)}`}var Cw=e=>e===`board`?`board`:bw(e)?e:`c${String(e).slice(8)}`;function ww(e){return e===`board`?`board`:/^c[1-9]\d{0,8}$/.test(e||``)?vw(e.slice(1)):bw(e)?e:null}var Tw=new Map,Ew=e=>`shapewall.lastChat.${e||``}`;function Dw(e,t){if(ww(t)){Tw.set(e||``,t);try{globalThis.sessionStorage?.setItem(Ew(e),t)}catch{}}}function Ow(e){let t=Tw.get(e||``);if(!t)try{t=globalThis.sessionStorage?.getItem(Ew(e))||``}catch{t=``}return ww(t)?t:`board`}var kw=864e5,Aw=e=>{let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()};function jw(e,{now:t=Date.now(),timeOf:n=e=>new Date(e).getTime()}={}){let r=Aw(t),i=[{id:`today`,label:`Today`,items:[]},{id:`yesterday`,label:`Yesterday`,items:[]},{id:`earlier`,label:`Earlier`,items:[]}];for(let t of e){let e=n(t.updatedAt);i[Number.isFinite(e)&&e>=r?0:Number.isFinite(e)&&e>=r-kw?1:2].items.push(t)}return i.filter(e=>e.items.length)}function Mw(e,t=null){let n=xw(e);return n===`comment`?t?.body?String(t.body).replace(/\s+/g,` `).trim().slice(0,60):`Comment chat`:n===`board`?`Board chat`:`New chat`}var Nw=e=>String(e||``).split(`
29
+ `).map(e=>`> ${e}`.trimEnd()).join(`
30
+ `);function Pw({title:e,threadId:t,messages:n,comment:r=null,boardTitle:i=null,exportedAt:a=new Date}){let o=[`# ${e||Mw(t,r)}`,``],s=[i?`Board: ${i}`:null,r?`About comment #${r.id}`:null].filter(Boolean);o.push(`_Exported from Shapewall on ${a.toISOString().slice(0,10)}.${s.length?` ${s.join(`. `)}.`:``}_`,``),r?.body&&o.push(Nw(r.body),``);for(let e of n||[]){let t=e.createdAt?` (${String(e.createdAt).slice(0,16).replace(`T`,` `)} UTC)`:``;if(e.role===`user`){o.push(`## You${t}`,``,e.text||`_(images only)_`,``);let n=(e.attachments||[]).map(e=>e.name).filter(Boolean);n.length&&o.push(`Images: ${n.join(`, `)}`,``)}else{o.push(`## Agent${t}`,``);let n=(e.cards||[]).filter(e=>e.label).map(e=>`- ${e.label}${e.detail?`: ${e.detail}`:``}`);n.length&&o.push(`Steps:`,``,...n,``),e.text&&o.push(e.text,``),e.status===`stopped`&&o.push(`_Stopped._`,``),e.error?.message&&o.push(`_Error: ${e.error.message}_`,``)}}return`${o.join(`
31
+ `).trimEnd()}\n`}function Fw(e){return`${String(e||`chat`).toLowerCase().normalize(`NFKD`).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`chat`}.md`}function Iw(e){let t=AS(e.id);return t?.state===`waiting`?`waiting`:t?.state===`working`||[`queued`,`working`].includes(e.agentStatus)?`working`:null}function Lw({comment:e,onFix:t,onOpenChat:n=null,busy:i,touch:a,className:o}){let s=Iw(e),c=(0,J.useContext)(vv)?.boardId||null,l=!!t&&e.status===`open`,u=Xe(l?`/api/agent/status`:null);eC(u.refetch,l);let[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(null);if(!l)return null;if(!s&&e.agentStatus===`branch-ready`)return n?(0,Y.jsxs)(r,{size:a?`touch`:`xs`,variant:`default`,className:K(`rounded-full pr-3 pl-2.5`,o),onClick:()=>n(e),"data-sw-fix-agent-open":e.id,"data-sw-fix-agent-state":`branch`,children:[(0,Y.jsx)(Mh,{size:13,"aria-hidden":`true`}),` Review branch`]}):null;if(s)return(0,Y.jsxs)(`span`,{className:K(`inline-flex min-w-0 items-center gap-1.5`,o),"data-sw-fix-agent-state":s,children:[(0,Y.jsxs)(`span`,{className:K(`inline-flex h-7 min-w-0 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium`,s===`waiting`?`bg-warn/15 text-fg`:`bg-accent/10 text-accent`),role:`status`,children:[s===`waiting`?(0,Y.jsx)(u_,{size:13,className:`shrink-0 text-warn`,"aria-hidden":`true`}):(0,Y.jsx)(ug,{size:13,className:`shrink-0 motion-safe:animate-spin`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:s===`waiting`?`Agent needs your OK`:`Agent working`})]}),n?(0,Y.jsx)(r,{size:a?`touch`:`xs`,variant:s===`waiting`?`default`:`ghost`,onClick:()=>n(e),"data-sw-fix-agent-open":e.id,children:s===`waiting`?`Review`:`View`}):null]});let{name:h,options:g,defaultId:_}=fw(u.data),v=e.agentStatus===`done`,y=v?`secondary`:`default`,b=a?`touch`:`xs`,x=async n=>{if(m(null),g.length&&c){f(!0);try{let t=nC(c,vw(e.id)),r=pw({threadProfile:(await Ke.get(t))?.profileId,wanted:n,defaultId:_});r&&await Ke.post(`${t}/profile`,{profileId:r})}catch(e){m(e.message);return}finally{f(!1)}}t(e)},S=g.length>0,C=(0,Y.jsxs)(r,{size:b,variant:y,className:K(S?`rounded-l-full rounded-r-none pr-2.5 pl-2.5`:`rounded-full pr-3 pl-2.5`,!S&&o),disabled:i||d,onClick:()=>x(`default`),"data-sw-fix-agent":e.id,"data-sw-fix-agent-name":h||void 0,children:[d?(0,Y.jsx)(ug,{size:13,className:`motion-safe:animate-spin`,"aria-hidden":`true`}):(0,Y.jsx)(m_,{size:13,"aria-hidden":`true`}),` `,mw({again:v,name:h})]}),w=p?(0,Y.jsx)(`span`,{className:`min-w-0 text-xs text-bad`,role:`alert`,children:p}):null;return S?(0,Y.jsxs)(`span`,{className:K(`inline-flex min-w-0 flex-wrap items-center justify-end gap-1.5`,o),"data-sw-fix-agent-split":e.id,children:[w,(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0`,children:[C,(0,Y.jsx)(_w,{options:g,value:null,onChoose:e=>x(e===_?`default`:e),heading:`Run this fix once with`,align:`end`,touch:a,children:(0,Y.jsx)(r,{size:a?`icon`:`icon-xs`,variant:y,className:K(`rounded-l-none rounded-r-full`,v?`-ml-px`:`border-l border-accent-fg/30`),disabled:i||d,"aria-label":`Fix with another agent`,"data-sw-fix-agent-choose":e.id,children:(0,Y.jsx)(H,{size:13,"aria-hidden":`true`})})})]})]}):w?(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center justify-end gap-1.5`,children:[w,C]}):C}var Rw=(e,t)=>t?`${e}, ${t}`:e;function zw(e){return e===`viewer`?`Viewers can't reply -- ask an admin for access.`:e===`guest`?`This share link can't reply -- ask the board owner.`:`Replies are off on this board.`}function Bw({at:e,editedAt:t}){return(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-baseline gap-1 text-xs text-faint`,children:[(0,Y.jsx)(h,{content:rb(e),children:(0,Y.jsx)(`time`,{dateTime:e,children:Ee(e)})}),t?(0,Y.jsx)(h,{content:`Edited ${rb(t)}`,children:(0,Y.jsx)(`span`,{"data-sw-edited":`true`,children:`(edited)`})}):null]})}function Vw({author:e,at:t,editedAt:n,children:r,reactions:i,canReact:a,me:o,onReact:s,touch:c,...l}){return(0,Y.jsxs)(`li`,{className:`group/message flex gap-2.5 py-2`,...l,children:[(0,Y.jsx)(Zy,{...e,size:c?`lg`:`md`,className:`mt-0.5`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`p`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-ui`,children:[(0,Y.jsx)(Yy,{...e}),(0,Y.jsx)(Bw,{at:t,editedAt:n})]}),r,(0,Y.jsx)(nw,{reactions:i,canReact:a,me:o,onToggle:s,touch:c})]})]})}function Hw({comment:e,busy:t,onSave:n,onCancel:i,touch:a,people:o}){let[s,c]=(0,J.useState)(e.body),l=async t=>{t?.preventDefault();let r=s.trim();if(!r||r===e.body)return i();await n(e,r)&&i()};return(0,Y.jsxs)(`form`,{className:`mt-1 space-y-1.5`,onSubmit:l,"data-sw-edit-form":e.id,children:[(0,Y.jsxs)(`label`,{className:`block`,children:[(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Edit comment `,e.id]}),(0,Y.jsx)(sb,{rows:3,size:a?`touch`:`sm`,value:s,maxLength:HC,onChange:c,people:o,onKeyDown:e=>{UC(e,a)&&(e.preventDefault(),l())},autoFocus:!0})]}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(r,{size:a?`touch`:`xs`,variant:`ghost`,onClick:i,disabled:t,"data-sw-edit-cancel":e.id,children:`Cancel`}),(0,Y.jsx)(r,{size:a?`touch`:`xs`,variant:`default`,type:`submit`,disabled:t||!s.trim(),"data-sw-edit-save":e.id,children:`Save`})]})]})}function Uw({comment:e,busy:t,onReply:n,touch:i,people:a,autoFocus:o,askName:s=!1,onSaveName:c=null,media:l=null}){let[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(()=>s&&!fe()),[m,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(!1),v=!!l?.attach,y=!!l?.draw,b=Jb({enabled:v}),x=`reply-${e.id}`,S=`${e.pageId}|${e.viewport}`,C=cx(e=>e?.owner===x?e.shapes.length:0);(0,J.useEffect)(()=>{if(y)return sx.start(S,x),()=>sx.end(x)},[y,S,x]);let w=y&&i?l.pageImage?.(e.pageId,e.viewport):null,T=async r=>{r?.preventDefault();let i=u.trim();if(!i||t||b.reading)return;let a=f?m.trim():``;a&&(He(a),c?.(a));let o=sx.get(),s=o?.owner===x?o.shapes:[],l=qb(b.images);await n(e,i,{...l.length?{images:l}:{},...s.length?{drawing:lx(s)}:{},onImageError:b.setError})&&(d(``),b.clear(),sx.set({shapes:[],tool:null}),a&&p(!1))},E=Math.min(6,Math.max(1,u.split(`
32
+ `).length)),D=`sw-reply-image-error-${e.id}`;return(0,Y.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2 border-t border-line px-3 py-2`,onSubmit:T,...jx(b,v),"data-sw-reply-form":e.id,children:[f?(0,Y.jsxs)(`label`,{className:`flex w-full items-center gap-2 text-xs text-muted`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Your name`}),(0,Y.jsx)(Ge,{size:i?`touch`:`xs`,value:m,onChange:e=>h(e.target.value.slice(0,60)),placeholder:`shown on your reply`,className:`flex-1`,"data-sw-reply-author":e.id})]}):null,(0,Y.jsxs)(`label`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`sr-only`,children:[`Reply to comment `,e.id]}),(0,Y.jsx)(sb,{rows:E,size:i?`touch`:`sm`,value:u,maxLength:HC,onChange:d,people:a,className:`resize-none`,placeholder:i?`Reply`:`Reply, @ to mention`,onKeyDown:e=>{UC(e,i)&&(e.preventDefault(),T())},autoFocus:o,"aria-describedby":b.error?D:void 0,"data-sw-reply-input":e.id})]}),(0,Y.jsx)(z,{type:`submit`,variant:`default`,size:i?`icon`:`icon-sm`,className:`rounded-full`,disabled:t||b.reading||!u.trim(),label:t&&b.images.length?`Uploading the reply`:`Send reply`,"data-sw-reply-send":e.id,children:(0,Y.jsx)(Wm,{size:16,"aria-hidden":`true`})}),v?(0,Y.jsx)(`div`,{className:`w-full`,children:(0,Y.jsx)(Mx,{draft:b,touch:i,id:D})}):null,v||y||l?.attachNote?(0,Y.jsxs)(`div`,{className:`-mt-1 -ml-1 flex w-full flex-wrap items-center gap-0.5`,"data-sw-reply-media":e.id,children:[y&&!i?(0,Y.jsx)(Ex,{owner:x,touch:!1,compact:!0,className:`flex-1`,leading:v?(0,Y.jsx)(Ax,{draft:b,touch:!1,disabled:t}):null}):v?(0,Y.jsx)(Ax,{draft:b,touch:i,disabled:t}):null,y&&i&&w?(0,Y.jsxs)(r,{size:`touch`,variant:`ghost`,onClick:()=>_(!0),"data-sw-draw-open":`true`,children:[(0,Y.jsx)(Km,{size:16,"aria-hidden":`true`}),` `,C?`Drawing (${C})`:`Draw on the page`]}):null,l?.attachNote?(0,Y.jsx)(`p`,{className:`w-full px-1 text-caption text-faint`,"data-sw-attach-note":`true`,children:l.attachNote}):null]}):null,y&&i&&w?(0,Y.jsx)(kx,{open:g,onClose:()=>_(!1),owner:x,src:w.src,native:w.native,title:l.pageTitle}):null]})}function Ww({item:e,currentVersion:t,onShow:n}){if(!e?.drawing?.shapes?.length)return null;let r=!!(e.drawing.captureVersion&&t&&e.drawing.captureVersion!==t),i=e.drawing.shapes.length;return(0,Y.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted`,"data-sw-message-drawing":r?`previous`:`current`,children:[(0,Y.jsx)(Km,{size:11,className:`mr-1 inline-block align-[-1px]`,"aria-hidden":`true`}),r?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{children:[`Drawn on the previous capture (`,i===1?`one shape`:`${i} shapes`,`).`]}),` `,n?(0,Y.jsx)(`button`,{type:`button`,className:`rounded text-accent underline-offset-2 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-accent`,onClick:n,"data-sw-show-drawing":`true`,children:`View it on Before`}):null]}):(0,Y.jsxs)(`span`,{children:[`Drawn on the page (`,i===1?`one shape`:`${i} shapes`,`), shown over the frame.`]})]})}function Gw({comment:e,page:n,title:i,people:a,touch:o,me:s,can:c,busy:l,actions:u,nav:d,beforeAfter:f,onClose:p=null,editingRef:v=null,denial:y=null,role:b=null,hosted:x=null,onSaveName:w=null,media:E=null}){let[D,O]=(0,J.useState)(!1),[k,A]=(0,J.useState)(!1),j=(0,J.useRef)(null);(0,J.useEffect)(()=>{O(!1),A(!1)},[e.id]),v&&(v.current=D?()=>O(!1):null);let M=e.replies?.length||0;(0,J.useEffect)(()=>{let e=j.current;e&&(e.scrollTop=e.scrollHeight)},[e.id,M]);let N=e.status===`resolved`,P=N&&e.agentStatus!==`done`?null:e.agentStatus,F=o?`icon`:`icon-sm`,ee=fv(e.viewport,null),I=!!u.onFixAgent&&e.status===`open`,L=e.reopenCount>0&&!N||!!P,B=e.github?.issue?Vy(e.github.issue.url):null,V=E?.currentVersion?.(e)||null,H=()=>{let e=j.current?.querySelector(`[data-sw-before-after]`);e?.scrollIntoView?.({block:`nearest`}),e?.querySelector(`[data-sw-compare-handle], [role="tab"]`)?.focus?.()},U=[u.onCopyLink?{id:`link`,label:`Copy link`,icon:og,run:()=>u.onCopyLink(e),hook:`data-sw-copy-link`}:null,c.edit?{id:`edit`,label:`Edit`,icon:Bg,run:()=>O(!0),hook:`data-sw-edit`}:null,u.onAskAgent?{id:`agent`,label:`Ask agent`,icon:S,run:()=>u.onAskAgent(e),hook:`data-sw-ask-agent`}:null,B?{id:`issue`,label:`Open issue #${e.github.issue.number} on GitHub`,icon:nh,href:B,hook:`data-sw-github-open`}:u.onGithubIssue&&c.resolve?{id:`issue`,label:`Create a GitHub issue`,icon:nh,run:()=>u.onGithubIssue(e),hook:`data-sw-github-issue`}:null,u.onHistory&&n?{id:`history`,label:`Page history`,icon:Kg,run:()=>u.onHistory(e),hook:`data-sw-comment-history`}:null,n?.url?{id:`page`,label:`Open the page`,icon:bh,href:n.url,hook:`data-sw-open-page`}:null].filter(Boolean);return(0,Y.jsxs)(`div`,{className:`flex max-h-[inherit] min-h-0 flex-col`,"data-sw-selected-comment":e.id,"data-sw-thread":e.id,children:[(0,Y.jsxs)(`div`,{className:K(`flex shrink-0 items-center gap-0.5 border-b border-line`,o?`px-2 py-1`:`py-1 pr-1 pl-3`),children:[(0,Y.jsx)(`p`,{className:`flex min-w-0 flex-1 items-center gap-1.5 text-xs text-muted`,"data-sw-thread-title":`true`,children:p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{className:`shrink-0 font-semibold text-fg tabular`,children:[`#`,e.id]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-fg/80`,children:i}),ee?(0,Y.jsx)(h,{content:`${e.viewport[0].toUpperCase()}${e.viewport.slice(1)} capture`,children:(0,Y.jsx)(`span`,{className:`inline-flex shrink-0 text-faint`,"aria-label":`${e.viewport} capture`,role:`img`,children:(0,Y.jsx)(ee,{size:12,"aria-hidden":`true`})})}):(0,Y.jsxs)(`span`,{className:`shrink-0 text-faint`,children:[`· `,e.viewport]})]}):d?.total>1?(0,Y.jsxs)(`span`,{className:`tabular`,children:[d.index+1,` of `,d.total]}):null}),d?.total>1?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(z,{size:F,onClick:d.onPrev,label:Rw(`Previous thread`,d.prevNote),tooltip:Rw(`Previous thread (Left arrow)`,d.prevNote),"data-sw-thread-prev":`true`,"data-sw-thread-note":d.prevNote||void 0,children:(0,Y.jsx)(eh,{size:16,"aria-hidden":`true`})}),(0,Y.jsx)(z,{size:F,onClick:d.onNext,label:Rw(`Next thread`,d.nextNote),tooltip:Rw(`Next thread (Right arrow)`,d.nextNote),"data-sw-thread-next":`true`,"data-sw-thread-note":d.nextNote||void 0,children:(0,Y.jsx)(R,{size:16,"aria-hidden":`true`})})]}):null,c.resolve?(0,Y.jsx)(z,{size:F,variant:N?`default`:`ghost`,className:K(`rounded-full`,N&&`bg-ok text-ok-fg hover:bg-ok/90`),disabled:l,"aria-pressed":N,onClick:()=>u.onStatus(e,N?`reopen`:`resolve`),label:N?`Reopen the thread`:`Resolve the thread`,tooltip:N?`Resolved: reopen`:`Resolve`,...N?{"data-sw-reopen":e.id}:{"data-sw-resolve":e.id},children:(0,Y.jsx)(m,{size:16,strokeWidth:2.5,"aria-hidden":`true`})}):N?(0,Y.jsxs)(`span`,{className:`mx-1 inline-flex items-center gap-1 rounded-full bg-ok/15 px-2 text-xs leading-6 font-medium text-fg`,children:[(0,Y.jsx)(m,{size:12,"aria-hidden":`true`}),` Resolved`]}):null,U.length||c.delete?(0,Y.jsxs)(Ce,{children:[(0,Y.jsx)(h,{content:`More`,children:(0,Y.jsx)(C,{asChild:!0,children:(0,Y.jsx)(r,{variant:`ghost`,size:F,"aria-label":`More for comment ${e.id}`,"data-sw-thread-menu":e.id,children:(0,Y.jsx)(vh,{size:16,"aria-hidden":`true`})})})}),(0,Y.jsxs)(t,{align:`end`,children:[U.map(t=>t.href?(0,Y.jsx)(T,{asChild:!0,[t.hook]:e.id,children:(0,Y.jsxs)(`a`,{href:t.href,target:`_blank`,rel:`noreferrer noopener`,children:[(0,Y.jsx)(t.icon,{size:14,"aria-hidden":`true`}),` `,t.label]})},t.id):(0,Y.jsxs)(T,{onSelect:t.run,[t.hook]:e.id,children:[(0,Y.jsx)(t.icon,{size:14,"aria-hidden":`true`}),` `,t.label]},t.id)),c.delete?(0,Y.jsxs)(Y.Fragment,{children:[U.length?(0,Y.jsx)(_,{}):null,(0,Y.jsxs)(T,{tone:`danger`,onSelect:()=>A(!0),"data-sw-delete":e.id,children:[(0,Y.jsx)(E_,{size:14,"aria-hidden":`true`}),` Delete thread`]})]}):null]})]}):null,p?(0,Y.jsx)(z,{size:F,onClick:p,label:`Close the thread`,tooltip:`Close (Esc)`,"data-sw-thread-close":`true`,children:(0,Y.jsx)(g,{size:16,"aria-hidden":`true`})}):null]}),I||L?(0,Y.jsxs)(`div`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-1.5 border-b border-line px-3 py-1.5`,"data-sw-thread-agent":`true`,children:[(0,Y.jsx)(qy,{comment:e}),I&&[`queued`,`working`].includes(P)?null:(0,Y.jsx)(Ky,{status:P,at:e.agentStatusAt,branch:e.agentBranch||null}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1`}),I?(0,Y.jsx)(Lw,{comment:e,onFix:u.onFixAgent,onOpenChat:u.onAskAgent,busy:l,touch:o}):null]}):null,(0,Y.jsxs)(`div`,{ref:j,className:`min-h-0 flex-1 overflow-y-auto px-3`,children:[e.orphanReason?(0,Y.jsx)(`p`,{className:`pt-2 text-xs text-muted`,children:e.orphanReason}):null,e.imported&&e.agentStatus?(0,Y.jsx)(`p`,{className:`pt-2 text-xs text-muted`,children:`Imported agent status (history)`}):null,u.onSendToAgent&&e.status===`open`?(0,Y.jsx)(`div`,{className:`py-2`,children:(0,Y.jsx)(r,{size:o?`touch`:`sm`,disabled:l||e.dispatchable||e.needsRunApproval&&![`admin`,`owner`].includes(b),onClick:()=>u.onSendToAgent(e),children:e.dispatchable?`Sent to agent`:e.needsRunApproval?[`admin`,`owner`].includes(b)?`Approve agent run`:`Awaiting run approval`:`Send to agent`})}):null,(0,Y.jsxs)(`ol`,{className:`divide-y divide-line/60`,"aria-label":`Comment ${e.id} and replies`,children:[(0,Y.jsxs)(Vw,{author:Qy(e),at:e.createdAt,editedAt:e.editedAt,reactions:e.reactions,canReact:c.react,me:s,onReact:t=>u.onReact(e,t,null),touch:o,"data-sw-message":`comment`,children:[D?(0,Y.jsx)(Hw,{comment:e,busy:l,onSave:u.onEdit,onCancel:()=>O(!1),touch:o,people:a}):(0,Y.jsx)(ab,{text:e.body,plain:!!e.authorGuest,className:`block text-ui break-words whitespace-pre-wrap text-fg`}),(0,Y.jsx)(Nx,{boardId:E?.boardId,images:e.images,touch:o,label:`Comment ${e.id}`}),(0,Y.jsx)(Ww,{item:e,currentVersion:V,onShow:H}),e.anchor?(0,Y.jsx)(h,{content:(0,Y.jsx)(`span`,{className:`font-mono text-[11px] break-all`,children:e.anchor.selector}),children:(0,Y.jsxs)(`p`,{className:`mt-1.5 inline-flex max-w-full min-w-0 items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[11px] text-muted`,"data-sw-thread-anchor":`true`,tabIndex:0,children:[(0,Y.jsx)(mh,{size:11,className:`shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Pinned to`}),(0,Y.jsx)(`span`,{className:`truncate text-fg`,children:nb(e.anchor)})]})}):null,n?.note?(0,Y.jsxs)(`p`,{className:`mt-1 flex items-start gap-1 text-xs text-faint`,"data-sw-page-note":`true`,children:[(0,Y.jsx)(Xh,{size:11,className:`mt-0.5 shrink-0`,"aria-hidden":`true`}),` `,n.note]}):null,e.resolution?(0,Y.jsxs)(`p`,{className:`mt-1.5 rounded bg-ok/10 px-2 py-1 text-xs text-fg`,children:[`Fix: `,e.resolution]}):null,(0,Y.jsx)(Hy,{value:e.fixRef,touch:o}),(0,Y.jsx)(Wy,{github:e.github,touch:o}),f?(0,Y.jsx)($C,{comment:e,pair:f.pairFor(e),native:f.nativeFor(e),urlFor:f.urlFor,onImageError:f.onImageError,touch:o}):null]}),(e.replies||[]).length?(0,Y.jsx)(`li`,{"data-sw-replies":`true`,children:(0,Y.jsx)(`ol`,{className:`divide-y divide-line/60`,"aria-label":`Replies`,children:e.replies.map(t=>(0,Y.jsxs)(Vw,{author:$y(t),at:t.createdAt,reactions:t.reactions,canReact:c.react,me:s,onReact:n=>u.onReact(e,n,t.id),touch:o,"data-sw-reply":t.id,children:[(0,Y.jsx)(ab,{text:t.body,plain:!!t.guest,className:`block text-ui break-words whitespace-pre-wrap text-fg`}),(0,Y.jsx)(Nx,{boardId:E?.boardId,images:t.images,touch:o,label:`Reply ${t.id}`}),(0,Y.jsx)(Ww,{item:t,currentVersion:V,onShow:H})]},t.id))})}):null]})]}),k?(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-line bg-bad/10 px-3 py-2 text-xs text-fg`,role:`alert`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Delete this thread and its replies for good?`}),(0,Y.jsx)(r,{size:o?`touch`:`xs`,variant:`ghost`,onClick:()=>A(!1),disabled:l,children:`Cancel`}),(0,Y.jsxs)(r,{size:o?`touch`:`xs`,variant:`secondary`,className:`text-bad`,onClick:()=>u.onDelete(e),disabled:l,"data-sw-delete-confirm":e.id,children:[(0,Y.jsx)(E_,{size:13,"aria-hidden":`true`}),` Delete`]})]}):null,c.reply?(0,Y.jsx)(Uw,{comment:e,busy:l,onReply:u.onReply,touch:o,people:a,askName:x===!1,onSaveName:w,media:E},e.id):(0,Y.jsx)(`p`,{className:`shrink-0 border-t border-line px-3 py-2 text-xs text-muted`,"data-sw-reply-denied":b||`true`,children:y||zw(b)})]})}var Kw=`input, textarea, select, [contenteditable="true"]`,qw={top:10,right:10,bottom:60,left:10};function Jw(e,t){let n=Uu(),r=(0,J.useRef)(null),i=(0,J.useRef)({selector:e,point:t});return i.current={selector:e,point:t},r.current||={getBoundingClientRect(){let{domNode:e,transform:t}=n.getState(),{selector:r,point:a}=i.current,o=r?e?.querySelector(r):null;if(o)return o.getBoundingClientRect();let s=e?.getBoundingClientRect();if(!s||!a)return new DOMRect(-1e4,-1e4,0,0);let[c,l,u]=t;return new DOMRect(s.left+a.x*u+c,s.top+a.y*u+l,0,0)}},r}function Yw(e,t,n){let r=Uu(),[i,a]=(0,J.useState)(`right`);return(0,J.useEffect)(()=>{if(!e)return;let i=()=>{let e=r.getState().domNode?.getBoundingClientRect(),i=t.current.getBoundingClientRect();if(!e)return;let o=(n.current?.offsetWidth||360)+20;a(e.right-i.right>=o?`right`:i.left-e.left>=o?`left`:`bottom`)};i();let o=r.subscribe(i),s=new ResizeObserver(i),c=r.getState().domNode;return c&&s.observe(c),()=>{o(),s.disconnect()}},[e,r,t,n]),i}function Xw({open:e,onClose:t,selector:n,point:r,children:i,label:a,onKeyDown:o,onEscape:s,focusContent:c,stowed:l,className:u,...d}){let f=Uu(),p=Jw(n,r),m=(0,J.useRef)(null),h=Yw(e,p,m);return(0,Y.jsxs)(Ye,{open:e,onOpenChange:e=>e?null:t(),children:[(0,Y.jsx)(ce,{virtualRef:p}),(0,Y.jsx)(qe,{ref:m,side:h,align:`start`,sideOffset:10,alignOffset:-6,collisionBoundary:f.getState().domNode,collisionPadding:qw,hideWhenDetached:!0,updatePositionStrategy:`always`,"aria-label":a,className:K(`z-30`,u,l&&`invisible`),"data-sw-stowed":l?`true`:void 0,onOpenAutoFocus:e=>{c&&(e.preventDefault(),m.current?.focus({preventScroll:!0}))},onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>{s?.(e)===!1&&e.preventDefault()},onKeyDown:e=>{m.current?.contains(e.target)&&!e.target?.closest?.(Kw)&&o?.(e)},tabIndex:-1,...d,children:i})]})}function Zw(e){(document.querySelector(`[data-sw-pin="${CSS.escape(e)}"]`)||[...document.querySelectorAll(`[data-sw-pin-cluster]`)].find(t=>t.getAttribute(`data-sw-pin-cluster`).split(`,`).includes(e)))?.focus({preventScroll:!0})}function Qw(e,t,n){e.altKey||e.ctrlKey||e.metaKey||(e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),t?.()):(e.key===`ArrowRight`||e.key===`ArrowDown`)&&(e.preventDefault(),n?.()))}function $w({comment:e,point:t,onClose:n,onPrev:r,onNext:i,editingRef:a,stowed:o,children:s}){let c=(0,J.useRef)({onPrev:r,onNext:i});return c.current={onPrev:r,onNext:i},(0,J.useEffect)(()=>{let e=e=>{e.defaultPrevented||document.activeElement!==document.body||document.querySelector(`[role="menu"], [role="listbox"], [role="dialog"]:not([data-sw-thread-popover])`)||Qw(e,c.current.onPrev,c.current.onNext)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,J.useEffect)(()=>{let t=window.setTimeout(()=>{document.activeElement===document.body&&document.querySelector(`[data-sw-thread-popover="${e.id}"]`)?.focus({preventScroll:!0})},450);return()=>window.clearTimeout(t)},[e.id]),(0,Y.jsx)(Xw,{open:!0,onClose:n,selector:`[data-sw-pin="${e.id}"]`,point:t,label:`Comment ${e.id}`,focusContent:!0,stowed:o,className:`flex max-h-[min(560px,var(--radix-popover-content-available-height))] w-[360px] flex-col overflow-hidden p-0 outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onEscape:()=>{if(a?.current&&document.activeElement?.closest?.(`[data-sw-edit-form]`))return a.current(),!1;let t=String(e.id);return window.setTimeout(()=>Zw(t),0),!0},onKeyDown:e=>Qw(e,r,i),"data-sw-thread-popover":e.id,children:s})}function eT({point:e,onClose:t,stowed:n,children:r}){return(0,Y.jsx)(Xw,{open:!0,onClose:t,selector:`[data-sw-draft-pin]`,point:e,label:`New comment`,stowed:n,className:`w-[340px] p-3`,"data-sw-composer-popover":`true`,children:r})}var tT=600,nT=e=>`shapewall.seen:${typeof window>`u`?``:window.location.pathname}:${e}`;function rT(e){try{let t=JSON.parse(window.localStorage.getItem(nT(e))||`{}`);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}function iT(e,t){try{let n=Object.entries(t).sort((e,t)=>String(t[1]).localeCompare(String(e[1]))).slice(0,tT);window.localStorage.setItem(nT(e),JSON.stringify(Object.fromEntries(n)))}catch{}}function aT(e){let t={at:e.createdAt||``,author:e.author,handle:e.authorHandle||null};for(let n of e.replies||[])String(n.createdAt)>String(t.at)&&(t={at:n.createdAt,author:n.author,handle:n.handle||null});return t}function oT(e,t){return t?t.handle&&e.handle?e.handle===t.handle:!!t.name&&String(e.author||``).toLowerCase()===String(t.name).toLowerCase():!1}function sT(e,t,n){let r=aT(e);return!r.at||oT(r,n)?!1:!t[e.id]||String(t[e.id])<String(r.at)}function cT(e){let[t,n]=(0,J.useState)(()=>rT(e));(0,J.useEffect)(()=>{n(rT(e));let t=t=>{t.key===nT(e)&&n(rT(e))};return window.addEventListener(`storage`,t),()=>window.removeEventListener(`storage`,t)},[e]);let r=(0,J.useCallback)(t=>{n(n=>{let r=!1,i={...n};for(let e of t){let t=aT(e).at;t&&String(i[e.id]||``)<String(t)&&(i[e.id]=t,r=!0)}return r?(iT(e,i),i):n})},[e]);return{seen:t,markSeen:(0,J.useCallback)(e=>r([e]),[r]),markAllSeen:r}}var lT=[`viewer`,`member`,`admin`,`owner`],uT=(e,t)=>lT.indexOf(e)>=lT.indexOf(t)&&lT.includes(e),dT=({isAuthor:e})=>!!e,fT=({role:e,isAuthor:t})=>uT(e,`member`)&&(!!t||uT(e,`admin`)),pT=`https://shapewall.com/contact`,mT={version:`0.3.0`,revision:`c34ececf96613a351c6811f5b6ee7e932d65e65b`},hT=e=>`v${e?.version||mT.version}${e?.revision?` · ${e.revision.slice(0,7)}`:``}`,gT=`modulepreload`,_T=function(e,t){return new URL(e,t).href},vT={},yT=function(e){return e.pathname.endsWith(`.css`)},bT=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},xT=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=_T(t,n);let r=s(t),i=yT(r);return bT(vT,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:gT,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ST=(0,J.lazy)(()=>xT(()=>import(`./app-update-dialog-rhaw0MRk.js`),__vite__mapDeps([0,1,2]),import.meta.url)),CT=`shapewall:open-about`;function wT(e=null){window.dispatchEvent(new CustomEvent(CT,{detail:{opener:e}}))}function TT({transport:e,className:t,placement:n=`menu`,ref:i}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=e=>{u.current=e||null,c(!0),o(!0)};(0,J.useImperativeHandle)(i,()=>({open:()=>d(document.activeElement)}),[]),(0,J.useEffect)(()=>{let e=e=>d(e.detail?.opener||null);return window.addEventListener(CT,e),()=>window.removeEventListener(CT,e)},[]);let f=()=>o(!1),p=e=>{e.preventDefault(),[u.current,l.current,document.querySelector(`[data-sw-profile-menu]`)].find(e=>e?.isConnected&&e!==document.body)?.focus()},m=`About Shapewall and updates, ${hT(mT)}, created by Dan Baruch`;return(0,Y.jsxs)(Y.Fragment,{children:[n===`footer`?(0,Y.jsx)(`footer`,{className:K(`flex shrink-0 justify-center border-t border-line bg-surface text-muted`,t),style:{paddingBottom:`env(safe-area-inset-bottom, 0px)`},children:(0,Y.jsxs)(r,{variant:`ghost`,size:`touch`,className:`gap-2 rounded-none px-3 text-[10px] font-normal lg:h-6`,onClick:()=>d(l.current),"aria-label":m,"data-sw-app-about":`footer`,ref:l,children:[(0,Y.jsx)(`span`,{children:`Created by Dan Baruch`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Y.jsx)(`span`,{"data-sw-app-version":!0,children:hT(mT)})]})}):n===`link`?(0,Y.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Y.jsx)(r,{asChild:!0,variant:`ghost`,size:`touch`,className:`px-2 text-caption font-normal text-faint hover:text-fg lg:h-8`,"data-sw-app-contact":`link`,children:(0,Y.jsx)(`a`,{href:pT,target:`_blank`,rel:`noopener noreferrer`,children:`Contact`})}),(0,Y.jsxs)(r,{variant:`ghost`,size:`touch`,className:K(`gap-1.5 px-2 text-caption font-normal text-faint hover:text-fg lg:h-8`,t),onClick:()=>d(l.current),"aria-label":m,"data-sw-app-about":`link`,ref:l,children:[(0,Y.jsx)(`span`,{children:`About Shapewall`}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,"data-sw-app-version":!0,children:[`v`,mT.version]})]})]}):null,s?(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(`span`,{role:`status`,className:`sr-only`,children:`Opening About & Updates…`}),children:(0,Y.jsx)(ST,{open:a,onClose:f,onCloseAutoFocus:p,transport:e})}):null]})}function ET({demo:e,className:n,children:r,align:i=`start`}){return e.viewAs?(0,Y.jsxs)(Ce,{children:[(0,Y.jsx)(C,{asChild:!0,children:r}),(0,Y.jsxs)(t,{align:i,className:K(`w-64`,n),children:[(0,Y.jsx)(D,{children:`View as (demo)`}),(0,Y.jsx)(A,{value:e.viewAs.value,onValueChange:e.viewAs.onChange,children:e.viewAs.options.map(e=>(0,Y.jsxs)(d,{value:e.id,"data-sw-view-as":e.id,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint?(0,Y.jsx)(`span`,{className:`truncate text-xs text-faint`,children:e.hint}):null]},e.id))})]})]}):r}var DT=()=>(0,Y.jsxs)(`span`,{className:`inline-flex h-5 shrink-0 items-center gap-1.5 rounded-full bg-accent/12 px-2 text-caption font-semibold text-accent`,children:[(0,Y.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent`,"aria-hidden":`true`}),`Demo`]});function OT({variant:e=`strip`,className:t}){let n=j();return n?e===`chip`?(0,Y.jsxs)(`div`,{className:K(`flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-surface-2/60 p-0.5`,t),role:`region`,"aria-label":`Demo`,"data-sw-demo-banner":n.role,children:[(0,Y.jsx)(ET,{demo:n,align:`end`,children:(0,Y.jsxs)(r,{variant:`ghost`,size:`touch`,className:`h-11 gap-1.5 rounded-full px-2 text-ui text-fg lg:h-8`,"aria-label":`Demo, viewing as `+n.roleLabel+`. Change who you view as`,"data-sw-demo-view-as":!0,children:[(0,Y.jsx)(DT,{}),(0,Y.jsx)(`span`,{className:`hidden max-w-28 truncate font-medium sm:inline`,children:n.roleLabel}),(0,Y.jsx)(H,{size:13,className:`text-faint`,"aria-hidden":`true`})]})}),(0,Y.jsx)(z,{label:`Reset the demo`,size:`icon`,className:`rounded-full text-muted max-lg:hidden lg:h-8 lg:w-8`,onClick:n.reset,"data-sw-demo-reset":!0,children:(0,Y.jsx)(Jg,{size:14,"aria-hidden":`true`})}),(0,Y.jsx)(kT,{})]}):(0,Y.jsxs)(`div`,{className:K(`flex shrink-0 items-center gap-2 border-b border-line bg-surface px-2 text-ui text-muted sm:px-3 lg:h-9`,t),role:`region`,"aria-label":`Demo`,"data-sw-demo-banner":n.role,children:[(0,Y.jsx)(DT,{}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`hidden shrink-0 sm:inline`,children:`Viewing as`}),(0,Y.jsx)(ET,{demo:n,children:(0,Y.jsxs)(r,{variant:`ghost`,size:`touch`,className:`min-w-0 gap-1 px-1.5 text-ui text-fg lg:h-7`,"aria-label":`Viewing as `+n.roleLabel+`. Change who you view as`,"data-sw-demo-view-as":!0,children:[(0,Y.jsx)(`span`,{className:`truncate font-semibold`,children:n.roleLabel}),(0,Y.jsxs)(`span`,{className:`hidden truncate font-normal text-muted sm:inline`,children:[`(`,n.personaName,`)`]}),(0,Y.jsx)(H,{size:13,className:`shrink-0 text-faint`,"aria-hidden":`true`})]})}),(0,Y.jsx)(`span`,{className:`hidden truncate text-faint md:inline`,children:`· Changes stay in this browser`})]}),(0,Y.jsxs)(r,{variant:`ghost`,size:`touch`,className:`shrink-0 gap-1.5 px-2 text-ui text-muted lg:h-7`,onClick:n.reset,"data-sw-demo-reset":!0,children:[(0,Y.jsx)(Jg,{size:13,"aria-hidden":`true`}),` Reset`]}),(0,Y.jsx)(kT,{})]}):null}function kT(){let e=j();return e?(0,Y.jsx)(M,{open:!!e.resetAsked,onClose:e.cancelReset,title:`Reset the demo?`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r,{size:`touch`,variant:`ghost`,onClick:e.cancelReset,className:`lg:h-10`,"data-sw-demo-reset-cancel":!0,children:`Cancel`}),(0,Y.jsxs)(r,{size:`touch`,className:`border-bad/50 bg-bad text-bad-fg hover:bg-bad/90 lg:h-10`,onClick:e.resetNow,"data-sw-demo-reset-confirm":!0,children:[(0,Y.jsx)(Jg,{size:14,"aria-hidden":`true`}),` Reset`]})]}),children:(0,Y.jsx)(`p`,{className:`px-5 py-4 text-sm text-muted`,children:`Your comments, invites and changes in this browser go back to the start.`})}):null}var AT={unknown:{title:`This share link is not valid`,text:`Check that you have the whole link, or ask whoever shared it for a new one.`},revoked:{title:`This share link was revoked`,text:`Whoever shared it turned it off. Ask them for a new link.`},expired:{title:`This share link has expired`,text:`Share links work for a set time. Ask whoever shared it for a new one.`},off:{title:`This share link is turned off`,text:`The workspace no longer allows share links, or the person who made it can no longer share. Ask them for a new link.`}};function jT({problem:e,onLeave:t}){let n=AT[e?.status]||AT.unknown,i=e?.at?new Date(e.at):null;return(0,Y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Y.jsx)(OT,{}),(0,Y.jsx)(`main`,{className:`flex flex-1 items-center justify-center p-4`,children:(0,Y.jsxs)(`div`,{className:`w-full max-w-md rounded-xl border border-line bg-surface p-6 text-center shadow-card sm:p-8`,role:`alert`,"data-sw-share-problem":e?.status||`unknown`,children:[(0,Y.jsx)(`span`,{className:`inline-flex h-11 w-11 items-center justify-center rounded-xl bg-bad/10 text-bad`,children:(0,Y.jsx)(ig,{size:20,"aria-hidden":`true`})}),(0,Y.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:n.title}),(0,Y.jsxs)(`p`,{className:`mt-2 text-sm text-muted`,children:[n.text,i&&Number.isFinite(i.getTime())?(0,Y.jsxs)(Y.Fragment,{children:[` `,e.status===`revoked`?`Revoked`:`Expired`,` `,i.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),`.`]}):null]}),(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-muted`,children:`In the demo, share links are made on a project's page in the console.`}),(0,Y.jsx)(r,{size:`touch`,variant:`default`,className:`mt-5 lg:h-10`,onClick:t,"data-sw-share-problem-leave":!0,children:`Open the demo board`})]})})]})}async function MT(e,t,n){let r;try{r=await fetch(t,{method:e,credentials:`same-origin`,headers:{...n===void 0?{Accept:`application/json`}:{Accept:`application/json`,"Content-Type":`application/json`},...typeof document<`u`&&document.querySelector(`meta[name="shapewall-local-accounts"]`)&&t.startsWith(`/auth/`)?Se():{}},body:n===void 0?void 0:JSON.stringify(n),cache:`no-store`})}catch{throw new Je(0,`offline`,`Could not reach the server. Check your connection and try again.`)}let i=null;try{i=await r.json()}catch{i=null}if(!r.ok){let e=Number(r.headers.get(`Retry-After`)),t=i?.error?.message||`Request failed (${r.status})`;throw new Je(r.status,i?.error?.code||`error`,r.status===429&&e>0?PT(t,e):t,{retryAfter:r.status===429&&e>0?e:null})}return i}function NT(e){return e>=5400?`${Math.ceil(e/3600)} hours`:e>=90?`${Math.ceil(e/60)} minutes`:e>60?`2 minutes`:e===1?`1 second`:`${e} seconds`}var PT=(e,t)=>`${e.replace(/\s*Wait (a while|a moment) and try again\.?\s*$/i,``)} Try again in ${NT(t)}.`,FT={get:e=>MT(`GET`,e),post:(e,t={})=>MT(`POST`,e,t),patch:(e,t={})=>MT(`PATCH`,e,t),put:(e,t={})=>MT(`PUT`,e,t),delete:(e,t)=>MT(`DELETE`,e,t)},IT=e=>{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t+`===`.slice((t.length+3)%4));return Uint8Array.from(n,e=>e.charCodeAt(0)).buffer},LT=e=>btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``);async function RT(e,{mediation:t,signal:n}={}){let r={...e,challenge:IT(e.challenge),allowCredentials:(e.allowCredentials||[]).map(e=>({...e,id:IT(e.id)}))},i=await navigator.credentials.get({publicKey:r,...t?{mediation:t}:{},...n?{signal:n}:{}}),a=i.response;return{id:i.id,rawId:LT(i.rawId),type:i.type,authenticatorAttachment:i.authenticatorAttachment||void 0,clientExtensionResults:i.getClientExtensionResults(),response:{clientDataJSON:LT(a.clientDataJSON),authenticatorData:LT(a.authenticatorData),signature:LT(a.signature),userHandle:a.userHandle?LT(a.userHandle):void 0}}}async function zT(){let{options:e}=await FT.post(`/auth/reauth/options`,{}),t=await RT(e);await FT.post(`/auth/reauth/verify`,{response:t})}function BT({boardId:e}){let[t,n]=(0,J.useState)([]),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),u=`/api/boards/${encodeURIComponent(e)}/approvals`;(0,J.useEffect)(()=>{let t=!0,r=()=>Ke.get(`/api/boards/${encodeURIComponent(e)}/agent-budget`).then(e=>{t&&a(e)}).catch(()=>{}),i=()=>Ke.get(u).then(e=>{t&&n(e.approvals)}).catch(()=>{});i(),r();let o=()=>{document.visibilityState===`visible`&&(i(),r())},s=setInterval(o,3e3);return document.addEventListener(`visibilitychange`,o),()=>{t=!1,clearInterval(s),document.removeEventListener(`visibilitychange`,o)}},[u,e]);let d=async(e,t)=>{l(!0),s(null);try{await zT(),await Ke.post(`${u}/${e.id}`,{state:t,hash:e.command_hash}),n(t=>t.filter(t=>t.id!==e.id))}catch(e){s(e.message)}finally{l(!1)}};return!t.length&&!o&&!i?.exhausted?null:(0,Y.jsxs)(`section`,{"aria-label":`Agent command approvals`,className:`max-h-64 shrink-0 overflow-auto border-b border-line bg-surface p-3 text-sm`,children:[i?.exhausted?(0,Y.jsxs)(`p`,{role:`status`,className:`pb-2`,children:[`The agent hit today’s limit: `,i.claims,`/`,i.dailyLimit,` runs, `,i.open,`/`,i.openLimit,` in progress. Change limits in Agent policy in the console.`]}):null,t.map(e=>(0,Y.jsxs)(`article`,{className:`space-y-2 pb-3`,children:[(0,Y.jsxs)(`p`,{className:`font-semibold`,children:[`Agent asks to run a command for comment #`,e.comment_number]}),(0,Y.jsx)(`pre`,{className:`overflow-auto whitespace-pre-wrap break-words rounded bg-surface-2 p-2`,children:e.command.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u200b-\u200f\u202a-\u202e\u2066-\u2069]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`)}),(0,Y.jsx)(`p`,{children:e.reason}),(0,Y.jsx)(r,{size:`touch`,variant:`default`,className:`lg:h-8`,disabled:c,onClick:()=>d(e,`approved`),children:`Approve once with passkey`}),` `,(0,Y.jsx)(r,{size:`touch`,variant:`danger`,className:`lg:h-8`,disabled:c,onClick:()=>d(e,`denied`),children:`Deny`})]},e.id)),o?(0,Y.jsx)(`p`,{role:`alert`,className:`text-bad`,children:o}):null]})}var VT={share:{title:`This link was revoked`,body:`Or it expired. The board stops updating and you cannot comment. Ask whoever shared it for a new link.`,href:null},signed_out:{title:`You were signed out`,body:`Sign in again to keep working on this board.`,href:`signin`},removed:{title:`You don't have access to this board any more`,body:`You may have been removed from the workspace. Ask an admin to invite you again.`,href:`home`}};function HT(){let[e,t]=(0,J.useState)(null);if((0,J.useEffect)(()=>{let e=e=>t(t=>t||e.detail?.kind||null);return window.addEventListener(le,e),()=>window.removeEventListener(le,e)},[]),!e)return null;let n=VT[e],r=encodeURIComponent(window.location.pathname+window.location.search);return(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-bad/30 bg-bad/10 px-4 py-2 text-sm text-fg`,role:`alert`,"data-sw-access-lost":e,children:[e===`share`?(0,Y.jsx)(ig,{size:15,className:`shrink-0 text-bad`,"aria-hidden":`true`}):(0,Y.jsx)(mg,{size:15,className:`shrink-0 text-bad`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`font-medium`,children:n.title}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 text-muted`,children:n.body}),n.href===`signin`?(0,Y.jsx)(`a`,{href:`/signin?next=${r}`,className:`inline-flex h-11 items-center font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,children:`Sign in`}):n.href===`home`?(0,Y.jsx)(`a`,{href:`/`,className:`inline-flex h-11 items-center font-medium text-accent underline-offset-2 hover:underline lg:h-auto`,children:`Your workspaces`}):null]})}var UT=`You're a viewer. Ask an admin for member access to comment.`;function WT({compact:e=!1}){return(0,Y.jsx)(h,{content:UT,side:`bottom`,children:(0,Y.jsxs)(`span`,{role:`note`,tabIndex:0,"aria-label":UT,className:K(`inline-flex shrink-0 items-center gap-1.5 rounded-full border border-line bg-surface-2 text-xs font-medium whitespace-nowrap text-muted outline-none focus-visible:outline-2 focus-visible:outline-accent`,e?`h-11 px-2.5`:`h-8 px-2.5`),"data-sw-viewer-note":!0,children:[(0,Y.jsx)(Sh,{size:14,"aria-hidden":`true`}),` Viewer`]})})}function GT({project:e}){return(0,Y.jsx)(h,{content:`Back to ${e.name}`,side:`bottom`,align:`start`,children:(0,Y.jsx)(`a`,{href:e.url,className:`block max-w-full min-w-0 truncate rounded-sm px-2.5 text-[11px] leading-3.5 font-medium text-muted outline-none hover:text-fg focus-visible:outline-2 focus-visible:outline-accent`,"data-sw-project-crumb":!0,children:e.name})})}var KT={includes:e=>typeof e==`string`&&(e===`all`||/^[a-z][a-z0-9-]{0,31}$/.test(e))};function qT({enabled:e,boardId:t,canvasRef:n,flow:r,selection:i,mode:a,onMode:o,onInvalidate:s}){let[c,l]=(0,J.useState)([]),[u,d]=(0,J.useState)(0),[f,p]=(0,J.useState)(`offline`),[m,h]=(0,J.useState)(null),g=(0,J.useRef)({cursor:null});g.current={...g.current,selection:i,mode:a,onMode:o,onInvalidate:s};let _=(0,J.useRef)(null);return em({onChange:e?()=>_.current?.():void 0}),(0,J.useEffect)(()=>{_.current?.()},[i,a]),(0,J.useEffect)(()=>{if(!e){l([]),d(0),h(null);return}let i=!1,a;return xT(async()=>{let{connectPresence:e}=await import(`./runtime-Bft6x_6E.js`);return{connectPresence:e}},[],import.meta.url).then(({connectPresence:e})=>{i||(a=e({boardId:t,canvasRef:n,flow:r,latest:g,sendRef:_,setPeers:l,setCount:d,setFollowing:h,setStatus:p}))}).catch(()=>{i||p(`offline`)}),()=>{i=!0,a?.()}},[e,t,n,r]),(0,J.useEffect)(()=>{if(m===null)return;let e=c.find(e=>e.id===m);if(!e){h(null);return}let t=e.viewport;if(!t||![t.x,t.y,t.zoom].every(Number.isFinite)||!KT.includes(e.mode))return;g.current.mode!==e.mode&&g.current.onMode?.(e.mode);let n=window.requestAnimationFrame(()=>{let e=r.getViewport();(Math.abs(e.x-t.x)>.01||Math.abs(e.y-t.y)>.01||Math.abs(e.zoom-t.zoom)>.001)&&r.setViewport(t,{duration:0})});return()=>window.cancelAnimationFrame(n)},[m,c,r]),{peers:c,count:u,status:f,following:m,follow:h,stopFollowing:()=>h(null)}}function JT({touch:e,...t}){let n=qT(t);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(QT,{presence:n}),(0,Y.jsx)(ZT,{presence:n,touch:e})]})}var YT=e=>`${e.id}|${e.name}|${e.color}|${+!!e.viewport}`;function XT(e,t){let n=e.presence,r=t.presence;return e.touch===t.touch&&n.status===r.status&&n.count===r.count&&n.following===r.following&&n.peers.length===r.peers.length&&n.peers.every((e,t)=>YT(e)===YT(r.peers[t]))}var ZT=(0,J.memo)(function({presence:e,touch:t}){if(e.status!==`online`)return null;let n=e.peers.find(t=>t.id===e.following);return(0,Y.jsxs)(`div`,{className:`absolute top-14 right-2 z-30 flex max-w-[calc(100%-1rem)] flex-wrap items-center justify-end gap-1 rounded-xl border border-line bg-surface/95 p-1 shadow-pop`,"aria-label":`Who is viewing`,"data-sw-presence":`true`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 text-xs text-muted`,"data-sw-presence-count":e.count,children:[(0,Y.jsx)(P_,{size:13,"aria-hidden":`true`}),e.count,` viewing`]}),e.peers.slice(0,5).map(n=>(0,Y.jsx)(h,{content:`${n.name}${n.viewport?`: follow their view`:``}`,children:(0,Y.jsx)(r,{size:t?`icon`:`icon-sm`,variant:e.following===n.id?`default`:`ghost`,"aria-label":`Follow ${n.name}`,"aria-pressed":e.following===n.id,disabled:!n.viewport,"data-sw-presence-peer":n.id,onClick:()=>e.follow(e.following===n.id?null:n.id),children:(0,Y.jsx)(se,{person:!0,name:n.name,color:n.color,size:`sm`})})},n.id)),e.peers.length>5?(0,Y.jsxs)(`span`,{className:`px-1 text-xs text-muted`,children:[`+`,e.peers.length-5]}):null,n?(0,Y.jsxs)(r,{size:t?`touch`:`xs`,variant:`secondary`,onClick:e.stopFollowing,"data-sw-stop-follow":`true`,children:[`Stop following `,n.name]}):null]})},XT);function QT({presence:e}){let t=e.peers.filter(e=>e.cursor&&Number.isFinite(e.cursor.x)&&Number.isFinite(e.cursor.y));return(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-20 overflow-hidden`,"aria-hidden":`true`,"data-sw-presence-cursors":`true`,children:t.length?(0,Y.jsx)($T,{peers:t}):null})}function $T({peers:e}){let{x:t,y:n,zoom:r}=Qp();return e.map(e=>(0,Y.jsxs)(`div`,{className:`absolute top-0 left-0`,style:{transform:`translate(${e.cursor.x*r+t}px, ${e.cursor.y*r+n}px)`,color:e.color},"data-sw-presence-cursor":e.id,"data-sw-cursor-x":e.cursor.x,"data-sw-cursor-y":e.cursor.y,children:[(0,Y.jsx)(Pg,{size:18,fill:`currentColor`,stroke:`white`,strokeWidth:1.5}),(0,Y.jsx)(`span`,{className:`ml-3 block max-w-36 truncate rounded px-1.5 py-0.5 text-[10px] text-white shadow-sm`,style:{background:e.color},children:e.name})]},e.id))}var eE=`shapewall.appearance`,tE=[{id:`light`,label:`Light`},{id:`dark`,label:`Dark`},{id:`system`,label:`System`}],nE=[{id:`default`,label:`Default`},{id:`ocean`,label:`Ocean`},{id:`forest`,label:`Forest`},{id:`contrast`,label:`High contrast`}],rE={mode:`system`,theme:`default`};function iE(e){return{mode:tE.some(t=>t.id===e?.mode)?e.mode:rE.mode,theme:nE.some(t=>t.id===e?.theme)?e.theme:rE.theme}}var aE=(e,t)=>e===`system`?t?`dark`:`light`:e,oE=typeof window<`u`,sE=()=>oE&&window.matchMedia?window.matchMedia(`(prefers-color-scheme: dark)`):null;function cE(){try{return iE(JSON.parse(window.localStorage.getItem(`shapewall.appearance`)||`null`))}catch{return{...rE}}}var lE=oE?cE():{...rE},uE=new Set;function dE(){let e=getComputedStyle(document.documentElement).getPropertyValue(`--surface`).trim();if(e)for(let t of document.querySelectorAll(`meta[name="theme-color"]`))t.removeAttribute(`media`),t.setAttribute(`content`,e)}function fE(e=lE){if(!oE)return;let t=document.documentElement;t.setAttribute(`data-mode`,aE(e.mode,!!sE()?.matches)),t.setAttribute(`data-theme`,e.theme),dE()}function pE(){return lE}function mE(e){lE=iE({...lE,...e});try{window.localStorage.setItem(eE,JSON.stringify(lE))}catch{}fE(),uE.forEach(e=>e())}oE&&(fE(),sE()?.addEventListener?.(`change`,()=>{lE.mode===`system`&&(fE(),uE.forEach(e=>e()))}),window.addEventListener(`storage`,e=>{e.key===`shapewall.appearance`&&(lE=cE(),fE(),uE.forEach(e=>e()))}));var hE=e=>(uE.add(e),()=>uE.delete(e));function gE(){return[(0,J.useSyncExternalStore)(hE,pE,pE),mE]}var _E=()=>oE?aE(lE.mode,!!sE()?.matches):`light`;function vE(){return(0,J.useSyncExternalStore)(hE,_E,_E)}var yE=`shapewall.demo.try`;function bE(){try{return window.localStorage.getItem(yE)===`1`}catch{return!1}}function xE(e){let[t,n]=(0,J.useState)(()=>e&&!bE());return[e&&t,()=>{n(!1);try{window.localStorage.setItem(yE,`1`)}catch{}}]}function SE({touch:e,done:t,onOpenComment:n,onComment:i,onAgent:a,onClose:o}){let[s,c]=(0,J.useState)(!0),l=[{id:`open`,icon:wg,label:`Open a comment`,hint:e?`Tap a pin on a page`:`Click a pin on a page`,run:n},i&&{id:`comment`,icon:Sg,label:e?`Pin your own comment`:`Press C to comment`,hint:e?`The comment button, then a page`:`Then click anywhere on a page`,run:i},a?{id:`agent`,icon:S,label:`Ask the agent`,hint:e?`In the ... menu`:`It reads the open comments`,run:a}:null].filter(Boolean),u=l.filter(e=>t.has(e.id)).length,d=e?`bottom-16 left-2`:`bottom-16 left-3`;return s?(0,Y.jsxs)(`button`,{type:`button`,className:K(`pointer-events-auto absolute z-30 inline-flex items-center gap-2 rounded-full border border-line bg-surface/95 pr-3 pl-2 text-[13px] font-medium text-fg shadow-pop backdrop-blur outline-none hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-accent`,e?`h-11`:`h-9`,d),onClick:()=>c(!1),"aria-expanded":`false`,"aria-label":`Try this: ${u} of ${l.length} done. Show the tips`,"data-sw-try-this":`folded`,children:[(0,Y.jsx)(m_,{size:15,className:`text-accent`,"aria-hidden":`true`}),` Try this`,(0,Y.jsxs)(`span`,{className:`tabular text-xs text-muted`,children:[u,`/`,l.length]})]}):(0,Y.jsxs)(`section`,{className:K(`pointer-events-auto absolute z-30 animate-pop-in rounded-xl border border-line bg-surface/95 p-3 text-fg shadow-pop backdrop-blur`,e?`inset-x-2 bottom-16`:`bottom-16 left-3 w-72`),"aria-label":`Try this`,"data-sw-try-this":`true`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,Y.jsx)(m_,{size:15,className:`shrink-0 text-accent`,"aria-hidden":`true`}),(0,Y.jsxs)(`h2`,{className:`min-w-0 flex-1 text-sm font-semibold`,children:[`Try this`,` `,(0,Y.jsxs)(`span`,{className:`tabular text-xs font-medium text-muted`,children:[u,`/`,l.length]})]}),(0,Y.jsx)(z,{size:e?`icon`:`icon-xs`,onClick:()=>c(!0),label:`Fold the tips away`,"aria-expanded":`true`,"data-sw-try-fold":`true`,children:(0,Y.jsx)(H,{size:14,"aria-hidden":`true`})}),(0,Y.jsx)(z,{size:e?`icon`:`icon-xs`,onClick:o,label:`Close the tips for good`,"data-sw-try-close":`true`,children:(0,Y.jsx)(g,{size:14,"aria-hidden":`true`})})]}),(0,Y.jsx)(`ol`,{className:`flex flex-col gap-1`,children:l.map(n=>{let i=t.has(n.id),a=i?m:n.icon;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(r,{size:e?`touch`:`sm`,variant:`ghost`,className:`h-auto w-full justify-start py-1.5 text-left`,onClick:n.run,"data-sw-try-step":n.id,"data-sw-try-done":i?`true`:void 0,children:[(0,Y.jsx)(`span`,{className:K(`flex h-6 w-6 shrink-0 items-center justify-center rounded-full`,i?`bg-ok/15 text-ok`:`bg-accent/10 text-accent`),"aria-hidden":`true`,children:(0,Y.jsx)(a,{size:13})}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:K(`block text-[13px] font-medium text-fg`,i&&`text-muted line-through decoration-faint`),children:n.label}),(0,Y.jsx)(`span`,{className:`block text-xs font-normal text-muted`,children:n.hint})]})]})},n.id)})}),(0,Y.jsx)(`p`,{className:`mt-2 border-t border-line px-2 pt-2 text-xs text-muted`,"data-sw-try-nav":`true`,children:e?`Drag to move around, pinch to zoom.`:`Scroll to move, Ctrl+scroll or pinch to zoom, Space+drag to pan.`})]})}var CE=new Map,wE=10;function TE(e,t,n,r){let i=n*t*4;for(let n=0;n<t;n+=1){let t=i+n*4;if(Math.abs(e[t]-r[0])>wE||Math.abs(e[t+1]-r[1])>wE||Math.abs(e[t+2]-r[2])>wE)return!0}return!1}function EE(e,t,n){if(!t||!n)return 1;let r=(n-1)*t*4,i=[e[r],e[r+1],e[r+2]];for(let r=n-1;r>=0;--r)if(TE(e,t,r,i))return Math.min(1,(r+1)/n);return 1}function DE(e){if(!e||typeof document>`u`)return Promise.resolve(1);if(CE.has(e))return CE.get(e);let t=new Promise(t=>{let n=new Image;n.decoding=`async`,n.onload=()=>{try{let e=Math.min(n.naturalWidth,200),r=Math.round(n.naturalHeight*e/n.naturalWidth),i=document.createElement(`canvas`);i.width=e,i.height=r;let a=i.getContext(`2d`,{willReadFrequently:!0});a.drawImage(n,0,0,e,r),t(EE(a.getImageData(0,0,e,r).data,e,r))}catch{t(1)}},n.onerror=()=>t(1),n.src=e});return CE.set(e,t),t}var OE=()=>typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches,kE=e=>OE()?0:e,AE=()=>OE()?`auto`:`smooth`,jE=.02,ME={padding:.16};function NE(e,t,n,r=92){if(!t?.width||!t?.height)return e;let i=Math.min(t.width/e.width,t.height/e.height)/(1+2*n),a=r/Math.max(i,.01);return{...e,y:e.y-a,height:e.height+a}}function PE(e){let t=String(e||``).split(`,`).map(Number);return t.length!==3||t.some(e=>!Number.isFinite(e))||t[2]<=0?null:{x:t[0],y:t[1],zoom:t[2]}}function FE(e,t,n,{phoneCompare:r,shotUrls:i}){let a=t.frames[0];if(r&&a&&n?.width){let r=Math.min(4,(n.width-16)/t.w);e.setViewport({x:8-t.x*r,y:70-(t.y+a.y)*r,zoom:r},{duration:kE(450)});return}let o=r=>e.fitBounds(NE({x:t.x,y:t.y,width:t.w,height:Math.min(t.h,(a?a.y+a.h*r:t.h)+16)},n,.12),{padding:.12,duration:kE(450)});!a||!i.length?o(1):Promise.all(i.map(e=>DE(e))).then(e=>o(Math.max(.2,...e))).catch(()=>o(1))}function IE(e,t,n,r=24){let i=n.map(n=>e.x+t.x+t.w*n.spot.x/100),a=n.map(n=>e.y+t.y+t.h*n.spot.y/100);return{x:Math.min(...i)-r,y:Math.min(...a)-r,width:Math.max(...i)-Math.min(...i)+r*2,height:Math.max(...a)-Math.min(...a)+r*2}}var LE=.34,RE=12,zE=.75,BE=72,VE=40;function HE(e,t,n=ME.padding){if(!t?.width||!t?.height||!e?.length)return null;let r=e.filter(e=>e.type===`groupFrame`),i=UE(r.length?r:e);if(!i)return null;let a=Math.min(t.width/(i.width*(1+2*n)),t.height/(i.height*(1+2*n))),o=e.filter(e=>e.type!==`groupFrame`).length;if(a>=.34||!r.length||o<=RE)return null;let s=[...r].sort((e,t)=>e.position.y-t.position.y||e.position.x-t.position.x)[0],c=s.width??s.style?.width??0,l=s.height??s.style?.height??0,u=Math.min((t.width-80)/c,(t.height-BE-24)/l),d=Math.max(a,LE,Math.min(zE,u));return{x:VE-s.position.x*d,y:BE-s.position.y*d,zoom:d}}function UE(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let e=a.width??a.style?.width??0,o=a.height??a.style?.height??0;t=Math.min(t,a.position.x),n=Math.min(n,a.position.y),r=Math.max(r,a.position.x+e),i=Math.max(i,a.position.y+o)}return Number.isFinite(t)?{x:t,y:n,width:r-t,height:i-n}:null}var WE={top:100,bottom:64,side:24},GE=280,KE=2;function qE(e,t,n=.5){if(!t?.width||!t?.height||!e?.width||!e?.height)return null;let{top:r,bottom:i,side:a}=WE,o=Math.max(1,t.width-a*2),s=Math.max(1,t.height-r-i),c=o/e.width,l=Math.min(c,s/e.height),u=Math.min(KE,4,Math.max(l,Math.min(c,GE/e.width))),d=e.width*u,f=e.height*u,p=a+(o-d)/2-e.x*u,m=r+(s-f)/2-e.y*u;if(f>s){m=r-e.y*u;let t=e.y+e.height*Math.min(1,Math.max(0,n));m+t*u>r+s*.8&&(m=Math.max(r+s-(e.y+e.height)*u,r+s/2-t*u))}return{x:p,y:m,zoom:u}}function JE(e){let t=Uu(),[n,r]=(0,J.useState)(null),i=(0,J.useRef)(null),a=(0,J.useCallback)(e=>{i.current=e,r(e)},[]);return(0,J.useEffect)(()=>{if(!e)return;let n=null,r=()=>{window.clearTimeout(n),n=window.setTimeout(()=>a(t.getState().transform[2]),300)};r();let o=t.getState().transform[2],s=t.subscribe(e=>{let t=e.transform[2];t!==o&&(o=t,i.current!==null&&t<i.current*.8&&a(t),r())});return()=>{window.clearTimeout(n),s()}},[e,a,t]),[n,a]}var YE=`shapewall.minimap`;function XE(){try{let e=window.localStorage.getItem(YE);return e===`on`||e!==`off`&&null}catch{return null}}function ZE(e){return e>=30}var QE=`shapewall.tip.board`;function $E(){try{return window.localStorage.getItem(QE)===`1`}catch{return!1}}function eD(e){try{window.localStorage.setItem(YE,e?`on`:`off`)}catch{}}function tD(){try{window.localStorage.setItem(QE,`1`)}catch{}}var nD=`shapewall.rail.`;function rD(e){try{let t=Number(window.localStorage.getItem(nD+e));return Number.isFinite(t)&&t>0?t:null}catch{return null}}function iD(e,t){try{t==null?window.localStorage.removeItem(nD+e):window.localStorage.setItem(nD+e,String(Math.round(t)))}catch{}}var aD=8;function oD({groups:e,onPick:t}){let[n,i]=(0,J.useState)(``),a=n.trim().toLowerCase(),o=e.flatMap(e=>e.pages.map(t=>({...t,group:e.group}))),s=a?o.filter(e=>`${e.title} ${e.path||``} ${e.group}`.toLowerCase().includes(a)):o.slice(0,aD);return(0,Y.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-page-finder":`true`,children:[(0,Y.jsx)(Ge,{size:`touch`,icon:n_,value:n,onChange:e=>i(e.target.value.slice(0,80)),placeholder:`Search ${o.length} pages`,"aria-label":`Search pages`,"data-sw-page-search":`true`}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1`,children:s.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(r,{size:`touch`,variant:`ghost`,className:`w-full justify-start`,onClick:()=>t(e.id),"data-sw-page-pick":e.id,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-faint`,children:e.group})]})},e.id))}),s.length?null:(0,Y.jsxs)(`p`,{className:`px-1 text-sm text-muted`,children:[`No page matches "`,n.trim(),`".`]}),!a&&o.length>aD?(0,Y.jsxs)(`p`,{className:`px-1 text-xs text-faint`,children:[o.length-aD,` more: type to find them.`]}):null]})}var sD=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||``),cD=sD?`⌘K`:`Ctrl K`,lD=60,uD=6,dD=e=>String(e||``).toLowerCase().normalize(`NFKD`).replace(/[̀-ͯ]/g,``);function fD(e,...t){let n=0;for(let[r,i]of t.entries()){let t=dD(i);if(!t)continue;let a=r===0?1:.5;t.startsWith(e)?n=Math.max(n,3*a):t.includes(` ${e}`)||t.includes(`/${e}`)?n=Math.max(n,2*a):t.includes(e)&&(n=Math.max(n,1*a))}return n}var pD=e=>e.filter(e=>e.score>0).sort((e,t)=>t.score-e.score).map(e=>e.entry);function mD({query:e,groups:t,journeys:n,canEditJourneys:r,comments:i,actions:a,titleOf:o}){let s=dD(e.trim()),c=t.flatMap(e=>e.pages.map(t=>({id:t.id,kind:`page`,icon:Eh,title:t.title,detail:t.path||``,meta:e.group,run:{type:`page`,id:t.id}}))),l=n.map(e=>({id:`journey:${e.id}`,kind:`journey`,icon:Qg,title:e.name,detail:e.description||``,meta:e.branching?`${e.paths?.length||2} paths`:`${e.steps.length} steps`,run:{type:`journey`,id:e.id}}));r&&l.push({id:`journey:__new`,kind:`journey`,icon:Hg,title:`New journey`,detail:`Click pages in the order people visit them`,meta:``,run:{type:`new-journey`}});let u=a.map(e=>({id:`action:${e.id}`,kind:`action`,icon:e.icon||R_,title:e.label,detail:e.detail||``,meta:e.keys||``,run:{type:`action`,run:e.run}}));if(!s)return[l.length?{id:`journeys`,label:`Journeys`,items:l}:null,{id:`pages`,label:`Pages`,items:c.slice(0,lD),more:Math.max(0,c.length-lD)},u.length?{id:`actions`,label:`Actions`,items:u}:null].filter(Boolean);let d=/^#?(\d{1,7})$/.exec(s)?.[1],f=e=>({id:`comment:${e.id}`,kind:`comment`,icon:wg,title:`#${e.id} ${String(e.body||``).split(`
33
+ `)[0]}`,detail:[o(e.pageId),e.viewport].filter(Boolean).join(` · `),meta:e.status===`resolved`?`Resolved`:``,run:{type:`comment`,comment:e}}),p=d?i.find(e=>String(e.id)===d):null,m=[p,...(s.length>=2&&!d?pD(i.map(e=>({entry:e,score:fD(s,e.body,e.author)}))):[]).filter(e=>e!==p)].filter(Boolean).slice(0,uD).map(f),h=pD(c.map(e=>({entry:e,score:fD(s,e.title,e.detail,e.meta)}))),g=pD(l.map(e=>({entry:e,score:fD(s,e.title,e.detail)}))),_=pD(u.map(e=>({entry:e,score:fD(s,e.title,e.detail)})));return[d&&p?{id:`comments`,label:`Comments`,items:m}:null,h.length?{id:`pages`,label:`Pages`,items:h.slice(0,lD)}:null,g.length?{id:`journeys`,label:`Journeys`,items:g}:null,!d&&m.length?{id:`comments`,label:`Comments`,items:m}:null,_.length?{id:`actions`,label:`Actions`,items:_}:null].filter(Boolean)}function hD({onOpen:e,compact:t=!1,className:n,...r}){return(0,Y.jsxs)(`button`,{type:`button`,...r,onClick:e,className:K(`inline-flex h-8 shrink-0 items-center gap-2 rounded-md border border-line bg-surface-2/60 text-[13px] text-muted outline-none hover:border-faint/40 hover:bg-surface-2 hover:text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,t?`w-8 justify-center`:`w-60 px-2.5`,n),"aria-label":`Go to a page, journey or comment`,"aria-haspopup":`dialog`,"aria-keyshortcuts":sD?`Meta+K`:`Control+K`,"data-sw-page-jump":`true`,"data-sw-palette-trigger":`true`,children:[(0,Y.jsx)(n_,{size:14,"aria-hidden":`true`,className:`shrink-0`}),t?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:`Go to page or journey`}),(0,Y.jsx)(a,{className:`shrink-0`,children:cD})]})]})}function gD({open:e,onOpenChange:t,groups:n,journeys:r=[],canEditJourneys:i=!1,comments:a=[],actions:o=[],titleOf:s=e=>e,onPage:c,onJourney:l,onNewJourney:u,onComment:d,onCloseAutoFocus:f}){return G(e,()=>t(!1)),(0,Y.jsx)(y,{open:e,onOpenChange:t,children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(Ze,{}),(0,Y.jsxs)(ne,{className:`fixed top-[12dvh] left-1/2 z-50 flex max-h-[min(560px,76dvh)] w-[min(640px,calc(100vw-1.5rem))] -translate-x-1/2 animate-pop-in flex-col overflow-hidden rounded-xl border border-line bg-surface text-fg shadow-pop outline-none`,"aria-describedby":void 0,onCloseAutoFocus:f,"data-sw-palette":`true`,children:[(0,Y.jsx)(ie,{className:`sr-only`,children:`Go to a page, journey or comment`}),e?(0,Y.jsx)(_D,{groups:n,journeys:r,canEditJourneys:i,comments:a,actions:o,titleOf:s,onRun:e=>{t(!1),e.type===`page`?c(e.id):e.type===`journey`?l(e.id):e.type===`new-journey`?u?.():e.type===`comment`?d?.(e.comment):e.type===`action`&&e.run()}}):null]})]})})}function _D({groups:e,journeys:t,canEditJourneys:n,comments:r,actions:i,titleOf:o,onRun:s}){let[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(0),f=(0,J.useRef)(null),p=(0,J.useMemo)(()=>mD({query:c,groups:e,journeys:t,canEditJourneys:n,comments:r,actions:i,titleOf:o}),[c,e,t,n,r,i,o]),m=(0,J.useMemo)(()=>p.flatMap(e=>e.items),[p]),h=m[Math.min(u,m.length-1)]||null;(0,J.useEffect)(()=>d(0),[c]),(0,J.useEffect)(()=>{h&&f.current?.querySelector(`[data-sw-option="${CSS.escape(h.id)}"]`)?.scrollIntoView({block:`nearest`})},[h]);let g=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!m.length)return;let t=e.key===`ArrowDown`?1:-1;d(e=>(Math.min(e,m.length-1)+t+m.length)%m.length)}else e.key===`Home`&&e.ctrlKey?d(0):e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),h&&s(h.run))},_=e=>`sw-palette-${e.id.replace(/[^\w-]/g,`_`)}`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-4`,children:[(0,Y.jsx)(n_,{size:17,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{autoFocus:!0,value:c,onChange:e=>l(e.target.value.slice(0,120)),onKeyDown:g,placeholder:`Go to a page, journey or #comment...`,className:`h-13 min-w-0 flex-1 bg-transparent text-base text-fg outline-none placeholder:text-faint lg:h-12 lg:text-[15px]`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`sw-palette-list`,"aria-activedescendant":h?_(h):void 0,"aria-autocomplete":`list`,"aria-label":`Search the board`,"data-sw-palette-input":`true`}),(0,Y.jsx)(a,{className:`hidden shrink-0 lg:inline-flex`,children:`Esc`})]}),(0,Y.jsxs)(`div`,{ref:f,id:`sw-palette-list`,role:`listbox`,"aria-label":`Results`,className:`min-h-0 flex-1 overflow-y-auto p-1.5`,children:[p.map(e=>(0,Y.jsxs)(`div`,{role:`presentation`,className:`pb-1`,children:[(0,Y.jsx)(`p`,{role:`presentation`,className:`px-2.5 pt-2 pb-1 text-[11px] font-medium tracking-wide text-faint uppercase`,children:e.label}),e.items.map(e=>{let t=e===h,n=e.icon;return(0,Y.jsxs)(`div`,{id:_(e),role:`option`,"aria-selected":t,className:K(`flex min-h-11 cursor-default items-center gap-3 rounded-lg px-2.5 py-1.5 select-none lg:min-h-10`,t?`bg-accent/10 text-fg`:`text-fg`),onMouseMove:()=>{let t=m.indexOf(e);t!==u&&d(t)},onClick:()=>s(e.run),"data-sw-option":e.id,children:[(0,Y.jsx)(`span`,{className:K(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,t?`border-accent/30 bg-surface text-accent`:`border-line bg-surface-2 text-muted`),"aria-hidden":`true`,children:(0,Y.jsx)(n,{size:14})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.title}),e.detail?(0,Y.jsx)(`span`,{className:K(`block truncate text-xs text-muted`,e.kind===`page`&&`font-mono text-[11px]`),children:e.detail}):null]}),e.meta?(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-faint`,children:e.meta}):null,t?(0,Y.jsx)(fh,{size:14,className:`hidden shrink-0 text-muted lg:block`,"aria-hidden":`true`}):null]},e.id)}),e.more?(0,Y.jsxs)(`p`,{role:`presentation`,className:`px-2.5 py-1 text-xs text-faint`,children:[e.more,` more pages: type to find them.`]}):null]},e.id)),m.length?null:(0,Y.jsxs)(`p`,{className:`px-3 py-8 text-center text-sm text-muted`,"data-sw-palette-empty":`true`,children:[`Nothing matches "`,c.trim(),`".`]})]}),(0,Y.jsxs)(`div`,{className:`hidden items-center gap-4 border-t border-line bg-surface-2/50 px-4 py-2 text-xs text-muted lg:flex`,children:[(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Y.jsx)(a,{children:`↑`}),(0,Y.jsx)(a,{children:`↓`}),` to move`]}),(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Y.jsx)(a,{children:`↵`}),` to open`]}),(0,Y.jsx)(`span`,{className:`ml-auto`,children:`#12 finds comment 12`})]})]})}var vD=Object.freeze({id:null,pinned:!1,via:null,swap:!1});function yD({onChange:e,openDelay:t=150,closeDelay:n=250,setTimer:r=(e,t)=>setTimeout(e,t),clearTimer:i=e=>clearTimeout(e)}={}){let a=vD,o=null,s=()=>{o!==null&&i(o),o=null},c=(e,t)=>{s(),o=r(()=>{o=null,e()},t)},l=t=>{a=t,e?.(a)},u=()=>{s(),a.id!==null&&l(vD)};return{get state(){return a},enterIcon(e){a.pinned||(s(),a.id!==e&&(a.id===null?c(()=>l({id:e,pinned:!1,via:`hover`,swap:!1}),t):l({id:e,pinned:!1,via:`hover`,swap:!0})))},leave(){a.pinned||(a.id===null?s():c(u,n))},enterPanel(){a.pinned||s()},toggle(e,t=`click`){s(),a.id===e&&a.pinned?u():l({id:e,pinned:!0,via:t,swap:!1})},close:u,dispose:s}}function bD({anchorTop:e,viewportHeight:t,margin:n=8,minHeight:r=320}){let i=Math.max(0,t-n*2),a=t-Math.max(e,n)-n;return Math.round(Math.min(i,Math.max(a,Math.min(r,i))))}var xD=`shapewall.lastBoard`,SD=`shapewall.sidebar`,CD=`shapewall.sidebarWidth`,wD=208,TD=420,ED=16,DD=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||``)?`⌘B`:`Ctrl B`;function OD(e){try{typeof e==`string`&&e.startsWith(`/`)&&window.localStorage.setItem(xD,e)}catch{}}function kD(e){try{let t=window.localStorage.getItem(SD);return t===`expanded`||t!==`collapsed`&&e}catch{return e}}function AD(e){let t=Math.max(wD,Math.min(TD,Math.floor(window.innerWidth*.4)));return Math.min(t,Math.max(wD,Math.round(e)))}function jD(){try{let e=Number(window.localStorage.getItem(CD));return Number.isFinite(e)&&e>0?AD(e):256}catch{return 256}}function MD(e){try{e===256?window.localStorage.removeItem(CD):window.localStorage.setItem(CD,String(e))}catch{}}function ND(){let[e,t]=(0,J.useState)(jD),[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=()=>t(e=>AD(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let a=e=>{let n=AD(e);t(n),MD(n)},o={onPointerDown:t=>{t.button===0&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),i.current={x:t.clientX,width:e},r(!0))},onPointerMove:e=>{i.current&&t(AD(i.current.width+e.clientX-i.current.x))},onPointerUp:e=>{i.current&&(a(i.current.width+e.clientX-i.current.x),i.current=null,r(!1))},onDoubleClick:()=>a(256),onKeyDown:t=>{let n=t.shiftKey?64:ED;if(t.key===`ArrowRight`)a(e+n);else if(t.key===`ArrowLeft`)a(e-n);else if(t.key===`Home`)a(256);else return;t.preventDefault()}};return o.onPointerCancel=o.onPointerUp,{width:e,dragging:n,handle:o}}var PD=e=>!!(e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)||e.closest?.(`[contenteditable="true"]`)));function FD(e=!0,t=!0){let[n,r]=(0,J.useState)(()=>kD(t)),i=(0,J.useCallback)(()=>r(e=>{try{window.localStorage.setItem(SD,e?`collapsed`:`expanded`)}catch{}return!e}),[]);return(0,J.useEffect)(()=>{if(!e)return;let t=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey||e.key.toLowerCase()!==`b`||PD(e.target)||document.querySelector(`[role="dialog"]:not([data-sw-rail-flyout])`)||(e.preventDefault(),i())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,i]),[n,i,r]}function ID(e,t){return K(`relative flex items-center rounded-md outline-none transition-colors focus-visible:outline-2 focus-visible:outline-accent`,e?`h-8 w-full gap-2.5 px-2.5 text-left text-[13px] font-medium`:`h-10 w-10 justify-center rounded-lg`,t?`bg-accent/10 text-fg`:`text-muted hover:bg-surface-2 hover:text-fg`)}function LD({item:e,expanded:t,link:n,flyouts:r}){let{id:i,label:o,icon:s,href:c,to:l,onSelect:u,active:d,count:f,shortcut:p,flyout:m,...g}=e;if(!t&&m&&r)return(0,Y.jsx)(VD,{item:e,flyouts:r});let _=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(s,{size:t?16:19,"aria-hidden":`true`,className:K(`shrink-0`,d&&`text-accent`)}),t?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}):null,t&&f?(0,Y.jsx)(`span`,{className:`shrink-0 text-xs font-normal text-faint tabular`,children:f}):null]}),v={className:ID(t,d),"aria-label":t?void 0:o,"aria-current":d?`page`:void 0,"data-sw-rail-item":i,...g},y=l&&n?(0,Y.jsx)(n,{to:l,...v,children:_}):c?(0,Y.jsx)(`a`,{href:c,...v,children:_}):(0,Y.jsx)(`button`,{type:`button`,onClick:u,...v,children:_});return(0,Y.jsx)(`li`,{children:t?y:(0,Y.jsx)(h,{content:p?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[o,(0,Y.jsx)(a,{children:p})]}):o,side:`right`,children:y})})}var RD=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,zD=e=>[...e.querySelectorAll(RD)].filter(e=>e.getClientRects().length>0);function BD(e,t){let n=zD(document).filter(e=>!t?.contains(e));(n[n.indexOf(e)+1]||e).focus()}function VD({item:e,flyouts:t}){let{id:n,label:r,icon:i,active:a,flyout:o,dot:s}=e,{state:c,intent:l,width:u,disabled:d}=t,f=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith(`data-`))),m=(0,J.useId)(),h=(0,J.useRef)(null),g=(0,J.useRef)(null),_=c.id===n,[v,y]=(0,J.useState)(null);(0,J.useLayoutEffect)(()=>{if(!_)return;let e=()=>{let e=h.current?.getBoundingClientRect().top??0;y(bD({anchorTop:e,viewportHeight:window.innerHeight}))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[_]),(0,J.useEffect)(()=>{if(!_)return;let e=e=>{g.current?.contains(e.target)||h.current?.contains(e.target)||l.close()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[_,l]);let b=_&&c.pinned;(0,J.useEffect)(()=>{if(!b)return;let e=requestAnimationFrame(()=>{let e=g.current;e&&!e.contains(document.activeElement)&&(zD(e)[0]||e).focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[b]);let S=(0,J.useCallback)(()=>{let e=!!g.current?.contains(document.activeElement);l.close(),e&&h.current?.focus({preventScroll:!0})},[l]),C=e=>t=>{t.pointerType!==`touch`&&e()},w=e=>{if(e.key!==`Tab`||e.defaultPrevented)return;let t=zD(g.current);t.length&&(e.shiftKey&&document.activeElement===t[0]?(e.preventDefault(),h.current?.focus()):!e.shiftKey&&document.activeElement===t[t.length-1]&&(e.preventDefault(),l.close(),BD(h.current,g.current)))};return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(V,{open:_,onOpenChange:e=>{e||l.close()},children:[(0,Y.jsx)(p,{asChild:!0,children:(0,Y.jsxs)(`button`,{ref:h,type:`button`,className:ID(!1,a||_),"aria-label":r,"aria-haspopup":`dialog`,"aria-expanded":_,"aria-controls":_?m:void 0,"aria-current":a?`page`:void 0,"data-sw-rail-item":n,"data-sw-rail-flyout-trigger":n,"data-state":_?c.pinned?`pinned`:`open`:`closed`,...f,onPointerEnter:C(()=>!d&&l.enterIcon(n)),onPointerLeave:C(()=>l.leave()),onClick:e=>!d&&l.toggle(n,e.detail===0?`key`:`click`),onKeyDown:e=>{e.key!==`ArrowRight`||d||(e.preventDefault(),b||l.toggle(n,`key`))},children:[(0,Y.jsx)(i,{size:19,"aria-hidden":`true`,className:K(`shrink-0`,a&&`text-accent`)}),s?(0,Y.jsx)(`span`,{className:`pointer-events-none absolute top-1.5 right-1.5 h-2 w-2 rounded-full bg-accent ring-2 ring-surface`,"aria-hidden":`true`,"data-sw-rail-dot":n}):null]})}),(0,Y.jsx)(Pe,{children:(0,Y.jsx)(x,{ref:g,id:m,side:`right`,align:`start`,sideOffset:12,collisionPadding:8,"aria-label":r,tabIndex:-1,className:K(`sw-rail-flyout z-40 flex flex-col overflow-y-auto overscroll-contain rounded-lg border border-line bg-surface p-2 text-fg shadow-pop outline-none`,`[&_[data-sw-pages-sidebar]]:border-t-0 [&_[data-sw-pages-sidebar]]:pt-0`,c.swap&&`sw-rail-flyout-swap`),style:{width:u,maxHeight:v??void 0},"data-sw-rail-flyout":n,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{e.preventDefault();let t=c.pinned||g.current?.contains(document.activeElement);l.close(),t&&h.current?.focus({preventScroll:!0})},onInteractOutside:e=>{h.current?.contains(e.target)&&e.preventDefault()},onPointerEnter:C(()=>l.enterPanel()),onPointerLeave:C(()=>l.leave()),onKeyDown:w,children:o({close:S})})})]})})}function HD({items:e,expanded:t,link:n,label:r,flyouts:i,flush:a}){return e.length?(0,Y.jsxs)(`div`,{className:K(`w-full`,!a&&`border-t border-line pt-2`),children:[t&&r?(0,Y.jsx)(`p`,{className:`px-2.5 pb-1 text-xs font-semibold text-faint`,children:r}):null,(0,Y.jsx)(`ul`,{className:K(`flex flex-col`,t?`gap-0.5`:`items-center gap-1`),children:e.map(e=>(0,Y.jsx)(LD,{item:e,expanded:t,link:n,flyouts:i},e.id))})]}):null}function UD(e,t,n=!1){let[r,i]=(0,J.useState)(()=>({id:null,pinned:!1,via:null,swap:!1})),a=(0,J.useRef)(null);return a.current||=yD({onChange:i}),(0,J.useEffect)(()=>()=>a.current.dispose(),[]),(0,J.useEffect)(()=>{(e||n)&&a.current.close()},[e,n]),{state:r,intent:a.current,width:t,disabled:n}}function WD({expanded:e,onToggle:t,home:n,homeTo:r,homeLabel:i=`Shapewall`,title:o,logo:s,items:c=[],sections:l=[],sectionsLabel:u,link:d,profile:f,children:p,className:m,flyoutsDisabled:g=!1}){let _=r&&d?d:`a`,v=r&&d?{to:r}:{href:n},y=e?`Collapse sidebar`:`Expand sidebar`,{width:b,dragging:x,handle:S}=ND(),C=UD(e,b,g),w=e?[]:l.filter(e=>!e.flyout),T=w.length?c.find(e=>e.active):null,E=T?c.map(e=>e===T?{...e,flyout:({close:t})=>(0,Y.jsx)(`div`,{onClick:e=>{e.target.closest?.(`[data-sw-rail-item]`)&&setTimeout(t,0)},children:(0,Y.jsx)(HD,{items:w,expanded:!0,link:d,label:u||e.label,flush:!0})})}:e):c,D=T?l.filter(e=>e.flyout):l;return(0,Y.jsxs)(`div`,{className:K(`relative flex shrink-0`,m),children:[(0,Y.jsxs)(`nav`,{"aria-label":`Shapewall`,className:K(`flex flex-col gap-2 overflow-hidden border-r border-line bg-surface py-2`,e?`px-2`:`w-[52px] items-center`),style:e?{width:b}:void 0,"data-sw-app-rail":e?`expanded`:`collapsed`,children:[(0,Y.jsxs)(`div`,{className:K(`flex shrink-0 items-center gap-1`,e?`h-10`:`flex-col`),children:[(0,Y.jsx)(h,{content:e?null:i,side:`right`,children:(0,Y.jsx)(_,{...v,className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg outline-none hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-accent`,"aria-label":i,"data-sw-rail-home":`true`,children:s})}),e?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,"data-sw-rail-title":`true`,children:o||`Shapewall`}):null,(0,Y.jsx)(h,{content:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[y,(0,Y.jsx)(a,{children:DD})]}),side:`right`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:t,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted outline-none hover:bg-surface-2 hover:text-fg focus-visible:outline-2 focus-visible:outline-accent`,"aria-label":y,"aria-expanded":e,"data-sw-sidebar-toggle":`true`,children:e?(0,Y.jsx)(Ig,{size:17,"aria-hidden":`true`}):(0,Y.jsx)(Rg,{size:17,"aria-hidden":`true`})})})]}),(0,Y.jsx)(HD,{items:E,expanded:e,link:d,flyouts:C}),(0,Y.jsxs)(`div`,{className:K(`flex min-h-0 flex-1 flex-col gap-2`,e?`overflow-y-auto in-[.sw-scrollbars]:mr-[calc(-1*var(--scrollbar-size))]`:`w-full`),children:[(0,Y.jsx)(HD,{items:D,expanded:e,link:d,label:u,flyouts:C}),e?p:null]}),f?(0,Y.jsx)(`div`,{className:K(`w-full shrink-0 border-t border-line pt-2`,!e&&`flex justify-center`),children:f(e)}):null]}),e?(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuenow":b,"aria-valuemin":wD,"aria-valuemax":TD,tabIndex:0,"aria-description":`Drag or use the arrow keys to resize. Double-click or press Home to reset.`,className:`group absolute inset-y-0 -right-1.5 z-20 w-3 cursor-col-resize touch-none outline-none`,"data-sw-sidebar-handle":`true`,...S,children:(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:K(`absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 bg-accent opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-100`,x&&`opacity-100`)})}):null,x?(0,Y.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-col-resize`,"aria-hidden":`true`}):null]})}function GD({count:e,corner:t=!1}){return e?(0,Y.jsxs)(`span`,{className:K(`inline-flex min-w-5 items-center justify-center rounded-full bg-bad px-1.5 text-[11px] leading-5 font-semibold text-bad-fg tabular`,t?`pointer-events-none absolute -top-1.5 -right-1.5`:`ml-1`),"data-sw-broken-links-badge":e,children:[e,(0,Y.jsxs)(`span`,{className:`sr-only`,children:[` broken link`,e===1?``:`s`]})]}):null}var KD=e=>e.status?String(e.status):`No answer`;function qD({items:e,open:t,onOpenChange:n}){let[r,i]=(0,J.useState)(!1),a=t??r,o=n||i,s=e.length;return(0,Y.jsx)(`div`,{className:`absolute top-2 left-2 z-30 max-w-[calc(100%-1rem)] max-lg:top-[4.75rem]`,"data-sw-broken-links":`true`,children:(0,Y.jsxs)(Ye,{open:a,onOpenChange:o,children:[(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:K(`inline-flex h-9 max-w-full items-center gap-2 rounded-full border border-bad/40 bg-surface pr-2.5 pl-2 text-xs font-medium text-fg shadow-pop transition-colors hover:bg-surface-2`,`focus-visible:outline-2 focus-visible:outline-accent [@media(pointer:coarse)]:h-11`),"aria-expanded":a,"data-sw-broken-links-toggle":`true`,children:[(0,Y.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-bad/10 text-bad`,children:(0,Y.jsx)(ig,{size:12,"aria-hidden":`true`})}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[s,` broken link`,s===1?``:`s`]}),(0,Y.jsx)(`span`,{className:`hidden shrink-0 font-normal text-muted sm:inline`,children:`from the last capture`}),(0,Y.jsx)(H,{size:13,className:K(`shrink-0 text-faint transition-transform`,a&&`rotate-180`),"aria-hidden":`true`})]})}),(0,Y.jsxs)(qe,{align:`start`,className:`w-[min(26rem,calc(100vw-1.5rem))] p-0`,"aria-label":`Broken links`,children:[(0,Y.jsxs)(`div`,{className:`border-b border-line px-3 py-2.5`,children:[(0,Y.jsxs)(`p`,{className:`text-[13px] font-semibold text-fg`,children:[s,` link`,s===1?``:`s`,` lead`,s===1?`s`:``,` to an error`]}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:`Found on the pages of the last capture. Fix the link or publish the page.`})]}),(0,Y.jsx)(`ul`,{className:`max-h-72 divide-y divide-line overflow-auto`,children:e.slice(0,100).map(e=>(0,Y.jsxs)(`li`,{className:`flex items-start gap-2.5 px-3 py-2`,"data-sw-broken-link":e.path??e.url,children:[(0,Y.jsx)(`span`,{className:`mt-0.5 inline-flex h-5 shrink-0 items-center rounded bg-bad/10 px-1.5 font-mono text-[11px] font-semibold text-bad tabular`,children:KD(e)}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate font-mono text-xs text-fg`,children:e.path??e.url}),(e.from||[]).length?(0,Y.jsxs)(`span`,{className:`mt-0.5 block text-[11px] text-muted`,children:[`Linked from `,(e.from||[]).join(`, `)]}):null]})]},e.url))}),s>100?(0,Y.jsx)(`p`,{className:`border-t border-line px-3 py-2 text-[11px] text-faint`,children:`Showing the first 100.`}):null]})]})})}function JD({label:e,keys:t}){return(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e,t.map(e=>(0,Y.jsx)(a,{children:e},e))]})}var YD=`__none`;function XD(e){if(e.branching)return`${e.paths?.length||2} paths`;let t=e.steps?.length||0;return`${t} ${t===1?`step`:`steps`}`}function ZD({journeys:e=[],journey:n,openJourney:i,closeJourney:o,canEditJourneys:s,startBuilder:c,showLinks:l,toggleLinks:u,linksTip:f,brokenLinks:p,openBrokenLinks:v,canCompare:y,comparePair:b,toggleCompare:x,minimapOn:S,toggleMinimap:w,compact:E,labelMax:O=160}){let[k,j]=(0,J.useState)(``),M=(0,J.useRef)(null),N=[l,!!b].filter(Boolean).length,P=p.length,F=e.length>8,ee=k.trim().toLowerCase(),I=F&&ee?e.filter(e=>e.name.toLowerCase().includes(ee)):e,L=(0,J.useRef)(null),R=`pr-2`,B=e=>(0,Y.jsx)(`span`,{className:K(`ml-auto inline-flex h-4 w-4 items-center justify-center`,e?`!text-accent`:`opacity-0`),children:(0,Y.jsx)(m,{size:14,className:`!text-accent`,"aria-hidden":`true`})}),V=P?`${P} broken link${P===1?``:`s`}`:null,H=[N?`${N} on`:null,V].filter(Boolean).join(`, `),U=n?`Journey: ${n.name}. Views`:H?`Views, ${H}`:`Views`,te=n?(0,Y.jsx)(JD,{label:`Journey: ${n.name}. Open Views to switch`,keys:[`J`]}):e.length?(0,Y.jsx)(JD,{label:`Views: journeys, links between pages, compare, minimap`,keys:[`J`]}):`Views: links between pages, compare, minimap`,ne=!!n,re=(0,Y.jsxs)(r,{variant:ne?`soft`:`ghost`,className:K(`relative h-8 shrink-0 text-[13px]`,E?`w-8 px-0`:`px-2.5`,ne?E?``:`rounded-r-none`:`text-fg`),"aria-label":U,"data-sw-view-menu":`true`,"data-sw-view-journey":n?.id,children:[ne?(0,Y.jsx)(Qg,{size:15,"aria-hidden":`true`}):(0,Y.jsx)(Sh,{size:15,"aria-hidden":`true`}),E?null:ne?(0,Y.jsx)(`span`,{className:`block truncate`,style:{maxWidth:O},"data-sw-view-journey-name":`true`,children:n.name}):`Views`,P?(0,Y.jsx)(`span`,{className:`pointer-events-none absolute -top-1.5 -right-1.5 inline-flex min-w-4 items-center justify-center rounded-full bg-bad px-1 text-[10px] leading-4 font-semibold text-bad-fg tabular`,"aria-hidden":`true`,"data-sw-broken-links-badge":P,children:P}):ne&&E?(0,Y.jsx)(`span`,{className:`absolute top-1 right-1 h-1.5 w-1.5 rounded-full bg-accent ring-2 ring-surface`,"aria-hidden":`true`,"data-sw-view-on":`journey`}):N&&!ne?(0,Y.jsx)(`span`,{className:`absolute top-1 right-1 h-1.5 w-1.5 rounded-full bg-muted ring-2 ring-surface`,"aria-hidden":`true`,"data-sw-view-on":N}):null]});return(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center`,"data-sw-views":`true`,children:[(0,Y.jsxs)(Ce,{onOpenChange:e=>e?null:j(``),children:[(0,Y.jsx)(h,{content:te,side:`bottom`,children:(0,Y.jsx)(C,{asChild:!0,children:re})}),(0,Y.jsxs)(t,{align:`start`,className:`w-80`,onCloseAutoFocus:e=>{e.preventDefault();let t=M.current;M.current=null,t?t():document.querySelector(`[data-sw-canvas]`)?.focus({preventScroll:!0})},"data-sw-views-menu":`true`,children:[e.length||s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(D,{className:`flex items-center gap-2`,children:[`Journeys`,e.length?(0,Y.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 font-normal tracking-normal normal-case`,children:[`Next `,(0,Y.jsx)(a,{children:`J`})]}):null]}),F?(0,Y.jsx)(`div`,{className:`px-1 pb-1`,children:(0,Y.jsx)(Ge,{size:`xs`,icon:n_,value:k,onChange:e=>j(e.target.value),placeholder:`Filter journeys`,"aria-label":`Filter journeys`,"data-sw-views-filter":`true`,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),L.current?.querySelector(`[role="menuitemradio"]`)?.focus()):e.key!==`Escape`&&e.key!==`Tab`&&e.stopPropagation()}})}):null,(0,Y.jsxs)(A,{ref:L,value:n?.id||YD,onValueChange:e=>e===YD?o():i(e),className:F?`max-h-72 overflow-y-auto`:void 0,"aria-label":`Journeys`,"data-sw-views-journeys":e.length,children:[ee?null:(0,Y.jsxs)(d,{value:YD,"data-sw-views-journey":`none`,children:[(0,Y.jsx)(Sh,{size:15,"aria-hidden":`true`}),` None`,(0,Y.jsx)(`span`,{className:`ml-auto text-caption text-faint`,children:`All pages`})]}),I.map(e=>(0,Y.jsxs)(d,{value:e.id,"data-sw-views-journey":e.id,children:[(0,Y.jsx)(Qg,{size:15,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 text-caption text-faint tabular-nums`,children:XD(e)})]},e.id)),ee&&!I.length?(0,Y.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted`,children:`No journey matches.`}):null]}),s?(0,Y.jsxs)(T,{className:R,onSelect:()=>c(),"data-sw-views-new-journey":`true`,children:[(0,Y.jsx)(Hg,{size:15,"aria-hidden":`true`}),` New journey`]}):null,(0,Y.jsx)(_,{})]}):null,(0,Y.jsx)(D,{children:`Show`}),(0,Y.jsxs)(T,{className:R,role:`menuitemcheckbox`,"aria-checked":l,onSelect:u,"data-sw-links-toggle":`true`,children:[(0,Y.jsx)(I_,{size:15,"aria-hidden":`true`}),`Links between pages`,B(l)]}),y?(0,Y.jsxs)(T,{className:R,role:`menuitemcheckbox`,"aria-checked":!!b,onSelect:x,"data-sw-compare-toggle":`true`,children:[(0,Y.jsx)(Ph,{size:15,"aria-hidden":`true`}),` Compare environments`,B(!!b)]}):null,(0,Y.jsxs)(T,{className:R,role:`menuitemcheckbox`,"aria-checked":S,onSelect:w,children:[(0,Y.jsx)(vg,{size:15,"aria-hidden":`true`}),` Minimap`,B(S)]}),P?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_,{}),(0,Y.jsxs)(T,{className:R,onSelect:()=>{l||u(),M.current=v},"data-sw-broken-links-open":`true`,children:[(0,Y.jsx)(ig,{size:15,className:`!text-bad`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block`,children:`Broken links`}),(0,Y.jsxs)(`span`,{className:`block text-caption text-muted`,children:[P,` `,P===1?`link leads`:`links lead`,` to an error`]})]}),(0,Y.jsx)(`span`,{className:`ml-auto inline-flex min-w-5 items-center justify-center rounded-full bg-bad px-1.5 text-[11px] leading-5 font-semibold text-bad-fg tabular`,children:P})]})]}):null,(0,Y.jsx)(_,{}),(0,Y.jsxs)(`p`,{className:`px-2 py-1.5 text-xs text-muted`,children:[f,`.`]})]})]}),ne&&!E?(0,Y.jsx)(z,{variant:`soft`,className:`h-8 w-7 shrink-0 -ml-px rounded-l-none`,onClick:o,label:`Leave journey`,tooltip:(0,Y.jsx)(JD,{label:`Leave the journey`,keys:[`Esc`]}),side:`bottom`,"data-sw-view-journey-clear":`true`,children:(0,Y.jsx)(g,{size:14,"aria-hidden":`true`})}):null]})}function QD({data:e,capture:t}){let n=e?.manifest?.capturedAt,r=!t?.running&&t?.state===`failed`&&t.error,i=t?.running?`Capturing${t.total?` ${t.done||0} of ${t.total}`:``}`:n?`Captured ${Ee(n)}`:`Not captured yet`;return(0,Y.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs whitespace-nowrap text-muted`,"data-sw-captured":`true`,children:t?.running?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,role:`status`,children:[(0,Y.jsx)(ue,{size:12}),(0,Y.jsx)(`span`,{className:`tabular`,children:t.total?`${t.done||0}/${t.total}`:`Capturing`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:i})]}):r?(0,Y.jsx)(h,{content:`Last capture failed: ${t.error}`,side:`bottom`,children:(0,Y.jsxs)(`span`,{tabIndex:0,className:`inline-flex h-6 items-center gap-1.5 rounded-full bg-bad/10 px-2 font-medium text-bad outline-none focus-visible:outline-2 focus-visible:outline-accent`,"data-sw-capture-failed":`true`,children:[(0,Y.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-bad`,"aria-hidden":`true`}),` Capture failed`]})}):(0,Y.jsx)(h,{content:i,side:`bottom`,children:(0,Y.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":i,className:`inline-flex h-6 w-4 items-center justify-center rounded-full outline-none focus-visible:outline-2 focus-visible:outline-accent`,children:(0,Y.jsx)(`span`,{className:K(`h-2 w-2 rounded-full`,n?`bg-ok`:`bg-faint`),"aria-hidden":`true`})})})})}function $D({data:e,capture:t}){let n=e?.manifest?.capturedAt;return(0,Y.jsxs)(`p`,{className:`text-xs whitespace-nowrap text-muted`,"data-sw-captured":`true`,children:[t?.running?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Y.jsx)(ue,{size:12}),` Capturing`,t.total?` ${t.done||0}/${t.total}`:``]}):n?`Captured ${Ee(n)}`:`Not captured yet`,!t?.running&&t?.state===`failed`&&t.error?(0,Y.jsxs)(`span`,{className:`ml-2 text-bad`,children:[`Last capture failed: `,t.error]}):null]})}var eO=e=>e.preventDefault(),tO={light:S_,dark:Mg,system:Ag},nO=`h-11 justify-center gap-1.5 rounded-md border border-transparent px-1 text-xs lg:h-9 data-[state=checked]:border-accent data-[state=checked]:bg-accent/10 data-[state=checked]:text-fg`;function rO({name:e,avatarUrl:n=null,detail:i=null,items:a=[],workspaces:o=null,viewAs:s=null,showName:c=!1,label:l=`Profile and appearance`,about:u=!0,triggerClassName:f,side:p=`bottom`,align:h=`end`,...g}){let[v,y]=gE(),b=(0,J.useRef)(null);return(0,Y.jsxs)(Ce,{children:[(0,Y.jsx)(C,{asChild:!0,children:(0,Y.jsxs)(r,{ref:b,variant:`ghost`,size:`touch`,className:K(`shrink-0 gap-2 px-1.5 lg:h-10`,f),"aria-label":e?`${l}: ${e}`:l,"data-sw-profile-menu":!0,...g,children:[(0,Y.jsx)(se,{name:e||`?`,src:n,className:`h-8 w-8`}),c&&e?(0,Y.jsx)(`span`,{className:`hidden max-w-40 truncate text-sm text-fg md:inline`,children:e}):null]})}),(0,Y.jsxs)(t,{className:`w-72`,side:p,align:h,"data-sw-profile-content":!0,children:[e||i?(0,Y.jsxs)(D,{className:`normal-case`,children:[e?(0,Y.jsx)(`span`,{className:`block truncate text-[13px] font-medium tracking-normal text-fg`,children:e}):null,i?(0,Y.jsx)(`span`,{className:`block truncate text-xs font-normal tracking-normal text-muted`,children:i}):null]}):null,a.length?(0,Y.jsxs)(Y.Fragment,{children:[e||i?(0,Y.jsx)(_,{}):null,(0,Y.jsx)(xe,{children:a.map(({id:e,label:t,icon:n,onSelect:r,tone:i,hint:a,...o})=>(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(T,{onSelect:r,tone:i,"data-sw-profile-item":e,"aria-describedby":a?`sw-profile-hint-`+e:void 0,...o,children:[n?(0,Y.jsx)(n,{size:14,"aria-hidden":`true`}):null,` `,t]}),a?(0,Y.jsx)(`p`,{id:`sw-profile-hint-`+e,className:`px-2 pb-1.5 text-xs text-muted`,"data-sw-profile-hint":e,children:a}):null]},e))})]}):null,o?.list?.length?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_,{}),(0,Y.jsx)(D,{children:`Workspace`}),o.list.map(e=>(0,Y.jsxs)(T,{onSelect:()=>o.onPick(e.id),"data-sw-profile-workspace":e.id,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.roleLabel?(0,Y.jsx)(`span`,{className:`text-xs text-faint`,children:e.roleLabel}):null,e.id===o.current?(0,Y.jsx)(m,{size:14,className:`!text-accent`,"aria-label":`Current`}):null]},e.id))]}):null,s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_,{}),(0,Y.jsx)(D,{children:`View as (demo)`}),(0,Y.jsx)(A,{value:s.value,onValueChange:s.onChange,children:s.options.map(e=>(0,Y.jsxs)(d,{value:e.id,"data-sw-view-as":e.id,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint?(0,Y.jsx)(`span`,{className:`truncate text-xs text-faint`,children:e.hint}):null]},e.id))})]}):null,(0,Y.jsx)(_,{}),(0,Y.jsx)(D,{children:`Appearance`}),(0,Y.jsx)(A,{value:v.mode,onValueChange:e=>y({mode:e}),className:`grid grid-cols-3 gap-1 px-1 pb-1`,"aria-label":`Mode`,children:tE.map(e=>{let t=tO[e.id];return(0,Y.jsxs)(d,{value:e.id,indicator:!1,className:nO,onSelect:eO,"data-sw-appearance-mode":e.id,children:[(0,Y.jsx)(t,{size:14,"aria-hidden":`true`}),` `,e.label]},e.id)})}),(0,Y.jsx)(A,{value:v.theme,onValueChange:e=>y({theme:e}),className:`grid grid-cols-2 gap-1 px-1 pb-1`,"aria-label":`Theme`,children:nE.map(e=>(0,Y.jsxs)(d,{value:e.id,indicator:!1,className:K(nO,`justify-start px-2`),onSelect:eO,"data-sw-theme-option":e.id,children:[(0,Y.jsx)(`span`,{className:K(`h-4 w-4 shrink-0 rounded-full ring-1 ring-line`,`sw-swatch-${e.id}`),"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.label})]},e.id))}),u?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_,{}),(0,Y.jsxs)(T,{onSelect:()=>wT(b.current),"data-sw-app-about":`menu`,children:[(0,Y.jsx)(Xh,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`About Shapewall and updates`}),(0,Y.jsxs)(`span`,{className:`text-caption text-faint tabular-nums`,"data-sw-app-version":!0,children:[`v`,mT.version]})]}),(0,Y.jsx)(T,{asChild:!0,"data-sw-app-contact":`menu`,children:(0,Y.jsxs)(`a`,{href:pT,target:`_blank`,rel:`noopener noreferrer`,children:[(0,Y.jsx)(gg,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Contact`})]})})]}):null]})]})}function iO(e){return e?.public?`Visitor, public board (view only)`:e?.guest?`Guest, through a share link`:e?.hosted?[e.user?.handle?`@${e.user.handle}`:null,aO(e.role)].filter(Boolean).join(` · `):`A board on this machine`}var aO=e=>e?e[0].toUpperCase()+e.slice(1):null;function oO({info:e,localName:t,onOpenBuzz:n,demo:r,localSettingsAvailable:i,settingsAvailable:a,openSettings:o,setShareOpen:s,side:c,align:l,showName:u,triggerClassName:d}){return(0,Y.jsx)(rO,{name:e?.user?.name||t||null,avatarUrl:e?.user?.avatarUrl,detail:iO(e),items:[...e?.buzzAvailable===!0?[{id:`buzz`,label:`Existing Buzz conversation`,icon:o_,onSelect:n,"data-sw-buzz-open":`true`}]:[],...i?[{id:`account`,label:`Account and security`,icon:M_,onSelect:()=>Oe(`/account`)},{id:`console`,label:`Workspace Console`,icon:Jm,onSelect:()=>Oe(`/console`)}]:a?[{id:`settings`,label:`Settings`,icon:o_,onSelect:o,"data-sw-settings-open":`profile`}]:[],...e?.shareEnabled?[{id:`share`,label:`Share with your team...`,icon:Jm,onSelect:()=>s(!0)}]:[],...e?.consoleUrl&&!e?.guest?[{id:`console`,label:`Workspace Console`,icon:Jm,onSelect:()=>Oe(e.consoleUrl)}]:[],...e?.public&&typeof e.reportUrl==`string`&&e.reportUrl.startsWith(`mailto:`)?[{id:`report`,label:`Report this board`,icon:Ah,onSelect:()=>Oe(e.reportUrl)}]:[],...r?[r.resetItem]:[]],viewAs:r?.viewAs||null,side:c,align:l,showName:u,triggerClassName:d})}var sO=[`full`,`search`,`panels`,`view`,`viewport`,`tight`],cO={pad:12,gap:6,zoneGap:20,tightGap:4,tightZoneGap:12,search:{min:240,max:320,icon:32},name:[200,176,152,128,104,104],journey:[160,128,96],journeyMax:280};function lO(e){let t=t=>e>=sO.indexOf(t);return{search:t(`search`),panels:t(`panels`),view:t(`view`),viewport:t(`viewport`),comment:t(`tight`),tight:t(`tight`)}}function uO(e,t,n=lO(t).tight?cO.tightGap:cO.gap){let r=e.filter(Boolean);if(!r.length)return 0;let i=lO(t),a=e=>e.at&&i[e.at]?e.compact:Array.isArray(e.full)?e.full[t]:e.full;return r.reduce((e,t)=>e+a(t),0)+n*(r.length-1)}function dO({text:e,title:t,viewports:n=[],capture:r=!1,status:i={kind:`dot`},viewer:a=!1,comment:o=!1,panels:s={comments:0,agent:!1,checks:!1},settings:c=!1,journey:l=null}){let u=(t,n)=>Math.ceil(e(String(t),n))+1,d={left:[],right:[]};n.length>1&&d.left.push({id:`viewport`,full:6+n.reduce((e,t)=>e+20+u(t,`xs`),0),compact:6+n.length*30,at:`viewport`});let f=l?u(l,`ui`):0,p=e=>Math.min(f,cO.journey[Math.min(e,cO.journey.length-1)]);d.left.push({id:`view`,full:l?sO.map((e,t)=>41+p(t)+27):41+u(`Views`,`ui`),...l?{grow:sO.map((e,t)=>Math.max(0,Math.min(f,cO.journeyMax)-p(t)))}:{},compact:32,at:`view`}),r&&d.left.push({id:`capture`,full:32}),d.left.push({id:`capture-status`,full:i.kind===`running`?18+u(i.progress||`Capturing`,`xs`):i.kind===`failed`?28+u(`Capture failed`,`xs`):16}),a&&d.right.push({id:`viewer`,full:40+u(`Viewer`,`xs`)}),o&&d.right.push({id:`comment`,full:45+u(`Comment`,`ui`),compact:32,at:`comment`});let m=12+u(s.comments,`count`),h=[{full:46+u(`Comments`,`ui`)+m,compact:40+m}];s.agent&&h.push({full:40+u(`Agent`,`ui`),compact:34}),s.checks&&h.push({full:40+u(`Checks`,`ui`),compact:34});let g=2*(h.length-1);return d.right.push({id:`panels`,full:h.reduce((e,t)=>e+t.full,g),compact:h.reduce((e,t)=>e+t.compact,g),at:`panels`}),c&&d.right.push({id:`settings`,full:32}),{name:40+u(t,`name`),left:d.left,right:d.right,searchIcon:!!l}}function fO(e,t,n){let r=e.find(e=>e.id===`view`&&e.grow);return!r||lO(t).view?0:(Array.isArray(r.full)?r.full[t]-41-27:0)+Math.max(0,Math.min(r.grow[t],Math.floor(n)))}function pO({width:e,name:t,left:n=[],right:r=[],searchIcon:i=!1,config:a=cO}){let o=Math.max(0,e-2*a.pad),s=sO.length-1,c=e=>{let i=lO(e).tight,o=i?a.tightGap:a.gap,s=uO(n,e,o);return{left:Math.min(t,a.name[e])+(s?o+s:0),right:uO(r,e,o),zoneGap:i?a.tightZoneGap:a.zoneGap}};for(let e=+!!i;e<=s;e+=1){let t=c(e),r=o-2*(Math.max(t.left,t.right)+t.zoneGap);if(e===0){if(r>=a.search.min)return{step:e,centred:!0,search:Math.min(a.search.max,r),journey:0}}else{if(i){let r=o-t.left-t.right-a.search.icon-2*t.zoneGap;if(r<0)continue;let i=fO(n,e,r),s=(o-a.search.icon)/2-t.zoneGap,c=t.left+i-fO(n,e,0);return{step:e,centred:c<=s&&t.right<=s,search:0,journey:i}}if(r>=a.search.icon)return{step:e,centred:!0,search:0,journey:0}}}return{step:s,centred:!1,search:0,journey:fO(n,s,0)}}var mO={name:`600 14px`,ui:`500 13px`,xs:`500 12px`,count:`600 11px`},hO;function gO(e,t){return typeof document>`u`||(hO||=document.createElement(`canvas`).getContext(`2d`),!hO)?e.length*8:(hO.font=`${mO[t]} ${getComputedStyle(document.body).fontFamily}`,hO.measureText(e).width)}function _O(e,t){let[n,r]=(0,J.useState)(()=>typeof window>`u`?1280:window.innerWidth);return(0,J.useLayoutEffect)(()=>{let n=e.current;if(!t||!n)return;let i=()=>r(Math.round(n.getBoundingClientRect().width));if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(n),()=>a.disconnect()},[e,t]),n}function vO({labels:e,allOpen:t,panelHidden:n,chatAvailable:r,chatThread:i,reopenChat:a,checksOpen:o,canChecks:s,openChecks:c,closeChecks:l,updateParams:u}){let d=!n&&!i&&!o,f=`h-8 text-ui`;return(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,role:`group`,"aria-label":`Side panel`,children:[(0,Y.jsx)(h,{content:`${d?`Hide`:`Show`} comments (${t} open)`,side:`bottom`,children:(0,Y.jsxs)(ke,{variant:`flat`,className:f,pressed:d,onPressedChange:()=>u({panel:n||i||o?null:`off`,chat:null,checks:null,cv:null}),"aria-label":`Comments, ${t} open`,"data-sw-panel-toggle":`true`,children:[(0,Y.jsx)(wg,{size:14,"aria-hidden":`true`}),e?`Comments`:null,(0,Y.jsx)(`span`,{className:`tabular rounded-full bg-fg/[0.07] px-1.5 text-[11px] leading-4 font-semibold text-fg`,"aria-hidden":`true`,children:t})]})}),r?(0,Y.jsx)(h,{content:i?`Close the agent chat`:`Chat with your agent about this board`,side:`bottom`,children:(0,Y.jsxs)(ke,{variant:`flat`,className:f,pressed:!!i,"aria-label":`Agent`,onPressedChange:()=>i?u({chat:null}):a(),"data-sw-chat-toggle":`true`,children:[(0,Y.jsx)(S,{size:14,"aria-hidden":`true`}),e?`Agent`:null]})}):null,s?(0,Y.jsx)(h,{content:o?`Close the checks`:`Page checks: performance, accessibility, SEO`,side:`bottom`,align:`end`,children:(0,Y.jsxs)(ke,{variant:`flat`,className:f,pressed:!!o,"aria-label":`Checks`,onPressedChange:()=>o?l():c(),"data-sw-checks-toggle":`true`,children:[(0,Y.jsx)(Ah,{size:14,"aria-hidden":`true`}),e?`Checks`:null]})}):null]})}function yO({wide:e,info:t,boardId:n,boards:i,data:a,localProjects:o,projectsError:s,localName:c,onPickBoard:l,onOpenBuzz:u,demo:d,localSettingsAvailable:f,settingsAvailable:p,openSettings:m,setShareOpen:g,modes:_,mode:v,setMode:y,viewportNotice:b,canComment:x,comparePair:S,commentMode:C,setCommentMode:w,openPalette:T,setMenuOpen:E,showLinks:D,toggleLinks:O,linksTip:k,brokenLinks:A,canCompare:j,toggleCompare:M,minimapOn:N,toggleMinimap:P,journeys:F=[],journey:ee,openJourney:I,closeJourney:L,canEditJourneys:R,startBuilder:B,openBrokenLinks:V,capture:H,busy:U,canCapture:te,setCaptureConfirm:ne,chatAvailable:re,chatThread:ie,reopenChat:ae,updateParams:G,panelHidden:oe,checksOpen:se,allOpen:ce,canChecks:le,openChecks:ue,closeChecks:fe,setSheetOpen:me,sidebarTitled:ge}){let ve=i.find(e=>e.id===n)?.title||a?.board?.title||n,ye=t?.hosted&&t?.project?.url&&t.role!==`guest`?t.project:null,be=!x&&t?.hosted&&t?.role===`viewer`,xe=x&&!S,Se=(0,J.useRef)(null),Ce=_O(Se,e),we=H?.running?`running`:H?.state===`failed`&&H.error?`failed`:`dot`,Te=H?.running&&H.total?`${H.done||0}/${H.total}`:`Capturing`,Ee=_.map(e=>e.label).join(`
34
+ `),ke=(0,J.useMemo)(()=>pO({width:Ce,...dO({text:gO,title:ve,viewports:Ee?Ee.split(`
35
+ `):[],capture:!!te,status:{kind:we,progress:Te},viewer:be,comment:xe,panels:{comments:ce,agent:!!re,checks:!!le},settings:!!p,journey:ee?.name||null})}),[Ce,ve,Ee,te,we,Te,be,xe,ce,re,le,p,ee?.name]),Ae=lO(ke.step),je=(0,Y.jsx)(oO,{info:t,localName:c,onOpenBuzz:u,demo:d,localSettingsAvailable:f,settingsAvailable:p,openSettings:m,setShareOpen:g}),Ne=(0,Y.jsxs)(Ve,{value:n,onValueChange:e=>{if(!e.startsWith(`project/`))return l(e);let t=o.find(t=>`project/${t.id}`===e);t?.url&&t.running&&Oe(t.url)},children:[(0,Y.jsx)(he,{size:e?`sm`:`touch`,className:e?K(`max-w-72 min-w-0 border-transparent bg-transparent px-2.5 text-sm font-semibold shadow-none hover:bg-surface-2 data-[state=open]:bg-surface-2`,ye&&`h-6`):`min-w-0 flex-1 border-transparent bg-transparent px-2 text-[15px] font-semibold shadow-none`,"aria-label":`Board: ${ve}`,"data-sw-picker":`true`,children:(0,Y.jsx)(W,{children:(0,Y.jsx)(`span`,{className:`block truncate`,children:ve})})}),(0,Y.jsxs)(de,{children:[(0,Y.jsxs)(pe,{children:[o.length>1||ye?(0,Y.jsx)(De,{children:ye?ye.name:`This project`}):null,i.map(t=>(0,Y.jsx)(Me,{value:t.id,children:e?`${t.title} · ${t.pageCount} pages`:t.title},t.id))]}),o.length>1?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_e,{}),(0,Y.jsxs)(pe,{children:[(0,Y.jsx)(De,{children:`Local projects`}),o.map(e=>(0,Y.jsxs)(Me,{value:`project/${e.id}`,disabled:e.current||!e.running,"data-sw-local-project":e.id,children:[e.title,e.current?` (current)`:e.running?``:` (not running)`]},e.id))]}),o.some(e=>!e.running&&!e.current)?(0,Y.jsx)(`p`,{className:`max-w-72 px-2 py-1.5 text-xs text-muted`,children:`Start a stopped project with shapewall serve in its folder.`}):null]}):null,s?(0,Y.jsx)(`p`,{className:`max-w-72 px-2 py-1.5 text-xs text-bad`,children:`Could not load local projects. Check the terminal for your project index.`}):null]})]});if(!e)return(0,Y.jsxs)(`header`,{className:`flex shrink-0 items-center gap-1 border-b border-line bg-surface px-2 py-1.5`,"data-sw-toolbar":`compact`,children:[(0,Y.jsx)(`h1`,{className:`sr-only`,children:`Shapewall`}),Ne,x&&!S?(0,Y.jsx)(z,{size:`icon`,variant:C?`default`:`soft`,className:`shrink-0`,"aria-pressed":C,onClick:()=>w(e=>!e),label:C?`Stop commenting`:`Comment: tap a page to pin`,"data-sw-comment-mode":`true`,children:(0,Y.jsx)(Sg,{size:19,"aria-hidden":`true`})}):null,be?(0,Y.jsx)(WT,{compact:!0}):null,(0,Y.jsxs)(r,{size:`touch`,variant:`ghost`,className:`shrink-0 gap-1.5 px-2.5 text-fg`,onClick:()=>{fe(),me(!0)},"aria-label":`Comments, ${ce} open`,"data-sw-panel-toggle":`true`,children:[(0,Y.jsx)(wg,{size:18,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`tabular text-[13px] font-semibold`,children:ce})]}),(0,Y.jsx)(z,{size:`icon`,variant:`ghost`,className:`shrink-0 text-fg`,onClick:()=>E(!0),label:re?`More: agent, pages, views, screen size`:`More: pages, views, screen size`,"data-sw-menu":`true`,children:(0,Y.jsx)(vh,{size:19,"aria-hidden":`true`})}),je]});let Pe=_.map(e=>{let t=e.id===`all`?e_:fv(e.id);return{id:e.id,tooltip:Ae.viewport?e.label:null,label:Ae.viewport?(0,Y.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Y.jsx)(t,{size:14,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.label})]}):e.label}}),q=(0,Y.jsx)(QD,{data:a,capture:H}),Fe=Ae.tight?`gap-1`:`gap-1.5`;return(0,Y.jsxs)(`header`,{ref:Se,className:K(`grid h-14 shrink-0 items-center border-b border-line bg-surface px-3`,Ae.tight?`gap-x-3`:`gap-x-5`,ke.centred?`grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]`:`grid-cols-[auto_auto_minmax(0,1fr)]`),"data-sw-toolbar":`full`,"data-sw-toolbar-fit":sO[ke.step],"data-sw-toolbar-centred":ke.centred?`true`:`false`,children:[(0,Y.jsxs)(`h1`,{className:`sr-only`,children:[`Shapewall: `,ve]}),(0,Y.jsxs)(`div`,{className:K(`flex min-w-0 items-center`,Fe),"data-sw-toolbar-zone":`left`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col justify-center`,style:ke.centred?void 0:{maxWidth:cO.name[ke.step]},children:[ye&&!ge?(0,Y.jsx)(GT,{project:ye}):null,Ne]}),te?null:q,_.length>1?(0,Y.jsx)(`span`,{className:K(`shrink-0 rounded-md`,b&&`animate-flash`),"data-sw-viewport-flash":b?b.to:void 0,children:(0,Y.jsx)(ze,{label:`Screen size`,options:Pe,value:v,onChange:y,itemClassName:Ae.viewport?`px-2`:void 0})},b?.at||`still`):null,(0,Y.jsx)(ZD,{journeys:F,journey:ee,openJourney:I,closeJourney:L,canEditJourneys:R,startBuilder:B,showLinks:D,toggleLinks:O,linksTip:k,brokenLinks:A,openBrokenLinks:V,canCompare:j,comparePair:S,toggleCompare:M,minimapOn:N,toggleMinimap:P,compact:Ae.view,labelMax:ke.journey||cO.journey[Math.min(ke.step,cO.journey.length-1)]}),te?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(z,{variant:`ghost`,className:`shrink-0 text-fg`,disabled:H?.running||U,onClick:()=>ne(!0),label:`Capture now`,tooltip:`Recapture every page`,side:`bottom`,"data-sw-capture":`true`,children:(0,Y.jsx)(Xm,{size:16,"aria-hidden":`true`})}),q]}):null]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center justify-center`,"data-sw-toolbar-zone":`center`,children:(0,Y.jsx)(h,{content:(0,Y.jsx)(JD,{label:`Go to a page, journey or comment`,keys:[cD]}),side:`bottom`,children:(0,Y.jsx)(hD,{onOpen:T,compact:Ae.search,style:Ae.search?void 0:{width:ke.search}})})}),(0,Y.jsxs)(`div`,{className:K(`flex min-w-0 items-center justify-end`,Fe),"data-sw-toolbar-zone":`right`,children:[be?(0,Y.jsx)(WT,{}):null,xe?(0,Y.jsx)(h,{content:(0,Y.jsx)(JD,{label:C?`Stop commenting`:`Click a page to pin a comment`,keys:C?[`C`,`Esc`]:[`C`]}),side:`bottom`,children:(0,Y.jsxs)(r,{variant:C?`default`:`soft`,className:K(`h-8 shrink-0 text-[13px]`,Ae.comment?`w-8 px-0`:`px-3`,C&&`ring-2 ring-accent/30`),"aria-pressed":C,onClick:()=>w(e=>!e),"data-sw-comment-mode":`true`,children:[(0,Y.jsx)(Sg,{size:15,"aria-hidden":`true`}),Ae.comment?(0,Y.jsx)(`span`,{className:`sr-only`,children:`Comment`}):`Comment`]})}):null,(0,Y.jsx)(vO,{labels:!Ae.panels,allOpen:ce,panelHidden:oe,chatAvailable:re,chatThread:ie,reopenChat:ae,checksOpen:se,canChecks:le,openChecks:ue,closeChecks:fe,updateParams:G}),p?(0,Y.jsx)(z,{variant:`ghost`,className:`shrink-0 text-fg`,onClick:m,label:`Agent settings`,tooltip:`Agent settings: which agent the chat uses`,side:`bottom`,"data-sw-settings-open":`true`,children:(0,Y.jsx)(o_,{size:16,"aria-hidden":`true`})}):null]})]})}function bO({menuOpen:e,setMenuOpen:t,data:n,chatAvailable:i,chatThread:a,reopenChat:o,groupedPages:s,jumpToPage:c,modes:l,mode:u,setMode:d,journeys:f,journey:p,canEditJourneys:m,openJourney:h,closeJourney:g,startBuilder:_,canChecks:v,openChecks:y,showLinks:b,toggleLinks:x,brokenLinks:C,canCompare:w,comparePair:T,toggleCompare:E,settingsAvailable:D,openSettings:O,capture:k,canCapture:A,busy:j,setCaptureConfirm:N}){let P=`mb-1.5 flex items-center gap-1 text-[11px] font-medium tracking-wide text-faint uppercase`,[F,ee]=(0,J.useState)(``),I=f.length>8,L=I?F.trim().toLowerCase():``,R=L?f.filter(e=>e.name.toLowerCase().includes(L)):f,z=e=>{t(!1),e?h(e):g()};return(0,Y.jsx)(M,{open:e,onClose:()=>t(!1),title:n?.board?.title||`Board`,children:(0,Y.jsxs)(`div`,{className:`space-y-5 p-5`,children:[l.length>1?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:P,children:`Screen size`}),(0,Y.jsx)(ze,{label:`Screen size`,options:l,value:u,onChange:e=>{d(e),t(!1)},large:!0})]}):null,i?(0,Y.jsxs)(r,{size:`touch`,className:`w-full justify-start`,variant:a?`default`:`secondary`,onClick:()=>{t(!1),o()},"data-sw-chat-toggle":`true`,children:[(0,Y.jsx)(S,{size:16,"aria-hidden":`true`}),` Chat with your agent`]}):null,(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{className:P,children:[(0,Y.jsx)(fg,{size:12,"aria-hidden":`true`}),` Go to a page`]}),(0,Y.jsx)(oD,{groups:s,onPick:e=>{t(!1),c(e)}})]}),f.length||m?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:P,children:`Journeys`}),I?(0,Y.jsx)(Ge,{size:`touch`,icon:n_,wrapperClassName:`mb-1.5`,value:F,onChange:e=>ee(e.target.value),placeholder:`Filter journeys`,"aria-label":`Filter journeys`,"data-sw-views-filter":`true`}):null,(0,Y.jsxs)(`div`,{className:I?`flex max-h-80 flex-col gap-1.5 overflow-y-auto`:`flex flex-col gap-1.5`,role:`radiogroup`,"aria-label":`Journeys`,"data-sw-journey-menu":`true`,children:[f.length&&!L?(0,Y.jsxs)(r,{size:`touch`,className:`w-full justify-start`,role:`radio`,"aria-checked":!p,variant:p?`secondary`:`default`,onClick:()=>z(null),"data-sw-journey-open":`none`,children:[(0,Y.jsx)(Sh,{size:15,"aria-hidden":`true`}),` None`,(0,Y.jsx)(`span`,{className:`ml-auto text-xs opacity-70`,children:`All pages`})]}):null,R.map(e=>(0,Y.jsxs)(r,{size:`touch`,className:`w-full justify-start`,role:`radio`,"aria-checked":p?.id===e.id,variant:p?.id===e.id?`default`:`secondary`,onClick:()=>z(e.id),"data-sw-journey-open":e.id,children:[(0,Y.jsx)(Qg,{size:15,"aria-hidden":`true`}),` `,(0,Y.jsx)(`span`,{className:`truncate`,children:e.name}),(0,Y.jsx)(`span`,{className:`ml-auto text-xs tabular-nums opacity-70`,children:XD(e)})]},e.id)),L&&!R.length?(0,Y.jsx)(`p`,{className:`px-1 text-sm text-muted`,children:`No journey matches.`}):null,m?(0,Y.jsxs)(r,{size:`touch`,variant:`ghost`,className:`w-full justify-start`,onClick:()=>{t(!1),_()},children:[(0,Y.jsx)(Hg,{size:15,"aria-hidden":`true`}),` New journey`]}):null]})]}):null,(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`p`,{className:P,children:`Show`}),v?(0,Y.jsxs)(r,{size:`touch`,className:`w-full justify-start`,variant:`secondary`,onClick:()=>{t(!1),y()},"data-sw-checks-toggle":`true`,children:[(0,Y.jsx)(Ah,{size:16,"aria-hidden":`true`}),`Checks`]}):null,(0,Y.jsxs)(r,{size:`touch`,className:`w-full justify-start`,"aria-pressed":b,variant:b?`default`:`secondary`,onClick:()=>{t(!1),x()},"data-sw-links-toggle":`true`,children:[(0,Y.jsx)(I_,{size:15,"aria-hidden":`true`}),` `,b?`Hide links between pages`:`Show links between pages`,(0,Y.jsx)(GD,{count:C.length})]}),w?(0,Y.jsxs)(r,{size:`touch`,className:`w-full justify-start`,"aria-pressed":!!T,variant:T?`default`:`secondary`,onClick:()=>{t(!1),E()},"data-sw-compare-toggle":`true`,children:[(0,Y.jsx)(Ph,{size:15,"aria-hidden":`true`}),` `,T?`Leave compare mode`:`Compare environments`]}):null,D?(0,Y.jsxs)(r,{size:`touch`,className:`w-full justify-start`,variant:`secondary`,onClick:()=>{t(!1),O()},"data-sw-settings-open":`true`,children:[(0,Y.jsx)(o_,{size:15,"aria-hidden":`true`}),` Agent settings`]}):null]}),(0,Y.jsxs)(`div`,{className:`space-y-2 border-t border-line pt-4`,children:[(0,Y.jsx)($D,{data:n,capture:k}),A?(0,Y.jsxs)(r,{size:`touch`,className:`w-full`,disabled:k?.running||j,onClick:()=>{t(!1),N(!0)},"data-sw-capture":`true`,children:[(0,Y.jsx)(Xm,{size:15,"aria-hidden":`true`}),` Capture now`]}):null]})]})})}function xO({wide:e,commentMode:t,canComment:n,readyKeys:i,setCommentMode:a,showLinks:o,activePage:s,shownSteps:c,data:l,presentPages:u,hiddenLinkTargets:d,showAllLinks:f,targetTitle:p,updateParams:m,tipOpen:h,tryOpen:_,journey:v,builder:y,viewportNotice:b,dismissTip:x,modes:S,setMode:C,comparePair:w}){let T=e=>S.find(t=>t.id===e)?.label||e,E=e?`Scroll or drag to move, Ctrl+scroll or pinch to zoom. Click a page for its actions${n&&!w?`, or press C to comment`:``}.`:`Pinch to zoom. Tap a page for its actions${n&&!w?`, or the comment button to pin a note`:``}.`;return(0,Y.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-30 flex flex-col items-center gap-1.5 px-2`,"data-sw-canvas-notes":`true`,children:[t&&n?(0,Y.jsxs)(`div`,{className:`pointer-events-auto flex w-max max-w-full items-center gap-2 rounded-full bg-accent py-0.5 pr-0.5 pl-3 text-xs font-medium text-accent-fg shadow-pop`,role:`status`,"data-sw-comment-hint":i.size?`element`:`page`,children:[(0,Y.jsx)(Sg,{size:13,className:`shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0`,children:i.size?e?`Click an element on the live page to comment on it.`:`Tap an element on the live page to comment on it.`:e?`Click a page to comment. Zoom in until the page goes live to pin it to an element.`:`Tap a page to pin a comment.`}),(0,Y.jsxs)(r,{size:e?`xs`:`touch`,variant:`inverse`,className:`shrink-0 rounded-full`,onClick:()=>a(!1),"data-sw-comment-hint-done":`true`,children:[`Done`,e?` (Esc)`:``]})]}):null,o&&!s&&!c&&G_(l?.links,u,d)>150?(0,Y.jsx)(`p`,{className:`w-max max-w-full rounded-full bg-surface px-3 py-1 text-xs font-medium text-muted shadow-pop`,"data-sw-links-hint":`true`,children:e?`Hover or select a page to see its links`:`Tap a page to see its links`}):null,o&&(d?.size||f)?(0,Y.jsxs)(`div`,{className:`pointer-events-auto flex w-max max-w-full items-center gap-2 rounded-full border border-line bg-surface py-0.5 pr-0.5 pl-3 text-xs text-muted shadow-pop`,"data-sw-links-global":f?`shown`:`hidden`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:f?`Showing every link, the nav and footer ones too.`:`Hiding the nav and footer links (to ${[...d].slice(0,3).map(e=>p(e)).join(`, `)}${d.size>3?` and ${d.size-3} more`:``}).`}),(0,Y.jsx)(r,{size:e?`xs`:`touch`,variant:`ghost`,className:`shrink-0 rounded-full`,onClick:()=>m({la:f?null:`1`}),"data-sw-links-global-toggle":`true`,children:f?`Hide them`:`Show them`})]}):null,h&&!_&&l&&!t&&!o&&!v&&!y&&!b?(0,Y.jsxs)(`div`,{className:`pointer-events-auto flex w-max max-w-full items-center gap-1.5 rounded-full border border-line bg-surface py-0.5 pr-0.5 pl-3 text-xs text-fg shadow-pop`,role:`note`,"data-sw-tip":`true`,children:[(0,Y.jsx)(ng,{size:13,className:`shrink-0 text-accent`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`min-w-0`,children:E}),(0,Y.jsx)(z,{size:e?`icon-xs`:`icon`,variant:`ghost`,className:`shrink-0 rounded-full shadow-none`,onClick:x,label:`Dismiss the tip`,"data-sw-tip-dismiss":`true`,children:(0,Y.jsx)(g,{size:14,"aria-hidden":`true`})})]}):null,b?(0,Y.jsxs)(`div`,{className:`pointer-events-auto flex w-max max-w-full items-center gap-2 rounded-lg border border-line bg-surface py-1 pr-1 pl-3 text-xs text-fg shadow-pop`,role:`status`,"data-sw-viewport-notice":b.to,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[`Showing `,T(b.to),`: comment #`,b.id,` is on the `,b.to,` capture.`]}),(0,Y.jsxs)(r,{size:e?`xs`:`touch`,variant:`secondary`,className:`shrink-0`,onClick:()=>C(b.from),"data-sw-viewport-notice-back":`true`,children:[`Back to `,T(b.from)]})]}):null]})}var SO=e=>e?.tool?`${e.owner}\n${e.key}`:``;function CO(e){let t=cx(SO);return e&&!!t}function wO({flow:e,canvasRef:t,targets:n,focusFor:r,shotFor:i}){let a=cx(SO),o=(0,J.useRef)(null),s=(0,J.useRef)({targets:n,focusFor:r,shotFor:i,active:a});return s.current={targets:n,focusFor:r,shotFor:i,active:a},(0,J.useEffect)(()=>{if(!a){o.current&&e.setViewport(o.current,{duration:kE(400)}),o.current=null;return}let[n,r]=a.split(`
36
+ `),i=r.lastIndexOf(`|`),[c,l]=[r.slice(0,i),r.slice(i+1)],u=s.current.targets?.[c],d=u?.frames.find(e=>e.viewport===l);if(!d)return;o.current||=e.getViewport();let f=!1;return DE(s.current.shotFor(c,l)).catch(()=>1).then(r=>{if(f||s.current.active!==a)return;let i=Math.min(1,Math.max(0,s.current.focusFor(n))),o=Math.min(1,Math.max(.25,r,i+.08)),c=qE({x:u.x+d.x,y:u.y+d.y,width:d.w,height:d.h*o},t.current?.getBoundingClientRect(),i/o);c&&e.setViewport(c,{duration:kE(450)})}),()=>{f=!0}},[a,e,t]),a?(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-30 flex justify-center px-2`,"data-sw-drawing-mode":`true`,children:(0,Y.jsx)(Ox,{owner:a.split(`
37
+ `)[0]})}):null}function TO(){let[e,t]=(0,J.useState)(null),[n,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{e||r(!1)},[e]),(0,J.useEffect)(()=>{if(!e||n)return;let r=window.setTimeout(()=>t(t=>t===e?null:t),6e3);return()=>window.clearTimeout(r)},[e,n]),[e,t,r]}function EO(e,t){let n=!!e?.untilSheet;(0,J.useEffect)(()=>{if(!n)return;let e=()=>{document.querySelector(`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`)&&t(e=>e?.untilSheet?null:e)};e();let r=new MutationObserver(e);return r.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`]}),()=>r.disconnect()},[n,t])}function DO({toast:e,setToast:t,onHold:n,wide:i,raised:a}){return EO(e,t),e?(0,Y.jsxs)(`div`,{onMouseEnter:()=>n?.(!0),onMouseLeave:()=>n?.(!1),onFocus:()=>n?.(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||n?.(!1)},className:K(`absolute inset-x-0 z-[80] mx-auto flex w-max max-w-[calc(100%-1rem)] animate-pop-in items-center gap-2 rounded-lg bg-fg py-1 pr-1 pl-3 text-xs font-medium text-surface shadow-pop`,a?i?`bottom-28`:`bottom-44`:i?`bottom-4`:`bottom-16`),role:`status`,"data-sw-toast":`true`,children:[(0,Y.jsx)(`span`,{className:`min-w-0`,children:e.text}),e.undo?(0,Y.jsx)(r,{size:i?`xs`:`touch`,variant:`inverse`,onClick:()=>{e.undo(),t(null)},"data-sw-toast-undo":`true`,children:`Undo`}):null,(0,Y.jsx)(z,{size:i?`icon-xs`:`icon`,variant:`inverse`,onClick:()=>t(null),label:`Dismiss`,children:(0,Y.jsx)(g,{size:13,"aria-hidden":`true`})})]},e.at):null}function OO({notice:e,setNotice:t,wide:n}){return e?(0,Y.jsxs)(`div`,{className:K(`flex shrink-0 items-center gap-3 border-b border-line px-4 py-2 text-xs`,e.tone===`bad`?`bg-bad/10 text-bad`:`bg-accent/10 text-fg`),role:e.tone===`bad`?`alert`:`status`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.text}),(0,Y.jsx)(r,{variant:`ghost`,size:n?`xs`:`touch`,onClick:()=>t(null),children:`Dismiss`})]}):null}var kO=(0,J.lazy)(()=>xT(()=>import(`./ChecksPanel-BqrS02Ih.js`),__vite__mapDeps([3,1,2,4,5]),import.meta.url)),AO=(0,J.lazy)(()=>xT(()=>import(`./BoardChat-CupOxioV.js`),__vite__mapDeps([6,1,7,5,2,4]),import.meta.url));function jO({wide:e,checksOpen:t,checksProps:n,chatThread:r,chatProps:i,panelHidden:a,panelProps:o,updateParams:s}){return e&&t?(0,Y.jsx)(LO,{panel:`checks`,defaultWidth:384,"aria-label":`Checks`,children:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(`p`,{className:`p-4 text-sm text-muted`,children:`Loading checks…`}),children:(0,Y.jsx)(kO,{...n})})},`checks`):e&&r?(0,Y.jsx)(LO,{panel:`agent`,defaultWidth:384,"aria-label":`Agent`,children:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(V_,{}),children:(0,Y.jsx)(AO,{...i,onClose:()=>s({chat:null})})})},`agent`):e&&!a?(0,Y.jsx)(LO,{panel:`comments`,defaultWidth:384,id:`sw-comments`,tabIndex:-1,className:`outline-none`,"aria-label":`Comments`,children:(0,Y.jsx)(MC,{...o,onClose:()=>s({panel:`off`})})},`comments`):null}var MO=280,NO=.6,PO=16,FO=`side`;function IO(e){let t=Math.max(MO,Math.floor(window.innerWidth*NO));return Math.min(t,Math.max(MO,Math.round(e)))}function LO({panel:e,defaultWidth:t,className:n,children:r,...i}){let[a,o]=(0,J.useState)(()=>IO(rD(FO)??t)),[s,c]=(0,J.useState)(!1),l=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=()=>o(e=>IO(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let u=e=>{let n=IO(e);o(n),iD(FO,n===t?null:n)},d=e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),l.current={x:e.clientX,width:a},c(!0))},f=e=>{l.current&&o(IO(l.current.width+l.current.x-e.clientX))},p=e=>{l.current&&(u(l.current.width+l.current.x-e.clientX),l.current=null,c(!1))},m=e=>{let n=e.shiftKey?64:PO;if(e.key===`ArrowLeft`)u(a+n);else if(e.key===`ArrowRight`)u(a-n);else if(e.key===`Home`)u(t);else return;e.preventDefault()};return(0,Y.jsxs)(`aside`,{className:K(`relative flex shrink-0 flex-col border-l border-line bg-surface`,n),style:{width:a},"data-sw-rail":e,...i,children:[(0,Y.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize panel`,"aria-valuenow":a,"aria-valuemin":MO,"aria-valuemax":Math.max(MO,Math.floor(window.innerWidth*NO)),"aria-description":`Drag or use the arrow keys to resize. Double-click or press Home to reset.`,tabIndex:0,className:`group absolute inset-y-0 -left-1.5 z-20 w-3 cursor-col-resize touch-none outline-none`,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onDoubleClick:()=>u(t),onKeyDown:m,"data-sw-rail-handle":`true`,children:(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:K(`absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 bg-accent opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-100`,s&&`opacity-100`)})}),s?(0,Y.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-col-resize`,"aria-hidden":`true`}):null,r]})}function RO({checksOpen:e,closeChecks:t,checksProps:n,chatAvailable:r,chatThread:i,chatProps:a,updateParams:o,sheetOpen:s,setSheetOpen:c,panelProps:l,threadSheet:u,threadProps:d,closeThread:f,selectedComment:p,targetTitle:m,draft:h,busy:g,setDraft:_,draftDescription:v,composerProps:y}){return(0,Y.jsxs)(Y.Fragment,{children:[e?(0,Y.jsx)(M,{open:!0,onClose:t,title:`Checks`,size:`md`,children:(0,Y.jsx)(`div`,{className:`flex h-[78dvh] min-h-0 flex-col`,children:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(`p`,{children:`Loading checks…`}),children:(0,Y.jsx)(kO,{...n})})})}):null,r?(0,Y.jsx)(M,{open:!!i,onClose:()=>o({chat:null}),title:`Agent`,size:`md`,children:(0,Y.jsx)(`div`,{className:`flex h-[78dvh] flex-col`,children:(0,Y.jsx)(J.Suspense,{fallback:(0,Y.jsx)(V_,{heading:!1}),children:(0,Y.jsx)(AO,{...a,heading:!1})})})}):null,(0,Y.jsx)(M,{open:s&&!e,onClose:()=>c(!1),title:`Comments`,size:`md`,children:(0,Y.jsx)(`div`,{className:`flex max-h-[70dvh] flex-col`,children:(0,Y.jsx)(MC,{...l,heading:!1})})}),(0,Y.jsx)(M,{open:u&&!!d&&!e,onClose:f,title:p?`#${p.id} · ${m(p.pageId)}`:`Comment`,description:p?`${p.viewport} capture`:void 0,size:`md`,children:d?(0,Y.jsx)(`div`,{className:`flex max-h-[72dvh] flex-col outline-none`,tabIndex:-1,"data-autofocus":!0,"data-sw-thread-sheet":p.id,children:(0,Y.jsx)(Gw,{...d})}):null}),(0,Y.jsx)(M,{open:!!h&&!e,onClose:()=>g?null:_(null),title:`New comment`,description:v,children:(0,Y.jsx)(`div`,{className:`p-4`,children:(0,Y.jsx)(WC,{...y,touch:!0})})})]})}var zO=e=>String(e).replace(/\/w\/[^/#?]+.*$/,`/account`),BO=`flex h-8 w-full items-center gap-2 rounded-md px-2.5 text-left text-[13px] outline-none focus-visible:outline-2 focus-visible:outline-accent`;function VO({journeys:e=[],journeyId:t=null,onJourney:n,canEditJourneys:r=!1,onNewJourney:i=null,bare:a=!1}){let[o,s]=(0,J.useState)(``),c=e.length>8,l=c?o.trim().toLowerCase():``,u=l?e.filter(e=>String(e.name||e.id).toLowerCase().includes(l)):e,d=e=>K(BO,e?`bg-accent/10 text-fg`:`text-fg/90 hover:bg-surface-2`),f=e=>K(`shrink-0`,e?`text-accent`:`text-faint`);return(0,Y.jsxs)(`div`,{className:K(`flex w-full flex-col`,!a&&`border-t border-line pt-2`),"data-sw-journeys-sidebar":`true`,children:[a?null:(0,Y.jsxs)(`p`,{className:`flex items-center px-2.5 pb-1 text-xs font-semibold text-faint`,children:[`Journeys `,(0,Y.jsx)(`span`,{className:`ml-1 font-normal tabular`,children:e.length})]}),c?(0,Y.jsx)(`div`,{className:`pb-2`,children:(0,Y.jsx)(Ge,{size:`sm`,icon:n_,value:o,onChange:e=>s(e.target.value.slice(0,80)),placeholder:`Filter journeys`,"aria-label":`Filter journeys`,"data-sw-journeys-filter":`true`})}):null,(0,Y.jsxs)(`ul`,{className:`pb-2`,"aria-label":`Journeys`,children:[e.length&&!l?(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,className:d(!t),"aria-current":t?void 0:`true`,onClick:()=>n(null),"data-sw-pages-journey":`none`,children:[(0,Y.jsx)(Sh,{size:14,"aria-hidden":`true`,className:f(!t)}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`None`}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-faint`,children:`Show all pages`})]})}):null,u.map(e=>{let r=e.id===t;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,className:d(r),"aria-current":r?`true`:void 0,onClick:()=>n(r?null:e.id),"data-sw-pages-journey":e.id,children:[(0,Y.jsx)(Qg,{size:14,"aria-hidden":`true`,className:f(r)}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name||e.id}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-faint tabular`,children:XD(e)})]})},e.id)}),l&&!u.length?(0,Y.jsxs)(`li`,{className:`px-2.5 py-3 text-sm text-muted`,children:[`No journey matches "`,o.trim(),`".`]}):null,e.length?null:(0,Y.jsx)(`li`,{className:`px-2.5 py-2 text-xs text-muted`,children:`No journeys yet.`}),r&&i?(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,className:K(BO,`text-muted hover:bg-surface-2 hover:text-fg`),onClick:i,"data-sw-journeys-new":`true`,children:[(0,Y.jsx)(Hg,{size:14,"aria-hidden":`true`,className:`shrink-0`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`New journey`})]})}):null]})]})}function HO({groups:e,comments:t,activePage:n,onPage:r,bare:i=!1}){let[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(()=>new Set),l=a.trim().toLowerCase(),u=(0,J.useMemo)(()=>{let e=new Map;for(let n of t||[])n.status===`open`&&e.set(n.pageId,(e.get(n.pageId)||0)+1);return e},[t]),d=e.map(e=>({...e,pages:l?e.pages.filter(t=>`${t.title} ${t.path||``} ${e.group}`.toLowerCase().includes(l)):e.pages})).filter(e=>e.pages.length),f=e=>c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),p=e.reduce((e,t)=>e+t.pages.length,0);return(0,Y.jsxs)(`div`,{className:K(`flex w-full flex-col`,!i&&`border-t border-line pt-2`),"data-sw-pages-sidebar":`true`,children:[i?null:(0,Y.jsxs)(`p`,{className:`flex items-center px-2.5 pb-1 text-xs font-semibold text-faint`,children:[`Pages `,(0,Y.jsx)(`span`,{className:`ml-1 font-normal tabular`,children:p})]}),(0,Y.jsx)(`div`,{className:`pb-2`,children:(0,Y.jsx)(Ge,{size:`sm`,icon:n_,value:a,onChange:e=>o(e.target.value.slice(0,80)),placeholder:`Filter pages`,"aria-label":`Filter pages`,"data-sw-pages-filter":`true`})}),(0,Y.jsxs)(`div`,{className:`pb-2`,children:[d.map(e=>{let t=s.has(e.group)&&!l;return(0,Y.jsxs)(`section`,{className:`mb-1`,"data-sw-pages-group":e.group,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-1 rounded-md px-2.5 text-xs font-semibold text-muted outline-none hover:text-fg focus-visible:outline-2 focus-visible:outline-accent`,"aria-expanded":!t,onClick:()=>f(e.group),children:[(0,Y.jsx)(H,{size:13,"aria-hidden":`true`,className:K(`transition-transform`,t&&`-rotate-90`)}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.group}),(0,Y.jsx)(`span`,{className:`ml-auto font-normal text-faint tabular`,children:e.pages.length})]}),t?null:(0,Y.jsx)(`ul`,{className:`ml-4`,children:e.pages.map((t,i)=>{let a=u.get(t.id)||0,o=t.id===n,s=i===e.pages.length-1;return(0,Y.jsx)(`li`,{className:K(`relative pl-3 before:pointer-events-none before:absolute before:top-0 before:left-0 before:h-4 before:w-2.5 before:rounded-bl-md before:border-b before:border-l`,o?`before:border-accent/60`:`before:border-line-strong/70`,!s&&`after:pointer-events-none after:absolute after:inset-y-0 after:left-0 after:border-l after:border-line-strong/70`),"data-sw-pages-wire":`true`,children:(0,Y.jsxs)(`button`,{type:`button`,className:K(`flex h-8 w-full items-center gap-2 rounded-md px-2 text-left text-[13px] outline-none focus-visible:outline-2 focus-visible:outline-accent`,o?`bg-accent/10 text-fg`:`text-fg/90 hover:bg-surface-2`),"aria-current":o?`true`:void 0,onClick:()=>r(t.id),"data-sw-pages-item":t.id,children:[(0,Y.jsx)(Eh,{size:14,"aria-hidden":`true`,className:K(`shrink-0`,o?`text-accent`:`text-faint`)}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.title}),a?(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-muted tabular`,"aria-label":`${a} open`,children:a}):null]})},t.id)})})]},e.group)}),l&&!d.length?(0,Y.jsxs)(`p`,{className:`px-2.5 py-3 text-sm text-muted`,children:[`Nothing matches "`,a.trim(),`".`]}):null]})]})}var UO=`shapewall.sidebar.nav`,WO=[`pages`,`journeys`];function GO(){try{let e=window.localStorage.getItem(UO);return WO.includes(e)?e:`pages`}catch{return`pages`}}function KO({className:e=``}){return(0,Y.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-accent ${e}`,"aria-hidden":`true`,"data-sw-journey-dot":`true`})}function qO({groups:e,journeys:t=[],comments:n,activePage:r,journeyId:i,onPage:a,onJourney:o,canEditJourneys:s,onNewJourney:c}){let[l,u]=(0,J.useState)(GO),d=e.reduce((e,t)=>e+t.pages.length,0);if(!t.length&&!s)return(0,Y.jsx)(HO,{groups:e,comments:n,activePage:r,onPage:a});let f=e=>{u(e);try{window.localStorage.setItem(UO,e)}catch{}},p=`gap-1`;return(0,Y.jsxs)(ye,{value:l,onValueChange:f,className:`flex w-full flex-col border-t border-line pt-2`,"data-sw-sidebar-nav":l,children:[(0,Y.jsxs)(Ae,{"aria-label":`Pages and journeys`,className:`mb-2`,children:[(0,Y.jsxs)(Le,{value:`pages`,className:p,"data-sw-sidebar-tab":`pages`,children:[`Pages `,(0,Y.jsx)(`span`,{className:`font-normal text-faint tabular`,children:d})]}),(0,Y.jsxs)(Le,{value:`journeys`,className:p,"data-sw-sidebar-tab":`journeys`,children:[`Journeys `,(0,Y.jsx)(`span`,{className:`font-normal text-faint tabular`,children:t.length}),i?(0,Y.jsx)(KO,{className:`ml-0.5`}):null]})]}),(0,Y.jsx)(oe,{value:`pages`,tabIndex:-1,children:(0,Y.jsx)(HO,{bare:!0,groups:e,comments:n,activePage:r,onPage:a})}),(0,Y.jsx)(oe,{value:`journeys`,tabIndex:-1,children:(0,Y.jsx)(VO,{bare:!0,journeys:t,journeyId:i,onJourney:o,canEditJourneys:s,onNewJourney:c})})]})}function JO({info:e,localSettingsAvailable:t,setShareOpen:n}){let r=[{id:`board`,label:`Board`,icon:eg,href:`./`,active:!0}],i=e?.consoleUrl&&!e?.guest?e.consoleUrl:null;return i?(r.push({id:`workspace`,label:`Workspace`,icon:Jm,href:i}),r.push({id:`account`,label:`Account and security`,icon:M_,href:zO(i)})):t&&(r.push({id:`workspace`,label:`Workspace`,icon:Jm,href:`/console`}),r.push({id:`account`,label:`Account and security`,icon:M_,href:`/account`})),e?.shareEnabled&&r.push({id:`share`,label:`Share with your team`,icon:c_,onSelect:()=>n(!0)}),r}function YO({info:e,localName:t,onOpenBuzz:n,demo:r,localSettingsAvailable:i,settingsAvailable:a,openSettings:o,setShareOpen:s,expanded:c,onToggle:l,pages:u,quiet:d=!1}){let f=!!e&&!e.guest&&!e.public&&!e.share,p=typeof window>`u`?null:new URLSearchParams(window.location.search).get(`board`);(0,J.useEffect)(()=>{f&&OD(window.location.pathname+(p?`?board=`+encodeURIComponent(p):``))},[f,p]);let m=JO({info:e,localSettingsAvailable:i,setShareOpen:s}),h=!!u&&(u.journeys?.length>0||u.canEditJourneys),g=(e,t)=>n=>{e(),t?.(n)},_=!c&&u?[{id:`pages`,label:`Pages`,icon:Oh,flyout:({close:e})=>(0,Y.jsx)(HO,{groups:u.groups,comments:u.comments,activePage:u.activePage,onPage:g(e,u.onPage)})},...h?[{id:`journeys`,label:`Journeys`,icon:Qg,dot:!!u.journeyId,"data-sw-rail-journeys":u.journeyId||`none`,flyout:({close:e})=>(0,Y.jsx)(VO,{journeys:u.journeys,journeyId:u.journeyId,onJourney:g(e,u.onJourney),canEditJourneys:u.canEditJourneys,onNewJourney:u.onNewJourney?()=>g(e,u.onNewJourney)():null})}]:[]]:[];return(0,Y.jsx)(WD,{expanded:c,onToggle:l,home:`./`,homeLabel:`Shapewall`,title:e?.project?.name||e?.title,logo:(0,Y.jsx)(`img`,{src:`./favicon.svg`,alt:``,className:`h-7 w-7`}),items:m,sections:_,flyoutsDisabled:d,profile:c=>(0,Y.jsx)(oO,{info:e,localName:t,onOpenBuzz:n,demo:r,localSettingsAvailable:i,settingsAvailable:a,openSettings:o,setShareOpen:s,side:`right`,align:`end`,showName:c,triggerClassName:c?`w-full justify-start`:`w-10 min-w-10 px-0`}),children:u?(0,Y.jsx)(qO,{...u}):null})}var XO=(0,J.lazy)(()=>xT(()=>import(`./QuickConnect-B-4pUgXH.js`).then(e=>e.a).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([7,1,5,2]),import.meta.url)),ZO=(0,J.lazy)(()=>xT(()=>import(`./History-CQG3NQOC.js`),__vite__mapDeps([8,1]),import.meta.url)),QO=(0,J.lazy)(()=>xT(()=>import(`./ShareDialog-BouvNraR.js`).then(e=>({default:e.ShareDialog})),__vite__mapDeps([9,1]),import.meta.url)),$O=(0,J.lazy)(()=>xT(()=>import(`./LocalSettings-CSNMhNyV.js`),__vite__mapDeps([10,1,7,5,2]),import.meta.url));function ek({info:e,boardId:t,boards:n,wide:i,shareOpen:a,setShareOpen:o,refetchView:s,settingsAvailable:l,settingsOpen:u,updateParams:d,onInfoChanged:f,generalSettingsOpen:p,updates:m,historyPage:h,closeHistory:g,historyViewport:_,historyPageId:v,data:y,comments:b,filter:x,focusComment:S,onImageError:C,captureConfirm:w,setCaptureConfirm:T,busy:E,focusedPage:D,findPage:O,startCapture:k}){let A=ge(a),j=ge(u);return(0,Y.jsxs)(Y.Fragment,{children:[e?.shareEnabled&&A?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(QO,{open:a,onClose:()=>o(!1),boardId:t,onMoved:s})}):null,l&&j?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(XO,{open:u,onClose:()=>d({settings:null}),onSaved:f,touch:!i,buzz:e?.buzzAvailable===!0})}):null,p?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)($O,{open:!0,onClose:()=>d({settings:null}),info:e,boardCount:n.length,onSaved:f,touch:!i,onOpenUpdates:()=>{d({settings:null}),m.current?.open()}})}):null,h?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(ZO,{open:!!h,onClose:g,page:h,viewport:_,data:y,comments:b.filter(e=>e.pageId===v&&e.viewport===_),urlFor:(e,n)=>c(t,e.kind,n?e.thumb:e.file,e.version),onPickComment:e=>{g(),d({filter:e.status===`resolved`&&x===`open`?`all`:null}),S(e)},touch:!i,onImageError:C})}):null,(0,Y.jsx)(M,{open:w,onClose:()=>E?null:T(!1),title:`Capture every page now?`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r,{size:i?`md`:`touch`,onClick:()=>T(!1),disabled:E,children:`Cancel`}),D&&O(D)?(0,Y.jsxs)(r,{size:i?`md`:`touch`,onClick:()=>k(null,[D]),disabled:E,"data-sw-capture-only":D,children:[`Only `,O(D).title]}):null,(0,Y.jsx)(r,{size:i?`md`:`touch`,variant:`default`,onClick:()=>k(),disabled:E,"data-sw-capture-confirm":`true`,children:`Capture all`})]}),children:(0,Y.jsxs)(`p`,{className:`p-5 text-sm text-muted`,children:[`Shapewall captures all `,y?.board?.pages.length||``,` pages at every viewport`,D&&O(D)?` (or only ${O(D).title}, the selected page)`:``,`. Comments stay where they are; pins on live pages follow their elements. The board updates when it finishes.`]})})]})}var tk=2;function nk(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function rk({canvasRef:e,flow:t,targets:n,viewports:r,settledZoom:i,setSettledZoom:a,comparePair:o,captures:s,variantsById:c}){let l=(0,J.useRef)(null),[u,d]=(0,J.useState)(()=>new Set),[f,p]=(0,J.useState)(()=>new Set),m=(0,J.useCallback)((e,t)=>{p(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),h=(0,J.useCallback)((e,t)=>o?null:e.startsWith(`variant:`)?c.get(e)?.files?.[t]?.live||null:s?.[e]?.[t]?.live||null,[o,s,c]),g=(0,J.useCallback)(()=>{let a=e.current?.getBoundingClientRect();if(!a?.width||!i){d(e=>e.size?new Set:e);return}let{x:o,y:s,zoom:c}=t.getViewport(),u=[];for(let[e,t]of Object.entries(n))for(let n of t.frames){if(!h(e,n.viewport))continue;let i=(t.x+n.x)*c+o,d=(t.y+n.y)*c+s,f=n.w*c,p=n.h*c;if(i>a.width||d>a.height||i+f<0||d+p<0)continue;let m=`${e}|${n.viewport}`,g=l.current===m,_=Math.min((r[n.viewport]?.width||1440)*.4,a.width*.5);f<(g?_/2:_)||u.push({key:m,rank:g?-1:Math.hypot(i+f/2-a.width/2,d+p/2-a.height/2)})}u.sort((e,t)=>e.rank-t.rank);let f=new Set(u.slice(0,tk).map(e=>e.key));l.current&&!f.has(l.current)&&(l.current=null),d(e=>nk(e,f)?e:f)},[e,t,n,h,i,r]);return(0,J.useEffect)(()=>{g()},[g]),{liveKeys:u,readyKeys:f,setLiveReady:m,liveFileFor:h,recomputeLive:g,openLive:(0,J.useCallback)((r,i)=>{let o=n[r],s=o?.frames.find(e=>e.viewport===i),c=e.current?.getBoundingClientRect();s&&c?.width&&(l.current=`${r}|${i}`,a(null),t.fitBounds({x:o.x+s.x,y:o.y+s.y,width:s.w,height:Math.min(s.h,s.w*(c.height/c.width))},{padding:.04,duration:kE(450)}))},[e,t,n,a])}}function ik({journey:e,builder:t,goStep:n,step:r,closeJourney:i}){(0,J.useEffect)(()=>{if(!e||t)return;let a=e=>{if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||document.querySelector(`[role="dialog"]`))return;let t=e.target;t?.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(t?.tagName)||t?.closest?.(`[role="listbox"], [role="menu"]`)||((e.key===`ArrowRight`||e.key===`ArrowLeft`)&&(e.preventDefault(),n(r+(e.key===`ArrowRight`?1:-1))),e.key===`Escape`&&!document.querySelector(`[data-sw-thread-popover], [data-sw-composer-popover]`)&&(e.preventDefault(),i()))};return window.addEventListener(`keydown`,a),()=>window.removeEventListener(`keydown`,a)},[t,i,n,e,r])}function ak({commentMode:e,setCommentMode:t,canComment:n,comparePair:r,setDraft:i}){(0,J.useEffect)(()=>{if(!e)return;let n=e=>{e.key!==`Escape`||vS(e.target)||document.querySelector(`[role="dialog"], [role="menu"], [role="listbox"]`)||t(!1)};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,t]),(0,J.useEffect)(()=>{if(!n||r)return;let e=e=>{if(e.defaultPrevented&&!Ue(e)||e.altKey||e.ctrlKey||e.metaKey||e.repeat||e.key!==`c`&&e.key!==`C`)return;let n=e.target;n?.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(n?.tagName)||document.querySelector(`[role="dialog"]:not([data-sw-thread-popover]), [role="menu"], [role="listbox"]`)||(e.preventDefault(),i(null),t(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n,r,t,i])}function ok({journeys:e,journey:t,builder:n,openJourney:r,closeJourney:i}){(0,J.useEffect)(()=>{if(!e.length||n)return;let a=n=>{if(n.defaultPrevented&&!Ue(n)||n.altKey||n.ctrlKey||n.metaKey||n.repeat||n.key!==`j`&&n.key!==`J`||vS(n.target)||document.querySelector(`[role="dialog"]:not([data-sw-thread-popover]), [role="menu"], [role="listbox"]`))return;n.preventDefault();let a=t?e.findIndex(e=>e.id===t.id):-1,o=e.length+1,s=(a+1+(n.shiftKey?-1:1)+o)%o-1;s<0?i():r(e[s].id)};return window.addEventListener(`keydown`,a),()=>window.removeEventListener(`keydown`,a)},[n,i,t,e,r])}function sk(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Array.isArray(e.branches)}function ck(e){let t=new Set,n=e=>{for(let r of e||[])if(typeof r==`string`)t.add(r);else if(sk(r))for(let e of r.branches)n(e.steps)};return n(e),[...t]}function lk(e){let t=[],n=[],r=(e,i,a)=>{let o=a;return e.forEach((e,a)=>{let s=i?`${i}:${a}`:String(a);if(typeof e==`string`){t.push({key:s,pageId:e});for(let e of o)n.push({from:e.key,to:s,label:e.label||null,branch:e.branch||null});o=[{key:s}];return}if(!sk(e))return;let c=[];e.branches.forEach((e,t)=>{let n=o.map(t=>({key:t.key,label:e.label,branch:e.id})),i=r(e.steps,`${s}:${t}`,n);e.end||c.push(...i)}),o=c}),o};return r(e||[],``,[]),{nodes:t,edges:n}}function uk(e,t=[]){let n=[],r=[],i=!1,a=(e,o,s)=>{for(let c=0;c<e.length;c+=1){if(i)return;let l=e[c],u=o?`${o}:${c}`:String(c);if(typeof l==`string`){n.push({key:u,pageId:l,branch:s});continue}if(!sk(l)||!l.branches.length)continue;let d=t[r.length],f=Math.max(0,l.branches.findIndex(e=>e.id===d)),p=l.branches[f];r.push({afterStep:n.length,options:l.branches.map(e=>({id:e.id,label:e.label,end:!!e.end})),chosen:p.id}),a(p.steps,`${u}:${f}`,p.label),p.end&&(i=!0)}};return a(e||[],``,null),{steps:n,forks:r,ended:i}}function dk(e,t,n){return[...e.forks.slice(0,t).map(e=>e.chosen),n]}function fk({boardId:e,view:t,updateParams:n,clearFocus:r,setCommentMode:i,journey:a,route:o,routePages:s,step:c,builder:l,setBuilder:u,busy:d,setBusy:f,setNotice:p,flow:m,targets:h,nodesReady:g,mode:_,comparePair:v,setSettledZoom:y}){let b=(0,J.useCallback)(e=>{r(),n({j:e||null,step:e?1:null,jc:null,jb:null})},[r,n]),x=(0,J.useCallback)(()=>n({j:null,step:null,jc:null,jb:null}),[n]),S=(0,J.useCallback)(e=>{s&&n({step:J_(e,s.length)})},[s,n]),C=(0,J.useCallback)((e,t)=>{o&&n({jb:dk(o,e,t).join(`,`)})},[o,n]),w=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(!a||!g||l){a||(w.current=null);return}let e=s[c-1],t=`${a.id}:${c}:${e}:${_}:${v}`;if(w.current===t)return;let n=h[e];n&&(w.current=t,y(null),m.fitBounds({x:n.x,y:n.y-48,width:n.w,height:n.h+48},{padding:.18,duration:kE(450)}))},[l,v,m,a,h,_,g,s,y,c]),ik({journey:a,builder:l,goStep:S,step:c,closeJourney:x});let T=(0,J.useCallback)((e=null)=>{i(!1),r(),u(e?{id:e.id,name:e.name,steps:structuredClone(e.steps),into:null}:{id:null,name:``,steps:[],into:null})},[r,u,i]),E=(0,J.useCallback)(e=>{u(t=>{if(!t||ck(t.steps).length>=50)return t;let n=structuredClone(t.steps),r=(t.into?n[t.into.fork]:null)?.branches?.[t.into.branch]?.steps||n;return r[r.length-1]===e?t:(r.push(e),{...t,steps:n})})},[u]),D=`/api/boards/${encodeURIComponent(e)}/journeys`;return{openJourney:b,closeJourney:x,goStep:S,chooseJourneyBranch:C,startBuilder:T,addBuilderStep:E,saveBuilder:async()=>{if(l&&!d){f(!0);try{let e={name:l.name,steps:l.steps},n=l.id?await Ke.patch(`${D}/${encodeURIComponent(l.id)}`,e):await Ke.post(D,e);await t.refetch(),u(null),w.current=null,b(n.journey.id)}catch(e){p({tone:`bad`,text:e.message||`The journey was not saved.`})}finally{f(!1)}}},removeJourney:async()=>{if(a&&!d){f(!0);try{await Ke.delete(`${D}/${encodeURIComponent(a.id)}`),x(),t.refetch()}catch(e){p({tone:`bad`,text:e.message||`The journey was not deleted.`})}finally{f(!1)}}}}}function pk({boardId:e,commentsQuery:t,view:n,info:r,localName:i,authorName:a,setBusy:o,setNotice:s,setToast:c,setDeletingIds:l,selectedCommentId:u,closeThread:d,wide:f,filter:p,allowed:m}){let h=(0,J.useRef)(new Map),g=(e,r=!1,{counts:i=!0}={})=>{t.setData(t=>{let n=Array.isArray(t?.comments)?t.comments:[];return r?{comments:n.filter(t=>t.id!==e.id)}:{comments:n.some(t=>t.id===e.id)?n.map(t=>t.id===e.id?e:t):[e,...n]}}),i&&n.refetch()},_=`/api/boards/${encodeURIComponent(e)}/comments`,v=async(e,t)=>{o(!0);try{let n=await Ke.post(`${_}/${e.id}/${t}`,{author:a()||void 0});g(n.comment),f&&t===`resolve`&&p===`open`&&d(),t===`resolve`&&m(`resolve`)&&c({at:Date.now(),text:`Resolved comment #${e.id}.`,undo:()=>v(n.comment,`reopen`)})}catch(e){s({tone:`bad`,text:e.message||`That did not save.`})}finally{o(!1)}},y=async(e,t,n={})=>{let{onImageError:r,images:i,drawing:c}=n;o(!0);try{let n=await Ke.post(`${_}/${e.id}/replies`,{body:t,author:a()||void 0,...i?.length?{images:i}:{},...c?{drawing:c}:{}});return g(n.comment),!0}catch(e){return r&&/image/.test(e.code||``)?r(e.message||`An image was not accepted.`):s({tone:`bad`,text:e.message||`That reply did not save.`}),!1}finally{o(!1)}},b=async(e,t)=>{o(!0);try{let n=await Ke.patch(`${_}/${e.id}`,{body:t});return g(n.comment),!0}catch(e){return s({tone:`bad`,text:e.message||`That edit did not save.`}),!1}finally{o(!1)}},x=async(e,t,n=null)=>{try{let a=await Ke.post(`${_}/${e.id}/reactions`,{emoji:t,...n?{replyId:n}:{},...r?.hosted?{}:{author:i||void 0}});g(a.comment,!1,{counts:!1})}catch(e){s({tone:`bad`,text:e.message||`That reaction did not save.`})}},S=async e=>{let t=new URL(window.location.href);t.searchParams.set(`c`,String(e.id)),t.searchParams.delete(`v`);try{await navigator.clipboard.writeText(t.href),s({tone:`info`,text:`Copied the link to comment #${e.id}.`})}catch{s({tone:`info`,text:`Link to comment #${e.id}: ${t.href}`})}},C=async e=>{o(!0);try{let t=await Ke.post(`${_}/${e.id}/github/issue`,{});g(t.comment),s({tone:`info`,text:`${t.created?`Opened`:`Already has`} GitHub issue #${t.issue.number}.`})}catch(e){s({tone:`bad`,text:e.message||`The GitHub issue was not created.`})}finally{o(!1)}},w=e=>{h.current.delete(e),l(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},T=async e=>{let t=h.current.get(e.id);if(t){window.clearTimeout(t.timer);try{await Ke.delete(`${_}/${e.id}`),g(e,!0)}catch(e){s({tone:`bad`,text:e.message||`That did not delete.`})}finally{w(e.id)}}},E=(0,J.useRef)(T);return E.current=T,(0,J.useEffect)(()=>{let e=()=>{for(let{comment:e}of[...h.current.values()])E.current(e)};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),e()}},[]),{commentsUrl:_,applyComment:g,setStatus:v,replyTo:y,editComment:b,reactTo:x,copyLink:S,githubIssue:C,removeComment:async e=>{u===e.id&&d(),l(t=>new Set(t).add(e.id));let t=window.setTimeout(()=>E.current(e),6e3);h.current.set(e.id,{comment:e,timer:t}),c({at:Date.now(),text:`Deleted comment #${e.id}.`,undo:()=>{window.clearTimeout(t),w(e.id)}})},sendToAgent:async e=>{let{dispatchHash:n}=e,i=!!(e.needsRunApproval&&[`admin`,`owner`].includes(r.role));o(!0);try{i&&await zT();let t=await Ke.post(`${_}/${e.id}/send-to-agent`,{dispatchHash:n,approve:i});g(t.comment)}catch(e){e.code===`comment_changed`?(t.refetch(),s({tone:`bad`,text:`This comment changed while you were approving it. Read it again, then send it.`})):s({tone:`bad`,text:e.message})}finally{o(!1)}}}}function mk(e){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(()=>new Set),c=Xe(`/api/boards/${encodeURIComponent(e)}`,{pollMs:r||t?2e3:o?0:3e4}),l=Xe(`/api/boards/${encodeURIComponent(e)}/comments`,{pollMs:o?0:t?1e3:2e4}),u=c.data,d=u?.capture;return(0,J.useEffect)(()=>{i(!!d?.running)},[d?.running]),{view:c,commentsQuery:l,data:u,capture:d,comments:(0,J.useMemo)(()=>{let e=Array.isArray(l.data?.comments)?l.data.comments:[];return a.size?e.filter(e=>!a.has(e.id)):e},[l.data,a]),fixRequest:t,setFixRequest:n,setPolling:i,deletingIds:a,setDeletingIds:s}}function hk({params:e,data:t,builder:n}){let r=(0,J.useMemo)(()=>Array.isArray(t?.journeys)?t.journeys:[],[t?.journeys]),i=n?null:r.find(t=>t.id===e.get(`j`))||null,a=e.get(`jb`)||``,o=(0,J.useMemo)(()=>i?uk(i.steps,a.split(`,`).filter(Boolean)):null,[i,a]),s=(0,J.useMemo)(()=>i?lk(i.steps):null,[i]),c=(0,J.useMemo)(()=>o?o.steps.map(e=>e.pageId):null,[o]);return{journeys:r,journey:i,route:o,routeGraph:s,routePages:c,step:J_(e.get(`step`),c?.length||0),journeyComments:!!i&&e.get(`jc`)===`1`}}var gk=40;function _k({pendingFocus:e,setPendingFocus:t,targets:n,viewports:r,flow:i,canvasRef:a,wide:o,setSettledZoom:s}){(0,J.useEffect)(()=>{if(!e)return;let c=Bv(n,e);if(!c){n[e.pageId]&&r[e.viewport]||t(null);return}t(null),s(null);let l=Math.max(i.getZoom(),1.2),u=a.current?.getBoundingClientRect(),d=n[e.pageId];if(o||!u?.width||!d){i.setCenter(c.x,c.y,{zoom:l,duration:kE(450)});return}let f=u.height*.28-c.y*l;d.y*l+f<gk&&(f=Math.min(gk-d.y*l,u.height*.45-c.y*l)),i.setViewport({x:u.width/2-c.x*l,y:f,zoom:l},{duration:kE(450)})},[a,i,n,e,t,s,r,o])}function vk({wide:e,nodesReady:t,initialCamera:n,selectedCommentId:r,canvasRef:i,nodes:a,flow:o,setSettledZoom:s}){let c=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(e||c.current||!t||(c.current=!0,n.current||r))return;let l=i.current?.getBoundingClientRect(),u=a.find(e=>e.type===`groupFrame`),d=u&&a.find(e=>e.type===`page`&&e.data?.page?.group===u.data.group);if(!l?.width||!u||!d){o.fitView(ME);return}let f=Math.min(u.width,d.width*2+72+2*(d.position.x-u.position.x)),p=Math.min(1.5,Math.max(.05,(l.width-16)/f)),m=12+44*Math.max(p,.45);s(null),o.setViewport({x:8-u.position.x*p,y:m-u.position.y*p,zoom:p})},[i,o,n,a,t,r,s,e])}function yk({mode:e,pendingFocus:t,shapeKey:n,clearFocus:r,fitBoard:i}){let a=(0,J.useRef)(e);(0,J.useEffect)(()=>{if(a.current===e||(a.current=e,r(),t))return;let n=window.setTimeout(i,60);return()=>window.clearTimeout(n)},[r,i,e,t]);let o=(0,J.useRef)(n);(0,J.useEffect)(()=>{if(o.current===n)return;o.current=n,r();let e=window.setTimeout(i,60);return()=>window.clearTimeout(e)},[r,i,n])}function bk({nodesReady:e,data:t,commentsLoaded:n,selectedCommentId:r,selectedComment:i,initialCamera:a,focusComment:o,deletingIds:s,setNotice:c,updateParams:l}){let u=(0,J.useRef)(!1);(0,J.useEffect)(()=>{!u.current&&e&&t&&(!r||n)&&(u.current=!0,i&&!a.current&&o(i))},[n,t,o,a,e,i,r]);let d=(0,J.useRef)(null);(0,J.useEffect)(()=>{r&&n&&!i&&!s.has(r)&&d.current!==r&&(d.current=r,c({tone:`bad`,text:`Comment #${r} was not found on this board. It may have been deleted.`}),l({c:null}))},[n,s,i,r,c,l])}function xk({selectedComment:e,visibleComments:t,focusComment:n,mode:r,viewports:i,modes:a}){let o=(0,J.useMemo)(()=>e&&!t.some(t=>t.id===e.id)?[e,...t]:t,[e,t]),s=e?o.findIndex(t=>t.id===e.id):-1;return{threadList:o,threadIndex:s,stepThread:e=>{o.length<2||s<0||n(o[(s+e+o.length)%o.length])},neighborNote:e=>{if(o.length<2||s<0||r===`all`)return null;let t=o[(s+e+o.length)%o.length];return t.viewport===r||!i[t.viewport]?null:`switches to ${a.find(e=>e.id===t.viewport)?.label||t.viewport}`}}}var Sk=[`issues`,`pages`,`seo`,`performance`,`history`],Ck=e=>Sk.includes(e)&&e!==`issues`?e:null;function wk({boardId:e,info:t,params:n,updateParams:r,pages:i}){let a=!!t?.checksAvailable,s=a&&!!n.get(`checks`),c=i?.some(e=>e.id===n.get(`checks`))?n.get(`checks`):null,l=n.get(`cv`)||null,u=Sk.includes(n.get(`ct`))?n.get(`ct`):`issues`,d=/^[a-z0-9][a-z0-9-]{0,63}$/.test(n.get(`ce`)||``)?n.get(`ce`):null,f=`/api/boards/${encodeURIComponent(e)}/checks`,p=d?`?env=${encodeURIComponent(d)}`:``,m=Xe(a?`${f}${p}`:null,{pollMs:o?0:3e4}),h=Xe(a&&s&&!o?`${f}/seo${p}`:null),g=a&&!o&&!t?.hosted,[_,v]=(0,J.useState)(!1),y=Xe(g&&s?`${f}/run`:null,{pollMs:_?1500:0}),b=y.data?.run||null,x=b?.state===`running`;(0,J.useEffect)(()=>v(x),[x]);let S=(0,J.useRef)(!1),{refetch:C}=m,{refetch:w}=h;(0,J.useEffect)(()=>{S.current&&!x&&(C(),w()),S.current=x},[x,C,w]);let[T,E]=(0,J.useState)(null),[D,O]=(0,J.useState)(!1),k=(0,J.useCallback)(async({pages:e=null,seo:t=!0}={})=>{O(!0),E(null);try{return await Ke.post(`${f}/run`,{seo:t,...e?{pages:e}:{},...d?{env:d}:{}}),v(!0),await y.refetch(),!0}catch(e){return E(e.message||`The checks run did not start.`),y.refetch(),!1}finally{O(!1)}},[f,d,y]),[A,j]=(0,J.useState)(!1),M=(0,J.useCallback)(async()=>{j(!0),E(null);try{await Ke.delete(`${f}/run`)}catch(e){E(e.message||`The checks run could not be stopped.`)}finally{j(!1),y.refetch()}},[f,y]),N=(0,J.useCallback)((e=null,t=null,n=null)=>r({checks:e||`all`,cv:t,chat:null,...n?{ct:Ck(n)}:{}}),[r]),P=(0,J.useCallback)(e=>r({ct:Ck(e)}),[r]),F=(0,J.useCallback)(()=>r({checks:null,cv:null,ct:null}),[r]),ee=(0,J.useMemo)(()=>{let e=new Map;for(let t of m.data?.views||[]){if([`stale`,`failed`].includes(t.state))continue;let n=t.runs?.reduce((e,t)=>e+(t.state===`stale`?0:t.actionable),0)??t.actionable;e.set(t.pageId,(e.get(t.pageId)||0)+n)}return e},[m.data]),I=g?{loading:y.loading,canRun:!!y.data?.canRun,reason:y.data?.reason||null,limit:y.data?.limit||100,privatePages:y.data?.privatePages||[],seoDefault:y.data?.seoDefault!==!1,run:b,starting:D,error:T,start:k,stop:M,stopping:A}:null,L=[`shapewall checks run`,`--board ${e}`,c?`--only ${c}`:null,d?`--env ${d}`:null,u===`seo`?`--seo`:null,`--limit 100`].filter(Boolean).join(` `);return{canChecks:a,checksOpen:s,checksPage:c,checksViewport:l,checksEnvironment:d,checksTab:u,setChecksTab:P,checksQuery:m,seoQuery:h,checksRun:I,checksPanelProps:{tab:u,onTab:P,seo:h.error?null:h.data,run:I,command:L},openChecks:N,closeChecks:F,checksCounts:ee}}function Tk({boardId:e,info:t,params:n,updateParams:r}){let i=!o&&!!t?.agent&&!(t?.remote?.noRemoteChat&&t?.remote?.kind!==`host`),a=n.get(`chat`)||``,s=i?ww(a):null,c=!!(t?.agent?.settingsEditable||t?.agent?.settingsReadonly),l=!o&&!E&&!t?.consoleUrl&&!t?.workspace&&!t?.hosted&&!t?.guest,u=l&&n.get(`settings`)===`general`,d=c&&n.get(`settings`)===`agent`,f=(0,J.useCallback)(()=>r({settings:`agent`}),[r]);return(0,J.useEffect)(()=>{s&&Dw(e,Cw(s))},[e,s]),{chatAvailable:i,chatThread:s,reopenChat:(0,J.useCallback)(()=>r({chat:Ow(e),checks:null,cv:null}),[e,r]),settingsAvailable:c,localSettingsAvailable:l,generalSettingsOpen:u,settingsOpen:d,openSettings:f,openChat:(0,J.useCallback)(e=>{r({chat:Cw(e),checks:null,cv:null})},[r])}}function Ek({boardId:e,params:t,updateParams:n,environmentList:r,setCommentMode:i,pageCount:a=0}){let o=(0,J.useMemo)(()=>Array.isArray(r)?r:[],[r]),s=(0,J.useMemo)(()=>{let[e,n]=String(t.get(`cmp`)||``).split(`_`),r=o.map(e=>e.id);return e&&n&&e!==n&&r.includes(e)&&r.includes(n)?[e,n]:null},[t.get(`cmp`),o]),c=t.get(`changed`),l=a>=30,u=!!s&&(c===`1`||c!==`0`&&l),d=e=>n({changed:e===l?null:e?`1`:`0`}),f=t.get(`diff`)!==`off`,p=Xe(s?`/api/boards/${encodeURIComponent(e)}/compare?a=${s[0]}&b=${s[1]}`:null),m=s&&p.data?.a===s[0]&&p.data?.b===s[1]?p.data:null,h=(0,J.useMemo)(()=>{if(!s)return null;let[e,t]=s,n=new Map(o.map(e=>[e.id,e])),r=o.find(e=>e.default)?.id;return{a:e,b:t,files:m?.files||{},failures:m?.failures||{},pages:m?.pages||{},showDiff:f,kindOf:e=>e===r?`captures`:`envs/${e}`,versionOf:e=>n.get(e)?.capturedAt||`none`,titleOf:e=>n.get(e)?.title||e,diffKind:`diffs/${e}_${t}`,diffVersion:`${n.get(e)?.capturedAt}|${n.get(t)?.capturedAt}`}},[m,s,o,f]),g=e=>{i(!1),n({cmp:e?e.join(`_`):null,changed:e?t.get(`changed`):null,diff:e?t.get(`diff`):null})};return{environments:o,comparePair:s,changedOnly:u,setChangedOnly:d,showDiff:f,compareQuery:p,compareData:m,compareView:h,setCompare:g,canCompare:o.length>1,toggleCompare:()=>g(s?null:[o[0].id,o[1].id])}}function Dk({comments:e,query:t,stateFilter:n,mentionFilter:r,titleOfPage:i,filter:a,journey:o,journeyComments:s}){let c=(0,J.useMemo)(()=>sv(e,{query:t,state:n,mention:r,titleOf:i}),[e,r,t,n,i]),l=(0,J.useMemo)(()=>{let e=s?new Set(o.pages||ck(o.steps)):null;return c.filter(t=>(a===`all`||t.status===a)&&(!e||e.has(t.pageId)))},[c,a,o,s]);return{narrowedComments:c,visibleComments:l,pinsByTarget:(0,J.useMemo)(()=>{let e=new Map;for(let t of l){let n=`${t.pageId}|${t.viewport}`;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[l]),counts:{open:c.filter(e=>e.status===`open`).length,resolved:c.filter(e=>e.status===`resolved`).length}}}function Ok({targets:e,layoutEdges:t,links:n,showLinks:r,showAllLinks:i,activePage:a,builder:o,route:s,routeGraph:c,routePages:l,step:u,journey:d,targetTitle:f}){let p=(0,J.useMemo)(()=>new Set(Object.keys(e).filter(e=>!e.startsWith(`variant:`))),[e]),m=(0,J.useMemo)(()=>o?uk(o.steps).steps.map(e=>e.pageId):null,[o]),h=o?m:l,g=(0,J.useMemo)(()=>r&&!i?K_(n,p):null,[n,p,i,r]),_=(0,J.useMemo)(()=>o||!s?null:{graph:c,path:s.steps.map(e=>e.key)},[o,s,c]),v=(0,J.useMemo)(()=>[...t,...q_({links:n||{},showLinks:r,activePage:a,journeySteps:o?m:null,journeyRoute:_,currentStep:o?0:u,present:p,hideTargets:g}).map(e=>({...e,ariaLabel:e.id.startsWith(`link:`)?`Link from ${f(e.source)} to ${f(e.target)}`:`Journey${e.data?.label?` step ${e.data.label}`:``}: ${f(e.source)} to ${f(e.target)}`}))],[a,o,m,n,g,_,t,p,r,u,f]),y=(0,J.useMemo)(()=>{if(o||!d||!l)return null;let e=new Set(l);return new Set((d.pages||ck(d.steps)).filter(t=>!e.has(t)))},[o,d,l]);return{presentPages:p,shownSteps:h,hiddenLinkTargets:g,edges:v,journeyView:(0,J.useMemo)(()=>h?{steps:W_(h),offPath:y,currentStep:o?null:u,currentPage:o?null:h[u-1]}:null,[o,y,h,u])}}var kk=[];function Ak(e){let t=(0,J.useRef)(e);t.current=e;let{boardId:n,data:r,viewports:i,journeyView:a,compareView:s,commentMode:l,canComment:d,wide:f,hosted:p,imageVersion:m,pinsByTarget:h,me:g,checksCounts:_,canChecks:v,agentFocus:y,agentWorkingPages:b,setLiveReady:x,focusedKey:S,selectingKey:C,settledZoom:w,selectedComment:T,draftSpot:D,unread:O,liveKeys:k}=e,[A]=(0,J.useState)(()=>wb({focusedKey:S,selectingKey:C,settledZoom:w,selectedComment:T,draftSpot:D,unread:O,liveKeys:k}));(0,J.useLayoutEffect)(()=>{A.set({focusedKey:S,selectingKey:C,settledZoom:w,selectedComment:T,draftSpot:D,unread:O,liveKeys:k})},[A,S,C,w,T,D,O,k]);let j=(0,J.useMemo)(()=>{let e=()=>t.current;return{onFocusFrame:(t,n)=>{let{selectedCommentId:r,closeThread:i,builder:a,addBuilderStep:o,layout:s,flow:c,setSettledZoom:l,canvasRef:u,setFocusedKey:d}=e();if(r&&i(),a){t.startsWith(`variant:`)||o(t);return}let f=s.targets[t],p=f?.frames.find(e=>e.viewport===n);f&&p&&Av(p,c.getZoom())&&(l(null),c.fitBounds(NE({x:f.x+p.x,y:f.y,width:p.w,height:p.y+p.h},u.current?.getBoundingClientRect(),.08),{padding:.08,duration:kE(450)})),d(`${t}|${n}`)},onPin:t=>{let n=e(),{layout:r,flow:i,canvasRef:a}=n;n.selectedCommentId&&n.closeThread();let o=r.targets[t.pageId],s=o?.frames.find(e=>e.viewport===t.viewport),c=a.current?.getBoundingClientRect();if(!n.wide&&s&&c?.width&&s.w*i.getZoom()<c.width*.6){n.setSettledZoom(null);let e=Math.min(4,(c.width-16)/s.w),r=o.y+s.y+s.h*t.y/100;i.setViewport({x:8-(o.x+s.x)*e,y:c.height*.35-r*e,zoom:e},{duration:kE(450)}),n.setToast({at:Date.now(),text:`Zoomed in: tap the spot again to pin your comment.`,untilSheet:!0})}else n.setDraft(e=>({...t,body:e?.body||n.checkDraft||``,author:e?.author??n.authorName()})),n.setCheckDraft(``)},onSelectComment:t=>e().selectComment(t),onHoverComment:e=>A.set({hoveredId:e}),onOpenCluster:(t,n,r)=>e().openCluster(t,n,r),onChecks:(...t)=>e().openChecks(...t),onHistory:(t,n=null)=>e().openHistory(t,n),onShowViewport:t=>e().updateParams({vp:t===e().defaultMode?null:t}),onImageError:()=>e().onImageError()}},[A]);return{board:(0,J.useMemo)(()=>({boardId:n,captures:r?.captures||{},manifest:r?.manifest||null,counts:r?.commentCounts||{},viewports:i,journey:a,compare:s,commentMode:l&&d&&!s,touch:!f,imageUrl:(e,t,r)=>c(n,e,t,r||m),liveUrl:(e,t,r)=>we(n,e,t,r||m),elementsUrl:(e,t,r)=>u(n,e,t,r||m),domFallback:!o&&!E&&!p,setLiveReady:x,pinsFor:(e,t)=>s?kk:h.get(`${e}|${t}`)||kk,me:g,checksCount:e=>_.get(e)||0,historyCount:e=>iv(r?.versions,e),agentWorking:y,agentWorkingPages:b,onFocusFrame:j.onFocusFrame,onPin:j.onPin,onSelectComment:j.onSelectComment,onHoverComment:f?j.onHoverComment:null,onOpenCluster:j.onOpenCluster,onChecks:v?j.onChecks:null,onHistory:j.onHistory,onShowViewport:j.onShowViewport,onImageError:j.onImageError}),[j,y,b,n,v,d,_,l,s,r?.captures,r?.commentCounts,r?.manifest,r?.versions,p,m,a,g,h,x,i,f]),view:A}}function jk({boardId:e,view:t,setBusy:n,setNotice:r,setPolling:i}){let[a,o]=(0,J.useState)(!1);return{captureConfirm:a,setCaptureConfirm:o,startCapture:async(a=null,s=null)=>{n(!0);try{r({tone:`info`,text:(await Ke.post(`/api/boards/${encodeURIComponent(e)}/capture`,{...a?{env:a}:{},...s?{pages:s}:{}})).message||`Capture started.`}),i(!0),t.refetch()}catch(e){r({tone:`bad`,text:e.message||`The capture did not start.`})}finally{n(!1),o(!1)}}}}function Mk({draft:e,setDraft:t,busy:n,setBusy:r,commentsUrl:i,applyComment:a,markSeen:o,setLocalName:s,setNotice:c,updateParams:l,wide:u,filter:d,targetTitle:f,people:p,info:m,media:h={attach:!1,draw:!1,attachNote:null},pageImage:g=()=>null}){let _=Jb({enabled:h.attach}),v=e?`${e.pageId}|${e.viewport}`:null;(0,J.useEffect)(()=>{!v||!h.draw?sx.end(`composer`):sx.get()?.owner===`composer`?sx.moveTo(v,`composer`):sx.start(v,`composer`)},[v,h.draw]);let{clear:y}=_;return(0,J.useEffect)(()=>{e||y()},[e,y]),(0,J.useEffect)(()=>()=>sx.end(`composer`),[]),{draftDescription:e?`${f(e.pageId)} · ${e.viewport} · ${e.anchor?`on "${e.anchor.text||e.anchor.selector.split(` > `).pop()}"`:`${Math.round(e.x)}% across, ${Math.round(e.y)}% down`}`:``,composerProps:{draft:e,onChange:e=>t(t=>t&&{...t,...e}),onSubmit:async()=>{if(!(!e?.body.trim()||n||_.reading)){r(!0);try{let n=(e.author||``).trim();He(n);let r=sx.get(),c=r?.owner===`composer`&&r.key===v?r.shapes:[],f=qb(_.images),{comment:p}=await Ke.post(i,{pageId:e.pageId,viewport:e.viewport,x:e.x,y:e.y,body:e.body,author:n,...e.anchor?{anchor:e.anchor}:{},...f.length?{images:f}:{},...c.length?{drawing:lx(c)}:{}});sx.end(`composer`),t(null),s(n),a(p),o(p),l({c:u?p.id:null,filter:d===`all`?`all`:null})}catch(e){/image/.test(e.code||``)?_.setError(e.message||`An image was not accepted.`):c({tone:`bad`,text:e.message||`The comment was not saved.`})}finally{r(!1)}}},onCancel:()=>t(null),busy:n,people:p,hosted:!!m?.hosted,signedInAs:m?.user?.name||null,media:{...h,images:_,owner:`composer`,page:e&&h.draw?g(e.pageId,e.viewport):null,pageTitle:e?f(e.pageId):``}}}}function Nk({canComment:e,comparePair:t,commentMode:n,markPicked:r,setDraft:i,setCommentMode:a,showLinks:o,toggleLinks:s,canCompare:c,toggleCompare:l,wide:u,fitBoard:d,minimapOn:f,toggleMinimap:p,chatAvailable:m,reopenChat:h,canChecks:g,openChecks:_}){return[e&&!t?{id:`comment`,label:n?`Stop commenting`:`Comment on a page`,icon:Sg,keys:`C`,run:()=>{r(),i(null),a(e=>!e)}}:null,{id:`links`,label:o?`Hide links between pages`:`Show links between pages`,icon:I_,run:s},c?{id:`compare`,label:t?`Leave compare mode`:`Compare environments`,icon:Ph,run:l}:null,u?{id:`fit`,label:`Fit the whole board`,icon:bg,keys:`Shift 1`,run:d}:null,u?{id:`minimap`,label:f?`Hide the minimap`:`Show the minimap`,icon:vg,run:p}:null,m?{id:`agent`,label:`Chat with your agent`,icon:S,run:h}:null,g?{id:`checks`,label:`Open page checks`,icon:Ah,run:()=>_()}:null].filter(Boolean)}var Pk=30,Fk=28,Ik=240;function Lk(e){let t=1/e;return{"--sw-zoom":e.toFixed(4),"--sw-inv":t.toFixed(4),"--sw-title-scale":Math.min(t,96/Pk).toFixed(4),"--sw-title-fade":Math.max(0,Math.min(1,(e-.16)*25)).toFixed(3),"--sw-group-scale":Math.min(t,Ik/Fk).toFixed(4),"--sw-label-scale":Math.min(t,1.6).toFixed(4),"--sw-chip-scale":Math.min(t,1).toFixed(4)}}function Rk(){let e=Uu();return(0,J.useEffect)(()=>{let t=null,n=e=>{let n=e.transform[2],r=e.domNode;if(r&&n!==t){t=n;for(let[e,t]of Object.entries(Lk(n)))r.style.setProperty(e,t)}};return n(e.getState()),e.subscribe(n)},[e]),null}function zk({fitBoard:e,zoomTo:t}){let n=Vd();(0,J.useEffect)(()=>{let r=r=>{if(!(r.defaultPrevented||r.altKey||r.ctrlKey||r.metaKey||vS(r.target))&&!document.querySelector(`[role="dialog"], [role="menu"], [role="listbox"]`)){if(r.shiftKey&&r.code===`Digit1`)e();else if(r.shiftKey&&r.code===`Digit0`)t(1);else if(!r.shiftKey&&(r.key===`=`||r.key===`+`))n.zoomIn({duration:kE(200)});else if(!r.shiftKey&&r.key===`-`)n.zoomOut({duration:kE(200)});else return;r.preventDefault()}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,n,t])}function Bk({wide:e,clearFocus:n,setSettledZoom:r,minimapOn:i,liveKeys:o,toggleMinimap:s,hideFit:c,hideMinimap:l=!1,fitBoard:u}){let d=Vd(),f=$(e=>Math.round(e.transform[2]*100)),p=e=>{n(),r(null);let{x:t,y:i,zoom:a}=d.getViewport(),o=document.querySelector(`[data-sw-canvas]`)?.getBoundingClientRect(),s=(o?.width||0)/2,c=(o?.height||0)/2,l=e/a;d.setViewport({x:s-(s-t)*l,y:c-(c-i)*l,zoom:e},{duration:kE(250)})};if(zk({fitBoard:u,zoomTo:p}),!e)return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Rk,{}),(0,Y.jsx)($u,{position:`bottom-left`,className:K(`!m-2`,c&&`hidden`),children:(0,Y.jsx)(z,{size:`icon`,variant:`secondary`,className:`bg-surface/95 shadow-pop backdrop-blur`,onClick:u,label:`Fit the whole board`,"data-sw-fit":`true`,children:(0,Y.jsx)(bg,{size:17,"aria-hidden":`true`})})})]});let m=i&&!o.size&&!l,g=i&&o.size?`Minimap: hidden while a page is live`:i?`Hide the minimap`:`Show the minimap`,v=`h-8 w-8 rounded-md text-muted shadow-none hover:bg-surface-2 hover:text-fg`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Rk,{}),(0,Y.jsx)($u,{position:`bottom-left`,className:`!m-3`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-0.5 rounded-lg border border-line bg-surface/95 p-0.5 shadow-pop backdrop-blur`,role:`group`,"aria-label":`Zoom`,"data-sw-zoom-controls":`true`,children:[(0,Y.jsx)(z,{className:K(v,`react-flow__controls-zoomout`),onClick:()=>d.zoomOut({duration:kE(200)}),label:`Zoom out`,tooltip:(0,Y.jsx)(JD,{label:`Zoom out`,keys:[`-`]}),children:(0,Y.jsx)(Eg,{size:15,"aria-hidden":`true`})}),(0,Y.jsxs)(Ce,{children:[(0,Y.jsx)(h,{content:`Zoom level`,children:(0,Y.jsxs)(C,{className:`tabular h-8 min-w-12 rounded-md px-1.5 text-xs font-medium text-fg outline-none hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-accent`,"aria-label":`Zoom ${f}%`,"data-sw-zoom-level":f,children:[f,`%`]})}),(0,Y.jsxs)(t,{side:`top`,align:`start`,className:`min-w-52`,children:[(0,Y.jsxs)(T,{onSelect:()=>d.zoomIn({duration:kE(200)}),children:[`Zoom in `,(0,Y.jsx)(a,{className:`ml-auto`,children:`+`})]}),(0,Y.jsxs)(T,{onSelect:()=>d.zoomOut({duration:kE(200)}),children:[`Zoom out `,(0,Y.jsx)(a,{className:`ml-auto`,children:`-`})]}),(0,Y.jsx)(_,{}),(0,Y.jsx)(T,{onSelect:()=>p(.5),children:`Zoom to 50%`}),(0,Y.jsxs)(T,{onSelect:()=>p(1),children:[`Zoom to 100% `,(0,Y.jsx)(a,{className:`ml-auto`,children:`Shift 0`})]}),(0,Y.jsx)(T,{onSelect:()=>p(2),children:`Zoom to 200%`}),(0,Y.jsx)(_,{}),(0,Y.jsxs)(T,{onSelect:u,children:[`Fit the whole board `,(0,Y.jsx)(a,{className:`ml-auto`,children:`Shift 1`})]})]})]}),(0,Y.jsx)(z,{className:K(v,`react-flow__controls-zoomin`),onClick:()=>d.zoomIn({duration:kE(200)}),label:`Zoom in`,tooltip:(0,Y.jsx)(JD,{label:`Zoom in`,keys:[`+`]}),children:(0,Y.jsx)(Hg,{size:15,"aria-hidden":`true`})}),(0,Y.jsx)(`span`,{className:`mx-0.5 h-5 w-px bg-line`,"aria-hidden":`true`}),(0,Y.jsx)(z,{className:K(v,`react-flow__controls-fitview`),onClick:u,label:`Fit the whole board`,tooltip:(0,Y.jsx)(JD,{label:`Fit the whole board`,keys:[`Shift`,`1`]}),children:(0,Y.jsx)(bg,{size:14,"aria-hidden":`true`})}),(0,Y.jsx)(z,{className:K(v,i&&`text-accent hover:text-accent`),"aria-pressed":i,onClick:s,label:i?`Hide the minimap`:`Show the minimap`,tooltip:g,"data-sw-minimap-toggle":i?o.size?`auto-hidden`:`on`:`off`,children:(0,Y.jsx)(vg,{size:14,"aria-hidden":`true`})})]})}),m?(0,Y.jsx)(Fm,{pannable:!0,zoomable:!0,position:`bottom-right`,className:`!m-3 overflow-hidden !rounded-lg shadow-pop`,style:{width:168,height:104},bgColor:`color-mix(in srgb, var(--surface) 88%, transparent)`,maskColor:`color-mix(in srgb, var(--sunken) 55%, transparent)`,maskStrokeColor:`var(--accent)`,maskStrokeWidth:2,nodeBorderRadius:6,nodeColor:e=>e.type===`groupFrame`?`color-mix(in srgb, var(--fg) 5%, transparent)`:`color-mix(in srgb, var(--fg) 28%, transparent)`,nodeStrokeWidth:0,ariaLabel:`Minimap`,"data-sw-minimap":`true`}):null]})}function Vk(e,t,n=8){return t?e.left<t.right+n&&e.left+e.width>t.left-n&&e.top<t.bottom+n&&e.top+e.height>t.top-n:!1}function Hk(e,t){let n=null;for(let r of e||[]){if(!r||r.width<=0||r.height<=0)continue;let e=r.left-t.left,i=r.top-t.top,a=e+r.width,o=i+r.height;n=n?{left:Math.min(n.left,e),top:Math.min(n.top,i),right:Math.max(n.right,a),bottom:Math.max(n.bottom,o)}:{left:e,top:i,right:a,bottom:o}}return n}function Uk({card:e,canvas:t,bar:n,avoid:r=null,gap:i=8,zoom:a=1,toggleSize:o=44}){let{width:s,height:c}=t,l=r?r.bottom+i:i,u=e=>Math.max(i,Math.min(c-n.height-i,e)),d=(e,t=n)=>!Vk({...e,width:t.width,height:t.height},r,i),f=t=>{let r={left:t,top:u(e.top)};if(d(r))return r;let a={left:t,top:l};return a.top+n.height+i<=c?a:null},p=null;if(e.titleTop-n.height-i>=i){let t={left:Math.max(i,Math.min(e.right-n.width,s-n.width-i)),top:e.titleTop-n.height-i};d(t)&&(p=t)}!p&&e.right+i+n.width<=s-i&&(p=f(e.right+i)),!p&&e.left-i-n.width>=i&&(p=f(e.left-i-n.width));let m=e.titleTop>=i&&a>.2?{top:Math.max(i,e.titleTop-7),left:Math.max(i,Math.min(s-52,e.right-44-Math.min(140,(e.right-e.left)*.3)))}:{top:i,left:i};d(m,{width:o,height:o})||(m={...m,top:l});let h={left:i,top:d({left:i,top:i})?i:l};return{place:p,toggle:m,fallback:h}}var Wk=30;function Gk({focused:e,target:t,frame:n,title:i,hasLive:a,live:o,ready:s,selecting:c,touch:l,href:u,onOpenLive:d,onToggleSelect:f,onClose:p,history:m=0,onHistory:_=null,onChecks:v=null,onCapture:y=null,captureBusy:b=!1}){let x=$(e=>e.transform),S=$(e=>e.width),C=$(e=>e.height),w=$(e=>e.domNode),[T,E]=(0,J.useState)(null),D=T===e;(0,J.useEffect)(()=>{e||E(null)},[e]);let[O,k]=(0,J.useState)(null);if((0,J.useLayoutEffect)(()=>{let t=e&&w?w.closest(`[data-sw-canvas]`)?.querySelector(`[data-sw-canvas-notes]`):null,n=()=>{let e=t?Hk(Array.from(t.children).map(e=>e.getBoundingClientRect()),w.getBoundingClientRect()):null;k(t=>JSON.stringify(t)===JSON.stringify(e)?t:e)};if(n(),!t)return;let r=new MutationObserver(n);r.observe(t,{childList:!0,subtree:!0,characterData:!0});let i=typeof ResizeObserver>`u`?null:new ResizeObserver(n);return i?.observe(t),()=>{r.disconnect(),i?.disconnect()}},[e,w,S,C]),!e||!t||!n)return null;let[A,j,M]=x,N=(t.x+n.x)*M+A,P=(t.y+n.y)*M+j,F=t.y*M+j-(M>.2?Wk:0),ee=N+n.w*M,I=P+n.h*M;if(ee<0||N>S||I<0||P>C||Av(n,M))return null;let L=l?54:40,R=(l?236:340)+(_?l?56:90:0)+(y?l?56:120:0)+(v?l?48:90:0),{place:B,toggle:V,fallback:H}=Uk({card:{left:N,top:P,right:ee,bottom:I,titleTop:F},canvas:{width:S,height:C},bar:{width:R,height:L},avoid:O,gap:8,zoom:M}),U=l?`touch`:`sm`,te=`text-fg shadow-none`,ne=l&&`text-[13px]`;if(!B&&!D)return(0,Y.jsx)(z,{size:`icon`,variant:`secondary`,style:V,className:`nodrag nopan absolute z-20 rounded-full bg-surface/95 text-fg shadow-pop`,onClick:t=>{t.stopPropagation(),E(e)},label:`${i} actions`,side:`bottom`,"data-sw-frame-bar-toggle":e,children:(0,Y.jsx)(vh,{size:18,"aria-hidden":`true`})});let re=B?{left:B.left,top:B.top,width:Math.min(R,S-16)}:{left:H.left,top:H.top,width:Math.min(R,S-16)};return(0,Y.jsxs)(`div`,{className:`nodrag nopan nowheel absolute z-20 flex items-center flex-wrap justify-end gap-1 rounded-lg border border-line bg-surface/95 p-1 shadow-pop backdrop-blur`,style:re,role:`toolbar`,"aria-label":`${i} actions`,"data-sw-frame-bar":e,onClick:e=>e.stopPropagation(),children:[l?null:(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 truncate px-1.5 text-xs font-medium text-muted`,children:[i,` · `,n.viewport]}),a&&!o?(0,Y.jsxs)(r,{size:U,variant:`default`,className:K(`shadow-none`,ne),onClick:d,"data-sw-open-live":e,children:[(0,Y.jsx)(Og,{size:15,"aria-hidden":`true`}),` Open live`]}):null,o?(0,Y.jsxs)(r,{size:U,variant:c?`default`:`ghost`,className:K(`shadow-none`,ne,!c&&`text-fg`),"aria-pressed":c,disabled:!s,onClick:f,"data-sw-select-text":e,children:[(0,Y.jsx)(g_,{size:15,"aria-hidden":`true`}),` `,c?`Done`:`Select text`]}):null,v?(0,Y.jsxs)(r,{size:U,variant:`ghost`,className:te,onClick:v,"aria-label":`Page checks`,"data-sw-frame-checks":e,children:[(0,Y.jsx)(Ah,{size:15,"aria-hidden":`true`}),l?null:`Checks`]}):null,_?(0,Y.jsx)(h,{content:`Page history: ${m+1} captures`,children:(0,Y.jsxs)(r,{size:U,variant:`ghost`,className:te,onClick:_,"aria-label":`Page history: ${m+1} captures`,"data-sw-frame-history":e,children:[(0,Y.jsx)(Kg,{size:15,"aria-hidden":`true`}),` `,l?null:`History`]})}):null,y?(0,Y.jsx)(h,{content:`Recapture this page at every screen size`,children:(0,Y.jsxs)(r,{size:U,variant:`ghost`,className:te,disabled:b,onClick:y,"aria-label":`Capture this page`,"data-sw-frame-capture":e,children:[(0,Y.jsx)(Xm,{size:15,"aria-hidden":`true`}),` `,l?null:`Capture`]})}):null,u?(0,Y.jsx)(z,{asChild:!0,size:l?`icon`:`icon-sm`,className:te,label:`Open the page in a new tab`,children:(0,Y.jsx)(`a`,{href:u,target:`_blank`,rel:`noreferrer`,children:(0,Y.jsx)(bh,{size:15,"aria-hidden":`true`})})}):null,(0,Y.jsx)(z,{size:l?`icon`:`icon-sm`,onClick:B?p:()=>E(null),label:B?`Close`:`Collapse`,"data-sw-frame-bar-close":`true`,children:(0,Y.jsx)(g,{size:15,"aria-hidden":`true`})})]})}function Kk({onChecks:e,onHistory:t,historyCountFor:n,focusedKey:r,layout:i,data:a,liveKeys:o,readyKeys:s,selectingKey:c,touch:l,liveFileFor:u,onOpenLive:d,onToggleSelect:f,onClose:p,onCapture:m,captureBusy:h}){if(!r)return null;let g=r.lastIndexOf(`|`),_=r.slice(0,g),v=r.slice(g+1),y=i.targets[_],b=y?.frames.find(e=>e.viewport===v);if(!b)return null;let x=_.startsWith(`variant:`)?a?.variants?.find(e=>`variant:${e.id}`===_):null,S=x?null:a?.board?.pages.find(e=>e.id===_);return(0,Y.jsx)(Gk,{focused:r,target:y,frame:b,title:x?x.title:S?.title||_,hasLive:!!u(_,v),live:o.has(r),ready:s.has(r),selecting:c===r,touch:l,href:S?.url||(x?.source&&/^https?:/.test(x.source)?x.source:null),onOpenLive:()=>d(_,v),onToggleSelect:()=>f(r),onClose:p,history:S&&a?.versions?.[S.id]?.[v]?.length||0,onChecks:S&&e?()=>e(S.id,v):null,onHistory:S&&n(S.id)?()=>t(S.id,v):null,onCapture:S&&m?()=>m(S.id):null,captureBusy:h})}var qk=(0,J.lazy)(()=>xT(()=>import(`./ShareDialog-BouvNraR.js`).then(e=>({default:e.MigrationBanner})),__vite__mapDeps([9,1]),import.meta.url)),Jk=()=>{},Yk=new Set;function Xk(e,t){let n=new Map;for(let r of e||[])n.has(t(r))||n.set(t(r),r);return n}function Zk({boardId:e,boards:t,info:n,onPickBoard:r,onInfoChanged:i,onOpenBuzz:a}){let s=ve(`(min-width: 1024px)`),l=ve(`(max-width: 640px)`),u=Vd(),d=j(),p=vE(),[m,h]=We(),[g,_]=(0,J.useState)(!1),v=!n?.readOnly&&(!o||F),y=v&&!o&&!n?.hosted,b=v&&n?.allowCapture,x=e=>n?.permissions?.[e]!==!1,{view:S,commentsQuery:C,data:w,capture:T,comments:D,fixRequest:O,setFixRequest:k,setPolling:A,deletingIds:M,setDeletingIds:P}=mk(e),ee=Xe(n?.localProjectsEnabled?`/api/local-projects`:null,{pollMs:3e4}),I=ee.data?.projects||[],L=(0,J.useMemo)(()=>w?.viewports||{},[w?.viewports]),R=Object.keys(L),z=(0,J.useMemo)(()=>{let e=R.map(e=>({id:e,label:pv(e)}));return e.length>1&&e.push({id:`all`,label:e.length===2?`Both`:`All`}),e},[R.join(`,`)]),B=l&&R.includes(`phone`)?`phone`:R[0]||`desktop`,V=z.some(e=>e.id===m.get(`vp`))?m.get(`vp`):B,H=OC.some(e=>e.id===m.get(`filter`))?m.get(`filter`):`open`,U=Number(m.get(`c`))||null,te=(m.get(`q`)||``).slice(0,120),ne=av.some(e=>e.id===m.get(`st`))?m.get(`st`):null,re=/^[a-z][\w.-]{0,39}$/.test(m.get(`m`)||``)?m.get(`m`):null,ie=m.get(`panel`)===`off`,{canChecks:ae,checksOpen:W,checksPage:oe,checksViewport:se,checksQuery:ce,openChecks:le,closeChecks:de,checksCounts:pe,checksPanelProps:me,checksRun:he}=wk({boardId:e,info:n,params:m,updateParams:h,pages:w?.board?.pages}),[ge,_e]=(0,J.useState)(``),{chatAvailable:ye,chatThread:be,settingsAvailable:xe,localSettingsAvailable:Se,generalSettingsOpen:Ce,settingsOpen:we,openSettings:Te,openChat:Ee,reopenChat:De}=Tk({boardId:e,info:n,params:m,updateParams:h}),Oe=(0,J.useRef)(null),ke=(0,J.useRef)(PE(m.get(`v`))),Ae=(0,J.useRef)(null),[je,Me]=(0,J.useState)(!1),[Ne,Pe]=(0,J.useState)(null),[q,Fe]=(0,J.useState)(!1),[Ie,Le]=(0,J.useState)(!1),Re=n?.localUser?.name||``,[ze,Be]=(0,J.useState)(()=>fe()),Ve=ze||Re,He=(0,J.useCallback)(()=>fe()||Re,[Re]),Ue=(0,J.useRef)(null),[Ge,Ke]=(0,J.useState)(!1),[qe,Je]=(0,J.useState)(null),[Ye,Ze,Qe]=TO(),[$e,et]=(0,J.useState)(()=>XE()),tt=$e??ZE(w?.board?.pages?.length||0),[nt,rt]=(0,J.useState)(!1),it=jS(e),at=it&&[`working`,`waiting`].includes(it.state)&&Number(it.commentId)||null,ot=(0,J.useMemo)(()=>at?new Set([at]):Yk,[at]),[st,ct]=(0,J.useState)(!1),[lt,ut]=(0,J.useState)(null),[dt,ft]=(0,J.useState)(null),[pt,mt]=(0,J.useState)(null),[ht,gt]=(0,J.useState)(null),[_t,vt]=(0,J.useState)(()=>!$E()),[yt,bt]=xE(!!d),[xt,St]=(0,J.useState)(()=>new Set),Ct=(0,J.useCallback)(e=>St(t=>t.has(e)?t:new Set(t).add(e)),[]),wt=(0,J.useCallback)(()=>{vt(!1),tD()},[]),Tt=()=>{bt(),wt()},Et=m.get(`hist`),Dt=m.get(`hv`),{journeys:Ot,journey:kt,route:At,routeGraph:jt,routePages:Mt,step:Nt,journeyComments:Pt}=hk({params:m,data:w,builder:pt}),X=m.get(`links`)===`1`,[Ft,It]=(0,J.useState)(!1);(0,J.useEffect)(()=>{X||It(!1)},[X]);let Lt=Array.isArray(w?.brokenLinks)?w.brokenLinks:[],Rt=Lt.length?`Arrows for the links between pages; ${Lt.length} ${Lt.length===1?`link leads`:`links lead`} to an error`:`Arrows for the links between pages`,{environments:zt,comparePair:Bt,changedOnly:Vt,showDiff:Ht,compareQuery:Ut,compareData:Wt,compareView:Gt,setCompare:Kt,canCompare:qt,toggleCompare:Jt,setChangedOnly:Yt}=Ek({boardId:e,params:m,updateParams:h,environmentList:w?.environments,setCommentMode:Me,pageCount:w?.board?.pages?.length||0}),Xt=(0,J.useMemo)(()=>{let e=w?.board?.pages||[];return!Vt||!Wt?e:e.filter(e=>(ev(Wt,e.id)||0)>0)},[Vt,Wt,w?.board?.pages]),Zt=(0,J.useMemo)(()=>w?.board&&R.length?Iv({pages:Xt,groups:w.board.groups,variants:Bt?[]:w.variants,viewports:L,mode:V,compare:Bt}):{nodes:[],edges:[],targets:{}},[w?.board,w?.variants,Xt,L,V,Bt]),[Qt,$t,en]=$p(Zt.nodes);(0,J.useEffect)(()=>{$t(Zt.nodes)},[Zt.nodes,$t]);let tn=nm(),[nn,rn]=JE(tn),[an,on]=(0,J.useState)(null),[sn,cn]=(0,J.useState)(null),ln=(0,J.useCallback)(()=>{on(null),cn(null)},[]),un=(0,J.useCallback)(()=>{ln(),rn(null),u.fitView({...ME,duration:kE(400)})},[ln,u,rn]);yk({mode:V,pendingFocus:lt,shapeKey:`${Bt?.join(`_`)||``}|${Vt&&Wt?Xt.length:`all`}`,clearFocus:ln,fitBoard:un});let dn=(0,J.useMemo)(()=>Xk(w?.board?.pages,e=>e.id),[w?.board?.pages]),fn=(0,J.useMemo)(()=>Xk(w?.variants,e=>`variant:${e.id}`),[w?.variants]),{visibleComments:pn,pinsByTarget:mn,counts:hn}=Dk({comments:D,query:te,stateFilter:ne,mentionFilter:re,titleOfPage:(0,J.useCallback)(e=>String(e).startsWith(`variant:`)?fn.get(e)?.title||``:dn.get(e)?.title||``,[dn,fn]),filter:H,journey:kt,journeyComments:Pt}),gn=(0,J.useMemo)(()=>N(D),[D]),_n=(0,J.useMemo)(()=>({name:n?.user?.name||Ve||``,handle:n?.user?.handle||null}),[n?.user?.name,n?.user?.handle,Ve]),vn=v&&!w?.migratedTo?.readOnly&&x(`comment`),yn=e=>{let t=!!_n.handle&&e.authorHandle===_n.handle;return{reply:v&&!w?.migratedTo?.readOnly&&x(`reply`),resolve:v&&!w?.migratedTo?.readOnly&&x(`resolve`),react:v&&!w?.migratedTo?.readOnly&&x(`react`),edit:v&&!w?.migratedTo?.readOnly&&x(`edit`)&&(!n?.hosted||dT({isAuthor:t})),delete:v&&!w?.migratedTo?.readOnly&&x(`delete`)&&(!n?.hosted||fT({role:n.role,isAuthor:t}))}},{seen:bn,markSeen:xn,markAllSeen:Sn}=cT(e),Cn=(0,J.useMemo)(()=>new Set(D.filter(e=>sT(e,bn,_n)).map(e=>e.id)),[D,_n,bn]),wn=D.find(e=>e.id===U)||null,Tn=CO(s),En=(0,J.useMemo)(()=>{let e=new Set;for(let t of D)t.status!==`resolved`&&(t.agentStatus===`working`||ot.has(t.id))&&e.add(t.pageId);return e},[ot,D]),Dn=(0,J.useCallback)(e=>dn.get(e)||null,[dn]),On=(0,J.useCallback)(e=>{if(e.startsWith(`variant:`)){let t=fn.get(e);return t?`Variant: ${t.title}`:`Removed variant`}return Dn(e)?.title||e},[fn,Dn]),kn=w?.manifest?.capturedAt||`none`,An=(0,J.useRef)(null),{refetch:jn}=S,{refetch:Mn}=C,{refetch:Nn}=Ut,Pn=(0,J.useCallback)(()=>{let e=`${kn}|${w?.environments?.map(e=>e.capturedAt).join(`,`)||``}`;An.current!==e&&(An.current=e,jn(),Mn(),Nn())},[w?.environments,kn,Mn,Nn,jn]),Fn=(0,J.useRef)(!1),In=(0,J.useCallback)(e=>{Fn.current=!1,Pe(null),h({c:e.id}),s||(Fe(!1),Le(!0))},[h,s]),Ln=(0,J.useCallback)(()=>{Le(!1),h({c:null}),Fn.current&&!s&&Fe(!0),Fn.current=!1},[h,s]),Rn=(0,J.useCallback)(e=>{let t=V!==`all`&&e.viewport!==V&&!!L[e.viewport];Pe(null),ut(e),h({c:e.id,...t?{vp:e.viewport===B?null:e.viewport}:{}}),t&&gt({from:V,to:e.viewport,id:e.id,at:Date.now()}),s||(Fe(!1),Le(!0))},[B,V,h,L,s]);(0,J.useEffect)(()=>{if(!ht)return;let e=window.setTimeout(()=>gt(null),6e3);return()=>window.clearTimeout(e)},[ht]),_k({pendingFocus:lt,setPendingFocus:ut,targets:Zt.targets,viewports:L,flow:u,canvasRef:Ae,wide:s,setSettledZoom:rn}),vk({wide:s,nodesReady:tn,initialCamera:ke,selectedCommentId:U,canvasRef:Ae,nodes:Zt.nodes,flow:u,setSettledZoom:rn});let zn=(0,J.useRef)(!ke.current&&!U&&!m.get(`j`)),Bn=(0,J.useRef)(!ke.current&&!!U),[Vn,Hn]=(0,J.useState)(()=>!s||!zn.current);(0,J.useEffect)(()=>{if(!zn.current||!tn||!Zt.nodes.length)return;if(zn.current=!1,!s){Hn(!0);return}let e=HE(Zt.nodes,Ae.current?.getBoundingClientRect());rn(null);let t=e?u.setViewport(e):u.fitView(ME);Promise.resolve(t).finally(()=>Hn(!0))},[u,Zt.nodes,tn,rn,s]);let Un=(0,J.useRef)(!1),Wn=()=>{Un.current=!0},Gn=(0,J.useCallback)(e=>{Un.current&&(Un.current=!1,e.preventDefault(),Ae.current?.focus({preventScroll:!0}))},[]),{liveKeys:Kn,readyKeys:qn,setLiveReady:Jn,liveFileFor:Yn,recomputeLive:Xn,openLive:Zn}=rk({canvasRef:Ae,flow:u,targets:Zt.targets,viewports:L,settledZoom:nn,setSettledZoom:rn,comparePair:Bt,captures:w?.captures,variantsById:fn});(0,J.useEffect)(()=>{sn&&!Kn.has(sn)&&cn(null)},[Kn,sn]);let{openJourney:Qn,closeJourney:$n,goStep:er,chooseJourneyBranch:tr,startBuilder:nr,addBuilderStep:rr,saveBuilder:ir,removeJourney:ar}=fk({boardId:e,view:S,updateParams:h,clearFocus:ln,setCommentMode:Me,journey:kt,route:At,routePages:Mt,step:Nt,builder:pt,setBuilder:mt,busy:st,setBusy:ct,setNotice:Je,flow:u,targets:Zt.targets,nodesReady:tn,mode:V,comparePair:Bt,setSettledZoom:rn}),or=an&&!an.startsWith(`variant:`)?mv(an):null,sr=or?.targetId||null,cr=dt||sr,lr=m.get(`la`)===`1`,{presentPages:ur,shownSteps:dr,hiddenLinkTargets:fr,edges:pr,journeyView:mr}=Ok({targets:Zt.targets,layoutEdges:Zt.edges,links:w?.links,showLinks:X,showAllLinks:lr,activePage:cr,builder:pt,route:At,routeGraph:jt,routePages:Mt,step:Nt,journey:kt,targetTitle:On}),hr=(0,J.useCallback)((e,t=null)=>{if(!e||String(e).startsWith(`variant:`))return;let n=V===`all`?R[0]:V;h({hist:e,hv:t&&t!==n?t:null})},[V,h,R.join(`,`)]),gr=Et&&w?.board?.pages.find(e=>e.id===Et)||null,_r=Dt&&L[Dt]?Dt:V===`all`?R[0]:V,vr=(0,J.useCallback)(()=>h({hist:null,hv:null}),[h]),yr=t=>{let n=Zt.targets[t];if(!n)return;rn(null);let r=n.frames[0],i=n.frames.map(e=>w?.captures?.[t]?.[e.viewport]).filter(e=>e?.thumb||e?.file);FE(u,n,Ae.current?.getBoundingClientRect(),{phoneCompare:!!Bt&&!s,shotUrls:i.map(t=>c(e,`captures`,t.thumb||t.file,kn))}),r&&on(`${t}|${r.viewport}`)},br=(0,J.useMemo)(()=>{let e=Xt;return[...new Set(e.map(e=>e.group))].map(t=>({group:t,pages:e.filter(e=>e.group===t)}))},[Xt]),xr=(0,J.useMemo)(()=>Ne?{pageId:Ne.pageId,viewport:Ne.viewport,x:Ne.x,y:Ne.y,anchor:Ne.anchor}:null,[Ne?.pageId,Ne?.viewport,Ne?.x,Ne?.y,Ne?.anchor]),Sr=(0,J.useCallback)((e,t,n)=>{let r=Zt.targets[e],i=r?.frames.find(e=>e.viewport===t);i&&(u.getZoom()>=3.9?In(n[0].comment):(rn(null),u.fitBounds(IE(r,i,n),{padding:.3,duration:kE(450)})))},[u,Zt.targets,In,rn]),{board:Cr,view:wr}=Ak({boardId:e,data:w,viewports:L,journeyView:mr,compareView:Gt,commentMode:je,canComment:vn,wide:s,hosted:n?.hosted,imageVersion:kn,pinsByTarget:mn,me:_n,checksCounts:pe,canChecks:ae,agentFocus:ot,agentWorkingPages:En,setLiveReady:Jn,focusedKey:an,selectingKey:sn,settledZoom:nn,selectedComment:wn,draftSpot:xr,unread:Cn,liveKeys:Kn,selectedCommentId:U,closeThread:Ln,builder:pt,addBuilderStep:rr,layout:Zt,flow:u,canvasRef:Ae,setSettledZoom:rn,setFocusedKey:on,setToast:Ze,setDraft:Pe,checkDraft:ge,setCheckDraft:_e,authorName:He,selectComment:In,openCluster:Sr,openChecks:le,openHistory:hr,updateParams:h,defaultMode:B,onImageError:Pn}),{commentsUrl:Tr,applyComment:Er,setStatus:Dr,replyTo:Or,editComment:kr,reactTo:Ar,copyLink:jr,githubIssue:Mr,removeComment:Nr,sendToAgent:Pr}=pk({boardId:e,commentsQuery:C,view:S,info:n,localName:Ve,authorName:He,setBusy:ct,setNotice:Je,setToast:Ze,setDeletingIds:P,selectedCommentId:U,closeThread:Ln,wide:s,filter:H,allowed:x}),Fr=(0,J.useMemo)(()=>({attach:vn&&!o&&!n?.guest,draw:vn&&!o,attachNote:vn&&!o&&n?.guest?`Guests on a share link cannot attach images. You can still draw on the page.`:null}),[vn,n?.guest]),Ir=(0,J.useCallback)((t,n)=>{let r=w?.captures?.[t]?.[n];if(!r?.file)return null;let i=String(t).startsWith(`variant:`)?fn.get(t):null,a=dn.get(i?i.pageId:t),o=Nv(L,n,a?.frameHeight);return o?{src:c(e,`captures`,r.file,kn),native:o}:null},[e,w?.captures,kn,dn,fn,L]),{draftDescription:Lr,composerProps:Rr}=Mk({draft:Ne,setDraft:Pe,busy:st,setBusy:ct,commentsUrl:Tr,applyComment:Er,markSeen:xn,setLocalName:Be,setNotice:Je,updateParams:h,wide:s,filter:H,targetTitle:On,people:gn,info:n,media:Fr,pageImage:Ir}),{captureConfirm:zr,setCaptureConfirm:Br,startCapture:Vr}=jk({boardId:e,view:S,setBusy:ct,setNotice:Je,setPolling:A}),Hr=(0,J.useCallback)(e=>{h({v:`${Math.round(e.x)},${Math.round(e.y)},${e.zoom.toFixed(3)}`}),rn(e.zoom),Xn()},[Xn,rn,h]),Ur=bS({canvasRef:Ae,flow:u,minZoom:jE,maxZoom:4,onRest:Hr}),Wr=(0,J.useCallback)((e,t)=>{Ur.moving()||Hr(t)},[Hr,Ur]);G(!!an,ln),(0,J.useEffect)(()=>{an&&_t&&wt()},[wt,an,_t]),G(je,()=>Me(!1)),G(!!kt,$n),G(!!pt,()=>mt(null)),ak({commentMode:je,setCommentMode:Me,canComment:vn,comparePair:Bt,setDraft:Pe}),ok({journeys:Ot,journey:kt,builder:pt,openJourney:Qn,closeJourney:$n});let[Gr,Kr]=FD(s,!1);(0,J.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`||document.querySelector(`[role="dialog"]:not([data-sw-thread-popover]):not([data-sw-palette])`)||(e.preventDefault(),rt(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,J.useEffect)(()=>{je||Pe(e=>e&&!e.body.trim()?null:e)},[je]),(0,J.useEffect)(()=>{wn&&xn(wn)},[xn,wn]),(0,J.useEffect)(()=>{wn&&Ct(`open`),je&&Ct(`comment`),be&&Ct(`agent`)},[be,je,Ct,wn]),bk({nodesReady:tn,data:w,commentsLoaded:C.data,selectedCommentId:U,selectedComment:wn,initialCamera:ke,focusComment:Rn,deletingIds:M,setNotice:Je,updateParams:h});let{threadList:qr,threadIndex:Jr,stepThread:Yr,neighborNote:Xr}=xk({selectedComment:wn,visibleComments:pn,focusComment:Rn,mode:V,viewports:L,modes:z});(0,J.useEffect)(()=>{let e=null,t=wr.subscribe(()=>{let{hoveredId:t}=wr.get(),n=t===null?null:Ae.current?.querySelector(`[data-sw-pin="${t}"]`)||null;n!==e&&(e?.removeAttribute(`data-sw-pin-hover`),n?.setAttribute(`data-sw-pin-hover`,`true`),e=n)});return()=>{t(),e?.removeAttribute(`data-sw-pin-hover`)}},[wr]);let Zr=e=>{gt(null),h({vp:e===B?null:e})},Qr=D.filter(e=>e.status===`open`).length,$r=bC({boardId:e,enabled:!(!ye||w?.migratedTo?.readOnly||!n?.agent?.fixWithAgent||!n?.agent?.configured||n?.hosted&&!E),onProgress:()=>{C.refetch(),S.refetch()}}),[ei,ti]=(0,J.useState)(null),ni=e=>{let t=D.find(t=>t.id===e);t?Rn(t):Ee(vw(e))},ri={...$r,agentName:n?.agent?.label||`agent`,boardId:e,onOpenThread:ni,onConfirm:e=>ti(e)},ii={batch:ri,comments:pn,filter:H,counts:hn,onFilter:e=>h({filter:e===`open`?null:e}),selectedId:U,onHover:Cr.onHoverComment,onFocus:e=>{Fn.current=!s,Rn(e)},unread:Cn,onMarkAllRead:()=>Sn(D),people:gn,narrow:{query:te,state:ne,mention:re,onQuery:e=>h({q:e||null}),onState:e=>h({st:e}),onMention:e=>h({m:e}),onClear:()=>h({q:null,st:null,m:null})},canAct:vn,targetTitle:On,touch:!s,onResetBrowserComments:F?()=>{f(e),h({c:null}),C.refetch(),S.refetch()}:null,journeyFilter:kt?{name:kt.name,on:Pt,onToggle:()=>h({jc:Pt?null:`1`})}:null},ai=wn?{comment:wn,page:Dn(wn.pageId),title:On(wn.pageId),people:gn,me:_n,can:yn(wn),role:n?.guest?`guest`:n?.role||null,hosted:!!n?.hosted,onSaveName:Be,media:{...Fr,boardId:e,pageImage:Ir,pageTitle:On(wn.pageId),currentVersion:e=>String(e.pageId).startsWith(`variant:`)?null:Y_(w?.manifest?.pages?.[e.pageId]?.[e.viewport],w?.manifest)},busy:st,touch:!s,editingRef:Ue,actions:{onReply:Or,onSendToAgent:n?.hosted&&w?.agentDispatch&&!wn.authorGuest&&!wn.authorAgent?Pr:null,onStatus:Dr,onEdit:kr,onDelete:Nr,onReact:Ar,onCopyLink:jr,onFixAgent:ye&&!w?.migratedTo?.readOnly&&n?.agent?.fixWithAgent&&n?.agent?.configured?e=>{k({commentId:e.id,nonce:Date.now()}),s||Le(!1),Ee(vw(e.id))}:null,onAskAgent:ye?e=>{s||Le(!1),Ee(vw(e.id))}:null,onGithubIssue:!o&&n?.github?.ready?Mr:null,onHistory:e=>{s||Le(!1),hr(e.pageId,e.viewport)}},nav:{index:Jr,total:qr.length,onPrev:()=>Yr(-1),onNext:()=>Yr(1),prevNote:Xr(-1),nextNote:Xr(1)},beforeAfter:w?{pairFor:e=>Q_(e,{manifest:w.manifest,captures:w.captures,versions:w.versions}),nativeFor:e=>{let t=String(e.pageId).startsWith(`variant:`)?fn.get(e.pageId):null,n=dn.get(t?t.pageId:e.pageId);return Nv(L,e.viewport,n?.frameHeight)||null},urlFor:t=>c(e,t.kind,t.file,t.version),onImageError:Pn}:null}:null,oi={boardId:e,batch:ri,fixRequest:O,onFixDone:()=>{k(null),S.refetch(),C.refetch()},agent:n?.agent,threadId:be||`board`,onThread:Ee,comments:D,pages:w?.board?.pages||[],captures:w?.captures||{},imageVersion:kn,defaultViewport:V===`all`?B:V,focused:or?{pageId:or.targetId,viewport:or.viewport}:null,touch:!s,onOpenSettings:xe?Te:null,settingsLocked:!!(ye&&!xe&&n?.agent?.settingsLocked),onAgentChanged:i,people:gn,onRunChecks:he?async()=>{let e=await he.start({seo:he.seoDefault});return le(),e}:null,journeys:Ot,checksCounts:ae?pe:null,onBoardChanged:()=>{S.refetch(),C.refetch()},onNavigate:e=>{if(!s&&e.kind!==`check`&&h({chat:null}),e.kind===`comment`){let t=D.find(t=>t.id===e.id);t&&Rn(t)}else e.kind===`page`?yr(e.id):e.kind===`journey`?Qn(e.id):e.kind===`check`&&le(e.id)},onRecapture:b&&!Bt?e=>e?Vr(null,Array.isArray(e)?e:[e]):Br(!0):E?()=>Je({tone:`info`,text:`The demo does not take new captures. On your own board this recaptures the changed pages.`}):null},si=()=>h({links:X?null:`1`}),ci=()=>{let e=!tt;et(e),eD(e)},li=!!gr||we||Ce||zr||!s&&W,ui={data:ce.data,error:ce.error,loading:ce.loading,pages:w?.board?.pages||[],pageId:oe,viewport:se,onSelect:le,onClose:de,onRefresh:ce.refetch,onEnvironment:e=>h({ce:e}),canComment:vn,local:!o&&!n?.hosted,onView:(e,t)=>{de(),h({vp:t,page:e}),ut({pageId:e,viewport:t,x:50,y:50})},onDraft:(e,t,n)=>{_e(`${n.title}\n\n${n.observation}\n${n.nextAction}\n\nCheck report ${t.id} (${e.viewport}, ${t.auditedAt}). Separately sampled; review before sending to an agent.`.slice(0,1800)),de(),h({vp:e.viewport}),ut({pageId:e.pageId,viewport:e.viewport,x:50,y:50}),Fe(!1),Me(!0),Ze({at:Date.now(),text:`Choose a pin on the page, then review and save your comment.`})},...me},di=e=>{e.preventDefault(),de(),s?((ie||be)&&h({panel:null,chat:null}),window.requestAnimationFrame(()=>window.requestAnimationFrame(()=>document.getElementById(`sw-comments`)?.focus()))):Fe(!0)},fi=e=>xS(e,e=>{let t=Zt.targets[e]?.frames[0];t&&Cr.onFocusFrame(e,t.viewport)}),pi=Nk({canComment:vn,comparePair:Bt,commentMode:je,markPicked:Wn,setDraft:Pe,setCommentMode:Me,showLinks:X,toggleLinks:si,canCompare:qt,toggleCompare:Jt,wide:s,fitBoard:un,minimapOn:tt,toggleMinimap:ci,chatAvailable:ye,reopenChat:De,canChecks:ae,openChecks:le}),mi={setMenuOpen:Ke,data:w,chatAvailable:ye,chatThread:be,reopenChat:De,updateParams:h,groupedPages:br,jumpToPage:yr,modes:z,mode:V,setMode:Zr,journeys:Ot,journey:kt,canEditJourneys:y,openJourney:Qn,closeJourney:$n,startBuilder:nr,openBrokenLinks:()=>It(!0),canChecks:ae,openChecks:le,showLinks:X,toggleLinks:si,brokenLinks:Lt,canCompare:qt,comparePair:Bt,toggleCompare:Jt,settingsAvailable:xe,openSettings:Te,capture:T,canCapture:b,busy:st,setCaptureConfirm:Br};return(0,Y.jsxs)(Qk,{board:Cr,view:wr,people:gn,children:[(0,Y.jsxs)(`div`,{className:`flex h-full flex-col`,"data-sw-board":e,style:{paddingTop:`env(safe-area-inset-top, 0px)`},children:[(0,Y.jsx)(OT,{}),(0,Y.jsx)(HT,{}),n?.hosted&&w?.agentApprove?(0,Y.jsx)(BT,{boardId:e}):null,(0,Y.jsx)(`a`,{href:`#sw-comments`,className:`sr-only z-[80] rounded-md bg-accent px-3 py-2 text-sm font-medium text-accent-fg focus:not-sr-only focus:absolute focus:top-2 focus:left-2`,onClick:di,"data-sw-skip-comments":`true`,children:`Skip to comments`}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[s?(0,Y.jsx)(YO,{...mi,info:n,localName:Ve,onOpenBuzz:a,demo:d,localSettingsAvailable:Se,setShareOpen:_,expanded:Gr,onToggle:Kr,quiet:Tn,pages:w?{groups:br,journeys:Ot,comments:D,activePage:cr,journeyId:kt?.id||null,onPage:yr,onJourney:Qn,canEditJourneys:y,onNewJourney:()=>nr()}:null}):null,(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(yO,{...mi,wide:s,info:n,boardId:e,boards:t,localProjects:I,projectsError:ee.error,localName:Ve,onPickBoard:r,onOpenBuzz:a,demo:d,localSettingsAvailable:Se,setShareOpen:_,viewportNotice:ht,canComment:vn,commentMode:je,setCommentMode:Me,openPalette:()=>rt(!0),minimapOn:tt,toggleMinimap:ci,linksTip:Rt,panelHidden:ie,checksOpen:W,allOpen:Qr,closeChecks:de,setSheetOpen:Fe,sidebarTitled:s&&Gr}),!n?.hosted&&w?.migratedTo?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(qk,{marker:w.migratedTo,boardId:e,editable:!!n?.shareEnabled,onChange:S.refetch})}):null,(0,Y.jsx)(OO,{notice:qe,setNotice:Je,wide:s}),Bt?(0,Y.jsx)(VC,{environments:zt,pair:Bt,loading:Ut.loading||!Wt,error:Ut.error?Ut.error.message:null,changedPages:Wt?.changedPages??0,totalPages:w?.board?.pages?.length||0,changedOnly:Vt,showDiff:Ht,canCapture:b,captureBusy:st||!!T?.running,touch:!s,onPair:e=>Kt(e),onChangedOnly:Yt,onShowDiff:e=>h({diff:e?null:`off`}),onCapture:e=>Vr(e),onClose:()=>Kt(null)}):null,(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,Y.jsxs)(`div`,{ref:Ae,tabIndex:-1,className:K(`relative min-w-0 flex-1 outline-none`,je&&vn&&`sw-commenting`),onKeyDown:fi,"data-sw-canvas":`true`,children:[X&&Lt.length?(0,Y.jsx)(qD,{items:Lt,open:Ft,onOpenChange:It}):null,s&&w?(0,Y.jsx)(wO,{flow:u,canvasRef:Ae,targets:Zt.targets,focusFor:e=>((e===`composer`?Ne?.y:wn?.y)??50)/100,shotFor:(t,n)=>{let r=w.captures?.[t]?.[n];return r?.file?c(e,`captures`,r.thumb||r.file,kn):null}}):null,Tn?null:(0,Y.jsx)(xO,{wide:s,commentMode:je,canComment:vn,readyKeys:qn,setCommentMode:Me,showLinks:X,activePage:cr,shownSteps:dr,data:w,presentPages:ur,hiddenLinkTargets:fr,showAllLinks:lr,targetTitle:On,updateParams:h,tipOpen:_t,tryOpen:yt,journey:kt,builder:pt,viewportNotice:ht,dismissTip:wt,modes:z,setMode:Zr,comparePair:Bt}),!w&&S.error?(0,Y.jsx)(U_,{error:S.error,onRetry:S.refetch}):w?(0,Y.jsxs)(Jp,{nodes:Qt,edges:pr,edgeTypes:cS,onNodeMouseEnter:X?(e,t)=>ft(t.type===`page`?t.id:null):void 0,onNodeMouseLeave:X?()=>ft(null):void 0,onNodesChange:en,onNodeClick:Jk,nodeTypes:rS,colorMode:p,defaultViewport:ke.current||void 0,fitView:Bn.current,style:Vn?void 0:{opacity:0},edgesFocusable:!1,fitViewOptions:ME,minZoom:jE,maxZoom:4,panOnScroll:!1,zoomOnScroll:!1,panActivationKeyCode:null,zoomActivationKeyCode:null,onlyRenderVisibleElements:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,zoomOnDoubleClick:!je,onMoveEnd:Wr,onPaneClick:()=>{ln(),U&&Ln()},proOptions:{hideAttribution:!0},children:[(0,Y.jsx)(um,{gap:40,size:1}),(0,Y.jsx)(Kk,{onChecks:ae?le:null,onHistory:hr,historyCountFor:e=>iv(w?.versions,e),focusedKey:Tn?null:an,layout:Zt,data:w,liveKeys:Kn,readyKeys:qn,selectingKey:sn,touch:!s,liveFileFor:Yn,onOpenLive:Zn,onToggleSelect:e=>cn(t=>t===e?null:e),onClose:ln,onCapture:b&&!Bt?e=>Vr(null,[e]):null,captureBusy:st||!!T?.running}),s&&Ne&&!li?(0,Y.jsx)(eT,{point:Bv(Zt.targets,Ne),stowed:Tn,onClose:()=>st?null:Pe(null),children:(0,Y.jsx)(WC,{...Rr,touch:!1,description:Lr})}):null,s&&ai&&!Ne&&!li?(0,Y.jsx)($w,{comment:wn,point:Bv(Zt.targets,wn),onClose:Ln,stowed:Tn,onPrev:()=>Yr(-1),onNext:()=>Yr(1),editingRef:Ue,children:(0,Y.jsx)(Gw,{...ai,onClose:Ln})}):null,(0,Y.jsx)(Bk,{wide:s,clearFocus:ln,setSettledZoom:rn,minimapOn:tt,liveKeys:Kn,toggleMinimap:ci,hideFit:!!(kt||pt),hideMinimap:!!(kt||pt),fitBoard:un})]}):(0,Y.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-sm text-muted`,children:[(0,Y.jsx)(ue,{}),` Loading board`]}),n?.hosted&&!E?(0,Y.jsx)(JT,{touch:!s,enabled:!!w&&!o,boardId:e,canvasRef:Ae,flow:u,selection:U,mode:V,onMode:e=>h({vp:e}),onInvalidate:()=>{C.refetch(),S.refetch()}}):null,yt&&w&&!kt&&!pt&&!Tn&&(!je||s)?(0,Y.jsx)(SE,{touch:!s,done:xt,onOpenComment:()=>{let e=pn.filter(e=>e.status===`open`),t=e.find(e=>V===`all`||e.viewport===V)||e[0]||pn[0];t&&Rn(t)},onComment:vn&&!Bt?()=>{Pe(null),Me(!0)}:null,onAgent:ye?De:null,onClose:Tt}):null,(0,Y.jsx)(DO,{toast:Ye,setToast:Ze,onHold:Qe,wide:s,raised:!!(kt||pt)}),Bt&&Vt&&Wt&&!Xt.length?(0,Y.jsx)(`p`,{className:`absolute inset-x-0 top-1/3 mx-auto w-max max-w-[90%] rounded-lg bg-surface px-4 py-3 text-sm text-muted shadow-pop`,children:`No visual changes between these two environments.`}):null,pt?(0,Y.jsx)(IC,{draft:pt,pages:w?.board?.pages||[],onChange:mt,onSave:ir,onCancel:()=>mt(null),pageTitle:e=>Dn(e)?.title||e,busy:st,touch:!s}):kt&&!Tn?(0,Y.jsx)(FC,{journey:kt,route:At,step:Nt,pageTitle:e=>Dn(e)?.title||e,onStep:er,onChoose:tr,onClose:$n,onEdit:()=>nr(kt),onDelete:ar,canEdit:y&&kt.source===`board`,busy:st,touch:!s},kt.id):null]}),(0,Y.jsx)(jO,{wide:s,checksOpen:W,checksProps:ui,chatThread:be,chatProps:oi,panelHidden:ie,panelProps:ii,updateParams:h})]})]})]}),(0,Y.jsx)(TT,{ref:Oe})]}),s?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(RO,{checksOpen:W,closeChecks:de,checksProps:ui,chatAvailable:ye,chatThread:be,chatProps:oi,updateParams:h,sheetOpen:q,setSheetOpen:Fe,panelProps:ii,threadSheet:Ie,threadProps:ai,closeThread:Ln,selectedComment:wn,targetTitle:On,draft:Ne,busy:st,setDraft:Pe,draftDescription:Lr,composerProps:Rr}),(0,Y.jsx)(bO,{...mi,menuOpen:Ge})]}),$r.offered?(0,Y.jsx)(CC,{open:!!ei,onClose:()=>{ti(null),$r.setError(null)},ids:ei||[],comments:D,max:$r.max,agentName:ri.agentName,targetTitle:On,busy:$r.busy,error:$r.error,touch:!s,onStart:async e=>{await $r.start(e)&&ti(null)}}):null,(0,Y.jsx)(ek,{info:n,boardId:e,boards:t,wide:s,shareOpen:g,setShareOpen:_,refetchView:jn,settingsAvailable:xe,settingsOpen:we,updateParams:h,onInfoChanged:i,generalSettingsOpen:Ce,updates:Oe,historyPage:gr,closeHistory:vr,historyViewport:_r,historyPageId:Et,data:w,comments:D,filter:H,focusComment:Rn,onImageError:Pn,captureConfirm:zr,setCaptureConfirm:Br,busy:st,focusedPage:sr,findPage:Dn,startCapture:Vr}),(0,Y.jsx)(gD,{open:nt,onOpenChange:rt,groups:br,journeys:Ot,canEditJourneys:y,comments:D,titleOf:On,actions:pi,onPage:e=>{Wn(),yr(e)},onJourney:e=>{Wn(),Qn(e)},onNewJourney:()=>{Wn(),nr()},onComment:e=>{Wn(),Rn(e)},onCloseAutoFocus:Gn})]})}function Qk({board:e,view:t,people:n,children:r}){return(0,Y.jsx)(vv.Provider,{value:e,children:(0,Y.jsx)(Eb.Provider,{value:t,children:(0,Y.jsx)(ib.Provider,{value:n,children:r})})})}function $k(){let[e,t]=(0,J.useState)(``),[n,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(``);(0,J.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await Ke.get(`/api/pairing`);if(!e)return;i(t),(t.pairing.state===`approved`||[`host`,`device`,`identity`].includes(t.access))&&window.location.reload()}catch(t){e&&o(t.message)}};t();let n=setInterval(t,2e3);return()=>{e=!1,clearInterval(n)}},[]);let s=async t=>{t.preventDefault(),o(``);try{let t=await Ke.post(`/api/pairing`,{name:e});i(e=>({...e,pairing:t}))}catch(e){o(e.message)}},c=n?.pairing,l=c?.code,u=/iPad|iPhone|iPod/.test(navigator.userAgent),d=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone;return(0,Y.jsxs)(`main`,{className:`mx-auto flex min-h-dvh max-w-lg flex-col justify-center gap-5 p-6`,"data-sw-pairing":!0,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:`Shapewall`}),(0,Y.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold text-fg`,children:`Pair this device`})]}),(0,Y.jsx)(`p`,{className:`text-sm text-muted`,children:`This board belongs to the person running Shapewall. Match the code and approve this device on that computer.`}),c?.state===`pending`?(0,Y.jsxs)(`section`,{className:`space-y-3 rounded-lg border border-line p-4`,"aria-live":`polite`,children:[(0,Y.jsxs)(`p`,{className:`text-sm text-fg`,children:[`Waiting for approval: `,c.name]}),(0,Y.jsxs)(`p`,{className:`font-mono text-3xl tracking-widest text-fg`,"data-sw-pairing-code":!0,children:[l.slice(0,4),`-`,l.slice(4)]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Expires in five minutes. On the host, open Devices or run `,(0,Y.jsxs)(`code`,{children:[`shapewall devices approve `,l]}),`.`]})]}):(0,Y.jsxs)(`form`,{className:`space-y-3`,onSubmit:s,children:[[`denied`,`expired`].includes(c?.state)?(0,Y.jsxs)(`p`,{className:`text-sm text-warn`,role:`status`,children:[c.state===`denied`?`The host denied this request.`:`This request expired.`,` You can request again.`]}):null,(0,Y.jsx)(`label`,{htmlFor:`device-name`,className:`block text-sm text-fg`,children:`Device name`}),(0,Y.jsx)(Ge,{id:`device-name`,required:!0,maxLength:80,placeholder:`My phone`,value:e,onChange:e=>t(e.target.value)}),(0,Y.jsx)(r,{type:`submit`,children:`Request pairing`})]}),a?(0,Y.jsx)(`p`,{className:`text-sm text-bad`,role:`alert`,children:a}):null,n?.secure?null:(0,Y.jsx)(`p`,{className:`rounded-lg border border-warn/30 p-3 text-xs text-warn`,children:`Plain HTTP on Wi-Fi exposes your device cookie to sniffing and replay. Use Tailscale for private HTTPS, or configure a TLS certificate. Without HTTPS this board installs only as a bookmark.`}),u&&!d?(0,Y.jsx)(`p`,{className:`text-xs text-muted`,children:`Installing on your iPhone? Add the board to your Home Screen first, then pair from inside that app. Its cookies are separate from Safari.`}):null]})}function eA({info:e}){let[t,n]=(0,J.useState)(!1),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(``),c=e?.remote,l=!!c?.manage;(0,J.useEffect)(()=>{if(!l)return;let e=!0,t=async()=>{try{let t=await Ke.get(`/api/devices`);e&&a(t)}catch(t){e&&s(t.message)}};t();let n=setInterval(t,4e3);return()=>{e=!1,clearInterval(n)}},[l]);let u=async(e,t)=>{try{await Ke[e](t),l?a(await Ke.get(`/api/devices`)):window.location.reload()}catch(e){s(e.message)}};if(!c||!l&&!c.device)return null;let d=i?.pending||[];return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`fixed bottom-3 left-3 z-30 rounded-lg border border-line bg-surface p-1 shadow-lg lg:bottom-16 lg:left-[64px]`,children:(0,Y.jsx)(r,{size:`sm`,variant:`ghost`,onClick:()=>n(!0),"data-sw-devices-open":!0,children:l?`Devices${d.length?` (${d.length} waiting)`:``}`:c.device.name})}),(0,Y.jsx)(M,{open:t,onClose:()=>n(!1),title:l?`Your devices`:`This device`,children:(0,Y.jsxs)(`div`,{className:`max-h-[70dvh] space-y-4 overflow-auto p-5`,"data-sw-devices":!0,children:[o?(0,Y.jsx)(`p`,{role:`alert`,className:`text-sm text-bad`,children:o}):null,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted`,children:`Approve only your own devices, after matching the code shown on them. Paired devices can comment, capture and drive your connected agent.`}),d.map(e=>(0,Y.jsxs)(`section`,{className:`space-y-2 rounded border border-line p-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`break-all text-xs text-muted`,children:[e.browser,` · `,e.ip]}),(0,Y.jsxs)(`p`,{className:`font-mono text-lg text-fg`,children:[e.code.slice(0,4),`-`,e.code.slice(4)]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(r,{size:`sm`,onClick:()=>u(`post`,`/api/devices/${e.code}/approve`),children:`Approve`}),(0,Y.jsx)(r,{size:`sm`,variant:`secondary`,onClick:()=>u(`post`,`/api/devices/${e.code}/deny`),children:`Deny`})]})]},e.id)),(i?.devices||[]).map(e=>(0,Y.jsxs)(`section`,{className:`flex items-center justify-between gap-2 rounded border border-line p-3`,children:[(0,Y.jsxs)(`p`,{className:`min-w-0 break-words text-sm text-fg`,children:[e.name,(0,Y.jsxs)(`span`,{className:`block text-xs text-muted`,children:[`Last seen `,new Date(e.lastSeenAt).toLocaleDateString()]})]}),(0,Y.jsx)(r,{size:`sm`,variant:`secondary`,onClick:()=>u(`delete`,`/api/devices/${e.id}`),children:`Revoke`})]},e.id)),!d.length&&!i?.devices?.length?(0,Y.jsx)(`p`,{className:`text-sm text-muted`,children:`No paired devices or requests yet.`}):null]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Paired as `,c.device.name,`. Settings and other devices are managed on the host computer.`]}),(0,Y.jsx)(r,{variant:`secondary`,onClick:()=>u(`delete`,`/api/devices/${c.device.id}`),children:`Revoke this device`})]})]})})]})}var tA=(0,J.lazy)(()=>xT(()=>import(`./BuzzDialog-Ds7Thpfe.js`),__vite__mapDeps([11,1]),import.meta.url)),nA=!E&&typeof document<`u`&&!!document.querySelector(`meta[name="shapewall-remote"]`);function rA(){let[e,t]=(0,J.useState)(!1),[n,i]=(0,J.useState)(!1),a=ge(n);(0,J.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener(`shapewall:pairing-required`,e),()=>window.removeEventListener(`shapewall:pairing-required`,e)},[]);let o=Xe(nA?`/api/pairing`:null),s=!nA||[`host`,`device`,`identity`].includes(o.data?.access),c=Xe(s?`/api/info`:null);eC(c.refetch,!!c.data?.agent);let l=c.data?.agent?.ownerWrites===!0;(0,J.useEffect)(()=>US(l),[l]);let u=j(),d=Xe(s?`/api/boards`:null),[f,p]=We(),m=Array.isArray(d.data?.boards)?d.data.boards:[],h=f.get(`board`),g=m.find(e=>e.id===h)||m[0];me(c.data?.fixturesAt);let _=E?u?.shareProblem:null;iA(_?`Share link`:g?.title);let v=E&&f.has(`share`);return(0,J.useEffect)(()=>{v&&p({share:null})},[v,p]),nA&&!o.loading&&!s||e||c.error?.code===`pairing_required`||d.error?.code===`pairing_required`?(0,Y.jsx)($k,{}):_?(0,Y.jsx)(jT,{problem:_,onLeave:u.leaveShare}):d.loading||c.loading?(0,Y.jsx)(B_,{}):d.error?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(U_,{error:d.error,onRetry:()=>Promise.all([d.refetch(),c.error?c.refetch():null]),extra:E?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r,{asChild:!0,size:`touch`,variant:`secondary`,className:`lg:h-10`,children:(0,Y.jsx)(`a`,{href:`console.html#/signin`,children:`Sign in to the demo`})}),(0,Y.jsx)(r,{size:`touch`,variant:`ghost`,className:`lg:h-10`,onClick:()=>u?.reset(),children:`Reset the demo`})]}):null}),E?(0,Y.jsx)(kT,{}):null]}):g?(0,Y.jsxs)(L,{children:[(0,Y.jsx)(eA,{info:c.data}),c.data?.buzzAvailable===!0&&a?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(tA,{open:n,onClose:()=>i(!1),boardId:g.id},g.id)}):null,(0,Y.jsx)(Wp,{children:(0,Y.jsx)(Zk,{boardId:g.id,boards:m,info:c.data,onInfoChanged:c.refetch,onOpenBuzz:()=>i(!0),onPickBoard:e=>p({board:e,c:null,v:null})})},g.id)]}):(0,Y.jsx)(`div`,{className:`flex h-full bg-sunken`,children:(0,Y.jsx)(k,{size:`lg`,icon:eg,title:`No boards yet`,children:c.data?.hosted?(0,Y.jsxs)(Y.Fragment,{children:[`Capture your site locally, then run `,(0,Y.jsx)(`code`,{className:`font-mono text-ui text-fg`,children:`shapewall push`}),` with a project token.`]}):(0,Y.jsxs)(Y.Fragment,{children:[`Add pages to `,(0,Y.jsx)(`code`,{className:`font-mono text-ui text-fg`,children:`shapewall.config.json`}),`, then run`,` `,(0,Y.jsx)(`code`,{className:`font-mono text-ui text-fg`,children:`shapewall capture`}),`.`]})})})}function iA(e){(0,J.useEffect)(()=>{if(!E||!e)return;let t=String(e).replace(/\s*\(demo\)$/i,``);document.title=t===`Share link`?`Share link · Shapewall demo`:`${t} board · Shapewall demo`},[e])}function aA(){typeof navigator<`u`&&`serviceWorker`in navigator&&window.isSecureContext&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`./sw.js`,{scope:`./`}).catch(()=>{})})}var oA=900;function sA(){try{let e=document.createElement(`div`);e.style.cssText=`position:absolute;top:-999px;width:100px;height:100px;overflow:scroll;visibility:hidden`,document.documentElement.appendChild(e);let t=e.offsetWidth-e.clientWidth>0;return e.remove(),t}catch{return!1}}function cA(){let e=new WeakMap;document.addEventListener(`scroll`,t=>{let n=t.target===document?document.documentElement:t.target;n instanceof Element&&(n.hasAttribute(`data-scrolling`)||n.setAttribute(`data-scrolling`,``),clearTimeout(e.get(n)),e.set(n,setTimeout(()=>n.removeAttribute(`data-scrolling`),oA)))},{capture:!0,passive:!0})}typeof document<`u`&&sA()&&(document.documentElement.classList.add(`sw-scrollbars`),cA()),document.querySelector(`meta[name="shapewall-agent-settings"]`)?xT(async()=>{let{default:e}=await import(`./Management-CJVNAqAW.js`);return{default:e}},__vite__mapDeps([12,7,1,5,2]),import.meta.url).then(({default:e})=>(0,rt.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(e,{}))):((0,rt.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(J.StrictMode,{children:(0,Y.jsx)(rA,{})})),aA());export{Jg as $,lC as A,Vb as B,dw as C,eh as Ct,mC as D,pC as E,eC as F,E_ as G,P_ as H,OS as I,m_ as J,b_ as K,SS as L,sC as M,nC as N,oC as O,cC as P,Qg as Q,Bb as R,lw as S,nh as St,EC as T,A_ as U,rv as V,O_ as W,i_ as X,u_ as Y,n_ as Z,ow as _,bh as _t,mT as a,mg as at,rw as b,uh as bt,jw as c,cg as ct,Sw as d,Wh as dt,Kg as et,xw as f,Hh as ft,sw as g,Eh as gt,_w as h,Ah as ht,gE as i,Sg as it,aC as j,rC as k,bw as l,ng as lt,hw as m,Mh as mt,tE as n,Bg as nt,hT as o,fg as ot,Pw as p,Rh as pt,v_ as q,nE as r,wg as rt,Mw as s,ug as st,AE as t,Wg as tt,Fw as u,Xh as ut,iw as v,vh as vt,GC as w,Wm as wt,cw as x,oh as xt,aw as y,mh as yt,zb as z};