comfy-ts 2.10.0 → 2.12.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 (110) hide show
  1. package/README.md +1 -0
  2. package/dist/{LogsSt-DFxzQfDc.js → LogsSt-U1H0mP1m.js} +35 -5
  3. package/dist/LogsSt-U1H0mP1m.js.map +1 -0
  4. package/dist/cli.js +4 -4
  5. package/dist/index.cjs +565 -62
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +210 -31
  8. package/dist/index.d.ts +210 -31
  9. package/dist/index.js +561 -63
  10. package/dist/index.js.map +1 -1
  11. package/dist/{run-serve-_nrvJYyt.js → run-serve-BeAznay5.js} +549 -43
  12. package/dist/run-serve-BeAznay5.js.map +1 -0
  13. package/dist/{run-tui-Atvf9vb3.js → run-tui-BTGjvnKk.js} +75 -18
  14. package/dist/run-tui-BTGjvnKk.js.map +1 -0
  15. package/dist/{DefinedWorkflow-BatWaZO1.js → schemaDrift-Cg39vs53.js} +644 -60
  16. package/dist/schemaDrift-Cg39vs53.js.map +1 -0
  17. package/dist/serve-web.js +523 -133
  18. package/dist/{state-6RFDIQwJ.js → state-C7REnHan.js} +18 -3
  19. package/dist/{state-6RFDIQwJ.js.map → state-C7REnHan.js.map} +1 -1
  20. package/dist/web.d.ts +210 -31
  21. package/dist/web.js +561 -63
  22. package/dist/web.js.map +1 -1
  23. package/examples/comfy-cloud/capybara-i2v.cflow.ts +2 -0
  24. package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +2 -0
  25. package/examples/comfy-cloud/wan22-i2v.cflow.ts +2 -0
  26. package/examples/comfy-cloud/wan22-t2v.cflow.ts +2 -0
  27. package/examples/rvion/06-qwen-image-edit.cflow.ts +3 -2
  28. package/examples/rvion/07-local-llm-text-gen.cflow.ts +2 -2
  29. package/examples/rvion/10-anima-t2i.cflow.ts +229 -0
  30. package/extra/README.md +4 -0
  31. package/extra/comfyui-fresh-model-lists/README.md +25 -0
  32. package/extra/comfyui-fresh-model-lists/__init__.py +36 -0
  33. package/extra/comfyui-fresh-model-lists/test_fresh_model_lists.py +97 -0
  34. package/package.json +17 -7
  35. package/src/cli/draftMeta.ts +39 -0
  36. package/src/cli/serve/ServeApp.ts +242 -12
  37. package/src/cli/serve/applyVarPayload.ts +50 -22
  38. package/src/cli/serve/describeVar.ts +49 -6
  39. package/src/cli/serve/favicon.ts +3 -0
  40. package/src/cli/serve/llmConfigShape.ts +51 -0
  41. package/src/cli/serve/llmConfigs.ts +52 -0
  42. package/src/cli/serve/tagList.ts +92 -0
  43. package/src/cli/serve/tagSource.ts +69 -0
  44. package/src/cli/serve/web/api.ts +60 -0
  45. package/src/cli/serve/web/components/App.tsx +336 -44
  46. package/src/cli/serve/web/components/Gallery.tsx +105 -28
  47. package/src/cli/serve/web/components/HistoryPicker.tsx +149 -0
  48. package/src/cli/serve/web/components/Icon.tsx +18 -2
  49. package/src/cli/serve/web/components/MenuButton.tsx +53 -0
  50. package/src/cli/serve/web/components/Omnibox.tsx +85 -0
  51. package/src/cli/serve/web/components/PromptEnhancer.tsx +476 -180
  52. package/src/cli/serve/web/components/TooltipLayer.tsx +45 -0
  53. package/src/cli/serve/web/components/VarIcon.tsx +24 -0
  54. package/src/cli/serve/web/components/VarsForm.tsx +341 -177
  55. package/src/cli/serve/web/components/controls/BasicControls.tsx +57 -32
  56. package/src/cli/serve/web/components/controls/LorasControl.tsx +708 -285
  57. package/src/cli/serve/web/components/controls/PresetPicker.tsx +1 -1
  58. package/src/cli/serve/web/components/controls/PromptControl.tsx +279 -0
  59. package/src/cli/serve/web/components/controls/PromptEditor.tsx +113 -0
  60. package/src/cli/serve/web/components/controls/SeedControl.tsx +17 -10
  61. package/src/cli/serve/web/components/controls/SizeControl.tsx +111 -18
  62. package/src/cli/serve/web/components/modKey.ts +2 -0
  63. package/src/cli/serve/web/llm.ts +23 -12
  64. package/src/cli/serve/web/promptEditor/promptExtensions.ts +281 -0
  65. package/src/cli/serve/web/state/EnhancerSt.ts +415 -100
  66. package/src/cli/serve/web/state/FormSt.ts +193 -29
  67. package/src/cli/serve/web/state/OmniboxSt.ts +57 -0
  68. package/src/cli/serve/web/state/WebSt.ts +281 -57
  69. package/src/cli/serve/web/state/choiceButtons.ts +61 -0
  70. package/src/cli/serve/web/state/generateButton.ts +16 -0
  71. package/src/cli/serve/web/state/history.ts +54 -0
  72. package/src/cli/serve/web/state/host.ts +5 -2
  73. package/src/cli/serve/web/state/keptLines.ts +53 -0
  74. package/src/cli/serve/web/state/latentMode.ts +20 -0
  75. package/src/cli/serve/web/state/loraSort.ts +57 -0
  76. package/src/cli/serve/web/state/moduleTree.ts +2 -2
  77. package/src/cli/serve/web/state/omnibox.ts +69 -0
  78. package/src/cli/serve/web/state/payload.ts +38 -58
  79. package/src/cli/serve/web/state/shortcuts.ts +54 -0
  80. package/src/cli/serve/web/state/sizeStars.ts +31 -0
  81. package/src/cli/serve/web/state/stableSlots.ts +21 -0
  82. package/src/cli/serve/web/state/varGroups.ts +24 -0
  83. package/src/cli/serve/web/styles.ts +472 -118
  84. package/src/cli/serve/webBundle.ts +54 -10
  85. package/src/cli/tui/components/Header.tsx +2 -0
  86. package/src/cli/tui/components/PickerOverlays.tsx +9 -2
  87. package/src/cli/tui/imagePicker/ImagePickerSt.ts +1 -1
  88. package/src/cli/tui/state/DraftsSt.ts +18 -2
  89. package/src/cli/tui/state/EditorSt.ts +1 -1
  90. package/src/cli/tui/state/HostSt.ts +34 -0
  91. package/src/cli/tui/state/LorasSt.ts +1 -1
  92. package/src/cli/tui/state/PickerSt.ts +25 -7
  93. package/src/cli/tui/state/SettingsSt.ts +1 -1
  94. package/src/cli/tui/state/TuiSt.ts +10 -0
  95. package/src/coreExports.ts +20 -0
  96. package/src/host/ComfyHost.ts +15 -0
  97. package/src/host/loraInfoCache.ts +70 -0
  98. package/src/host/loraManagerApi.ts +27 -0
  99. package/src/host/schemaDrift.ts +87 -0
  100. package/src/state.ts +5 -0
  101. package/src/vars/ComfyVars.ts +337 -67
  102. package/src/vars/DefinedWorkflow.ts +40 -19
  103. package/src/vars/lanes.ts +238 -0
  104. package/src/vars/loraEntry.ts +101 -0
  105. package/src/vars/promptSyntax.ts +382 -0
  106. package/dist/DefinedWorkflow-BatWaZO1.js.map +0 -1
  107. package/dist/LogsSt-DFxzQfDc.js.map +0 -1
  108. package/dist/run-serve-_nrvJYyt.js.map +0 -1
  109. package/dist/run-tui-Atvf9vb3.js.map +0 -1
  110. package/src/cli/serve/web/components/Sidebar.tsx +0 -66
package/dist/serve-web.js CHANGED
@@ -1,22 +1,58 @@
1
- var _y=Object.defineProperty;var xy=(e,t,n)=>{for(var a in t)_y(e,a,{get:t[a],set:n[a],enumerable:!0,configurable:!0})};function Um(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Um)}catch(e){console.error(e)}}var Bn={};xy(Bn,{unstable_now:()=>dt,unstable_IdlePriority:()=>ql,unstable_ImmediatePriority:()=>Gl,unstable_LowPriority:()=>Yl,unstable_NormalPriority:()=>Hn,unstable_Profiling:()=>_f,unstable_UserBlockingPriority:()=>Kl,unstable_cancelCallback:()=>Xl,unstable_forceFrameRate:()=>xf,unstable_getCurrentPriorityLevel:()=>Ql,unstable_next:()=>Ef,unstable_requestPaint:()=>Zl,unstable_runWithPriority:()=>wf,unstable_scheduleCallback:()=>jn,unstable_shouldYield:()=>$l,unstable_wrapCallback:()=>Nf},{unstable_now:(N_)=>dt=N_,unstable_IdlePriority:(N_)=>ql=N_,unstable_ImmediatePriority:(N_)=>Gl=N_,unstable_LowPriority:(N_)=>Yl=N_,unstable_NormalPriority:(N_)=>Hn=N_,unstable_Profiling:(N_)=>_f=N_,unstable_UserBlockingPriority:(N_)=>Kl=N_,unstable_cancelCallback:(N_)=>Xl=N_,unstable_forceFrameRate:(N_)=>xf=N_,unstable_getCurrentPriorityLevel:(N_)=>Ql=N_,unstable_next:(N_)=>Ef=N_,unstable_requestPaint:(N_)=>Zl=N_,unstable_runWithPriority:(N_)=>wf=N_,unstable_scheduleCallback:(N_)=>jn=N_,unstable_shouldYield:(N_)=>$l=N_,unstable_wrapCallback:(N_)=>Nf=N_});function Qr(e,t){var n=e.length;e.push(t);e:for(;0<n;){var a=n-1>>>1,i=e[a];if(0<Vl(i,t))e[a]=t,e[n]=i,n=a;else break e}}function St(e){return e.length===0?null:e[0]}function jl(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var a=0,i=e.length,l=i>>>1;a<l;){var o=2*(a+1)-1,r=e[o],u=o+1,c=e[u];if(0>Vl(r,n))u<i&&0>Vl(c,r)?(e[a]=c,e[u]=n,a=u):(e[a]=r,e[o]=n,a=o);else if(u<i&&0>Vl(c,n))e[a]=c,e[u]=n,a=u;else break e}}return t}function Vl(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}var dt=void 0;if(typeof performance==="object"&&typeof performance.now==="function")Zr=performance,dt=function(){return Zr.now()};else Ll=Date,$r=Ll.now(),dt=function(){return Ll.now()-$r};var Zr,Ll,$r,Dt=[],ln=[],Ey=1,$e=null,Oe=3,Jr=!1,Si=!1,_i=!1,Wr=!1,vf=typeof setTimeout==="function"?setTimeout:null,gf=typeof clearTimeout==="function"?clearTimeout:null,mf=typeof setImmediate<"u"?setImmediate:null;function Bl(e){for(var t=St(ln);t!==null;){if(t.callback===null)jl(ln);else if(t.startTime<=e)jl(ln),t.sortIndex=t.expirationTime,Qr(Dt,t);else break;t=St(ln)}}function Pr(e){if(_i=!1,Bl(e),!Si)if(St(Dt)!==null)Si=!0,ga||(ga=!0,va());else{var t=St(ln);t!==null&&Ir(Pr,t.startTime-e)}}var ga=!1,xi=-1,yf=5,bf=-1;function Sf(){return Wr?!0:Bn.unstable_now()-bf<yf?!1:!0}function Xr(){if(Wr=!1,ga){var e=Bn.unstable_now();bf=e;var t=!0;try{e:{Si=!1,_i&&(_i=!1,gf(xi),xi=-1),Jr=!0;var n=Oe;try{t:{Bl(e);for($e=St(Dt);$e!==null&&!($e.expirationTime>e&&Sf());){var a=$e.callback;if(typeof a==="function"){$e.callback=null,Oe=$e.priorityLevel;var i=a($e.expirationTime<=e);if(e=Bn.unstable_now(),typeof i==="function"){$e.callback=i,Bl(e),t=!0;break t}$e===St(Dt)&&jl(Dt),Bl(e)}else jl(Dt);$e=St(Dt)}if($e!==null)t=!0;else{var l=St(ln);l!==null&&Ir(Pr,l.startTime-e),t=!1}}break e}finally{$e=null,Oe=n,Jr=!1}t=void 0}}finally{t?va():ga=!1}}}var va;if(typeof mf==="function")va=function(){mf(Xr)};else if(typeof MessageChannel<"u")Hl=new MessageChannel,Fr=Hl.port2,Hl.port1.onmessage=Xr,va=function(){Fr.postMessage(null)};else va=function(){vf(Xr,0)};var Hl,Fr;function Ir(e,t){xi=vf(function(){e(Bn.unstable_now())},t)}var ql=5,Gl=1,Yl=4,Hn=3,_f=null,Kl=2,Xl=function(e){e.callback=null},xf=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"):yf=0<e?Math.floor(1000/e):5},Ql=function(){return Oe},Ef=function(e){switch(Oe){case 1:case 2:case 3:var t=3;break;default:t=Oe}var n=Oe;Oe=t;try{return e()}finally{Oe=n}},Zl=function(){Wr=!0},wf=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=Oe;Oe=e;try{return t()}finally{Oe=n}},jn=function(e,t,n){var a=Bn.unstable_now();switch(typeof n==="object"&&n!==null?(n=n.delay,n=typeof n==="number"&&0<n?a+n:a):n=a,e){case 1:var i=-1;break;case 2:i=250;break;case 5:i=1073741823;break;case 4:i=1e4;break;default:i=5000}return i=n+i,e={id:Ey++,callback:t,priorityLevel:e,startTime:n,expirationTime:i,sortIndex:-1},n>a?(e.sortIndex=n,Qr(ln,e),St(Dt)===null&&e===St(ln)&&(_i?(gf(xi),xi=-1):_i=!0,Ir(Pr,n-a))):(e.sortIndex=i,Qr(Dt,e),Si||Jr||(Si=!0,ga||(ga=!0,va()))),e},$l=Sf,Nf=function(e){var t=Oe;return function(){var n=Oe;Oe=t;try{return e.apply(this,arguments)}finally{Oe=n}}};var wy=Symbol.for("react.forward_ref");var Ny=Symbol.for("react.memo");var Of={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Oy=Object.assign,Af={};function Ei(e,t,n){this.props=e,this.context=t,this.refs=Af,this.updater=n||Of}Ei.prototype.isReactComponent={};Ei.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ei.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Tf(){}Tf.prototype=Ei.prototype;function Df(e,t,n){this.props=e,this.context=t,this.refs=Af,this.updater=n||Of}var es=Df.prototype=new Tf;es.constructor=Df;Oy(es,Ei.prototype);es.isPureReactComponent=!0;var wi={H:null,A:null,T:null,S:null};var Jl=wi;var Ni=function(e){return{$$typeof:wy,render:e}};var Oi=function(e,t){return{$$typeof:Ny,type:e,compare:t===void 0?null:t}};var zf=function(){};var be=function(e,t){return wi.H.useEffect(e,t)};var zt=function(e){return wi.H.useRef(e)},ya=function(e){return wi.H.useState(e)},Fl=function(e,t,n){return wi.H.useSyncExternalStore(e,t,n)};var ns="19.2.8";function Rf(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rf)}catch(e){console.error(e)}}function Ay(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 on(){}var Ty={d:{f:on,r:function(){throw Error(Ay(522))},D:on,C:on,L:on,m:on,X:on,S:on,M:on},p:0,findDOMNode:null};var as=Ty;Rf();function _(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 zy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ml(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function th(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 nh(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 Mf(e){if(ml(e)!==e)throw Error(_(188))}function Ry(e){var t=e.alternate;if(!t){if(t=ml(e),t===null)throw Error(_(188));return t!==e?null:e}for(var n=e,a=t;;){var i=n.return;if(i===null)break;var l=i.alternate;if(l===null){if(a=i.return,a!==null){n=a;continue}break}if(i.child===l.child){for(l=i.child;l;){if(l===n)return Mf(i),e;if(l===a)return Mf(i),t;l=l.sibling}throw Error(_(188))}if(n.return!==a.return)n=i,a=l;else{for(var o=!1,r=i.child;r;){if(r===n){o=!0,n=i,a=l;break}if(r===a){o=!0,a=i,n=l;break}r=r.sibling}if(!o){for(r=l.child;r;){if(r===n){o=!0,n=l,a=i;break}if(r===a){o=!0,a=l,n=i;break}r=r.sibling}if(!o)throw Error(_(189))}}if(n.alternate!==a)throw Error(_(190))}if(n.tag!==3)throw Error(_(188));return n.stateNode.current===n?e:t}function ah(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=ah(e),t!==null)return t;e=e.sibling}return null}var ae=Object.assign,My=Symbol.for("react.element"),Wl=Symbol.for("react.transitional.element"),Ci=Symbol.for("react.portal"),wa=Symbol.for("react.fragment"),ih=Symbol.for("react.strict_mode"),Vs=Symbol.for("react.profiler"),lh=Symbol.for("react.consumer"),Bt=Symbol.for("react.context"),Cu=Symbol.for("react.forward_ref"),Ls=Symbol.for("react.suspense"),Bs=Symbol.for("react.suspense_list"),ku=Symbol.for("react.memo"),rn=Symbol.for("react.lazy"),Hs=Symbol.for("react.activity"),Cy=Symbol.for("react.memo_cache_sentinel"),Cf=Symbol.iterator;function Ai(e){if(e===null||typeof e!=="object")return null;return e=Cf&&e[Cf]||e["@@iterator"],typeof e==="function"?e:null}var ky=Symbol.for("react.client.reference");function js(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===ky?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case wa:return"Fragment";case Vs:return"Profiler";case ih:return"StrictMode";case Ls:return"Suspense";case Bs:return"SuspenseList";case Hs:return"Activity"}if(typeof e==="object")switch(e.$$typeof){case Ci:return"Portal";case Bt:return e.displayName||"Context";case lh:return(e._context.displayName||"Context")+".Consumer";case Cu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ku:return t=e.displayName||null,t!==null?t:js(e.type)||"Memo";case rn:t=e._payload,e=e._init;try{return js(e(t))}catch(n){}}return null}var ki=Array.isArray,z=Jl,X=as,Zn={pending:!1,data:null,method:null,action:null},qs=[],Na=-1;function Nt(e){return{current:e}}function ye(e){0>Na||(e.current=qs[Na],qs[Na]=null,Na--)}function P(e,t){Na++,qs[Na]=e.current,e.current=t}var wt=Nt(null),tl=Nt(null),yn=Nt(null),To=Nt(null);function Do(e,t){switch(P(yn,t),P(tl,e),P(wt,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)?(e=e.namespaceURI)?Bd(e):0:0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Bd(t),e=wm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ye(wt),P(wt,e)}function Ya(){ye(wt),ye(tl),ye(yn)}function Gs(e){e.memoizedState!==null&&P(To,e);var t=wt.current,n=wm(t,e.type);t!==n&&(P(tl,e),P(wt,n))}function zo(e){tl.current===e&&(ye(wt),ye(tl)),To.current===e&&(ye(To),dl._currentValue=Zn)}var is,kf;function Gn(e){if(is===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);is=t&&t[1]||"",kf=-1<n.stack.indexOf(`
1
+ var $_=Object.defineProperty;var x0=(e,t,n)=>{for(var i in t)$_(e,i,{get:t[i],set:n[i],enumerable:!0,configurable:!0})};function gk(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gk)}catch(e){console.error(e)}}var Eo={};x0(Eo,{unstable_now:()=>Un,unstable_IdlePriority:()=>Mc,unstable_ImmediatePriority:()=>_c,unstable_LowPriority:()=>Dc,unstable_NormalPriority:()=>Co,unstable_Profiling:()=>O0,unstable_UserBlockingPriority:()=>Lc,unstable_cancelCallback:()=>zc,unstable_forceFrameRate:()=>R0,unstable_getCurrentPriorityLevel:()=>Bc,unstable_next:()=>N0,unstable_requestPaint:()=>Pc,unstable_runWithPriority:()=>T0,unstable_scheduleCallback:()=>Ao,unstable_shouldYield:()=>Ic,unstable_wrapCallback:()=>M0},{unstable_now:(G6)=>Un=G6,unstable_IdlePriority:(G6)=>Mc=G6,unstable_ImmediatePriority:(G6)=>_c=G6,unstable_LowPriority:(G6)=>Dc=G6,unstable_NormalPriority:(G6)=>Co=G6,unstable_Profiling:(G6)=>O0=G6,unstable_UserBlockingPriority:(G6)=>Lc=G6,unstable_cancelCallback:(G6)=>zc=G6,unstable_forceFrameRate:(G6)=>R0=G6,unstable_getCurrentPriorityLevel:(G6)=>Bc=G6,unstable_next:(G6)=>N0=G6,unstable_requestPaint:(G6)=>Pc=G6,unstable_runWithPriority:(G6)=>T0=G6,unstable_scheduleCallback:(G6)=>Ao=G6,unstable_shouldYield:(G6)=>Ic=G6,unstable_wrapCallback:(G6)=>M0=G6});function lp(e,t){var n=e.length;e.push(t);e:for(;0<n;){var i=n-1>>>1,r=e[i];if(0<Ac(r,t))e[i]=t,e[n]=r,n=i;else break e}}function di(e){return e.length===0?null:e[0]}function Tc(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var i=0,r=e.length,o=r>>>1;i<o;){var s=2*(i+1)-1,l=e[s],a=s+1,u=e[a];if(0>Ac(l,n))a<r&&0>Ac(u,l)?(e[i]=u,e[a]=n,i=a):(e[i]=l,e[s]=n,i=s);else if(a<r&&0>Ac(u,n))e[i]=u,e[a]=n,i=a;else break e}}return t}function Ac(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}var Un=void 0;if(typeof performance==="object"&&typeof performance.now==="function")ap=performance,Un=function(){return ap.now()};else Oc=Date,up=Oc.now(),Un=function(){return Oc.now()-up};var ap,Oc,up,Pi=[],kr=[],G_=1,pn=null,St=3,cp=!1,la=!1,aa=!1,hp=!1,S0=typeof setTimeout==="function"?setTimeout:null,k0=typeof clearTimeout==="function"?clearTimeout:null,w0=typeof setImmediate<"u"?setImmediate:null;function Rc(e){for(var t=di(kr);t!==null;){if(t.callback===null)Tc(kr);else if(t.startTime<=e)Tc(kr),t.sortIndex=t.expirationTime,lp(Pi,t);else break;t=di(kr)}}function dp(e){if(aa=!1,Rc(e),!la)if(di(Pi)!==null)la=!0,ks||(ks=!0,Ss());else{var t=di(kr);t!==null&&pp(dp,t.startTime-e)}}var ks=!1,ua=-1,E0=5,C0=-1;function A0(){return hp?!0:Eo.unstable_now()-C0<E0?!1:!0}function sp(){if(hp=!1,ks){var e=Eo.unstable_now();C0=e;var t=!0;try{e:{la=!1,aa&&(aa=!1,k0(ua),ua=-1),cp=!0;var n=St;try{t:{Rc(e);for(pn=di(Pi);pn!==null&&!(pn.expirationTime>e&&A0());){var i=pn.callback;if(typeof i==="function"){pn.callback=null,St=pn.priorityLevel;var r=i(pn.expirationTime<=e);if(e=Eo.unstable_now(),typeof r==="function"){pn.callback=r,Rc(e),t=!0;break t}pn===di(Pi)&&Tc(Pi),Rc(e)}else Tc(Pi);pn=di(Pi)}if(pn!==null)t=!0;else{var o=di(kr);o!==null&&pp(dp,o.startTime-e),t=!1}}break e}finally{pn=null,St=n,cp=!1}t=void 0}}finally{t?Ss():ks=!1}}}var Ss;if(typeof w0==="function")Ss=function(){w0(sp)};else if(typeof MessageChannel<"u")Nc=new MessageChannel,fp=Nc.port2,Nc.port1.onmessage=sp,Ss=function(){fp.postMessage(null)};else Ss=function(){S0(sp,0)};var Nc,fp;function pp(e,t){ua=S0(function(){e(Eo.unstable_now())},t)}var Mc=5,_c=1,Dc=4,Co=3,O0=null,Lc=2,zc=function(e){e.callback=null},R0=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"):E0=0<e?Math.floor(1000/e):5},Bc=function(){return St},N0=function(e){switch(St){case 1:case 2:case 3:var t=3;break;default:t=St}var n=St;St=t;try{return e()}finally{St=n}},Pc=function(){hp=!0},T0=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=St;St=e;try{return t()}finally{St=n}},Ao=function(e,t,n){var i=Eo.unstable_now();switch(typeof n==="object"&&n!==null?(n=n.delay,n=typeof n==="number"&&0<n?i+n:i):n=i,e){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5000}return r=n+r,e={id:G_++,callback:t,priorityLevel:e,startTime:n,expirationTime:r,sortIndex:-1},n>i?(e.sortIndex=n,lp(kr,e),di(Pi)===null&&e===di(kr)&&(aa?(k0(ua),ua=-1):aa=!0,pp(dp,n-i))):(e.sortIndex=r,lp(Pi,e),la||cp||(la=!0,ks||(ks=!0,Ss()))),e},Ic=A0,M0=function(e){var t=St;return function(){var n=St;St=t;try{return e.apply(this,arguments)}finally{St=n}}};var Ii={};x0(Ii,{Activity:()=>j0,Children:()=>F0,Component:()=>K0,Fragment:()=>q0,Profiler:()=>$0,PureComponent:()=>G0,StrictMode:()=>W0,Suspense:()=>Y0,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:()=>As,__COMPILER_RUNTIME:()=>X0,cache:()=>Q0,cacheSignal:()=>J0,cloneElement:()=>Sp,createContext:()=>Er,createElement:()=>Z0,createRef:()=>ex,forwardRef:()=>Cr,isValidElement:()=>Hc,lazy:()=>tx,memo:()=>Os,startTransition:()=>nx,unstable_useCacheRefresh:()=>ix,use:()=>rx,useActionState:()=>ox,useCallback:()=>ft,useContext:()=>Ar,useDebugValue:()=>kp,useDeferredValue:()=>sx,useEffect:()=>te,useEffectEvent:()=>lx,useId:()=>Uc,useImperativeHandle:()=>ca,useInsertionEffect:()=>ax,useLayoutEffect:()=>Vi,useMemo:()=>Je,useOptimistic:()=>ux,useReducer:()=>Ep,useRef:()=>q,useState:()=>Q,useSyncExternalStore:()=>Or,useTransition:()=>cx,version:()=>jc},{Activity:(W6)=>j0=W6,Children:(W6)=>F0=W6,Component:(W6)=>K0=W6,Fragment:(W6)=>q0=W6,Profiler:(W6)=>$0=W6,PureComponent:(W6)=>G0=W6,StrictMode:(W6)=>W0=W6,Suspense:(W6)=>Y0=W6,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:(W6)=>As=W6,__COMPILER_RUNTIME:(W6)=>X0=W6,cache:(W6)=>Q0=W6,cacheSignal:(W6)=>J0=W6,cloneElement:(W6)=>Sp=W6,createContext:(W6)=>Er=W6,createElement:(W6)=>Z0=W6,createRef:(W6)=>ex=W6,forwardRef:(W6)=>Cr=W6,isValidElement:(W6)=>Hc=W6,lazy:(W6)=>tx=W6,memo:(W6)=>Os=W6,startTransition:(W6)=>nx=W6,unstable_useCacheRefresh:(W6)=>ix=W6,use:(W6)=>rx=W6,useActionState:(W6)=>ox=W6,useCallback:(W6)=>ft=W6,useContext:(W6)=>Ar=W6,useDebugValue:(W6)=>kp=W6,useDeferredValue:(W6)=>sx=W6,useEffect:(W6)=>te=W6,useEffectEvent:(W6)=>lx=W6,useId:(W6)=>Uc=W6,useImperativeHandle:(W6)=>ca=W6,useInsertionEffect:(W6)=>ax=W6,useLayoutEffect:(W6)=>Vi=W6,useMemo:(W6)=>Je=W6,useOptimistic:(W6)=>ux=W6,useReducer:(W6)=>Ep=W6,useRef:(W6)=>q=W6,useState:(W6)=>Q=W6,useSyncExternalStore:(W6)=>Or=W6,useTransition:(W6)=>cx=W6,version:(W6)=>jc=W6});var vp=Symbol.for("react.transitional.element"),W_=Symbol.for("react.portal"),Y_=Symbol.for("react.fragment"),X_=Symbol.for("react.strict_mode"),Q_=Symbol.for("react.profiler"),J_=Symbol.for("react.consumer"),Z_=Symbol.for("react.context"),e2=Symbol.for("react.forward_ref"),t2=Symbol.for("react.suspense"),n2=Symbol.for("react.memo"),B0=Symbol.for("react.lazy"),i2=Symbol.for("react.activity"),_0=Symbol.iterator;function r2(e){if(e===null||typeof e!=="object")return null;return e=_0&&e[_0]||e["@@iterator"],typeof e==="function"?e:null}var P0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I0=Object.assign,V0={};function Cs(e,t,n){this.props=e,this.context=t,this.refs=V0,this.updater=n||P0}Cs.prototype.isReactComponent={};Cs.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Cs.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function H0(){}H0.prototype=Cs.prototype;function bp(e,t,n){this.props=e,this.context=t,this.refs=V0,this.updater=n||P0}var yp=bp.prototype=new H0;yp.constructor=bp;I0(yp,Cs.prototype);yp.isPureReactComponent=!0;var D0=Array.isArray;function gp(){}var _e={H:null,A:null,T:null,S:null},U0=Object.prototype.hasOwnProperty;function xp(e,t,n){var i=n.ref;return{$$typeof:vp,type:e,key:t,ref:i!==void 0?i:null,props:n}}function o2(e,t){return xp(e.type,t,e.props)}function wp(e){return typeof e==="object"&&e!==null&&e.$$typeof===vp}function s2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var L0=/\/+/g;function mp(e,t){return typeof e==="object"&&e!==null&&e.key!=null?s2(""+e.key):t.toString(36)}function l2(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status==="string"?e.then(gp,gp):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Es(e,t,n,i,r){var o=typeof e;if(o==="undefined"||o==="boolean")e=null;var s=!1;if(e===null)s=!0;else switch(o){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case vp:case W_:s=!0;break;case B0:return s=e._init,Es(s(e._payload),t,n,i,r)}}if(s)return r=r(e),s=i===""?"."+mp(e,0):i,D0(r)?(n="",s!=null&&(n=s.replace(L0,"$&/")+"/"),Es(r,t,n,"",function(u){return u})):r!=null&&(wp(r)&&(r=o2(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(L0,"$&/")+"/")+s)),t.push(r)),1;s=0;var l=i===""?".":i+":";if(D0(e))for(var a=0;a<e.length;a++)i=e[a],o=l+mp(i,a),s+=Es(i,t,n,o,r);else if(a=r2(e),typeof a==="function")for(e=a.call(e),a=0;!(i=e.next()).done;)i=i.value,o=l+mp(i,a++),s+=Es(i,t,n,o,r);else if(o==="object"){if(typeof e.then==="function")return Es(l2(e),t,n,i,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return s}function Vc(e,t,n){if(e==null)return e;var i=[],r=0;return Es(e,i,"","",function(o){return t.call(n,o,r++)}),i}function a2(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){if(e._status===0||e._status===-1)e._status=1,e._result=n},function(n){if(e._status===0||e._status===-1)e._status=2,e._result=n}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var z0=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)},u2={map:Vc,forEach:function(e,t,n){Vc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Vc(e,function(){t++}),t},toArray:function(e){return Vc(e,function(t){return t})||[]},only:function(e){if(!wp(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};var j0=i2,F0=u2,K0=Cs,q0=Y_,$0=Q_,G0=bp,W0=X_,Y0=t2,As=_e,X0={__proto__:null,c:function(e){return _e.H.useMemoCache(e)}},Q0=function(e){return function(){return e.apply(null,arguments)}},J0=function(){return null},Sp=function(e,t,n){if(e===null||e===void 0)throw Error("The argument must be a React element, but you passed "+e+".");var i=I0({},e.props),r=e.key;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)!U0.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(i[o]=t[o]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),l=0;l<o;l++)s[l]=arguments[l+2];i.children=s}return xp(e.type,r,i)},Er=function(e){return e={$$typeof:Z_,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:J_,_context:e},e},Z0=function(e,t,n){var i,r={},o=null;if(t!=null)for(i in t.key!==void 0&&(o=""+t.key),t)U0.call(t,i)&&i!=="key"&&i!=="__self"&&i!=="__source"&&(r[i]=t[i]);var s=arguments.length-2;if(s===1)r.children=n;else if(1<s){for(var l=Array(s),a=0;a<s;a++)l[a]=arguments[a+2];r.children=l}if(e&&e.defaultProps)for(i in s=e.defaultProps,s)r[i]===void 0&&(r[i]=s[i]);return xp(e,o,r)},ex=function(){return{current:null}},Cr=function(e){return{$$typeof:e2,render:e}},Hc=wp,tx=function(e){return{$$typeof:B0,_payload:{_status:-1,_result:e},_init:a2}},Os=function(e,t){return{$$typeof:n2,type:e,compare:t===void 0?null:t}},nx=function(e){var t=_e.T,n={};_e.T=n;try{var i=e(),r=_e.S;r!==null&&r(n,i),typeof i==="object"&&i!==null&&typeof i.then==="function"&&i.then(gp,z0)}catch(o){z0(o)}finally{t!==null&&n.types!==null&&(t.types=n.types),_e.T=t}},ix=function(){return _e.H.useCacheRefresh()},rx=function(e){return _e.H.use(e)},ox=function(e,t,n){return _e.H.useActionState(e,t,n)},ft=function(e,t){return _e.H.useCallback(e,t)},Ar=function(e){return _e.H.useContext(e)},kp=function(){},sx=function(e,t){return _e.H.useDeferredValue(e,t)},te=function(e,t){return _e.H.useEffect(e,t)},lx=function(e){return _e.H.useEffectEvent(e)},Uc=function(){return _e.H.useId()},ca=function(e,t,n){return _e.H.useImperativeHandle(e,t,n)},ax=function(e,t){return _e.H.useInsertionEffect(e,t)},Vi=function(e,t){return _e.H.useLayoutEffect(e,t)},Je=function(e,t){return _e.H.useMemo(e,t)},ux=function(e,t){return _e.H.useOptimistic(e,t)},Ep=function(e,t,n){return _e.H.useReducer(e,t,n)},q=function(e){return _e.H.useRef(e)},Q=function(e){return _e.H.useState(e)},Or=function(e,t,n){return _e.H.useSyncExternalStore(e,t,n)},cx=function(){return _e.H.useTransition()},jc="19.2.8";function hx(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=="function")return;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(hx)}catch(e){console.error(e)}}function fx(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 Rr(){}var fa={d:{f:Rr,r:function(){throw Error(fx(522))},D:Rr,C:Rr,L:Rr,m:Rr,X:Rr,S:Rr,M:Rr},p:0,findDOMNode:null},c2=Symbol.for("react.portal");function f2(e,t,n){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c2,key:i==null?null:""+i,children:e,containerInfo:t,implementation:n}}var Cp=As;var Ap=fa,Op=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(fx(299));return f2(e,t,null,n)},Fc=function(e){var t=Cp.T,n=fa.p;try{if(Cp.T=null,fa.p=2,e)return e()}finally{Cp.T=t,fa.p=n,fa.d.f()}};hx();function R(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 h2(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function eu(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Bw(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 Pw(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 dx(e){if(eu(e)!==e)throw Error(R(188))}function d2(e){var t=e.alternate;if(!t){if(t=eu(e),t===null)throw Error(R(188));return t!==e?null:e}for(var n=e,i=t;;){var r=n.return;if(r===null)break;var o=r.alternate;if(o===null){if(i=r.return,i!==null){n=i;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===n)return dx(r),e;if(o===i)return dx(r),t;o=o.sibling}throw Error(R(188))}if(n.return!==i.return)n=r,i=o;else{for(var s=!1,l=r.child;l;){if(l===n){s=!0,n=r,i=o;break}if(l===i){s=!0,i=r,n=o;break}l=l.sibling}if(!s){for(l=o.child;l;){if(l===n){s=!0,n=o,i=r;break}if(l===i){s=!0,i=o,n=r;break}l=l.sibling}if(!s)throw Error(R(189))}}if(n.alternate!==i)throw Error(R(190))}if(n.tag!==3)throw Error(R(188));return n.stateNode.current===n?e:t}function Iw(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Iw(e),t!==null)return t;e=e.sibling}return null}var ze=Object.assign,p2=Symbol.for("react.element"),Kc=Symbol.for("react.transitional.element"),ba=Symbol.for("react.portal"),Ds=Symbol.for("react.fragment"),Vw=Symbol.for("react.strict_mode"),lm=Symbol.for("react.profiler"),Hw=Symbol.for("react.consumer"),Gi=Symbol.for("react.context"),rg=Symbol.for("react.forward_ref"),am=Symbol.for("react.suspense"),um=Symbol.for("react.suspense_list"),og=Symbol.for("react.memo"),Nr=Symbol.for("react.lazy"),cm=Symbol.for("react.activity"),m2=Symbol.for("react.memo_cache_sentinel"),px=Symbol.iterator;function ha(e){if(e===null||typeof e!=="object")return null;return e=px&&e[px]||e["@@iterator"],typeof e==="function"?e:null}var g2=Symbol.for("react.client.reference");function fm(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===g2?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case Ds:return"Fragment";case lm:return"Profiler";case Vw:return"StrictMode";case am:return"Suspense";case um:return"SuspenseList";case cm:return"Activity"}if(typeof e==="object")switch(e.$$typeof){case ba:return"Portal";case Gi:return e.displayName||"Context";case Hw:return(e._context.displayName||"Context")+".Consumer";case rg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case og:return t=e.displayName||null,t!==null?t:fm(e.type)||"Memo";case Nr:t=e._payload,e=e._init;try{return fm(e(t))}catch(n){}}return null}var ya=Array.isArray,J=As,ge=Ap,Do={pending:!1,data:null,method:null,action:null},hm=[],Ls=-1;function bi(e){return{current:e}}function st(e){0>Ls||(e.current=hm[Ls],hm[Ls]=null,Ls--)}function Ae(e,t){Ls++,hm[Ls]=e.current,e.current=t}var vi=bi(null),Ha=bi(null),Hr=bi(null),wf=bi(null);function Sf(e,t){switch(Ae(Hr,t),Ae(Ha,e),Ae(vi,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)?(e=e.namespaceURI)?yw(e):0:0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yw(t),e=ok(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}st(vi),Ae(vi,e)}function Js(){st(vi),st(Ha),st(Hr)}function dm(e){e.memoizedState!==null&&Ae(wf,e);var t=vi.current,n=ok(t,e.type);t!==n&&(Ae(Ha,e),Ae(vi,n))}function kf(e){Ha.current===e&&(st(vi),st(Ha)),wf.current===e&&(st(wf),Qa._currentValue=Do)}var Np,mx;function Ro(e){if(Np===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Np=t&&t[1]||"",mx=-1<n.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+is+e+kf}var ls=!1;function os(e,t){if(!e||ls)return"";ls=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(g){var h=g}Reflect.construct(e,[],y)}else{try{y.call()}catch(g){h=g}e.call(y.prototype)}}else{try{throw Error()}catch(g){h=g}(y=e())&&typeof y.catch==="function"&&y.catch(function(){})}}catch(g){if(g&&h&&typeof g.stack==="string")return[g.stack,h.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var l=a.DetermineComponentFrameRoot(),o=l[0],r=l[1];if(o&&r){var u=o.split(`
4
- `),c=r.split(`
5
- `);for(i=a=0;a<u.length&&!u[a].includes("DetermineComponentFrameRoot");)a++;for(;i<c.length&&!c[i].includes("DetermineComponentFrameRoot");)i++;if(a===u.length||i===c.length)for(a=u.length-1,i=c.length-1;1<=a&&0<=i&&u[a]!==c[i];)i--;for(;1<=a&&0<=i;a--,i--)if(u[a]!==c[i]){if(a!==1||i!==1)do if(a--,i--,0>i||u[a]!==c[i]){var m=`
6
- `+u[a].replace(" at new "," at ");return e.displayName&&m.includes("<anonymous>")&&(m=m.replace("<anonymous>",e.displayName)),m}while(1<=a&&0<=i);break}}}finally{ls=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Gn(n):""}function Uy(e,t){switch(e.tag){case 26:case 27:case 5:return Gn(e.type);case 16:return Gn("Lazy");case 13:return e.child!==t&&t!==null?Gn("Suspense Fallback"):Gn("Suspense");case 19:return Gn("SuspenseList");case 0:case 15:return os(e.type,!1);case 11:return os(e.type.render,!1);case 1:return os(e.type,!0);case 31:return Gn("Activity");default:return""}}function Uf(e){try{var t="",n=null;do t+=Uy(e,n),n=e,e=e.return;while(e);return t}catch(a){return`
7
- Error generating stack: `+a.message+`
8
- `+a.stack}}var Ys=Object.prototype.hasOwnProperty,Uu=jn,rs=Xl,Vy=$l,Ly=Zl,je=dt,By=Ql,oh=Gl,rh=Kl,Ro=Hn,Hy=Yl,sh=ql,jy=void 0,qy=void 0,vl=null,qe=null;function hn(e){if(typeof jy==="function"&&qy(e),qe&&typeof qe.setStrictMode==="function")try{qe.setStrictMode(vl,e)}catch(t){}}var Ge=Math.clz32?Math.clz32:Ky,{log:Gy,LN2:Yy}=Math;function Ky(e){return e>>>=0,e===0?32:31-(Gy(e)/Yy|0)|0}var Pl=256,Il=262144,eo=4194304;function Yn(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&261888;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 ar(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var i=0,l=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var r=a&134217727;return r!==0?(a=r&~l,a!==0?i=Yn(a):(o&=r,o!==0?i=Yn(o):n||(n=r&~e,n!==0&&(i=Yn(n))))):(r=a&~l,r!==0?i=Yn(r):o!==0?i=Yn(o):n||(n=a&~e,n!==0&&(i=Yn(n)))),i===0?0:t!==0&&t!==i&&(t&l)===0&&(l=i&-i,n=t&-t,l>=n||l===32&&(n&4194048)!==0)?t:i}function gl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Xy(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5000;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function uh(){var e=eo;return eo<<=1,(eo&62914560)===0&&(eo=4194304),e}function ss(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ir(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Qy(e,t,n,a,i,l){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{entanglements:r,expirationTimes:u,hiddenUpdates:c}=e;for(n=o&~n;0<n;){var m=31-Ge(n),y=1<<m;r[m]=0,u[m]=-1;var h=c[m];if(h!==null)for(c[m]=null,m=0;m<h.length;m++){var g=h[m];g!==null&&(g.lane&=-536870913)}n&=~y}a!==0&&ch(e,a,0),l!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=l&~(o&~t))}function ch(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-Ge(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&261930}function fh(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-Ge(n),i=1<<a;i&t|e[a]&t&&(e[a]|=t),n&=~i}}function dh(e,t){var n=t&-t;return n=(n&42)!==0?1:hh(n),(n&(e.suspendedLanes|t))!==0?0:n}function hh(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 Vu(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ph(){var e=X.p;if(e!==0)return e;return e=window.event,e===void 0?32:Cm(e.type)}function Vf(e,t){var n=X.p;try{return X.p=e,t()}finally{X.p=n}}var Dn=Math.random().toString(36).slice(2),_e="__reactFiber$"+Dn,Ce="__reactProps$"+Dn,yl="__reactContainer$"+Dn,Ks="__reactEvents$"+Dn,Zy="__reactListeners$"+Dn,$y="__reactHandles$"+Dn,Lf="__reactResources$"+Dn,bl="__reactMarker$"+Dn;function Lu(e){delete e[_e],delete e[Ce],delete e[Ks],delete e[Zy],delete e[$y]}function Oa(e){var t=e[_e];if(t)return t;for(var n=e.parentNode;n;){if(t=n[yl]||n[_e]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Yd(e);e!==null;){if(n=e[_e])return n;e=Yd(e)}return t}e=n,n=e.parentNode}return null}function ei(e){if(e=e[_e]||e[yl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ui(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(_(33))}function Va(e){var t=e[Lf];return t||(t=e[Lf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ge(e){e[bl]=!0}var mh=new Set,vh={};function la(e,t){Ka(e,t),Ka(e+"Capture",t)}function Ka(e,t){vh[e]=t;for(e=0;e<t.length;e++)mh.add(t[e])}var Jy=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]*$"),Bf={},Hf={};function Fy(e){if(Ys.call(Hf,e))return!0;if(Ys.call(Bf,e))return!1;if(Jy.test(e))return Hf[e]=!0;return Bf[e]=!0,!1}function fo(e,t,n){if(Fy(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function to(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,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+a)}}function Fe(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Wy(e,t,n){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get==="function"&&typeof a.set==="function"){var{get:i,set:l}=a;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,l.call(this,o)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xs(e){if(!e._valueTracker){var t=gh(e)?"checked":"value";e._valueTracker=Wy(e,t,""+e[t])}}function yh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=gh(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Mo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch(t){return e.body}}var Py=/[\n"\\]/g;function Ie(e){return e.replace(Py,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Qs(e,t,n,a,i,l,o,r){if(e.name="",o!=null&&typeof o!=="function"&&typeof o!=="symbol"&&typeof o!=="boolean"?e.type=o:e.removeAttribute("type"),t!=null)if(o==="number"){if(t===0&&e.value===""||e.value!=t)e.value=""+Fe(t)}else e.value!==""+Fe(t)&&(e.value=""+Fe(t));else o!=="submit"&&o!=="reset"||e.removeAttribute("value");t!=null?Zs(e,o,Fe(t)):n!=null?Zs(e,o,Fe(n)):a!=null&&e.removeAttribute("value"),i==null&&l!=null&&(e.defaultChecked=!!l),i!=null&&(e.checked=i&&typeof i!=="function"&&typeof i!=="symbol"),r!=null&&typeof r!=="function"&&typeof r!=="symbol"&&typeof r!=="boolean"?e.name=""+Fe(r):e.removeAttribute("name")}function bh(e,t,n,a,i,l,o,r){if(l!=null&&typeof l!=="function"&&typeof l!=="symbol"&&typeof l!=="boolean"&&(e.type=l),t!=null||n!=null){if(!(l!=="submit"&&l!=="reset"||t!==void 0&&t!==null)){Xs(e);return}n=n!=null?""+Fe(n):"",t=t!=null?""+Fe(t):n,r||t===e.value||(e.value=t),e.defaultValue=t}a=a!=null?a:i,a=typeof a!=="function"&&typeof a!=="symbol"&&!!a,e.checked=r?e.checked:!!a,e.defaultChecked=!!a,o!=null&&typeof o!=="function"&&typeof o!=="symbol"&&typeof o!=="boolean"&&(e.name=o),Xs(e)}function Zs(e,t,n){t==="number"&&Mo(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function La(e,t,n,a){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&&a&&(e[n].defaultSelected=!0)}else{n=""+Fe(n),t=null;for(i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,a&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Sh(e,t,n){if(t!=null&&(t=""+Fe(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Fe(n):""}function _h(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(_(92));if(ki(a)){if(1<a.length)throw Error(_(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=Fe(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a),Xs(e)}function Xa(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Iy=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 jf(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n==="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!=="number"||n===0||Iy.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function xh(e,t,n){if(t!=null&&typeof t!=="object")throw Error(_(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var i in t)a=t[i],t.hasOwnProperty(i)&&n[i]!==a&&jf(e,i,a)}else for(var l in t)t.hasOwnProperty(l)&&jf(e,l,t[l])}function Bu(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 eb=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),tb=/^[\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 ho(e){return tb.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ht(){}var $s=null;function Hu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Aa=null,Ba=null;function qf(e){var t=ei(e);if(t&&(e=t.stateNode)){var n=e[Ce]||null;e:switch(e=t.stateNode,t.type){case"input":if(Qs(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;n=n.querySelectorAll('input[name="'+Ie(""+t)+'"][type="radio"]');for(t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var i=a[Ce]||null;if(!i)throw Error(_(90));Qs(a,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&yh(a)}break e;case"textarea":Sh(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&La(e,!!n.multiple,t,!1)}}}var us=!1;function Eh(e,t,n){if(us)return e(t,n);us=!0;try{var a=e(t);return a}finally{if(us=!1,Aa!==null||Ba!==null){if(vr(),Aa&&(t=Aa,e=Ba,Ba=Aa=null,qf(t),e))for(t=0;t<e.length;t++)qf(e[t])}}}function nl(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Ce]||null;if(a===null)return null;n=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!=="function")throw Error(_(231,t,typeof n));return n}var Kt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Js=!1;if(Kt)try{Kn={},Object.defineProperty(Kn,"passive",{get:function(){Js=!0}}),window.addEventListener("test",Kn,Kn),window.removeEventListener("test",Kn,Kn)}catch(e){Js=!1}var Kn,pn=null,ju=null,po=null;function wh(){if(po)return po;var e,t=ju,n=t.length,a,i="value"in pn?pn.value:pn.textContent,l=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(a=1;a<=o&&t[n-a]===i[l-a];a++);return po=i.slice(e,1<a?1-a:void 0)}function mo(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 no(){return!0}function Gf(){return!1}function ke(e){function t(n,a,i,l,o){this._reactName=n,this._targetInst=i,this.type=a,this.nativeEvent=l,this.target=o,this.currentTarget=null;for(var r in e)e.hasOwnProperty(r)&&(n=e[r],this[r]=n?n(l):l[r]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?no:Gf,this.isPropagationStopped=Gf,this}return ae(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!=="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=no)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!=="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=no)},persist:function(){},isPersistent:no}),t}var oa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lr=ke(oa),Sl=ae({},oa,{view:0,detail:0}),nb=ke(Sl),cs,fs,Ti,or=ae({},Sl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){if("movementX"in e)return e.movementX;return e!==Ti&&(Ti&&e.type==="mousemove"?(cs=e.screenX-Ti.screenX,fs=e.screenY-Ti.screenY):fs=cs=0,Ti=e),cs},movementY:function(e){return"movementY"in e?e.movementY:fs}}),Yf=ke(or),ab=ae({},or,{dataTransfer:0}),ib=ke(ab),lb=ae({},Sl,{relatedTarget:0}),ds=ke(lb),ob=ae({},oa,{animationName:0,elapsedTime:0,pseudoElement:0}),rb=ke(ob),sb=ae({},oa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ub=ke(sb),cb=ae({},oa,{data:0}),Kf=ke(cb),fb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},db={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"},hb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pb(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=hb[e])?!!t[e]:!1}function qu(){return pb}var mb=ae({},Sl,{key:function(e){if(e.key){var t=fb[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=mo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?db[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qu,charCode:function(e){return e.type==="keypress"?mo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?mo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),vb=ke(mb),gb=ae({},or,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xf=ke(gb),yb=ae({},Sl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qu}),bb=ke(yb),Sb=ae({},oa,{propertyName:0,elapsedTime:0,pseudoElement:0}),_b=ke(Sb),xb=ae({},or,{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}),Eb=ke(xb),wb=ae({},oa,{newState:0,oldState:0}),Nb=ke(wb),Ob=[9,13,27,32],Gu=Kt&&"CompositionEvent"in window,Gi=null;Kt&&"documentMode"in document&&(Gi=document.documentMode);var Ab=Kt&&"TextEvent"in window&&!Gi,Nh=Kt&&(!Gu||Gi&&8<Gi&&11>=Gi),Qf=String.fromCharCode(32),Zf=!1;function Oh(e,t){switch(e){case"keyup":return Ob.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ah(e){return e=e.detail,typeof e==="object"&&"data"in e?e.data:null}var Ta=!1;function Tb(e,t){switch(e){case"compositionend":return Ah(t);case"keypress":if(t.which!==32)return null;return Zf=!0,Qf;case"textInput":return e=t.data,e===Qf&&Zf?null:e;default:return null}}function Db(e,t){if(Ta)return e==="compositionend"||!Gu&&Oh(e,t)?(e=wh(),po=ju=pn=null,Ta=!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 Nh&&t.locale!=="ko"?null:t.data;default:return null}}var zb={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 $f(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!zb[e.type]:t==="textarea"?!0:!1}function Th(e,t,n,a){Aa?Ba?Ba.push(a):Ba=[a]:Aa=a,t=Fo(t,"onChange"),0<t.length&&(n=new lr("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Yi=null,al=null;function Rb(e){Sm(e,0)}function rr(e){var t=Ui(e);if(yh(t))return e}function Jf(e,t){if(e==="change")return t}var Dh=!1;if(Kt){if(Kt){if(Li="oninput"in document,!Li)vo=document.createElement("div"),vo.setAttribute("oninput","return;"),Li=typeof vo.oninput==="function";Vi=Li}else Vi=!1;Dh=Vi&&(!document.documentMode||9<document.documentMode)}var Vi,Li,vo;function Ff(){Yi&&(Yi.detachEvent("onpropertychange",zh),al=Yi=null)}function zh(e){if(e.propertyName==="value"&&rr(al)){var t=[];Th(t,al,e,Hu(e)),Eh(Rb,t)}}function Mb(e,t,n){e==="focusin"?(Ff(),Yi=t,al=n,Yi.attachEvent("onpropertychange",zh)):e==="focusout"&&Ff()}function Cb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return rr(al)}function kb(e,t){if(e==="click")return rr(t)}function Ub(e,t){if(e==="input"||e==="change")return rr(t)}function Vb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ye=typeof Object.is==="function"?Object.is:Vb;function il(e,t){if(Ye(e,t))return!0;if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var i=n[a];if(!Ys.call(t,i)||!Ye(e[i],t[i]))return!1}return!0}function Wf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Pf(e,t){var n=Wf(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Wf(n)}}function Rh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Rh(e,t.parentNode):("contains"in e)?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Mh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Mo(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==="string"}catch(a){n=!1}if(n)e=t.contentWindow;else break;t=Mo(e.document)}return t}function Yu(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 Lb=Kt&&"documentMode"in document&&11>=document.documentMode,Da=null,Fs=null,Ki=null,Ws=!1;function If(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ws||Da==null||Da!==Mo(a)||(a=Da,("selectionStart"in a)&&Yu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ki&&il(Ki,a)||(Ki=a,a=Fo(Fs,"onSelect"),0<a.length&&(t=new lr("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Da)))}function qn(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var za={animationend:qn("Animation","AnimationEnd"),animationiteration:qn("Animation","AnimationIteration"),animationstart:qn("Animation","AnimationStart"),transitionrun:qn("Transition","TransitionRun"),transitionstart:qn("Transition","TransitionStart"),transitioncancel:qn("Transition","TransitionCancel"),transitionend:qn("Transition","TransitionEnd")},hs={},Ch={};Kt&&(Ch=document.createElement("div").style,("AnimationEvent"in window)||(delete za.animationend.animation,delete za.animationiteration.animation,delete za.animationstart.animation),("TransitionEvent"in window)||delete za.transitionend.transition);function ra(e){if(hs[e])return hs[e];if(!za[e])return e;var t=za[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ch)return hs[e]=t[n];return e}var kh=ra("animationend"),Uh=ra("animationiteration"),Vh=ra("animationstart"),Bb=ra("transitionrun"),Hb=ra("transitionstart"),jb=ra("transitioncancel"),Lh=ra("transitionend"),Bh=new Map,Ps="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ps.push("scrollEnd");function mt(e,t){Bh.set(e,t),la(t,[e])}var Co=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)},Je=[],Ra=0,Ku=0;function sr(){for(var e=Ra,t=Ku=Ra=0;t<e;){var n=Je[t];Je[t++]=null;var a=Je[t];Je[t++]=null;var i=Je[t];Je[t++]=null;var l=Je[t];if(Je[t++]=null,a!==null&&i!==null){var o=a.pending;o===null?i.next=i:(i.next=o.next,o.next=i),a.pending=i}l!==0&&Hh(n,i,l)}}function ur(e,t,n,a){Je[Ra++]=e,Je[Ra++]=t,Je[Ra++]=n,Je[Ra++]=a,Ku|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Xu(e,t,n,a){return ur(e,t,n,a),ko(e)}function sa(e,t){return ur(e,null,null,t),ko(e)}function Hh(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var i=!1,l=e.return;l!==null;)l.childLanes|=n,a=l.alternate,a!==null&&(a.childLanes|=n),l.tag===22&&(e=l.stateNode,e===null||e._visibility&1||(i=!0)),e=l,l=l.return;return e.tag===3?(l=e.stateNode,i&&t!==null&&(i=31-Ge(n),e=l.hiddenUpdates,a=e[i],a===null?e[i]=[t]:a.push(t),t.lane=n|536870912),l):null}function ko(e){if(50<Ii)throw Ii=0,bu=null,Error(_(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ma={};function qb(e,t,n,a){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=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Be(e,t,n,a){return new qb(e,t,n,a)}function Qu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qt(e,t){var n=e.alternate;return n===null?(n=Be(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&65011712,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 jh(e,t){e.flags&=65011714;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 go(e,t,n,a,i,l){var o=0;if(a=e,typeof e==="function")Qu(e)&&(o=1);else if(typeof e==="string")o=Z0(e,n,wt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Hs:return e=Be(31,n,t,i),e.elementType=Hs,e.lanes=l,e;case wa:return $n(n.children,i,l,t);case ih:o=8,i|=24;break;case Vs:return e=Be(12,n,t,i|2),e.elementType=Vs,e.lanes=l,e;case Ls:return e=Be(13,n,t,i),e.elementType=Ls,e.lanes=l,e;case Bs:return e=Be(19,n,t,i),e.elementType=Bs,e.lanes=l,e;default:if(typeof e==="object"&&e!==null)switch(e.$$typeof){case Bt:o=10;break e;case lh:o=9;break e;case Cu:o=11;break e;case ku:o=14;break e;case rn:o=16,a=null;break e}o=29,n=Error(_(130,e===null?"null":typeof e,"")),a=null}return t=Be(o,n,t,i),t.elementType=e,t.type=a,t.lanes=l,t}function $n(e,t,n,a){return e=Be(7,e,a,t),e.lanes=n,e}function ps(e,t,n){return e=Be(6,e,null,t),e.lanes=n,e}function qh(e){var t=Be(18,null,null,0);return t.stateNode=e,t}function ms(e,t,n){return t=Be(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ed=new WeakMap;function et(e,t){if(typeof e==="object"&&e!==null){var n=ed.get(e);if(n!==void 0)return n;return t={value:e,source:t,stack:Uf(t)},ed.set(e,t),t}return{value:e,source:t,stack:Uf(t)}}var Ca=[],ka=0,Uo=null,ll=0,We=[],Pe=0,Nn=null,_t=1,xt="";function Vt(e,t){Ca[ka++]=ll,Ca[ka++]=Uo,Uo=e,ll=t}function Gh(e,t,n){We[Pe++]=_t,We[Pe++]=xt,We[Pe++]=Nn,Nn=e;var a=_t;e=xt;var i=32-Ge(a)-1;a&=~(1<<i),n+=1;var l=32-Ge(t)+i;if(30<l){var o=i-i%5;l=(a&(1<<o)-1).toString(32),a>>=o,i-=o,_t=1<<32-Ge(t)+i|n<<i|a,xt=l+e}else _t=1<<l|n<<i|a,xt=e}function Zu(e){e.return!==null&&(Vt(e,1),Gh(e,1,0))}function $u(e){for(;e===Uo;)Uo=Ca[--ka],Ca[ka]=null,ll=Ca[--ka],Ca[ka]=null;for(;e===Nn;)Nn=We[--Pe],We[Pe]=null,xt=We[--Pe],We[Pe]=null,_t=We[--Pe],We[Pe]=null}function Yh(e,t){We[Pe++]=_t,We[Pe++]=xt,We[Pe++]=Nn,_t=t.id,xt=t.overflow,Nn=e}var xe=null,ne=null,G=!1,bn=null,tt=!1,Is=Error(_(519));function On(e){var t=Error(_(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ol(et(t,e)),Is}function td(e){var{stateNode:t,type:n,memoizedProps:a}=e;switch(t[_e]=e,t[Ce]=a,n){case"dialog":H("cancel",t),H("close",t);break;case"iframe":case"object":case"embed":H("load",t);break;case"video":case"audio":for(n=0;n<cl.length;n++)H(cl[n],t);break;case"source":H("error",t);break;case"img":case"image":case"link":H("error",t),H("load",t);break;case"details":H("toggle",t);break;case"input":H("invalid",t),bh(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":H("invalid",t);break;case"textarea":H("invalid",t),_h(t,a.value,a.defaultValue,a.children)}n=a.children,typeof n!=="string"&&typeof n!=="number"&&typeof n!=="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||Em(t.textContent,n)?(a.popover!=null&&(H("beforetoggle",t),H("toggle",t)),a.onScroll!=null&&H("scroll",t),a.onScrollEnd!=null&&H("scrollend",t),a.onClick!=null&&(t.onclick=Ht),t=!0):t=!1,t||On(e,!0)}function nd(e){for(xe=e.return;xe;)switch(xe.tag){case 5:case 31:case 13:tt=!1;return;case 27:case 3:tt=!0;return;default:xe=xe.return}}function ba(e){if(e!==xe)return!1;if(!G)return nd(e),G=!0,!1;var t=e.tag,n;if(n=t!==3&&t!==27){if(n=t===5)n=e.type,n=!(n!=="form"&&n!=="button")||Ou(e.type,e.memoizedProps);n=!n}if(n&&ne&&On(e),nd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(_(317));ne=Gd(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(_(317));ne=Gd(e)}else t===27?(t=ne,zn(e.type)?(e=zu,zu=null,ne=e):ne=t):ne=xe?it(e.stateNode.nextSibling):null;return!0}function ea(){ne=xe=null,G=!1}function vs(){var e=bn;return e!==null&&(Re===null?Re=e:Re.push.apply(Re,e),bn=null),e}function ol(e){bn===null?bn=[e]:bn.push(e)}var eu=Nt(null),ua=null,jt=null;function un(e,t,n){P(eu,t._currentValue),t._currentValue=n}function Gt(e){e._currentValue=eu.current,ye(eu)}function tu(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function nu(e,t,n,a){var i=e.child;i!==null&&(i.return=e);for(;i!==null;){var l=i.dependencies;if(l!==null){var o=i.child;l=l.firstContext;e:for(;l!==null;){var r=l;l=i;for(var u=0;u<t.length;u++)if(r.context===t[u]){l.lanes|=n,r=l.alternate,r!==null&&(r.lanes|=n),tu(l.return,n,e),a||(o=null);break e}l=r.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(_(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),tu(o,n,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function ti(e,t,n,a){e=null;for(var i=t,l=!1;i!==null;){if(!l){if((i.flags&524288)!==0)l=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(_(387));if(o=o.memoizedProps,o!==null){var r=i.type;Ye(i.pendingProps.value,o.value)||(e!==null?e.push(r):e=[r])}}else if(i===To.current){if(o=i.alternate,o===null)throw Error(_(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(dl):e=[dl])}i=i.return}e!==null&&nu(t,e,n,a),t.flags|=262144}function Vo(e){for(e=e.firstContext;e!==null;){if(!Ye(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ta(e){ua=e,jt=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ee(e){return Kh(ua,e)}function ao(e,t){return ua===null&&ta(e),Kh(e,t)}function Kh(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},jt===null){if(e===null)throw Error(_(308));jt=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else jt=jt.next=t;return n}var Gb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},Yb=jn,Kb=Hn,fe={$$typeof:Bt,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ju(){return{controller:new Gb,data:new Map,refCount:0}}function _l(e){e.refCount--,e.refCount===0&&Yb(Kb,function(){e.controller.abort()})}var Xi=null,au=0,Qa=0,Ha=null;function Xb(e,t){if(Xi===null){var n=Xi=[];au=0,Qa=Sc(),Ha={status:"pending",value:void 0,then:function(a){n.push(a)}}}return au++,t.then(ad,ad),t}function ad(){if(--au===0&&Xi!==null){Ha!==null&&(Ha.status="fulfilled");var e=Xi;Xi=null,Qa=0,Ha=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Qb(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(i){n.push(i)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var i=0;i<n.length;i++)(0,n[i])(t)},function(i){a.status="rejected",a.reason=i;for(i=0;i<n.length;i++)(0,n[i])(void 0)}),a}var id=z.S;z.S=function(e,t){tm=je(),typeof t==="object"&&t!==null&&typeof t.then==="function"&&Xb(e,t),id!==null&&id(e,t)};var Jn=Nt(null);function Fu(){var e=Jn.current;return e!==null?e:W.pooledCache}function yo(e,t){t===null?P(Jn,Jn.current):P(Jn,t.pool)}function Xh(){var e=Fu();return e===null?null:{parent:fe._currentValue,pool:e}}var ni=Error(_(460)),Wu=Error(_(474)),cr=Error(_(542)),Lo={then:function(){}};function ld(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Qh(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ht,Ht),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,rd(e),e;default:if(typeof t.status==="string")t.then(Ht,Ht);else{if(e=W,e!==null&&100<e.shellSuspendCounter)throw Error(_(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=a}},function(a){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,rd(e),e}throw Fn=t,ni}}function Xn(e){try{var t=e._init;return t(e._payload)}catch(n){if(n!==null&&typeof n==="object"&&typeof n.then==="function")throw Fn=n,ni;throw n}}var Fn=null;function od(){if(Fn===null)throw Error(_(459));var e=Fn;return Fn=null,e}function rd(e){if(e===ni||e===cr)throw Error(_(483))}var ja=null,rl=0;function io(e){var t=rl;return rl+=1,ja===null&&(ja=[]),Qh(ja,e,t)}function Di(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function lo(e,t){if(t.$$typeof===My)throw Error(_(525));throw e=Object.prototype.toString.call(t),Error(_(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Zh(e){function t(d,f){if(e){var v=d.deletions;v===null?(d.deletions=[f],d.flags|=16):v.push(f)}}function n(d,f){if(!e)return null;for(;f!==null;)t(d,f),f=f.sibling;return null}function a(d){for(var f=new Map;d!==null;)d.key!==null?f.set(d.key,d):f.set(d.index,d),d=d.sibling;return f}function i(d,f){return d=qt(d,f),d.index=0,d.sibling=null,d}function l(d,f,v){if(d.index=v,!e)return d.flags|=1048576,f;if(v=d.alternate,v!==null)return v=v.index,v<f?(d.flags|=67108866,f):v;return d.flags|=67108866,f}function o(d){return e&&d.alternate===null&&(d.flags|=67108866),d}function r(d,f,v,b){if(f===null||f.tag!==6)return f=ps(v,d.mode,b),f.return=d,f;return f=i(f,v),f.return=d,f}function u(d,f,v,b){var w=v.type;if(w===wa)return m(d,f,v.props.children,b,v.key);if(f!==null&&(f.elementType===w||typeof w==="object"&&w!==null&&w.$$typeof===rn&&Xn(w)===f.type))return f=i(f,v.props),Di(f,v),f.return=d,f;return f=go(v.type,v.key,v.props,null,d.mode,b),Di(f,v),f.return=d,f}function c(d,f,v,b){if(f===null||f.tag!==4||f.stateNode.containerInfo!==v.containerInfo||f.stateNode.implementation!==v.implementation)return f=ms(v,d.mode,b),f.return=d,f;return f=i(f,v.children||[]),f.return=d,f}function m(d,f,v,b,w){if(f===null||f.tag!==7)return f=$n(v,d.mode,b,w),f.return=d,f;return f=i(f,v),f.return=d,f}function y(d,f,v){if(typeof f==="string"&&f!==""||typeof f==="number"||typeof f==="bigint")return f=ps(""+f,d.mode,v),f.return=d,f;if(typeof f==="object"&&f!==null){switch(f.$$typeof){case Wl:return v=go(f.type,f.key,f.props,null,d.mode,v),Di(v,f),v.return=d,v;case Ci:return f=ms(f,d.mode,v),f.return=d,f;case rn:return f=Xn(f),y(d,f,v)}if(ki(f)||Ai(f))return f=$n(f,d.mode,v,null),f.return=d,f;if(typeof f.then==="function")return y(d,io(f),v);if(f.$$typeof===Bt)return y(d,ao(d,f),v);lo(d,f)}return null}function h(d,f,v,b){var w=f!==null?f.key:null;if(typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint")return w!==null?null:r(d,f,""+v,b);if(typeof v==="object"&&v!==null){switch(v.$$typeof){case Wl:return v.key===w?u(d,f,v,b):null;case Ci:return v.key===w?c(d,f,v,b):null;case rn:return v=Xn(v),h(d,f,v,b)}if(ki(v)||Ai(v))return w!==null?null:m(d,f,v,b,null);if(typeof v.then==="function")return h(d,f,io(v),b);if(v.$$typeof===Bt)return h(d,f,ao(d,v),b);lo(d,v)}return null}function g(d,f,v,b,w){if(typeof b==="string"&&b!==""||typeof b==="number"||typeof b==="bigint")return d=d.get(v)||null,r(f,d,""+b,w);if(typeof b==="object"&&b!==null){switch(b.$$typeof){case Wl:return d=d.get(b.key===null?v:b.key)||null,u(f,d,b,w);case Ci:return d=d.get(b.key===null?v:b.key)||null,c(f,d,b,w);case rn:return b=Xn(b),g(d,f,v,b,w)}if(ki(b)||Ai(b))return d=d.get(v)||null,m(f,d,b,w,null);if(typeof b.then==="function")return g(d,f,v,io(b),w);if(b.$$typeof===Bt)return g(d,f,v,ao(f,b),w);lo(f,b)}return null}function x(d,f,v,b){for(var w=null,k=null,O=f,R=f=0,U=null;O!==null&&R<v.length;R++){O.index>R?(U=O,O=null):U=O.sibling;var B=h(d,O,v[R],b);if(B===null){O===null&&(O=U);break}e&&O&&B.alternate===null&&t(d,O),f=l(B,f,R),k===null?w=B:k.sibling=B,k=B,O=U}if(R===v.length)return n(d,O),G&&Vt(d,R),w;if(O===null){for(;R<v.length;R++)O=y(d,v[R],b),O!==null&&(f=l(O,f,R),k===null?w=O:k.sibling=O,k=O);return G&&Vt(d,R),w}for(O=a(O);R<v.length;R++)U=g(O,d,R,v[R],b),U!==null&&(e&&U.alternate!==null&&O.delete(U.key===null?R:U.key),f=l(U,f,R),k===null?w=U:k.sibling=U,k=U);return e&&O.forEach(function(ft){return t(d,ft)}),G&&Vt(d,R),w}function A(d,f,v,b){if(v==null)throw Error(_(151));for(var w=null,k=null,O=f,R=f=0,U=null,B=v.next();O!==null&&!B.done;R++,B=v.next()){O.index>R?(U=O,O=null):U=O.sibling;var ft=h(d,O,B.value,b);if(ft===null){O===null&&(O=U);break}e&&O&&ft.alternate===null&&t(d,O),f=l(ft,f,R),k===null?w=ft:k.sibling=ft,k=ft,O=U}if(B.done)return n(d,O),G&&Vt(d,R),w;if(O===null){for(;!B.done;R++,B=v.next())B=y(d,B.value,b),B!==null&&(f=l(B,f,R),k===null?w=B:k.sibling=B,k=B);return G&&Vt(d,R),w}for(O=a(O);!B.done;R++,B=v.next())B=g(O,d,R,B.value,b),B!==null&&(e&&B.alternate!==null&&O.delete(B.key===null?R:B.key),f=l(B,f,R),k===null?w=B:k.sibling=B,k=B);return e&&O.forEach(function(qr){return t(d,qr)}),G&&Vt(d,R),w}function M(d,f,v,b){if(typeof v==="object"&&v!==null&&v.type===wa&&v.key===null&&(v=v.props.children),typeof v==="object"&&v!==null){switch(v.$$typeof){case Wl:e:{for(var w=v.key;f!==null;){if(f.key===w){if(w=v.type,w===wa){if(f.tag===7){n(d,f.sibling),b=i(f,v.props.children),b.return=d,d=b;break e}}else if(f.elementType===w||typeof w==="object"&&w!==null&&w.$$typeof===rn&&Xn(w)===f.type){n(d,f.sibling),b=i(f,v.props),Di(b,v),b.return=d,d=b;break e}n(d,f);break}else t(d,f);f=f.sibling}v.type===wa?(b=$n(v.props.children,d.mode,b,v.key),b.return=d,d=b):(b=go(v.type,v.key,v.props,null,d.mode,b),Di(b,v),b.return=d,d=b)}return o(d);case Ci:e:{for(w=v.key;f!==null;){if(f.key===w)if(f.tag===4&&f.stateNode.containerInfo===v.containerInfo&&f.stateNode.implementation===v.implementation){n(d,f.sibling),b=i(f,v.children||[]),b.return=d,d=b;break e}else{n(d,f);break}else t(d,f);f=f.sibling}b=ms(v,d.mode,b),b.return=d,d=b}return o(d);case rn:return v=Xn(v),M(d,f,v,b)}if(ki(v))return x(d,f,v,b);if(Ai(v)){if(w=Ai(v),typeof w!=="function")throw Error(_(150));return v=w.call(v),A(d,f,v,b)}if(typeof v.then==="function")return M(d,f,io(v),b);if(v.$$typeof===Bt)return M(d,f,ao(d,v),b);lo(d,v)}return typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint"?(v=""+v,f!==null&&f.tag===6?(n(d,f.sibling),b=i(f,v),b.return=d,d=b):(n(d,f),b=ps(v,d.mode,b),b.return=d,d=b),o(d)):n(d,f)}return function(d,f,v,b){try{rl=0;var w=M(d,f,v,b);return ja=null,w}catch(O){if(O===ni||O===cr)throw O;var k=Be(29,O,null,d.mode);return k.lanes=b,k.return=d,k}finally{}}}var na=Zh(!0),$h=Zh(!1),sn=!1;function Pu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function iu(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 Wn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pn(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(K&2)!==0){var i=a.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),a.pending=t,t=ko(e),Hh(e,null,n),t}return ur(e,a,t,n),ko(e)}function Qi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,fh(e,n)}}function gs(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var i=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};l===null?i=l=o:l=l.next=o,n=n.next}while(n!==null);l===null?i=l=t:l=l.next=t}else i=l=t;n={baseState:a.baseState,firstBaseUpdate:i,lastBaseUpdate:l,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var lu=!1;function Zi(){if(lu){var e=Ha;if(e!==null)throw e}}function $i(e,t,n,a){lu=!1;var i=e.updateQueue;sn=!1;var{firstBaseUpdate:l,lastBaseUpdate:o}=i,r=i.shared.pending;if(r!==null){i.shared.pending=null;var u=r,c=u.next;u.next=null,o===null?l=c:o.next=c,o=u;var m=e.alternate;m!==null&&(m=m.updateQueue,r=m.lastBaseUpdate,r!==o&&(r===null?m.firstBaseUpdate=c:r.next=c,m.lastBaseUpdate=u))}if(l!==null){var y=i.baseState;o=0,m=c=u=null,r=l;do{var h=r.lane&-536870913,g=h!==r.lane;if(g?(q&h)===h:(a&h)===h){h!==0&&h===Qa&&(lu=!0),m!==null&&(m=m.next={lane:0,tag:r.tag,payload:r.payload,callback:null,next:null});e:{var x=e,A=r;h=t;var M=n;switch(A.tag){case 1:if(x=A.payload,typeof x==="function"){y=x.call(M,y,h);break e}y=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=A.payload,h=typeof x==="function"?x.call(M,y,h):x,h===null||h===void 0)break e;y=ae({},y,h);break e;case 2:sn=!0}}h=r.callback,h!==null&&(e.flags|=64,g&&(e.flags|=8192),g=i.callbacks,g===null?i.callbacks=[h]:g.push(h))}else g={lane:h,tag:r.tag,payload:r.payload,callback:r.callback,next:null},m===null?(c=m=g,u=y):m=m.next=g,o|=h;if(r=r.next,r===null)if(r=i.shared.pending,r===null)break;else g=r,r=g.next,g.next=null,i.lastBaseUpdate=g,i.shared.pending=null}while(1);m===null&&(u=y),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=m,l===null&&(i.shared.lanes=0),Tn|=o,e.lanes=o,e.memoizedState=y}}function Jh(e,t){if(typeof e!=="function")throw Error(_(191,e));e.call(t)}function Fh(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Jh(n[e],t)}var Za=Nt(null),Bo=Nt(0);function sd(e,t){e=$t,P(Bo,e),P(Za,t),$t=e|t.baseLanes}function ou(){P(Bo,$t),P(Za,Za.current)}function Iu(){$t=Bo.current,ye(Za),ye(Bo)}var Ke=Nt(null),nt=null;function cn(e){var t=e.alternate;P(re,re.current&1),P(Ke,e),nt===null&&(t===null||Za.current!==null?nt=e:t.memoizedState!==null&&(nt=e))}function ru(e){P(re,re.current),P(Ke,e),nt===null&&(nt=e)}function Wh(e){e.tag===22?(P(re,re.current),P(Ke,e),nt===null&&(nt=e)):fn(e)}function fn(){P(re,re.current),P(Ke,Ke.current)}function Le(e){ye(Ke),nt===e&&(nt=null),ye(re)}var re=Nt(0);function Ho(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Tu(n)||Du(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Xt=0,C=null,F=null,ue=null,jo=!1,qa=!1,aa=!1,qo=0,sl=0,Ga=null,Zb=0;function le(){throw Error(_(321))}function ec(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ye(e[n],t[n]))return!1;return!0}function tc(e,t,n,a,i,l){return Xt=l,C=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?Tp:dc,aa=!1,l=n(a,i),aa=!1,qa&&(l=Ih(t,n,a,i)),Ph(e),l}function Ph(e){z.H=ul;var t=F!==null&&F.next!==null;if(Xt=0,ue=F=C=null,jo=!1,sl=0,Ga=null,t)throw Error(_(300));e===null||de||(e=e.dependencies,e!==null&&Vo(e)&&(de=!0))}function Ih(e,t,n,a){C=e;var i=0;do{if(qa&&(Ga=null),sl=0,qa=!1,25<=i)throw Error(_(301));if(i+=1,ue=F=null,e.updateQueue!=null){var l=e.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}z.H=Dp,l=t(n,a)}while(qa);return l}function $b(){var e=z.H,t=e.useState()[0];return t=typeof t.then==="function"?xl(t):t,e=e.useState()[0],(F!==null?F.memoizedState:null)!==e&&(C.flags|=1024),t}function nc(){var e=qo!==0;return qo=0,e}function ac(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ic(e){if(jo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}jo=!1}Xt=0,ue=F=C=null,qa=!1,sl=qo=0,Ga=null}function Ae(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ue===null?C.memoizedState=ue=e:ue=ue.next=e,ue}function se(){if(F===null){var e=C.alternate;e=e!==null?e.memoizedState:null}else e=F.next;var t=ue===null?C.memoizedState:ue.next;if(t!==null)ue=t,F=e;else{if(e===null){if(C.alternate===null)throw Error(_(467));throw Error(_(310))}F=e,e={memoizedState:F.memoizedState,baseState:F.baseState,baseQueue:F.baseQueue,queue:F.queue,next:null},ue===null?C.memoizedState=ue=e:ue=ue.next=e}return ue}function fr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xl(e){var t=sl;return sl+=1,Ga===null&&(Ga=[]),e=Qh(Ga,e,t),t=C,(ue===null?t.memoizedState:ue.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?Tp:dc),e}function dr(e){if(e!==null&&typeof e==="object"){if(typeof e.then==="function")return xl(e);if(e.$$typeof===Bt)return Ee(e)}throw Error(_(438,String(e)))}function lc(e){var t=null,n=C.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=C.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=fr(),C.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=Cy;return t.index++,n}function Qt(e,t){return typeof t==="function"?t(e):t}function bo(e){var t=se();return oc(t,F,e)}function oc(e,t,n){var a=e.queue;if(a===null)throw Error(_(311));a.lastRenderedReducer=n;var i=e.baseQueue,l=a.pending;if(l!==null){if(i!==null){var o=i.next;i.next=l.next,l.next=o}t.baseQueue=i=l,a.pending=null}if(l=e.baseState,i===null)e.memoizedState=l;else{t=i.next;var r=o=null,u=null,c=t,m=!1;do{var y=c.lane&-536870913;if(y!==c.lane?(q&y)===y:(Xt&y)===y){var h=c.revertLane;if(h===0)u!==null&&(u=u.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),y===Qa&&(m=!0);else if((Xt&h)===h){c=c.next,h===Qa&&(m=!0);continue}else y={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},u===null?(r=u=y,o=l):u=u.next=y,C.lanes|=h,Tn|=h;y=c.action,aa&&n(l,y),l=c.hasEagerState?c.eagerState:n(l,y)}else h={lane:y,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},u===null?(r=u=h,o=l):u=u.next=h,C.lanes|=y,Tn|=y;c=c.next}while(c!==null&&c!==t);if(u===null?o=l:u.next=r,!Ye(l,e.memoizedState)&&(de=!0,m&&(n=Ha,n!==null)))throw n;e.memoizedState=l,e.baseState=o,e.baseQueue=u,a.lastRenderedState=l}return i===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function ys(e){var t=se(),n=t.queue;if(n===null)throw Error(_(311));n.lastRenderedReducer=e;var{dispatch:a,pending:i}=n,l=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do l=e(l,o.action),o=o.next;while(o!==i);Ye(l,t.memoizedState)||(de=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,a]}function ep(e,t,n){var a=C,i=se(),l=G;if(l){if(n===void 0)throw Error(_(407));n=n()}else n=t();var o=!Ye((F||i).memoizedState,n);if(o&&(i.memoizedState=n,de=!0),i=i.queue,rc(ap.bind(null,a,i,e),[e]),i.getSnapshot!==t||o||ue!==null&&ue.memoizedState.tag&1){if(a.flags|=2048,$a(9,{destroy:void 0},np.bind(null,a,i,n,t),null),W===null)throw Error(_(349));l||(Xt&127)!==0||tp(a,t,n)}return n}function tp(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=C.updateQueue,t===null?(t=fr(),C.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function np(e,t,n,a){t.value=n,t.getSnapshot=a,ip(t)&&lp(e)}function ap(e,t,n){return n(function(){ip(t)&&lp(e)})}function ip(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ye(e,n)}catch(a){return!0}}function lp(e){var t=sa(e,2);t!==null&&Me(t,e,2)}function su(e){var t=Ae();if(typeof e==="function"){var n=e;if(e=n(),aa){hn(!0);try{n()}finally{hn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qt,lastRenderedState:e},t}function op(e,t,n,a){return e.baseState=n,oc(e,F,typeof a==="function"?a:Qt)}function Jb(e,t,n,a,i){if(pr(e))throw Error(_(485));if(e=t.action,e!==null){var l={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){l.listeners.push(o)}};z.T!==null?n(!0):l.isTransition=!1,a(l),n=t.pending,n===null?(l.next=t.pending=l,rp(t,l)):(l.next=n.next,t.pending=n.next=l)}}function rp(e,t){var{action:n,payload:a}=t,i=e.state;if(t.isTransition){var l=z.T,o={};z.T=o;try{var r=n(i,a),u=z.S;u!==null&&u(o,r),ud(e,t,r)}catch(c){uu(e,t,c)}finally{l!==null&&o.types!==null&&(l.types=o.types),z.T=l}}else try{l=n(i,a),ud(e,t,l)}catch(c){uu(e,t,c)}}function ud(e,t,n){n!==null&&typeof n==="object"&&typeof n.then==="function"?n.then(function(a){cd(e,t,a)},function(a){return uu(e,t,a)}):cd(e,t,n)}function cd(e,t,n){t.status="fulfilled",t.value=n,sp(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,rp(e,n)))}function uu(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,sp(t),t=t.next;while(t!==a)}e.action=null}function sp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function up(e,t){return t}function fd(e,t){if(G){var n=W.formState;if(n!==null){e:{var a=C;if(G){if(ne){t:{var i=ne;for(var l=tt;i.nodeType!==8;){if(!l){i=null;break t}if(i=it(i.nextSibling),i===null){i=null;break t}}l=i.data,i=l==="F!"||l==="F"?i:null}if(i){ne=it(i.nextSibling),a=i.data==="F!";break e}}On(a)}a=!1}a&&(t=n[0])}}return n=Ae(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:up,lastRenderedState:t},n.queue=a,n=Np.bind(null,C,a),a.dispatch=n,a=su(!1),l=fc.bind(null,C,!1,a.queue),a=Ae(),i={state:t,dispatch:null,action:e,pending:null},a.queue=i,n=Jb.bind(null,C,i,l,n),i.dispatch=n,a.memoizedState=e,[t,n,!1]}function dd(e){var t=se();return cp(t,F,e)}function cp(e,t,n){if(t=oc(e,t,up)[0],e=bo(Qt)[0],typeof t==="object"&&t!==null&&typeof t.then==="function")try{var a=xl(t)}catch(o){if(o===ni)throw cr;throw o}else a=t;t=se();var i=t.queue,l=i.dispatch;return n!==t.memoizedState&&(C.flags|=2048,$a(9,{destroy:void 0},Fb.bind(null,i,n),null)),[a,l,e]}function Fb(e,t){e.action=t}function hd(e){var t=se(),n=F;if(n!==null)return cp(t,n,e);se(),t=t.memoizedState,n=se();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function $a(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=C.updateQueue,t===null&&(t=fr(),C.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function fp(){return se().memoizedState}function So(e,t,n,a){var i=Ae();C.flags|=e,i.memoizedState=$a(1|t,{destroy:void 0},n,a===void 0?null:a)}function hr(e,t,n,a){var i=se();a=a===void 0?null:a;var l=i.memoizedState.inst;F!==null&&a!==null&&ec(a,F.memoizedState.deps)?i.memoizedState=$a(t,l,n,a):(C.flags|=e,i.memoizedState=$a(1|t,l,n,a))}function pd(e,t){So(8390656,8,e,t)}function rc(e,t){hr(2048,8,e,t)}function Wb(e){C.flags|=4;var t=C.updateQueue;if(t===null)t=fr(),C.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function dp(e){var t=se().memoizedState;return Wb({ref:t,nextImpl:e}),function(){if((K&2)!==0)throw Error(_(440));return t.impl.apply(void 0,arguments)}}function hp(e,t){return hr(4,2,e,t)}function pp(e,t){return hr(4,4,e,t)}function mp(e,t){if(typeof t==="function"){e=e();var n=t(e);return function(){typeof n==="function"?n():t(null)}}if(t!==null&&t!==void 0)return e=e(),t.current=e,function(){t.current=null}}function vp(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,hr(4,4,mp.bind(null,t,e),n)}function sc(){}function gp(e,t){var n=se();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&ec(t,a[1]))return a[0];return n.memoizedState=[e,t],e}function yp(e,t){var n=se();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&ec(t,a[1]))return a[0];if(a=e(),aa){hn(!0);try{e()}finally{hn(!1)}}return n.memoizedState=[a,t],a}function uc(e,t,n){if(n===void 0||(Xt&1073741824)!==0&&(q&261930)===0)return e.memoizedState=t;return e.memoizedState=n,e=am(),C.lanes|=e,Tn|=e,n}function bp(e,t,n,a){if(Ye(n,t))return n;if(Za.current!==null)return e=uc(e,n,a),Ye(e,t)||(de=!0),e;if((Xt&42)===0||(Xt&1073741824)!==0&&(q&261930)===0)return de=!0,e.memoizedState=n;return e=am(),C.lanes|=e,Tn|=e,t}function Sp(e,t,n,a,i){var l=X.p;X.p=l!==0&&8>l?l:8;var o=z.T,r={};z.T=r,fc(e,!1,t,n);try{var u=i(),c=z.S;if(c!==null&&c(r,u),u!==null&&typeof u==="object"&&typeof u.then==="function"){var m=Qb(u,a);Ji(e,t,m,at(e))}else Ji(e,t,a,at(e))}catch(y){Ji(e,t,{then:function(){},status:"rejected",reason:y},at())}finally{X.p=l,o!==null&&r.types!==null&&(o.types=r.types),z.T=o}}function Pb(){}function cu(e,t,n,a){if(e.tag!==5)throw Error(_(476));var i=_p(e).queue;Sp(e,i,t,Zn,n===null?Pb:function(){return xp(e),n(a)})}function _p(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Zn,baseState:Zn,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qt,lastRenderedState:Zn},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qt,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xp(e){var t=_p(e);t.next===null&&(t=e.alternate.memoizedState),Ji(e,t.next.queue,{},at())}function cc(){return Ee(dl)}function Ep(){return se().memoizedState}function wp(){return se().memoizedState}function Ib(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=at();e=Wn(n);var a=Pn(t,e,n);a!==null&&(Me(a,t,n),Qi(a,t,n)),t={cache:Ju()},e.payload=t;return}t=t.return}}function e0(e,t,n){var a=at();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pr(e)?Op(t,n):(n=Xu(e,t,n,a),n!==null&&(Me(n,e,a),Ap(n,t,a)))}function Np(e,t,n){var a=at();Ji(e,t,n,a)}function Ji(e,t,n,a){var i={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pr(e))Op(t,i);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var o=t.lastRenderedState,r=l(o,n);if(i.hasEagerState=!0,i.eagerState=r,Ye(r,o))return ur(e,t,i,0),W===null&&sr(),!1}catch(u){}finally{}if(n=Xu(e,t,i,a),n!==null)return Me(n,e,a),Ap(n,t,a),!0}return!1}function fc(e,t,n,a){if(a={lane:2,revertLane:Sc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},pr(e)){if(t)throw Error(_(479))}else t=Xu(e,n,a,2),t!==null&&Me(t,e,2)}function pr(e){var t=e.alternate;return e===C||t!==null&&t===C}function Op(e,t){qa=jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ap(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,fh(e,n)}}var ul={readContext:Ee,use:dr,useCallback:le,useContext:le,useEffect:le,useImperativeHandle:le,useLayoutEffect:le,useInsertionEffect:le,useMemo:le,useReducer:le,useRef:le,useState:le,useDebugValue:le,useDeferredValue:le,useTransition:le,useSyncExternalStore:le,useId:le,useHostTransitionStatus:le,useFormState:le,useActionState:le,useOptimistic:le,useMemoCache:le,useCacheRefresh:le};ul.useEffectEvent=le;var Tp={readContext:Ee,use:dr,useCallback:function(e,t){return Ae().memoizedState=[e,t===void 0?null:t],e},useContext:Ee,useEffect:pd,useImperativeHandle:function(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,So(4194308,4,mp.bind(null,t,e),n)},useLayoutEffect:function(e,t){return So(4194308,4,e,t)},useInsertionEffect:function(e,t){So(4,2,e,t)},useMemo:function(e,t){var n=Ae();t=t===void 0?null:t;var a=e();if(aa){hn(!0);try{e()}finally{hn(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=Ae();if(n!==void 0){var i=n(t);if(aa){hn(!0);try{n(t)}finally{hn(!1)}}}else i=t;return a.memoizedState=a.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},a.queue=e,e=e.dispatch=e0.bind(null,C,e),[a.memoizedState,e]},useRef:function(e){var t=Ae();return e={current:e},t.memoizedState=e},useState:function(e){e=su(e);var t=e.queue,n=Np.bind(null,C,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:sc,useDeferredValue:function(e,t){var n=Ae();return uc(n,e,t)},useTransition:function(){var e=su(!1);return e=Sp.bind(null,C,e.queue,!0,!1),Ae().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=C,i=Ae();if(G){if(n===void 0)throw Error(_(407));n=n()}else{if(n=t(),W===null)throw Error(_(349));(q&127)!==0||tp(a,t,n)}i.memoizedState=n;var l={value:n,getSnapshot:t};return i.queue=l,pd(ap.bind(null,a,l,e),[e]),a.flags|=2048,$a(9,{destroy:void 0},np.bind(null,a,l,n,t),null),n},useId:function(){var e=Ae(),t=W.identifierPrefix;if(G){var n=xt,a=_t;n=(a&~(1<<32-Ge(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=qo++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Zb++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:cc,useFormState:fd,useActionState:fd,useOptimistic:function(e){var t=Ae();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=fc.bind(null,C,!0,n),n.dispatch=t,[e,t]},useMemoCache:lc,useCacheRefresh:function(){return Ae().memoizedState=Ib.bind(null,C)},useEffectEvent:function(e){var t=Ae(),n={impl:e};return t.memoizedState=n,function(){if((K&2)!==0)throw Error(_(440));return n.impl.apply(void 0,arguments)}}},dc={readContext:Ee,use:dr,useCallback:gp,useContext:Ee,useEffect:rc,useImperativeHandle:vp,useInsertionEffect:hp,useLayoutEffect:pp,useMemo:yp,useReducer:bo,useRef:fp,useState:function(){return bo(Qt)},useDebugValue:sc,useDeferredValue:function(e,t){var n=se();return bp(n,F.memoizedState,e,t)},useTransition:function(){var e=bo(Qt)[0],t=se().memoizedState;return[typeof e==="boolean"?e:xl(e),t]},useSyncExternalStore:ep,useId:Ep,useHostTransitionStatus:cc,useFormState:dd,useActionState:dd,useOptimistic:function(e,t){var n=se();return op(n,F,e,t)},useMemoCache:lc,useCacheRefresh:wp};dc.useEffectEvent=dp;var Dp={readContext:Ee,use:dr,useCallback:gp,useContext:Ee,useEffect:rc,useImperativeHandle:vp,useInsertionEffect:hp,useLayoutEffect:pp,useMemo:yp,useReducer:ys,useRef:fp,useState:function(){return ys(Qt)},useDebugValue:sc,useDeferredValue:function(e,t){var n=se();return F===null?uc(n,e,t):bp(n,F.memoizedState,e,t)},useTransition:function(){var e=ys(Qt)[0],t=se().memoizedState;return[typeof e==="boolean"?e:xl(e),t]},useSyncExternalStore:ep,useId:Ep,useHostTransitionStatus:cc,useFormState:hd,useActionState:hd,useOptimistic:function(e,t){var n=se();if(F!==null)return op(n,F,e,t);return n.baseState=e,[e,n.queue.dispatch]},useMemoCache:lc,useCacheRefresh:wp};Dp.useEffectEvent=dp;function bs(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n===null||n===void 0?t:ae({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var fu={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=at(),i=Wn(a);i.payload=t,n!==void 0&&n!==null&&(i.callback=n),t=Pn(e,i,a),t!==null&&(Me(t,e,a),Qi(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=at(),i=Wn(a);i.tag=1,i.payload=t,n!==void 0&&n!==null&&(i.callback=n),t=Pn(e,i,a),t!==null&&(Me(t,e,a),Qi(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=at(),a=Wn(n);a.tag=2,t!==void 0&&t!==null&&(a.callback=t),t=Pn(e,a,n),t!==null&&(Me(t,e,n),Qi(t,e,n))}};function md(e,t,n,a,i,l,o){return e=e.stateNode,typeof e.shouldComponentUpdate==="function"?e.shouldComponentUpdate(a,l,o):t.prototype&&t.prototype.isPureReactComponent?!il(n,a)||!il(i,l):!0}function vd(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps==="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps==="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&fu.enqueueReplaceState(t,t.state,null)}function ia(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=ae({},n));for(var i in e)n[i]===void 0&&(n[i]=e[i])}return n}function t0(e){Co(e)}function n0(e){console.error(e)}function a0(e){Co(e)}function Go(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function gd(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function du(e,t,n){return n=Wn(n),n.tag=3,n.payload={element:null},n.callback=function(){Go(e,t)},n}function zp(e){return e=Wn(e),e.tag=3,e}function Rp(e,t,n,a){var i=n.type.getDerivedStateFromError;if(typeof i==="function"){var l=a.value;e.payload=function(){return i(l)},e.callback=function(){gd(t,n,a)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==="function"&&(e.callback=function(){gd(t,n,a),typeof i!=="function"&&(Sn===null?Sn=new Set([this]):Sn.add(this));var r=a.stack;this.componentDidCatch(a.value,{componentStack:r!==null?r:""})})}function i0(e,t,n,a,i){if(n.flags|=32768,a!==null&&typeof a==="object"&&typeof a.then==="function"){if(t=n.alternate,t!==null&&ti(t,n,i,!0),n=Ke.current,n!==null){switch(n.tag){case 31:case 13:return nt===null?Zo():n.alternate===null&&oe===0&&(oe=3),n.flags&=-257,n.flags|=65536,n.lanes=i,a===Lo?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),zs(e,a,i)),!1;case 22:return n.flags|=65536,a===Lo?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),zs(e,a,i)),!1}throw Error(_(435,n.tag))}return zs(e,a,i),Zo(),!1}if(G)return t=Ke.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,a!==Is&&(e=Error(_(422),{cause:a}),ol(et(e,n)))):(a!==Is&&(t=Error(_(423),{cause:a}),ol(et(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,a=et(a,n),i=du(e.stateNode,a,i),gs(e,i),oe!==4&&(oe=2)),!1;var l=Error(_(520),{cause:a});if(l=et(l,n),Pi===null?Pi=[l]:Pi.push(l),oe!==4&&(oe=2),t===null)return!0;a=et(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=du(n.stateNode,a,e),gs(n,e),!1;case 1:if(t=n.type,l=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError==="function"||l!==null&&typeof l.componentDidCatch==="function"&&(Sn===null||!Sn.has(l))))return n.flags|=65536,i&=-i,n.lanes|=i,i=zp(i),Rp(i,e,n,a),gs(n,i),!1}n=n.return}while(n!==null);return!1}var hc=Error(_(461)),de=!1;function Se(e,t,n,a){t.child=e===null?$h(t,null,n,a):na(t,e.child,n,a)}function yd(e,t,n,a,i){n=n.render;var l=t.ref;if("ref"in a){var o={};for(var r in a)r!=="ref"&&(o[r]=a[r])}else o=a;if(ta(t),a=tc(e,t,n,o,l,i),r=nc(),e!==null&&!de)return ac(e,t,i),Zt(e,t,i);return G&&r&&Zu(t),t.flags|=1,Se(e,t,a,i),t.child}function bd(e,t,n,a,i){if(e===null){var l=n.type;if(typeof l==="function"&&!Qu(l)&&l.defaultProps===void 0&&n.compare===null)return t.tag=15,t.type=l,Mp(e,t,l,a,i);return e=go(n.type,null,a,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e}if(l=e.child,!pc(e,i)){var o=l.memoizedProps;if(n=n.compare,n=n!==null?n:il,n(o,a)&&e.ref===t.ref)return Zt(e,t,i)}return t.flags|=1,e=qt(l,a),e.ref=t.ref,e.return=t,t.child=e}function Mp(e,t,n,a,i){if(e!==null){var l=e.memoizedProps;if(il(l,a)&&e.ref===t.ref)if(de=!1,t.pendingProps=a=l,pc(e,i))(e.flags&131072)!==0&&(de=!0);else return t.lanes=e.lanes,Zt(e,t,i)}return hu(e,t,n,a,i)}function Cp(e,t,n,a){var i=a.children,l=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(l=l!==null?l.baseLanes|n:n,e!==null){a=t.child=e.child;for(i=0;a!==null;)i=i|a.lanes|a.childLanes,a=a.sibling;a=i&~l}else a=0,t.child=null;return Sd(e,t,l,n,a)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&yo(t,l!==null?l.cachePool:null),l!==null?sd(t,l):ou(),Wh(t);else return a=t.lanes=536870912,Sd(e,t,l!==null?l.baseLanes|n:n,n,a)}else l!==null?(yo(t,l.cachePool),sd(t,l),fn(t),t.memoizedState=null):(e!==null&&yo(t,null),ou(),fn(t));return Se(e,t,i,n),t.child}function Bi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Sd(e,t,n,a,i){var l=Fu();return l=l===null?null:{parent:fe._currentValue,pool:l},t.memoizedState={baseLanes:n,cachePool:l},e!==null&&yo(t,null),ou(),Wh(t),e!==null&&ti(e,t,a,!0),t.childLanes=i,null}function _o(e,t){return t=Yo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function _d(e,t,n){return na(t,e.child,null,n),e=_o(t,t.pendingProps),e.flags|=2,Le(t),t.memoizedState=null,e}function l0(e,t,n){var a=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(G){if(a.mode==="hidden")return e=_o(t,a),t.lanes=536870912,Bi(null,e);if(ru(t),(e=ne)?(e=Om(e,tt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Nn!==null?{id:_t,overflow:xt}:null,retryLane:536870912,hydrationErrors:null},n=qh(e),n.return=t,t.child=n,xe=t,ne=null)):e=null,e===null)throw On(t);return t.lanes=536870912,null}return _o(t,a)}var l=e.memoizedState;if(l!==null){var o=l.dehydrated;if(ru(t),i)if(t.flags&256)t.flags&=-257,t=_d(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(_(558));else if(de||ti(e,t,n,!1),i=(n&e.childLanes)!==0,de||i){if(a=W,a!==null&&(o=dh(a,n),o!==0&&o!==l.retryLane))throw l.retryLane=o,sa(e,o),Me(a,e,o),hc;Zo(),t=_d(e,t,n)}else e=l.treeContext,ne=it(o.nextSibling),xe=t,G=!0,bn=null,tt=!1,e!==null&&Yh(t,e),t=_o(t,a),t.flags|=4096;return t}return e=qt(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function xo(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(_(284));if(e===null||e.ref!==n)t.flags|=4194816}}function hu(e,t,n,a,i){if(ta(t),n=tc(e,t,n,a,void 0,i),a=nc(),e!==null&&!de)return ac(e,t,i),Zt(e,t,i);return G&&a&&Zu(t),t.flags|=1,Se(e,t,n,i),t.child}function xd(e,t,n,a,i,l){if(ta(t),t.updateQueue=null,n=Ih(t,a,n,i),Ph(e),a=nc(),e!==null&&!de)return ac(e,t,l),Zt(e,t,l);return G&&a&&Zu(t),t.flags|=1,Se(e,t,n,l),t.child}function Ed(e,t,n,a,i){if(ta(t),t.stateNode===null){var l=Ma,o=n.contextType;typeof o==="object"&&o!==null&&(l=Ee(o)),l=new n(a,l),t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=fu,t.stateNode=l,l._reactInternals=t,l=t.stateNode,l.props=a,l.state=t.memoizedState,l.refs={},Pu(t),o=n.contextType,l.context=typeof o==="object"&&o!==null?Ee(o):Ma,l.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==="function"&&(bs(t,n,o,a),l.state=t.memoizedState),typeof n.getDerivedStateFromProps==="function"||typeof l.getSnapshotBeforeUpdate==="function"||typeof l.UNSAFE_componentWillMount!=="function"&&typeof l.componentWillMount!=="function"||(o=l.state,typeof l.componentWillMount==="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount==="function"&&l.UNSAFE_componentWillMount(),o!==l.state&&fu.enqueueReplaceState(l,l.state,null),$i(t,a,l,i),Zi(),l.state=t.memoizedState),typeof l.componentDidMount==="function"&&(t.flags|=4194308),a=!0}else if(e===null){l=t.stateNode;var r=t.memoizedProps,u=ia(n,r);l.props=u;var c=l.context,m=n.contextType;o=Ma,typeof m==="object"&&m!==null&&(o=Ee(m));var y=n.getDerivedStateFromProps;m=typeof y==="function"||typeof l.getSnapshotBeforeUpdate==="function",r=t.pendingProps!==r,m||typeof l.UNSAFE_componentWillReceiveProps!=="function"&&typeof l.componentWillReceiveProps!=="function"||(r||c!==o)&&vd(t,l,a,o),sn=!1;var h=t.memoizedState;l.state=h,$i(t,a,l,i),Zi(),c=t.memoizedState,r||h!==c||sn?(typeof y==="function"&&(bs(t,n,y,a),c=t.memoizedState),(u=sn||md(t,n,u,a,h,c,o))?(m||typeof l.UNSAFE_componentWillMount!=="function"&&typeof l.componentWillMount!=="function"||(typeof l.componentWillMount==="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount==="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount==="function"&&(t.flags|=4194308)):(typeof l.componentDidMount==="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=c),l.props=a,l.state=c,l.context=o,a=u):(typeof l.componentDidMount==="function"&&(t.flags|=4194308),a=!1)}else{l=t.stateNode,iu(e,t),o=t.memoizedProps,m=ia(n,o),l.props=m,y=t.pendingProps,h=l.context,c=n.contextType,u=Ma,typeof c==="object"&&c!==null&&(u=Ee(c)),r=n.getDerivedStateFromProps,(c=typeof r==="function"||typeof l.getSnapshotBeforeUpdate==="function")||typeof l.UNSAFE_componentWillReceiveProps!=="function"&&typeof l.componentWillReceiveProps!=="function"||(o!==y||h!==u)&&vd(t,l,a,u),sn=!1,h=t.memoizedState,l.state=h,$i(t,a,l,i),Zi();var g=t.memoizedState;o!==y||h!==g||sn||e!==null&&e.dependencies!==null&&Vo(e.dependencies)?(typeof r==="function"&&(bs(t,n,r,a),g=t.memoizedState),(m=sn||md(t,n,m,a,h,g,u)||e!==null&&e.dependencies!==null&&Vo(e.dependencies))?(c||typeof l.UNSAFE_componentWillUpdate!=="function"&&typeof l.componentWillUpdate!=="function"||(typeof l.componentWillUpdate==="function"&&l.componentWillUpdate(a,g,u),typeof l.UNSAFE_componentWillUpdate==="function"&&l.UNSAFE_componentWillUpdate(a,g,u)),typeof l.componentDidUpdate==="function"&&(t.flags|=4),typeof l.getSnapshotBeforeUpdate==="function"&&(t.flags|=1024)):(typeof l.componentDidUpdate!=="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!=="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=g),l.props=a,l.state=g,l.context=u,a=m):(typeof l.componentDidUpdate!=="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof l.getSnapshotBeforeUpdate!=="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),a=!1)}return l=a,xo(e,t),a=(t.flags&128)!==0,l||a?(l=t.stateNode,n=a&&typeof n.getDerivedStateFromError!=="function"?null:l.render(),t.flags|=1,e!==null&&a?(t.child=na(t,e.child,null,i),t.child=na(t,null,n,i)):Se(e,t,n,i),t.memoizedState=l.state,e=t.child):e=Zt(e,t,i),e}function wd(e,t,n,a){return ea(),t.flags|=256,Se(e,t,n,a),t.child}var Ss={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _s(e){return{baseLanes:e,cachePool:Xh()}}function xs(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=He),e}function kp(e,t,n){var a=t.pendingProps,i=!1,l=(t.flags&128)!==0,o;if((o=l)||(o=e!==null&&e.memoizedState===null?!1:(re.current&2)!==0),o&&(i=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(G){if(i?cn(t):fn(t),(e=ne)?(e=Om(e,tt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Nn!==null?{id:_t,overflow:xt}:null,retryLane:536870912,hydrationErrors:null},n=qh(e),n.return=t,t.child=n,xe=t,ne=null)):e=null,e===null)throw On(t);return Du(e)?t.lanes=32:t.lanes=536870912,null}var r=a.children;if(a=a.fallback,i)return fn(t),i=t.mode,r=Yo({mode:"hidden",children:r},i),a=$n(a,i,n,null),r.return=t,a.return=t,r.sibling=a,t.child=r,a=t.child,a.memoizedState=_s(n),a.childLanes=xs(e,o,n),t.memoizedState=Ss,Bi(null,a);return cn(t),pu(t,r)}var u=e.memoizedState;if(u!==null&&(r=u.dehydrated,r!==null)){if(l)t.flags&256?(cn(t),t.flags&=-257,t=Es(e,t,n)):t.memoizedState!==null?(fn(t),t.child=e.child,t.flags|=128,t=null):(fn(t),r=a.fallback,i=t.mode,a=Yo({mode:"visible",children:a.children},i),r=$n(r,i,n,null),r.flags|=2,a.return=t,r.return=t,a.sibling=r,t.child=a,na(t,e.child,null,n),a=t.child,a.memoizedState=_s(n),a.childLanes=xs(e,o,n),t.memoizedState=Ss,t=Bi(null,a));else if(cn(t),Du(r)){if(o=r.nextSibling&&r.nextSibling.dataset,o)var c=o.dgst;o=c,a=Error(_(419)),a.stack="",a.digest=o,ol({value:a,source:null,stack:null}),t=Es(e,t,n)}else if(de||ti(e,t,n,!1),o=(n&e.childLanes)!==0,de||o){if(o=W,o!==null&&(a=dh(o,n),a!==0&&a!==u.retryLane))throw u.retryLane=a,sa(e,a),Me(o,e,a),hc;Tu(r)||Zo(),t=Es(e,t,n)}else Tu(r)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,ne=it(r.nextSibling),xe=t,G=!0,bn=null,tt=!1,e!==null&&Yh(t,e),t=pu(t,a.children),t.flags|=4096);return t}if(i)return fn(t),r=a.fallback,i=t.mode,u=e.child,c=u.sibling,a=qt(u,{mode:"hidden",children:a.children}),a.subtreeFlags=u.subtreeFlags&65011712,c!==null?r=qt(c,r):(r=$n(r,i,n,null),r.flags|=2),r.return=t,a.return=t,a.sibling=r,t.child=a,Bi(null,a),a=t.child,r=e.child.memoizedState,r===null?r=_s(n):(i=r.cachePool,i!==null?(u=fe._currentValue,i=i.parent!==u?{parent:u,pool:u}:i):i=Xh(),r={baseLanes:r.baseLanes|n,cachePool:i}),a.memoizedState=r,a.childLanes=xs(e,o,n),t.memoizedState=Ss,Bi(e.child,a);return cn(t),n=e.child,e=n.sibling,n=qt(n,{mode:"visible",children:a.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 pu(e,t){return t=Yo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Yo(e,t){return e=Be(22,e,null,t),e.lanes=0,e}function Es(e,t,n){return na(t,e.child,null,n),e=pu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Nd(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),tu(e.return,t,n)}function ws(e,t,n,a,i,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:i,treeForkCount:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=a,o.tail=n,o.tailMode=i,o.treeForkCount=l)}function Up(e,t,n){var a=t.pendingProps,i=a.revealOrder,l=a.tail;a=a.children;var o=re.current,r=(o&2)!==0;if(r?(o=o&1|2,t.flags|=128):o&=1,P(re,o),Se(e,t,a,n),a=G?ll:0,!r&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Nd(e,n,t);else if(e.tag===19)Nd(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"forwards":n=t.child;for(i=null;n!==null;)e=n.alternate,e!==null&&Ho(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ws(t,!1,i,n,l,a);break;case"backwards":case"unstable_legacy-backwards":n=null,i=t.child;for(t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ws(t,!0,n,null,l,a);break;case"together":ws(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function Zt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Tn|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ti(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(_(153));if(t.child!==null){e=t.child,n=qt(e,e.pendingProps),t.child=n;for(n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=qt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function pc(e,t){if((e.lanes&t)!==0)return!0;return e=e.dependencies,e!==null&&Vo(e)?!0:!1}function o0(e,t,n){switch(t.tag){case 3:Do(t,t.stateNode.containerInfo),un(t,fe,e.memoizedState.cache),ea();break;case 27:case 5:Gs(t);break;case 4:Do(t,t.stateNode.containerInfo);break;case 10:un(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ru(t),null;break;case 13:var a=t.memoizedState;if(a!==null){if(a.dehydrated!==null)return cn(t),t.flags|=128,null;if((n&t.child.childLanes)!==0)return kp(e,t,n);return cn(t),e=Zt(e,t,n),e!==null?e.sibling:null}cn(t);break;case 19:var i=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(ti(e,t,n,!1),a=(n&t.childLanes)!==0),i){if(a)return Up(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),P(re,re.current),a)break;else return null;case 22:return t.lanes=0,Cp(e,t,n,t.pendingProps);case 24:un(t,fe,e.memoizedState.cache)}return Zt(e,t,n)}function Vp(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)de=!0;else{if(!pc(e,n)&&(t.flags&128)===0)return de=!1,o0(e,t,n);de=(e.flags&131072)!==0?!0:!1}else de=!1,G&&(t.flags&1048576)!==0&&Gh(t,ll,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=Xn(t.elementType),t.type=e,typeof e==="function")Qu(e)?(a=ia(e,a),t.tag=1,t=Ed(null,t,e,a,n)):(t.tag=0,t=hu(null,t,e,a,n));else{if(e!==void 0&&e!==null){var i=e.$$typeof;if(i===Cu){t.tag=11,t=yd(null,t,e,a,n);break e}else if(i===ku){t.tag=14,t=bd(null,t,e,a,n);break e}}throw t=js(e)||e,Error(_(306,t,""))}}return t;case 0:return hu(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,i=ia(a,t.pendingProps),Ed(e,t,a,i,n);case 3:e:{if(Do(t,t.stateNode.containerInfo),e===null)throw Error(_(387));a=t.pendingProps;var l=t.memoizedState;i=l.element,iu(e,t),$i(t,a,null,n);var o=t.memoizedState;if(a=o.cache,un(t,fe,a),a!==l.cache&&nu(t,[fe],n,!0),Zi(),a=o.element,l.isDehydrated)if(l={element:a,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){t=wd(e,t,a,n);break e}else if(a!==i){i=et(Error(_(424)),t),ol(i),t=wd(e,t,a,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}ne=it(e.firstChild),xe=t,G=!0,bn=null,tt=!0,n=$h(t,null,a,n);for(t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ea(),a===i){t=Zt(e,t,n);break e}Se(e,t,a,n)}t=t.child}return t;case 26:return xo(e,t),e===null?(n=Xd(t.type,null,t.pendingProps,null))?t.memoizedState=n:G||(n=t.type,e=t.pendingProps,a=Wo(yn.current).createElement(n),a[_e]=t,a[Ce]=e,we(a,n,e),ge(a),t.stateNode=a):t.memoizedState=Xd(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Gs(t),e===null&&G&&(a=t.stateNode=Am(t.type,t.pendingProps,yn.current),xe=t,tt=!0,i=ne,zn(t.type)?(zu=i,ne=it(a.firstChild)):ne=i),Se(e,t,t.pendingProps.children,n),xo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:if(e===null&&G){if(i=a=ne)a=k0(a,t.type,t.pendingProps,tt),a!==null?(t.stateNode=a,xe=t,ne=it(a.firstChild),tt=!1,i=!0):i=!1;i||On(t)}return Gs(t),i=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,a=l.children,Ou(i,l)?a=null:o!==null&&Ou(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=tc(e,t,$b,null,null,n),dl._currentValue=i),xo(e,t),Se(e,t,a,n),t.child;case 6:if(e===null&&G){if(e=n=ne)n=U0(n,t.pendingProps,tt),n!==null?(t.stateNode=n,xe=t,ne=null,e=!0):e=!1;e||On(t)}return null;case 13:return kp(e,t,n);case 4:return Do(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=na(t,null,a,n):Se(e,t,a,n),t.child;case 11:return yd(e,t,t.type,t.pendingProps,n);case 7:return Se(e,t,t.pendingProps,n),t.child;case 8:return Se(e,t,t.pendingProps.children,n),t.child;case 12:return Se(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,un(t,t.type,a.value),Se(e,t,a.children,n),t.child;case 9:return i=t.type._context,a=t.pendingProps.children,ta(t),i=Ee(i),a=a(i),t.flags|=1,Se(e,t,a,n),t.child;case 14:return bd(e,t,t.type,t.pendingProps,n);case 15:return Mp(e,t,t.type,t.pendingProps,n);case 19:return Up(e,t,n);case 31:return l0(e,t,n);case 22:return Cp(e,t,n,t.pendingProps);case 24:return ta(t),a=Ee(fe),e===null?(i=Fu(),i===null&&(i=W,l=Ju(),i.pooledCache=l,l.refCount++,l!==null&&(i.pooledCacheLanes|=n),i=l),t.memoizedState={parent:a,cache:i},Pu(t),un(t,fe,i)):((e.lanes&n)!==0&&(iu(e,t),$i(t,null,null,n),Zi()),i=e.memoizedState,l=t.memoizedState,i.parent!==a?(i={parent:a,cache:a},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),un(t,fe,a)):(a=l.cache,un(t,fe,a),a!==i.cache&&nu(t,[fe],n,!0))),Se(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(_(156,t.tag))}function Mt(e){e.flags|=4}function Ns(e,t,n,a,i){if(t=(e.mode&32)!==0)t=!1;if(t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(om())e.flags|=8192;else throw Fn=Lo,Wu}else e.flags&=-16777217}function Od(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!zm(t))if(om())e.flags|=8192;else throw Fn=Lo,Wu}function oo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?uh():536870912,e.lanes|=t,Ja|=t)}function zi(e,t){if(!G)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function te(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,a|=i.subtreeFlags&65011712,a|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,a|=i.subtreeFlags,a|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function r0(e,t,n){var a=t.pendingProps;switch($u(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return te(t),null;case 1:return te(t),null;case 3:if(n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Gt(fe),Ya(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),e===null||e.child===null)ba(t)?Mt(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,vs());return te(t),null;case 26:var{type:i,memoizedState:l}=t;return e===null?(Mt(t),l!==null?(te(t),Od(t,l)):(te(t),Ns(t,i,null,a,n))):l?l!==e.memoizedState?(Mt(t),te(t),Od(t,l)):(te(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&Mt(t),te(t),Ns(t,i,e,a,n)),null;case 27:if(zo(t),n=yn.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Mt(t);else{if(!a){if(t.stateNode===null)throw Error(_(166));return te(t),null}e=wt.current,ba(t)?td(t,e):(e=Am(i,a,n),t.stateNode=e,Mt(t))}return te(t),null;case 5:if(zo(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Mt(t);else{if(!a){if(t.stateNode===null)throw Error(_(166));return te(t),null}if(l=wt.current,ba(t))td(t,l);else{var o=Wo(yn.current);switch(l){case 1:l=o.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:l=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":l=o.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":l=o.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":l=o.createElement("div"),l.innerHTML="<script></script>",l=l.removeChild(l.firstChild);break;case"select":l=typeof a.is==="string"?o.createElement("select",{is:a.is}):o.createElement("select"),a.multiple?l.multiple=!0:a.size&&(l.size=a.size);break;default:l=typeof a.is==="string"?o.createElement(i,{is:a.is}):o.createElement(i)}}l[_e]=t,l[Ce]=a;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)l.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=l;e:switch(we(l,i,a),i){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Mt(t)}}return te(t),Ns(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Mt(t);else{if(typeof a!=="string"&&t.stateNode===null)throw Error(_(166));if(e=yn.current,ba(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,i=xe,i!==null)switch(i.tag){case 27:case 5:a=i.memoizedProps}e[_e]=t,e=e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Em(e.nodeValue,n)?!0:!1,e||On(t,!0)}else e=Wo(e).createTextNode(a),e[_e]=t,t.stateNode=e}return te(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=ba(t),n!==null){if(e===null){if(!a)throw Error(_(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(_(557));e[_e]=t}else ea(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;te(t),e=!1}else n=vs(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e){if(t.flags&256)return Le(t),t;return Le(t),null}if((t.flags&128)!==0)throw Error(_(558))}return te(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ba(t),a!==null&&a.dehydrated!==null){if(e===null){if(!i)throw Error(_(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(_(317));i[_e]=t}else ea(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;te(t),i=!1}else i=vs(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i){if(t.flags&256)return Le(t),t;return Le(t),null}}if(Le(t),(t.flags&128)!==0)return t.lanes=n,t;return n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,i=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(i=a.alternate.memoizedState.cachePool.pool),l=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),l!==i&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),oo(t,t.updateQueue),te(t),null;case 4:return Ya(),e===null&&_m(t.stateNode.containerInfo),te(t),null;case 10:return Gt(t.type),te(t),null;case 19:if(ye(re),a=t.memoizedState,a===null)return te(t),null;if(i=(t.flags&128)!==0,l=a.rendering,l===null)if(i)zi(a,!1);else{if(oe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(l=Ho(e),l!==null){t.flags|=128,zi(a,!1),e=l.updateQueue,t.updateQueue=e,oo(t,e),t.subtreeFlags=0,e=n;for(n=t.child;n!==null;)jh(n,e),n=n.sibling;return P(re,re.current&1|2),G&&Vt(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&je()>Xo&&(t.flags|=128,i=!0,zi(a,!1),t.lanes=4194304)}else{if(!i)if(e=Ho(l),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,oo(t,e),zi(a,!0),a.tail===null&&a.tailMode==="hidden"&&!l.alternate&&!G)return te(t),null}else 2*je()-a.renderingStartTime>Xo&&n!==536870912&&(t.flags|=128,i=!0,zi(a,!1),t.lanes=4194304);a.isBackwards?(l.sibling=t.child,t.child=l):(e=a.last,e!==null?e.sibling=l:t.child=l,a.last=l)}if(a.tail!==null)return e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=je(),e.sibling=null,n=re.current,P(re,i?n&1|2:n&1),G&&Vt(t,a.treeForkCount),e;return te(t),null;case 22:case 23:return Le(t),Iu(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(n&536870912)!==0&&(t.flags&128)===0&&(te(t),t.subtreeFlags&6&&(t.flags|=8192)):te(t),n=t.updateQueue,n!==null&&oo(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&ye(Jn),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gt(fe),te(t),null;case 25:return null;case 30:return null}throw Error(_(156,t.tag))}function s0(e,t){switch($u(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gt(fe),Ya(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zo(t),null;case 31:if(t.memoizedState!==null){if(Le(t),t.alternate===null)throw Error(_(340));ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Le(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(_(340));ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ye(re),null;case 4:return Ya(),null;case 10:return Gt(t.type),null;case 22:case 23:return Le(t),Iu(),e!==null&&ye(Jn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gt(fe),null;case 25:return null;default:return null}}function Lp(e,t){switch($u(t),t.tag){case 3:Gt(fe),Ya();break;case 26:case 27:case 5:zo(t);break;case 4:Ya();break;case 31:t.memoizedState!==null&&Le(t);break;case 13:Le(t);break;case 19:ye(re);break;case 10:Gt(t.type);break;case 22:case 23:Le(t),Iu(),e!==null&&ye(Jn);break;case 24:Gt(fe)}}function El(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var i=a.next;n=i;do{if((n.tag&e)===e){a=void 0;var l=n.create,o=n.inst;a=l(),o.destroy=a}n=n.next}while(n!==i)}}catch(r){Z(t,t.return,r)}}function An(e,t,n){try{var a=t.updateQueue,i=a!==null?a.lastEffect:null;if(i!==null){var l=i.next;a=l;do{if((a.tag&e)===e){var o=a.inst,r=o.destroy;if(r!==void 0){o.destroy=void 0,i=t;var u=n,c=r;try{c()}catch(m){Z(i,u,m)}}}a=a.next}while(a!==l)}}catch(m){Z(t,t.return,m)}}function Bp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Fh(t,n)}catch(a){Z(e,e.return,a)}}}function Hp(e,t,n){n.props=ia(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Z(e,t,a)}}function Fi(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof n==="function"?e.refCleanup=n(a):n.current=a}}catch(i){Z(e,t,i)}}function Et(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a==="function")try{a()}catch(i){Z(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==="function")try{n(null)}catch(i){Z(e,t,i)}else n.current=null}function jp(e){var{type:t,memoizedProps:n,stateNode:a}=e;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(i){Z(e,e.return,i)}}function Os(e,t,n){try{var a=e.stateNode;T0(a,e.type,n,t),a[Ce]=t}catch(i){Z(e,e.return,i)}}function qp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&zn(e.type)||e.tag===4}function As(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qp(e.return))return null;e=e.return}e.sibling.return=e.return;for(e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&zn(e.type))continue e;if(e.flags&2)continue e;if(e.child===null||e.tag===4)continue e;else e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function mu(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!==null&&n!==void 0||t.onclick!==null||(t.onclick=Ht));else if(a!==4&&(a===27&&zn(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(mu(e,t,n),e=e.sibling;e!==null;)mu(e,t,n),e=e.sibling}function Ko(e,t,n){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(a!==4&&(a===27&&zn(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ko(e,t,n),e=e.sibling;e!==null;)Ko(e,t,n),e=e.sibling}function Gp(e){var{stateNode:t,memoizedProps:n}=e;try{for(var a=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);we(t,a,n),t[_e]=e,t[Ce]=n}catch(l){Z(e,e.return,l)}}var Lt=!1,ce=!1,Ts=!1,Ad=typeof WeakSet==="function"?WeakSet:Set,ve=null;function u0(e,t){if(e=e.containerInfo,wu=tr,e=Mh(e),Yu(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var a=n.getSelection&&n.getSelection();if(a&&a.rangeCount!==0){n=a.anchorNode;var i=a.anchorOffset,l=a.focusNode;a=a.focusOffset;try{n.nodeType,l.nodeType}catch(A){n=null;break e}var o=0,r=-1,u=-1,c=0,m=0,y=e,h=null;t:for(;;){for(var g;;){if(y!==n||i!==0&&y.nodeType!==3||(r=o+i),y!==l||a!==0&&y.nodeType!==3||(u=o+a),y.nodeType===3&&(o+=y.nodeValue.length),(g=y.firstChild)===null)break;h=y,y=g}for(;;){if(y===e)break t;if(h===n&&++c===i&&(r=o),h===l&&++m===a&&(u=o),(g=y.nextSibling)!==null)break;y=h,h=y.parentNode}y=g}n=r===-1||u===-1?null:{start:r,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;Nu={focusedElem:e,selectionRange:n},tr=!1;for(ve=t;ve!==null;)if(t=ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ve=e;else for(;ve!==null;){switch(t=ve,l=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&l!==null){e=void 0,n=t,i=l.memoizedProps,l=l.memoizedState,a=n.stateNode;try{var x=ia(n.type,i);e=a.getSnapshotBeforeUpdate(x,l),a.__reactInternalSnapshotBeforeUpdate=e}catch(A){Z(n,n.return,A)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Au(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Au(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(_(163))}if(e=t.sibling,e!==null){e.return=t.return,ve=e;break}ve=t.return}}function Yp(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:kt(e,n),a&4&&El(5,n);break;case 1:if(kt(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){Z(n,n.return,o)}else{var i=ia(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Z(n,n.return,o)}}a&64&&Bp(n),a&512&&Fi(n,n.return);break;case 3:if(kt(e,n),a&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{Fh(e,t)}catch(o){Z(n,n.return,o)}}break;case 27:t===null&&a&4&&Gp(n);case 26:case 5:kt(e,n),t===null&&a&4&&jp(n),a&512&&Fi(n,n.return);break;case 12:kt(e,n);break;case 31:kt(e,n),a&4&&Qp(e,n);break;case 13:kt(e,n),a&4&&Zp(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=y0.bind(null,n),V0(e,n))));break;case 22:if(a=n.memoizedState!==null||Lt,!a){t=t!==null&&t.memoizedState!==null||ce,i=Lt;var l=ce;Lt=a,(ce=t)&&!l?Ut(e,n,(n.subtreeFlags&8772)!==0):kt(e,n),Lt=i,ce=l}break;case 30:break;default:kt(e,n)}}function Kp(e){var t=e.alternate;t!==null&&(e.alternate=null,Kp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Lu(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 ie=null,ze=!1;function Ct(e,t,n){for(n=n.child;n!==null;)Xp(e,t,n),n=n.sibling}function Xp(e,t,n){if(qe&&typeof qe.onCommitFiberUnmount==="function")try{qe.onCommitFiberUnmount(vl,n)}catch(l){}switch(n.tag){case 26:ce||Et(n,t),Ct(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:ce||Et(n,t);var a=ie,i=ze;zn(n.type)&&(ie=n.stateNode,ze=!1),Ct(e,t,n),el(n.stateNode),ie=a,ze=i;break;case 5:ce||Et(n,t);case 6:if(a=ie,i=ze,ie=null,Ct(e,t,n),ie=a,ze=i,ie!==null)if(ze)try{(ie.nodeType===9?ie.body:ie.nodeName==="HTML"?ie.ownerDocument.body:ie).removeChild(n.stateNode)}catch(l){Z(n,t,l)}else try{ie.removeChild(n.stateNode)}catch(l){Z(n,t,l)}break;case 18:ie!==null&&(ze?(e=ie,jd(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Ia(e)):jd(ie,n.stateNode));break;case 4:a=ie,i=ze,ie=n.stateNode.containerInfo,ze=!0,Ct(e,t,n),ie=a,ze=i;break;case 0:case 11:case 14:case 15:An(2,n,t),ce||An(4,n,t),Ct(e,t,n);break;case 1:ce||(Et(n,t),a=n.stateNode,typeof a.componentWillUnmount==="function"&&Hp(n,t,a)),Ct(e,t,n);break;case 21:Ct(e,t,n);break;case 22:ce=(a=ce)||n.memoizedState!==null,Ct(e,t,n),ce=a;break;default:Ct(e,t,n)}}function Qp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Ia(e)}catch(n){Z(t,t.return,n)}}}function Zp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Ia(e)}catch(n){Z(t,t.return,n)}}function c0(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Ad),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Ad),t;default:throw Error(_(435,e.tag))}}function ro(e,t){var n=c0(e);t.forEach(function(a){if(!n.has(a)){n.add(a);var i=b0.bind(null,e,a);a.then(i,i)}})}function Te(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var i=n[a],l=e,o=t,r=o;e:for(;r!==null;){switch(r.tag){case 27:if(zn(r.type)){ie=r.stateNode,ze=!1;break e}break;case 5:ie=r.stateNode,ze=!1;break e;case 3:case 4:ie=r.stateNode.containerInfo,ze=!0;break e}r=r.return}if(ie===null)throw Error(_(160));Xp(l,o,i),ie=null,ze=!1,l=i.alternate,l!==null&&(l.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)$p(t,e),t=t.sibling}var pt=null;function $p(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Te(t,e),De(e),a&4&&(An(3,e,e.return),El(3,e),An(5,e,e.return));break;case 1:Te(t,e),De(e),a&512&&(ce||n===null||Et(n,n.return)),a&64&&Lt&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?a:n.concat(a))));break;case 26:var i=pt;if(Te(t,e),De(e),a&512&&(ce||n===null||Et(n,n.return)),a&4){var l=n!==null?n.memoizedState:null;if(a=e.memoizedState,n===null)if(a===null)if(e.stateNode===null){e:{a=e.type,n=e.memoizedProps,i=i.ownerDocument||i;t:switch(a){case"title":if(l=i.getElementsByTagName("title")[0],!l||l[bl]||l[_e]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))l=i.createElement(a),i.head.insertBefore(l,i.querySelector("head > title"));we(l,a,n),l[_e]=e,ge(l),a=l;break e;case"link":var o=Zd("link","href",i).get(a+(n.href||""));if(o){for(var r=0;r<o.length;r++)if(l=o[r],l.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&l.getAttribute("rel")===(n.rel==null?null:n.rel)&&l.getAttribute("title")===(n.title==null?null:n.title)&&l.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(r,1);break t}}l=i.createElement(a),we(l,a,n),i.head.appendChild(l);break;case"meta":if(o=Zd("meta","content",i).get(a+(n.content||""))){for(r=0;r<o.length;r++)if(l=o[r],l.getAttribute("content")===(n.content==null?null:""+n.content)&&l.getAttribute("name")===(n.name==null?null:n.name)&&l.getAttribute("property")===(n.property==null?null:n.property)&&l.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&l.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(r,1);break t}}l=i.createElement(a),we(l,a,n),i.head.appendChild(l);break;default:throw Error(_(468,a))}l[_e]=e,ge(l),a=l}e.stateNode=a}else $d(i,e.type,e.stateNode);else e.stateNode=Qd(i,a,e.memoizedProps);else l!==a?(l===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):l.count--,a===null?$d(i,e.type,e.stateNode):Qd(i,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Os(e,e.memoizedProps,n.memoizedProps)}break;case 27:Te(t,e),De(e),a&512&&(ce||n===null||Et(n,n.return)),n!==null&&a&4&&Os(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Te(t,e),De(e),a&512&&(ce||n===null||Et(n,n.return)),e.flags&32){i=e.stateNode;try{Xa(i,"")}catch(x){Z(e,e.return,x)}}a&4&&e.stateNode!=null&&(i=e.memoizedProps,Os(e,i,n!==null?n.memoizedProps:i)),a&1024&&(Ts=!0);break;case 6:if(Te(t,e),De(e),a&4){if(e.stateNode===null)throw Error(_(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(x){Z(e,e.return,x)}}break;case 3:if(No=null,i=pt,pt=Po(t.containerInfo),Te(t,e),pt=i,De(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Ia(t.containerInfo)}catch(x){Z(e,e.return,x)}Ts&&(Ts=!1,Jp(e));break;case 4:a=pt,pt=Po(e.stateNode.containerInfo),Te(t,e),De(e),pt=a;break;case 12:Te(t,e),De(e);break;case 31:Te(t,e),De(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,ro(e,a)));break;case 13:Te(t,e),De(e),e.child.flags&8192&&e.memoizedState!==null!==(n!==null&&n.memoizedState!==null)&&(mr=je()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,ro(e,a)));break;case 22:i=e.memoizedState!==null;var u=n!==null&&n.memoizedState!==null,c=Lt,m=ce;if(Lt=c||i,ce=m||u,Te(t,e),ce=m,Lt=c,De(e),a&8192)e:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||u||Lt||ce||Qn(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){u=n=t;try{if(l=u.stateNode,i)o=l.style,typeof o.setProperty==="function"?o.setProperty("display","none","important"):o.display="none";else{r=u.stateNode;var y=u.memoizedProps.style,h=y!==void 0&&y!==null&&y.hasOwnProperty("display")?y.display:null;r.style.display=h==null||typeof h==="boolean"?"":(""+h).trim()}}catch(x){Z(u,u.return,x)}}}else if(t.tag===6){if(n===null){u=t;try{u.stateNode.nodeValue=i?"":u.memoizedProps}catch(x){Z(u,u.return,x)}}}else if(t.tag===18){if(n===null){u=t;try{var g=u.stateNode;i?qd(g,!0):qd(u.stateNode,!1)}catch(x){Z(u,u.return,x)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(n=a.retryQueue,n!==null&&(a.retryQueue=null,ro(e,n))));break;case 19:Te(t,e),De(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,ro(e,a)));break;case 30:break;case 21:break;default:Te(t,e),De(e)}}function De(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(qp(a)){n=a;break}a=a.return}if(n==null)throw Error(_(160));switch(n.tag){case 27:var i=n.stateNode,l=As(e);Ko(e,l,i);break;case 5:var o=n.stateNode;n.flags&32&&(Xa(o,""),n.flags&=-33);var r=As(e);Ko(e,r,o);break;case 3:case 4:var u=n.stateNode.containerInfo,c=As(e);mu(e,c,u);break;default:throw Error(_(161))}}catch(m){Z(e,e.return,m)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Jp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Jp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function kt(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Yp(e,t.alternate,t),t=t.sibling}function Qn(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:An(4,t,t.return),Qn(t);break;case 1:Et(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==="function"&&Hp(t,t.return,n),Qn(t);break;case 27:el(t.stateNode);case 26:case 5:Et(t,t.return),Qn(t);break;case 22:t.memoizedState===null&&Qn(t);break;case 30:Qn(t);break;default:Qn(t)}e=e.sibling}}function Ut(e,t,n){n=n&&(t.subtreeFlags&8772)!==0;for(t=t.child;t!==null;){var a=t.alternate,i=e,l=t,o=l.flags;switch(l.tag){case 0:case 11:case 15:Ut(i,l,n),El(4,l);break;case 1:if(Ut(i,l,n),a=l,i=a.stateNode,typeof i.componentDidMount==="function")try{i.componentDidMount()}catch(c){Z(a,a.return,c)}if(a=l,i=a.updateQueue,i!==null){var r=a.stateNode;try{var u=i.shared.hiddenCallbacks;if(u!==null)for(i.shared.hiddenCallbacks=null,i=0;i<u.length;i++)Jh(u[i],r)}catch(c){Z(a,a.return,c)}}n&&o&64&&Bp(l),Fi(l,l.return);break;case 27:Gp(l);case 26:case 5:Ut(i,l,n),n&&a===null&&o&4&&jp(l),Fi(l,l.return);break;case 12:Ut(i,l,n);break;case 31:Ut(i,l,n),n&&o&4&&Qp(i,l);break;case 13:Ut(i,l,n),n&&o&4&&Zp(i,l);break;case 22:l.memoizedState===null&&Ut(i,l,n),Fi(l,l.return);break;case 30:break;default:Ut(i,l,n)}t=t.sibling}}function mc(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&&_l(n))}function vc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_l(e))}function ht(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Fp(e,t,n,a),t=t.sibling}function Fp(e,t,n,a){var i=t.flags;switch(t.tag){case 0:case 11:case 15:ht(e,t,n,a),i&2048&&El(9,t);break;case 1:ht(e,t,n,a);break;case 3:ht(e,t,n,a),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_l(e)));break;case 12:if(i&2048){ht(e,t,n,a),e=t.stateNode;try{var l=t.memoizedProps,o=l.id,r=l.onPostCommit;typeof r==="function"&&r(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(u){Z(t,t.return,u)}}else ht(e,t,n,a);break;case 31:ht(e,t,n,a);break;case 13:ht(e,t,n,a);break;case 23:break;case 22:l=t.stateNode,o=t.alternate,t.memoizedState!==null?l._visibility&2?ht(e,t,n,a):Wi(e,t):l._visibility&2?ht(e,t,n,a):(l._visibility|=2,_a(e,t,n,a,(t.subtreeFlags&10256)!==0||!1)),i&2048&&mc(o,t);break;case 24:ht(e,t,n,a),i&2048&&vc(t.alternate,t);break;default:ht(e,t,n,a)}}function _a(e,t,n,a,i){i=i&&((t.subtreeFlags&10256)!==0||!1);for(t=t.child;t!==null;){var l=e,o=t,r=n,u=a,c=o.flags;switch(o.tag){case 0:case 11:case 15:_a(l,o,r,u,i),El(8,o);break;case 23:break;case 22:var m=o.stateNode;o.memoizedState!==null?m._visibility&2?_a(l,o,r,u,i):Wi(l,o):(m._visibility|=2,_a(l,o,r,u,i)),i&&c&2048&&mc(o.alternate,o);break;case 24:_a(l,o,r,u,i),i&&c&2048&&vc(o.alternate,o);break;default:_a(l,o,r,u,i)}t=t.sibling}}function Wi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,i=a.flags;switch(a.tag){case 22:Wi(n,a),i&2048&&mc(a.alternate,a);break;case 24:Wi(n,a),i&2048&&vc(a.alternate,a);break;default:Wi(n,a)}t=t.sibling}}var Hi=8192;function Sa(e,t,n){if(e.subtreeFlags&Hi)for(e=e.child;e!==null;)Wp(e,t,n),e=e.sibling}function Wp(e,t,n){switch(e.tag){case 26:Sa(e,t,n),e.flags&Hi&&e.memoizedState!==null&&$0(n,pt,e.memoizedState,e.memoizedProps);break;case 5:Sa(e,t,n);break;case 3:case 4:var a=pt;pt=Po(e.stateNode.containerInfo),Sa(e,t,n),pt=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=Hi,Hi=16777216,Sa(e,t,n),Hi=a):Sa(e,t,n));break;default:Sa(e,t,n)}}function Pp(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 Ri(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];ve=a,em(a,e)}Pp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ip(e),e=e.sibling}function Ip(e){switch(e.tag){case 0:case 11:case 15:Ri(e),e.flags&2048&&An(9,e,e.return);break;case 3:Ri(e);break;case 12:Ri(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Eo(e)):Ri(e);break;default:Ri(e)}}function Eo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];ve=a,em(a,e)}Pp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:An(8,t,t.return),Eo(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Eo(t));break;default:Eo(t)}e=e.sibling}}function em(e,t){for(;ve!==null;){var n=ve;switch(n.tag){case 0:case 11:case 15:An(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:_l(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,ve=a;else e:for(n=e;ve!==null;){a=ve;var i=a.sibling,l=a.return;if(Kp(a),a===n){ve=null;break e}if(i!==null){i.return=l,ve=i;break e}ve=l}}}var f0={getCacheForType:function(e){var t=Ee(fe),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ee(fe).controller.signal}},d0=typeof WeakMap==="function"?WeakMap:Map,K=0,W=null,j=null,q=0,Q=0,Ve=null,mn=!1,ai=!1,gc=!1,$t=0,oe=0,Tn=0,In=0,yc=0,He=0,Ja=0,Pi=null,Re=null,vu=!1,mr=0,tm=0,Xo=1/0,Qo=null,Sn=null,pe=0,_n=null,Fa=null,Yt=0,gu=0,yu=null,nm=null,Ii=0,bu=null;function at(){return(K&2)!==0&&q!==0?q&-q:z.T!==null?Sc():ph()}function am(){if(He===0)if((q&536870912)===0||G){var e=Il;Il<<=1,(Il&3932160)===0&&(Il=262144),He=e}else He=536870912;return e=Ke.current,e!==null&&(e.flags|=32),He}function Me(e,t,n){if(e===W&&(Q===2||Q===9)||e.cancelPendingCommit!==null)Wa(e,0),vn(e,q,He,!1);if(ir(e,n),(K&2)===0||e!==W)e===W&&((K&2)===0&&(In|=n),oe===4&&vn(e,q,He,!1)),Jt(e)}function im(e,t,n){if((K&6)!==0)throw Error(_(327));var a=!n&&(t&127)===0&&(t&e.expiredLanes)===0||gl(e,t),i=a?m0(e,t):Ds(e,t,!0),l=a;do{if(i===0){ai&&!a&&vn(e,t,0,!1);break}else{if(n=e.current.alternate,l&&!h0(n)){i=Ds(e,t,!1),l=!1;continue}if(i===2){if(l=t,e.errorRecoveryDisabledLanes&l)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var r=e;i=Pi;var u=r.current.memoizedState.isDehydrated;if(u&&(Wa(r,o).flags|=256),o=Ds(r,o,!1),o!==2){if(gc&&!u){r.errorRecoveryDisabledLanes|=l,In|=l,i=4;break e}l=Re,Re=i,l!==null&&(Re===null?Re=l:Re.push.apply(Re,l))}i=o}if(l=!1,i!==2)continue}}if(i===1){Wa(e,0),vn(e,t,0,!0);break}e:{switch(a=e,l=i,l){case 0:case 1:throw Error(_(345));case 4:if((t&4194048)!==t)break;case 6:vn(a,t,He,!mn);break e;case 2:Re=null;break;case 3:case 5:break;default:throw Error(_(329))}if((t&62914560)===t&&(i=mr+300-je(),10<i)){if(vn(a,t,He,!mn),ar(a,0,!0)!==0)break e;Yt=t,a.timeoutHandle=Nm(Td.bind(null,a,n,Re,Qo,vu,t,He,In,Ja,mn,l,"Throttled",-0,0),i);break e}Td(a,n,Re,Qo,vu,t,He,In,Ja,mn,l,null,-0,0)}}break}while(1);Jt(e)}function Td(e,t,n,a,i,l,o,r,u,c,m,y,h,g){if(e.timeoutHandle=-1,y=t.subtreeFlags,y&8192||(y&16785408)===16785408){y={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ht},Wp(t,l,y);var x=(l&62914560)===l?mr-je():(l&4194048)===l?tm-je():0;if(x=J0(y,x),x!==null){Yt=l,e.cancelPendingCommit=x(zd.bind(null,e,t,l,n,a,i,o,r,u,m,y,null,h,g)),vn(e,l,o,!c);return}}zd(e,t,l,n,a,i,o,r,u)}function h0(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 a=0;a<n.length;a++){var i=n[a],l=i.getSnapshot;i=i.value;try{if(!Ye(l(),i))return!1}catch(o){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 vn(e,t,n,a){t&=~yc,t&=~In,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var i=t;0<i;){var l=31-Ge(i),o=1<<l;a[l]=-1,i&=~o}n!==0&&ch(e,n,t)}function vr(){return(K&6)===0?(wl(0,!1),!1):!0}function bc(){if(j!==null){if(Q===0)var e=j.return;else e=j,jt=ua=null,ic(e),ja=null,rl=0,e=j;for(;e!==null;)Lp(e.alternate,e),e=e.return;j=null}}function Wa(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,R0(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Yt=0,bc(),W=e,j=n=qt(e.current,null),q=t,Q=0,Ve=null,mn=!1,ai=gl(e,t),gc=!1,Ja=He=yc=In=Tn=oe=0,Re=Pi=null,vu=!1,(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var i=31-Ge(a),l=1<<i;t|=e[i],a&=~l}return $t=t,sr(),n}function lm(e,t){C=null,z.H=ul,t===ni||t===cr?(t=od(),Q=3):t===Wu?(t=od(),Q=4):Q=t===hc?8:t!==null&&typeof t==="object"&&typeof t.then==="function"?6:1,Ve=t,j===null&&(oe=1,Go(e,et(t,e.current)))}function om(){var e=Ke.current;return e===null?!0:(q&4194048)===q?nt===null?!0:!1:(q&62914560)===q||(q&536870912)!==0?e===nt:!1}function rm(){var e=z.H;return z.H=ul,e===null?ul:e}function sm(){var e=z.A;return z.A=f0,e}function Zo(){oe=4,mn||(q&4194048)!==q&&Ke.current!==null||(ai=!0),(Tn&134217727)===0&&(In&134217727)===0||W===null||vn(W,q,He,!1)}function Ds(e,t,n){var a=K;K|=2;var i=rm(),l=sm();if(W!==e||q!==t)Qo=null,Wa(e,t);t=!1;var o=oe;e:do try{if(Q!==0&&j!==null){var r=j,u=Ve;switch(Q){case 8:bc(),o=6;break e;case 3:case 2:case 9:case 6:Ke.current===null&&(t=!0);var c=Q;if(Q=0,Ve=null,Ua(e,r,u,c),n&&ai){o=0;break e}break;default:c=Q,Q=0,Ve=null,Ua(e,r,u,c)}}p0(),o=oe;break}catch(m){lm(e,m)}while(1);return t&&e.shellSuspendCounter++,jt=ua=null,K=a,z.H=i,z.A=l,j===null&&(W=null,q=0,sr()),o}function p0(){for(;j!==null;)um(j)}function m0(e,t){var n=K;K|=2;var a=rm(),i=sm();W!==e||q!==t?(Qo=null,Xo=je()+500,Wa(e,t)):ai=gl(e,t);e:do try{if(Q!==0&&j!==null){t=j;var l=Ve;t:switch(Q){case 1:Q=0,Ve=null,Ua(e,t,l,1);break;case 2:case 9:if(ld(l)){Q=0,Ve=null,Dd(t);break}t=function(){Q!==2&&Q!==9||W!==e||(Q=7),Jt(e)},l.then(t,t);break e;case 3:Q=7;break e;case 4:Q=5;break e;case 7:ld(l)?(Q=0,Ve=null,Dd(t)):(Q=0,Ve=null,Ua(e,t,l,7));break;case 5:var o=null;switch(j.tag){case 26:o=j.memoizedState;case 5:case 27:var r=j;if(o?zm(o):r.stateNode.complete){Q=0,Ve=null;var u=r.sibling;if(u!==null)j=u;else{var c=r.return;c!==null?(j=c,gr(c)):j=null}break t}}Q=0,Ve=null,Ua(e,t,l,5);break;case 6:Q=0,Ve=null,Ua(e,t,l,6);break;case 8:bc(),oe=6;break e;default:throw Error(_(462))}}v0();break}catch(m){lm(e,m)}while(1);if(jt=ua=null,z.H=a,z.A=i,K=n,j!==null)return 0;return W=null,q=0,sr(),oe}function v0(){for(;j!==null&&!Vy();)um(j)}function um(e){var t=Vp(e.alternate,e,$t);e.memoizedProps=e.pendingProps,t===null?gr(e):j=t}function Dd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=xd(n,t,t.pendingProps,t.type,void 0,q);break;case 11:t=xd(n,t,t.pendingProps,t.type.render,t.ref,q);break;case 5:ic(t);default:Lp(n,t),t=j=jh(t,$t),t=Vp(n,t,$t)}e.memoizedProps=e.pendingProps,t===null?gr(e):j=t}function Ua(e,t,n,a){jt=ua=null,ic(t),ja=null,rl=0;var i=t.return;try{if(i0(e,i,t,n,q)){oe=1,Go(e,et(n,e.current)),j=null;return}}catch(l){if(i!==null)throw j=i,l;oe=1,Go(e,et(n,e.current)),j=null;return}if(t.flags&32768){if(G||a===1)e=!0;else if(ai||(q&536870912)!==0)e=!1;else if(mn=e=!0,a===2||a===9||a===3||a===6)a=Ke.current,a!==null&&a.tag===13&&(a.flags|=16384);cm(t,e)}else gr(t)}function gr(e){var t=e;do{if((t.flags&32768)!==0){cm(t,mn);return}e=t.return;var n=r0(t.alternate,t,$t);if(n!==null){j=n;return}if(t=t.sibling,t!==null){j=t;return}j=t=e}while(t!==null);oe===0&&(oe=5)}function cm(e,t){do{var n=s0(e.alternate,e);if(n!==null){n.flags&=32767,j=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){j=e;return}j=e=n}while(e!==null);oe=6,j=null}function zd(e,t,n,a,i,l,o,r,u){e.cancelPendingCommit=null;do yr();while(pe!==0);if((K&6)!==0)throw Error(_(327));if(t!==null){if(t===e.current)throw Error(_(177));if(l=t.lanes|t.childLanes,l|=Ku,Qy(e,n,l,o,r,u),e===W&&(j=W=null,q=0),Fa=t,_n=e,Yt=n,gu=l,yu=i,nm=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,S0(Ro,function(){return mm(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=z.T,z.T=null,i=X.p,X.p=2,o=K,K|=4;try{u0(e,t,n)}finally{K=o,X.p=i,z.T=a}}pe=1,fm(),dm(),hm()}}function fm(){if(pe===1){pe=0;var e=_n,t=Fa,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=z.T,z.T=null;var a=X.p;X.p=2;var i=K;K|=4;try{$p(t,e);var l=Nu,o=Mh(e.containerInfo),{focusedElem:r,selectionRange:u}=l;if(o!==r&&r&&r.ownerDocument&&Rh(r.ownerDocument.documentElement,r)){if(u!==null&&Yu(r)){var{start:c,end:m}=u;if(m===void 0&&(m=c),"selectionStart"in r)r.selectionStart=c,r.selectionEnd=Math.min(m,r.value.length);else{var y=r.ownerDocument||document,h=y&&y.defaultView||window;if(h.getSelection){var g=h.getSelection(),x=r.textContent.length,A=Math.min(u.start,x),M=u.end===void 0?A:Math.min(u.end,x);!g.extend&&A>M&&(o=M,M=A,A=o);var d=Pf(r,A),f=Pf(r,M);if(d&&f&&(g.rangeCount!==1||g.anchorNode!==d.node||g.anchorOffset!==d.offset||g.focusNode!==f.node||g.focusOffset!==f.offset)){var v=y.createRange();v.setStart(d.node,d.offset),g.removeAllRanges(),A>M?(g.addRange(v),g.extend(f.node,f.offset)):(v.setEnd(f.node,f.offset),g.addRange(v))}}}}y=[];for(g=r;g=g.parentNode;)g.nodeType===1&&y.push({element:g,left:g.scrollLeft,top:g.scrollTop});typeof r.focus==="function"&&r.focus();for(r=0;r<y.length;r++){var b=y[r];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}tr=!!wu,Nu=wu=null}finally{K=i,X.p=a,z.T=n}}e.current=t,pe=2}}function dm(){if(pe===2){pe=0;var e=_n,t=Fa,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=z.T,z.T=null;var a=X.p;X.p=2;var i=K;K|=4;try{Yp(e,t.alternate,t)}finally{K=i,X.p=a,z.T=n}}pe=3}}function hm(){if(pe===4||pe===3){pe=0,Ly();var e=_n,t=Fa,n=Yt,a=nm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?pe=5:(pe=0,Fa=_n=null,pm(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Sn=null),Vu(n),t=t.stateNode,qe&&typeof qe.onCommitFiberRoot==="function")try{qe.onCommitFiberRoot(vl,t,void 0,(t.current.flags&128)===128)}catch(u){}if(a!==null){t=z.T,i=X.p,X.p=2,z.T=null;try{for(var l=e.onRecoverableError,o=0;o<a.length;o++){var r=a[o];l(r.value,{componentStack:r.stack})}}finally{z.T=t,X.p=i}}(Yt&3)!==0&&yr(),Jt(e),i=e.pendingLanes,(n&261930)!==0&&(i&42)!==0?e===bu?Ii++:(Ii=0,bu=e):Ii=0,wl(0,!1)}}function pm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_l(t)))}function yr(){return fm(),dm(),hm(),mm()}function mm(){if(pe!==5)return!1;var e=_n,t=gu;gu=0;var n=Vu(Yt),a=z.T,i=X.p;try{X.p=32>n?32:n,z.T=null,n=yu,yu=null;var l=_n,o=Yt;if(pe=0,Fa=_n=null,Yt=0,(K&6)!==0)throw Error(_(331));var r=K;if(K|=4,Ip(l.current),Fp(l,l.current,o,n),K=r,wl(0,!1),qe&&typeof qe.onPostCommitFiberRoot==="function")try{qe.onPostCommitFiberRoot(vl,l)}catch(u){}return!0}finally{X.p=i,z.T=a,pm(e,t)}}function Rd(e,t,n){t=et(n,t),t=du(e.stateNode,t,2),e=Pn(e,t,2),e!==null&&(ir(e,2),Jt(e))}function Z(e,t,n){if(e.tag===3)Rd(e,e,n);else for(;t!==null;){if(t.tag===3){Rd(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError==="function"||typeof a.componentDidCatch==="function"&&(Sn===null||!Sn.has(a))){e=et(n,e),n=zp(2),a=Pn(t,n,2),a!==null&&(Rp(n,a,t,e),ir(a,2),Jt(a));break}}t=t.return}}function zs(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new d0;var i=new Set;a.set(t,i)}else i=a.get(t),i===void 0&&(i=new Set,a.set(t,i));i.has(n)||(gc=!0,i.add(n),e=g0.bind(null,e,t,n),t.then(e,e))}function g0(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,W===e&&(q&n)===n&&(oe===4||oe===3&&(q&62914560)===q&&300>je()-mr?(K&2)===0&&Wa(e,0):yc|=n,Ja===q&&(Ja=0)),Jt(e)}function vm(e,t){t===0&&(t=uh()),e=sa(e,t),e!==null&&(ir(e,t),Jt(e))}function y0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vm(e,n)}function b0(e,t){var n=0;switch(e.tag){case 31:case 13:var{stateNode:a,memoizedState:i}=e;i!==null&&(n=i.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(_(314))}a!==null&&a.delete(t),vm(e,n)}function S0(e,t){return Uu(e,t)}var $o=null,xa=null,Su=!1,Jo=!1,Rs=!1,gn=0;function Jt(e){e!==xa&&e.next===null&&(xa===null?$o=xa=e:xa=xa.next=e),Jo=!0,Su||(Su=!0,x0())}function wl(e,t){if(!Rs&&Jo){Rs=!0;do{var n=!1;for(var a=$o;a!==null;){if(!t)if(e!==0){var i=a.pendingLanes;if(i===0)var l=0;else{var o=a.suspendedLanes,r=a.pingedLanes;l=(1<<31-Ge(42|e)+1)-1,l&=i&~(o&~r),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(n=!0,Md(a,l))}else l=q,l=ar(a,a===W?l:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(l&3)===0||gl(a,l)||(n=!0,Md(a,l));a=a.next}}while(n);Rs=!1}}function _0(){gm()}function gm(){Jo=Su=!1;var e=0;gn!==0&&z0()&&(e=gn);for(var t=je(),n=null,a=$o;a!==null;){var i=a.next,l=ym(a,t);if(l===0)a.next=null,n===null?$o=i:n.next=i,i===null&&(xa=n);else if(n=a,e!==0||(l&3)!==0)Jo=!0;a=i}pe!==0&&pe!==5||wl(e,!1),gn!==0&&(gn=0)}function ym(e,t){for(var{suspendedLanes:n,pingedLanes:a,expirationTimes:i}=e,l=e.pendingLanes&-62914561;0<l;){var o=31-Ge(l),r=1<<o,u=i[o];if(u===-1){if((r&n)===0||(r&a)!==0)i[o]=Xy(r,t)}else u<=t&&(e.expiredLanes|=r);l&=~r}if(t=W,n=q,n=ar(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(Q===2||Q===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&rs(a),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||gl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&rs(a),Vu(n)){case 2:case 8:n=rh;break;case 32:n=Ro;break;case 268435456:n=sh;break;default:n=Ro}return a=bm.bind(null,e),n=Uu(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&rs(a),e.callbackPriority=2,e.callbackNode=null,2}function bm(e,t){if(pe!==0&&pe!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(yr()&&e.callbackNode!==n)return null;var a=q;if(a=ar(e,e===W?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0)return null;return im(e,a,t),ym(e,je()),e.callbackNode!=null&&e.callbackNode===n?bm.bind(null,e):null}function Md(e,t){if(yr())return null;im(e,t,!0)}function x0(){M0(function(){(K&6)!==0?Uu(oh,_0):gm()})}function Sc(){if(gn===0){var e=Qa;e===0&&(e=Pl,Pl<<=1,(Pl&261888)===0&&(Pl=256)),gn=e}return gn}function Cd(e){return e==null||typeof e==="symbol"||typeof e==="boolean"?null:typeof e==="function"?e:ho(""+e)}function kd(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function E0(e,t,n,a,i){if(t==="submit"&&n&&n.stateNode===i){var l=Cd((i[Ce]||null).action),o=a.submitter;o&&(t=(t=o[Ce]||null)?Cd(t.formAction):o.getAttribute("formAction"),t!==null&&(l=t,o=null));var r=new lr("action","action",null,a,i);e.push({event:r,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(gn!==0){var u=o?kd(i,o):new FormData(i);cu(n,{pending:!0,data:u,method:i.method,action:l},null,u)}}else typeof l==="function"&&(r.preventDefault(),u=o?kd(i,o):new FormData(i),cu(n,{pending:!0,data:u,method:i.method,action:l},l,u))},currentTarget:i}]})}}for(ji=0;ji<Ps.length;ji++)qi=Ps[ji],_u=qi.toLowerCase(),xu=qi[0].toUpperCase()+qi.slice(1),mt(_u,"on"+xu);var qi,_u,xu,ji;mt(kh,"onAnimationEnd");mt(Uh,"onAnimationIteration");mt(Vh,"onAnimationStart");mt("dblclick","onDoubleClick");mt("focusin","onFocus");mt("focusout","onBlur");mt(Bb,"onTransitionRun");mt(Hb,"onTransitionStart");mt(jb,"onTransitionCancel");mt(Lh,"onTransitionEnd");Ka("onMouseEnter",["mouseout","mouseover"]);Ka("onMouseLeave",["mouseout","mouseover"]);Ka("onPointerEnter",["pointerout","pointerover"]);Ka("onPointerLeave",["pointerout","pointerover"]);la("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));la("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));la("onBeforeInput",["compositionend","keypress","textInput","paste"]);la("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));la("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));la("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cl="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(" "),w0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(cl));function Sm(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],i=a.event;a=a.listeners;e:{var l=void 0;if(t)for(var o=a.length-1;0<=o;o--){var r=a[o],u=r.instance,c=r.currentTarget;if(r=r.listener,u!==l&&i.isPropagationStopped())break e;l=r,i.currentTarget=c;try{l(i)}catch(m){Co(m)}i.currentTarget=null,l=u}else for(o=0;o<a.length;o++){if(r=a[o],u=r.instance,c=r.currentTarget,r=r.listener,u!==l&&i.isPropagationStopped())break e;l=r,i.currentTarget=c;try{l(i)}catch(m){Co(m)}i.currentTarget=null,l=u}}}}function H(e,t){var n=t[Ks];n===void 0&&(n=t[Ks]=new Set);var a=e+"__bubble";n.has(a)||(xm(t,e,2,!1),n.add(a))}function Ms(e,t,n){var a=0;t&&(a|=4),xm(n,e,a,t)}var so="_reactListening"+Math.random().toString(36).slice(2);function _m(e){if(!e[so]){e[so]=!0,mh.forEach(function(n){n!=="selectionchange"&&(w0.has(n)||Ms(n,!1,e),Ms(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[so]||(t[so]=!0,Ms("selectionchange",!1,t))}}function xm(e,t,n,a){switch(Cm(t)){case 2:var i=e1;break;case 8:i=t1;break;default:i=wc}n=i.bind(null,t,n,e),i=void 0,!Js||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),a?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Cs(e,t,n,a,i){var l=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var o=a.tag;if(o===3||o===4){var r=a.stateNode.containerInfo;if(r===i)break;if(o===4)for(o=a.return;o!==null;){var u=o.tag;if((u===3||u===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;r!==null;){if(o=Oa(r),o===null)return;if(u=o.tag,u===5||u===6||u===26||u===27){a=l=o;continue e}r=r.parentNode}}a=a.return}Eh(function(){var c=l,m=Hu(n),y=[];e:{var h=Bh.get(e);if(h!==void 0){var g=lr,x=e;switch(e){case"keypress":if(mo(n)===0)break e;case"keydown":case"keyup":g=vb;break;case"focusin":x="focus",g=ds;break;case"focusout":x="blur",g=ds;break;case"beforeblur":case"afterblur":g=ds;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=Yf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=ib;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=bb;break;case kh:case Uh:case Vh:g=rb;break;case Lh:g=_b;break;case"scroll":case"scrollend":g=nb;break;case"wheel":g=Eb;break;case"copy":case"cut":case"paste":g=ub;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=Xf;break;case"toggle":case"beforetoggle":g=Nb}var A=(t&4)!==0,M=!A&&(e==="scroll"||e==="scrollend"),d=A?h!==null?h+"Capture":null:h;A=[];for(var f=c,v;f!==null;){var b=f;if(v=b.stateNode,b=b.tag,b!==5&&b!==26&&b!==27||v===null||d===null||(b=nl(f,d),b!=null&&A.push(fl(f,b,v))),M)break;f=f.return}0<A.length&&(h=new g(h,x,null,n,m),y.push({event:h,listeners:A}))}}if((t&7)===0){e:{if(h=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",h&&n!==$s&&(x=n.relatedTarget||n.fromElement)&&(Oa(x)||x[yl]))break e;if(g||h){if(h=m.window===m?m:(h=m.ownerDocument)?h.defaultView||h.parentWindow:window,g){if(x=n.relatedTarget||n.toElement,g=c,x=x?Oa(x):null,x!==null&&(M=ml(x),A=x.tag,x!==M||A!==5&&A!==27&&A!==6))x=null}else g=null,x=c;if(g!==x){if(A=Yf,b="onMouseLeave",d="onMouseEnter",f="mouse",e==="pointerout"||e==="pointerover")A=Xf,b="onPointerLeave",d="onPointerEnter",f="pointer";if(M=g==null?h:Ui(g),v=x==null?h:Ui(x),h=new A(b,f+"leave",g,n,m),h.target=M,h.relatedTarget=v,b=null,Oa(m)===c&&(A=new A(d,f+"enter",x,n,m),A.target=v,A.relatedTarget=M,b=A),M=b,g&&x)t:{A=N0,d=g,f=x,v=0;for(b=d;b;b=A(b))v++;b=0;for(var w=f;w;w=A(w))b++;for(;0<v-b;)d=A(d),v--;for(;0<b-v;)f=A(f),b--;for(;v--;){if(d===f||f!==null&&d===f.alternate){A=d;break t}d=A(d),f=A(f)}A=null}else A=null;g!==null&&Ud(y,h,g,A,!1),x!==null&&M!==null&&Ud(y,M,x,A,!0)}}}e:{if(h=c?Ui(c):window,g=h.nodeName&&h.nodeName.toLowerCase(),g==="select"||g==="input"&&h.type==="file")var k=Jf;else if($f(h))if(Dh)k=Ub;else{k=Cb;var O=Mb}else g=h.nodeName,!g||g.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?c&&Bu(c.elementType)&&(k=Jf):k=kb;if(k&&(k=k(e,c))){Th(y,k,n,m);break e}O&&O(e,h,c),e==="focusout"&&c&&h.type==="number"&&c.memoizedProps.value!=null&&Zs(h,"number",h.value)}switch(O=c?Ui(c):window,e){case"focusin":if($f(O)||O.contentEditable==="true")Da=O,Fs=c,Ki=null;break;case"focusout":Ki=Fs=Da=null;break;case"mousedown":Ws=!0;break;case"contextmenu":case"mouseup":case"dragend":Ws=!1,If(y,n,m);break;case"selectionchange":if(Lb)break;case"keydown":case"keyup":If(y,n,m)}var R;if(Gu)e:{switch(e){case"compositionstart":var U="onCompositionStart";break e;case"compositionend":U="onCompositionEnd";break e;case"compositionupdate":U="onCompositionUpdate";break e}U=void 0}else Ta?Oh(e,n)&&(U="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(U="onCompositionStart");if(U&&(Nh&&n.locale!=="ko"&&(Ta||U!=="onCompositionStart"?U==="onCompositionEnd"&&Ta&&(R=wh()):(pn=m,ju=("value"in pn)?pn.value:pn.textContent,Ta=!0)),O=Fo(c,U),0<O.length&&(U=new Kf(U,e,null,n,m),y.push({event:U,listeners:O}),R?U.data=R:(R=Ah(n),R!==null&&(U.data=R)))),R=Ab?Tb(e,n):Db(e,n))U=Fo(c,"onBeforeInput"),0<U.length&&(O=new Kf("onBeforeInput","beforeinput",null,n,m),y.push({event:O,listeners:U}),O.data=R);E0(y,e,c,n,m)}Sm(y,t)})}function fl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Fo(e,t){for(var n=t+"Capture",a=[];e!==null;){var i=e,l=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||l===null||(i=nl(e,n),i!=null&&a.unshift(fl(e,i,l)),i=nl(e,t),i!=null&&a.push(fl(e,i,l))),e.tag===3)return a;e=e.return}return[]}function N0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e?e:null}function Ud(e,t,n,a,i){for(var l=t._reactName,o=[];n!==null&&n!==a;){var r=n,u=r.alternate,c=r.stateNode;if(r=r.tag,u!==null&&u===a)break;r!==5&&r!==26&&r!==27||c===null||(u=c,i?(c=nl(n,l),c!=null&&o.unshift(fl(n,c,u))):i||(c=nl(n,l),c!=null&&o.push(fl(n,c,u)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var O0=/\r\n?/g,A0=/\u0000|\uFFFD/g;function Vd(e){return(typeof e==="string"?e:""+e).replace(O0,`
9
- `).replace(A0,"")}function Em(e,t){return t=Vd(t),Vd(e)===t?!0:!1}function J(e,t,n,a,i,l){switch(n){case"children":typeof a==="string"?t==="body"||t==="textarea"&&a===""||Xa(e,a):(typeof a==="number"||typeof a==="bigint")&&t!=="body"&&Xa(e,""+a);break;case"className":to(e,"class",a);break;case"tabIndex":to(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":to(e,n,a);break;case"style":xh(e,a,l);break;case"data":if(t!=="object"){to(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a==="function"||typeof a==="symbol"||typeof a==="boolean"){e.removeAttribute(n);break}a=ho(""+a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a==="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof l==="function"&&(n==="formAction"?(t!=="input"&&J(e,t,"name",i.name,i,null),J(e,t,"formEncType",i.formEncType,i,null),J(e,t,"formMethod",i.formMethod,i,null),J(e,t,"formTarget",i.formTarget,i,null)):(J(e,t,"encType",i.encType,i,null),J(e,t,"method",i.method,i,null),J(e,t,"target",i.target,i,null)));if(a==null||typeof a==="symbol"||typeof a==="boolean"){e.removeAttribute(n);break}a=ho(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Ht);break;case"onScroll":a!=null&&H("scroll",e);break;case"onScrollEnd":a!=null&&H("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!=="object"||!("__html"in a))throw Error(_(61));if(n=a.__html,n!=null){if(i.children!=null)throw Error(_(60));e.innerHTML=n}}break;case"multiple":e.multiple=a&&typeof a!=="function"&&typeof a!=="symbol";break;case"muted":e.muted=a&&typeof a!=="function"&&typeof a!=="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a==="function"||typeof a==="boolean"||typeof a==="symbol"){e.removeAttribute("xlink:href");break}n=ho(""+a),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":a!=null&&typeof a!=="function"&&typeof a!=="symbol"?e.setAttribute(n,""+a):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!=="function"&&typeof a!=="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!=="function"&&typeof a!=="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!=="function"&&typeof a!=="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a==="function"||typeof a==="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":H("beforetoggle",e),H("toggle",e),fo(e,"popover",a);break;case"xlinkActuate":Rt(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Rt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Rt(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Rt(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Rt(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Rt(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Rt(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Rt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Rt(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":fo(e,"is",a);break;case"innerText":case"textContent":break;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=eb.get(n)||n,fo(e,n,a)}}function Eu(e,t,n,a,i,l){switch(n){case"style":xh(e,a,l);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!=="object"||!("__html"in a))throw Error(_(61));if(n=a.__html,n!=null){if(i.children!=null)throw Error(_(60));e.innerHTML=n}}break;case"children":typeof a==="string"?Xa(e,a):(typeof a==="number"||typeof a==="bigint")&&Xa(e,""+a);break;case"onScroll":a!=null&&H("scroll",e);break;case"onScrollEnd":a!=null&&H("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Ht);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!vh.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(i=n.endsWith("Capture"),t=n.slice(2,i?n.length-7:void 0),l=e[Ce]||null,l=l!=null?l[n]:null,typeof l==="function"&&e.removeEventListener(t,l,i),typeof a==="function")){typeof l!=="function"&&l!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,i);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):fo(e,n,a)}}}function we(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":H("error",e),H("load",e);var a=!1,i=!1,l;for(l in n)if(n.hasOwnProperty(l)){var o=n[l];if(o!=null)switch(l){case"src":a=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(_(137,t));default:J(e,t,l,o,n,null)}}i&&J(e,t,"srcSet",n.srcSet,n,null),a&&J(e,t,"src",n.src,n,null);return;case"input":H("invalid",e);var r=l=o=i=null,u=null,c=null;for(a in n)if(n.hasOwnProperty(a)){var m=n[a];if(m!=null)switch(a){case"name":i=m;break;case"type":o=m;break;case"checked":u=m;break;case"defaultChecked":c=m;break;case"value":l=m;break;case"defaultValue":r=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(_(137,t));break;default:J(e,t,a,m,n,null)}}bh(e,l,r,u,c,o,i,!1);return;case"select":H("invalid",e),a=o=l=null;for(i in n)if(n.hasOwnProperty(i)&&(r=n[i],r!=null))switch(i){case"value":l=r;break;case"defaultValue":o=r;break;case"multiple":a=r;default:J(e,t,i,r,n,null)}t=l,n=o,e.multiple=!!a,t!=null?La(e,!!a,t,!1):n!=null&&La(e,!!a,n,!0);return;case"textarea":H("invalid",e),l=i=a=null;for(o in n)if(n.hasOwnProperty(o)&&(r=n[o],r!=null))switch(o){case"value":a=r;break;case"defaultValue":i=r;break;case"children":l=r;break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(_(91));break;default:J(e,t,o,r,n,null)}_h(e,a,i,l);return;case"option":for(u in n)if(n.hasOwnProperty(u)&&(a=n[u],a!=null))switch(u){case"selected":e.selected=a&&typeof a!=="function"&&typeof a!=="symbol";break;default:J(e,t,u,a,n,null)}return;case"dialog":H("beforetoggle",e),H("toggle",e),H("cancel",e),H("close",e);break;case"iframe":case"object":H("load",e);break;case"video":case"audio":for(a=0;a<cl.length;a++)H(cl[a],e);break;case"image":H("error",e),H("load",e);break;case"details":H("toggle",e);break;case"embed":case"source":case"link":H("error",e),H("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(c in n)if(n.hasOwnProperty(c)&&(a=n[c],a!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(_(137,t));default:J(e,t,c,a,n,null)}return;default:if(Bu(t)){for(m in n)n.hasOwnProperty(m)&&(a=n[m],a!==void 0&&Eu(e,t,m,a,n,void 0));return}}for(r in n)n.hasOwnProperty(r)&&(a=n[r],a!=null&&J(e,t,r,a,n,null))}function T0(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,l=null,o=null,r=null,u=null,c=null,m=null;for(g in n){var y=n[g];if(n.hasOwnProperty(g)&&y!=null)switch(g){case"checked":break;case"value":break;case"defaultValue":u=y;default:a.hasOwnProperty(g)||J(e,t,g,null,a,y)}}for(var h in a){var g=a[h];if(y=n[h],a.hasOwnProperty(h)&&(g!=null||y!=null))switch(h){case"type":l=g;break;case"name":i=g;break;case"checked":c=g;break;case"defaultChecked":m=g;break;case"value":o=g;break;case"defaultValue":r=g;break;case"children":case"dangerouslySetInnerHTML":if(g!=null)throw Error(_(137,t));break;default:g!==y&&J(e,t,h,g,a,y)}}Qs(e,o,r,u,c,m,l,i);return;case"select":g=o=r=h=null;for(l in n)if(u=n[l],n.hasOwnProperty(l)&&u!=null)switch(l){case"value":break;case"multiple":g=u;default:a.hasOwnProperty(l)||J(e,t,l,null,a,u)}for(i in a)if(l=a[i],u=n[i],a.hasOwnProperty(i)&&(l!=null||u!=null))switch(i){case"value":h=l;break;case"defaultValue":r=l;break;case"multiple":o=l;default:l!==u&&J(e,t,i,l,a,u)}t=r,n=o,a=g,h!=null?La(e,!!n,h,!1):!!a!==!!n&&(t!=null?La(e,!!n,t,!0):La(e,!!n,n?[]:"",!1));return;case"textarea":g=h=null;for(r in n)if(i=n[r],n.hasOwnProperty(r)&&i!=null&&!a.hasOwnProperty(r))switch(r){case"value":break;case"children":break;default:J(e,t,r,null,a,i)}for(o in a)if(i=a[o],l=n[o],a.hasOwnProperty(o)&&(i!=null||l!=null))switch(o){case"value":h=i;break;case"defaultValue":g=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(_(91));break;default:i!==l&&J(e,t,o,i,a,l)}Sh(e,h,g);return;case"option":for(var x in n)if(h=n[x],n.hasOwnProperty(x)&&h!=null&&!a.hasOwnProperty(x))switch(x){case"selected":e.selected=!1;break;default:J(e,t,x,null,a,h)}for(u in a)if(h=a[u],g=n[u],a.hasOwnProperty(u)&&h!==g&&(h!=null||g!=null))switch(u){case"selected":e.selected=h&&typeof h!=="function"&&typeof h!=="symbol";break;default:J(e,t,u,h,a,g)}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 A in n)h=n[A],n.hasOwnProperty(A)&&h!=null&&!a.hasOwnProperty(A)&&J(e,t,A,null,a,h);for(c in a)if(h=a[c],g=n[c],a.hasOwnProperty(c)&&h!==g&&(h!=null||g!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(_(137,t));break;default:J(e,t,c,h,a,g)}return;default:if(Bu(t)){for(var M in n)h=n[M],n.hasOwnProperty(M)&&h!==void 0&&!a.hasOwnProperty(M)&&Eu(e,t,M,void 0,a,h);for(m in a)h=a[m],g=n[m],!a.hasOwnProperty(m)||h===g||h===void 0&&g===void 0||Eu(e,t,m,h,a,g);return}}for(var d in n)h=n[d],n.hasOwnProperty(d)&&h!=null&&!a.hasOwnProperty(d)&&J(e,t,d,null,a,h);for(y in a)h=a[y],g=n[y],!a.hasOwnProperty(y)||h===g||h==null&&g==null||J(e,t,y,h,a,g)}function Ld(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function D0(){if(typeof performance.getEntriesByType==="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),a=0;a<n.length;a++){var i=n[a],{transferSize:l,initiatorType:o,duration:r}=i;if(l&&r&&Ld(o)){o=0,r=i.responseEnd;for(a+=1;a<n.length;a++){var u=n[a],c=u.startTime;if(c>r)break;var m=u.transferSize,y=u.initiatorType;m&&Ld(y)&&(u=u.responseEnd,o+=m*(u<r?1:(r-c)/(u-c)))}if(--a,t+=8*(l+o)/(i.duration/1000),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==="number")?e:5}var wu=null,Nu=null;function Wo(e){return e.nodeType===9?e:e.ownerDocument}function Bd(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 wm(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 Ou(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 ks=null;function z0(){var e=window.event;if(e&&e.type==="popstate"){if(e===ks)return!1;return ks=e,!0}return ks=null,!1}var Nm=typeof setTimeout==="function"?setTimeout:void 0,R0=typeof clearTimeout==="function"?clearTimeout:void 0,Hd=typeof Promise==="function"?Promise:void 0,M0=typeof queueMicrotask==="function"?queueMicrotask:typeof Hd<"u"?function(e){return Hd.resolve(null).then(e).catch(C0)}:Nm;function C0(e){setTimeout(function(){throw e})}function zn(e){return e==="head"}function jd(e,t){var n=t,a=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"||n==="/&"){if(a===0){e.removeChild(i),Ia(t);return}a--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")a++;else if(n==="html")el(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,el(n);for(var l=n.firstChild;l;){var o=l.nextSibling,r=l.nodeName;l[bl]||r==="SCRIPT"||r==="STYLE"||r==="LINK"&&l.rel.toLowerCase()==="stylesheet"||n.removeChild(l),l=o}}else n==="body"&&el(e.ownerDocument.body);n=i}while(n);Ia(t)}function qd(e,t){var n=e;e=0;do{var a=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||""),a&&a.nodeType===8)if(n=a.data,n==="/$")if(e===0)break;else e--;else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=a}while(n)}function Au(e){var t=e.firstChild;t&&t.nodeType===10&&(t=t.nextSibling);for(;t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Au(n),Lu(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function k0(e,t,n,a){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(!a)if(t==="input"&&e.type==="hidden"){var l=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===l)return e}else return e;else if(!e[bl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(l=e.getAttribute("rel"),l==="stylesheet"&&e.hasAttribute("data-precedence"))break;else if(l!==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(l=e.getAttribute("src"),(l!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&l&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}if(e=it(e.nextSibling),e===null)break}return null}function U0(e,t,n){if(t==="")return null;for(;e.nodeType!==3;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n)return null;if(e=it(e.nextSibling),e===null)return null}return e}function Om(e,t){for(;e.nodeType!==8;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t)return null;if(e=it(e.nextSibling),e===null)return null}return e}function Tu(e){return e.data==="$?"||e.data==="$~"}function Du(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function V0(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function it(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 zu=null;function Gd(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return it(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Yd(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 Am(e,t,n){switch(t=Wo(n),e){case"html":if(e=t.documentElement,!e)throw Error(_(452));return e;case"head":if(e=t.head,!e)throw Error(_(453));return e;case"body":if(e=t.body,!e)throw Error(_(454));return e;default:throw Error(_(451))}}function el(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Lu(e)}var lt=new Map,Kd=new Set;function Po(e){return typeof e.getRootNode==="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ft=X.d;X.d={f:L0,r:B0,D:H0,C:j0,L:q0,m:G0,X:K0,S:Y0,M:X0};function L0(){var e=Ft.f(),t=vr();return e||t}function B0(e){var t=ei(e);t!==null&&t.tag===5&&t.type==="form"?xp(t):Ft.r(e)}var ii=typeof document>"u"?null:document;function Tm(e,t,n){var a=ii;if(a&&typeof t==="string"&&t){var i=Ie(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n==="string"&&(i+='[crossorigin="'+n+'"]'),Kd.has(i)||(Kd.add(i),e={rel:e,crossOrigin:n,href:t},a.querySelector(i)===null&&(t=a.createElement("link"),we(t,"link",e),ge(t),a.head.appendChild(t)))}}function H0(e){Ft.D(e),Tm("dns-prefetch",e,null)}function j0(e,t){Ft.C(e,t),Tm("preconnect",e,t)}function q0(e,t,n){Ft.L(e,t,n);var a=ii;if(a&&e&&t){var i='link[rel="preload"][as="'+Ie(t)+'"]';t==="image"?n&&n.imageSrcSet?(i+='[imagesrcset="'+Ie(n.imageSrcSet)+'"]',typeof n.imageSizes==="string"&&(i+='[imagesizes="'+Ie(n.imageSizes)+'"]')):i+='[href="'+Ie(e)+'"]':i+='[href="'+Ie(e)+'"]';var l=i;switch(t){case"style":l=Pa(e);break;case"script":l=li(e)}lt.has(l)||(e=ae({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),lt.set(l,e),a.querySelector(i)!==null||t==="style"&&a.querySelector(Nl(l))||t==="script"&&a.querySelector(Ol(l))||(t=a.createElement("link"),we(t,"link",e),ge(t),a.head.appendChild(t)))}}function G0(e,t){Ft.m(e,t);var n=ii;if(n&&e){var a=t&&typeof t.as==="string"?t.as:"script",i='link[rel="modulepreload"][as="'+Ie(a)+'"][href="'+Ie(e)+'"]',l=i;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=li(e)}if(!lt.has(l)&&(e=ae({rel:"modulepreload",href:e},t),lt.set(l,e),n.querySelector(i)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ol(l)))return}a=n.createElement("link"),we(a,"link",e),ge(a),n.head.appendChild(a)}}}function Y0(e,t,n){Ft.S(e,t,n);var a=ii;if(a&&e){var i=Va(a).hoistableStyles,l=Pa(e);t=t||"default";var o=i.get(l);if(!o){var r={loading:0,preload:null};if(o=a.querySelector(Nl(l)))r.loading=5;else{e=ae({rel:"stylesheet",href:e,"data-precedence":t},n),(n=lt.get(l))&&_c(e,n);var u=o=a.createElement("link");ge(u),we(u,"link",e),u._p=new Promise(function(c,m){u.onload=c,u.onerror=m}),u.addEventListener("load",function(){r.loading|=1}),u.addEventListener("error",function(){r.loading|=2}),r.loading|=4,wo(o,t,a)}o={type:"stylesheet",instance:o,count:1,state:r},i.set(l,o)}}}function K0(e,t){Ft.X(e,t);var n=ii;if(n&&e){var a=Va(n).hoistableScripts,i=li(e),l=a.get(i);l||(l=n.querySelector(Ol(i)),l||(e=ae({src:e,async:!0},t),(t=lt.get(i))&&xc(e,t),l=n.createElement("script"),ge(l),we(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(i,l))}}function X0(e,t){Ft.M(e,t);var n=ii;if(n&&e){var a=Va(n).hoistableScripts,i=li(e),l=a.get(i);l||(l=n.querySelector(Ol(i)),l||(e=ae({src:e,async:!0,type:"module"},t),(t=lt.get(i))&&xc(e,t),l=n.createElement("script"),ge(l),we(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(i,l))}}function Xd(e,t,n,a){var i=(i=yn.current)?Po(i):null;if(!i)throw Error(_(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence==="string"&&typeof n.href==="string"?(t=Pa(n.href),n=Va(i).hoistableStyles,a=n.get(t),a||(a={type:"style",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href==="string"&&typeof n.precedence==="string"){e=Pa(n.href);var l=Va(i).hoistableStyles,o=l.get(e);if(o||(i=i.ownerDocument||i,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(e,o),(l=i.querySelector(Nl(e)))&&!l._p&&(o.instance=l,o.state.loading=5),lt.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},lt.set(e,n),l||Q0(i,e,n,o.state))),t&&a===null)throw Error(_(528,""));return o}if(t&&a!==null)throw Error(_(529,""));return null;case"script":return t=n.async,n=n.src,typeof n==="string"&&t&&typeof t!=="function"&&typeof t!=="symbol"?(t=li(n),n=Va(i).hoistableScripts,a=n.get(t),a||(a={type:"script",instance:null,count:0,state:null},n.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(_(444,e))}}function Pa(e){return'href="'+Ie(e)+'"'}function Nl(e){return'link[rel="stylesheet"]['+e+"]"}function Dm(e){return ae({},e,{"data-precedence":e.precedence,precedence:null})}function Q0(e,t,n,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),we(t,"link",n),ge(t),e.head.appendChild(t))}function li(e){return'[src="'+Ie(e)+'"]'}function Ol(e){return"script[async]"+e}function Qd(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ie(n.href)+'"]');if(a)return t.instance=a,ge(a),a;var i=ae({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),ge(a),we(a,"style",i),wo(a,n.precedence,e),t.instance=a;case"stylesheet":i=Pa(n.href);var l=e.querySelector(Nl(i));if(l)return t.state.loading|=4,t.instance=l,ge(l),l;a=Dm(n),(i=lt.get(i))&&_c(a,i),l=(e.ownerDocument||e).createElement("link"),ge(l);var o=l;return o._p=new Promise(function(r,u){o.onload=r,o.onerror=u}),we(l,"link",a),t.state.loading|=4,wo(l,n.precedence,e),t.instance=l;case"script":if(l=li(n.src),i=e.querySelector(Ol(l)))return t.instance=i,ge(i),i;if(a=n,i=lt.get(l))a=ae({},n),xc(a,i);return e=e.ownerDocument||e,i=e.createElement("script"),ge(i),we(i,"link",a),e.head.appendChild(i),t.instance=i;case"void":return null;default:throw Error(_(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,wo(a,n.precedence,e));return t.instance}function wo(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=a.length?a[a.length-1]:null,l=i,o=0;o<a.length;o++){var r=a[o];if(r.dataset.precedence===t)l=r;else if(l!==i)break}l?l.parentNode.insertBefore(e,l.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function _c(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function xc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var No=null;function Zd(e,t,n){if(No===null){var a=new Map,i=No=new Map;i.set(n,a)}else i=No,a=i.get(n),a||(a=new Map,i.set(n,a));if(a.has(e))return a;a.set(e,null),n=n.getElementsByTagName(e);for(i=0;i<n.length;i++){var l=n[i];if(!(l[bl]||l[_e]||e==="link"&&l.getAttribute("rel")==="stylesheet")&&l.namespaceURI!=="http://www.w3.org/2000/svg"){var o=l.getAttribute(t)||"";o=e+o;var r=a.get(o);r?r.push(l):a.set(o,[l])}}return a}function $d(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Z0(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 zm(e){return e.type==="stylesheet"&&(e.state.loading&3)===0?!1:!0}function $0(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!=="string"||matchMedia(a.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var i=Pa(a.href),l=t.querySelector(Nl(i));if(l){t=l._p,t!==null&&typeof t==="object"&&typeof t.then==="function"&&(e.count++,e=Io.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=l,ge(l);return}l=t.ownerDocument||t,a=Dm(a),(i=lt.get(i))&&_c(a,i),l=l.createElement("link"),ge(l);var o=l;o._p=new Promise(function(r,u){o.onload=r,o.onerror=u}),we(l,"link",a),n.instance=l}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Io.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Us=0;function J0(e,t){return e.stylesheets&&e.count===0&&Oo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var a=setTimeout(function(){if(e.stylesheets&&Oo(e,e.stylesheets),e.unsuspend){var l=e.unsuspend;e.unsuspend=null,l()}},60000+t);0<e.imgBytes&&Us===0&&(Us=62500*D0());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Oo(e,e.stylesheets),e.unsuspend)){var l=e.unsuspend;e.unsuspend=null,l()}},(e.imgBytes>Us?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(i)}}:null}function Io(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Oo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var er=null;function Oo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,er=new Map,t.forEach(F0,e),er=null,Io.call(e))}function F0(e,t){if(!(t.state.loading&4)){var n=er.get(e);if(n)var a=n.get(null);else{n=new Map,er.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<i.length;l++){var o=i[l];if(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")n.set(o.dataset.precedence,o),a=o}a&&n.set(null,a)}i=t.instance,o=i.getAttribute("data-precedence"),l=n.get(o)||a,l===a&&n.set(null,i),n.set(o,i),this.count++,a=Io.bind(this),i.addEventListener("load",a),i.addEventListener("error",a),l?l.parentNode.insertBefore(i,l.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var dl={$$typeof:Bt,Provider:null,Consumer:null,_currentValue:Zn,_currentValue2:Zn,_threadCount:0};function W0(e,t,n,a,i,l,o,r,u){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=ss(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ss(0),this.hiddenUpdates=ss(null),this.identifierPrefix=a,this.onUncaughtError=i,this.onCaughtError=l,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=u,this.incompleteTransitions=new Map}function P0(e,t,n,a,i,l,o,r,u,c,m,y){return e=new W0(e,t,n,o,u,c,m,y,r),t=1,l===!0&&(t|=24),l=Be(3,null,null,t),e.current=l,l.stateNode=e,t=Ju(),t.refCount++,e.pooledCache=t,t.refCount++,l.memoizedState={element:a,isDehydrated:n,cache:t},Pu(l),e}function I0(e){if(!e)return Ma;return e=Ma,e}function Rm(e,t,n,a,i,l){i=I0(i),a.context===null?a.context=i:a.pendingContext=i,a=Wn(t),a.payload={element:n},l=l===void 0?null:l,l!==null&&(a.callback=l),n=Pn(e,a,t),n!==null&&(Me(n,e,t),Qi(n,e,t))}function Jd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ec(e,t){Jd(e,t),(e=e.alternate)&&Jd(e,t)}function Mm(e){if(e.tag===13||e.tag===31){var t=sa(e,67108864);t!==null&&Me(t,e,67108864),Ec(e,67108864)}}function Fd(e){if(e.tag===13||e.tag===31){var t=at();t=hh(t);var n=sa(e,t);n!==null&&Me(n,e,t),Ec(e,t)}}var tr=!0;function e1(e,t,n,a){var i=z.T;z.T=null;var l=X.p;try{X.p=2,wc(e,t,n,a)}finally{X.p=l,z.T=i}}function t1(e,t,n,a){var i=z.T;z.T=null;var l=X.p;try{X.p=8,wc(e,t,n,a)}finally{X.p=l,z.T=i}}function wc(e,t,n,a){if(tr){var i=Ru(a);if(i===null)Cs(e,t,a,nr,n),Wd(e,a);else if(a1(i,e,t,n,a))a.stopPropagation();else if(Wd(e,a),t&4&&-1<n1.indexOf(e)){for(;i!==null;){var l=ei(i);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var o=Yn(l.pendingLanes);if(o!==0){var r=l;r.pendingLanes|=2;for(r.entangledLanes|=2;o;){var u=1<<31-Ge(o);r.entanglements[1]|=u,o&=~u}Jt(l),(K&6)===0&&(Xo=je()+500,wl(0,!1))}}break;case 31:case 13:r=sa(l,2),r!==null&&Me(r,l,2),vr(),Ec(l,2)}if(l=Ru(a),l===null&&Cs(e,t,a,nr,n),l===i)break;i=l}i!==null&&a.stopPropagation()}else Cs(e,t,a,null,n)}}function Ru(e){return e=Hu(e),Nc(e)}var nr=null;function Nc(e){if(nr=null,e=Oa(e),e!==null){var t=ml(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=th(t),e!==null)return e;e=null}else if(n===31){if(e=nh(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 nr=e,null}function Cm(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"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(By()){case oh:return 2;case rh:return 8;case Ro:case Hy:return 32;case sh:return 268435456;default:return 32}default:return 32}}var Mu=!1,xn=null,En=null,wn=null,hl=new Map,pl=new Map,dn=[],n1="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 Wd(e,t){switch(e){case"focusin":case"focusout":xn=null;break;case"dragenter":case"dragleave":En=null;break;case"mouseover":case"mouseout":wn=null;break;case"pointerover":case"pointerout":hl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":pl.delete(t.pointerId)}}function Mi(e,t,n,a,i,l){if(e===null||e.nativeEvent!==l)return e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:l,targetContainers:[i]},t!==null&&(t=ei(t),t!==null&&Mm(t)),e;return e.eventSystemFlags|=a,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e}function a1(e,t,n,a,i){switch(t){case"focusin":return xn=Mi(xn,e,t,n,a,i),!0;case"dragenter":return En=Mi(En,e,t,n,a,i),!0;case"mouseover":return wn=Mi(wn,e,t,n,a,i),!0;case"pointerover":var l=i.pointerId;return hl.set(l,Mi(hl.get(l)||null,e,t,n,a,i)),!0;case"gotpointercapture":return l=i.pointerId,pl.set(l,Mi(pl.get(l)||null,e,t,n,a,i)),!0}return!1}function km(e){var t=Oa(e.target);if(t!==null){var n=ml(t);if(n!==null){if(t=n.tag,t===13){if(t=th(n),t!==null){e.blockedOn=t,Vf(e.priority,function(){Fd(n)});return}}else if(t===31){if(t=nh(n),t!==null){e.blockedOn=t,Vf(e.priority,function(){Fd(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 Ao(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ru(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);$s=a,n.target.dispatchEvent(a),$s=null}else return t=ei(n),t!==null&&Mm(t),e.blockedOn=n,!1;t.shift()}return!0}function Pd(e,t,n){Ao(e)&&n.delete(t)}function i1(){Mu=!1,xn!==null&&Ao(xn)&&(xn=null),En!==null&&Ao(En)&&(En=null),wn!==null&&Ao(wn)&&(wn=null),hl.forEach(Pd),pl.forEach(Pd)}function uo(e,t){e.blockedOn===t&&(e.blockedOn=null,Mu||(Mu=!0,jn(Hn,i1)))}var co=null;function Id(e){co!==e&&(co=e,jn(Hn,function(){co===e&&(co=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],i=e[t+2];if(typeof a!=="function")if(Nc(a||n)===null)continue;else break;var l=ei(n);l!==null&&(e.splice(t,3),t-=3,cu(l,{pending:!0,data:i,method:n.method,action:a},a,i))}}))}function Ia(e){function t(u){return uo(u,e)}xn!==null&&uo(xn,e),En!==null&&uo(En,e),wn!==null&&uo(wn,e),hl.forEach(t),pl.forEach(t);for(var n=0;n<dn.length;n++){var a=dn[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<dn.length&&(n=dn[0],n.blockedOn===null);)km(n),n.blockedOn===null&&dn.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var i=n[a],l=n[a+1],o=i[Ce]||null;if(typeof l==="function")o||Id(n);else if(o){var r=null;if(l&&l.hasAttribute("formAction")){if(i=l,o=l[Ce]||null)r=o.formAction;else if(Nc(i)!==null)continue}else r=o.action;typeof r==="function"?n[a+1]=r:(n.splice(a,3),a-=3),Id(n)}}}function l1(){function e(l){l.canIntercept&&l.info==="react-transition"&&l.intercept({handler:function(){return new Promise(function(o){return i=o})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),a||setTimeout(n,20)}function n(){if(!a&&!navigation.transition){var l=navigation.currentEntry;l&&l.url!=null&&navigation.navigate(l.url,{state:l.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation==="object"){var a=!1,i=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),i!==null&&(i(),i=null)}}}function Oc(e){this._internalRoot=e}Ac.prototype.render=Oc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(_(409));var n=t.current,a=at();Rm(n,a,e,t,null,null)};Ac.prototype.unmount=Oc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Rm(e.current,2,null,e,null,null),vr(),t[yl]=null}};function Ac(e){this._internalRoot=e}Ac.prototype.unstable_scheduleHydration=function(e){if(e){var t=ph();e={blockedOn:null,target:e,priority:t};for(var n=0;n<dn.length&&t!==0&&t<dn[n].priority;n++);dn.splice(n,0,e),n===0&&km(e)}};var eh=ns;if(eh!=="19.2.8")throw Error(_(527,eh,"19.2.8"));X.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0){if(typeof e.render==="function")throw Error(_(188));throw e=Object.keys(e).join(","),Error(_(268,e))}return e=Ry(t),e=e!==null?ah(e):null,e=e===null?null:e.stateNode,e};var o1={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){if(Ea=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ea.isDisabled&&Ea.supportsFiber)try{vl=Ea.inject(o1),qe=Ea}catch(e){}}var Ea;var Tc=function(e,t){if(!zy(e))throw Error(_(299));var n=!1,a="",i=t0,l=n0,o=a0;return t!==null&&t!==void 0&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(l=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=P0(e,1,!1,null,null,n,a,null,i,l,o,l1),e[yl]=t.current,_m(e),new Oc(t)};Um();function I(e,...t){throw Error(`[MobX] minified error nr: ${e}${t.length?" "+t.map(String).join(","):""}. See mobx.js.org/errors`)}var{assign:At,getOwnPropertyDescriptor:Lc,defineProperty:It,prototype:Ar}=Object,Rc=[];Object.freeze(Rc);var Jm={};Object.freeze(Jm);var u1=Object.toString();var ri=()=>{};function ui(e){return typeof e==="function"}function Mc(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function Tr(e){return e!==null&&typeof e==="object"}function tn(e){if(!Tr(e))return!1;let t=Object.getPrototypeOf(e);if(t==null)return!0;let n=ca(t,"constructor")&&t.constructor;return typeof n==="function"&&n.toString()===u1}function Fm(e){let t=e==null?void 0:e.constructor;if(!t)return!1;if(t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction")return!0;return!1}function Wm(e,t,n){It(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function c1(e,t,n){It(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function ha(e,t){let n="isMobX"+e;return t.prototype[n]=!0,function(a){return Tr(a)&&a[n]===!0}}function zl(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function f1(e){let t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===null}function Rn(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}function d1(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(!n.length)return t;return[...t,...n.filter((a)=>Ar.propertyIsEnumerable.call(e,a))]}var xr=Reflect.ownKeys;function Pm(e){return e===null?null:typeof e==="object"?""+e:e}function ca(e,t){return Ar.hasOwnProperty.call(e,t)}var h1=Object.getOwnPropertyDescriptors;function Xe(e,t){return!!(e&t)}function Qe(e,t,n){if(n)e|=t;else e&=~t;return e}var V=Symbol("mobx administration");class fi{constructor(e="Atom"){this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=-1,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}get isBeingObserved(){return Xe(this.flags_,1)}set isBeingObserved(e){this.flags_=Qe(this.flags_,1,e)}get isPendingUnobservation(){return Xe(this.flags_,2)}set isPendingUnobservation(e){this.flags_=Qe(this.flags_,2,e)}get diffValue(){return Xe(this.flags_,4)?1:0}set diffValue(e){this.flags_=Qe(this.flags_,4,e===1?!0:!1)}onBO(){if(this.onBOL)this.onBOL.forEach((e)=>e())}onBUO(){if(this.onBUOL)this.onBUOL.forEach((e)=>e())}reportObserved(){return _v(this)}reportChanged(){st(),xv(this),ut()}toString(){return this.name_}}var Bc=ha("Atom",fi);function Im(e,t=ri,n=ri){let a=new fi(e);if(t!==ri)a.onBOL=new Set([t]);if(n!==ri)a.onBUOL=new Set([n]);return a}var Hc=Object.is;function fa(e,t,n){if(Uv(e))return e;if(Array.isArray(e))return Ne.array(e,{name:n});if(tn(e))return Ne.object(e,void 0,{name:n});if(zl(e))return Ne.map(e,{name:n});if(Rn(e))return Ne.set(e,{name:n});if(typeof e==="function"&&!ci(e)&&!Tl(e))if(Fm(e))return kr(e);else return Yc(n,e);return e}function p1(e,t,n){if(e===void 0||e===null)return e;if(Dl(e)||Lv(e)||pi(e)||Pt(e))return e;if(Array.isArray(e))return Ne.array(e,{name:n,deep:!1});if(tn(e))return Ne.object(e,void 0,{name:n,deep:!1});if(zl(e))return Ne.map(e,{name:n,deep:!1});if(Rn(e))return Ne.set(e,{name:n,deep:!1})}function Dr(e){return e}function zr(e,t){return{annotationType_:e,options_:t,make_:m1,extend_:v1}}function m1(e,t,n,a){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,n,!1)===null?0:1;if(a===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(ci(n.value))return 1;let l=tv(e,this,t,n,!1);return It(a,t,l),2}function v1(e,t,n,a){let i=tv(e,this,t,n);return e.defineProperty_(t,i,a)}function ev(e,t,n){let{kind:a,name:i,addInitializer:l}=n,o=e,r=(c)=>{var m,y,h,g;return da((m=(y=o.options_)==null?void 0:y.name)!=null?m:i.toString(),c,(h=(g=o.options_)==null?void 0:g.autoAction)!=null?h:!1)};if(a=="field")return function(c){var m;let y=c;if(!ci(y))y=r(y);if((m=o.options_)!=null&&m.bound)y=y.bind(this),y.isMobxAction=!0;return y};if(a=="method"){var u;if(!ci(t))t=r(t);if((u=o.options_)!=null&&u.bound)l(function(){let c=this,m=c[i].bind(c);m.isMobxAction=!0,c[i]=m});return t}I(43,o.annotationType_,String(i),a)}function g1(e,{annotationType_:t},n,{value:a}){}function tv(e,t,n,a,i=N.safeDescriptors){var l,o,r,u,c,m,y;g1(e,t,n,a);let{value:h}=a;if((l=t.options_)!=null&&l.bound){var g;h=h.bind((g=e.proxy_)!=null?g:e.target_)}return{value:da((o=(r=t.options_)==null?void 0:r.name)!=null?o:n.toString(),h,(u=(c=t.options_)==null?void 0:c.autoAction)!=null?u:!1,(m=t.options_)!=null&&m.bound?(y=e.proxy_)!=null?y:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:i?!1:!0}}function nv(e,t){return{annotationType_:e,options_:t,make_:y1,extend_:b1}}function y1(e,t,n,a){var i;if(a===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!ca(e.target_,t)||!Tl(e.target_[t]))){if(this.extend_(e,t,n,!1)===null)return 0}if(Tl(n.value))return 1;let l=iv(e,this,t,n,!1,!1);return It(a,t,l),2}function b1(e,t,n,a){var i;let l=iv(e,this,t,n,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,l,a)}function av(e,t,n){var a;let{name:i,addInitializer:l}=n;if(!Tl(t))t=kr(t);if((a=e.options_)!=null&&a.bound)l(function(){let o=this,r=o[i].bind(o);r.isMobXFlow=!0,o[i]=r});return t}function S1(e,{annotationType_:t},n,{value:a}){}function iv(e,t,n,a,i,l=N.safeDescriptors){S1(e,t,n,a);let{value:o}=a;if(!Tl(o))o=kr(o);if(i){var r;o=o.bind((r=e.proxy_)!=null?r:e.target_),o.isMobXFlow=!0}return{value:o,configurable:l?e.isPlainObject_:!0,enumerable:!1,writable:l?!1:!0}}function lv(e,t){return{annotationType_:e,options_:t,make_:_1,extend_:x1}}function _1(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function x1(e,t,n,a){return E1(e,this,t,n),e.defineComputedProperty_(t,At({},this.options_,{get:n.get,set:n.set}),a)}function ov(e,t,n){let a=e,{name:i,addInitializer:l}=n,o;function r(u,c){let m=At({},a.options_,{get:t,context:u});return m.name||(m.name=`ObservableObject.${i.toString()}`),new en(m)}return l(function(){var u;let c=Cl(this)[V],m=this,y=c.values_.get(i);if(y instanceof en&&y.derivation!==t)c.values_.delete(i);((u=c.lazyComputedKeys_)!=null?u:c.lazyComputedKeys_=new Map).set(i,()=>r(m,c))}),function(){let u=this[V],c=u.values_.get(i);if(c instanceof en&&c.derivation!==t){var m;let h=(m=o)==null?void 0:m.get(this);if(!h){var y;h=r(this,u),((y=o)!=null?y:o=new WeakMap).set(this,h)}return h.get()}return u.getObservablePropValue_(i)}}function E1(e,{annotationType_:t},n,{get:a}){}function jc(e,t){return{annotationType_:e,options_:t,make_:w1,extend_:N1}}function w1(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function N1(e,t,n,a){var i,l;return O1(e,this,t,n),e.defineObservableProperty_(t,n.value,(i=(l=this.options_)==null?void 0:l.enhancer_)!=null?i:fa,a)}function rv(e,t,n){let a=e,{kind:i,name:l}=n;if(i!=="accessor")return;function o(r,u){var c;let m=Cl(r)[V];return((c=m.lazyObservableKeys_)!=null?c:m.lazyObservableKeys_=new Map).set(l,()=>{var y,h;return new Cn(u,(y=(h=a.options_)==null?void 0:h.enhancer_)!=null?y:fa,`ObservableObject.${l.toString()}`,!1)}),m}return{get(){var r;return((r=this[V])!=null?r:o(this,t.get.call(this))).getObservablePropValue_(l)},set(r){var u;return((u=this[V])!=null?u:o(this,r)).setObservablePropValue_(l,r)},init(r){return o(this,r),r}}}function O1(e,{annotationType_:t},n,a){}var A1="true",T1=sv();function sv(e){return{annotationType_:A1,options_:e,make_:D1,extend_:z1}}function D1(e,t,n,a){var i,l;if(n.get)return qc.make_(e,t,n,a);if(n.set){let m=ci(n.set)?n.set:da(t.toString(),n.set);if(a===e.target_)return e.defineProperty_(t,{configurable:N.safeDescriptors?e.isPlainObject_:!0,set:m})===null?0:2;return It(a,t,{configurable:!0,set:m}),2}if(a!==e.target_&&typeof n.value==="function"){var o;if(Fm(n.value)){var r;return((r=this.options_)!=null&&r.autoBind?hS:kr).make_(e,t,n,a)}return((o=this.options_)!=null&&o.autoBind?oS:Yc).make_(e,t,n,a)}let u=((i=this.options_)==null?void 0:i.deep)===!1?di:Ne;if(typeof n.value==="function"&&(l=this.options_)!=null&&l.autoBind){var c;n.value=n.value.bind((c=e.proxy_)!=null?c:e.target_)}return u.make_(e,t,n,a)}function z1(e,t,n,a){var i,l;if(n.get)return qc.extend_(e,t,n,a);if(n.set)return e.defineProperty_(t,{configurable:N.safeDescriptors?e.isPlainObject_:!0,set:da(t.toString(),n.set)},a);if(typeof n.value==="function"&&(i=this.options_)!=null&&i.autoBind){var o;n.value=n.value.bind((o=e.proxy_)!=null?o:e.target_)}return(((l=this.options_)==null?void 0:l.deep)===!1?di:Ne).extend_(e,t,n,a)}function Rr(e,t){return At(function(a,i){if(i&&typeof i.kind==="string")return t(e,a,i);return},e)}var R1="observable",M1="observable.ref",C1="observable.shallow";var uv={deep:!0,name:void 0,defaultDecorator:void 0};Object.freeze(uv);function br(e){return e||uv}var cv=jc(R1),k1=jc(M1,{enhancer_:Dr}),U1=jc(C1,{enhancer_:p1});function fv(e){return Rr(e,rv)}function Sr(e){return e.deep===!0?fa:e.deep===!1?Dr:L1(e.defaultDecorator)}function V1(e){var t;return e?(t=e.defaultDecorator)!=null?t:sv(e):void 0}function L1(e){var t,n;return!e?fa:(t=(n=e.options_)==null?void 0:n.enhancer_)!=null?t:fa}function B1(e,t,n){if(t&&typeof t.kind==="string")return rv(cv,e,t);if(Uv(e))return e;if(tn(e))return Ne.object(e,t,n);if(Array.isArray(e))return Ne.array(e,t);if(zl(e))return Ne.map(e,t);if(Rn(e))return Ne.set(e,t);if(typeof e==="object"&&e!==null)return e;return Ne.box(e,t)}var H1={box(e,t){let n=br(t);return new Cn(e,Sr(n),n.name,!0,n.equals)},array(e,t){let n=br(t);return SS(e,Sr(n),n.name)},map(e,t){let n=br(t);return new Xc(e,Sr(n),n.name)},set(e,t){let n=br(t);return new Qc(e,Sr(n),n.name)},object(e,t,n){return mi(()=>Rv(vS({},n),e,t))}},di=fv(k1),Rl=fv(U1);var Ne=At(B1,cv,H1),dv="computed";function j1(e){return Rr(e,ov)}var hv=lv(dv);var qc=function(t,n){if(n&&typeof n.kind==="string")return ov(hv,t,n);if(tn(t))return j1(lv(dv,t));let a=tn(n)?n:{};return a.get=t,a.name||(a.name=t.name||""),new en(a)};At(qc,hv);var Vm,Lm,Er=0,q1=1,G1=(Vm=(Lm=Lc(()=>{},"name"))==null?void 0:Lm.configurable)!=null?Vm:!1,Bm={value:"action",configurable:!0,writable:!1,enumerable:!1};function da(e,t,n=!1,a){function i(){return pv(e,n,t,a||this,arguments)}if(i.isMobxAction=!0,i.toString=()=>t.toString(),G1)Bm.value=e,It(i,"name",Bm);return i}function pv(e,t,n,a,i){let l=Y1(e,t,a,i);try{return n.apply(a,i)}catch(o){throw l.error_=o,o}finally{K1(l)}}function Y1(e,t,n,a){let l=0,o=N.trackingDerivation,r=!t||!o;st();let u=N.allowStateChanges;if(r)hi();let c=N.allowStateReads,m={runAsAction_:r,prevDerivation_:o,prevAllowStateChanges_:u,prevAllowStateReads_:c,notifySpy_:!1,startTime_:l,actionId_:q1++,parentActionId_:Er};return Er=m.actionId_,m}function K1(e){if(Er!==e.actionId_)I(30);if(Er=e.parentActionId_,e.error_!==void 0)N.suppressReactionErrors=!0;if(ut(),e.runAsAction_)kn(e.prevDerivation_);N.suppressReactionErrors=!1}function X1(e,t){let n=Q1(e);try{return t()}finally{Z1(n)}}function Q1(e){let t=N.allowStateChanges;return N.allowStateChanges=e,t}function Z1(e){N.allowStateChanges=e}class Cn extends fi{constructor(e,t,n="ObservableValue",a=!0,i=Hc){super(n);if(this.enhancer_=void 0,this.name_=void 0,this.equals_=void 0,this.hasUnreportedChange_=!1,this.interceptors_=void 0,this.changeListeners_=void 0,this.value_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,this.equals_=i,this.value_=t(e,void 0,n),!1)var l}dehanceValue(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}set(e){let t=this.value_;if(e=this.prepareNewValue_(e),e!==N.UNCHANGED)this.setNewValue_(e)}prepareNewValue_(e){if(Ot(this),ot(this)){let t=rt(this,{object:this,type:Un,newValue:e});if(!t)return N.UNCHANGED;e=t.newValue}return e=this.enhancer_(e,this.value_,this.name_),this.equals_(this.value_,e)?N.UNCHANGED:e}setNewValue_(e){let t=this.value_;if(this.value_=e,this.reportChanged(),vt(this))gt(this,{type:Un,object:this,newValue:e,oldValue:t})}get(){return this.reportObserved(),this.dehanceValue(this.value_)}raw(){return this.value_}toJSON(){return this.get()}toString(){return`${this.name_}[${this.value_}]`}valueOf(){return Pm(this.get())}[Symbol.toPrimitive](){return this.valueOf()}}class en{constructor(e){if(this.dependenciesState_=-1,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=0,this.unboundDepsCount_=0,this.value_=new Al(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,!e.get)I(31);if(this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set)this.setter_=da("ComputedValue-setter",e.set);this.equals_=e.equals||Hc,this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}onBecomeStale_(){eS(this)}onBO(){if(this.onBOL)this.onBOL.forEach((e)=>e())}onBUO(){if(this.onBUOL)this.onBUOL.forEach((e)=>e())}get isComputing(){return Xe(this.flags_,1)}set isComputing(e){this.flags_=Qe(this.flags_,1,e)}get isRunningSetter(){return Xe(this.flags_,2)}set isRunningSetter(e){this.flags_=Qe(this.flags_,2,e)}get isBeingObserved(){return Xe(this.flags_,4)}set isBeingObserved(e){this.flags_=Qe(this.flags_,4,e)}get isPendingUnobservation(){return Xe(this.flags_,8)}set isPendingUnobservation(e){this.flags_=Qe(this.flags_,8,e)}get diffValue(){return Xe(this.flags_,16)?1:0}set diffValue(e){this.flags_=Qe(this.flags_,16,e===1?!0:!1)}get(){if(this.isComputing)I(32,this.name_,this.derivation);if(N.inBatch===0&&this.observers_.size===0&&!this.keepAlive_){if(Cc(this))this.warnAboutUntrackedRead_(),st(),this.value_=this.computeValue_(!1),ut()}else if(_v(this),Cc(this)){let t=N.trackingContext;if(this.keepAlive_&&!t)N.trackingContext=this;if(this.trackAndCompute())I1(this);N.trackingContext=t}let e=this.value_;if(_r(e))throw e.cause;return e}set(e){if(this.setter_){if(this.isRunningSetter)I(33,this.name_);this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else I(34,this.name_)}trackAndCompute(){let e=this.value_,t=this.dependenciesState_===-1,n=this.computeValue_(!0),a=t||_r(e)||_r(n)||!this.equals_(e,n);if(a)this.value_=n;return a}computeValue_(e){this.isComputing=!0;let t=!1,n;if(e)n=mv(this,this.derivation,this.scope_);else if(N.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(a){n=new Al(a)}return this.isComputing=!1,n}suspend_(){if(!this.keepAlive_)kc(this),this.value_=void 0}warnAboutUntrackedRead_(){return}toString(){return`${this.name_}[${this.derivation.toString()}]`}valueOf(){return Pm(this.get())}[Symbol.toPrimitive](){return this.valueOf()}}var Mr=ha("ComputedValue",en);class Al{constructor(e){this.cause=void 0,this.cause=e}}function _r(e){return e instanceof Al}function Cc(e){switch(e.dependenciesState_){case 0:return!1;case-1:case 2:return!0;case 1:{let n=hi(),a=e.observing_,i=a.length;for(let l=0;l<i;l++){let o=a[l];if(Mr(o)){if(N.disableErrorBoundaries)o.get();else try{o.get()}catch(r){return kn(n),!0}if(e.dependenciesState_===2)return kn(n),!0}}return gv(e),kn(n),!1}}}function Ot(e){return}function $1(e){}function mv(e,t,n){gv(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++N.runId;let i=N.trackingDerivation;N.trackingDerivation=e,N.inBatch++;let l;if(N.disableErrorBoundaries===!0)l=t.call(n);else try{l=t.call(n)}catch(o){l=new Al(o)}return N.inBatch--,N.trackingDerivation=i,F1(e),J1(e),l}function J1(e){return}function F1(e){let t=e.observing_,n=e.observing_=e.newObserving_,a=0,i=0,l=e.unboundDepsCount_;for(let o=0;o<l;o++){let r=n[o];if(r.diffValue===0){if(r.diffValue=1,i!==o)n[i]=r;i++}if(r.dependenciesState_>a)a=r.dependenciesState_}n.length=i,e.newObserving_=null,l=t.length;while(l--){let o=t[l];if(o.diffValue===0)bv(o,e);o.diffValue=0}while(i--){let o=n[i];if(o.diffValue===1)o.diffValue=0,P1(o,e)}if(a!==0)e.dependenciesState_=a,e.onBecomeStale_()}function kc(e){let t=e.observing_;e.observing_=[];let n=t.length;while(n--)bv(t[n],e);e.dependenciesState_=-1}function vv(e){let t=hi();try{return e()}finally{kn(t)}}function hi(){let e=N.trackingDerivation;return N.trackingDerivation=null,e}function kn(e){N.trackingDerivation=e}function gv(e){if(e.dependenciesState_===0)return;e.dependenciesState_=0;let t=e.observing_,n=t.length;while(n--)t[n].lowestObserverState_=0}var yv=7;class Uc{constructor(){this.version=yv,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.safeDescriptors=!0}}var Dc=!0,W1=!1,N=function(){let e=globalThis;if(e.__mobxInstanceCount>0&&!e.__mobxGlobals)Dc=!1;if(e.__mobxGlobals&&e.__mobxGlobals.version!==yv)Dc=!1;if(!Dc)return setTimeout(()=>{if(!W1)I(35)},1),new Uc;else if(e.__mobxGlobals){if(e.__mobxInstanceCount+=1,!e.__mobxGlobals.UNCHANGED)e.__mobxGlobals.UNCHANGED={};return e.__mobxGlobals}else return e.__mobxInstanceCount=1,e.__mobxGlobals=new Uc}();function Gc(){return N}function P1(e,t){if(e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_)e.lowestObserverState_=t.dependenciesState_}function bv(e,t){if(e.observers_.delete(t),e.observers_.size===0)Sv(e)}function Sv(e){if(e.isPendingUnobservation===!1)e.isPendingUnobservation=!0,N.pendingUnobservations.push(e)}function st(){N.inBatch++}function ut(){if(--N.inBatch===0){Ev();let e=N.pendingUnobservations;for(let t=0;t<e.length;t++){let n=e[t];if(n.isPendingUnobservation=!1,n.observers_.size===0){if(n.isBeingObserved)n.isBeingObserved=!1,n.onBUO();if(n instanceof en)n.suspend_()}}N.pendingUnobservations=[]}}function _v(e){$1(e);let t=N.trackingDerivation;if(t!==null){if(t.runId_!==e.lastAccessedBy_){if(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&N.trackingContext)e.isBeingObserved=!0,e.onBO()}return e.isBeingObserved}else if(e.observers_.size===0&&N.inBatch>0)Sv(e);return!1}function xv(e){if(e.lowestObserverState_===2)return;e.lowestObserverState_=2,e.observers_.forEach((t)=>{if(t.dependenciesState_===0)t.onBecomeStale_();t.dependenciesState_=2})}function I1(e){if(e.lowestObserverState_===2)return;e.lowestObserverState_=2,e.observers_.forEach((t)=>{if(t.dependenciesState_===1)t.dependenciesState_=2;else if(t.dependenciesState_===0)e.lowestObserverState_=0})}function eS(e){if(e.lowestObserverState_!==0)return;e.lowestObserverState_=1,e.observers_.forEach((t)=>{if(t.dependenciesState_===0)t.dependenciesState_=1,t.onBecomeStale_()})}class Ml{constructor(e="Reaction",t,n,a){this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=-1,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=a}get isDisposed(){return Xe(this.flags_,1)}set isDisposed(e){this.flags_=Qe(this.flags_,1,e)}get isScheduled(){return Xe(this.flags_,2)}set isScheduled(e){this.flags_=Qe(this.flags_,2,e)}get isTrackPending(){return Xe(this.flags_,4)}set isTrackPending(e){this.flags_=Qe(this.flags_,4,e)}get isRunning(){return Xe(this.flags_,8)}set isRunning(e){this.flags_=Qe(this.flags_,8,e)}get diffValue(){return Xe(this.flags_,16)?1:0}set diffValue(e){this.flags_=Qe(this.flags_,16,e===1?!0:!1)}onBecomeStale_(){this.schedule_()}schedule_(){if(!this.isScheduled)this.isScheduled=!0,N.pendingReactions.push(this),Ev()}runReaction_(){if(!this.isDisposed){st(),this.isScheduled=!1;let e=N.trackingContext;if(N.trackingContext=this,Cc(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}N.trackingContext=e,ut()}}track(e){if(this.isDisposed)return;st();let t=!1,n;this.isRunning=!0;let a=N.trackingContext;N.trackingContext=this;let i=mv(this,e,void 0);if(N.trackingContext=a,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed)kc(this);if(_r(i))this.reportExceptionInDerivation_(i.cause);ut()}reportExceptionInDerivation_(e){if(this.errorHandler_){this.errorHandler_(e,this);return}if(N.disableErrorBoundaries)throw e;let t=`[mobx] uncaught error in '${this}'`;if(!N.suppressReactionErrors)console.error(t,e);N.globalReactionErrorHandlers.forEach((n)=>n(e,this))}dispose(){if(!this.isDisposed){if(this.isDisposed=!0,!this.isRunning)st(),kc(this),ut()}}getDisposer_(e){let t=()=>{this.dispose(),e==null||e.removeEventListener==null||e.removeEventListener("abort",t)};if(e==null||e.addEventListener==null||e.addEventListener("abort",t),t[V]=this,"dispose"in Symbol&&typeof Symbol.dispose==="symbol")t[Symbol.dispose]=t;return t}toString(){return`Reaction[${this.name_}]`}}var tS=100,nS=(e)=>e();function Ev(){if(N.inBatch>0||N.isRunningReactions)return;nS(aS)}function aS(){N.isRunningReactions=!0;let e=N.pendingReactions,t=0;while(e.length>0){if(++t===tS)console.error(`[mobx] cycle in reaction: ${e[0]}`),e.splice(0);let n=e.splice(0);for(let a=0,i=n.length;a<i;a++)n[a].runReaction_()}N.isRunningReactions=!1}var wr=ha("Reaction",Ml);var wv="action";var Nv="autoAction",iS="autoAction.bound",Ov="<unnamed action>",Av=zr(wv);var Tv=zr(Nv,{autoAction:!0}),lS=zr(iS,{autoAction:!0,bound:!0});function Dv(e){return Rr(e,ev)}function zv(e){return function(a,i){if(i&&typeof i.kind==="string")return ev(e?Tv:Av,a,i);if(ui(a))return da(a.name||Ov,a,e);if(ui(i))return da(a,i,e);if(Mc(a))return Dv(zr(e?Nv:wv,{name:a,autoAction:e}))}}var si=zv(!1);At(si,Av);var Yc=zv(!0);At(Yc,Tv);var oS=Dv(lS);function E(e){return pv(e.name||Ov,!1,e,this,void 0)}function ci(e){return ui(e)&&e.isMobxAction===!0}var rS=(e)=>e();function sS(e){return e.scheduler?e.scheduler:e.delay?(t)=>setTimeout(t,e.delay):rS}function Cr(e,t,n=Jm){var a,i;let l=(a=n.name)!=null?a:"Reaction",o=si(l,n.onError?uS(n.onError,t):t),r=!n.scheduler&&!n.delay,u=sS(n),c=!0,m=!1,y,h=n.equals||Hc,g=new Ml(l,()=>{if(c||r)x();else if(!m)m=!0,u(x)},n.onError,n.requiresObservable);function x(){if(m=!1,g.isDisposed)return;let A=!1,M=y;if(g.track(()=>{let d=X1(!1,()=>e(g));A=c||!h(y,d),y=d}),c&&n.fireImmediately)o(y,M,g);else if(!c&&A)o(y,M,g);c=!1}if(!(n!=null&&(i=n.signal)!=null&&i.aborted))g.schedule_();return g.getDisposer_(n==null?void 0:n.signal)}function uS(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}function Rv(e,t,n,a){let i=h1(t);return mi(()=>{let l=Cl(e,a)[V];xr(i).forEach((o)=>{l.extend_(o,i[o],!n?!0:(o in n)?n[o]:!0)})}),e}function Mv(e,t){return Cv(Or(e,t))}function Cv(e){let t={name:e.name_};if(e.observing_&&e.observing_.length>0)t.dependencies=cS(e.observing_).map(Cv);return t}function cS(e){return Array.from(new Set(e))}class kv extends Error{constructor(){super("FLOW_CANCELLED");Object.setPrototypeOf(this,new.target.prototype),this.name="FlowCancellationError"}toString(){return`Error: ${this.message}`}}function fS(e){return Rr(e,av)}var Hm=nv("flow"),dS=nv("flow.bound",{bound:!0}),kr=At(function(t,n){if(n&&typeof n.kind==="string")return av(Hm,t,n);let a=t,i=a.name||"flow",l=function(){let r=this,u=arguments,c=0,m=si(i,a).apply(r,u),y,h=void 0,g=new Promise(function(A,M){let d=0;y=M;function f(w){h=void 0;let k;try{k=si(i,m.next).call(m,w)}catch(O){return M(O)}b(k)}function v(w){h=void 0;let k;try{k=si(i,m.throw).call(m,w)}catch(O){return M(O)}b(k)}function b(w){if(ui(w==null?void 0:w.then)){w.then(b,M);return}if(w.done)return A(w.value);return h=Promise.resolve(w.value),h.then(f,v)}f(void 0)}),x=i;return g.cancel=si(x,function(){try{if(h)jm(h);let A=m.return(void 0),M=Promise.resolve(A.value);M.then(ri,ri),jm(M),y(new kv)}catch(A){y(A)}}),g};return l.isMobXFlow=!0,l},Hm),hS=fS(dS);function jm(e){if(ui(e.cancel))e.cancel()}function Tl(e){return(e==null?void 0:e.isMobXFlow)===!0}function pS(e,t){if(!e)return!1;if(t!==void 0){if(Dl(e)){var n,a;let i=e[V];return i.values_.has(t)||!!((n=i.lazyComputedKeys_)!=null&&n.has(t))||!!((a=i.lazyObservableKeys_)!=null&&a.has(t))}return!1}return Dl(e)||!!e[V]||Bc(e)||wr(e)||Mr(e)}function Uv(e){return pS(e)}function Wt(e,t=void 0){st();try{return e.apply(t)}finally{ut()}}function oi(e){return e[V]}var mS={has(e,t){return oi(e).has_(t)},get(e,t){return oi(e).get_(t)},set(e,t,n){var a;if(!Mc(t))return!1;return(a=oi(e).set_(t,n,!0))!=null?a:!0},deleteProperty(e,t){var n;if(!Mc(t))return!1;return(n=oi(e).delete_(t,!0))!=null?n:!0},defineProperty(e,t,n){var a;return(a=oi(e).defineProperty_(t,n))!=null?a:!0},ownKeys(e){return oi(e).ownKeys_()},preventExtensions(e){I(13)}};function vS(e,t){var n,a;return e=Cl(e,t),(a=(n=e[V]).proxy_)!=null?a:n.proxy_=new Proxy(e,mS)}function ot(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function rt(e,t){let n=hi();try{let a=[...e.interceptors_||[]];for(let i=0,l=a.length;i<l;i++){if(t=a[i](t),t&&!t.type)I(14);if(!t)break}return t}finally{kn(n)}}function vt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function gt(e,t){let n=hi(),a=e.changeListeners_;if(!a)return;a=a.slice();for(let i=0,l=a.length;i<l;i++)a[i](t);kn(n)}var zc=Symbol("mobx-keys");function nn(e,t,n){if(tn(e))return Rv(e,e,t,n);return mi(()=>{let a=Cl(e,n)[V];if(!e[zc]){let i=Object.getPrototypeOf(e),l=new Set([...xr(e),...xr(i)]);l.delete("constructor"),l.delete(V),Wm(i,zc,l)}e[zc].forEach((i)=>gS(a,i,!t?!0:(i in t)?t[i]:!0))}),e}function gS(e,t,n){if(n===!0)n=e.defaultAnnotation_;if(n===!1)return;if(Hv(e,n,t),!(t in e.target_))I(1,n.annotationType_,`${e.name_}.${t.toString()}`);let a=e.target_;while(a&&a!==Ar){let i=Lc(a,t);if(i){let l=n.make_(e,t,i,a);if(l===0)return;if(l===1)break}a=Object.getPrototypeOf(a)}Bv(e,n,t)}var qm="splice",Un="update",yS=1e4,bS={get(e,t){let n=e[V];if(t===V)return n;if(t==="length")return n.getArrayLength_();if(typeof t==="string"&&!isNaN(t))return n.get_(parseInt(t));if(ca(Vc,t))return Vc[t];return e[t]},set(e,t,n){let a=e[V];if(t==="length")a.setArrayLength_(n);if(typeof t==="symbol"||isNaN(t))e[t]=n;else a.set_(parseInt(t),n);return!0},preventExtensions(){I(15)}};class Kc{constructor(e="ObservableArray",t,n){this.owned_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.atom_=new fi(e),this.enhancer_=(a,i)=>t(a,i,"ObservableArray[..]")}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}dehanceValues_(e){if(this.dehancer!==void 0&&e.length>0)return e.map(this.dehancer);return e}getArrayLength_(){return this.atom_.reportObserved(),this.values_.length}setArrayLength_(e){if(typeof e!=="number"||isNaN(e)||e<0)I(40,e);let t=this.values_.length;if(e===t)return;else if(e>t){let n=Array.from({length:e-t});this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)}updateArrayLength_(e,t){if(e!==this.lastKnownLength_)I(16);this.lastKnownLength_+=t}spliceWithArray_(e,t,n){Ot(this.atom_);let a=this.values_.length;if(e===void 0)e=0;else if(e>a)e=a;else if(e<0)e=Math.max(0,a+e);if(arguments.length===1)t=a-e;else if(t===void 0||t===null)t=0;else t=Math.max(0,Math.min(t,a-e));if(n===void 0)n=Rc;if(ot(this)){let l=rt(this,{object:this.proxy_,type:qm,index:e,removedCount:t,added:n});if(!l)return Rc;t=l.removedCount,n=l.added}n=n.length===0?n:n.map((l)=>this.enhancer_(l,void 0));let i=this.spliceItemsIntoValues_(e,t,n);if(t!==0||n.length!==0)this.notifyArraySplice_(e,n,i);return this.dehanceValues_(i)}spliceItemsIntoValues_(e,t,n){if(n.length<yS)return this.values_.splice(e,t,...n);else{let a=this.values_.slice(e,e+t),i=this.values_.slice(e+t);this.values_.length+=n.length-t;for(let l=0;l<n.length;l++)this.values_[e+l]=n[l];for(let l=0;l<i.length;l++)this.values_[e+n.length+l]=i[l];return a}}notifyArrayChildUpdate_(e,t,n){let i=vt(this),l=i?{observableKind:"array",object:this.proxy_,type:Un,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;if(this.atom_.reportChanged(),i)gt(this,l)}notifyArraySplice_(e,t,n){let i=vt(this),l=i?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:qm,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;if(this.atom_.reportChanged(),i)gt(this,l)}get_(e){return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])}set_(e,t){let n=this.values_;if(e<n.length){Ot(this.atom_);let a=n[e];if(ot(this)){let l=rt(this,{type:Un,object:this.proxy_,index:e,newValue:t});if(!l)return;t=l.newValue}if(t=this.enhancer_(t,a),t!==a)n[e]=t,this.notifyArrayChildUpdate_(e,t,a)}else{let a=Array.from({length:e+1-n.length});a[a.length-1]=t,this.spliceWithArray_(n.length,0,a)}}}function SS(e,t,n="ObservableArray",a=!1){return mi(()=>{let i=new Kc(n,t,a);c1(i.values_,V,i);let l=new Proxy(i.values_,bS);if(i.proxy_=l,e&&e.length)i.spliceWithArray_(0,0,e);return l})}var Vc={clear(){return this.splice(0)},replace(e){let t=this[V];return t.spliceWithArray_(0,t.values_.length,e)},toJSON(){return this.slice()},splice(e,t,...n){let a=this[V];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(e);case 2:return a.spliceWithArray_(e,t)}return a.spliceWithArray_(e,t,n)},spliceWithArray(e,t,n){return this[V].spliceWithArray_(e,t,n)},push(...e){let t=this[V];return t.spliceWithArray_(t.values_.length,0,e),t.values_.length},pop(){return this.splice(Math.max(this[V].values_.length-1,0),1)[0]},shift(){return this.splice(0,1)[0]},unshift(...e){let t=this[V];return t.spliceWithArray_(0,0,e),t.values_.length},reverse(){if(N.trackingDerivation)I(37,"reverse");return this.replace(this.slice().reverse()),this},sort(){if(N.trackingDerivation)I(37,"sort");let e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove(e){let t=this[V],n=t.dehanceValues_(t.values_).indexOf(e);if(n>-1)return this.splice(n,1),!0;return!1}};ee("at",Ze);ee("concat",Ze);ee("flat",Ze);ee("includes",Ze);ee("indexOf",Ze);ee("join",Ze);ee("lastIndexOf",Ze);ee("slice",Ze);ee("toString",Ze);ee("toLocaleString",Ze);ee("toSorted",Ze);ee("toSpliced",Ze);ee("with",Ze);ee("every",yt);ee("filter",yt);ee("find",yt);ee("findIndex",yt);ee("findLast",yt);ee("findLastIndex",yt);ee("flatMap",yt);ee("forEach",yt);ee("map",yt);ee("some",yt);ee("toReversed",yt);ee("reduce",Vv);ee("reduceRight",Vv);function ee(e,t){if(typeof Array.prototype[e]==="function")Vc[e]=t(e)}function Ze(e){return function(){let t=this[V];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function yt(e){return function(t,n){let a=this[V];return a.atom_.reportObserved(),a.dehanceValues_(a.values_)[e]((l,o)=>t.call(n,l,o,this))}}function Vv(e){return function(){let t=this[V];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_),a=arguments[0];return arguments[0]=(i,l,o)=>a(i,l,o,this),n[e].apply(n,arguments)}}var _S=ha("ObservableArrayAdministration",Kc);function Lv(e){return Tr(e)&&_S(e[V])}var xS={},Mn="add",Nr="delete";class Xc{constructor(e,t=fa,n="ObservableMap"){this.enhancer_=void 0,this.name_=void 0,this[V]=xS,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,mi(()=>{if(this.keysAtom_=Im("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,e)this.merge(e)})}has_(e){return this.data_.has(e)}has(e){if(!N.trackingDerivation)return this.has_(e);let t=this.hasMap_.get(e);if(!t){let n=t=new Cn(this.has_(e),Dr,"ObservableMap.key?",!1);this.hasMap_.set(e,n),n.onBUOL=new Set([()=>this.hasMap_.delete(e)])}return t.get()}set(e,t){let n=this.has_(e);if(ot(this)){let a=rt(this,{type:n?Un:Mn,object:this,newValue:t,name:e});if(!a)return this;t=a.newValue}if(n)this.updateValue_(e,t);else this.addValue_(e,t);return this}delete(e){if(Ot(this.keysAtom_),ot(this)){if(!rt(this,{type:Nr,object:this,name:e}))return!1}if(this.has_(e)){let n=vt(this),a=n?{observableKind:"map",debugObjectName:this.name_,type:Nr,object:this,oldValue:this.data_.get(e).value_,name:e}:null;if(Wt(()=>{var i;this.keysAtom_.reportChanged(),(i=this.hasMap_.get(e))==null||i.setNewValue_(!1),this.data_.get(e).setNewValue_(void 0),this.data_.delete(e)}),n)gt(this,a);return!0}return!1}updateValue_(e,t){let n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==N.UNCHANGED){let i=vt(this),l=i?{observableKind:"map",debugObjectName:this.name_,type:Un,object:this,oldValue:n.value_,name:e,newValue:t}:null;if(n.setNewValue_(t),i)gt(this,l)}}addValue_(e,t){Ot(this.keysAtom_),Wt(()=>{var l;let o=new Cn(t,this.enhancer_,"ObservableMap.key",!1);this.data_.set(e,o),t=o.value_,(l=this.hasMap_.get(e))==null||l.setNewValue_(!0),this.keysAtom_.reportChanged()});let n=!1,a=vt(this),i=a||n?{observableKind:"map",debugObjectName:this.name_,type:Mn,object:this,name:e,newValue:t}:null;if(a)gt(this,i)}get(e){if(this.has(e))return this.dehanceValue_(this.data_.get(e).get());return this.dehanceValue_(void 0)}getOrInsert(e,t){if(!this.has(e))this.set(e,t);return this.get(e)}getOrInsertComputed(e,t){if(!this.has(e))this.set(e,t(e));return this.get(e)}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}keys(){return this.keysAtom_.reportObserved(),this.data_.keys()}values(){let e=this,t=this.keys();return Gm({next(){let{done:n,value:a}=t.next();return{done:n,value:n?void 0:e.get(a)}}})}entries(){let e=this,t=this.keys();return Gm({next(){let{done:n,value:a}=t.next();return{done:n,value:n?void 0:[a,e.get(a)]}}})}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[n,a]of this)e.call(t,a,n,this)}merge(e){if(pi(e))e=new Map(e);return Wt(()=>{if(tn(e))d1(e).forEach((t)=>this.set(t,e[t]));else if(Array.isArray(e))e.forEach(([t,n])=>this.set(t,n));else if(zl(e)){if(!f1(e))I(19,e);e.forEach((t,n)=>this.set(n,t))}else if(e!==null&&e!==void 0)I(20,e)}),this}clear(){Wt(()=>{vv(()=>{for(let e of this.keys())this.delete(e)})})}replace(e){return Wt(()=>{let t=ES(e),n=new Map,a=!1;for(let i of this.data_.keys())if(!t.has(i))if(this.delete(i))a=!0;else{let o=this.data_.get(i);n.set(i,o)}for(let[i,l]of t.entries()){let o=this.data_.has(i);if(this.set(i,l),this.data_.has(i)){let r=this.data_.get(i);if(n.set(i,r),!o)a=!0}}if(!a)if(this.data_.size!==n.size)this.keysAtom_.reportChanged();else{let i=this.data_.keys(),l=n.keys(),o=i.next(),r=l.next();while(!o.done){if(o.value!==r.value){this.keysAtom_.reportChanged();break}o=i.next(),r=l.next()}}this.data_=n}),this}get size(){return this.keysAtom_.reportObserved(),this.data_.size}toString(){return"[object ObservableMap]"}toJSON(){return Array.from(this)}get[Symbol.toStringTag](){return"Map"}}var pi=ha("ObservableMap",Xc);function Gm(e){return e[Symbol.toStringTag]="MapIterator",qv(e)}function ES(e){if(zl(e)||pi(e))return e;else if(Array.isArray(e))return new Map(e);else if(tn(e)){let t=new Map;for(let n in e)t.set(n,e[n]);return t}else return I(21,e)}var wS={};class Qc{constructor(e,t=fa,n="ObservableSet"){this.name_=void 0,this[V]=wS,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,this.enhancer_=(a,i)=>t(a,i,n),mi(()=>{if(this.atom_=Im(this.name_),e)this.replace(e)})}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}clear(){Wt(()=>{vv(()=>{for(let e of this.data_.values())this.delete(e)})})}forEach(e,t){for(let n of this)e.call(t,n,n,this)}get size(){return this.atom_.reportObserved(),this.data_.size}add(e){if(Ot(this.atom_),ot(this)){let t=rt(this,{type:Mn,object:this,newValue:e});if(!t)return this;e=t.newValue}if(!this.has(e)){Wt(()=>{this.data_.add(this.enhancer_(e,void 0)),this.atom_.reportChanged()});let t=!1,n=vt(this),a=n||t?{observableKind:"set",debugObjectName:this.name_,type:Mn,object:this,newValue:e}:null;if(n)gt(this,a)}return this}delete(e){if(ot(this)){if(!rt(this,{type:Nr,object:this,oldValue:e}))return!1}if(this.has(e)){let n=vt(this),a=n?{observableKind:"set",debugObjectName:this.name_,type:Nr,object:this,oldValue:e}:null;if(Wt(()=>{this.atom_.reportChanged(),this.data_.delete(e)}),n)gt(this,a);return!0}return!1}has(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))}entries(){let e=this.values();return Ym({next(){let{value:t,done:n}=e.next();return!n?{value:[t,t],done:n}:{value:void 0,done:n}}})}keys(){return this.values()}values(){this.atom_.reportObserved();let e=this,t=this.data_.values();return Ym({next(){let{value:n,done:a}=t.next();return!a?{value:e.dehanceValue_(n),done:a}:{value:void 0,done:a}}})}intersection(e){if(Rn(e)&&!Pt(e))return e.intersection(this);else return new Set(this).intersection(e)}union(e){if(Rn(e)&&!Pt(e))return e.union(this);else return new Set(this).union(e)}difference(e){return new Set(this).difference(e)}symmetricDifference(e){if(Rn(e)&&!Pt(e))return e.symmetricDifference(this);else return new Set(this).symmetricDifference(e)}isSubsetOf(e){return new Set(this).isSubsetOf(e)}isSupersetOf(e){return new Set(this).isSupersetOf(e)}isDisjointFrom(e){if(Rn(e)&&!Pt(e))return e.isDisjointFrom(this);else return new Set(this).isDisjointFrom(e)}replace(e){if(Pt(e))e=new Set(e);return Wt(()=>{if(Array.isArray(e))this.clear(),e.forEach((t)=>this.add(t));else if(Rn(e))this.clear(),e.forEach((t)=>this.add(t));else if(e!==null&&e!==void 0)I(41,e)}),this}toJSON(){return Array.from(this)}toString(){return"[object ObservableSet]"}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return"Set"}}var Pt=ha("ObservableSet",Qc);function Ym(e){return e[Symbol.toStringTag]="SetIterator",qv(e)}var Km=Object.create(null),Xm="remove";class Zc{constructor(e,t=new Map,n,a=T1){this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=a,this.keysAtom_=new fi("ObservableObject.keys"),this.isPlainObject_=tn(this.target_)}getObservablePropValue_(e){var t,n;return((t=(n=this.values_.get(e))!=null?n:this.materializeLazyComputed_(e))!=null?t:this.materializeLazyObservable_(e)).get()}materializeLazyComputed_(e){var t;let n=(t=this.lazyComputedKeys_)==null?void 0:t.get(e);if(!n)return;if(this.lazyComputedKeys_.delete(e),this.lazyComputedKeys_.size===0)this.lazyComputedKeys_=void 0;let a=n();return this.values_.set(e,a),a}materializeLazyObservable_(e){var t;let n=(t=this.lazyObservableKeys_)==null?void 0:t.get(e);if(!n)return;if(this.lazyObservableKeys_.delete(e),this.lazyObservableKeys_.size===0)this.lazyObservableKeys_=void 0;let a=n();return this.values_.set(e,a),a}setObservablePropValue_(e,t){var n,a;let i=(n=(a=this.values_.get(e))!=null?a:this.materializeLazyComputed_(e))!=null?n:this.materializeLazyObservable_(e);if(i instanceof en)return i.set(t),!0;if(ot(this)){let l=rt(this,{type:Un,object:this.proxy_||this.target_,name:e,newValue:t});if(!l)return null;t=l.newValue}if(t=i.prepareNewValue_(t),t!==N.UNCHANGED){let l=vt(this),o=!1,r=l?{type:Un,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:e,newValue:t}:null;if(i.setNewValue_(t),l)gt(this,r)}return!0}get_(e){if(N.trackingDerivation&&!ca(this.target_,e))this.has_(e);return this.target_[e]}set_(e,t,n=!1){if(ca(this.target_,e))if(this.values_.has(e))return this.setObservablePropValue_(e,t);else if(n)return Reflect.set(this.target_,e,t);else return this.target_[e]=t,!0;else return this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)}has_(e){if(!N.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);let t=this.pendingKeys_.get(e);if(!t)t=new Cn(e in this.target_,Dr,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t);return t.get()}extend_(e,t,n,a=!1){if(n===!0)n=this.defaultAnnotation_;if(n===!1)return this.defineProperty_(e,t,a);Hv(this,n,e);let i=n.extend_(this,e,t,a);if(i)Bv(this,n,e);return i}defineProperty_(e,t,n=!1){Ot(this.keysAtom_);try{st();let a=this.delete_(e);if(!a)return a;if(ot(this)){let i=rt(this,{object:this.proxy_||this.target_,name:e,type:Mn,newValue:t.value});if(!i)return null;let{newValue:l}=i;if(t.value!==l)t=At({},t,{value:l})}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else It(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{ut()}return!0}defineObservableProperty_(e,t,n,a=!1){Ot(this.keysAtom_);try{st();let i=this.delete_(e);if(!i)return i;if(ot(this)){let u=rt(this,{object:this.proxy_||this.target_,name:e,type:Mn,newValue:t});if(!u)return null;t=u.newValue}let l=Qm(e),o={configurable:N.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,e,o))return!1}else It(this.target_,e,o);let r=new Cn(t,n,"ObservableObject.key",!1);this.values_.set(e,r),this.notifyPropertyAddition_(e,r.value_)}finally{ut()}return!0}defineComputedProperty_(e,t,n=!1){Ot(this.keysAtom_);try{st();let a=this.delete_(e);if(!a)return a;if(ot(this)){if(!rt(this,{object:this.proxy_||this.target_,name:e,type:Mn,newValue:void 0}))return null}t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;let i=Qm(e),l={configurable:N.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,l))return!1}else It(this.target_,e,l);this.values_.set(e,new en(t)),this.notifyPropertyAddition_(e,void 0)}finally{ut()}return!0}delete_(e,t=!1){if(Ot(this.keysAtom_),!ca(this.target_,e))return!0;if(ot(this)){if(!rt(this,{object:this.proxy_||this.target_,name:e,type:Xm}))return null}try{var n;st();let i=vt(this),l=!1,o=this.values_.get(e),r=void 0;if(!o&&(i||l)){var a;r=(a=Lc(this.target_,e))==null?void 0:a.value}if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(o){if(this.values_.delete(e),o instanceof Cn)r=o.value_;xv(o)}if(this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),i||l){let u={type:Xm,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:r,name:e};if(i)gt(this,u)}}finally{ut()}return!0}notifyPropertyAddition_(e,t){var n;let a=vt(this),i=!1;if(a){let l=a?{type:Mn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;if(a)gt(this,l)}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()}ownKeys_(){return this.keysAtom_.reportObserved(),xr(this.target_)}keys_(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)}}function Cl(e,t){var n;if(ca(e,V))return e;let a=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",i=new Zc(e,new Map,String(a),V1(t));return Wm(e,V,i),e}var NS=ha("ObservableObjectAdministration",Zc);function Qm(e){return Km[e]||(Km[e]={get(){return this[V].getObservablePropValue_(e)},set(t){return this[V].setObservablePropValue_(e,t)}})}function Dl(e){if(Tr(e))return NS(e[V]);return!1}function Bv(e,t,n){}function Hv(e,t,n){}function Or(e,t){if(typeof e==="object"&&e!==null){if(Lv(e)){if(t!==void 0)I(23);return e[V].atom_}if(Pt(e))return e.atom_;if(pi(e)){if(t===void 0)return e.keysAtom_;let i=e.data_.get(t)||e.hasMap_.get(t);if(!i)I(25,t,Zm(e));return i}if(Dl(e)){var n,a;if(!t)return I(26);let i=e[V],l=(n=(a=i.values_.get(t))!=null?a:i.materializeLazyComputed_(t))!=null?n:i.materializeLazyObservable_(t);if(!l)I(27,t,Zm(e));return l}if(Bc(e)||Mr(e)||wr(e))return e}else if(ui(e)){if(wr(e[V]))return e[V]}I(28)}function jv(e,t){if(!e)I(29);if(t!==void 0)return jv(Or(e,t));if(Bc(e)||Mr(e)||wr(e))return e;if(pi(e)||Pt(e))return e;if(e[V])return e[V];I(24,e)}function Zm(e,t){let n;if(t!==void 0)n=Or(e,t);else if(ci(e))return e.name;else if(Dl(e)||pi(e)||Pt(e))n=jv(e);else n=Or(e);return n.name_}function mi(e){let t=hi(),n=!0;st();try{return e()}finally{ut(),kn(t)}}var R_=Ar.toString;var $m,OS=(($m=globalThis.Iterator)==null?void 0:$m.prototype)||{};function qv(e){return e[Symbol.iterator]=AS,At(Object.create(OS),e)}function AS(){return this}var Gv;if(!ya||!Fl)throw Error("mobx-react-lite requires React 18 or later");if(!((Gc==null||(Gv=Gc())==null?void 0:Gv.version)>=7))throw Error("mobx-react-lite requires mobx at least version 7 to be available");var TS=1e4,DS=1e4;class Jv{constructor(e){this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=(t=TS)=>{clearTimeout(this.sweepTimeout),this.sweepTimeout=void 0;let n=Date.now();if(this.registrations.forEach((a,i)=>{if(n-a.registeredAt>=t)this.finalize(a.value),this.registrations.delete(i)}),this.registrations.size>0)this.scheduleSweep()},this.finalizeAllImmediately=()=>{this.sweep(0)},this.finalize=e}register(e,t,n){this.registrations.set(n,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}unregister(e){this.registrations.delete(e)}scheduleSweep(){if(this.sweepTimeout===void 0)this.sweepTimeout=setTimeout(this.sweep,DS)}}var zS=typeof FinalizationRegistry<"u"?FinalizationRegistry:Jv,$c=new zS((e)=>{var t;(t=e.reaction)==null||t.dispose(),e.reaction=null}),RS=!1;function Fv(){return RS}function Yv(e){e.reaction=new Ml(`observer${e.name}`,()=>{e.stateVersion=Symbol(),e.onStoreChange==null||e.onStoreChange()})}function Wv(e,t="observed"){if(Fv())return e();let n=zt(null);if(!n.current){let o={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe(r){if($c.unregister(o),o.onStoreChange=r,!o.reaction)Yv(o),o.stateVersion=Symbol();return()=>{var u;o.onStoreChange=null,(u=o.reaction)==null||u.dispose(),o.reaction=null}},getSnapshot(){return o.stateVersion}};n.current=o}let a=n.current;if(!a.reaction)Yv(a),$c.register(n,a,a);zf(a.reaction,Mv),Fl(a.subscribe,a.getSnapshot,a.getSnapshot);let i,l;if(a.reaction.track(()=>{try{i=e()}catch(o){l=o}}),l)throw l;return i}var Kv,Xv,Pv=typeof Symbol==="function"&&Symbol.for,MS=(Kv=(Xv=Object.getOwnPropertyDescriptor(()=>{},"name"))==null?void 0:Xv.configurable)!=null?Kv:!1,Qv=Pv?Symbol.for("react.forward_ref"):typeof Ni==="function"&&Ni((e)=>null).$$typeof,Zv=Pv?Symbol.for("react.memo"):typeof Oi==="function"&&Oi((e)=>null).$$typeof;function L(e){if(Zv&&e.$$typeof===Zv)throw Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(Fv())return e;let t=!1,n=e,a=e.displayName||e.name;if(Qv&&e.$$typeof===Qv){if(t=!0,n=e.render,typeof n!=="function")throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function")}let i=(l,o)=>Wv(()=>n(l,o),a);if(i.displayName=e.displayName,MS)Object.defineProperty(i,"name",{value:e.name,writable:!0,configurable:!0});if(t)i=Ni(i);return i=Oi(i),kS(e,i),i}var CS={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function kS(e,t){Object.keys(e).forEach((n)=>{if(!CS[n])Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function US({children:e,render:t}){if(e&&t)console.error("MobX Observer: Do not use children and render in the same time in `Observer`");let n=e||t;if(typeof n!=="function")return null;return Wv(n)}US.displayName="Observer";function Vn(e,t){return ya(()=>Ne(e(),t,{autoBind:!0}))[0]}var $v,U_=($v=$c.finalizeAllImmediately)!=null?$v:()=>{};var VS=Symbol.for("react.transitional.element"),LS=Symbol.for("react.fragment");function Iv(e,t,n){var a=null;if(n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:VS,type:e,key:a,ref:t!==void 0?t:null,props:n}}var he=LS,s=Iv,p=Iv;var BS={close:s("path",{d:"M6 6l12 12M18 6L6 18"}),trash:s("path",{d:"M4 7h16M10 7V5h4v2M6 7l1 12h10l1-12M10 11v5M14 11v5"}),copy:s("path",{d:"M9 9h10v10H9zM5 15V5h10"}),external:s("path",{d:"M14 5h5v5M19 5l-8 8M18 14v5H5V6h5"}),dice:p(he,{children:[s("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}),s("circle",{cx:"9",cy:"9",r:"1.3",fill:"currentColor",stroke:"none"}),s("circle",{cx:"15",cy:"15",r:"1.3",fill:"currentColor",stroke:"none"}),s("circle",{cx:"12",cy:"12",r:"1.3",fill:"currentColor",stroke:"none"})]}),image:p(he,{children:[s("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),s("circle",{cx:"8.5",cy:"10",r:"1.5"}),s("path",{d:"M4 17l5-5 4 4 3-2 4 4"})]}),tag:p(he,{children:[s("path",{d:"M4 11V4h7l9 9-7 7-9-9z"}),s("circle",{cx:"8",cy:"8",r:"1.3",fill:"currentColor",stroke:"none"})]}),sparkle:s("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9zM18 15l.8 2.2L21 18l-2.2.8L18 21l-.8-2.2L15 18l2.2-.8z"}),play:s("path",{d:"M7 4l13 8-13 8z",fill:"currentColor",stroke:"none"}),pause:s("path",{d:"M8 5v14M16 5v14"}),save:s("path",{d:"M5 4h11l3 3v13H5zM8 4v6h7V4M8 20v-6h8v6"}),ghost:s("path",{d:"M5 20V10a7 7 0 0114 0v10l-2.3-2-2.4 2-2.3-2-2.4 2zM9.5 10h.01M14.5 10h.01"}),"panel-off":p(he,{children:[s("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),s("path",{d:"M4 5l16 14"})]}),"panel-bottom":p(he,{children:[s("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),s("path",{d:"M3 14h18"}),s("rect",{x:"4.5",y:"15.5",width:"15",height:"3",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-side":p(he,{children:[s("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),s("path",{d:"M14 4v16"}),s("rect",{x:"15.5",y:"5.5",width:"4",height:"13",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-left":p(he,{children:[s("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),s("path",{d:"M10 4v16"}),s("rect",{x:"4.5",y:"5.5",width:"4",height:"13",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-corner":p(he,{children:[s("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),s("rect",{x:"12.5",y:"12.5",width:"7",height:"6",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),swap:s("path",{d:"M4 8h13l-3-3M20 16H7l3 3"}),plus:s("path",{d:"M12 5v14M5 12h14"}),"copy-plus":s("path",{d:"M9 9h10v10H9zM5 15V5h10M14 12v4M12 14h4"}),pen:s("path",{d:"M4 20h4L20 8l-4-4L4 16zM14 6l4 4"}),broom:s("path",{d:"M19 4l-7 7M9.5 8.5l6 6-5 5-6-6zM4.5 13.5L2 21l7.5-2.5"}),expand:s("path",{d:"M4 9V4h5M20 15v5h-5M15 4h5v5M9 20H4v-5"}),shrink:s("path",{d:"M9 4v5H4M15 20v-5h5M20 9h-5V4M4 15h5v5"}),power:s("path",{d:"M12 3v9M7.5 6.5a7 7 0 109 0"}),warn:s("path",{d:"M12 4l9 16H3zM12 10v4M12 17h.01"}),link:s("path",{d:"M10 14a4 4 0 015.7 0l2.6-2.6a4 4 0 10-5.7-5.7L11 7.3M14 10a4 4 0 01-5.7 0l-2.6 2.6a4 4 0 105.7 5.7L13 16.7"}),unlink:s("path",{d:"M9 15l-1.6 1.6a4 4 0 01-5.7-5.7L3.3 9.3M15 9l1.6-1.6a4 4 0 015.7 5.7L20.7 14.7M4 4l16 16"}),grip:p(he,{children:[s("circle",{cx:"9",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),s("circle",{cx:"15",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),s("circle",{cx:"9",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),s("circle",{cx:"15",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),s("circle",{cx:"9",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"}),s("circle",{cx:"15",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"})]}),refresh:s("path",{d:"M20 11a8 8 0 10-2 6M20 6v5h-5"}),terminal:s("path",{d:"M4 5h16v14H4zM7 9l3 3-3 3M13 15h4"}),folder:s("path",{d:"M3 7h6l2 2h10v10H3z"}),dot:s("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor",stroke:"none"})};function D(e){return p("svg",{className:"icon",viewBox:"0 0 24 24",width:`${e.size??1.15}em`,height:`${e.size??1.15}em`,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":e.title==null,role:e.title==null?void 0:"img",children:[e.title==null?null:s("title",{children:e.title}),BS[e.name]]})}async function me(e,t){let n=await fetch(e,t),a=await n.json().catch(()=>null);if(!n.ok||a==null)throw Error(a?.error??`http ${n.status} on ${e}`);return a}function Jc(){return me("/drafts")}function eg(e){return me(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`)}function tg(e){return me(`/generate/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e.payload)})}function kl(e,t={}){return me(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.values),keepalive:t.keepalive===!0})}function Fc(e){return me(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"DELETE"})}function ng(e){return me(`/run/${encodeURIComponent(e.module)}`)}function Ur(e){return`/run/${encodeURIComponent(e.module)}/preview?t=${e.tick}`}function Wc(e){return me(`/lora-info/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`)}function ag(e){return me(`/lora-about/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`)}function Pc(e){return`/lora-preview/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`}function ig(){return me("/settings")}function lg(e){return me("/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}function og(){return me("/hosts")}function rg(e){return me(`/hosts/${encodeURIComponent(e.host)}/ping`)}function sg(e){return me(`/hosts/${encodeURIComponent(e.host)}/${e.action}`,{method:"POST"})}function ug(e){return me(`/hosts/${encodeURIComponent(e.host)}/logs`)}function cg(e){return me(`/hosts/${encodeURIComponent(e.module)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({host:e.host})})}function fg(){return me("/prompt-enhancers")}function dg(e){return me(`/prompt-enhancers/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({text:e.text})})}function hg(e){return me(`/prompt-enhancers/${encodeURIComponent(e.name)}`,{method:"DELETE"})}async function pg(e){let t=new Uint8Array(await e.file.arrayBuffer()),n="";for(let a=0;a<t.length;a+=32768)n+=String.fromCharCode(...t.subarray(a,a+32768));return me("/upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e.file.name,dataBase64:btoa(n)})})}function mg(e){if(e.target.kind==="image")return{url:e.target.url,title:e.target.title,promptId:e.target.promptId};let t=e.target.module,n=e.results.filter((l)=>l.module===t),a=n.length>e.target.after?n[0]:void 0,i=a?.images.find((l)=>l.url!=null);if(!e.isRunning&&i?.url!=null)return{url:i.url,title:i.filename,promptId:a?.promptId??null};return{url:Ur({module:t,tick:e.previewTick}),title:"latent preview",promptId:null}}async function vg(e){let t=await fetch(e);if(!t.ok)throw Error(`fetch failed (http ${t.status})`);let n=await t.blob(),a=n.type==="image/png"?n:await HS(n);await navigator.clipboard.write([new ClipboardItem({"image/png":a})])}async function HS(e){let t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let a=n.getContext("2d");if(a==null)throw Error("canvas 2d context unavailable");return a.drawImage(t,0,0),await new Promise((i,l)=>{n.toBlob((o)=>{if(o==null)l(Error("png encode failed"));else i(o)},"image/png")})}var gg=typeof navigator<"u"&&navigator.clipboard!=null;function jS(){return Vn(()=>({copyNote:null,lightbox:null,zoom:1,panX:0,panY:0,setCopyNote(e,t){this.copyNote={url:e,text:t}},openLightbox(e){this.lightbox=e,this.resetZoom()},closeLightbox(){this.lightbox=null,this.resetZoom()},zoomBy(e,t){let n=Math.min(8,Math.max(1,this.zoom*e));if(n===this.zoom)return;let a=n/this.zoom;if(this.panX=t.x-(t.x-this.panX)*a,this.panY=t.y-(t.y-this.panY)*a,this.zoom=n,n===1)this.panX=0,this.panY=0},panBy(e,t){if(this.zoom===1)return;this.panX+=e,this.panY+=t},resetZoom(){this.zoom=1,this.panX=0,this.panY=0}}))}var qS=L(function(t){let n=t.local.lightbox,a=n==null?null:mg({target:n,isRunning:t.st.run.isRunning,previewTick:t.st.run.previewTick,results:t.st.run.results});be(()=>{if(n==null)return;let o=(r)=>{if(r.key==="Escape")t.local.closeLightbox()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n,t.local]);let i=zt(null);if(be(()=>{let o=i.current;if(o==null)return;let r=(u)=>{u.preventDefault();let c=o.getBoundingClientRect();t.local.zoomBy(u.deltaY<0?1.2:0.8333333333333334,{x:u.clientX-c.left-c.width/2,y:u.clientY-c.top-c.height/2})};return o.addEventListener("wheel",r,{passive:!1}),()=>o.removeEventListener("wheel",r)},[n,t.local]),a==null)return null;let l=()=>{vg(a.url).then(()=>t.local.setCopyNote(a.url,"copied ✓")).catch((o)=>t.local.setCopyNote(a.url,`copy failed: ${o instanceof Error?o.message:String(o)}`))};return s("div",{className:"modal-overlay",onClick:()=>t.local.closeLightbox(),children:p("div",{className:"lightbox",onClick:(o)=>o.stopPropagation(),children:[s("div",{ref:i,className:t.local.zoom>1?"zoom-view grabbing":"zoom-view",onDoubleClick:()=>t.local.resetZoom(),onPointerDown:(o)=>{if(t.local.zoom===1)return;o.currentTarget.setPointerCapture(o.pointerId)},onPointerMove:(o)=>{if(o.buttons!==1)return;t.local.panBy(o.movementX,o.movementY)},children:s("img",{src:a.url,alt:a.title,draggable:!1,style:{transform:`translate(${t.local.panX}px, ${t.local.panY}px) scale(${t.local.zoom})`}})}),p("div",{className:"lightbox-bar",children:[s("span",{className:"hint","data-tip":a.title,children:a.title}),t.local.zoom>1?p("button",{type:"button","data-tip":"back to fit (or double click the image)",onClick:()=>t.local.resetZoom(),children:[t.local.zoom.toFixed(1),"× · fit"]}):s("span",{className:"hint",children:"scroll to zoom"}),gg?s("button",{type:"button",onClick:l,children:"copy"}):null,s("a",{href:a.url,target:"_blank",rel:"noreferrer",children:"open ↗"}),a.promptId!=null?t.st.hostActions.map((o)=>{let r=t.st.run.results.find((c)=>c.promptId===a.promptId),u=r?.images.findIndex((c)=>c.url===a.url)??-1;if(r==null||u<0)return null;return s("button",{type:"button",className:"host-action","data-tip":o.title,onClick:()=>t.st.postResultAction(o.id,r,{url:a.url,filename:a.title},u),children:o.label},o.id)}):null,a.promptId!=null?s("button",{type:"button","data-tip":"remove this result",onClick:()=>{if(a.promptId!=null)t.st.run.remove(a.promptId);t.local.closeLightbox()},children:"delete"}):null,t.local.copyNote?.url===a.url?s("span",{className:"hint",children:t.local.copyNote.text}):null,s("button",{type:"button","data-tip":"close (esc)",onClick:()=>t.local.closeLightbox(),children:s(D,{name:"close"})})]})]})})});function yg(e){let t=e.indexOf("</think>");if(t===-1)return e.trimStart().startsWith("<think>")?{thinking:e.replace(/^\s*<think>/,"").trim(),answer:""}:{thinking:null,answer:e.trim()};let n=e.slice(0,t).replace(/^\s*<think>/,"").trim();return{thinking:n===""?null:n,answer:e.slice(t+8).trim()}}var GS=L(function(t){let n=Vn(()=>({showThinking:!1,copied:!1,toggle(){this.showThinking=!this.showThinking},markCopied(){this.copied=!0}})),{thinking:a,answer:i}=yg(t.entry.text);return p("div",{className:"run-text",children:[p("div",{className:"run-text-head",children:[s("span",{className:"hint",children:t.entry.nodeKey??"text"}),a!=null?s("button",{type:"button",className:"link","data-tip":"the model's reasoning, before its answer",onClick:()=>n.toggle(),children:n.showThinking?"hide thinking":"thinking"}):null,gg?p("button",{type:"button",className:"link","data-tip":"copy this text",onClick:()=>{navigator.clipboard.writeText(i===""?t.entry.text:i),n.markCopied()},children:[s(D,{name:"copy"})," ",n.copied?"copied":""]}):null]}),a!=null&&n.showThinking?s("pre",{className:"run-thinking",children:a}):null,i===""?s("div",{className:"noimg",children:"the model reasoned past its token budget and never answered — raise max tokens"}):s("pre",{className:"run-text-body",children:i})]})}),YS=L(function(t){let{thinking:n,answer:a}=yg(t.text),i=zt(null);be(()=>{let o=i.current;if(o!=null)o.scrollTop=o.scrollHeight});let l=a!==""?a:n??"";return p("div",{className:"run-live",children:[a===""&&n!=null?s("span",{className:"hint",children:"thinking…"}):null,s("pre",{ref:i,className:a===""?"run-live-body dim":"run-live-body",children:l})]})}),KS=L(function(t){let n=t.st.run.runningModule;if(!t.st.run.isRunning||n==null)return null;let a=t.st.run.progressPercent,i=Ur({module:n,tick:t.st.run.previewTick}),l=t.st.run.progressNode,o=t.st.run.progressCount,r=t.st.run.progressText;return p("div",{className:"run-card running",children:[p("div",{className:"meta",children:[p("span",{children:["generating ",n,"…"]}),s("span",{children:a!=null?`${Math.round(a)}%`:""})]}),l!=null?p("div",{className:"run-node",children:[l,o!=null?` ${o.value}/${o.max}`:""]}):null,r!=null&&r!==""?s(YS,{text:r}):null,s("div",{className:"progress-track",children:s("div",{className:"progress-fill",style:{width:`${a??0}%`}})}),t.st.run.hasPreview&&t.st.showLatent?s("div",{className:"imgs",children:s("button",{type:"button",className:"img-button",onClick:()=>t.local.openLightbox({kind:"latent",module:n,after:t.st.run.results.filter((u)=>u.module===n).length}),children:s("img",{src:i,alt:"latent preview"})})}):null]})}),bg=L(function(t){let n=jS();if(t.st.run.results.length===0&&!t.st.run.isRunning)return null;let a=t.compact===!0?t.st.run.results.slice(0,1):t.st.run.results;return p("div",{className:"gallery",children:[s(KS,{st:t.st,local:n}),a.map((i)=>p("div",{className:"run-card",children:[p("div",{className:"meta",children:[p("span",{children:[i.at," · ",i.module,"/",i.draft," · ",(i.durationMs/1000).toFixed(1),"s",Object.entries(i.seeds).map(([l,o])=>` · ${l}: ${o}`)]}),s("button",{type:"button",className:"link","data-tip":"remove this result",onClick:()=>t.st.run.remove(i.promptId),children:s(D,{name:"trash"})})]}),p("div",{className:"imgs",children:[i.images.map((l,o)=>l.url!=null?p("div",{className:"img-cell",children:[s("button",{type:"button",className:"img-button","data-tip":l.filename,onClick:()=>{if(l.url!=null)n.openLightbox({kind:"image",url:l.url,title:l.filename,promptId:i.promptId})},children:s("img",{src:l.url,alt:l.filename})}),t.st.hostActions.length>0?p("div",{className:"host-actions",children:[t.st.hostActions.map((r)=>s("button",{type:"button",className:"host-action","data-tip":r.title,onClick:()=>{if(l.url!=null)t.st.postResultAction(r.id,i,{url:l.url,filename:l.filename},o)},children:r.label},r.id)),s("button",{type:"button",className:"host-action danger","data-tip":"remove this result",onClick:()=>t.st.run.remove(i.promptId),children:"✕"})]}):null]},l.filename):p("div",{className:"noimg",children:[l.filename," (not saved locally — no preview)"]},l.filename)),i.images.length===0&&(i.texts??[]).length===0?s("div",{className:"noimg",children:"no outputs"}):null]}),(i.texts??[]).map((l,o)=>s(GS,{entry:l},`${i.promptId}-${o}`))]},i.promptId)),s(qS,{st:t.st,local:n})]})});function XS(e){return e.split(/[/\\]/).filter((t)=>t!=="")}function QS(e){return XS(e).slice(0,-1)}function ZS(e){let t=e[0];if(t==null)return[];let n=[];for(let a=0;a<t.length;a++){let i=t[a];if(i==null||!e.every((l)=>l[a]===i))break;n.push(i)}return n}function Sg(e){if(e.length===0)return[];let t=e.map((l)=>QS(l.file)),n=ZS(t),a=Math.max(0,n.length-1),i=new Map;for(let[l,o]of e.entries()){let r=(t[l]??[]).slice(a).join("/"),u=i.get(r);if(u==null)i.set(r,[o]);else u.push(o)}return[...i.entries()].map(([l,o])=>({folder:l,modules:[...o].sort((r,u)=>r.module.localeCompare(u.module))})).sort((l,o)=>l.folder.localeCompare(o.folder))}var _g=L(function(t){let n=Sg(t.st.modules);return p("div",{className:"sidebar",children:[p("div",{className:"side-head",children:[s("span",{children:"workflows"}),s("button",{type:"button","data-tip":"close — reopen it by clicking the workflow name",onClick:()=>t.st.toggleSidebar(),children:s(D,{name:"close"})})]}),n.map((a)=>p("div",{className:"side-group",children:[a.folder===""?null:p("div",{className:"side-folder",children:[a.folder,"/"]}),s("div",{className:"side-branch",children:a.modules.map((i)=>p("div",{children:[p("div",{className:"side-module",children:[s("span",{className:"name",children:i.module}),s("span",{className:"host",children:i.host})]}),i.drafts.map((l)=>{let o=t.st.form?.moduleKey===i.module&&t.st.form?.draft===l;return s("button",{type:"button",className:o?"side-draft sel":"side-draft",onClick:()=>void t.st.select({module:i.module,draft:l}),children:l},l)})]},i.module))})]},a.folder)),Object.keys(t.st.loadErrors).length>0?p("div",{className:"side-errors",children:[s("div",{children:"failed to load:"}),Object.entries(t.st.loadErrors).map(([a,i])=>p("div",{children:[s("div",{className:"file",children:a}),s("div",{className:"msg",children:i})]},a))]}):null]})});function xg(e,t){let n=t.trim();return e.find((a)=>a.text.trim()===n)?.label??null}function $S(e){let t=e.split(`
10
- `).find((n)=>n.trim()!=="")??"";return t.length<=90?t:`${t.slice(0,89)}…`}var Vr=L(function(t){let n=t.v.desc.textPresets??[],[a,i]=ya(!1);if(n.length===0)return null;let l=typeof t.v.value==="string"?t.v.value:"",o=xg(n,l);return p("div",{className:"preset-box",onKeyDown:(r)=>r.key==="Escape"?i(!1):void 0,children:[p("button",{type:"button",className:"preset-btn","aria-expanded":a,"data-tip":"named starting texts — picking one replaces the field",onClick:()=>i(!a),children:[s(D,{name:"tag"})," presets ▾"]}),a?p(he,{children:[s("div",{className:"preset-backdrop",onClick:()=>i(!1)}),s("div",{className:"preset-menu",children:n.map((r)=>p("button",{type:"button",className:r.label===o?"preset-item on":"preset-item",onClick:()=>{t.v.set(r.text),i(!1)},children:[p("span",{className:"preset-name",children:[r.label===o?"• ":"  ",r.label]}),s("span",{className:"preset-peek",children:$S(r.text)})]},r.label))})]}):null]})});function Ul(e){let t={};if(typeof e==="object"&&e!==null&&!Array.isArray(e)){for(let[n,a]of Object.entries(e))if(typeof a==="string")t[n]=a}return t}function gi(e){return e==="openrouter"?"https://openrouter.ai/api/v1":"http://localhost:3000"}function Lr(e){return e.trim().replace(/\/+$/,"")}function JS(e){let t=Lr(e.baseUrl)===""?gi(e.provider):Lr(e.baseUrl);return e.provider==="openrouter"?`${t}/models`:`${t}/api/models`}function FS(e){let t=Lr(e.baseUrl)===""?gi(e.provider):Lr(e.baseUrl);return e.provider==="openrouter"?`${t}/chat/completions`:`${t}/api/chat/completions`}function vi(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{}}function an(e){return typeof e==="string"?e:""}function WS(e){let t=vi(e).data;if(!Array.isArray(t))return[];let n=[];for(let a of t){let i=vi(a),l=an(i.id);if(l==="")continue;let o=i.supported_parameters,r=Array.isArray(o)?o.includes("reasoning"):null;n.push({id:l,name:an(i.name)===""?l:an(i.name),reasoning:r})}return n.sort((a,i)=>a.id.localeCompare(i.id)),n}async function Eg(e,t){let n=await e.text().catch(()=>"");return Error(`llm ${t} failed: http ${e.status} ${n.slice(0,300)}`)}function wg(e,t){if(e instanceof Error&&e.name==="AbortError")return e;let n=e instanceof Error?e.message:String(e);return Error(`could not reach ${t} (${n}) — is it running, and does it allow this origin? open webui needs CORS_ALLOW_ORIGIN`)}async function Ng(e){let t=JS(e),n;try{n=await fetch(t,{headers:Og(e)})}catch(a){throw wg(a,t)}if(!n.ok)throw await Eg(n,"model list");return WS(await n.json())}function Og(e){return e.key.trim()===""?{}:{Authorization:`Bearer ${e.key.trim()}`}}function PS(e){let t=e.provider==="openrouter"&&e.effort!=="off"?{reasoning:{effort:e.effort}}:{};return{model:e.model,stream:!0,messages:[{role:"system",content:e.system},{role:"user",content:e.user}],...t}}function IS(e){let t=e.split(`
11
- `),n=t.pop()??"",a=[];for(let i of t){let l=i.trim();if(l===""||l.startsWith(":"))continue;if(l.startsWith("data:"))a.push(l.slice(5).trim())}return{events:a,rest:n}}function e_(e){if(e===""||e==="[DONE]")return null;let t;try{t=JSON.parse(e)}catch{return null}let n=vi(t),a=vi(n.error);if(an(a.message)!=="")throw Error(`llm stream error: ${an(a.message)}`);let i=n.choices;if(!Array.isArray(i))return null;let l=vi(vi(i[0]).delta),o=an(l.content),r=an(l.reasoning)===""?an(l.reasoning_content):an(l.reasoning);if(o===""&&r==="")return null;return{content:o,reasoning:r}}class Ag{inside=!1;pending="";feed(e){let t=this.pending+e;this.pending="";let n="",a="";for(;;){let l=this.inside?"</think>":"<think>",o=t.indexOf(l);if(o===-1)break;let r=t.slice(0,o);if(this.inside)a+=r;else n+=r;t=t.slice(o+l.length),this.inside=!this.inside}let i=t_(t);if(i!==-1)this.pending=t.slice(i),t=t.slice(0,i);if(this.inside)a+=t;else n+=t;return{content:n,reasoning:a}}flush(){let e=this.pending;return this.pending="",this.inside?{content:"",reasoning:e}:{content:e,reasoning:""}}}function t_(e){let t=e.lastIndexOf("<");if(t===-1)return-1;let n=e.slice(t);return"<think>".startsWith(n)||"</think>".startsWith(n)?t:-1}async function Tg(e){if(e.endpoint.provider==="openrouter"&&e.endpoint.key.trim()==="")throw Error("no openrouter api key — paste one in the enhancer settings");if(e.model.trim()==="")throw Error("no model selected");let t=FS(e.endpoint),n;try{n=await fetch(t,{method:"POST",headers:{...Og(e.endpoint),"content-type":"application/json"},body:JSON.stringify(PS({...e,provider:e.endpoint.provider})),signal:e.signal})}catch(c){throw wg(c,t)}if(!n.ok)throw await Eg(n,"refine");let a=n.body?.getReader();if(a==null)throw Error("llm refine failed: the response carried no stream");let i=new TextDecoder,l=new Ag,o={content:"",reasoning:""},r=(c)=>{if(c.content===""&&c.reasoning==="")return;o.content+=c.content,o.reasoning+=c.reasoning,e.onDelta(c)},u="";for(;;){let c=await a.read();if(c.done)break;u+=i.decode(c.value,{stream:!0});let m=IS(u);u=m.rest;for(let y of m.events){let h=e_(y);if(h==null)continue;let g=l.feed(h.content);r({content:g.content,reasoning:g.reasoning+h.reasoning})}}if(r(l.flush()),o.content.trim()==="")throw Error("the model returned no prompt text — try another model");return o}var Rg="comfy-ts-serve-enhancer",n_={openrouter:"anthropic/claude-sonnet-5",openwebui:""},Mg=["openrouter","openwebui"];function Cg(e){return e==="openrouter"||e==="openwebui"}function kg(e){return e==="off"||e==="low"||e==="medium"||e==="high"}function Dg(e){let t=typeof e==="object"&&e!==null?e:{},n=Ul(t.modelByProvider),a=Ul(t.baseUrlByProvider);return{provider:Cg(t.provider)?t.provider:"openrouter",keyByProvider:Ul(t.keyByProvider),baseUrlByProvider:{openrouter:gi("openrouter"),openwebui:gi("openwebui"),...a},modelByProvider:{...n_,...n},effort:kg(t.effort)?t.effort:"medium",thinkingOnly:t.thinkingOnly!==!1,presetName:typeof t.presetName==="string"?t.presetName:"",presetByModule:Ul(t.presetByModule)}}function zg(e,t){if(!t.includes(e))return e;for(let n=2;n<1000;n++){let a=`${e} ${n}`;if(!t.includes(a))return a}return`${e} ${t.length+1}`}function a_(){try{return Dg(JSON.parse(localStorage.getItem(Rg)??"{}"))}catch{return Dg({})}}class Ic{provider;keyByProvider;baseUrlByProvider;modelByProvider;effort;thinkingOnly;presetName;presetByModule;presets=[];presetsState="idle";presetsError="";saveState="saved";saveError="";models=[];modelsState="idle";modelsError="";target=null;targetModule="";original="";result="";thinking="";phase="idle";error="";abort=null;disposer;lastSaved="";constructor(){let e=a_();this.provider=e.provider,this.keyByProvider=e.keyByProvider,this.baseUrlByProvider=e.baseUrlByProvider,this.modelByProvider=e.modelByProvider,this.effort=e.effort,this.thinkingOnly=e.thinkingOnly,this.presetName=e.presetName,this.presetByModule=e.presetByModule,nn(this,{abort:!1,disposer:!1,lastSaved:!1}),this.disposer=Cr(()=>{let t=this.preset;return t==null?null:JSON.stringify(t)},(t)=>{if(t==null||t===this.lastSaved)return;this.savePresetNow(JSON.parse(t))},{delay:600})}dispose(){this.disposer()}get apiKey(){return this.keyByProvider[this.provider]??""}get baseUrl(){return this.baseUrlByProvider[this.provider]??gi(this.provider)}get model(){return this.modelByProvider[this.provider]??""}get endpoint(){return{provider:this.provider,baseUrl:this.baseUrl,key:this.apiKey}}get visibleModels(){return this.thinkingOnly?this.models.filter((e)=>e.reasoning!==!1):this.models}get preset(){return this.presets.find((e)=>e.name===this.presetName)??this.presets[0]??null}get isOpen(){return this.target!=null}settingsJSON(){return{provider:this.provider,keyByProvider:this.keyByProvider,baseUrlByProvider:this.baseUrlByProvider,modelByProvider:this.modelByProvider,effort:this.effort,thinkingOnly:this.thinkingOnly,presetName:this.presetName,presetByModule:this.presetByModule}}persist(){try{localStorage.setItem(Rg,JSON.stringify(this.settingsJSON()))}catch{}}setProvider(e){if(!Cg(e))return;this.provider=e,this.models=[],this.modelsState="idle",this.modelsError="",this.persist()}setApiKey(e){this.keyByProvider[this.provider]=e.trim(),this.persist()}setBaseUrl(e){this.baseUrlByProvider[this.provider]=e.trim(),this.persist()}setModel(e){this.modelByProvider[this.provider]=e,this.persist()}setEffort(e){if(!kg(e))return;this.effort=e,this.persist()}toggleThinkingOnly(){this.thinkingOnly=!this.thinkingOnly,this.persist()}async loadPresets(){E(()=>{this.presetsState="loading",this.presetsError=""});try{let e=await fg();E(()=>{if(this.presets=e.enhancers,this.presetsState="idle",!this.presets.some((t)=>t.name===this.presetName))this.presetName=this.presets[0]?.name??"";this.lastSaved=JSON.stringify(this.preset)})}catch(e){E(()=>{this.presetsState="error",this.presetsError=e instanceof Error?e.message:String(e)})}}async savePresetNow(e){E(()=>{this.saveState="saving",this.lastSaved=JSON.stringify(e)});try{let t=await dg(e);E(()=>{this.presets=t.enhancers,this.saveState="saved",this.saveError=""})}catch(t){E(()=>{this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)})}}selectPreset(e){if(!this.presets.some((t)=>t.name===e))return;if(this.presetName=e,this.lastSaved=JSON.stringify(this.preset),this.targetModule!=="")this.presetByModule[this.targetModule]=e;this.persist()}setPresetText(e){let t=this.preset;if(t==null)return;this.presets=this.presets.map((n)=>n.name===t.name?{...n,text:e}:n)}addPreset(e,t=""){if(e.trim()==="")return;let n=zg(e.trim(),this.presets.map((a)=>a.name));this.presets=[...this.presets,{name:n,text:t}],this.presetName=n,this.persist(),this.savePresetNow({name:n,text:t})}duplicatePreset(){let e=this.preset;if(e!=null)this.addPreset(`${e.name} copy`,e.text)}async renamePreset(e){let t=this.preset,n=zg(e.trim(),this.presets.filter((a)=>a.name!==t?.name).map((a)=>a.name));if(t==null||n===""||n===t.name)return;await this.savePresetNow({name:n,text:t.text}),E(()=>{this.presetName=n,this.persist()}),await this.removePresetFile(t.name)}async deletePreset(){let e=this.preset;if(e==null)return;await this.removePresetFile(e.name),E(()=>{for(let[t,n]of Object.entries(this.presetByModule))if(n===e.name)delete this.presetByModule[t];if(!this.presets.some((t)=>t.name===this.presetName))this.presetName=this.presets[0]?.name??"";this.persist()})}async removePresetFile(e){try{let t=await hg({name:e});E(()=>{this.presets=t.enhancers})}catch(t){E(()=>{this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)})}}openFor(e){this.target=e.v,this.targetModule=e.module,this.original=typeof e.v.value==="string"?e.v.value:"",this.result="",this.thinking="",this.error="",this.phase="idle";let t=this.presetByModule[e.module];if(t!=null)this.presetName=t;if(this.presets.length===0)this.loadPresets()}close(){this.cancel(),this.target=null,this.targetModule=""}setResult(e){this.result=e}setOriginal(e){this.original=e}async loadModels(){E(()=>{this.modelsState="loading",this.modelsError=""});try{let e=await Ng(this.endpoint);E(()=>{this.models=e,this.modelsState="idle"})}catch(e){E(()=>{this.modelsState="error",this.modelsError=e instanceof Error?e.message:String(e)})}}cancel(){if(this.abort?.abort(),this.abort=null,this.phase==="running")this.phase=this.result===""?"idle":"done"}run(){this.runNow()}async runNow(){let e=this.preset;if(e==null||this.phase==="running")return;let t=new AbortController;this.abort=t,E(()=>{this.phase="running",this.error="",this.result="",this.thinking=""});try{await Tg({endpoint:this.endpoint,model:this.model,system:e.text,user:this.original,effort:this.effort,signal:t.signal,onDelta:(n)=>E(()=>{this.result+=n.content,this.thinking+=n.reasoning})}),E(()=>{this.phase="done"})}catch(n){let a=t.signal.aborted;E(()=>{if(this.phase=a?this.result===""?"idle":"done":"error",!a)this.error=n instanceof Error?n.message:String(n)})}finally{if(this.abort===t)this.abort=null}}apply(){let e=this.result.trim();if(this.target==null||e==="")return;this.target.set(e),this.close()}}var i_=["off","low","medium","high"],l_={openrouter:"openrouter (cloud)",openwebui:"open webui (local)"},o_=L(function(t){let n=t.e.visibleModels,a=t.e.provider==="openwebui";return p("div",{children:[s("div",{className:"section-title",children:"provider · keys stay in this browser"}),p("div",{className:"enh-row",children:[s("select",{value:t.e.provider,onChange:(i)=>t.e.setProvider(i.target.value),children:Mg.map((i)=>s("option",{value:i,children:l_[i]},i))}),a?s("input",{type:"text",placeholder:"http://localhost:3000",value:t.e.baseUrl,onChange:(i)=>t.e.setBaseUrl(i.target.value),style:{flex:1,minWidth:180}}):null,s("input",{type:"password",placeholder:a?"open webui api key (blank if none)":"sk-or-v1-… (localStorage only)",value:t.e.apiKey,onChange:(i)=>t.e.setApiKey(i.target.value),style:{flex:1,minWidth:160}}),s("button",{type:"button",onClick:()=>void t.e.loadModels(),disabled:t.e.modelsState==="loading",children:t.e.modelsState==="loading"?"loading…":"load models"})]}),p("div",{className:"enh-row",children:[n.length>0?p("select",{value:t.e.model,onChange:(i)=>t.e.setModel(i.target.value),style:{flex:1},children:[n.some((i)=>i.id===t.e.model)?null:p("option",{value:t.e.model,children:[t.e.model," (not in the list)"]}),n.map((i)=>s("option",{value:i.id,children:i.id},i.id))]}):s("input",{type:"text",placeholder:a?"model id, e.g. qwen3:8b":"model id, e.g. anthropic/claude-sonnet-5",value:t.e.model,onChange:(i)=>t.e.setModel(i.target.value),style:{flex:1}}),p("label",{className:"row-inline","data-tip":"hide models that report no reasoning support",children:[s("input",{type:"checkbox",checked:t.e.thinkingOnly,onChange:()=>t.e.toggleThinkingOnly()}),s("span",{className:"hint",children:"thinking only"})]}),a?null:p("label",{className:"row-inline","data-tip":"reasoning effort sent to the model",children:[s("span",{className:"hint",children:"effort"}),s("select",{value:t.e.effort,onChange:(i)=>t.e.setEffort(i.target.value),children:i_.map((i)=>s("option",{value:i,children:i},i))})]})]}),a?s("div",{className:"hint",children:"a local model's <think> block is routed to the thinking pane, never into your prompt"}):null,t.e.modelsError!==""?p("div",{className:"error",children:["\uD83D\uDD34 ",t.e.modelsError]}):null]})}),r_=L(function(t){let n=t.e.preset;if(n==null)return p("div",{children:[s("div",{className:"section-title",children:"master prompt"}),s("div",{className:"hint",children:t.e.presetsState==="loading"?"loading .comfy-ts/prompt-enhancers/…":"no master prompt yet"}),t.e.presetsError!==""?p("div",{className:"error",children:["\uD83D\uDD34 ",t.e.presetsError]}):null,s("button",{type:"button",onClick:()=>t.e.addPreset("refine-prompt"),children:"create one"})]});let a=()=>{let o=window.prompt("rename this master prompt (renames the file)",n.name);if(o!=null)t.e.renamePreset(o)},i=()=>{let o=window.prompt("name the new master prompt","refine-<model>-prompt");if(o!=null)t.e.addPreset(o)},l=()=>{if(window.confirm(`delete master prompt '${n.name}'? the .md file is removed.`))t.e.deletePreset()};return p("div",{children:[p("div",{className:"section-title",children:["master prompt · one per image model · .comfy-ts/prompt-enhancers/",n.name,".md"]}),p("div",{className:"enh-row",children:[s("select",{value:n.name,onChange:(o)=>t.e.selectPreset(o.target.value),style:{flex:1},children:t.e.presets.map((o)=>s("option",{value:o.name,children:o.name},o.name))}),s("button",{type:"button",onClick:i,children:"new"}),s("button",{type:"button",onClick:()=>t.e.duplicatePreset(),children:"duplicate"}),s("button",{type:"button",onClick:a,children:"rename"}),s("button",{type:"button",onClick:l,"data-tip":"delete this master prompt file",children:s(D,{name:"close"})}),p("span",{className:"hint",children:[t.e.saveState==="saving"?"saving…":null,t.e.saveState==="saved"?"autosaved to disk":null,t.e.saveState==="error"?`\uD83D\uDD34 save failed: ${t.e.saveError}`:null]})]}),s("textarea",{rows:8,value:n.text,onChange:(o)=>t.e.setPresetText(o.target.value)})]})}),s_=L(function(t){let n=t.e;be(()=>{let i=(l)=>{if(l.key==="Escape")n.close();if(l.key==="Enter"&&(l.metaKey||l.ctrlKey))l.preventDefault(),n.run()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[n]);let a=n.phase==="running";return s("div",{className:"modal-overlay",onClick:()=>n.close(),children:p("div",{className:"modal",onClick:(i)=>i.stopPropagation(),children:[p("div",{className:"modal-head",children:[p("b",{style:{flex:1},children:[s(D,{name:"sparkle"})," enhance prompt"]}),s("button",{type:"button",onClick:()=>n.close(),children:s(D,{name:"close"})})]}),p("div",{className:"modal-body",children:[s(o_,{e:n}),s(r_,{e:n}),s("div",{className:"section-title",children:"prompt"}),p("div",{className:"enh-cols",children:[p("div",{children:[s("div",{className:"hint",children:"yours (edit before refining, the var is untouched)"}),s("textarea",{rows:8,value:n.original,onChange:(i)=>n.setOriginal(i.target.value)})]}),p("div",{children:[s("div",{className:"hint",children:a?"rewriting…":"rewritten (editable before apply)"}),s("textarea",{rows:8,value:n.result,placeholder:"hit enhance",onChange:(i)=>n.setResult(i.target.value)})]})]}),n.thinking!==""?p("div",{children:[s("div",{className:"section-title",children:"thinking"}),s("div",{className:"enh-think",children:n.thinking})]}):null,n.error!==""?p("div",{className:"error",children:["\uD83D\uDD34 ",n.error]}):null]}),p("div",{className:"modal-foot",children:[a?s("button",{type:"button",onClick:()=>n.cancel(),children:"stop"}):s("button",{type:"button",className:"primary",onClick:()=>n.run(),"data-tip":"⌘⏎ / ctrl+⏎",children:"enhance"}),s("button",{type:"button",onClick:()=>n.apply(),disabled:n.result.trim()==="",children:"apply to prompt"}),s("span",{className:"hint",style:{flex:1},children:a?`${n.result.length} chars streamed`:"nothing is written until you apply"}),s("button",{type:"button",className:"link",onClick:()=>n.close(),children:"cancel"})]})]})})}),Ug=L(function(t){let n=t.st.enhancer;return p(he,{children:[p("button",{type:"button",className:"link","data-tip":"rewrite this prompt with an llm",onClick:()=>n.openFor({v:t.v,module:t.module}),children:[s(D,{name:"sparkle"})," enhance"]}),n.target===t.v?s(s_,{e:n}):null]})});var Vg=L(function(t){let n=typeof t.v.value==="string"?t.v.value:"",a=Math.min(12,Math.max(4,n.split(`
12
- `).length+1)),i=t.st.form?.loraKeywordsFor(t.v)??[];return p("div",{children:[i.length>0?s("div",{className:"kw-prefix","data-tip":"added in front of your prompt at run time, one per active lora",children:i.map((l)=>s("span",{className:"kw-chip",children:l},l))}):null,s("textarea",{rows:a,value:n,onChange:(l)=>t.v.set(l.target.value)}),p("div",{className:"row-inline",children:[s("span",{className:"hint",children:'// line = comment · "- " line = negative prompt'}),s(Vr,{v:t.v}),s(Ug,{v:t.v,st:t.st,module:t.module})]})]})}),Lg=L(function(t){let n=typeof t.v.value==="string"?t.v.value:"",a=t.v.desc.textPresets??[];if(t.v.desc.multiline===!0){let i=Math.min(12,Math.max(3,n.split(`
13
- `).length+1));return p("div",{children:[s("textarea",{rows:i,value:n,onChange:(l)=>t.v.set(l.target.value)}),a.length>0?s("div",{className:"row-inline",children:s(Vr,{v:t.v})}):null]})}if(a.length===0)return s("input",{type:"text",value:n,onChange:(i)=>t.v.set(i.target.value)});return p("div",{className:"row-inline",children:[s("input",{type:"text",style:{flex:1},value:n,onChange:(i)=>t.v.set(i.target.value)}),s(Vr,{v:t.v})]})}),Bg=L(function(t){let n=t.v.desc.kind==="int",a=typeof t.v.value==="number"?t.v.value:0,i=t.v.desc.min,l=t.v.desc.max,o=(r)=>{let u=n?parseInt(r,10):parseFloat(r);if(Number.isFinite(u))t.v.set(u)};return p("div",{className:"row-inline",children:[s("input",{type:"number",value:a,step:n?1:"any",min:i,max:l,onChange:(r)=>o(r.target.value)}),i!=null&&l!=null?s("input",{type:"range",style:{flex:1,minWidth:120},value:a,min:i,max:l,step:n?1:(l-i)/200,onChange:(r)=>o(r.target.value)}):null,i!=null||l!=null?s("span",{className:"hint",children:`${i??"-∞"} … ${l??"∞"}`}):null]})}),Hg=L(function(t){return p("label",{className:"row-inline",style:{cursor:"pointer"},children:[s("input",{type:"checkbox",checked:t.v.value===!0,onChange:(n)=>t.v.set(n.target.checked)}),s("span",{className:"hint",children:t.v.value===!0?"on":"off"})]})}),jg=L(function(t){let n=t.v.desc.choices??[],a=typeof t.v.value==="string"?t.v.value:"";return p("select",{value:a,onChange:(i)=>t.v.set(i.target.value),children:[n.includes(a)?null:s("option",{value:a,disabled:!0,children:a===""?"(unset)":`${a} (not on this host)`}),n.map((i)=>s("option",{value:i,children:i},i))]})});var qg=L(function(t){let n=zt(null),a=typeof t.v.value==="string"?t.v.value:"",i=/^https?:\/\//.test(a)?a:t.v.uploadedUrl,l=t.v.desc.extensions??[],o=async(r)=>{if(r==null)return;try{let u=await pg({file:r});t.v.set(u.path),t.v.setUploadedUrl(u.url)}catch(u){alert(`upload failed: ${u instanceof Error?u.message:String(u)}`)}};return p("div",{children:[p("div",{className:"row-inline",children:[s("input",{type:"text",style:{flex:1},placeholder:"local path or http(s) url",value:a,onChange:(r)=>{t.v.set(r.target.value),t.v.setUploadedUrl(null)}}),s("button",{type:"button",onClick:()=>n.current?.click(),children:"upload…"}),a!==""?s("button",{type:"button","data-tip":"clear the image",onClick:()=>{t.v.set(""),t.v.setUploadedUrl(null)},children:s(D,{name:"close"})}):null,s("input",{ref:n,type:"file",accept:l.map((r)=>`.${r}`).join(","),style:{display:"none"},onChange:(r)=>{o(r.target.files?.[0]),r.target.value=""}})]}),i!=null&&i!==""?s("div",{className:"img-preview",children:s("img",{src:i,alt:a})}):null]})});function Ue(e,t){console.error(`\uD83D\uDD34 [comfy-ts serve] ${e}: ${t instanceof Error?t.message:String(t)}`)}function Gg(e){let t={};for(let n of e)if(n.kind!=="seed")t[n.name]=n.value;return t}function pa(e){if(typeof e==="number"&&Number.isFinite(e))return{mode:"=",value:e};if(e!=null&&typeof e==="object"){let t=e;return{mode:typeof t.mode==="string"?t.mode:"=",value:typeof t.value==="number"&&Number.isFinite(t.value)?t.value:0}}return{mode:"=",value:0}}function ef(e){if(e!=null&&typeof e==="object"){let t=e;if(typeof t.width==="number"&&typeof t.height==="number")return{width:t.width,height:t.height}}return{width:1024,height:1024}}function tf(e,t){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let n=new Set(t),a={};for(let[i,l]of Object.entries(e))if(n.has(i)&&Br(l))a[i]=l;return a}function Yg(e,t){if(e.kind==="seed")return pa(t??e.default);if(e.kind==="size")return ef(t??e.default);if(e.kind==="loras")return tf(t??e.default,e.options??[]);return t??e.default}function Kg(){return Math.floor(Math.random()*4294967296)}function Br(e){return e!=null&&e!==!1}function Hr(e){if(typeof e==="number"&&Number.isFinite(e))return{model:e,clip:e};if(Array.isArray(e)&&typeof e[0]==="number"&&typeof e[1]==="number")return{model:e[0],clip:e[1]};return{model:1,clip:1}}function Xg(e,t,n,a){let i={...e};if(!n)i[t]=!1;else{let l=a??Hr(e[t]);i[t]=[l.model,l.clip]}return i}function Qg(e){let t=new Set(e.options),n=Object.keys(e.record).filter((i)=>t.has(i)&&(Br(e.record[i])||e.paused.has(i))),a=[...e.paused].filter((i)=>t.has(i)&&!n.includes(i));return[...n,...a].reverse()}function Zg(e){let t=[...e.displayed],[n]=t.splice(e.from,1);if(n==null)return e.record;t.splice(e.to,0,n);let a={};for(let i of[...t].reverse())if(i in e.record)a[i]=e.record[i];for(let[i,l]of Object.entries(e.record))if(!(i in a))a[i]=l;return a}function $g(e,t,n){return{...e,[t]:[n.model,n.clip]}}var nf="application/x-comfy-lora";function u_(e){if(e!=null&&typeof e==="object"&&!Array.isArray(e))return e;return{}}var Jg=L(function(t){let n=Vn(()=>({open:!1,filter:"",info:new Map,previewFailed:new Set,prevStrength:new Map,paused:new Set,setOpen(S){this.open=S},setFilter(S){this.filter=S},noteInfo(S,T){this.info.set(S,T)},notePreviewFailed(S){this.previewFailed.add(S)},notePrevStrength(S,T){this.prevStrength.set(S,T)},setPaused(S,T){if(T)this.paused.add(S);else this.paused.delete(S)},details:null,setDetails(S){this.details=S},split:new Map,isSplit(S,T){return this.split.get(S)??T},setSplit(S,T){this.split.set(S,T)}})),a=u_(t.v.value),i=t.v.desc.options??[],l=t.v.desc.optionLabels??{},o=(S)=>l[S]??S,r=(S)=>Br(a[S]),u=(S)=>r(S)||n.paused.has(S),c=Qg({record:a,options:i,paused:n.paused}),m=new Set(t.v.desc.managerOnlyOptions??[]),y="on disk and known to the lora manager, but ComfyUI has not scanned it: it refuses the prompt. only restarting ComfyUI makes it re-read the folder",h=(S)=>m.has(S)?s("span",{className:"lora-warn","data-tip":"on disk and known to the lora manager, but ComfyUI has not scanned it: it refuses the prompt. only restarting ComfyUI makes it re-read the folder",children:s(D,{name:"warn",size:0.9})}):null,g=c.filter((S)=>m.has(S)),x=t.st.showLoraImages,A=t.st.showLoraTitles,M=(S,T)=>{n.setPaused(S,!1);let Y={...a};if(T==null)delete Y[S];else Y[S]=T;t.v.set(Y)},d=(S,T)=>{if(!T)n.notePrevStrength(S,Hr(a[S]));n.setPaused(S,!T),t.v.set(Xg(a,S,T,T?n.prevStrength.get(S):void 0))},f=(S,T)=>{if(!r(S)){n.notePrevStrength(S,T);return}t.v.set($g(a,S,T))},v=(S)=>{let T=r(S)?Hr(a[S]):n.prevStrength.get(S)??{model:1,clip:1},Y=n.isSplit(S,T.model!==T.clip),bt=(yi,bi)=>{if(!Number.isFinite(bi))return;let ma=Math.round(bi*100)/100;if(yi==="both")return f(S,{model:ma,clip:ma});f(S,yi==="model"?{model:ma,clip:T.clip}:{model:T.model,clip:ma})},Ln=(yi,bi,ma,Sy)=>p("div",{className:"st-line",children:[s("button",{type:"button",className:"st-label","data-tip":Sy,onClick:()=>n.setSplit(S,!Y),children:ma}),s("input",{type:"range",min:-1,max:2,step:0.05,value:bi,onChange:(Kr)=>bt(yi,parseFloat(Kr.target.value))}),s("input",{type:"number",step:0.05,value:bi,onChange:(Kr)=>bt(yi,parseFloat(Kr.target.value))})]});if(!Y)return Ln("both",T.model,"m+c","model and clip together — click to set them apart");return p(he,{children:[Ln("model",T.model,"m","model strength — click to tie them back together"),Ln("clip",T.clip,"c","clip strength — click to tie them back together")]})},b=n.open,w=t.host,k=c.join(`
14
- `);be(()=>{if(!b)return;for(let S of k.split(`
15
- `)){if(S===""||n.info.has(S))continue;n.noteInfo(S,"loading"),Wc({host:w,name:S}).then((T)=>n.noteInfo(S,T)).catch(()=>n.noteInfo(S,"error"))}},[b,k,w,n]),be(()=>{if(!b)return;let S=(T)=>{if(T.key==="Escape")n.setOpen(!1)};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[b,n]);let O=n.filter.toLowerCase(),R=(S)=>S.toLowerCase().includes(O)||o(S).toLowerCase().includes(O),U=i.filter(R),B=t.st.loraCap,ft=U.filter((S)=>!u(S)).slice(0,B),qr=(S)=>{let T=S.split(/[\\/]+/);return T.length<=1?"":T.slice(0,-1).join("/")},yy=(()=>{let S=new Map;for(let T of ft){let Y=qr(T),bt=S.get(Y);if(bt==null)S.set(Y,[T]);else bt.push(T)}return[...S.entries()].map(([T,Y])=>({folder:T,names:Y})).sort((T,Y)=>T.folder.localeCompare(Y.folder))})(),Gr=zt(null);be(()=>{if(!b)return;let S=Gr.current;if(S==null)return;S.focus(),S.select()},[b]);let by=()=>{let S=ft[0];if(S==null)return;M(S,[1,1]),Gr.current?.select()},Yr=(S)=>{if(!x)return null;return n.previewFailed.has(S)?s("div",{className:"lora-thumb none",children:"no preview"}):s("img",{className:t.st.loraFill?"lora-thumb fill":"lora-thumb",loading:"lazy",src:Pc({host:t.host,name:S}),alt:o(S),onError:()=>n.notePreviewFailed(S)},S)},pf=p(he,{children:[s("button",{type:"button",className:x?"mode sel":"mode","data-tip":x?"hide lora images":"show lora images",onClick:()=>t.st.toggleLoraImages(),children:s(D,{name:"image"})}),s("button",{type:"button",className:A?"mode sel":"mode","data-tip":A?"hide lora titles":"show lora titles",onClick:()=>t.st.toggleLoraTitles(),children:s(D,{name:"tag"})}),x?s("button",{type:"button",className:t.st.loraFill?"mode sel":"mode","data-tip":t.st.loraFill?"fit the whole preview inside the card":"fill the card with the preview",onClick:()=>t.st.toggleLoraFill(),children:s(D,{name:t.st.loraFill?"shrink":"expand"})}):null]});return p("div",{children:[p("div",{className:"lora-actions",children:[p("button",{type:"button",className:"field-height",onClick:()=>n.setOpen(!0),children:[s(D,{name:"plus"})," ",c.length===0?`add loras (${i.length})`:"add"]}),s("span",{className:"btn-group field-height",children:pf}),p("button",{type:"button",className:"field-height",disabled:t.st.loraSyncing,"data-tip":"re-download the lora metadata from the lora manager on this host (names, trigger words, previews)",onClick:()=>void t.st.refreshLoras(),children:[s(D,{name:"refresh"})," ",t.st.loraSyncing?"syncing…":"sync"]}),g.length>0?p("button",{type:"button",className:"field-height warn-action",disabled:t.st.hostWatch==="down","data-tip":`${g.length} lora(s) here are on disk but ComfyUI has not scanned them, so it refuses the prompt. Only a RESTART makes it re-read its models folder: refetching the schema just re-reads the same list. then hit refresh here and the var widens in place`,onClick:()=>void t.st.hostAction("restart"),children:[s(D,{name:"power"})," restart ComfyUI"]}):null,t.hostUrl==null?null:p("a",{className:"button-link field-height",href:`${t.hostUrl}/loras`,target:"_blank",rel:"noreferrer","data-tip":"open the lora manager of this host in a new tab",children:[s(D,{name:"external"})," manager"]}),c.length>0?p("span",{className:"hint",children:[c.length," in the palette · ",c.filter(r).length," on"]}):null,t.v.desc.optionsFilter==null?null:p("span",{className:"hint","data-tip":"this workflow declared v.loras(<regex>) — only matching loras are offered",children:["filter ",t.v.desc.optionsFilter]})]}),s("div",{className:"row-inline",children:!x&&!A?p("span",{className:"hint",children:[c.length," lora",c.length===1?"":"s"," in the palette"]}):c.map((S,T)=>p("span",{className:`${x?"lora-chip card":"lora-chip"}${r(S)?"":" off"}`,draggable:!0,onMouseDown:(Y)=>{let bt=Y.target;Y.currentTarget.draggable=bt.closest("input, label, button, select, a")==null},onMouseUp:(Y)=>{Y.currentTarget.draggable=!0},onDragStart:(Y)=>{Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData(nf,String(T))},onDragOver:(Y)=>{if(Y.dataTransfer.types.includes(nf))Y.preventDefault()},onDrop:(Y)=>{let bt=Y.dataTransfer.getData(nf);if(bt==="")return;Y.preventDefault();let Ln=Number(bt);if(Number.isInteger(Ln)&&Ln!==T)t.v.set(Zg({record:a,displayed:c,from:Ln,to:T}))},children:[p("span",{className:"chip-media",children:[s("button",{type:"button",className:"lora-toggle","data-tip":`${S}
16
- click for its details`,onClick:()=>n.setDetails(S),children:Yr(S)}),s("button",{type:"button",className:"chip-remove","data-tip":"remove from the palette (the popup adds it back)",onClick:()=>M(S,null),children:s(D,{name:"close",size:1.05})})]}),p("span",{className:"chip-head",children:[p("label",{className:"switch","data-tip":r(S)?"pause this lora":"resume this lora",children:[s("input",{type:"checkbox",checked:r(S),onChange:(Y)=>d(S,Y.target.checked)}),s("span",{className:"track"})]}),A?s("button",{type:"button",className:"chip-title as-text","data-tip":`${S}
17
- click for its details`,onClick:()=>n.setDetails(S),children:o(S)}):null,h(S)]}),s("span",{className:"chip-controls",children:v(S)})]},S))}),n.details==null?null:s(c_,{name:n.details,host:t.host,hostUrl:t.hostUrl,label:o(n.details),showImage:x,keyword:(t.v.desc.optionKeywords??{})[n.details]??null,managerOnly:m.has(n.details),onClose:()=>n.setDetails(null)}),n.open?s("div",{className:"modal-overlay",onClick:()=>n.setOpen(!1),children:p("div",{className:"modal",onClick:(S)=>S.stopPropagation(),children:[p("div",{className:"modal-head",children:[s("input",{ref:Gr,type:"text",placeholder:`search ${i.length} loras${t.v.desc.optionsFilter==null?"":` matching ${t.v.desc.optionsFilter}`} — enter adds the first`,value:n.filter,onChange:(S)=>n.setFilter(S.target.value),onKeyDown:(S)=>{if(S.key!=="Enter")return;S.preventDefault(),by()}}),pf,s("button",{type:"button","data-tip":"close (esc)",onClick:()=>n.setOpen(!1),children:s(D,{name:"close"})})]}),p("div",{className:"modal-body",children:[c.length>0?p("div",{children:[p("div",{className:"section-title",children:["your palette (",c.length,")"]}),c.filter(R).map((S)=>{let T=n.info.get(S);return p("div",{className:r(S)?"lora-active-row":"lora-active-row off",children:[Yr(S),p("div",{className:"lora-active-text",children:[s("div",{className:"lora-label","data-tip":S,children:A?o(S):"···"}),typeof T==="object"&&T.triggerWords.length>0?s("div",{className:"hint",children:T.triggerWords.join(", ")}):s("div",{className:"hint",children:S})]}),s("input",{type:"checkbox",checked:r(S),"data-tip":r(S)?"pause (stays in the palette)":"resume",onChange:(Y)=>d(S,Y.target.checked)}),v(S),s("button",{type:"button",className:"chip-remove","data-tip":"remove from the list",onClick:()=>M(S,null),children:s(D,{name:"close",size:0.9})})]},S)})]}):null,s("div",{className:"section-title",children:"all loras — tap to add to the palette"}),yy.map((S)=>p("div",{children:[p("div",{className:"section-title",children:[S.folder===""?"loose (no folder)":`${S.folder}/`," · ",S.names.length]}),s("div",{className:"lora-grid",children:S.names.map((T)=>p("button",{type:"button",className:"lora-card","data-tip":T,onClick:()=>M(T,[1,1]),children:[Yr(T),p("div",{className:"lora-label",children:[A?o(T):T.slice(0,2)+"···",h(T)]})]},T))})]},S.folder)),U.length-c.filter(R).length>B?p("div",{className:"loras-more",children:["… ",U.length-c.filter(R).length-B," more — refine the filter, or draw",s("input",{type:"number",min:1,max:2000,value:B,"data-tip":"how many cards this popup draws — each one is an image request, so the right number depends on your collection and your box. Kept in this browser",onChange:(S)=>{let T=parseInt(S.target.value,10);if(Number.isFinite(T))t.st.setLoraCap(T)}}),"at once"]}):null,U.length===0?p("div",{className:"loras-more",children:["no lora matches '",n.filter,"'"]}):null]})]})}):null]})}),c_=L(function(t){let n=Vn(()=>({info:"loading",about:null,aboutError:null,set(r){this.info=r},setAbout(r){this.about=r,this.aboutError=null},setAboutError(r){this.about=null,this.aboutError=r}})),{name:a,host:i}=t;be(()=>{let r=!0;return n.set("loading"),n.setAbout(null),Wc({host:i,name:a}).then((u)=>{if(r)n.set(u)}).catch((u)=>{if(r)n.set("error");Ue(`lora info for ${a}`,u)}),ag({host:i,name:a}).then((u)=>{if(r)n.setAbout(u)}).catch((u)=>{if(r)n.setAboutError(u instanceof Error?u.message:String(u));Ue(`lora details for ${a}`,u)}),()=>{r=!1}},[i,a,n]),be(()=>{let r=(u)=>{if(u.key==="Escape")t.onClose()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t]);let l=n.info,o=(r,u)=>u==null||u===""?null:p("div",{className:"detail-row",children:[s("span",{className:"detail-key",children:r}),s("span",{className:"detail-val",children:u})]});return s("div",{className:"modal-overlay",onClick:()=>t.onClose(),children:p("div",{className:"modal",onClick:(r)=>r.stopPropagation(),children:[p("div",{className:"modal-head",children:[s("b",{style:{flex:1},children:t.label}),s("button",{type:"button","data-tip":"close (esc)",onClick:()=>t.onClose(),children:s(D,{name:"close"})})]}),p("div",{className:"modal-body",children:[l==="loading"?s("div",{className:"hint",children:"reading the mirror…"}):null,l==="error"?s("div",{className:"error",children:"\uD83D\uDD34 could not read this lora's metadata"}):null,typeof l==="object"?p("div",{className:"lora-details",children:[t.showImage?s("img",{className:"detail-thumb",src:Pc({host:i,name:a}),alt:t.label}):null,p("div",{className:"detail-list",children:[l.known===!1?s("div",{className:"hint",children:"not in the lora manager mirror — run sync, or this file is unknown to it"}):null,t.managerOnly?s("div",{className:"hint",children:"⚠ only the lora manager lists it, not comfy"}):null,o("file",a),o("base model",l.baseModel),o("folder",l.folder),o("trigger words",l.triggerWords.join(", ")),o("prompt keyword",t.keyword),o("tags",(l.tags??[]).join(", ")),o("notes",l.notes),o("size",l.fileSize==null?null:`${(l.fileSize/1e9).toFixed(2)} GB`),o("path",l.filePath),n.about?.description==null?null:s("div",{className:"detail-desc",children:n.about.description}),o("civitai",l.civitaiUrl==null?null:p("a",{href:l.civitaiUrl,target:"_blank",rel:"noreferrer",children:[l.civitaiVersion??"model page"," ↗"]})),n.about!=null&&n.about.examples.length>0?p("div",{children:[p("div",{className:"section-title",children:["examples (",n.about.examples.length,")"]}),s("div",{className:"detail-examples",children:n.about.examples.slice(0,8).map((r)=>s("img",{src:r,alt:"",loading:"lazy"},r))})]}):null,n.about?.examplesReason==null?null:p("div",{className:"hint",children:["no example images: ",n.about.examplesReason]}),n.aboutError==null?null:p("div",{className:"error",children:["\uD83D\uDD34 the lora manager did not answer: ",n.aboutError]}),t.hostUrl==null?null:p("a",{className:"button-link",href:`${t.hostUrl}/loras`,target:"_blank",rel:"noreferrer",children:[s(D,{name:"external"})," open in the lora manager"]})]})]}):null]})]})})});var af=[{mode:"=",hint:"fixed: this exact seed, every run"},{mode:"+",hint:"increments after each run"},{mode:"?",hint:"a fresh random seed each run"}];function f_(e){if(af.some((t)=>t.mode===e))return af;return[...af,{mode:e,hint:e==="-"?"decrements after each run":`mode '${e}'`}]}var Fg=L(function(t){let n=pa(t.v.value),a=(i)=>{if(Number.isFinite(i))t.v.set({mode:n.mode,value:Math.max(0,Math.floor(i))})};return s("div",{children:p("div",{className:"row-inline",children:[s("span",{className:"btn-group field-height",children:f_(n.mode).map((i)=>s("button",{type:"button",className:n.mode===i.mode?"sel":"","data-tip":i.hint,onClick:()=>t.v.set({mode:i.mode,value:n.value}),children:i.mode},i.mode))}),s("input",{type:"number",min:0,value:n.value,onChange:(i)=>a(parseInt(i.target.value,10))}),s("button",{type:"button",className:"field-height","data-tip":"roll a random seed now",onClick:()=>a(Kg()),children:s(D,{name:"dice"})})]})})});var Wg=L(function(t){let n=ef(t.v.value),a=t.v.desc.presets??[],i=a.find((o)=>o.width===n.width&&o.height===n.height),l=(o)=>{let r=o.width??n.width,u=o.height??n.height;if(Number.isFinite(r)&&Number.isFinite(u)&&r>0&&u>0)t.v.set({width:Math.floor(r),height:Math.floor(u)})};return p("div",{className:"row-inline",children:[p("select",{value:i?.label??"__custom__",onChange:(o)=>{let r=a.find((u)=>u.label===o.target.value);if(r!=null)t.v.set({width:r.width,height:r.height})},children:[i==null?s("option",{value:"__custom__",children:"custom"}):null,a.map((o)=>p("option",{value:o.label,children:[o.label," (",o.width,"×",o.height,")"]},o.label))]}),s("input",{type:"number",min:1,value:n.width,onChange:(o)=>l({width:Number(o.target.value)})}),"×",s("input",{type:"number",min:1,value:n.height,onChange:(o)=>l({height:Number(o.target.value)})}),s("button",{type:"button","data-tip":"swap width and height",onClick:()=>t.v.set({width:n.height,height:n.width}),children:s(D,{name:"swap"})})]})});class Pg{name;desc;initial;value;dirty=!1;uploadedUrl=null;constructor(e,t,n){this.name=e;this.desc=t;this.initial=n;this.value=n,nn(this,{value:di,name:!1,desc:!1})}set(e){this.value=e,this.dirty=!0}setFromRun(e){this.value=e,this.initial=e,this.dirty=!1}setUploadedUrl(e){this.uploadedUrl=e}revert(){this.value=this.initial,this.dirty=!1,this.uploadedUrl=null}snapshot(){return{name:this.name,value:this.value}}}class lf{moduleKey;draft;vars;host;saveState="saved";saveError=null;disposers=[];saveChain=Promise.resolve(!0);lastSaved;lastQueued;queueSeq=0;onSettled=null;constructor(e,t,n,a){this.moduleKey=e;this.draft=t;this.host=n.host,this.vars=Object.entries(n.vars).map(([i,l])=>new Pg(i,l,Yg(l,a[i]))),this.lastSaved=JSON.stringify(Object.fromEntries(this.vars.map((i)=>[i.name,a[i.name]]))),this.lastQueued=this.lastSaved,nn(this,{vars:!1,moduleKey:!1,draft:!1,host:!1,disposers:!1,saveChain:!1,lastSaved:!1,lastQueued:!1,queueSeq:!1,onSettled:!1}),this.disposers.push(Cr(()=>JSON.stringify(this.valuesJSON()),()=>{this.save(),this.onSettled?.()},{delay:500}))}dispose(e={}){for(let t of this.disposers)t();if(this.disposers=[],e.flush===!1)return;if(JSON.stringify(this.valuesJSON())!==this.lastQueued)this.save()}flushKeepalive(){let e=JSON.stringify(this.valuesJSON());if(e===this.lastQueued)return;this.lastQueued=e,kl({module:this.moduleKey,draft:this.draft,values:JSON.parse(e)},{keepalive:!0}).then(()=>E(()=>{this.lastSaved=e,this.lastQueued=e,this.saveState="saved"}),(t)=>E(()=>{if(this.lastQueued===e)this.lastQueued=this.lastSaved;this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)}))}valuesJSON(){return Object.fromEntries(this.vars.map((e)=>[e.name,e.value]))}queuePayload(){return Gg(this.vars.map((e)=>({name:e.name,kind:e.desc.kind,value:e.value})))}loraKeywordsFor(e){let t=e.desc.keywordsFrom;if(t==null)return[];let n=this.vars.find((o)=>o.name===t);if(n==null)return[];let a=n.desc.optionKeywords??{},i=n.value!=null&&typeof n.value==="object"?n.value:{},l=[];for(let o of n.desc.options??[]){let r=i[o];if(r==null||r===!1)continue;let u=a[o];if(u!=null&&u!==""&&!l.includes(u))l.push(u)}return l}get dirtyCount(){return this.vars.filter((e)=>e.dirty).length}save(){let e=JSON.stringify(this.valuesJSON());if(e===this.lastQueued)return this.lastSaved===e?Promise.resolve(!0):this.saveChain;this.lastQueued=e;let t=++this.queueSeq;return E(()=>{this.saveState="saving"}),this.saveChain=this.saveChain.then(async()=>{try{return await kl({module:this.moduleKey,draft:this.draft,values:JSON.parse(e)}),E(()=>{this.lastSaved=e,this.saveState="saved",this.saveError=null}),!0}catch(n){return E(()=>{if(this.queueSeq===t)this.lastQueued=this.lastSaved;this.saveChain=Promise.resolve(!0),this.saveState="error",this.saveError=n instanceof Error?n.message:String(n)}),!1}}),this.saveChain}revertAll(){for(let e of this.vars)e.revert()}}function Ig(e){try{let t=new URLSearchParams(e.startsWith("?")?e.slice(1):e),n=t.get("workflow"),a=t.get("draft");return{module:n===""?null:n,draft:a===""?null:a}}catch{return{module:null,draft:null}}}function ey(e){let t=new URLSearchParams(e.search.startsWith("?")?e.search.slice(1):e.search);t.set("workflow",e.module),t.set("draft",e.draft);let n=t.toString();return n===""?"":`?${n}`}function ty(e){let t=(l)=>l==null?null:e.modules.find((o)=>o.module===l)??null,n=t(e.url.module)??t(e.stored.module)??e.modules[0];if(n==null)return null;let a=e.url.module!=null&&e.url.module===n.module?e.url.draft:e.stored.draft,i=a!=null&&n.drafts.includes(a)?a:"default";return{module:n.module,draft:i}}function d_(e){return new Promise((t)=>setTimeout(t,e))}class of{queue=[];error=null;results=[];progressPercent=null;progressNode=null;progressCount=null;progressText=null;hasPreview=!1;previewTick=0;draining=!1;nextId=0;pollGen=0;onSeeds=null;constructor(){nn(this,{queue:Rl,results:Rl})}get isRunning(){return this.queue.some((e)=>e.sent)}get runningModule(){return this.queue.find((e)=>e.sent)?.module??null}get pendingCount(){return this.queue.filter((e)=>!e.sent).length}enqueue(e){if(this.queue=[...this.queue,{id:`q${this.nextId++}`,...e,sent:!1}],this.error=null,!this.draining)this.drain()}removeQueued(e){this.queue=this.queue.filter((t)=>t.id!==e||t.sent)}clearQueue(){this.queue=this.queue.filter((e)=>e.sent)}remove(e){this.results=this.results.filter((t)=>t.promptId!==e)}clear(){this.results=[]}async drain(){if(this.draining)return;this.draining=!0;try{while(!0){let e=this.queue.find((n)=>!n.sent);if(e==null)return;E(()=>{this.queue=this.queue.map((n)=>n.id===e.id?{...n,sent:!0}:n),this.progressPercent=null,this.progressNode=null,this.progressCount=null,this.progressText=null,this.hasPreview=!1});let t=++this.pollGen;this.poll(e.module,t);try{let n=await tg(e);E(()=>{this.results=[{...n,at:new Date().toLocaleTimeString()},...this.results].slice(0,20)}),this.onSeeds?.({module:e.module,draft:e.draft,seeds:n.seeds})}catch(n){E(()=>{this.error=n instanceof Error?n.message:String(n),this.queue=this.queue.filter((a)=>a.sent&&a.id!==e.id)})}finally{this.pollGen++,E(()=>{this.queue=this.queue.filter((n)=>n.id!==e.id),this.progressPercent=null,this.progressNode=null,this.progressCount=null,this.progressText=null,this.hasPreview=!1})}}}finally{this.draining=!1}}async poll(e,t){while(t===this.pollGen){if(await d_(700),t!==this.pollGen)return;try{let n=await ng({module:e});E(()=>{if(t!==this.pollGen)return;this.progressPercent=n.percent,this.progressNode=n.node??null,this.progressCount=n.nodeProgress??null,this.progressText=n.progressText??null,this.hasPreview=n.hasPreview,this.previewTick=n.previewSeq??0})}catch{}}}}function rf(e){return e!=null&&typeof e==="object"}function jr(e){return rf(e)&&!Array.isArray(e)}function ny(e){if(!rf(e))return null;switch(e.comfyTs){case"set-prompt":return typeof e.text==="string"?{comfyTs:"set-prompt",text:e.text}:null;case"host-actions":{if(!Array.isArray(e.actions))return null;let t=[];for(let n of e.actions){if(!rf(n)||typeof n.id!=="string"||n.id===""||typeof n.label!=="string")continue;if(n.label===""||t.some((a)=>a.id===n.id))continue;t.push({id:n.id,label:n.label,...typeof n.title==="string"?{title:n.title}:{}})}return{comfyTs:"host-actions",actions:t}}case"set-selection":return typeof e.module==="string"&&e.module!==""&&typeof e.draft==="string"?{comfyTs:"set-selection",module:e.module,draft:e.draft}:null;case"set-values":return jr(e.values)?{comfyTs:"set-values",values:e.values}:null;case"get-state":return{comfyTs:"get-state"};default:return null}}function ay(e){let t=e.modules.find((n)=>n.module===e.want.module);if(t==null)return null;return{module:t.module,draft:t.drafts.includes(e.want.draft)?e.want.draft:"default"}}var ct={ok:!1},h_=["=","+","-","?"];function Tt(e){return typeof e==="number"&&Number.isFinite(e)}function p_(e){if(typeof e==="boolean"||Tt(e))return!0;return Array.isArray(e)&&e.length===2&&Tt(e[0])&&Tt(e[1])}function sf(e,t,n){switch(e.kind){case"prompt":case"text":case"image":return typeof t==="string"?{ok:!0,value:t}:ct;case"int":return Tt(t)?{ok:!0,value:Math.trunc(t)}:ct;case"float":return Tt(t)?{ok:!0,value:t}:ct;case"toggle":return typeof t==="boolean"?{ok:!0,value:t}:ct;case"choice":return typeof t==="string"&&(e.choices??[]).includes(t)?{ok:!0,value:t}:ct;case"seed":{let a=pa(n);if(Tt(t))return{ok:!0,value:{mode:a.mode,value:Math.max(0,Math.floor(t))}};if(!jr(t))return ct;if(t.mode!==void 0&&!(typeof t.mode==="string"&&h_.includes(t.mode)))return ct;if(t.value!==void 0&&!Tt(t.value))return ct;return{ok:!0,value:{mode:typeof t.mode==="string"?t.mode:a.mode,value:Tt(t.value)?Math.max(0,Math.floor(t.value)):a.value}}}case"size":{let a=null,i=null;if(typeof t==="string"){let l=/^\s*(\d+)\s*x\s*(\d+)\s*$/i.exec(t);if(l!=null)a=Number(l[1]),i=Number(l[2])}else if(jr(t))a=t.width,i=t.height;if(!Tt(a)||!Tt(i)||a<1||i<1)return ct;return{ok:!0,value:{width:Math.floor(a),height:Math.floor(i)}}}case"loras":{if(!jr(t))return ct;for(let a of Object.values(t))if(!p_(a))return ct;return{ok:!0,value:tf(t,e.options??[])}}default:return ct}}function iy(e){return e.find((t)=>t.desc.kind==="prompt")??e.find((t)=>(t.desc.kind==="text"||t.desc.kind==="prompt")&&/prompt/i.test(t.name)&&!/neg/i.test(t.name))??null}function ly(e,t){if(t==null)return e.comfyTs==="ready"||e.comfyTs==="selection"||e.comfyTs==="error"&&e.code==="boot"?"*":null;return t==="null"?"*":t}function uf(e){try{let t=JSON.stringify(e,(n,a)=>typeof a==="bigint"?`${a}n`:a);if(typeof e==="bigint")return`${e}n`;return t??String(e)}catch{try{return String(e)}catch{return"[unprintable]"}}}function oy(e){try{let n=new URLSearchParams(e.startsWith("?")?e.slice(1):e).get("prompt");return n==null||n===""?null:n}catch{return null}}function cf(){try{return typeof window<"u"&&window.parent!==window}catch{return!1}}var uy="comfy-ts-serve-ui",m_="side",cy=[{id:"off",icon:"panel-off",title:"no preview: the form only"},{id:"bottom",icon:"panel-bottom",title:"results below the form"},{id:"left",icon:"panel-left",title:"results left of the form"},{id:"side",icon:"panel-side",title:"results right of the form"},{id:"pinned",icon:"panel-corner",title:"newest image in the bottom right corner, form scrolls under it"}];function v_(e){return e==="off"||e==="bottom"||e==="left"||e==="side"||e==="pinned"}var fy=200,g_=60;function ry(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.floor(e):fy;return Math.min(2000,Math.max(1,t))}function y_(e){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let t={};for(let[n,a]of Object.entries(e))if(Array.isArray(a))t[n]=a.filter((i)=>typeof i==="string");return t}function ff(){try{let e=JSON.parse(localStorage.getItem(uy)??"{}")??{};return{...e,varOrder:y_(e.varOrder)}}catch{return{}}}function sy(){return window.matchMedia("(max-width: 800px)").matches}class df{phase="loading";bootError="";modules=[];loadErrors={};form=null;formLoading=!1;formError=null;sidebarOpen;showLoraImages;showLoraTitles;loraFill;loraCap;run;enhancer;settings={saveToDisk:!0,hostOverride:{},savePrefix:{},effectivePrefix:{}};savingError=null;prefixEdits={};prefixTimers=new Map;get saveToDisk(){return this.settings.saveToDisk}layout;varOrder={};orderedVars(e,t){let n=this.varOrder[e];if(n==null)return[...t];let a=new Set(t),i=n.filter((l)=>a.has(l));return[...i,...t.filter((l)=>!i.includes(l))]}moveVar(e){let t=this.orderedVars(e.module,e.names),[n]=t.splice(e.from,1);if(n==null)return;t.splice(e.to,0,n),this.varOrder={...this.varOrder,[e.module]:t},this.persist()}hosts={hosts:[],defaults:{},overrides:{}};hostError=null;hostActions=[];hostOrigin=null;lastPostedState=null;switches=new Set;hostChain=Promise.resolve();constructor(){this.run=new of,this.run.onSeeds=(t)=>this.applyRunSeeds(t),this.enhancer=new Ic;let e=ff();if(this.layout=v_(e.layout)?e.layout:m_,this.sidebarOpen=e.sidebar??!1,this.showLoraImages=e.loraImages??!0,this.showLoraTitles=e.loraTitles??!0,this.loraFill=e.loraFill??!0,this.loraCap=ry(e.loraCapMigrated!==!0&&e.loraCap===g_?fy:e.loraCap),this.showLatent=e.latent??!0,this.varOrder=e.varOrder??{},this.showLogs=e.logs??!1,nn(this,{run:!1,enhancer:!1,form:di,modules:Rl,hostOrigin:!1,hostChain:!1,lastPostedState:!1,switches:!1}),cf())window.addEventListener("message",(t)=>this.onHostMessage(t));window.addEventListener("beforeunload",()=>this.form?.flushKeepalive()),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")this.form?.save()}),this.hostChain=this.boot().catch((t)=>Ue("panel boot failed",t))}toggleSidebar(){this.sidebarOpen=!this.sidebarOpen,this.persist()}toggleLoraImages(){this.showLoraImages=!this.showLoraImages,this.persist()}toggleLoraTitles(){this.showLoraTitles=!this.showLoraTitles,this.persist()}toggleLoraFill(){this.loraFill=!this.loraFill,this.persist()}setLoraCap(e){this.loraCap=ry(e),this.persist()}applyRunSeeds(e){let t=this.form;if(t==null||t.moduleKey!==e.module||t.draft!==e.draft)return;E(()=>{for(let n of t.vars){if(n.desc.kind!=="seed")continue;let a=e.seeds[n.name];if(typeof a!=="number"||!Number.isFinite(a))continue;let i=pa(n.value);if(i.value===a)continue;n.setFromRun({mode:i.mode,value:a})}}),this.mirrorState()}syncUrl(){let e=this.form;if(e==null)return;try{let t=ey({search:window.location.search,module:e.moduleKey,draft:e.draft});window.history.replaceState(null,"",`${window.location.pathname}${t}${window.location.hash}`)}catch(t){Ue("could not put the selection in the url",t)}}persist(){try{let e=ff();localStorage.setItem(uy,JSON.stringify({...e,...this.form!=null?{module:this.form.moduleKey,draft:this.form.draft}:{},sidebar:this.sidebarOpen,loraImages:this.showLoraImages,loraTitles:this.showLoraTitles,loraFill:this.loraFill,loraCap:this.loraCap,loraCapMigrated:!0,layout:this.layout,latent:this.showLatent,logs:this.showLogs,varOrder:this.varOrder}))}catch(e){Ue("ui state could not be stored (it will not survive a reload)",e)}}moduleByKey(e){return this.modules.find((t)=>t.module===e)??null}async boot(){try{let e=await Jc();E(()=>{this.modules=e.workflows,this.loadErrors=e.loadErrors??{},this.phase="ready"}),this.loadSettings(),this.loadHosts();let t=ff(),n=ty({url:Ig(window.location.search),stored:{module:t.module??null,draft:t.draft??null},modules:this.modules});if(n==null){this.postHost({comfyTs:"error",code:"boot",message:"no workflows are served"});return}if(await this.select(n),this.form==null){this.postHost({comfyTs:"error",code:"boot",message:`the opening draft could not be read: ${this.formError??"unknown error"}`});return}let a=oy(window.location.search);if(a!=null)this.setPromptText(a);this.postHost({comfyTs:"ready"})}catch(e){let t=e instanceof Error?e.message:String(e);E(()=>{this.phase="error",this.bootError=t}),this.postHost({comfyTs:"error",code:"boot",message:t})}}selectToken=0;select(e,t={}){return this.trackSwitch(this.selectNow(e,t.mirror??!0))}trackSwitch(e){this.switches.add(e);let t=()=>void this.switches.delete(e);return e.then(t,t),e}async switchSettled(){while(this.switches.size>0)await Promise.allSettled(this.switches)}async selectNow(e,t){let n=this.moduleByKey(e.module);if(n==null)return;if(this.form?.moduleKey===e.module&&this.form.draft===e.draft){E(()=>{if(sy())this.sidebarOpen=!1});return}let a=++this.selectToken;E(()=>{if(this.enhancer.close(),this.formLoading=!0,this.formError=null,sy())this.sidebarOpen=!1});let i=this.form;if(i!=null){if(i.dispose(),E(()=>{this.form=null}),!await i.save())E(()=>{this.formError=`the previous draft could not be saved: ${i.saveError??"unknown error"}`})}try{let l=await eg(e);if(a!==this.selectToken)return;let o=new lf(e.module,e.draft,n,l.values??{});if(o.onSettled=()=>this.mirrorState(),E(()=>{this.form=o,this.persist(),this.syncUrl()}),this.postHost({comfyTs:"selection",module:o.moduleKey,draft:o.draft}),t)this.mirrorState()}catch(l){E(()=>{if(a!==this.selectToken)return;this.form=null,this.formError=l instanceof Error?l.message:String(l)})}finally{E(()=>{if(a===this.selectToken)this.formLoading=!1})}}promptVar(){return iy(this.form?.vars??[])}setPromptText(e){let t=this.promptVar();if(t==null)return;let n=sf(t.desc,e,t.value);if(!n.ok){Ue("host set-prompt",`'${t.name}' (${t.desc.kind}) rejected the text`);return}E(()=>t.set(n.value))}postHost(e){if(!cf())return;let t=ly(e,this.hostOrigin);if(t==null)return;try{window.parent.postMessage(e,t)}catch(n){Ue("could not post to the host page",n)}}setValues(e){let t=this.form;if(t==null)return Object.keys(e);let n=[];return E(()=>{for(let[a,i]of Object.entries(e)){let l=t.vars.find((r)=>r.name===a);if(l==null){n.push(a),Ue("host set-values",`no var named '${a}' on ${t.moduleKey}`);continue}let o=sf(l.desc,i,l.value);if(o.ok)l.set(o.value);else n.push(a),Ue("host set-values",`'${a}' (${l.desc.kind}) rejected ${uf(i)}`)}}),n}stateOf(e){let t=e.valuesJSON();return{key:uf([e.moduleKey,e.draft,t]),values:t}}replyState(e,t,n){let{key:a,values:i}=this.stateOf(e);this.lastPostedState=a,this.postHost({comfyTs:"state",module:e.moduleKey,draft:e.draft,values:i,request:t,...n!=null?{rejected:n}:{}})}mirrorState(){let e=this.form;if(e==null||this.hostOrigin==null)return;let{key:t,values:n}=this.stateOf(e);if(t===this.lastPostedState)return;this.lastPostedState=t,this.postHost({comfyTs:"state",module:e.moduleKey,draft:e.draft,values:n})}replyError(e,t,n){this.postHost({comfyTs:"error",code:t,message:n,request:e})}onHostMessage(e){if(e.source!==window.parent)return;let t=ny(e.data);if(t==null)return;if(this.hostOrigin==null)this.hostOrigin=e.origin;else if(e.origin!==this.hostOrigin)return;this.hostChain=this.hostChain.then(()=>this.applyHostMessage(t)).catch((n)=>Ue(`host message '${t.comfyTs}' failed`,n))}async applyHostMessage(e){try{await this.applyHostMessageNow(e)}catch(t){if(e.comfyTs==="set-selection"||e.comfyTs==="set-values"||e.comfyTs==="get-state")this.replyError(e.comfyTs,"no-form",t instanceof Error?t.message:String(t));throw t}}async applyHostMessageNow(e){switch(e.comfyTs){case"host-actions":E(()=>{this.hostActions=e.actions});return;case"set-prompt":await this.switchSettled(),this.setPromptText(e.text);return;case"set-selection":{await this.switchSettled();let t=ay({want:e,modules:this.modules});if(t==null){this.replyError("set-selection","unknown-module",`no workflow named '${e.module}' is served`);return}let n=this.form;if(n==null||n.moduleKey!==t.module||n.draft!==t.draft)await this.select(t,{mirror:!1}),await this.switchSettled();let a=this.form;if(a==null){let i=this.formError??"the draft could not be read";this.replyError("set-selection","select-failed",i)}else if(a.moduleKey!==t.module||a.draft!==t.draft)this.replyError("set-selection","superseded",`the panel switched to ${a.moduleKey}/${a.draft} while ${t.module}/${t.draft} was loading`);else this.replyState(a,"set-selection");return}case"set-values":{await this.switchSettled();let t=this.form;if(t==null){this.replyError("set-values","no-form",this.noFormMessage());return}this.replyState(t,"set-values",this.setValues(e.values));return}case"get-state":{await this.switchSettled();let t=this.form;if(t==null)this.replyError("get-state","no-form",this.noFormMessage());else this.replyState(t,"get-state");return}}}noFormMessage(){return this.formError!=null?`no draft is open: ${this.formError}`:"no draft is open"}postResultAction(e,t,n,a){let i=this.promptVar();this.postHost({comfyTs:"result-action",id:e,promptId:t.promptId,ix:a,url:n.url,filename:n.filename,module:t.module,draft:t.draft,seeds:t.seeds,prompt:i!=null&&typeof i.value==="string"?i.value:null})}get generateInResults(){return this.layout==="side"||this.layout==="left"||this.layout==="pinned"}setLayout(e){this.layout=e,this.persist()}hostFor(e){return this.hosts.overrides[e]??this.hosts.defaults[e]??""}hostUrlFor(e){let t=this.hostFor(e);return this.hosts.hosts.find((n)=>n.id===t)?.httpUrl??null}isHostOverridden(e){return this.hosts.overrides[e]!=null}async loadHosts(){try{let e=await og();E(()=>{this.hosts=e})}catch(e){Ue("could not read the host list",e)}}showLogs=!1;logLines=[];logsError=null;hostNote=null;showLatent=!0;logsTimer=null;toggleLatent(){this.showLatent=!this.showLatent,this.persist()}toggleLogs(){if(this.showLogs=!this.showLogs,this.persist(),this.logsTimer!=null)clearInterval(this.logsTimer);if(this.logsTimer=null,!this.showLogs)return;this.pullLogs(),this.logsTimer=setInterval(()=>void this.pullLogs(),3000)}async pullLogs(){let e=this.form==null?null:this.hostFor(this.form.moduleKey);if(e==null||e==="")return;try{let t=await ug({host:e});E(()=>{this.logLines=t.lines,this.logsError=null})}catch(t){E(()=>{this.logsError=t instanceof Error?t.message:String(t)})}}loraSyncing=!1;async refreshLoras(){if(this.loraSyncing)return;E(()=>{this.loraSyncing=!0}),await this.hostAction("refresh-loras"),await this.trackSwitch(this.reloadIndexAndForm())}async reloadIndexAndForm(){try{let e=await Jc(),t=this.form;if(E(()=>{this.modules=e.workflows}),t!=null)t.dispose(),await t.save(),E(()=>{this.form=null}),await this.select({module:t.moduleKey,draft:t.draft})}catch(e){E(()=>{this.hostError=e instanceof Error?e.message:String(e)})}finally{E(()=>{this.loraSyncing=!1})}}hostWatch="idle";async watchHostComeBack(){let e=this.form==null?null:this.hostFor(this.form.moduleKey);if(e==null||e==="")return;E(()=>{this.hostWatch="down"});let t=Date.now()+120000;for(;;){if(await new Promise((a)=>setTimeout(a,2500)),Date.now()>t){E(()=>{this.hostWatch="idle",this.hostError=`${e} has not answered for 2 minutes — check the console`});return}if(!await rg({host:e}).then((a)=>a.up).catch(()=>!1))continue;E(()=>{this.hostWatch="back",this.hostNote=`${e} is back up`}),setTimeout(()=>E(()=>this.hostWatch="idle"),4000);return}}async hostAction(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t==="")return;E(()=>{this.hostError=null,this.hostNote=null});try{let n=await sg({host:t,action:e});if(E(()=>{this.hostNote=n.note}),e==="restart")this.watchHostComeBack()}catch(n){E(()=>{this.hostError=n instanceof Error?n.message:String(n)})}}async setModuleHost(e){E(()=>{this.hostError=null});try{let t=await cg(e);E(()=>{this.hosts={...this.hosts,overrides:t.overrides}})}catch(t){E(()=>{this.hostError=t instanceof Error?t.message:String(t)})}}async loadSettings(){try{let e=await ig();E(()=>{this.settings=e})}catch(e){Ue("could not read the serve settings",e)}}savePrefixDraft(e){return this.prefixEdits[e]??this.settings.savePrefix[e]??""}setSavePrefix(e,t){this.prefixEdits[e]=t,this.savingError=null;let n=this.prefixTimers.get(e);if(n!=null)clearTimeout(n);this.prefixTimers.set(e,setTimeout(()=>{this.pushSettings({savePrefix:{[e]:t}})},500))}async pushSettings(e){try{let t=await lg(e);return E(()=>{this.settings=t,this.savingError=null}),!0}catch(t){return E(()=>{this.savingError=t instanceof Error?t.message:String(t)}),!1}}async toggleSaveToDisk(){let e=!this.saveToDisk,t=this.settings;if(E(()=>{this.settings={...this.settings,saveToDisk:e},this.savingError=null}),!await this.pushSettings({saveToDisk:e}))E(()=>{this.settings=t})}generate(){this.generateNow()}async generateNow(){let e=this.form;if(e==null)return;let t=e.queuePayload();if(!await e.save())return;this.run.enqueue({module:e.moduleKey,draft:e.draft,payload:t})}async renameDraft(e){let t=this.form,n=e.trim();if(t==null||n===""||n===t.draft)return;let a=t.draft;if(await this.duplicateDraft(n),this.form?.draft!==n)return;await Fc({module:t.moduleKey,draft:a}).then((i)=>E(()=>{this.modules=this.modules.map((l)=>l.module===t.moduleKey?{...l,drafts:i.drafts}:l)}),(i)=>E(()=>{this.formError=`renamed to '${n}', but the old draft '${a}' could not be removed: ${i instanceof Error?i.message:String(i)}`}))}deleteDraft(e){return this.trackSwitch(this.deleteDraftNow(e))}async deleteDraftNow(e){let t=this.form;if(t!=null&&t.moduleKey===e.module&&t.draft===e.draft)t.dispose({flush:!1}),E(()=>{this.form=null});try{let n=await Fc(e);E(()=>{this.modules=this.modules.map((i)=>i.module===e.module?{...i,drafts:n.drafts}:i)});let a=n.drafts.includes("default")?"default":n.drafts[0]??"default";await this.select({module:e.module,draft:a})}catch(n){E(()=>{this.formError=n instanceof Error?n.message:String(n)})}}async duplicateDraft(e){let t=this.form,n=e.trim();if(t==null||n==="")return;if(this.moduleByKey(t.moduleKey)?.drafts.includes(n)===!0&&!window.confirm(`draft '${n}' already exists — overwrite it?`))return;try{let i=await kl({module:t.moduleKey,draft:n,values:t.valuesJSON()});E(()=>{this.modules=this.modules.map((l)=>l.module===t.moduleKey?{...l,drafts:i.drafts}:l)}),await this.select({module:t.moduleKey,draft:n})}catch(i){E(()=>{this.formError=i instanceof Error?i.message:String(i)})}}}var b_=L(function(t){switch(t.v.desc.kind){case"prompt":return s(Vg,{v:t.v,st:t.st,module:t.module});case"text":return s(Lg,{v:t.v});case"int":case"float":return s(Bg,{v:t.v});case"seed":return s(Fg,{v:t.v});case"toggle":return s(Hg,{v:t.v});case"choice":return s(jg,{v:t.v});case"loras":return s(Jg,{v:t.v,host:t.st.hostFor(t.module),st:t.st,hostUrl:t.st.hostUrlFor(t.module)});case"size":return s(Wg,{v:t.v});case"image":return s(qg,{v:t.v});default:return p("div",{className:"hint",children:["unsupported var kind '",t.v.desc.kind,"' — use the json api"]})}}),S_=L(function(t){return p("div",{className:t.v.desc.kind==="loras"||t.v.desc.kind==="prompt"?"var-row wide":"var-row",onDragOver:(n)=>{if(n.dataTransfer.types.includes("application/x-comfy-var"))n.preventDefault()},onDrop:(n)=>{let a=n.dataTransfer.getData("application/x-comfy-var");if(a==="")return;n.preventDefault();let i=Number(a);if(Number.isInteger(i)&&i!==t.index)t.st.moveVar({module:t.module,names:t.names,from:i,to:t.index})},children:[p("div",{className:"var-label",draggable:!0,onDragStart:(n)=>{n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("application/x-comfy-var",String(t.index))},children:[s("span",{"data-tip":`${t.v.desc.kind}
18
- drag the label to reorder`,children:t.v.desc.label??t.v.name}),t.v.dirty?s("button",{type:"button",className:"dirty-dot","data-tip":"changed this session — click to restore the loaded value (autosaves)",onClick:()=>t.v.revert(),children:"●"}):null]}),s("div",{className:"var-control",children:s(b_,{v:t.v,host:t.host,st:t.st,module:t.module})})]})}),__=L(function(t){let n=Vn(()=>({mode:null,name:"",start(l,o){this.mode=l,this.name=l==="duplicate"?`${o} copy`:o},set(l){this.name=l},stop(){this.mode=null}})),a=t.st.moduleByKey(t.form.moduleKey)?.drafts??[t.form.draft],i=()=>{let l=n.name.trim(),o=n.mode;if(n.stop(),l===""||o==null)return;if(o==="duplicate")t.st.duplicateDraft(l);else t.st.renameDraft(l)};return p("div",{className:"head-box",children:[p("span",{className:"head-label",children:["draft",p("span",{className:t.form.saveState==="error"?"save-state error":"save-state",children:[t.form.saveState==="saving"?"· saving":null,t.form.saveState==="saved"?"· saved":null,t.form.saveState==="error"?"· NOT SAVED":null]})]}),n.mode!=null?s("input",{type:"text",autoFocus:!0,className:"head-input",value:n.name,placeholder:n.mode==="rename"?"new name, then enter":"new draft name, then enter",onFocus:(l)=>l.currentTarget.select(),onChange:(l)=>n.set(l.target.value),onKeyDown:(l)=>{if(l.key==="Enter")i();if(l.key==="Escape")n.stop()},onBlur:()=>n.stop()}):s("select",{className:"head-select draft",value:t.form.draft,"data-tip":"switch draft",onChange:(l)=>void t.st.select({module:t.form.moduleKey,draft:l.target.value}),children:a.map((l)=>s("option",{value:l,children:l},l))}),p("span",{className:"head-line",children:[p("span",{className:"btn-group head-group",children:[s("button",{type:"button","data-tip":"rename this draft (the file is renamed)",onClick:()=>n.mode!=null?i():n.start("rename",t.form.draft),children:s(D,{name:"pen"})}),s("button",{type:"button","data-tip":"save these values as a new draft",onClick:()=>n.mode!=null?i():n.start("duplicate",t.form.draft),children:s(D,{name:"copy-plus"})}),s("button",{type:"button",className:"danger","data-tip":"delete this draft's file (default resets to the workflow's own values)",onClick:()=>{if(window.confirm(`delete draft '${t.form.draft}' of ${t.form.moduleKey}? the file is removed.`))t.st.deleteDraft({module:t.form.moduleKey,draft:t.form.draft})},children:s(D,{name:"trash"})})]}),t.form.dirtyCount>0?s("button",{type:"button",className:"dirty head-right","data-tip":`${t.form.dirtyCount} var${t.form.dirtyCount>1?"s":""} changed this session — revert to the values this draft loaded with`,onClick:()=>t.form.revertAll(),children:s(D,{name:"broom"})}):null]})]})}),hf=L(function(t){let n=t.st.run;return p("span",{className:"run-line",children:[p("button",{type:"button",className:n.isRunning?"primary pulse":"primary","data-tip":"⌘⏎ / ctrl+⏎ — click again to queue another",onClick:()=>t.st.generate(),children:[s(D,{name:"play",size:0.85})," ",n.isRunning?n.progressPercent!=null?`generating… ${Math.round(n.progressPercent)}%`:"generating…":"generate",n.isRunning?null:s("span",{className:"kbd-hint",children:"⌘⏎"})]}),n.queue.length>0?p("span",{className:"run-chip","data-tip":"prompts waiting behind this one",children:["queue: ",n.queue.length,n.pendingCount>0?s("button",{type:"button",className:"link","data-tip":`drop the ${n.pendingCount} not yet sent to the host`,onClick:()=>n.clearQueue(),children:"clear"}):null]}):null,n.results.length>0?p("span",{className:"run-chip","data-tip":"runs kept in this page",children:[n.results.length," result",n.results.length===1?"":"s",s("button",{type:"button",className:"link","data-tip":"forget every run shown here",onClick:()=>n.clear(),children:"clear"})]}):null]})}),x_=L(function(t){let n=t.st.saveToDisk;return p("div",{className:"var-row",children:[s("div",{className:"var-label",children:s("span",{"data-tip":"save — where this workflow's images go",children:"output"})}),p("div",{className:"var-control",children:[p("div",{className:"row-inline",children:[p("label",{className:"row-inline",style:{cursor:"pointer"},children:[s("input",{type:"checkbox",checked:n,onChange:()=>void t.st.toggleSaveToDisk()}),p("span",{className:"hint",children:[s(D,{name:n?"save":"ghost",size:1})," ",n?"write to disk":"memory only"]})]}),n?p(he,{children:[s("span",{className:"hint",children:".comfy-ts/outputs/"}),s("input",{type:"text",style:{flex:1,minWidth:120},placeholder:t.module,value:t.st.savePrefixDraft(t.module),"data-tip":"subfolder the images land in — folder names only, a/b allowed",onChange:(a)=>t.st.setSavePrefix(t.module,a.target.value)}),s("span",{className:"hint",children:"/…png"})]}):s("span",{className:"hint",children:"kept in memory and shown here, lost when the server restarts"})]}),t.st.savingError!=null?p("div",{className:"error",children:["\uD83D\uDD34 ",t.st.savingError]}):null]})]})}),dy=L(function(t){let n=t.st.form;if(be(()=>{let l=(o)=>{if(t.st.enhancer.isOpen)return;if(o.key==="Enter"&&(o.metaKey||o.ctrlKey))o.preventDefault(),t.st.generate()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t.st]),n==null)return null;let a=t.st.orderedVars(n.moduleKey,n.vars.map((l)=>l.name)),i=a.map((l)=>n.vars.find((o)=>o.name===l)).filter((l)=>l!=null);return p("div",{children:[s("div",{className:"head-shell",children:p("div",{className:"head-boxes",children:[p("div",{className:"head-box",children:[s("span",{className:"head-label",children:"workflow"}),s("div",{className:"head-line",children:s("button",{type:"button",className:"head-value app as-link","data-tip":t.st.sidebarOpen?"close the workflow menu":"browse every workflow",onClick:()=>t.st.toggleSidebar(),children:n.moduleKey})}),p("div",{className:"head-line",children:[s("span",{className:"btn-group",children:s("button",{type:"button","data-tip":t.st.sidebarOpen?"close the workflow menu":"browse every workflow",onClick:()=>t.st.toggleSidebar(),children:s(D,{name:"folder"})})}),p("span",{className:"hint",children:[n.vars.length," vars"]})]})]}),s(__,{st:t.st,form:n}),p("div",{className:"head-box",children:[s("span",{className:"head-label",children:"host"}),s("div",{className:"head-line",children:t.st.hosts.hosts.length>1?s("select",{className:"head-select",value:t.st.hostFor(n.moduleKey),"data-tip":"run this workflow on another host",onChange:(l)=>void t.st.setModuleHost({module:n.moduleKey,host:l.target.value}),children:t.st.hosts.hosts.map((l)=>s("option",{value:l.id,children:l.id===(t.st.hosts.defaults[n.moduleKey]??"")?`${l.id} (its own)`:l.id},l.id))}):s("span",{className:"head-value host",children:t.st.hostFor(n.moduleKey)||n.host})}),p("div",{className:"head-line",children:[p("span",{className:"btn-group",children:[s("button",{type:"button","data-tip":"interrupt the prompt running now",onClick:()=>void t.st.hostAction("interrupt"),children:s(D,{name:"pause"})}),s("button",{type:"button","data-tip":"drop everything still pending in the host queue",onClick:()=>void t.st.hostAction("clear-queue"),children:s(D,{name:"trash"})}),s("button",{type:"button","data-tip":"refetch object_info from the host and rewrite sdk.d.ts (the var lists widen in place)",onClick:()=>void t.st.hostAction("refresh-schema"),children:s(D,{name:"refresh"})}),s("button",{type:"button",className:"danger","data-tip":"restart ComfyUI on that host (manager reboot) — it reconnects when back",onClick:()=>{if(window.confirm(`restart ComfyUI on '${t.st.hostFor(n.moduleKey)}'?`))t.st.hostAction("restart")},children:s(D,{name:"power"})})]}),t.st.isHostOverridden(n.moduleKey)?p("button",{type:"button",className:"link","data-tip":`runs on an override — back to ${t.st.hosts.defaults[n.moduleKey]??"its own host"}`,onClick:()=>void t.st.setModuleHost({module:n.moduleKey,host:null}),children:[s(D,{name:"swap"})," reset"]}):null]})]}),p("div",{className:"head-box",children:[s("span",{className:"head-label",children:"preview"}),s("div",{className:"head-line",children:s("span",{className:"btn-group",children:cy.map((l)=>s("button",{type:"button",className:t.st.layout===l.id?"sel":"","data-tip":l.title,onClick:()=>t.st.setLayout(l.id),children:s(D,{name:l.icon})},l.id))})}),s("div",{className:"head-line",children:p("span",{className:"btn-group",children:[s("button",{type:"button",className:t.st.showLatent?"sel":"","data-tip":t.st.showLatent?"hide the latent preview during a run":"show the latent preview",onClick:()=>t.st.toggleLatent(),children:s(D,{name:"image"})}),s("button",{type:"button",className:t.st.showLogs?"sel":"","data-tip":t.st.showLogs?"hide the ComfyUI console":"show the ComfyUI console",onClick:()=>t.st.toggleLogs(),children:s(D,{name:"terminal"})})]})})]})]})}),t.st.hostError!=null?p("div",{className:"error",children:["\uD83D\uDD34 ",t.st.hostError]}):null,t.st.hostWatch==="down"?s("div",{className:"host-note pulse",children:"restarting… waiting for the host to answer again"}):null,t.st.hostNote!=null&&t.st.hostWatch!=="down"?s("div",{className:"host-note",children:t.st.hostNote}):null,n.saveState==="error"?p("div",{className:"error",children:["\uD83D\uDD34 draft save failed: ",n.saveError]}):null,p("div",{className:"vars",children:[i.map((l,o)=>s(S_,{v:l,host:n.host,st:t.st,module:n.moduleKey,index:o,names:a},`${n.moduleKey}/${n.draft}/${l.name}`)),s(x_,{st:t.st,module:n.moduleKey})]}),t.st.generateInResults&&t.st.run.error==null?null:p("div",{className:"runbar",children:[t.st.generateInResults?null:s(hf,{st:t.st}),t.st.run.error!=null?p("span",{className:"error",children:["\uD83D\uDD34 ",t.st.run.error]}):null]})]})});function E_(){be(()=>{let e=(t)=>{if(t.key!=="a"&&t.key!=="A")return;if(!t.metaKey&&!t.ctrlKey)return;if(t.altKey)return;let n=document.activeElement;if(!(n instanceof HTMLInputElement?n.type==="text"||n.type==="search"||n.type==="password"||n.type==="url":n instanceof HTMLTextAreaElement))return;t.preventDefault(),n.select()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[])}var hy=L(function(t){if(E_(),t.st.phase==="loading")return s("div",{className:"center",children:"loading…"});if(t.st.phase==="error")return s("div",{className:"center",children:p("div",{className:"error",children:["\uD83D\uDD34 ",t.st.bootError]})});return s("div",{className:"app",children:p("div",{className:"cols",children:[t.st.sidebarOpen?s("div",{className:"backdrop",onClick:()=>t.st.toggleSidebar()}):null,t.st.sidebarOpen?s(_g,{st:t.st}):null,p("div",{className:"main",children:[t.st.formError!=null?p("div",{className:"center error",children:["\uD83D\uDD34 ",t.st.formError]}):null,t.st.formLoading&&t.st.form==null?s("div",{className:"center",children:"loading draft…"}):null,t.st.modules.length===0?s("div",{className:"center",children:"no workflow modules loaded"}):null,p("div",{className:`work layout-${t.st.layout}`,children:[p("div",{className:"form-col",children:[s(dy,{st:t.st}),t.st.showLogs?p("div",{className:"logs",children:[p("div",{className:"logs-head",children:[p("span",{children:["console · ",t.st.hostFor(t.st.form?.moduleKey??"")||"host"]}),s("button",{type:"button",className:"link",onClick:()=>t.st.toggleLogs(),children:"hide"})]}),t.st.logsError!=null?p("div",{className:"error",children:["\uD83D\uDD34 ",t.st.logsError]}):null,s("pre",{children:t.st.logLines.join(`
19
- `)})]}):null]}),t.st.layout==="off"?null:p("div",{className:"results-col",children:[t.st.generateInResults?p("div",{className:"results-run",children:[s(hf,{st:t.st}),t.st.run.error!=null?p("span",{className:"error",children:["\uD83D\uDD34 ",t.st.run.error]}):null]}):null,s(bg,{st:t.st,compact:t.st.layout==="pinned"})]})]})]})]})})});var py=`
3
+ `+Np+e+mx}var Tp=!1;function Mp(e,t){if(!e||Tp)return"";Tp=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(d){var h=d}Reflect.construct(e,[],f)}else{try{f.call()}catch(d){h=d}e.call(f.prototype)}}else{try{throw Error()}catch(d){h=d}(f=e())&&typeof f.catch==="function"&&f.catch(function(){})}}catch(d){if(d&&h&&typeof d.stack==="string")return[d.stack,h.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=i.DetermineComponentFrameRoot(),s=o[0],l=o[1];if(s&&l){var a=s.split(`
4
+ `),u=l.split(`
5
+ `);for(r=i=0;i<a.length&&!a[i].includes("DetermineComponentFrameRoot");)i++;for(;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;if(i===a.length||r===u.length)for(i=a.length-1,r=u.length-1;1<=i&&0<=r&&a[i]!==u[r];)r--;for(;1<=i&&0<=r;i--,r--)if(a[i]!==u[r]){if(i!==1||r!==1)do if(i--,r--,0>r||a[i]!==u[r]){var c=`
6
+ `+a[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=r);break}}}finally{Tp=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ro(n):""}function v2(e,t){switch(e.tag){case 26:case 27:case 5:return Ro(e.type);case 16:return Ro("Lazy");case 13:return e.child!==t&&t!==null?Ro("Suspense Fallback"):Ro("Suspense");case 19:return Ro("SuspenseList");case 0:case 15:return Mp(e.type,!1);case 11:return Mp(e.type.render,!1);case 1:return Mp(e.type,!0);case 31:return Ro("Activity");default:return""}}function gx(e){try{var t="",n=null;do t+=v2(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
7
+ Error generating stack: `+i.message+`
8
+ `+i.stack}}var pm=Object.prototype.hasOwnProperty,sg=Ao,_p=zc,b2=Ic,y2=Pc,Zt=Un,x2=Bc,Uw=_c,jw=Lc,Ef=Co,w2=Dc,Fw=Mc,S2=void 0,k2=void 0,tu=null,en=null;function zr(e){if(typeof S2==="function"&&k2(e),en&&typeof en.setStrictMode==="function")try{en.setStrictMode(tu,e)}catch(t){}}var tn=Math.clz32?Math.clz32:A2,{log:E2,LN2:C2}=Math;function A2(e){return e>>>=0,e===0?32:31-(E2(e)/C2|0)|0}var qc=256,$c=262144,Gc=4194304;function No(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&261888;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 Xf(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var l=i&134217727;return l!==0?(i=l&~o,i!==0?r=No(i):(s&=l,s!==0?r=No(s):n||(n=l&~e,n!==0&&(r=No(n))))):(l=i&~o,l!==0?r=No(l):s!==0?r=No(s):n||(n=i&~e,n!==0&&(r=No(n)))),r===0?0:t!==0&&t!==r&&(t&o)===0&&(o=r&-r,n=t&-t,o>=n||o===32&&(n&4194048)!==0)?t:r}function nu(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function O2(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5000;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Kw(){var e=Gc;return Gc<<=1,(Gc&62914560)===0&&(Gc=4194304),e}function Dp(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qf(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function R2(e,t,n,i,r,o){var s=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var{entanglements:l,expirationTimes:a,hiddenUpdates:u}=e;for(n=s&~n;0<n;){var c=31-tn(n),f=1<<c;l[c]=0,a[c]=-1;var h=u[c];if(h!==null)for(u[c]=null,c=0;c<h.length;c++){var d=h[c];d!==null&&(d.lane&=-536870913)}n&=~f}i!==0&&qw(e,i,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(s&~t))}function qw(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-tn(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function $w(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-tn(n),r=1<<i;r&t|e[i]&t&&(e[i]|=t),n&=~r}}function Gw(e,t){var n=t&-t;return n=(n&42)!==0?1:Ww(n),(n&(e.suspendedLanes|t))!==0?0:n}function Ww(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 lg(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Yw(){var e=ge.p;if(e!==0)return e;return e=window.event,e===void 0?32:pk(e.type)}function vx(e,t){var n=ge.p;try{return ge.p=e,t()}finally{ge.p=n}}var Qr=Math.random().toString(36).slice(2),dt="__reactFiber$"+Qr,Ut="__reactProps$"+Qr,iu="__reactContainer$"+Qr,mm="__reactEvents$"+Qr,N2="__reactListeners$"+Qr,T2="__reactHandles$"+Qr,bx="__reactResources$"+Qr,ru="__reactMarker$"+Qr;function ag(e){delete e[dt],delete e[Ut],delete e[mm],delete e[N2],delete e[T2]}function zs(e){var t=e[dt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[iu]||n[dt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ew(e);e!==null;){if(n=e[dt])return n;e=Ew(e)}return t}e=n,n=e.parentNode}return null}function ul(e){if(e=e[dt]||e[iu]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function xa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(R(33))}function qs(e){var t=e[bx];return t||(t=e[bx]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ot(e){e[ru]=!0}var Xw=new Set,Qw={};function qo(e,t){Zs(e,t),Zs(e+"Capture",t)}function Zs(e,t){Qw[e]=t;for(e=0;e<t.length;e++)Xw.add(t[e])}var M2=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]*$"),yx={},xx={};function _2(e){if(pm.call(xx,e))return!0;if(pm.call(yx,e))return!1;if(M2.test(e))return xx[e]=!0;return yx[e]=!0,!1}function of(e,t,n){if(_2(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Wc(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 Hi(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+i)}}function gn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Jw(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function D2(e,t,n){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get==="function"&&typeof i.set==="function"){var{get:r,set:o}=i;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gm(e){if(!e._valueTracker){var t=Jw(e)?"checked":"value";e._valueTracker=D2(e,t,""+e[t])}}function Zw(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=Jw(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function Cf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch(t){return e.body}}var L2=/[\n"\\]/g;function yn(e){return e.replace(L2,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function vm(e,t,n,i,r,o,s,l){if(e.name="",s!=null&&typeof s!=="function"&&typeof s!=="symbol"&&typeof s!=="boolean"?e.type=s:e.removeAttribute("type"),t!=null)if(s==="number"){if(t===0&&e.value===""||e.value!=t)e.value=""+gn(t)}else e.value!==""+gn(t)&&(e.value=""+gn(t));else s!=="submit"&&s!=="reset"||e.removeAttribute("value");t!=null?bm(e,s,gn(t)):n!=null?bm(e,s,gn(n)):i!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!=="function"&&typeof r!=="symbol"),l!=null&&typeof l!=="function"&&typeof l!=="symbol"&&typeof l!=="boolean"?e.name=""+gn(l):e.removeAttribute("name")}function e1(e,t,n,i,r,o,s,l){if(o!=null&&typeof o!=="function"&&typeof o!=="symbol"&&typeof o!=="boolean"&&(e.type=o),t!=null||n!=null){if(!(o!=="submit"&&o!=="reset"||t!==void 0&&t!==null)){gm(e);return}n=n!=null?""+gn(n):"",t=t!=null?""+gn(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}i=i!=null?i:r,i=typeof i!=="function"&&typeof i!=="symbol"&&!!i,e.checked=l?e.checked:!!i,e.defaultChecked=!!i,s!=null&&typeof s!=="function"&&typeof s!=="symbol"&&typeof s!=="boolean"&&(e.name=s),gm(e)}function bm(e,t,n){t==="number"&&Cf(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function $s(e,t,n,i){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&i&&(e[n].defaultSelected=!0)}else{n=""+gn(n),t=null;for(r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,i&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function t1(e,t,n){if(t!=null&&(t=""+gn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+gn(n):""}function n1(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(R(92));if(ya(i)){if(1<i.length)throw Error(R(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=gn(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),gm(e)}function el(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var z2=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 wx(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n==="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!=="number"||n===0||z2.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function i1(e,t,n){if(t!=null&&typeof t!=="object")throw Error(R(62));if(e=e.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var r in t)i=t[r],t.hasOwnProperty(r)&&n[r]!==i&&wx(e,r,i)}else for(var o in t)t.hasOwnProperty(o)&&wx(e,o,t[o])}function ug(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 B2=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),P2=/^[\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 sf(e){return P2.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Wi(){}var ym=null;function cg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bs=null,Gs=null;function Sx(e){var t=ul(e);if(t&&(e=t.stateNode)){var n=e[Ut]||null;e:switch(e=t.stateNode,t.type){case"input":if(vm(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;n=n.querySelectorAll('input[name="'+yn(""+t)+'"][type="radio"]');for(t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var r=i[Ut]||null;if(!r)throw Error(R(90));vm(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&Zw(i)}break e;case"textarea":t1(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&$s(e,!!n.multiple,t,!1)}}}var Lp=!1;function r1(e,t,n){if(Lp)return e(t,n);Lp=!0;try{var i=e(t);return i}finally{if(Lp=!1,Bs!==null||Gs!==null){if(uh(),Bs&&(t=Bs,e=Gs,Gs=Bs=null,Sx(t),e))for(t=0;t<e.length;t++)Sx(e[t])}}}function Ua(e,t){var n=e.stateNode;if(n===null)return null;var i=n[Ut]||null;if(i===null)return null;n=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(n&&typeof n!=="function")throw Error(R(231,t,typeof n));return n}var Zi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xm=!1;if(Zi)try{To={},Object.defineProperty(To,"passive",{get:function(){xm=!0}}),window.addEventListener("test",To,To),window.removeEventListener("test",To,To)}catch(e){xm=!1}var To,Br=null,fg=null,lf=null;function o1(){if(lf)return lf;var e,t=fg,n=t.length,i,r="value"in Br?Br.value:Br.textContent,o=r.length;for(e=0;e<n&&t[e]===r[e];e++);var s=n-e;for(i=1;i<=s&&t[n-i]===r[o-i];i++);return lf=r.slice(e,1<i?1-i:void 0)}function af(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 Yc(){return!0}function kx(){return!1}function jt(e){function t(n,i,r,o,s){this._reactName=n,this._targetInst=r,this.type=i,this.nativeEvent=o,this.target=s,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Yc:kx,this.isPropagationStopped=kx,this}return ze(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!=="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Yc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!=="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Yc)},persist:function(){},isPersistent:Yc}),t}var $o={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jf=jt($o),ou=ze({},$o,{view:0,detail:0}),I2=jt(ou),zp,Bp,da,Zf=ze({},ou,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hg,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){if("movementX"in e)return e.movementX;return e!==da&&(da&&e.type==="mousemove"?(zp=e.screenX-da.screenX,Bp=e.screenY-da.screenY):Bp=zp=0,da=e),zp},movementY:function(e){return"movementY"in e?e.movementY:Bp}}),Ex=jt(Zf),V2=ze({},Zf,{dataTransfer:0}),H2=jt(V2),U2=ze({},ou,{relatedTarget:0}),Pp=jt(U2),j2=ze({},$o,{animationName:0,elapsedTime:0,pseudoElement:0}),F2=jt(j2),K2=ze({},$o,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),q2=jt(K2),$2=ze({},$o,{data:0}),Cx=jt($2),G2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},W2={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"},Y2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function X2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Y2[e])?!!t[e]:!1}function hg(){return X2}var Q2=ze({},ou,{key:function(e){if(e.key){var t=G2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=af(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?W2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hg,charCode:function(e){return e.type==="keypress"?af(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?af(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),J2=jt(Q2),Z2=ze({},Zf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ax=jt(Z2),eD=ze({},ou,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hg}),tD=jt(eD),nD=ze({},$o,{propertyName:0,elapsedTime:0,pseudoElement:0}),iD=jt(nD),rD=ze({},Zf,{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}),oD=jt(rD),sD=ze({},$o,{newState:0,oldState:0}),lD=jt(sD),aD=[9,13,27,32],dg=Zi&&"CompositionEvent"in window,Oa=null;Zi&&"documentMode"in document&&(Oa=document.documentMode);var uD=Zi&&"TextEvent"in window&&!Oa,s1=Zi&&(!dg||Oa&&8<Oa&&11>=Oa),Ox=String.fromCharCode(32),Rx=!1;function l1(e,t){switch(e){case"keyup":return aD.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function a1(e){return e=e.detail,typeof e==="object"&&"data"in e?e.data:null}var Ps=!1;function cD(e,t){switch(e){case"compositionend":return a1(t);case"keypress":if(t.which!==32)return null;return Rx=!0,Ox;case"textInput":return e=t.data,e===Ox&&Rx?null:e;default:return null}}function fD(e,t){if(Ps)return e==="compositionend"||!dg&&l1(e,t)?(e=o1(),lf=fg=Br=null,Ps=!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 s1&&t.locale!=="ko"?null:t.data;default:return null}}var hD={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 Nx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!hD[e.type]:t==="textarea"?!0:!1}function u1(e,t,n,i){Bs?Gs?Gs.push(i):Gs=[i]:Bs=i,t=Ff(t,"onChange"),0<t.length&&(n=new Jf("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var Ra=null,ja=null;function dD(e){tk(e,0)}function eh(e){var t=xa(e);if(Zw(t))return e}function Tx(e,t){if(e==="change")return t}var c1=!1;if(Zi){if(Zi){if(Sa="oninput"in document,!Sa)uf=document.createElement("div"),uf.setAttribute("oninput","return;"),Sa=typeof uf.oninput==="function";wa=Sa}else wa=!1;c1=wa&&(!document.documentMode||9<document.documentMode)}var wa,Sa,uf;function Mx(){Ra&&(Ra.detachEvent("onpropertychange",f1),ja=Ra=null)}function f1(e){if(e.propertyName==="value"&&eh(ja)){var t=[];u1(t,ja,e,cg(e)),r1(dD,t)}}function pD(e,t,n){e==="focusin"?(Mx(),Ra=t,ja=n,Ra.attachEvent("onpropertychange",f1)):e==="focusout"&&Mx()}function mD(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return eh(ja)}function gD(e,t){if(e==="click")return eh(t)}function vD(e,t){if(e==="input"||e==="change")return eh(t)}function bD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var nn=typeof Object.is==="function"?Object.is:bD;function Fa(e,t){if(nn(e,t))return!0;if(typeof e!=="object"||e===null||typeof t!=="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!pm.call(t,r)||!nn(e[r],t[r]))return!1}return!0}function _x(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dx(e,t){var n=_x(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=_x(n)}}function h1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?h1(e,t.parentNode):("contains"in e)?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function d1(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Cf(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==="string"}catch(i){n=!1}if(n)e=t.contentWindow;else break;t=Cf(e.document)}return t}function pg(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 yD=Zi&&"documentMode"in document&&11>=document.documentMode,Is=null,wm=null,Na=null,Sm=!1;function Lx(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sm||Is==null||Is!==Cf(i)||(i=Is,("selectionStart"in i)&&pg(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Na&&Fa(Na,i)||(Na=i,i=Ff(wm,"onSelect"),0<i.length&&(t=new Jf("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=Is)))}function Oo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Vs={animationend:Oo("Animation","AnimationEnd"),animationiteration:Oo("Animation","AnimationIteration"),animationstart:Oo("Animation","AnimationStart"),transitionrun:Oo("Transition","TransitionRun"),transitionstart:Oo("Transition","TransitionStart"),transitioncancel:Oo("Transition","TransitionCancel"),transitionend:Oo("Transition","TransitionEnd")},Ip={},p1={};Zi&&(p1=document.createElement("div").style,("AnimationEvent"in window)||(delete Vs.animationend.animation,delete Vs.animationiteration.animation,delete Vs.animationstart.animation),("TransitionEvent"in window)||delete Vs.transitionend.transition);function Go(e){if(Ip[e])return Ip[e];if(!Vs[e])return e;var t=Vs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in p1)return Ip[e]=t[n];return e}var m1=Go("animationend"),g1=Go("animationiteration"),v1=Go("animationstart"),xD=Go("transitionrun"),wD=Go("transitionstart"),SD=Go("transitioncancel"),b1=Go("transitionend"),y1=new Map,km="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");km.push("scrollEnd");function Kn(e,t){y1.set(e,t),qo(t,[e])}var Af=typeof reportError==="function"?reportError:function(e){if(typeof window==="object"&&typeof window.ErrorEvent==="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e==="object"&&e!==null&&typeof e.message==="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==="object"&&typeof process.emit==="function"){process.emit("uncaughtException",e);return}console.error(e)},mn=[],Hs=0,mg=0;function th(){for(var e=Hs,t=mg=Hs=0;t<e;){var n=mn[t];mn[t++]=null;var i=mn[t];mn[t++]=null;var r=mn[t];mn[t++]=null;var o=mn[t];if(mn[t++]=null,i!==null&&r!==null){var s=i.pending;s===null?r.next=r:(r.next=s.next,s.next=r),i.pending=r}o!==0&&x1(n,r,o)}}function nh(e,t,n,i){mn[Hs++]=e,mn[Hs++]=t,mn[Hs++]=n,mn[Hs++]=i,mg|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function gg(e,t,n,i){return nh(e,t,n,i),Of(e)}function Wo(e,t){return nh(e,null,null,t),Of(e)}function x1(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var r=!1,o=e.return;o!==null;)o.childLanes|=n,i=o.alternate,i!==null&&(i.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(r=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,r&&t!==null&&(r=31-tn(n),e=o.hiddenUpdates,i=e[r],i===null?e[r]=[t]:i.push(t),t.lane=n|536870912),o):null}function Of(e){if(50<Ia)throw Ia=0,Km=null,Error(R(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Us={};function kD(e,t,n,i){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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qt(e,t,n,i){return new kD(e,t,n,i)}function vg(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xi(e,t){var n=e.alternate;return n===null?(n=Qt(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&65011712,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 w1(e,t){e.flags&=65011714;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 cf(e,t,n,i,r,o){var s=0;if(i=e,typeof e==="function")vg(e)&&(s=1);else if(typeof e==="string")s=NL(e,n,vi.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case cm:return e=Qt(31,n,t,r),e.elementType=cm,e.lanes=o,e;case Ds:return Lo(n.children,r,o,t);case Vw:s=8,r|=24;break;case lm:return e=Qt(12,n,t,r|2),e.elementType=lm,e.lanes=o,e;case am:return e=Qt(13,n,t,r),e.elementType=am,e.lanes=o,e;case um:return e=Qt(19,n,t,r),e.elementType=um,e.lanes=o,e;default:if(typeof e==="object"&&e!==null)switch(e.$$typeof){case Gi:s=10;break e;case Hw:s=9;break e;case rg:s=11;break e;case og:s=14;break e;case Nr:s=16,i=null;break e}s=29,n=Error(R(130,e===null?"null":typeof e,"")),i=null}return t=Qt(s,n,t,r),t.elementType=e,t.type=i,t.lanes=o,t}function Lo(e,t,n,i){return e=Qt(7,e,i,t),e.lanes=n,e}function Vp(e,t,n){return e=Qt(6,e,null,t),e.lanes=n,e}function S1(e){var t=Qt(18,null,null,0);return t.stateNode=e,t}function Hp(e,t,n){return t=Qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var zx=new WeakMap;function xn(e,t){if(typeof e==="object"&&e!==null){var n=zx.get(e);if(n!==void 0)return n;return t={value:e,source:t,stack:gx(t)},zx.set(e,t),t}return{value:e,source:t,stack:gx(t)}}var js=[],Fs=0,Rf=null,Ka=0,vn=[],bn=0,Gr=null,pi=1,mi="";function qi(e,t){js[Fs++]=Ka,js[Fs++]=Rf,Rf=e,Ka=t}function k1(e,t,n){vn[bn++]=pi,vn[bn++]=mi,vn[bn++]=Gr,Gr=e;var i=pi;e=mi;var r=32-tn(i)-1;i&=~(1<<r),n+=1;var o=32-tn(t)+r;if(30<o){var s=r-r%5;o=(i&(1<<s)-1).toString(32),i>>=s,r-=s,pi=1<<32-tn(t)+r|n<<r|i,mi=o+e}else pi=1<<o|n<<r|i,mi=e}function bg(e){e.return!==null&&(qi(e,1),k1(e,1,0))}function yg(e){for(;e===Rf;)Rf=js[--Fs],js[Fs]=null,Ka=js[--Fs],js[Fs]=null;for(;e===Gr;)Gr=vn[--bn],vn[bn]=null,mi=vn[--bn],vn[bn]=null,pi=vn[--bn],vn[bn]=null}function E1(e,t){vn[bn++]=pi,vn[bn++]=mi,vn[bn++]=Gr,pi=t.id,mi=t.overflow,Gr=e}var pt=null,Le=null,he=!1,Ur=null,wn=!1,Em=Error(R(519));function Wr(e){var t=Error(R(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qa(xn(t,e)),Em}function Bx(e){var{stateNode:t,type:n,memoizedProps:i}=e;switch(t[dt]=e,t[Ut]=i,n){case"dialog":se("cancel",t),se("close",t);break;case"iframe":case"object":case"embed":se("load",t);break;case"video":case"audio":for(n=0;n<Ya.length;n++)se(Ya[n],t);break;case"source":se("error",t);break;case"img":case"image":case"link":se("error",t),se("load",t);break;case"details":se("toggle",t);break;case"input":se("invalid",t),e1(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":se("invalid",t);break;case"textarea":se("invalid",t),n1(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!=="string"&&typeof n!=="number"&&typeof n!=="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||rk(t.textContent,n)?(i.popover!=null&&(se("beforetoggle",t),se("toggle",t)),i.onScroll!=null&&se("scroll",t),i.onScrollEnd!=null&&se("scrollend",t),i.onClick!=null&&(t.onclick=Wi),t=!0):t=!1,t||Wr(e,!0)}function Px(e){for(pt=e.return;pt;)switch(pt.tag){case 5:case 31:case 13:wn=!1;return;case 27:case 3:wn=!0;return;default:pt=pt.return}}function Rs(e){if(e!==pt)return!1;if(!he)return Px(e),he=!0,!1;var t=e.tag,n;if(n=t!==3&&t!==27){if(n=t===5)n=e.type,n=!(n!=="form"&&n!=="button")||Qm(e.type,e.memoizedProps);n=!n}if(n&&Le&&Wr(e),Px(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(R(317));Le=kw(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(R(317));Le=kw(e)}else t===27?(t=Le,Jr(e.type)?(e=tg,tg=null,Le=e):Le=t):Le=pt?En(e.stateNode.nextSibling):null;return!0}function Ho(){Le=pt=null,he=!1}function Up(){var e=Ur;return e!==null&&(Vt===null?Vt=e:Vt.push.apply(Vt,e),Ur=null),e}function qa(e){Ur===null?Ur=[e]:Ur.push(e)}var Cm=bi(null),Yo=null,Yi=null;function Mr(e,t,n){Ae(Cm,t._currentValue),t._currentValue=n}function Qi(e){e._currentValue=Cm.current,st(Cm)}function Am(e,t,n){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function Om(e,t,n,i){var r=e.child;r!==null&&(r.return=e);for(;r!==null;){var o=r.dependencies;if(o!==null){var s=r.child;o=o.firstContext;e:for(;o!==null;){var l=o;o=r;for(var a=0;a<t.length;a++)if(l.context===t[a]){o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Am(o.return,n,e),i||(s=null);break e}o=l.next}}else if(r.tag===18){if(s=r.return,s===null)throw Error(R(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Am(s,n,e),s=null}else s=r.child;if(s!==null)s.return=r;else for(s=r;s!==null;){if(s===e){s=null;break}if(r=s.sibling,r!==null){r.return=s.return,s=r;break}s=s.return}r=s}}function cl(e,t,n,i){e=null;for(var r=t,o=!1;r!==null;){if(!o){if((r.flags&524288)!==0)o=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var s=r.alternate;if(s===null)throw Error(R(387));if(s=s.memoizedProps,s!==null){var l=r.type;nn(r.pendingProps.value,s.value)||(e!==null?e.push(l):e=[l])}}else if(r===wf.current){if(s=r.alternate,s===null)throw Error(R(387));s.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(Qa):e=[Qa])}r=r.return}e!==null&&Om(t,e,n,i),t.flags|=262144}function Nf(e){for(e=e.firstContext;e!==null;){if(!nn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Uo(e){Yo=e,Yi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function mt(e){return C1(Yo,e)}function Xc(e,t){return Yo===null&&Uo(e),C1(e,t)}function C1(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Yi===null){if(e===null)throw Error(R(308));Yi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Yi=Yi.next=t;return n}var ED=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},CD=Ao,AD=Co,tt={$$typeof:Gi,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xg(){return{controller:new ED,data:new Map,refCount:0}}function su(e){e.refCount--,e.refCount===0&&CD(AD,function(){e.controller.abort()})}var Ta=null,Rm=0,tl=0,Ws=null;function OD(e,t){if(Ta===null){var n=Ta=[];Rm=0,tl=qg(),Ws={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Rm++,t.then(Ix,Ix),t}function Ix(){if(--Rm===0&&Ta!==null){Ws!==null&&(Ws.status="fulfilled");var e=Ta;Ta=null,tl=0,Ws=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function RD(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){i.status="rejected",i.reason=r;for(r=0;r<n.length;r++)(0,n[r])(void 0)}),i}var Vx=J.S;J.S=function(e,t){BS=Zt(),typeof t==="object"&&t!==null&&typeof t.then==="function"&&OD(e,t),Vx!==null&&Vx(e,t)};var zo=bi(null);function wg(){var e=zo.current;return e!==null?e:Ee.pooledCache}function ff(e,t){t===null?Ae(zo,zo.current):Ae(zo,t.pool)}function A1(){var e=wg();return e===null?null:{parent:tt._currentValue,pool:e}}var fl=Error(R(460)),Sg=Error(R(474)),ih=Error(R(542)),Tf={then:function(){}};function Hx(e){return e=e.status,e==="fulfilled"||e==="rejected"}function O1(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Wi,Wi),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,jx(e),e;default:if(typeof t.status==="string")t.then(Wi,Wi);else{if(e=Ee,e!==null&&100<e.shellSuspendCounter)throw Error(R(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=i}},function(i){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,jx(e),e}throw Bo=t,fl}}function Mo(e){try{var t=e._init;return t(e._payload)}catch(n){if(n!==null&&typeof n==="object"&&typeof n.then==="function")throw Bo=n,fl;throw n}}var Bo=null;function Ux(){if(Bo===null)throw Error(R(459));var e=Bo;return Bo=null,e}function jx(e){if(e===fl||e===ih)throw Error(R(483))}var Ys=null,$a=0;function Qc(e){var t=$a;return $a+=1,Ys===null&&(Ys=[]),O1(Ys,e,t)}function pa(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Jc(e,t){if(t.$$typeof===p2)throw Error(R(525));throw e=Object.prototype.toString.call(t),Error(R(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function R1(e){function t(g,v){if(e){var y=g.deletions;y===null?(g.deletions=[v],g.flags|=16):y.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function i(g){for(var v=new Map;g!==null;)g.key!==null?v.set(g.key,g):v.set(g.index,g),g=g.sibling;return v}function r(g,v){return g=Xi(g,v),g.index=0,g.sibling=null,g}function o(g,v,y){if(g.index=y,!e)return g.flags|=1048576,v;if(y=g.alternate,y!==null)return y=y.index,y<v?(g.flags|=67108866,v):y;return g.flags|=67108866,v}function s(g){return e&&g.alternate===null&&(g.flags|=67108866),g}function l(g,v,y,S){if(v===null||v.tag!==6)return v=Vp(y,g.mode,S),v.return=g,v;return v=r(v,y),v.return=g,v}function a(g,v,y,S){var k=y.type;if(k===Ds)return c(g,v,y.props.children,S,y.key);if(v!==null&&(v.elementType===k||typeof k==="object"&&k!==null&&k.$$typeof===Nr&&Mo(k)===v.type))return v=r(v,y.props),pa(v,y),v.return=g,v;return v=cf(y.type,y.key,y.props,null,g.mode,S),pa(v,y),v.return=g,v}function u(g,v,y,S){if(v===null||v.tag!==4||v.stateNode.containerInfo!==y.containerInfo||v.stateNode.implementation!==y.implementation)return v=Hp(y,g.mode,S),v.return=g,v;return v=r(v,y.children||[]),v.return=g,v}function c(g,v,y,S,k){if(v===null||v.tag!==7)return v=Lo(y,g.mode,S,k),v.return=g,v;return v=r(v,y),v.return=g,v}function f(g,v,y){if(typeof v==="string"&&v!==""||typeof v==="number"||typeof v==="bigint")return v=Vp(""+v,g.mode,y),v.return=g,v;if(typeof v==="object"&&v!==null){switch(v.$$typeof){case Kc:return y=cf(v.type,v.key,v.props,null,g.mode,y),pa(y,v),y.return=g,y;case ba:return v=Hp(v,g.mode,y),v.return=g,v;case Nr:return v=Mo(v),f(g,v,y)}if(ya(v)||ha(v))return v=Lo(v,g.mode,y,null),v.return=g,v;if(typeof v.then==="function")return f(g,Qc(v),y);if(v.$$typeof===Gi)return f(g,Xc(g,v),y);Jc(g,v)}return null}function h(g,v,y,S){var k=v!==null?v.key:null;if(typeof y==="string"&&y!==""||typeof y==="number"||typeof y==="bigint")return k!==null?null:l(g,v,""+y,S);if(typeof y==="object"&&y!==null){switch(y.$$typeof){case Kc:return y.key===k?a(g,v,y,S):null;case ba:return y.key===k?u(g,v,y,S):null;case Nr:return y=Mo(y),h(g,v,y,S)}if(ya(y)||ha(y))return k!==null?null:c(g,v,y,S,null);if(typeof y.then==="function")return h(g,v,Qc(y),S);if(y.$$typeof===Gi)return h(g,v,Xc(g,y),S);Jc(g,y)}return null}function d(g,v,y,S,k){if(typeof S==="string"&&S!==""||typeof S==="number"||typeof S==="bigint")return g=g.get(y)||null,l(v,g,""+S,k);if(typeof S==="object"&&S!==null){switch(S.$$typeof){case Kc:return g=g.get(S.key===null?y:S.key)||null,a(v,g,S,k);case ba:return g=g.get(S.key===null?y:S.key)||null,u(v,g,S,k);case Nr:return S=Mo(S),d(g,v,y,S,k)}if(ya(S)||ha(S))return g=g.get(y)||null,c(v,g,S,k,null);if(typeof S.then==="function")return d(g,v,y,Qc(S),k);if(S.$$typeof===Gi)return d(g,v,y,Xc(v,S),k);Jc(v,S)}return null}function m(g,v,y,S){for(var k=null,A=null,E=v,O=v=0,T=null;E!==null&&O<y.length;O++){E.index>O?(T=E,E=null):T=E.sibling;var _=h(g,E,y[O],S);if(_===null){E===null&&(E=T);break}e&&E&&_.alternate===null&&t(g,E),v=o(_,v,O),A===null?k=_:A.sibling=_,A=_,E=T}if(O===y.length)return n(g,E),he&&qi(g,O),k;if(E===null){for(;O<y.length;O++)E=f(g,y[O],S),E!==null&&(v=o(E,v,O),A===null?k=E:A.sibling=E,A=E);return he&&qi(g,O),k}for(E=i(E);O<y.length;O++)T=d(E,g,O,y[O],S),T!==null&&(e&&T.alternate!==null&&E.delete(T.key===null?O:T.key),v=o(T,v,O),A===null?k=T:A.sibling=T,A=T);return e&&E.forEach(function(L){return t(g,L)}),he&&qi(g,O),k}function b(g,v,y,S){if(y==null)throw Error(R(151));for(var k=null,A=null,E=v,O=v=0,T=null,_=y.next();E!==null&&!_.done;O++,_=y.next()){E.index>O?(T=E,E=null):T=E.sibling;var L=h(g,E,_.value,S);if(L===null){E===null&&(E=T);break}e&&E&&L.alternate===null&&t(g,E),v=o(L,v,O),A===null?k=L:A.sibling=L,A=L,E=T}if(_.done)return n(g,E),he&&qi(g,O),k;if(E===null){for(;!_.done;O++,_=y.next())_=f(g,_.value,S),_!==null&&(v=o(_,v,O),A===null?k=_:A.sibling=_,A=_);return he&&qi(g,O),k}for(E=i(E);!_.done;O++,_=y.next())_=d(E,g,O,_.value,S),_!==null&&(e&&_.alternate!==null&&E.delete(_.key===null?O:_.key),v=o(_,v,O),A===null?k=_:A.sibling=_,A=_);return e&&E.forEach(function(B){return t(g,B)}),he&&qi(g,O),k}function x(g,v,y,S){if(typeof y==="object"&&y!==null&&y.type===Ds&&y.key===null&&(y=y.props.children),typeof y==="object"&&y!==null){switch(y.$$typeof){case Kc:e:{for(var k=y.key;v!==null;){if(v.key===k){if(k=y.type,k===Ds){if(v.tag===7){n(g,v.sibling),S=r(v,y.props.children),S.return=g,g=S;break e}}else if(v.elementType===k||typeof k==="object"&&k!==null&&k.$$typeof===Nr&&Mo(k)===v.type){n(g,v.sibling),S=r(v,y.props),pa(S,y),S.return=g,g=S;break e}n(g,v);break}else t(g,v);v=v.sibling}y.type===Ds?(S=Lo(y.props.children,g.mode,S,y.key),S.return=g,g=S):(S=cf(y.type,y.key,y.props,null,g.mode,S),pa(S,y),S.return=g,g=S)}return s(g);case ba:e:{for(k=y.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===y.containerInfo&&v.stateNode.implementation===y.implementation){n(g,v.sibling),S=r(v,y.children||[]),S.return=g,g=S;break e}else{n(g,v);break}else t(g,v);v=v.sibling}S=Hp(y,g.mode,S),S.return=g,g=S}return s(g);case Nr:return y=Mo(y),x(g,v,y,S)}if(ya(y))return m(g,v,y,S);if(ha(y)){if(k=ha(y),typeof k!=="function")throw Error(R(150));return y=k.call(y),b(g,v,y,S)}if(typeof y.then==="function")return x(g,v,Qc(y),S);if(y.$$typeof===Gi)return x(g,v,Xc(g,y),S);Jc(g,y)}return typeof y==="string"&&y!==""||typeof y==="number"||typeof y==="bigint"?(y=""+y,v!==null&&v.tag===6?(n(g,v.sibling),S=r(v,y),S.return=g,g=S):(n(g,v),S=Vp(y,g.mode,S),S.return=g,g=S),s(g)):n(g,v)}return function(g,v,y,S){try{$a=0;var k=x(g,v,y,S);return Ys=null,k}catch(E){if(E===fl||E===ih)throw E;var A=Qt(29,E,null,g.mode);return A.lanes=S,A.return=g,A}finally{}}}var jo=R1(!0),N1=R1(!1),Tr=!1;function kg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Nm(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 Po(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Io(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(me&2)!==0){var r=i.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),i.pending=t,t=Of(e),x1(e,null,n),t}return nh(e,i,t,n),Of(e)}function Ma(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,$w(e,n)}}function jp(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?r=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?r=o=t:o=o.next=t}else r=o=t;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Tm=!1;function _a(){if(Tm){var e=Ws;if(e!==null)throw e}}function Da(e,t,n,i){Tm=!1;var r=e.updateQueue;Tr=!1;var{firstBaseUpdate:o,lastBaseUpdate:s}=r,l=r.shared.pending;if(l!==null){r.shared.pending=null;var a=l,u=a.next;a.next=null,s===null?o=u:s.next=u,s=a;var c=e.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==s&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(o!==null){var f=r.baseState;s=0,c=u=a=null,l=o;do{var h=l.lane&-536870913,d=h!==l.lane;if(d?(ue&h)===h:(i&h)===h){h!==0&&h===tl&&(Tm=!0),c!==null&&(c=c.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var m=e,b=l;h=t;var x=n;switch(b.tag){case 1:if(m=b.payload,typeof m==="function"){f=m.call(x,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,h=typeof m==="function"?m.call(x,f,h):m,h===null||h===void 0)break e;f=ze({},f,h);break e;case 2:Tr=!0}}h=l.callback,h!==null&&(e.flags|=64,d&&(e.flags|=8192),d=r.callbacks,d===null?r.callbacks=[h]:d.push(h))}else d={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=d,a=f):c=c.next=d,s|=h;if(l=l.next,l===null)if(l=r.shared.pending,l===null)break;else d=l,l=d.next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}while(1);c===null&&(a=f),r.baseState=a,r.firstBaseUpdate=u,r.lastBaseUpdate=c,o===null&&(r.shared.lanes=0),Xr|=s,e.lanes=s,e.memoizedState=f}}function T1(e,t){if(typeof e!=="function")throw Error(R(191,e));e.call(t)}function M1(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)T1(n[e],t)}var nl=bi(null),Mf=bi(0);function Fx(e,t){e=ir,Ae(Mf,e),Ae(nl,t),ir=e|t.baseLanes}function Mm(){Ae(Mf,ir),Ae(nl,nl.current)}function Eg(){ir=Mf.current,st(nl),st(Mf)}var rn=bi(null),Sn=null;function _r(e){var t=e.alternate;Ae(Ke,Ke.current&1),Ae(rn,e),Sn===null&&(t===null||nl.current!==null?Sn=e:t.memoizedState!==null&&(Sn=e))}function _m(e){Ae(Ke,Ke.current),Ae(rn,e),Sn===null&&(Sn=e)}function _1(e){e.tag===22?(Ae(Ke,Ke.current),Ae(rn,e),Sn===null&&(Sn=e)):Dr(e)}function Dr(){Ae(Ke,Ke.current),Ae(rn,rn.current)}function Xt(e){st(rn),Sn===e&&(Sn=null),st(Ke)}var Ke=bi(0);function _f(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Zm(n)||eg(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var er=0,ne=null,we=null,Ze=null,Df=!1,Xs=!1,Fo=!1,Lf=0,Ga=0,Qs=null,ND=0;function He(){throw Error(R(321))}function Cg(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!nn(e[n],t[n]))return!1;return!0}function Ag(e,t,n,i,r,o){return er=o,ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,J.H=e===null||e.memoizedState===null?uS:Pg,Fo=!1,o=n(i,r),Fo=!1,Xs&&(o=L1(t,n,i,r)),D1(e),o}function D1(e){J.H=Wa;var t=we!==null&&we.next!==null;if(er=0,Ze=we=ne=null,Df=!1,Ga=0,Qs=null,t)throw Error(R(300));e===null||nt||(e=e.dependencies,e!==null&&Nf(e)&&(nt=!0))}function L1(e,t,n,i){ne=e;var r=0;do{if(Xs&&(Qs=null),Ga=0,Xs=!1,25<=r)throw Error(R(301));if(r+=1,Ze=we=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}J.H=cS,o=t(n,i)}while(Xs);return o}function TD(){var e=J.H,t=e.useState()[0];return t=typeof t.then==="function"?lu(t):t,e=e.useState()[0],(we!==null?we.memoizedState:null)!==e&&(ne.flags|=1024),t}function Og(){var e=Lf!==0;return Lf=0,e}function Rg(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ng(e){if(Df){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Df=!1}er=0,Ze=we=ne=null,Xs=!1,Ga=Lf=0,Qs=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ze===null?ne.memoizedState=Ze=e:Ze=Ze.next=e,Ze}function qe(){if(we===null){var e=ne.alternate;e=e!==null?e.memoizedState:null}else e=we.next;var t=Ze===null?ne.memoizedState:Ze.next;if(t!==null)Ze=t,we=e;else{if(e===null){if(ne.alternate===null)throw Error(R(467));throw Error(R(310))}we=e,e={memoizedState:we.memoizedState,baseState:we.baseState,baseQueue:we.baseQueue,queue:we.queue,next:null},Ze===null?ne.memoizedState=Ze=e:Ze=Ze.next=e}return Ze}function rh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lu(e){var t=Ga;return Ga+=1,Qs===null&&(Qs=[]),e=O1(Qs,e,t),t=ne,(Ze===null?t.memoizedState:Ze.next)===null&&(t=t.alternate,J.H=t===null||t.memoizedState===null?uS:Pg),e}function oh(e){if(e!==null&&typeof e==="object"){if(typeof e.then==="function")return lu(e);if(e.$$typeof===Gi)return mt(e)}throw Error(R(438,String(e)))}function Tg(e){var t=null,n=ne.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=ne.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=rh(),ne.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=m2;return t.index++,n}function tr(e,t){return typeof t==="function"?t(e):t}function hf(e){var t=qe();return Mg(t,we,e)}function Mg(e,t,n){var i=e.queue;if(i===null)throw Error(R(311));i.lastRenderedReducer=n;var r=e.baseQueue,o=i.pending;if(o!==null){if(r!==null){var s=r.next;r.next=o.next,o.next=s}t.baseQueue=r=o,i.pending=null}if(o=e.baseState,r===null)e.memoizedState=o;else{t=r.next;var l=s=null,a=null,u=t,c=!1;do{var f=u.lane&-536870913;if(f!==u.lane?(ue&f)===f:(er&f)===f){var h=u.revertLane;if(h===0)a!==null&&(a=a.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===tl&&(c=!0);else if((er&h)===h){u=u.next,h===tl&&(c=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},a===null?(l=a=f,s=o):a=a.next=f,ne.lanes|=h,Xr|=h;f=u.action,Fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else h={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},a===null?(l=a=h,s=o):a=a.next=h,ne.lanes|=f,Xr|=f;u=u.next}while(u!==null&&u!==t);if(a===null?s=o:a.next=l,!nn(o,e.memoizedState)&&(nt=!0,c&&(n=Ws,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=a,i.lastRenderedState=o}return r===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Fp(e){var t=qe(),n=t.queue;if(n===null)throw Error(R(311));n.lastRenderedReducer=e;var{dispatch:i,pending:r}=n,o=t.memoizedState;if(r!==null){n.pending=null;var s=r=r.next;do o=e(o,s.action),s=s.next;while(s!==r);nn(o,t.memoizedState)||(nt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function z1(e,t,n){var i=ne,r=qe(),o=he;if(o){if(n===void 0)throw Error(R(407));n=n()}else n=t();var s=!nn((we||r).memoizedState,n);if(s&&(r.memoizedState=n,nt=!0),r=r.queue,_g(I1.bind(null,i,r,e),[e]),r.getSnapshot!==t||s||Ze!==null&&Ze.memoizedState.tag&1){if(i.flags|=2048,il(9,{destroy:void 0},P1.bind(null,i,r,n,t),null),Ee===null)throw Error(R(349));o||(er&127)!==0||B1(i,t,n)}return n}function B1(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ne.updateQueue,t===null?(t=rh(),ne.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function P1(e,t,n,i){t.value=n,t.getSnapshot=i,V1(t)&&H1(e)}function I1(e,t,n){return n(function(){V1(t)&&H1(e)})}function V1(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!nn(e,n)}catch(i){return!0}}function H1(e){var t=Wo(e,2);t!==null&&Ht(t,e,2)}function Dm(e){var t=Rt();if(typeof e==="function"){var n=e;if(e=n(),Fo){zr(!0);try{n()}finally{zr(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:e},t}function U1(e,t,n,i){return e.baseState=n,Mg(e,we,typeof i==="function"?i:tr)}function MD(e,t,n,i,r){if(lh(e))throw Error(R(485));if(e=t.action,e!==null){var o={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){o.listeners.push(s)}};J.T!==null?n(!0):o.isTransition=!1,i(o),n=t.pending,n===null?(o.next=t.pending=o,j1(t,o)):(o.next=n.next,t.pending=n.next=o)}}function j1(e,t){var{action:n,payload:i}=t,r=e.state;if(t.isTransition){var o=J.T,s={};J.T=s;try{var l=n(r,i),a=J.S;a!==null&&a(s,l),Kx(e,t,l)}catch(u){Lm(e,t,u)}finally{o!==null&&s.types!==null&&(o.types=s.types),J.T=o}}else try{o=n(r,i),Kx(e,t,o)}catch(u){Lm(e,t,u)}}function Kx(e,t,n){n!==null&&typeof n==="object"&&typeof n.then==="function"?n.then(function(i){qx(e,t,i)},function(i){return Lm(e,t,i)}):qx(e,t,n)}function qx(e,t,n){t.status="fulfilled",t.value=n,F1(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,j1(e,n)))}function Lm(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,F1(t),t=t.next;while(t!==i)}e.action=null}function F1(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function K1(e,t){return t}function $x(e,t){if(he){var n=Ee.formState;if(n!==null){e:{var i=ne;if(he){if(Le){t:{var r=Le;for(var o=wn;r.nodeType!==8;){if(!o){r=null;break t}if(r=En(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){Le=En(r.nextSibling),i=r.data==="F!";break e}}Wr(i)}i=!1}i&&(t=n[0])}}return n=Rt(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:K1,lastRenderedState:t},n.queue=i,n=sS.bind(null,ne,i),i.dispatch=n,i=Dm(!1),o=Bg.bind(null,ne,!1,i.queue),i=Rt(),r={state:t,dispatch:null,action:e,pending:null},i.queue=r,n=MD.bind(null,ne,r,o,n),r.dispatch=n,i.memoizedState=e,[t,n,!1]}function Gx(e){var t=qe();return q1(t,we,e)}function q1(e,t,n){if(t=Mg(e,t,K1)[0],e=hf(tr)[0],typeof t==="object"&&t!==null&&typeof t.then==="function")try{var i=lu(t)}catch(s){if(s===fl)throw ih;throw s}else i=t;t=qe();var r=t.queue,o=r.dispatch;return n!==t.memoizedState&&(ne.flags|=2048,il(9,{destroy:void 0},_D.bind(null,r,n),null)),[i,o,e]}function _D(e,t){e.action=t}function Wx(e){var t=qe(),n=we;if(n!==null)return q1(t,n,e);qe(),t=t.memoizedState,n=qe();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function il(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=ne.updateQueue,t===null&&(t=rh(),ne.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function $1(){return qe().memoizedState}function df(e,t,n,i){var r=Rt();ne.flags|=e,r.memoizedState=il(1|t,{destroy:void 0},n,i===void 0?null:i)}function sh(e,t,n,i){var r=qe();i=i===void 0?null:i;var o=r.memoizedState.inst;we!==null&&i!==null&&Cg(i,we.memoizedState.deps)?r.memoizedState=il(t,o,n,i):(ne.flags|=e,r.memoizedState=il(1|t,o,n,i))}function Yx(e,t){df(8390656,8,e,t)}function _g(e,t){sh(2048,8,e,t)}function DD(e){ne.flags|=4;var t=ne.updateQueue;if(t===null)t=rh(),ne.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function G1(e){var t=qe().memoizedState;return DD({ref:t,nextImpl:e}),function(){if((me&2)!==0)throw Error(R(440));return t.impl.apply(void 0,arguments)}}function W1(e,t){return sh(4,2,e,t)}function Y1(e,t){return sh(4,4,e,t)}function X1(e,t){if(typeof t==="function"){e=e();var n=t(e);return function(){typeof n==="function"?n():t(null)}}if(t!==null&&t!==void 0)return e=e(),t.current=e,function(){t.current=null}}function Q1(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,sh(4,4,X1.bind(null,t,e),n)}function Dg(){}function J1(e,t){var n=qe();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Cg(t,i[1]))return i[0];return n.memoizedState=[e,t],e}function Z1(e,t){var n=qe();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Cg(t,i[1]))return i[0];if(i=e(),Fo){zr(!0);try{e()}finally{zr(!1)}}return n.memoizedState=[i,t],i}function Lg(e,t,n){if(n===void 0||(er&1073741824)!==0&&(ue&261930)===0)return e.memoizedState=t;return e.memoizedState=n,e=IS(),ne.lanes|=e,Xr|=e,n}function eS(e,t,n,i){if(nn(n,t))return n;if(nl.current!==null)return e=Lg(e,n,i),nn(e,t)||(nt=!0),e;if((er&42)===0||(er&1073741824)!==0&&(ue&261930)===0)return nt=!0,e.memoizedState=n;return e=IS(),ne.lanes|=e,Xr|=e,t}function tS(e,t,n,i,r){var o=ge.p;ge.p=o!==0&&8>o?o:8;var s=J.T,l={};J.T=l,Bg(e,!1,t,n);try{var a=r(),u=J.S;if(u!==null&&u(l,a),a!==null&&typeof a==="object"&&typeof a.then==="function"){var c=RD(a,i);La(e,t,c,kn(e))}else La(e,t,i,kn(e))}catch(f){La(e,t,{then:function(){},status:"rejected",reason:f},kn())}finally{ge.p=o,s!==null&&l.types!==null&&(s.types=l.types),J.T=s}}function LD(){}function zm(e,t,n,i){if(e.tag!==5)throw Error(R(476));var r=nS(e).queue;tS(e,r,t,Do,n===null?LD:function(){return iS(e),n(i)})}function nS(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Do,baseState:Do,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:Do},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tr,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function iS(e){var t=nS(e);t.next===null&&(t=e.alternate.memoizedState),La(e,t.next.queue,{},kn())}function zg(){return mt(Qa)}function rS(){return qe().memoizedState}function oS(){return qe().memoizedState}function zD(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kn();e=Po(n);var i=Io(t,e,n);i!==null&&(Ht(i,t,n),Ma(i,t,n)),t={cache:xg()},e.payload=t;return}t=t.return}}function BD(e,t,n){var i=kn();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},lh(e)?lS(t,n):(n=gg(e,t,n,i),n!==null&&(Ht(n,e,i),aS(n,t,i)))}function sS(e,t,n){var i=kn();La(e,t,n,i)}function La(e,t,n,i){var r={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(lh(e))lS(t,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,l=o(s,n);if(r.hasEagerState=!0,r.eagerState=l,nn(l,s))return nh(e,t,r,0),Ee===null&&th(),!1}catch(a){}finally{}if(n=gg(e,t,r,i),n!==null)return Ht(n,e,i),aS(n,t,i),!0}return!1}function Bg(e,t,n,i){if(i={lane:2,revertLane:qg(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},lh(e)){if(t)throw Error(R(479))}else t=gg(e,n,i,2),t!==null&&Ht(t,e,2)}function lh(e){var t=e.alternate;return e===ne||t!==null&&t===ne}function lS(e,t){Xs=Df=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function aS(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,$w(e,n)}}var Wa={readContext:mt,use:oh,useCallback:He,useContext:He,useEffect:He,useImperativeHandle:He,useLayoutEffect:He,useInsertionEffect:He,useMemo:He,useReducer:He,useRef:He,useState:He,useDebugValue:He,useDeferredValue:He,useTransition:He,useSyncExternalStore:He,useId:He,useHostTransitionStatus:He,useFormState:He,useActionState:He,useOptimistic:He,useMemoCache:He,useCacheRefresh:He};Wa.useEffectEvent=He;var uS={readContext:mt,use:oh,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:mt,useEffect:Yx,useImperativeHandle:function(e,t,n){n=n!==null&&n!==void 0?n.concat([e]):null,df(4194308,4,X1.bind(null,t,e),n)},useLayoutEffect:function(e,t){return df(4194308,4,e,t)},useInsertionEffect:function(e,t){df(4,2,e,t)},useMemo:function(e,t){var n=Rt();t=t===void 0?null:t;var i=e();if(Fo){zr(!0);try{e()}finally{zr(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=Rt();if(n!==void 0){var r=n(t);if(Fo){zr(!0);try{n(t)}finally{zr(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=BD.bind(null,ne,e),[i.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=Dm(e);var t=e.queue,n=sS.bind(null,ne,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Dg,useDeferredValue:function(e,t){var n=Rt();return Lg(n,e,t)},useTransition:function(){var e=Dm(!1);return e=tS.bind(null,ne,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=ne,r=Rt();if(he){if(n===void 0)throw Error(R(407));n=n()}else{if(n=t(),Ee===null)throw Error(R(349));(ue&127)!==0||B1(i,t,n)}r.memoizedState=n;var o={value:n,getSnapshot:t};return r.queue=o,Yx(I1.bind(null,i,o,e),[e]),i.flags|=2048,il(9,{destroy:void 0},P1.bind(null,i,o,n,t),null),n},useId:function(){var e=Rt(),t=Ee.identifierPrefix;if(he){var n=mi,i=pi;n=(i&~(1<<32-tn(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Lf++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=ND++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:zg,useFormState:$x,useActionState:$x,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Bg.bind(null,ne,!0,n),n.dispatch=t,[e,t]},useMemoCache:Tg,useCacheRefresh:function(){return Rt().memoizedState=zD.bind(null,ne)},useEffectEvent:function(e){var t=Rt(),n={impl:e};return t.memoizedState=n,function(){if((me&2)!==0)throw Error(R(440));return n.impl.apply(void 0,arguments)}}},Pg={readContext:mt,use:oh,useCallback:J1,useContext:mt,useEffect:_g,useImperativeHandle:Q1,useInsertionEffect:W1,useLayoutEffect:Y1,useMemo:Z1,useReducer:hf,useRef:$1,useState:function(){return hf(tr)},useDebugValue:Dg,useDeferredValue:function(e,t){var n=qe();return eS(n,we.memoizedState,e,t)},useTransition:function(){var e=hf(tr)[0],t=qe().memoizedState;return[typeof e==="boolean"?e:lu(e),t]},useSyncExternalStore:z1,useId:rS,useHostTransitionStatus:zg,useFormState:Gx,useActionState:Gx,useOptimistic:function(e,t){var n=qe();return U1(n,we,e,t)},useMemoCache:Tg,useCacheRefresh:oS};Pg.useEffectEvent=G1;var cS={readContext:mt,use:oh,useCallback:J1,useContext:mt,useEffect:_g,useImperativeHandle:Q1,useInsertionEffect:W1,useLayoutEffect:Y1,useMemo:Z1,useReducer:Fp,useRef:$1,useState:function(){return Fp(tr)},useDebugValue:Dg,useDeferredValue:function(e,t){var n=qe();return we===null?Lg(n,e,t):eS(n,we.memoizedState,e,t)},useTransition:function(){var e=Fp(tr)[0],t=qe().memoizedState;return[typeof e==="boolean"?e:lu(e),t]},useSyncExternalStore:z1,useId:rS,useHostTransitionStatus:zg,useFormState:Wx,useActionState:Wx,useOptimistic:function(e,t){var n=qe();if(we!==null)return U1(n,we,e,t);return n.baseState=e,[e,n.queue.dispatch]},useMemoCache:Tg,useCacheRefresh:oS};cS.useEffectEvent=G1;function Kp(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n===null||n===void 0?t:ze({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bm={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=kn(),r=Po(i);r.payload=t,n!==void 0&&n!==null&&(r.callback=n),t=Io(e,r,i),t!==null&&(Ht(t,e,i),Ma(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=kn(),r=Po(i);r.tag=1,r.payload=t,n!==void 0&&n!==null&&(r.callback=n),t=Io(e,r,i),t!==null&&(Ht(t,e,i),Ma(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kn(),i=Po(n);i.tag=2,t!==void 0&&t!==null&&(i.callback=t),t=Io(e,i,n),t!==null&&(Ht(t,e,n),Ma(t,e,n))}};function Xx(e,t,n,i,r,o,s){return e=e.stateNode,typeof e.shouldComponentUpdate==="function"?e.shouldComponentUpdate(i,o,s):t.prototype&&t.prototype.isPureReactComponent?!Fa(n,i)||!Fa(r,o):!0}function Qx(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps==="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps==="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&Bm.enqueueReplaceState(t,t.state,null)}function Ko(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=ze({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function PD(e){Af(e)}function ID(e){console.error(e)}function VD(e){Af(e)}function zf(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Jx(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Pm(e,t,n){return n=Po(n),n.tag=3,n.payload={element:null},n.callback=function(){zf(e,t)},n}function fS(e){return e=Po(e),e.tag=3,e}function hS(e,t,n,i){var r=n.type.getDerivedStateFromError;if(typeof r==="function"){var o=i.value;e.payload=function(){return r(o)},e.callback=function(){Jx(t,n,i)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch==="function"&&(e.callback=function(){Jx(t,n,i),typeof r!=="function"&&(jr===null?jr=new Set([this]):jr.add(this));var l=i.stack;this.componentDidCatch(i.value,{componentStack:l!==null?l:""})})}function HD(e,t,n,i,r){if(n.flags|=32768,i!==null&&typeof i==="object"&&typeof i.then==="function"){if(t=n.alternate,t!==null&&cl(t,n,r,!0),n=rn.current,n!==null){switch(n.tag){case 31:case 13:return Sn===null?Hf():n.alternate===null&&Ue===0&&(Ue=3),n.flags&=-257,n.flags|=65536,n.lanes=r,i===Tf?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),tm(e,i,r)),!1;case 22:return n.flags|=65536,i===Tf?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),tm(e,i,r)),!1}throw Error(R(435,n.tag))}return tm(e,i,r),Hf(),!1}if(he)return t=rn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,i!==Em&&(e=Error(R(422),{cause:i}),qa(xn(e,n)))):(i!==Em&&(t=Error(R(423),{cause:i}),qa(xn(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,i=xn(i,n),r=Pm(e.stateNode,i,r),jp(e,r),Ue!==4&&(Ue=2)),!1;var o=Error(R(520),{cause:i});if(o=xn(o,n),Pa===null?Pa=[o]:Pa.push(o),Ue!==4&&(Ue=2),t===null)return!0;i=xn(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=Pm(n.stateNode,i,e),jp(n,e),!1;case 1:if(t=n.type,o=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError==="function"||o!==null&&typeof o.componentDidCatch==="function"&&(jr===null||!jr.has(o))))return n.flags|=65536,r&=-r,n.lanes|=r,r=fS(r),hS(r,e,n,i),jp(n,r),!1}n=n.return}while(n!==null);return!1}var Ig=Error(R(461)),nt=!1;function ht(e,t,n,i){t.child=e===null?N1(t,null,n,i):jo(t,e.child,n,i)}function Zx(e,t,n,i,r){n=n.render;var o=t.ref;if("ref"in i){var s={};for(var l in i)l!=="ref"&&(s[l]=i[l])}else s=i;if(Uo(t),i=Ag(e,t,n,s,o,r),l=Og(),e!==null&&!nt)return Rg(e,t,r),nr(e,t,r);return he&&l&&bg(t),t.flags|=1,ht(e,t,i,r),t.child}function ew(e,t,n,i,r){if(e===null){var o=n.type;if(typeof o==="function"&&!vg(o)&&o.defaultProps===void 0&&n.compare===null)return t.tag=15,t.type=o,dS(e,t,o,i,r);return e=cf(n.type,null,i,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e}if(o=e.child,!Vg(e,r)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:Fa,n(s,i)&&e.ref===t.ref)return nr(e,t,r)}return t.flags|=1,e=Xi(o,i),e.ref=t.ref,e.return=t,t.child=e}function dS(e,t,n,i,r){if(e!==null){var o=e.memoizedProps;if(Fa(o,i)&&e.ref===t.ref)if(nt=!1,t.pendingProps=i=o,Vg(e,r))(e.flags&131072)!==0&&(nt=!0);else return t.lanes=e.lanes,nr(e,t,r)}return Im(e,t,n,i,r)}function pS(e,t,n,i){var r=i.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|n:n,e!==null){i=t.child=e.child;for(r=0;i!==null;)r=r|i.lanes|i.childLanes,i=i.sibling;i=r&~o}else i=0,t.child=null;return tw(e,t,o,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ff(t,o!==null?o.cachePool:null),o!==null?Fx(t,o):Mm(),_1(t);else return i=t.lanes=536870912,tw(e,t,o!==null?o.baseLanes|n:n,n,i)}else o!==null?(ff(t,o.cachePool),Fx(t,o),Dr(t),t.memoizedState=null):(e!==null&&ff(t,null),Mm(),Dr(t));return ht(e,t,r,n),t.child}function ka(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function tw(e,t,n,i,r){var o=wg();return o=o===null?null:{parent:tt._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&ff(t,null),Mm(),_1(t),e!==null&&cl(e,t,i,!0),t.childLanes=r,null}function pf(e,t){return t=Bf({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function nw(e,t,n){return jo(t,e.child,null,n),e=pf(t,t.pendingProps),e.flags|=2,Xt(t),t.memoizedState=null,e}function UD(e,t,n){var i=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(he){if(i.mode==="hidden")return e=pf(t,i),t.lanes=536870912,ka(null,e);if(_m(t),(e=Le)?(e=lk(e,wn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gr!==null?{id:pi,overflow:mi}:null,retryLane:536870912,hydrationErrors:null},n=S1(e),n.return=t,t.child=n,pt=t,Le=null)):e=null,e===null)throw Wr(t);return t.lanes=536870912,null}return pf(t,i)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(_m(t),r)if(t.flags&256)t.flags&=-257,t=nw(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(R(558));else if(nt||cl(e,t,n,!1),r=(n&e.childLanes)!==0,nt||r){if(i=Ee,i!==null&&(s=Gw(i,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Wo(e,s),Ht(i,e,s),Ig;Hf(),t=nw(e,t,n)}else e=o.treeContext,Le=En(s.nextSibling),pt=t,he=!0,Ur=null,wn=!1,e!==null&&E1(t,e),t=pf(t,i),t.flags|=4096;return t}return e=Xi(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mf(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(R(284));if(e===null||e.ref!==n)t.flags|=4194816}}function Im(e,t,n,i,r){if(Uo(t),n=Ag(e,t,n,i,void 0,r),i=Og(),e!==null&&!nt)return Rg(e,t,r),nr(e,t,r);return he&&i&&bg(t),t.flags|=1,ht(e,t,n,r),t.child}function iw(e,t,n,i,r,o){if(Uo(t),t.updateQueue=null,n=L1(t,i,n,r),D1(e),i=Og(),e!==null&&!nt)return Rg(e,t,o),nr(e,t,o);return he&&i&&bg(t),t.flags|=1,ht(e,t,n,o),t.child}function rw(e,t,n,i,r){if(Uo(t),t.stateNode===null){var o=Us,s=n.contextType;typeof s==="object"&&s!==null&&(o=mt(s)),o=new n(i,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Bm,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=i,o.state=t.memoizedState,o.refs={},kg(t),s=n.contextType,o.context=typeof s==="object"&&s!==null?mt(s):Us,o.state=t.memoizedState,s=n.getDerivedStateFromProps,typeof s==="function"&&(Kp(t,n,s,i),o.state=t.memoizedState),typeof n.getDerivedStateFromProps==="function"||typeof o.getSnapshotBeforeUpdate==="function"||typeof o.UNSAFE_componentWillMount!=="function"&&typeof o.componentWillMount!=="function"||(s=o.state,typeof o.componentWillMount==="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==="function"&&o.UNSAFE_componentWillMount(),s!==o.state&&Bm.enqueueReplaceState(o,o.state,null),Da(t,i,o,r),_a(),o.state=t.memoizedState),typeof o.componentDidMount==="function"&&(t.flags|=4194308),i=!0}else if(e===null){o=t.stateNode;var l=t.memoizedProps,a=Ko(n,l);o.props=a;var u=o.context,c=n.contextType;s=Us,typeof c==="object"&&c!==null&&(s=mt(c));var f=n.getDerivedStateFromProps;c=typeof f==="function"||typeof o.getSnapshotBeforeUpdate==="function",l=t.pendingProps!==l,c||typeof o.UNSAFE_componentWillReceiveProps!=="function"&&typeof o.componentWillReceiveProps!=="function"||(l||u!==s)&&Qx(t,o,i,s),Tr=!1;var h=t.memoizedState;o.state=h,Da(t,i,o,r),_a(),u=t.memoizedState,l||h!==u||Tr?(typeof f==="function"&&(Kp(t,n,f,i),u=t.memoizedState),(a=Tr||Xx(t,n,a,i,h,u,s))?(c||typeof o.UNSAFE_componentWillMount!=="function"&&typeof o.componentWillMount!=="function"||(typeof o.componentWillMount==="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==="function"&&(t.flags|=4194308)):(typeof o.componentDidMount==="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=u),o.props=i,o.state=u,o.context=s,i=a):(typeof o.componentDidMount==="function"&&(t.flags|=4194308),i=!1)}else{o=t.stateNode,Nm(e,t),s=t.memoizedProps,c=Ko(n,s),o.props=c,f=t.pendingProps,h=o.context,u=n.contextType,a=Us,typeof u==="object"&&u!==null&&(a=mt(u)),l=n.getDerivedStateFromProps,(u=typeof l==="function"||typeof o.getSnapshotBeforeUpdate==="function")||typeof o.UNSAFE_componentWillReceiveProps!=="function"&&typeof o.componentWillReceiveProps!=="function"||(s!==f||h!==a)&&Qx(t,o,i,a),Tr=!1,h=t.memoizedState,o.state=h,Da(t,i,o,r),_a();var d=t.memoizedState;s!==f||h!==d||Tr||e!==null&&e.dependencies!==null&&Nf(e.dependencies)?(typeof l==="function"&&(Kp(t,n,l,i),d=t.memoizedState),(c=Tr||Xx(t,n,c,i,h,d,a)||e!==null&&e.dependencies!==null&&Nf(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!=="function"&&typeof o.componentWillUpdate!=="function"||(typeof o.componentWillUpdate==="function"&&o.componentWillUpdate(i,d,a),typeof o.UNSAFE_componentWillUpdate==="function"&&o.UNSAFE_componentWillUpdate(i,d,a)),typeof o.componentDidUpdate==="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!=="function"||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=="function"||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=d),o.props=i,o.state=d,o.context=a,i=c):(typeof o.componentDidUpdate!=="function"||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=="function"||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),i=!1)}return o=i,mf(e,t),i=(t.flags&128)!==0,o||i?(o=t.stateNode,n=i&&typeof n.getDerivedStateFromError!=="function"?null:o.render(),t.flags|=1,e!==null&&i?(t.child=jo(t,e.child,null,r),t.child=jo(t,null,n,r)):ht(e,t,n,r),t.memoizedState=o.state,e=t.child):e=nr(e,t,r),e}function ow(e,t,n,i){return Ho(),t.flags|=256,ht(e,t,n,i),t.child}var qp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $p(e){return{baseLanes:e,cachePool:A1()}}function Gp(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Jt),e}function mS(e,t,n){var i=t.pendingProps,r=!1,o=(t.flags&128)!==0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(Ke.current&2)!==0),s&&(r=!0,t.flags&=-129),s=(t.flags&32)!==0,t.flags&=-33,e===null){if(he){if(r?_r(t):Dr(t),(e=Le)?(e=lk(e,wn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Gr!==null?{id:pi,overflow:mi}:null,retryLane:536870912,hydrationErrors:null},n=S1(e),n.return=t,t.child=n,pt=t,Le=null)):e=null,e===null)throw Wr(t);return eg(e)?t.lanes=32:t.lanes=536870912,null}var l=i.children;if(i=i.fallback,r)return Dr(t),r=t.mode,l=Bf({mode:"hidden",children:l},r),i=Lo(i,r,n,null),l.return=t,i.return=t,l.sibling=i,t.child=l,i=t.child,i.memoizedState=$p(n),i.childLanes=Gp(e,s,n),t.memoizedState=qp,ka(null,i);return _r(t),Vm(t,l)}var a=e.memoizedState;if(a!==null&&(l=a.dehydrated,l!==null)){if(o)t.flags&256?(_r(t),t.flags&=-257,t=Wp(e,t,n)):t.memoizedState!==null?(Dr(t),t.child=e.child,t.flags|=128,t=null):(Dr(t),l=i.fallback,r=t.mode,i=Bf({mode:"visible",children:i.children},r),l=Lo(l,r,n,null),l.flags|=2,i.return=t,l.return=t,i.sibling=l,t.child=i,jo(t,e.child,null,n),i=t.child,i.memoizedState=$p(n),i.childLanes=Gp(e,s,n),t.memoizedState=qp,t=ka(null,i));else if(_r(t),eg(l)){if(s=l.nextSibling&&l.nextSibling.dataset,s)var u=s.dgst;s=u,i=Error(R(419)),i.stack="",i.digest=s,qa({value:i,source:null,stack:null}),t=Wp(e,t,n)}else if(nt||cl(e,t,n,!1),s=(n&e.childLanes)!==0,nt||s){if(s=Ee,s!==null&&(i=Gw(s,n),i!==0&&i!==a.retryLane))throw a.retryLane=i,Wo(e,i),Ht(s,e,i),Ig;Zm(l)||Hf(),t=Wp(e,t,n)}else Zm(l)?(t.flags|=192,t.child=e.child,t=null):(e=a.treeContext,Le=En(l.nextSibling),pt=t,he=!0,Ur=null,wn=!1,e!==null&&E1(t,e),t=Vm(t,i.children),t.flags|=4096);return t}if(r)return Dr(t),l=i.fallback,r=t.mode,a=e.child,u=a.sibling,i=Xi(a,{mode:"hidden",children:i.children}),i.subtreeFlags=a.subtreeFlags&65011712,u!==null?l=Xi(u,l):(l=Lo(l,r,n,null),l.flags|=2),l.return=t,i.return=t,i.sibling=l,t.child=i,ka(null,i),i=t.child,l=e.child.memoizedState,l===null?l=$p(n):(r=l.cachePool,r!==null?(a=tt._currentValue,r=r.parent!==a?{parent:a,pool:a}:r):r=A1(),l={baseLanes:l.baseLanes|n,cachePool:r}),i.memoizedState=l,i.childLanes=Gp(e,s,n),t.memoizedState=qp,ka(e.child,i);return _r(t),n=e.child,e=n.sibling,n=Xi(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n}function Vm(e,t){return t=Bf({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Bf(e,t){return e=Qt(22,e,null,t),e.lanes=0,e}function Wp(e,t,n){return jo(t,e.child,null,n),e=Vm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sw(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Am(e.return,t,n)}function Yp(e,t,n,i,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r,treeForkCount:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=n,s.tailMode=r,s.treeForkCount=o)}function gS(e,t,n){var i=t.pendingProps,r=i.revealOrder,o=i.tail;i=i.children;var s=Ke.current,l=(s&2)!==0;if(l?(s=s&1|2,t.flags|=128):s&=1,Ae(Ke,s),ht(e,t,i,n),i=he?Ka:0,!l&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sw(e,n,t);else if(e.tag===19)sw(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":n=t.child;for(r=null;n!==null;)e=n.alternate,e!==null&&_f(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),Yp(t,!1,r,n,o,i);break;case"backwards":case"unstable_legacy-backwards":n=null,r=t.child;for(t.child=null;r!==null;){if(e=r.alternate,e!==null&&_f(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}Yp(t,!0,n,null,o,i);break;case"together":Yp(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function nr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Xr|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(cl(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(R(153));if(t.child!==null){e=t.child,n=Xi(e,e.pendingProps),t.child=n;for(n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Vg(e,t){if((e.lanes&t)!==0)return!0;return e=e.dependencies,e!==null&&Nf(e)?!0:!1}function jD(e,t,n){switch(t.tag){case 3:Sf(t,t.stateNode.containerInfo),Mr(t,tt,e.memoizedState.cache),Ho();break;case 27:case 5:dm(t);break;case 4:Sf(t,t.stateNode.containerInfo);break;case 10:Mr(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,_m(t),null;break;case 13:var i=t.memoizedState;if(i!==null){if(i.dehydrated!==null)return _r(t),t.flags|=128,null;if((n&t.child.childLanes)!==0)return mS(e,t,n);return _r(t),e=nr(e,t,n),e!==null?e.sibling:null}_r(t);break;case 19:var r=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(cl(e,t,n,!1),i=(n&t.childLanes)!==0),r){if(i)return gS(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Ae(Ke,Ke.current),i)break;else return null;case 22:return t.lanes=0,pS(e,t,n,t.pendingProps);case 24:Mr(t,tt,e.memoizedState.cache)}return nr(e,t,n)}function vS(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)nt=!0;else{if(!Vg(e,n)&&(t.flags&128)===0)return nt=!1,jD(e,t,n);nt=(e.flags&131072)!==0?!0:!1}else nt=!1,he&&(t.flags&1048576)!==0&&k1(t,Ka,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Mo(t.elementType),t.type=e,typeof e==="function")vg(e)?(i=Ko(e,i),t.tag=1,t=rw(null,t,e,i,n)):(t.tag=0,t=Im(null,t,e,i,n));else{if(e!==void 0&&e!==null){var r=e.$$typeof;if(r===rg){t.tag=11,t=Zx(null,t,e,i,n);break e}else if(r===og){t.tag=14,t=ew(null,t,e,i,n);break e}}throw t=fm(e)||e,Error(R(306,t,""))}}return t;case 0:return Im(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,r=Ko(i,t.pendingProps),rw(e,t,i,r,n);case 3:e:{if(Sf(t,t.stateNode.containerInfo),e===null)throw Error(R(387));i=t.pendingProps;var o=t.memoizedState;r=o.element,Nm(e,t),Da(t,i,null,n);var s=t.memoizedState;if(i=s.cache,Mr(t,tt,i),i!==o.cache&&Om(t,[tt],n,!0),_a(),i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=ow(e,t,i,n);break e}else if(i!==r){r=xn(Error(R(424)),t),qa(r),t=ow(e,t,i,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}Le=En(e.firstChild),pt=t,he=!0,Ur=null,wn=!0,n=N1(t,null,i,n);for(t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ho(),i===r){t=nr(e,t,n);break e}ht(e,t,i,n)}t=t.child}return t;case 26:return mf(e,t),e===null?(n=Aw(t.type,null,t.pendingProps,null))?t.memoizedState=n:he||(n=t.type,e=t.pendingProps,i=Kf(Hr.current).createElement(n),i[dt]=t,i[Ut]=e,gt(i,n,e),ot(i),t.stateNode=i):t.memoizedState=Aw(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return dm(t),e===null&&he&&(i=t.stateNode=ak(t.type,t.pendingProps,Hr.current),pt=t,wn=!0,r=Le,Jr(t.type)?(tg=r,Le=En(i.firstChild)):Le=r),ht(e,t,t.pendingProps.children,n),mf(e,t),e===null&&(t.flags|=4194304),t.child;case 5:if(e===null&&he){if(r=i=Le)i=gL(i,t.type,t.pendingProps,wn),i!==null?(t.stateNode=i,pt=t,Le=En(i.firstChild),wn=!1,r=!0):r=!1;r||Wr(t)}return dm(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,Qm(r,o)?i=null:s!==null&&Qm(r,s)&&(t.flags|=32),t.memoizedState!==null&&(r=Ag(e,t,TD,null,null,n),Qa._currentValue=r),mf(e,t),ht(e,t,i,n),t.child;case 6:if(e===null&&he){if(e=n=Le)n=vL(n,t.pendingProps,wn),n!==null?(t.stateNode=n,pt=t,Le=null,e=!0):e=!1;e||Wr(t)}return null;case 13:return mS(e,t,n);case 4:return Sf(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=jo(t,null,i,n):ht(e,t,i,n),t.child;case 11:return Zx(e,t,t.type,t.pendingProps,n);case 7:return ht(e,t,t.pendingProps,n),t.child;case 8:return ht(e,t,t.pendingProps.children,n),t.child;case 12:return ht(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,Mr(t,t.type,i.value),ht(e,t,i.children,n),t.child;case 9:return r=t.type._context,i=t.pendingProps.children,Uo(t),r=mt(r),i=i(r),t.flags|=1,ht(e,t,i,n),t.child;case 14:return ew(e,t,t.type,t.pendingProps,n);case 15:return dS(e,t,t.type,t.pendingProps,n);case 19:return gS(e,t,n);case 31:return UD(e,t,n);case 22:return pS(e,t,n,t.pendingProps);case 24:return Uo(t),i=mt(tt),e===null?(r=wg(),r===null&&(r=Ee,o=xg(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=n),r=o),t.memoizedState={parent:i,cache:r},kg(t),Mr(t,tt,r)):((e.lanes&n)!==0&&(Nm(e,t),Da(t,null,null,n),_a()),r=e.memoizedState,o=t.memoizedState,r.parent!==i?(r={parent:i,cache:i},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Mr(t,tt,i)):(i=o.cache,Mr(t,tt,i),i!==r.cache&&Om(t,[tt],n,!0))),ht(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(R(156,t.tag))}function Ui(e){e.flags|=4}function Xp(e,t,n,i,r){if(t=(e.mode&32)!==0)t=!1;if(t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(US())e.flags|=8192;else throw Bo=Tf,Sg}else e.flags&=-16777217}function lw(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!fk(t))if(US())e.flags|=8192;else throw Bo=Tf,Sg}function Zc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Kw():536870912,e.lanes|=t,rl|=t)}function ma(e,t){if(!he)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function De(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags&65011712,i|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function FD(e,t,n){var i=t.pendingProps;switch(yg(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return De(t),null;case 1:return De(t),null;case 3:if(n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Qi(tt),Js(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),e===null||e.child===null)Rs(t)?Ui(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Up());return De(t),null;case 26:var{type:r,memoizedState:o}=t;return e===null?(Ui(t),o!==null?(De(t),lw(t,o)):(De(t),Xp(t,r,null,i,n))):o?o!==e.memoizedState?(Ui(t),De(t),lw(t,o)):(De(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ui(t),De(t),Xp(t,r,e,i,n)),null;case 27:if(kf(t),n=Hr.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ui(t);else{if(!i){if(t.stateNode===null)throw Error(R(166));return De(t),null}e=vi.current,Rs(t)?Bx(t,e):(e=ak(r,i,n),t.stateNode=e,Ui(t))}return De(t),null;case 5:if(kf(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ui(t);else{if(!i){if(t.stateNode===null)throw Error(R(166));return De(t),null}if(o=vi.current,Rs(t))Bx(t,o);else{var s=Kf(Hr.current);switch(o){case 1:o=s.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:o=s.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":o=s.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":o=s.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":o=s.createElement("div"),o.innerHTML="<script></script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof i.is==="string"?s.createElement("select",{is:i.is}):s.createElement("select"),i.multiple?o.multiple=!0:i.size&&(o.size=i.size);break;default:o=typeof i.is==="string"?s.createElement(r,{is:i.is}):s.createElement(r)}}o[dt]=t,o[Ut]=i;e: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 e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;e:switch(gt(o,r,i),r){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Ui(t)}}return De(t),Xp(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ui(t);else{if(typeof i!=="string"&&t.stateNode===null)throw Error(R(166));if(e=Hr.current,Rs(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,r=pt,r!==null)switch(r.tag){case 27:case 5:i=r.memoizedProps}e[dt]=t,e=e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||rk(e.nodeValue,n)?!0:!1,e||Wr(t,!0)}else e=Kf(e).createTextNode(i),e[dt]=t,t.stateNode=e}return De(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Rs(t),n!==null){if(e===null){if(!i)throw Error(R(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(R(557));e[dt]=t}else Ho(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;De(t),e=!1}else n=Up(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e){if(t.flags&256)return Xt(t),t;return Xt(t),null}if((t.flags&128)!==0)throw Error(R(558))}return De(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Rs(t),i!==null&&i.dehydrated!==null){if(e===null){if(!r)throw Error(R(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(R(317));r[dt]=t}else Ho(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;De(t),r=!1}else r=Up(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r){if(t.flags&256)return Xt(t),t;return Xt(t),null}}if(Xt(t),(t.flags&128)!==0)return t.lanes=n,t;return n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(i=t.child,r=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(r=i.alternate.memoizedState.cachePool.pool),o=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),o!==r&&(i.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Zc(t,t.updateQueue),De(t),null;case 4:return Js(),e===null&&nk(t.stateNode.containerInfo),De(t),null;case 10:return Qi(t.type),De(t),null;case 19:if(st(Ke),i=t.memoizedState,i===null)return De(t),null;if(r=(t.flags&128)!==0,o=i.rendering,o===null)if(r)ma(i,!1);else{if(Ue!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=_f(e),o!==null){t.flags|=128,ma(i,!1),e=o.updateQueue,t.updateQueue=e,Zc(t,e),t.subtreeFlags=0,e=n;for(n=t.child;n!==null;)w1(n,e),n=n.sibling;return Ae(Ke,Ke.current&1|2),he&&qi(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&Zt()>If&&(t.flags|=128,r=!0,ma(i,!1),t.lanes=4194304)}else{if(!r)if(e=_f(o),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Zc(t,e),ma(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!he)return De(t),null}else 2*Zt()-i.renderingStartTime>If&&n!==536870912&&(t.flags|=128,r=!0,ma(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(e=i.last,e!==null?e.sibling=o:t.child=o,i.last=o)}if(i.tail!==null)return e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Zt(),e.sibling=null,n=Ke.current,Ae(Ke,r?n&1|2:n&1),he&&qi(t,i.treeForkCount),e;return De(t),null;case 22:case 23:return Xt(t),Eg(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(De(t),t.subtreeFlags&6&&(t.flags|=8192)):De(t),n=t.updateQueue,n!==null&&Zc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&st(zo),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Qi(tt),De(t),null;case 25:return null;case 30:return null}throw Error(R(156,t.tag))}function KD(e,t){switch(yg(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qi(tt),Js(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return kf(t),null;case 31:if(t.memoizedState!==null){if(Xt(t),t.alternate===null)throw Error(R(340));Ho()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Xt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(R(340));Ho()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return st(Ke),null;case 4:return Js(),null;case 10:return Qi(t.type),null;case 22:case 23:return Xt(t),Eg(),e!==null&&st(zo),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qi(tt),null;case 25:return null;default:return null}}function bS(e,t){switch(yg(t),t.tag){case 3:Qi(tt),Js();break;case 26:case 27:case 5:kf(t);break;case 4:Js();break;case 31:t.memoizedState!==null&&Xt(t);break;case 13:Xt(t);break;case 19:st(Ke);break;case 10:Qi(t.type);break;case 22:case 23:Xt(t),Eg(),e!==null&&st(zo);break;case 24:Qi(tt)}}function au(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var r=i.next;n=r;do{if((n.tag&e)===e){i=void 0;var o=n.create,s=n.inst;i=o(),s.destroy=i}n=n.next}while(n!==r)}}catch(l){ye(t,t.return,l)}}function Yr(e,t,n){try{var i=t.updateQueue,r=i!==null?i.lastEffect:null;if(r!==null){var o=r.next;i=o;do{if((i.tag&e)===e){var s=i.inst,l=s.destroy;if(l!==void 0){s.destroy=void 0,r=t;var a=n,u=l;try{u()}catch(c){ye(r,a,c)}}}i=i.next}while(i!==o)}}catch(c){ye(t,t.return,c)}}function yS(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{M1(t,n)}catch(i){ye(e,e.return,i)}}}function xS(e,t,n){n.props=Ko(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){ye(e,t,i)}}function za(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof n==="function"?e.refCleanup=n(i):n.current=i}}catch(r){ye(e,t,r)}}function gi(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i==="function")try{i()}catch(r){ye(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==="function")try{n(null)}catch(r){ye(e,t,r)}else n.current=null}function wS(e){var{type:t,memoizedProps:n,stateNode:i}=e;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(r){ye(e,e.return,r)}}function Qp(e,t,n){try{var i=e.stateNode;cL(i,e.type,n,t),i[Ut]=t}catch(r){ye(e,e.return,r)}}function SS(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Jr(e.type)||e.tag===4}function Jp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||SS(e.return))return null;e=e.return}e.sibling.return=e.return;for(e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Jr(e.type))continue e;if(e.flags&2)continue e;if(e.child===null||e.tag===4)continue e;else e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Hm(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!==null&&n!==void 0||t.onclick!==null||(t.onclick=Wi));else if(i!==4&&(i===27&&Jr(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Hm(e,t,n),e=e.sibling;e!==null;)Hm(e,t,n),e=e.sibling}function Pf(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&Jr(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Pf(e,t,n),e=e.sibling;e!==null;)Pf(e,t,n),e=e.sibling}function kS(e){var{stateNode:t,memoizedProps:n}=e;try{for(var i=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);gt(t,i,n),t[dt]=e,t[Ut]=n}catch(o){ye(e,e.return,o)}}var $i=!1,et=!1,Zp=!1,aw=typeof WeakSet==="function"?WeakSet:Set,rt=null;function qD(e,t){if(e=e.containerInfo,Ym=Wf,e=d1(e),pg(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch(b){n=null;break e}var s=0,l=-1,a=-1,u=0,c=0,f=e,h=null;t:for(;;){for(var d;;){if(f!==n||r!==0&&f.nodeType!==3||(l=s+r),f!==o||i!==0&&f.nodeType!==3||(a=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(d=f.firstChild)===null)break;h=f,f=d}for(;;){if(f===e)break t;if(h===n&&++u===r&&(l=s),h===o&&++c===i&&(a=s),(d=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=d}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;Xm={focusedElem:e,selectionRange:n},Wf=!1;for(rt=t;rt!==null;)if(t=rt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,rt=e;else for(;rt!==null;){switch(t=rt,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)r=e[n],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,n=t,r=o.memoizedProps,o=o.memoizedState,i=n.stateNode;try{var m=Ko(n.type,r);e=i.getSnapshotBeforeUpdate(m,o),i.__reactInternalSnapshotBeforeUpdate=e}catch(b){ye(n,n.return,b)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Jm(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Jm(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(R(163))}if(e=t.sibling,e!==null){e.return=t.return,rt=e;break}rt=t.return}}function ES(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Fi(e,n),i&4&&au(5,n);break;case 1:if(Fi(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(s){ye(n,n.return,s)}else{var r=Ko(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(s){ye(n,n.return,s)}}i&64&&yS(n),i&512&&za(n,n.return);break;case 3:if(Fi(e,n),i&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{M1(e,t)}catch(s){ye(n,n.return,s)}}break;case 27:t===null&&i&4&&kS(n);case 26:case 5:Fi(e,n),t===null&&i&4&&wS(n),i&512&&za(n,n.return);break;case 12:Fi(e,n);break;case 31:Fi(e,n),i&4&&OS(e,n);break;case 13:Fi(e,n),i&4&&RS(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=eL.bind(null,n),bL(e,n))));break;case 22:if(i=n.memoizedState!==null||$i,!i){t=t!==null&&t.memoizedState!==null||et,r=$i;var o=et;$i=i,(et=t)&&!o?Ki(e,n,(n.subtreeFlags&8772)!==0):Fi(e,n),$i=r,et=o}break;case 30:break;default:Fi(e,n)}}function CS(e){var t=e.alternate;t!==null&&(e.alternate=null,CS(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ag(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 Pe=null,It=!1;function ji(e,t,n){for(n=n.child;n!==null;)AS(e,t,n),n=n.sibling}function AS(e,t,n){if(en&&typeof en.onCommitFiberUnmount==="function")try{en.onCommitFiberUnmount(tu,n)}catch(o){}switch(n.tag){case 26:et||gi(n,t),ji(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:et||gi(n,t);var i=Pe,r=It;Jr(n.type)&&(Pe=n.stateNode,It=!1),ji(e,t,n),Va(n.stateNode),Pe=i,It=r;break;case 5:et||gi(n,t);case 6:if(i=Pe,r=It,Pe=null,ji(e,t,n),Pe=i,It=r,Pe!==null)if(It)try{(Pe.nodeType===9?Pe.body:Pe.nodeName==="HTML"?Pe.ownerDocument.body:Pe).removeChild(n.stateNode)}catch(o){ye(n,t,o)}else try{Pe.removeChild(n.stateNode)}catch(o){ye(n,t,o)}break;case 18:Pe!==null&&(It?(e=Pe,ww(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),al(e)):ww(Pe,n.stateNode));break;case 4:i=Pe,r=It,Pe=n.stateNode.containerInfo,It=!0,ji(e,t,n),Pe=i,It=r;break;case 0:case 11:case 14:case 15:Yr(2,n,t),et||Yr(4,n,t),ji(e,t,n);break;case 1:et||(gi(n,t),i=n.stateNode,typeof i.componentWillUnmount==="function"&&xS(n,t,i)),ji(e,t,n);break;case 21:ji(e,t,n);break;case 22:et=(i=et)||n.memoizedState!==null,ji(e,t,n),et=i;break;default:ji(e,t,n)}}function OS(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{al(e)}catch(n){ye(t,t.return,n)}}}function RS(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{al(e)}catch(n){ye(t,t.return,n)}}function $D(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new aw),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new aw),t;default:throw Error(R(435,e.tag))}}function ef(e,t){var n=$D(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var r=tL.bind(null,e,i);i.then(r,r)}})}function Bt(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var r=n[i],o=e,s=t,l=s;e:for(;l!==null;){switch(l.tag){case 27:if(Jr(l.type)){Pe=l.stateNode,It=!1;break e}break;case 5:Pe=l.stateNode,It=!1;break e;case 3:case 4:Pe=l.stateNode.containerInfo,It=!0;break e}l=l.return}if(Pe===null)throw Error(R(160));AS(o,s,r),Pe=null,It=!1,o=r.alternate,o!==null&&(o.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)NS(t,e),t=t.sibling}var Fn=null;function NS(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Bt(t,e),Pt(e),i&4&&(Yr(3,e,e.return),au(3,e),Yr(5,e,e.return));break;case 1:Bt(t,e),Pt(e),i&512&&(et||n===null||gi(n,n.return)),i&64&&$i&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var r=Fn;if(Bt(t,e),Pt(e),i&512&&(et||n===null||gi(n,n.return)),i&4){var o=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(i){case"title":if(o=r.getElementsByTagName("title")[0],!o||o[ru]||o[dt]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))o=r.createElement(i),r.head.insertBefore(o,r.querySelector("head > title"));gt(o,i,n),o[dt]=e,ot(o),i=o;break e;case"link":var s=Rw("link","href",r).get(i+(n.href||""));if(s){for(var l=0;l<s.length;l++)if(o=s[l],o.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&o.getAttribute("rel")===(n.rel==null?null:n.rel)&&o.getAttribute("title")===(n.title==null?null:n.title)&&o.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(l,1);break t}}o=r.createElement(i),gt(o,i,n),r.head.appendChild(o);break;case"meta":if(s=Rw("meta","content",r).get(i+(n.content||""))){for(l=0;l<s.length;l++)if(o=s[l],o.getAttribute("content")===(n.content==null?null:""+n.content)&&o.getAttribute("name")===(n.name==null?null:n.name)&&o.getAttribute("property")===(n.property==null?null:n.property)&&o.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute("charset")===(n.charSet==null?null:n.charSet)){s.splice(l,1);break t}}o=r.createElement(i),gt(o,i,n),r.head.appendChild(o);break;default:throw Error(R(468,i))}o[dt]=e,ot(o),i=o}e.stateNode=i}else Nw(r,e.type,e.stateNode);else e.stateNode=Ow(r,i,e.memoizedProps);else o!==i?(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,i===null?Nw(r,e.type,e.stateNode):Ow(r,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Qp(e,e.memoizedProps,n.memoizedProps)}break;case 27:Bt(t,e),Pt(e),i&512&&(et||n===null||gi(n,n.return)),n!==null&&i&4&&Qp(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Bt(t,e),Pt(e),i&512&&(et||n===null||gi(n,n.return)),e.flags&32){r=e.stateNode;try{el(r,"")}catch(m){ye(e,e.return,m)}}i&4&&e.stateNode!=null&&(r=e.memoizedProps,Qp(e,r,n!==null?n.memoizedProps:r)),i&1024&&(Zp=!0);break;case 6:if(Bt(t,e),Pt(e),i&4){if(e.stateNode===null)throw Error(R(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(m){ye(e,e.return,m)}}break;case 3:if(bf=null,r=Fn,Fn=qf(t.containerInfo),Bt(t,e),Fn=r,Pt(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{al(t.containerInfo)}catch(m){ye(e,e.return,m)}Zp&&(Zp=!1,TS(e));break;case 4:i=Fn,Fn=qf(e.stateNode.containerInfo),Bt(t,e),Pt(e),Fn=i;break;case 12:Bt(t,e),Pt(e);break;case 31:Bt(t,e),Pt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ef(e,i)));break;case 13:Bt(t,e),Pt(e),e.child.flags&8192&&e.memoizedState!==null!==(n!==null&&n.memoizedState!==null)&&(ah=Zt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ef(e,i)));break;case 22:r=e.memoizedState!==null;var a=n!==null&&n.memoizedState!==null,u=$i,c=et;if($i=u||r,et=c||a,Bt(t,e),et=c,$i=u,Pt(e),i&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||a||$i||et||_o(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){a=n=t;try{if(o=a.stateNode,r)s=o.style,typeof s.setProperty==="function"?s.setProperty("display","none","important"):s.display="none";else{l=a.stateNode;var f=a.memoizedProps.style,h=f!==void 0&&f!==null&&f.hasOwnProperty("display")?f.display:null;l.style.display=h==null||typeof h==="boolean"?"":(""+h).trim()}}catch(m){ye(a,a.return,m)}}}else if(t.tag===6){if(n===null){a=t;try{a.stateNode.nodeValue=r?"":a.memoizedProps}catch(m){ye(a,a.return,m)}}}else if(t.tag===18){if(n===null){a=t;try{var d=a.stateNode;r?Sw(d,!0):Sw(a.stateNode,!1)}catch(m){ye(a,a.return,m)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,ef(e,n))));break;case 19:Bt(t,e),Pt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,ef(e,i)));break;case 30:break;case 21:break;default:Bt(t,e),Pt(e)}}function Pt(e){var t=e.flags;if(t&2){try{for(var n,i=e.return;i!==null;){if(SS(i)){n=i;break}i=i.return}if(n==null)throw Error(R(160));switch(n.tag){case 27:var r=n.stateNode,o=Jp(e);Pf(e,o,r);break;case 5:var s=n.stateNode;n.flags&32&&(el(s,""),n.flags&=-33);var l=Jp(e);Pf(e,l,s);break;case 3:case 4:var a=n.stateNode.containerInfo,u=Jp(e);Hm(e,u,a);break;default:throw Error(R(161))}}catch(c){ye(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function TS(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;TS(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Fi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ES(e,t.alternate,t),t=t.sibling}function _o(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Yr(4,t,t.return),_o(t);break;case 1:gi(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==="function"&&xS(t,t.return,n),_o(t);break;case 27:Va(t.stateNode);case 26:case 5:gi(t,t.return),_o(t);break;case 22:t.memoizedState===null&&_o(t);break;case 30:_o(t);break;default:_o(t)}e=e.sibling}}function Ki(e,t,n){n=n&&(t.subtreeFlags&8772)!==0;for(t=t.child;t!==null;){var i=t.alternate,r=e,o=t,s=o.flags;switch(o.tag){case 0:case 11:case 15:Ki(r,o,n),au(4,o);break;case 1:if(Ki(r,o,n),i=o,r=i.stateNode,typeof r.componentDidMount==="function")try{r.componentDidMount()}catch(u){ye(i,i.return,u)}if(i=o,r=i.updateQueue,r!==null){var l=i.stateNode;try{var a=r.shared.hiddenCallbacks;if(a!==null)for(r.shared.hiddenCallbacks=null,r=0;r<a.length;r++)T1(a[r],l)}catch(u){ye(i,i.return,u)}}n&&s&64&&yS(o),za(o,o.return);break;case 27:kS(o);case 26:case 5:Ki(r,o,n),n&&i===null&&s&4&&wS(o),za(o,o.return);break;case 12:Ki(r,o,n);break;case 31:Ki(r,o,n),n&&s&4&&OS(r,o);break;case 13:Ki(r,o,n),n&&s&4&&RS(r,o);break;case 22:o.memoizedState===null&&Ki(r,o,n),za(o,o.return);break;case 30:break;default:Ki(r,o,n)}t=t.sibling}}function Hg(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&&su(n))}function Ug(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&su(e))}function jn(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)MS(e,t,n,i),t=t.sibling}function MS(e,t,n,i){var r=t.flags;switch(t.tag){case 0:case 11:case 15:jn(e,t,n,i),r&2048&&au(9,t);break;case 1:jn(e,t,n,i);break;case 3:jn(e,t,n,i),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&su(e)));break;case 12:if(r&2048){jn(e,t,n,i),e=t.stateNode;try{var o=t.memoizedProps,s=o.id,l=o.onPostCommit;typeof l==="function"&&l(s,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(a){ye(t,t.return,a)}}else jn(e,t,n,i);break;case 31:jn(e,t,n,i);break;case 13:jn(e,t,n,i);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState!==null?o._visibility&2?jn(e,t,n,i):Ba(e,t):o._visibility&2?jn(e,t,n,i):(o._visibility|=2,Ts(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Hg(s,t);break;case 24:jn(e,t,n,i),r&2048&&Ug(t.alternate,t);break;default:jn(e,t,n,i)}}function Ts(e,t,n,i,r){r=r&&((t.subtreeFlags&10256)!==0||!1);for(t=t.child;t!==null;){var o=e,s=t,l=n,a=i,u=s.flags;switch(s.tag){case 0:case 11:case 15:Ts(o,s,l,a,r),au(8,s);break;case 23:break;case 22:var c=s.stateNode;s.memoizedState!==null?c._visibility&2?Ts(o,s,l,a,r):Ba(o,s):(c._visibility|=2,Ts(o,s,l,a,r)),r&&u&2048&&Hg(s.alternate,s);break;case 24:Ts(o,s,l,a,r),r&&u&2048&&Ug(s.alternate,s);break;default:Ts(o,s,l,a,r)}t=t.sibling}}function Ba(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,r=i.flags;switch(i.tag){case 22:Ba(n,i),r&2048&&Hg(i.alternate,i);break;case 24:Ba(n,i),r&2048&&Ug(i.alternate,i);break;default:Ba(n,i)}t=t.sibling}}var Ea=8192;function Ns(e,t,n){if(e.subtreeFlags&Ea)for(e=e.child;e!==null;)_S(e,t,n),e=e.sibling}function _S(e,t,n){switch(e.tag){case 26:Ns(e,t,n),e.flags&Ea&&e.memoizedState!==null&&TL(n,Fn,e.memoizedState,e.memoizedProps);break;case 5:Ns(e,t,n);break;case 3:case 4:var i=Fn;Fn=qf(e.stateNode.containerInfo),Ns(e,t,n),Fn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=Ea,Ea=16777216,Ns(e,t,n),Ea=i):Ns(e,t,n));break;default:Ns(e,t,n)}}function DS(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 ga(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];rt=i,zS(i,e)}DS(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)LS(e),e=e.sibling}function LS(e){switch(e.tag){case 0:case 11:case 15:ga(e),e.flags&2048&&Yr(9,e,e.return);break;case 3:ga(e);break;case 12:ga(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,gf(e)):ga(e);break;default:ga(e)}}function gf(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];rt=i,zS(i,e)}DS(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Yr(8,t,t.return),gf(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,gf(t));break;default:gf(t)}e=e.sibling}}function zS(e,t){for(;rt!==null;){var n=rt;switch(n.tag){case 0:case 11:case 15:Yr(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:su(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,rt=i;else e:for(n=e;rt!==null;){i=rt;var r=i.sibling,o=i.return;if(CS(i),i===n){rt=null;break e}if(r!==null){r.return=o,rt=r;break e}rt=o}}}var GD={getCacheForType:function(e){var t=mt(tt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return mt(tt).controller.signal}},WD=typeof WeakMap==="function"?WeakMap:Map,me=0,Ee=null,le=null,ue=0,be=0,Yt=null,Pr=!1,hl=!1,jg=!1,ir=0,Ue=0,Xr=0,Vo=0,Fg=0,Jt=0,rl=0,Pa=null,Vt=null,Um=!1,ah=0,BS=0,If=1/0,Vf=null,jr=null,it=0,Fr=null,ol=null,Ji=0,jm=0,Fm=null,PS=null,Ia=0,Km=null;function kn(){return(me&2)!==0&&ue!==0?ue&-ue:J.T!==null?qg():Yw()}function IS(){if(Jt===0)if((ue&536870912)===0||he){var e=$c;$c<<=1,($c&3932160)===0&&($c=262144),Jt=e}else Jt=536870912;return e=rn.current,e!==null&&(e.flags|=32),Jt}function Ht(e,t,n){if(e===Ee&&(be===2||be===9)||e.cancelPendingCommit!==null)sl(e,0),Ir(e,ue,Jt,!1);if(Qf(e,n),(me&2)===0||e!==Ee)e===Ee&&((me&2)===0&&(Vo|=n),Ue===4&&Ir(e,ue,Jt,!1)),rr(e)}function VS(e,t,n){if((me&6)!==0)throw Error(R(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||nu(e,t),r=i?QD(e,t):em(e,t,!0),o=i;do{if(r===0){hl&&!i&&Ir(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!YD(n)){r=em(e,t,!1),o=!1;continue}if(r===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){t=s;e:{var l=e;r=Pa;var a=l.current.memoizedState.isDehydrated;if(a&&(sl(l,s).flags|=256),s=em(l,s,!1),s!==2){if(jg&&!a){l.errorRecoveryDisabledLanes|=o,Vo|=o,r=4;break e}o=Vt,Vt=r,o!==null&&(Vt===null?Vt=o:Vt.push.apply(Vt,o))}r=s}if(o=!1,r!==2)continue}}if(r===1){sl(e,0),Ir(e,t,0,!0);break}e:{switch(i=e,o=r,o){case 0:case 1:throw Error(R(345));case 4:if((t&4194048)!==t)break;case 6:Ir(i,t,Jt,!Pr);break e;case 2:Vt=null;break;case 3:case 5:break;default:throw Error(R(329))}if((t&62914560)===t&&(r=ah+300-Zt(),10<r)){if(Ir(i,t,Jt,!Pr),Xf(i,0,!0)!==0)break e;Ji=t,i.timeoutHandle=sk(uw.bind(null,i,n,Vt,Vf,Um,t,Jt,Vo,rl,Pr,o,"Throttled",-0,0),r);break e}uw(i,n,Vt,Vf,Um,t,Jt,Vo,rl,Pr,o,null,-0,0)}}break}while(1);rr(e)}function uw(e,t,n,i,r,o,s,l,a,u,c,f,h,d){if(e.timeoutHandle=-1,f=t.subtreeFlags,f&8192||(f&16785408)===16785408){f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wi},_S(t,o,f);var m=(o&62914560)===o?ah-Zt():(o&4194048)===o?BS-Zt():0;if(m=ML(f,m),m!==null){Ji=o,e.cancelPendingCommit=m(fw.bind(null,e,t,o,n,i,r,s,l,a,c,f,null,h,d)),Ir(e,o,s,!u);return}}fw(e,t,o,n,i,r,s,l,a)}function YD(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 i=0;i<n.length;i++){var r=n[i],o=r.getSnapshot;r=r.value;try{if(!nn(o(),r))return!1}catch(s){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 Ir(e,t,n,i){t&=~Fg,t&=~Vo,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var r=t;0<r;){var o=31-tn(r),s=1<<o;i[o]=-1,r&=~s}n!==0&&qw(e,n,t)}function uh(){return(me&6)===0?(uu(0,!1),!1):!0}function Kg(){if(le!==null){if(be===0)var e=le.return;else e=le,Yi=Yo=null,Ng(e),Ys=null,$a=0,e=le;for(;e!==null;)bS(e.alternate,e),e=e.return;le=null}}function sl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,dL(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ji=0,Kg(),Ee=e,le=n=Xi(e.current,null),ue=t,be=0,Yt=null,Pr=!1,hl=nu(e,t),jg=!1,rl=Jt=Fg=Vo=Xr=Ue=0,Vt=Pa=null,Um=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var r=31-tn(i),o=1<<r;t|=e[r],i&=~o}return ir=t,th(),n}function HS(e,t){ne=null,J.H=Wa,t===fl||t===ih?(t=Ux(),be=3):t===Sg?(t=Ux(),be=4):be=t===Ig?8:t!==null&&typeof t==="object"&&typeof t.then==="function"?6:1,Yt=t,le===null&&(Ue=1,zf(e,xn(t,e.current)))}function US(){var e=rn.current;return e===null?!0:(ue&4194048)===ue?Sn===null?!0:!1:(ue&62914560)===ue||(ue&536870912)!==0?e===Sn:!1}function jS(){var e=J.H;return J.H=Wa,e===null?Wa:e}function FS(){var e=J.A;return J.A=GD,e}function Hf(){Ue=4,Pr||(ue&4194048)!==ue&&rn.current!==null||(hl=!0),(Xr&134217727)===0&&(Vo&134217727)===0||Ee===null||Ir(Ee,ue,Jt,!1)}function em(e,t,n){var i=me;me|=2;var r=jS(),o=FS();if(Ee!==e||ue!==t)Vf=null,sl(e,t);t=!1;var s=Ue;e:do try{if(be!==0&&le!==null){var l=le,a=Yt;switch(be){case 8:Kg(),s=6;break e;case 3:case 2:case 9:case 6:rn.current===null&&(t=!0);var u=be;if(be=0,Yt=null,Ks(e,l,a,u),n&&hl){s=0;break e}break;default:u=be,be=0,Yt=null,Ks(e,l,a,u)}}XD(),s=Ue;break}catch(c){HS(e,c)}while(1);return t&&e.shellSuspendCounter++,Yi=Yo=null,me=i,J.H=r,J.A=o,le===null&&(Ee=null,ue=0,th()),s}function XD(){for(;le!==null;)KS(le)}function QD(e,t){var n=me;me|=2;var i=jS(),r=FS();Ee!==e||ue!==t?(Vf=null,If=Zt()+500,sl(e,t)):hl=nu(e,t);e:do try{if(be!==0&&le!==null){t=le;var o=Yt;t:switch(be){case 1:be=0,Yt=null,Ks(e,t,o,1);break;case 2:case 9:if(Hx(o)){be=0,Yt=null,cw(t);break}t=function(){be!==2&&be!==9||Ee!==e||(be=7),rr(e)},o.then(t,t);break e;case 3:be=7;break e;case 4:be=5;break e;case 7:Hx(o)?(be=0,Yt=null,cw(t)):(be=0,Yt=null,Ks(e,t,o,7));break;case 5:var s=null;switch(le.tag){case 26:s=le.memoizedState;case 5:case 27:var l=le;if(s?fk(s):l.stateNode.complete){be=0,Yt=null;var a=l.sibling;if(a!==null)le=a;else{var u=l.return;u!==null?(le=u,ch(u)):le=null}break t}}be=0,Yt=null,Ks(e,t,o,5);break;case 6:be=0,Yt=null,Ks(e,t,o,6);break;case 8:Kg(),Ue=6;break e;default:throw Error(R(462))}}JD();break}catch(c){HS(e,c)}while(1);if(Yi=Yo=null,J.H=i,J.A=r,me=n,le!==null)return 0;return Ee=null,ue=0,th(),Ue}function JD(){for(;le!==null&&!b2();)KS(le)}function KS(e){var t=vS(e.alternate,e,ir);e.memoizedProps=e.pendingProps,t===null?ch(e):le=t}function cw(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=iw(n,t,t.pendingProps,t.type,void 0,ue);break;case 11:t=iw(n,t,t.pendingProps,t.type.render,t.ref,ue);break;case 5:Ng(t);default:bS(n,t),t=le=w1(t,ir),t=vS(n,t,ir)}e.memoizedProps=e.pendingProps,t===null?ch(e):le=t}function Ks(e,t,n,i){Yi=Yo=null,Ng(t),Ys=null,$a=0;var r=t.return;try{if(HD(e,r,t,n,ue)){Ue=1,zf(e,xn(n,e.current)),le=null;return}}catch(o){if(r!==null)throw le=r,o;Ue=1,zf(e,xn(n,e.current)),le=null;return}if(t.flags&32768){if(he||i===1)e=!0;else if(hl||(ue&536870912)!==0)e=!1;else if(Pr=e=!0,i===2||i===9||i===3||i===6)i=rn.current,i!==null&&i.tag===13&&(i.flags|=16384);qS(t,e)}else ch(t)}function ch(e){var t=e;do{if((t.flags&32768)!==0){qS(t,Pr);return}e=t.return;var n=FD(t.alternate,t,ir);if(n!==null){le=n;return}if(t=t.sibling,t!==null){le=t;return}le=t=e}while(t!==null);Ue===0&&(Ue=5)}function qS(e,t){do{var n=KD(e.alternate,e);if(n!==null){n.flags&=32767,le=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){le=e;return}le=e=n}while(e!==null);Ue=6,le=null}function fw(e,t,n,i,r,o,s,l,a){e.cancelPendingCommit=null;do fh();while(it!==0);if((me&6)!==0)throw Error(R(327));if(t!==null){if(t===e.current)throw Error(R(177));if(o=t.lanes|t.childLanes,o|=mg,R2(e,n,o,s,l,a),e===Ee&&(le=Ee=null,ue=0),ol=t,Fr=e,Ji=n,jm=o,Fm=r,PS=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,nL(Ef,function(){return XS(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=J.T,J.T=null,r=ge.p,ge.p=2,s=me,me|=4;try{qD(e,t,n)}finally{me=s,ge.p=r,J.T=i}}it=1,$S(),GS(),WS()}}function $S(){if(it===1){it=0;var e=Fr,t=ol,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=J.T,J.T=null;var i=ge.p;ge.p=2;var r=me;me|=4;try{NS(t,e);var o=Xm,s=d1(e.containerInfo),{focusedElem:l,selectionRange:a}=o;if(s!==l&&l&&l.ownerDocument&&h1(l.ownerDocument.documentElement,l)){if(a!==null&&pg(l)){var{start:u,end:c}=a;if(c===void 0&&(c=u),"selectionStart"in l)l.selectionStart=u,l.selectionEnd=Math.min(c,l.value.length);else{var f=l.ownerDocument||document,h=f&&f.defaultView||window;if(h.getSelection){var d=h.getSelection(),m=l.textContent.length,b=Math.min(a.start,m),x=a.end===void 0?b:Math.min(a.end,m);!d.extend&&b>x&&(s=x,x=b,b=s);var g=Dx(l,b),v=Dx(l,x);if(g&&v&&(d.rangeCount!==1||d.anchorNode!==g.node||d.anchorOffset!==g.offset||d.focusNode!==v.node||d.focusOffset!==v.offset)){var y=f.createRange();y.setStart(g.node,g.offset),d.removeAllRanges(),b>x?(d.addRange(y),d.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),d.addRange(y))}}}}f=[];for(d=l;d=d.parentNode;)d.nodeType===1&&f.push({element:d,left:d.scrollLeft,top:d.scrollTop});typeof l.focus==="function"&&l.focus();for(l=0;l<f.length;l++){var S=f[l];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}Wf=!!Ym,Xm=Ym=null}finally{me=r,ge.p=i,J.T=n}}e.current=t,it=2}}function GS(){if(it===2){it=0;var e=Fr,t=ol,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=J.T,J.T=null;var i=ge.p;ge.p=2;var r=me;me|=4;try{ES(e,t.alternate,t)}finally{me=r,ge.p=i,J.T=n}}it=3}}function WS(){if(it===4||it===3){it=0,y2();var e=Fr,t=ol,n=Ji,i=PS;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?it=5:(it=0,ol=Fr=null,YS(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(jr=null),lg(n),t=t.stateNode,en&&typeof en.onCommitFiberRoot==="function")try{en.onCommitFiberRoot(tu,t,void 0,(t.current.flags&128)===128)}catch(a){}if(i!==null){t=J.T,r=ge.p,ge.p=2,J.T=null;try{for(var o=e.onRecoverableError,s=0;s<i.length;s++){var l=i[s];o(l.value,{componentStack:l.stack})}}finally{J.T=t,ge.p=r}}(Ji&3)!==0&&fh(),rr(e),r=e.pendingLanes,(n&261930)!==0&&(r&42)!==0?e===Km?Ia++:(Ia=0,Km=e):Ia=0,uu(0,!1)}}function YS(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,su(t)))}function fh(){return $S(),GS(),WS(),XS()}function XS(){if(it!==5)return!1;var e=Fr,t=jm;jm=0;var n=lg(Ji),i=J.T,r=ge.p;try{ge.p=32>n?32:n,J.T=null,n=Fm,Fm=null;var o=Fr,s=Ji;if(it=0,ol=Fr=null,Ji=0,(me&6)!==0)throw Error(R(331));var l=me;if(me|=4,LS(o.current),MS(o,o.current,s,n),me=l,uu(0,!1),en&&typeof en.onPostCommitFiberRoot==="function")try{en.onPostCommitFiberRoot(tu,o)}catch(a){}return!0}finally{ge.p=r,J.T=i,YS(e,t)}}function hw(e,t,n){t=xn(n,t),t=Pm(e.stateNode,t,2),e=Io(e,t,2),e!==null&&(Qf(e,2),rr(e))}function ye(e,t,n){if(e.tag===3)hw(e,e,n);else for(;t!==null;){if(t.tag===3){hw(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError==="function"||typeof i.componentDidCatch==="function"&&(jr===null||!jr.has(i))){e=xn(n,e),n=fS(2),i=Io(t,n,2),i!==null&&(hS(n,i,t,e),Qf(i,2),rr(i));break}}t=t.return}}function tm(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new WD;var r=new Set;i.set(t,r)}else r=i.get(t),r===void 0&&(r=new Set,i.set(t,r));r.has(n)||(jg=!0,r.add(n),e=ZD.bind(null,e,t,n),t.then(e,e))}function ZD(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ee===e&&(ue&n)===n&&(Ue===4||Ue===3&&(ue&62914560)===ue&&300>Zt()-ah?(me&2)===0&&sl(e,0):Fg|=n,rl===ue&&(rl=0)),rr(e)}function QS(e,t){t===0&&(t=Kw()),e=Wo(e,t),e!==null&&(Qf(e,t),rr(e))}function eL(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),QS(e,n)}function tL(e,t){var n=0;switch(e.tag){case 31:case 13:var{stateNode:i,memoizedState:r}=e;r!==null&&(n=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(R(314))}i!==null&&i.delete(t),QS(e,n)}function nL(e,t){return sg(e,t)}var Uf=null,Ms=null,qm=!1,jf=!1,nm=!1,Vr=0;function rr(e){e!==Ms&&e.next===null&&(Ms===null?Uf=Ms=e:Ms=Ms.next=e),jf=!0,qm||(qm=!0,rL())}function uu(e,t){if(!nm&&jf){nm=!0;do{var n=!1;for(var i=Uf;i!==null;){if(!t)if(e!==0){var r=i.pendingLanes;if(r===0)var o=0;else{var s=i.suspendedLanes,l=i.pingedLanes;o=(1<<31-tn(42|e)+1)-1,o&=r&~(s&~l),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,dw(i,o))}else o=ue,o=Xf(i,i===Ee?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(o&3)===0||nu(i,o)||(n=!0,dw(i,o));i=i.next}}while(n);nm=!1}}function iL(){JS()}function JS(){jf=qm=!1;var e=0;Vr!==0&&hL()&&(e=Vr);for(var t=Zt(),n=null,i=Uf;i!==null;){var r=i.next,o=ZS(i,t);if(o===0)i.next=null,n===null?Uf=r:n.next=r,r===null&&(Ms=n);else if(n=i,e!==0||(o&3)!==0)jf=!0;i=r}it!==0&&it!==5||uu(e,!1),Vr!==0&&(Vr=0)}function ZS(e,t){for(var{suspendedLanes:n,pingedLanes:i,expirationTimes:r}=e,o=e.pendingLanes&-62914561;0<o;){var s=31-tn(o),l=1<<s,a=r[s];if(a===-1){if((l&n)===0||(l&i)!==0)r[s]=O2(l,t)}else a<=t&&(e.expiredLanes|=l);o&=~l}if(t=Ee,n=ue,n=Xf(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(be===2||be===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&_p(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||nu(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&_p(i),lg(n)){case 2:case 8:n=jw;break;case 32:n=Ef;break;case 268435456:n=Fw;break;default:n=Ef}return i=ek.bind(null,e),n=sg(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&_p(i),e.callbackPriority=2,e.callbackNode=null,2}function ek(e,t){if(it!==0&&it!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(fh()&&e.callbackNode!==n)return null;var i=ue;if(i=Xf(e,e===Ee?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0)return null;return VS(e,i,t),ZS(e,Zt()),e.callbackNode!=null&&e.callbackNode===n?ek.bind(null,e):null}function dw(e,t){if(fh())return null;VS(e,t,!0)}function rL(){pL(function(){(me&6)!==0?sg(Uw,iL):JS()})}function qg(){if(Vr===0){var e=tl;e===0&&(e=qc,qc<<=1,(qc&261888)===0&&(qc=256)),Vr=e}return Vr}function pw(e){return e==null||typeof e==="symbol"||typeof e==="boolean"?null:typeof e==="function"?e:sf(""+e)}function mw(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function oL(e,t,n,i,r){if(t==="submit"&&n&&n.stateNode===r){var o=pw((r[Ut]||null).action),s=i.submitter;s&&(t=(t=s[Ut]||null)?pw(t.formAction):s.getAttribute("formAction"),t!==null&&(o=t,s=null));var l=new Jf("action","action",null,i,r);e.push({event:l,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Vr!==0){var a=s?mw(r,s):new FormData(r);zm(n,{pending:!0,data:a,method:r.method,action:o},null,a)}}else typeof o==="function"&&(l.preventDefault(),a=s?mw(r,s):new FormData(r),zm(n,{pending:!0,data:a,method:r.method,action:o},o,a))},currentTarget:r}]})}}for(Ca=0;Ca<km.length;Ca++)Aa=km[Ca],$m=Aa.toLowerCase(),Gm=Aa[0].toUpperCase()+Aa.slice(1),Kn($m,"on"+Gm);var Aa,$m,Gm,Ca;Kn(m1,"onAnimationEnd");Kn(g1,"onAnimationIteration");Kn(v1,"onAnimationStart");Kn("dblclick","onDoubleClick");Kn("focusin","onFocus");Kn("focusout","onBlur");Kn(xD,"onTransitionRun");Kn(wD,"onTransitionStart");Kn(SD,"onTransitionCancel");Kn(b1,"onTransitionEnd");Zs("onMouseEnter",["mouseout","mouseover"]);Zs("onMouseLeave",["mouseout","mouseover"]);Zs("onPointerEnter",["pointerout","pointerover"]);Zs("onPointerLeave",["pointerout","pointerover"]);qo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));qo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));qo("onBeforeInput",["compositionend","keypress","textInput","paste"]);qo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));qo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));qo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ya="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(" "),sL=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ya));function tk(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],r=i.event;i=i.listeners;e:{var o=void 0;if(t)for(var s=i.length-1;0<=s;s--){var l=i[s],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==o&&r.isPropagationStopped())break e;o=l,r.currentTarget=u;try{o(r)}catch(c){Af(c)}r.currentTarget=null,o=a}else for(s=0;s<i.length;s++){if(l=i[s],a=l.instance,u=l.currentTarget,l=l.listener,a!==o&&r.isPropagationStopped())break e;o=l,r.currentTarget=u;try{o(r)}catch(c){Af(c)}r.currentTarget=null,o=a}}}}function se(e,t){var n=t[mm];n===void 0&&(n=t[mm]=new Set);var i=e+"__bubble";n.has(i)||(ik(t,e,2,!1),n.add(i))}function im(e,t,n){var i=0;t&&(i|=4),ik(n,e,i,t)}var tf="_reactListening"+Math.random().toString(36).slice(2);function nk(e){if(!e[tf]){e[tf]=!0,Xw.forEach(function(n){n!=="selectionchange"&&(sL.has(n)||im(n,!1,e),im(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[tf]||(t[tf]=!0,im("selectionchange",!1,t))}}function ik(e,t,n,i){switch(pk(t)){case 2:var r=BL;break;case 8:r=PL;break;default:r=Yg}n=r.bind(null,t,n,e),r=void 0,!xm||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),i?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function rm(e,t,n,i,r){var o=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var s=i.tag;if(s===3||s===4){var l=i.stateNode.containerInfo;if(l===r)break;if(s===4)for(s=i.return;s!==null;){var a=s.tag;if((a===3||a===4)&&s.stateNode.containerInfo===r)return;s=s.return}for(;l!==null;){if(s=zs(l),s===null)return;if(a=s.tag,a===5||a===6||a===26||a===27){i=o=s;continue e}l=l.parentNode}}i=i.return}r1(function(){var u=o,c=cg(n),f=[];e:{var h=y1.get(e);if(h!==void 0){var d=Jf,m=e;switch(e){case"keypress":if(af(n)===0)break e;case"keydown":case"keyup":d=J2;break;case"focusin":m="focus",d=Pp;break;case"focusout":m="blur",d=Pp;break;case"beforeblur":case"afterblur":d=Pp;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":d=Ex;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":d=H2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":d=tD;break;case m1:case g1:case v1:d=F2;break;case b1:d=iD;break;case"scroll":case"scrollend":d=I2;break;case"wheel":d=oD;break;case"copy":case"cut":case"paste":d=q2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":d=Ax;break;case"toggle":case"beforetoggle":d=lD}var b=(t&4)!==0,x=!b&&(e==="scroll"||e==="scrollend"),g=b?h!==null?h+"Capture":null:h;b=[];for(var v=u,y;v!==null;){var S=v;if(y=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||y===null||g===null||(S=Ua(v,g),S!=null&&b.push(Xa(v,S,y))),x)break;v=v.return}0<b.length&&(h=new d(h,m,null,n,c),f.push({event:h,listeners:b}))}}if((t&7)===0){e:{if(h=e==="mouseover"||e==="pointerover",d=e==="mouseout"||e==="pointerout",h&&n!==ym&&(m=n.relatedTarget||n.fromElement)&&(zs(m)||m[iu]))break e;if(d||h){if(h=c.window===c?c:(h=c.ownerDocument)?h.defaultView||h.parentWindow:window,d){if(m=n.relatedTarget||n.toElement,d=u,m=m?zs(m):null,m!==null&&(x=eu(m),b=m.tag,m!==x||b!==5&&b!==27&&b!==6))m=null}else d=null,m=u;if(d!==m){if(b=Ex,S="onMouseLeave",g="onMouseEnter",v="mouse",e==="pointerout"||e==="pointerover")b=Ax,S="onPointerLeave",g="onPointerEnter",v="pointer";if(x=d==null?h:xa(d),y=m==null?h:xa(m),h=new b(S,v+"leave",d,n,c),h.target=x,h.relatedTarget=y,S=null,zs(c)===u&&(b=new b(g,v+"enter",m,n,c),b.target=y,b.relatedTarget=x,S=b),x=S,d&&m)t:{b=lL,g=d,v=m,y=0;for(S=g;S;S=b(S))y++;S=0;for(var k=v;k;k=b(k))S++;for(;0<y-S;)g=b(g),y--;for(;0<S-y;)v=b(v),S--;for(;y--;){if(g===v||v!==null&&g===v.alternate){b=g;break t}g=b(g),v=b(v)}b=null}else b=null;d!==null&&gw(f,h,d,b,!1),m!==null&&x!==null&&gw(f,x,m,b,!0)}}}e:{if(h=u?xa(u):window,d=h.nodeName&&h.nodeName.toLowerCase(),d==="select"||d==="input"&&h.type==="file")var A=Tx;else if(Nx(h))if(c1)A=vD;else{A=mD;var E=pD}else d=h.nodeName,!d||d.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?u&&ug(u.elementType)&&(A=Tx):A=gD;if(A&&(A=A(e,u))){u1(f,A,n,c);break e}E&&E(e,h,u),e==="focusout"&&u&&h.type==="number"&&u.memoizedProps.value!=null&&bm(h,"number",h.value)}switch(E=u?xa(u):window,e){case"focusin":if(Nx(E)||E.contentEditable==="true")Is=E,wm=u,Na=null;break;case"focusout":Na=wm=Is=null;break;case"mousedown":Sm=!0;break;case"contextmenu":case"mouseup":case"dragend":Sm=!1,Lx(f,n,c);break;case"selectionchange":if(yD)break;case"keydown":case"keyup":Lx(f,n,c)}var O;if(dg)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Ps?l1(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");if(T&&(s1&&n.locale!=="ko"&&(Ps||T!=="onCompositionStart"?T==="onCompositionEnd"&&Ps&&(O=o1()):(Br=c,fg=("value"in Br)?Br.value:Br.textContent,Ps=!0)),E=Ff(u,T),0<E.length&&(T=new Cx(T,e,null,n,c),f.push({event:T,listeners:E}),O?T.data=O:(O=a1(n),O!==null&&(T.data=O)))),O=uD?cD(e,n):fD(e,n))T=Ff(u,"onBeforeInput"),0<T.length&&(E=new Cx("onBeforeInput","beforeinput",null,n,c),f.push({event:E,listeners:T}),E.data=O);oL(f,e,u,n,c)}tk(f,t)})}function Xa(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ff(e,t){for(var n=t+"Capture",i=[];e!==null;){var r=e,o=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||o===null||(r=Ua(e,n),r!=null&&i.unshift(Xa(e,r,o)),r=Ua(e,t),r!=null&&i.push(Xa(e,r,o))),e.tag===3)return i;e=e.return}return[]}function lL(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e?e:null}function gw(e,t,n,i,r){for(var o=t._reactName,s=[];n!==null&&n!==i;){var l=n,a=l.alternate,u=l.stateNode;if(l=l.tag,a!==null&&a===i)break;l!==5&&l!==26&&l!==27||u===null||(a=u,r?(u=Ua(n,o),u!=null&&s.unshift(Xa(n,u,a))):r||(u=Ua(n,o),u!=null&&s.push(Xa(n,u,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var aL=/\r\n?/g,uL=/\u0000|\uFFFD/g;function vw(e){return(typeof e==="string"?e:""+e).replace(aL,`
9
+ `).replace(uL,"")}function rk(e,t){return t=vw(t),vw(e)===t?!0:!1}function xe(e,t,n,i,r,o){switch(n){case"children":typeof i==="string"?t==="body"||t==="textarea"&&i===""||el(e,i):(typeof i==="number"||typeof i==="bigint")&&t!=="body"&&el(e,""+i);break;case"className":Wc(e,"class",i);break;case"tabIndex":Wc(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Wc(e,n,i);break;case"style":i1(e,i,o);break;case"data":if(t!=="object"){Wc(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i==="function"||typeof i==="symbol"||typeof i==="boolean"){e.removeAttribute(n);break}i=sf(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i==="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o==="function"&&(n==="formAction"?(t!=="input"&&xe(e,t,"name",r.name,r,null),xe(e,t,"formEncType",r.formEncType,r,null),xe(e,t,"formMethod",r.formMethod,r,null),xe(e,t,"formTarget",r.formTarget,r,null)):(xe(e,t,"encType",r.encType,r,null),xe(e,t,"method",r.method,r,null),xe(e,t,"target",r.target,r,null)));if(i==null||typeof i==="symbol"||typeof i==="boolean"){e.removeAttribute(n);break}i=sf(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=Wi);break;case"onScroll":i!=null&&se("scroll",e);break;case"onScrollEnd":i!=null&&se("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!=="object"||!("__html"in i))throw Error(R(61));if(n=i.__html,n!=null){if(r.children!=null)throw Error(R(60));e.innerHTML=n}}break;case"multiple":e.multiple=i&&typeof i!=="function"&&typeof i!=="symbol";break;case"muted":e.muted=i&&typeof i!=="function"&&typeof i!=="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i==="function"||typeof i==="boolean"||typeof i==="symbol"){e.removeAttribute("xlink:href");break}n=sf(""+i),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":i!=null&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,""+i):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!=="function"&&typeof i!=="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!=="function"&&typeof i!=="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i==="function"||typeof i==="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":se("beforetoggle",e),se("toggle",e),of(e,"popover",i);break;case"xlinkActuate":Hi(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Hi(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Hi(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Hi(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Hi(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Hi(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Hi(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Hi(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Hi(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":of(e,"is",i);break;case"innerText":case"textContent":break;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=B2.get(n)||n,of(e,n,i)}}function Wm(e,t,n,i,r,o){switch(n){case"style":i1(e,i,o);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!=="object"||!("__html"in i))throw Error(R(61));if(n=i.__html,n!=null){if(r.children!=null)throw Error(R(60));e.innerHTML=n}}break;case"children":typeof i==="string"?el(e,i):(typeof i==="number"||typeof i==="bigint")&&el(e,""+i);break;case"onScroll":i!=null&&se("scroll",e);break;case"onScrollEnd":i!=null&&se("scrollend",e);break;case"onClick":i!=null&&(e.onclick=Wi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Qw.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),o=e[Ut]||null,o=o!=null?o[n]:null,typeof o==="function"&&e.removeEventListener(t,o,r),typeof i==="function")){typeof o!=="function"&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,r);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):of(e,n,i)}}}function gt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":se("error",e),se("load",e);var i=!1,r=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case"src":i=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(R(137,t));default:xe(e,t,o,s,n,null)}}r&&xe(e,t,"srcSet",n.srcSet,n,null),i&&xe(e,t,"src",n.src,n,null);return;case"input":se("invalid",e);var l=o=s=r=null,a=null,u=null;for(i in n)if(n.hasOwnProperty(i)){var c=n[i];if(c!=null)switch(i){case"name":r=c;break;case"type":s=c;break;case"checked":a=c;break;case"defaultChecked":u=c;break;case"value":o=c;break;case"defaultValue":l=c;break;case"children":case"dangerouslySetInnerHTML":if(c!=null)throw Error(R(137,t));break;default:xe(e,t,i,c,n,null)}}e1(e,o,l,a,u,s,r,!1);return;case"select":se("invalid",e),i=s=o=null;for(r in n)if(n.hasOwnProperty(r)&&(l=n[r],l!=null))switch(r){case"value":o=l;break;case"defaultValue":s=l;break;case"multiple":i=l;default:xe(e,t,r,l,n,null)}t=o,n=s,e.multiple=!!i,t!=null?$s(e,!!i,t,!1):n!=null&&$s(e,!!i,n,!0);return;case"textarea":se("invalid",e),o=r=i=null;for(s in n)if(n.hasOwnProperty(s)&&(l=n[s],l!=null))switch(s){case"value":i=l;break;case"defaultValue":r=l;break;case"children":o=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(R(91));break;default:xe(e,t,s,l,n,null)}n1(e,i,r,o);return;case"option":for(a in n)if(n.hasOwnProperty(a)&&(i=n[a],i!=null))switch(a){case"selected":e.selected=i&&typeof i!=="function"&&typeof i!=="symbol";break;default:xe(e,t,a,i,n,null)}return;case"dialog":se("beforetoggle",e),se("toggle",e),se("cancel",e),se("close",e);break;case"iframe":case"object":se("load",e);break;case"video":case"audio":for(i=0;i<Ya.length;i++)se(Ya[i],e);break;case"image":se("error",e),se("load",e);break;case"details":se("toggle",e);break;case"embed":case"source":case"link":se("error",e),se("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)&&(i=n[u],i!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(R(137,t));default:xe(e,t,u,i,n,null)}return;default:if(ug(t)){for(c in n)n.hasOwnProperty(c)&&(i=n[c],i!==void 0&&Wm(e,t,c,i,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(i=n[l],i!=null&&xe(e,t,l,i,n,null))}function cL(e,t,n,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,o=null,s=null,l=null,a=null,u=null,c=null;for(d in n){var f=n[d];if(n.hasOwnProperty(d)&&f!=null)switch(d){case"checked":break;case"value":break;case"defaultValue":a=f;default:i.hasOwnProperty(d)||xe(e,t,d,null,i,f)}}for(var h in i){var d=i[h];if(f=n[h],i.hasOwnProperty(h)&&(d!=null||f!=null))switch(h){case"type":o=d;break;case"name":r=d;break;case"checked":u=d;break;case"defaultChecked":c=d;break;case"value":s=d;break;case"defaultValue":l=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(R(137,t));break;default:d!==f&&xe(e,t,h,d,i,f)}}vm(e,s,l,a,u,c,o,r);return;case"select":d=s=l=h=null;for(o in n)if(a=n[o],n.hasOwnProperty(o)&&a!=null)switch(o){case"value":break;case"multiple":d=a;default:i.hasOwnProperty(o)||xe(e,t,o,null,i,a)}for(r in i)if(o=i[r],a=n[r],i.hasOwnProperty(r)&&(o!=null||a!=null))switch(r){case"value":h=o;break;case"defaultValue":l=o;break;case"multiple":s=o;default:o!==a&&xe(e,t,r,o,i,a)}t=l,n=s,i=d,h!=null?$s(e,!!n,h,!1):!!i!==!!n&&(t!=null?$s(e,!!n,t,!0):$s(e,!!n,n?[]:"",!1));return;case"textarea":d=h=null;for(l in n)if(r=n[l],n.hasOwnProperty(l)&&r!=null&&!i.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:xe(e,t,l,null,i,r)}for(s in i)if(r=i[s],o=n[s],i.hasOwnProperty(s)&&(r!=null||o!=null))switch(s){case"value":h=r;break;case"defaultValue":d=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(R(91));break;default:r!==o&&xe(e,t,s,r,i,o)}t1(e,h,d);return;case"option":for(var m in n)if(h=n[m],n.hasOwnProperty(m)&&h!=null&&!i.hasOwnProperty(m))switch(m){case"selected":e.selected=!1;break;default:xe(e,t,m,null,i,h)}for(a in i)if(h=i[a],d=n[a],i.hasOwnProperty(a)&&h!==d&&(h!=null||d!=null))switch(a){case"selected":e.selected=h&&typeof h!=="function"&&typeof h!=="symbol";break;default:xe(e,t,a,h,i,d)}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 b in n)h=n[b],n.hasOwnProperty(b)&&h!=null&&!i.hasOwnProperty(b)&&xe(e,t,b,null,i,h);for(u in i)if(h=i[u],d=n[u],i.hasOwnProperty(u)&&h!==d&&(h!=null||d!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(R(137,t));break;default:xe(e,t,u,h,i,d)}return;default:if(ug(t)){for(var x in n)h=n[x],n.hasOwnProperty(x)&&h!==void 0&&!i.hasOwnProperty(x)&&Wm(e,t,x,void 0,i,h);for(c in i)h=i[c],d=n[c],!i.hasOwnProperty(c)||h===d||h===void 0&&d===void 0||Wm(e,t,c,h,i,d);return}}for(var g in n)h=n[g],n.hasOwnProperty(g)&&h!=null&&!i.hasOwnProperty(g)&&xe(e,t,g,null,i,h);for(f in i)h=i[f],d=n[f],!i.hasOwnProperty(f)||h===d||h==null&&d==null||xe(e,t,f,h,i,d)}function bw(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fL(){if(typeof performance.getEntriesByType==="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var r=n[i],{transferSize:o,initiatorType:s,duration:l}=r;if(o&&l&&bw(s)){s=0,l=r.responseEnd;for(i+=1;i<n.length;i++){var a=n[i],u=a.startTime;if(u>l)break;var c=a.transferSize,f=a.initiatorType;c&&bw(f)&&(a=a.responseEnd,s+=c*(a<l?1:(l-u)/(a-u)))}if(--i,t+=8*(o+s)/(r.duration/1000),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==="number")?e:5}var Ym=null,Xm=null;function Kf(e){return e.nodeType===9?e:e.ownerDocument}function yw(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 ok(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 Qm(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 om=null;function hL(){var e=window.event;if(e&&e.type==="popstate"){if(e===om)return!1;return om=e,!0}return om=null,!1}var sk=typeof setTimeout==="function"?setTimeout:void 0,dL=typeof clearTimeout==="function"?clearTimeout:void 0,xw=typeof Promise==="function"?Promise:void 0,pL=typeof queueMicrotask==="function"?queueMicrotask:typeof xw<"u"?function(e){return xw.resolve(null).then(e).catch(mL)}:sk;function mL(e){setTimeout(function(){throw e})}function Jr(e){return e==="head"}function ww(e,t){var n=t,i=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(r),al(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Va(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Va(n);for(var o=n.firstChild;o;){var s=o.nextSibling,l=o.nodeName;o[ru]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=s}}else n==="body"&&Va(e.ownerDocument.body);n=r}while(n);al(t)}function Sw(e,t){var n=e;e=0;do{var i=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||""),i&&i.nodeType===8)if(n=i.data,n==="/$")if(e===0)break;else e--;else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function Jm(e){var t=e.firstChild;t&&t.nodeType===10&&(t=t.nextSibling);for(;t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Jm(n),ag(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function gL(e,t,n,i){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(!i)if(t==="input"&&e.type==="hidden"){var o=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;else if(!e[ru])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;else if(o!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}if(e=En(e.nextSibling),e===null)break}return null}function vL(e,t,n){if(t==="")return null;for(;e.nodeType!==3;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n)return null;if(e=En(e.nextSibling),e===null)return null}return e}function lk(e,t){for(;e.nodeType!==8;){if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t)return null;if(e=En(e.nextSibling),e===null)return null}return e}function Zm(e){return e.data==="$?"||e.data==="$~"}function eg(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function bL(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function En(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 tg=null;function kw(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return En(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Ew(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 ak(e,t,n){switch(t=Kf(n),e){case"html":if(e=t.documentElement,!e)throw Error(R(452));return e;case"head":if(e=t.head,!e)throw Error(R(453));return e;case"body":if(e=t.body,!e)throw Error(R(454));return e;default:throw Error(R(451))}}function Va(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ag(e)}var Cn=new Map,Cw=new Set;function qf(e){return typeof e.getRootNode==="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var or=ge.d;ge.d={f:yL,r:xL,D:wL,C:SL,L:kL,m:EL,X:AL,S:CL,M:OL};function yL(){var e=or.f(),t=uh();return e||t}function xL(e){var t=ul(e);t!==null&&t.tag===5&&t.type==="form"?iS(t):or.r(e)}var dl=typeof document>"u"?null:document;function uk(e,t,n){var i=dl;if(i&&typeof t==="string"&&t){var r=yn(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n==="string"&&(r+='[crossorigin="'+n+'"]'),Cw.has(r)||(Cw.add(r),e={rel:e,crossOrigin:n,href:t},i.querySelector(r)===null&&(t=i.createElement("link"),gt(t,"link",e),ot(t),i.head.appendChild(t)))}}function wL(e){or.D(e),uk("dns-prefetch",e,null)}function SL(e,t){or.C(e,t),uk("preconnect",e,t)}function kL(e,t,n){or.L(e,t,n);var i=dl;if(i&&e&&t){var r='link[rel="preload"][as="'+yn(t)+'"]';t==="image"?n&&n.imageSrcSet?(r+='[imagesrcset="'+yn(n.imageSrcSet)+'"]',typeof n.imageSizes==="string"&&(r+='[imagesizes="'+yn(n.imageSizes)+'"]')):r+='[href="'+yn(e)+'"]':r+='[href="'+yn(e)+'"]';var o=r;switch(t){case"style":o=ll(e);break;case"script":o=pl(e)}Cn.has(o)||(e=ze({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Cn.set(o,e),i.querySelector(r)!==null||t==="style"&&i.querySelector(cu(o))||t==="script"&&i.querySelector(fu(o))||(t=i.createElement("link"),gt(t,"link",e),ot(t),i.head.appendChild(t)))}}function EL(e,t){or.m(e,t);var n=dl;if(n&&e){var i=t&&typeof t.as==="string"?t.as:"script",r='link[rel="modulepreload"][as="'+yn(i)+'"][href="'+yn(e)+'"]',o=r;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=pl(e)}if(!Cn.has(o)&&(e=ze({rel:"modulepreload",href:e},t),Cn.set(o,e),n.querySelector(r)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(fu(o)))return}i=n.createElement("link"),gt(i,"link",e),ot(i),n.head.appendChild(i)}}}function CL(e,t,n){or.S(e,t,n);var i=dl;if(i&&e){var r=qs(i).hoistableStyles,o=ll(e);t=t||"default";var s=r.get(o);if(!s){var l={loading:0,preload:null};if(s=i.querySelector(cu(o)))l.loading=5;else{e=ze({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Cn.get(o))&&$g(e,n);var a=s=i.createElement("link");ot(a),gt(a,"link",e),a._p=new Promise(function(u,c){a.onload=u,a.onerror=c}),a.addEventListener("load",function(){l.loading|=1}),a.addEventListener("error",function(){l.loading|=2}),l.loading|=4,vf(s,t,i)}s={type:"stylesheet",instance:s,count:1,state:l},r.set(o,s)}}}function AL(e,t){or.X(e,t);var n=dl;if(n&&e){var i=qs(n).hoistableScripts,r=pl(e),o=i.get(r);o||(o=n.querySelector(fu(r)),o||(e=ze({src:e,async:!0},t),(t=Cn.get(r))&&Gg(e,t),o=n.createElement("script"),ot(o),gt(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(r,o))}}function OL(e,t){or.M(e,t);var n=dl;if(n&&e){var i=qs(n).hoistableScripts,r=pl(e),o=i.get(r);o||(o=n.querySelector(fu(r)),o||(e=ze({src:e,async:!0,type:"module"},t),(t=Cn.get(r))&&Gg(e,t),o=n.createElement("script"),ot(o),gt(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},i.set(r,o))}}function Aw(e,t,n,i){var r=(r=Hr.current)?qf(r):null;if(!r)throw Error(R(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence==="string"&&typeof n.href==="string"?(t=ll(n.href),n=qs(r).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href==="string"&&typeof n.precedence==="string"){e=ll(n.href);var o=qs(r).hoistableStyles,s=o.get(e);if(s||(r=r.ownerDocument||r,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=r.querySelector(cu(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Cn.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Cn.set(e,n),o||RL(r,e,n,s.state))),t&&i===null)throw Error(R(528,""));return s}if(t&&i!==null)throw Error(R(529,""));return null;case"script":return t=n.async,n=n.src,typeof n==="string"&&t&&typeof t!=="function"&&typeof t!=="symbol"?(t=pl(n),n=qs(r).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(R(444,e))}}function ll(e){return'href="'+yn(e)+'"'}function cu(e){return'link[rel="stylesheet"]['+e+"]"}function ck(e){return ze({},e,{"data-precedence":e.precedence,precedence:null})}function RL(e,t,n,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),gt(t,"link",n),ot(t),e.head.appendChild(t))}function pl(e){return'[src="'+yn(e)+'"]'}function fu(e){return"script[async]"+e}function Ow(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+yn(n.href)+'"]');if(i)return t.instance=i,ot(i),i;var r=ze({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),ot(i),gt(i,"style",r),vf(i,n.precedence,e),t.instance=i;case"stylesheet":r=ll(n.href);var o=e.querySelector(cu(r));if(o)return t.state.loading|=4,t.instance=o,ot(o),o;i=ck(n),(r=Cn.get(r))&&$g(i,r),o=(e.ownerDocument||e).createElement("link"),ot(o);var s=o;return s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),gt(o,"link",i),t.state.loading|=4,vf(o,n.precedence,e),t.instance=o;case"script":if(o=pl(n.src),r=e.querySelector(fu(o)))return t.instance=r,ot(r),r;if(i=n,r=Cn.get(o))i=ze({},n),Gg(i,r);return e=e.ownerDocument||e,r=e.createElement("script"),ot(r),gt(r,"link",i),e.head.appendChild(r),t.instance=r;case"void":return null;default:throw Error(R(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,vf(i,n.precedence,e));return t.instance}function vf(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=i.length?i[i.length-1]:null,o=r,s=0;s<i.length;s++){var l=i[s];if(l.dataset.precedence===t)o=l;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function $g(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Gg(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var bf=null;function Rw(e,t,n){if(bf===null){var i=new Map,r=bf=new Map;r.set(n,i)}else r=bf,i=r.get(n),i||(i=new Map,r.set(n,i));if(i.has(e))return i;i.set(e,null),n=n.getElementsByTagName(e);for(r=0;r<n.length;r++){var o=n[r];if(!(o[ru]||o[dt]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var s=o.getAttribute(t)||"";s=e+s;var l=i.get(s);l?l.push(o):i.set(s,[o])}}return i}function Nw(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function NL(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 fk(e){return e.type==="stylesheet"&&(e.state.loading&3)===0?!1:!0}function TL(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!=="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var r=ll(i.href),o=t.querySelector(cu(r));if(o){t=o._p,t!==null&&typeof t==="object"&&typeof t.then==="function"&&(e.count++,e=$f.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=o,ot(o);return}o=t.ownerDocument||t,i=ck(i),(r=Cn.get(r))&&$g(i,r),o=o.createElement("link"),ot(o);var s=o;s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),gt(o,"link",i),n.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=$f.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var sm=0;function ML(e,t){return e.stylesheets&&e.count===0&&yf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&yf(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},60000+t);0<e.imgBytes&&sm===0&&(sm=62500*fL());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&yf(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>sm?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(r)}}:null}function $f(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)yf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Gf=null;function yf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Gf=new Map,t.forEach(_L,e),Gf=null,$f.call(e))}function _L(e,t){if(!(t.state.loading&4)){var n=Gf.get(e);if(n)var i=n.get(null);else{n=new Map,Gf.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var s=r[o];if(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")n.set(s.dataset.precedence,s),i=s}i&&n.set(null,i)}r=t.instance,s=r.getAttribute("data-precedence"),o=n.get(s)||i,o===i&&n.set(null,r),n.set(s,r),this.count++,i=$f.bind(this),r.addEventListener("load",i),r.addEventListener("error",i),o?o.parentNode.insertBefore(r,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var Qa={$$typeof:Gi,Provider:null,Consumer:null,_currentValue:Do,_currentValue2:Do,_threadCount:0};function DL(e,t,n,i,r,o,s,l,a){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=Dp(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dp(0),this.hiddenUpdates=Dp(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=a,this.incompleteTransitions=new Map}function LL(e,t,n,i,r,o,s,l,a,u,c,f){return e=new DL(e,t,n,s,a,u,c,f,l),t=1,o===!0&&(t|=24),o=Qt(3,null,null,t),e.current=o,o.stateNode=e,t=xg(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:i,isDehydrated:n,cache:t},kg(o),e}function zL(e){if(!e)return Us;return e=Us,e}function hk(e,t,n,i,r,o){r=zL(r),i.context===null?i.context=r:i.pendingContext=r,i=Po(t),i.payload={element:n},o=o===void 0?null:o,o!==null&&(i.callback=o),n=Io(e,i,t),n!==null&&(Ht(n,e,t),Ma(n,e,t))}function Tw(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Wg(e,t){Tw(e,t),(e=e.alternate)&&Tw(e,t)}function dk(e){if(e.tag===13||e.tag===31){var t=Wo(e,67108864);t!==null&&Ht(t,e,67108864),Wg(e,67108864)}}function Mw(e){if(e.tag===13||e.tag===31){var t=kn();t=Ww(t);var n=Wo(e,t);n!==null&&Ht(n,e,t),Wg(e,t)}}var Wf=!0;function BL(e,t,n,i){var r=J.T;J.T=null;var o=ge.p;try{ge.p=2,Yg(e,t,n,i)}finally{ge.p=o,J.T=r}}function PL(e,t,n,i){var r=J.T;J.T=null;var o=ge.p;try{ge.p=8,Yg(e,t,n,i)}finally{ge.p=o,J.T=r}}function Yg(e,t,n,i){if(Wf){var r=ng(i);if(r===null)rm(e,t,i,Yf,n),_w(e,i);else if(VL(r,e,t,n,i))i.stopPropagation();else if(_w(e,i),t&4&&-1<IL.indexOf(e)){for(;r!==null;){var o=ul(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var s=No(o.pendingLanes);if(s!==0){var l=o;l.pendingLanes|=2;for(l.entangledLanes|=2;s;){var a=1<<31-tn(s);l.entanglements[1]|=a,s&=~a}rr(o),(me&6)===0&&(If=Zt()+500,uu(0,!1))}}break;case 31:case 13:l=Wo(o,2),l!==null&&Ht(l,o,2),uh(),Wg(o,2)}if(o=ng(i),o===null&&rm(e,t,i,Yf,n),o===r)break;r=o}r!==null&&i.stopPropagation()}else rm(e,t,i,null,n)}}function ng(e){return e=cg(e),Xg(e)}var Yf=null;function Xg(e){if(Yf=null,e=zs(e),e!==null){var t=eu(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Bw(t),e!==null)return e;e=null}else if(n===31){if(e=Pw(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 Yf=e,null}function pk(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"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(x2()){case Uw:return 2;case jw:return 8;case Ef:case w2:return 32;case Fw:return 268435456;default:return 32}default:return 32}}var ig=!1,Kr=null,qr=null,$r=null,Ja=new Map,Za=new Map,Lr=[],IL="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 _w(e,t){switch(e){case"focusin":case"focusout":Kr=null;break;case"dragenter":case"dragleave":qr=null;break;case"mouseover":case"mouseout":$r=null;break;case"pointerover":case"pointerout":Ja.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Za.delete(t.pointerId)}}function va(e,t,n,i,r,o){if(e===null||e.nativeEvent!==o)return e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:o,targetContainers:[r]},t!==null&&(t=ul(t),t!==null&&dk(t)),e;return e.eventSystemFlags|=i,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e}function VL(e,t,n,i,r){switch(t){case"focusin":return Kr=va(Kr,e,t,n,i,r),!0;case"dragenter":return qr=va(qr,e,t,n,i,r),!0;case"mouseover":return $r=va($r,e,t,n,i,r),!0;case"pointerover":var o=r.pointerId;return Ja.set(o,va(Ja.get(o)||null,e,t,n,i,r)),!0;case"gotpointercapture":return o=r.pointerId,Za.set(o,va(Za.get(o)||null,e,t,n,i,r)),!0}return!1}function mk(e){var t=zs(e.target);if(t!==null){var n=eu(t);if(n!==null){if(t=n.tag,t===13){if(t=Bw(n),t!==null){e.blockedOn=t,vx(e.priority,function(){Mw(n)});return}}else if(t===31){if(t=Pw(n),t!==null){e.blockedOn=t,vx(e.priority,function(){Mw(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 xf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ng(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);ym=i,n.target.dispatchEvent(i),ym=null}else return t=ul(n),t!==null&&dk(t),e.blockedOn=n,!1;t.shift()}return!0}function Dw(e,t,n){xf(e)&&n.delete(t)}function HL(){ig=!1,Kr!==null&&xf(Kr)&&(Kr=null),qr!==null&&xf(qr)&&(qr=null),$r!==null&&xf($r)&&($r=null),Ja.forEach(Dw),Za.forEach(Dw)}function nf(e,t){e.blockedOn===t&&(e.blockedOn=null,ig||(ig=!0,Ao(Co,HL)))}var rf=null;function Lw(e){rf!==e&&(rf=e,Ao(Co,function(){rf===e&&(rf=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],r=e[t+2];if(typeof i!=="function")if(Xg(i||n)===null)continue;else break;var o=ul(n);o!==null&&(e.splice(t,3),t-=3,zm(o,{pending:!0,data:r,method:n.method,action:i},i,r))}}))}function al(e){function t(a){return nf(a,e)}Kr!==null&&nf(Kr,e),qr!==null&&nf(qr,e),$r!==null&&nf($r,e),Ja.forEach(t),Za.forEach(t);for(var n=0;n<Lr.length;n++){var i=Lr[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Lr.length&&(n=Lr[0],n.blockedOn===null);)mk(n),n.blockedOn===null&&Lr.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var r=n[i],o=n[i+1],s=r[Ut]||null;if(typeof o==="function")s||Lw(n);else if(s){var l=null;if(o&&o.hasAttribute("formAction")){if(r=o,s=o[Ut]||null)l=s.formAction;else if(Xg(r)!==null)continue}else l=s.action;typeof l==="function"?n[i+1]=l:(n.splice(i,3),i-=3),Lw(n)}}}function UL(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(s){return r=s})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation==="object"){var i=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Qg(e){this._internalRoot=e}Jg.prototype.render=Qg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(R(409));var n=t.current,i=kn();hk(n,i,e,t,null,null)};Jg.prototype.unmount=Qg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;hk(e.current,2,null,e,null,null),uh(),t[iu]=null}};function Jg(e){this._internalRoot=e}Jg.prototype.unstable_scheduleHydration=function(e){if(e){var t=Yw();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lr.length&&t!==0&&t<Lr[n].priority;n++);Lr.splice(n,0,e),n===0&&mk(e)}};var zw=jc;if(zw!=="19.2.8")throw Error(R(527,zw,"19.2.8"));ge.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0){if(typeof e.render==="function")throw Error(R(188));throw e=Object.keys(e).join(","),Error(R(268,e))}return e=d2(t),e=e!==null?Iw(e):null,e=e===null?null:e.stateNode,e};var jL={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:J,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){if(_s=__REACT_DEVTOOLS_GLOBAL_HOOK__,!_s.isDisabled&&_s.supportsFiber)try{tu=_s.inject(jL),en=_s}catch(e){}}var _s;var Zg=function(e,t){if(!h2(e))throw Error(R(299));var n=!1,i="",r=PD,o=ID,s=VD;return t!==null&&t!==void 0&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=LL(e,1,!1,null,null,n,i,null,r,o,s,UL),e[iu]=t.current,nk(e),new Qg(t)};gk();function Oe(e,...t){throw Error(`[MobX] minified error nr: ${e}${t.length?" "+t.map(String).join(","):""}. See mobx.js.org/errors`)}var{assign:xi,getOwnPropertyDescriptor:av,defineProperty:ar,prototype:xh}=Object,nv=[];Object.freeze(nv);var Tk={};Object.freeze(Tk);var qL=Object.toString();var gl=()=>{};function bl(e){return typeof e==="function"}function iv(e){switch(typeof e){case"string":case"symbol":case"number":return!0}return!1}function wh(e){return e!==null&&typeof e==="object"}function cr(e){if(!wh(e))return!1;let t=Object.getPrototypeOf(e);if(t==null)return!0;let n=Xo(t,"constructor")&&t.constructor;return typeof n==="function"&&n.toString()===qL}function Mk(e){let t=e==null?void 0:e.constructor;if(!t)return!1;if(t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction")return!0;return!1}function _k(e,t,n){ar(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function $L(e,t,n){ar(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Zo(e,t){let n="isMobX"+e;return t.prototype[n]=!0,function(i){return wh(i)&&i[n]===!0}}function mu(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function GL(e){let t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t);return Object.getPrototypeOf(n)===null}function Zr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}function WL(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(!n.length)return t;return[...t,...n.filter((i)=>xh.propertyIsEnumerable.call(e,i))]}var mh=Reflect.ownKeys;function Dk(e){return e===null?null:typeof e==="object"?""+e:e}function Xo(e,t){return xh.hasOwnProperty.call(e,t)}var YL=Object.getOwnPropertyDescriptors;function on(e,t){return!!(e&t)}function sn(e,t,n){if(n)e|=t;else e&=~t;return e}var ie=Symbol("mobx administration");class xl{constructor(e="Atom"){this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=-1,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}get isBeingObserved(){return on(this.flags_,1)}set isBeingObserved(e){this.flags_=sn(this.flags_,1,e)}get isPendingUnobservation(){return on(this.flags_,2)}set isPendingUnobservation(e){this.flags_=sn(this.flags_,2,e)}get diffValue(){return on(this.flags_,4)?1:0}set diffValue(e){this.flags_=sn(this.flags_,4,e===1?!0:!1)}onBO(){if(this.onBOL)this.onBOL.forEach((e)=>e())}onBUO(){if(this.onBUOL)this.onBUOL.forEach((e)=>e())}reportObserved(){return nE(this)}reportChanged(){Rn(),iE(this),Nn()}toString(){return this.name_}}var uv=Zo("Atom",xl);function Lk(e,t=gl,n=gl){let i=new xl(e);if(t!==gl)i.onBOL=new Set([t]);if(n!==gl)i.onBUOL=new Set([n]);return i}var cv=Object.is;function Qo(e,t,n){if(gE(e))return e;if(Array.isArray(e))return vt.array(e,{name:n});if(cr(e))return vt.object(e,void 0,{name:n});if(mu(e))return vt.map(e,{name:n});if(Zr(e))return vt.set(e,{name:n});if(typeof e==="function"&&!yl(e)&&!du(e))if(Mk(e))return Ah(e);else return pv(n,e);return e}function XL(e,t,n){if(e===void 0||e===null)return e;if(pu(e)||bE(e)||El(e)||lr(e))return e;if(Array.isArray(e))return vt.array(e,{name:n,deep:!1});if(cr(e))return vt.object(e,void 0,{name:n,deep:!1});if(mu(e))return vt.map(e,{name:n,deep:!1});if(Zr(e))return vt.set(e,{name:n,deep:!1})}function Sh(e){return e}function kh(e,t){return{annotationType_:e,options_:t,make_:QL,extend_:JL}}function QL(e,t,n,i){var r;if((r=this.options_)!=null&&r.bound)return this.extend_(e,t,n,!1)===null?0:1;if(i===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(yl(n.value))return 1;let o=Bk(e,this,t,n,!1);return ar(i,t,o),2}function JL(e,t,n,i){let r=Bk(e,this,t,n);return e.defineProperty_(t,r,i)}function zk(e,t,n){let{kind:i,name:r,addInitializer:o}=n,s=e,l=(u)=>{var c,f,h,d;return Jo((c=(f=s.options_)==null?void 0:f.name)!=null?c:r.toString(),u,(h=(d=s.options_)==null?void 0:d.autoAction)!=null?h:!1)};if(i=="field")return function(u){var c;let f=u;if(!yl(f))f=l(f);if((c=s.options_)!=null&&c.bound)f=f.bind(this),f.isMobxAction=!0;return f};if(i=="method"){var a;if(!yl(t))t=l(t);if((a=s.options_)!=null&&a.bound)o(function(){let u=this,c=u[r].bind(u);c.isMobxAction=!0,u[r]=c});return t}Oe(43,s.annotationType_,String(r),i)}function ZL(e,{annotationType_:t},n,{value:i}){}function Bk(e,t,n,i,r=U.safeDescriptors){var o,s,l,a,u,c,f;ZL(e,t,n,i);let{value:h}=i;if((o=t.options_)!=null&&o.bound){var d;h=h.bind((d=e.proxy_)!=null?d:e.target_)}return{value:Jo((s=(l=t.options_)==null?void 0:l.name)!=null?s:n.toString(),h,(a=(u=t.options_)==null?void 0:u.autoAction)!=null?a:!1,(c=t.options_)!=null&&c.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:r?e.isPlainObject_:!0,enumerable:!1,writable:r?!1:!0}}function Pk(e,t){return{annotationType_:e,options_:t,make_:ez,extend_:tz}}function ez(e,t,n,i){var r;if(i===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((r=this.options_)!=null&&r.bound&&(!Xo(e.target_,t)||!du(e.target_[t]))){if(this.extend_(e,t,n,!1)===null)return 0}if(du(n.value))return 1;let o=Vk(e,this,t,n,!1,!1);return ar(i,t,o),2}function tz(e,t,n,i){var r;let o=Vk(e,this,t,n,(r=this.options_)==null?void 0:r.bound);return e.defineProperty_(t,o,i)}function Ik(e,t,n){var i;let{name:r,addInitializer:o}=n;if(!du(t))t=Ah(t);if((i=e.options_)!=null&&i.bound)o(function(){let s=this,l=s[r].bind(s);l.isMobXFlow=!0,s[r]=l});return t}function nz(e,{annotationType_:t},n,{value:i}){}function Vk(e,t,n,i,r,o=U.safeDescriptors){nz(e,t,n,i);let{value:s}=i;if(!du(s))s=Ah(s);if(r){var l;s=s.bind((l=e.proxy_)!=null?l:e.target_),s.isMobXFlow=!0}return{value:s,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:o?!1:!0}}function Hk(e,t){return{annotationType_:e,options_:t,make_:iz,extend_:rz}}function iz(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function rz(e,t,n,i){return oz(e,this,t,n),e.defineComputedProperty_(t,xi({},this.options_,{get:n.get,set:n.set}),i)}function Uk(e,t,n){let i=e,{name:r,addInitializer:o}=n,s;function l(a,u){let c=xi({},i.options_,{get:t,context:a});return c.name||(c.name=`ObservableObject.${r.toString()}`),new ur(c)}return o(function(){var a;let u=bu(this)[ie],c=this,f=u.values_.get(r);if(f instanceof ur&&f.derivation!==t)u.values_.delete(r);((a=u.lazyComputedKeys_)!=null?a:u.lazyComputedKeys_=new Map).set(r,()=>l(c,u))}),function(){let a=this[ie],u=a.values_.get(r);if(u instanceof ur&&u.derivation!==t){var c;let h=(c=s)==null?void 0:c.get(this);if(!h){var f;h=l(this,a),((f=s)!=null?f:s=new WeakMap).set(this,h)}return h.get()}return a.getObservablePropValue_(r)}}function oz(e,{annotationType_:t},n,{get:i}){}function fv(e,t){return{annotationType_:e,options_:t,make_:sz,extend_:lz}}function sz(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function lz(e,t,n,i){var r,o;return az(e,this,t,n),e.defineObservableProperty_(t,n.value,(r=(o=this.options_)==null?void 0:o.enhancer_)!=null?r:Qo,i)}function jk(e,t,n){let i=e,{kind:r,name:o}=n;if(r!=="accessor")return;function s(l,a){var u;let c=bu(l)[ie];return((u=c.lazyObservableKeys_)!=null?u:c.lazyObservableKeys_=new Map).set(o,()=>{var f,h;return new to(a,(f=(h=i.options_)==null?void 0:h.enhancer_)!=null?f:Qo,`ObservableObject.${o.toString()}`,!1)}),c}return{get(){var l;return((l=this[ie])!=null?l:s(this,t.get.call(this))).getObservablePropValue_(o)},set(l){var a;return((a=this[ie])!=null?a:s(this,l)).setObservablePropValue_(o,l)},init(l){return s(this,l),l}}}function az(e,{annotationType_:t},n,i){}var uz="true",cz=Fk();function Fk(e){return{annotationType_:uz,options_:e,make_:fz,extend_:hz}}function fz(e,t,n,i){var r,o;if(n.get)return hv.make_(e,t,n,i);if(n.set){let c=yl(n.set)?n.set:Jo(t.toString(),n.set);if(i===e.target_)return e.defineProperty_(t,{configurable:U.safeDescriptors?e.isPlainObject_:!0,set:c})===null?0:2;return ar(i,t,{configurable:!0,set:c}),2}if(i!==e.target_&&typeof n.value==="function"){var s;if(Mk(n.value)){var l;return((l=this.options_)!=null&&l.autoBind?Yz:Ah).make_(e,t,n,i)}return((s=this.options_)!=null&&s.autoBind?jz:pv).make_(e,t,n,i)}let a=((r=this.options_)==null?void 0:r.deep)===!1?wl:vt;if(typeof n.value==="function"&&(o=this.options_)!=null&&o.autoBind){var u;n.value=n.value.bind((u=e.proxy_)!=null?u:e.target_)}return a.make_(e,t,n,i)}function hz(e,t,n,i){var r,o;if(n.get)return hv.extend_(e,t,n,i);if(n.set)return e.defineProperty_(t,{configurable:U.safeDescriptors?e.isPlainObject_:!0,set:Jo(t.toString(),n.set)},i);if(typeof n.value==="function"&&(r=this.options_)!=null&&r.autoBind){var s;n.value=n.value.bind((s=e.proxy_)!=null?s:e.target_)}return(((o=this.options_)==null?void 0:o.deep)===!1?wl:vt).extend_(e,t,n,i)}function Eh(e,t){return xi(function(i,r){if(r&&typeof r.kind==="string")return t(e,i,r);return},e)}var dz="observable",pz="observable.ref",mz="observable.shallow";var Kk={deep:!0,name:void 0,defaultDecorator:void 0};Object.freeze(Kk);function hh(e){return e||Kk}var qk=fv(dz),gz=fv(pz,{enhancer_:Sh}),vz=fv(mz,{enhancer_:XL});function $k(e){return Eh(e,jk)}function dh(e){return e.deep===!0?Qo:e.deep===!1?Sh:yz(e.defaultDecorator)}function bz(e){var t;return e?(t=e.defaultDecorator)!=null?t:Fk(e):void 0}function yz(e){var t,n;return!e?Qo:(t=(n=e.options_)==null?void 0:n.enhancer_)!=null?t:Qo}function xz(e,t,n){if(t&&typeof t.kind==="string")return jk(qk,e,t);if(gE(e))return e;if(cr(e))return vt.object(e,t,n);if(Array.isArray(e))return vt.array(e,t);if(mu(e))return vt.map(e,t);if(Zr(e))return vt.set(e,t);if(typeof e==="object"&&e!==null)return e;return vt.box(e,t)}var wz={box(e,t){let n=hh(t);return new to(e,dh(n),n.name,!0,n.equals)},array(e,t){let n=hh(t);return nB(e,dh(n),n.name)},map(e,t){let n=hh(t);return new gv(e,dh(n),n.name)},set(e,t){let n=hh(t);return new vv(e,dh(n),n.name)},object(e,t,n){return Cl(()=>hE(Jz({},n),e,t))}},wl=$k(gz),gu=$k(vz);var vt=xi(xz,qk,wz),Gk="computed";function Sz(e){return Eh(e,Uk)}var Wk=Hk(Gk);var hv=function(t,n){if(n&&typeof n.kind==="string")return Uk(Wk,t,n);if(cr(t))return Sz(Hk(Gk,t));let i=cr(n)?n:{};return i.get=t,i.name||(i.name=t.name||""),new ur(i)};xi(hv,Wk);var vk,bk,gh=0,kz=1,Ez=(vk=(bk=av(()=>{},"name"))==null?void 0:bk.configurable)!=null?vk:!1,yk={value:"action",configurable:!0,writable:!1,enumerable:!1};function Jo(e,t,n=!1,i){function r(){return Yk(e,n,t,i||this,arguments)}if(r.isMobxAction=!0,r.toString=()=>t.toString(),Ez)yk.value=e,ar(r,"name",yk);return r}function Yk(e,t,n,i,r){let o=Cz(e,t,i,r);try{return n.apply(i,r)}catch(s){throw o.error_=s,s}finally{Az(o)}}function Cz(e,t,n,i){let o=0,s=U.trackingDerivation,l=!t||!s;Rn();let a=U.allowStateChanges;if(l)Sl();let u=U.allowStateReads,c={runAsAction_:l,prevDerivation_:s,prevAllowStateChanges_:a,prevAllowStateReads_:u,notifySpy_:!1,startTime_:o,actionId_:kz++,parentActionId_:gh};return gh=c.actionId_,c}function Az(e){if(gh!==e.actionId_)Oe(30);if(gh=e.parentActionId_,e.error_!==void 0)U.suppressReactionErrors=!0;if(Nn(),e.runAsAction_)no(e.prevDerivation_);U.suppressReactionErrors=!1}function Oz(e,t){let n=Rz(e);try{return t()}finally{Nz(n)}}function Rz(e){let t=U.allowStateChanges;return U.allowStateChanges=e,t}function Nz(e){U.allowStateChanges=e}class to extends xl{constructor(e,t,n="ObservableValue",i=!0,r=cv){super(n);if(this.enhancer_=void 0,this.name_=void 0,this.equals_=void 0,this.hasUnreportedChange_=!1,this.interceptors_=void 0,this.changeListeners_=void 0,this.value_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,this.equals_=r,this.value_=t(e,void 0,n),!1)var o}dehanceValue(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}set(e){let t=this.value_;if(e=this.prepareNewValue_(e),e!==U.UNCHANGED)this.setNewValue_(e)}prepareNewValue_(e){if(yi(this),An(this)){let t=On(this,{object:this,type:io,newValue:e});if(!t)return U.UNCHANGED;e=t.newValue}return e=this.enhancer_(e,this.value_,this.name_),this.equals_(this.value_,e)?U.UNCHANGED:e}setNewValue_(e){let t=this.value_;if(this.value_=e,this.reportChanged(),qn(this))$n(this,{type:io,object:this,newValue:e,oldValue:t})}get(){return this.reportObserved(),this.dehanceValue(this.value_)}raw(){return this.value_}toJSON(){return this.get()}toString(){return`${this.name_}[${this.value_}]`}valueOf(){return Dk(this.get())}[Symbol.toPrimitive](){return this.valueOf()}}class ur{constructor(e){if(this.dependenciesState_=-1,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=0,this.unboundDepsCount_=0,this.value_=new hu(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,!e.get)Oe(31);if(this.derivation=e.get,this.name_=e.name||"ComputedValue",e.set)this.setter_=Jo("ComputedValue-setter",e.set);this.equals_=e.equals||cv,this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}onBecomeStale_(){Bz(this)}onBO(){if(this.onBOL)this.onBOL.forEach((e)=>e())}onBUO(){if(this.onBUOL)this.onBUOL.forEach((e)=>e())}get isComputing(){return on(this.flags_,1)}set isComputing(e){this.flags_=sn(this.flags_,1,e)}get isRunningSetter(){return on(this.flags_,2)}set isRunningSetter(e){this.flags_=sn(this.flags_,2,e)}get isBeingObserved(){return on(this.flags_,4)}set isBeingObserved(e){this.flags_=sn(this.flags_,4,e)}get isPendingUnobservation(){return on(this.flags_,8)}set isPendingUnobservation(e){this.flags_=sn(this.flags_,8,e)}get diffValue(){return on(this.flags_,16)?1:0}set diffValue(e){this.flags_=sn(this.flags_,16,e===1?!0:!1)}get(){if(this.isComputing)Oe(32,this.name_,this.derivation);if(U.inBatch===0&&this.observers_.size===0&&!this.keepAlive_){if(rv(this))this.warnAboutUntrackedRead_(),Rn(),this.value_=this.computeValue_(!1),Nn()}else if(nE(this),rv(this)){let t=U.trackingContext;if(this.keepAlive_&&!t)U.trackingContext=this;if(this.trackAndCompute())zz(this);U.trackingContext=t}let e=this.value_;if(ph(e))throw e.cause;return e}set(e){if(this.setter_){if(this.isRunningSetter)Oe(33,this.name_);this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else Oe(34,this.name_)}trackAndCompute(){let e=this.value_,t=this.dependenciesState_===-1,n=this.computeValue_(!0),i=t||ph(e)||ph(n)||!this.equals_(e,n);if(i)this.value_=n;return i}computeValue_(e){this.isComputing=!0;let t=!1,n;if(e)n=Xk(this,this.derivation,this.scope_);else if(U.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(i){n=new hu(i)}return this.isComputing=!1,n}suspend_(){if(!this.keepAlive_)ov(this),this.value_=void 0}warnAboutUntrackedRead_(){return}toString(){return`${this.name_}[${this.derivation.toString()}]`}valueOf(){return Dk(this.get())}[Symbol.toPrimitive](){return this.valueOf()}}var Ch=Zo("ComputedValue",ur);class hu{constructor(e){this.cause=void 0,this.cause=e}}function ph(e){return e instanceof hu}function rv(e){switch(e.dependenciesState_){case 0:return!1;case-1:case 2:return!0;case 1:{let n=Sl(),i=e.observing_,r=i.length;for(let o=0;o<r;o++){let s=i[o];if(Ch(s)){if(U.disableErrorBoundaries)s.get();else try{s.get()}catch(l){return no(n),!0}if(e.dependenciesState_===2)return no(n),!0}}return Jk(e),no(n),!1}}}function yi(e){return}function Tz(e){}function Xk(e,t,n){Jk(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++U.runId;let r=U.trackingDerivation;U.trackingDerivation=e,U.inBatch++;let o;if(U.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(s){o=new hu(s)}return U.inBatch--,U.trackingDerivation=r,_z(e),Mz(e),o}function Mz(e){return}function _z(e){let t=e.observing_,n=e.observing_=e.newObserving_,i=0,r=0,o=e.unboundDepsCount_;for(let s=0;s<o;s++){let l=n[s];if(l.diffValue===0){if(l.diffValue=1,r!==s)n[r]=l;r++}if(l.dependenciesState_>i)i=l.dependenciesState_}n.length=r,e.newObserving_=null,o=t.length;while(o--){let s=t[o];if(s.diffValue===0)eE(s,e);s.diffValue=0}while(r--){let s=n[r];if(s.diffValue===1)s.diffValue=0,Lz(s,e)}if(i!==0)e.dependenciesState_=i,e.onBecomeStale_()}function ov(e){let t=e.observing_;e.observing_=[];let n=t.length;while(n--)eE(t[n],e);e.dependenciesState_=-1}function Qk(e){let t=Sl();try{return e()}finally{no(t)}}function Sl(){let e=U.trackingDerivation;return U.trackingDerivation=null,e}function no(e){U.trackingDerivation=e}function Jk(e){if(e.dependenciesState_===0)return;e.dependenciesState_=0;let t=e.observing_,n=t.length;while(n--)t[n].lowestObserverState_=0}var Zk=7;class sv{constructor(){this.version=Zk,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.safeDescriptors=!0}}var ev=!0,Dz=!1,U=function(){let e=globalThis;if(e.__mobxInstanceCount>0&&!e.__mobxGlobals)ev=!1;if(e.__mobxGlobals&&e.__mobxGlobals.version!==Zk)ev=!1;if(!ev)return setTimeout(()=>{if(!Dz)Oe(35)},1),new sv;else if(e.__mobxGlobals){if(e.__mobxInstanceCount+=1,!e.__mobxGlobals.UNCHANGED)e.__mobxGlobals.UNCHANGED={};return e.__mobxGlobals}else return e.__mobxInstanceCount=1,e.__mobxGlobals=new sv}();function dv(){return U}function Lz(e,t){if(e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_)e.lowestObserverState_=t.dependenciesState_}function eE(e,t){if(e.observers_.delete(t),e.observers_.size===0)tE(e)}function tE(e){if(e.isPendingUnobservation===!1)e.isPendingUnobservation=!0,U.pendingUnobservations.push(e)}function Rn(){U.inBatch++}function Nn(){if(--U.inBatch===0){rE();let e=U.pendingUnobservations;for(let t=0;t<e.length;t++){let n=e[t];if(n.isPendingUnobservation=!1,n.observers_.size===0){if(n.isBeingObserved)n.isBeingObserved=!1,n.onBUO();if(n instanceof ur)n.suspend_()}}U.pendingUnobservations=[]}}function nE(e){Tz(e);let t=U.trackingDerivation;if(t!==null){if(t.runId_!==e.lastAccessedBy_){if(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&U.trackingContext)e.isBeingObserved=!0,e.onBO()}return e.isBeingObserved}else if(e.observers_.size===0&&U.inBatch>0)tE(e);return!1}function iE(e){if(e.lowestObserverState_===2)return;e.lowestObserverState_=2,e.observers_.forEach((t)=>{if(t.dependenciesState_===0)t.onBecomeStale_();t.dependenciesState_=2})}function zz(e){if(e.lowestObserverState_===2)return;e.lowestObserverState_=2,e.observers_.forEach((t)=>{if(t.dependenciesState_===1)t.dependenciesState_=2;else if(t.dependenciesState_===0)e.lowestObserverState_=0})}function Bz(e){if(e.lowestObserverState_!==0)return;e.lowestObserverState_=1,e.observers_.forEach((t)=>{if(t.dependenciesState_===0)t.dependenciesState_=1,t.onBecomeStale_()})}class vu{constructor(e="Reaction",t,n,i){this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=-1,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=i}get isDisposed(){return on(this.flags_,1)}set isDisposed(e){this.flags_=sn(this.flags_,1,e)}get isScheduled(){return on(this.flags_,2)}set isScheduled(e){this.flags_=sn(this.flags_,2,e)}get isTrackPending(){return on(this.flags_,4)}set isTrackPending(e){this.flags_=sn(this.flags_,4,e)}get isRunning(){return on(this.flags_,8)}set isRunning(e){this.flags_=sn(this.flags_,8,e)}get diffValue(){return on(this.flags_,16)?1:0}set diffValue(e){this.flags_=sn(this.flags_,16,e===1?!0:!1)}onBecomeStale_(){this.schedule_()}schedule_(){if(!this.isScheduled)this.isScheduled=!0,U.pendingReactions.push(this),rE()}runReaction_(){if(!this.isDisposed){Rn(),this.isScheduled=!1;let e=U.trackingContext;if(U.trackingContext=this,rv(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(t){this.reportExceptionInDerivation_(t)}}U.trackingContext=e,Nn()}}track(e){if(this.isDisposed)return;Rn();let t=!1,n;this.isRunning=!0;let i=U.trackingContext;U.trackingContext=this;let r=Xk(this,e,void 0);if(U.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed)ov(this);if(ph(r))this.reportExceptionInDerivation_(r.cause);Nn()}reportExceptionInDerivation_(e){if(this.errorHandler_){this.errorHandler_(e,this);return}if(U.disableErrorBoundaries)throw e;let t=`[mobx] uncaught error in '${this}'`;if(!U.suppressReactionErrors)console.error(t,e);U.globalReactionErrorHandlers.forEach((n)=>n(e,this))}dispose(){if(!this.isDisposed){if(this.isDisposed=!0,!this.isRunning)Rn(),ov(this),Nn()}}getDisposer_(e){let t=()=>{this.dispose(),e==null||e.removeEventListener==null||e.removeEventListener("abort",t)};if(e==null||e.addEventListener==null||e.addEventListener("abort",t),t[ie]=this,"dispose"in Symbol&&typeof Symbol.dispose==="symbol")t[Symbol.dispose]=t;return t}toString(){return`Reaction[${this.name_}]`}}var Pz=100,Iz=(e)=>e();function rE(){if(U.inBatch>0||U.isRunningReactions)return;Iz(Vz)}function Vz(){U.isRunningReactions=!0;let e=U.pendingReactions,t=0;while(e.length>0){if(++t===Pz)console.error(`[mobx] cycle in reaction: ${e[0]}`),e.splice(0);let n=e.splice(0);for(let i=0,r=n.length;i<r;i++)n[i].runReaction_()}U.isRunningReactions=!1}var vh=Zo("Reaction",vu);var oE="action";var sE="autoAction",Hz="autoAction.bound",lE="<unnamed action>",aE=kh(oE);var uE=kh(sE,{autoAction:!0}),Uz=kh(Hz,{autoAction:!0,bound:!0});function cE(e){return Eh(e,zk)}function fE(e){return function(i,r){if(r&&typeof r.kind==="string")return zk(e?uE:aE,i,r);if(bl(i))return Jo(i.name||lE,i,e);if(bl(r))return Jo(i,r,e);if(iv(i))return cE(kh(e?sE:oE,{name:i,autoAction:e}))}}var vl=fE(!1);xi(vl,aE);var pv=fE(!0);xi(pv,uE);var jz=cE(Uz);function M(e){return Yk(e.name||lE,!1,e,this,void 0)}function yl(e){return bl(e)&&e.isMobxAction===!0}var Fz=(e)=>e();function Kz(e){return e.scheduler?e.scheduler:e.delay?(t)=>setTimeout(t,e.delay):Fz}function kl(e,t,n=Tk){var i,r;let o=(i=n.name)!=null?i:"Reaction",s=vl(o,n.onError?qz(n.onError,t):t),l=!n.scheduler&&!n.delay,a=Kz(n),u=!0,c=!1,f,h=n.equals||cv,d=new vu(o,()=>{if(u||l)m();else if(!c)c=!0,a(m)},n.onError,n.requiresObservable);function m(){if(c=!1,d.isDisposed)return;let b=!1,x=f;if(d.track(()=>{let g=Oz(!1,()=>e(d));b=u||!h(f,g),f=g}),u&&n.fireImmediately)s(f,x,d);else if(!u&&b)s(f,x,d);u=!1}if(!(n!=null&&(r=n.signal)!=null&&r.aborted))d.schedule_();return d.getDisposer_(n==null?void 0:n.signal)}function qz(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}function hE(e,t,n,i){let r=YL(t);return Cl(()=>{let o=bu(e,i)[ie];mh(r).forEach((s)=>{o.extend_(s,r[s],!n?!0:(s in n)?n[s]:!0)})}),e}function dE(e,t){return pE(yh(e,t))}function pE(e){let t={name:e.name_};if(e.observing_&&e.observing_.length>0)t.dependencies=$z(e.observing_).map(pE);return t}function $z(e){return Array.from(new Set(e))}class mE extends Error{constructor(){super("FLOW_CANCELLED");Object.setPrototypeOf(this,new.target.prototype),this.name="FlowCancellationError"}toString(){return`Error: ${this.message}`}}function Gz(e){return Eh(e,Ik)}var xk=Pk("flow"),Wz=Pk("flow.bound",{bound:!0}),Ah=xi(function(t,n){if(n&&typeof n.kind==="string")return Ik(xk,t,n);let i=t,r=i.name||"flow",o=function(){let l=this,a=arguments,u=0,c=vl(r,i).apply(l,a),f,h=void 0,d=new Promise(function(b,x){let g=0;f=x;function v(k){h=void 0;let A;try{A=vl(r,c.next).call(c,k)}catch(E){return x(E)}S(A)}function y(k){h=void 0;let A;try{A=vl(r,c.throw).call(c,k)}catch(E){return x(E)}S(A)}function S(k){if(bl(k==null?void 0:k.then)){k.then(S,x);return}if(k.done)return b(k.value);return h=Promise.resolve(k.value),h.then(v,y)}v(void 0)}),m=r;return d.cancel=vl(m,function(){try{if(h)wk(h);let b=c.return(void 0),x=Promise.resolve(b.value);x.then(gl,gl),wk(x),f(new mE)}catch(b){f(b)}}),d};return o.isMobXFlow=!0,o},xk),Yz=Gz(Wz);function wk(e){if(bl(e.cancel))e.cancel()}function du(e){return(e==null?void 0:e.isMobXFlow)===!0}function Xz(e,t){if(!e)return!1;if(t!==void 0){if(pu(e)){var n,i;let r=e[ie];return r.values_.has(t)||!!((n=r.lazyComputedKeys_)!=null&&n.has(t))||!!((i=r.lazyObservableKeys_)!=null&&i.has(t))}return!1}return pu(e)||!!e[ie]||uv(e)||vh(e)||Ch(e)}function gE(e){return Xz(e)}function sr(e,t=void 0){Rn();try{return e.apply(t)}finally{Nn()}}function ml(e){return e[ie]}var Qz={has(e,t){return ml(e).has_(t)},get(e,t){return ml(e).get_(t)},set(e,t,n){var i;if(!iv(t))return!1;return(i=ml(e).set_(t,n,!0))!=null?i:!0},deleteProperty(e,t){var n;if(!iv(t))return!1;return(n=ml(e).delete_(t,!0))!=null?n:!0},defineProperty(e,t,n){var i;return(i=ml(e).defineProperty_(t,n))!=null?i:!0},ownKeys(e){return ml(e).ownKeys_()},preventExtensions(e){Oe(13)}};function Jz(e,t){var n,i;return e=bu(e,t),(i=(n=e[ie]).proxy_)!=null?i:n.proxy_=new Proxy(e,Qz)}function An(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function On(e,t){let n=Sl();try{let i=[...e.interceptors_||[]];for(let r=0,o=i.length;r<o;r++){if(t=i[r](t),t&&!t.type)Oe(14);if(!t)break}return t}finally{no(n)}}function qn(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function $n(e,t){let n=Sl(),i=e.changeListeners_;if(!i)return;i=i.slice();for(let r=0,o=i.length;r<o;r++)i[r](t);no(n)}var tv=Symbol("mobx-keys");function Gn(e,t,n){if(cr(e))return hE(e,e,t,n);return Cl(()=>{let i=bu(e,n)[ie];if(!e[tv]){let r=Object.getPrototypeOf(e),o=new Set([...mh(e),...mh(r)]);o.delete("constructor"),o.delete(ie),_k(r,tv,o)}e[tv].forEach((r)=>Zz(i,r,!t?!0:(r in t)?t[r]:!0))}),e}function Zz(e,t,n){if(n===!0)n=e.defaultAnnotation_;if(n===!1)return;if(xE(e,n,t),!(t in e.target_))Oe(1,n.annotationType_,`${e.name_}.${t.toString()}`);let i=e.target_;while(i&&i!==xh){let r=av(i,t);if(r){let o=n.make_(e,t,r,i);if(o===0)return;if(o===1)break}i=Object.getPrototypeOf(i)}yE(e,n,t)}var Sk="splice",io="update",eB=1e4,tB={get(e,t){let n=e[ie];if(t===ie)return n;if(t==="length")return n.getArrayLength_();if(typeof t==="string"&&!isNaN(t))return n.get_(parseInt(t));if(Xo(lv,t))return lv[t];return e[t]},set(e,t,n){let i=e[ie];if(t==="length")i.setArrayLength_(n);if(typeof t==="symbol"||isNaN(t))e[t]=n;else i.set_(parseInt(t),n);return!0},preventExtensions(){Oe(15)}};class mv{constructor(e="ObservableArray",t,n){this.owned_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.atom_=new xl(e),this.enhancer_=(i,r)=>t(i,r,"ObservableArray[..]")}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}dehanceValues_(e){if(this.dehancer!==void 0&&e.length>0)return e.map(this.dehancer);return e}getArrayLength_(){return this.atom_.reportObserved(),this.values_.length}setArrayLength_(e){if(typeof e!=="number"||isNaN(e)||e<0)Oe(40,e);let t=this.values_.length;if(e===t)return;else if(e>t){let n=Array.from({length:e-t});this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)}updateArrayLength_(e,t){if(e!==this.lastKnownLength_)Oe(16);this.lastKnownLength_+=t}spliceWithArray_(e,t,n){yi(this.atom_);let i=this.values_.length;if(e===void 0)e=0;else if(e>i)e=i;else if(e<0)e=Math.max(0,i+e);if(arguments.length===1)t=i-e;else if(t===void 0||t===null)t=0;else t=Math.max(0,Math.min(t,i-e));if(n===void 0)n=nv;if(An(this)){let o=On(this,{object:this.proxy_,type:Sk,index:e,removedCount:t,added:n});if(!o)return nv;t=o.removedCount,n=o.added}n=n.length===0?n:n.map((o)=>this.enhancer_(o,void 0));let r=this.spliceItemsIntoValues_(e,t,n);if(t!==0||n.length!==0)this.notifyArraySplice_(e,n,r);return this.dehanceValues_(r)}spliceItemsIntoValues_(e,t,n){if(n.length<eB)return this.values_.splice(e,t,...n);else{let i=this.values_.slice(e,e+t),r=this.values_.slice(e+t);this.values_.length+=n.length-t;for(let o=0;o<n.length;o++)this.values_[e+o]=n[o];for(let o=0;o<r.length;o++)this.values_[e+n.length+o]=r[o];return i}}notifyArrayChildUpdate_(e,t,n){let r=qn(this),o=r?{observableKind:"array",object:this.proxy_,type:io,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;if(this.atom_.reportChanged(),r)$n(this,o)}notifyArraySplice_(e,t,n){let r=qn(this),o=r?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Sk,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;if(this.atom_.reportChanged(),r)$n(this,o)}get_(e){return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])}set_(e,t){let n=this.values_;if(e<n.length){yi(this.atom_);let i=n[e];if(An(this)){let o=On(this,{type:io,object:this.proxy_,index:e,newValue:t});if(!o)return;t=o.newValue}if(t=this.enhancer_(t,i),t!==i)n[e]=t,this.notifyArrayChildUpdate_(e,t,i)}else{let i=Array.from({length:e+1-n.length});i[i.length-1]=t,this.spliceWithArray_(n.length,0,i)}}}function nB(e,t,n="ObservableArray",i=!1){return Cl(()=>{let r=new mv(n,t,i);$L(r.values_,ie,r);let o=new Proxy(r.values_,tB);if(r.proxy_=o,e&&e.length)r.spliceWithArray_(0,0,e);return o})}var lv={clear(){return this.splice(0)},replace(e){let t=this[ie];return t.spliceWithArray_(0,t.values_.length,e)},toJSON(){return this.slice()},splice(e,t,...n){let i=this[ie];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray_(e);case 2:return i.spliceWithArray_(e,t)}return i.spliceWithArray_(e,t,n)},spliceWithArray(e,t,n){return this[ie].spliceWithArray_(e,t,n)},push(...e){let t=this[ie];return t.spliceWithArray_(t.values_.length,0,e),t.values_.length},pop(){return this.splice(Math.max(this[ie].values_.length-1,0),1)[0]},shift(){return this.splice(0,1)[0]},unshift(...e){let t=this[ie];return t.spliceWithArray_(0,0,e),t.values_.length},reverse(){if(U.trackingDerivation)Oe(37,"reverse");return this.replace(this.slice().reverse()),this},sort(){if(U.trackingDerivation)Oe(37,"sort");let e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove(e){let t=this[ie],n=t.dehanceValues_(t.values_).indexOf(e);if(n>-1)return this.splice(n,1),!0;return!1}};Re("at",ln);Re("concat",ln);Re("flat",ln);Re("includes",ln);Re("indexOf",ln);Re("join",ln);Re("lastIndexOf",ln);Re("slice",ln);Re("toString",ln);Re("toLocaleString",ln);Re("toSorted",ln);Re("toSpliced",ln);Re("with",ln);Re("every",Wn);Re("filter",Wn);Re("find",Wn);Re("findIndex",Wn);Re("findLast",Wn);Re("findLastIndex",Wn);Re("flatMap",Wn);Re("forEach",Wn);Re("map",Wn);Re("some",Wn);Re("toReversed",Wn);Re("reduce",vE);Re("reduceRight",vE);function Re(e,t){if(typeof Array.prototype[e]==="function")lv[e]=t(e)}function ln(e){return function(){let t=this[ie];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Wn(e){return function(t,n){let i=this[ie];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e]((o,s)=>t.call(n,o,s,this))}}function vE(e){return function(){let t=this[ie];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_),i=arguments[0];return arguments[0]=(r,o,s)=>i(r,o,s,this),n[e].apply(n,arguments)}}var iB=Zo("ObservableArrayAdministration",mv);function bE(e){return wh(e)&&iB(e[ie])}var rB={},eo="add",bh="delete";class gv{constructor(e,t=Qo,n="ObservableMap"){this.enhancer_=void 0,this.name_=void 0,this[ie]=rB,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,Cl(()=>{if(this.keysAtom_=Lk("ObservableMap.keys()"),this.data_=new Map,this.hasMap_=new Map,e)this.merge(e)})}has_(e){return this.data_.has(e)}has(e){if(!U.trackingDerivation)return this.has_(e);let t=this.hasMap_.get(e);if(!t){let n=t=new to(this.has_(e),Sh,"ObservableMap.key?",!1);this.hasMap_.set(e,n),n.onBUOL=new Set([()=>this.hasMap_.delete(e)])}return t.get()}set(e,t){let n=this.has_(e);if(An(this)){let i=On(this,{type:n?io:eo,object:this,newValue:t,name:e});if(!i)return this;t=i.newValue}if(n)this.updateValue_(e,t);else this.addValue_(e,t);return this}delete(e){if(yi(this.keysAtom_),An(this)){if(!On(this,{type:bh,object:this,name:e}))return!1}if(this.has_(e)){let n=qn(this),i=n?{observableKind:"map",debugObjectName:this.name_,type:bh,object:this,oldValue:this.data_.get(e).value_,name:e}:null;if(sr(()=>{var r;this.keysAtom_.reportChanged(),(r=this.hasMap_.get(e))==null||r.setNewValue_(!1),this.data_.get(e).setNewValue_(void 0),this.data_.delete(e)}),n)$n(this,i);return!0}return!1}updateValue_(e,t){let n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==U.UNCHANGED){let r=qn(this),o=r?{observableKind:"map",debugObjectName:this.name_,type:io,object:this,oldValue:n.value_,name:e,newValue:t}:null;if(n.setNewValue_(t),r)$n(this,o)}}addValue_(e,t){yi(this.keysAtom_),sr(()=>{var o;let s=new to(t,this.enhancer_,"ObservableMap.key",!1);this.data_.set(e,s),t=s.value_,(o=this.hasMap_.get(e))==null||o.setNewValue_(!0),this.keysAtom_.reportChanged()});let n=!1,i=qn(this),r=i||n?{observableKind:"map",debugObjectName:this.name_,type:eo,object:this,name:e,newValue:t}:null;if(i)$n(this,r)}get(e){if(this.has(e))return this.dehanceValue_(this.data_.get(e).get());return this.dehanceValue_(void 0)}getOrInsert(e,t){if(!this.has(e))this.set(e,t);return this.get(e)}getOrInsertComputed(e,t){if(!this.has(e))this.set(e,t(e));return this.get(e)}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}keys(){return this.keysAtom_.reportObserved(),this.data_.keys()}values(){let e=this,t=this.keys();return kk({next(){let{done:n,value:i}=t.next();return{done:n,value:n?void 0:e.get(i)}}})}entries(){let e=this,t=this.keys();return kk({next(){let{done:n,value:i}=t.next();return{done:n,value:n?void 0:[i,e.get(i)]}}})}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[n,i]of this)e.call(t,i,n,this)}merge(e){if(El(e))e=new Map(e);return sr(()=>{if(cr(e))WL(e).forEach((t)=>this.set(t,e[t]));else if(Array.isArray(e))e.forEach(([t,n])=>this.set(t,n));else if(mu(e)){if(!GL(e))Oe(19,e);e.forEach((t,n)=>this.set(n,t))}else if(e!==null&&e!==void 0)Oe(20,e)}),this}clear(){sr(()=>{Qk(()=>{for(let e of this.keys())this.delete(e)})})}replace(e){return sr(()=>{let t=oB(e),n=new Map,i=!1;for(let r of this.data_.keys())if(!t.has(r))if(this.delete(r))i=!0;else{let s=this.data_.get(r);n.set(r,s)}for(let[r,o]of t.entries()){let s=this.data_.has(r);if(this.set(r,o),this.data_.has(r)){let l=this.data_.get(r);if(n.set(r,l),!s)i=!0}}if(!i)if(this.data_.size!==n.size)this.keysAtom_.reportChanged();else{let r=this.data_.keys(),o=n.keys(),s=r.next(),l=o.next();while(!s.done){if(s.value!==l.value){this.keysAtom_.reportChanged();break}s=r.next(),l=o.next()}}this.data_=n}),this}get size(){return this.keysAtom_.reportObserved(),this.data_.size}toString(){return"[object ObservableMap]"}toJSON(){return Array.from(this)}get[Symbol.toStringTag](){return"Map"}}var El=Zo("ObservableMap",gv);function kk(e){return e[Symbol.toStringTag]="MapIterator",SE(e)}function oB(e){if(mu(e)||El(e))return e;else if(Array.isArray(e))return new Map(e);else if(cr(e)){let t=new Map;for(let n in e)t.set(n,e[n]);return t}else return Oe(21,e)}var sB={};class vv{constructor(e,t=Qo,n="ObservableSet"){this.name_=void 0,this[ie]=sB,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=n,this.enhancer_=(i,r)=>t(i,r,n),Cl(()=>{if(this.atom_=Lk(this.name_),e)this.replace(e)})}dehanceValue_(e){if(this.dehancer!==void 0)return this.dehancer(e);return e}clear(){sr(()=>{Qk(()=>{for(let e of this.data_.values())this.delete(e)})})}forEach(e,t){for(let n of this)e.call(t,n,n,this)}get size(){return this.atom_.reportObserved(),this.data_.size}add(e){if(yi(this.atom_),An(this)){let t=On(this,{type:eo,object:this,newValue:e});if(!t)return this;e=t.newValue}if(!this.has(e)){sr(()=>{this.data_.add(this.enhancer_(e,void 0)),this.atom_.reportChanged()});let t=!1,n=qn(this),i=n||t?{observableKind:"set",debugObjectName:this.name_,type:eo,object:this,newValue:e}:null;if(n)$n(this,i)}return this}delete(e){if(An(this)){if(!On(this,{type:bh,object:this,oldValue:e}))return!1}if(this.has(e)){let n=qn(this),i=n?{observableKind:"set",debugObjectName:this.name_,type:bh,object:this,oldValue:e}:null;if(sr(()=>{this.atom_.reportChanged(),this.data_.delete(e)}),n)$n(this,i);return!0}return!1}has(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))}entries(){let e=this.values();return Ek({next(){let{value:t,done:n}=e.next();return!n?{value:[t,t],done:n}:{value:void 0,done:n}}})}keys(){return this.values()}values(){this.atom_.reportObserved();let e=this,t=this.data_.values();return Ek({next(){let{value:n,done:i}=t.next();return!i?{value:e.dehanceValue_(n),done:i}:{value:void 0,done:i}}})}intersection(e){if(Zr(e)&&!lr(e))return e.intersection(this);else return new Set(this).intersection(e)}union(e){if(Zr(e)&&!lr(e))return e.union(this);else return new Set(this).union(e)}difference(e){return new Set(this).difference(e)}symmetricDifference(e){if(Zr(e)&&!lr(e))return e.symmetricDifference(this);else return new Set(this).symmetricDifference(e)}isSubsetOf(e){return new Set(this).isSubsetOf(e)}isSupersetOf(e){return new Set(this).isSupersetOf(e)}isDisjointFrom(e){if(Zr(e)&&!lr(e))return e.isDisjointFrom(this);else return new Set(this).isDisjointFrom(e)}replace(e){if(lr(e))e=new Set(e);return sr(()=>{if(Array.isArray(e))this.clear(),e.forEach((t)=>this.add(t));else if(Zr(e))this.clear(),e.forEach((t)=>this.add(t));else if(e!==null&&e!==void 0)Oe(41,e)}),this}toJSON(){return Array.from(this)}toString(){return"[object ObservableSet]"}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return"Set"}}var lr=Zo("ObservableSet",vv);function Ek(e){return e[Symbol.toStringTag]="SetIterator",SE(e)}var Ck=Object.create(null),Ak="remove";class bv{constructor(e,t=new Map,n,i=cz){this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=n,this.defaultAnnotation_=i,this.keysAtom_=new xl("ObservableObject.keys"),this.isPlainObject_=cr(this.target_)}getObservablePropValue_(e){var t,n;return((t=(n=this.values_.get(e))!=null?n:this.materializeLazyComputed_(e))!=null?t:this.materializeLazyObservable_(e)).get()}materializeLazyComputed_(e){var t;let n=(t=this.lazyComputedKeys_)==null?void 0:t.get(e);if(!n)return;if(this.lazyComputedKeys_.delete(e),this.lazyComputedKeys_.size===0)this.lazyComputedKeys_=void 0;let i=n();return this.values_.set(e,i),i}materializeLazyObservable_(e){var t;let n=(t=this.lazyObservableKeys_)==null?void 0:t.get(e);if(!n)return;if(this.lazyObservableKeys_.delete(e),this.lazyObservableKeys_.size===0)this.lazyObservableKeys_=void 0;let i=n();return this.values_.set(e,i),i}setObservablePropValue_(e,t){var n,i;let r=(n=(i=this.values_.get(e))!=null?i:this.materializeLazyComputed_(e))!=null?n:this.materializeLazyObservable_(e);if(r instanceof ur)return r.set(t),!0;if(An(this)){let o=On(this,{type:io,object:this.proxy_||this.target_,name:e,newValue:t});if(!o)return null;t=o.newValue}if(t=r.prepareNewValue_(t),t!==U.UNCHANGED){let o=qn(this),s=!1,l=o?{type:io,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:r.value_,name:e,newValue:t}:null;if(r.setNewValue_(t),o)$n(this,l)}return!0}get_(e){if(U.trackingDerivation&&!Xo(this.target_,e))this.has_(e);return this.target_[e]}set_(e,t,n=!1){if(Xo(this.target_,e))if(this.values_.has(e))return this.setObservablePropValue_(e,t);else if(n)return Reflect.set(this.target_,e,t);else return this.target_[e]=t,!0;else return this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)}has_(e){if(!U.trackingDerivation)return e in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);let t=this.pendingKeys_.get(e);if(!t)t=new to(e in this.target_,Sh,"ObservableObject.key?",!1),this.pendingKeys_.set(e,t);return t.get()}extend_(e,t,n,i=!1){if(n===!0)n=this.defaultAnnotation_;if(n===!1)return this.defineProperty_(e,t,i);xE(this,n,e);let r=n.extend_(this,e,t,i);if(r)yE(this,n,e);return r}defineProperty_(e,t,n=!1){yi(this.keysAtom_);try{Rn();let i=this.delete_(e);if(!i)return i;if(An(this)){let r=On(this,{object:this.proxy_||this.target_,name:e,type:eo,newValue:t.value});if(!r)return null;let{newValue:o}=r;if(t.value!==o)t=xi({},t,{value:o})}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else ar(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Nn()}return!0}defineObservableProperty_(e,t,n,i=!1){yi(this.keysAtom_);try{Rn();let r=this.delete_(e);if(!r)return r;if(An(this)){let a=On(this,{object:this.proxy_||this.target_,name:e,type:eo,newValue:t});if(!a)return null;t=a.newValue}let o=Ok(e),s={configurable:U.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:o.get,set:o.set};if(i){if(!Reflect.defineProperty(this.target_,e,s))return!1}else ar(this.target_,e,s);let l=new to(t,n,"ObservableObject.key",!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Nn()}return!0}defineComputedProperty_(e,t,n=!1){yi(this.keysAtom_);try{Rn();let i=this.delete_(e);if(!i)return i;if(An(this)){if(!On(this,{object:this.proxy_||this.target_,name:e,type:eo,newValue:void 0}))return null}t.name||(t.name="ObservableObject.key"),t.context=this.proxy_||this.target_;let r=Ok(e),o={configurable:U.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:r.get,set:r.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else ar(this.target_,e,o);this.values_.set(e,new ur(t)),this.notifyPropertyAddition_(e,void 0)}finally{Nn()}return!0}delete_(e,t=!1){if(yi(this.keysAtom_),!Xo(this.target_,e))return!0;if(An(this)){if(!On(this,{object:this.proxy_||this.target_,name:e,type:Ak}))return null}try{var n;Rn();let r=qn(this),o=!1,s=this.values_.get(e),l=void 0;if(!s&&(r||o)){var i;l=(i=av(this.target_,e))==null?void 0:i.value}if(t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(s){if(this.values_.delete(e),s instanceof to)l=s.value_;iE(s)}if(this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r||o){let a={type:Ak,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:e};if(r)$n(this,a)}}finally{Nn()}return!0}notifyPropertyAddition_(e,t){var n;let i=qn(this),r=!1;if(i){let o=i?{type:eo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;if(i)$n(this,o)}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()}ownKeys_(){return this.keysAtom_.reportObserved(),mh(this.target_)}keys_(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)}}function bu(e,t){var n;if(Xo(e,ie))return e;let i=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",r=new bv(e,new Map,String(i),bz(t));return _k(e,ie,r),e}var lB=Zo("ObservableObjectAdministration",bv);function Ok(e){return Ck[e]||(Ck[e]={get(){return this[ie].getObservablePropValue_(e)},set(t){return this[ie].setObservablePropValue_(e,t)}})}function pu(e){if(wh(e))return lB(e[ie]);return!1}function yE(e,t,n){}function xE(e,t,n){}function yh(e,t){if(typeof e==="object"&&e!==null){if(bE(e)){if(t!==void 0)Oe(23);return e[ie].atom_}if(lr(e))return e.atom_;if(El(e)){if(t===void 0)return e.keysAtom_;let r=e.data_.get(t)||e.hasMap_.get(t);if(!r)Oe(25,t,Rk(e));return r}if(pu(e)){var n,i;if(!t)return Oe(26);let r=e[ie],o=(n=(i=r.values_.get(t))!=null?i:r.materializeLazyComputed_(t))!=null?n:r.materializeLazyObservable_(t);if(!o)Oe(27,t,Rk(e));return o}if(uv(e)||Ch(e)||vh(e))return e}else if(bl(e)){if(vh(e[ie]))return e[ie]}Oe(28)}function wE(e,t){if(!e)Oe(29);if(t!==void 0)return wE(yh(e,t));if(uv(e)||Ch(e)||vh(e))return e;if(El(e)||lr(e))return e;if(e[ie])return e[ie];Oe(24,e)}function Rk(e,t){let n;if(t!==void 0)n=yh(e,t);else if(yl(e))return e.name;else if(pu(e)||El(e)||lr(e))n=wE(e);else n=yh(e);return n.name_}function Cl(e){let t=Sl(),n=!0;Rn();try{return e()}finally{Nn(),no(t)}}var eV=xh.toString;var Nk,aB=((Nk=globalThis.Iterator)==null?void 0:Nk.prototype)||{};function SE(e){return e[Symbol.iterator]=uB,xi(Object.create(aB),e)}function uB(){return this}var kE;if(!Q||!Or)throw Error("mobx-react-lite requires React 18 or later");if(!((dv==null||(kE=dv())==null?void 0:kE.version)>=7))throw Error("mobx-react-lite requires mobx at least version 7 to be available");var cB=1e4,fB=1e4;class TE{constructor(e){this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=(t=cB)=>{clearTimeout(this.sweepTimeout),this.sweepTimeout=void 0;let n=Date.now();if(this.registrations.forEach((i,r)=>{if(n-i.registeredAt>=t)this.finalize(i.value),this.registrations.delete(r)}),this.registrations.size>0)this.scheduleSweep()},this.finalizeAllImmediately=()=>{this.sweep(0)},this.finalize=e}register(e,t,n){this.registrations.set(n,{value:t,registeredAt:Date.now()}),this.scheduleSweep()}unregister(e){this.registrations.delete(e)}scheduleSweep(){if(this.sweepTimeout===void 0)this.sweepTimeout=setTimeout(this.sweep,fB)}}var hB=typeof FinalizationRegistry<"u"?FinalizationRegistry:TE,yv=new hB((e)=>{var t;(t=e.reaction)==null||t.dispose(),e.reaction=null}),dB=!1;function ME(){return dB}function EE(e){e.reaction=new vu(`observer${e.name}`,()=>{e.stateVersion=Symbol(),e.onStoreChange==null||e.onStoreChange()})}function _E(e,t="observed"){if(ME())return e();let n=q(null);if(!n.current){let s={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe(l){if(yv.unregister(s),s.onStoreChange=l,!s.reaction)EE(s),s.stateVersion=Symbol();return()=>{var a;s.onStoreChange=null,(a=s.reaction)==null||a.dispose(),s.reaction=null}},getSnapshot(){return s.stateVersion}};n.current=s}let i=n.current;if(!i.reaction)EE(i),yv.register(n,i,i);kp(i.reaction,dE),Or(i.subscribe,i.getSnapshot,i.getSnapshot);let r,o;if(i.reaction.track(()=>{try{r=e()}catch(s){o=s}}),o)throw o;return r}var CE,AE,DE=typeof Symbol==="function"&&Symbol.for,pB=(CE=(AE=Object.getOwnPropertyDescriptor(()=>{},"name"))==null?void 0:AE.configurable)!=null?CE:!1,OE=DE?Symbol.for("react.forward_ref"):typeof Cr==="function"&&Cr((e)=>null).$$typeof,RE=DE?Symbol.for("react.memo"):typeof Os==="function"&&Os((e)=>null).$$typeof;function X(e){if(RE&&e.$$typeof===RE)throw Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(ME())return e;let t=!1,n=e,i=e.displayName||e.name;if(OE&&e.$$typeof===OE){if(t=!0,n=e.render,typeof n!=="function")throw Error("[mobx-react-lite] `render` property of ForwardRef was not a function")}let r=(o,s)=>_E(()=>n(o,s),i);if(r.displayName=e.displayName,pB)Object.defineProperty(r,"name",{value:e.name,writable:!0,configurable:!0});if(t)r=Cr(r);return r=Os(r),gB(e,r),r}var mB={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function gB(e,t){Object.keys(e).forEach((n)=>{if(!mB[n])Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}function vB({children:e,render:t}){if(e&&t)console.error("MobX Observer: Do not use children and render in the same time in `Observer`");let n=e||t;if(typeof n!=="function")return null;return _E(n)}vB.displayName="Observer";function ro(e,t){return Q(()=>vt(e(),t,{autoBind:!0}))[0]}var NE,rV=(NE=yv.finalizeAllImmediately)!=null?NE:()=>{};var bB=Symbol.for("react.transitional.element"),yB=Symbol.for("react.fragment");function LE(e,t,n){var i=null;if(n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:bB,type:e,key:i,ref:t!==void 0?t:null,props:n}}var oe=yB,p=LE,w=LE;function xB(e,t){let n=getComputedStyle(e),i=parseFloat(n.fontSize);return t*i}function wB(e,t){let n=getComputedStyle(e.ownerDocument.documentElement),i=parseFloat(n.fontSize);return t*i}function SB(e){return e/100*window.innerHeight}function kB(e){return e/100*window.innerWidth}function EB(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function Ol({groupSize:e,panelElement:t,styleProp:n}){let i,[r,o]=EB(n);switch(o){case"%":{i=r/100*e;break}case"px":{i=r;break}case"rem":{i=wB(t,r);break}case"em":{i=xB(t,r);break}case"vh":{i=SB(r);break}case"vw":{i=kB(r);break}}return i}function kt(e){return parseFloat(e.toFixed(3))}function Nl({group:e}){let{orientation:t,panels:n}=e;return n.reduce((i,r)=>(i+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,i),0)}function wv(e){let{panels:t}=e,n=Nl({group:e});return n===0?t.map((i)=>({groupResizeBehavior:i.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:i.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:i.panelConstraints.disabled,minSize:0,maxSize:100,panelId:i.id})):t.map((i)=>{let{element:r,panelConstraints:o}=i,s=0;if(o.collapsedSize!==void 0){let f=Ol({groupSize:n,panelElement:r,styleProp:o.collapsedSize});s=kt(f/n*100)}let l;if(o.collapsedThreshold!==void 0){let f=Ol({groupSize:n,panelElement:r,styleProp:o.collapsedThreshold});l=kt(f/n*100)}let a;if(o.defaultSize!==void 0){let f=Ol({groupSize:n,panelElement:r,styleProp:o.defaultSize});a=kt(f/n*100)}let u=0;if(o.minSize!==void 0){let f=Ol({groupSize:n,panelElement:r,styleProp:o.minSize});u=kt(f/n*100)}let c=100;if(o.maxSize!==void 0){let f=Ol({groupSize:n,panelElement:r,styleProp:o.maxSize});c=kt(f/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:s,collapsedThreshold:l,collapsible:o.collapsible===!0,defaultSize:a,disabled:o.disabled,minSize:u,maxSize:c,panelId:i.id}})}class Ev{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let i=!1,r=null,o=Array.from(n);for(let s=0;s<o.length;s++){let l=o[s];try{l.call(null,t)}catch(a){r===null&&(i=!0,r=a)}}if(i)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let i=n.indexOf(t);i>=0&&n.splice(i,1)}}}var $e={cursorFlags:0,state:"inactive"},Cv=new Ev;function fr(){return $e}function QE(e){return Cv.addListener("change",e)}function CB(e,t=[],n,i=!1){let r=$e,o={...$e};o.cursorFlags=e,o.state==="active"&&(o.didPointerMove||=i,o.previews=t,n&&(o.previewLayoutMap=n)),$e=o,Cv.emit("change",{prev:r,next:o})}function ki(e){let t=$e;$e=e,t.state==="active"&&e.state!=="active"&&t.didPointerMove&&t.hitRegions.forEach(({separator:n})=>{n&&n.element.ownerDocument.activeElement===n.element&&n.element.blur()}),Cv.emit("change",{prev:t,next:e})}function AB(e){$e.state!=="active"||!$e.previews.some((t)=>t.separator===e)||ki({...$e,previews:$e.previews.map((t)=>t.separator===e?{...t}:t)})}function OB(e){if($e.state==="inactive")return!1;let t=$e.hitRegions.filter((i)=>i.group!==e),n=$e.state==="active"&&$e.previews.some((i)=>i.group===e);if(t.length===$e.hitRegions.length&&!n)return!1;if(t.length===0)ki({cursorFlags:0,state:"inactive"});else if($e.state==="active"){let i=new Map($e.initialLayoutMap),r=new Map($e.previewLayoutMap);i.delete(e),r.delete(e),ki({...$e,cursorFlags:0,hitRegions:t,initialLayoutMap:i,previewLayoutMap:r,previews:$e.previews.filter((o)=>o.group!==e)})}else ki({...$e,hitRegions:t});return!0}var RB=(e)=>e,xv=()=>{},JE=1,ZE=2,eC=4,tC=8,zE=3,BE=12,Oh;function PE(){return Oh===void 0&&(Oh=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Oh=!0)),Oh}function NB({cursorFlags:e,groups:t,state:n}){let i=0,r=0;switch(n){case"active":case"hover":t.forEach((o)=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{i++;break}case"vertical":{r++;break}}})}if(!(i===0&&r===0)){switch(n){case"active":{if(e&&PE()){let o=(e&JE)!==0,s=(e&ZE)!==0,l=(e&eC)!==0,a=(e&tC)!==0;if(o)return l?"se-resize":a?"ne-resize":"e-resize";if(s)return l?"sw-resize":a?"nw-resize":"w-resize";if(l)return"s-resize";if(a)return"n-resize"}break}}return PE()?i>0&&r>0?"move":i>0?"ew-resize":"ns-resize":i>0&&r>0?"grab":i>0?"col-resize":"row-resize"}}var IE=new WeakMap;function xu(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=IE.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let i=fr();switch(i.state){case"active":case"hover":{let r=NB({cursorFlags:i.cursorFlags,groups:i.hitRegions.map((s)=>s.group),state:i.state}),o=`*, *:hover {cursor: ${r} !important; }`;if(t===o)return;t=o,r?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}IE.set(e,{prevStyle:t,styleSheet:n})}function Se(e,t="Assertion error"){if(!e)throw Error(t)}function Sv(e,t){return Array.from(t).sort((n,i)=>{let r=e==="horizontal"?TB(n,i):MB(n,i);if(r!==0)return r;let o=n.element.compareDocumentPosition(i.element);return o&Node.DOCUMENT_POSITION_DISCONNECTED?0:o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function TB(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function MB(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function kv(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function nC(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function _B({orientation:e,rects:t,targetRect:n}){let i={x:n.x+n.width/2,y:n.y+n.height/2},r,o=Number.MAX_VALUE;for(let s of t){let{x:l,y:a}=nC(i,s),u=e==="horizontal"?l:a;u<o&&(o=u,r=s)}return Se(r,"No rect found"),r}var Rh;function DB(){return Rh===void 0&&(typeof matchMedia=="function"?Rh=!!matchMedia("(pointer:coarse)").matches:Rh=!1),Rh}function Av({expandHitTargets:e=!0,group:t,includeDisabled:n=!1}){let{element:i,orientation:r,panels:o,separators:s}=t,l=Sv(r,Array.from(i.children).filter(kv).filter((g)=>!g.hasAttribute("data-resize-preview")).map((g)=>({element:g}))).map(({element:g})=>g),a=[],u=!1,c=!1,f=-1,h,d=-1,m=0,b,x=[];{let g=-1;for(let v of l)v.hasAttribute("data-panel")&&(g++,v.hasAttribute("data-disabled")||(m++,f===-1&&(f=g),d=g))}if(n||m>1){let g=-1;for(let v of l)if(v.hasAttribute("data-panel")){g++;let y=o.find((S)=>S.element===v);if(y){if(b){let S=b.element.getBoundingClientRect(),k=v.getBoundingClientRect(),A;if(c){let E=r==="horizontal"?new DOMRect(S.right,S.top,0,S.height):new DOMRect(S.left,S.bottom,S.width,0),O=r==="horizontal"?new DOMRect(k.left,k.top,0,k.height):new DOMRect(k.left,k.top,k.width,0);switch(x.length){case 0:{A=[E,O];break}case 1:{let T=x[0],_=_B({orientation:r,rects:[S,k],targetRect:T.element.getBoundingClientRect()});A=[T,_===S?O:E];break}default:{A=x;break}}}else x.length?A=x:A=[r==="horizontal"?new DOMRect(S.right,k.top,k.left-S.right,k.height):new DOMRect(k.left,S.bottom,k.width,k.top-S.bottom)];for(let E of A){let O="width"in E?E:E.element.getBoundingClientRect(),T=e?DB()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(O.width<T){let L=T-O.width;O=new DOMRect(O.x-L/2,O.y,O.width+L,O.height)}if(O.height<T){let L=T-O.height;O=new DOMRect(O.x,O.y-L/2,O.width,O.height+L)}let _=g<=f||g>d;(n||!u&&!_)&&(h??=Nl({group:t}),a.push({group:t,groupSize:h,panels:[b,y],separator:"width"in E?void 0:E,rect:O})),u=!1}}c=!1,b=y,x=[]}}else if(v.hasAttribute("data-separator")){v.ariaDisabled!==null&&(u=!0);let y=s.find((S)=>S.element===v);y?x.push(y):(b=void 0,x=[])}else c=!0}return a}var Si=new Map,iC=new Ev;function LB(e){Si=new Map(Si),Si.delete(e)}function rC(e,t){for(let[n]of Si)if(n.id===e)return n}function oo(e,t){for(let[n,i]of Si)if(n.id===e)return i;if(t)throw Error(`Could not find data for Group with id ${e}`)}function so(){return Si}function Ov(e,t){return iC.addListener("groupChange",(n)=>{n.group.id===e&&t(n)})}function Ci(e,t,n){let i=Si.get(e);Si=new Map(Si),Si.set(e,t),iC.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:i,next:t})}function zB(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function lt(e,t,n=0){return Math.abs(kt(e)-kt(t))<=n}function wi(e,t){return lt(e,t)?0:e>t?1:-1}function Rl({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:i}){let{collapsedSize:r=0,collapsedThreshold:o,collapsible:s,disabled:l,maxSize:a=100,minSize:u=0}=t;if(l&&!e)return n;if(wi(i,u)<0)if(s){let c=o??(u-r)/2,f=wi(n,r)<=0,h=f?r+c:u-c,d=wi(i,h);wi(i,r)<=0||d<0||o!==void 0&&f&&d===0?i=r:i=u}else i=u;return i=Math.min(a,i),i=kt(i),i}function wu({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:i,prevLayout:r,trigger:o}){if(lt(e,0))return t;let s=o==="imperative-api",l=n.map(({panelId:m})=>t[m]),a=n.map(({panelId:m})=>r[m]),u=[...l],[c,f]=i;Se(c!=null,"Invalid first pivot index"),Se(f!=null,"Invalid second pivot index");let h=0;switch(o){case"keyboard":{{let m=e<0?f:c,b=n[m];Se(b,`Panel constraints not found for index ${m}`);let{collapsedSize:x=0,collapsible:g,minSize:v=0}=b;if(g){let y=l[m];if(Se(y!=null,`Previous layout not found for panel index ${m}`),lt(y,x)){let S=v-y;wi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}{let m=e<0?c:f,b=n[m];Se(b,`No panel constraints found for index ${m}`);let{collapsedSize:x=0,collapsible:g,minSize:v=0}=b;if(g){let y=l[m];if(Se(y!=null,`Previous layout not found for panel index ${m}`),lt(y,v)){let S=y-x;wi(S,Math.abs(e))>0&&(e=e<0?0-S:S)}}}break}default:{let m=e<0?f:c,b=n[m];Se(b,`Panel constraints not found for index ${m}`);let x=l[m],{collapsedSize:g,collapsedThreshold:v,collapsible:y,minSize:S}=b;if(y&&wi(x,S)<0){let k=S-g,A=v??k/2,E=x+Math.abs(e);if(wi(E,S)<0){let O=wi(Math.abs(e),A),T=v===void 0&&e<0;O>0||O===0&&T?e=e<0?-k:k:e=0}}break}}{let m=e<0?1:-1,b=e<0?f:c,x=0;for(;;){let v=l[b];Se(v!=null,`Previous layout not found for panel index ${b}`);let y=Rl({overrideDisabledPanels:s,panelConstraints:n[b],prevSize:v,size:100})-v;if(x+=y,b+=m,b<0||b>=n.length)break}let g=Math.min(Math.abs(e),Math.abs(x));e=e<0?0-g:g}{let m=e<0?c:f;for(;m>=0&&m<n.length;){let b=Math.abs(e)-Math.abs(h),x=l[m];Se(x!=null,`Previous layout not found for panel index ${m}`);let g=x-b,v=Rl({overrideDisabledPanels:s,panelConstraints:n[m],prevSize:x,size:g});if(!lt(x,v)&&(h+=x-v,u[m]=v,h.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(zB(a,u))return r;{let m=e<0?f:c,b=l[m];Se(b!=null,`Previous layout not found for panel index ${m}`);let x=b+h,g=Rl({overrideDisabledPanels:s,panelConstraints:n[m],prevSize:b,size:x});if(u[m]=g,!lt(g,x)){let v=x-g,y=e<0?f:c;for(;y>=0&&y<n.length;){let S=u[y];Se(S!=null,`Previous layout not found for panel index ${y}`);let k=S+v,A=Rl({overrideDisabledPanels:s,panelConstraints:n[y],prevSize:S,size:k});if(lt(S,A)||(v-=A-S,u[y]=A),lt(v,0))break;e>0?y--:y++}}}let d=Object.values(u).reduce((m,b)=>b+m,0);return lt(d,100,0.1)?u.reduce((m,b,x)=>(m[n[x].panelId]=b,m),{}):r}function Ei(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||wi(e[n],t[n])!==0)return!1;return!0}function Rv({commit:e,document:t,event:n,hitRegions:i,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:s,prevCursorFlags:l}){let a=0,u=fr(),c=u.state==="active"?u.previews:[],f=new Map(u.state==="active"?u.previewLayoutMap:void 0);i.forEach((m)=>{let{group:b,groupSize:x}=m,{orientation:g,panels:v}=b;if(e&&b.resizePreviewMode!=="separator")return;let{disableCursor:y}=b.mutableState,S=0;s?g==="horizontal"?S=(n.clientX-s.x)/x*100:S=(n.clientY-s.y)/x*100:g==="horizontal"?S=n.clientX<0?-100:100:S=n.clientY<0?-100:100;let k=r.get(b),A=o.get(b);if(!k||!A)return;let{defaultLayoutDeferred:E,derivedPanelConstraints:O,groupSize:T,layout:_,separatorToPanels:L}=A;if(O&&_&&L){let B=b.resizePreviewMode==="separator"?f.get(b)??_:_,W=wu({delta:S,initialLayout:k,panelConstraints:O,pivotIndices:m.panels.map((K)=>v.indexOf(K)),prevLayout:B,trigger:"mouse-or-touch"});if(b.resizePreviewMode==="separator"&&!e&&!Ei(W,B)){f.set(b,W);let K=0,I=v.map((j)=>(K+=W[j.id]-k[j.id],K*(x/100)));c=c.map((j)=>{if(j.group!==b)return j;let ee=I[j.panelIndex];return ee===j.offset?j:{...j,offset:ee}})}if(Ei(W,B)&&S!==0&&!y)switch(g){case"horizontal":{a|=S<0?JE:ZE;break}case"vertical":{a|=S<0?eC:tC;break}}(b.resizePreviewMode!=="separator"||e)&&!Ei(W,_)&&Ci(m.group,{defaultLayoutDeferred:E,derivedPanelConstraints:O,groupSize:T,layout:W,separatorToPanels:L})}});let h=0;n.movementX===0?h|=l&zE:h|=a&zE,n.movementY===0?h|=l&BE:h|=a&BE;let d=u.state==="active"&&(n.clientX!==u.pointerDownAtPoint.x||n.clientY!==u.pointerDownAtPoint.y);CB(h,c,f,d),xu(t)}function oC(e,t){let n=fr(),i=so(),r=!1;switch(n.state){case"active":Rv({commit:!0,document:e,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:i,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),ki({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(xu(e),r=!0,n.hitRegions.forEach((o)=>{if(!i.has(o.group))return;let s=oo(o.group.id,!0);Ci(o.group,s,{isUserInteraction:!0})}))}return r}function VE(e){e.defaultPrevented||oC(e.currentTarget,e)}function BB(e,t,n){let i,r={x:1/0,y:1/0};for(let o of t){let s=nC(n,o.rect);switch(e){case"horizontal":{s.x<=r.x&&(i=o,r=s);break}case"vertical":{s.y<=r.y&&(i=o,r=s);break}}}return i?{distance:r,hitRegion:i}:void 0}function PB(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function IB(e,t){if(e===t)throw Error("Cannot compare node with itself");let n={a:jE(e),b:jE(t)},i;for(;n.a.at(-1)===n.b.at(-1);)i=n.a.pop(),n.b.pop();Se(i,"Stacking order can only be calculated for elements with a common ancestor");let r={a:UE(HE(n.a)),b:UE(HE(n.b))};if(r.a===r.b){let o=i.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)},l=o.length;for(;l--;){let a=o[l];if(a===s.a)return 1;if(a===s.b)return-1}}return Math.sign(r.a-r.b)}var VB=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function HB(e){let t=getComputedStyle(sC(e)??e).display;return t==="flex"||t==="inline-flex"}function UB(e){let t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||HB(e))||+t.opacity<1||("transform"in t)&&t.transform!=="none"||("webkitTransform"in t)&&t.webkitTransform!=="none"||("mixBlendMode"in t)&&t.mixBlendMode!=="normal"||("filter"in t)&&t.filter!=="none"||("webkitFilter"in t)&&t.webkitFilter!=="none"||("isolation"in t)&&t.isolation==="isolate"||VB.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function HE(e){let t=e.length;for(;t--;){let n=e[t];if(Se(n,"Missing node"),UB(n))return n}return null}function UE(e){return e&&Number(getComputedStyle(e).zIndex)||0}function jE(e){let t=[];for(;e;)t.push(e),e=sC(e);return t}function sC(e){let{parentNode:t}=e;return PB(t)?t.host:t}function jB(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function FB(e){try{return e.matches(":modal")}catch{return!1}}function KB({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(kv(n)){let i=n.closest("dialog");if(i&&!i.contains(e)&&FB(i))return!1}if(!kv(n)||n.contains(e)||e.contains(n))return!0;if(IB(n,e)>0){let i=n;for(;i;){if(i.contains(e))return!0;if(jB(i.getBoundingClientRect(),t))return!1;i=i.parentElement}}return!0}function Nv(e,t){let n=[];return t.forEach((i,r)=>{if(r.disabled)return;let o=Av({group:r}),s=BB(r.orientation,o,{x:e.clientX,y:e.clientY});s&&s.distance.x<=0&&s.distance.y<=0&&KB({groupElement:r.element,hitRegion:s.hitRegion.rect,pointerEventTarget:e.target})&&n.push(s.hitRegion)}),n}function ts({layout:e,panelConstraints:t}){let n=t.map(({panelId:s})=>e[s]),i=[...n],r=i.reduce((s,l)=>s+l,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map((s)=>`${s}%`).join(", ")}`);if(!lt(r,100)&&i.length>0)for(let s=0;s<t.length;s++){let l=i[s];Se(l!=null,`No layout data found for index ${s}`);let a=100/r*l;i[s]=a}let o=0;for(let s=0;s<t.length;s++){let l=n[s];Se(l!=null,`No layout data found for index ${s}`);let a=i[s];Se(a!=null,`No layout data found for index ${s}`);let u=Rl({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:l,size:a});a!=u&&(o+=a-u,i[s]=u)}if(!lt(o,0))for(let s=0;s<t.length;s++){let l=i[s];Se(l!=null,`No layout data found for index ${s}`);let a=l+o,u=Rl({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:l,size:a});if(l!==u&&(o-=u-l,i[s]=u,lt(o,0)))break}return i.reduce((s,l,a)=>(s[t[a].panelId]=l,s),{})}function lC({groupId:e,panelId:t}){let n=()=>{let a=so();for(let[u,{defaultLayoutDeferred:c,derivedPanelConstraints:f,layout:h,groupSize:d,separatorToPanels:m}]of a)if(u.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:u,groupSize:d,layout:h,separatorToPanels:m};throw Error(`Group ${e} not found`)},i=()=>{let a=n().derivedPanelConstraints.find((u)=>u.panelId===t);if(a!==void 0)return a;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{let a=n().group.panels.find((u)=>u.id===t);if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},o=()=>{let a=n().layout[t];if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},s=({nextSize:a,panels:u,prevLayout:c,derivedPanelConstraints:f})=>{let h=o(),d=u.findIndex((x)=>x.id===t),m=d===0,b=d===u.length-1;if(b&&a<h&&(m||u.slice(0,d).every((x,g)=>{let v=f[g];return v?.collapsible&&lt(v.collapsedSize,c[v.panelId])}))){let x=u.slice(0,d).reduce((g,v)=>g+c[v.id],0);return{...c,[t]:kt(100-x)}}return wu({delta:b?h-a:a-h,initialLayout:c,panelConstraints:f,pivotIndices:b?[d-1,d]:[d,d+1],prevLayout:c,trigger:"imperative-api"})},l=(a)=>{let u=o();if(a===u)return;let{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:h,groupSize:d,layout:m,separatorToPanels:b}=n(),x=s({nextSize:a,panels:h.panels,prevLayout:m,derivedPanelConstraints:f}),g=ts({layout:x,panelConstraints:f});Ei(m,g)||Ci(h,{defaultLayoutDeferred:c,derivedPanelConstraints:f,groupSize:d,layout:g,separatorToPanels:b})};return{collapse:()=>{let{collapsible:a,collapsedSize:u}=i(),{mutableValues:c}=r(),f=o();a&&f!==u&&(c.expandToSize=f,l(u))},expand:()=>{let{collapsible:a,collapsedSize:u,minSize:c}=i(),{mutableValues:f}=r(),h=o();if(a&&h===u){let d=f.expandToSize??c;d===0&&(d=1),l(d)}},getSize:()=>{let{group:a}=n(),u=o(),{element:c}=r(),f=a.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:u,inPixels:f}},isCollapsed:()=>{let{collapsible:a,collapsedSize:u}=i(),c=o();return a&&lt(u,c)},resize:(a)=>{let{group:u}=n(),{element:c}=r(),f=Nl({group:u}),h=Ol({groupSize:f,panelElement:c,styleProp:a}),d=kt(h/f*100);l(d)}}}function FE(e){if(e.defaultPrevented)return;let t=so();Nv(e,t).forEach((n)=>{if(n.separator&&!n.separator.disableDoubleClick){let i=n.panels.find((r)=>r.panelConstraints.defaultSize!==void 0);if(i){let r=i.panelConstraints.defaultSize,o=lC({groupId:n.group.id,panelId:i.id});o&&r!==void 0&&(o.resize(r),e.preventDefault())}}})}function Nh(e){let t=so();for(let[n]of t)if(n.separators.some((i)=>i.element===e))return n;throw Error("Could not find parent Group for separator element")}function aC({groupId:e}){let t=()=>{let n=so();for(let[i,r]of n)if(i.id===e)return{group:i,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:n,layout:i}=t();return n?{}:i},setLayout(n){let{defaultLayoutDeferred:i,derivedPanelConstraints:r,group:o,groupSize:s,layout:l,separatorToPanels:a}=t(),u=ts({layout:n,panelConstraints:r});return i?l:(Ei(l,u)||Ci(o,{defaultLayoutDeferred:i,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:a}),u)}}}function es(e,t){let n=Nh(e),i=oo(n.id,!0),r=n.separators.find((c)=>c.element===e);Se(r,"Matching separator not found");let o=i.separatorToPanels.get(r);Se(o,"Matching panels not found");let s=o.map((c)=>n.panels.indexOf(c)),l=aC({groupId:n.id}).getLayout(),a=wu({delta:t,initialLayout:l,panelConstraints:i.derivedPanelConstraints,pivotIndices:s,prevLayout:l,trigger:"keyboard"}),u=ts({layout:a,panelConstraints:i.derivedPanelConstraints});Ei(l,u)||Ci(n,{defaultLayoutDeferred:i.defaultLayoutDeferred,derivedPanelConstraints:i.derivedPanelConstraints,groupSize:i.groupSize,layout:u,separatorToPanels:i.separatorToPanels},{isUserInteraction:!0})}function KE(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Nh(t);if(!(n.disabled||n.separators.find((i)=>i.element===t)?.disabled))switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&es(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&es(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&es(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&es(t,-5);break}case"End":{e.preventDefault(),es(t,100);break}case"Enter":{e.preventDefault();let i=Nh(t),r=oo(i.id,!0),{derivedPanelConstraints:o,layout:s,separatorToPanels:l}=r,a=i.separators.find((h)=>h.element===t);Se(a,"Matching separator not found");let u=l.get(a);Se(u,"Matching panels not found");let c=u[0],f=o.find((h)=>h.panelId===c.id);if(Se(f,"Panel metadata not found"),f.collapsible){let h=s[c.id],d=f.collapsedSize===h?i.mutableState.expandedPanelSizes[c.id]??f.minSize:f.collapsedSize;es(t,d-h)}break}case"F6":{e.preventDefault();let i=Nh(t).separators.map((s)=>s.element),r=Array.from(i).findIndex((s)=>s===e.currentTarget);Se(r!==null,"Index not found");let o=e.shiftKey?r>0?r-1:i.length-1:r+1<i.length?r+1:0;i[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),es(t,-100);break}}}function qB(e,t){let{element:n,orientation:i,panels:r}=e,o=n.getBoundingClientRect(),s=i==="horizontal";return Av({expandHitTargets:!1,group:e,includeDisabled:!0}).map(({panels:l,rect:a,separator:u},c)=>{let f=r.indexOf(l[0]),h=s?a.left+a.width/2:a.top+a.height/2;return{active:t.some((d)=>{if(d.group!==e||d.panels[0]!==l[0])return!1;if(u||d.separator)return d.separator===u;let m=s?d.rect.left+d.rect.width/2:d.rect.top+d.rect.height/2;return lt(h,m)}),group:e,key:u?`separator-${u.id}`:`panel-${l[0].id}-${c}`,offset:0,panelIndex:f,rect:new DOMRect((s&&!u?h:a.left)-o.left-n.clientLeft+n.scrollLeft,(!s&&!u?h:a.top)-o.top-n.clientTop+n.scrollTop,s&&!u?0:a.width,!s&&!u?0:a.height),separator:u}})}function qE(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;let t=so(),n=Nv(e,t);if(n.length===0)return;let i=new Map,r=!1;n.forEach((s)=>{s.separator&&(r||(r=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));let l=t.get(s.group);l&&i.set(s.group,l.layout)});let o=Array.from(i.keys()).flatMap((s)=>s.resizePreviewMode==="separator"?qB(s,n):[]);ki({cursorFlags:0,didPointerMove:!1,hitRegions:n,initialLayoutMap:i,pointerDownAtPoint:{x:e.clientX,y:e.clientY},previewLayoutMap:new Map(i),previews:o,state:"active"}),e.preventDefault()}function $E(e){let t=so(),n=fr();switch(n.state){case"active":Rv({commit:!1,document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function GE(e){if(e.defaultPrevented)return;let t=fr(),n=so();switch(t.state){case"active":{if(e.buttons===0){t.previewLayoutMap.forEach((i,r)=>{let o=n.get(r);r.resizePreviewMode==="separator"&&o&&!Ei(i,o.layout)&&Ci(r,{...o,layout:i})}),ki({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach((i)=>{if(!n.has(i.group))return;let r=oo(i.group.id,!0);Ci(i.group,r,{isUserInteraction:!0})}),xu(e.currentTarget);return}for(let i of t.hitRegions)if(i.separator){let{element:r}=i.separator;r.isConnected&&!r.hasPointerCapture?.(e.pointerId)&&r.setPointerCapture?.(e.pointerId)}Rv({commit:!1,document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{let i=Nv(e,n);i.length===0?t.state!=="inactive"&&ki({cursorFlags:0,state:"inactive"}):ki({cursorFlags:0,hitRegions:i,state:"hover"}),xu(e.currentTarget);break}}}function WE(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(fr().state){case"hover":ki({cursorFlags:0,state:"inactive"})}}function YE(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;oC(e.currentTarget,e)&&e.preventDefault()}function $B(e){let t=0,n=0,i={};for(let o of e)if(o.defaultSize!==void 0){t++;let s=kt(o.defaultSize);n+=s,i[o.panelId]=s}else i[o.panelId]=void 0;let r=e.length-t;if(r!==0){let o=kt((100-n)/r);for(let s of e)s.defaultSize===void 0&&(i[s.panelId]=o)}return i}function GB(e,t){let n=e.map((r)=>r.id),i=Object.keys(t);if(n.length!==i.length)return!1;for(let r of n)if(!i.includes(r))return!1;return!0}function XE({group:e,panelConstraints:t}){let n=e.panels.map(({id:r})=>r).join(","),i=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(i&&GB(e.panels,i)?i:$B(t))}function WB(e,t,n){if(!n[0])return;let i=e.panels.find((a)=>a.element===t);if(!i||!i.onResize)return;let r=Nl({group:e}),o=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,s=i.mutableValues.prevSize,l={asPercentage:kt(o/r*100),inPixels:o};i.mutableValues.prevSize=l,i.onResize(l,i.id,s)}function uC(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function YB(e,t){return e.length!==t.length?!1:e.every((n,i)=>uC(n,t[i]))}function XB({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:i}){if(n<=0||t<=0||n===t)return i;let r=0,o=0,s=!1,l=new Map,a=[];for(let f of e.panels){let h=i[f.id]??0;switch(f.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{s=!0;let d=h/100*n,m=kt(d/t*100);l.set(f.id,m),r+=m;break}case"preserve-relative-size":default:{a.push(f.id),o+=h;break}}}if(!s||a.length===0)return i;let u=100-r,c={...i};if(l.forEach((f,h)=>{c[h]=f}),o>0)for(let f of a){let h=i[f]??0;c[f]=kt(h/o*u)}else{let f=kt(u/a.length);for(let h of a)c[h]=f}return c}var Al=new Map;function QB(e){let t=!0;Se(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");let n=e.element.ownerDocument.defaultView.ResizeObserver,i=new Set,r=new Set,o=new n((h)=>{for(let d of h){let{borderBoxSize:m,target:b}=d;if(b===e.element){if(t){let x=Nl({group:e});if(x===0)return;let g=oo(e.id);if(!g)return;let v=wv(e),y=g.defaultLayoutDeferred?XE({group:e,panelConstraints:v}):g.layout,S=XB({group:e,nextGroupSize:x,prevGroupSize:g.groupSize,prevLayout:y}),k=ts({layout:S,panelConstraints:v});if(!g.defaultLayoutDeferred&&Ei(g.layout,k)&&YB(g.derivedPanelConstraints,v)&&g.groupSize===x)continue;Ci(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:v,groupSize:x,layout:k,separatorToPanels:g.separatorToPanels})}}else WB(e,b,m)}});o.observe(e.element),e.panels.forEach((h)=>{Se(!i.has(h.id),`Panel ids must be unique; id "${h.id}" was used more than once`),i.add(h.id),h.onResize&&o.observe(h.element)});let s=Nl({group:e}),l=wv(e),a=XE({group:e,panelConstraints:l}),u=ts({layout:a,panelConstraints:l}),c=e.element.ownerDocument;Al.set(c,(Al.get(c)??0)+1);let f=new Map;return Av({group:e,includeDisabled:!0}).forEach((h)=>{h.separator&&f.set(h.separator,h.panels)}),Ci(e,{defaultLayoutDeferred:s===0,derivedPanelConstraints:l,groupSize:s,layout:u,separatorToPanels:f}),e.separators.forEach((h)=>{Se(!r.has(h.id),`Separator ids must be unique; id "${h.id}" was used more than once`),r.add(h.id),h.element.addEventListener("keydown",KE)}),Al.get(c)===1&&(c.addEventListener("contextmenu",VE,!0),c.addEventListener("dblclick",FE,!0),c.addEventListener("pointerdown",qE,!0),c.addEventListener("pointerleave",$E),c.addEventListener("pointermove",GE),c.addEventListener("pointerout",WE),c.addEventListener("pointerup",YE,!0)),function(){t=!1,Al.set(c,Math.max(0,(Al.get(c)??0)-1)),LB(e),OB(e)&&xu(c),e.separators.forEach((h)=>{h.element.removeEventListener("keydown",KE)}),Al.get(c)||(c.removeEventListener("contextmenu",VE,!0),c.removeEventListener("dblclick",FE,!0),c.removeEventListener("pointerdown",qE,!0),c.removeEventListener("pointerleave",$E),c.removeEventListener("pointermove",GE),c.removeEventListener("pointerout",WE),c.removeEventListener("pointerup",YE,!0)),o.disconnect()}}function JB(){let[e,t]=Q({}),n=ft(()=>t({}),[]);return[e,n]}function Tv(e){let t=Uc();return`${e??t}`}var Yn=typeof window<"u"?Vi:te;function yu(e){let t=q(e);return Yn(()=>{t.current=e},[e]),ft((...n)=>t.current?.(...n),[t])}function Mv(...e){return yu((t)=>{e.forEach((n)=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function _v(e){let t=q({...e});return Yn(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var cC=Er(null);function ZB({separator:e}){let{element:t}=e,n=q(null);return Yn(()=>{let i=t.cloneNode(!0),r=[t,...t.querySelectorAll("*")],o=[i,...i.querySelectorAll("*")],s=t.ownerDocument.defaultView;return r.forEach((l,a)=>{let u=o[a];if(u instanceof s.HTMLElement||u instanceof s.SVGElement){let c=s.getComputedStyle(l);for(let f=0;f<c.length;f++){let h=c.item(f);u.style.setProperty(h,c.getPropertyValue(h))}}u.removeAttribute("data-testid"),u.removeAttribute("id")}),Object.assign(i.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),n.current.appendChild(i),()=>i.remove()},[t]),p("div",{ref:n,style:{height:"100%",opacity:0.65,pointerEvents:"none",width:"100%"}})}function Mh(){let e=Ar(cC);return Se(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function fC(e){let{registerOverlay:t}=Mh(),n=q(e);uC(n.current,e)||(n.current=e);let i=n.current;return Yn(()=>t(i),[t,i]),null}fC.displayName="SeparatorOverlay";function e4({active:e,orientation:t,style:n,...i}){let r;switch(t){case"horizontal":{r={height:"100%",minWidth:"1px"};break}case"vertical":{r={minHeight:"1px",width:"100%"};break}}return p("div",{...i,"data-separator-overlay":e?"active":"inactive",style:{...r,...n,flexShrink:0,pointerEvents:"none"}})}function t4({overlay:e,preview:t}){let{group:n,offset:i,rect:r,separator:o}=t,s=n.orientation==="horizontal",l=o?.preview,a=e;return Hc(l)&&l.type===fC&&(a=l.props,l=void 0),l==null&&(a?l=p(e4,{...a,active:t.active,orientation:n.orientation}):o&&(l=p(ZB,{separator:o}))),p("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:r.height,left:r.left,pointerEvents:"none",position:"absolute",top:r.top,transform:s?`translateX(${i}px)`:`translateY(${i}px)`,width:r.width},children:l})}function n4(e,t){let n=q({getLayout:()=>({}),setLayout:RB});ca(t,()=>n.current,[]),Yn(()=>{Object.assign(n.current,aC({groupId:e}))})}function i4({groupId:e,resizePreviewMode:t}){let[n,i]=Q([]),r=q(n);return Yn(()=>{let o=(l)=>{let a=rC(e),u=t==="separator"&&l.state==="active"?l.previews.filter((f)=>f.group===a&&(f.active||!lt(f.offset,0))):[],c=r.current;c.length===u.length&&u.every((f,h)=>f===c[h])||(r.current=u,i(u))};if(t!=="separator"){o(fr());return}let s=QE(({next:l})=>o(l));return o(fr()),s},[e,t]),n}function Dv({children:e,className:t,defaultLayout:n,disableCursor:i,disabled:r,elementRef:o,groupRef:s,id:l,onLayoutChange:a,onLayoutChanged:u,orientation:c="horizontal",resizePreviewMode:f="panel",resizeTargetMinimumSize:h={coarse:20,fine:10},style:d,...m}){let b=q({onLayoutChange:{},onLayoutChanged:{}}),x=yu((I)=>{Ei(b.current.onLayoutChange,I)||(b.current.onLayoutChange=I,a?.(I))}),g=yu((I,j)=>{Ei(b.current.onLayoutChanged,I)||(b.current.onLayoutChanged=I,u?.(I,{isUserInteraction:j}))}),v=Tv(l),[y,S]=Q(),k=i4({groupId:v,resizePreviewMode:f}),A=q(null),[E,O]=JB(),T=q({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),_=Mv(A,o);n4(v,s);let L=yu((I,j)=>{let ee=oo(I);if(ee)return{flexGrow:ee.layout[j]??1};if(n?.[j])return{flexGrow:n?.[j]}}),B=_v({defaultLayout:n,disableCursor:i,resizeTargetMinimumSize:h}),W=Je(()=>({get disableCursor(){return!!B.disableCursor},getPanelStyles:L,id:v,orientation:c,registerPanel:(I)=>{let j=T.current;return j.panels=Sv(c,[...j.panels,I]),O(),()=>{j.panels=j.panels.filter((ee)=>ee!==I),O()}},registerOverlay:(I)=>(S(I),()=>{S(void 0)}),registerSeparator:(I)=>{let j=T.current;return j.separators=Sv(c,[...j.separators,I]),O(),()=>{j.separators=j.separators.filter((ee)=>ee!==I),O()}},updatePanelProps:(I,{disabled:j})=>{let ee=T.current.panels.find((Ye)=>Ye.id===I);ee&&(ee.panelConstraints.disabled=j);let F=rC(v),fe=oo(v);F&&fe&&Ci(F,{...fe,derivedPanelConstraints:wv(F)})},updateSeparatorProps:(I,{disabled:j,disableDoubleClick:ee})=>{let F=T.current.separators.find((fe)=>fe.id===I);F&&(F.disabled=j,F.disableDoubleClick=ee)}}),[L,v,O,c,B]),K=q(null);return Yn(()=>{let I=A.current;if(I===null)return;let j=T.current,ee;if(B.defaultLayout!==void 0&&Object.keys(B.defaultLayout).length===j.panels.length){ee={};for(let Qe of j.panels){let Wt=B.defaultLayout[Qe.id];Wt!==void 0&&(ee[Qe.id]=Wt)}}let F={disabled:!!r,element:I,id:v,mutableState:{defaultLayout:ee,disableCursor:!!B.disableCursor,expandedPanelSizes:T.current.lastExpandedPanelSizes,layouts:T.current.layouts},orientation:c,panels:j.panels,resizePreviewMode:f,get resizeTargetMinimumSize(){return B.resizeTargetMinimumSize},separators:j.separators};K.current=F;let fe=QB(F),{defaultLayoutDeferred:Ye,derivedPanelConstraints:yt,layout:Xe}=oo(F.id,!0);!Ye&&yt.length>0&&(x(Xe),g(Xe,!1));let xt=Ov(v,(Qe)=>{let{defaultLayoutDeferred:Wt,derivedPanelConstraints:Lt,layout:Bi}=Qe.next;if(Wt||Lt.length===0)return;let op=F.panels.map(({id:zt})=>zt).join(",");F.mutableState.layouts[op]=Bi,Lt.forEach((zt)=>{if(zt.collapsible){let{layout:sa}=Qe.prev??{};if(sa){let C=lt(zt.collapsedSize,Bi[zt.panelId]),D=lt(zt.collapsedSize,sa[zt.panelId]);C&&!D&&(F.mutableState.expandedPanelSizes[zt.panelId]=sa[zt.panelId])}}});let xs=fr(),Ec=xs.state!=="active"||!xs.hitRegions.some((zt)=>zt.group===F);x(Bi),Ec&&g(Bi,Qe.isUserInteraction)});return()=>{K.current=null,fe(),xt()}},[r,v,g,x,c,E,f,B]),te(()=>{let I=K.current;I&&(I.mutableState.defaultLayout=n,I.mutableState.disableCursor=!!i)}),p(cC.Provider,{value:W,children:w("div",{...m,className:t,"data-group":!0,"data-testid":v,id:v,ref:_,style:{height:"100%",width:"100%",overflow:"hidden",position:f==="separator"?"relative":void 0,...d,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:[e,k.map((I)=>p(t4,{overlay:y,preview:I},I.key))]})})}Dv.displayName="Group";function Th(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function r4({id:e,panelIds:t,storage:n}){let i=Th(e,[]),r=n.getItem(i);if(r)try{let o=JSON.parse(r);if(t){let s=t.join(","),l=o[s];if(l&&Array.isArray(l.layout)&&t.length===l.layout.length){let a={};for(let u=0;u<t.length;u++)a[t[u]]=l.layout[u];return a}}else{let s=Object.keys(o);if(s.length===1){let l=o[s[0]];if(l&&Array.isArray(l.layout)){let a=s[0].split(",");if(a.length===l.layout.length){let u={};for(let c=0;c<a.length;c++)u[a[c]]=l.layout[c];return u}}}}}catch{}}function hC({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:i=localStorage,...r}){let o=n!==void 0,s="id"in r?r.id:r.groupId,l=Th(s,n??[]),a=Or(o4,()=>i.getItem(l),()=>i.getItem(l)),u=Je(()=>{if(a){let x=JSON.parse(a),g=Object.values(x);if(Array.from(g).every((v)=>typeof v=="number"))return x}},[a]),c=Je(()=>{if(!u)return r4({id:s,panelIds:n,storage:i})},[u,s,n,i]),f=u??c,h=q(null),d=ft(()=>{let x=h.current;x&&(h.current=null,clearTimeout(x))},[]);Vi(()=>()=>{d()},[d]);let m=ft((x,g)=>{if(t&&!g.isUserInteraction)return;d();let v;o?v=Th(s,Object.keys(x)):v=Th(s,[]);try{i.setItem(v,JSON.stringify(x))}catch(y){console.error(y)}},[d,o,s,t,i]),b=ft((x)=>{d(),e===0?m(x,{isUserInteraction:!1}):h.current=setTimeout(()=>{m(x,{isUserInteraction:!1})},e)},[d,e,m]);return{defaultLayout:f,onLayoutChange:b,onLayoutChanged:m}}function o4(){return function(){}}function s4(e,t){let{id:n}=Mh(),i=q({collapse:xv,expand:xv,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:xv});ca(t,()=>i.current,[]),Yn(()=>{Object.assign(i.current,lC({groupId:n,panelId:e}))})}function _h({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:i,collapsible:r=!1,defaultSize:o,disabled:s,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:u,maxSize:c="100%",minSize:f="0%",onResize:h,panelRef:d,style:m,...b}){let x=!!u,g=Tv(u),v=_v({disabled:s}),y=q(null),S=Mv(y,l),{getPanelStyles:k,id:A,orientation:E,registerPanel:O,updatePanelProps:T}=Mh(),_=h!==null,L=yu((I,j,ee)=>{h?.(I,u,ee)});Yn(()=>{let I=y.current;if(I!==null){let j={element:I,id:g,idIsStable:x,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:_?L:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsedThreshold:i,collapsible:r,defaultSize:o,disabled:v.disabled,maxSize:c,minSize:f}};return O(j)}},[a,n,i,r,o,_,g,x,c,f,L,O,v]),te(()=>{T(g,{disabled:s})},[s,g,T]),s4(g,d);let B=()=>{let I=k(A,g);if(I)return JSON.stringify(I)},W=Or((I)=>Ov(A,I),B,B),K;return W?K=JSON.parse(W):o!==void 0?K={flexGrow:void 0,flexShrink:void 0,flexBasis:o}:K={flexGrow:1},p("div",{...b,"data-disabled":s||void 0,"data-panel":!0,"data-testid":g,id:g,ref:S,style:{...l4,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...K},children:p("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...m,touchAction:E==="horizontal"?"pan-y":"pan-x"},children:e})})}_h.displayName="Panel";var l4={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function a4({layout:e,panelConstraints:t,panelId:n,panelIndex:i}){let r,o,s=e[n],l=t.find((a)=>a.panelId===n);if(l){let a=l.maxSize,u=l.collapsible?l.collapsedSize:l.minSize,c=[i,i+1];o=ts({layout:wu({delta:u-s,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],r=ts({layout:wu({delta:a-s,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:o,valueNow:s}}function Lv({children:e,className:t,disabled:n,disableDoubleClick:i,elementRef:r,id:o,preview:s,style:l,...a}){let u=Tv(o),c=_v({disabled:n,disableDoubleClick:i,children:e,className:t,preview:s,style:l}),[f,h]=Q({}),[d,m]=Q("inactive"),[b,x]=Q(!1),g=q(null),v=q(null),y=Mv(g,r),{disableCursor:S,id:k,orientation:A,registerSeparator:E,updateSeparatorProps:O}=Mh(),T=A==="horizontal"?"vertical":"horizontal";Yn(()=>{let B=g.current;if(B!==null){let W={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:B,id:u,get children(){return c.children},get className(){return c.className},get preview(){return c.preview},get style(){return c.style}};v.current=W;let K=E(W),I=QE((ee)=>{m(ee.next.state!=="inactive"&&ee.next.hitRegions.some((F)=>F.separator===W)?ee.next.state:"inactive")}),j=Ov(k,(ee)=>{let{derivedPanelConstraints:F,layout:fe,separatorToPanels:Ye}=ee.next,yt=Ye.get(W);if(yt){let Xe=yt[0],xt=F.findIndex((Qe)=>Qe.panelId===Xe.id);h(a4({layout:fe,panelConstraints:F,panelId:Xe.id,panelIndex:xt}))}});return()=>{v.current=null,I(),j(),K()}}},[k,u,E,c]),Yn(()=>{let B=v.current;B&&AB(B)},[s]),te(()=>{O(u,{disabled:n,disableDoubleClick:i})},[n,i,u,O]);let _;n&&!S&&(_="not-allowed");let L;if(n)L="disabled";else switch(d){case"active":{L="active";break}default:b?L="focus":L=d}return p("div",{...a,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":T,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":L,"data-testid":u,id:u,onBlur:()=>x(!1),onFocus:()=>x(!0),ref:y,role:"separator",style:{flexBasis:"auto",cursor:_,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}Lv.displayName="Separator";var u4={close:p("path",{d:"M6 6l12 12M18 6L6 18"}),trash:p("path",{d:"M4 7h16M10 7V5h4v2M6 7l1 12h10l1-12M10 11v5M14 11v5"}),copy:p("path",{d:"M9 9h10v10H9zM5 15V5h10"}),external:p("path",{d:"M14 5h5v5M19 5l-8 8M18 14v5H5V6h5"}),dice:w(oe,{children:[p("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}),p("circle",{cx:"9",cy:"9",r:"1.3",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"15",r:"1.3",fill:"currentColor",stroke:"none"}),p("circle",{cx:"12",cy:"12",r:"1.3",fill:"currentColor",stroke:"none"})]}),image:w(oe,{children:[p("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),p("circle",{cx:"8.5",cy:"10",r:"1.5"}),p("path",{d:"M4 17l5-5 4 4 3-2 4 4"})]}),tag:w(oe,{children:[p("path",{d:"M4 11V4h7l9 9-7 7-9-9z"}),p("circle",{cx:"8",cy:"8",r:"1.3",fill:"currentColor",stroke:"none"})]}),sparkle:p("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9zM18 15l.8 2.2L21 18l-2.2.8L18 21l-.8-2.2L15 18l2.2-.8z"}),play:p("path",{d:"M7 4l13 8-13 8z",fill:"currentColor",stroke:"none"}),pause:p("path",{d:"M8 5v14M16 5v14"}),save:p("path",{d:"M5 4h11l3 3v13H5zM8 4v6h7V4M8 20v-6h8v6"}),ghost:p("path",{d:"M5 20V10a7 7 0 0114 0v10l-2.3-2-2.4 2-2.3-2-2.4 2zM9.5 10h.01M14.5 10h.01"}),"panel-off":w(oe,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M4 5l16 14"})]}),"panel-bottom":w(oe,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M3 14h18"}),p("rect",{x:"4.5",y:"15.5",width:"15",height:"3",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-side":w(oe,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M14 4v16"}),p("rect",{x:"15.5",y:"5.5",width:"4",height:"13",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-left":w(oe,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("path",{d:"M10 4v16"}),p("rect",{x:"4.5",y:"5.5",width:"4",height:"13",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),"panel-corner":w(oe,{children:[p("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),p("rect",{x:"12.5",y:"12.5",width:"7",height:"6",fill:"currentColor",stroke:"none",opacity:"0.85"})]}),swap:p("path",{d:"M4 8h13l-3-3M20 16H7l3 3"}),plus:p("path",{d:"M12 5v14M5 12h14"}),"copy-plus":p("path",{d:"M9 9h10v10H9zM5 15V5h10M14 12v4M12 14h4"}),pen:p("path",{d:"M4 20h4L20 8l-4-4L4 16zM14 6l4 4"}),broom:p("path",{d:"M19 4l-7 7M9.5 8.5l6 6-5 5-6-6zM4.5 13.5L2 21l7.5-2.5"}),expand:p("path",{d:"M4 9V4h5M20 15v5h-5M15 4h5v5M9 20H4v-5"}),shrink:p("path",{d:"M9 4v5H4M15 20v-5h5M20 9h-5V4M4 15h5v5"}),power:p("path",{d:"M12 3v9M7.5 6.5a7 7 0 109 0"}),warn:p("path",{d:"M12 4l9 16H3zM12 10v4M12 17h.01"}),link:p("path",{d:"M10 14a4 4 0 015.7 0l2.6-2.6a4 4 0 10-5.7-5.7L11 7.3M14 10a4 4 0 01-5.7 0l-2.6 2.6a4 4 0 105.7 5.7L13 16.7"}),unlink:p("path",{d:"M9 15l-1.6 1.6a4 4 0 01-5.7-5.7L3.3 9.3M15 9l1.6-1.6a4 4 0 015.7 5.7L20.7 14.7M4 4l16 16"}),grip:w(oe,{children:[p("circle",{cx:"9",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"6",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"9",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"9",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"}),p("circle",{cx:"15",cy:"18",r:"1.4",fill:"currentColor",stroke:"none"})]}),refresh:p("path",{d:"M20 11a8 8 0 10-2 6M20 6v5h-5"}),terminal:p("path",{d:"M4 5h16v14H4zM7 9l3 3-3 3M13 15h4"}),text:p("path",{d:"M4 7h16M4 12h10M4 17h13"}),more:p("path",{d:"M5 12h.01M12 12h.01M19 12h.01",strokeWidth:3.2}),eye:p("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zM12 9a3 3 0 110 6 3 3 0 010-6z"}),"eye-off":p("path",{d:"M3 3l18 18M10.6 5.1A10 10 0 0112 5c6.5 0 10 7 10 7a17 17 0 01-3.2 4.2M6.6 6.6C3.9 8.4 2 12 2 12s3.5 7 10 7a9.7 9.7 0 005.4-1.6M9.9 9.9a3 3 0 004.2 4.2"}),rows:p("path",{d:"M4 5h16v6H4zM4 13h16v6H4z"}),grid:p("path",{d:"M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z"}),search:p("path",{d:"M10.5 4a6.5 6.5 0 110 13 6.5 6.5 0 010-13zM15.5 15.5L20 20"}),history:p("path",{d:"M4 12a8 8 0 102.3-5.6M4 4v4h4M12 8v4l3 2"}),dot:p("circle",{cx:"12",cy:"12",r:"5",fill:"currentColor",stroke:"none"})};function H(e){return w("svg",{className:"icon",viewBox:"0 0 24 24",width:`${e.size??1.15}em`,height:`${e.size??1.15}em`,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":e.title==null,role:e.title==null?void 0:"img",children:[e.title==null?null:p("title",{children:e.title}),u4[e.name]]})}async function Ne(e,t){let n=await fetch(e,t),i=await n.json().catch(()=>null);if(!n.ok||i==null)throw Error(i?.error??`http ${n.status} on ${e}`);return i}function zv(){return Ne("/drafts")}function dC(e){return Ne(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`)}function pC(e){return Ne(`/generate/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e.payload)})}function mC(e){return Ne(`/preview/${encodeURIComponent(e.module)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e.values),signal:e.signal})}function Su(e,t={}){return Ne(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.values),keepalive:t.keepalive===!0})}function Bv(e){return Ne(`/drafts/${encodeURIComponent(e.module)}/${encodeURIComponent(e.draft)}`,{method:"DELETE"})}function gC(e){return Ne(`/run/${encodeURIComponent(e.module)}`)}function ku(e){return`/run/${encodeURIComponent(e.module)}/preview?t=${e.tick}`}function Pv(e){return Ne(`/lora-info/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`)}function vC(e){return Ne(`/lora-about/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`)}function Iv(e){return`/lora-preview/${encodeURIComponent(e.host)}/${encodeURIComponent(e.name)}`}function bC(){return Ne("/settings")}function yC(e){return Ne("/settings",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e)})}function xC(){return Ne("/hosts")}function wC(e){return Ne(`/hosts/${encodeURIComponent(e.host)}/ping`)}function SC(e){return Ne(`/hosts/${encodeURIComponent(e.host)}/${e.action}`,{method:"POST"})}function kC(e){return Ne(`/hosts/${encodeURIComponent(e.host)}/drift${e.full?"?full=1":""}`)}function EC(e){return Ne(`/hosts/${encodeURIComponent(e.host)}/lora-civitai/${encodeURIComponent(e.lora)}`,{method:"POST"})}function CC(e){return Ne(`/hosts/${encodeURIComponent(e.host)}/logs`)}function AC(e){return Ne(`/hosts/${encodeURIComponent(e.module)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({host:e.host})})}function OC(){return Ne("/prompt-enhancers")}function RC(e){return Ne(`/prompt-enhancers/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({text:e.text})})}function NC(e){return Ne(`/prompt-enhancers/${encodeURIComponent(e.name)}`,{method:"DELETE"})}function TC(){return Ne("/llm-configs")}function MC(e){return Ne(`/llm-configs/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.config)})}function _C(e){return Ne(`/llm-configs/${encodeURIComponent(e.name)}`,{method:"DELETE"})}async function DC(e){let t=new Uint8Array(await e.file.arrayBuffer()),n="";for(let i=0;i<t.length;i+=32768)n+=String.fromCharCode(...t.subarray(i,i+32768));return Ne("/upload",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:e.file.name,dataBase64:btoa(n)})})}function LC(e){let t=new URLSearchParams({q:e.q,limit:String(e.limit??20)});return Ne(`/tags/${encodeURIComponent(e.module)}/${encodeURIComponent(e.varName)}?${t}`,{signal:e.signal})}function zC(e){return e.length>0&&e.length<=5&&e.every((t)=>t.length<=16)}function Dh(e){if(typeof e==="string")return[e];if(Array.isArray(e))return e.filter((t)=>typeof t==="string");return[]}function BC(e){if(e.select==="one")return e.c;let t=Dh(e.value);if(e.select==="zero-or-one")return t.includes(e.c)?null:e.c;let n=t.includes(e.c);return e.choices.filter((i)=>i===e.c?!n:t.includes(i))}function PC(e){let t=(n)=>typeof n==="string"&&e.choices.includes(n);if(e.select==="many")return Array.isArray(e.raw)&&e.raw.every(t)?{ok:!0,value:e.choices.filter((n)=>Array.isArray(e.raw)&&e.raw.includes(n))}:{ok:!1};if(e.select==="zero-or-one")return e.raw===null||t(e.raw)?{ok:!0,value:e.raw}:{ok:!1};return t(e.raw)?{ok:!0,value:e.raw}:{ok:!1}}function IC(e){let t=Dh(e.raw).filter((n)=>e.choices.includes(n));if(e.select==="many")return e.choices.filter((n)=>t.includes(n));if(e.select==="zero-or-one")return t[0]??null;return typeof e.raw==="string"?e.raw:t[0]??null}function Eu(e){if(typeof e!=="object"||e==null||Array.isArray(e))return!1;let t=e,n=t.strength;return Array.isArray(n)&&n.length===2&&typeof n[0]==="number"&&Number.isFinite(n[0])&&typeof n[1]==="number"&&Number.isFinite(n[1])&&(t.off==null||typeof t.off==="boolean")&&(t.mute==null||Array.isArray(t.mute)&&t.mute.every((i)=>typeof i==="string"))}function Lh(e){if(typeof e==="boolean")return!0;if(typeof e==="number")return Number.isFinite(e);if(Array.isArray(e))return e.length===2&&e.every((t)=>typeof t==="number"&&Number.isFinite(t));return Eu(e)}function Tl(e){if(e==null||e===!1)return!1;if(Eu(e))return e.off!==!0;return!0}function Vv(e){return Tl(e)||Eu(e)&&e.off===!0}function Hv(e){if(typeof e==="number"&&Number.isFinite(e))return[e,e];if(Array.isArray(e)&&typeof e[0]==="number"&&typeof e[1]==="number")return[e[0],e[1]];if(Eu(e))return[e.strength[0],e.strength[1]];return[1,1]}function zh(e){return Eu(e)&&e.mute!=null?e.mute:[]}function Uv(e){return[...new Set(e.split(",").map((t)=>t.trim()).filter((t)=>t!==""))]}function Cu(e,t){let n=t.strength??Hv(e),i=t.on==null?!Tl(e):!t.on,r=[...t.mute??zh(e)];if(!i&&r.length===0)return[n[0],n[1]];return{strength:[n[0],n[1]],...i?{off:!0}:{},...r.length===0?{}:{mute:r}}}var jv="main";function Au(e){return typeof e==="object"&&e!=null&&!Array.isArray(e)}function c4(e){return Au(e)&&typeof e.name==="string"&&typeof e.prompt==="string"&&typeof e.active==="boolean"}function hr(e){return Au(e)&&Array.isArray(e.lanes)&&e.lanes.every(c4)}function VC(e){return typeof e==="string"||hr(e)}function HC(e){return typeof e==="string"?{lanes:[{name:jv,prompt:e,active:!0}]}:e}function UC(e){let t=e.lanes[0];return e.lanes.length===1&&t!=null&&t.active?t.prompt:null}function jC(e){return e.lanes.map((t)=>`# ${t.name}${t.active?"":" (off)"}
10
+ ${t.prompt}`).join(`
11
+ `)}function FC(e){return Au(e)&&!("lanes"in e)&&Object.values(e).every((t)=>t==null||Lh(t))}function f4(e){return Au(e)&&typeof e.name==="string"&&typeof e.active==="boolean"&&FC(e.loras)}function Xn(e){return Au(e)&&Array.isArray(e.lanes)&&e.lanes.every(f4)}function Bh(e){return FC(e)||Xn(e)}function KC(e){if(!Xn(e))return{record:e,duplicates:[]};let t={},n=[];for(let i of e.lanes){if(!i.active)continue;for(let[r,o]of Object.entries(i.loras)){if(o==null)continue;if(r in t)n.push(r);else t[r]=o}}return{record:t,duplicates:n}}function qC(e){return Xn(e)?e:{lanes:[{name:jv,active:!0,loras:e}]}}function Ph(e){let t=e.lanes[0];return e.lanes.length===1&&t!=null&&t.active?t.loras:null}function $C(e,t){let n=e.lanes.findIndex((i)=>i.active&&i.loras[t]!=null);return n!==-1?n:e.lanes.findIndex((i)=>i.loras[t]!=null)}function GC(e,t,n){let i=(s)=>{let l={...s};if(n==null)delete l[t];else l[t]=n;return l};if(!Xn(e))return i(e);if(e.lanes.length===0)return{lanes:[{name:jv,active:!0,loras:i({})}]};let r=$C(e,t),o=r===-1?0:r;return{lanes:e.lanes.map((s,l)=>l===o?{...s,loras:i(s.loras)}:s)}}function Ou(e){let t=new Set(e.map((i)=>i.name)),n=e.length+1;while(t.has(`lane ${n}`))n++;return`lane ${n}`}function Qn(e,t,n){return e.map((i,r)=>r===t?{...i,...n}:i)}function Ih(e,t,n){let i=t+n;if(t<0||t>=e.length||i<0||i>=e.length)return[...e];let r=[...e],[o]=r.splice(t,1);if(o!=null)r.splice(i,0,o);return r}function Vh(e,t){return e.filter((n,i)=>i!==t)}function WC(e,t){let n=e.lanes[t.from],i=n?.loras[t.name];if(n==null||i==null||e.lanes[t.to]==null)return e;let r=e.lanes.map((u)=>({...u,loras:{...u.loras}})),o=r[t.from],s=r[t.to];if(o==null||s==null)return e;delete o.loras[t.name];let l={},a=!1;for(let[u,c]of Object.entries(s.loras)){if(u===t.beforeName&&!a)l[t.name]=i,a=!0;l[u]=c}if(!a)l[t.name]=i;return s.loras=l,{lanes:r}}function Fv(e,t){if(!Xn(e))return e[t];return e.lanes[$C(e,t)]?.loras[t]}function YC(e){let t=new Map,n=Xn(e)?e.lanes:[{name:"",active:!0,loras:e}];for(let i of n)for(let[r,o]of Object.entries(i.loras)){if(o==null||o===!1)continue;let s=i.active&&Tl(o),l=t.get(r);if(l==null||!l.running&&s)t.set(r,{name:r,setting:o,running:s})}return[...t.values()]}function XC(e){let t={};for(let n of e)if(n.kind!=="seed")t[n.name]=n.value;return t}function ns(e){if(typeof e==="number"&&Number.isFinite(e))return{mode:"=",value:e};if(e!=null&&typeof e==="object"){let t=e;return{mode:typeof t.mode==="string"?t.mode:"=",value:typeof t.value==="number"&&Number.isFinite(t.value)?t.value:0}}return{mode:"=",value:0}}function Ru(e){if(e!=null&&typeof e==="object"){let t=e;if(typeof t.width==="number"&&typeof t.height==="number")return{width:t.width,height:t.height}}return{width:1024,height:1024}}function Ml(e,t){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let n=new Set(t),i={};for(let[r,o]of Object.entries(e))if(n.has(r)&&Lh(o)&&Vv(o))i[r]=o;return i}function h4(e,t){if(Xn(e))return{lanes:e.lanes.map((n)=>({...n,loras:Ml(n.loras,t)}))};return Ml(e,t)}function QC(e,t){if(e.kind==="seed")return ns(t??e.default);if(e.kind==="size")return Ru(t??e.default);if(e.kind==="loras")return h4(t??e.default,e.options??[]);if(e.kind==="choice")return IC({select:e.select??"one",choices:e.choices??[],raw:t??e.default});return t??e.default}function JC(){return Math.floor(Math.random()*4294967296)}function ZC(e){return Tl(e)}function eA(e){let[t,n]=Hv(e);return{model:t,clip:n}}function tA(e,t,n){return{...e,[t]:Cu(e[t],{on:n})}}function nA(e){let t=new Set(e.options);return Object.keys(e.record).filter((n)=>t.has(n)&&Vv(e.record[n]))}function iA(e){let t=[...e.displayed],[n]=t.splice(e.from,1);if(n==null)return e.record;t.splice(e.to,0,n);let i={};for(let r of t)if(r in e.record)i[r]=e.record[r];for(let[r,o]of Object.entries(e.record))if(!(r in i))i[r]=o;return i}function rA(e,t,n){return{...e,[t]:Cu(e[t],{strength:[n.model,n.clip]})}}function oA(e){if(e.target.kind==="image")return{url:e.target.url,title:e.target.title,promptId:e.target.promptId};let t=e.target.module,n=e.results.filter((o)=>o.module===t),i=n.length>e.target.after?n[0]:void 0,r=i?.images.find((o)=>o.url!=null);if(!e.isRunning&&r?.url!=null)return{url:r.url,title:r.filename,promptId:i?.promptId??null};return{url:ku({module:t,tick:e.previewTick}),title:"latent preview",promptId:null}}async function sA(e){let t=await fetch(e);if(!t.ok)throw Error(`fetch failed (http ${t.status})`);let n=await t.blob(),i=n.type==="image/png"?n:await d4(n);await navigator.clipboard.write([new ClipboardItem({"image/png":i})])}async function d4(e){let t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;let i=n.getContext("2d");if(i==null)throw Error("canvas 2d context unavailable");return i.drawImage(t,0,0),await new Promise((r,o)=>{n.toBlob((s)=>{if(s==null)o(Error("png encode failed"));else r(s)},"image/png")})}var lA=typeof navigator<"u"&&navigator.clipboard!=null;function p4(){return ro(()=>({copyNote:null,lightbox:null,zoom:1,panX:0,panY:0,setCopyNote(e,t){this.copyNote={url:e,text:t}},openLightbox(e){this.lightbox=e,this.resetZoom()},closeLightbox(){this.lightbox=null,this.resetZoom()},zoomBy(e,t){let n=Math.min(8,Math.max(1,this.zoom*e));if(n===this.zoom)return;let i=n/this.zoom;if(this.panX=t.x-(t.x-this.panX)*i,this.panY=t.y-(t.y-this.panY)*i,this.zoom=n,n===1)this.panX=0,this.panY=0},panBy(e,t){if(this.zoom===1)return;this.panX+=e,this.panY+=t},resetZoom(){this.zoom=1,this.panX=0,this.panY=0}}))}var m4=X(function(t){let n=t.local.lightbox,i=n==null?null:oA({target:n,isRunning:t.st.run.isRunning,previewTick:t.st.run.previewTick,results:t.st.run.results});te(()=>{if(n==null)return;let s=(l)=>{if(l.key==="Escape")t.local.closeLightbox()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n,t.local]);let r=q(null);if(te(()=>{let s=r.current;if(s==null)return;let l=(a)=>{a.preventDefault();let u=s.getBoundingClientRect();t.local.zoomBy(a.deltaY<0?1.2:0.8333333333333334,{x:a.clientX-u.left-u.width/2,y:a.clientY-u.top-u.height/2})};return s.addEventListener("wheel",l,{passive:!1}),()=>s.removeEventListener("wheel",l)},[n,t.local]),i==null)return null;let o=()=>{sA(i.url).then(()=>t.local.setCopyNote(i.url,"copied ✓")).catch((s)=>t.local.setCopyNote(i.url,`copy failed: ${s instanceof Error?s.message:String(s)}`))};return p("div",{className:"modal-overlay",onClick:()=>t.local.closeLightbox(),children:w("div",{className:"lightbox",onClick:(s)=>s.stopPropagation(),children:[p("div",{ref:r,className:t.local.zoom>1?"zoom-view grabbing":"zoom-view",onDoubleClick:()=>t.local.resetZoom(),onPointerDown:(s)=>{if(t.local.zoom===1)return;s.currentTarget.setPointerCapture(s.pointerId)},onPointerMove:(s)=>{if(s.buttons!==1)return;t.local.panBy(s.movementX,s.movementY)},children:p("img",{src:i.url,alt:i.title,draggable:!1,style:{transform:`translate(${t.local.panX}px, ${t.local.panY}px) scale(${t.local.zoom})`}})}),w("div",{className:"lightbox-bar",children:[p("span",{className:"hint","data-tip":i.title,children:i.title}),t.local.zoom>1?w("button",{type:"button","data-tip":"back to fit (or double click the image)",onClick:()=>t.local.resetZoom(),children:[t.local.zoom.toFixed(1),"× · fit"]}):p("span",{className:"hint",children:"scroll to zoom"}),lA?p("button",{type:"button",onClick:o,children:"copy"}):null,p("a",{href:i.url,target:"_blank",rel:"noreferrer",children:"open ↗"}),i.promptId!=null?t.st.hostActions.map((s)=>{let l=t.st.run.results.find((u)=>u.promptId===i.promptId),a=l?.images.findIndex((u)=>u.url===i.url)??-1;if(l==null||a<0)return null;return p("button",{type:"button",className:"host-action","data-tip":s.title,onClick:()=>t.st.postResultAction(s.id,l,{url:i.url,filename:i.title},a),children:s.label},s.id)}):null,i.promptId!=null?p("button",{type:"button","data-tip":"remove this result",onClick:()=>{if(i.promptId!=null)t.st.run.remove(i.promptId);t.local.closeLightbox()},children:"delete"}):null,t.local.copyNote?.url===i.url?p("span",{className:"hint",children:t.local.copyNote.text}):null,p("button",{type:"button","data-tip":"close (esc)",onClick:()=>t.local.closeLightbox(),children:p(H,{name:"close"})})]})]})})});function aA(e){let t=e.indexOf("</think>");if(t===-1)return e.trimStart().startsWith("<think>")?{thinking:e.replace(/^\s*<think>/,"").trim(),answer:""}:{thinking:null,answer:e.trim()};let n=e.slice(0,t).replace(/^\s*<think>/,"").trim();return{thinking:n===""?null:n,answer:e.slice(t+8).trim()}}var g4=X(function(t){let n=ro(()=>({showThinking:!1,copied:!1,toggle(){this.showThinking=!this.showThinking},markCopied(){this.copied=!0}})),{thinking:i,answer:r}=aA(t.entry.text);return w("div",{className:"run-text",children:[w("div",{className:"run-text-head",children:[p("span",{className:"hint",children:t.entry.nodeKey??"text"}),i!=null?p("button",{type:"button",className:"link","data-tip":"the model's reasoning, before its answer",onClick:()=>n.toggle(),children:n.showThinking?"hide thinking":"thinking"}):null,lA?w("button",{type:"button",className:"link","data-tip":"copy this text",onClick:()=>{navigator.clipboard.writeText(r===""?t.entry.text:r),n.markCopied()},children:[p(H,{name:"copy"})," ",n.copied?"copied":""]}):null]}),i!=null&&n.showThinking?p("pre",{className:"run-thinking",children:i}):null,r===""?p("div",{className:"noimg",children:"the model reasoned past its token budget and never answered — raise max tokens"}):p("pre",{className:"run-text-body",children:r})]})}),v4=X(function(t){let{thinking:n,answer:i}=aA(t.text),r=q(null);te(()=>{let s=r.current;if(s!=null)s.scrollTop=s.scrollHeight});let o=i!==""?i:n??"";return w("div",{className:"run-live",children:[i===""&&n!=null?p("span",{className:"hint",children:"thinking…"}):null,p("pre",{ref:r,className:i===""?"run-live-body dim":"run-live-body",children:o})]})}),b4=X(function(t){let n=t.st.run.progressPercent,i=t.st.run.progressNode,r=t.st.run.progressCount;return p("div",{className:"corner-run-anchor",children:w("div",{className:"corner-run",children:[t.st.run.hasPreview?p("button",{type:"button",className:"img-button","data-tip":"the latent so far: click to see it big",onClick:()=>t.local.openLightbox({kind:"latent",module:t.module,after:t.st.run.results.filter((o)=>o.module===t.module).length}),children:p("img",{src:ku({module:t.module,tick:t.st.run.previewTick}),alt:"latent preview"})}):null,w("div",{className:"corner-run-meta",children:[w("span",{className:"run-meta-text",children:[i==null?t.module:i,r!=null?` ${r.value}/${r.max}`:""]}),p("span",{children:n!=null?`${Math.round(n)}%`:""})]}),p("div",{className:"progress-track",children:p("div",{className:"progress-fill",style:{width:`${n??0}%`}})})]})})}),y4=X(function(t){let n=t.st.run.runningModule;if(!t.st.run.isRunning||n==null)return null;if(t.st.latentMode==="corner")return p(b4,{st:t.st,local:t.local,module:n});let i=t.st.run.progressPercent,r=ku({module:n,tick:t.st.run.previewTick}),o=t.st.run.progressNode,s=t.st.run.progressCount,l=t.st.run.progressText,a=t.st.form,u=a?.moduleKey===n?a.vars.find((d)=>d.desc.kind==="size"):void 0,c=u==null?null:Ru(u.value),f=c!=null||t.st.run.hasPreview,h=c==null?1:c.width/c.height;return w("div",{className:"run-card running",children:[w("div",{className:"meta",children:[w("span",{className:"run-meta-text",children:["generating ",n,"…",o!=null?` · ${o}${s!=null?` ${s.value}/${s.max}`:""}`:""]}),p("span",{children:i!=null?`${Math.round(i)}%`:""})]}),l!=null&&l!==""?p(v4,{text:l}):null,f?w("div",{className:"run-frame",style:{aspectRatio:String(h),width:t.st.resultsView==="fit"?"100%":`min(100%, ${t.st.resultsSize}px, calc(${t.st.resultsSize}px * ${h}))`},children:[t.st.run.hasPreview&&t.st.latentMode==="full"?p("button",{type:"button",className:"img-button",onClick:()=>t.local.openLightbox({kind:"latent",module:n,after:t.st.run.results.filter((d)=>d.module===n).length}),children:p("img",{src:r,alt:"latent preview"})}):null,p("div",{className:"progress-track over",children:p("div",{className:"progress-fill",style:{width:`${i??0}%`}})})]}):p("div",{className:"progress-track",children:p("div",{className:"progress-fill",style:{width:`${i??0}%`}})})]})}),uA=X(function(t){let n=p4();if(t.st.run.results.length===0&&!t.st.run.isRunning)return null;let i=t.compact===!0?t.st.run.results.slice(0,1):t.st.run.results;return w("div",{className:`gallery${t.st.blurResults?" blur":""}${t.compact===!0?"":` view-${t.st.resultsView}`}`,children:[p(y4,{st:t.st,local:n}),i.map((r)=>w("div",{className:"run-card",children:[w("div",{className:"meta",children:[w("span",{children:[r.at," · ",r.module,"/",r.draft," · ",(r.durationMs/1000).toFixed(1),"s",Object.entries(r.seeds).map(([o,s])=>` · ${o}: ${s}`)]}),p("button",{type:"button",className:"link","data-tip":"remove this result",onClick:()=>t.st.run.remove(r.promptId),children:p(H,{name:"trash"})})]}),w("div",{className:"imgs",children:[r.images.map((o,s)=>o.url!=null?w("div",{className:"img-cell",children:[p("button",{type:"button",className:"img-button","data-tip":o.filename,onClick:()=>{if(o.url!=null)n.openLightbox({kind:"image",url:o.url,title:o.filename,promptId:r.promptId})},children:p("img",{src:o.url,alt:o.filename,style:t.st.resultsView==="grid"&&t.compact!==!0?{maxWidth:`min(100%, ${t.st.resultsSize}px)`,maxHeight:t.st.resultsSize}:void 0})}),t.st.hostActions.length>0?w("div",{className:"host-actions",children:[t.st.hostActions.map((l)=>p("button",{type:"button",className:"host-action","data-tip":l.title,onClick:()=>{if(o.url!=null)t.st.postResultAction(l.id,r,{url:o.url,filename:o.filename},s)},children:l.label},l.id)),p("button",{type:"button",className:"host-action danger","data-tip":"remove this result",onClick:()=>t.st.run.remove(r.promptId),children:"✕"})]}):null]},o.filename):w("div",{className:"noimg",children:[o.filename," (not saved locally — no preview)"]},o.filename)),r.images.length===0&&(r.texts??[]).length===0?p("div",{className:"noimg",children:"no outputs"}):null]}),(r.texts??[]).map((o,s)=>p(g4,{entry:o},`${r.promptId}-${s}`))]},r.promptId)),p(m4,{st:t.st,local:n})]})});var cA=[{mode:"corner",tip:"latent small, in a corner: the last image stays where it is, the new one lands at once when done"},{mode:"full",tip:"latent full size, in the running card at the top of the results"},{mode:"off",tip:"no latent: a progress bar, then the image"}];function fA(e){if(e==="full"||e==="corner"||e==="off")return e;if(e===!1)return"off";return"corner"}function hA(e){te(()=>{let t=(n)=>{if(!(n.metaKey||n.ctrlKey)||n.altKey||n.shiftKey)return;if(n.key!=="k"&&n.key!=="K"&&n.key!=="j"&&n.key!=="J")return;n.preventDefault(),e.omnibox.toggle()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e])}var dA=X(function(t){let n=t.st.omnibox,i=q(null);if(te(()=>{i.current?.querySelector(".omni-row.sel")?.scrollIntoView({block:"nearest"})},[n.cursor,n.query]),!n.isOpen)return null;let r=n.results,o=Object.entries(t.st.loadErrors),s=t.st.form;return p("div",{className:"modal-overlay omni-overlay",onClick:()=>n.close(),children:w("div",{className:"modal omni",onClick:(l)=>l.stopPropagation(),children:[p("div",{className:"modal-head",children:p("input",{type:"text",autoFocus:!0,placeholder:"workflow or draft…",value:n.query,onChange:(l)=>n.setQuery(l.target.value),onKeyDown:(l)=>{if(l.key==="ArrowDown")n.move(1);else if(l.key==="ArrowUp")n.move(-1);else if(l.key==="Enter")n.pick();else if(l.key==="Escape")n.close();else return;l.preventDefault()}})}),w("div",{className:"modal-body omni-list",ref:i,children:[r.length===0?p("div",{className:"hint",children:"no workflow or draft matches"}):null,r.map((l,a)=>{let u=s?.moduleKey===l.module&&s.draft===l.draft,c=["omni-row",a===n.cursor?"sel":"",u?"open":""].join(" ");return w("button",{type:"button",className:c,onClick:()=>n.pick(l),children:[p("span",{className:"omni-label",children:l.label}),p("span",{className:"omni-host",children:u?"open":l.host})]},`${l.module}/${l.draft}`)}),o.length>0?w("div",{className:"omni-errors",children:[p("div",{className:"section-title",children:"failed to load"}),o.map(([l,a])=>w("div",{children:[p("div",{className:"file",children:l}),p("div",{className:"msg",children:a})]},l))]}):null]})]})})});function Hh(){return typeof window<"u"}function lo(e){if(Uh(e))return(e.nodeName||"").toLowerCase();return"#document"}function Et(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ai(e){var t;return(t=(Uh(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Uh(e){if(!Hh())return!1;return e instanceof Node||e instanceof Et(e).Node}function Ct(e){if(!Hh())return!1;return e instanceof Element||e instanceof Et(e).Element}function Jn(e){if(!Hh())return!1;return e instanceof HTMLElement||e instanceof Et(e).HTMLElement}function Nu(e){if(!Hh()||typeof ShadowRoot>"u")return!1;return e instanceof ShadowRoot||e instanceof Et(e).ShadowRoot}function Tu(e){let{overflow:t,overflowX:n,overflowY:i,display:r}=Tn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&r!=="inline"&&r!=="contents"}function pA(e){return/^(table|td|th)$/.test(lo(e))}function Mu(e){try{if(e.matches(":popover-open"))return!0}catch(t){}try{return e.matches(":modal")}catch(t){return!1}}var x4=/transform|translate|scale|rotate|perspective|filter/,w4=/paint|layout|strict|content/,is=(e)=>!!e&&e!=="none",Kv;function jh(e){let t=Ct(e)?Tn(e):e;return is(t.transform)||is(t.translate)||is(t.scale)||is(t.rotate)||is(t.perspective)||!_u()&&(is(t.backdropFilter)||is(t.filter))||x4.test(t.willChange||"")||w4.test(t.contain||"")}function mA(e){let t=dr(e);while(Jn(t)&&!rs(t)){if(jh(t))return t;else if(Mu(t))return null;t=dr(t)}return null}function _u(){if(Kv==null)Kv=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none");return Kv}function rs(e){return/^(html|body|#document)$/.test(lo(e))}function Tn(e){return Et(e).getComputedStyle(e)}function Du(e){if(Ct(e))return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop};return{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function dr(e){if(lo(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Nu(e)&&e.host||Ai(e);return Nu(t)?t.host:t}function gA(e){let t=dr(e);if(rs(t))return(e.ownerDocument||e).body;if(Jn(t)&&Tu(t))return t;return gA(t)}function pr(e,t,n){var i;if(t===void 0)t=[];if(n===void 0)n=!0;let r=gA(e),o=r===((i=e.ownerDocument)==null?void 0:i.body),s=Et(r);if(o){let l=Fh(s);return t.concat(s,s.visualViewport||[],Tu(r)?r:[],l&&n?pr(l):[])}else return t.concat(r,pr(r,[],n))}function Fh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var{min:_l,max:mr,round:zu,floor:Bu}=Math,Oi=(e)=>({x:e,y:e}),S4={left:"right",right:"left",bottom:"top",top:"bottom"};function yA(e,t,n){return mr(e,_l(t,n))}function Pu(e,t){return typeof e==="function"?e(t):e}function os(e){return e.split("-")[0]}function Iu(e){return e.split("-")[1]}function qv(e){return e==="x"?"y":"x"}function $v(e){return e==="y"?"height":"width"}function gr(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function Gv(e){return qv(gr(e))}function xA(e,t,n){if(n===void 0)n=!1;let i=Iu(e),r=Gv(e),o=$v(r),s=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";if(t.reference[o]>t.floating[o])s=Lu(s);return[s,Lu(s)]}function wA(e){let t=Lu(e);return[Kh(e),t,Kh(t)]}function Kh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var vA=["left","right"],bA=["right","left"],k4=["top","bottom"],E4=["bottom","top"];function C4(e,t,n){switch(e){case"top":case"bottom":if(n)return t?bA:vA;return t?vA:bA;case"left":case"right":return t?k4:E4;default:return[]}}function SA(e,t,n,i){let r=Iu(e),o=C4(os(e),n==="start",i);if(r){if(o=o.map((s)=>s+"-"+r),t)o=o.concat(o.map(Kh))}return o}function Lu(e){let t=os(e);return S4[t]+e.slice(t.length)}function A4(e){var t,n,i,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(i=e.bottom)!=null?i:0,left:(r=e.left)!=null?r:0}}function kA(e){return typeof e!=="number"?A4(e):{top:e,right:e,bottom:e,left:e}}function ss(e){let{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}/*!
12
+ * tabbable 6.5.0
13
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
14
+ */var O4=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],Wv=O4.join(","),AA=typeof Element>"u",Vu=AA?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qh=!AA&&Element.prototype.getRootNode?function(e){var t;return e===null||e===void 0?void 0:(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e===null||e===void 0?void 0:e.ownerDocument},$h=function(t,n){var i;if(n===void 0)n=!0;var r=t===null||t===void 0?void 0:(i=t.getAttribute)===null||i===void 0?void 0:i.call(t,"inert"),o=r===""||r==="true",s=o||n&&t&&(typeof t.closest==="function"?t.closest("[inert]"):$h(t.parentNode));return s},R4=function(t){var n,i=t===null||t===void 0?void 0:(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return i===""||i==="true"},N4=function(t,n,i){if($h(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(Wv));if(n&&Vu.call(t,Wv))r.unshift(t);return r=r.filter(i),r},Yv=function(t,n,i){var r=[],o=Array.from(t);while(o.length){var s=o.shift();if($h(s,!1))continue;if(s.tagName==="SLOT"){var l=s.assignedElements(),a=l.length?l:s.children,u=Yv(a,!0,i);if(i.flatten)r.push.apply(r,u);else r.push({scopeParent:s,candidates:u})}else{var c=Vu.call(s,Wv);if(c&&i.filter(s)&&(n||!t.includes(s)))r.push(s);var f=s.shadowRoot||typeof i.getShadowRoot==="function"&&i.getShadowRoot(s),h=!$h(f,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(s));if(f&&h){var d=Yv(f===!0?s.children:f.children,!0,i);if(i.flatten)r.push.apply(r,d);else r.push({scopeParent:s,candidates:d})}else o.unshift.apply(o,s.children)}}return r},OA=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},RA=function(t){if(!t)throw Error("No node provided");if(t.tabIndex<0){if((/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||R4(t))&&!OA(t))return 0}return t.tabIndex},T4=function(t,n){var i=RA(t);if(i<0&&n&&!OA(t))return 0;return i},M4=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},NA=function(t){return t.tagName==="INPUT"},_4=function(t){return NA(t)&&t.type==="hidden"},D4=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(i){return i.tagName==="SUMMARY"});return n},L4=function(t,n){for(var i=0;i<t.length;i++)if(t[i].checked&&t[i].form===n)return t[i]},z4=function(t){if(!t.name)return!0;var n=t.form||qh(t),i=function(l){return n.querySelectorAll('input[type="radio"][name="'+l+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape==="function")r=i(window.CSS.escape(t.name));else try{r=i(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var o=L4(r,t.form);return!o||o===t},B4=function(t){return NA(t)&&t.type==="radio"},P4=function(t){return B4(t)&&!z4(t)},I4=function(t){var n,i=t&&qh(t),r=(n=i)===null||n===void 0?void 0:n.host,o=!1;if(i&&i!==t){var s,l,a;o=!!((s=r)!==null&&s!==void 0&&(l=s.ownerDocument)!==null&&l!==void 0&&l.contains(r)||t!==null&&t!==void 0&&(a=t.ownerDocument)!==null&&a!==void 0&&a.contains(t));while(!o&&r){var u,c,f;i=qh(r),r=(u=i)===null||u===void 0?void 0:u.host,o=!!((c=r)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(r))}}return o},EA=function(t){var n=t.getBoundingClientRect(),{width:i,height:r}=n;return i===0&&r===0},V4=function(t,n){var{displayCheck:i,getShadowRoot:r}=n;if(i==="full-native"){if("checkVisibility"in t){var o=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}}var s=getComputedStyle(t),l=s.visibility;if(l==="hidden"||l==="collapse")return!0;var a=Vu.call(t,"details>summary:first-of-type"),u=a?t.parentElement:t;if(Vu.call(u,"details:not([open]) *"))return!0;if(!i||i==="full"||i==="full-native"||i==="legacy-full"){if(typeof r==="function"){var c=t;while(t){var f=t.parentElement,h=qh(t);if(f&&!f.shadowRoot&&r(f)===!0)return EA(t);else if(t.assignedSlot)t=t.assignedSlot;else if(!f&&h!==t.ownerDocument)t=h.host;else t=f}t=c}if(I4(t))return!t.getClientRects().length;if(i!=="legacy-full")return!0}else if(i==="non-zero-area")return EA(t);return!1},H4=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName)){var n=t.parentElement;while(n){if(n.tagName==="FIELDSET"&&n.disabled){for(var i=0;i<n.children.length;i++){var r=n.children.item(i);if(r.tagName==="LEGEND")return Vu.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}}return!1},U4=function(t,n){if(n.disabled||_4(n)||V4(n,t)||D4(n)||H4(n))return!1;return!0},CA=function(t,n){if(P4(n)||RA(n)<0||!U4(t,n))return!1;return!0},j4=function(t){var n=parseInt(t.getAttribute("tabindex"),10);if(isNaN(n)||n>=0)return!0;return!1},TA=function(t){var n=[],i=[];return t.forEach(function(r,o){var s=!!r.scopeParent,l=s?r.scopeParent:r,a=T4(l,s),u=s?TA(r.candidates):l;if(a===0)s?n.push.apply(n,u):n.push(l);else i.push({documentOrder:o,tabIndex:a,item:r,isScope:s,content:u})}),i.sort(M4).reduce(function(r,o){return o.isScope?r.push.apply(r,o.content):r.push(o.content),r},[]).concat(n)},Xv=function(t,n){n=n||{};var i;if(n.getShadowRoot)i=Yv([t],n.includeContainer,{filter:CA.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:j4});else i=N4(t,n.includeContainer,CA.bind(null,n));return TA(i)};function MA(){return/apple/i.test(navigator.vendor)}function _A(e){let t=e.activeElement;while(((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null){var n;t=t.shadowRoot.activeElement}return t}function DA(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Nu(n)){let i=t;while(i){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function Gh(e){return(e==null?void 0:e.ownerDocument)||document}var F4=typeof document<"u",K4=function(){},ao=F4?Vi:K4,q4={...Ii};var $4=q4.useInsertionEffect,G4=$4||((e)=>e());function LA(e){let t=q(()=>{});return G4(()=>{t.current=e}),ft(function(){for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];return t.current==null?void 0:t.current(...i)},[])}var Qv=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver==="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function zA(e,t){let n=Xv(e,Qv()),i=n.length;if(i===0)return;let r=_A(Gh(e)),o=n.indexOf(r),s=o===-1?t===1?0:i-1:o+t;return n[s]}function BA(e){return zA(Gh(e).body,1)||e}function PA(e){return zA(Gh(e).body,-1)||e}function Wh(e,t){let n=t||e.currentTarget,i=e.relatedTarget;return!i||!DA(n,i)}function IA(e){Xv(e,Qv()).forEach((n)=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Jv(e){e.querySelectorAll("[data-tabindex]").forEach((n)=>{let i=n.dataset.tabindex;if(delete n.dataset.tabindex,i)n.setAttribute("tabindex",i);else n.removeAttribute("tabindex")})}function VA(e,t,n){let{reference:i,floating:r}=e,o=gr(t),s=Gv(t),l=$v(s),a=os(t),u=o==="y",c=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2,h=i[l]/2-r[l]/2,d;switch(a){case"top":d={x:c,y:i.y-r.height};break;case"bottom":d={x:c,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:f};break;case"left":d={x:i.x-r.width,y:f};break;default:d={x:i.x,y:i.y}}let m=Iu(t);if(m)d[s]+=h*(m==="end"?1:-1)*(n&&u?-1:1);return d}async function HA(e,t){var n;if(t===void 0)t={};let{x:i,y:r,platform:o,rects:s,elements:l,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:h=!1,padding:d=0}=Pu(t,e),m=kA(d),x=l[h?f==="floating"?"reference":"floating":f],g=ss(await o.getClippingRect({element:((n=await(o.isElement==null?void 0:o.isElement(x)))!=null?n:!0)?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),v=f==="floating"?{x:i,y:r,width:s.floating.width,height:s.floating.height}:s.reference,y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),S=await(o.isElement==null?void 0:o.isElement(y))&&await(o.getScale==null?void 0:o.getScale(y))||{x:1,y:1},k=ss(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:y,strategy:a}):v);return{top:(g.top-k.top+m.top)/S.y,bottom:(k.bottom-g.bottom+m.bottom)/S.y,left:(g.left-k.left+m.left)/S.x,right:(k.right-g.right+m.right)/S.x}}var W4=50,UA=async(e,t,n)=>{let{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:HA},a=await(s.isRTL==null?void 0:s.isRTL(t)),u=await s.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:f}=VA(u,i,a),h=i,d=0,m={};for(let b=0;b<o.length;b++){let x=o[b];if(!x)continue;let{name:g,fn:v}=x,{x:y,y:S,data:k,reset:A}=await v({x:c,y:f,initialPlacement:i,placement:h,strategy:r,middlewareData:m,rects:u,platform:l,elements:{reference:e,floating:t}});if(c=y!=null?y:c,f=S!=null?S:f,m[g]={...m[g],...k},A&&d<W4){if(d++,typeof A==="object"){if(A.placement)h=A.placement;if(A.rects)u=A.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:r}):A.rects;({x:c,y:f}=VA(u,h,a))}b=-1}}return{x:c,y:f,placement:h,strategy:r,middlewareData:m}};var jA=function(e){if(e===void 0)e={};return{name:"flip",options:e,async fn(t){var n,i;let{placement:r,middlewareData:o,rects:s,initialPlacement:l,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:b=!0,...x}=Pu(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};let g=os(r),v=gr(l),y=os(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(u.floating)),k=h||(y||!b?[Lu(l)]:wA(l)),A=m!=="none";if(!h&&A)k.push(...SA(l,b,m,S));let E=[l,...k],O=await a.detectOverflow(t,x),T=[],_=((i=o.flip)==null?void 0:i.overflows)||[];if(c)T.push(O[g]);if(f){let K=xA(r,s,S);T.push(O[K[0]],O[K[1]])}if(_=[..._,{placement:r,overflows:T}],!T.every((K)=>K<=0)){var L,B;let K=(((L=o.flip)==null?void 0:L.index)||0)+1,I=E[K];if(I){if(!(f==="alignment"?v!==gr(I):!1)||_.every((F)=>gr(F.placement)===v?F.overflows[0]>0:!0))return{data:{index:K,overflows:_},reset:{placement:I}}}let j=(B=_.filter((ee)=>ee.overflows[0]<=0).sort((ee,F)=>ee.overflows[1]-F.overflows[1])[0])==null?void 0:B.placement;if(!j)switch(d){case"bestFit":{var W;let ee=(W=_.filter((F)=>{if(A){let fe=gr(F.placement);return fe===v||fe==="y"}return!0}).map((F)=>[F.placement,F.overflows.filter((fe)=>fe>0).reduce((fe,Ye)=>fe+Ye,0)]).sort((F,fe)=>F[1]-fe[1])[0])==null?void 0:W[0];if(ee)j=ee;break}case"initialPlacement":j=l;break}if(r!==j)return{reset:{placement:j}}}return{}}}};var Y4=new Set(["left","top"]);async function X4(e,t){let{placement:n,platform:i,elements:r}=e,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),s=os(n),l=Iu(n),a=gr(n)==="y",u=Y4.has(s)?-1:1,c=o&&a?-1:1,f=Pu(t,e),{mainAxis:h,crossAxis:d,alignmentAxis:m}=typeof f==="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};if(l&&typeof m==="number")d=l==="end"?m*-1:m;return a?{x:d*c,y:h*u}:{x:h*u,y:d*c}}var FA=function(e){if(e===void 0)e=0;return{name:"offset",options:e,async fn(t){var n,i;let{x:r,y:o,placement:s,middlewareData:l}=t,a=await X4(t,e);if(s===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset)return{};return{x:r+a.x,y:o+a.y,data:{...a,placement:s}}}}},KA=function(e){if(e===void 0)e={};return{name:"shift",options:e,async fn(t){let{x:n,y:i,placement:r,platform:o}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:(v)=>{let{x:y,y:S}=v;return{x:y,y:S}}},...u}=Pu(e,t),c={x:n,y:i},f=await o.detectOverflow(t,u),h=gr(r),d=qv(h),m=c[d],b=c[h],x=(v,y)=>yA(y+f[v==="y"?"top":"left"],y,y-f[v==="y"?"bottom":"right"]);if(s)m=x(d,m);if(l)b=x(h,b);let g=a.fn({...t,[d]:m,[h]:b});return{...g,data:{x:g.x-n,y:g.y-i,enabled:{[d]:s,[h]:l}}}}}};function GA(e){let t=Tn(e),n=parseFloat(t.width)||0,i=parseFloat(t.height)||0,r=Jn(e),o=r?e.offsetWidth:n,s=r?e.offsetHeight:i,l=zu(n)!==o||zu(i)!==s;if(l)n=o,i=s;return{width:n,height:i,$:l}}function eb(e){return!Ct(e)?e.contextElement:e}function Dl(e){let t=eb(e);if(!Jn(t))return Oi(1);let n=t.getBoundingClientRect(),{width:i,height:r,$:o}=GA(t),s=(o?zu(n.width):n.width)/i,l=(o?zu(n.height):n.height)/r;if(!s||!Number.isFinite(s))s=1;if(!l||!Number.isFinite(l))l=1;return{x:s,y:l}}var Q4=Oi(0);function WA(e){let t=Et(e);if(!_u()||!t.visualViewport)return Q4;return{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function J4(e,t,n){if(t===void 0)t=!1;return!!n&&t&&n===Et(e)}function ls(e,t,n,i){if(t===void 0)t=!1;if(n===void 0)n=!1;let r=e.getBoundingClientRect(),o=eb(e),s=Oi(1);if(t)if(i){if(Ct(i))s=Dl(i)}else s=Dl(e);let l=J4(o,n,i)?WA(o):Oi(0),a=(r.left+l.x)/s.x,u=(r.top+l.y)/s.y,c=r.width/s.x,f=r.height/s.y;if(o&&i){let h=Et(o),d=Ct(i)?Et(i):i,m=h,b=Fh(m);while(b&&d!==m){let x=Dl(b),g=b.getBoundingClientRect(),v=Tn(b),y=g.left+(b.clientLeft+parseFloat(v.paddingLeft))*x.x,S=g.top+(b.clientTop+parseFloat(v.paddingTop))*x.y;a*=x.x,u*=x.y,c*=x.x,f*=x.y,a+=y,u+=S,m=Et(b),b=Fh(m)}}return ss({width:c,height:f,x:a,y:u})}function Yh(e,t){let n=Du(e).scrollLeft;if(!t)return ls(Ai(e)).left+n;return t.left+n}function YA(e,t){let n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-Yh(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function Z4(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e,o=r==="fixed",s=Ai(i),l=t?Mu(t.floating):!1;if(i===s||l&&o)return n;let a={scrollLeft:0,scrollTop:0},u=Oi(1),c=Oi(0),f=Jn(i);if(f||!o){if(lo(i)!=="body"||Tu(s))a=Du(i);if(f){let d=ls(i);u=Dl(i),c.x=d.x+i.clientLeft,c.y=d.y+i.clientTop}}let h=s&&!f&&!o?YA(s,a):Oi(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+h.x,y:n.y*u.y-a.scrollTop*u.y+c.y+h.y}}function e3(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function t3(e){let t=Du(e),n=e.ownerDocument.body,i=mr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=mr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),o=-t.scrollLeft+Yh(e),s=-t.scrollTop;if(Tn(n).direction==="rtl")o+=mr(e.clientWidth,n.clientWidth)-i;return{width:i,height:r,x:o,y:s}}var n3=25;function i3(e,t,n){if(n===void 0)n="viewport";let i=n==="layoutViewport",r=Et(e),o=Ai(e),s=r.visualViewport,{clientWidth:l,clientHeight:a}=o,u=0,c=0;if(s){let h=!_u()||t==="fixed";if(i){if(!h)u=-s.offsetLeft,c=-s.offsetTop}else if(l=s.width,a=s.height,h)u=s.offsetLeft,c=s.offsetTop}if(Yh(o)<=0){let h=o.ownerDocument,d=h.body,m=getComputedStyle(d),b=h.compatMode==="CSS1Compat"?parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0:0,x=Math.abs(o.clientWidth-d.clientWidth-b),g=getComputedStyle(o).scrollbarGutter==="stable both-edges"?x/2:x;if(g<=n3)l-=g}return{width:l,height:a,x:u,y:c}}function r3(e,t){let n=ls(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,o=Dl(e),s=e.clientWidth*o.x,l=e.clientHeight*o.y,a=r*o.x,u=i*o.y;return{width:s,height:l,x:a,y:u}}function qA(e,t,n){let i;if(t==="viewport"||t==="layoutViewport")i=i3(e,n,t);else if(t==="document")i=t3(Ai(e));else if(Ct(t))i=r3(t,n);else{let r=WA(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return ss(i)}function o3(e,t){let n=t.get(e);if(n)return n;let i=pr(e,[],!1).filter((l)=>Ct(l)&&lo(l)!=="body"),r=null,o=Tn(e).position==="fixed",s=o?dr(e):e;while(Ct(s)&&!rs(s)){let l=Tn(s),a=jh(s),u=r?r.position:o?"fixed":"";if(!a&&(u==="fixed"||u==="absolute"&&l.position==="static"))i=i.filter((f)=>f!==s);else r=l;s=dr(s)}return t.set(e,i),i}function s3(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e,s=[...n==="clippingAncestors"?Mu(t)?[]:o3(t,this._c):[].concat(n),i],l=qA(t,s[0],r),{top:a,right:u,bottom:c,left:f}=l;for(let h=1;h<s.length;h++){let d=qA(t,s[h],r);a=mr(d.top,a),u=_l(d.right,u),c=_l(d.bottom,c),f=mr(d.left,f)}return{width:u-f,height:c-a,x:f,y:a}}function l3(e){let{width:t,height:n}=GA(e);return{width:t,height:n}}function a3(e,t,n){let i=Jn(t),r=Ai(t),o=n==="fixed",s=ls(e,!0,o,t),l={scrollLeft:0,scrollTop:0},a=Oi(0);if(i||!o){if(lo(t)!=="body"||Tu(r))l=Du(t);if(i){let h=ls(t,!0,o,t);a.x=h.x+t.clientLeft,a.y=h.y+t.clientTop}}if(!i&&r)a.x=Yh(r);let u=r&&!i&&!o?YA(r,l):Oi(0),c=s.left+l.scrollLeft-a.x-u.x,f=s.top+l.scrollTop-a.y-u.y;return{x:c,y:f,width:s.width,height:s.height}}function Zv(e){return Tn(e).position==="static"}function $A(e,t){if(!Jn(e)||Tn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;if(Ai(e)===n)n=n.ownerDocument.body;return n}function XA(e,t){let n=Et(e);if(Mu(e))return n;if(!Jn(e)){let r=dr(e);while(r&&!rs(r)){if(Ct(r)&&!Zv(r))return r;r=dr(r)}return n}let i=$A(e,t);while(i&&pA(i)&&Zv(i))i=$A(i,t);if(i&&rs(i)&&Zv(i)&&!jh(i))return n;return i||mA(e)||n}var u3=async function(e){let t=this.getOffsetParent||XA,n=this.getDimensions,i=await n(e.floating);return{reference:a3(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function c3(e){return Tn(e).direction==="rtl"}var tb={convertOffsetParentRelativeRectToViewportRelativeRect:Z4,getDocumentElement:Ai,getClippingRect:s3,getOffsetParent:XA,getElementRects:u3,getClientRects:e3,getDimensions:l3,getScale:Dl,isElement:Ct,isRTL:c3};function QA(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function f3(e,t,n){let i=null,r,o=Ai(e);function s(){var c;clearTimeout(r),(c=i)==null||c.disconnect(),i=null}function l(c,f){if(c===void 0)c=!1;if(f===void 0)f=1;s();let h=e.getBoundingClientRect(),{left:d,top:m,width:b,height:x}=h;if(!c)t();if(!b||!x)return;let g=Bu(m),v=Bu(o.clientWidth-(d+b)),y=Bu(o.clientHeight-(m+x)),S=Bu(d),A={rootMargin:-g+"px "+-v+"px "+-y+"px "+-S+"px",threshold:mr(0,_l(1,f))||1},E=!0;function O(T){let _=T[0].intersectionRatio;if(!QA(h,e.getBoundingClientRect()))return l();if(_!==f){if(!E)return l();if(!_)r=setTimeout(()=>{l(!1,0.0000001)},1000);else l(!1,_)}E=!1}try{i=new IntersectionObserver(O,{...A,root:o.ownerDocument})}catch(T){i=new IntersectionObserver(O,A)}i.observe(e)}let a=Et(e),u=()=>l(n);return a.addEventListener("resize",u),l(!0),()=>{a.removeEventListener("resize",u),s()}}function Xh(e,t,n,i){if(i===void 0)i={};let{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver==="function",layoutShift:l=typeof IntersectionObserver==="function",animationFrame:a=!1}=i,u=eb(e),c=r||o?[...u?pr(u):[],...t?pr(t):[]]:[];c.forEach((g)=>{r&&g.addEventListener("scroll",n),o&&g.addEventListener("resize",n)});let f=u&&l?f3(u,n,o):null,h=-1,d=null;if(s){if(d=new ResizeObserver((g)=>{let[v]=g;if(v&&v.target===u&&d&&t)d.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=d)==null||y.observe(t)});n()}),u&&!a)d.observe(u);if(t)d.observe(t)}let m,b=a?ls(e):null;if(a)x();function x(){let g=ls(e);if(b&&!QA(b,g))n();b=g,m=requestAnimationFrame(x)}return n(),()=>{var g;if(c.forEach((v)=>{r&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),f==null||f(),(g=d)==null||g.disconnect(),d=null,a)cancelAnimationFrame(m)}}var JA=FA;var ZA=KA,eO=jA;var Qh=(e,t,n)=>{let i=new Map,r=n!=null?n:{},o={...tb,...r.platform,_c:i};return UA(e,t,{...r,platform:o})};var d3=typeof document<"u",p3=function(){},Jh=d3?Vi:p3;function Zh(e,t){if(e===t)return!0;if(typeof e!==typeof t)return!1;if(typeof e==="function"&&e.toString()===t.toString())return!0;let n,i,r;if(e&&t&&typeof e==="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;i--!==0;)if(!Zh(e[i],t[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){let o=r[i];if(o==="_owner"&&e.$$typeof)continue;if(!Zh(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function nO(e){if(typeof window>"u")return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tO(e,t){let n=nO(e);return Math.round(t*n)/n}function nb(e){let t=q(e);return Jh(()=>{t.current=e}),t}function iO(e){if(e===void 0)e={};let{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:o,floating:s}={},transform:l=!0,whileElementsMounted:a,open:u}=e,[c,f]=Q({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,d]=Q(i);if(!Zh(h,i))d(i);let[m,b]=Q(null),[x,g]=Q(null),v=ft((F)=>{if(F!==A.current)A.current=F,b(F)},[]),y=ft((F)=>{if(F!==E.current)E.current=F,g(F)},[]),S=o||m,k=s||x,A=q(null),E=q(null),O=q(c),T=a!=null,_=nb(a),L=nb(r),B=nb(u),W=ft(()=>{if(!A.current||!E.current)return;let F={placement:t,strategy:n,middleware:h};if(L.current)F.platform=L.current;Qh(A.current,E.current,F).then((fe)=>{let Ye={...fe,isPositioned:B.current!==!1};if(K.current&&!Zh(O.current,Ye))O.current=Ye,Fc(()=>{f(Ye)})})},[h,t,n,L,B]);Jh(()=>{if(u===!1&&O.current.isPositioned)O.current.isPositioned=!1,f((F)=>({...F,isPositioned:!1}))},[u]);let K=q(!1);Jh(()=>(K.current=!0,()=>{K.current=!1}),[]),Jh(()=>{if(S)A.current=S;if(k)E.current=k;if(S&&k){if(_.current)return _.current(S,k,W);W()}},[S,k,W,_,T]);let I=Je(()=>({reference:A,floating:E,setReference:v,setFloating:y}),[v,y]),j=Je(()=>({reference:S,floating:k}),[S,k]),ee=Je(()=>{let F={position:n,left:0,top:0};if(!j.floating)return F;let fe=tO(j.floating,c.x),Ye=tO(j.floating,c.y);if(l)return{...F,transform:"translate("+fe+"px, "+Ye+"px)",...nO(j.floating)>=1.5&&{willChange:"transform"}};return{position:n,left:fe,top:Ye}},[n,l,j.floating,c.x,c.y]);return Je(()=>({...c,update:W,refs:I,elements:j,floatingStyles:ee}),[c,W,I,j,ee])}var ed=(e,t)=>{let n=JA(e);return{name:n.name,fn:n.fn,options:[e,t]}},ib=(e,t)=>{let n=ZA(e);return{name:n.name,fn:n.fn,options:[e,t]}};var rb=(e,t)=>{let n=eO(e);return{name:n.name,fn:n.fn,options:[e,t]}};var m3="ArrowLeft",g3="ArrowRight",v3="ArrowUp",b3="ArrowDown";var y3=[m3,g3],x3=[v3,b3],eU=[...y3,...x3];var w3={...Ii},rO=!1,S3=0,oO=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+S3++;function k3(){let[e,t]=Q(()=>rO?oO():void 0);return ao(()=>{if(e==null)t(oO())},[]),te(()=>{rO=!0},[]),e}var E3=w3.useId,aO=E3||k3;function C3(){let e=new Map;return{emit(t,n){var i;(i=e.get(t))==null||i.forEach((r)=>r(n))},on(t,n){if(!e.has(t))e.set(t,new Set);e.get(t).add(n)},off(t,n){var i;(i=e.get(t))==null||i.delete(n)}}}var A3=Er(null),O3=Er(null),R3=()=>{var e;return((e=Ar(A3))==null?void 0:e.id)||null},N3=()=>Ar(O3);function uO(e){return"data-floating-ui-"+e}var T3={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},sO=Cr(function(t,n){let[i,r]=Q();ao(()=>{if(MA())r("button")},[]);let o={ref:n,tabIndex:0,role:i,"aria-hidden":i?void 0:!0,[uO("focus-guard")]:"",style:T3};return p("span",{...t,...o})}),M3={clipPath:"inset(50%)",position:"fixed",top:0,left:0},cO=Er(null),lO=uO("portal");function _3(e){if(e===void 0)e={};let{id:t,root:n}=e,i=aO(),r=D3(),[o,s]=Q(null),l=q(null);return ao(()=>()=>{o==null||o.remove(),queueMicrotask(()=>{l.current=null})},[o]),ao(()=>{if(!i)return;if(l.current)return;let a=t?document.getElementById(t):null;if(!a)return;let u=document.createElement("div");u.id=i,u.setAttribute(lO,""),a.appendChild(u),l.current=u,s(u)},[t,i]),ao(()=>{if(n===null)return;if(!i)return;if(l.current)return;let a=n||(r==null?void 0:r.portalNode);if(a&&!Uh(a))a=a.current;a=a||document.body;let u=null;if(t)u=document.createElement("div"),u.id=t,a.appendChild(u);let c=document.createElement("div");c.id=i,c.setAttribute(lO,""),a=u||a,a.appendChild(c),l.current=c,s(c)},[t,n,i,r]),o}function fO(e){let{children:t,id:n,root:i,preserveTabOrder:r=!0}=e,o=_3({id:n,root:i}),[s,l]=Q(null),a=q(null),u=q(null),c=q(null),f=q(null),h=s==null?void 0:s.modal,d=s==null?void 0:s.open,m=!!s&&!s.modal&&s.open&&r&&!!(i||o);return te(()=>{if(!o||!r||h)return;function b(x){if(o&&Wh(x))(x.type==="focusin"?Jv:IA)(o)}return o.addEventListener("focusin",b,!0),o.addEventListener("focusout",b,!0),()=>{o.removeEventListener("focusin",b,!0),o.removeEventListener("focusout",b,!0)}},[o,r,h]),te(()=>{if(!o)return;if(d)return;Jv(o)},[d,o]),w(cO.Provider,{value:Je(()=>({preserveTabOrder:r,beforeOutsideRef:a,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:f,portalNode:o,setFocusManagerState:l}),[r,o]),children:[m&&o&&p(sO,{"data-type":"outside",ref:a,onFocus:(b)=>{if(Wh(b,o)){var x;(x=c.current)==null||x.focus()}else{let g=s?s.domReference:null,v=PA(g);v==null||v.focus()}}}),m&&o&&p("span",{"aria-owns":o.id,style:M3}),o&&Op(t,o),m&&o&&p(sO,{"data-type":"outside",ref:u,onFocus:(b)=>{if(Wh(b,o)){var x;(x=f.current)==null||x.focus()}else{let g=s?s.domReference:null,v=BA(g);v==null||v.focus(),(s==null?void 0:s.closeOnFocusOut)&&(s==null||s.onOpenChange(!1,b.nativeEvent,"focus-out"))}}})]})}var D3=()=>Ar(cO);function L3(e){let{open:t=!1,onOpenChange:n,elements:i}=e,r=aO(),o=q({}),[s]=Q(()=>C3()),l=R3()!=null,[a,u]=Q(i.reference),c=LA((d,m,b)=>{o.current.openEvent=d?m:void 0,s.emit("openchange",{open:d,event:m,reason:b,nested:l}),n==null||n(d,m,b)}),f=Je(()=>({setPositionReference:u}),[]),h=Je(()=>({reference:a||i.reference||null,floating:i.floating||null,domReference:i.reference}),[a,i.reference,i.floating]);return Je(()=>({dataRef:o,open:t,onOpenChange:c,elements:h,events:s,floatingId:r,refs:f}),[t,c,h,s,r,f])}function hO(e){var t,n;let{elements:i,...r}=e===void 0?{}:e,{nodeId:o}=r,s=L3({...r,elements:{reference:(t=i==null?void 0:i.reference)!=null?t:null,floating:(n=i==null?void 0:i.floating)!=null?n:null}}),l=r.rootContext||s,a=l.elements,[u,c]=Q(null),[f,h]=Q(null),m=(a==null?void 0:a.domReference)||u,b=q(null),x=N3();ao(()=>{if(m)b.current=m},[m]);let g=iO({...r,elements:{...a,...f&&{reference:f}}}),v=ft((E)=>{let O=Ct(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;h(O),g.refs.setReference(O)},[g.refs]),y=ft((E)=>{if(Ct(E)||E===null)b.current=E,c(E);if(Ct(g.refs.reference.current)||g.refs.reference.current===null||E!==null&&!Ct(E))g.refs.setReference(E)},[g.refs]),S=Je(()=>({...g.refs,setReference:y,setPositionReference:v,domReference:b}),[g.refs,y,v]),k=Je(()=>({...g.elements,domReference:m}),[g.elements,m]),A=Je(()=>({...g,...l,refs:S,elements:k,nodeId:o}),[g,S,k,o,l]);return ao(()=>{l.dataRef.current.floatingContext=A;let E=x==null?void 0:x.nodesRef.current.find((O)=>O.id===o);if(E)E.context=A}),Je(()=>({...g,context:A,refs:S,elements:k}),[g,S,k,A])}function dO(){let[e,t]=Q(null),{refs:n,floatingStyles:i}=hO({placement:"bottom-start",middleware:[ed(6),rb(),ib({padding:8})],whileElementsMounted:Xh,elements:{reference:e?.el??null}});if(te(()=>{let r=(s)=>{if(s.pointerType==="touch")return;let l=s.target,a=l instanceof Element?l.closest("[data-tip]"):null,u=a?.getAttribute("data-tip")??"";t((c)=>a==null||u===""?null:c?.el===a&&c.text===u?c:{el:a,text:u})},o=()=>t(null);return document.addEventListener("pointerover",r),document.addEventListener("pointerdown",o),document.addEventListener("keydown",o),window.addEventListener("scroll",o,!0),()=>{document.removeEventListener("pointerover",r),document.removeEventListener("pointerdown",o),document.removeEventListener("keydown",o),window.removeEventListener("scroll",o,!0)}},[]),e==null)return null;return p(fO,{children:p("div",{ref:n.setFloating,style:i,className:"tooltip",role:"tooltip",children:e.text})})}var Mn=/mac|iphone|ipad/i.test(navigator.userAgent)?"⌘":"Ctrl+";function pO(e){return{label:e.kind,count:String(Math.max(0,Math.min(999,Math.round(e.count))))}}function mO(e){let t=e.split(`
15
+ `).map((r)=>r.trim()).filter((r)=>r!==""),n=t.filter((r)=>r.startsWith("- ")).map((r)=>r.slice(2).trim());return{positive:t.filter((r)=>!r.startsWith("- ")).join(" · "),negative:n.join(" · ")}}var Ll={"focus-prompt":"P","open-loras":"O","open-enhancer":"E","toggle-blur":"B"};function gO(e){if(!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey)return null;let t=e.key.toUpperCase();for(let[n,i]of Object.entries(Ll))if(i===t)return n;return null}function vO(e){let t=(n)=>e.find((i)=>i.kind===n&&!i.inactive)?.name??null;return{prompt:t("prompt"),loras:t("loras")}}var ob={enhance:"E",apply:"I"};function bO(e){if(!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey)return null;let t=e.key.toUpperCase();for(let[n,i]of Object.entries(ob))if(i===t)return n;return null}function yO(e,t){let n=t.trim();return e.find((i)=>i.text.trim()===n)?.label??null}function z3(e){let t=e.split(`
16
+ `).find((n)=>n.trim()!=="")??"";return t.length<=90?t:`${t.slice(0,89)}…`}var Hu=X(function(t){let n=t.v.desc.textPresets??[],[i,r]=Q(!1);if(n.length===0)return null;let o=typeof t.v.value==="string"?t.v.value:"",s=yO(n,o);return w("div",{className:"preset-box",onKeyDown:(l)=>l.key==="Escape"?r(!1):void 0,children:[w("button",{type:"button",className:"preset-btn mini","aria-expanded":i,"data-tip":"named starting texts — picking one replaces the field",onClick:()=>r(!i),children:[p(H,{name:"tag"})," presets ▾"]}),i?w(oe,{children:[p("div",{className:"preset-backdrop",onClick:()=>r(!1)}),p("div",{className:"preset-menu",children:n.map((l)=>w("button",{type:"button",className:l.label===s?"preset-item on":"preset-item",onClick:()=>{t.v.set(l.text),r(!1)},children:[w("span",{className:"preset-name",children:[l.label===s?"• ":"  ",l.label]}),p("span",{className:"preset-peek",children:z3(l.text)})]},l.label))})]}):null]})});function td(e){if(e.icon.trimStart().startsWith("<svg"))return p("img",{className:"var-icon",alt:"",src:`data:image/svg+xml;utf8,${encodeURIComponent(e.icon)}`});return p("svg",{className:"var-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:e.color==null?void 0:{color:e.color},"aria-hidden":"true",children:p("path",{d:e.icon})})}var xO=X(function(t){let n=typeof t.v.value==="string"?t.v.value:"",i=t.v.desc.textPresets??[];if(t.v.desc.multiline===!0){let r=Math.min(12,Math.max(3,n.split(`
17
+ `).length+1));return w("div",{children:[p("textarea",{rows:r,value:n,onChange:(o)=>t.v.set(o.target.value)}),i.length>0?p("div",{className:"row-inline",children:p(Hu,{v:t.v})}):null]})}if(i.length===0)return p("input",{type:"text",value:n,onChange:(r)=>t.v.set(r.target.value)});return w("div",{className:"row-inline",children:[p("input",{type:"text",style:{flex:1},value:n,onChange:(r)=>t.v.set(r.target.value)}),p(Hu,{v:t.v})]})}),wO=X(function(t){let n=t.v.desc.kind==="int",i=typeof t.v.value==="number"?t.v.value:0,r=t.v.desc.min,o=t.v.desc.max,s=(l)=>{let a=n?parseInt(l,10):parseFloat(l);if(Number.isFinite(a))t.v.set(a)};return w("div",{className:"row-inline",children:[p("input",{type:"number",value:i,step:n?1:"any",min:r,max:o,onChange:(l)=>s(l.target.value)}),r!=null&&o!=null?p("input",{type:"range",style:{flex:1,minWidth:120},value:i,min:r,max:o,step:n?1:(o-r)/200,onChange:(l)=>s(l.target.value)}):null,r!=null||o!=null?p("span",{className:"hint",children:`${r??"-∞"} … ${o??"∞"}`}):null]})}),SO=X(function(t){return w("label",{className:"row-inline",style:{cursor:"pointer"},children:[p("input",{type:"checkbox",checked:t.v.value===!0,onChange:(n)=>t.v.set(n.target.checked)}),p("span",{className:"hint",children:t.v.value===!0?"on":"off"})]})}),kO=X(function(t){let n=t.v.desc.choices??[],i=t.v.desc.select??"one",r=Dh(t.v.value),o=t.v.desc.ui?.options??{},s=(c)=>t.v.set(BC({select:i,choices:n,value:t.v.value,c})),l=r.filter((c)=>!n.includes(c)),a=l.length>0?w("span",{className:"hint",children:[l.join(", ")," (not on this host)"]}):i==="one"&&r.length===0?p("span",{className:"hint",children:"(unset)"}):null;if(zC(n)||i!=="one")return w("span",{className:"row-inline",children:[p("span",{className:"btn-group wrap",children:n.map((c)=>{let f=o[c],h=r.includes(c);return w("button",{type:"button",className:h?"sel":"","data-tip":i==="many"?`${h?"on":"off"}: click to toggle`:i==="zero-or-one"&&h?"click again to pick none":void 0,style:f?.color==null?void 0:h?{background:f.color,borderColor:f.color}:{color:f.color},onClick:()=>s(c),children:[f?.icon==null?null:p(td,{icon:f.icon,color:void 0}),c]},c)})}),a]});let u=r[0]??"";return w("select",{value:u,onChange:(c)=>t.v.set(c.target.value),children:[n.includes(u)?null:p("option",{value:u,disabled:!0,children:u===""?"(unset)":`${u} (not on this host)`}),n.map((c)=>p("option",{value:c,children:c},c))]})});function Uu(e){let[t,n]=Q(!1),i=()=>n(!1);return w("span",{className:`preset-box menu-box ${e.className??""}`,onKeyDown:(r)=>r.key==="Escape"?i():void 0,children:[p("button",{type:"button",className:"menu-btn","aria-expanded":t,"data-tip":e.tip,onClick:()=>n(!t),children:p(H,{name:"more"})}),t?w(oe,{children:[p("div",{className:"preset-backdrop",onClick:i}),p("div",{className:"preset-menu menu-list",children:e.children(i)})]}):null]})}function Ft(e){return w("button",{type:"button",className:"menu-item",disabled:e.disabled,"data-tip":e.tip,onClick:e.onClick,children:[p("span",{className:"menu-check",children:e.checked==null?"":e.checked?"✓":""}),e.label]})}var lb=[],OO=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map((t)=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?OO:lb).push(n=n+e[t])})();function B3(e){if(e<768)return!1;for(let t=0,n=lb.length;;){let i=t+n>>1;if(e<lb[i])n=i;else if(e>=OO[i])t=i+1;else return!0;if(t==n)return!1}}function EO(e){return e>=127462&&e<=127487}var CO=8205;function RO(e,t,n=!0,i=!0){return(n?NO:P3)(e,t,i)}function NO(e,t,n){if(t==e.length)return t;if(t&&TO(e.charCodeAt(t))&&MO(e.charCodeAt(t-1)))t--;let i=sb(e,t);t+=AO(i);while(t<e.length){let r=sb(e,t);if(i==CO||r==CO||n&&B3(r))t+=AO(r),i=r;else if(EO(r)){let o=0,s=t-2;while(s>=0&&EO(sb(e,s)))o++,s-=2;if(o%2==0)break;else t+=2}else break}return t}function P3(e,t,n){while(t>1){let i=NO(e,t-2,n);if(i<t)return i;t--}return 0}function sb(e,t){let n=e.charCodeAt(t);if(!MO(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);if(!TO(i))return n;return(n-55296<<10)+(i-56320)+65536}function TO(e){return e>=56320&&e<57344}function MO(e){return e>=55296&&e<56320}function AO(e){return e<65536?1:2}class ce{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vl(this,e,t);let i=[];if(this.decompose(0,e,i,2),n.length)n.decompose(0,n.length,i,3);return this.decompose(t,this.length,i,1),Ri.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vl(this,e,t);let n=[];return this.decompose(e,t,n,0),Ri.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new Pl(this),r=new Pl(e);for(let o=t,s=t;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(e=1){return new Pl(this,e)}iterRange(e,t=this.length){return new bb(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{if(t==null)t=this.lines+1;let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new yb(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw RangeError("A document must have at least one line");if(e.length==1&&!e[0])return ce.empty;return e.length<=32?new Ge(e):Ri.from(Ge.split(e,[]))}}class Ge extends ce{constructor(e,t=I3(e)){super();this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.text[r],s=i+o.length;if((t?n:s)>=e)return new PO(i,s,n,o);i=s+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new Ge(_O(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),s=od(r.text,o.text.slice(),0,r.length);if(s.length<=32)n.push(new Ge(s,o.length+r.length));else{let l=s.length>>1;n.push(new Ge(s.slice(0,l)),new Ge(s.slice(l)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof Ge))return super.replace(e,t,n);[e,t]=Vl(this,e,t);let i=od(this.text,od(n.text,_O(this.text,0,e)),t),r=this.length+n.length-(t-e);if(i.length<=32)return new Ge(i,r);return Ri.from(Ge.split(i,[]),r)}sliceString(e,t=this.length,n=`
18
+ `){[e,t]=Vl(this,e,t);let i="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let s=this.text[o],l=r+s.length;if(r>e&&o)i+=n;if(e<l&&t>r)i+=s.slice(Math.max(0,e-r),t-r);r=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)if(n.push(r),i+=r.length+1,n.length==32)t.push(new Ge(n,i)),n=[],i=-1;if(i>-1)t.push(new Ge(n,i));return t}}class Ri extends ce{constructor(e,t){super();this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,i){for(let r=0;;r++){let o=this.children[r],s=i+o.length,l=n+o.lines-1;if((t?l:s)>=e)return o.lineInner(e,t,n,i);i=s+1,n=l+1}}decompose(e,t,n,i){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let s=this.children[r],l=o+s.length;if(e<=l&&t>=o){let a=i&((o<=e?1:0)|(l>=t?2:0));if(o>=e&&l<=t&&!a)n.push(s);else s.decompose(e-o,t-o,n,a)}o=l+1}}replace(e,t,n){if([e,t]=Vl(this,e,t),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let o=this.children[i],s=r+o.length;if(e>=r&&t<=s){let l=o.replace(e-r,t-r,n),a=this.lines-o.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let u=this.children.slice();return u[i]=l,new Ri(u,this.length-(t-e)+n.length)}return super.replace(r,s,l)}r=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
19
+ `){[e,t]=Vl(this,e,t);let i="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let s=this.children[r],l=o+s.length;if(o>e&&r)i+=n;if(e<l&&t>o)i+=s.sliceString(e-o,t-o,n);o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ri))return 0;let n=0,[i,r,o,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==o||r==s)return n;let l=this.children[i],a=e.children[r];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let h of e)n+=h.lines;if(n<32){let h=[];for(let d of e)d.flatten(h);return new Ge(h,t)}let i=Math.max(32,n>>5),r=i<<1,o=i>>1,s=[],l=0,a=-1,u=[];function c(h){let d;if(h.lines>r&&h instanceof Ri)for(let m of h.children)c(m);else if(h.lines>o&&(l>o||!l))f(),s.push(h);else if(h instanceof Ge&&l&&(d=u[u.length-1])instanceof Ge&&h.lines+d.lines<=32)l+=h.lines,a+=h.length+1,u[u.length-1]=new Ge(d.text.concat(h.text),d.length+1+h.length);else{if(l+h.lines>i)f();l+=h.lines,a+=h.length+1,u.push(h)}}function f(){if(l==0)return;s.push(u.length==1?u[0]:Ri.from(u,a)),a=-1,l=u.length=0}for(let h of e)c(h);return f(),s.length==1?s[0]:new Ri(s,t)}}ce.empty=new Ge([""],0);function I3(e){let t=-1;for(let n of e)t+=n.length+1;return t}function od(e,t,n=0,i=1e9){for(let r=0,o=0,s=!0;o<e.length&&r<=i;o++){let l=e[o],a=r+l.length;if(a>=n){if(a>i)l=l.slice(0,i-r);if(r<n)l=l.slice(n-r);if(s)t[t.length-1]+=l,s=!1;else t.push(l)}r=a+1}return t}function _O(e,t,n){return od(e,[""],t,n)}class Pl{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Ge?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=!1;for(;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof Ge?i.text.length:i.children.length;if(o==(t>0?s:0)){if(n==0)return this.done=!0,this.value="",this;if(t>0)this.offsets[n-1]++;this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
20
+ `,this;e--}else if(i instanceof Ge){let l=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];if(e>l.length)e-=l.length,this.offsets[n]+=t;else{if(t<0)this.offsets[n]--;this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Ge?l.text.length:l.children.length)<<1)}}}}next(e=0){if(e<0)this.nextInner(-e,-this.dir),e=this.value.length;return this.nextInner(e,this.dir)}}class bb{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Pl(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;if(e>n)e=n;n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){if(e<0)e=Math.max(e,this.from-this.pos);else if(e>0)e=Math.min(e,this.to-this.pos);return this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class yb{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);if(t&&this.afterBreak)this.value="",this.afterBreak=!1;else if(t)this.done=!0,this.value="";else if(n)if(this.afterBreak)this.value="";else this.afterBreak=!0,this.next();else this.value=i,this.afterBreak=!1;return this}get lineBreak(){return!1}}if(typeof Symbol<"u")ce.prototype[Symbol.iterator]=function(){return this.iter()},Pl.prototype[Symbol.iterator]=bb.prototype[Symbol.iterator]=yb.prototype[Symbol.iterator]=function(){return this};class PO{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function Vl(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function at(e,t,n=!0,i=!0){return RO(e,t,n,i)}function V3(e){return e>=56320&&e<57344}function H3(e){return e>=55296&&e<56320}function vr(e,t){let n=e.charCodeAt(t);if(!H3(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);if(!V3(i))return n;return(n-55296<<10)+(i-56320)+65536}function IO(e){if(e<=65535)return String.fromCharCode(e);return e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320)}function fo(e){return e<65536?1:2}var ub=/\r\n?|\n/,Nt=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Nt||(Nt={}));class Zn{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];if(o<0)e(n,i,r),i+=r;else i+=o;n+=r}}iterChangedRanges(e,t=!1){cb(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];if(i<0)e.push(n,i);else e.push(i,n)}return new Zn(e)}composeDesc(e){return this.empty?e:e.empty?this:VO(this,e)}mapDesc(e,t=!1){return e.empty?this:fb(this,e,t)}mapPos(e,t=-1,n=Nt.Simple){let i=0,r=0;for(let o=0;o<this.sections.length;){let s=this.sections[o++],l=this.sections[o++],a=i+s;if(l<0){if(a>e)return r+(e-i);r+=s}else{if(n!=Nt.Simple&&a>=e&&(n==Nt.TrackDel&&i<e&&a>e||n==Nt.TrackBefore&&i<e||n==Nt.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!s)return e==i||t<0?r:r+l;r+=l}i=a}if(e>i)throw RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=this.sections[n++],o=this.sections[n++],s=i+r;if(o>=0&&i<=t&&s>=e)return i<e&&s>t?"cover":!0;i=s}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((t)=>typeof t!="number"))throw RangeError("Invalid JSON representation of ChangeDesc");return new Zn(e)}static create(e){return new Zn(e)}}class We extends Zn{constructor(e,t){super(e);this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return cb(this,(t,n,i,r,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return fb(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i<t.length;i+=2){let o=t[i],s=t[i+1];if(s>=0){t[i]=s,t[i+1]=o;let l=i>>1;while(n.length<l)n.push(ce.empty);n.push(o?e.slice(r,r+o):ce.empty)}r+=o}return new We(t,n)}compose(e){return this.empty?e:e.empty?this:VO(this,e,!0)}map(e,t=!1){return e.empty?this:fb(this,e,t,!0)}iterChanges(e,t=!1){cb(this,e,t)}get desc(){return Zn.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new Hl(this);e:for(let o=0,s=0;;){let l=o==e.length?1e9:e[o++];while(s<l||s==l&&r.len==0){if(r.done)break e;let u=Math.min(r.len,l-s);At(i,u,-1);let c=r.ins==-1?-1:r.off==0?r.ins:0;if(At(t,u,c),c>0)co(n,t,r.text);r.forward(u),s+=u}let a=e[o++];while(s<a){if(r.done)break e;let u=Math.min(r.len,a-s);At(t,u,-1),At(i,u,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(u),s+=u}}return{changes:new We(t,n),filtered:Zn.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];if(i<0)e.push(n);else if(i==0)e.push([n]);else e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],o=0,s=null;function l(u=!1){if(!u&&!i.length)return;if(o<t)At(i,t-o,-1);let c=new We(i,r);s=s?s.compose(c.map(s)):c,i=[],r=[],o=0}function a(u){if(Array.isArray(u))for(let c of u)a(c);else if(u instanceof We){if(u.length!=t)throw RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),s=s?s.compose(u.map(s)):u}else{let{from:c,to:f=c,insert:h}=u;if(c>f||c<0||f>t)throw RangeError(`Invalid change range ${c} to ${f} (in doc of length ${t})`);let d=!h?ce.empty:typeof h=="string"?ce.of(h.split(n||ub)):h,m=d.length;if(c==f&&m==0)return;if(c<o)l();if(c>o)At(i,c-o,-1);At(i,f-c,m),co(r,i,d),o=f}}return a(e),l(!s),s}static empty(e){return new We(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let r=e[i];if(typeof r=="number")t.push(r,-1);else if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,s)=>s&&typeof o!="string"))throw RangeError("Invalid JSON representation of ChangeSet");else if(r.length==1)t.push(r[0],0);else{while(n.length<i)n.push(ce.empty);n[i]=ce.of(r.slice(1)),t.push(r[0],n[i].length)}}return new We(t,n)}static createSet(e,t){return new We(e,t)}}function At(e,t,n,i=!1){if(t==0&&n<=0)return;let r=e.length-2;if(r>=0&&n<=0&&n==e[r+1])e[r]+=t;else if(r>=0&&t==0&&e[r]==0)e[r+1]+=n;else if(i)e[r]+=t,e[r+1]+=n;else e.push(t,n)}function co(e,t,n){if(n.length==0)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{while(e.length<i)e.push(ce.empty);e.push(n)}}function cb(e,t,n){let i=e.inserted;for(let r=0,o=0,s=0;s<e.sections.length;){let l=e.sections[s++],a=e.sections[s++];if(a<0)r+=l,o+=l;else{let u=r,c=o,f=ce.empty;for(;;){if(u+=l,c+=a,a&&i)f=f.append(i[s-2>>1]);if(n||s==e.sections.length||e.sections[s+1]<0)break;l=e.sections[s++],a=e.sections[s++]}t(r,u,o,c,f),r=u,o=c}}}function fb(e,t,n,i=!1){let r=[],o=i?[]:null,s=new Hl(e),l=new Hl(t);for(let a=-1;;)if(s.done&&l.len||l.done&&s.len)throw Error("Mismatched change set lengths");else if(s.ins==-1&&l.ins==-1){let u=Math.min(s.len,l.len);At(r,u,-1),s.forward(u),l.forward(u)}else if(l.ins>=0&&(s.ins<0||a==s.i||s.off==0&&(l.len<s.len||l.len==s.len&&!n))){let u=l.len;At(r,l.ins,-1);while(u){let c=Math.min(s.len,u);if(s.ins>=0&&a<s.i&&s.len<=c){if(At(r,0,s.ins),o)co(o,r,s.text);a=s.i}s.forward(c),u-=c}l.next()}else if(s.ins>=0){let u=0,c=s.len;while(c)if(l.ins==-1){let f=Math.min(c,l.len);u+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;if(At(r,u,a<s.i?s.ins:0),o&&a<s.i)co(o,r,s.text);a=s.i,s.forward(s.len-c)}else if(s.done&&l.done)return o?We.createSet(r,o):Zn.create(r);else throw Error("Mismatched change set lengths")}function VO(e,t,n=!1){let i=[],r=n?[]:null,o=new Hl(e),s=new Hl(t);for(let l=!1;;)if(o.done&&s.done)return r?We.createSet(i,r):Zn.create(i);else if(o.ins==0)At(i,o.len,0,l),o.next();else if(s.len==0&&!s.done){if(At(i,0,s.ins,l),r)co(r,i,s.text);s.next()}else if(o.done||s.done)throw Error("Mismatched change set lengths");else{let a=Math.min(o.len2,s.len),u=i.length;if(o.ins==-1){let c=s.ins==-1?-1:s.off?0:s.ins;if(At(i,a,c,l),r&&c)co(r,i,s.text)}else if(s.ins==-1){if(At(i,o.off?0:o.len,a,l),r)co(r,i,o.textBit(a))}else if(At(i,o.off?0:o.len,s.off?0:s.ins,l),r&&!s.off)co(r,i,s.text);l=(o.ins>a||s.ins>=0&&s.len>a)&&(l||i.length>u),o.forward2(a),s.forward(a)}}class Hl{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;if(this.i<e.length)this.len=e[this.i++],this.ins=e[this.i++];else this.len=0,this.ins=-2;this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ce.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?ce.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){if(e==this.len)this.next();else this.len-=e,this.off+=e}forward2(e){if(this.ins==-1)this.forward(e);else if(e==this.ins)this.next();else this.ins-=e,this.off+=e}}class uo{constructor(e,t,n,i){this.from=e,this.to=t,this.flags=n,this.goalColumn=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let n,i;if(this.empty)n=i=e.mapPos(this.from,t);else n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1);return n==this.from&&i==this.to?this:new uo(n,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return N.range(e,t,void 0,void 0,n);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return N.range(this.anchor,i,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw RangeError("Invalid JSON representation for SelectionRange");return N.range(e.anchor,e.head)}static create(e,t,n,i){return new uo(e,t,n,i)}}class N{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){if(e.empty)return this;return N.create(this.ranges.map((n)=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new N([this.main],0)}addRange(e,t=!0){return N.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,N.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((e)=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new N(e.ranges.map((t)=>uo.fromJSON(t)),e.main)}static single(e,t=e){return new N([N.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let r=e[i];if(r.empty?r.from<=n:r.from<n)return N.normalized(e.slice(),t);n=r.to}return new N(e,t)}static cursor(e,t=0,n,i){return uo.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),i)}static range(e,t,n,i,r){let o=i==null?7:Math.min(6,i);if(!r&&e!=t)r=t<e?1:-1;if(r)o|=r<0?8:16;return t<e?uo.create(t,e,o|32,n):uo.create(e,t,o,n)}static undirectionalRange(e,t){return uo.create(e,t,64,void 0)}static normalized(e,t=0){let n=e[t];e.sort((i,r)=>i.from-r.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let r=e[i],o=e[i-1];if(r.empty?r.from<=o.to:r.from<o.to){let s=o.from,l=Math.max(r.to,o.to);if(i<=t)t--;e.splice(--i,2,r.anchor>r.head?N.range(l,s):N.range(s,l))}}return new N(e,t)}}function HO(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError("Selection points outside of document")}var xb=0;class Y{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=xb++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new Y(e.combine||((t)=>t),e.compareInput||((t,n)=>t===n),e.compare||(!e.combine?wb:(t,n)=>t===n),!!e.static,e.enables)}of(e){return new Fu([],this,0,e)}compute(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new Fu(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error("Can't compute a static facet");return new Fu(e,this,2,t)}from(e,t){if(!t)t=(n)=>n;return this.compute([e],(n)=>t(n.field(e)))}}function wb(e,t){return e==t||e.length==t.length&&e.every((n,i)=>n===t[i])}class Fu{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=xb++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,o=e[r]>>1,s=this.type==2,l=!1,a=!1,u=[];for(let c of this.dependencies)if(c=="doc")l=!0;else if(c=="selection")a=!0;else if((((t=e[c.id])!==null&&t!==void 0?t:1)&1)==0)u.push(e[c.id]);return{create(c){return c.values[o]=n(c),1},update(c,f){if(l&&f.docChanged||a&&(f.docChanged||f.selection)||hb(c,u)){let h=n(c);if(s?!DO(h,c.values[o],i):!i(h,c.values[o]))return c.values[o]=h,1}return 0},reconfigure:(c,f)=>{let h,d=f.config.address[r];if(d!=null){let m=ad(f,d);if(this.dependencies.every((b)=>b instanceof Y?f.facet(b)===c.facet(b):b instanceof an?f.field(b,!1)==c.field(b,!1):!0)||(s?DO(h=n(c),m,i):i(h=n(c),m)))return c.values[o]=m,0}else h=n(c);return c.values[o]=h,1}}}get extension(){return this}}function DO(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function hb(e,t){let n=!1;for(let i of t)if(Ku(e,i)&1)n=!0;return n}function U3(e,t,n){let i=n.map((a)=>e[a.id]),r=n.map((a)=>a.type),o=i.filter((a)=>!(a&1)),s=e[t.id]>>1;function l(a){let u=[];for(let c=0;c<i.length;c++){let f=ad(a,i[c]);if(r[c]==2)for(let h of f)u.push(h);else u.push(f)}return t.combine(u)}return{create(a){for(let u of i)Ku(a,u);return a.values[s]=l(a),1},update(a,u){if(!hb(a,o))return 0;let c=l(a);if(t.compare(c,a.values[s]))return 0;return a.values[s]=c,1},reconfigure(a,u){let c=hb(a,i),f=u.config.facets[t.id],h=u.facet(t);if(f&&!c&&wb(n,f))return a.values[s]=h,0;let d=l(a);if(t.compare(d,h))return a.values[s]=h,0;return a.values[s]=d,1}}}var nd=Y.define({static:!0});class an{constructor(e,t,n,i,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(e){let t=new an(xb++,e.create,e.update,e.compare||((n,i)=>n===i),e);if(e.provide)t.provides=e.provide(t);return t}create(e){let t=e.facet(nd).find((n)=>n.field==this);return((t===null||t===void 0?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:(n)=>(n.values[t]=this.create(n),1),update:(n,i)=>{let r=n.values[t],o=this.updateF(r,i);if(this.compareF(r,o))return 0;return n.values[t]=o,1},reconfigure:(n,i)=>{let r=n.facet(nd),o=i.facet(nd),s;if((s=r.find((l)=>l.field==this))&&s!=o.find((l)=>l.field==this))return n.values[t]=s.create(n),1;if(i.config.address[this.id]!=null)return n.values[t]=i.field(this),0;return n.values[t]=this.create(n),1}}}init(e){return[this,nd.of({field:this,create:e})]}get extension(){return this}}var as={lowest:4,low:3,default:2,high:1,highest:0};function ju(e){return(t)=>new Sb(t,e)}var Ni={highest:ju(as.highest),high:ju(as.high),default:ju(as.default),low:ju(as.low),lowest:ju(as.lowest)};class Sb{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class ud{of(e){return new sd(this,e)}reconfigure(e){return ud.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class sd{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class ld{constructor(e,t,n,i,r,o){this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=o,this.statusTemplate=[];while(this.statusTemplate.length<n.length)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],r=Object.create(null),o=new Map;for(let f of j3(e,t,o))if(f instanceof an)i.push(f);else(r[f.facet.id]||(r[f.facet.id]=[])).push(f);let s=Object.create(null),l=[],a=[];for(let f of i)s[f.id]=a.length<<1,a.push((h)=>f.slot(h));let u=n===null||n===void 0?void 0:n.config.facets;for(let f in r){let h=r[f],d=h[0].facet,m=u&&u[f]||[];if(h.every((b)=>b.type==0))if(s[d.id]=l.length<<1|1,wb(m,h))l.push(n.facet(d));else{let b=d.combine(h.map((x)=>x.value));l.push(n&&d.compare(b,n.facet(d))?n.facet(d):b)}else{for(let b of h)if(b.type==0)s[b.id]=l.length<<1|1,l.push(b.value);else s[b.id]=a.length<<1,a.push((x)=>b.dynamicSlot(x));s[d.id]=a.length<<1,a.push((b)=>U3(b,d,h))}}let c=a.map((f)=>f(s));return new ld(e,o,c,s,l,r)}}function j3(e,t,n){let i=[[],[],[],[],[]],r=new Map;function o(s,l){let a=r.get(s);if(a!=null){if(a<=l)return;let u=i[a].indexOf(s);if(u>-1)i[a].splice(u,1);if(s instanceof sd)n.delete(s.compartment)}if(r.set(s,l),Array.isArray(s))for(let u of s)o(u,l);else if(s instanceof sd){if(n.has(s.compartment))throw RangeError("Duplicate use of compartment in extensions");let u=t.get(s.compartment)||s.inner;n.set(s.compartment,u),o(u,l)}else if(s instanceof Sb)o(s.inner,s.prec);else if(s instanceof an){if(i[l].push(s),s.provides)o(s.provides,l)}else if(s instanceof Fu){if(i[l].push(s),s.facet.extensions)o(s.facet.extensions,as.default)}else{let u=s.extension;if(!u)throw Error(`Unrecognized extension value in extension set (${s}).`);if(u==s)throw Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(u,l)}}return o(e,as.default),i.reduce((s,l)=>s.concat(l))}function Ku(e,t){if(t&1)return 2;let n=t>>1,i=e.status[n];if(i==4)throw Error("Cyclic dependency between fields and/or facets");if(i&2)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function ad(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var UO=Y.define(),db=Y.define({combine:(e)=>e.some((t)=>t),static:!0}),jO=Y.define({combine:(e)=>e.length?e[0]:void 0,static:!0}),FO=Y.define(),KO=Y.define(),qO=Y.define(),$O=Y.define({combine:(e)=>e.length?e[0]:!1});class un{constructor(e,t){this.type=e,this.value=t}static define(){return new GO}}class GO{of(e){return new un(this,e)}}class WO{constructor(e){this.map=e}of(e){return new ve(this,e)}}class ve{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new ve(this.type,t)}is(e){return this.type==e}static define(e={}){return new WO(e.map||((t)=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let r=i.map(t);if(r)n.push(r)}return n}}ve.reconfigure=ve.define();ve.appendConfig=ve.define();class je{constructor(e,t,n,i,r,o){if(this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,n)HO(n,t.newLength);if(!r.some((s)=>s.type==je.time))this.annotations=r.concat(je.time.of(Date.now()))}static create(e,t,n,i,r,o){return new je(e,t,n,i,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){if(!this._state)this.startState.applyTransaction(this);return this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value;return}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(je.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}je.time=un.define();je.userEvent=un.define();je.addToHistory=un.define();je.remote=un.define();function F3(e,t){let n=[];for(let i=0,r=0;;){let o,s;if(i<e.length&&(r==t.length||t[r]>=e[i]))o=e[i++],s=e[i++];else if(r<t.length)o=t[r++],s=t[r++];else return n;if(!n.length||n[n.length-1]<o)n.push(o,s);else if(n[n.length-1]<s)n[n.length-1]=s}}function YO(e,t,n){var i;let r,o,s;if(n)r=t.changes,o=We.empty(t.changes.length),s=e.changes.compose(t.changes);else r=t.changes.map(e.changes),o=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(r);return{changes:s,selection:t.selection?t.selection.map(o):(i=e.selection)===null||i===void 0?void 0:i.map(r),effects:ve.mapEffects(e.effects,r).concat(ve.mapEffects(t.effects,o)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function pb(e,t,n){let i=t.selection,r=Il(t.annotations);if(t.userEvent)r=r.concat(je.userEvent.of(t.userEvent));return{changes:t.changes instanceof We?t.changes:We.of(t.changes||[],n,e.facet(jO)),selection:i&&(i instanceof N?i:N.single(i.anchor,i.head)),effects:Il(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function XO(e,t,n){let i=pb(e,t.length?t[0]:{},e.doc.length);if(t.length&&t[0].filter===!1)n=!1;for(let o=1;o<t.length;o++){if(t[o].filter===!1)n=!1;let s=!!t[o].sequential;i=YO(i,pb(e,t[o],s?i.changes.newLength:e.doc.length),s)}let r=je.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return q3(n?K3(r):r)}function K3(e){let t=e.startState,n=!0;for(let r of t.facet(FO)){let o=r(e);if(o===!1){n=!1;break}if(Array.isArray(o))n=n===!0?o:F3(n,o)}if(n!==!0){let r,o;if(n===!1)o=e.changes.invertedDesc,r=We.empty(t.doc.length);else{let s=e.changes.filter(n);r=s.changes,o=s.filtered.mapDesc(s.changes).invertedDesc}e=je.create(t,r,e.selection&&e.selection.map(o),ve.mapEffects(e.effects,o),e.annotations,e.scrollIntoView)}let i=t.facet(KO);for(let r=i.length-1;r>=0;r--){let o=i[r](e);if(o instanceof je)e=o;else if(Array.isArray(o)&&o.length==1&&o[0]instanceof je)e=o[0];else e=XO(t,Il(o),!1)}return e}function q3(e){let t=e.startState,n=t.facet(qO),i=e;for(let r=n.length-1;r>=0;r--){let o=n[r](e);if(o&&Object.keys(o).length)i=YO(i,pb(t,o,e.changes.newLength),!0)}return i==e?e:je.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}var $3=[];function Il(e){return e==null?$3:Array.isArray(e)?e:[e]}var _n=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(_n||(_n={})),G3=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,mb;try{mb=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function W3(e){if(mb)return mb.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||G3.test(n)))return!0}return!1}function Y3(e){return(t)=>{if(!/\S/.test(t))return _n.Space;if(W3(t))return _n.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return _n.Word;return _n.Other}}class de{constructor(e,t,n,i,r,o){if(this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,o)o._state=this;for(let s=0;s<this.config.dynamicSlots.length;s++)Ku(this,s<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError("Field is not present in this state");return}return Ku(this,n),ad(this,n)}update(...e){return XO(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let s of e.effects)if(s.is(ud.reconfigure)){if(t)i=new Map,t.compartments.forEach((l,a)=>i.set(a,l)),t=null;i.set(s.value.compartment,s.value.extension)}else if(s.is(ve.reconfigure))t=null,n=s.value;else if(s.is(ve.appendConfig))t=null,n=Il(n).concat(s.value);let r;if(!t)t=ld.resolve(n,i,this),r=new de(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values;else r=e.startState.values.slice();let o=e.startState.facet(db)?e.newSelection:e.newSelection.asSingle();new de(t,e.newDoc,o,r,(s,l)=>l.update(s,e),e)}replaceSelection(e){if(typeof e=="string")e=this.toText(e);return this.changeByRange((t)=>({changes:{from:t.from,to:t.to,insert:e},range:N.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],o=Il(n.effects);for(let s=1;s<t.ranges.length;s++){let l=e(t.ranges[s]),a=this.changes(l.changes),u=a.map(i);for(let f=0;f<s;f++)r[f]=r[f].map(u);let c=i.mapDesc(a,!0);r.push(l.range.map(c)),i=i.compose(u),o=ve.mapEffects(o,u).concat(ve.mapEffects(Il(l.effects),c))}return{changes:i,selection:N.create(r,t.mainIndex),effects:o}}changes(e=[]){if(e instanceof We)return e;return We.of(e,this.doc.length,this.facet(de.lineSeparator))}toText(e){return ce.of(e.split(this.facet(de.lineSeparator)||ub))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];if(t==null)return e.default;return Ku(this,t),ad(this,t)}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];if(i instanceof an&&this.config.address[i.id]!=null)t[n]=i.spec.toJSON(this.field(e[n]),this)}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let r in n)if(Object.prototype.hasOwnProperty.call(e,r)){let o=n[r],s=e[r];i.push(o.init((l)=>o.spec.fromJSON(s,l)))}}return de.create({doc:e.doc,selection:N.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=ld.resolve(e.extensions||[],new Map),n=e.doc instanceof ce?e.doc:ce.of((e.doc||"").split(t.staticFacet(de.lineSeparator)||ub)),i=!e.selection?N.single(0):e.selection instanceof N?e.selection:N.single(e.selection.anchor,e.selection.head);if(HO(i,n.length),!t.staticFacet(db))i=i.asSingle();return new de(t,n,i,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(de.tabSize)}get lineBreak(){return this.facet(de.lineSeparator)||`
21
+ `}get readOnly(){return this.facet($O)}phrase(e,...t){for(let n of this.facet(de.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}if(t.length)e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let r=+(i||1);return!r||r>t.length?n:t[r-1]});return e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(UO))for(let o of r(this,t,n))if(Object.prototype.hasOwnProperty.call(o,e))i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return Y3(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-n,s=e-n;while(o>0){let l=at(t,o,!1);if(r(t.slice(l,o))!=_n.Word)break;o=l}while(s<i){let l=at(t,s);if(r(t.slice(s,l))!=_n.Word)break;s=l}return o==s?null:N.range(o+n,s+n)}}de.allowMultipleSelections=db;de.tabSize=Y.define({combine:(e)=>e.length?e[0]:4});de.lineSeparator=jO;de.readOnly=$O;de.phrases=Y.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((r)=>e[r]==t[r])}});de.languageData=UO;de.changeFilter=FO;de.transactionFilter=KO;de.transactionExtender=qO;ud.reconfigure=ve.define();function Ul(e,t,n={}){let i={};for(let r of e)for(let o of Object.keys(r)){let s=r[o],l=i[o];if(l===void 0)i[o]=s;else if(l===s||s===void 0);else if(Object.hasOwnProperty.call(n,o))i[o]=n[o](l,s);else throw Error("Config merge conflict for field "+o)}for(let r in t)if(i[r]===void 0)i[r]=t[r];return i}class ei{eq(e){return this==e}range(e,t=e){return qu.create(e,t,this)}}ei.prototype.startSide=ei.prototype.endSide=0;ei.prototype.point=!1;ei.prototype.mapMode=Nt.TrackDel;function kb(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class qu{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new qu(e,t,n)}}function gb(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Eb{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return zl(this.to)}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let o=i,s=r.length;;){if(o==s)return o;let l=o+s>>1,a=r[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return a>=0?o:s;if(a>=0)s=l;else o=l+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(i(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t,n,i,r){let o=[],s=[],l=[],a=-1,u=-1;e:for(let c=0;c<this.value.length;c++){let f=this.value[c],h=this.from[c]+e,d=this.to[c]+e,m,b;if(h==d){let x=t.mapPos(h,f.startSide,f.mapMode);if(x==null)continue;if(m=b=x,f.startSide!=f.endSide){if(b=t.mapPos(h,f.endSide),b<m)continue}}else if(m=t.mapPos(h,f.startSide),b=t.mapPos(d,f.endSide),m>b||m==b&&f.startSide>0&&f.endSide<=0)continue;if((b-m||f.endSide-f.startSide)<0)continue;if(a<0)a=m;if(f.point)u=Math.max(u,b-m);if((m-n||f.startSide-i)>=0)o.push(f),s.push(m-a),l.push(b-a),n=b,i=f.endSide;else{if(m==b)for(let x=o.length;x>0;x--){if((m-(l[x-1]+a)||f.startSide-o[x-1].endSide)>=0){o.splice(x,0,f),s.splice(x,0,m-a),l.splice(x,0,b-a);continue e}if((m-(s[x-1]+a)||f.endSide-o[x-1].startSide)>0)break}r(m,b,f)}}return{mapped:o.length?new Eb(s,l,o,u):null,pos:a}}}class pe{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new pe(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n)t=t.slice().sort(gb);if(this.isEmpty)return t.length?pe.of(t):this;let s=new Cb(this,null,-1).goto(0),l=0,a=[],u=new us;while(s.value||l<t.length)if(l<t.length&&(s.from-t[l].from||s.startSide-t[l].value.startSide)>=0){let c=t[l++];if(!u.addInner(c.from,c.to,c.value,!1))a.push(c)}else if(s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(s.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||r<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex]))s.nextChunk();else{if(!o||i>s.to||r<s.from||o(s.from,s.to,s.value)){if(!u.addInner(s.from,s.to,s.value,!1))a.push(qu.create(s.from,s.to,s.value))}s.next()}return u.finishInner(this.nextLayer.isEmpty&&!a.length?pe.empty:this.nextLayer.update({add:a,filter:o,filterFrom:i,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1,r,o=(l,a,u)=>{if(!r)r=new us;r.addRange(l,a,u,!1)};for(let l=0;l<this.chunk.length;l++){let a=this.chunkPos[l],u=this.chunk[l],c=e.touchesRange(a,a+u.length);if(c===!1)i=Math.max(i,u.maxPoint),t.push(u),n.push(e.mapPos(a));else if(c===!0){let[f,h]=!t.length?[-1,-1]:[zl(n)+zl(t).length,zl(zl(t).value).endSide],{mapped:d,pos:m}=u.map(a,e,f,h,o);if(d)i=Math.max(i,d.maxPoint),t.push(d),n.push(m)}}let s=this.nextLayer.map(e);if(r)s=r.finishInner(s);return t.length==0?s:new pe(n,t,s||pe.empty,i)}between(e,t,n){if(this.isEmpty)return;for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],o=this.chunk[i];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,n)===!1)return}this.nextLayer.between(e,t,n)}iter(e=0){return $u.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return $u.from(e).goto(t)}static compare(e,t,n,i,r=-1){let o=e.filter((c)=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),s=t.filter((c)=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=r),l=LO(o,s,n),a=new Bl(o,l,r),u=new Bl(s,l,r);if(n.iterGaps((c,f,h)=>zO(a,c,u,f,h,i)),n.empty&&n.length==0)zO(a,0,u,0,0,i)}static eq(e,t,n=0,i){if(i==null)i=999999999;let r=e.filter((u)=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter((u)=>!u.isEmpty&&e.indexOf(u)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let s=LO(r,o),l=new Bl(r,s,0).goto(n),a=new Bl(o,s,0).goto(n);for(;;){if(l.to!=a.to||!vb(l.active,a.active)||l.point&&(!a.point||!kb(l.point,a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(e,t,n,i,r=-1){let o=new Bl(e,null,r).goto(t),s=t,l=o.openStart;for(;;){let a=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),c=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);i.point(s,a,o.point,u,c,o.pointRank),l=Math.min(o.openEnd(a),u.length)}else if(a>s)i.span(s,a,o.active,l),l=o.openEnd(a);if(o.to>n)return l+(o.point&&o.to>n?1:0);s=o.to,o.next()}}static of(e,t=!1){let n=new us;for(let i of e instanceof qu?[e]:t?X3(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return pe.empty;let t=zl(e);for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=pe.empty;i=i.nextLayer)t=new pe(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}pe.empty=new pe([],[],null,-1);function zl(e){return e[e.length-1]}function X3(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(gb(t,i)>0)return e.slice().sort(gb);t=i}return e}pe.empty.nextLayer=pe.empty;class us{finishChunk(e){if(this.chunks.push(new Eb(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e)this.from=[],this.to=[],this.value=[]}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addRange(e,t,n,!0)}addRange(e,t,n,i){if(!this.addInner(e,t,n,i))(this.nextLayer||(this.nextLayer=new us)).addRange(e,t,n,i)}addInner(e,t,n,i){let r=e-this.lastTo||n.startSide-this.last.endSide;if(i&&r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");if(r<0)return!1;if(this.from.length==250)this.finishChunk(!0);if(this.chunkStart<0)this.chunkStart=e;if(this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point)this.maxPoint=Math.max(this.maxPoint,t-e);return!0}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;if(this.from.length)this.finishChunk(!0);this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(pe.empty)}finishInner(e){if(this.from.length)this.finishChunk(!1);if(this.chunks.length==0)return e;let t=pe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function LO(e,t,n){let i=new Map;for(let o of e)for(let s=0;s<o.chunk.length;s++)if(o.chunk[s].maxPoint<=0)i.set(o.chunk[s],o.chunkPos[s]);let r=new Set;for(let o of t)for(let s=0;s<o.chunk.length;s++){let l=i.get(o.chunk[s]);if(l!=null&&(n?n.mapPos(l):l)==o.chunkPos[s]&&!(n===null||n===void 0?void 0:n.touchesRange(l,l+o.chunk[s].length)))r.add(o.chunk[s])}return r}class Cb{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){while(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);if(!n||this.rangeIndex<i)this.setRangeIndex(i)}this.next()}forward(e,t){if((this.to-e||this.endSide-t)<0)this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)while(this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]))this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class $u{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)if(o.maxPoint>=n)i.push(new Cb(o,t,n,r));return i.length==1?i[0]:new $u(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)ab(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)ab(this.heap,n);if((this.to-e||this.value.endSide-t)<0)this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];if(this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value)e.next();ab(this.heap,0)}}}function ab(e,t){for(let n=e[t];;){let i=(t<<1)+1;if(i>=e.length)break;let r=e[i];if(i+1<e.length&&r.compare(e[i+1])>=0)r=e[i+1],i++;if(n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class Bl{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=$u.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){while(this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){id(this.active,e),id(this.activeTo,e),id(this.activeRank,e),this.minActive=BO(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;while(t<this.activeRank.length&&(r-this.activeRank[t]||i-this.activeTo[t])>0)t++;if(rd(this.active,t,n),rd(this.activeTo,t,i),rd(this.activeRank,t,r),e)rd(e,t,this.cursor.from);this.minActive=BO(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}if(this.removeActive(i),n)id(n,i)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0;n--){if(this.activeRank[n]<this.pointRank)break;if(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)t.push(this.active[n])}return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function zO(e,t,n,i,r,o){e.goto(t),n.goto(i);let s=i+r,l=i,a=i-t,u=!!o.boundChange;for(let c=!1;;){let f=e.to+a-n.to,h=f||e.endSide-n.endSide,d=h<0?e.to+a:n.to,m=Math.min(d,s);if(e.point||n.point){if(!(e.point&&n.point&&kb(e.point,n.point)&&vb(e.activeForPoint(e.to),n.activeForPoint(n.to))))o.comparePoint(l,m,e.point,n.point);c=!1}else{if(c)o.boundChange(l),c=!1;if(m>l&&!vb(e.active,n.active))o.compareRange(l,m,e.active,n.active);if(u&&m<s&&(f||e.openEnd(d)!=n.openEnd(d)))c=!0}if(d>s)break;if(l=d,h<=0)e.next();if(h>=0)n.next()}}function vb(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!kb(e[n],t[n]))return!1;return!0}function id(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function rd(e,t,n){for(let i=e.length-1;i>=t;i--)e[i+1]=e[i];e[t]=n}function BO(e,t){let n=-1,i=1e9;for(let r=0;r<t.length;r++)if((t[r]-i||e[r].endSide-e[n].endSide)<0)n=r,i=t[r];return n}function cs(e,t,n=e.length){let i=0;for(let r=0;r<n&&r<e.length;)if(e.charCodeAt(r)==9)i+=t-i%t,r++;else i++,r=at(e,r);return i}function QO(e,t,n,i){for(let r=0,o=0;;){if(o>=t)return r;if(r==e.length)break;o+=e.charCodeAt(r)==9?n-o%n:1,r=at(e,r)}return i===!0?-1:e.length}var JO=typeof Symbol>"u"?"__"+"ͼ":Symbol.for("ͼ"),Ab=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ZO=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ti{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,s,l,a){let u=[],c=/^@(\w+)\b/.exec(o[0]),f=c&&c[1]=="keyframes";if(c&&s==null)return l.push(o[0]+";");for(let h in s){let d=s[h];if(/&/.test(h))r(h.split(/,\s*/).map((m)=>o.map((b)=>m.replace(/&/,b))).reduce((m,b)=>m.concat(b)),d,l);else if(d&&typeof d=="object"){if(!c)throw RangeError("The value of a property ("+h+") should be a primitive value.");r(i(h),d,u,f)}else if(d!=null)u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,(m)=>"-"+m.toLowerCase())+": "+d+";")}if(u.length||f)l.push((n&&!c&&!a?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)r(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
22
+ `)}static newName(){let e=ZO[JO]||1;return ZO[JO]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[Ab],r=n&&n.nonce;if(!i)i=new tR(e,r);else if(r)i.setNonce(r);i.mount(Array.isArray(t)?t:[t],e)}}var eR=new Map;class tR{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let r=eR.get(n);if(r)return e[Ab]=r;this.sheet=new i.CSSStyleSheet,eR.set(n,this)}else if(this.styleTag=n.createElement("style"),t)this.styleTag.setAttribute("nonce",t);this.modules=[],e[Ab]=this}mount(e,t){let n=this.sheet,i=0,r=0,o=!1;for(let s=0;s<e.length;s++){let l=e[s],a=this.modules.indexOf(l);if(a<r&&a>-1)this.modules.splice(a,1),o=!0,r--,a=-1;if(a==-1){if(this.modules.splice(r++,0,l),o=!0,n)for(let u=0;u<l.rules.length;u++)n.insertRule(l.rules[u],i++)}else{while(r<a)i+=this.modules[r++].rules.length;i+=l.rules.length,r++}}if(n){if(t.adoptedStyleSheets.indexOf(this.sheet)<0)t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]}else{if(o){let l="";for(let a=0;a<this.modules.length;a++)l+=this.modules[a].getRules()+`
23
+ `;this.styleTag.textContent=l}let s=t.head||t;if(this.styleTag.parentNode!=s)s.insertBefore(this.styleTag,s.firstChild)}}setNonce(e){if(this.styleTag&&this.styleTag.getAttribute("nonce")!=e)this.styleTag.setAttribute("nonce",e)}}var br={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},jl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Q3=typeof navigator<"u"&&/Mac/.test(navigator.platform),J3=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ie=0;Ie<10;Ie++)br[48+Ie]=br[96+Ie]=String(Ie);var Ie;for(Ie=1;Ie<=24;Ie++)br[Ie+111]="F"+Ie;var Ie;for(Ie=65;Ie<=90;Ie++)br[Ie]=String.fromCharCode(Ie+32),jl[Ie]=String.fromCharCode(Ie);var Ie;for(Gu in br)if(!jl.hasOwnProperty(Gu))jl[Gu]=br[Gu];var Gu;function nR(e){var t=Q3&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||J3&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?jl:br)[e.keyCode]||e.key||"Unidentified";if(n=="Esc")n="Escape";if(n=="Del")n="Delete";if(n=="Left")n="ArrowLeft";if(n=="Up")n="ArrowUp";if(n=="Right")n="ArrowRight";if(n=="Down")n="ArrowDown";return n}var Tt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Db=typeof document<"u"?document:{documentElement:{style:{}}},Lb=/Edge\/(\d+)/.exec(Tt.userAgent),_R=/MSIE \d/.test(Tt.userAgent),zb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Tt.userAgent),Nd=!!(_R||zb||Lb),iR=!Nd&&/gecko\/(\d+)/i.test(Tt.userAgent),Ob=!Nd&&/Chrome\/(\d+)/.exec(Tt.userAgent),rR="webkitFontSmoothing"in Db.documentElement.style,Bb=!Nd&&/Apple Computer/.test(Tt.vendor),oR=Bb&&(/Mobile\/\w+/.test(Tt.userAgent)||Tt.maxTouchPoints>2),V={mac:oR||/Mac/.test(Tt.platform),windows:/Win/.test(Tt.platform),linux:/Linux|X11/.test(Tt.platform),ie:Nd,ie_version:_R?Db.documentMode||6:zb?+zb[1]:Lb?+Lb[1]:0,gecko:iR,gecko_version:iR?+(/Firefox\/(\d+)/.exec(Tt.userAgent)||[0,0])[1]:0,chrome:!!Ob,chrome_version:Ob?+Ob[1]:0,ios:oR,android:/Android\b/.test(Tt.userAgent),webkit:rR,webkit_version:rR?+(/\bAppleWebKit\/(\d+)/.exec(Tt.userAgent)||[0,0])[1]:0,safari:Bb,safari_version:Bb?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Tt.userAgent)||[0,0])[1]:0,tabSize:Db.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Jb(e,t){for(let n in e)if(n=="class"&&t.class)t.class+=" "+e.class;else if(n=="style"&&t.style)t.style+=";"+e.style;else t[n]=e[n];return t}var Sd=Object.create(null);function Zb(e,t,n){if(e==t)return!0;if(!e)e=Sd;if(!t)t=Sd;let i=Object.keys(e),r=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let o of i)if(o!=n&&(r.indexOf(o)==-1||e[o]!==t[o]))return!1;return!0}function Z3(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;if(t[i]==null)e.removeAttribute(i)}for(let n in t){let i=t[n];if(n=="style")e.style.cssText=i;else if(e.getAttribute(n)!=i)e.setAttribute(n,i)}}function sR(e,t,n){let i=!1;if(t){for(let r in t)if(!(n&&(r in n)))if(i=!0,r=="style")e.style.cssText="";else e.removeAttribute(r)}if(n){for(let r in n)if(!(t&&t[r]==n[r]))if(i=!0,r=="style")e.style.cssText=n[r];else e.setAttribute(r,n[r])}return i}function eP(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class go{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Ln=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Ln||(Ln={}));class ke extends ei{constructor(e,t,n,i){super();this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new sc(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?300000000:-400000000:t>0?1e8:-1e8,new ds(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,i;if(e.isBlockGap)n=-500000000,i=400000000;else{let{start:r,end:o}=DR(e,t);n=(r?t?-300000000:-1:500000000)-1,i=(o?t?200000000:1:-600000000)+1}return new ds(e,n,i,t,e.widget||null,!0)}static line(e){return new lc(e)}static set(e,t=!1){return pe.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ke.none=pe.empty;class sc extends ke{constructor(e){let{start:t,end:n}=DR(e);super(t?-1:500000000,n?1:-600000000,null,e);this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Jb(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Sd}eq(e){return this==e||e instanceof sc&&this.tagName==e.tagName&&Zb(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw RangeError("Mark decorations may not be empty");return super.range(e,t)}}sc.prototype.point=!1;class lc extends ke{constructor(e){super(-200000000,-200000000,null,e)}eq(e){return e instanceof lc&&this.spec.class==e.spec.class&&Zb(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}lc.prototype.mapMode=Nt.TrackBefore;lc.prototype.point=!0;class ds extends ke{constructor(e,t,n,i,r,o){super(t,n,r,e);this.block=i,this.isReplace=o,this.mapMode=!i?Nt.TrackDel:t<=0?Nt.TrackBefore:Nt.TrackAfter}get type(){return this.startSide!=this.endSide?Ln.WidgetRange:this.startSide<=0?Ln.WidgetBefore:Ln.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ds&&tP(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}ds.prototype.point=!0;function DR(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;if(n==null)n=e.inclusive;if(i==null)i=e.inclusive;return{start:n!==null&&n!==void 0?n:t,end:i!==null&&i!==void 0?i:t}}function tP(e,t){return e==t||!!(e&&t&&e.compare(t))}function ql(e,t,n,i=0){let r=n.length-1;if(r>=0&&n[r]+i>=e)n[r]=Math.max(n[r],t);else n.push(e,t)}class tc extends ei{constructor(e,t,n){super();this.tagName=e,this.attributes=t,this.rank=n}eq(e){return e==this||e instanceof tc&&this.tagName==e.tagName&&Zb(this.attributes,e.attributes)}static create(e){return new tc(e.tagName,e.attributes||Sd,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return pe.of(e,t)}}tc.prototype.startSide=tc.prototype.endSide=-1;function nc(e){let t;if(e.nodeType==11)t=e.getSelection?e:e.ownerDocument;else t=e;return t.getSelection()}function Pb(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Qu(e,t){if(!t.anchorNode)return!1;try{return Pb(e,t.anchorNode)}catch(n){return!1}}function Ju(e){if(e.nodeType==3)return rc(e,0,e.nodeValue.length).getClientRects();else if(e.nodeType==1)return e.getClientRects();else return[]}function Zu(e,t,n,i){return n?lR(e,t,n,i,-1)||lR(e,t,n,i,1):!1}function po(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function kd(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function lR(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:wr(e))){if(e.nodeName=="DIV")return!1;let o=e.parentNode;if(!o||o.nodeType!=1)return!1;t=po(e)+(r<0?0:1),e=o}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?wr(e):0}else return!1}}function wr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function ic(e,t){let{left:n,right:i}=e;if(n==i)return e;let r=t?n:i;return{left:r,right:r,top:e.top,bottom:e.bottom}}function nP(e){let t=e.visualViewport;if(t)return{left:0,right:t.width,top:0,bottom:t.height};return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function LR(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;if(n>0.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)n=1;if(i>0.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)i=1;return{scaleX:n,scaleY:i}}function iP(e,t,n,i,r,o,s,l){let a=e.ownerDocument,u=a.defaultView||window;for(let c=e,f=!1;c&&!f;)if(c.nodeType==1){let h,d=c==a.body,m=1,b=1;if(d)h=nP(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position))f=!0;if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let v=c.getBoundingClientRect();({scaleX:m,scaleY:b}=LR(c,v)),h={left:v.left,right:v.left+c.clientWidth*m,top:v.top,bottom:v.top+c.clientHeight*b}}let x=0,g=0;if(r=="nearest"){if(t.top<h.top+s){if(g=t.top-(h.top+s),n>0&&t.bottom>h.bottom+g)g=t.bottom-h.bottom+s}else if(t.bottom>h.bottom-s){if(g=t.bottom-h.bottom+s,n<0&&t.top-g<h.top)g=t.top-(h.top+s)}}else{let v=t.bottom-t.top,y=h.bottom-h.top;g=(r=="center"&&v<=y?t.top+v/2-y/2:r=="start"||r=="center"&&n<0?t.top-s:t.bottom-y+s)-h.top}if(i=="nearest"){if(t.left<h.left+o){if(x=t.left-(h.left+o),n>0&&t.right>h.right+x)x=t.right-h.right+o}else if(t.right>h.right-o){if(x=t.right-h.right+o,n<0&&t.left<h.left+x)x=t.left-(h.left+o)}}else x=(i=="center"?t.left+(t.right-t.left)/2-(h.right-h.left)/2:i=="start"==l?t.left-o:t.right-(h.right-h.left)+o)-h.left;if(x||g)if(d)u.scrollBy(x,g);else{let v=0,y=0;if(g){let S=c.scrollTop;c.scrollTop+=g/b,y=(c.scrollTop-S)*b}if(x){let S=c.scrollLeft;c.scrollLeft+=x/m,v=(c.scrollLeft-S)*m}if(t={left:t.left-v,top:t.top-y,right:t.right-v,bottom:t.bottom-y},v&&Math.abs(v-x)<1)i="nearest";if(y&&Math.abs(y-g)<1)r="nearest"}if(d)break;if(t.top<h.top||t.bottom>h.bottom||t.left<h.left||t.right>h.right)t={left:Math.max(t.left,h.left),right:Math.min(t.right,h.right),top:Math.max(t.top,h.top),bottom:Math.min(t.bottom,h.bottom)};c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function zR(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let o=e.parentNode;o;)if(o==n.body||(!t||i)&&r)break;else if(o.nodeType==1){if(!r&&o.scrollHeight>o.clientHeight)r=o;if(t&&!i&&o.scrollWidth>o.clientWidth)i=o;o=o.assignedSlot||o.parentNode}else if(o.nodeType==11)o=o.host;else break;return{x:i,y:r}}class BR{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?wr(t):0),n,Math.min(e.focusOffset,n?wr(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}function PR(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)if(n.nodeType==1)t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function IR(e,t=!0){for(let{node:n,left:i,top:r}of e){if(t&&n.scrollTop!=r)n.scrollTop=r;if(n.scrollLeft!=i)n.scrollLeft=i}}var fs=null;if(V.safari&&V.safari_version>=26)fs=!1;function VR(e){if(e.setActive)return e.setActive();if(fs)return e.focus(fs);let t=PR(e);if(e.focus(fs==null?{get preventScroll(){return fs={preventScroll:!0},!0}}:void 0),!fs)fs=!1,IR(t)}var aR;function rc(e,t,n=t){let i=aR||(aR=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function $l(e,t,n,i){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};if(i)({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,e.dispatchEvent(o);let s=new KeyboardEvent("keyup",r);return s.synthetic=!0,e.dispatchEvent(s),o.defaultPrevented||s.defaultPrevented}function rP(e){while(e){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function oP(e,t){let{focusNode:n,focusOffset:i}=t;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;i=Math.min(i,wr(n));for(;;)if(i){if(n.nodeType!=1)return!1;let r=n.childNodes[i-1];if(r.contentEditable=="false")i--;else n=r,i=wr(n)}else if(n==e)return!0;else i=po(n),n=n.parentNode}function HR(e){if(e instanceof Window)return e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4);return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function UR(e,t){for(let n=e,i=t;;)if(n.nodeType==3&&i>0)return{node:n,offset:i};else if(n.nodeType==1&&i>0){if(n.contentEditable=="false")return null;n=n.childNodes[i-1],i=wr(n)}else if(n.parentNode&&!kd(n))i=po(n),n=n.parentNode;else return null}function jR(e,t){for(let n=e,i=t;;)if(n.nodeType==3&&i<n.nodeValue.length)return{node:n,offset:i};else if(n.nodeType==1&&i<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[i],i=0}else if(n.parentNode&&!kd(n))i=po(n)+1,n=n.parentNode;else return null}class ri{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new ri(e.parentNode,po(e),t)}static after(e,t){return new ri(e.parentNode,po(e)+1,t)}}var Be=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Be||(Be={})),ps=Be.LTR,ey=Be.RTL;function FR(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}var sP=FR("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),lP=FR("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Ib=Object.create(null),Ti=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Ib[t]=n,Ib[n]=-t}function KR(e){return e<=247?sP[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?lP[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var aP=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class oi{get dir(){return this.level%2?ey:ps}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let r=-1;for(let o=0;o<e.length;o++){let s=e[o];if(s.from<=t&&s.to>=t){if(s.level==n)return o;if(r<0||(i!=0?i<0?s.from<t:s.to>t:e[r].level>s.level))r=o}}if(r<0)throw RangeError("Index out of range");return r}}function qR(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!qR(i.inner,r.inner))return!1}return!0}var Ce=[];function uP(e,t,n,i,r){for(let o=0;o<=i.length;o++){let s=o?i[o-1].to:t,l=o<i.length?i[o].from:n,a=o?256:r;for(let u=s,c=a,f=a;u<l;u++){let h=KR(e.charCodeAt(u));if(h==512)h=c;else if(h==8&&f==4)h=16;if(Ce[u]=h==4?2:h,h&7)f=h;c=h}for(let u=s,c=a,f=a;u<l;u++){let h=Ce[u];if(h==128)if(u<l-1&&c==Ce[u+1]&&c&24)h=Ce[u]=c;else Ce[u]=256;else if(h==64){let d=u+1;while(d<l&&Ce[d]==64)d++;let m=u&&c==8||d<n&&Ce[d]==8?f==1?1:8:256;for(let b=u;b<d;b++)Ce[b]=m;u=d-1}else if(h==8&&f==1)Ce[u]=1;if(c=h,h&7)f=h}}}function cP(e,t,n,i,r){let o=r==1?2:1;for(let s=0,l=0,a=0;s<=i.length;s++){let u=s?i[s-1].to:t,c=s<i.length?i[s].from:n;for(let f=u,h,d,m;f<c;f++)if(d=Ib[h=e.charCodeAt(f)])if(d<0){for(let b=l-3;b>=0;b-=3)if(Ti[b+1]==-d){let x=Ti[b+2],g=x&2?r:!(x&4)?0:x&1?o:r;if(g)Ce[f]=Ce[Ti[b]]=g;l=b;break}}else if(Ti.length==189)break;else Ti[l++]=f,Ti[l++]=h,Ti[l++]=a;else if((m=Ce[f])==2||m==1){let b=m==r;a=b?0:1;for(let x=l-3;x>=0;x-=3){let g=Ti[x+2];if(g&2)break;if(b)Ti[x+2]|=2;else{if(g&4)break;Ti[x+2]|=4}}}}}function fP(e,t,n,i){for(let r=0,o=i;r<=n.length;r++){let s=r?n[r-1].to:e,l=r<n.length?n[r].from:t;for(let a=s;a<l;){let u=Ce[a];if(u==256){let c=a+1;for(;;)if(c==l){if(r==n.length)break;c=n[r++].to,l=r<n.length?n[r].from:t}else if(Ce[c]==256)c++;else break;let f=o==1,h=(c<t?Ce[c]:i)==1,d=f==h?f?1:2:i;for(let m=c,b=r,x=b?n[b-1].to:e;m>a;){if(m==x)m=n[--b].from,x=b?n[b-1].to:e;Ce[--m]=d}a=c}else o=u,a++}}}function Vb(e,t,n,i,r,o,s){let l=i%2?2:1;if(i%2==r%2)for(let a=t,u=0;a<n;){let c=!0,f=!1;if(u==o.length||a<o[u].from){let b=Ce[a];if(b!=l)c=!1,f=b==16}let h=!c&&l==1?[]:null,d=c?i:i+1,m=a;e:for(;;)if(u<o.length&&m==o[u].from){if(f)break e;let b=o[u];if(!c)for(let x=b.to,g=u+1;;){if(x==n)break e;if(g<o.length&&o[g].from==x)x=o[g++].to;else if(Ce[x]==l)break e;else break}if(u++,h)h.push(b);else{if(b.from>a)s.push(new oi(a,b.from,d));let x=b.direction==ps!=!(d%2);Hb(e,x?i+1:i,r,b.inner,b.from,b.to,s),a=b.to}m=b.to}else if(m==n||(c?Ce[m]!=l:Ce[m]==l))break;else m++;if(h)Vb(e,a,m,i+1,r,h,s);else if(a<m)s.push(new oi(a,m,d));a=m}else for(let a=n,u=o.length;a>t;){let c=!0,f=!1;if(!u||a>o[u-1].to){let b=Ce[a-1];if(b!=l)c=!1,f=b==16}let h=!c&&l==1?[]:null,d=c?i:i+1,m=a;e:for(;;)if(u&&m==o[u-1].to){if(f)break e;let b=o[--u];if(!c)for(let x=b.from,g=u;;){if(x==t)break e;if(g&&o[g-1].to==x)x=o[--g].from;else if(Ce[x-1]==l)break e;else break}if(h)h.push(b);else{if(b.to<a)s.push(new oi(b.to,a,d));let x=b.direction==ps!=!(d%2);Hb(e,x?i+1:i,r,b.inner,b.from,b.to,s),a=b.from}m=b.from}else if(m==t||(c?Ce[m-1]!=l:Ce[m-1]==l))break;else m--;if(h)Vb(e,m,a,i+1,r,h,s);else if(m<a)s.push(new oi(m,a,d));a=m}}function Hb(e,t,n,i,r,o,s){let l=t%2?2:1;uP(e,r,o,i,l),cP(e,r,o,i,l),fP(r,o,i,l),Vb(e,r,o,t,n,i,s)}function hP(e,t,n){if(!e)return[new oi(0,0,t==ey?1:0)];if(t==ps&&!n.length&&!aP.test(e))return $R(e.length);if(n.length)while(e.length>Ce.length)Ce[Ce.length]=256;let i=[],r=t==ps?0:1;return Hb(e,r,r,n,0,e.length,i),i}function $R(e){return[new oi(0,e,0)]}var GR="";function dP(e,t,n,i,r){var o;if(!e.length)return null;let s=i.head-e.from,l;if(i.head==e.from&&i.assoc<0){if(!r)return null;s=t[l=0].side(!1,n)}else if(i.head==e.to&&i.assoc>0){if(r)return null;s=t[l=t.length-1].side(!0,n)}else l=oi.find(t,s,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc);let a=t[l],u=a.side(r,n);if(s==u){let h=l+=r?1:-1;if(h<0||h>=t.length)return null;a=t[l=h],s=a.side(!r,n),u=a.side(r,n)}let c=at(e.text,s,a.forward(r,n));if(c<a.from||c>a.to)c=u;GR=e.text.slice(Math.min(s,c),Math.max(s,c));let f=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];if(c==u){if(!f)return r?N.cursor(e.to,1):N.cursor(e.from,-1);if(f.level+(r?0:1)<a.level)return N.cursor(f.side(!r,n)+e.from,f.forward(r,n)?1:-1,f.level)}return N.cursor(c+e.from,a.forward(r,n)?-1:1,a.level)}function pP(e,t,n){for(let i=t;i<n;i++){let r=KR(e.charCodeAt(i));if(r==1)return ps;if(r==2||r==4)return ey}return ps}var WR=Y.define(),YR=Y.define(),XR=Y.define(),QR=Y.define(),Ub=Y.define(),JR=Y.define(),ZR=Y.define(),ty=Y.define(),ny=Y.define(),eN=Y.define({combine:(e)=>e.some((t)=>t)}),mP=Y.define({combine:(e)=>e.some((t)=>t)}),tN=Y.define();class Gl{constructor(e,t,n,i,r,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new Gl(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Gl(N.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}var cd=ve.define({map:(e,t)=>e.map(t)}),nN=ve.define();function Mt(e,t,n){let i=e.facet(QR);if(i.length)i[0](t);else if(window.onerror&&window.onerror(String(t),n,void 0,void 0,t));else if(n)console.error(n+":",t);else console.error(t)}var yr=Y.define({combine:(e)=>e.length?e[0]:!0}),gP=0,Kl=Y.define({combine(e){return e.filter((t,n)=>{for(let i=0;i<n;i++)if(e[i].plugin==t.plugin)return!1;return!0})}});class fn{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Kl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Kl.of({plugin:this,arg:e}))}static define(e,t){let{eventHandlers:n,eventObservers:i,provide:r,decorations:o}=t||{};return new fn(gP++,e,n,i,(s)=>{let l=[];if(o)l.push(Td.of((a)=>{let u=a.plugin(s);return u?o(u):ke.none}));if(r)l.push(r(s));return l})}static fromClass(e,t){return fn.define((n,i)=>new e(n,i),t)}}class bd{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(!this.value){if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Mt(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}}else if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Mt(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(i){}this.deactivate()}}return this}destroy(e){var t;if((t=this.value)===null||t===void 0?void 0:t.destroy)try{this.value.destroy()}catch(n){Mt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}var iN=Y.define(),iy=Y.define(),Td=Y.define(),rN=Y.define(),ry=Y.define(),ac=Y.define(),oN=Y.define();function uR(e,t){let n=e.state.facet(oN);if(!n.length)return n;let i=n.map((o)=>o instanceof Function?o(e):o),r=[];return pe.spans(i,t.from,t.to,{point(){},span(o,s,l,a){let u=o-t.from,c=s-t.from,f=r;for(let h=l.length-1;h>=0;h--,a--){let d=l[h].spec.bidiIsolate,m;if(d==null)d=pP(t.text,u,c);if(a>0&&f.length&&(m=f[f.length-1]).to==u&&m.direction==d)m.to=c,f=m.inner;else{let b={from:u,to:c,direction:d,inner:[]};f.push(b),f=b.inner}}}}),r}var sN=Y.define();function oy(e){let t=0,n=0,i=0,r=0;for(let o of e.state.facet(sN)){let s=o(e);if(s){if(s.left!=null)t=Math.max(t,s.left);if(s.right!=null)n=Math.max(n,s.right);if(s.top!=null)i=Math.max(i,s.top);if(s.bottom!=null)r=Math.max(r,s.bottom)}}return{left:t,right:n,top:i,bottom:r}}var Wu=Y.define();class Dn{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Dn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(i.fromA>n.toA)continue;if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let i=0,r=0,o=0;;){let s=i<e.length?e[i].fromB:1e9,l=r<t.length?t[r]:1e9,a=Math.min(s,l);if(a==1e9)break;let u=a+o,c=a,f=u;for(;;)if(r<t.length&&t[r]<=c){let h=t[r+1];r+=2,c=Math.max(c,h);for(let d=i;d<e.length&&e[d].fromB<=c;d++)o=e[d].toA-e[d].toB;f=Math.max(f,h+o)}else if(i<e.length&&e[i].fromB<=c){let h=e[i++];c=Math.max(c,h.toB),f=Math.max(f,h.toA),o=h.toA-h.toB}else break;n.push(new Dn(u,f,a,c))}return n}}class Ed{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=We.empty(this.startState.doc.length);for(let r of n)this.changes=this.changes.compose(r.changes);let i=[];this.changes.iterChangedRanges((r,o,s,l)=>i.push(new Dn(r,o,s,l))),this.changedRanges=i}static create(e,t,n){return new Ed(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e)=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var vP=[];class Ve{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return vP}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;if(t)Z3(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let i of this.children){if(i==e)return n;n+=i.length+i.breakAfter}throw RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=po(this.dom),i=this.length?e>0:t>0;return new ri(this.parent.dom,n+(i?1:0),e==0||e==this.length)}markDirty(e){if(this.flags&=-3,e)this.flags|=4;if(this.parent&&this.parent.flags&2)this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof cc)return e;return null}static get(e){return e.cmTile}}class uc extends Ve{constructor(e){super(e,0);this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,i,r=(e===null||e===void 0?void 0:e.node)==t?e:null,o=0;for(let s of this.children){if(s.sync(e),o+=s.length+s.breakAfter,i=n?n.nextSibling:t.firstChild,r&&i!=s.dom)r.written=!0;if(s.dom.parentNode==t)while(i&&i!=s.dom)i=cR(i);else t.insertBefore(s.dom,i);n=s.dom}if(i=n?n.nextSibling:t.firstChild,r&&i)r.written=!0;while(i)i=cR(i);this.length=o}}function cR(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class cc extends uc{constructor(e,t){super(t);this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Ve.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,r=0;;)if(i==n.children.length){if(!t.length)return;if(n=n.parent,n.breakAfter)r++;i=t.pop()}else{let o=n.children[i++];if(o instanceof xr)t.push(i),n=o,i=0;else{let s=r+o.length,l=e(o,r);if(l!==void 0)return l;r=s+o.breakAfter}}}resolveBlock(e,t){let n,i=-1,r,o=-1;if(this.blockTiles((s,l)=>{let a=l+s.length;if(e>=l&&e<=a){if(s.isWidget()&&t>=-1&&t<=1){if(s.flags&32)return!0;if(s.flags&16)n=void 0}if((l<e||e==a&&(t<-1?s.length:s.covers(1)))&&(!n||!s.isWidget()&&n.isWidget()))n=s,i=e-l;if((a>e||e==l&&(t>1?s.length:s.covers(-1)))&&(!r||!s.isWidget()&&r.isWidget()))r=s,o=e-l}}),!n&&!r)throw Error("No tile at position "+e);return n&&t<0||!r?{tile:n,offset:i}:{tile:r,offset:o}}}class xr extends uc{constructor(e,t){super(e);this.wrapper=t}isBlock(){return!0}covers(e){if(!this.children.length)return!1;return e<0?this.children[0].covers(-1):this.lastChild.covers(1)}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new xr(t||document.createElement(e.tagName),e);if(!t)n.flags|=4;return n}}class Wl extends uc{constructor(e,t){super(e);this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new Wl(t||document.createElement("div"),e);if(!t||!n)i.flags|=4;return i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let i=null,r=-1,o=null,s=-1;function l(u,c){for(let f=0,h=0;f<u.children.length&&h<=c;f++){let d=u.children[f],m=h+d.length;if(m>=c){if(d.isComposite())l(d,c-h);else if((!o||o.isHidden&&(t>0&&!(o.flags&32)||n&&yP(o,d)))&&(m>c||d.flags&32&&t<=1))o=d,s=c-h;else if(h<c||d.flags&16&&!d.isHidden&&t>=-1)i=d,r=c-h}h=m}}l(this,e);let a=(t<0?i:o)||i||o;return a?{tile:a,offset:a==i?r:s}:null}coordsIn(e,t,n){let i=this.resolveInline(e,t,!0);if(!i)return bP(this);return i.tile.coordsIn(Math.max(0,i.offset),t,n)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:i,offset:r}=n;if(this.dom.contains(i.dom)){if(i.isText())return new ri(i.dom,Math.min(i.dom.nodeValue.length,r));return i.domPosFor(r,i.flags&16?1:i.flags&32?-1:t)}let o=n.tile.parent,s=!1;for(let l of o.children){if(s)return new ri(l.dom,0);if(l==n.tile)s=!0}}return new ri(this.dom,0)}}function bP(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Ju(t);return n[n.length-1]||null}function yP(e,t){let n=e.coordsIn(0,1),i=t.coordsIn(0,1);return n&&i&&i.top<n.bottom}class Kt extends uc{constructor(e,t){super(e);this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new Kt(t||document.createElement(e.tagName),e);if(!t)n.flags|=4;return n}}class hs extends Ve{constructor(e,t){super(e,t.length);this.text=t}sync(e){if(this.flags&2)return;if(super.sync(e),this.dom.nodeValue!=this.text){if(e&&e.node==this.dom)e.written=!0;this.dom.nodeValue=this.text}}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let i=this.dom.nodeValue.length;if(e>i)e=i;let r=e,o=e,s=0;if(e==0&&t<0||e==i&&t>=0){if(!(V.chrome||V.gecko)){if(e)r--,s=1;else if(o<i)o++,s=-1}}else if(t<0)r--;else if(o<i)o++;let l=rc(this.dom,r,o).getClientRects();if(!l.length)return null;let a=l[(s?s<0:t>=0)?0:l.length-1];if(V.safari&&!s&&a.width==0)a=Array.prototype.find.call(l,(u)=>u.width)||a;return n==null?a:ic(a,(s?s>0:t<0)==n)}static of(e,t){let n=new hs(t||document.createTextNode(e),e);if(!t)n.flags|=2;return n}}class ms extends Ve{constructor(e,t,n,i){super(e,t,i);this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){if(this.flags&48)return!1;return(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return ic(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);else{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let s=this.flags&16?!0:this.flags&32?!1:e>0;for(let l=s?r.length-1:0;;l+=s?-1:1)if(o=r[l],e>0?l==0:l==r.length-1||o.top<o.bottom)break;return ic(o,!s)}}get overrideDOMText(){if(!this.length)return ce.empty;let{root:e}=this;if(!e)return ce.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,i,r){if(!r){if(r=e.toDOM(t),!e.editable)r.contentEditable="false"}return new ms(r,n,e,i)}}class oc extends Ve{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true");super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return ce.empty}coordsIn(e,t,n){let i=this.dom.getBoundingClientRect();return n==null?i:ic(i,t>0==n)}}class lN{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:r,beforeBreak:o,parents:s}=this;while(e||t>0)if(!i.isComposite()){let l=i.length;if(r<l&&e){let a=Math.min(e,l-r);if(n)n.skip(i,r,r+a);e-=a,r+=a}if(r==l)o=!!i.breakAfter,{tile:i,index:r}=s.pop(),r++;else if(!e)break}else if(o){if(!e)break;if(n)n.break();e--,o=!1}else if(r==i.children.length){if(!e&&!s.length)break;if(n)n.leave(i);o=!!i.breakAfter,{tile:i,index:r}=s.pop(),r++}else{let l=i.children[r],a=l.breakAfter;if((t>0?l.length<=e:l.length<e)&&(!n||n.skip(l,0,l.length)!==!1||!l.isComposite))o=!!a,r++,e-=l.length;else if(s.push({tile:i,index:r}),i=l,r=0,n&&l.isComposite())n.enter(l)}return this.tile=i,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class aN{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class uN{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var r;this.flushBuffer();let o=this.ensureMarks(t,n),s=o.lastChild;if(s&&s.isText()&&!(s.flags&8)&&s.length+e.length<512){this.cache.reused.set(s,2);let l=o.children[o.children.length-1]=new hs(s.dom,s.text+e);l.parent=o}else o.append(i||hs.of(e,(r=this.cache.find(hs))===null||r===void 0?void 0:r.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;if(n.dom!=t.line.dom)n.setDOM(this.cache.reused.has(t.line)?Rb(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2);let i=n;for(let s=t.marks.length-1;s>=0;s--){let l=t.marks[s],a=i.lastChild;if(a instanceof Kt&&a.mark.eq(l.mark)){if(a.dom!=l.dom)a.setDOM(Rb(l.dom));i=a}else{let{dom:u}=l;if(this.cache.reused.get(l)){if(Ve.get(l.dom))u=Rb(l.dom)}let c=Kt.of(l.mark,u);i.append(c),i=c}this.cache.reused.set(l,2)}let r=Ve.get(e.text);if(r)this.cache.reused.set(r,2);let o=new hs(e.text,e.text.nodeValue);o.flags|=8,this.pos=e.range.toB,i.append(o)}addInlineWidget(e,t,n){let i=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);if(!i)this.flushBuffer();let r=this.ensureMarks(t,n);if(!i&&!(e.flags&16))r.append(this.getBuffer(1));r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;if(!e)e=dN;let i=Wl.start(e,t||((n=this.cache.find(Wl))===null||n===void 0?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){if(!this.blockPosCovered())this.addLineStart(e)}ensureLine(e){if(!this.curLine)this.addLineStart(e)}ensureMarks(e,t){var n;let i=this.curLine;for(let r=e.length-1;r>=0;r--){let o=e[r],s;if(t>0&&(s=i.lastChild)&&s instanceof Kt&&s.mark.eq(o))i=s,t--;else{let l=Kt.of(o,(n=this.cache.find(Kt,(a)=>a.mark.eq(o)))===null||n===void 0?void 0:n.dom);i.append(l),i=l,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;if(!e||!fR(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(V.ios&&fR(this.curLine,!0)))this.curLine.append(this.cache.findWidget(Nb,0,32)||new ms(Nb.toDOM(),0,Nb,32));this.curLine=this.afterWidget=null}}updateBlockWrappers(){if(this.wrapperPos>this.pos+1e4)this.blockWrappers.goto(this.pos),this.wrappers.length=0;for(let e=this.wrappers.length-1;e>=0;e--)if(this.wrappers[e].to<this.pos)this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new aN(e.from,e.to,e.value,t),i=this.wrappers.length;while(i>0&&(this.wrappers[i-1].rank-n.rank||this.wrappers[i-1].to-n.to)<0)i--;this.wrappers.splice(i,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof xr&&i.wrapper.eq(n.wrapper))t=i;else{let r=xr.of(n.wrapper,(e=this.cache.find(xr,(o)=>o.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(oc,void 0,1);if(n)n.flags=t;return n||new oc(t)}flushBuffer(){if(this.afterWidget&&!(this.afterWidget.flags&32))this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null}}class cN{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){if(this.textOff+e<=this.text.length)this.textOff+=e;else this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0}next(e){if(this.textOff==this.text.length){let{value:i,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw Error("Ran out of text content when drawing inline views");this.text=i;let s=this.textOff=Math.min(e,i.length);return r?null:i.slice(0,s)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}var Cd=[ms,Wl,hs,Kt,oc,xr,cc];for(let e=0;e<Cd.length;e++)Cd[e].bucket=e;class fN{constructor(e){this.view=e,this.buckets=Cd.map(()=>[]),this.index=Cd.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];if(n.length<6)n.push(e);else n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,r=this.buckets[i],o=this.index[i];for(let s=0;s<r.length;s++){let l=(s+o)%r.length,a=r[l];if((!t||t(a))&&!this.reused.has(a)){if(r.splice(l,1),l<o)this.index[i]--;return this.reused.set(a,n),a}}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let r=0,o=0;;r++){if(r==i.length){if(o)return null;o=1,r=0}let s=i[r];if(!this.reused.has(s)&&(o==0?s.widget.compare(e):s.widget.constructor==e.constructor&&e.updateDOM(s.dom,this.view,s.widget))){if(i.splice(r,1),r<this.index[0])this.index[0]--;if(s.widget==e&&s.length==t&&(s.flags&497)==n)return this.reused.set(s,1),s;else return this.reused.set(s,2),new ms(s.dom,t,e,s.flags&-498|n)}}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(this.reused.has(e))return;return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class hN{constructor(e,t,n,i,r){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new fN(e),this.text=new cN(e.state.doc),this.builder=new uN(this.cache,new cc(e,e.contentDOM),pe.iter(n)),this.cache.reused.set(t,2),this.old=new lN(t),this.reuseWalker={skip:(o,s,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:(o)=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,r=0,o=0;;){let s=o<e.length?e[o++]:null,l=s?s.fromA:this.old.root.length;if(l>i){let a=l-i;this.preserve(a,!o,!s),i=l,r+=a}if(!s)break;if(t&&s.fromA<=t.range.fromA&&s.toA>=t.range.toA)this.forward(s.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(r,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,s.toA),this.emit(t.range.toB,s.toB);else this.forward(s.fromA,s.toA),this.emit(r,s.toB);r=s.toB,i=s.toA}if(this.builder.curLine)this.builder.endLine();return this.builder.root}preserve(e,t,n){let i=SP(this.old),r=this.openMarks;this.old.advance(e,n?1:-1,{skip:(o,s,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-s);else{let a=l>0||s<o.length?ms.of(o.widget,this.view,l-s,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);if(a.flags&256)a.flags&=-2,this.builder.addBlockWidget(a);else this.builder.ensureLine(null),this.builder.addInlineWidget(a,i,r),r=i.length}else if(o.isText()){if(this.builder.ensureLine(null),!s&&l==o.length&&!this.cache.reused.has(o))this.builder.addText(o.text,i,r,this.cache.reuse(o));else this.cache.add(o),this.builder.addText(o.text.slice(s,l),i,r);r=i.length}else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof oc)this.cache.add(o);else if(o instanceof Kt)this.builder.ensureLine(null),this.builder.addMark(o,i,r),this.cache.reused.set(o,1),r=i.length;else return!1;this.openWidget=!1},enter:(o)=>{if(o.isLine())this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o));else if(this.cache.add(o),o instanceof Kt)i.unshift(o.mark);this.openWidget=!1},leave:(o)=>{if(o.isLine()){if(i.length)i.length=r=0}else if(o instanceof Kt)i.shift(),r=Math.min(r,i.length)},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,i=this.builder,r=-1,o=pe.spans(this.decorations,e,t,{point:(s,l,a,u,c,f)=>{if(a instanceof ds){if(this.disallowBlockEffectsFor[f]){if(a.block)throw RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(s).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=u.length,c>u.length)i.continueWidget(l-s);else{let h=a.widget||(a.block?gs.block:gs.inline),d=xP(a),m=this.cache.findWidget(h,l-s,d)||ms.of(h,this.view,l-s,d);if(a.block){if(a.startSide>0)i.addLineStartIfNotCovered(n);i.addBlockWidget(m)}else i.ensureLine(n),i.addInlineWidget(m,u,c)}n=null}else n=wP(n,a);if(l>s)this.text.skip(l-s)},span:(s,l,a,u)=>{for(let c=s;c<l;){let f=this.text.next(Math.min(512,l-c));if(f==null)i.addLineStartIfNotCovered(n),i.addBreak(),c++;else i.ensureLine(n),i.addText(f,a,c==s?u:a.length),c+=f.length;n=null}r=a.length}});if(r>-1)this.openWidget=o>r;if(!this.openWidget)i.addLineStartIfNotCovered(n);this.openMarks=o}forward(e,t,n=1){if(t-e<=10)this.old.advance(t-e,n,this.reuseWalker);else this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker)}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let r=Ve.get(i);if(i==this.view.contentDOM)break;if(r instanceof Kt)t.push(r);else if(r===null||r===void 0?void 0:r.isLine())n=r;else if(r instanceof xr);else if(i.nodeName=="DIV"&&!n)n=new Wl(i,dN);else if(!n)t.push(Kt.of(new sc({tagName:i.nodeName.toLowerCase(),attributes:eP(i)}),i))}if(!n)return null;return{line:n,marks:t}}}function fR(e,t){let n=(i)=>{for(let r of i.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function xP(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;if(e.block)t|=256;return t}var dN={class:"cm-line"};function wP(e,t){let n=t.spec.attributes,i=t.spec.class;if(!n&&!i)return e;if(!e)e={class:"cm-line"};if(n)Jb(n,e);if(i)e.class+=" "+i;return e}function SP(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;if(i instanceof Kt)t.push(i.mark)}return t}function Rb(e){let t=Ve.get(e);if(t)t.setDOM(e.cloneNode());return e}class gs extends go{constructor(e){super();this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}gs.inline=new gs("span");gs.block=new gs("div");var Nb=new class extends go{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class jb{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ke.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new cc(e,e.contentDOM),this.updateInner([new Dn(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;if(this.minWidth>0&&n.length)if(!n.every(({fromA:u,toA:c})=>c<this.minWidthFrom||u>this.minWidthTo))this.minWidth=this.minWidthFrom=this.minWidthTo=0;else this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1);this.updateEditContextFormatting(e);let i=-1;if(this.view.inputState.composing>=0&&!this.view.observer.editContext){if((t=this.domChanged)===null||t===void 0?void 0:t.newSel)i=this.domChanged.newSel.head;else if(!TP(e.changes,this.hasComposition)&&!e.selectionSet)i=e.state.selection.main.head}let r=i>-1?EP(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:c}=this.hasComposition;n=new Dn(u,c,e.changes.mapPos(u,-1),e.changes.mapPos(c,1)).addToSet(n.slice())}if(this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(V.ie||V.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines)this.forceSelection=!0;let o=this.decorations,s=this.blockWrappers;this.updateDeco();let l=OP(o,this.decorations,e.changes);if(l.length)n=Dn.extendWithRanges(n,l);let a=RP(s,this.blockWrappers,e.changes);if(a.length)n=Dn.extendWithRanges(n,a);if(r&&!n.some((u)=>u.fromA<=r.range.fromA&&u.toA>=r.range.toA))n=r.range.addToSet(n.slice());if(this.tile.flags&2&&n.length==0)return!1;else{if(this.updateInner(n,r),e.transactions.length)this.lastUpdate=Date.now();return!0}}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let o=this.tile,s=new hN(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);if(t&&Ve.get(t.text))s.cache.reused.set(Ve.get(t.text),2);this.tile=s.run(e,t),Fb(o,s.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=V.chrome||V.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;if(this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node)))this.forceSelection=!0;this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){for(let r of this.tile.children)if(r.isWidget()&&r.widget instanceof yd)i.push(r.dom)}n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)if(n.is(nN))this.editContextFormatting=n.value}updateSelection(e=!1,t=!1){if(e||!this.view.observer.selectionRange.focusNode)this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,r=i==n,o=!r&&!(this.view.state.facet(yr)||n.tabIndex>-1)&&Qu(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(r||t||o))return;let s=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a,u;if(l.empty)u=a=this.inlineDOMNearPos(l.anchor,l.assoc||1);else u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),a=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1);if(V.gecko&&l.empty&&!this.hasComposition&&kP(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=u=new ri(f,0),s=!0}let c=this.view.observer.selectionRange;if(s||!c.focusNode||(!Zu(a.node,a.offset,c.anchorNode,c.anchorOffset)||!Zu(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l))this.view.observer.ignore(()=>{if(V.android&&V.chrome&&n.contains(c.focusNode)&&NP(c.focusNode,n))n.blur(),n.focus({preventScroll:!0});let f=nc(this.view.root);if(!f);else if(l.empty){if(V.gecko){let h=CP(a.node,a.offset);if(h&&h!=3){let d=(h==1?UR:jR)(a.node,a.offset);if(d)a=new ri(d.node,d.offset)}}if(f.collapse(a.node,a.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0)f.caretBidiLevel=l.bidiLevel}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(u.node,u.offset)}catch(h){}}else{let h=document.createRange();if(l.anchor>l.head)[a,u]=[u,a];h.setEnd(u.node,u.offset),h.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(h)}if(o&&this.view.root.activeElement==n){if(n.blur(),i)i.focus()}}),this.view.observer.setSelectionRange(a,u);this.impreciseAnchor=a.precise?null:new ri(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new ri(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Zu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=nc(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let s=o.posAtStart;if(t.head==s||t.head==s+o.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let u=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let c=e.observer.selectionRange;if(e.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=t.from)n.collapse(i,r)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let i=n.posAtStart;if(n.isComposite()){let r;if(e==n.dom)r=n.dom.childNodes[t];else{let o=wr(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==n.dom)break;if(o==0&&s.firstChild!=s.lastChild)if(e==s.firstChild)o=-1;else o=1;e=s}if(o<0)r=e;else r=e.nextSibling}if(r==n.dom.firstChild)return i;while(r&&!Ve.get(r))r=r.nextSibling;if(!r)return i+n.length;for(let o=0,s=i;;o++){let l=n.children[o];if(l.dom==r)return s;s+=l.length+l.breakAfter}}else if(n.isText())return e==n.dom?i+t:i+(t?n.length:0);else return i}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);if(n.isWidget())return n.domPosFor(i,t);return n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i=-1,r=!1,o,s=-1,l=!1;if(this.tile.blockTiles((a,u)=>{if(a.isWidget()){if(a.flags&32&&u>=e)return!0;if(a.flags&16)r=!0}else{let c=u+a.length;if(u<=e)n=a,i=e-u,r=c<e;if(c>=e&&!o)o=a,s=e-u,l=u>e;if(u>e&&o)return!0}}),!n&&!o)return this.domAtPos(e,t);if(r&&o)n=null;else if(l&&n)o=null;return n&&t<0||!o?n.domIn(i,t):o.domIn(s,t)}coordsAt(e,t,n){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);if(i.isWidget()){if(i.widget instanceof yd)return null;return i.coordsInWidget(r,t,!0)}return i.coordsIn(r,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function i(r,o){if(r.isComposite())for(let s of r.children){if(s.length>=o){let l=i(s,o);if(l)return l}if(o-=s.length,o<0)break}else if(r.isText()&&o<r.length){let s=at(r.text,o);if(s==o)return null;let l=rc(r.dom,o,s).getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(a==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return i(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,l=this.view.textDirection==Be.LTR,a=0,u=(c,f,h)=>{for(let d=0;d<c.children.length;d++){if(f>i)break;let m=c.children[d],b=f+m.length,x=m.dom.getBoundingClientRect(),{height:g}=x;if(h&&!d)a+=x.top-h.top;if(m instanceof xr){if(b>n)u(m,f,x)}else if(f>=n){if(a>0)t.push(-a);if(t.push(g+a),a=0,o){let v=m.dom.lastChild,y=v?Ju(v):[];if(y.length){let S=y[y.length-1],k=l?S.right-x.left:x.right-S.left;if(k>s)s=k,this.minWidth=r,this.minWidthFrom=f,this.minWidthTo=b}}}if(h&&d==c.children.length-1)a+=h.bottom-x.bottom;f=b+m.breakAfter}};return u(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Be.RTL:Be.LTR}measureTextSize(){let e=this.tile.blockTiles((o)=>{if(o.isLine()&&o.children.length&&o.length<=20){let s=0,l;for(let a of o.children){if(!a.isText()||/[^ -~]/.test(a.text))return;let u=Ju(a.dom);if(u.length!=1)return;s+=u[0].width,l=u[0].height}if(s)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:s/o.length,textHeight:l}}});if(e)return e;let t=document.createElement("div"),n,i,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=Ju(t.firstChild)[0];n=t.getBoundingClientRect().height,i=o&&o.width?o.width/27:7,r=o&&o.height?o.height:n,t.remove()}),{lineHeight:n,charWidth:i,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],o=r?r.from-1:this.view.state.doc.length;if(o>n){let s=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(ke.replace({widget:new yd(s),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return ke.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Td).map((r)=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),n=!1,i=this.view.state.facet(ry).map((r,o)=>{let s=typeof r=="function";if(s)n=!0;return s?r(this.view):r});if(i.length)this.dynamicDecorationMap[e++]=n,t.push(pe.join(i));this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];while(e<this.decorations.length)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(rN).map((r)=>typeof r=="function"?r(this.view):r)}scrollIntoView(e){if(e.isSnapshot){let a=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=a.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let a of this.view.state.facet(tN))try{if(a(this.view,e.range,e))return!0}catch(u){Mt(this.view.state,u,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),i;if(!n)return;if(!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1)))n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)};let r=oy(this.view),o={left:n.left-r.left,top:n.top-r.top,right:n.right+r.right,bottom:n.bottom+r.bottom},{offsetWidth:s,offsetHeight:l}=this.view.scrollDOM;if(iP(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Be.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let a=this.view.docView.lineAt(t.head,1);if(a){let u=PR(a.dom);a.dom.scrollIntoView({block:"nearest"}),IR(u,!1)}}}lineHasWidget(e){let t=(n)=>n.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Fb(this.tile)}}function Fb(e,t){let n=t===null||t===void 0?void 0:t.get(e);if(n!=1){if(n==null)e.destroy();for(let i of e.children)Fb(i,t)}}function kP(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function pN(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=UR(n.focusNode,n.focusOffset),r=jR(n.focusNode,n.focusOffset),o=i||r;if(r&&i&&r.node!=i.node){let l=Ve.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)o=r;else if(e.docView.lastCompositionAfterCursor){let a=Ve.get(i.node);if(!(!a||a.isText()&&a.text!=i.node.nodeValue))o=r}}if(e.docView.lastCompositionAfterCursor=o!=i,!o)return null;let s=t-o.offset;return{from:s,to:s+o.node.nodeValue.length,node:o.node}}function EP(e,t,n){let i=pN(e,n);if(!i)return null;let{node:r,from:o,to:s}=i,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(e.state.doc.sliceString(i.from,i.to)!=l)return null;let a=t.invertedDesc;return{range:new Dn(a.mapPos(o),a.mapPos(s),o,s),text:r}}function CP(e,t){if(e.nodeType!=1)return 0;return(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable=="false"?2:0)}var AP=class{constructor(){this.changes=[]}compareRange(t,n){ql(t,n,this.changes)}comparePoint(t,n){ql(t,n,this.changes)}boundChange(t){ql(t,t,this.changes)}};function OP(e,t,n){let i=new AP;return pe.compare(e,t,n,i),i.changes}class mN{constructor(){this.changes=[]}compareRange(e,t){ql(e,t,this.changes)}comparePoint(){}boundChange(e){ql(e,e,this.changes)}}function RP(e,t,n){let i=new mN;return pe.compare(e,t,n,i),i.changes}function NP(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function TP(e,t){let n=!1;if(t)e.iterChangedRanges((i,r)=>{if(i<t.to&&r>t.from)n=!0});return n}class yd extends go{constructor(e){super();this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function MP(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),o=t-r.from;if(r.length==0)return N.cursor(t);if(o==0)n=1;else if(o==r.length)n=-1;let s=o,l=o;if(n<0)s=at(r.text,o,!1);else l=at(r.text,o);let a=i(r.text.slice(s,l));while(s>0){let u=at(r.text,s,!1);if(i(r.text.slice(u,s))!=a)break;s=u}while(l<r.length){let u=at(r.text,l);if(i(r.text.slice(l,u))!=a)break;l=u}return N.undirectionalRange(s+r.from,l+r.from)}function _P(e,t,n,i,r){let o=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,a=Math.floor((r-n.top-(e.defaultLineHeight-l)*0.5)/l);o+=a*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+QO(s,o,e.state.tabSize)}function DP(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let r;for(let o of i.type){if(o.from>t)break;if(o.to<t)continue;if(o.from<t&&o.to>t)return o;if(!r||o.type==Ln.Text&&(r.type!=o.type||(n<0?o.from<t:o.to>t)))r=o}return r||i}return i}function LP(e,t,n,i){let r=DP(e,t.head,t.assoc||-1),o=!i||r.type!=Ln.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(o){let s=e.dom.getBoundingClientRect(),l=e.textDirectionAt(r.from),a=e.posAtCoords({x:n==(l==Be.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(a!=null)return N.cursor(a,n?-1:1)}return N.cursor(n?r.to:r.from,n?-1:1)}function hR(e,t,n,i){let r=e.state.doc.lineAt(t.head),o=e.bidiSpans(r),s=e.textDirectionAt(r.from);for(let l=t,a=null;;){let u=dP(r,o,s,l,n),c=GR;if(!u){if(r.number==(n?e.state.doc.lines:1))return l;c=`
24
+ `,r=e.state.doc.line(r.number+(n?1:-1)),o=e.bidiSpans(r),u=n?N.cursor(r.from,-1):N.cursor(r.to,1)}if(!a){if(!i)return u;a=i(c)}else if(!a(c))return l;l=u}}function zP(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return(o)=>{let s=i(o);if(r==_n.Space)r=s;return r==s}}function BP(e,t,n,i){let r=t.head,o=n?1:-1;if(r==(n?e.state.doc.length:0))return N.cursor(r,t.assoc);let s=t.goalColumn,l,a=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),c=e.documentTop;if(u){if(s==null)s=u.left-a.left;l=o<0?u.top:u.bottom}else{let m=e.viewState.lineBlockAt(r);if(s==null)s=Math.min(a.right-a.left,e.defaultCharacterWidth*(r-m.from));l=(o<0?m.top:m.bottom)+c}let f=a.left+s,h=e.viewState.heightOracle.textHeight>>1,d=i!==null&&i!==void 0?i:h;for(let m=0;;m+=h){let b=l+(d+m)*o,x=Kb(e,{x:f,y:b},!1,o);if(n?b>a.bottom:b<a.top)return N.cursor(x.pos,x.assoc);let g=e.coordsAtPos(x.pos,x.assoc),v=g?(g.top+g.bottom)/2:0;if(!g||(n?v>l:v<l))return N.cursor(x.pos,x.assoc,void 0,s)}}function ec(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,(o,s,l)=>{if(t>o&&t<s){let a=i||n||(t-o<s-t?-1:1);t=a<0?o:s,i=a}});if(!i)return t}}function gN(e,t){let n=null;for(let i=0;i<t.ranges.length;i++){let r=t.ranges[i],o=null;if(r.empty){let s=ec(e,r.from,0);if(s!=r.from)o=N.cursor(s,-1)}else{let s=ec(e,r.from,-1),l=ec(e,r.to,1);if(s!=r.from||l!=r.to)if(r.undirectional)o=N.undirectionalRange(r.from,r.to);else o=N.range(r.from==r.anchor?s:l,r.from==r.head?s:l)}if(o){if(!n)n=t.ranges.slice();n[i]=o}}return n?N.create(n,t.mainIndex):t}function Tb(e,t,n){let i=ec(e.state.facet(ac).map((r)=>r(e)),n.from,t.head>n.from?-1:1);return i==n.from?n:N.cursor(i,i<n.from?1:-1)}class ni{constructor(e,t){this.pos=e,this.assoc=t}}function Kb(e,t,n,i){let r=e.contentDOM.getBoundingClientRect(),o=r.top+e.viewState.paddingTop,{x:s,y:l}=t,a=l-o,u;for(;;){if(a<0)return new ni(0,1);if(a>e.viewState.docHeight)return new ni(e.state.doc.length,-1);if(u=e.elementAtHeight(a),i==null)break;if(u.type==Ln.Text){if(i<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let h=e.docView.coordsAt(i<0?u.from:u.to,i>0?-1:1);if(h&&(i<0?h.top<=a+o:h.bottom>=a+o))break}let f=e.viewState.heightOracle.textHeight/2;a=i>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==Ln.Text){let f=_P(e,r,u,s,l);return new ni(f,f==u.from?1:-1)}}if(u.type!=Ln.Text)return a<(u.top+u.bottom)/2?new ni(u.from,1):new ni(u.to,-1);let c=e.docView.lineAt(u.from,2);if(!c||c.length!=u.length)c=e.docView.lineAt(u.from,-2);return new vN(e,s,l,e.textDirectionAt(u.from)).scanTile(c,u.from)}class vN{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){if(!this.line||this.line.from>e||this.line.to<e)this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line);return this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[oi.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[oi.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t,n=!1){let i=0,r=e.length-1,o=new Set,s=this.bidiIn(e[0],e[r]),l,a,u=-1,c=1e9,f;e:while(i<r){let d=r-i,m=i+r>>1;t:if(o.has(m)){for(let g=1;g<d;g++){let v=m+g;if(v>=r)v-=d;if(!o.has(v)){m=v;break t}}break e}o.add(m);let b=t(m),x=0;if(b)for(let g=0;g<b.length;g++){let v=b[g];if(v.width==0&&b.length>1)continue;if(v.bottom<this.y){if(!l||l.bottom<v.bottom)l=v;x=1}else if(v.top>this.y){if(!a||a.top>v.top)a=v;x=-1}else{let y=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,S=Math.abs(y);if(S<c)u=m,c=S,f=v;if(y)x=y<0==(this.baseDir==Be.LTR)?-1:1}}if(x==-1&&(!s||this.baseDirAt(e[m],1)))r=m;else if(x==1&&(!s||this.baseDirAt(e[m+1],-1)))i=m+1}if(!f){if(!a&&!l)return{i:0,after:!1};let d=l&&(!a||this.y-l.bottom<a.top-this.y)?l:a;return this.y=(d.top+d.bottom)/2,this.scan(e,t,!0)}if(c&&!n){let{top:d,bottom:m}=f;if(l&&l.bottom>(d+d+m)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(a&&a.top<(d+m+m)/3)return this.y=a.top+1,this.scan(e,t,!0)}let h=(s?this.dirAt(e[u],1):this.baseDir)==Be.LTR;return{i:u,after:this.x>(f.left+f.right)/2==h}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=at(e.text,r))n.push(t+r);n.push(t+e.length);let i=this.scan(n,(r)=>{let o=n[r]-t,s=n[r+1]-t;return rc(e.dom,o,s).getClientRects()});return i.after?new ni(n[i.i+1],-1):new ni(n[i.i],1)}scanTile(e,t){if(!e.length)return new ni(t,1);if(e.children.length==1){let s=e.children[0];if(s.isText())return this.scanText(s,t);else if(s.isComposite())return this.scanTile(s,t)}let n=[t];for(let s=0,l=t;s<e.children.length;s++)n.push(l+=e.children[s].length);let i=this.scan(n,(s)=>{let l=e.children[s];if(l.flags&48)return null;return(l.dom.nodeType==1?l.dom:rc(l.dom,0,l.length)).getClientRects()}),r=e.children[i.i],o=n[i.i];if(r.isText())return this.scanText(r,o);if(r.isComposite())return this.scanTile(r,o);return i.after?new ni(n[i.i+1],-1):new ni(o,1)}}var Fl="￿";class bN{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(de.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Fl}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let r=this.text.length;this.readNode(i);let o=Ve.get(i),s=i.nextSibling;if(s==t){if((o===null||o===void 0?void 0:o.breakAfter)&&!s&&n!=this.view.contentDOM)this.lineBreak();break}let l=Ve.get(s);if((o&&l?o.breakAfter:(o?o.breakAfter:kd(i))||kd(s)&&(i.nodeName!="BR"||(o===null||o===void 0?void 0:o.isWidget()))&&this.text.length>r)&&!IP(s,t))this.lineBreak();i=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)if(n.node==e)n.pos=this.text.length+Math.min(n.offset,t.length);for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,s;if(this.lineSeparator)r=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length;else if(s=i.exec(t))r=s.index,o=s[0].length;if(this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1){for(let l of this.points)if(l.node==e&&l.pos>this.text.length)l.pos-=o-1}n=r+o}}readNode(e){let t=Ve.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)if(i.lineBreak)this.lineBreak();else this.append(i.value)}else if(e.nodeType==3)this.readTextNode(e);else if(e.nodeName=="BR"){if(e.nextSibling)this.lineBreak()}else if(e.nodeType==1)this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)if(n.node==e&&e.childNodes[n.offset]==t)n.pos=this.text.length}findPointInside(e,t){for(let n of this.points)if(e.nodeType==3?n.node==e:e.contains(n.node))n.pos=this.text.length+(PP(e,n.node,n.offset)?t:0)}}function PP(e,t,n){for(;;){if(!t||n<wr(t))return!1;if(t==e)return!0;n=po(t)+1,t=t.parentNode}}function IP(e,t){let n;for(;;e=e.nextSibling){if(e==t||!e)break;let i=Ve.get(e);if(!(i===null||i===void 0?void 0:i.isWidget()))return!1;if(i)(n||(n=[])).push(i)}if(n)for(let i of n){let r=i.overrideDOMText;if(r===null||r===void 0?void 0:r.length)return!1}return!0}class qb{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class yN{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView,s=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=xN(e.docView.tile,t,n,0))){let l=r||o?[]:HP(e),a=new bN(l,e);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=UP(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!Pb(e.contentDOM,l.focusNode)?s.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Pb(e.contentDOM,l.anchorNode)?s.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((V.ios||V.chrome)&&a!=u&&Math.min(a,u)<=s.main.from&&Math.max(a,u)>=s.main.to&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(a,u),h=Math.max(a,u),d=c.from-f,m=c.to-h;if((d==0||d==1||f==0)&&(m==0||m==-1||h==e.state.doc.length))a=0,u=e.state.doc.length}if(e.inputState.composing>-1&&s.ranges.length>1)this.newSel=s.replaceRange(N.range(u,a));else if(e.lineWrapping&&u==a&&!(s.main.empty&&s.main.head==a)&&e.inputState.lastTouchTime>Date.now()-100){let f=e.coordsAtPos(a,-1),h=0;if(f)h=e.inputState.lastTouchY<=f.bottom?-1:1;this.newSel=N.create([N.cursor(a,h)])}else this.newSel=N.single(u,a)}}}function xN(e,t,n,i){if(e.isComposite()){let r=-1,o=-1,s=-1,l=-1;for(let a=0,u=i,c=i;a<e.children.length;a++){let f=e.children[a],h=u+f.length;if(u<t&&h>n)return xN(f,t,n,u);if(h>=t&&r==-1)r=a,o=u;if(u>n&&f.dom.parentNode==e.dom){s=a,l=c;break}c=h,u=h+f.breakAfter}return{from:o,to:l<0?i+e.length:l,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:s<e.children.length&&s>=0?e.children[s].dom:null}}else if(e.isText())return{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling};else return null}function wN(e,t){let n,{newSel:i}=t,{state:r}=e,o=r.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:a}=t.bounds,u=o.from,c=null;if(s===8||V.android&&t.text.length<a-l)u=o.to,c="end";let f=r.doc.sliceString(l,a,Fl),h,d;if(!o.empty&&o.from>=l&&o.to<=a&&(t.typeOver||f!=t.text)&&f.slice(0,o.from-l)==t.text.slice(0,o.from-l)&&f.slice(o.to-l)==t.text.slice(h=t.text.length-(f.length-(o.to-l))))n={from:o.from,to:o.to,insert:ce.of(t.text.slice(o.from-l,h).split(Fl))};else if(d=SN(f,t.text,u-l,c)){if(V.chrome&&s==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==Fl+Fl)d.toB--;n={from:l+d.from,to:l+d.toA,insert:ce.of(t.text.slice(d.from,d.toB).split(Fl))}}}else if(i&&(!e.hasFocus&&r.facet(yr)||Ad(i,o)))i=null;if(!n&&!i)return!1;if((V.mac||V.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"){if(i&&n.insert.length==2)i=N.single(i.main.anchor-1,i.main.head-1);n={from:n.from,to:n.to,insert:ce.of([n.insert.toString().replace("."," ")])}}else if(r.doc.lineAt(o.from).to<o.to&&e.docView.lineHasWidget(o.to)&&e.inputState.insertingTextAt>Date.now()-50)n={from:o.from,to:o.to,insert:r.toText(e.inputState.insertingText)};else if(V.chrome&&n&&n.from==n.to&&n.from==o.head&&n.insert.toString()==`
25
+ `&&e.lineWrapping){if(i)i=N.single(i.main.anchor-1,i.main.head-1);n={from:o.from,to:o.to,insert:ce.of([" "])}}if(n)return sy(e,n,i,s);else if(i&&!Ad(i,o)){let l=!1,a="select";if(e.inputState.lastSelectionTime>Date.now()-50){if(e.inputState.lastSelectionOrigin=="select")l=!0;if(a=e.inputState.lastSelectionOrigin,a=="select.pointer")i=gN(r.facet(ac).map((u)=>u(e)),i)}return e.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function sy(e,t,n,i=-1){if(V.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(V.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&$l(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||i==8&&t.insert.length<t.to-t.from&&t.to>r.head)&&$l(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&$l(e.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();if(e.inputState.composing>=0)e.inputState.composing++;let s,l=()=>s||(s=VP(e,t,n));if(!e.state.facet(JR).some((a)=>a(e,t.from,t.to,o,l)))e.dispatch(l());return!0}function VP(e,t,n){let i,r=e.state,o=r.selection.main,s=-1;if(t.from==t.to&&t.from<o.from||t.from>o.to){let a=t.from<o.from?-1:1,u=a<0?o.from:o.to,c=ec(r.facet(ac).map((f)=>f(e)),u,a);if(t.from==c)s=c}if(s>-1)i={changes:t,selection:N.cursor(t.from+t.insert.length,-1)};else if(t.from>=o.from&&t.to<=o.to&&t.to-t.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let a=o.from<t.from?r.sliceDoc(o.from,t.from):"",u=o.to>t.to?r.sliceDoc(t.to,o.to):"";i=r.replaceSelection(e.state.toText(a+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let a=r.changes(t),u=n&&n.main.to<=a.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=o.to+10&&t.to>=o.to-10){let c=e.state.sliceDoc(t.from,t.to),f,h=n&&pN(e,n.main.head);if(h){let m=t.insert.length-(t.to-t.from);f={from:h.from,to:h.to-m}}else f=e.state.doc.lineAt(o.head);let d=o.to-t.to;i=r.changeByRange((m)=>{if(m.from==o.from&&m.to==o.to)return{changes:a,range:u||m.map(a)};let b=m.to-d,x=b-c.length;if(e.state.sliceDoc(x,b)!=c||b>=f.from&&x<=f.to)return{range:m};let g=r.changes({from:x,to:b,insert:t.insert}),v=m.to-o.to;return{changes:g,range:!u?m.map(g):N.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v))}})}else i={changes:a,selection:u&&r.selection.replaceRange(u)}}let l="input.type";if(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50){if(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange)l+=".start",e.inputState.compositionFirstChange=!1}return r.update(i,{userEvent:l,scrollIntoView:!0})}function SN(e,t,n,i){let r=Math.min(e.length,t.length),o=0;while(o<r&&e.charCodeAt(o)==t.charCodeAt(o))o++;if(o==r&&e.length==t.length)return null;let s=e.length,l=t.length;while(s>0&&l>0&&e.charCodeAt(s-1)==t.charCodeAt(l-1))s--,l--;if(i=="end"){let a=Math.max(0,o-Math.min(s,l));n-=s+a-o}if(s<o&&e.length<t.length){let a=n<=o&&n>=s?o-n:0;o-=a,l=o+(l-s),s=o}else if(l<o){let a=n<=o&&n>=l?o-n:0;o-=a,s=o+(s-l),l=o}return{from:o,toA:s,toB:l}}function HP(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}=e.observer.selectionRange;if(n){if(t.push(new qb(n,i)),r!=n||o!=i)t.push(new qb(r,o))}return t}function UP(e,t){if(e.length==0)return null;let n=e[0].pos,i=e.length==2?e[1].pos:n;return n<0||i<0?null:n==i?N.create([N.cursor(i+t,-1)]):N.single(n+t,i+t)}function Ad(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class kN{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){if(this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,V.safari)e.contentDOM.addEventListener("input",()=>null);if(V.gecko)n8(e.contentDOM.ownerDocument)}handleEvent(e){if(!YP(this.view,e)||this.ignoreDuringComposition(e))return;if(e.type=="keydown"&&this.keydown(e))return;if(this.view.updateState!=0)Promise.resolve().then(()=>this.runHandlers(e.type,e));else this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=FP(e),n=this.handlers,i=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,s=n[r];if(s&&o!=!s.handlers.length)i.removeEventListener(r,this.handleEvent),s=null;if(!s)i.addEventListener(r,this.handleEvent,{passive:o})}for(let r in n)if(r!="scroll"&&!t[r])i.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&CN.indexOf(e.keyCode)<0)this.tabFocusMode=-1;if(V.android&&V.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(V.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(EN.some((t)=>t.keyCode==e.keyCode)&&!e.ctrlKey||KP.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};if(t.shiftKey&&V.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&jP(this.view.win))t.shiftKey=!1;let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{if(this.pendingIOSKey==n)this.flushIOSKey()},50),!0}if(e.keyCode!=229)this.view.observer.forceFlush();return!1}flushIOSKey(e){let t=this.pendingIOSKey;if(!t||this.view.observer.pendingRecords().length)return!1;if(t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))return!1;return this.pendingIOSKey=void 0,$l(this.view.contentDOM,t.key,t.keyCode,t.mods)}ignoreDuringComposition(e){if(!/^key/.test(e.type)||e.synthetic)return!1;if(this.composing>0)return!0;if(V.safari&&!V.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)return this.compositionPendingKey=!1,!0;return!1}startMouseSelection(e){if(this.mouseSelection)this.mouseSelection.destroy();this.mouseSelection=e}update(e){if(this.view.observer.update(e),this.mouseSelection)this.mouseSelection.update(e);if(this.draggedContent&&e.docChanged)this.draggedContent=this.draggedContent.map(e.changes);if(e.transactions.length)this.lastKeyCode=this.lastSelectionTime=0}destroy(){if(this.mouseSelection)this.mouseSelection.destroy()}}function jP(e){if(!e.visualViewport)return!1;return e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<0.85}function dR(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(r){Mt(n.state,r)}}}function FP(e){let t=Object.create(null);function n(i){return t[i]||(t[i]={observers:[],handlers:[]})}for(let i of e){let r=i.spec,o=r&&r.plugin.domEventHandlers,s=r&&r.plugin.domEventObservers;if(o)for(let l in o){let a=o[l];if(a)n(l).handlers.push(dR(i.value,a))}if(s)for(let l in s){let a=s[l];if(a)n(l).observers.push(dR(i.value,a))}}for(let i in si)n(i).handlers.push(si[i]);for(let i in Dt)n(i).observers.push(Dt[i]);return t}var EN=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],KP="dthko",CN=[16,17,18,20,91,92,224,225],fd=6;function hd(e){return Math.max(0,e)*0.7+8}function qP(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class AN{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=zR(e.contentDOM),this.atoms=e.state.facet(ac).map((o)=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(de.allowMultipleSelections)&&$P(e,t),this.dragging=WP(e,t)&&NN(t)==1?null:!1}start(e){if(this.dragging===!1)this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&qP(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,i=0,r=0,o=this.view.win.innerWidth,s=this.view.win.innerHeight;if(this.scrollParents.x)({left:i,right:o}=this.scrollParents.x.getBoundingClientRect());if(this.scrollParents.y)({top:r,bottom:s}=this.scrollParents.y.getBoundingClientRect());let l=oy(this.view);if(e.clientX-l.left<=i+fd)t=-hd(i-e.clientX);else if(e.clientX+l.right>=o-fd)t=hd(e.clientX-o);if(e.clientY-l.top<=r+fd)n=-hd(r-e.clientY);else if(e.clientY+l.bottom>=s-fd)n=hd(e.clientY-s);this.setScrollSpeed(t,n)}up(e){if(this.dragging==null)this.select(this.lastEvent);if(!this.dragging)e.preventDefault();this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){if(this.scrollSpeed={x:e,y:t},e||t){if(this.scrolling<0)this.scrolling=setInterval(()=>this.scroll(),50)}else if(this.scrolling>-1)clearInterval(this.scrolling),this.scrolling=-1}scroll(){let{x:e,y:t}=this.scrollSpeed;if(e&&this.scrollParents.x)this.scrollParents.x.scrollLeft+=e,e=0;if(t&&this.scrollParents.y)this.scrollParents.y.scrollTop+=t,t=0;if(e||t)this.view.win.scrollBy(e,t);if(this.dragging===!1)this.select(this.lastEvent)}select(e){let{view:t}=this,n=gN(this.atoms,this.style.get(e,this.extend,this.multiple));if(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))this.view.dispatch({selection:n,userEvent:"select.pointer"});this.mustSelect=!1}update(e){if(e.transactions.some((t)=>t.isUserEvent("input.type")))this.destroy();else if(this.style.update(e))setTimeout(()=>this.select(this.lastEvent),20)}}function $P(e,t){let n=e.state.facet(WR);return n.length?n[0](t):V.mac?t.metaKey:t.ctrlKey}function GP(e,t){let n=e.state.facet(YR);return n.length?n[0](t):V.mac?!t.altKey:!t.ctrlKey}function WP(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=nc(e.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let o=0;o<r.length;o++){let s=r[o];if(s.left<=t.clientX&&s.right>=t.clientX&&s.top<=t.clientY&&s.bottom>=t.clientY)return!0}return!1}function YP(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,i;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(i=Ve.get(n))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(t))return!1;return!0}var si=Object.create(null),Dt=Object.create(null),ON=V.ie&&V.ie_version<15||V.ios&&V.webkit_version<604;function XP(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),RN(e,n.value)},50)}function Md(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function RN(e,t){t=Md(e.state,ty,t);let{state:n}=e,i,r=1,o=n.toText(t),s=o.lines==n.selection.ranges.length;if($b!=null&&n.selection.ranges.every((a)=>a.empty)&&$b==o.toString()){let a=-1;i=n.changeByRange((u)=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let f=n.toText((s?o.line(r++).text:t)+n.lineBreak);return{changes:{from:c.from,insert:f},range:N.cursor(u.from+f.length,-1)}})}else if(s)i=n.changeByRange((a)=>{let u=o.line(r++);return{changes:{from:a.from,to:a.to,insert:u.text},range:N.cursor(a.from+u.length,-1)}});else i=n.replaceSelection(o);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Dt.scroll=(e)=>{let t=e.inputState;if(t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,V.ios&&!t.touchActive)t.lastIOSMomentumScroll=Date.now()};Dt.wheel=Dt.mousewheel=(e)=>{e.inputState.lastWheelEvent=Date.now()};si.keydown=(e,t)=>{if(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0)e.inputState.tabFocusMode=Date.now()+2000;return!1};Dt.touchstart=(e,t)=>{let n=e.inputState,i=t.targetTouches[0];if(n.touchActive=!0,n.lastTouchTime=Date.now(),i)n.lastTouchX=i.clientX,n.lastTouchY=i.clientY;n.setSelectionOrigin("select.pointer")};Dt.touchmove=(e)=>{e.inputState.setSelectionOrigin("select.pointer")};Dt.touchend=(e,t)=>{e.inputState.touchActive=!1};si.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2000)return!1;let n=null;for(let i of e.state.facet(XR))if(n=i(e,t),n)break;if(!n&&t.button==0)n=JP(e,t);if(n){let i=!e.hasFocus;if(e.inputState.startMouseSelection(new AN(e,t,n,i)),i)e.observer.ignore(()=>{VR(e.contentDOM);let o=e.root.activeElement;if(o&&!o.contains(e.contentDOM))o.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function pR(e,t,n,i){if(i==1)return N.cursor(t,n);else if(i==2)return MP(e.state,t,n);else{let r=e.docView.lineAt(t,n),o=e.state.doc.lineAt(r?r.posAtEnd:t),s=r?r.posAtStart:o.from,l=r?r.posAtEnd:o.to;if(l<e.state.doc.length&&l==o.to)l++;return N.undirectionalRange(s,l)}}var QP=V.ie&&V.ie_version<=11,mR=null,gR=0,vR=0;function NN(e){if(!QP)return e.detail;let t=mR,n=vR;return mR=e,vR=Date.now(),gR=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(gR+1)%3:1}function JP(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=NN(t),r=e.state.selection;return{update(o){if(o.docChanged)n.pos=o.changes.mapPos(n.pos),r=r.map(o.changes)},get(o,s,l){let a=e.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),u,c=pR(e,a.pos,a.assoc,i);if(n.pos!=a.pos&&!s){let f=pR(e,n.pos,n.assoc,i),h=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=h<c.from?N.range(h,d,c.assoc):N.range(d,h,c.assoc)}if(s)return r.replaceRange(r.main.extend(c.from,c.to,c.assoc));else if(l&&i==1&&r.ranges.length>1&&(u=ZP(r,a.pos)))return u;else if(l)return r.addRange(c);else return N.create([c])}}}function ZP(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:r}=e.ranges[n];if(i<=t&&r>=t)return N.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}si.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let o=r.posAtStart,s=o+r.length;if(o>=n.to||s<=n.from)n=N.undirectionalRange(o,s)}}let{inputState:i}=e;if(i.mouseSelection)i.mouseSelection.dragging=!0;if(i.draggedContent=n,t.dataTransfer)t.dataTransfer.setData("Text",Md(e.state,ny,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove";return!1};si.dragend=(e)=>(e.inputState.draggedContent=null,!1);function bR(e,t,n,i){if(n=Md(e.state,ty,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:o}=e.inputState,s=i&&o&&GP(e,t)?{from:o.from,to:o.to}:null,l={from:r,insert:n},a=e.state.changes(s?[s,l]:l);e.focus(),e.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}si.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,o=()=>{if(++r==n.length)bR(e,t,i.filter((s)=>s!=null).join(e.state.lineBreak),!1)};for(let s=0;s<n.length;s++){let l=new FileReader;l.onerror=o,l.onload=()=>{if(!/[\x00-\x08\x0e-\x1f]{2}/.test(l.result))i[s]=l.result;o()},l.readAsText(n[s])}return!0}else{let i=t.dataTransfer.getData("Text");if(i)return bR(e,t,i,!0),!0}return!1};si.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=ON?null:t.clipboardData;if(n)return RN(e,n.getData("text/plain")||n.getData("text/uri-list")),!0;else return XP(e),!1};function e8(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}function t8(e){let t=[],n=[],i=!1;for(let r of e.selection.ranges)if(!r.empty)t.push(e.sliceDoc(r.from,r.to)),n.push(r);if(!t.length){let r=-1;for(let{from:o}of e.selection.ranges){let s=e.doc.lineAt(o);if(s.number>r)t.push(s.text),n.push({from:s.from,to:Math.min(e.doc.length,s.to+1)});r=s.number}i=!0}return{text:Md(e,ny,t.join(e.lineBreak)),ranges:n,linewise:i}}var $b=null;si.copy=si.cut=(e,t)=>{if(!Qu(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=t8(e.state);if(!n&&!r)return!1;if($b=r?n:null,t.type=="cut"&&!e.state.readOnly)e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=ON?null:t.clipboardData;if(o)return o.clearData(),o.setData("text/plain",n),!0;else return e8(e,n),!1};var TN=un.define();function MN(e,t){let n=[];for(let i of e.facet(ZR)){let r=i(e,t);if(r)n.push(r)}return n.length?e.update({effects:n,annotations:TN.of(!0)}):null}function _N(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=MN(e.state,t);if(n)e.dispatch(n);else e.update([])}},10)}Dt.focus=(e)=>{if(e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft))e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft;_N(e)};Dt.blur=(e)=>{e.observer.clearSelectionRange(),_N(e)};Dt.compositionstart=Dt.compositionupdate=(e)=>{if(e.observer.editContext)return;if(e.inputState.compositionFirstChange==null)e.inputState.compositionFirstChange=!0;if(e.inputState.composing<0){let{main:t}=e.state.selection;if(!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from)e.dispatch({changes:e.state.selection.ranges.filter((n)=>!n.empty).map((n)=>({from:n.from,to:n.to})),userEvent:"input"});e.inputState.composing=0}};Dt.compositionend=(e)=>{if(e.observer.editContext)return;if(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,V.chrome&&V.android)e.observer.flushSoon();else if(e.inputState.compositionPendingChange)Promise.resolve().then(()=>e.observer.flush());else setTimeout(()=>{if(e.inputState.composing<0&&e.docView.hasComposition)e.update([])},50)};Dt.contextmenu=(e)=>{e.inputState.lastContextMenu=Date.now()};si.beforeinput=(e,t)=>{var n,i;if(t.inputType=="insertText"||t.inputType=="insertCompositionText")e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now();if(t.inputType=="insertReplacementText"&&e.observer.editContext){let o=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),s=t.getTargetRanges();if(o&&s.length){let l=s[0],a=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return sy(e,{from:a,to:u,insert:e.state.toText(o)},null),!0}}let r;if(V.chrome&&V.android&&(r=EN.find((o)=>o.inputType==t.inputType))){if(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete"){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var s;if((((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>o+10&&e.hasFocus)e.contentDOM.blur(),e.focus()},100)}}if(V.ios&&t.inputType=="deleteContentForward")e.observer.flushSoon();if(V.safari&&t.inputType=="insertText"&&e.inputState.composing>=0)setTimeout(()=>Dt.compositionend(e,t),20);return!1};var yR=new Set;function n8(e){if(!yR.has(e))yR.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{})}var xR=["pre-wrap","normal","pre-line","break-spaces"],Yl=!1;function wR(){Yl=!1}class DN{constructor(e){this.lineWrapping=e,this.doc=ce.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;if(this.lineWrapping)n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*0.5)/this.lineLength));return this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return xR.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];if(i<0)n++;else if(!this.heightSamples[Math.floor(i*10)])t=!0,this.heightSamples[Math.floor(i*10)]=!0}return t}refresh(e,t,n,i,r,o){let s=xR.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>0.3||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,l){this.heightSamples={};for(let a=0;a<o.length;a++){let u=o[a];if(u<0)a++;else this.heightSamples[Math.floor(u*10)]=!0}}return l}}class LN{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class ii{constructor(e,t,n,i,r){this.from=e,this.length=t,this.top=n,this.height=i,this._content=r}get type(){return typeof this._content=="number"?Ln.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof ds?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new ii(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Te=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Te||(Te={})),xd=0.001;class _t{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){if(this.height!=e){if(Math.abs(this.height-e)>xd)Yl=!0;this.height=e}}replace(e,t,n){return _t.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,o=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:l,toA:a,fromB:u,toB:c}=i[s],f=r.lineAt(l,Te.ByPosNoHeight,n.setDoc(t),0,0),h=f.to>=a?f:r.lineAt(a,Te.ByPosNoHeight,n,0,0);c+=h.to-a,a=h.to;while(s>0&&f.from<=i[s-1].toA)if(l=i[s-1].fromA,u=i[s-1].fromB,s--,l<f.from)f=r.lineAt(l,Te.ByPosNoHeight,n,0,0);u+=f.from-l,l=f.from;let d=ay.build(n.setDoc(o),e,u,c);r=Od(r,r.replace(l,a,d))}return r.updateHeight(n,0)}static empty(){return new cn(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,i=0,r=0;for(;;)if(t==n)if(i>r*2){let s=e[t-1];if(s.break)e.splice(--t,1,s.left,null,s.right);else e.splice(--t,1,s.left,s.right);n+=1+s.break,i-=s.size}else if(r>i*2){let s=e[n];if(s.break)e.splice(n,1,s.left,null,s.right);else e.splice(n,1,s.left,s.right);n+=2+s.break,r-=s.size}else break;else if(i<r){let s=e[t++];if(s)i+=s.size}else{let s=e[--n];if(s)r+=s.size}let o=!1;if(e[t-1]==null)o=!0,t--;else if(e[t]==null)o=!0,n++;return new zN(_t.of(e.slice(0,t)),o,_t.of(e.slice(n)))}}function Od(e,t){if(e==t)return e;if(e.constructor!=t.constructor)Yl=!0;return t}_t.prototype.size=1;var i8=ke.replace({});class ly extends _t{constructor(e,t,n){super(e,t);this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new ii(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new ii(i,0,n,this.spaceAbove,i8):this.mainBlock(n,i)}lineAt(e,t,n,i,r){let o=this.mainBlock(i,r);return this.spaceAbove?this.blockAt(0,n,i,r).join(o):o}forEachLine(e,t,n,i,r,o){if(e<=r+this.length&&t>=r)o(this.lineAt(0,Te.ByPos,n,i,r))}setMeasuredHeight(e){let t=e.heights[e.index++];if(t<0)this.spaceAbove=-t,t=e.heights[e.index++];else this.spaceAbove=0;this.setHeight(t)}updateHeight(e,t=0,n=!1,i){if(i&&i.from<=t&&i.more)this.setMeasuredHeight(i);return this.outdated=!1,this}toString(){return`block(${this.length})`}}class cn extends ly{constructor(e,t,n){super(e,t,null);this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new ii(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];if(n.length==1&&(i instanceof cn||i instanceof bt&&i.flags&4)&&Math.abs(this.length-i.length)<10){if(i instanceof bt)i=new cn(i.length,this.height,this.spaceAbove);else i.height=this.height;if(!this.outdated)i.outdated=!1;return i}else return _t.of(n)}updateHeight(e,t=0,n=!1,i){if(i&&i.from<=t&&i.more)this.setMeasuredHeight(i);else if(n||this.outdated)this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight);return this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class bt extends _t{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,r=i-n+1,o,s=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*r);if(o=l/r,this.length>r+1)s=(this.height-l)/(this.length-r-1)}else o=this.height/r;return{firstLine:n,lastLine:i,perLine:o,perChar:s}}blockAt(e,t,n,i){let{firstLine:r,lastLine:o,perLine:s,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let a=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),u=t.doc.lineAt(a),c=s+u.length*l,f=Math.max(n,e-c/2);return new ii(u.from,u.length,f,c,0)}else{let a=Math.max(0,Math.min(o-r,Math.floor((e-n)/s))),{from:u,length:c}=t.doc.line(r+a);return new ii(u,c,n+s*a,s,0)}}lineAt(e,t,n,i,r){if(t==Te.ByHeight)return this.blockAt(e,n,i,r);if(t==Te.ByPosNoHeight){let{from:h,to:d}=n.doc.lineAt(e);return new ii(h,d-h,0,0,0)}let{firstLine:o,perLine:s,perChar:l}=this.heightMetrics(n,r),a=n.doc.lineAt(e),u=s+a.length*l,c=a.number-o,f=i+s*c+l*(a.from-r-c);return new ii(a.from,a.length,Math.max(i,Math.min(f,i+this.height-u)),u,0)}forEachLine(e,t,n,i,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:s,perLine:l,perChar:a}=this.heightMetrics(n,r);for(let u=e,c=i;u<=t;){let f=n.doc.lineAt(u);if(u==e){let d=f.number-s;c+=l*d+a*(e-r-d)}let h=l+a*f.length;o(new ii(f.from,f.length,c,h,0)),c+=h,u=f.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let r=n[n.length-1];if(r instanceof bt)n[n.length-1]=new bt(r.length+i);else n.push(null,new bt(i-1))}if(e>0){let r=n[0];if(r instanceof bt)n[0]=new bt(e+r.length);else n.unshift(new bt(e-1),null)}return _t.of(n)}decomposeLeft(e,t){t.push(new bt(e-1),null)}decomposeRight(e,t){t.push(null,new bt(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],s=Math.max(t,i.from),l=-1;if(i.from>t)o.push(new bt(i.from-t-1).updateHeight(e,t));while(s<=r&&i.more){let u=e.doc.lineAt(s).length;if(o.length)o.push(null);let c=i.heights[i.index++],f=0;if(c<0)f=-c,c=i.heights[i.index++];if(l==-1)l=c;else if(Math.abs(c-l)>=xd)l=-2;let h=new cn(u,c,f);h.outdated=!1,o.push(h),s+=u+1}if(s<=r)o.push(null,new bt(r-s).updateHeight(e,s));let a=_t.of(o);if(l<0||Math.abs(a.height-this.height)>=xd||Math.abs(l-this.heightMetrics(e,t).perLine)>=xd)Yl=!0;return Od(this,a)}else if(n||this.outdated)this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1;return this}toString(){return`gap(${this.length})`}}class zN extends _t{constructor(e,t,n){super(e.length+(t?1:0)+n.length,e.height+n.height,(t?1:0)|(e.outdated||n.outdated?2:0));this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,i){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,r,i+this.left.length+this.break)}lineAt(e,t,n,i,r){let o=i+this.left.height,s=r+this.left.length+this.break,l=t==Te.ByHeight?e<o:e<s,a=l?this.left.lineAt(e,t,n,i,r):this.right.lineAt(e,t,n,o,s);if(this.break||(l?a.to<s:a.from>s))return a;let u=t==Te.ByPosNoHeight?Te.ByPosNoHeight:Te.ByPos;if(l)return a.join(this.right.lineAt(s,u,n,o,s));else return this.left.lineAt(s,u,n,i,r).join(a)}forEachLine(e,t,n,i,r,o){let s=i+this.left.height,l=r+this.left.length+this.break;if(this.break){if(e<l)this.left.forEachLine(e,t,n,i,r,o);if(t>=l)this.right.forEachLine(e,t,n,s,l,o)}else{let a=this.lineAt(l,Te.ByPos,n,i,r);if(e<a.from)this.left.forEachLine(e,Math.min(t,a.from-1),n,i,r,o);if(a.to>=e&&a.from<=t)o(a);if(t>a.to)this.right.forEachLine(Math.max(e,a.to+1),t,n,s,l,o)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];if(e>0)this.decomposeLeft(e,r);let o=r.length;for(let s of n)r.push(s);if(e>0)SR(r,o-1);if(t<this.length){let s=r.length;this.decomposeRight(t,r),SR(r,s)}return _t.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);if(t.push(this.left),this.break){if(n++,e>=n)t.push(null)}if(e>n)this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);if(e<n)this.left.decomposeRight(e,t);if(this.break&&e<i)t.push(null);t.push(this.right)}balanced(e,t){if(e.size>2*t.size||t.size>2*e.size)return _t.of(this.break?[e,null,t]:[e,t]);return this.left=Od(this.left,e),this.right=Od(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this}updateHeight(e,t=0,n=!1,i){let{left:r,right:o}=this,s=t+r.length+this.break,l=null;if(i&&i.from<=t+r.length&&i.more)l=r=r.updateHeight(e,t,n,i);else r.updateHeight(e,t,n);if(i&&i.from<=s+o.length&&i.more)l=o=o.updateHeight(e,s,n,i);else o.updateHeight(e,s,n);if(l)return this.balanced(r,o);return this.height=this.left.height+this.right.height,this.outdated=!1,this}toString(){return this.left+(this.break?" ":"-")+this.right}}function SR(e,t){let n,i;if(e[t]==null&&(n=e[t-1])instanceof bt&&(i=e[t+1])instanceof bt)e.splice(t-1,3,new bt(n.length+1+i.length))}var r8=5;class ay{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];if(i instanceof cn)i.length+=n-this.pos;else if(n>this.pos||!this.isCovered)this.nodes.push(new cn(n-this.pos,-1,0));if(this.writtenTo=n,t>n)this.nodes.push(null),this.writtenTo++,this.lineStart=-1}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;if(i<0)i=this.oracle.lineHeight;let o=t-e;if(n.block)this.addBlock(new ly(o,i,n));else if(o||r||i>=r8)this.addLineDeco(i,r,o)}else if(t>e)this.span(e,t);if(this.lineEnd>-1&&this.lineEnd<this.pos)this.lineEnd=this.oracle.doc.lineAt(this.pos).to}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);if(this.lineStart=e,this.lineEnd=t,this.writtenTo<e){if(this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)this.nodes.push(this.blankContent(this.writtenTo,e-1));this.nodes.push(null)}if(this.pos>e)this.nodes.push(new cn(this.pos-e,-1,0));this.writtenTo=this.pos}blankContent(e,t){let n=new bt(t-e);if(this.oracle.doc.lineAt(e).to==t)n.flags|=4;return n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof cn)return e;let t=new cn(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;if(t&&t.startSide>0&&!this.isCovered)this.ensureLine();if(this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0)this.covering=e}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];if(this.lineStart>-1&&!(t instanceof cn)&&!this.isCovered)this.nodes.push(new cn(0,-1,0));else if(this.writtenTo<this.pos||t==null)this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes){if(i instanceof cn)i.updateHeight(this.oracle,n);n+=i?i.length:1}return this.nodes}static build(e,t,n,i){let r=new ay(n,e);return pe.spans(t,n,i,r,0),r.finish(n)}}function o8(e,t,n){let i=new BN;return pe.compare(e,t,n,i,0),i.changes}class BN{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){if(e<t||n&&n.heightRelevant||i&&i.heightRelevant)ql(e,t,this.changes,5)}}function s8(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,r=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(r.innerHeight,n.bottom);for(let u=e.parentNode;u&&u!=i.body;)if(u.nodeType==1){let c=u,f=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let h=c.getBoundingClientRect();o=Math.max(o,h.left),s=Math.min(s,h.right),l=Math.max(l,h.top),a=Math.min(u==e.parentNode?r.innerHeight:a,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:o-n.left,right:Math.max(o,s)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}}function l8(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function a8(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class wd{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(e,t){return ke.replace({widget:new PN(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class PN extends go{constructor(e,t){super();this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");if(this.vertical)e.style.height=this.size+"px";else e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block";return e}get estimatedHeight(){return this.vertical?this.size:-1}}class Gb{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=kR,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Be.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(iy).some((i)=>typeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new DN(n),this.stateDeco=ER(t),this.heightMap=_t.empty().applyChanges(this.stateDeco,ce.empty,this.heightOracle.setDoc(t.doc),[new Dn(0,0,0,t.doc.length)]);for(let i=0;i<2;i++)if(this.viewport=this.getViewport(0,null),!this.updateForViewport())break;this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ke.set(this.lineGaps.map((i)=>i.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:r,to:o})=>i>=r&&i<=o)){let{from:r,to:o}=this.lineBlockAt(i);e.push(new Yu(r,o))}}return this.viewports=e.sort((n,i)=>n.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7000000?kR:new uy(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e)=>{this.viewportLines.push(Xu(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=ER(this.state);let i=e.changedRanges,r=Dn.extendWithRanges(i,o8(n,this.stateDeco,e?e.changes:We.empty(this.state.doc.length))),o=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);if(wR(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=o||Yl)e.flags|=2;if(s)this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top;else this.scrollAnchorPos=-1,this.scrollAnchorHeight=o;let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;if(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))l=this.getViewport(0,t);let a=l.from!=this.viewport.from||l.to!=this.viewport.to;if(this.viewport=l,e.flags|=this.updateForViewport(),a||!e.changes.empty||e.flags&2)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>4000)this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes)));if(e.flags|=this.computeVisibleRanges(e.changes),t)this.scrollTarget=t;if(!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(mP))this.mustEnforceCursorAssoc=!0}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Be.RTL:Be.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",s=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let a=0,u=0;if(s.width&&s.height){let{scaleX:S,scaleY:k}=LR(t,s);if(S>0.005&&Math.abs(this.scaleX-S)>0.005||k>0.005&&Math.abs(this.scaleY-k)>0.005)this.scaleX=S,this.scaleY=k,a|=16,o=l=!0}let c=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;if(this.paddingTop!=c||this.paddingBottom!=f)this.paddingTop=c,this.paddingBottom=f,a|=18;if(this.editorWidth!=e.scrollDOM.clientWidth){if(i.lineWrapping)l=!0;this.editorWidth=e.scrollDOM.clientWidth,a|=16}let h=zR(this.view.contentDOM,!1).y;if(h!=this.scrollParent)this.scrollParent=h,this.scrollAnchorHeight=-1,this.scrollOffset=0;let d=this.getScrollOffset();if(this.scrollOffset!=d)this.scrollAnchorHeight=-1,this.scrollOffset=d;this.scrolledToBottom=HR(this.scrollParent||e.win);let m=(this.printing?a8:s8)(t,this.paddingTop),b=m.top-this.pixelViewport.top,x=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView){if(this.inView=g,g)l=!0}if(!this.inView&&!this.scrollTarget&&!l8(e.dom))return 0;let v=s.width;if(this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,a|=16;if(l){let S=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S))o=!0;if(o||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:k,charWidth:A,textHeight:E}=e.docView.measureTextSize();if(o=k>0&&i.refresh(r,k,A,E,Math.max(5,v/A),S),o)e.docView.minWidth=0,a|=16}if(b>0&&x>0)u=Math.max(b,x);else if(b<0&&x<0)u=Math.min(b,x);wR();for(let k of this.viewports){let A=k.from==this.viewport.from?S:e.docView.measureVisibleLineHeights(k);this.heightMap=(o?_t.empty().applyChanges(this.stateDeco,ce.empty,this.heightOracle,[new Dn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new LN(k.from,A))}if(Yl)a|=2}let y=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);if(y){if(a&2)a|=this.updateScaler();this.viewport=this.getViewport(u,this.scrollTarget),a|=this.updateForViewport()}if(a&2||y)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>4000)this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e));if(a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc)this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc();return a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=0.5-Math.max(-0.5,Math.min(0.5,e/1000/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:s}=this,l=new Yu(i.lineAt(o-n*1000,Te.ByHeight,r,0,0).from,i.lineAt(s+(1-n)*1000,Te.ByHeight,r,0,0).to);if(t){let{head:a}=t.range;if(a<l.from||a>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=i.lineAt(a,Te.ByPos,r,0,0),f;if(t.y=="center")f=(c.top+c.bottom)/2-u/2;else if(t.y=="start"||t.y=="nearest"&&a<l.from)f=c.top;else f=c.bottom-u;l=new Yu(i.lineAt(f-500,Te.ByHeight,r,0,0).from,i.lineAt(f+u+500,Te.ByHeight,r,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Yu(this.heightMap.lineAt(n,Te.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,Te.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,Te.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,Te.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:s}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=s+Math.max(10,Math.min(n,250)))&&(i>o-2000&&r<s+2000)}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)if(!t.touchesRange(i.from,i.to))n.push(new wd(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2000,r=i>>1,o=i<<1;if(this.defaultTextDirection!=Be.LTR&&!n)return[];let s=[],l=(u,c,f,h)=>{if(c-u<r)return;let d=this.state.selection.main,m=[d.from];if(!d.empty)m.push(d.to);for(let x of m)if(x>u&&x<c){l(u,x-10,f,h),l(x+10,c,f,h);return}let b=c8(e,(x)=>x.from>=f.from&&x.to<=f.to&&Math.abs(x.from-u)<r&&Math.abs(x.to-c)<r&&!m.some((g)=>x.from<g&&x.to>g));if(!b){if(c<f.to&&t&&n&&t.visibleRanges.some((v)=>v.from<=c&&v.to>=c)){let v=t.moveToLineBoundary(N.cursor(c),!1,!0).head;if(v>u)c=v}let x=this.gapSize(f,u,c,h),g=n||x<2000000?x:2000000;b=new wd(u,c,x,g)}s.push(b)},a=(u)=>{if(u.length<o||u.type!=Ln.Text)return;let c=u8(u.from,u.to,this.stateDeco);if(c.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,h,d;if(n){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,x;if(f!=null){let g=pd(c,f),v=((this.visibleBottom-this.visibleTop)/2+m)/u.height;b=g-v,x=g+v}else b=(this.visibleTop-u.top-m)/u.height,x=(this.visibleBottom-u.top+m)/u.height;h=dd(c,b),d=dd(c,x)}else{let m=c.total*this.heightOracle.charWidth,b=i*this.heightOracle.charWidth,x=0;if(m>2000000){for(let k of e)if(k.from>=u.from&&k.from<u.to&&k.size!=k.displaySize&&k.from*this.heightOracle.charWidth+x<this.pixelViewport.left)x=k.size-k.displaySize}let g=this.pixelViewport.left+x,v=this.pixelViewport.right+x,y,S;if(f!=null){let k=pd(c,f),A=((v-g)/2+b)/m;y=k-A,S=k+A}else y=(g-b)/m,S=(v+b)/m;h=dd(c,y),d=dd(c,S)}if(h>u.from)l(u.from,h,u,c);if(d<u.to)l(d,u.to,u,c)};for(let u of this.viewportLines)if(Array.isArray(u.type))u.type.forEach(a);else a(u);return s}gapSize(e,t,n,i){let r=pd(i,n)-pd(i,t);if(this.heightOracle.lineWrapping)return e.height*r;else return i.total*this.heightOracle.charWidth*r}updateLineGaps(e){if(!wd.same(e,this.lineGaps))this.lineGaps=e,this.lineGapDeco=ke.set(e.map((t)=>t.draw(this,this.heightOracle.lineWrapping)))}computeVisibleRanges(e){let t=this.stateDeco;if(this.lineGaps.length)t=t.concat(this.lineGapDeco);let n=[];pe.spans(t,this.viewport.from,this.viewport.to,{span(r,o){n.push({from:r,to:o})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let r=0;r<n.length&&!(i&8);r++){let o=this.visibleRanges[r],s=n[r];if(o.from!=s.from||o.to!=s.to){if(i|=4,!(e&&e.mapPos(o.from,-1)==s.from&&e.mapPos(o.to,1)==s.to))i|=8}}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t)=>t.from<=e&&t.to>=e)||Xu(this.heightMap.lineAt(e,Te.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((t)=>t.top<=e&&t.bottom>=e)||Xu(this.heightMap.lineAt(this.scaler.fromDOM(e),Te.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Xu(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Yu{constructor(e,t){this.from=e,this.to=t}}function u8(e,t,n){let i=[],r=e,o=0;if(pe.spans(n,e,t,{span(){},point(s,l){if(s>r)i.push({from:r,to:s}),o+=s-r;r=l}},20),r<t)i.push({from:r,to:t}),o+=t-r;return{total:o,ranges:i}}function dd({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let r=0;;r++){let{from:o,to:s}=t[r],l=s-o;if(i<=l)return o+i;i-=l}}function pd(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}function c8(e,t){for(let n of e)if(t(n))return n;return}var kR={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function ER(e){let t=e.facet(Td).filter((i)=>typeof i!="function"),n=e.facet(ry).filter((i)=>typeof i!="function");if(n.length)t.push(pe.join(n));return t}class uy{constructor(e,t,n){let i=0,r=0,o=0;this.viewports=n.map(({from:s,to:l})=>{let a=t.lineAt(s,Te.ByPos,e,0,0).top,u=t.lineAt(l,Te.ByPos,e,0,0).bottom;return i+=u-a,{from:s,to:l,top:a,bottom:u,domTop:0,domBottom:0}}),this.scale=(7000000-i)/(t.height-i);for(let s of this.viewports)s.domTop=o+(s.top-r)*this.scale,o=s.domBottom=s.domTop+(s.bottom-s.top),r=s.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return i+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,i=r.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-i)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,i=r.domBottom}}eq(e){if(!(e instanceof uy))return!1;return this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function Xu(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new ii(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((r)=>Xu(r,t)):e._content)}var md=Y.define({combine:(e)=>e.join(" ")}),Wb=Y.define({combine:(e)=>e.indexOf(!0)>-1}),Yb=ti.newName(),IN=ti.newName(),VN=ti.newName(),HN={"&light":"."+IN,"&dark":"."+VN};function Xb(e,t,n){return new ti(t,{finish(i){return/&/.test(i)?i.replace(/&\w*/,(r)=>{if(r=="&")return e;if(!n||!n[r])throw RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+i}})}var f8=Xb("."+Yb,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},HN),h8={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Mb=V.ie&&V.ie_version<=11;class UN{constructor(e){if(this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new BR,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t)=>{for(let n of t)this.queue.push(n);if((V.ie&&V.ie_version<=11||V.ios&&e.composing)&&t.some((n)=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length))this.flushSoon();else this.flush()}),window.EditContext&&V.android&&e.constructor.EDIT_CONTEXT!==!1&&!(V.chrome&&V.chrome_version<126)){if(this.editContext=new jN(e),e.state.facet(yr))e.contentDOM.editContext=this.editContext.editContext}if(Mb)this.onCharData=(t)=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()};if(this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia)this.printQuery=window.matchMedia("print");if(typeof ResizeObserver=="function")this.resizeScroll=new ResizeObserver(()=>{var t;if(((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75)this.onResize()}),this.resizeScroll.observe(e.scrollDOM);if(this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function")this.intersection=new IntersectionObserver((t)=>{if(this.parentCheck<0)this.parentCheck=setTimeout(this.listenForScroll.bind(this),1000);if(t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting){if(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView)this.onScrollChanged(document.createEvent("Event"))}},{threshold:[0,0.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((t)=>{if(t.length>0&&t[t.length-1].intersectionRatio>0)this.onScrollChanged(document.createEvent("Event"))},{});this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){if(this.view.inputState.runHandlers("scroll",e),this.intersecting)this.view.measure()}onScroll(e){if(this.intersecting)this.flush(!1);if(this.editContext)this.view.requestMeasure(this.editContext.measureReq);this.onScrollChanged(e)}onResize(){if(this.resizeTimeout<0)this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50)}onPrint(e){if((e.type=="change"||!e.type)&&!e.matches)return;this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(yr)?n.root.activeElement!=this.dom:!Qu(this.dom,i))return;let r=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(e)){if(!t)this.selectionChanged=!1;return}if((V.ie&&V.ie_version<=11||V.android&&V.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Zu(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset))this.flushSoon();else this.flush(!1)}readSelectionRange(){let{view:e}=this,t=nc(e.root);if(!t)return!1;let n=V.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&d8(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=Qu(this.dom,n);if(i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&oP(this.dom,n))return this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1;if(this.selectionRange.setRange(n),i)this.selectionChanged=!0;return!0}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1){if(!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n)e++;else if(!t)t=this.scrollTargets.slice(0,e);if(t)t.push(n);n=n.assignedSlot||n.parentNode}else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t)t=this.scrollTargets.slice(0,e);if(t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){if(this.active)return;if(this.observer.observe(this.dom,h8),Mb)this.dom.addEventListener("DOMCharacterDataModified",this.onCharData);this.active=!0}stop(){if(!this.active)return;if(this.active=!1,this.observer.disconnect(),Mb)this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData)}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let i=()=>{let r=this.delayedAndroidKey;if(r){if(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force)$l(this.dom,r.key,r.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}if(!this.delayedAndroidKey||e=="Enter")this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!((n=this.delayedAndroidKey)===null||n===void 0?void 0:n.force)}}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){if(this.delayedFlush<0)this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()})}forceFlush(){if(this.delayedFlush>=0)this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1;this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();if(e.length)this.queue=[];let t=-1,n=-1,i=!1;for(let r of e){let o=this.readMutation(r);if(!o)continue;if(o.typeOver)i=!0;if(t==-1)({from:t,to:n}=o);else t=Math.min(o.from,t),n=Math.max(o.to,n)}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Qu(this.dom,this.selectionRange);if(e<0&&!i)return null;if(e>-1)this.lastChange=Date.now();this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new yN(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;if(e)this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=wN(this.view,t);if(this.view.state==n&&(t.domChanged||t.newSel&&!Ad(this.view.state.selection,t.newSel.main)))this.view.update([]);return i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=CR(t,e.previousSibling||e.target.previousSibling,-1),i=CR(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else if(e.type=="characterData")return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue};else return null}setWindow(e){if(e!=this.win)this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win)}addWindowListeners(e){if(e.addEventListener("resize",this.onResize),this.printQuery)if(this.printQuery.addEventListener)this.printQuery.addEventListener("change",this.onPrint);else this.printQuery.addListener(this.onPrint);else e.addEventListener("beforeprint",this.onPrint);e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){if(e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery)if(this.printQuery.removeEventListener)this.printQuery.removeEventListener("change",this.onPrint);else this.printQuery.removeListener(this.onPrint);else e.removeEventListener("beforeprint",this.onPrint);e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){if(this.editContext){if(this.editContext.update(e),e.startState.facet(yr)!=e.state.facet(yr))e.view.contentDOM.editContext=e.state.facet(yr)?this.editContext.editContext:null}}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);if(this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext)this.view.contentDOM.editContext=null,this.editContext.destroy()}}function CR(e,t,n){while(t){let i=Ve.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function AR(e,t){let{startContainer:n,startOffset:i,endContainer:r,endOffset:o}=t,s=e.docView.domAtPos(e.state.selection.main.anchor,1);if(Zu(s.node,s.offset,r,o))[n,i,r,o]=[r,o,n,i];return{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}}function d8(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return AR(e,r)}let n=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?AR(e,n):null}class jN{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=(n)=>{let i=e.state.selection.main,{anchor:r,head:o}=i,s=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);if(e.inputState.composing>=0&&!this.composing)this.composing={contextBase:n.updateRangeStart,editorBase:s,drifted:!1};let a=l-s>n.text.length;if(s==this.from&&r<this.from)s=r;else if(l==this.to&&r>this.to)l=r;let u=SN(e.state.sliceDoc(s,l),n.text,(a?i.from:i.to)-s,a?"end":null);if(!u){let f=N.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));if(!Ad(f,i))e.dispatch({selection:f,userEvent:"select"});return}let c={from:u.from+s,to:u.toA+s,insert:ce.of(n.text.slice(u.from,u.toB).split(`
26
+ `))};if((V.mac||V.android)&&c.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off")c={from:s,to:l,insert:ce.of([n.text.replace("."," ")])};if(this.pendingContextChange=c,!e.state.readOnly){let f=this.to-this.from+(c.to-c.from+c.insert.length);sy(e,c,N.single(this.toEditorPos(n.selectionStart,f),this.toEditorPos(n.selectionEnd,f)))}if(this.pendingContextChange)this.revertPending(e.state),this.setSelection(e.state);if(c.from<c.to&&!c.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1))))this.handlers.compositionend(n)},this.handlers.characterboundsupdate=(n)=>{let i=[],r=null;for(let o=this.toEditorPos(n.rangeStart),s=this.toEditorPos(n.rangeEnd);o<s;o++){let l=e.coordsForChar(o);r=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||r||new DOMRect,i.push(r)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=(n)=>{let i=[];for(let r of n.getTextFormats()){let{underlineStyle:o,underlineThickness:s}=r;if(!/none/i.test(o)&&!/none/i.test(s)){let l=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);if(l<a){let u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(s)?1:2}px`;i.push(ke.mark({attributes:{style:u}}).range(l,a))}}}e.dispatch({effects:nN.of(ke.set(i))})},this.handlers.compositionstart=()=>{if(e.inputState.composing<0)e.inputState.composing=0,e.inputState.compositionFirstChange=!0},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;if(this.composing=null,n)this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:(n)=>{let i=nc(n.root);if(i&&i.rangeCount)this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;if(e.changes.iterChanges((r,o,s,l,a)=>{if(n)return;let u=a.length-(o-r);if(i&&o>=i.to)if(i.from==r&&i.to==o&&i.insert.eq(a)){i=this.pendingContextChange=null,t+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+a.length>30000){n=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),a.toString()),this.to+=u}t+=u}),i&&!n)this.revertPending(e.state);return!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;if(this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some((i)=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to))))this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase);else if(!this.applyEdits(e)||!this.rangeIsValid(e.state))this.pendingContextChange=null,this.reset(e.state);else if(e.docChanged||e.selectionSet||t)this.setSelection(e.state);if(e.geometryChanged||e.docChanged||e.selectionSet)e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);if(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=i)this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>30000)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class G{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;if(this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent)e.parent.appendChild(this.dom);let{dispatch:n}=e;if(this.dispatchTransactions=e.dispatchTransactions||n&&((i)=>i.forEach((r)=>n(r,this)))||((i)=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||rP(e.parent)||document,this.viewState=new Gb(this,e.state||de.create(e)),e.scrollTo&&e.scrollTo.is(cd))this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state);this.plugins=this.state.facet(Kl).map((i)=>new bd(i));for(let i of this.plugins)i.update(this);if(this.observer=new UN(this),this.inputState=new kN(this),this.inputState.ensureHandlers(this.plugins),this.docView=new jb(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(t=document.fonts)===null||t===void 0?void 0:t.ready)document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof je?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,i,r=this.state;for(let f of e){if(f.startState!=r)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=f.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,s=0,l=null;if(e.some((f)=>f.annotation(TN)))this.inputState.notifiedFocused=o,s=1;else if(o!=this.inputState.notifiedFocused){if(this.inputState.notifiedFocused=o,l=MN(r,o),!l)s=1}let a=this.observer.delayedAndroidKey,u=null;if(a){if(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))u=null}else this.observer.clear();if(r.facet(de.phrases)!=this.state.facet(de.phrases))return this.setState(r);i=Ed.create(this,r,e),i.flags|=s;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(c)c=c.map(f.changes);if(f.scrollIntoView){let{main:h}=f.state.selection,{x:d,y:m}=this.state.facet(G.cursorScrollMargin);c=new Gl(h.empty?h:N.cursor(h.head,h.head>h.anchor?-1:1),"nearest","nearest",m,d)}for(let h of f.effects)if(h.is(cd))c=h.value.clip(this.state)}if(this.viewState.update(i,c),this.bidiCache=Rd.update(this.bidiCache,i.changes),!i.empty)this.updatePlugins(i),this.inputState.update(i);if(t=this.docView.update(i),this.state.facet(Wu)!=this.styleModules)this.mountStyles();n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some((f)=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(md)!=i.state.facet(md))this.viewState.mustMeasureContent=!0;if(t||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)this.requestMeasure();if(t)this.docViewUpdate();if(!i.empty)for(let f of this.state.facet(Ub))try{f(i)}catch(h){Mt(this.state,h,"update listener")}if(l||u)Promise.resolve().then(()=>{if(l&&this.state==l.startState)this.dispatch(l);if(u){if(!wN(this,u)&&a.force)$l(this.contentDOM,a.key,a.keyCode)}})}setState(e){if(this.updateState!=0)throw Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Gb(this,e),this.plugins=e.facet(Kl).map((n)=>new bd(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new jb(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}if(t)this.focus();this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Kl),n=e.state.facet(Kl);if(t!=n){let i=[];for(let r of n){let o=t.indexOf(r);if(o<0)i.push(new bd(r));else{let s=this.plugins[o];s.mustUpdate=e,i.push(s)}}for(let r of this.plugins)if(r.mustUpdate!=e)r.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);if(t!=n)this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Mt(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1)this.win.cancelAnimationFrame(this.measureScheduled);if(this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}if(this.measureScheduled=0,e)this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o,scaleY:s}=this.viewState;if(Math.abs(i-this.viewState.scrollOffset)>1)o=-1;this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0){if(HR(n||this.win))r=-1,o=this.viewState.heightMap.height/this.viewState.scaleY;else{let d=this.viewState.scrollAnchorAt(i);r=d.from,o=d.top}s=this.viewState.scaleY}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];if(!(a&4))[this.measureRequests,u]=[u,this.measureRequests];let c=u.map((d)=>{try{return d.read(this)}catch(m){return Mt(this.state,m),OR}}),f=Ed.create(this,this.state,[]),h=!1;if(f.flags|=a,!t)t=f;else t.flags|=a;if(this.updateState=2,!f.empty){if(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f),h)this.docViewUpdate()}for(let d=0;d<u.length;d++)if(c[d]!=OR)try{let m=u[d];if(m.write)m.write(c[d],this)}catch(m){Mt(this.state,m)}if(h)this.docView.updateSelection(!0);if(!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)/this.viewState.scaleY-o/s;if((m>1||m<-1)&&!(V.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){if(i=i+m,!n)this.win.scrollBy(0,m);else if(r<0)n.scrollTop=n.scrollHeight;else n.scrollTop+=m;o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Ub))l(t)}get themeClasses(){return Yb+" "+(this.state.facet(Wb)?VN:IN)+" "+this.state.facet(md)}updateAttrs(){let e=RR(this,iN,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:!this.state.facet(yr)?"false":"true",class:"cm-content",style:`${V.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};if(this.state.readOnly)t["aria-readonly"]="true";RR(this,iy,t);let n=this.observer.ignore(()=>{let i=sR(this.contentDOM,this.contentAttrs,t),r=sR(this.dom,this.editorAttrs,e);return i||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let i of n.effects)if(i.is(G.announce)){if(t)this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Wu);let e=this.state.facet(G.cspNonce);ti.mount(this.root,this.styleModules.concat(f8).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw Error("Reading the editor layout isn't allowed during an update");if(this.updateState==0&&this.measureScheduled>-1)this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0)this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure());if(e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);if(t===void 0||t&&t.plugin!=e)this.pluginMap.set(e,t=this.plugins.find((n)=>n.plugin==e)||null);return t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Tb(this,e,hR(this,e,t,n))}moveByGroup(e,t){return Tb(this,e,hR(this,e,t,(n)=>zP(this,e.head,n)))}visualLineSide(e,t){return t?N.cursor(e.to,1):N.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return LP(this,e,t,n)}moveVertically(e,t,n){return Tb(this,e,BP(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Kb(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Kb(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),i=this.bidiSpans(n),r=i[oi.find(i,e-n.from,-1,t)];if(n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&r.dir!=this.textDirectionAt(n.from))if(e==n.to)e=n.from+r.from,t=1;else e=n.from+r.to,t=-1;return this.docView.coordsAt(e,t,r.dir==Be.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){if(!this.state.facet(eN)||e<this.viewport.from||e>this.viewport.to)return this.textDirection;return this.readMeasured(),this.docView.textDirectionAt(e)}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>p8)return $R(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||qR(r.isolates,n=uR(this,e))))return r.order;if(!n)n=uR(this,e);let i=hP(e.text,t,n);return this.bidiCache.push(new Rd(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||V.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-30000)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{VR(this.contentDOM),this.docView.updateSelection()})}setRoot(e){if(this._root!=e)this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles()}destroy(){if(this.root.activeElement==this.contentDOM)this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);if(this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1)this.win.cancelAnimationFrame(this.measureScheduled);this.destroyed=!0}static scrollIntoView(e,t={}){var n,i,r,o;return cd.of(new Gl(typeof e=="number"?N.cursor(e):e,(n=t.y)!==null&&n!==void 0?n:"nearest",(i=t.x)!==null&&i!==void 0?i:"nearest",(r=t.yMargin)!==null&&r!==void 0?r:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return cd.of(new Gl(N.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){if(e==null)this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1;else if(typeof e=="boolean")this.inputState.tabFocusMode=e?0:-1;else if(this.inputState.tabFocusMode!=0)this.inputState.tabFocusMode=Date.now()+e}static domEventHandlers(e){return fn.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return fn.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=ti.newName(),i=[md.of(n),Wu.of(Xb(`.${n}`,e))];if(t&&t.dark)i.push(Wb.of(!0));return i}static baseTheme(e){return Ni.lowest(Wu.of(Xb("."+Yb,e,HN)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&Ve.get(n)||Ve.get(e);return((t=i===null||i===void 0?void 0:i.root)===null||t===void 0?void 0:t.view)||null}}G.styleModule=Wu;G.inputHandler=JR;G.clipboardInputFilter=ty;G.clipboardOutputFilter=ny;G.scrollHandler=tN;G.focusChangeEffect=ZR;G.perLineTextDirection=eN;G.exceptionSink=QR;G.updateListener=Ub;G.editable=yr;G.mouseSelectionStyle=XR;G.dragMovesSelection=YR;G.clickAddsSelectionRange=WR;G.decorations=Td;G.blockWrappers=rN;G.outerDecorations=ry;G.atomicRanges=ac;G.bidiIsolatedRanges=oN;G.cursorScrollMargin=Y.define({combine:(e)=>{let t=5,n=5;for(let i of e)if(typeof i=="number")t=n=i;else({x:t,y:n}=i);return{x:t,y:n}}});G.scrollMargins=sN;G.darkTheme=Wb;G.cspNonce=Y.define({combine:(e)=>e.length?e[0]:""});G.contentAttributes=iy;G.editorAttributes=iN;G.lineWrapping=G.contentAttributes.of({class:"cm-lineWrapping"});G.announce=ve.define();var p8=4096,OR={};class Rd{constructor(e,t,n,i,r,o){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some((r)=>r.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:Be.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];if(o.dir==i&&!t.touchesRange(o.from,o.to))n.push(new Rd(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function RR(e,t,n){for(let i=e.state.facet(t),r=i.length-1;r>=0;r--){let o=i[r],s=typeof o=="function"?o(e):o;if(s)Jb(s,n)}return n}var m8=V.mac?"mac":V.windows?"win":V.linux?"linux":"key";function g8(e,t){let n=e.split(/-(?!$)/),i=n[n.length-1];if(i=="Space")i=" ";let r,o,s,l;for(let a=0;a<n.length-1;++a){let u=n[a];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))if(t=="mac")l=!0;else o=!0;else throw Error("Unrecognized modifier name: "+u)}if(r)i="Alt-"+i;if(o)i="Ctrl-"+i;if(l)i="Meta-"+i;if(s)i="Shift-"+i;return i}function gd(e,t,n){if(t.altKey)e="Alt-"+e;if(t.ctrlKey)e="Ctrl-"+e;if(t.metaKey)e="Meta-"+e;if(n!==!1&&t.shiftKey)e="Shift-"+e;return e}var v8=Ni.default(G.domEventHandlers({keydown(e,t){return w8(b8(t.state),e,t,"editor")}})),Xl=Y.define({enables:v8}),NR=new WeakMap;function b8(e){let t=e.facet(Xl),n=NR.get(t);if(!n)NR.set(t,n=x8(t.reduce((i,r)=>i.concat(r),[])));return n}var ho=null,y8=4000;function x8(e,t=m8){let n=Object.create(null),i=Object.create(null),r=(s,l)=>{let a=i[s];if(a==null)i[s]=l;else if(a!=l)throw Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},o=(s,l,a,u,c)=>{var f,h;let d=n[s]||(n[s]=Object.create(null)),m=l.split(/ (?!$)/).map((g)=>g8(g,t));for(let g=1;g<m.length;g++){let v=m.slice(0,g).join(" ");if(r(v,!0),!d[v])d[v]={preventDefault:!0,stopPropagation:!1,run:[(y)=>{let S=ho={view:y,prefix:v,scope:s};return setTimeout(()=>{if(ho==S)ho=null},y8),!0}]}}let b=m.join(" ");r(b,!1);let x=d[b]||(d[b]={preventDefault:!1,stopPropagation:!1,run:((h=(f=d._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});if(a)x.run.push(a);if(u)x.preventDefault=!0;if(c)x.stopPropagation=!0};for(let s of e){let l=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));if(!c._any)c._any={preventDefault:!1,stopPropagation:!1,run:[]};let{any:f}=s;for(let h in c)c[h].run.push((d)=>f(d,Qb))}let a=s[t]||s.key;if(!a)continue;for(let u of l)if(o(u,a,s.run,s.preventDefault,s.stopPropagation),s.shift)o(u,"Shift-"+a,s.shift,s.preventDefault,s.stopPropagation)}return n}var Qb=null;function w8(e,t,n,i){Qb=t;let r=nR(t),o=vr(r,0),s=fo(o)==r.length&&r!=" ",l="",a=!1,u=!1,c=!1;if(ho&&ho.view==n&&ho.scope==i){if(l=ho.prefix+" ",CN.indexOf(t.keyCode)<0)u=!0,ho=null}let f=new Set,h=(x)=>{if(x){for(let g of x.run)if(!f.has(g)){if(f.add(g),g(n)){if(x.stopPropagation)c=!0;return!0}}if(x.preventDefault){if(x.stopPropagation)c=!0;u=!0}}return!1},d=e[i],m,b;if(d){if(h(d[l+gd(r,t,!s)]))a=!0;else if(s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(V.windows&&t.ctrlKey&&t.altKey)&&!(V.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(m=br[t.keyCode])&&m!=r){if(h(d[l+gd(m,t,!0)]))a=!0;else if(t.shiftKey&&(b=jl[t.keyCode])!=r&&b!=m&&h(d[l+gd(b,t,!1)]))a=!0}else if(s&&t.shiftKey&&h(d[l+gd(r,t,!0)]))a=!0;if(!a&&h(d._any))a=!0}if(u)a=!0;if(a&&c)t.stopPropagation();return Qb=null,a}var S8=V.gecko&&V.gecko_version==153?"#ffffff01":"transparent",HU=Ni.highest(G.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${S8} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));var UU=/x/.unicode!=null?"gu":"g";class FN extends go{constructor(e){super();this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Ju(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=ic(t[0],n.direction!="rtl"),r=parseInt(n.lineHeight);if(i.bottom-i.top>r*1.5)return{left:i.left,right:i.right,top:i.top,bottom:i.top+r};return i}ignoreEvent(){return!1}}function KN(e){let t=fn.fromClass(class{constructor(n){this.view=n,this.placeholder=e?ke.set([ke.widget({widget:new FN(e),side:1}).range(0)]):ke.none}get decorations(){return this.view.state.doc.length?ke.none:this.placeholder}},{decorations:(n)=>n.decorations});return typeof e=="string"?[t,G.contentAttributes.of({"aria-placeholder":e})]:t}var vd="-10000px";class qN{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter((o)=>o);let r=null;this.tooltipViews=this.tooltips.map((o)=>r=n(o,r))}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter((l)=>l);if(i===this.input){for(let l of this.tooltipViews)if(l.update)l.update(e);return!1}let o=[],s=t?[]:null;for(let l=0;l<r.length;l++){let a=r[l],u=-1;if(!a)continue;for(let c=0;c<this.tooltips.length;c++){let f=this.tooltips[c];if(f&&f.create==a.create)u=c}if(u<0){if(o[l]=this.createTooltipView(a,l?o[l-1]:null),s)s[l]=!!a.above}else{let c=o[l]=this.tooltipViews[u];if(s)s[l]=t[u];if(c.update)c.update(e)}}for(let l of this.tooltipViews)if(o.indexOf(l)<0)this.removeTooltipView(l),(n=l.destroy)===null||n===void 0||n.call(l);if(t)s.forEach((l,a)=>t[a]=l),t.length=s.length;return this.input=i,this.tooltips=r,this.tooltipViews=o,!0}}function k8(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}var _b=Y.define({combine:(e)=>{var t,n,i;return{position:V.ios?"absolute":((t=e.find((r)=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find((r)=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((i=e.find((r)=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||k8}}}),TR=new WeakMap,$N=fn.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(_b);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new qN(e,cy,(n,i)=>this.createTooltip(n,i),(n)=>{if(this.resizeObserver)this.resizeObserver.unobserve(n.dom);n.dom.remove()}),this.above=this.manager.tooltips.map((n)=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver((n)=>{if(Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1)this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){if(this.parent)this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container);else this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){if(this.measureTimeout<0)this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50)}update(e){if(e.transactions.length)this.lastTransaction=Date.now();let t=this.manager.update(e,this.above);if(t)this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(_b);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){if(this.parent)this.container.remove();this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else if(this.parent&&this.view.themeClasses!=this.classes)this.classes=this.container.className=this.view.themeClasses;if(n)this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}if(n.dom.style.position=this.position,n.dom.style.top=vd,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount)n.mount(this.view);if(this.resizeObserver)this.resizeObserver.observe(n.dom);return n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(e=i.destroy)===null||e===void 0||e.call(i);if(this.parent)this.container.remove();(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:o}=this.manager.tooltipViews[0];if(V.safari){let s=o.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}else n=!!o.offsetParent&&o.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let o=this.parent.getBoundingClientRect();if(o.width&&o.height)e=o.width/this.parent.offsetWidth,t=o.height/this.parent.offsetHeight}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=oy(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((o,s)=>{let l=this.manager.tooltipViews[s];return l.getCoords?l.getCoords(o.pos):this.view.coordsAtPos(o.pos)}),size:this.manager.tooltipViews.map(({dom:o})=>o.getBoundingClientRect()),space:this.view.state.facet(_b).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:o}=e,s=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],u=this.manager.tooltipViews[l],{dom:c}=u,f=e.pos[l],h=e.size[l];if(!f||a.clip!==!1&&(f.bottom<=Math.max(n.top,i.top)||f.top>=Math.min(n.bottom,i.bottom)||f.right<Math.max(n.left,i.left)-0.1||f.left>Math.min(n.right,i.right)+0.1)){c.style.top=vd;continue}let d=a.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,m=d?7:0,b=h.right-h.left,x=(t=TR.get(u))!==null&&t!==void 0?t:h.bottom-h.top,g=u.offset||C8,v=this.view.textDirection==Be.LTR,y=h.width>i.right-i.left?v?i.left:i.right-h.width:v?Math.max(i.left,Math.min(f.left-(d?14:0)+g.x,i.right-b)):Math.min(Math.max(i.left,f.left-b+(d?14:0)-g.x),i.right-b),S=this.above[l];if(!a.strictSide&&(S?f.top-x-m-g.y<i.top:f.bottom+x+m+g.y>i.bottom)&&S==i.bottom-f.bottom>f.top-i.top)S=this.above[l]=!S;let k=(S?f.top-i.top:i.bottom-f.bottom)-m;if(k<x&&u.resize!==!1){if(k<this.view.defaultLineHeight){c.style.top=vd;continue}TR.set(u,x),c.style.height=(x=k)/o+"px"}else if(c.style.height)c.style.height="";let A=S?f.top-x-m-g.y:f.bottom+m+g.y,E=y+b;if(u.overlap!==!0){for(let O of s)if(O.left<E&&O.right>y&&O.top<A+x&&O.bottom>A)A=S?O.top-x-2-m:O.bottom+m+2}if(this.position=="absolute")c.style.top=(A-e.parent.top)/o+"px",MR(c,(y-e.parent.left)/r);else c.style.top=A/o+"px",MR(c,y/r);if(d){let O=f.left+(v?g.x:-g.x)-(y+14-7);d.style.left=O/r+"px"}if(u.overlap!==!0)s.push({left:y,top:A,right:E,bottom:A+x});if(c.classList.toggle("cm-tooltip-above",S),c.classList.toggle("cm-tooltip-below",!S),u.positioned)u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length){if(this.view.inView)this.view.requestMeasure(this.measureReq);if(this.inView!=this.view.inView){if(this.inView=this.view.inView,!this.inView)for(let e of this.manager.tooltipViews)e.dom.style.top=vd}}}},{eventObservers:{scroll(){this.maybeMeasure()}}});function MR(e,t){let n=parseInt(e.style.left,10);if(isNaN(n)||Math.abs(t-n)>1)e.style.left=t+"px"}var E8=G.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),C8={x:0,y:0},cy=Y.define({enables:[$N,E8]});function fy(e,t){let n=e.plugin($N);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}class mo extends ei{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}mo.prototype.elementClass="";mo.prototype.toDOM=void 0;mo.prototype.mapMode=Nt.TrackBefore;mo.prototype.startSide=mo.prototype.endSide=-1;mo.prototype.point=!0;var A8=0;class Dd{constructor(e,t){this.from=e,this.to=t}}class ae{constructor(e={}){this.id=A8++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");if(typeof e!="function")e=hn.match(e);return(t)=>{let n=e(t);return n===void 0?null:[this,n]}}}ae.closedBy=new ae({deserialize:(e)=>e.split(" ")});ae.openedBy=new ae({deserialize:(e)=>e.split(" ")});ae.group=new ae({deserialize:(e)=>e.split(" ")});ae.isolate=new ae({deserialize:(e)=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw RangeError("Invalid value for isolate: "+e);return e||"auto"}});ae.contextHash=new ae({perNode:!0});ae.lookAhead=new ae({perNode:!0});ae.mounted=new ae({perNode:!0});class Ql{constructor(e,t,n,i=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[ae.mounted.id]}}var O8=Object.create(null);class hn{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):O8,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new hn(e.name||"",t,e.id,n);if(e.props)for(let r of e.props){if(!Array.isArray(r))r=r(i);if(r){if(r[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ae.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return(n)=>{for(let i=n.prop(ae.group),r=-1;r<(i?i.length:0);r++){let o=t[r<0?n.name:i[r]];if(o)return o}}}}hn.none=new hn("",Object.create(null),0,8);var _d=new WeakMap,GN=new WeakMap,Fe;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(Fe||(Fe={}));class ut{constructor(e,t,n,i,r){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,s]of r)this.props[typeof o=="number"?o:o.id]=s}}toString(){let e=Ql.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();if(i){if(t)t+=",";t+=i}}return!this.type.name?t:(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":"")}cursor(e=0){return new zd(this.topNode,e)}cursorAt(e,t=0,n=0){let i=_d.get(this)||this.topNode,r=new zd(i);return r.moveTo(e,t),_d.set(this,r._tree),r}get topNode(){return new zn(this,0,0,null)}resolve(e,t=0){let n=fc(_d.get(this)||this.topNode,e,t,!1);return _d.set(this,n),n}resolveInner(e,t=0){let n=fc(GN.get(this)||this.topNode,e,t,!0);return GN.set(this,n),n}resolveStack(e,t=0){return R8(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,o=e.mode||0,s=(o&Fe.IncludeAnonymous)>0;for(let l=this.cursor(o|Fe.IncludeAnonymous);;){let a=!1;if(l.from<=r&&l.to>=i&&(!s&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;a=!0}for(;;){if(a&&n&&(s||!l.type.isAnonymous))n(l);if(l.nextSibling())break;if(!l.parent())return;a=!0}}}prop(e){return!e.perNode?this.type.prop(e):this.props?this.props[e.id]:void 0}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:gy(hn.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new ut(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new ut(hn.none,t,n,i)))}static build(e){return N8(e)}}ut.empty=new ut(hn.none,[],[],0);class dy{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new dy(this.buffer,this.index)}}class bo{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return hn.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],r=i.name;if(/\W/.test(r)&&!i.isError)r=JSON.stringify(r);if(e+=4,n==e)return r;let o=[];while(e<n)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,n,i,r){let{buffer:o}=this,s=-1;for(let l=e;l!=t;l=o[l+3])if(XN(r,i,o[l+1],o[l+2])){if(s=l,n>0)break}return s}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),o=0;for(let s=e,l=0;s<t;){r[l++]=i[s++],r[l++]=i[s++]-n;let a=r[l++]=i[s++]-n;r[l++]=i[s++]-e,o=Math.max(o,a)}return new bo(r,o,this.set)}}function XN(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function fc(e,t,n,i){var r;while(e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t)){let s=!i&&e instanceof zn&&e.index<0?null:e.parent;if(!s)return e;e=s}let o=i?0:Fe.IgnoreOverlays;if(i){for(let s=e,l=s.parent;l;s=l,l=s.parent)if(s instanceof zn&&s.index<0&&((r=l.enter(t,n,o))===null||r===void 0?void 0:r.from)!=s.from)e=l}for(;;){let s=e.enter(t,n,o);if(!s)return e;e=s}}class py{cursor(e=0){return new zd(this,e)}getChild(e,t=null,n=null){let i=WN(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return WN(this,e,t,n)}resolve(e,t=0){return fc(this,e,t,!1)}resolveInner(e,t=0){return fc(this,e,t,!0)}matchContext(e){return hy(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;while(t){let i=t.lastChild;if(!i||i.to!=t.to)break;if(i.type.isError&&i.from==i.to)n=t,t=i.prevSibling;else t=i}return n}get node(){return this}get next(){return this.parent}}class zn extends py{constructor(e,t,n,i){super();this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,r=0){for(let o=this;;){for(let{children:s,positions:l}=o._tree,a=t>0?s.length:-1;e!=a;e+=t){let u=s[e],c=l[e]+o.from,f;if(!(r&Fe.EnterBracketed&&u instanceof ut&&(f=Ql.get(u))&&!f.overlay&&f.bracketed&&n>=c&&n<=c+u.length)&&!XN(i,n,c,c+u.length))continue;if(u instanceof bo){if(r&Fe.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,t,n-c,i);if(h>-1)return new vo(new QN(o,u,e,c),null,h)}else if(r&Fe.IncludeAnonymous||(!u.type.isAnonymous||my(u))){let h;if(!(r&Fe.IgnoreMounts)&&(h=Ql.get(u))&&!h.overlay)return new zn(h.tree,c,e,o);let d=new zn(u,c,e,o);return r&Fe.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?u.children.length-1:0,t,n,i,r)}}if(r&Fe.IncludeAnonymous||!o.type.isAnonymous)return null;if(o.index>=0)e=o.index+t;else e=t<0?-1:o._parent._tree.children.length;if(o=o._parent,!o)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let i;if(!(n&Fe.IgnoreOverlays)&&(i=Ql.get(this._tree))&&i.overlay){let r=e-this.from,o=n&Fe.EnterBracketed&&i.bracketed;for(let{from:s,to:l}of i.overlay)if((t>0||o?s<=r:s<r)&&(t<0||o?l>=r:l>r))return new zn(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;while(e.type.isAnonymous&&e._parent)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function WN(e,t,n,i){let r=e.cursor(),o=[];if(!r.firstChild())return o;if(n!=null){for(let s=!1;!s;)if(s=r.type.is(n),!r.nextSibling())return o}for(;;){if(i!=null&&r.type.is(i))return o;if(r.type.is(t))o.push(r.node);if(!r.nextSibling())return i==null?o:[]}}function hy(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class QN{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class vo extends py{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super();this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new vo(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&Fe.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new vo(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];if(t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length))return new vo(this.context,this._parent,t);return this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;if(this.index==t)return this.externalSibling(-1);return new vo(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let o=n.buffer[this.index+1];e.push(n.slice(i,r,o)),t.push(0)}return new ut(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function JN(e){if(!e.length)return null;let t=0,n=e[0];for(let o=1;o<e.length;o++){let s=e[o];if(s.from>n.from||s.to<n.to)n=s,t=o}let i=n instanceof zn&&n.index<0?null:n.parent,r=e.slice();if(i)r[t]=i;else r.splice(t,1);return new ZN(r,n)}class ZN{constructor(e,t){this.heads=e,this.node=t}get next(){return JN(this.heads)}}function R8(e,t,n){let i=e.resolveInner(t,n),r=null;for(let o=i instanceof zn?i:i.context.parent;o;o=o.parent)if(o.index<0){let s=o.parent;(r||(r=[i])).push(s.resolve(t,n)),o=s}else{let s=Ql.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=t&&s.overlay[s.overlay.length-1].to>=t){let l=new zn(s.tree,s.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(fc(l,t,n,!1))}}return r?JN(r):i}class zd{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Fe.EnterBracketed,e instanceof zn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){if(!e)return!1;return this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){if(!e)return!1;if(e instanceof zn)return this.buffer=null,this.yieldNode(e);return this.buffer=e.context,this.yieldBuf(e.index,e.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);if(r<0)return!1;return this.stack.push(this.index),this.yieldBuf(r)}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){if(!this.buffer)return this.yield(this._tree.enter(e,t,n));return n&Fe.ExcludeBuffers?!1:this.enterChild(1,e,t)}parent(){if(!this.buffer)return this.yieldNode(this.mode&Fe.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Fe.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!this._tree._parent?!1:this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,o=e<0?-1:n._tree.children.length;r!=o;r+=e){let s=n._tree.children[r];if(this.mode&Fe.IncludeAnonymous||s instanceof bo||!s.type.isAnonymous||my(s))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){while(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))if(!this.parent())break;while(this.enterChild(1,e,t));return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=r+1;break e}i=this.stack[--r]}for(let i=n;i<this.stack.length;i++)t=new vo(this.buffer,t,this.stack[i]);return this.bufferNode=new vo(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}if(!this.type.isAnonymous)i=!0}for(;;){if(i&&t)t(this);if(i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return hy(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return hy(this._tree,e,i);let o=n[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function my(e){return e.children.some((t)=>t instanceof bo||!t.type.isAnonymous||my(t))}function N8(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=1024,reused:o=[],minRepeatType:s=i.types.length}=e,l=Array.isArray(n)?new dy(n,n.length):n,a=i.types,u=0,c=0;function f(k,A,E,O,T,_){let{id:L,start:B,end:W,size:K}=l,I=c,j=u;if(K<0)if(l.next(),K==-1){let yt=o[L];E.push(yt),O.push(B-k);return}else if(K==-3){u=L;return}else if(K==-4){c=L;return}else throw RangeError(`Unrecognized record size: ${K}`);let ee=a[L],F,fe,Ye=B-k;if(W-B<=r&&(fe=x(l.pos-A,T))){let yt=new Uint16Array(fe.size-fe.skip),Xe=l.pos-fe.size,xt=yt.length;while(l.pos>Xe)xt=g(fe.start,yt,xt);F=new bo(yt,W-fe.start,i),Ye=fe.start-k}else{let yt=l.pos-K;l.next();let Xe=[],xt=[],Qe=L>=s?L:-1,Wt=0,Lt=W;while(l.pos>yt)if(Qe>=0&&l.id==Qe&&l.size>=0){if(l.end<=Lt-r)m(Xe,xt,B,Wt,l.end,Lt,Qe,I,j),Wt=Xe.length,Lt=l.end;l.next()}else if(_>2500)h(B,yt,Xe,xt);else f(B,yt,Xe,xt,Qe,_+1);if(Qe>=0&&Wt>0&&Wt<Xe.length)m(Xe,xt,B,Wt,B,Lt,Qe,I,j);if(Xe.reverse(),xt.reverse(),Qe>-1&&Wt>0){let Bi=d(ee,j);F=gy(ee,Xe,xt,0,Xe.length,0,W-B,Bi,Bi)}else F=b(ee,Xe,xt,W-B,I-W,j)}E.push(F),O.push(Ye)}function h(k,A,E,O){let T=[],_=0,L=-1;while(l.pos>A){let{id:B,start:W,end:K,size:I}=l;if(I>4)l.next();else if(L>-1&&W<L)break;else{if(L<0)L=K-r;T.push(B,W,K),_++,l.next()}}if(_){let B=new Uint16Array(_*4),W=T[T.length-2];for(let K=T.length-3,I=0;K>=0;K-=3)B[I++]=T[K],B[I++]=T[K+1]-W,B[I++]=T[K+2]-W,B[I++]=I;E.push(new bo(B,T[2]-W,i)),O.push(W-k)}}function d(k,A){return(E,O,T)=>{let _=0,L=E.length-1,B,W;if(L>=0&&(B=E[L])instanceof ut){if(!L&&B.type==k&&B.length==T)return B;if(W=B.prop(ae.lookAhead))_=O[L]+B.length+W}return b(k,E,O,T,_,A)}}function m(k,A,E,O,T,_,L,B,W){let K=[],I=[];while(k.length>O)K.push(k.pop()),I.push(A.pop()+E-T);k.push(b(i.types[L],K,I,_-T,B-_,W)),A.push(T-E)}function b(k,A,E,O,T,_,L){if(_){let B=[ae.contextHash,_];L=L?[B].concat(L):[B]}if(T>25){let B=[ae.lookAhead,T];L=L?[B].concat(L):[B]}return new ut(k,A,E,O,L)}function x(k,A){let E=l.fork(),O=0,T=0,_=0,L=E.end-r,B={size:0,start:0,skip:0};e:for(let W=E.pos-k;E.pos>W;){let K=E.size;if(E.id==A&&K>=0){B.size=O,B.start=T,B.skip=_,_+=4,O+=4,E.next();continue}let I=E.pos-K;if(K<0||I<W||E.start<L)break;let j=E.id>=s?4:0,ee=E.start;E.next();while(E.pos>I){if(E.size<0)if(E.size==-3||E.size==-4)j+=4;else break e;else if(E.id>=s)j+=4;E.next()}T=ee,O+=K,_+=j}if(A<0||O==k)B.size=O,B.start=T,B.skip=_;return B.size>4?B:void 0}function g(k,A,E){let{id:O,start:T,end:_,size:L}=l;if(l.next(),L>=0&&O<s){let B=E;if(L>4){let W=l.pos-(L-4);while(l.pos>W)E=g(k,A,E)}A[--E]=B,A[--E]=_-k,A[--E]=T-k,A[--E]=O}else if(L==-3)u=O;else if(L==-4)c=O;return E}let v=[],y=[];while(l.pos>0)f(e.start||0,e.bufferStart||0,v,y,-1,0);let S=(t=e.length)!==null&&t!==void 0?t:v.length?y[0]+v[0].length:0;return new ut(a[e.topID],v.reverse(),y.reverse(),S)}var YN=new WeakMap;function Ld(e,t){if(!e.isAnonymous||t instanceof bo||t.type!=e)return 1;let n=YN.get(t);if(n==null){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof ut)){n=1;break}n+=Ld(e,i)}YN.set(t,n)}return n}function gy(e,t,n,i,r,o,s,l,a){let u=0;for(let m=i;m<r;m++)u+=Ld(e,t[m]);let c=Math.ceil(u*1.5/8),f=[],h=[];function d(m,b,x,g,v){for(let y=x;y<g;){let S=y,k=b[y],A=Ld(e,m[y]);y++;for(;y<g;y++){let E=Ld(e,m[y]);if(A+E>=c)break;A+=E}if(y==S+1){if(A>c){let E=m[S];d(E.children,E.positions,0,E.children.length,b[S]+v);continue}f.push(m[S])}else{let E=b[y-1]+m[y-1].length-k;f.push(gy(e,m,b,S,y,k,E,null,a))}h.push(k+v-o)}}return d(t,n,i,r,0),(l||a)(f,h,s)}class yo{constructor(e,t,n,i,r=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let i=[new yo(0,e.length,e,0,!1,n)];for(let r of t)if(r.to>e.length)i.push(r);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,o=e.length?e[0]:null;for(let s=0,l=0,a=0;;s++){let u=s<t.length?t[s]:null,c=u?u.fromA:1e9;if(c-l>=n)while(o&&o.from<c){let f=o;if(l>=f.from||c<=f.to||a){let h=Math.max(f.from,l)-a,d=Math.min(f.to,c)-a;f=h>=d?null:new yo(h,d,f.tree,f.offset+a,s>0,!!u)}if(f)i.push(f);if(o.to>c)break;o=r<e.length?e[r++]:null}if(!u)break;l=u.toA,a=u.toA-u.toB}return i}}class vy{startParse(e,t,n){if(typeof e=="string")e=new eT(e);return n=!n?[new Dd(0,e.length)]:n.length?n.map((i)=>new Dd(i.from,i.to)):[new Dd(0,0)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let r=i.advance();if(r)return r}}}class eT{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}var $U=new ae({perNode:!0});var T8=0;class Bn{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=T8++}toString(){let{name:e}=this;for(let t of this.modified)if(t.name)e=`${t.name}(${e})`;return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Bn)t=e;if(t===null||t===void 0?void 0:t.base)throw Error("Can not derive from a modified tag");let i=new Bn(n,[],null,[]);if(i.set.push(i),t)for(let r of t.set)i.set.push(r);return i}static defineModifier(e){let t=new Vd(e);return(n)=>{if(n.modified.indexOf(t)>-1)return n;return Vd.get(n.base||n,n.modified.concat(t).sort((i,r)=>i.id-r.id))}}}var M8=0;class Vd{constructor(e){this.name=e,this.instances=[],this.id=M8++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((s)=>s.base==e&&_8(t,s.modified));if(n)return n;let i=[],r=new Bn(e.name,i,e,t);for(let s of t)s.instances.push(r);let o=D8(t);for(let s of e.set)if(!s.modified.length)for(let l of o)i.push(Vd.get(s,l));return r}}function _8(e,t){return e.length==t.length&&e.every((n,i)=>n==t[i])}function D8(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(e[n]));return t.sort((n,i)=>i.length-n.length)}function iT(e){let t=Object.create(null);for(let n in e){let i=e[n];if(!Array.isArray(i))i=[i];for(let r of n.split(" "))if(r){let o=[],s=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){s=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!h)throw RangeError("Invalid path: "+r);if(o.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==r.length)break;let d=r[f++];if(f==r.length&&d=="!"){s=0;break}if(d!="/")throw RangeError("Invalid path: "+r);l=r.slice(f)}let a=o.length-1,u=o[a];if(!u)throw RangeError("Invalid path: "+r);let c=new dc(i,s,a>0?o.slice(0,a):null);t[u]=c.sort(t[u])}}return L8.add(t)}var L8=new ae({combine(e,t){let n,i,r;while(e||t){if(!e||t&&e.depth<t.depth)r=t,t=t.next;else r=e,e=e.next;if(n&&n.mode==r.mode&&!r.context&&!n.context)continue;let o=new dc(r.tags,r.mode,r.context);if(n)n.next=o;else i=o;n=o}return i}});class dc{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){if(!e||e.depth<this.depth)return this.next=e,this;return e.next=this.sort(e.next),e}get depth(){return this.context?this.context.length:0}}dc.empty=new dc([],2,null);function xy(e,t){let n=Object.create(null);for(let o of e)if(!Array.isArray(o.tag))n[o.tag.id]=o.class;else for(let s of o.tag)n[s.id]=o.class;let{scope:i,all:r=null}=t||{};return{style:(o)=>{let s=r;for(let l of o)for(let a of l.set){let u=n[a.id];if(u){s=s?s+" "+u:u;break}}return s},scope:i}}var z=Bn.define,Bd=z(),xo=z(),tT=z(xo),nT=z(xo),wo=z(),Pd=z(wo),by=z(wo),Di=z(),vs=z(Di),Mi=z(),_i=z(),yy=z(),hc=z(yy),Id=z(),P={comment:Bd,lineComment:z(Bd),blockComment:z(Bd),docComment:z(Bd),name:xo,variableName:z(xo),typeName:tT,tagName:z(tT),propertyName:nT,attributeName:z(nT),className:z(xo),labelName:z(xo),namespace:z(xo),macroName:z(xo),literal:wo,string:Pd,docString:z(Pd),character:z(Pd),attributeValue:z(Pd),number:by,integer:z(by),float:z(by),bool:z(wo),regexp:z(wo),escape:z(wo),color:z(wo),url:z(wo),keyword:Mi,self:z(Mi),null:z(Mi),atom:z(Mi),unit:z(Mi),modifier:z(Mi),operatorKeyword:z(Mi),controlKeyword:z(Mi),definitionKeyword:z(Mi),moduleKeyword:z(Mi),operator:_i,derefOperator:z(_i),arithmeticOperator:z(_i),logicOperator:z(_i),bitwiseOperator:z(_i),compareOperator:z(_i),updateOperator:z(_i),definitionOperator:z(_i),typeOperator:z(_i),controlOperator:z(_i),punctuation:yy,separator:z(yy),bracket:hc,angleBracket:z(hc),squareBracket:z(hc),paren:z(hc),brace:z(hc),content:Di,heading:vs,heading1:z(vs),heading2:z(vs),heading3:z(vs),heading4:z(vs),heading5:z(vs),heading6:z(vs),contentSeparator:z(Di),list:z(Di),quote:z(Di),emphasis:z(Di),strong:z(Di),link:z(Di),monospace:z(Di),strikethrough:z(Di),inserted:z(),deleted:z(),changed:z(),invalid:z(),meta:Id,documentMeta:z(Id),annotation:z(Id),processingInstruction:z(Id),definition:Bn.defineModifier("definition"),constant:Bn.defineModifier("constant"),function:Bn.defineModifier("function"),standard:Bn.defineModifier("standard"),local:Bn.defineModifier("local"),special:Bn.defineModifier("special")};for(let e in P){let t=P[e];if(t instanceof Bn)t.name=e}var YU=xy([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}]);var wy,mc=new ae;var z8=new ae;class li{constructor(e,t,n=[],i=""){if(this.data=e,this.name=i,!de.prototype.hasOwnProperty("tree"))Object.defineProperty(de.prototype,"tree",{get(){return ai(this)}});this.parser=t,this.extension=[Zl.of(this),de.languageData.of((r,o,s)=>{let l=rT(r,o,s),a=l.type.prop(mc);if(!a)return[];let u=r.facet(a),c=l.type.prop(z8);if(c){let f=l.resolve(o-l.from,s);for(let h of c)if(h.test(f,r)){let d=r.facet(h.facet);return h.type=="replace"?d:d.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return rT(e,t,n).type.prop(mc)==this.data}findRegions(e){let t=e.facet(Zl);if((t===null||t===void 0?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(r,o)=>{if(r.prop(mc)==this.data){n.push({from:o,to:o+r.length});return}let s=r.prop(ae.mounted);if(s){if(s.tree.prop(mc)==this.data){if(s.overlay)for(let l of s.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+r.length});return}else if(s.overlay){let l=n.length;if(i(s.tree,s.overlay[0].from+o),n.length>l)return}}for(let l=0;l<r.children.length;l++){let a=r.children[l];if(a instanceof ut)i(a,r.positions[l]+o)}};return i(ai(e),0),n}get allowsNesting(){return!0}}li.setState=ve.define();function rT(e,t,n){let i=e.facet(Zl),r=ai(e).topNode;if(!i||i.allowsNesting){for(let o=r;o;o=o.enter(t,n,Fe.ExcludeBuffers|Fe.EnterBracketed))if(o.type.isTop)r=o}return r}function ai(e){let t=e.field(li.state,!1);return t?t.tree:ut.empty}class uT{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;if(e<n||t>=this.cursorPos)return this.doc.sliceString(e,t);else return this.string.slice(e-n,t-n)}}var pc=null;class Hd{constructor(e,t,n=[],i,r,o,s,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=o,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new Hd(e,t,[],ut.empty,0,n,[],null)}startParse(){return this.parser.startParse(new uT(this.state.doc),this.fragments)}work(e,t){if(t!=null&&t>=this.state.doc.length)t=void 0;if(this.tree!=ut.empty&&this.isDone(t!==null&&t!==void 0?t:this.state.doc.length))return this.takeTree(),!0;return this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}if(!this.parse)this.parse=this.startParse();if(t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length)this.parse.stopAt(t);for(;;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(yo.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t!==null&&t!==void 0?t:this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;if(this.parse&&(e=this.parse.parsedPos)>=this.treeLen){if(this.parse.stoppedAt==null||this.parse.stoppedAt>e)this.parse.stopAt(e);this.withContext(()=>{while(!(t=this.parse.advance()));}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(yo.addTree(this.tree,this.fragments,!0)),this.parse=null}}withContext(e){let t=pc;pc=this;try{return e()}finally{pc=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=oT(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:o,skipped:s}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((a,u,c,f)=>l.push({fromA:a,toA:u,fromB:c,toB:f})),n=yo.applyChanges(n,l),i=ut.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){s=[];for(let a of this.skipped){let u=e.mapPos(a.from,1),c=e.mapPos(a.to,-1);if(u<c)s.push({from:u,to:c})}}}return new Hd(this.parser,t,n,i,r,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:i,to:r}=this.skipped[n];if(i<e.to&&r>e.from)this.fragments=oT(this.fragments,i,r),this.skipped.splice(n--,1)}if(this.skipped.length>=t)return!1;return this.reset(),!0}reset(){if(this.parse)this.takeTree(),this.parse=null}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends vy{createParse(t,n,i){let r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance(){let l=pc;if(l){for(let a of i)l.tempSkipped.push(a);if(e)l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e}return this.parsedPos=o,new ut(hn.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return pc}}function oT(e,t,n){return yo.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Jl{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);if(!t.work(20,n))t.takeTree();return new Jl(t)}static init(e){let t=Math.min(3000,e.doc.length),n=Hd.create(e.facet(Zl).parser,e,{from:0,to:t});if(!n.work(20,t))n.takeTree();return new Jl(n)}}li.state=an.define({create:Jl.init,update(e,t){for(let n of t.effects)if(n.is(li.setState))return n.value;if(t.startState.facet(Zl)!=t.state.facet(Zl))return Jl.init(t.state);return e.apply(t)}});var cT=(e)=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};if(typeof requestIdleCallback<"u")cT=(e)=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)};var Sy=typeof navigator<"u"&&((wy=navigator.scheduling)===null||wy===void 0?void 0:wy.isInputPending)?()=>navigator.scheduling.isInputPending():null,B8=fn.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(li.state).context;if(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)this.scheduleWork();if(t.docChanged||t.selectionSet){if(this.view.hasFocus)this.chunkBudget+=50;this.scheduleWork()}this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(li.state);if(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))this.working=cT(this.work)}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus))this.chunkEnd=n+30000,this.chunkBudget=3000;if(this.chunkBudget<=0)return;let{state:i,viewport:{to:r}}=this.view,o=i.field(li.state);if(o.tree==o.context.tree&&o.context.isDone(r+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,t&&!Sy?Math.max(25,t.timeRemaining()-5):1e9),l=o.context.treeLen<r&&i.doc.length>r+1000,a=o.context.work(()=>Sy&&Sy()||Date.now()>s,r+(l?0:1e5));if(this.chunkBudget-=Date.now()-n,a||this.chunkBudget<=0)o.context.takeTree(),this.view.dispatch({effects:li.setState.of(new Jl(o.context))});if(this.chunkBudget>0&&!(a&&!l))this.scheduleWork();this.checkAsyncSchedule(o.context)}checkAsyncSchedule(t){if(t.scheduleOn)this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch((n)=>Mt(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null}destroy(){if(this.working)this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Zl=Y.define({combine(e){return e.length?e[0]:null},enables:(e)=>[li.state,B8,G.contentAttributes.compute([e],(t)=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});var P8=Y.define(),gc=Y.define({combine:(e)=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((n)=>n!=t[0]))throw Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function vc(e){let t=e.facet(gc);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function bc(e,t){let n="",i=e.tabSize,r=e.facet(gc)[0];if(r=="\t"){while(t>=i)n+="\t",t-=i;r=" "}for(let o=0;o<t;o++)n+=r;return n}function Ay(e,t){if(e instanceof de)e=new ea(e);for(let i of e.state.facet(P8)){let r=i(e,t);if(r!==void 0)return r}let n=ai(e.state);return n.length>=t?V8(e,n,t):null}class ea{constructor(e,t={}){this.state=e,this.options=t,this.unit=vc(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;if(i!=null&&i>=n.from&&i<=n.to)if(r&&i==e)return{text:"",from:e};else if(t<0?i<e:i<=e)return{text:n.text.slice(i-n.from),from:i};else return{text:n.text.slice(0,i-n.from),from:n.from};return n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;if(o>-1)r+=o-this.countColumn(n,n.search(/\S|$/));return r}countColumn(e,t=e.length){return cs(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}var I8=new ae;function V8(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let o=[];for(let s=r;s&&!(s.from<i.node.from||s.to>i.node.to||s.from==i.node.from&&s.type==i.node.type);s=s.parent)o.push(s);for(let s=o.length-1;s>=0;s--)i={node:o[s],next:i}}return fT(i,e,n)}function fT(e,t,n){for(let i=e;i;i=i.next){let r=U8(i.node);if(r)return r(Oy.create(t,n,i))}return 0}function H8(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function U8(e){let t=e.type.prop(I8);if(t)return t;let n=e.firstChild,i;if(n&&(i=n.type.prop(ae.closedBy))){let r=e.lastChild,o=r&&i.indexOf(r.name)>-1;return(s)=>q8(s,!0,1,void 0,o&&!H8(s)?r.from:void 0)}return e.parent==null?j8:null}function j8(){return 0}class Oy extends ea{constructor(e,t,n){super(e.state,e.options);this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Oy(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);while(n.parent&&n.parent.from==n.from)n=n.parent;if(F8(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return fT(this.context.next,this.base,this.pos)}}function F8(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function K8(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let l=n.to;;){let a=t.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=s)return null;let u=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+u}}l=a.to}}function q8(e,t,n,i,r){let o=e.textAfter,s=o.match(/^\s*/)[0].length,l=i&&o.slice(s,s+i.length)==i||r==e.pos+s,a=t?K8(e):null;if(a)return l?e.column(a.from):e.column(a.to);return e.baseIndent+(l?0:e.unit*n)}class Ry{constructor(e,t){this.specs=e;let n;function i(s){let l=ti.newName();return(n||(n=Object.create(null)))["."+l]=s,l}let r=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof li?(s)=>s.prop(mc)==o.data:o?(s)=>s==o:void 0,this.style=xy(e.map((s)=>({tag:s.tag,class:s.class||i(Object.assign({},s,{tag:null}))})),{all:r}).style,this.module=n?new ti(n):null,this.themeType=t.themeType}static define(e,t){return new Ry(e,t||{})}}var o9=Ry.define([{tag:P.meta,color:"#404740"},{tag:P.link,textDecoration:"underline"},{tag:P.heading,textDecoration:"underline",fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strong,fontWeight:"bold"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.keyword,color:"#708"},{tag:[P.atom,P.bool,P.url,P.contentSeparator,P.labelName],color:"#219"},{tag:[P.literal,P.inserted],color:"#164"},{tag:[P.string,P.deleted],color:"#a11"},{tag:[P.regexp,P.escape,P.special(P.string)],color:"#e40"},{tag:P.definition(P.variableName),color:"#00f"},{tag:P.local(P.variableName),color:"#30a"},{tag:[P.typeName,P.namespace],color:"#085"},{tag:P.className,color:"#167"},{tag:[P.special(P.variableName),P.macroName],color:"#256"},{tag:P.definition(P.propertyName),color:"#00c"},{tag:P.comment,color:"#940"},{tag:P.invalid,color:"#f00"}]);var $8=1e4,G8="()[]{}";var W8=new ae;function Ey(e,t,n){let i=e.prop(t<0?ae.openedBy:ae.closedBy);if(i)return i;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function Cy(e){let t=e.type.prop(W8);return t?t(e.node):e}function bs(e,t,n,i={}){let r=i.maxScanDistance||$8,o=i.brackets||G8,s=ai(e),l=s.resolveInner(t,n);for(let a=l;a;a=a.parent){let u=Ey(a.type,n,o);if(u&&a.from<a.to){let c=Cy(a);if(c&&(n>0?t>=c.from&&t<c.to:t>c.from&&t<=c.to))return Y8(e,t,n,a,c,u,o)}}return X8(e,t,n,s,l.type,r,o)}function Y8(e,t,n,i,r,o,s){let l=i.parent,a={from:r.from,to:r.to},u=0,c=l===null||l===void 0?void 0:l.cursor();if(c&&(n<0?c.childBefore(i.from):c.childAfter(i.to)))do if(n<0?c.to<=i.from:c.from>=i.to){if(u==0&&o.indexOf(c.type.name)>-1&&c.from<c.to){let f=Cy(c);return{start:a,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(Ey(c.type,n,s))u++;else if(Ey(c.type,-n,s)){if(u==0){let f=Cy(c);return{start:a,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function X8(e,t,n,i,r,o,s){if(n<0?!t:t==e.doc.length)return null;let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let h=0;!c.next().done&&h<=o;){let d=c.value;if(n<0)h+=d.length;let m=t+h*n;for(let b=n>0?0:d.length-1,x=n>0?d.length:-1;b!=x;b+=n){let g=s.indexOf(d[b]);if(g<0||i.resolveInner(m+b,1).type!=r)continue;if(g%2==0==n>0)f++;else if(f==1)return{start:u,end:{from:m+b,to:m+b+1},matched:g>>1==a>>1};else f--}if(n>0)h+=d.length}return c.done?{start:u,matched:!1}:null}var Q8=Object.create(null),sT=[hn.none];var lT=[],aT=Object.create(null),J8=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])J8[e]=Z8(Q8,t);function ky(e,t){if(lT.indexOf(e)>-1)return;lT.push(e),console.warn(t)}function Z8(e,t){let n=[];for(let l of t.split(" ")){let a=[];for(let u of l.split(".")){let c=e[u]||P[u];if(!c)ky(u,`Unknown highlighting tag ${u}`);else if(typeof c=="function")if(!a.length)ky(u,`Modifier ${u} used at start of tag`);else a=a.map(c);else if(a.length)ky(u,`Tag ${u} used as modifier`);else a=Array.isArray(c)?c:[c]}for(let u of a)n.push(u)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map((l)=>l.id),o=aT[r];if(o)return o.id;let s=aT[r]=hn.define({id:sT.length,name:i,props:[iT({[i]:n})]});return sT.push(s),s.id}var s9={rtl:ke.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:Be.RTL}),ltr:ke.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:Be.LTR}),auto:ke.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};class _y{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=ai(this.state).resolveInner(this.pos,-1);while(t&&e.indexOf(t.name)<0)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(vT(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){if(e=="abort"&&this.abortListeners){if(this.abortListeners.push(t),n&&n.onDocChange)this.abortOnDocChange=!0}}}function hT(e){let t=Object.keys(e).join(""),n=/\w/.test(t);if(n)t=t.replace(/\w/g,"");return`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function e5(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let o=1;o<r.length;o++)n[r[o]]=!0}let i=hT(t)+hT(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function t5(e){let t=e.map((r)=>typeof r=="string"?{label:r}:r),[n,i]=t.every((r)=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:e5(t);return(r)=>{let o=r.matchBefore(i);return o||r.explicit?{from:o?o.from:r.pos,options:t,validFor:n}:null}}class My{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function ys(e){return e.selection.main.from}function vT(e,t){var n;let{source:i}=e,r=t&&i[0]!="^",o=i[i.length-1]!="$";if(!r&&!o)return e;return new RegExp(`${r?"^":""}(?:${i})${o?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}var bT=un.define();function n5(e,t,n,i){let{main:r}=e.selection,o=n-r.from,s=i-r.from;return{...e.changeByRange((l)=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+o,l.from+s)!=e.sliceDoc(n,i))return{range:l};let a=e.toText(t);return{changes:{from:l.from+o,to:i==r.from?l.to:l.from+s,insert:a},range:N.cursor(l.from+o+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var dT=new WeakMap;function i5(e){if(!Array.isArray(e))return e;let t=dT.get(e);if(!t)dT.set(e,t=t5(e));return t}var jd=ve.define(),yc=ve.define();class yT{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=vr(e,t),i=fo(n);this.chars.push(n);let r=e.slice(t,t+i),o=r.toUpperCase();this.folded.push(vr(o==r?r.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:i,precise:r,byWord:o}=this;if(t.length==1){let g=vr(e,0),v=fo(g),y=v==e.length?0:-100;if(g==t[0]);else if(g==n[0])y+=-200;else return null;return this.ret(y,[0,v])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(s<0){for(let g=0,v=Math.min(e.length,200);g<v&&a<l;){let y=vr(e,g);if(y==t[a]||y==n[a])i[a++]=g;g+=fo(y)}if(a<l)return null}let u=0,c=0,f=!1,h=0,d=-1,m=-1,b=/[a-z]/.test(e),x=!0;for(let g=0,v=Math.min(e.length,200),y=0;g<v&&c<l;){let S=vr(e,g);if(s<0){if(u<l&&S==t[u])r[u++]=g;if(h<l)if(S==t[h]||S==n[h]){if(h==0)d=g;m=g+1,h++}else h=0}let k,A=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(k=IO(S))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;if(!g||A==1&&b||y==0&&A!=0){if(t[c]==S||n[c]==S&&(f=!0))o[c++]=g;else if(o.length)x=!1}y=A,g+=fo(S)}if(c==l&&o[0]==0&&x)return this.result(-100+(f?-200:0),o,e);if(h==l&&d==0)return this.ret(-200-e.length+(m==e.length?0:-100),[0,m]);if(s>-1)return this.ret(-700-e.length,[s,s+this.pattern.length]);if(h==l)return this.ret(-900-e.length,[d,m]);if(c==l)return this.result(-100+(f?-200:0)+-700+(x?0:-1100),o,e);return t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,n){let i=[],r=0;for(let o of t){let s=o+(this.astral?fo(vr(n,o)):1);if(r&&i[r-1]==o)i[r-1]=s;else i[r++]=o,i[r++]=s}return this.ret(e-n.length,i)}}class xT{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;if(n==null)return null;return this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this}}var ct=Y.define({combine(e){return Ul(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:r5,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>(i)=>pT(t(i),n(i)),optionClass:(t,n)=>(i)=>pT(t(i),n(i)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function pT(e,t){return e?t?e+" "+t:e:t}function r5(e,t,n,i,r,o){let s=e.textDirection==Be.RTL,l=s,a=!1,u="top",c,f,h=t.left-r.left,d=r.right-t.right,m=i.right-i.left,b=i.bottom-i.top;if(l&&h<Math.min(m,d))l=!1;else if(!l&&d<Math.min(m,h))l=!0;if(m<=(l?h:d))c=Math.max(r.top,Math.min(n.top,r.bottom-b))-t.top,f=Math.min(400,l?h:d);else{a=!0,f=Math.min(400,(s?t.right:r.right-t.left)-30);let v=r.bottom-t.bottom;if(v>=b||v>t.top)c=n.bottom-t.top;else u="bottom",c=t.bottom-n.top}let x=(t.bottom-t.top)/o.offsetHeight,g=(t.right-t.left)/o.offsetWidth;return{style:`${u}: ${c/x}px; max-width: ${f/g}px`,class:"cm-completionInfo-"+(a?s?"left-narrow":"right-narrow":l?"left":"right")}}var Dy=ve.define();function o5(e){let t=e.addToOptions.slice();if(e.icons)t.push({render(n){let i=document.createElement("div");if(i.classList.add("cm-completionIcon"),n.type)i.classList.add(...n.type.split(/\s+/g).map((r)=>"cm-completionIcon-"+r));return i.setAttribute("aria-hidden","true"),i},position:20});return t.push({render(n,i,r,o){let s=document.createElement("span");s.className="cm-completionLabel";let l=n.displayLabel||n.label,a=0;for(let u=0;u<o.length;){let c=o[u++],f=o[u++];if(c>a)s.appendChild(document.createTextNode(l.slice(a,c)));let h=s.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(l.slice(c,f))),h.className="cm-completionMatchedText",a=f}if(a<l.length)s.appendChild(document.createTextNode(l.slice(a)));return s},position:50},{render(n){if(!n.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=n.detail,i},position:80}),t.sort((n,i)=>n.position-i.position).map((n)=>n.render)}function Ny(e,t,n){if(e<=n)return{from:0,to:e};if(t<0)t=0;if(t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let i=Math.ceil((e-t)/n);return{from:e-i*n,to:e-(i-1)*n}}class wT{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:(l)=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:r,selected:o}=i.open,s=e.state.facet(ct);this.optionContent=o5(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Ny(r.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(l)=>{let{options:a}=e.state.field(t).open;for(let u=l.target,c;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(c=/-(\d+)$/.exec(u.id))&&+c[1]<a.length){this.applyCompletion(e,a[+c[1]]),l.preventDefault();return}if(l.target==this.list){let u=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;if(u!=null)e.dispatch({effects:Dy.of(u)}),l.preventDefault()}}),this.dom.addEventListener("focusout",(l)=>{let a=e.state.field(this.stateField,!1);if(a&&a.tooltip&&e.state.facet(ct).closeOnBlur&&l.relatedTarget!=e.contentDOM)e.dispatch({effects:yc.of(null)})}),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(e,t){if(this.list)this.list.remove();this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{if(this.info)this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:r,selected:o,disabled:s}=n.open;if(!i.open||i.open.options!=r)this.range=Ny(r.length,o,e.state.facet(ct).maxRenderedOptions),this.showOptions(r,n.id);if(this.updateSel(),s!=((t=i.open)===null||t===void 0?void 0:t.disabled))this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))if(n)this.dom.classList.remove(n);for(let n of t.split(" "))if(n)this.dom.classList.add(n);this.currentClass=t}}positioned(e){if(this.space=e,this.info)this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)this.range=Ny(t.options.length,t.selected,this.view.state.facet(ct).maxRenderedOptions),this.showOptions(t.options,e.id);let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:r}=i;if(!r)return;let o=typeof r==="string"?document.createTextNode(r):r(i);if(!o)return;if("then"in o)o.then((s)=>{if(s&&this.view.state.field(this.stateField,!1)==e)this.addInfoPane(s,i)}).catch((s)=>Mt(this.view.state,s,"completion info"));else this.addInfoPane(o,i),n.setAttribute("aria-describedby",this.info.id)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:r}=e;n.appendChild(i),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)if(n.nodeName!="LI"||!n.id)i--;else if(i==e){if(!n.hasAttribute("aria-selected"))n.setAttribute("aria-selected","true"),t=n}else if(n.hasAttribute("aria-selected"))n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby");if(t)l5(this.list,t);return t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}if(i.top>Math.min(r.bottom,t.bottom)-10||i.bottom<Math.max(r.top,t.top)+10)return null;return this.view.state.facet(ct).positionInfo(this.view,t,i,n,r,this.dom)}placeInfo(e){if(this.info)if(e){if(e.style)this.info.style.cssText=e.style;this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")}else this.info.style.cssText="top: -1e6px"}createListBox(e,t,n){let i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",(o)=>{if(o.target==i)o.preventDefault()});let r=null;for(let o=n.from;o<n.to;o++){let{completion:s,match:l}=e[o],{section:a}=s;if(a){let f=typeof a=="string"?a:a.name;if(f!=r&&(o>n.from||n.from==0))if(r=f,typeof a!="string"&&a.header)i.appendChild(a.header(a));else{let h=i.appendChild(document.createElement("completion-section"));h.textContent=f}}let u=i.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let c=this.optionClass(s);if(c)u.className=c;for(let f of this.optionContent){let h=f(s,this.view.state,this.view,l);if(h)u.appendChild(h)}}if(n.from)i.classList.add("cm-completionListIncompleteTop");if(n.to<e.length)i.classList.add("cm-completionListIncompleteBottom");return i}destroyInfo(){if(this.info){if(this.infoDestroy)this.infoDestroy();this.info.remove(),this.info=null}}destroy(){this.destroyInfo()}}function s5(e,t){return(n)=>new wT(n,e,t)}function l5(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;if(i.top<n.top)e.scrollTop-=(n.top-i.top)/r;else if(i.bottom>n.bottom)e.scrollTop+=(i.bottom-n.bottom)/r}function mT(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function a5(e,t){let n=[],i=null,r=null,o=(c)=>{n.push(c);let{section:f}=c.completion;if(f){if(!i)i=[];let h=typeof f=="string"?f:f.name;if(!i.some((d)=>d.name==h))i.push(typeof f=="string"?{name:h}:f)}},s=t.facet(ct);for(let c of e)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let h of c.result.options)o(new My(h,c.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(c.from,c.to),d,m=s.filterStrict?new xT(h):new yT(h);for(let b of c.result.options)if(d=m.match(b.label)){let x=!b.displayLabel?d.matched:f?f(b,d.matched):[],g=d.score+(b.boost||0);if(o(new My(b,c.source,x,g)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;if(!r)r=Object.create(null);r[v]=Math.max(g,r[v]||-1e9)}}}}if(i){let c=Object.create(null),f=0,h=(d,m)=>(d.rank==="dynamic"&&m.rank==="dynamic"?r[m.name]-r[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(d.name<m.name?-1:1);for(let d of i.sort(h))f-=1e5,c[d.name]=f;for(let d of n){let{section:m}=d.completion;if(m)d.score+=c[typeof m=="string"?m:m.name]}}let l=[],a=null,u=s.compareCompletions;for(let c of n.sort((f,h)=>h.score-f.score||u(f.completion,h.completion))){let f=c.completion;if(!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost)l.push(c);else if(mT(c.completion)>mT(a))l[l.length-1]=c;a=c.completion}return l}class ta{constructor(e,t,n,i,r,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ta(this.options,gT(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r,o){if(i&&!o&&e.some((a)=>a.isPending))return i.setDisabled();let s=a5(e,t);if(!s.length)return i&&e.some((a)=>a.isPending)?i.setDisabled():null;let l=t.facet(ct).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let a=i.options[i.selected].completion;for(let u=0;u<s.length;u++)if(s[u].completion==a){l=u;break}}return new ta(s,gT(n,l),{pos:e.reduce((a,u)=>u.hasResult()?Math.min(a,u.from):a,1e8),create:p5,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new ta(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ta(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Fd{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Fd(h5,"cm-ac-"+Math.floor(Math.random()*2000000).toString(36),null)}update(e){let{state:t}=e,n=t.facet(ct),r=(n.override||t.languageDataAt("autocomplete",ys(t)).map(i5)).map((l)=>(this.active.find((u)=>u.source==l)||new Pn(l,this.active.some((u)=>u.state!=0)?1:0)).update(e,n));if(r.length==this.active.length&&r.every((l,a)=>l==this.active[a]))r=this.active;let o=this.open,s=e.effects.some((l)=>l.is(Ly));if(o&&e.docChanged)o=o.map(e.changes);if(e.selection||r.some((l)=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!u5(r,this.active)||s)o=ta.build(r,t,this.id,o,n,s);else if(o&&o.disabled&&!r.some((l)=>l.isPending))o=null;if(!o&&r.every((l)=>!l.isPending)&&r.some((l)=>l.hasResult()))r=r.map((l)=>l.hasResult()?new Pn(l.source,0):l);for(let l of e.effects)if(l.is(Dy))o=o&&o.setSelected(l.value,this.id);return r==this.active&&o==this.open?this:new Fd(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?c5:f5}}function u5(e,t){if(e==t)return!0;for(let n=0,i=0;;){while(n<e.length&&!e[n].hasResult())n++;while(i<t.length&&!t[i].hasResult())i++;let r=n==e.length,o=i==t.length;if(r||o)return r==o;if(e[n++].result!=t[i++].result)return!1}}var c5={"aria-autocomplete":"list"},f5={};function gT(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};if(t>-1)n["aria-activedescendant"]=e+"-"+t;return n}var h5=[];function ST(e,t){if(e.isUserEvent("input.complete")){let i=e.annotation(bT);if(i&&t.activateOnCompletion(i))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Pn{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=ST(e,t),i=this;if(n&8||n&16&&this.touches(e))i=new Pn(i.source,0);if(n&4&&i.state==0)i=new Pn(this.source,1);i=i.updateFor(e,n);for(let r of e.effects)if(r.is(jd))i=new Pn(i.source,1,r.value);else if(r.is(yc))i=new Pn(i.source,0);else if(r.is(Ly)){for(let o of r.value)if(o.source==i.source)i=o}return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(ys(e.state))}}class na extends Pn{constructor(e,t,n,i,r,o){super(e,3,t);this.limit=n,this.result=i,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let i=this.result;if(i.map&&!e.changes.empty)i=i.map(i,e.changes);let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),s=ys(e.state);if(s>o||!i||t&2&&(ys(e.startState)==this.from||s<this.limit))return new Pn(this.source,t&4?1:0);let l=e.changes.mapPos(this.limit);if(d5(i.validFor,e.state,r,o))return new na(this.source,this.explicit,l,i,r,o);if(i.update&&(i=i.update(i,r,o,new _y(e.state,s,!1))))return new na(this.source,this.explicit,l,i,i.from,(n=i.to)!==null&&n!==void 0?n:ys(e.state));return new Pn(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;if(!t)return new Pn(this.source,0);return new na(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1))}touches(e){return e.changes.touchesRange(this.from,this.to)}}function d5(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return typeof e=="function"?e(r,n,i,t):vT(e,!0).test(r)}var Ly=ve.define({map(e,t){return e.map((n)=>n.map(t))}}),qt=an.define({create(){return Fd.start()},update(e,t){return e.update(t)},provide:(e)=>[cy.from(e,(t)=>t.tooltip),G.contentAttributes.from(e,(t)=>t.attrs)]});function zy(e,t){let n=t.completion.apply||t.completion.label,i=e.state.field(qt).active.find((r)=>r.source==t.source);if(!(i instanceof na))return!1;if(typeof n=="string")e.dispatch({...n5(e.state,n,i.from,i.to),annotations:bT.of(t.completion)});else n(e,t.completion,i.from,i.to);return!0}var p5=s5(qt,zy);function Ud(e,t="option"){return(n)=>{let i=n.state.field(qt,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(ct).interactionDelay)return!1;let r=1,o;if(t=="page"&&(o=fy(n,i.open.tooltip)))r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1);let{length:s}=i.open.options,l=i.open.selected>-1?i.open.selected+r*(e?1:-1):e?0:s-1;if(l<0)l=t=="page"?0:s-1;else if(l>=s)l=t=="page"?s-1:0;return n.dispatch({effects:Dy.of(l)}),!0}}var m5=(e)=>{let t=e.state.field(qt,!1);if(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(ct).interactionDelay)return!1;return zy(e,t.open.options[t.open.selected])},Ty=(e)=>{if(!e.state.field(qt,!1))return!1;return e.dispatch({effects:jd.of(!0)}),!0},g5=(e)=>{let t=e.state.field(qt,!1);if(!t||!t.active.some((n)=>n.state!=0))return!1;return e.dispatch({effects:yc.of(null)}),!0};class kT{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}var v5=50,b5=1000,y5=fn.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(qt).active)if(t.isPending)this.startQuery(t)}update(e){let t=e.state.field(qt),n=e.state.facet(ct);if(!e.selectionSet&&!e.docChanged&&e.startState.field(qt)==t)return;let i=e.transactions.some((o)=>{let s=ST(o,n);return s&8||(o.selection||o.docChanged)&&!(s&3)});for(let o=0;o<this.running.length;o++){let s=this.running[o];if(i||s.context.abortOnDocChange&&e.docChanged||s.updates.length+e.transactions.length>v5&&Date.now()-s.time>b5){for(let l of s.context.abortListeners)try{l()}catch(a){Mt(this.view.state,a)}s.context.abortListeners=null,this.running.splice(o--,1)}else s.updates.push(...e.transactions)}if(this.debounceUpdate>-1)clearTimeout(this.debounceUpdate);if(e.transactions.some((o)=>o.effects.some((s)=>s.is(jd))))this.pendingStart=!0;let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some((o)=>o.isPending&&!this.running.some((s)=>s.active.source==o.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0){for(let o of e.transactions)if(o.isUserEvent("input.type"))this.composing=2;else if(this.composing==2&&o.selection)this.composing=3}}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(qt);for(let n of t.active)if(n.isPending&&!this.running.some((i)=>i.active.source==n.source))this.startQuery(n);if(this.running.length&&t.open&&t.open.disabled)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ct).updateSyncTime)}startQuery(e){let{state:t}=this.view,n=ys(t),i=new _y(t,n,e.explicit,this.view),r=new kT(e,i);this.running.push(r),Promise.resolve(e.source(i)).then((o)=>{if(!r.context.aborted)r.done=o||null,this.scheduleAccept()},(o)=>{this.view.dispatch({effects:yc.of(null)}),Mt(this.view.state,o)})}scheduleAccept(){if(this.running.every((e)=>e.done!==void 0))this.accept();else if(this.debounceAccept<0)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ct).updateSyncTime)}accept(){var e;if(this.debounceAccept>-1)clearTimeout(this.debounceAccept);this.debounceAccept=-1;let t=[],n=this.view.state.facet(ct),i=this.view.state.field(qt);for(let r=0;r<this.running.length;r++){let o=this.running[r];if(o.done===void 0)continue;if(this.running.splice(r--,1),o.done){let l=ys(o.updates.length?o.updates[0].startState:this.view.state),a=Math.min(l,o.done.from+(o.active.explicit?0:1)),u=new na(o.active.source,o.active.explicit,a,o.done,o.done.from,(e=o.done.to)!==null&&e!==void 0?e:l);for(let c of o.updates)u=u.update(c,n);if(u.hasResult()){t.push(u);continue}}let s=i.active.find((l)=>l.source==o.active.source);if(s&&s.isPending)if(o.done==null){let l=new Pn(o.active.source,0);for(let a of o.updates)l=l.update(a,n);if(!l.isPending)t.push(l)}else this.startQuery(s)}if(t.length||i.open&&i.open.disabled)this.view.dispatch({effects:Ly.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(qt,!1);if(t&&t.tooltip&&this.view.state.facet(ct).closeOnBlur){let n=t.open&&fy(this.view,t.open.tooltip);if(!n||!n.dom.contains(e.relatedTarget))setTimeout(()=>this.view.dispatch({effects:yc.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){if(this.composing==3)setTimeout(()=>this.view.dispatch({effects:jd.of(!1)}),20);this.composing=0}}}),x5=typeof navigator=="object"&&/Win/.test(navigator.platform),w5=Ni.highest(G.domEventHandlers({keydown(e,t){let n=t.state.field(qt,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(x5&&e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find((s)=>s.source==i.source),o=i.completion.commitCharacters||r.result.commitCharacters;if(o&&o.indexOf(e.key)>-1)zy(t,i);return!1}})),S5=G.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:0.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:0.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'\uD835\uDC65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\uD835\uDC36'"}},".cm-completionIcon-type":{"&:after":{content:"'\uD835\uDC61'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\uD83D\uDD11︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});var ET=new class extends ei{};ET.startSide=1;ET.endSide=-1;var h9=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);function CT(e={}){return[w5,qt,ct.of(e),y5,E5,S5]}var k5=[{key:"Ctrl-Space",run:Ty},{mac:"Alt-`",run:Ty},{mac:"Alt-i",run:Ty},{key:"Escape",run:g5},{key:"ArrowDown",run:Ud(!0)},{key:"ArrowUp",run:Ud(!1)},{key:"PageDown",run:Ud(!0,"page")},{key:"PageUp",run:Ud(!1,"page")},{key:"Enter",run:m5}],E5=Ni.highest(Xl.computeN([ct],(e)=>e.facet(ct).defaultKeymap?[k5]:[]));var C5=(e)=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=jy(e.state,n.from);return i.line?A5(e):i.block?R5(e):!1};function Uy(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);if(!r)return!1;return i(n.update(r)),!0}}var A5=Uy(M5,0);var O5=Uy(LT,0);var R5=Uy((e,t)=>LT(e,t,T5(t)),0);function jy(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}var xc=50;function N5(e,{open:t,close:n},i,r){let o=e.sliceDoc(i-xc,i),s=e.sliceDoc(r,r+xc),l=/\s*$/.exec(o)[0].length,a=/^\s*/.exec(s)[0].length,u=o.length-l;if(o.slice(u-t.length,u)==t&&s.slice(a,a+n.length)==n)return{open:{pos:i-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;if(r-i<=2*xc)c=f=e.sliceDoc(i,r);else c=e.sliceDoc(i,i+xc),f=e.sliceDoc(r-xc,r);let h=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,m=f.length-d-n.length;if(c.slice(h,h+t.length)==t&&f.slice(m,m+n.length)==n)return{open:{pos:i+h+t.length,margin:/\s/.test(c.charAt(h+t.length))?1:0},close:{pos:r-d-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}};return null}function T5(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);if(r.from>i.from&&r.from==n.to)r=n.to==i.to+1?i:e.doc.lineAt(n.to-1);let o=t.length-1;if(o>=0&&t[o].to>i.from)t[o].to=r.to;else t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}function LT(e,t,n=t.selection.ranges){let i=n.map((o)=>jy(t,o.from).block);if(!i.every((o)=>o))return null;let r=n.map((o,s)=>N5(t,i[s],o.from,o.to));if(e!=2&&!r.every((o)=>o))return{changes:t.changes(n.map((o,s)=>{if(r[s])return[];return[{from:o.from,insert:i[s].open+" "},{from:o.to,insert:" "+i[s].close}]}))};else if(e!=1&&r.some((o)=>o)){let o=[];for(let s=0,l;s<r.length;s++)if(l=r[s]){let a=i[s],{open:u,close:c}=l;o.push({from:u.pos-a.open.length,to:u.pos+u.margin},{from:c.pos-c.margin,to:c.pos+a.close.length})}return{changes:o}}return null}function M5(e,t,n=t.selection.ranges){let i=[],r=-1;e:for(let{from:o,to:s}of n){let l=i.length,a=1e9,u;for(let c=o;c<=s;){let f=t.doc.lineAt(c);if(u==null){if(u=jy(t,f.from).line,!u)continue e}if(f.from>r&&(o==s||s>f.from)){r=f.from;let h=/^\s*/.exec(f.text)[0].length,d=h==f.length,m=f.text.slice(h,h+u.length)==u?h:-1;if(h<f.text.length&&h<a)a=h;i.push({line:f,comment:m,token:u,indent:h,empty:d,single:!1})}c=f.to+1}if(a<1e9){for(let c=l;c<i.length;c++)if(i[c].indent<i[c].line.text.length)i[c].indent=a}if(i.length==l+1)i[l].single=!0}if(e!=2&&i.some((o)=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of i)if(f||!c)o.push({from:l.from+u,insert:a+" "});let s=t.changes(o);return{changes:s,selection:t.selection.map(s,1)}}else if(e!=1&&i.some((o)=>o.comment>=0)){let o=[];for(let{line:s,comment:l,token:a}of i)if(l>=0){let u=s.from+l,c=u+a.length;if(s.text[c-s.from]==" ")c++;o.push({from:u,to:c})}return{changes:o}}return null}var Py=un.define(),_5=un.define(),D5=Y.define(),zT=Y.define({combine(e){return Ul(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(i,r)=>t(i,r)||n(i,r)})}}),BT=an.define({create(){return Li.empty},update(e,t){let n=t.state.facet(zT),i=t.annotation(Py);if(i){let a=$t.fromTransaction(t,i.selection),u=i.side,c=u==0?e.undone:e.done;if(a)c=qd(c,c.length,n.minDepth,a);else c=HT(c,t.startState.selection);return new Li(u==0?i.rest:c,u==0?c:i.rest)}let r=t.annotation(_5);if(r=="full"||r=="before")e=e.isolate();if(t.annotation(je.addToHistory)===!1)return!t.changes.empty?e.addMapping(t.changes.desc):e;let o=$t.fromTransaction(t),s=t.annotation(je.time),l=t.annotation(je.userEvent);if(o)e=e.addChanges(o,s,l,n,t);else if(t.selection)e=e.addSelection(t.startState.selection,s,l,n.newGroupDelay);if(r=="full"||r=="after")e=e.isolate();return e},toJSON(e){return{done:e.done.map((t)=>t.toJSON()),undone:e.undone.map((t)=>t.toJSON())}},fromJSON(e){return new Li(e.done.map($t.fromJSON),e.undone.map($t.fromJSON))}});function PT(e={}){return[BT,zT.of(e),G.domEventHandlers({beforeinput(t,n){let i=t.inputType=="historyUndo"?IT:t.inputType=="historyRedo"?Iy:null;if(!i)return!1;return t.preventDefault(),i(n)}})]}function $d(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(BT,!1);if(!r)return!1;let o=r.pop(e,n,t);if(!o)return!1;return i(o),!0}}var IT=$d(0,!1),Iy=$d(1,!1),L5=$d(0,!0),z5=$d(1,!0);class $t{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new $t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((i)=>i.toJSON())}}static fromJSON(e){return new $t(e.changes&&We.fromJSON(e.changes),[],e.mapped&&Zn.fromJSON(e.mapped),e.startSelection&&N.fromJSON(e.startSelection),e.selectionsAfter.map(N.fromJSON))}static fromTransaction(e,t){let n=In;for(let i of e.startState.facet(D5)){let r=i(e);if(r.length)n=n.concat(r)}if(!n.length&&e.changes.empty)return null;return new $t(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,In)}static selection(e){return new $t(void 0,In,void 0,void 0,e)}}function qd(e,t,n,i){let r=t+1>n+20?t-n-1:0,o=e.slice(r,t);return o.push(i),o}function B5(e,t){let n=[],i=!1;return e.iterChangedRanges((r,o)=>n.push(r,o)),t.iterChangedRanges((r,o,s,l)=>{for(let a=0;a<n.length;){let u=n[a++],c=n[a++];if(l>=u&&s<=c)i=!0}}),i}function P5(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,i)=>n.empty!=t.ranges[i].empty).length===0}function VT(e,t){return!e.length?t:!t.length?e:e.concat(t)}var In=[],I5=200;function HT(e,t){if(!e.length)return[$t.selection([t])];else{let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-I5));if(i.length&&i[i.length-1].eq(t))return e;return i.push(t),qd(e,e.length-1,1e9,n.setSelAfter(i))}}function V5(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function By(e,t){if(!e.length)return e;let n=e.length,i=In;while(n){let r=H5(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let o=e.slice(0,n);return o[n-1]=r,o}else t=r.mapped,n--,i=r.selectionsAfter}return i.length?[$t.selection(i)]:In}function H5(e,t,n){let i=VT(e.selectionsAfter.length?e.selectionsAfter.map((l)=>l.map(t)):In,n);if(!e.changes)return $t.selection(i);let r=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new $t(r,ve.mapEffects(e.effects,t),s,e.startSelection.map(o),i)}var U5=/^(input\.type|delete)($|\.)/;class Li{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new Li(this.done,this.undone):this}addChanges(e,t,n,i,r){let o=this.done,s=o[o.length-1];if(s&&s.changes&&!s.changes.empty&&e.changes&&(!n||U5.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(r,B5(s.changes,e.changes))||n=="input.type.compose"))o=qd(o,o.length-1,i.minDepth,new $t(e.changes.compose(s.changes),VT(ve.mapEffects(e.effects,s.changes),s.effects),s.mapped,s.startSelection,In));else o=qd(o,o.length,i.minDepth,e);return new Li(o,In,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:In;if(r.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&P5(r[r.length-1],e))return this;return new Li(HT(this.done,e),this.undone,t,n)}addMapping(e){return new Li(By(this.done,e),By(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let r=i[i.length-1],o=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):t.selection);if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Py.of({side:e,rest:V5(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});else if(!r.changes)return null;else{let s=i.length==1?In:i.slice(0,i.length-1);if(r.mapped)s=By(s,r.mapped);return t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Py.of({side:e,rest:s,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}}}Li.empty=new Li(In,In);var UT=[{key:"Mod-z",run:IT,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Iy,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Iy,preventDefault:!0},{key:"Mod-u",run:L5,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:z5,preventDefault:!0}];function ia(e,t){return N.create(e.ranges.map(t),e.mainIndex)}function ui(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function ci({state:e,dispatch:t},n){let i=ia(e.selection,n);if(i.eq(e.selection,!0))return!1;return t(ui(e,i)),!0}function Gd(e,t){return N.cursor(t?e.to:e.from)}function jT(e,t){return ci(e,(n)=>n.empty?e.moveByChar(n,t):Gd(n,t))}function Ot(e){return e.textDirectionAt(e.state.selection.main.head)==Be.LTR}var FT=(e)=>jT(e,!Ot(e)),KT=(e)=>jT(e,Ot(e));function qT(e,t){return ci(e,(n)=>n.empty?e.moveByGroup(n,t):Gd(n,t))}var j5=(e)=>qT(e,!Ot(e)),F5=(e)=>qT(e,Ot(e));var x9=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function K5(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Wd(e,t,n){let i=ai(e).resolveInner(t.head),r=n?ae.closedBy:ae.openedBy;for(let a=t.head;;){let u=n?i.childAfter(a):i.childBefore(a);if(!u)break;if(K5(e,u,r))i=u;else a=n?u.to:u.from}let o=i.type.prop(r),s,l;if(o&&(s=n?bs(e,i.from,1):bs(e,i.to,-1))&&s.matched)l=n?s.end.to:s.end.from;else l=n?i.to:i.from;return N.cursor(l,n?-1:1)}var q5=(e)=>ci(e,(t)=>Wd(e.state,t,!Ot(e))),$5=(e)=>ci(e,(t)=>Wd(e.state,t,Ot(e)));function $T(e,t){return ci(e,(n)=>{if(!n.empty)return Gd(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}var GT=(e)=>$T(e,!1),WT=(e)=>$T(e,!0);function YT(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,i=0,r;if(t){for(let o of e.state.facet(G.scrollMargins)){let s=o(e);if(s===null||s===void 0?void 0:s.top)n=Math.max(s===null||s===void 0?void 0:s.top,n);if(s===null||s===void 0?void 0:s.bottom)i=Math.max(s===null||s===void 0?void 0:s.bottom,i)}r=e.scrollDOM.clientHeight-n-i}else r=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:i,selfScroll:t,height:Math.max(e.defaultLineHeight,r-5)}}function XT(e,t){let n=YT(e),{state:i}=e,r=ia(i.selection,(s)=>s.empty?e.moveVertically(s,t,n.height):Gd(s,t));if(r.eq(i.selection))return!1;let o;if(n.selfScroll){let s=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;if(s&&s.top>a&&s.bottom<u)o=G.scrollIntoView(r.main.head,{y:"start",yMargin:s.top-a})}return e.dispatch(ui(i,r),{effects:o}),!0}var AT=(e)=>XT(e,!1),Vy=(e)=>XT(e,!0);function So(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from))r=e.moveToLineBoundary(t,n,!1);if(!n&&r.head==i.from&&i.length){let o=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;if(o&&t.head!=i.from+o)r=N.cursor(i.from+o)}return r}var G5=(e)=>ci(e,(t)=>So(e,t,!0)),W5=(e)=>ci(e,(t)=>So(e,t,!1)),Y5=(e)=>ci(e,(t)=>So(e,t,!Ot(e))),X5=(e)=>ci(e,(t)=>So(e,t,Ot(e))),Q5=(e)=>ci(e,(t)=>e.moveToLineBoundary(t,!1,!1)),J5=(e)=>ci(e,(t)=>e.moveToLineBoundary(t,!0,!1));function Z5(e,t,n){let i=!1,r=ia(e.selection,(o)=>{let s=bs(e,o.head,-1)||bs(e,o.head,1)||o.head>0&&bs(e,o.head-1,1)||o.head<e.doc.length&&bs(e,o.head+1,-1);if(!s||!s.end)return o;i=!0;let l=s.start.from==o.head?s.end.to:s.end.from;return n?N.range(o.anchor,l):N.cursor(l)});if(!i)return!1;return t(ui(e,r)),!0}var eI=({state:e,dispatch:t})=>Z5(e,t,!1);function Vn(e,t,n){let i=ia(e.state.selection,(r)=>{if(r.undirectional&&r.head>=r.anchor!=t)r=N.range(r.head,r.anchor);let o=n(r);return N.range(r.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});if(i.eq(e.state.selection))return!1;return e.dispatch(ui(e.state,i)),!0}function QT(e,t){return Vn(e,t,(n)=>e.moveByChar(n,t))}var JT=(e)=>QT(e,!Ot(e)),ZT=(e)=>QT(e,Ot(e));function eM(e,t){return Vn(e,t,(n)=>e.moveByGroup(n,t))}var tI=(e)=>eM(e,!Ot(e)),nI=(e)=>eM(e,Ot(e));var iI=(e)=>{let t=!Ot(e);return Vn(e,t,(n)=>Wd(e.state,n,t))},rI=(e)=>{let t=Ot(e);return Vn(e,t,(n)=>Wd(e.state,n,t))};function tM(e,t){return Vn(e,t,(n)=>e.moveVertically(n,t))}var nM=(e)=>tM(e,!1),iM=(e)=>tM(e,!0);function rM(e,t){return Vn(e,t,(n)=>e.moveVertically(n,t,YT(e).height))}var OT=(e)=>rM(e,!1),RT=(e)=>rM(e,!0),oI=(e)=>Vn(e,!0,(t)=>So(e,t,!0)),sI=(e)=>Vn(e,!1,(t)=>So(e,t,!1)),lI=(e)=>{let t=!Ot(e);return Vn(e,t,(n)=>So(e,n,t))},aI=(e)=>{let t=Ot(e);return Vn(e,t,(n)=>So(e,n,t))},uI=(e)=>Vn(e,!1,(t)=>N.cursor(e.lineBlockAt(t.head).from)),cI=(e)=>Vn(e,!0,(t)=>N.cursor(e.lineBlockAt(t.head).to)),NT=({state:e,dispatch:t})=>(t(ui(e,{anchor:0})),!0),TT=({state:e,dispatch:t})=>(t(ui(e,{anchor:e.doc.length})),!0),MT=({state:e,dispatch:t})=>(t(ui(e,{anchor:e.selection.main.anchor,head:0})),!0),_T=({state:e,dispatch:t})=>(t(ui(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),fI=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),hI=({state:e,dispatch:t})=>{let n=Yd(e).map(({from:i,to:r})=>N.undirectionalRange(i,Math.min(r+1,e.doc.length)));return t(e.update({selection:N.create(n),userEvent:"select"})),!0},dI=({state:e,dispatch:t})=>{let n=ia(e.selection,(i)=>{let r=ai(e),o=r.resolveStack(i.from,1);if(i.empty){let s=r.resolveStack(i.from,-1);if(s.node.from>=o.node.from&&s.node.to<=o.node.to)o=s}for(let s=o;s;s=s.next){let{node:l}=s;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&s.next)return N.undirectionalRange(l.from,l.to)}return i});if(n.eq(e.selection))return!1;return t(ui(e,n)),!0};function oM(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let o of n.selection.ranges){let s=n.doc.lineAt(o.head);if(t?s.to<e.state.doc.length:s.from>0)for(let l=o;;){let a=e.moveVertically(l,t);if(a.head<s.from||a.head>s.to){if(!r.some((u)=>u.head==a.head))r.push(a);break}else if(a.head==l.head)break;else l=a}}if(r.length==i.ranges.length)return!1;return e.dispatch(ui(n,N.create(r,r.length-1))),!0}var pI=(e)=>oM(e,!1),mI=(e)=>oM(e,!0),gI=({state:e,dispatch:t})=>{let n=e.selection,i=null;if(n.ranges.length>1)i=N.create([n.main]);else if(!n.main.empty)i=N.create([N.cursor(n.main.head)]);if(!i)return!1;return t(ui(e,i)),!0};function wc(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange((o)=>{let{from:s,to:l}=o;if(s==l){let a=t(o);if(a<s)n="delete.backward",a=Kd(e,a,!1);else if(a>s)n="delete.forward",a=Kd(e,a,!0);s=Math.min(s,a),l=Math.max(l,a)}else s=Kd(e,s,!1),l=Kd(e,l,!0);return s==l?{range:o}:{changes:{from:s,to:l},range:N.cursor(s,s<o.head?-1:1)}});if(r.changes.empty)return!1;return e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?G.announce.of(i.phrase("Selection deleted")):void 0})),!0}function Kd(e,t,n){if(e instanceof G)for(let i of e.state.facet(G.atomicRanges).map((r)=>r(e)))i.between(t,t,(r,o)=>{if(r<t&&o>t)t=n?o:r});return t}var sM=(e,t,n)=>wc(e,(i)=>{let r=i.from,{state:o}=e,s=o.doc.lineAt(r),l,a;if(n&&!t&&r>s.from&&r<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,r-s.from))){if(l[l.length-1]=="\t")return r-1;let u=cs(l,o.tabSize),c=u%vc(o)||vc(o);for(let f=0;f<c&&l[l.length-1-f]==" ";f++)r--;a=r}else if(a=at(s.text,r-s.from,t,t)+s.from,a==r&&s.number!=(t?o.doc.lines:1))a+=t?1:-1;else if(!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(a-s.from,r-s.from)))a=at(s.text,a-s.from,!1,!1)+s.from;return a}),Hy=(e)=>sM(e,!1,!0);var lM=(e)=>sM(e,!0,!1),aM=(e,t)=>wc(e,(n)=>{let i=n.head,{state:r}=e,o=r.doc.lineAt(i),s=r.charCategorizer(i);for(let l=null;;){if(i==(t?o.to:o.from)){if(i==n.head&&o.number!=(t?r.doc.lines:1))i+=t?1:-1;break}let a=at(o.text,i-o.from,t)+o.from,u=o.text.slice(Math.min(i,a)-o.from,Math.max(i,a)-o.from),c=s(u);if(l!=null&&c!=l)break;if(u!=" "||i!=n.head)l=c;i=a}return i}),uM=(e)=>aM(e,!1),vI=(e)=>aM(e,!0);var bI=(e)=>wc(e,(t)=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var yI=(e)=>wc(e,(t)=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),xI=(e)=>wc(e,(t)=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)});var wI=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((i)=>({changes:{from:i.from,to:i.to,insert:ce.of(["",""])},range:N.cursor(i.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},SI=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((i)=>{if(!i.empty||i.from==0||i.from==e.doc.length)return{range:i};let r=i.from,o=e.doc.lineAt(r),s=r==o.from?r-1:at(o.text,r-o.from,!1)+o.from,l=r==o.to?r+1:at(o.text,r-o.from,!0)+o.from;return{changes:{from:s,to:l,insert:e.doc.slice(r,l).append(e.doc.slice(s,r))},range:N.cursor(l)}});if(n.changes.empty)return!1;return t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0};function Yd(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),o=e.doc.lineAt(i.to);if(!i.empty&&i.to==o.from)o=e.doc.lineAt(i.to-1);if(n>=r.number){let s=t[t.length-1];s.to=o.to,s.ranges.push(i)}else t.push({from:r.from,to:o.to,ranges:[i]});n=o.number+1}return t}function cM(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let o of Yd(e)){if(n?o.to==e.doc.length:o.from==0)continue;let s=e.doc.lineAt(n?o.to+1:o.from-1),l=s.length+1;if(n){i.push({from:o.to,to:s.to},{from:o.from,insert:s.text+e.lineBreak});for(let a of o.ranges)r.push(N.range(Math.min(e.doc.length,a.anchor+l),Math.min(e.doc.length,a.head+l)))}else{i.push({from:s.from,to:o.from},{from:o.to,insert:e.lineBreak+s.text});for(let a of o.ranges)r.push(N.range(a.anchor-l,a.head-l))}}if(!i.length)return!1;return t(e.update({changes:i,scrollIntoView:!0,selection:N.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0}var Fy=({state:e,dispatch:t})=>cM(e,t,!1),Ky=({state:e,dispatch:t})=>cM(e,t,!0);function fM(e,t,n){if(e.readOnly)return!1;let i=[];for(let o of Yd(e))if(n)i.push({from:o.from,insert:e.doc.slice(o.from,o.to)+e.lineBreak});else i.push({from:o.to,insert:e.lineBreak+e.doc.slice(o.from,o.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var kI=({state:e,dispatch:t})=>fM(e,t,!1),EI=({state:e,dispatch:t})=>fM(e,t,!0),CI=(e)=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Yd(t).map(({from:r,to:o})=>{if(r>0)r--;else if(o<t.doc.length)o++;return{from:r,to:o}})),i=ia(t.selection,(r)=>{let o=void 0;if(e.lineWrapping){let s=e.lineBlockAt(r.head),l=e.coordsAtPos(r.head,r.assoc||1);if(l)o=s.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2}return e.moveVertically(r,!0,o)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function AI(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ai(e).resolveInner(t),i=n.childBefore(t),r=n.childAfter(t),o;if(i&&r&&i.to<=t&&r.from>=t&&(o=i.type.prop(ae.closedBy))&&o.indexOf(r.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(i.to,r.from)))return{from:i.to,to:r.from};return null}var DT=hM(!1),OI=hM(!0);function hM(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange((r)=>{let{from:o,to:s}=r,l=t.doc.lineAt(o),a=!e&&o==s&&AI(t,o);if(e)o=s=(s<=l.to?l:t.doc.lineAt(s)).to;let u=new ea(t,{simulateBreak:o,simulateDoubleBreak:!!a}),c=Ay(u,o);if(c==null)c=cs(/^\s*/.exec(t.doc.lineAt(o).text)[0],t.tabSize);while(s<l.to&&/\s/.test(l.text[s-l.from]))s++;if(a)({from:o,to:s}=a);else if(o>l.from&&o<l.from+100&&!/\S/.test(l.text.slice(0,o)))o=l.from;let f=["",bc(t,c)];if(a)f.push(bc(t,u.lineIndent(l.from,-1)));return{changes:{from:o,to:s,insert:ce.of(f)},range:N.cursor(o+1+f[1].length)}});return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function qy(e,t){let n=-1;return e.changeByRange((i)=>{let r=[];for(let s=i.from;s<=i.to;){let l=e.doc.lineAt(s);if(l.number>n&&(i.empty||i.to>l.from))t(l,r,i),n=l.number;s=l.to+1}let o=e.changes(r);return{changes:r,range:N.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var RI=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new ea(e,{overrideIndentation:(o)=>{let s=n[o];return s==null?-1:s}}),r=qy(e,(o,s,l)=>{let a=Ay(i,o.from);if(a==null)return;if(!/\S/.test(o.text))a=0;let u=/^\s*/.exec(o.text)[0],c=bc(e,a);if(u!=c||l.from<o.from+u.length)n[o.from]=a,s.push({from:o.from,to:o.from+u.length,insert:c})});if(!r.changes.empty)t(e.update(r,{userEvent:"indent"}));return!0},NI=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(qy(e,(n,i)=>{i.push({from:n.from,insert:e.facet(gc)})}),{userEvent:"input.indent"})),!0},TI=({state:e,dispatch:t})=>{if(e.readOnly)return!1;return t(e.update(qy(e,(n,i)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let o=cs(r,e.tabSize),s=0,l=bc(e,Math.max(0,o-vc(e)));while(s<r.length&&s<l.length&&r.charCodeAt(s)==l.charCodeAt(s))s++;i.push({from:n.from+s,to:n.from+r.length,insert:l.slice(s)})}),{userEvent:"delete.dedent"})),!0},MI=(e)=>(e.setTabFocusMode(),!0);var _I=[{key:"Ctrl-b",run:FT,shift:JT,preventDefault:!0},{key:"Ctrl-f",run:KT,shift:ZT},{key:"Ctrl-p",run:GT,shift:nM},{key:"Ctrl-n",run:WT,shift:iM},{key:"Ctrl-a",run:Q5,shift:uI},{key:"Ctrl-e",run:J5,shift:cI},{key:"Ctrl-d",run:lM},{key:"Ctrl-h",run:Hy},{key:"Ctrl-k",run:bI},{key:"Ctrl-Alt-h",run:uM},{key:"Ctrl-o",run:wI},{key:"Ctrl-t",run:SI},{key:"Ctrl-v",run:Vy}],DI=[{key:"ArrowLeft",run:FT,shift:JT,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:j5,shift:tI,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Y5,shift:lI,preventDefault:!0},{key:"ArrowRight",run:KT,shift:ZT,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:F5,shift:nI,preventDefault:!0},{mac:"Cmd-ArrowRight",run:X5,shift:aI,preventDefault:!0},{key:"ArrowUp",run:GT,shift:nM,preventDefault:!0},{mac:"Cmd-ArrowUp",run:NT,shift:MT},{mac:"Ctrl-ArrowUp",run:AT,shift:OT},{key:"ArrowDown",run:WT,shift:iM,preventDefault:!0},{mac:"Cmd-ArrowDown",run:TT,shift:_T},{mac:"Ctrl-ArrowDown",run:Vy,shift:RT},{key:"PageUp",run:AT,shift:OT},{key:"PageDown",run:Vy,shift:RT},{key:"Home",run:W5,shift:sI,preventDefault:!0},{key:"Mod-Home",run:NT,shift:MT},{key:"End",run:G5,shift:oI,preventDefault:!0},{key:"Mod-End",run:TT,shift:_T},{key:"Enter",run:DT,shift:DT},{key:"Mod-a",run:fI},{key:"Backspace",run:Hy,shift:Hy,preventDefault:!0},{key:"Delete",run:lM,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:uM,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:vI,preventDefault:!0},{mac:"Mod-Backspace",run:yI,preventDefault:!0},{mac:"Mod-Delete",run:xI,preventDefault:!0}].concat(_I.map((e)=>({mac:e.key,run:e.run,shift:e.shift}))),dM=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:q5,shift:iI},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:$5,shift:rI},{key:"Alt-ArrowUp",run:Fy},{key:"Shift-Alt-ArrowUp",run:kI},{key:"Alt-ArrowDown",run:Ky},{key:"Shift-Alt-ArrowDown",run:EI},{key:"Mod-Alt-ArrowUp",run:pI},{key:"Mod-Alt-ArrowDown",run:mI},{key:"Escape",run:gI},{key:"Mod-Enter",run:OI},{key:"Alt-l",mac:"Ctrl-l",run:hI},{key:"Mod-i",run:dI,preventDefault:!0},{key:"Mod-[",run:TI},{key:"Mod-]",run:NI},{key:"Mod-Alt-\\",run:RI},{key:"Shift-Mod-k",run:CI},{key:"Shift-Mod-\\",run:eI},{key:"Mod-/",run:C5},{key:"Alt-A",mac:"Ctrl-A",run:O5},{key:"Ctrl-m",mac:"Shift-Alt-m",run:MI}].concat(DI);var Xd=/^\s*\/\//;var ko=/^(\s*)- /;function Sc(e){let t=/(?:^|\s)\/\//.exec(e);if(t==null)return-1;return t.index+t[0].length-2}function mM(e){let t=Sc(e);return t<0?{text:e,hadComment:!1}:{text:e.slice(0,t).trimEnd(),hadComment:!0}}function LI(e){let t=[],n=[];for(let i of e.split(`
27
+ `)){let r=mM(i);if(r.hadComment&&r.text.trim()==="")continue;let o=ko.exec(i);if(o!=null&&o[0].length<=r.text.length+1){let s=r.text.slice(o[0].length).trim();if(s!=="")n.push(s)}else t.push(r.text)}return{positive:t.join(`
28
+ `).trim(),negative:n.join(", ")}}function Qd(e){let t=[],n=0;for(let i of e.split(`
29
+ `))t.push({from:n,text:i}),n+=i.length+1;return t}function Jd(e){let t=[],n=/(?<!\\)\(((?:\\[()]|[^()])*?):\s*(-?\d*\.?\d+)\s*(?<!\\)\)/g;for(let i=n.exec(e);i!=null;i=n.exec(e)){let r=i[1]??"",o=i[2]??"1",s=i.index,l=s+i[0].length,a=s+i[0].lastIndexOf(o);t.push({from:s,to:l,innerFrom:s+1,innerTo:s+1+r.length,numFrom:a,numTo:a+o.length,weight:Number(o)})}return t}var $y=(e)=>Math.round(e*100)/100,pM=(e)=>String($y(e));function zI(e,t){let n=Sc(e),i=n<0?e.length:n;if(t>i)return null;let r=t;while(r>0&&e[r-1]!==",")r--;let o=t;while(o<i&&e[o]!==",")o++;let s=ko.exec(e);if(s!=null&&r<s[0].length)r=s[0].length;while(r<o&&/\s/.test(e[r]??""))r++;while(o>r&&/\s/.test(e[o-1]??""))o--;return r<o?{from:r,to:o}:null}function gM(e,t,n,i){let r=Qd(e).find((d)=>t>=d.from&&t<=d.from+d.text.length);if(r==null||n>r.from+r.text.length)return null;let o=t-r.from,s=n-r.from,l=Sc(r.text);if(l>=0&&o>=l)return null;let a=Jd(r.text).filter((d)=>o>=d.from&&s<=d.to).sort((d,m)=>d.to-d.from-(m.to-m.from))[0];if(a!=null){let d=$y(a.weight+i),m=r.text.slice(a.innerFrom,a.innerTo);if(d===1){let b=r.from+a.from;return{changes:[{from:b,to:r.from+a.to,insert:m}],selection:{anchor:b,head:b+m.length}}}return{changes:[{from:r.from+a.numFrom,to:r.from+a.numTo,insert:pM(d)}],selection:{anchor:r.from+a.innerFrom,head:r.from+a.innerTo}}}let u;if(o===s)u=zI(r.text,o);else{let d=o,m=s;while(d<m&&/\s/.test(r.text[d]??""))d++;while(m>d&&/\s/.test(r.text[m-1]??""))m--;u=d<m?{from:d,to:m}:null}if(u==null)return null;let c=$y(1+i),f=r.from+u.from,h=r.from+u.to;return{changes:[{from:f,to:f,insert:"("},{from:h,to:h,insert:`:${pM(c)})`}],selection:{anchor:f+1,head:h+1}}}function vM(e,t,n){let i=Qd(e),r=n>t&&i.some((o)=>o.from===n)?n-1:n;return i.filter((o)=>o.from+o.text.length>=t&&o.from<=r)}function bM(e,t,n){let i=vM(e,t,n).filter((r)=>r.text.trim()!=="");if(i.length===0)return[];if(i.every((r)=>Xd.test(r.text)))return i.map((r)=>{let o=r.text.indexOf("//"),s=r.text[o+2]===" "?3:2;return{from:r.from+o,to:r.from+o+s,insert:""}});return i.filter((r)=>!Xd.test(r.text)).map((r)=>{let o=r.from+(/^\s*/.exec(r.text)?.[0].length??0);return{from:o,to:o,insert:"// "}})}function yM(e,t,n){let i=vM(e,t,n).filter((r)=>r.text.trim()!==""&&!Xd.test(r.text));if(i.length===0)return[];if(i.every((r)=>ko.test(r.text)))return i.map((r)=>{let o=ko.exec(r.text)?.[1]?.length??0;return{from:r.from+o,to:r.from+o+2,insert:""}});return i.filter((r)=>!ko.test(r.text)).map((r)=>{let o=r.from+(/^\s*/.exec(r.text)?.[0].length??0);return{from:o,to:o,insert:"- "}})}function xM(e){let t=[];for(let n of Qd(e)){let i=Sc(n.text),r=i<0?n.text.length:i,o=ko.exec(n.text);if(o!=null&&o[0].length<=r+1){let s=n.from+o[0].length-2;if(t.push({from:s,to:s+1,kind:"negative-dash"}),n.from+o[0].length<n.from+r)t.push({from:n.from+o[0].length,to:n.from+r,kind:"negative"})}for(let s of Jd(n.text.slice(0,r)))t.push({from:n.from+s.from,to:n.from+s.innerFrom,kind:"weight-paren"}),t.push({from:n.from+s.innerTo,to:n.from+s.numFrom,kind:"weight-paren"}),t.push({from:n.from+s.numFrom,to:n.from+s.numTo,kind:"weight-num"}),t.push({from:n.from+s.numTo,to:n.from+s.to,kind:"weight-paren"});if(i>=0)t.push({from:n.from+i,to:n.from+n.text.length,kind:"comment"})}return t.sort((n,i)=>n.from-i.from||n.to-i.to)}function wM(e){let t=e.trim(),n=Jd(t)[0];if(n!=null&&n.from===0&&n.to===t.length)t=t.slice(n.innerFrom,n.innerTo);return t.replace(/\\([()])/g,"$1").toLowerCase().replace(/_/g," ").replace(/\s+/g," ").trim()}function BI(e,t,n){let i=[],r=n;for(let o=n;o<=e.length;o++){if(o<e.length&&e[o]!==",")continue;let s=e.slice(r,o),l=s.length-s.trimStart().length,a=wM(s);if(a!=="")i.push({from:t+r+l,to:t+r+s.trimEnd().length,tag:a});r=o+1}return i}function SM(e,t={}){let n=[],i=[],r=[];for(let a of Qd(e)){if(Xd.test(a.text))continue;let u=mM(a.text).text,c=ko.exec(a.text),f=c!=null&&c[0].length<=u.length+1,h=BI(u,a.from,f?c[0].length:0);if((f?r:i).push(...h),t.weights===!1)for(let d of Jd(u))n.push({from:a.from+d.from,to:a.from+d.to,message:"this model ignores weights: the text inside is read, the number is not"})}let o=new Map;for(let a of t.injected??[]){let u=wM(a.tag);if(u!==""&&!o.has(u))o.set(u,a.source)}let s=(a,u)=>{let c=new Set;for(let f of a){if(c.has(f.tag))n.push({from:f.from,to:f.to,message:`'${f.tag}' is already in the ${u}`});c.add(f.tag)}};s(i,"prompt"),s(r,"negative prompt");let l=new Set(r.map((a)=>a.tag));for(let a of i){let u=o.get(a.tag);if(u!=null)n.push({from:a.from,to:a.to,message:`'${a.tag}' is already added by the lora ${u}`});if(l.has(a.tag))n.push({from:a.from,to:a.to,message:`'${a.tag}' is also in the negative prompt`})}return n.sort((a,u)=>a.from-u.from)}function kM(e){let t=LI(e).positive,n=0;for(let i of t.matchAll(/\p{L}+|\p{N}|[^\s\p{L}\p{N}]/gu)){let r=i[0];n+=/^\p{L}/u.test(r)&&r.length>8?Math.ceil(r.length/5):1}return n}function PI(e,t){let n=Sc(e);if(n>=0&&t>n)return null;let i=t;while(i>0&&!/[,(]/.test(e[i-1]??""))i--;let r=ko.exec(e);if(r!=null&&i<r[0].length)i=r[0].length;while(i<t&&/\s/.test(e[i]??""))i++;return{from:i,text:e.slice(i,t)}}function EM(e,t){let n=PI(e,t);if(n==null)return[];let i=[n],r=[];for(let o=n.from+1;o<t;o++)if(/\s/.test(e[o-1]??"")&&!/\s/.test(e[o]??""))r.push(o);for(let o of r.slice(-4))i.push({from:o,text:e.slice(o,t)});return i}function CM(e,t,n){let i=n.underscores===!0?e:e.replace(/(?<=[\p{L}\p{N})])_(?=[\p{L}\p{N}(])/gu," ");if(n.weights!==!1)i=i.replace(/(?<!\\)([()])/g,"\\$1");if(t===II&&n.artistPrefix!=null)i=`${n.artistPrefix}${i}`;return i}var II=1,AM={0:"general",1:"artist",3:"copyright",4:"character",5:"meta"};var Zd=0.05,Gy=ve.define(),VI={comment:"pe-comment",negative:"pe-negative","negative-dash":"pe-negative-dash","weight-paren":"pe-weight-paren","weight-num":"pe-weight-num"};function OM(e,t){let n=e.state.doc.toString(),i=t(),r=xM(n).filter((o)=>o.to>o.from).map((o)=>ke.mark({class:VI[o.kind]}).range(o.from,o.to));for(let o of SM(n,{injected:i.injected(),weights:i.weights}))if(o.to>o.from)r.push(ke.mark({class:"pe-issue",attributes:{"data-tip":o.message}}).range(o.from,o.to));return ke.set(r,!0)}function HI(e){return fn.fromClass(class{decorations;constructor(t){this.decorations=OM(t,e)}update(t){let n=t.transactions.some((i)=>i.effects.some((r)=>r.is(Gy)));if(t.docChanged||n)this.decorations=OM(t.view,e)}},{decorations:(t)=>t.decorations})}function UI(e,t){if(t.length===0)return!1;return e.dispatch({changes:t,userEvent:"input"}),!0}function RM(e,t){return(n)=>{if(!e().weights)return!1;let i=n.state.selection.main,r=gM(n.state.doc.toString(),i.from,i.to,t);if(r==null)return!1;return n.dispatch({changes:r.changes,selection:N.single(r.selection.anchor,r.selection.head),userEvent:"input"}),!0}}var NM=(e)=>(t)=>{let n=t.state.selection.main;return UI(t,e(t.state.doc.toString(),n.from,n.to))};function jI(e){let t=RM(e,Zd),n=RM(e,-Zd),i=NM(yM);return Ni.high(Xl.of([{key:"Mod-ArrowUp",run:t},{key:"Ctrl-ArrowUp",run:t},{key:"Mod-ArrowDown",run:n},{key:"Ctrl-ArrowDown",run:n},{key:"Mod-/",run:NM(bM)},{key:"Mod-Shift--",run:i},{key:"Mod-_",run:i},{key:"Alt-ArrowUp",run:Fy},{key:"Alt-ArrowDown",run:Ky}]))}var FI=(e)=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1000?`${Math.round(e/1000)}k`:String(e);function TM(e){return(t,n,i,r)=>{let o=t.state.sliceDoc(r,r+1),s=o===""||o===`
30
+ `?", ":"";t.dispatch({changes:{from:i,to:r,insert:e+s},selection:{anchor:i+e.length+s.length},userEvent:"input.complete"})}}async function KI(e,t,n){let i=t.trim().toLowerCase(),r=[],o=new Set;for(let l of e.loraWords()){let a=l.word.toLowerCase();if(o.has(a)||i!==""&&!a.includes(i))continue;o.add(a),r.push({label:l.word,detail:l.source,type:"lora",boost:50,apply:TM(l.word)})}if(e.tags==null||i==="")return r;let s=await e.searchTags(t.trim(),n);return e.onTagError(null),s.forEach((l,a)=>{let u=CM(l.name,l.category,{...e.tags,weights:e.weights});r.push({label:u,detail:`${l.alias==null?"":`← ${l.alias} · `}${FI(l.count)}`,type:`tag-${AM[l.category??-1]??"plain"}`,boost:-a,apply:TM(u)})}),r}function qI(e){return async(t)=>{let n=t.state.doc.lineAt(t.pos),i=e(),r=new AbortController;t.addEventListener("abort",()=>r.abort());for(let o of EM(n.text,t.pos-n.from)){if(o.text.trim().length<2&&!t.explicit)continue;try{let s=await KI(i,o.text,r.signal);if(s.length>0)return{from:n.from+o.from,options:s,filter:!1}}catch(s){if(r.signal.aborted)return null;return i.onTagError(s instanceof Error?s.message:String(s)),null}}return null}}var $I=G.theme({"&":{background:"var(--panel-2)",border:"1px solid var(--border)",borderRadius:"6px",color:"var(--text)",fontSize:"13px"},"&.cm-focused":{outline:"none",borderColor:"var(--accent)"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",lineHeight:"1.5",maxHeight:"18em",overflow:"auto"},".cm-content":{padding:"6px 0",caretColor:"var(--text)"},".cm-line":{padding:"0 8px"},".cm-cursor":{borderLeftColor:"var(--text)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{background:"var(--accent-dim) !important"},".cm-placeholder":{color:"var(--dim)"},".pe-comment":{color:"var(--dim)",fontStyle:"italic"},".pe-comment *":{color:"var(--dim)"},".pe-negative":{color:"var(--red)"},".pe-negative-dash":{color:"var(--red)",fontWeight:"700"},".pe-weight-paren":{opacity:"0.45"},".pe-weight-num":{color:"var(--amber)",fontWeight:"700"},".pe-issue":{textDecoration:"underline wavy var(--amber)",textUnderlineOffset:"3px"},".cm-tooltip.cm-tooltip-autocomplete":{background:"var(--panel)",border:"1px solid var(--border)",borderRadius:"6px",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"inherit",maxHeight:"16em"},".cm-tooltip-autocomplete > ul > li":{padding:"2px 8px",display:"flex",gap:"10px"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{background:"var(--accent-dim)",color:"#fff"},".cm-completionDetail":{marginLeft:"auto",color:"var(--dim)",fontStyle:"normal"},".cm-completionIcon":{display:"none"},".cm-completionLabel":{whiteSpace:"nowrap"},".cm-completionIcon-tag-artist + .cm-completionLabel":{color:"#ff8a8b"},".cm-completionIcon-tag-copyright + .cm-completionLabel":{color:"#c797ff"},".cm-completionIcon-tag-character + .cm-completionLabel":{color:"#35c64a"},".cm-completionIcon-tag-meta + .cm-completionLabel":{color:"#ead084"},".cm-completionIcon-lora + .cm-completionLabel":{color:"var(--accent)"}},{dark:!0}),GI=dM.filter((e)=>e.key!=="Mod-Enter");function MM(e){return[G.theme({".cm-content":{minHeight:`${e.minLines*1.5}em`}}),PT(),jI(e.ctx),Xl.of([...GI,...UT]),G.lineWrapping,HI(e.ctx),CT({override:[qI(e.ctx)],icons:!0,activateOnTyping:!0}),$I,KN(e.placeholder??""),G.updateListener.of((t)=>{if(t.docChanged)e.onChange(t.state.doc.toString())})]}var WI=[`⌘↑ / ⌘↓ (or ⌃↑ / ⌃↓): weight of the selection or the tag under the cursor, ±${Zd}`,"⌘/ comment lines · ⌘⇧- negative lines · ⌥↑ / ⌥↓ move lines",'"//" starts a comment · "- " line = negative prompt · ⌘⏎ generate'].join(`
31
+ `),Wy=X(function(t){let n=q(null),i=q(null),[r,o]=Q(null),s=q({p:t,setTagError:o});s.current={p:t,setTagError:o};let l=t.st.form,a=JSON.stringify(l?.injectedTagsFor(t.v)??[]);te(()=>{let c=()=>{let h=s.current.p,d=h.st.form;return{weights:h.v.desc.weights!==!1,tags:h.v.desc.tags??null,searchTags:async(m,b)=>(await LC({module:h.module,varName:h.v.name,q:m,signal:b})).hits,injected:()=>d?.injectedTagsFor(h.v)??[],loraWords:()=>d?.loraWordsFor(h.v)??[],onTagError:(m)=>s.current.setTagError(m)}};if(n.current==null)return;let f=new G({parent:n.current,state:de.create({doc:s.current.p.value,extensions:MM({ctx:c,onChange:(h)=>s.current.p.onChange(h),minLines:s.current.p.minLines})})});return i.current=f,()=>{f.destroy(),i.current=null}},[]),te(()=>{let c=i.current;if(c==null)return;let f=c.state.doc.toString();if(f===t.value)return;let h=Math.min(c.state.selection.main.head,t.value.length);c.dispatch({changes:{from:0,to:f.length,insert:t.value},selection:{anchor:h}})},[t.value]),te(()=>{i.current?.dispatch({effects:Gy.of(null)})},[a]);let u=kM(t.value);return w("div",{className:"prompt-editor",children:[p("div",{ref:n}),w("div",{className:r==null?"pe-foot":"pe-foot has-error",children:[r==null?null:w("span",{className:"pe-error","data-tip":r,children:["tags: ",r]}),p("span",{className:"pe-keys","data-tip":WI,children:"keys"}),w("span",{className:"pe-tokens","data-tip":`an estimate of the CLIP tokens the positive prompt uses
32
+ CLIP models read it in chunks of 75`,children:["≈ ",u," tokens"]})]})]})});function ep(e,t){if(t.text.trim()==="")return[...e];let n=e.find((r)=>r.text===t.text),i=e.filter((r)=>r.text!==t.text);return[{...t,count:(n?.count??0)+1},...i].slice(0,1000)}function _M(e,t){let n=t.toLowerCase().split(/\s+/).filter((i)=>i!=="");if(n.length===0)return[...e];return e.filter((i)=>{let r=`${i.text}
33
+ ${i.source}`.toLowerCase();return n.every((o)=>r.includes(o))})}function DM(e,t){let n=Math.max(0,Math.round((t-e)/1000));if(n<10)return"just now";if(n<60)return`${n}s ago`;let i=Math.floor(n/60);if(i<60)return`${i} min ago`;let r=Math.floor(i/60);if(r<24)return`${r} h ${i%60} min ago`;return`${Math.floor(r/24)} d ago`}function kc(e){let[t,n]=Q(!1),i=e.entries.length;return w(oe,{children:[w("button",{type:"button",className:e.compact===!0?"link":"mini",disabled:i===0,"data-tip":i===0?`every ${e.what} you submit shows here, until you close the page`:`${i} past ${e.what}s: search, preview, restore`,onClick:()=>n(!0),children:[p(H,{name:"history"}),e.compact===!0?null:" history"]}),t?p(YI,{entries:e.entries,what:e.what,onPick:(r)=>{n(!1),e.onPick(r)},onClose:()=>n(!1)}):null]})}function YI(e){let[t,n]=Q(""),[i,r]=Q(0),[o,s]=Q(()=>Date.now()),l=q(null),a=_M(e.entries,t),u=a[Math.min(i,Math.max(0,a.length-1))]??null;te(()=>{let f=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(f)},[]),te(()=>{let f=(h)=>{if(h.key!=="Escape")return;h.stopImmediatePropagation(),e.onClose()};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[e]),te(()=>{l.current?.querySelector(".hist-row.sel")?.scrollIntoView({block:"nearest"})},[i,t]);let c=(f)=>r((h)=>Math.max(0,Math.min(a.length-1,h+f)));return p("div",{className:"modal-overlay top hist-overlay",onClick:()=>e.onClose(),children:w("div",{className:"modal hist-modal",onClick:(f)=>f.stopPropagation(),children:[w("div",{className:"modal-head",children:[p(H,{name:"history"}),p("input",{type:"text",autoFocus:!0,placeholder:`search ${e.entries.length} past ${e.what}s, every word must match`,value:t,onChange:(f)=>{n(f.target.value),r(0)},onKeyDown:(f)=>{if(f.key==="ArrowDown")f.preventDefault(),c(1);else if(f.key==="ArrowUp")f.preventDefault(),c(-1);else if(f.key==="Enter"){if(f.preventDefault(),u!=null)e.onPick(u)}}}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc)",onClick:()=>e.onClose(),children:p(H,{name:"close"})})]}),w("div",{className:"hist-cols",children:[w("div",{className:"hist-list",ref:l,children:[a.length===0?w("div",{className:"hist-empty",children:["nothing matches '",t,"'"]}):null,a.map((f,h)=>w("button",{type:"button",className:f===u?"hist-row sel":"hist-row",onMouseEnter:()=>r(h),onClick:()=>e.onPick(f),children:[p("span",{className:"hist-first",children:f.text.split(`
34
+ `)[0]}),w("span",{className:"hist-meta",children:[DM(f.at,o),f.count>1?` · ${f.count}×`:"",f.source===""?"":` · ${f.source}`]})]},f.text))]}),p("div",{className:"hist-preview",children:u==null?null:w(oe,{children:[p("pre",{className:"hist-text",children:u.text}),w("div",{className:"hist-foot",children:[p("span",{className:"hint",children:"↑↓ to preview, enter or click to restore"}),w("button",{type:"button",className:"primary",onClick:()=>e.onPick(u),children:["restore this ",e.what]})]})]})})]})]})})}function Yy(e){let t={};if(typeof e==="object"&&e!==null&&!Array.isArray(e)){for(let[n,i]of Object.entries(e))if(typeof i==="string")t[n]=i}return t}function tp(e){if(e==="openrouter")return"https://openrouter.ai/api/v1";return e==="openwebui"?"http://localhost:3000":"http://localhost:8080/v1"}function LM(e){return e.trim().replace(/\/+$/,"")}function zM(e){let t=LM(e.baseUrl)===""?tp(e.provider):LM(e.baseUrl);return e.provider==="openwebui"?`${t}/api`:t}function XI(e){return`${zM(e)}/models`}function QI(e){return`${zM(e)}/chat/completions`}function ra(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{}}function Sr(e){return typeof e==="string"?e:""}function JI(e){let t=ra(e).data;if(!Array.isArray(t))return[];let n=[];for(let i of t){let r=ra(i),o=Sr(r.id);if(o==="")continue;let s=r.supported_parameters,l=Array.isArray(s)?s.includes("reasoning"):null;n.push({id:o,name:Sr(r.name)===""?o:Sr(r.name),reasoning:l})}return n.sort((i,r)=>i.id.localeCompare(r.id)),n}async function BM(e,t){let n=await e.text().catch(()=>"");return Error(`llm ${t} failed: http ${e.status} ${n.slice(0,300)}`)}function PM(e,t){if(e instanceof Error&&e.name==="AbortError")return e;let n=e instanceof Error?e.message:String(e);return Error(`could not reach ${t} (${n}) — is it running, and does it allow this origin? open webui needs CORS_ALLOW_ORIGIN`)}async function Xy(e){let t=XI(e),n;try{n=await fetch(t,{headers:IM(e)})}catch(i){throw PM(i,t)}if(!n.ok)throw await BM(n,"model list");return JI(await n.json())}function IM(e){return e.key.trim()===""?{}:{Authorization:`Bearer ${e.key.trim()}`}}function ZI(e){let t=e.provider==="openrouter"&&e.effort!=="off"?{reasoning:{effort:e.effort}}:e.provider==="openai"?{chat_template_kwargs:{enable_thinking:e.effort!=="off"}}:{};return{model:e.model,stream:!0,messages:[{role:"system",content:e.system},{role:"user",content:e.user}],...t}}function e6(e){let t=e.split(`
35
+ `),n=t.pop()??"",i=[];for(let r of t){let o=r.trim();if(o===""||o.startsWith(":"))continue;if(o.startsWith("data:"))i.push(o.slice(5).trim())}return{events:i,rest:n}}function t6(e){if(e===""||e==="[DONE]")return null;let t;try{t=JSON.parse(e)}catch{return null}let n=ra(t),i=ra(n.error);if(Sr(i.message)!=="")throw Error(`llm stream error: ${Sr(i.message)}`);let r=n.choices;if(!Array.isArray(r))return null;let o=ra(ra(r[0]).delta),s=Sr(o.content),l=Sr(o.reasoning)===""?Sr(o.reasoning_content):Sr(o.reasoning);if(s===""&&l==="")return null;return{content:s,reasoning:l}}class VM{inside=!1;pending="";feed(e){let t=this.pending+e;this.pending="";let n="",i="";for(;;){let o=this.inside?"</think>":"<think>",s=t.indexOf(o);if(s===-1)break;let l=t.slice(0,s);if(this.inside)i+=l;else n+=l;t=t.slice(s+o.length),this.inside=!this.inside}let r=n6(t);if(r!==-1)this.pending=t.slice(r),t=t.slice(0,r);if(this.inside)i+=t;else n+=t;return{content:n,reasoning:i}}flush(){let e=this.pending;return this.pending="",this.inside?{content:"",reasoning:e}:{content:e,reasoning:""}}}function n6(e){let t=e.lastIndexOf("<");if(t===-1)return-1;let n=e.slice(t);return"<think>".startsWith(n)||"</think>".startsWith(n)?t:-1}async function HM(e){if(e.endpoint.provider==="openrouter"&&e.endpoint.key.trim()==="")throw Error("no openrouter api key — paste one in the enhancer settings");if(e.model.trim()==="")throw Error("no model selected");let t=QI(e.endpoint),n;try{n=await fetch(t,{method:"POST",headers:{...IM(e.endpoint),"content-type":"application/json"},body:JSON.stringify(ZI({...e,provider:e.endpoint.provider})),signal:e.signal})}catch(u){throw PM(u,t)}if(!n.ok)throw await BM(n,"refine");let i=n.body?.getReader();if(i==null)throw Error("llm refine failed: the response carried no stream");let r=new TextDecoder,o=new VM,s={content:"",reasoning:""},l=(u)=>{if(u.content===""&&u.reasoning==="")return;s.content+=u.content,s.reasoning+=u.reasoning,e.onDelta(u)},a="";for(;;){let u=await i.read();if(u.done)break;a+=r.decode(u.value,{stream:!0});let c=e6(a);a=c.rest;for(let f of c.events){let h=t6(f);if(h==null)continue;let d=o.feed(h.content);l({content:d.content,reasoning:d.reasoning+h.reasoning})}}if(l(o.flush()),s.content.trim()==="")throw Error("the model returned no prompt text — try another model");return s}function Qy(e){return e==="openrouter"||e==="openwebui"||e==="openai"}function Jy(e){return e==="off"||e==="low"||e==="medium"||e==="high"}var UM={openrouter:"anthropic/claude-sonnet-5",openwebui:"",openai:""};function Zy(e){let t=typeof e==="object"&&e!==null&&!Array.isArray(e)?e:{},n=Qy(t.provider)?t.provider:"openrouter";return{provider:n,baseUrl:typeof t.baseUrl==="string"&&t.baseUrl.trim()!==""?t.baseUrl.trim():tp(n),model:typeof t.model==="string"?t.model:UM[n],effort:Jy(t.effort)?t.effort:"medium",thinkingOnly:t.thinkingOnly!==!1}}function jM(e,t){if(t===e.provider)return e;return{...e,provider:t,baseUrl:tp(t),model:UM[t]}}var e0="$enhance";function FM(e,t){return t==null?e:`${e}#${t}`}function KM(e){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let t={};for(let[n,i]of Object.entries(e))if(typeof i==="string"&&i!=="")t[n]=i;return t}var t0=(e)=>{let t=e.trimStart();return t.startsWith("- ")||t.startsWith("// ")};function qM(e){let t=e.split(`
36
+ `);return{body:t.filter((n)=>!t0(n)).join(`
37
+ `).trim(),kept:t.filter(t0).map((n)=>n.trim())}}function i6(e){let t=new Set;for(let n of e){if(!n.startsWith("- "))continue;for(let i of n.slice(2).split(","))if(i.trim()!=="")t.add(i.trim().toLowerCase())}return t}function n0(e,t){let n=i6(t);return[e.split(`
38
+ `).filter((r)=>t.length===0||!t0(r)).map((r)=>{if(n.size===0)return r;let o=r.indexOf(" - ");while(o!==-1){let s=(r.slice(o+3).split(",")[0]??"").trim().toLowerCase();if(n.has(s))return r.slice(0,o).trimEnd();o=r.indexOf(" - ",o+3)}return r}).join(`
39
+ `).trim(),...t].filter((r)=>r!=="").join(`
40
+ `)}var GM="comfy-ts-serve-enhancer",WM=["openrouter","openwebui","openai"];function $M(e){let t=typeof e==="object"&&e!==null?e:{};return{keyByProvider:Yy(t.keyByProvider),configName:typeof t.configName==="string"?t.configName:"",presetName:typeof t.presetName==="string"?t.presetName:"",presetByModule:Yy(t.presetByModule)}}function np(e,t){if(!t.includes(e))return e;for(let n=2;n<1000;n++){let i=`${e} ${n}`;if(!t.includes(i))return i}return`${e} ${t.length+1}`}function r6(e,t){let n=(o)=>o.toLowerCase().split(/[^a-z0-9]+/).filter((s)=>s.length>2&&!/^\d+$/.test(s)),i=new Set(n(e)),r=null;for(let o of t){let s=n(o).filter((l)=>i.has(l)).length;if(s===0)continue;if(r==null||s>r.score||s===r.score&&o.length<r.name.length)r={name:o,score:s}}return r?.name??null}function o6(e,t){if(t!=null)return hr(e)?e.lanes[t]?.prompt??"":"";return typeof e==="string"?e:""}function s6(e,t,n){if(t!=null&&hr(e))return{lanes:Qn(e.lanes,t,{prompt:n})};return n}function l6(e){let t=e.result.trim();if(!e.open||e.target==null||t==="")return;return{[e.target.name]:s6(e.target.value,e.lane,t)}}function a6(e){return e.previous!==""?e.previous:e.prompt}function u6(){try{return $M(JSON.parse(localStorage.getItem(GM)??"{}"))}catch{return $M({})}}class i0{getForm;keyByProvider;configName;presetName;presetByModule;configs=[];configsState="idle";configsError="";configSaveState="saved";configSaveError="";presets=[];presetsState="idle";presetsError="";saveState="saved";saveError="";configStatus=new Map;configStatusError=new Map;models=[];modelsState="idle";modelsError="";editing=null;inputHistory=[];target=null;targetLane=null;targetModule="";result="";thinking="";phase="idle";error="";abort=null;disposers;lastSaved="";lastSavedConfig="";constructor(e=()=>null){this.getForm=e;let t=u6();this.keyByProvider=t.keyByProvider,this.configName=t.configName,this.presetName=t.presetName,this.presetByModule=t.presetByModule,Gn(this,{abort:!1,disposers:!1,lastSaved:!1,lastSavedConfig:!1,getForm:!1}),this.disposers=[kl(()=>{let n=this.preset;return n==null?null:JSON.stringify(n)},(n)=>{if(n==null||n===this.lastSaved)return;this.savePresetNow(JSON.parse(n))},{delay:600}),kl(()=>{let n=this.configEntry;return n==null?null:JSON.stringify(n)},(n)=>{if(n==null||n===this.lastSavedConfig)return;this.saveConfigNow(JSON.parse(n))},{delay:600})]}dispose(){for(let e of this.disposers)e()}get configEntry(){return this.configs.find((e)=>e.name===this.configName)??this.configs[0]??null}get config(){return this.configEntry?.config??Zy({})}get provider(){return this.config.provider}get apiKey(){return this.keyByProvider[this.provider]??""}get baseUrl(){return this.config.baseUrl}get model(){return this.config.model}get effort(){return this.config.effort}get thinkingOnly(){return this.config.thinkingOnly}get endpoint(){return{provider:this.provider,baseUrl:this.baseUrl,key:this.apiKey}}get visibleModels(){return this.thinkingOnly?this.models.filter((e)=>e.reasoning!==!1):this.models}get preset(){return this.presets.find((e)=>e.name===this.presetName)??this.presets[0]??null}get isOpen(){return this.target!=null}settingsJSON(){return{keyByProvider:this.keyByProvider,configName:this.configName,presetName:this.presetName,presetByModule:this.presetByModule}}persist(){try{localStorage.setItem(GM,JSON.stringify(this.settingsJSON()))}catch{}}async loadConfigs(){M(()=>{this.configsState="loading",this.configsError=""});try{let e=await TC();M(()=>{if(this.configs=e.configs,this.configsState="idle",!this.configs.some((t)=>t.name===this.configName))this.configName=this.configs[0]?.name??"";this.lastSavedConfig=JSON.stringify(this.configEntry)}),this.probeConfigs()}catch(e){M(()=>{this.configsState="error",this.configsError=e instanceof Error?e.message:String(e)})}}async saveConfigNow(e){M(()=>{this.configSaveState="saving",this.lastSavedConfig=JSON.stringify(e)});try{let t=await MC(e);M(()=>{this.configs=t.configs.map((n)=>this.configs.find((i)=>i.name===n.name)??n),this.configSaveState="saved",this.configSaveError=""})}catch(t){M(()=>{this.configSaveState="error",this.configSaveError=t instanceof Error?t.message:String(t)})}}async probeConfigs(){let e=this.configs.map((t)=>({name:t.name,config:t.config}));await Promise.all(e.map(async(t)=>{M(()=>this.configStatus.set(t.name,"checking"));let n={provider:t.config.provider,baseUrl:t.config.baseUrl,key:this.keyByProvider[t.config.provider]??""};try{let i=await Xy(n);M(()=>{if(this.configStatus.set(t.name,"up"),this.configStatusError.delete(t.name),t.name===this.configEntry?.name&&this.models.length===0)this.models=i,this.modelsState="idle"})}catch(i){M(()=>{this.configStatus.set(t.name,"down"),this.configStatusError.set(t.name,i instanceof Error?i.message:String(i))})}}))}selectConfig(e){if(!this.configs.some((t)=>t.name===e))return;if(this.configName=e,this.lastSavedConfig=JSON.stringify(this.configEntry),this.clearModels(),this.persist(),this.configStatus.get(e)==="up")this.loadModels()}addConfig(e,t=Zy({})){if(e.trim()==="")return;let n=np(e.trim(),this.configs.map((i)=>i.name));this.configs=[...this.configs,{name:n,config:t}],this.configName=n,this.clearModels(),this.persist(),this.saveConfigNow({name:n,config:t})}duplicateConfig(){let e=this.configEntry;if(e!=null)this.addConfig(`${e.name} copy`,e.config)}async renameConfig(e){let t=this.configEntry,n=np(e.trim(),this.configs.filter((i)=>i.name!==t?.name).map((i)=>i.name));if(t==null||n===""||n===t.name)return;await this.saveConfigNow({name:n,config:t.config}),M(()=>{this.configName=n,this.persist()}),await this.removeConfigFile(t.name)}async deleteConfig(){let e=this.configEntry;if(e==null)return;await this.removeConfigFile(e.name),M(()=>{if(!this.configs.some((t)=>t.name===this.configName))this.configName=this.configs[0]?.name??"";this.lastSavedConfig=JSON.stringify(this.configEntry),this.persist()})}async removeConfigFile(e){try{let t=await _C({name:e});M(()=>{this.configs=t.configs})}catch(t){M(()=>{this.configSaveState="error",this.configSaveError=t instanceof Error?t.message:String(t)})}}patchConfig(e){let t=this.configEntry;if(t==null){this.addConfig("default",e(this.config));return}this.configs=this.configs.map((n)=>n.name===t.name?{name:n.name,config:e(n.config)}:n)}clearModels(){this.models=[],this.modelsState="idle",this.modelsError=""}setProvider(e){if(!Qy(e))return;this.patchConfig((t)=>jM(t,e)),this.clearModels()}setApiKey(e){this.keyByProvider[this.provider]=e.trim(),this.persist()}setBaseUrl(e){this.patchConfig((t)=>({...t,baseUrl:e.trim()}))}setModel(e){this.patchConfig((t)=>({...t,model:e}))}setEffort(e){if(!Jy(e))return;this.patchConfig((t)=>({...t,effort:e}))}toggleThinkingOnly(){this.patchConfig((e)=>({...e,thinkingOnly:!e.thinkingOnly}))}async loadPresets(){M(()=>{this.presetsState="loading",this.presetsError=""});try{let e=await OC();M(()=>{if(this.presets=e.enhancers,this.presetsState="idle",!this.presets.some((t)=>t.name===this.presetName))this.presetName=this.presets[0]?.name??"";this.lastSaved=JSON.stringify(this.preset)})}catch(e){M(()=>{this.presetsState="error",this.presetsError=e instanceof Error?e.message:String(e)})}}async savePresetNow(e){M(()=>{this.saveState="saving",this.lastSaved=JSON.stringify(e)});try{let t=await RC(e);M(()=>{this.presets=t.enhancers,this.saveState="saved",this.saveError=""})}catch(t){M(()=>{this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)})}}selectPreset(e){if(!this.presets.some((t)=>t.name===e))return;if(this.presetName=e,this.lastSaved=JSON.stringify(this.preset),this.targetModule!=="")this.presetByModule[this.targetModule]=e;this.persist()}setPresetText(e){let t=this.preset;if(t==null)return;this.presets=this.presets.map((n)=>n.name===t.name?{...n,text:e}:n)}addPreset(e,t=""){if(e.trim()==="")return;let n=np(e.trim(),this.presets.map((i)=>i.name));this.presets=[...this.presets,{name:n,text:t}],this.presetName=n,this.persist(),this.savePresetNow({name:n,text:t})}duplicatePreset(){let e=this.preset;if(e!=null)this.addPreset(`${e.name} copy`,e.text)}async renamePreset(e){let t=this.preset,n=np(e.trim(),this.presets.filter((i)=>i.name!==t?.name).map((i)=>i.name));if(t==null||n===""||n===t.name)return;await this.savePresetNow({name:n,text:t.text}),M(()=>{this.presetName=n,this.persist()}),await this.removePresetFile(t.name)}async deletePreset(){let e=this.preset;if(e==null)return;await this.removePresetFile(e.name),M(()=>{for(let[t,n]of Object.entries(this.presetByModule))if(n===e.name)delete this.presetByModule[t];if(!this.presets.some((t)=>t.name===this.presetName))this.presetName=this.presets[0]?.name??"";this.persist()})}async removePresetFile(e){try{let t=await NC({name:e});M(()=>{this.presets=t.enhancers})}catch(t){M(()=>{this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)})}}openFor(e){this.target=e.v,this.targetLane=e.lane??null,this.targetModule=e.module,this.error="";let t=this.presetByModule[e.module];if(t!=null)this.presetName=t;if(this.presets.length===0)this.loadPresets().then(()=>this.guessFor(e.module));else this.guessFor(e.module);this.loadConfigs()}guessFor(e){if(this.presetByModule[e]!=null)return;let t=r6(e,this.presets.map((n)=>n.name));if(t==null)return;this.presetName=t,this.lastSaved=JSON.stringify(this.preset)}setEditing(e){this.editing=e}get tryOverride(){return l6({open:this.isOpen,target:this.target,lane:this.targetLane,result:this.result})}get intentKey(){return this.target==null?null:FM(this.target.name,this.targetLane)}get original(){let e=this.intentKey;if(e==null||this.target==null)return"";return a6({previous:this.getForm()?.intentFor(e)??"",prompt:o6(this.target.value,this.targetLane)})}usePrompt(){let e=this.intentKey;if(e!=null)this.getForm()?.setIntent(e,"")}close(){this.editing=null,this.cancel(),this.target=null,this.targetLane=null,this.targetModule=""}setResult(e){this.result=e}setOriginal(e){let t=this.intentKey;if(t!=null)this.getForm()?.setIntent(t,e)}async loadModels(){M(()=>{this.modelsState="loading",this.modelsError=""});try{let e=await Xy(this.endpoint);M(()=>{this.models=e,this.modelsState="idle";let t=this.configEntry?.name;if(t!=null)this.configStatus.set(t,"up")})}catch(e){M(()=>{this.modelsState="error",this.modelsError=e instanceof Error?e.message:String(e);let t=this.configEntry?.name;if(t!=null)this.configStatus.set(t,"down")})}}cancel(){if(this.abort?.abort(),this.abort=null,this.phase==="running")this.phase=this.result===""?"idle":"done"}run(){this.runNow()}async runNow(){let e=this.preset;if(e==null||this.phase==="running")return;let t=new AbortController;this.abort=t;let n=qM(this.original);this.inputHistory=ep(this.inputHistory,{text:this.original,value:this.original,at:Date.now(),source:this.targetModule}),M(()=>{this.phase="running",this.error="",this.result="",this.thinking=""});try{await HM({endpoint:this.endpoint,model:this.model,system:e.text,user:n.body,effort:this.effort,signal:t.signal,onDelta:(i)=>M(()=>{this.result+=i.content,this.thinking+=i.reasoning})}),M(()=>{this.result=n0(this.result,n.kept),this.phase="done"})}catch(i){let r=t.signal.aborted;M(()=>{if(r&&this.result!=="")this.result=n0(this.result,n.kept);if(this.phase=r?this.result===""?"idle":"done":"error",!r)this.error=i instanceof Error?i.message:String(i)})}finally{if(this.abort===t)this.abort=null}}apply(){let e=this.result.trim();if(this.target==null||e==="")return;let t=this.target.value,n=this.targetLane;if(n!=null&&hr(t))this.target.set({lanes:Qn(t.lanes,n,{prompt:e})});else this.target.set(e);this.close()}}var c6=["off","low","medium","high"],f6={openrouter:"openrouter (cloud)",openwebui:"open webui (local)",openai:"llama.cpp / ollama / vllm (openai /v1)"},h6={openrouter:"",openwebui:"http://localhost:3000",openai:"http://localhost:8080/v1"},YM=X(function(t){let n=()=>{let r=window.prompt(`name the new ${t.kind}`,t.newName);if(r!=null)t.onCreate(r)},i=(r)=>{let o=t.status?.(r)??null;return o==null?null:p("span",{className:`enh-dot ${o.cls}`,"data-tip":o.tip})};return w("div",{className:"enh-tabs",children:[w("div",{className:"enh-tabs-title",children:[t.title,t.save==="saving"?p("span",{className:"enh-save",children:"saving…"}):null,t.save==="error"?p("span",{className:"enh-save error","data-tip":t.saveError,children:"\uD83D\uDD34 not saved"}):null]}),p("select",{className:"enh-tab-select",value:t.selected,onChange:(r)=>t.onSelect(r.target.value),children:t.names.map((r)=>p("option",{value:r,children:r},r))}),w("div",{className:"enh-tab-list",role:"tablist",children:[t.names.map((r)=>w("div",{className:r===t.selected?"enh-tab sel":"enh-tab",children:[w("button",{type:"button",role:"tab","aria-selected":r===t.selected,onClick:()=>t.onSelect(r),children:[i(r),p("span",{className:"enh-tab-name",children:r})]}),r===t.selected?p("button",{type:"button",className:t.editing?"enh-tab-edit sel":"enh-tab-edit","data-tip":t.editing?"close the editor":`edit this ${t.kind}`,onClick:()=>t.onEdit(),children:p(H,{name:"pen"})}):null]},r)),w("button",{type:"button",className:"enh-tab-new",onClick:n,children:[p(H,{name:"plus"})," new ",t.kind]})]})]})}),d6=X(function(t){let n=t.e,{configEntry:i,preset:r}=n;return w("nav",{className:"enh-side",children:[i==null?w("div",{className:"enh-tabs",children:[p("div",{className:"enh-tabs-title",children:"llm"}),w("button",{type:"button",className:"enh-tab-new",onClick:()=>n.setEditing("llm"),children:[p(H,{name:"plus"})," set up an llm"]})]}):p(YM,{title:"llm",names:n.configs.map((o)=>o.name),selected:i.name,kind:"llm",newName:"my-llm",save:n.configSaveState,saveError:n.configSaveError,editing:n.editing==="llm",onEdit:()=>n.setEditing(n.editing==="llm"?null:"llm"),status:(o)=>{let s=n.configStatus.get(o);if(s==null)return null;let l=n.configStatusError.get(o);return{cls:s,tip:s==="up"?"answers":s==="checking"?"checking…":`does not answer: ${l??""}`}},onSelect:(o)=>n.selectConfig(o),onCreate:(o)=>{n.addConfig(o),n.setEditing("llm")}}),r==null?w("div",{className:"enh-tabs",children:[p("div",{className:"enh-tabs-title",children:"master prompt"}),w("button",{type:"button",className:"enh-tab-new",onClick:()=>n.addPreset("refine-prompt"),children:[p(H,{name:"plus"})," new master prompt"]})]}):p(YM,{title:"master prompt",names:n.presets.map((o)=>o.name),selected:r.name,kind:"master prompt",newName:"refine-<model>-prompt",save:n.saveState,saveError:n.saveError,editing:n.editing==="preset",onEdit:()=>n.setEditing(n.editing==="preset"?null:"preset"),onSelect:(o)=>n.selectPreset(o),onCreate:(o)=>{n.addPreset(o),n.setEditing("preset")}})]})});function XM(e){let t=()=>{if(e.name==null)return;let i=window.prompt(`rename this ${e.kind} (renames the file)`,e.name);if(i!=null)e.onRename(i)},n=()=>{if(e.name==null)return;if(window.confirm(`delete ${e.kind} '${e.name}'? its file is removed.`))e.onDelete()};return w("section",{className:"enh-edit",children:[w("div",{className:"enh-edit-head",children:[w("h3",{className:"enh-h","data-tip":e.tip,children:[e.kind," ",p("span",{className:"enh-h-name",children:e.name??"new"})]}),e.name==null?null:w("span",{className:"btn-group",children:[p("button",{type:"button",onClick:()=>e.onDuplicate(),children:"duplicate"}),p("button",{type:"button",onClick:t,children:"rename"}),w("button",{type:"button",className:"quiet-danger",onClick:n,children:[p(H,{name:"trash"})," delete"]})]}),p("button",{type:"button",className:"enh-edit-close","data-tip":"done (esc), everything is already saved",onClick:()=>e.onClose(),children:"done"})]}),p("div",{className:"enh-edit-body",children:e.children})]})}var p6=X(function(t){let n=t.e,i=n.visibleModels,r=n.provider!=="openrouter",o=n.configEntry;return w(XM,{kind:"llm",name:o?.name??null,tip:o==null?"any edit creates the config file":`.comfy-ts/llm-configs/${o.name}.json, saved as you type`,onRename:(s)=>void n.renameConfig(s),onDuplicate:()=>n.duplicateConfig(),onDelete:()=>void n.deleteConfig(),onClose:()=>n.setEditing(null),children:[w("div",{className:"enh-grid",children:[p("label",{children:"provider"}),p("select",{value:n.provider,onChange:(s)=>n.setProvider(s.target.value),children:WM.map((s)=>p("option",{value:s,children:f6[s]},s))}),r?w(oe,{children:[p("label",{children:"address"}),p("input",{type:"text",placeholder:h6[n.provider],value:n.baseUrl,onChange:(s)=>n.setBaseUrl(s.target.value)})]}):null,p("label",{"data-tip":"kept in this browser only, never in a file",children:"api key"}),p("input",{type:"password",placeholder:r?"blank if none":"sk-or-v1-…",value:n.apiKey,onChange:(s)=>n.setApiKey(s.target.value)}),p("label",{children:"model"}),w("div",{className:"enh-inline",children:[i.length>0?w("select",{value:n.model,onChange:(s)=>n.setModel(s.target.value),children:[i.some((s)=>s.id===n.model)?null:w("option",{value:n.model,children:[n.model," (not in the list)"]}),i.map((s)=>p("option",{value:s.id,children:s.id},s.id))]}):p("input",{type:"text",placeholder:r?"e.g. qwen3:8b":"e.g. anthropic/claude-sonnet-5",value:n.model,onChange:(s)=>n.setModel(s.target.value)}),p("button",{type:"button",onClick:()=>void n.loadModels(),disabled:n.modelsState==="loading",children:n.modelsState==="loading"?"asking…":"list models"})]}),n.provider==="openwebui"?null:w(oe,{children:[p("label",{"data-tip":r?"off = no thinking (chat template switch), anything else = think first":"reasoning effort sent to the model",children:"thinking"}),w("div",{className:"enh-inline",children:[p("span",{className:"btn-group",children:c6.map((s)=>p("button",{type:"button",className:n.effort===s?"mode sel":"mode",onClick:()=>n.setEffort(s),children:s},s))}),w("label",{className:"row-inline","data-tip":"hide models that report no reasoning support",children:[p("input",{type:"checkbox",checked:n.thinkingOnly,onChange:()=>n.toggleThinkingOnly()}),"thinking models only"]})]})]})]}),n.modelsError!==""?w("div",{className:"error",children:["\uD83D\uDD34 ",n.modelsError]}):null,n.configsError!==""?w("div",{className:"error",children:["\uD83D\uDD34 ",n.configsError]}):null]})}),m6=X(function(t){let n=t.e.preset;return w(XM,{kind:"master prompt",name:n?.name??null,tip:n==null?void 0:`.comfy-ts/prompt-enhancers/${n.name}.md, saved as you type`,onRename:(i)=>void t.e.renamePreset(i),onDuplicate:()=>t.e.duplicatePreset(),onDelete:()=>void t.e.deletePreset(),onClose:()=>t.e.setEditing(null),children:[n==null?p("div",{className:"enh-empty",children:t.e.presetsState==="loading"?"loading…":"no master prompt yet: add one on the left"}):p("textarea",{className:"enh-text enh-master",rows:18,value:n.text,onChange:(i)=>t.e.setPresetText(i.target.value)}),t.e.presetsError!==""?w("div",{className:"error",children:["\uD83D\uDD34 ",t.e.presetsError]}):null]})}),g6=X(function(t){let n=t.e,i=n.phase==="running",r=q(null);te(()=>{let a=r.current;if(a==null)return;a.focus(),a.setSelectionRange(a.value.length,a.value.length)},[]);let o=QM(n),s=(a)=>w("span",{className:"kbd-hint",children:[Mn,ob[a]]}),l=n.result.trim()==="";return w("section",{className:"enh-job",children:[w("div",{className:"enh-actions",children:[i?p("button",{type:"button",className:"enh-big enh-go",onClick:()=>n.cancel(),children:"stop"}):w("button",{type:"button",className:"primary enh-big enh-go",onClick:o.enhance,children:[p(H,{name:"sparkle"})," enhance ",s("enhance")]}),w("button",{type:"button",className:"enh-big","data-tip":"generate the draft with this rewrite in place of the prompt: the prompt itself is not changed",onClick:()=>t.st.generate(n.tryOverride),disabled:l,children:[p(H,{name:"play",size:0.85})," try it ",w("span",{className:"kbd-hint",children:[Mn,"⏎"]})]}),w("button",{type:"button",className:"accent enh-big","data-tip":"write this rewrite into the prompt and close",onClick:o.apply,disabled:l,children:["apply to prompt ",s("apply")]}),p("span",{className:"run-error","data-tip":n.error===""?void 0:n.error,children:n.error===""?"":`\uD83D\uDD34 ${n.error}`})]}),w("div",{className:"enh-label enh-label-row",children:[p("span",{children:"yours, what gets sent (the form is untouched)"}),w("span",{className:"row-inline",children:[p("button",{type:"button",className:"mini","data-tip":"replace this text with the prompt you opened the enhancer from",onClick:()=>n.usePrompt(),children:"use the prompt"}),p(kc,{entries:n.inputHistory,what:"enhance input",onPick:(a)=>n.setOriginal(a.value)})]})]}),p("textarea",{ref:r,className:"enh-text enh-box",value:n.original,onChange:(a)=>n.setOriginal(a.target.value)}),w("div",{className:"enh-label",children:[i?`rewriting… ${n.result.length} chars`:"rewrite, editable before you apply",n.thinking===""?null:w("span",{className:"enh-think-tip","data-tip":n.thinking,children:["· thinking (",n.thinking.length," chars)"]})]}),p("textarea",{className:"enh-text enh-box enh-result",value:n.result,placeholder:"press enhance",onChange:(a)=>n.setResult(a.target.value)})]})});function QM(e){return{enhance:()=>e.phase==="running"?void 0:e.run(),apply:()=>e.apply()}}var v6=X(function(t){let{e:n,st:i}=t;return te(()=>{let r=(o)=>{if(o.key==="Escape"){if(n.editing!=null)n.setEditing(null);else n.close();return}let s=bO(o);if(s==null)return;o.preventDefault(),QM(n)[s]()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n,i]),p("div",{className:"modal-overlay top",onClick:()=>n.close(),children:w("div",{className:"modal enh-modal",onClick:(r)=>r.stopPropagation(),children:[w("div",{className:"modal-head",children:[w("b",{className:"enh-title",children:[p(H,{name:"sparkle"})," enhance prompt"]}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc), nothing is applied",onClick:()=>n.close(),children:p(H,{name:"close"})})]}),w("div",{className:"enh-layout",children:[p(d6,{e:n}),w("div",{className:"enh-right",children:[p("div",{className:"modal-body enh-main",children:p(g6,{e:n,st:i})}),n.editing==="llm"?p(p6,{e:n}):null,n.editing==="preset"?p(m6,{e:n}):null]})]})]})})}),r0=X(function(t){let n=t.st.enhancer;return w(oe,{children:[w("button",{type:"button",className:t.compact===!0?"link":"mini","data-tip":"rewrite this prompt with an llm",onClick:()=>n.openFor({v:t.v,module:t.module,lane:t.lane}),children:[p(H,{name:"sparkle"}),t.compact===!0?null:" enhance",t.shortcut===!0?w("span",{className:"kbd-hint",children:[Mn,Ll["open-enhancer"]]}):null]}),n.target===t.v&&n.targetLane===(t.lane??null)?p(v6,{e:n,st:t.st}):null]})});var JM=X(function(t){let[n,i]=Q(null),r=t.st.form,o=r?.loraKeywordGroups(t.v)??[];if(r==null||o.length===0)return null;return p("div",{className:"kw-prefix",children:o.map((s)=>{let l=s.parts.filter((a)=>a.on).length;return w("div",{className:"preset-box kw-box",children:[w("button",{type:"button",className:s.running?"kw-line":"kw-line stopped","aria-expanded":n===s.lora,"data-tip":`${s.lora}
41
+ ${s.running?"added in front of your prompt at run time":"not running: paused, or its lane is off"}
42
+ click to choose the words`,onClick:()=>i(n===s.lora?null:s.lora),children:[p("span",{className:"kw-lora",children:s.label}),p("span",{className:"kw-words",children:s.parts.filter((a)=>a.on).map((a)=>a.text).join(", ")||"no words"}),s.parts.length-l>0?w("span",{className:"kw-off",children:["+",s.parts.length-l," disabled"]}):null]}),n===s.lora?w(oe,{children:[p("div",{className:"preset-backdrop",onClick:()=>i(null)}),w("div",{className:"preset-menu kw-menu",children:[w("div",{className:"row-inline kw-menu-head",children:[p("span",{className:"kw-lora",children:s.label}),p("button",{type:"button",className:"link",onClick:()=>r.setKeywordMute(t.v,s.lora,[]),children:"all"}),p("button",{type:"button",className:"link",onClick:()=>r.setKeywordMute(t.v,s.lora,s.parts.map((a)=>a.text)),children:"none"})]}),s.parts.map((a)=>w("label",{className:"kw-item",children:[p("input",{type:"checkbox",checked:a.on,onChange:()=>r.toggleKeywordPart(t.v,s.lora,a.text)}),p("span",{children:a.text})]},a.text))]})]}):null]},s.lora)})})}),ip="application/x-comfy-lane",b6=X(function(t){let[n,i]=Q(!1),r=t.lanes[t.ix];if(r==null)return null;let o=(s)=>{t.v.set({lanes:s})};return w("div",{className:r.active?"lane-box":"lane-box off",onDragOver:(s)=>{if(s.dataTransfer.types.includes(ip))s.preventDefault()},onDrop:(s)=>{let l=Number(s.dataTransfer.getData(ip));if(s.dataTransfer.getData(ip)===""||!Number.isInteger(l)||l===t.ix)return;s.preventDefault(),o(Ih(t.lanes,l,t.ix-l))},children:[w("div",{className:"lane-bar",children:[n?p("input",{type:"text",className:"lane-name",autoFocus:!0,defaultValue:r.name,onFocus:(s)=>s.currentTarget.select(),onKeyDown:(s)=>{if(s.key==="Enter")o(Qn(t.lanes,t.ix,{name:s.currentTarget.value.trim()||r.name})),i(!1);if(s.key==="Escape")i(!1)},onBlur:()=>i(!1)}):p("button",{type:"button",className:r.active?"lane-pill":"lane-pill off",draggable:!0,"data-tip":`${r.active?"in the prompt":"left out"}: click to switch, drag to reorder, double-click to rename`,onDragStart:(s)=>{s.dataTransfer.effectAllowed="move",s.dataTransfer.setData(ip,String(t.ix))},onClick:()=>o(Qn(t.lanes,t.ix,{active:!r.active})),onDoubleClick:()=>i(!0),children:r.name}),w("span",{className:"lane-tools",children:[p(r0,{v:t.v,st:t.st,module:t.module,lane:t.ix,compact:!0,shortcut:t.shortcut}),p(Uu,{tip:"lane actions",children:(s)=>w(oe,{children:[p(Ft,{label:"rename",onClick:()=>{s(),i(!0)}}),p(Ft,{label:"remove",disabled:t.lanes.length===1,onClick:()=>{s(),o(Vh(t.lanes,t.ix))}})]})})]})]}),p(Wy,{v:t.v,st:t.st,module:t.module,value:r.prompt,onChange:(s)=>o(Qn(t.lanes,t.ix,{prompt:s})),minLines:2})]})}),ZM=X(function(t){let n=t.v.value;if(hr(n)){let r=UC(n);return w("div",{children:[p(JM,{v:t.v,st:t.st}),p("div",{className:"lanes",children:n.lanes.map((o,s)=>p(b6,{v:t.v,st:t.st,module:t.module,lanes:n.lanes,ix:s,shortcut:t.jumpTarget===!0&&s===0},s))}),w("div",{className:"row-inline lane-foot",children:[p("button",{type:"button",className:"link",onClick:()=>t.v.set({lanes:[...n.lanes,{name:Ou(n.lanes),prompt:"",active:!0}]}),children:"+ lane"}),r==null?null:p("button",{type:"button",className:"link","data-tip":"back to a single prompt box",onClick:()=>t.v.set(r),children:"single box"}),p(kc,{entries:t.st.promptHistory,what:"prompt",onPick:(o)=>t.v.set(o.value)}),p("span",{className:"hint",children:"lanes merge top to bottom"})]})]})}let i=typeof n==="string"?n:"";return w("div",{children:[p(JM,{v:t.v,st:t.st}),p(Wy,{v:t.v,st:t.st,module:t.module,value:i,onChange:(r)=>t.v.set(r),minLines:4}),w("div",{className:"row-inline prompt-actions",children:[p(Hu,{v:t.v}),p(r0,{v:t.v,st:t.st,module:t.module,shortcut:t.jumpTarget}),p(kc,{entries:t.st.promptHistory,what:"prompt",onPick:(r)=>t.v.set(r.value)}),p("button",{type:"button",className:"mini","data-tip":"split this prompt into named lanes, merged in the order they are listed",onClick:()=>t.v.set(HC(i)),children:"lanes"})]})]})});function e_(e){return{label:"generate",fill:e.isRunning?Math.max(0,Math.min(100,Math.round(e.percent??0))):null,running:e.isRunning}}function t_(e){let t=e.map(()=>null),n=0;while(n<e.length){let i=e[n]?.group;if(i==null){n++;continue}let r=n;while(r+1<e.length&&e[r+1]?.group===i)r++;let o=e.slice(n,r+1).find((s)=>s.groupColor!=null)?.groupColor??null;for(let s=n;s<=r;s++)t[s]={pos:n===r?"solo":s===n?"start":s===r?"end":"mid",color:o};n=r+1}return t}var n_=X(function(t){let n=q(null),i=typeof t.v.value==="string"?t.v.value:"",r=/^https?:\/\//.test(i)?i:t.v.uploadedUrl,o=t.v.desc.extensions??[],s=async(l)=>{if(l==null)return;try{let a=await DC({file:l});t.v.set(a.path),t.v.setUploadedUrl(a.url)}catch(a){alert(`upload failed: ${a instanceof Error?a.message:String(a)}`)}};return w("div",{children:[w("div",{className:"row-inline",children:[p("input",{type:"text",style:{flex:1},placeholder:"local path or http(s) url",value:i,onChange:(l)=>{t.v.set(l.target.value),t.v.setUploadedUrl(null)}}),p("button",{type:"button",onClick:()=>n.current?.click(),children:"upload…"}),i!==""?p("button",{type:"button","data-tip":"clear the image",onClick:()=>{t.v.set(""),t.v.setUploadedUrl(null)},children:p(H,{name:"close"})}):null,p("input",{ref:n,type:"file",accept:o.map((l)=>`.${l}`).join(","),style:{display:"none"},onChange:(l)=>{s(l.target.files?.[0]),l.target.value=""}})]}),r!=null&&r!==""?p("div",{className:"img-preview",children:p("img",{src:r,alt:i})}):null]})});function Gt(e,t){console.error(`\uD83D\uDD34 [comfy-ts serve] ${e}: ${t instanceof Error?t.message:String(t)}`)}var i_=[{mode:"folder",label:"folder",tip:"grouped by folder, in the order the host lists them"},{mode:"name",label:"name",tip:"by display name, A to Z"},{mode:"added",label:"date added",tip:"newest file first (the lora manager date). loras it has no date for come last"}];function r_(e){return e==="name"||e==="added"?e:"folder"}function o_(e){let t=[...e.names];if(e.mode==="name")return t.sort((n,i)=>e.label(n).localeCompare(e.label(i),void 0,{sensitivity:"base",numeric:!0}));if(e.mode==="added")return t.sort((n,i)=>{let r=e.addedAt[n],o=e.addedAt[i];if(r==null)return o==null?0:1;if(o==null)return-1;return o-r});return t}function s_(e){let t=e.matches.slice(0,e.cap),n=new Set(e.picked);return{cards:t,enterPick:t.find((i)=>!n.has(i))??null}}function l_(e){if(!e.picked)return"add";return e.on?"pause":"resume"}var oa="application/x-comfy-lora",o0="application/x-comfy-lora-lane",y6=X(function(t){let[n,i]=Q(!1),r=t.lanes[t.ix];if(r==null)return null;let o=(s)=>{t.v.set({lanes:s})};return w("div",{className:"lane-bar",onDragOver:(s)=>{let l=s.dataTransfer.types;if(l.includes(oa)||l.includes(o0))s.preventDefault()},onDrop:(s)=>{let l=s.dataTransfer.getData(oa);if(l!==""){s.preventDefault(),t.onDropCard(l);return}let a=s.dataTransfer.getData(o0),u=Number(a);if(a===""||!Number.isInteger(u)||u===t.ix)return;s.preventDefault(),o(Ih(t.lanes,u,t.ix-u))},children:[n?p("input",{type:"text",className:"lane-name",autoFocus:!0,defaultValue:r.name,onFocus:(s)=>s.currentTarget.select(),onKeyDown:(s)=>{if(s.key==="Enter")o(Qn(t.lanes,t.ix,{name:s.currentTarget.value.trim()||r.name})),i(!1);if(s.key==="Escape")i(!1)},onBlur:()=>i(!1)}):p("button",{type:"button",className:r.active?"lane-pill":"lane-pill off",draggable:!0,"data-tip":`${r.active?"runs":"left out"}: click to switch, drag to reorder, double-click to rename`,onDragStart:(s)=>{s.dataTransfer.effectAllowed="move",s.dataTransfer.setData(o0,String(t.ix))},onClick:()=>o(Qn(t.lanes,t.ix,{active:!r.active})),onDoubleClick:()=>i(!0),children:r.name}),t.count===0?null:p("span",{className:"hint",children:`${t.on}/${t.count} on`}),p("span",{className:"lane-tools",children:p(Uu,{tip:"lane actions",children:(s)=>w(oe,{children:[p(Ft,{label:"rename",onClick:()=>{s(),i(!0)}}),p(Ft,{label:"remove",disabled:t.count>0||t.lanes.length===1,tip:t.count>0?"empty the lane first":void 0,onClick:()=>{s(),o(Vh(t.lanes,t.ix))}})]})})})]})}),a_=X(function(t){let n=ro(()=>({open:!1,filter:"",info:new Map,previewFailed:new Set,paused:new Set,target:-1,openFor(C){this.target=C,this.open=!0},setOpen(C){this.open=C},setFilter(C){this.filter=C},noteInfo(C,D){this.info.set(C,D)},notePreviewFailed(C){this.previewFailed.add(C)},details:null,setDetails(C){this.details=C},split:new Map,isSplit(C,D){return this.split.get(C)??D},setSplit(C,D){this.split.set(C,D)}})),i=Bh(t.v.value)?t.v.value:{},r=Xn(i)?i:null,o=t.v.desc.options??[],s=t.v.desc.optionLabels??{},l=(C)=>s[C]??C,a=Xn(i)?i.lanes.map((C,D)=>({ix:D,record:C.loras,lane:C})):[{ix:-1,record:i,lane:null}],u=(C)=>nA({record:C.record,options:o}),c=[...new Set(a.flatMap(u))],f=(C,D)=>ZC(C.record[D]),h=a.reduce((C,D)=>C+u(D).filter((Z)=>f(D,Z)).length,0),d=a.find((C)=>C.ix===n.target)??a[0]??null,m=d==null?[]:u(d),b=(C,D)=>{let Z=Ml(D,o);if(r==null)t.v.set(Z);else t.v.set({lanes:Qn(r.lanes,C,{loras:Z})})},x=new Set(t.v.desc.managerOnlyOptions??[]),g="on disk and known to the lora manager, but not in ComfyUI's list yet: it refuses the prompt. the panel refreshes the host by itself when it changes; if this stays, the models drive is probably exFAT (install extra/comfyui-fresh-model-lists) or ComfyUI needs a restart",v=(C)=>x.has(C)?p("span",{className:"lora-warn","data-tip":"on disk and known to the lora manager, but not in ComfyUI's list yet: it refuses the prompt. the panel refreshes the host by itself when it changes; if this stays, the models drive is probably exFAT (install extra/comfyui-fresh-model-lists) or ComfyUI needs a restart",children:p(H,{name:"warn",size:0.9})}):null,y=t.st.showLoraImages,S=t.v.desc.optionTriggers??{},k=(C)=>{let D=S[C];if(D==null)return p("span",{className:"chip-triggers missing","data-tip":"this lora is newer than the copy of the lora manager's list kept here: the next host refresh brings its trigger words, name and preview (it runs by itself). The lora itself runs fine",children:"trigger words not loaded yet"});if(D.state==="unfetched"){let Z=t.st.loraFetching.has(C);return w("span",{className:"chip-triggers missing",children:["trigger words never fetched",p("button",{type:"button",className:"trigger-fetch",disabled:Z,"data-tip":"ask the lora manager to fetch this lora's civitai metadata, trigger words included",onClick:()=>void t.st.fetchLoraTriggers(C),children:Z?"fetching…":"fetch"})]})}if(D.state==="not-on-civitai"){let Z=t.st.loraFetching.has(C);return w("span",{className:"chip-triggers missing","data-tip":"civitai was asked and has no version for this file: a private or local lora, so no trigger words exist there",children:["not on civitai",p("button",{type:"button",className:"trigger-fetch",disabled:Z,"data-tip":"ask civitai again (it may have been published since)",onClick:()=>void t.st.fetchLoraTriggers(C),children:Z?"asking…":"retry"})]})}if(D.state==="none")return p("span",{className:"chip-triggers none","data-tip":"civitai was asked, and this lora has no trigger words",children:"no trigger words"});return p("span",{className:"chip-triggers words","data-tip":A?D.words.join(`
43
+ `):"titles are hidden",children:A?D.words.join(", "):`${D.words.length} trigger word${D.words.length===1?"":"s"}`})},A=t.st.showLoraTitles,E=(C,D,Z)=>{let wt={...C.record};if(Z==null)delete wt[D];else wt[D]=Z;b(C.ix,wt)},O=(C,D,Z)=>{b(C.ix,tA(C.record,D,Z))},T=(C,D,Z)=>{b(C.ix,rA(C.record,D,Z))},_=(C,D)=>{let Z=eA(C.record[D]),wt=n.isSplit(D,Z.model!==Z.clip),re=(dn,fi)=>{if(!Number.isFinite(fi))return;let hi=Math.round(fi*100)/100;if(dn==="both")return T(C,D,{model:hi,clip:hi});T(C,D,dn==="model"?{model:hi,clip:Z.clip}:{model:Z.model,clip:hi})},Me=(dn,fi,hi,Cc)=>w("div",{className:"st-line",children:[p("button",{type:"button",className:"st-label","data-tip":Cc,onClick:()=>n.setSplit(D,!wt),children:hi}),p("input",{type:"range",min:-1,max:2,step:0.05,value:fi,onChange:(ws)=>re(dn,parseFloat(ws.target.value))}),p("input",{type:"number",step:0.05,value:fi,onChange:(ws)=>re(dn,parseFloat(ws.target.value))})]});if(!wt)return Me("both",Z.model,"m+c","model and clip together — click to set them apart");return w(oe,{children:[Me("model",Z.model,"m","model strength — click to tie them back together"),Me("clip",Z.clip,"c","clip strength — click to tie them back together")]})},L=n.open,B=t.host,W=c.join(`
44
+ `);te(()=>{if(!L)return;for(let C of W.split(`
45
+ `)){if(C===""||n.info.has(C))continue;n.noteInfo(C,"loading"),Pv({host:B,name:C}).then((D)=>n.noteInfo(C,D)).catch(()=>n.noteInfo(C,"error"))}},[L,W,B,n]);let K=t.st.jump,I=a[0]?.ix??-1;te(()=>{if(!t.jumpTarget||K==null||K.kind!=="loras")return;n.openFor(I)},[K,t.jumpTarget,I,n]),te(()=>{if(!L)return;let C=(D)=>{if(D.key==="Escape")n.setOpen(!1)};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[L,n]);let j=n.filter.toLowerCase(),ee=(C)=>C.toLowerCase().includes(j)||l(C).toLowerCase().includes(j),F=o_({names:o.filter(ee),mode:t.st.loraSort,label:l,addedAt:t.v.desc.optionAddedAt??{}}),fe=t.st.loraCap,{cards:Ye,enterPick:yt}=s_({matches:F,picked:m,cap:fe}),Xe=(C)=>{let D=C.split(/[\\/]+/);return D.length<=1?"":D.slice(0,-1).join("/")},xt=(()=>{if(t.st.loraSort!=="folder")return[{folder:null,names:Ye}];let C=new Map;for(let D of Ye){let Z=Xe(D),wt=C.get(Z);if(wt==null)C.set(Z,[D]);else wt.push(D)}return[...C.entries()].map(([D,Z])=>({folder:D,names:Z})).sort((D,Z)=>D.folder.localeCompare(Z.folder))})(),Qe=q(null);te(()=>{if(!L)return;let C=Qe.current;if(C==null)return;C.focus(),C.select()},[L]);let Wt=()=>{let C=yt;if(C==null)return;if(d!=null)E(d,C,[1,1]);Qe.current?.select()},Lt=t.st.loraScale,Bi=Math.round(168*Lt),op=Math.round(120*Lt),xs=(C,D)=>{if(!y)return null;let Z=D==null?void 0:{height:D};return n.previewFailed.has(C)?p("div",{className:"lora-thumb none",style:Z,children:"no preview"}):p("img",{style:Z,className:t.st.loraFill?"lora-thumb fill":"lora-thumb",loading:"lazy",src:Iv({host:t.host,name:C}),alt:l(C),onError:()=>n.notePreviewFailed(C)},C)},Ec=p("span",{className:"paused-mark","aria-label":"paused",children:p(H,{name:"pause",size:2.6})}),zt=y?p("input",{type:"range",className:"setting-range",min:0.6,max:2,step:0.05,value:Lt,"data-tip":`lora image size ×${Lt.toFixed(2)}`,onChange:(C)=>t.st.setLoraScale(parseFloat(C.target.value))}):null,sa=w(oe,{children:[p("button",{type:"button",className:y?"mode sel":"mode","data-tip":y?"hide lora images":"show lora images",onClick:()=>t.st.toggleLoraImages(),children:p(H,{name:"image"})}),p("button",{type:"button",className:A?"mode sel":"mode","data-tip":A?"hide lora titles":"show lora titles",onClick:()=>t.st.toggleLoraTitles(),children:p(H,{name:"tag"})}),p("button",{type:"button",className:t.st.showLoraTriggers?"mode sel":"mode","data-tip":t.st.showLoraTriggers?"hide the trigger words":"show the trigger words",onClick:()=>t.st.toggleLoraTriggers(),children:p(H,{name:"text"})}),y?p("button",{type:"button",className:t.st.loraFill?"mode sel":"mode","data-tip":t.st.loraFill?"fit the whole preview inside the card":"fill the card with the preview",onClick:()=>t.st.toggleLoraFill(),children:p(H,{name:t.st.loraFill?"shrink":"expand"})}):null]});return w("div",{children:[w("div",{className:"lora-actions",children:[w("button",{type:"button",className:"field-height accent",onClick:()=>n.openFor(a[0]?.ix??-1),children:[p(H,{name:"plus"})," add"]}),p(Uu,{tip:"display, lora manager, lanes",children:(C)=>w(oe,{children:[p(Ft,{label:"images",checked:y,onClick:()=>t.st.toggleLoraImages()}),p(Ft,{label:"titles",checked:A,onClick:()=>t.st.toggleLoraTitles()}),p(Ft,{label:"fill the card",checked:t.st.loraFill,disabled:!y,onClick:()=>t.st.toggleLoraFill()}),p(Ft,{label:"trigger words",checked:t.st.showLoraTriggers,onClick:()=>t.st.toggleLoraTriggers()}),y?w("label",{className:"menu-item menu-range",children:[p("span",{className:"menu-check"}),"size",zt]}):null,p("div",{className:"menu-sep"}),t.hostUrl==null?null:p(Ft,{label:"open the lora manager ↗",onClick:()=>{C(),window.open(`${t.hostUrl}/loras`,"_blank","noreferrer")}}),p("div",{className:"menu-sep"}),r==null?p(Ft,{label:"split into lanes",onClick:()=>{C(),t.v.set(qC(i))}}):w(oe,{children:[p(Ft,{label:"+ lane",onClick:()=>{C(),t.v.set({lanes:[...r.lanes,{name:Ou(r.lanes),active:!0,loras:{}}]})}}),p(Ft,{label:"back to a single row",disabled:Ph(r)==null,tip:Ph(r)==null?"only with one active lane: nothing gets merged behind your back":void 0,onClick:()=>{C();let D=Ph(r);if(D!=null)t.v.set(D)}})]})]})}),c.length>0?w("span",{className:"hint",children:[c.length," in the palette · ",h," on"]}):null]}),w("div",{className:"lora-lanes",children:[!y&&!A?w("span",{className:"hint",children:[c.length," lora",c.length===1?"":"s"," in the palette"]}):a.map((C)=>{let D=u(C),Z=(re,Me)=>{let[dn,fi]=re.split(`
46
+ `),hi=Number(dn);if(fi==null||!Number.isInteger(hi)||fi===Me)return;if(hi===C.ix){let Cc=Me==null?D.length-1:D.indexOf(Me),ws=D.indexOf(fi);if(ws===-1||Cc===-1)return;b(C.ix,iA({record:C.record,displayed:D,from:ws,to:Cc}))}else if(r!=null)t.v.set(WC(r,{from:hi,name:fi,to:C.ix,beforeName:Me??void 0}))},wt=(re)=>{if(re.dataTransfer.types.includes(oa))re.preventDefault()};return w("div",{className:`lora-section${C.lane==null?"":" laned"}${C.lane==null||C.lane.active?"":" off"}`,children:[C.lane==null||r==null?null:p(y6,{v:t.v,lanes:r.lanes,ix:C.ix,count:D.length,on:D.filter((re)=>f(C,re)).length,onDropCard:(re)=>Z(re,null)}),w("div",{className:"row-inline lora-lane",children:[D.map((re)=>w("span",{className:`${y?"lora-chip card":"lora-chip"}${f(C,re)?"":" off"}`,style:y?{width:Bi}:void 0,draggable:!0,onMouseDown:(Me)=>{let dn=Me.target;Me.currentTarget.draggable=dn.closest("input, label, button, select, a")==null},onMouseUp:(Me)=>{Me.currentTarget.draggable=!0},onDragStart:(Me)=>{Me.dataTransfer.effectAllowed="move",Me.dataTransfer.setData(oa,`${C.ix}
47
+ ${re}`)},onDragOver:wt,onDrop:(Me)=>{let dn=Me.dataTransfer.getData(oa);if(dn==="")return;Me.preventDefault(),Z(dn,re)},children:[w("span",{className:"chip-media",children:[w("button",{type:"button",className:"lora-toggle","data-tip":`${re}
48
+ click to ${f(C,re)?"pause":"resume"}, click the title for details`,onClick:()=>O(C,re,!f(C,re)),children:[xs(re,Math.round(130*Lt)),y&&!f(C,re)?Ec:null]}),p("button",{type:"button",className:"chip-remove","data-tip":"remove from the palette (the popup adds it back)",onClick:()=>E(C,re,null),children:p(H,{name:"close",size:1.35})})]}),w("span",{className:"chip-head",children:[w("label",{className:"switch","data-tip":f(C,re)?"pause this lora":"resume this lora",children:[p("input",{type:"checkbox",checked:f(C,re),onChange:(Me)=>O(C,re,Me.target.checked)}),p("span",{className:"track"})]}),A?p("button",{type:"button",className:"chip-title as-text","data-tip":`${re}
49
+ click for its details`,onClick:()=>n.setDetails(re),children:l(re)}):null,v(re)]}),p("span",{className:"chip-controls",children:_(C,re)}),t.st.showLoraTriggers?k(re):null]},re)),C.lane==null?null:p("button",{type:"button",className:"lora-add-card","data-tip":`add loras to ${C.lane.name}`,onDragOver:wt,onDrop:(re)=>{let Me=re.dataTransfer.getData(oa);if(Me==="")return;re.preventDefault(),Z(Me,null)},onClick:()=>n.openFor(C.ix),children:p(H,{name:"plus"})})]})]},C.ix)}),r==null?null:w("div",{className:"row-inline",children:[w("button",{type:"button",onClick:()=>t.v.set({lanes:[...r.lanes,{name:Ou(r.lanes),active:!0,loras:{}}]}),children:[p(H,{name:"plus"})," lane"]}),p("span",{className:"hint",children:"lanes merge top to bottom · drag a card onto another lane to move it"})]})]}),n.details==null?null:p(x6,{name:n.details,host:t.host,hostUrl:t.hostUrl,label:l(n.details),showImage:y,keyword:(t.v.desc.optionKeywords??{})[n.details]??null,managerOnly:x.has(n.details),onClose:()=>n.setDetails(null)}),n.open?p("div",{className:"modal-overlay top",onClick:()=>n.setOpen(!1),children:w("div",{className:"modal loras-modal",onClick:(C)=>C.stopPropagation(),children:[w("div",{className:"modal-head",children:[p("span",{className:"btn-group",children:sa}),zt,p("input",{ref:Qe,type:"text",placeholder:`search ${o.length} loras, enter adds the first`,value:n.filter,onChange:(C)=>n.setFilter(C.target.value),onKeyDown:(C)=>{if(C.key!=="Enter")return;C.preventDefault(),Wt()}}),p("button",{type:"button",className:"modal-close","data-tip":"close (esc)",onClick:()=>n.setOpen(!1),children:p(H,{name:"close"})})]}),w("div",{className:"loras-split",children:[p("div",{className:"modal-body loras-palette",children:d==null||m.length===0?p("div",{className:"hint",children:"nothing picked yet: tap a lora to add it"}):w("div",{children:[w("div",{className:"section-title",children:[d.lane==null?"your palette":`lane ${d.lane.name}`," (",m.length,")"]}),m.map((C)=>{let D=n.info.get(C);return w("div",{className:f(d,C)?"lora-active-row":"lora-active-row off",children:[xs(C),w("div",{className:"lora-active-text",children:[p("div",{className:"lora-label","data-tip":C,children:A?l(C):"···"}),t.st.showLoraTriggers&&typeof D==="object"&&D.triggerWords.length>0?p("div",{className:"hint",children:D.triggerWords.join(", ")}):p("div",{className:"hint",children:C})]}),p("input",{type:"checkbox",checked:f(d,C),"data-tip":f(d,C)?"pause (stays in the palette)":"resume",onChange:(Z)=>O(d,C,Z.target.checked)}),_(d,C),p("button",{type:"button",className:"chip-remove","data-tip":"remove from the list",onClick:()=>E(d,C,null),children:p(H,{name:"close",size:1.2})})]},C)})]})}),w("div",{className:"modal-body loras-gallery",children:[w("div",{className:"section-title lora-sort-head",children:["all loras — tap to add or take out",w("span",{className:"lora-sort",children:["sort",i_.map((C)=>p("button",{type:"button",className:t.st.loraSort===C.mode?"mode sel":"mode","data-tip":C.tip,onClick:()=>t.st.setLoraSort(C.mode),children:C.label},C.mode))]})]}),xt.map((C)=>w("div",{children:[C.folder==null?null:w("div",{className:"section-title",children:[C.folder===""?"loose (no folder)":`${C.folder}/`," ·"," ",C.names.length]}),p("div",{className:"lora-grid",style:{gridTemplateColumns:`repeat(auto-fill, minmax(${op}px, 1fr))`},children:C.names.map((D)=>{let Z=m.includes(D),wt=d!=null&&f(d,D),re=l_({picked:Z,on:wt});return w("div",{className:!Z?"lora-card":wt?"lora-card picked":"lora-card picked off",children:[w("button",{type:"button",className:"lora-card-hit","data-tip":re==="add"?`${D}
50
+ click to add`:`${D}
51
+ click to ${re}`,onClick:()=>{if(d==null)return;if(re==="add")E(d,D,[1,1]);else O(d,D,re==="resume")},children:[w("span",{className:"thumb-box",children:[xs(D,Math.round(110*Lt)),y&&Z&&!wt?Ec:null]}),w("div",{className:"lora-label",children:[A?l(D):D.slice(0,2)+"···",v(D)]})]}),Z&&d!=null?p("button",{type:"button",className:"chip-remove","data-tip":"remove from the palette",onClick:()=>E(d,D,null),children:p(H,{name:"close",size:1.35})}):null]},D)})})]},C.folder??"*")),F.length>fe?w("div",{className:"loras-more",children:["… ",F.length-fe," more — refine the filter, or draw",p("input",{type:"number",min:1,max:2000,value:fe,"data-tip":"how many cards this popup draws — each one is an image request, so the right number depends on your collection and your box. Kept in this browser",onChange:(C)=>{let D=parseInt(C.target.value,10);if(Number.isFinite(D))t.st.setLoraCap(D)}}),"at once"]}):null,F.length===0?w("div",{className:"loras-more",children:["no lora matches '",n.filter,"'"]}):null]})]}),t.v.desc.optionsFilter==null?null:w("div",{className:"modal-foot hint",children:["this workflow offers loras matching ",t.v.desc.optionsFilter]})]})}):null]})}),x6=X(function(t){let n=ro(()=>({info:"loading",about:null,aboutError:null,set(l){this.info=l},setAbout(l){this.about=l,this.aboutError=null},setAboutError(l){this.about=null,this.aboutError=l}})),{name:i,host:r}=t;te(()=>{let l=!0;return n.set("loading"),n.setAbout(null),Pv({host:r,name:i}).then((a)=>{if(l)n.set(a)}).catch((a)=>{if(l)n.set("error");Gt(`lora info for ${i}`,a)}),vC({host:r,name:i}).then((a)=>{if(l)n.setAbout(a)}).catch((a)=>{if(l)n.setAboutError(a instanceof Error?a.message:String(a));Gt(`lora details for ${i}`,a)}),()=>{l=!1}},[r,i,n]),te(()=>{let l=(a)=>{if(a.key==="Escape")t.onClose()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t]);let o=n.info,s=(l,a)=>a==null||a===""?null:w("div",{className:"detail-row",children:[p("span",{className:"detail-key",children:l}),p("span",{className:"detail-val",children:a})]});return p("div",{className:"modal-overlay",onClick:()=>t.onClose(),children:w("div",{className:"modal",onClick:(l)=>l.stopPropagation(),children:[w("div",{className:"modal-head",children:[p("b",{style:{flex:1},children:t.label}),p("button",{type:"button","data-tip":"close (esc)",onClick:()=>t.onClose(),children:p(H,{name:"close"})})]}),w("div",{className:"modal-body",children:[o==="loading"?p("div",{className:"hint",children:"reading the mirror…"}):null,o==="error"?p("div",{className:"error",children:"\uD83D\uDD34 could not read this lora's metadata"}):null,typeof o==="object"?w("div",{className:"lora-details",children:[t.showImage?p("img",{className:"detail-thumb",src:Iv({host:r,name:i}),alt:t.label}):null,w("div",{className:"detail-list",children:[o.known===!1?p("div",{className:"hint",children:"newer than the copy of the lora manager's list kept here: sync reads it again"}):null,t.managerOnly?p("div",{className:"hint",children:"⚠ only the lora manager lists it, not comfy"}):null,s("file",i),s("base model",o.baseModel),s("folder",o.folder),s("trigger words",o.triggerWords.join(", ")),s("prompt keyword",t.keyword),s("tags",(o.tags??[]).join(", ")),s("notes",o.notes),s("size",o.fileSize==null?null:`${(o.fileSize/1e9).toFixed(2)} GB`),s("path",o.filePath),n.about?.description==null?null:p("div",{className:"detail-desc",children:n.about.description}),s("civitai",o.civitaiUrl==null?null:w("a",{href:o.civitaiUrl,target:"_blank",rel:"noreferrer",children:[o.civitaiVersion??"model page"," ↗"]})),n.about!=null&&n.about.examples.length>0?w("div",{children:[w("div",{className:"section-title",children:["examples (",n.about.examples.length,")"]}),p("div",{className:"detail-examples",children:n.about.examples.slice(0,8).map((l)=>p("img",{src:l,alt:"",loading:"lazy"},l))})]}):null,n.about?.examplesReason==null?null:w("div",{className:"hint",children:["no example images: ",n.about.examplesReason]}),n.aboutError==null?null:w("div",{className:"error",children:["\uD83D\uDD34 the lora manager did not answer: ",n.aboutError]}),t.hostUrl==null?null:w("a",{className:"button-link",href:`${t.hostUrl}/loras`,target:"_blank",rel:"noreferrer",children:[p(H,{name:"external"})," open in the lora manager"]})]})]}):null]})]})})});var s0=[{mode:"=",label:"fixed",hint:"this exact seed, every run"},{mode:"+",label:"inc",hint:"one more after each run"},{mode:"?",label:"random",hint:"a fresh random seed each run"}];function w6(e){if(s0.some((t)=>t.mode===e))return s0;return[...s0,e==="-"?{mode:"-",label:"dec",hint:"one less after each run"}:{mode:e,label:e,hint:`mode '${e}'`}]}var u_=X(function(t){let n=ns(t.v.value),i=(r)=>{if(Number.isFinite(r))t.v.set({mode:n.mode,value:Math.max(0,Math.floor(r))})};return p("div",{children:w("div",{className:"row-inline",children:[p("span",{className:"btn-group field-height",children:w6(n.mode).map((r)=>p("button",{type:"button",className:n.mode===r.mode?"sel":"","data-tip":r.hint,onClick:()=>t.v.set({mode:r.mode,value:n.value}),children:r.label},r.mode))}),p("input",{type:"number",min:0,value:n.value,onChange:(r)=>i(parseInt(r.target.value,10))}),p("button",{type:"button",className:"field-height","data-tip":"roll a random seed now",onClick:()=>i(JC()),children:p(H,{name:"dice"})})]})})});function c_(e){let t=new Set(e.mine??e.defaults);return e.presets.filter((n)=>t.has(n.label))}function f_(e){let t=e.mine??e.defaults;return t.includes(e.label)?t.filter((n)=>n!==e.label):[...t,e.label]}function h_(e,t,n){if(e<=0||t<=0)return{w:n,h:n};let i=n/Math.max(e,t);return{w:Math.max(2,Math.round(e*i)),h:Math.max(2,Math.round(t*i))}}function l0(e){let t=e.box??14,n=h_(e.width,e.height,t-2);return p("svg",{className:"aspect-icon",width:t,height:t,viewBox:`0 0 ${t} ${t}`,"aria-hidden":"true",children:p("rect",{x:(t-n.w)/2,y:(t-n.h)/2,width:n.w,height:n.h,rx:1.5,fill:"none",stroke:"currentColor",strokeWidth:1.4})})}function d_(e){return`${String(e).length+2.6}ch`}var p_=X(function(t){let[n,i]=Q(!1),r=Ru(t.v.value),o=t.v.desc.presets??[],s=`${t.module}/${t.v.name}`,l=t.v.desc.starredPresets??[],a=t.st.sizeStars[s],u=c_({presets:o,defaults:l,mine:a}),c=o.find((d)=>d.width===r.width&&d.height===r.height),f=(d)=>t.v.set({width:d.width,height:d.height}),h=(d)=>{let m=d.width??r.width,b=d.height??r.height;if(Number.isFinite(m)&&Number.isFinite(b)&&m>0&&b>0)t.v.set({width:Math.floor(m),height:Math.floor(b)})};return w("div",{className:"row-inline size-row",children:[u.length>0?p("span",{className:"btn-group",children:u.map((d)=>p("button",{type:"button",className:d===c?"sel":"","data-tip":`${d.label} · ${d.width}×${d.height}`,onClick:()=>f(d),children:p(l0,{width:d.width,height:d.height})},d.label))}):null,w("div",{className:"preset-box",onKeyDown:(d)=>d.key==="Escape"?i(!1):void 0,children:[w("button",{type:"button",className:"preset-btn size-pick","aria-expanded":n,onClick:()=>i(!n),children:[p(l0,{width:r.width,height:r.height})," ",c?.label??"custom"," ▾"]}),n?w(oe,{children:[p("div",{className:"preset-backdrop",onClick:()=>i(!1)}),p("div",{className:"preset-menu size-menu",children:o.map((d)=>{let m=u.includes(d);return w("div",{className:d===c?"size-item on":"size-item",children:[w("button",{type:"button",className:"size-item-pick",onClick:()=>{f(d),i(!1)},children:[p(l0,{width:d.width,height:d.height}),p("span",{className:"size-item-label",children:d.label}),w("span",{className:"hint",children:[d.width,"×",d.height]})]}),p("button",{type:"button",className:m?"size-star on":"size-star",title:m?"unstar: remove from the quick buttons":"star: add to the quick buttons",onClick:()=>t.st.setSizeStars(s,f_({defaults:l,mine:a,label:d.label})),children:m?"★":"☆"})]},d.label)})})]}):null]}),p("input",{type:"number",min:1,className:"size-num",style:{width:d_(r.width)},value:r.width,onChange:(d)=>h({width:Number(d.target.value)})}),"×",p("input",{type:"number",min:1,className:"size-num",style:{width:d_(r.height)},value:r.height,onChange:(d)=>h({height:Number(d.target.value)})}),p("button",{type:"button","data-tip":"swap width and height",onClick:()=>t.v.set({width:r.height,height:r.width}),children:p(H,{name:"swap"})})]})});var S6=X(function(t){switch(t.v.desc.kind){case"prompt":return p(ZM,{v:t.v,st:t.st,module:t.module,jumpTarget:t.jumpTarget});case"text":return p(xO,{v:t.v});case"int":case"float":return p(wO,{v:t.v});case"seed":return p(u_,{v:t.v});case"toggle":return p(SO,{v:t.v});case"choice":return p(kO,{v:t.v});case"loras":return p(a_,{v:t.v,host:t.st.hostFor(t.module),st:t.st,hostUrl:t.st.hostUrlFor(t.module),jumpTarget:t.jumpTarget});case"size":return p(p_,{v:t.v,st:t.st,module:t.module});case"image":return p(n_,{v:t.v});default:return w("div",{className:"hint",children:["unsupported var kind '",t.v.desc.kind,"' — use the json api"]})}}),k6=X(function(t){let n=q(null),i=t.st.jump,r=t.jumpKey==null?null:t.v.desc.kind;te(()=>{if(i==null||r!=="prompt"||i.kind!=="prompt")return;let a=n.current?.querySelector(".cm-content");a?.focus(),a?.scrollIntoView({block:"nearest"})},[i,r]);let o=t.v.desc.ui,s=t.st.form?.inactiveReason(t.v)??null,l=t.v.desc.kind==="loras"||t.v.desc.kind==="prompt";return w("div",{ref:n,className:`var-row${l?" wide":""}${s==null?"":" inactive"}${t.place==null?"":` in-group group-${t.place.pos}`}`,style:{background:o?.background??(t.place==null?void 0:t.place.color??void 0),outline:o?.border==null?void 0:`1px solid ${o.border}`,outlineOffset:o?.border==null?void 0:"-1px"},onDragOver:(a)=>{if(a.dataTransfer.types.includes("application/x-comfy-var"))a.preventDefault()},onDrop:(a)=>{let u=a.dataTransfer.getData("application/x-comfy-var");if(u==="")return;a.preventDefault();let c=Number(u);if(Number.isInteger(c)&&c!==t.index)t.st.moveVar({module:t.module,names:t.names,from:c,to:t.index})},children:[w("div",{className:t.jumpKey==null?"var-label":"var-label has-kbd",draggable:!0,onDragStart:(a)=>{a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("application/x-comfy-var",String(t.index))},children:[o?.description==null?null:p("span",{className:"var-help","data-tip":o.description,children:"?"}),o?.icon==null?null:p(td,{icon:o.icon,color:o.color}),p("span",{className:"var-name","data-tip":`${t.v.desc.label??t.v.name??""}
52
+ ${s??t.v.desc.kind}
53
+ drag the label to reorder`,style:o?.labelColor==null?void 0:{color:o.labelColor},children:t.v.desc.label??t.v.name}),t.v.dirty?p("button",{type:"button",className:"dirty-dot","data-tip":"changed this session — click to restore the loaded value (autosaves)",onClick:()=>t.v.revert(),children:"●"}):null,t.jumpKey==null?null:p("span",{className:"var-kbd-line","data-tip":t.v.desc.kind==="loras"?"opens the loras picker":"puts the cursor in this prompt",children:w("span",{className:"kbd-hint",children:[Mn,t.jumpKey]})})]}),p("div",{className:"var-control",inert:s!=null,children:p(S6,{v:t.v,host:t.host,st:t.st,module:t.module,jumpTarget:t.jumpKey!=null})})]})});function E6(e){return p("div",{className:"label-resizer",style:{left:e.st.labelWidth+2},"data-tip":"drag to resize the label column",onPointerDown:(t)=>{t.preventDefault();let n=t.clientX,i=e.st.labelWidth,r=(s)=>e.st.setLabelWidth(i+s.clientX-n,!1),o=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",o),e.st.setLabelWidth(e.st.labelWidth,!0)};window.addEventListener("pointermove",r),window.addEventListener("pointerup",o)}})}function C6(e){if(!e.includes("new"))return"new";let t=2;while(e.includes(`new ${t}`))t++;return`new ${t}`}var A6=X(function(t){let n=ro(()=>({mode:null,name:"",start(o,s){this.mode=o,this.name=o==="duplicate"?`${s} copy`:s},set(o){this.name=o},stop(){this.mode=null}})),i=t.st.moduleByKey(t.form.moduleKey)?.drafts??[t.form.draft],r=()=>{let o=n.name.trim(),s=n.mode;if(n.stop(),o===""||s==null)return;if(s==="duplicate")t.st.duplicateDraft(o);else if(s==="new")t.st.newDraft(o);else t.st.renameDraft(o)};return w("div",{className:"head-box",children:[w("span",{className:"head-label",children:["draft",w("span",{className:t.form.saveState==="error"?"save-state error":"save-state",children:[t.form.saveState==="saving"?"· saving":null,t.form.saveState==="saved"?"· saved":null,t.form.saveState==="error"?"· NOT SAVED":null]})]}),n.mode!=null?p("input",{type:"text",autoFocus:!0,className:"head-input",value:n.name,placeholder:n.mode==="rename"?"new name, then enter":n.mode==="new"?"name of the new draft (workflow defaults), then enter":"new draft name, then enter",onFocus:(o)=>o.currentTarget.select(),onChange:(o)=>n.set(o.target.value),onKeyDown:(o)=>{if(o.key==="Enter")r();if(o.key==="Escape")n.stop()},onBlur:()=>n.stop()}):w("span",{className:"head-line draft-line",children:[p("button",{type:"button",className:"head-icon","data-tip":"rename this draft (the file is renamed)",onClick:()=>n.start("rename",t.form.draft),children:p(H,{name:"pen"})}),p("select",{className:"head-select draft",value:t.form.draft,"data-tip":"switch draft",onChange:(o)=>void t.st.select({module:t.form.moduleKey,draft:o.target.value}),children:i.map((o)=>p("option",{value:o,children:o},o))}),p("button",{type:"button",className:"head-icon danger","data-tip":"delete this draft's file (default resets to the workflow's own values)",onClick:()=>{if(window.confirm(`delete draft '${t.form.draft}' of ${t.form.moduleKey}? the file is removed.`))t.st.deleteDraft({module:t.form.moduleKey,draft:t.form.draft})},children:p(H,{name:"trash"})})]}),w("span",{className:"head-line",children:[w("span",{className:"btn-group",children:[w("button",{type:"button",className:"accent","data-tip":"new draft with the workflow's own default values",onClick:()=>n.mode!=null?r():n.start("new",C6(i)),children:[p(H,{name:"plus"})," new"]}),w("button",{type:"button",className:"accent","data-tip":"save these values as a new draft",onClick:()=>n.mode!=null?r():n.start("duplicate",t.form.draft),children:[p(H,{name:"copy-plus"})," copy"]})]}),t.form.dirtyCount>0?p("button",{type:"button",className:"dirty head-right","data-tip":`${t.form.dirtyCount} var${t.form.dirtyCount>1?"s":""} changed this session — revert to the values this draft loaded with`,onClick:()=>t.form.revertAll(),children:p(H,{name:"broom"})}):null]})]})});function m_(e){let t=pO({kind:e.kind,count:e.count});return w("span",{className:e.count>0?"run-chip":"run-chip empty","data-tip":`${t.label}: ${e.tip}`,children:[p(H,{name:e.kind==="queue"?"rows":"image",size:0.95}),p("span",{className:"run-chip-count",children:t.count}),p("button",{type:"button",className:"run-chip-clear","data-tip":e.clearTip,"aria-label":`clear the ${t.label}`,disabled:!e.canClear,onClick:()=>e.onClear(),children:p(H,{name:"close",size:0.8})})]})}var a0=X(function(t){let n=t.st.run,i=e_({isRunning:n.isRunning,percent:n.progressPercent});return w("span",{className:"run-line",children:[w("button",{type:"button",className:i.running?"primary running":"primary","data-tip":i.running?`running ${i.fill??0}%: click again to queue another (⌘⏎ / ctrl+⏎)`:"⌘⏎ / ctrl+⏎: click again to queue another",style:i.fill==null?void 0:{background:`linear-gradient(90deg, var(--accent) ${i.fill}%, var(--accent-dim) ${i.fill}%)`},onClick:()=>t.st.generate(),children:[p(H,{name:"play",size:0.85})," ",i.label,w("span",{className:"kbd-hint",children:[Mn,"⏎"]})]}),p(m_,{kind:"queue",count:n.queue.length,tip:"prompts waiting behind this one",clearTip:`drop the ${n.pendingCount} not yet sent to the host`,canClear:n.pendingCount>0,onClear:()=>n.clearQueue()}),p(m_,{kind:"results",count:n.results.length,tip:"runs kept in this page",clearTip:"forget every run shown here",canClear:n.results.length>0,onClear:()=>n.clear()})]})}),O6=X(function(t){let n=t.st.saveToDisk;return w("div",{className:"var-row",children:[p("div",{className:"var-label",children:p("span",{"data-tip":"save — where this workflow's images go",children:"output"})}),w("div",{className:"var-control",children:[w("div",{className:"row-inline",children:[w("label",{className:"row-inline",style:{cursor:"pointer"},children:[p("input",{type:"checkbox",checked:n,onChange:()=>void t.st.toggleSaveToDisk()}),w("span",{className:"hint",children:[p(H,{name:n?"save":"ghost",size:1})," ",n?"write to disk":"memory only"]})]}),n?w(oe,{children:[p("span",{className:"hint",children:".comfy-ts/outputs/"}),p("input",{type:"text",style:{flex:1,minWidth:120},placeholder:t.module,value:t.st.savePrefixDraft(t.module),"data-tip":"subfolder the images land in — folder names only, a/b allowed",onChange:(i)=>t.st.setSavePrefix(t.module,i.target.value)}),p("span",{className:"hint",children:"/…png"})]}):p("span",{className:"hint",children:"kept in memory and shown here, lost when the server restarts"})]}),t.st.savingError!=null?w("div",{className:"error",children:["\uD83D\uDD34 ",t.st.savingError]}):null]})]})}),g_=X(function(t){let n=t.st.form,i=q({prompt:null,loras:null});if(te(()=>{let u=(c)=>{if(c.key==="Enter"&&(c.metaKey||c.ctrlKey)){c.preventDefault(),t.st.generate(t.st.enhancer.tryOverride);return}let f=gO(c);if(f==null)return;if(t.st.enhancer.isOpen&&f!=="toggle-blur")return;if(c.preventDefault(),f==="toggle-blur")return t.st.toggleBlur();if(f==="open-enhancer"){let h=t.st.form,d=h?.vars.find((m)=>m.name===i.current.prompt);if(h!=null&&d!=null)t.st.enhancer.openFor({v:d,module:h.moduleKey,lane:hr(d.value)?0:void 0});return}t.st.requestJump(f==="focus-prompt"?"prompt":"loras")};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[t.st]),n==null)return null;let r=t.st.orderedVars(n.moduleKey,n.vars.map((u)=>u.name)),o=r.map((u)=>n.vars.find((c)=>c.name===u)).filter((u)=>u!=null),s=t_(o.map((u)=>u.desc.ui??{})),l=vO(o.map((u)=>({name:u.name,kind:u.desc.kind,inactive:n.inactiveReason(u)!=null})));i.current=l;let a=(u)=>u===l.prompt?Ll["focus-prompt"]:u===l.loras?Ll["open-loras"]:null;return w("div",{children:[p("div",{className:"head-shell",children:w("div",{className:"head-boxes",children:[w("div",{className:"head-box",children:[p("span",{className:"head-label",children:"workflow"}),p("div",{className:"head-line",children:p("button",{type:"button",className:"head-value app as-link","data-tip":"search every workflow and draft (⌘K or ⌘J)",onClick:()=>t.st.omnibox.open(),children:n.moduleKey})}),w("div",{className:"head-line",children:[p("span",{className:"btn-group",children:w("button",{type:"button","data-tip":"search every workflow and draft (⌘K or ⌘J)",onClick:()=>t.st.omnibox.open(),children:[p(H,{name:"search"})," search ",w("span",{className:"kbd-hint",children:[Mn,"K"]})]})}),Object.keys(t.st.loadErrors).length>0?w("button",{type:"button",className:"link load-errors","data-tip":"some workflows failed to load: the list is at the bottom of the search",onClick:()=>t.st.omnibox.open(),children:[p(H,{name:"warn"})," ",Object.keys(t.st.loadErrors).length," failed"]}):null]})]}),p(A6,{st:t.st,form:n}),w("div",{className:"head-box",children:[w("span",{className:"head-label",children:["host",t.st.hostWatch==="down"?p("span",{className:"save-state pulse",children:"· restarting…"}):null,t.st.hostWatch==="back"?p("span",{className:"save-state",children:"· back up"}):null]}),w("div",{className:"head-line draft-line",children:[p("button",{type:"button",className:t.st.refreshing?"head-icon pulse":"head-icon","data-tip":t.st.refreshing?"refreshing what the host has…":"refresh what the host has (models, nodes, loras). It also refreshes by itself when something new appears",onClick:()=>void t.st.refreshHost(),children:p(H,{name:"refresh"})}),t.st.hosts.hosts.length>1?p("select",{className:"head-select",value:t.st.hostFor(n.moduleKey),"data-tip":"run this workflow on another host",onChange:(u)=>void t.st.setModuleHost({module:n.moduleKey,host:u.target.value}),children:t.st.hosts.hosts.map((u)=>p("option",{value:u.id,children:u.id===(t.st.hosts.defaults[n.moduleKey]??"")?`${u.id} (its own)`:u.id},u.id))}):p("span",{className:"head-value host",children:t.st.hostFor(n.moduleKey)||n.host}),p("button",{type:"button",className:"head-icon danger","data-tip":"restart ComfyUI on that host (manager reboot) — it reconnects when back",onClick:()=>{if(window.confirm(`restart ComfyUI on '${t.st.hostFor(n.moduleKey)}'?`))t.st.hostAction("restart")},children:p(H,{name:"power"})})]}),w("div",{className:"head-line",children:[p("span",{className:"btn-group",children:w("button",{type:"button","data-tip":"interrupt the prompt running now",onClick:()=>void t.st.hostAction("interrupt"),children:[p(H,{name:"pause"})," stop"]})}),p("span",{className:"btn-group",children:w("button",{type:"button",className:"quiet-danger","data-tip":"drop everything still pending in the host queue",onClick:()=>void t.st.hostAction("clear-queue"),children:[p(H,{name:"trash"})," clear queue"]})}),t.st.isHostOverridden(n.moduleKey)?w("button",{type:"button",className:"link","data-tip":`runs on an override — back to ${t.st.hosts.defaults[n.moduleKey]??"its own host"}`,onClick:()=>void t.st.setModuleHost({module:n.moduleKey,host:null}),children:[p(H,{name:"swap"})," reset"]}):null]})]})]})}),t.st.hostError!=null?w("div",{className:"error",children:["\uD83D\uDD34 ",t.st.hostError]}):null,n.saveState==="error"?w("div",{className:"error",children:["\uD83D\uDD34 draft save failed: ",n.saveError]}):null,w("div",{className:"vars",style:{gridTemplateColumns:`${t.st.labelWidth}px minmax(0, 1fr)`},children:[p(E6,{st:t.st}),o.map((u,c)=>p(k6,{v:u,host:n.host,st:t.st,module:n.moduleKey,index:c,names:r,place:s[c]??null,jumpKey:a(u.name)},`${n.moduleKey}/${n.draft}/${u.name}`)),p(O6,{st:t.st,module:n.moduleKey})]}),t.st.generateInResults?null:w("div",{className:"runbar",children:[p(a0,{st:t.st}),p("span",{className:"run-error","data-tip":t.st.run.error??void 0,children:t.st.run.error==null?"":`\uD83D\uDD34 ${t.st.run.error}`})]})]})});function R6(e){return e.split(/[/\\]/).filter((t)=>t!=="")}function N6(e){return R6(e).slice(0,-1)}function T6(e){let t=e[0];if(t==null)return[];let n=[];for(let i=0;i<t.length;i++){let r=t[i];if(r==null||!e.every((o)=>o[i]===r))break;n.push(r)}return n}function v_(e){if(e.length===0)return[];let t=e.map((o)=>N6(o.file)),n=T6(t),i=Math.max(0,n.length-1),r=new Map;for(let[o,s]of e.entries()){let l=(t[o]??[]).slice(i).join("/"),a=r.get(l);if(a==null)r.set(l,[s]);else a.push(s)}return[...r.entries()].map(([o,s])=>({folder:o,modules:[...s].sort((l,a)=>l.module.localeCompare(a.module))})).sort((o,s)=>o.folder.localeCompare(s.folder))}function y_(e){let t=[];for(let n of v_(e))for(let i of n.modules){let r=i.drafts.length>0?i.drafts:["default"],o=n.folder===""?i.module:`${n.folder}/${i.module}`;for(let s of r)t.push({module:i.module,draft:s,host:i.host,label:`${o}/${s}`})}return t}function M6(e){return e==null||e==="/"||e==="-"||e==="_"||e===" "||e==="."}function _6(e,t,n){let i=0,r=n-1;for(let o of e){let s=t.indexOf(o,r+1);if(s<0)return null;if(i+=1,s===r+1)i+=3;if(M6(t[s-1]))i+=5;i-=(s-r-1)*0.05,r=s}return i}function b_(e,t){let n=e.toLowerCase().replace(/\s+/g,"");if(n==="")return 0;let i=t.toLowerCase(),r=null;for(let o=i.indexOf(n[0]??"");o>=0;o=i.indexOf(n[0]??"",o+1)){let s=_6(n,i,o);if(s!=null&&(r==null||s>r))r=s}return r}function x_(e,t){if(t.trim()==="")return[...e];let n=[];for(let[i,r]of e.entries()){let o=b_(t,r.draft),s=b_(t,r.label),l=Math.max(o==null?-1/0:o+2,s??-1/0);if(l!==-1/0)n.push({entry:r,score:l,ix:i})}return n.sort((i,r)=>r.score-i.score||i.ix-r.ix),n.map((i)=>i.entry)}class u0{st;isOpen=!1;query="";cursor=0;constructor(e){this.st=e;Gn(this,{st:!1})}get results(){return x_(y_(this.st.modules),this.query)}open(){this.isOpen=!0,this.query="";let e=this.st.form,t=e==null?-1:this.results.findIndex((n)=>n.module===e.moduleKey&&n.draft===e.draft);this.cursor=Math.max(0,t)}close(){this.isOpen=!1}toggle(){if(this.isOpen)this.close();else this.open()}setQuery(e){this.query=e,this.cursor=0}move(e){let t=this.results.length;if(t===0)return;this.cursor=(this.cursor+e+t)%t}pick(e=this.results[this.cursor]){if(e==null)return;this.close(),this.st.select({module:e.module,draft:e.draft})}}class S_{name;desc;initial;value;dirty=!1;uploadedUrl=null;constructor(e,t,n){this.name=e;this.desc=t;this.initial=n;this.value=n,Gn(this,{value:wl,name:!1,desc:!1})}set(e){this.value=e,this.dirty=!0}setFromRun(e){this.value=e,this.initial=e,this.dirty=!1}setUploadedUrl(e){this.uploadedUrl=e}revert(){this.value=this.initial,this.dirty=!1,this.uploadedUrl=null}snapshot(){return{name:this.name,value:this.value}}}var c0={autosaveMs:500,previewMs:250};class f0{moduleKey;draft;vars;host;saveState="saved";saveError=null;disposers=[];saveChain=Promise.resolve(!0);lastSaved;lastQueued;queueSeq=0;onSettled=null;previews={};previewError=null;previewAbort=null;constructor(e,t,n,i,r=c0){this.moduleKey=e;this.draft=t;if(this.host=n.host,this.vars=Object.entries(n.vars).map(([s,l])=>new S_(s,l,QC(l,i[s]))),this.intents=KM(i[e0]),this.lastSaved=JSON.stringify(w_(Object.fromEntries(this.vars.map((s)=>[s.name,i[s.name]])),this.intents)),this.lastQueued=this.lastSaved,Gn(this,{vars:!1,moduleKey:!1,draft:!1,host:!1,disposers:!1,saveChain:!1,lastSaved:!1,lastQueued:!1,queueSeq:!1,onSettled:!1,previewAbort:!1}),this.disposers.push(kl(()=>JSON.stringify(this.valuesJSON()),()=>{this.save(),this.onSettled?.()},{delay:r.autosaveMs})),(n.previews??[]).length>0)this.disposers.push(kl(()=>JSON.stringify(this.varValues()),()=>void this.refreshPreviews(),{delay:r.previewMs,fireImmediately:!0}))}async refreshPreviews(){this.previewAbort?.abort();let e=new AbortController;this.previewAbort=e;try{let t=await mC({module:this.moduleKey,values:this.varValues(),signal:e.signal});M(()=>{this.previews=t.previews,this.previewError=null})}catch(t){if(e.signal.aborted)return;M(()=>{this.previewError=t instanceof Error?t.message:String(t)})}}dispose(e={}){for(let t of this.disposers)t();if(this.disposers=[],this.previewAbort?.abort(),e.flush===!1)return;if(JSON.stringify(this.valuesJSON())!==this.lastQueued)this.save()}flushKeepalive(){let e=JSON.stringify(this.valuesJSON());if(e===this.lastQueued)return;this.lastQueued=e,Su({module:this.moduleKey,draft:this.draft,values:JSON.parse(e)},{keepalive:!0}).then(()=>M(()=>{this.lastSaved=e,this.lastQueued=e,this.saveState="saved"}),(t)=>M(()=>{if(this.lastQueued===e)this.lastQueued=this.lastSaved;this.saveState="error",this.saveError=t instanceof Error?t.message:String(t)}))}intents={};intentFor(e){return this.intents[e]}setIntent(e,t){let n={...this.intents};if(t==="")delete n[e];else n[e]=t;this.intents=n}valuesJSON(){return w_(this.varValues(),this.intents)}varValues(){return Object.fromEntries(this.vars.map((e)=>[e.name,e.value]))}queuePayload(){return XC(this.vars.map((e)=>({name:e.name,kind:e.desc.kind,value:e.value})))}inactiveReason(e){let t=e.desc.ui?.activeWhen;if(t==null)return null;for(let[n,i]of Object.entries(t)){let o=this.vars.find((s)=>s.name===n)?.value;if(!i.some((s)=>s===o))return`only used when ${n} is ${i.join(" or ")}`}return null}keywordSource(e){let t=e.desc.keywordsFrom;if(t==null)return null;let n=this.vars.find((r)=>r.name===t);if(n==null)return null;let i=Bh(n.value)?n.value:{};return{source:n,value:i,record:KC(i).record}}loraKeywordGroups(e){let t=this.keywordSource(e);if(t==null)return[];let n=t.source.desc.optionKeywords??{},i=t.source.desc.optionLabels??{},r=new Map(YC(t.value).map((s)=>[s.name,s])),o=[];for(let s of t.source.desc.options??[]){let l=r.get(s);if(l==null)continue;let a=Uv(n[s]??"");if(a.length===0)continue;let u=zh(l.setting);o.push({lora:s,label:i[s]??s,running:l.running,parts:a.map((c)=>({text:c,on:!u.includes(c)}))})}return o}loraKeywordsFor(e){let t=[];for(let n of this.loraKeywordGroups(e)){if(!n.running)continue;let i=n.parts.filter((r)=>r.on).map((r)=>r.text).join(", ");if(i!==""&&!t.includes(i))t.push(i)}return t}injectedTagsFor(e){return this.loraKeywordGroups(e).filter((t)=>t.running).flatMap((t)=>t.parts.filter((n)=>n.on).map((n)=>({tag:n.text,source:t.label})))}loraWordsFor(e){let t=e.desc.keywordsFrom,n=t==null?null:this.vars.find((o)=>o.name===t);if(n==null)return[];let i=n.desc.optionKeywords??{},r=n.desc.optionLabels??{};return Object.entries(i).flatMap(([o,s])=>Uv(s).map((l)=>({word:l,source:r[o]??o})))}toggleKeywordPart(e,t,n){let i=this.keywordSource(e);if(i==null)return;let r=zh(Fv(i.value,t));this.setKeywordMute(e,t,r.includes(n)?r.filter((o)=>o!==n):[...r,n])}setKeywordMute(e,t,n){let i=this.keywordSource(e);if(i==null)return;i.source.set(GC(i.value,t,Cu(Fv(i.value,t),{mute:n})))}get dirtyCount(){return this.vars.filter((e)=>e.dirty).length}save(){let e=JSON.stringify(this.valuesJSON());if(e===this.lastQueued)return this.lastSaved===e?Promise.resolve(!0):this.saveChain;this.lastQueued=e;let t=++this.queueSeq;return M(()=>{this.saveState="saving"}),this.saveChain=this.saveChain.then(async()=>{try{return await Su({module:this.moduleKey,draft:this.draft,values:JSON.parse(e)}),M(()=>{this.lastSaved=e,this.saveState="saved",this.saveError=null}),!0}catch(n){return M(()=>{if(this.queueSeq===t)this.lastQueued=this.lastSaved;this.saveChain=Promise.resolve(!0),this.saveState="error",this.saveError=n instanceof Error?n.message:String(n)}),!1}}),this.saveChain}revertAll(){for(let e of this.vars)e.revert()}}function w_(e,t){return Object.keys(t).length===0?e:{...e,[e0]:t}}function k_(e){try{let t=new URLSearchParams(e.startsWith("?")?e.slice(1):e),n=t.get("workflow"),i=t.get("draft");return{module:n===""?null:n,draft:i===""?null:i}}catch{return{module:null,draft:null}}}function E_(e){let t=new URLSearchParams(e.search.startsWith("?")?e.search.slice(1):e.search);t.set("workflow",e.module),t.set("draft",e.draft);let n=t.toString();return n===""?"":`?${n}`}function C_(e){let t=(o)=>o==null?null:e.modules.find((s)=>s.module===o)??null,n=t(e.url.module)??t(e.stored.module)??e.modules[0];if(n==null)return null;let i=e.url.module!=null&&e.url.module===n.module?e.url.draft:e.stored.draft,r=i!=null&&n.drafts.includes(i)?i:"default";return{module:n.module,draft:r}}function D6(e){return new Promise((t)=>setTimeout(t,e))}class h0{queue=[];error=null;results=[];progressPercent=null;progressNode=null;progressCount=null;progressText=null;hasPreview=!1;previewTick=0;draining=!1;nextId=0;pollGen=0;onSeeds=null;constructor(){Gn(this,{queue:gu,results:gu})}get isRunning(){return this.queue.some((e)=>e.sent)}get runningModule(){return this.queue.find((e)=>e.sent)?.module??null}get pendingCount(){return this.queue.filter((e)=>!e.sent).length}enqueue(e){if(this.queue=[...this.queue,{id:`q${this.nextId++}`,...e,sent:!1}],this.error=null,!this.draining)this.drain()}removeQueued(e){this.queue=this.queue.filter((t)=>t.id!==e||t.sent)}clearQueue(){this.queue=this.queue.filter((e)=>e.sent)}remove(e){this.results=this.results.filter((t)=>t.promptId!==e)}clear(){this.results=[]}async drain(){if(this.draining)return;this.draining=!0;try{while(!0){let e=this.queue.find((n)=>!n.sent);if(e==null)return;M(()=>{this.queue=this.queue.map((n)=>n.id===e.id?{...n,sent:!0}:n),this.progressPercent=null,this.progressNode=null,this.progressCount=null,this.progressText=null,this.hasPreview=!1});let t=++this.pollGen;this.poll(e.module,t);try{let n=await pC(e);M(()=>{this.results=[{...n,at:new Date().toLocaleTimeString()},...this.results].slice(0,20)}),this.onSeeds?.({module:e.module,draft:e.draft,seeds:n.seeds})}catch(n){M(()=>{this.error=n instanceof Error?n.message:String(n),this.queue=this.queue.filter((i)=>i.sent&&i.id!==e.id)})}finally{this.pollGen++,M(()=>{this.queue=this.queue.filter((n)=>n.id!==e.id),this.progressPercent=null,this.progressNode=null,this.progressCount=null,this.progressText=null,this.hasPreview=!1})}}}finally{this.draining=!1}}async poll(e,t){while(t===this.pollGen){if(await D6(700),t!==this.pollGen)return;try{let n=await gC({module:e});M(()=>{if(t!==this.pollGen)return;this.progressPercent=n.percent,this.progressNode=n.node??null,this.progressCount=n.nodeProgress??null,this.progressText=n.progressText??null,this.hasPreview=n.hasPreview,this.previewTick=n.previewSeq??0})}catch{}}}}function d0(e){return e!=null&&typeof e==="object"}function rp(e){return d0(e)&&!Array.isArray(e)}function A_(e){if(!d0(e))return null;switch(e.comfyTs){case"set-prompt":return typeof e.text==="string"?{comfyTs:"set-prompt",text:e.text}:null;case"host-actions":{if(!Array.isArray(e.actions))return null;let t=[];for(let n of e.actions){if(!d0(n)||typeof n.id!=="string"||n.id===""||typeof n.label!=="string")continue;if(n.label===""||t.some((i)=>i.id===n.id))continue;t.push({id:n.id,label:n.label,...typeof n.title==="string"?{title:n.title}:{}})}return{comfyTs:"host-actions",actions:t}}case"set-selection":return typeof e.module==="string"&&e.module!==""&&typeof e.draft==="string"?{comfyTs:"set-selection",module:e.module,draft:e.draft}:null;case"set-values":return rp(e.values)?{comfyTs:"set-values",values:e.values}:null;case"get-state":return{comfyTs:"get-state"};default:return null}}function O_(e){let t=e.modules.find((n)=>n.module===e.want.module);if(t==null)return null;return{module:t.module,draft:t.drafts.includes(e.want.draft)?e.want.draft:"default"}}var Hn={ok:!1},L6=["=","+","-","?"];function zi(e){return typeof e==="number"&&Number.isFinite(e)}function z6(e){if(typeof e==="boolean"||zi(e))return!0;return Array.isArray(e)&&e.length===2&&zi(e[0])&&zi(e[1])}function p0(e,t,n){switch(e.kind){case"prompt":case"text":case"image":return typeof t==="string"?{ok:!0,value:t}:Hn;case"int":return zi(t)?{ok:!0,value:Math.trunc(t)}:Hn;case"float":return zi(t)?{ok:!0,value:t}:Hn;case"toggle":return typeof t==="boolean"?{ok:!0,value:t}:Hn;case"choice":{let i=PC({select:e.select??"one",choices:e.choices??[],raw:t});return i.ok?{ok:!0,value:i.value}:Hn}case"seed":{let i=ns(n);if(zi(t))return{ok:!0,value:{mode:i.mode,value:Math.max(0,Math.floor(t))}};if(!rp(t))return Hn;if(t.mode!==void 0&&!(typeof t.mode==="string"&&L6.includes(t.mode)))return Hn;if(t.value!==void 0&&!zi(t.value))return Hn;return{ok:!0,value:{mode:typeof t.mode==="string"?t.mode:i.mode,value:zi(t.value)?Math.max(0,Math.floor(t.value)):i.value}}}case"size":{let i=null,r=null;if(typeof t==="string"){let o=/^\s*(\d+)\s*x\s*(\d+)\s*$/i.exec(t);if(o!=null)i=Number(o[1]),r=Number(o[2])}else if(rp(t))i=t.width,r=t.height;if(!zi(i)||!zi(r)||i<1||r<1)return Hn;return{ok:!0,value:{width:Math.floor(i),height:Math.floor(r)}}}case"loras":{if(!rp(t))return Hn;for(let i of Object.values(t))if(!z6(i))return Hn;return{ok:!0,value:Ml(t,e.options??[])}}default:return Hn}}function R_(e){return e.find((t)=>t.desc.kind==="prompt")??e.find((t)=>(t.desc.kind==="text"||t.desc.kind==="prompt")&&/prompt/i.test(t.name)&&!/neg/i.test(t.name))??null}function N_(e,t){if(t==null)return e.comfyTs==="ready"||e.comfyTs==="selection"||e.comfyTs==="error"&&e.code==="boot"?"*":null;return t==="null"?"*":t}function m0(e){try{let t=JSON.stringify(e,(n,i)=>typeof i==="bigint"?`${i}n`:i);if(typeof e==="bigint")return`${e}n`;return t??String(e)}catch{try{return String(e)}catch{return"[unprintable]"}}}function T_(e){try{let n=new URLSearchParams(e.startsWith("?")?e.slice(1):e).get("prompt");return n==null||n===""?null:n}catch{return null}}function g0(){try{return typeof window<"u"&&window.parent!==window}catch{return!1}}var B_="comfy-ts-serve-ui",v0="side",P_=[{id:"off",icon:"panel-off",title:"no preview: the form only"},{id:"bottom",icon:"panel-bottom",title:"results below the form"},{id:"left",icon:"panel-left",title:"results left of the form"},{id:"side",icon:"panel-side",title:"results right of the form"},{id:"pinned",icon:"panel-corner",title:"newest image in the bottom right corner, form scrolls under it"}];function B6(e){return e==="off"||e==="bottom"||e==="left"||e==="side"||e==="pinned"}var I_=200,P6=60;function M_(e){let t=typeof e==="number"&&Number.isFinite(e)?e:1;return Math.min(2,Math.max(0.6,Math.round(t*20)/20))}var V_=320;function __(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.round(e):V_;return Math.min(640,Math.max(120,t))}var H_=120;function D_(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.round(e):H_;return Math.min(360,Math.max(60,t))}function L_(e){let t=typeof e==="number"&&Number.isFinite(e)?Math.floor(e):I_;return Math.min(2000,Math.max(1,t))}function z_(e){if(e==null||typeof e!=="object"||Array.isArray(e))return{};let t={};for(let[n,i]of Object.entries(e))if(Array.isArray(i))t[n]=i.filter((r)=>typeof r==="string");return t}function b0(){try{let e=JSON.parse(localStorage.getItem(B_)??"{}")??{};return{...e,varOrder:z_(e.varOrder),sizeStars:z_(e.sizeStars)}}catch{return{}}}class y0{formTiming;phase="loading";bootError="";modules=[];loadErrors={};form=null;formLoading=!1;formError=null;showLoraImages;showLoraTitles;loraFill;showLoraTriggers;loraScale;loraSort;loraCap;run;enhancer;omnibox;settings={saveToDisk:!0,hostOverride:{},savePrefix:{},effectivePrefix:{}};savingError=null;prefixEdits={};prefixTimers=new Map;get saveToDisk(){return this.settings.saveToDisk}layout;lastShownLayout=v0;varOrder={};sizeStars={};labelWidth=H_;orderedVars(e,t){let n=this.varOrder[e];if(n==null)return[...t];let i=new Set(t),r=n.filter((o)=>i.has(o));return[...r,...t.filter((o)=>!r.includes(o))]}moveVar(e){let t=this.orderedVars(e.module,e.names),[n]=t.splice(e.from,1);if(n==null)return;t.splice(e.to,0,n),this.varOrder={...this.varOrder,[e.module]:t},this.persist()}hosts={hosts:[],defaults:{},overrides:{}};hostError=null;hostActions=[];hostOrigin=null;lastPostedState=null;switches=new Set;hostChain=Promise.resolve();constructor(e=c0){this.formTiming=e;this.run=new h0,this.run.onSeeds=(n)=>this.applyRunSeeds(n),this.enhancer=new i0(()=>this.form),this.omnibox=new u0(this);let t=b0();if(this.layout=B6(t.layout)?t.layout:v0,this.showLoraImages=t.loraImages??!0,this.showLoraTitles=t.loraTitles??!0,this.loraFill=t.loraFill??!0,this.showLoraTriggers=t.loraTriggers??!1,this.loraScale=M_(t.loraScale),this.loraSort=r_(t.loraSort),this.loraCap=L_(t.loraCapMigrated!==!0&&t.loraCap===P6?I_:t.loraCap),this.latentMode=fA(t.latent),this.blurResults=t.blur??!1,this.resultsView=t.resultsView==="grid"?"grid":"fit",this.resultsSize=__(t.resultsSize),this.expandedPreviews=Array.isArray(t.expandedPreviews)?t.expandedPreviews.filter((n)=>typeof n==="string"):[],this.varOrder=t.varOrder??{},this.sizeStars=t.sizeStars??{},this.labelWidth=D_(t.labelWidth),this.showLogs=t.logs??!1,Gn(this,{run:!1,enhancer:!1,omnibox:!1,form:wl,modules:gu,hostOrigin:!1,hostChain:!1,lastPostedState:!1,switches:!1,formTiming:!1}),g0())window.addEventListener("message",(n)=>this.onHostMessage(n));window.addEventListener("beforeunload",()=>this.form?.flushKeepalive()),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")this.form?.save()}),this.hostChain=this.boot().catch((n)=>Gt("panel boot failed",n))}setLabelWidth(e,t){if(this.labelWidth=D_(e),t)this.persist()}setSizeStars(e,t){this.sizeStars[e]=t,this.persist()}setLoraScale(e){this.loraScale=M_(e),this.persist()}toggleLoraTriggers(){this.showLoraTriggers=!this.showLoraTriggers,this.persist()}toggleLoraImages(){this.showLoraImages=!this.showLoraImages,this.persist()}toggleLoraTitles(){this.showLoraTitles=!this.showLoraTitles,this.persist()}setLoraSort(e){this.loraSort=e,this.persist()}toggleLoraFill(){this.loraFill=!this.loraFill,this.persist()}setLoraCap(e){this.loraCap=L_(e),this.persist()}applyRunSeeds(e){let t=this.form;if(t==null||t.moduleKey!==e.module||t.draft!==e.draft)return;M(()=>{for(let n of t.vars){if(n.desc.kind!=="seed")continue;let i=e.seeds[n.name];if(typeof i!=="number"||!Number.isFinite(i))continue;let r=ns(n.value);if(r.value===i)continue;n.setFromRun({mode:r.mode,value:i})}}),this.mirrorState()}syncUrl(){let e=this.form;if(e==null)return;try{let t=E_({search:window.location.search,module:e.moduleKey,draft:e.draft});window.history.replaceState(null,"",`${window.location.pathname}${t}${window.location.hash}`)}catch(t){Gt("could not put the selection in the url",t)}}persist(){try{let e=b0();localStorage.setItem(B_,JSON.stringify({...e,...this.form!=null?{module:this.form.moduleKey,draft:this.form.draft}:{},loraImages:this.showLoraImages,loraTitles:this.showLoraTitles,loraFill:this.loraFill,loraTriggers:this.showLoraTriggers,loraScale:this.loraScale,loraSort:this.loraSort,loraCap:this.loraCap,loraCapMigrated:!0,layout:this.layout,latent:this.latentMode,blur:this.blurResults,resultsView:this.resultsView,resultsSize:this.resultsSize,expandedPreviews:this.expandedPreviews,logs:this.showLogs,varOrder:this.varOrder,sizeStars:this.sizeStars,labelWidth:this.labelWidth}))}catch(e){Gt("ui state could not be stored (it will not survive a reload)",e)}}moduleByKey(e){return this.modules.find((t)=>t.module===e)??null}async boot(){try{let e=await zv();M(()=>{this.modules=e.workflows,this.loadErrors=e.loadErrors??{},this.phase="ready"}),this.loadSettings(),this.loadHosts();let t=b0(),n=C_({url:k_(window.location.search),stored:{module:t.module??null,draft:t.draft??null},modules:this.modules});if(n==null){this.postHost({comfyTs:"error",code:"boot",message:"no workflows are served"});return}if(await this.select(n),this.form==null){this.postHost({comfyTs:"error",code:"boot",message:`the opening draft could not be read: ${this.formError??"unknown error"}`});return}let i=T_(window.location.search);if(i!=null)this.setPromptText(i);this.postHost({comfyTs:"ready"}),this.startDriftWatch()}catch(e){let t=e instanceof Error?e.message:String(e);M(()=>{this.phase="error",this.bootError=t}),this.postHost({comfyTs:"error",code:"boot",message:t})}}selectToken=0;select(e,t={}){return this.trackSwitch(this.selectNow(e,t.mirror??!0))}trackSwitch(e){this.switches.add(e);let t=()=>void this.switches.delete(e);return e.then(t,t),e}async switchSettled(){while(this.switches.size>0)await Promise.allSettled(this.switches)}async selectNow(e,t){let n=this.moduleByKey(e.module);if(n==null)return;if(this.form?.moduleKey===e.module&&this.form.draft===e.draft)return;let i=++this.selectToken;M(()=>{this.enhancer.close(),this.formLoading=!0,this.formError=null});let r=this.form;if(r!=null){if(r.dispose(),M(()=>{this.form=null}),!await r.save())M(()=>{this.formError=`the previous draft could not be saved: ${r.saveError??"unknown error"}`})}try{let o=await dC(e);if(i!==this.selectToken)return;let s=new f0(e.module,e.draft,n,o.values??{},this.formTiming);if(s.onSettled=()=>this.mirrorState(),M(()=>{this.form=s,this.persist(),this.syncUrl()}),this.postHost({comfyTs:"selection",module:s.moduleKey,draft:s.draft}),t)this.mirrorState()}catch(o){M(()=>{if(i!==this.selectToken)return;this.form=null,this.formError=o instanceof Error?o.message:String(o)})}finally{M(()=>{if(i===this.selectToken)this.formLoading=!1})}}promptVar(){return R_(this.form?.vars??[])}setPromptText(e){let t=this.promptVar();if(t==null)return;let n=p0(t.desc,e,t.value);if(!n.ok){Gt("host set-prompt",`'${t.name}' (${t.desc.kind}) rejected the text`);return}M(()=>t.set(n.value))}postHost(e){if(!g0())return;let t=N_(e,this.hostOrigin);if(t==null)return;try{window.parent.postMessage(e,t)}catch(n){Gt("could not post to the host page",n)}}setValues(e){let t=this.form;if(t==null)return Object.keys(e);let n=[];return M(()=>{for(let[i,r]of Object.entries(e)){let o=t.vars.find((l)=>l.name===i);if(o==null){n.push(i),Gt("host set-values",`no var named '${i}' on ${t.moduleKey}`);continue}let s=p0(o.desc,r,o.value);if(s.ok)o.set(s.value);else n.push(i),Gt("host set-values",`'${i}' (${o.desc.kind}) rejected ${m0(r)}`)}}),n}stateOf(e){let t=e.varValues();return{key:m0([e.moduleKey,e.draft,t]),values:t}}replyState(e,t,n){let{key:i,values:r}=this.stateOf(e);this.lastPostedState=i,this.postHost({comfyTs:"state",module:e.moduleKey,draft:e.draft,values:r,request:t,...n!=null?{rejected:n}:{}})}mirrorState(){let e=this.form;if(e==null||this.hostOrigin==null)return;let{key:t,values:n}=this.stateOf(e);if(t===this.lastPostedState)return;this.lastPostedState=t,this.postHost({comfyTs:"state",module:e.moduleKey,draft:e.draft,values:n})}replyError(e,t,n){this.postHost({comfyTs:"error",code:t,message:n,request:e})}onHostMessage(e){if(e.source!==window.parent)return;let t=A_(e.data);if(t==null)return;if(this.hostOrigin==null)this.hostOrigin=e.origin;else if(e.origin!==this.hostOrigin)return;this.hostChain=this.hostChain.then(()=>this.applyHostMessage(t)).catch((n)=>Gt(`host message '${t.comfyTs}' failed`,n))}async applyHostMessage(e){try{await this.applyHostMessageNow(e)}catch(t){if(e.comfyTs==="set-selection"||e.comfyTs==="set-values"||e.comfyTs==="get-state")this.replyError(e.comfyTs,"no-form",t instanceof Error?t.message:String(t));throw t}}async applyHostMessageNow(e){switch(e.comfyTs){case"host-actions":M(()=>{this.hostActions=e.actions});return;case"set-prompt":await this.switchSettled(),this.setPromptText(e.text);return;case"set-selection":{await this.switchSettled();let t=O_({want:e,modules:this.modules});if(t==null){this.replyError("set-selection","unknown-module",`no workflow named '${e.module}' is served`);return}let n=this.form;if(n==null||n.moduleKey!==t.module||n.draft!==t.draft)await this.select(t,{mirror:!1}),await this.switchSettled();let i=this.form;if(i==null){let r=this.formError??"the draft could not be read";this.replyError("set-selection","select-failed",r)}else if(i.moduleKey!==t.module||i.draft!==t.draft)this.replyError("set-selection","superseded",`the panel switched to ${i.moduleKey}/${i.draft} while ${t.module}/${t.draft} was loading`);else this.replyState(i,"set-selection");return}case"set-values":{await this.switchSettled();let t=this.form;if(t==null){this.replyError("set-values","no-form",this.noFormMessage());return}this.replyState(t,"set-values",this.setValues(e.values));return}case"get-state":{await this.switchSettled();let t=this.form;if(t==null)this.replyError("get-state","no-form",this.noFormMessage());else this.replyState(t,"get-state");return}}}noFormMessage(){return this.formError!=null?`no draft is open: ${this.formError}`:"no draft is open"}postResultAction(e,t,n,i){let r=this.promptVar();this.postHost({comfyTs:"result-action",id:e,promptId:t.promptId,ix:i,url:n.url,filename:n.filename,module:t.module,draft:t.draft,seeds:t.seeds,prompt:r!=null&&typeof r.value==="string"?r.value:null})}get generateInResults(){return this.layout==="side"||this.layout==="left"||this.layout==="pinned"}setLayout(e){if(this.layout!=="off")this.lastShownLayout=this.layout;this.layout=e,this.persist()}showPreview(){this.setLayout(this.lastShownLayout==="off"?v0:this.lastShownLayout)}hostFor(e){return this.hosts.overrides[e]??this.hosts.defaults[e]??""}hostUrlFor(e){let t=this.hostFor(e);return this.hosts.hosts.find((n)=>n.id===t)?.httpUrl??null}isHostOverridden(e){return this.hosts.overrides[e]!=null}async loadHosts(){try{let e=await xC();M(()=>{this.hosts=e})}catch(e){Gt("could not read the host list",e)}}showLogs=!1;logLines=[];logsError=null;latentMode="corner";blurResults=!1;jump=null;requestJump(e){this.jump={kind:e,seq:(this.jump?.seq??0)+1}}resultsView="fit";resultsSize=V_;expandedPreviews=[];logsTimer=null;setLatentMode(e){this.latentMode=e,this.persist()}togglePreviewExpanded(e){this.expandedPreviews=this.expandedPreviews.includes(e)?this.expandedPreviews.filter((t)=>t!==e):[...this.expandedPreviews,e],this.persist()}setResultsView(e){this.resultsView=e,this.persist()}setResultsSize(e){this.resultsSize=__(e),this.persist()}toggleBlur(){this.blurResults=!this.blurResults,this.persist()}toggleLogs(){if(this.showLogs=!this.showLogs,this.persist(),this.logsTimer!=null)clearInterval(this.logsTimer);if(this.logsTimer=null,!this.showLogs)return;this.pullLogs(),this.logsTimer=setInterval(()=>void this.pullLogs(),3000)}async pullLogs(){let e=this.form==null?null:this.hostFor(this.form.moduleKey);if(e==null||e==="")return;try{let t=await CC({host:e});M(()=>{this.logLines=t.lines,this.logsError=null})}catch(t){M(()=>{this.logsError=t instanceof Error?t.message:String(t)})}}refreshing=!1;async refreshHost(){if(this.refreshing)return;M(()=>{this.refreshing=!0});try{await this.hostAction("refresh-schema"),await this.trackSwitch(this.reloadIndexAndForm())}finally{M(()=>{this.refreshing=!1})}}driftDown=!1;startDriftWatch(){this.checkDrift(!0),setInterval(()=>{if(document.visibilityState==="visible")this.checkDrift(!1)},15000)}async checkDrift(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t===""||this.refreshing)return;try{let n=await kC({host:t,full:e}),i=this.driftDown;if(M(()=>{this.driftDown=!1}),n.changed)await this.refreshHost();else if(i&&!e)await this.checkDrift(!0)}catch{M(()=>{this.driftDown=!0})}}loraFetching=new Set;async fetchLoraTriggers(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t===""||this.loraFetching.has(e))return;M(()=>{this.loraFetching.add(e),this.hostError=null});try{await EC({host:t,lora:e}),await this.trackSwitch(this.reloadIndexAndForm())}catch(n){M(()=>{this.hostError=n instanceof Error?n.message:String(n)})}finally{M(()=>{this.loraFetching.delete(e)})}}async reloadIndexAndForm(){try{let e=await zv(),t=this.form;if(M(()=>{this.modules=e.workflows}),t!=null)t.dispose(),await t.save(),M(()=>{this.form=null}),await this.select({module:t.moduleKey,draft:t.draft})}catch(e){M(()=>{this.hostError=e instanceof Error?e.message:String(e)})}}hostWatch="idle";async watchHostComeBack(){let e=this.form==null?null:this.hostFor(this.form.moduleKey);if(e==null||e==="")return;M(()=>{this.hostWatch="down"});let t=Date.now()+120000;for(;;){if(await new Promise((i)=>setTimeout(i,2500)),Date.now()>t){M(()=>{this.hostWatch="idle",this.hostError=`${e} has not answered for 2 minutes — check the console`});return}if(!await wC({host:e}).then((i)=>i.up).catch(()=>!1))continue;M(()=>{this.hostWatch="back"}),this.checkDrift(!0),setTimeout(()=>M(()=>this.hostWatch="idle"),4000);return}}async hostAction(e){let t=this.form==null?null:this.hostFor(this.form.moduleKey);if(t==null||t==="")return;M(()=>{this.hostError=null});try{if(await SC({host:t,action:e}),e==="restart")this.watchHostComeBack()}catch(n){M(()=>{this.hostError=n instanceof Error?n.message:String(n)})}}async setModuleHost(e){M(()=>{this.hostError=null});try{let t=await AC(e);M(()=>{this.hosts={...this.hosts,overrides:t.overrides}})}catch(t){M(()=>{this.hostError=t instanceof Error?t.message:String(t)})}}async loadSettings(){try{let e=await bC();M(()=>{this.settings=e})}catch(e){Gt("could not read the serve settings",e)}}savePrefixDraft(e){return this.prefixEdits[e]??this.settings.savePrefix[e]??""}setSavePrefix(e,t){this.prefixEdits[e]=t,this.savingError=null;let n=this.prefixTimers.get(e);if(n!=null)clearTimeout(n);this.prefixTimers.set(e,setTimeout(()=>{this.pushSettings({savePrefix:{[e]:t}})},500))}async pushSettings(e){try{let t=await yC(e);return M(()=>{this.settings=t,this.savingError=null}),!0}catch(t){return M(()=>{this.savingError=t instanceof Error?t.message:String(t)}),!1}}async toggleSaveToDisk(){let e=!this.saveToDisk,t=this.settings;if(M(()=>{this.settings={...this.settings,saveToDisk:e},this.savingError=null}),!await this.pushSettings({saveToDisk:e}))M(()=>{this.settings=t})}generate(e){this.generateNow(e)}async generateNow(e){let t=this.form;if(t==null)return;let n={...t.queuePayload(),...e};if(!await t.save())return;this.run.enqueue({module:t.moduleKey,draft:t.draft,payload:n}),this.recordPrompts(t,n)}promptHistory=[];recordPrompts(e,t){let n=Date.now();for(let i of e.vars){let r=t[i.name];if(i.desc.kind!=="prompt"||!VC(r))continue;let o=typeof r==="string"?r:jC(r);this.promptHistory=ep(this.promptHistory,{text:o,value:r,at:n,source:`${e.moduleKey} · ${i.desc.label??i.name}`})}}async renameDraft(e){let t=this.form,n=e.trim();if(t==null||n===""||n===t.draft)return;let i=t.draft;if(await this.duplicateDraft(n),this.form?.draft!==n)return;await Bv({module:t.moduleKey,draft:i}).then((r)=>M(()=>{this.modules=this.modules.map((o)=>o.module===t.moduleKey?{...o,drafts:r.drafts}:o)}),(r)=>M(()=>{this.formError=`renamed to '${n}', but the old draft '${i}' could not be removed: ${r instanceof Error?r.message:String(r)}`}))}deleteDraft(e){return this.trackSwitch(this.deleteDraftNow(e))}async deleteDraftNow(e){let t=this.form;if(t!=null&&t.moduleKey===e.module&&t.draft===e.draft)t.dispose({flush:!1}),M(()=>{this.form=null});try{let n=await Bv(e);M(()=>{this.modules=this.modules.map((r)=>r.module===e.module?{...r,drafts:n.drafts}:r)});let i=n.drafts.includes("default")?"default":n.drafts[0]??"default";await this.select({module:e.module,draft:i})}catch(n){M(()=>{this.formError=n instanceof Error?n.message:String(n)})}}async duplicateDraft(e){let t=this.form;if(t==null)return;await this.createDraft(e,t.valuesJSON())}async newDraft(e){let t=this.form,n=t==null?null:this.moduleByKey(t.moduleKey);if(n==null)return;let i={};for(let[r,o]of Object.entries(n.vars))i[r]=o.default;await this.createDraft(e,i)}async createDraft(e,t){let n=this.form,i=e.trim();if(n==null||i==="")return;if(this.moduleByKey(n.moduleKey)?.drafts.includes(i)===!0&&!window.confirm(`draft '${i}' already exists — overwrite it?`))return;try{let o=await Su({module:n.moduleKey,draft:i,values:t});M(()=>{this.modules=this.modules.map((s)=>s.module===n.moduleKey?{...s,drafts:o.drafts}:s)}),await this.select({module:n.moduleKey,draft:i})}catch(o){M(()=>{this.formError=o instanceof Error?o.message:String(o)})}}}function I6(){te(()=>{let e=(t)=>{if(t.key!=="a"&&t.key!=="A")return;if(!t.metaKey&&!t.ctrlKey)return;if(t.altKey)return;let n=document.activeElement;if(!(n instanceof HTMLInputElement?n.type==="text"||n.type==="search"||n.type==="password"||n.type==="url":n instanceof HTMLTextAreaElement))return;t.preventDefault(),n.select()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[])}var V6=X(function(t){let n=t.st.form,i=n==null?[]:t.st.moduleByKey(n.moduleKey)?.previews??[];if(n==null||i.length===0)return null;return p("div",{className:"live-previews",children:i.map((r)=>{let o=`${n.moduleKey}/${r}`,s=t.st.expandedPreviews.includes(o),l=n.previews[r]??"…",a=l.split(`
54
+ `).filter((c)=>c.trim()!==""),u=mO(l);return w("button",{type:"button",className:s?"live-preview expanded":"live-preview","data-tip":s?"click to show one line each":"click for the full text",onClick:()=>t.st.togglePreviewExpanded(o),children:[w("span",{className:"live-preview-name",children:[r,n.previewError==null?null:p("span",{className:"live-preview-error","data-tip":`preview failed: ${n.previewError}`,children:"\uD83D\uDD34"})]}),w("span",{className:"live-preview-lines",children:[!s?w(oe,{children:[p("span",{className:"live-preview-line",children:u.positive}),p("span",{className:"live-preview-line negative",children:u.negative===""?"":`− ${u.negative}`})]}):null,s&&a.map((c,f)=>c.startsWith("- ")?w("span",{className:"live-preview-line negative",children:["− ",c.slice(2)]},f):p("span",{className:"live-preview-line",children:c},f))]})]},r)})})}),H6={full:"image",corner:"panel-corner",off:"panel-off"},U6=X(function(t){return w("div",{className:"results-head",children:[w("div",{className:"head-group-labeled",children:[p("span",{className:"group-caption",children:"preview"}),p("span",{className:"btn-group",children:P_.map((n)=>p("button",{type:"button",className:t.st.layout===n.id?"sel":"","data-tip":n.title,onClick:()=>t.st.setLayout(n.id),children:p(H,{name:n.icon})},n.id))})]}),w("div",{className:"head-group-labeled",children:[p("span",{className:"group-caption",children:"while running"}),w("span",{className:"row-inline head-row",children:[p("span",{className:"btn-group",children:cA.map((n)=>p("button",{type:"button",className:t.st.latentMode===n.mode?"sel":"","data-tip":n.tip,onClick:()=>t.st.setLatentMode(n.mode),children:p(H,{name:H6[n.mode]})},n.mode))}),p("span",{className:"btn-group",children:p("button",{type:"button",className:t.st.showLogs?"sel":"","data-tip":t.st.showLogs?"hide the ComfyUI console":"show the ComfyUI console",onClick:()=>t.st.toggleLogs(),children:p(H,{name:"terminal"})})})]})]}),w("div",{className:"head-group-labeled",children:[p("span",{className:"group-caption",children:"results"}),w("span",{className:"row-inline results-view",children:[w("span",{className:"btn-group",children:[p("button",{type:"button",className:t.st.resultsView==="fit"?"sel":"","data-tip":"fit: one image per row, as wide as this panel",onClick:()=>t.st.setResultsView("fit"),children:p(H,{name:"rows"})}),p("button",{type:"button",className:t.st.resultsView==="grid"?"sel":"","data-tip":"grid: images at the size you set, as many per row as fit",onClick:()=>t.st.setResultsView("grid"),children:p(H,{name:"grid"})})]}),p("input",{type:"range",className:"setting-range",min:120,max:640,step:20,disabled:t.st.resultsView!=="grid",value:t.st.resultsSize,"data-tip":t.st.resultsView==="grid"?`image size ${t.st.resultsSize}px`:"image size, for the grid view",onChange:(n)=>t.st.setResultsSize(Number(n.target.value))})]})]}),w("div",{className:"head-group-labeled",children:[w("span",{className:"group-caption",children:["blur ",w("span",{className:"kbd-hint",children:[Mn,"B"]})]}),p("span",{className:"btn-group",children:p("button",{type:"button",className:t.st.blurResults?"sel":"","data-tip":t.st.blurResults?`blurred until you hover: click (or ${Mn}B) for always clear`:`always clear: click (or ${Mn}B) to blur until you hover`,onClick:()=>t.st.toggleBlur(),children:p(H,{name:t.st.blurResults?"eye-off":"eye"})})})]})]})}),j6=760;function F6(){let e=`(max-width: ${j6}px)`,[t,n]=Q(()=>window.matchMedia(e).matches);return te(()=>{let i=window.matchMedia(e),r=()=>n(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),t}var K6={getItem:(e)=>{try{return localStorage.getItem(e)}catch{return null}},setItem:(e,t)=>{try{localStorage.setItem(e,t)}catch{}}},q6=X(function(t){let n=t.left?"comfy-ts-split-left":"comfy-ts-split-right",i=hC({id:n,storage:K6}),r=p(_h,{id:"form",minSize:"30%",className:"split-panel split-form",children:t.form}),o=p(_h,{id:"results",defaultSize:"34%",minSize:"16%",className:"split-panel split-results",children:t.results});return w(Dv,{id:n,orientation:"horizontal",className:`work split split-${t.left?"left":"right"}`,defaultLayout:i.defaultLayout,onLayoutChanged:i.onLayoutChanged,children:[t.left?o:r,p(Lv,{className:"split-handle"}),t.left?r:o]},n)}),U_=X(function(t){let n=F6();if(I6(),hA(t.st),t.st.phase==="loading")return p("div",{className:"center",children:"loading…"});if(t.st.phase==="error")return p("div",{className:"center",children:w("div",{className:"error",children:["\uD83D\uDD34 ",t.st.bootError]})});let i=t.st.layout,r=w("div",{className:"form-col",children:[p(g_,{st:t.st}),t.st.showLogs?w("div",{className:"logs",children:[w("div",{className:"logs-head",children:[w("span",{children:["console · ",t.st.hostFor(t.st.form?.moduleKey??"")||"host"]}),p("button",{type:"button",className:"link",onClick:()=>t.st.toggleLogs(),children:"hide"})]}),t.st.logsError!=null?w("div",{className:"error",children:["\uD83D\uDD34 ",t.st.logsError]}):null,p("pre",{children:t.st.logLines.join(`
55
+ `)})]}):null]}),o=w("div",{className:"results-col",children:[p(U6,{st:t.st}),t.st.generateInResults?w("div",{className:"results-run",children:[p(a0,{st:t.st}),p("span",{className:"run-error","data-tip":t.st.run.error??void 0,children:t.st.run.error==null?"":`\uD83D\uDD34 ${t.st.run.error}`})]}):null,p(V6,{st:t.st}),p(uA,{st:t.st,compact:i==="pinned"})]}),s=w(oe,{children:[t.st.formError!=null?w("div",{className:"center error",children:["\uD83D\uDD34 ",t.st.formError]}):null,t.st.formLoading&&t.st.form==null?p("div",{className:"center",children:"loading draft…"}):null,t.st.modules.length===0?p("div",{className:"center",children:"no workflow modules loaded"}):null]});return w("div",{className:"app",children:[p("div",{className:"cols",children:(i==="side"||i==="left")&&!n?p(q6,{st:t.st,left:i==="left",form:w(oe,{children:[s,r]}),results:o}):w("div",{className:"main",children:[s,w("div",{className:`work layout-${i}`,children:[r,i==="off"?w("button",{type:"button",className:"show-preview","data-tip":"show the preview panel again",onClick:()=>t.st.showPreview(),children:[p(H,{name:"panel-side"})," preview"]}):o]})]})}),p(dA,{st:t.st}),p(dO,{})]})});var j_=`
20
56
  :root {
21
57
  --bg: #101217;
22
58
  --panel: #171a21;
@@ -40,32 +76,27 @@ body {
40
76
  #root { height: 100%; }
41
77
  .app { display: flex; flex-direction: column; height: 100%; }
42
78
  .cols { display: flex; flex: 1; min-height: 0; position: relative; }
43
- .backdrop { display: none; }
44
-
45
- .sidebar {
46
- width: 240px; flex-shrink: 0; overflow-y: auto;
47
- border-right: 1px solid var(--border); background: var(--panel); padding: 6px 0;
48
- }
49
- /* the way OUT, from inside: the drawer opens from the workflow head box, which nothing
50
- advertises, so a visible close is what teaches where it lives */
51
- .side-head {
52
- display: flex; align-items: center; justify-content: space-between; gap: 8px;
53
- padding: 2px 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
54
- color: var(--dim); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
55
- }
56
- .side-head button { padding: 2px 6px; }
57
- .side-module { padding: 6px 12px 2px; }
58
- .side-module .name { font-weight: 600; }
59
- .side-module .host { color: var(--dim); font-size: 11px; margin-left: 6px; }
60
- .side-draft {
61
- display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--text);
62
- padding: 4px 12px 4px 26px; cursor: pointer; font: inherit; border-radius: 4px;
63
- }
64
- .side-draft:hover { background: var(--panel-2); }
65
- .side-draft.sel { background: var(--accent-dim); color: #fff; }
66
- .side-errors { margin: 12px; padding: 8px; border: 1px solid var(--red); border-radius: 6px; font-size: 12px; }
67
- .side-errors .file { color: var(--dim); word-break: break-all; }
68
- .side-errors .msg { color: var(--red); }
79
+
80
+ /* ⌘K / ⌘J: every workflow and draft, fuzzy matched. Above the other modals, so it opens from
81
+ inside the loras popup too */
82
+ .omni-overlay { z-index: 60; align-items: flex-start; padding-top: 12vh; }
83
+ .modal.omni { width: min(560px, 100%); max-height: min(70vh, 100%); }
84
+ .omni-list { padding: 4px; }
85
+ .omni-row {
86
+ display: flex; width: 100%; gap: 10px; align-items: baseline; justify-content: space-between;
87
+ text-align: left; border: 0; background: none; color: var(--text); padding: 6px 10px;
88
+ border-radius: 6px; cursor: pointer; font: inherit;
89
+ }
90
+ .omni-row:hover { background: var(--panel-2); }
91
+ .omni-row.sel { background: var(--accent-dim); color: #fff; }
92
+ .omni-row.open .omni-label { font-weight: 600; }
93
+ .omni-label { overflow-wrap: anywhere; }
94
+ .omni-host { color: var(--dim); font-size: 11px; white-space: nowrap; }
95
+ .omni-errors { margin: 10px 6px 4px; padding: 8px; border: 1px solid var(--red); border-radius: 6px; font-size: 12px; }
96
+ .omni-errors .section-title { margin-top: 0; color: var(--red); }
97
+ .omni-errors .file { color: var(--dim); word-break: break-all; }
98
+ .omni-errors .msg { color: var(--red); margin-bottom: 6px; white-space: pre-wrap; }
99
+ button.link.load-errors { color: var(--red); font-size: 11px; }
69
100
 
70
101
  /* the ONE scrolling element. --main-pad-y is its own top+bottom padding, published so the
71
102
  sticky results column can subtract exactly that: a column sized to the full VIEWPORT inside
@@ -80,17 +111,14 @@ body {
80
111
  /* the TUI header on the web: one labelled box per thing you are editing, actions below */
81
112
  /* the boxes measure the FORM COLUMN, not the window: a results panel on the side halves the
82
113
  space they have while the viewport is unchanged, so a media query would answer the wrong
83
- question. Three variants, and EVEN ones: flex-wrap could leave 3 boxes on one line and 1
84
- alone on the next, which reads as a bug rather than as a layout */
114
+ question. Two variants, and EVEN ones: three boxes in a row or stacked. Two columns would
115
+ leave one box alone on the second line, which reads as a bug rather than as a layout */
85
116
  .head-shell { container-type: inline-size; }
86
117
  .head-boxes { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 4px 0 0; align-items: stretch; }
87
- @container (min-width: 380px) {
88
- .head-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
89
- }
90
- @container (min-width: 780px) {
91
- .head-boxes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
118
+ @container (min-width: 540px) {
119
+ .head-boxes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
92
120
  }
93
- /* no container-query support: fall back to the old wrapping row rather than a stack of four */
121
+ /* no container-query support: fall back to the old wrapping row rather than a stack of three */
94
122
  @supports not (container-type: inline-size) {
95
123
  .head-boxes { display: flex; flex-wrap: wrap; }
96
124
  .head-boxes > .head-box { flex: 1 1 auto; min-width: 150px; }
@@ -116,34 +144,68 @@ body {
116
144
  }
117
145
  .head-value.as-link:hover { color: var(--accent); text-decoration: underline; }
118
146
  button.danger { color: var(--dim); }
147
+ /* a button that asks to be pressed: the host changed under the panel */
148
+ button.attention { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); font-size: 11px; white-space: nowrap; }
119
149
  button.danger:hover { color: var(--red); border-color: var(--red); }
120
150
 
121
- /* the sidebar is a tree: folder → workflows → drafts, the branch line makes the nesting readable */
122
- .side-group { margin-bottom: 7px; }
123
- .side-folder { padding: 4px 12px 2px; color: var(--dim); font-size: 11px; overflow-wrap: anywhere; }
124
- .side-branch { margin-left: 10px; border-left: 1px solid var(--border); }
125
-
126
151
  /* the label column is fit-content CAPPED, not a fixed slab: with short labels the controls
127
152
  start right after them. Rows are subgrids of .vars so the column still lines up across
128
153
  rows — a per-row grid would give every row its own width. The 150px track is the
129
154
  pre-subgrid fallback, kept first so an old engine still gets aligned columns */
130
155
  /* the form needs air under the head boxes: the first var sat flush against them */
131
- .vars { display: grid; grid-template-columns: fit-content(150px) 1fr; margin-top: 14px; }
156
+ .vars { display: grid; grid-template-columns: 120px minmax(0, 1fr); margin-top: 14px; position: relative; }
157
+ /* the label column's edge: a thin strip you drag, lit on hover */
158
+ .label-resizer {
159
+ position: absolute; top: 0; bottom: 0; width: 6px; margin-left: -3px; z-index: 5;
160
+ cursor: col-resize; border-radius: 3px;
161
+ }
162
+ .label-resizer:hover, .label-resizer:active { background: var(--accent-dim); }
132
163
  .var-row {
133
164
  display: grid; grid-template-columns: 150px 1fr; grid-column: 1 / -1;
134
165
  grid-template-columns: subgrid; gap: 8px; align-items: start;
135
- padding: 3px 0; border-bottom: 1px solid var(--border);
166
+ /* no rule between rows: the label column and the spacing already separate them. Every
167
+ row has the same side padding, so a tinted group block has room and its labels still line
168
+ up with the plain rows */
169
+ padding: 4px 8px;
136
170
  }
171
+ /* vars that go together (VarUi.group): one tinted block, rounded at its ends */
172
+ .var-row.in-group { background: rgba(122, 162, 247, 0.06); }
173
+ .var-row.group-start { border-radius: 8px 8px 0 0; margin-top: 6px; }
174
+ .var-row.group-end { border-radius: 0 0 8px 8px; margin-bottom: 6px; }
175
+ .var-row.group-solo { border-radius: 8px; margin: 6px 0; }
137
176
  /* the label IS the drag handle for its row: no separate grip to reveal or aim at */
138
- .var-label { padding-top: 3px; overflow-wrap: break-word; cursor: grab; }
177
+ /* labels never wrap: one line at the height of a control, cut with an ellipsis, whole on hover.
178
+ The icon and the (?) keep their size, only the name gives way */
179
+ .var-label { display: flex; align-items: center; justify-content: flex-end; min-height: 28px; min-width: 0; cursor: grab; }
180
+ .var-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
181
+ /* the ⌘ key that jumps to this var, on its own line under the name */
182
+ .var-label.has-kbd { flex-wrap: wrap; align-content: center; row-gap: 3px; }
183
+ .var-kbd-line { flex-basis: 100%; display: flex; justify-content: flex-end; color: var(--dim); }
184
+ .var-row.inactive .var-control { opacity: 0.18; filter: grayscale(1); }
185
+ .var-row.inactive .var-label { opacity: 0.45; }
139
186
  .var-label:active { cursor: grabbing; }
140
187
  .lora-chip[draggable='true'] { cursor: grab; }
141
188
  /* the card drags from anywhere, so its own controls must keep their cursor */
142
189
  .lora-chip input, .lora-chip label, .lora-chip button { cursor: pointer; }
143
190
  .lora-chip input[type='number'] { cursor: text; }
144
- .var-label .dirty-dot { color: var(--amber); margin-left: 4px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
145
- .var-label .dirty-dot:hover { color: var(--red); }
191
+ /* the modified mark: a small dot pinned to the cell's left edge, OUT of the flow, so a field
192
+ that changes never moves its label */
193
+ .var-label { position: relative; }
194
+ .var-label .dirty-dot {
195
+ position: absolute; left: -4px; top: 50%; transform: translateY(-50%);
196
+ width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%;
197
+ background: var(--amber); font-size: 0; cursor: pointer;
198
+ }
199
+ .var-label .dirty-dot:hover { background: var(--red); }
146
200
  .var-control { min-width: 0; }
201
+ /* a workflow's own icons: beside a label, or inside a choice button */
202
+ .var-icon { width: 15px; height: 15px; margin-right: 5px; flex-shrink: 0; }
203
+ .btn-group button .var-icon { margin-right: 3px; }
204
+ .var-help {
205
+ flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; margin-right: 5px;
206
+ width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--dim);
207
+ color: var(--dim); font-size: 10px; line-height: 1; cursor: help; vertical-align: 1px;
208
+ }
147
209
  .hint { color: var(--dim); font-size: 11px; margin-top: 2px; }
148
210
 
149
211
  input[type='text'], input[type='number'], textarea, select {
@@ -155,8 +217,62 @@ input[type='number'] { width: 110px; }
155
217
  textarea { width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
156
218
  input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
157
219
  input[type='range'] { width: 100%; accent-color: var(--accent); }
220
+ /* a steps or cfg slider across a whole wide row is a long drag for a small number: 320px is
221
+ still a fine grain for 1..60, and the number box keeps its place right after it */
222
+ .var-control input[type='range'] { max-width: 320px; }
158
223
  input[type='checkbox'] { accent-color: var(--accent); width: 16px; height: 16px; }
159
224
  .row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
225
+ /* lanes (src/vars/lanes.ts): named groups merged top to bottom. Each lane is a BAND: a tinted
226
+ strip, its name as plain small text on the left (clickable, not dressed as a button: click
227
+ switches it, drag reorders, double-click renames), its content on the right. An inactive lane
228
+ is dimmed, never hidden */
229
+ .lora-lanes { display: flex; flex-direction: column; gap: 4px; }
230
+ .lanes { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
231
+ .lane-box, .lora-section.laned {
232
+ display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: start;
233
+ background: var(--panel); border-radius: 8px; padding: 5px 6px 5px 8px;
234
+ }
235
+ .lane-bar { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding-top: 4px; }
236
+ .lane-pill {
237
+ background: none; border: 0; padding: 0; max-width: 100%; cursor: grab;
238
+ font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent);
239
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
240
+ }
241
+ .lane-pill:hover { text-decoration: underline dotted; }
242
+ .lane-pill.off { color: var(--dim); font-weight: 400; text-decoration: line-through; }
243
+ .lane-bar input.lane-name { width: 100%; padding: 1px 6px; font-size: 12px; height: 22px; }
244
+ /* the tools of a lane only show under the pointer: a calm list of lanes at rest */
245
+ .lane-tools { display: inline-flex; gap: 4px; align-items: center; opacity: 0; transition: opacity 0.12s; }
246
+ .lane-box:hover .lane-tools, .lora-section:hover .lane-tools, .lane-tools:focus-within { opacity: 1; }
247
+ .lane-box.off textarea, .lane-box.off .prompt-editor, .lora-section.off .lora-lane { opacity: 0.4; }
248
+ /* the prompt editor's own colors live in its CodeMirror theme (web/promptEditor/); here only the footer */
249
+ .prompt-editor { position: relative; }
250
+ .pe-foot {
251
+ position: absolute; right: 6px; bottom: 3px; display: flex; gap: 10px; font-size: 10px; color: var(--dim);
252
+ background: var(--panel-2); padding: 0 4px; border-radius: 4px; opacity: 0; pointer-events: none; transition: opacity 0.12s;
253
+ }
254
+ .prompt-editor:focus-within .pe-foot, .pe-foot.has-error { opacity: 1; pointer-events: auto; }
255
+ .pe-keys, .pe-tokens { cursor: help; }
256
+ .pe-error { color: var(--red); margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
257
+ .lane-foot { gap: 14px; }
258
+ .lora-add-card {
259
+ align-self: stretch; min-width: 56px; min-height: 56px; border: 1px dashed var(--border);
260
+ background: none; color: var(--dim); border-radius: 8px; display: inline-flex;
261
+ align-items: center; justify-content: center; font-size: 18px;
262
+ }
263
+ .lora-add-card:hover { border-color: var(--accent); color: var(--accent); }
264
+ /* ⋯ menus (components/MenuButton.tsx) */
265
+ .menu-box { display: inline-flex; }
266
+ button.menu-btn { height: 26px; width: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: none; border-color: transparent; color: var(--dim); }
267
+ button.menu-btn:hover, button.menu-btn[aria-expanded='true'] { color: var(--text); border-color: var(--border); background: var(--panel-2); }
268
+ .menu-list { min-width: 210px; left: auto; right: 0; }
269
+ .menu-item {
270
+ display: flex; gap: 6px; align-items: center; width: 100%; text-align: left;
271
+ background: none; border: 0; border-radius: 6px; padding: 5px 8px;
272
+ }
273
+ .menu-item:hover:not(:disabled) { background: var(--accent-dim); }
274
+ .menu-check { width: 12px; color: var(--accent); flex-shrink: 0; }
275
+ .menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
160
276
 
161
277
  /* presets menu (text + prompt vars). The backdrop sits UNDER the menu and over everything
162
278
  else, so any outside click closes it without a document listener */
@@ -177,6 +293,21 @@ input[type='checkbox'] { accent-color: var(--accent); width: 16px; height: 16px;
177
293
  .preset-item:hover { background: var(--accent-dim); border-color: transparent; }
178
294
  .preset-item.on .preset-name { color: var(--accent); }
179
295
  .preset-name { white-space: pre; }
296
+ /* size: starred aspect icons, the starrable list, fitted W × H */
297
+ .aspect-icon { display: inline-block; vertical-align: -0.2em; flex-shrink: 0; }
298
+ .size-row input.size-num { min-width: 0; padding-left: 5px; padding-right: 2px; }
299
+ .size-pick { display: inline-flex; gap: 6px; align-items: center; }
300
+ .size-menu { min-width: 300px; overflow-x: hidden; }
301
+ .size-item { display: flex; align-items: center; gap: 4px; border-radius: 6px; }
302
+ .size-item:hover { background: var(--accent-dim); }
303
+ .size-item.on .size-item-label { color: var(--accent); }
304
+ .size-item-pick {
305
+ flex: 1; display: flex; gap: 8px; align-items: center; text-align: left;
306
+ background: none; border: 0; padding: 4px 7px;
307
+ }
308
+ .size-item-label { flex: 1; white-space: nowrap; }
309
+ .size-star { background: none; border: 0; color: var(--dim); padding: 2px 8px; font-size: 14px; }
310
+ .size-star.on { color: var(--amber); }
180
311
  .preset-peek {
181
312
  color: var(--dim); font-size: 11px; max-width: 100%;
182
313
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
@@ -193,6 +324,8 @@ button.primary {
193
324
  background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600;
194
325
  padding: 5px 14px; display: inline-flex; align-items: center; gap: 6px;
195
326
  }
327
+ /* running: the fill sweeps across a dim track, the text stays, so nothing beside it moves */
328
+ button.primary.running { color: #fff; border-color: var(--accent); }
196
329
  .kbd-hint {
197
330
  font-size: 10px; opacity: 0.65; border: 1px solid currentColor; border-radius: 4px;
198
331
  padding: 0 4px; line-height: 1.4;
@@ -201,16 +334,36 @@ button.link { border: 0; background: none; color: var(--accent); padding: 0; }
201
334
  button.link.danger { color: var(--dim); }
202
335
  button.link.danger:hover { color: var(--red); }
203
336
  button.mode { padding: 2px 7px; font-size: 12px; }
204
- button.mode.sel { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
337
+ button.mode.sel { background: var(--accent); border-color: var(--accent); color: #0d1117; }
338
+ /* the actions that START something (new draft, add loras): accent outline, so the eye finds
339
+ them before the neutral ones. The lit segment of a group is a solid accent fill */
340
+ button.accent { color: var(--accent); border-color: var(--accent-dim); }
341
+ /* small secondary actions under a field (presets, enhance, lanes): one size, each its own box */
342
+ button.mini { height: 24px; padding: 0 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; color: var(--dim); }
343
+ button.mini:hover { color: var(--text); }
344
+ .prompt-actions { gap: 6px; margin-top: 4px; }
345
+ button.accent:hover { background: var(--accent-dim); color: #fff; }
205
346
 
206
- /* the run line: button, queue count, result count — one row, each part appearing only when
207
- it has something to say */
208
- .run-line { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
347
+ /* the run line: button, queue count, result count. Every part is ALWAYS there at one size, so
348
+ nothing beside it moves when a run starts, a queue empties or a count grows a digit */
349
+ .run-line { display: inline-flex; gap: 10px; align-items: center; flex-wrap: nowrap; }
350
+ .run-chip-count { display: inline-block; min-width: 2.2ch; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
351
+ .run-chip.empty { opacity: 0.5; }
352
+ .run-chip.empty .run-chip-count { color: var(--dim); }
353
+ .run-chip-clear {
354
+ display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
355
+ padding: 0; border: 0; border-radius: 50%; background: none; color: var(--dim); cursor: pointer;
356
+ }
357
+ .run-chip-clear:hover:not(:disabled) { color: var(--red); background: var(--panel-2); }
358
+ .run-chip-clear:disabled { cursor: default; opacity: 0.4; }
359
+ .run-error { flex: 1; min-width: 0; height: 1.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--red); font-size: 12px; }
360
+ input[type='range'].setting-range:disabled { opacity: 0.3; }
361
+ .live-preview-error { margin-left: 4px; }
362
+ .live-preview-line { min-height: 1.35em; }
209
363
  .run-chip {
210
- display: inline-flex; gap: 6px; align-items: center; color: var(--dim); font-size: 12px;
211
- border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px;
364
+ display: inline-flex; gap: 3px; align-items: center; color: var(--dim); font-size: 12px;
365
+ border: 1px solid var(--border); border-radius: 999px; padding: 1px 3px 1px 8px; flex-shrink: 0;
212
366
  }
213
- .run-chip .link { font-size: 12px; }
214
367
  .runbar {
215
368
  position: sticky; bottom: 0; display: flex; gap: 14px; align-items: center;
216
369
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
@@ -239,11 +392,17 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
239
392
  .host-action.danger:hover { color: var(--red); border-color: var(--red); }
240
393
  .lightbox-bar .host-action { padding: 4px 10px; }
241
394
  .run-card img { max-width: min(320px, 100%); max-height: 320px; border-radius: 6px; display: block; }
395
+ /* fit: every image as wide as the panel, one per row. grid: the slider sets the size (inline),
396
+ run cards wrap several per row */
397
+ .gallery.view-fit .imgs { flex-direction: column; }
398
+ .gallery.view-fit .img-cell, .gallery.view-fit .img-button { width: 100%; }
399
+ .gallery.view-fit .run-card img { width: 100%; height: auto; max-width: 100%; max-height: none; }
400
+ .gallery.view-grid { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
401
+ .gallery.view-grid .run-card { max-width: 100%; }
242
402
  .run-card .noimg { color: var(--dim); font-style: italic; }
243
403
  .run-card.running { border-color: var(--accent-dim); }
244
404
  /* what the host is on, in the node's own unit — the live signal of a text run, which has
245
405
  neither a latent frame nor an image to show */
246
- .run-node { color: var(--accent); font-size: 12px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
247
406
 
248
407
  /* a STRING output: the answer is prose, so it wraps and selects like prose. Monospace because
249
408
  an expanded prompt is copied into another field verbatim */
@@ -267,6 +426,27 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
267
426
  }
268
427
  .run-live-body.dim { color: var(--dim); }
269
428
  .progress-track { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
429
+ /* live previews under generate: compact, the name inline, each line cut to one; a click opens
430
+ the full text. A negative line is dim red, as the prompt box would read it */
431
+ .live-previews { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
432
+ .live-preview {
433
+ display: flex; gap: 8px; align-items: baseline; width: 100%; min-width: 0; text-align: left;
434
+ background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
435
+ font-size: 11px; line-height: 1.4; cursor: pointer;
436
+ }
437
+ .live-preview:hover { border-color: var(--accent-dim); }
438
+ .live-preview-name { flex-shrink: 0; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
439
+ .live-preview-lines { display: flex; flex-direction: column; min-width: 0; flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
440
+ .live-preview-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
441
+ .live-preview-line.negative { color: #c9848f; }
442
+ .live-preview.expanded .live-preview-line { white-space: pre-wrap; overflow-wrap: anywhere; }
443
+ /* the running image's frame, reserved at its final ratio: the latent fills it, the bar rides its
444
+ foot, so a run never changes the page's height */
445
+ .run-frame { position: relative; max-width: 100%; background: var(--bg); border-radius: 6px; overflow: hidden; }
446
+ .run-frame .img-button { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; }
447
+ .run-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
448
+ .progress-track.over { position: absolute; left: 6px; right: 6px; bottom: 6px; margin: 0; background: rgba(0, 0, 0, 0.45); }
449
+ .run-meta-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
270
450
  .progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.4s ease; }
271
451
 
272
452
  .lora-chip {
@@ -295,6 +475,16 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
295
475
  .lora-chip:not(.card) .lora-toggle { flex-direction: row; align-items: center; gap: 6px; }
296
476
  .lora-toggle:hover .chip-title { color: var(--accent); }
297
477
  .chip-controls { display: flex; flex-direction: column; gap: 3px; }
478
+ /* trigger words under a row card: the words wrap, a missing state carries its fix */
479
+ .chip-triggers { font-size: 11px; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; user-select: text; }
480
+ .chip-triggers.none, .chip-triggers.missing { color: var(--dim); font-style: italic; }
481
+ .chip-triggers.missing { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
482
+ .lora-chip .chip-triggers .trigger-fetch {
483
+ font-style: normal; font-size: 11px; padding: 1px 8px; border-radius: 6px;
484
+ border: 1px solid var(--border); background: var(--panel); color: var(--accent);
485
+ }
486
+ .lora-chip .chip-triggers .trigger-fetch:hover { color: var(--accent); border-color: var(--accent); }
487
+ .lora-chip .chip-triggers .trigger-fetch:disabled { color: var(--dim); cursor: default; }
298
488
  /* a line: label button, slider, number. The label toggles m+c ↔ m / c */
299
489
  .st-line { display: flex; gap: 5px; align-items: center; }
300
490
  .st-line .st-label {
@@ -341,15 +531,21 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
341
531
  The selector carries TWO classes on purpose: the .lora-chip button rule above is 0-1-1 and would
342
532
  otherwise win, stripping the padding and the backdrop off this one.
343
533
  width:auto because a stretch parent would otherwise pull it across the whole card */
344
- .chip-media .chip-remove, .lora-active-row .chip-remove {
534
+ .chip-media .chip-remove, .lora-active-row .chip-remove, .lora-card .chip-remove {
345
535
  position: absolute; top: 4px; right: 4px; z-index: 1; width: auto; height: auto;
346
536
  display: inline-flex; align-items: center; justify-content: center;
347
- border: 0; border-radius: 6px; padding: 4px; line-height: 0; color: #fff; cursor: pointer;
537
+ border: 0; border-radius: 8px; padding: 7px; line-height: 0; color: #fff; cursor: pointer;
348
538
  background: rgba(16, 18, 23, 0.72); opacity: 0.85; transition: opacity 0.12s, color 0.12s;
349
539
  }
350
- .chip-media .chip-remove:hover, .lora-active-row .chip-remove:hover { opacity: 1; color: var(--red); }
540
+ .chip-media .chip-remove:hover, .lora-active-row .chip-remove:hover, .lora-card .chip-remove:hover { opacity: 1; color: var(--red); }
351
541
 
352
542
  /* PAUSED: still in the palette, visibly not contributing to the graph */
543
+ .lora-toggle, .thumb-box { position: relative; display: block; }
544
+ .paused-mark {
545
+ position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
546
+ pointer-events: none; color: #fff; opacity: 0.8;
547
+ }
548
+ .paused-mark svg { background: rgba(16, 18, 23, 0.55); border-radius: 50%; padding: 10px; box-sizing: content-box; stroke-width: 3; }
353
549
  .lora-chip.off, .lora-active-row.off { opacity: 0.55; }
354
550
  .lora-chip.off { border-style: dashed; }
355
551
  .lora-chip.off .lora-thumb, .lora-active-row.off .lora-thumb { filter: grayscale(1); }
@@ -365,6 +561,33 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
365
561
  }
366
562
  .modal-head { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
367
563
  .modal-head input { flex: 1; }
564
+ /* a popup whose content grows and shrinks (the loras picker): pinned near the top, one fixed
565
+ height, so typing a filter or hiding images never moves it */
566
+ .modal-overlay.top { align-items: flex-start; padding-top: 5vh; }
567
+ .modal.loras-modal { height: min(86vh, 100%); max-height: none; }
568
+ .modal.loras-modal { width: min(1180px, 100%); }
569
+ /* the palette sits BESIDE the gallery, each scrolling alone: picking a lora grows the palette
570
+ and never moves a card under the pointer. Narrow: a fixed-height strip above, same reason */
571
+ .loras-split { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
572
+ .loras-split .modal-body { min-height: 0; }
573
+ .loras-palette { order: 2; border-left: 1px solid var(--border); }
574
+ .loras-palette .lora-active-row { flex-wrap: wrap; }
575
+ .lora-card.picked { border-color: var(--green); }
576
+ .lora-card.picked .lora-label { color: var(--green); }
577
+ .lora-card.picked.off { border-color: var(--border); border-style: dashed; opacity: 0.55; }
578
+ .lora-card.picked.off .lora-label { color: var(--dim); }
579
+ .lora-card.picked.off .lora-thumb { filter: grayscale(1); }
580
+ @media (max-width: 800px) {
581
+ .loras-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: 150px minmax(0, 1fr); }
582
+ .loras-palette { order: 0; border-left: 0; border-bottom: 1px solid var(--border); }
583
+ }
584
+ .modal-head .modal-close { margin-left: 6px; }
585
+ /* a display setting's slider (lora image size, result size): grey and small, never the accent
586
+ blue of the controls that change what runs */
587
+ input[type='range'].setting-range { width: 72px; flex: 0 0 72px; accent-color: var(--dim); opacity: 0.8; }
588
+ .menu-range { cursor: default; }
589
+ .menu-range input[type='range'].setting-range { margin-left: auto; width: 96px; flex-basis: 96px; }
590
+ .modal-foot { padding: 5px 10px; border-top: 1px solid var(--border); font-size: 11px; color: var(--dim); margin: 0; }
368
591
  .modal-body { overflow-y: auto; padding: 10px; }
369
592
  .section-title { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin: 8px 0 6px; }
370
593
 
@@ -374,9 +597,16 @@ button.mode.sel { background: var(--accent-dim); border-color: var(--accent); co
374
597
  .lora-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
375
598
 
376
599
  .lora-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
600
+ .lora-sort-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
601
+ .lora-sort { display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; }
602
+ .lora-sort .mode { font-size: 11px; padding: 2px 8px; }
377
603
  .lora-card {
378
- display: flex; flex-direction: column; gap: 6px; padding: 6px; text-align: left;
379
- background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; min-width: 0;
604
+ position: relative; min-width: 0;
605
+ background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
606
+ }
607
+ .lora-card-hit {
608
+ display: flex; flex-direction: column; gap: 6px; padding: 6px; width: 100%; text-align: left;
609
+ background: none; border: 0; cursor: pointer; color: inherit;
380
610
  }
381
611
  .lora-card:hover { border-color: var(--accent); }
382
612
  /* CONTAIN, never cover: a cropped preview hides exactly what the lora looks like */
@@ -415,14 +645,76 @@ div.lora-thumb.none {
415
645
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
416
646
  padding: 10px; border-top: 1px solid var(--border);
417
647
  }
418
- .enh-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
419
- .enh-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
420
- .enh-cols textarea { width: 100%; }
421
- .enh-cols textarea[readonly] { color: var(--dim); }
422
- .enh-think {
423
- max-height: 160px; overflow-y: auto; white-space: pre-wrap; font-size: 12px;
424
- color: var(--dim); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px;
648
+ /* one fixed size, pinned near the top: switching a tab or streaming a rewrite never moves it */
649
+ .modal.enh-modal { width: min(1180px, 100%); height: min(88vh, 100%); max-height: none; }
650
+ .enh-title { flex: 1; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
651
+ .enh-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
652
+ .enh-main { min-height: 0; display: flex; flex-direction: column; gap: 18px; padding: 14px 16px; font-size: 14px; }
653
+ .enh-side {
654
+ min-height: 0; overflow-y: auto; padding: 12px 10px; border-right: 1px solid var(--border);
655
+ background: var(--bg); display: flex; flex-direction: column; gap: 18px;
656
+ }
657
+ .enh-tabs-title {
658
+ display: flex; align-items: center; gap: 6px; margin: 0 4px 6px;
659
+ color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
660
+ }
661
+ .enh-save { margin-left: auto; color: var(--dim); font-weight: 400; text-transform: none; letter-spacing: 0; }
662
+ .enh-save.error { color: var(--red); }
663
+ .enh-tab-select { display: none; width: 100%; }
664
+ .enh-tab-list { display: flex; flex-direction: column; gap: 2px; }
665
+ .enh-tab { position: relative; display: flex; align-items: center; border-radius: 6px; border-left: 3px solid transparent; }
666
+ .enh-tab > button:first-child {
667
+ flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left;
668
+ background: none; border: 0; padding: 7px 8px; font-size: 14px; color: var(--text); cursor: pointer;
669
+ }
670
+ .enh-tab:hover { background: var(--panel-2); }
671
+ .enh-tab.sel { background: var(--accent-dim); border-left-color: var(--accent); }
672
+ .enh-tab.sel > button:first-child { font-weight: 600; }
673
+ .enh-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
674
+ .enh-tab-new {
675
+ margin-top: 4px; display: flex; align-items: center; gap: 6px; background: none; border: 1px dashed var(--border);
676
+ color: var(--dim); padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; text-align: left;
425
677
  }
678
+ .enh-tab-new:hover { color: var(--accent); border-color: var(--accent); }
679
+ .enh-tab-edit { background: none; border: 0; color: var(--dim); padding: 4px 8px; cursor: pointer; }
680
+ .enh-tab-edit:hover, .enh-tab-edit.sel { color: var(--accent); }
681
+ .enh-right { position: relative; min-height: 0; display: flex; flex-direction: column; }
682
+ .enh-right > .enh-main { flex: 1; overflow: hidden; }
683
+ .enh-job { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
684
+ .enh-job .enh-actions { margin-bottom: 8px; }
685
+ .enh-box { flex: 1; min-height: 60px; resize: none; }
686
+ .enh-box.enh-result { flex: 1.3; }
687
+ button.enh-go { min-width: 130px; justify-content: center; }
688
+ .enh-think-tip { margin-left: 6px; cursor: help; }
689
+ /* the editor covers the job, inside the modal: nothing clips it, nothing beside it moves */
690
+ .enh-edit {
691
+ position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column;
692
+ background: var(--panel); border-left: 3px solid var(--accent);
693
+ }
694
+ .enh-edit-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
695
+ .enh-edit-head .enh-h { flex: 1; min-width: 0; }
696
+ button.enh-edit-close { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; padding: 5px 16px; }
697
+ .enh-edit-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
698
+ .enh-master { flex: 1; min-height: 240px; resize: none; }
699
+ .enh-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--dim); }
700
+ .enh-dot.up { background: var(--green); }
701
+ .enh-dot.down { background: var(--red); }
702
+ .enh-dot.checking { background: var(--amber); }
703
+ .enh-empty { color: var(--dim); font-size: 13px; padding: 4px; }
704
+ .enh-h { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
705
+ .enh-h-name { color: var(--accent); font-weight: 600; }
706
+ .enh-label { font-size: 13px; color: var(--dim); margin-bottom: 4px; }
707
+ .enh-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
708
+ .enh-text { width: 100%; font-size: 14px; line-height: 1.5; }
709
+ .enh-result { border-color: var(--accent-dim); }
710
+ .enh-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
711
+ button.enh-big { font-size: 14px; padding: 8px 18px; }
712
+ .enh-grid { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; align-items: center; }
713
+ .enh-grid > label { color: var(--dim); font-size: 13px; text-align: right; }
714
+ .enh-grid input[type='text'], .enh-grid input[type='password'], .enh-grid > select { width: 100%; }
715
+ .enh-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
716
+ .enh-inline > select, .enh-inline > input[type='text'] { flex: 1; min-width: 160px; }
717
+ .enh-inline .row-inline { font-size: 13px; color: var(--dim); }
426
718
 
427
719
  .img-preview { margin-top: 8px; }
428
720
  .img-preview img { max-width: 220px; max-height: 220px; border-radius: 6px; border: 1px solid var(--border); }
@@ -430,6 +722,88 @@ div.lora-thumb.none {
430
722
  .center { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--dim); }
431
723
  .center .error { color: var(--red); max-width: 640px; white-space: pre-wrap; }
432
724
 
725
+ /* history picker: one fixed size, matches left, the highlighted one in full on the right */
726
+ .modal-overlay.hist-overlay { z-index: 60; }
727
+ .modal.hist-modal { width: min(1100px, 100%); height: min(76vh, 100%); max-height: none; }
728
+ .hist-modal .modal-head { align-items: center; }
729
+ .hist-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
730
+ .hist-list { min-height: 0; overflow-y: auto; border-right: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
731
+ .hist-row {
732
+ display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0;
733
+ border-left: 3px solid transparent; border-radius: 6px; padding: 6px 8px; cursor: pointer; color: var(--text); min-width: 0;
734
+ }
735
+ .hist-row.sel { background: var(--accent-dim); border-left-color: var(--accent); }
736
+ .hist-first { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
737
+ .hist-meta { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
738
+ .hist-empty { color: var(--dim); padding: 8px; font-size: 13px; }
739
+ .hist-preview { min-height: 0; display: flex; flex-direction: column; }
740
+ .hist-text {
741
+ flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere;
742
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5;
743
+ }
744
+ .hist-foot { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 12px; border-top: 1px solid var(--border); }
745
+ @media (max-width: 700px) {
746
+ .hist-cols { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
747
+ .hist-list { border-right: 0; border-bottom: 1px solid var(--border); }
748
+ }
749
+ /* the corner latent: a zero-height sticky anchor, so the card floats over the gallery without
750
+ taking a pixel of it; the card itself is one fixed size */
751
+ .corner-run-anchor { position: sticky; top: 6px; height: 0; z-index: 4; flex-basis: 100%; width: 100%; margin-bottom: -10px; }
752
+ .work.layout-pinned .corner-run-anchor { margin-bottom: -6px; }
753
+ .corner-run {
754
+ position: absolute; top: 0; right: 6px; width: 168px; display: flex; flex-direction: column; gap: 4px;
755
+ background: var(--panel); border: 1px solid var(--accent-dim); border-radius: 8px; padding: 6px;
756
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
757
+ }
758
+ .corner-run img { width: 100%; height: 120px; object-fit: contain; display: block; border-radius: 5px; background: var(--bg); }
759
+ .gallery.blur .corner-run img { filter: blur(14px); }
760
+ .corner-run-meta { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--dim); white-space: nowrap; }
761
+ .corner-run-meta .run-meta-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
762
+ /* blur mode: every result, the latent frame included, stays blurred until the pointer is on it */
763
+ .gallery.blur img { filter: blur(22px); transition: filter 0.12s; }
764
+ .gallery.blur img:hover, .gallery.blur .img-cell:hover img, .gallery.blur button:hover img { filter: none; }
765
+ /* bigger control buttons: the preview head and the three cards at the top, one size with the
766
+ rows below them */
767
+ .results-head .btn-group > button, .head-box .btn-group > button, .head-box button.head-icon {
768
+ height: 28px; min-width: 28px; font-size: 13px;
769
+ display: inline-flex; align-items: center; justify-content: center; gap: 4px;
770
+ }
771
+ /* the preview is its OWN surface: panel background and a border, so the editor and the
772
+ results never read as one page. Placement rules below refine it (the corner card is tighter) */
773
+ .results-col { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px 10px; }
774
+ .results-col .gallery { margin-top: 0; }
775
+ .results-col .run-card { background: var(--bg); }
776
+ .work.layout-bottom .results-col { margin-top: 16px; }
777
+ /* the panel's own controls sit on top of it */
778
+ .head-group-labeled { display: flex; flex-direction: column; gap: 2px; }
779
+ .results-view { gap: 6px; flex-wrap: nowrap; }
780
+ .head-row { gap: 6px; flex-wrap: nowrap; }
781
+ .group-caption { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; padding-left: 2px; }
782
+ .results-head {
783
+ display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
784
+ padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border);
785
+ }
786
+ .work.layout-pinned .results-head { justify-content: flex-end; padding-bottom: 4px; margin-bottom: 6px; }
787
+ /* placement off hides the panel and its buttons: this tab on the right edge brings it back */
788
+ .show-preview {
789
+ position: fixed; right: 0; top: 30%; z-index: 20; padding: 6px 8px;
790
+ border-radius: 8px 0 0 8px; border-right: 0; background: var(--panel); color: var(--dim);
791
+ }
792
+ .show-preview:hover { color: var(--text); }
793
+
794
+ /* LEFT / RIGHT on a wide screen: two full-height panels (react-resizable-panels), each
795
+ scrolling on its own, split by a handle. The preview side is its own surface, full height */
796
+ .work.split { flex: 1; min-width: 0; height: 100%; gap: 0; align-items: stretch; }
797
+ .split-panel { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
798
+ .split-form { padding: 12px 14px 14px; }
799
+ .split-results { background: var(--panel); padding: 10px 12px; }
800
+ .work.split .results-col {
801
+ position: static; width: auto; max-height: none; overflow: visible;
802
+ background: none; border: 0; border-radius: 0; padding: 0;
803
+ }
804
+ .split-handle { width: 5px; background: var(--border); cursor: col-resize; transition: background 0.1s; }
805
+ .split-handle:hover, .split-handle[data-separator-state='drag'] { background: var(--accent); }
806
+
433
807
  /* the placements. Each one is a BUTTON and nothing else: there is no width rule that quietly
434
808
  moves the panel somewhere no button is showing */
435
809
  .work.layout-side { display: flex; gap: 18px; align-items: flex-start; }
@@ -483,53 +857,73 @@ div.lora-thumb.none {
483
857
  .work.layout-pinned .run-card { padding: 0; border: 0; background: none; }
484
858
  .work.layout-pinned .run-card .meta { margin-bottom: 2px; font-size: 11px; }
485
859
  .work.layout-pinned .run-card img { max-height: 34vh; width: auto; }
486
- .results-run { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
860
+ .results-run { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; margin-bottom: 8px; min-width: 0; }
487
861
  .work.layout-pinned .results-run { margin-bottom: 6px; justify-content: flex-end; }
488
862
  /* segmented control: ONE group, no gaps, only the outer corners rounded */
489
863
  .btn-group { display: inline-flex; }
864
+ /* a many-choice with more options than a line holds wraps instead of pushing the row wide */
865
+ .btn-group.wrap { flex-wrap: wrap; row-gap: 4px; }
490
866
  .btn-group button {
491
867
  padding: 2px 6px; font-size: 13px; line-height: 1.3; border-radius: 0; margin: 0;
492
868
  border-right-width: 0; background: var(--panel-2);
493
869
  }
494
870
  .btn-group button:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
495
871
  .btn-group button:last-child { border-right-width: 1px; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
496
- .btn-group button.sel { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
872
+ .btn-group button.sel { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
497
873
  /* the selected segment owns the divider on both sides, else its highlight looks clipped */
498
874
  .btn-group button.sel + button { border-left-color: var(--accent); }
499
875
  .btn-group button:hover { background: var(--panel); }
500
- /* a group living inside a header box sits beside the value, not under it */
501
- .head-group { margin-left: 8px; vertical-align: middle; }
502
- .head-group button { padding: 2px 5px; }
503
- /* rows that mix buttons and inputs: one height for both, so nothing steps over the line.
504
- 32px is what an input with 6px padding and a 1px border measures at this font size */
876
+ .btn-group button.sel:hover { background: var(--accent); }
877
+ /* ONE height for every button a var row shows in a group or an action line: a choice, the
878
+ lora toggles, a lane header, the seed modes. Before, each kind had its own padding and a
879
+ choice sat visibly smaller than the toggles beside it */
880
+ .var-control .btn-group > button, .var-control .row-inline > button:not(.link):not(.lora-add-card):not(.mini),
881
+ .var-control .lora-actions > button {
882
+ height: 28px; min-width: 28px; font-size: 13px;
883
+ display: inline-flex; align-items: center; justify-content: center; gap: 4px;
884
+ }
505
885
  /* everything on a var row is the SAME height as the input beside it, or the row steps.
506
886
  28px is what the slimmed input measures (14px text, 3px padding, 1px border) */
507
887
  .field-height, .field-height button { height: 28px; }
508
888
  .field-height button { display: inline-flex; align-items: center; justify-content: center; }
509
889
  /* a one-character mode button still needs a target: = + ? are narrow glyphs */
510
890
  .btn-group.field-height button { min-width: 28px; }
891
+ /* the draft line: rename, the name, delete, on one line around the name they act on */
892
+ .draft-line { display: flex; gap: 4px; align-items: center; min-width: 0; }
893
+ .draft-line select { flex: 1; min-width: 0; }
894
+ button.head-icon { padding: 2px 5px; background: none; border-color: transparent; color: var(--dim); }
895
+ button.head-icon:hover { border-color: var(--border); color: var(--text); }
896
+ button.head-icon.danger:hover { color: var(--red); border-color: var(--red); }
511
897
  .head-input { padding: 2px 6px; font-size: 13px; font-weight: 600; color: var(--accent); max-width: 180px; }
512
898
  .head-label .save-state { color: var(--dim); font-weight: 400; margin-left: 4px; }
513
899
  .head-label .save-state.error { color: var(--red); }
514
900
  /* every head box is two lines: what you are on, then what you can do to it */
515
901
  .head-box { display: flex; flex-direction: column; gap: 5px; }
516
902
  .head-line { display: flex; gap: 8px; align-items: center; min-height: 24px; }
517
- .head-line .head-group { margin-left: 0; }
518
903
 
519
904
  /* the lora controls sit above the palette, left aligned */
520
905
  .lora-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
521
906
  .lora-actions button { font-size: 12px; }
522
- /* a lora the manager knows and comfy does not: flagged, never hidden */
523
- .host-note {
524
- margin: 8px 0; padding: 6px 10px; font-size: 12px; color: var(--text);
525
- background: var(--panel); border: 1px solid var(--accent-dim); border-radius: 6px;
526
- }
527
- /* the keywords the active loras prepend to the prompt: shown, not guessed */
528
- .kw-prefix { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
529
- .kw-chip {
530
- font-size: 11px; padding: 2px 8px; border-radius: 10px;
531
- background: var(--accent-dim); color: #fff;
907
+ /* the words the loras prepend to the prompt: shown, not guessed. One quiet LINE per lora (its
908
+ name, the words it adds, how many are disabled), cut with an ellipsis. Clickable without
909
+ shouting: dim text, a dotted underline on hover. A lora that is not running keeps its line,
910
+ fainter, so switching a lane never moves the form */
911
+ .kw-prefix { display: flex; flex-direction: column; gap: 1px; margin-bottom: 4px; }
912
+ .kw-box { max-width: 100%; }
913
+ .kw-line {
914
+ display: flex; gap: 6px; align-items: baseline; max-width: 100%; min-width: 0;
915
+ background: none; border: 0; padding: 1px 0; font-size: 11px; color: var(--dim); text-align: left; cursor: pointer;
532
916
  }
917
+ .kw-line:hover .kw-words, .kw-line[aria-expanded='true'] .kw-words { color: var(--text); text-decoration: underline dotted; }
918
+ .kw-line.stopped { opacity: 0.45; }
919
+ .kw-lora { font-weight: 600; white-space: nowrap; flex-shrink: 0; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
920
+ .kw-words { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #b4bccf; }
921
+ .kw-off { flex-shrink: 0; white-space: nowrap; font-style: italic; }
922
+ .kw-menu { min-width: 240px; }
923
+ .kw-menu-head { padding: 2px 6px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
924
+ .kw-menu-head .kw-lora { color: var(--text); margin-right: auto; }
925
+ .kw-item { display: flex; gap: 8px; align-items: center; padding: 3px 7px; border-radius: 6px; cursor: pointer; }
926
+ .kw-item:hover { background: var(--accent-dim); }
533
927
  /* a real switch, not a word: the state is readable at a glance and hittable on a phone */
534
928
  .switch { position: relative; display: inline-flex; width: 28px; height: 16px; flex-shrink: 0; cursor: pointer; }
535
929
  .switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
@@ -547,7 +941,12 @@ div.lora-thumb.none {
547
941
 
548
942
  /* the lora details sheet */
549
943
  .lora-details { display: flex; gap: 14px; flex-wrap: wrap; }
550
- .detail-thumb { width: 220px; max-width: 100%; border-radius: 8px; }
944
+ /* its own ratio, always: the sheet is a flex row, and a stretched child is drawn as tall as the
945
+ text beside it */
946
+ .detail-thumb {
947
+ width: 220px; max-width: 100%; height: auto; max-height: 70vh; align-self: flex-start;
948
+ object-fit: contain; border-radius: 8px;
949
+ }
551
950
  .detail-list { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
552
951
  .detail-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 12px; }
553
952
  .detail-key { color: var(--dim); }
@@ -563,8 +962,9 @@ div.lora-thumb.none {
563
962
  .detail-examples { display: flex; gap: 8px; flex-wrap: wrap; }
564
963
  .detail-examples img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; }
565
964
 
566
- button.warn-action { color: var(--amber); border-color: var(--amber); }
567
- button.warn-action:hover { background: var(--panel); }
965
+ /* destructive but routine (clear queue): neutral at rest, it only turns red under the pointer */
966
+ button.quiet-danger:hover { color: var(--red); border-color: var(--red); }
967
+ /* a lora the manager knows and comfy does not: flagged, never hidden */
568
968
  .lora-warn { color: var(--amber); display: inline-flex; margin-left: 4px; vertical-align: -0.1em; }
569
969
  /* an anchor that must read as a button (it opens the host's own page, so it IS a link) */
570
970
  .button-link {
@@ -586,44 +986,28 @@ button.warn-action:hover { background: var(--panel); }
586
986
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
587
987
  }
588
988
 
589
- /* INSTANT tooltips: the native title attribute waits about a second and cannot be styled, so
590
- every affordance carries data-tip instead. No js, no library, and no delay, which is the point */
989
+ /* tooltips: ONE floating layer (components/TooltipLayer.tsx) reads every data-tip. Instant,
990
+ because the native title waits about a second and cannot be styled. position: relative stays
991
+ on the anchors, some of them position their own children against it */
591
992
  [data-tip] { position: relative; }
592
- [data-tip]:hover::after, [data-tip]:focus-visible::after {
593
- content: attr(data-tip);
594
- /* anchored to the button's bottom LEFT, never centred: a centred tip on the leftmost
595
- button hangs off the screen, and one below never covers the row you are reading */
596
- position: absolute; top: calc(100% + 5px); left: 0;
597
- z-index: 60; pointer-events: none; white-space: normal; max-width: 220px; width: max-content;
598
- opacity: 0.8;
599
- background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
600
- border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 400; line-height: 1.3;
601
- box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
993
+ .tooltip {
994
+ z-index: 100; pointer-events: none; white-space: pre-line; max-width: 320px; width: max-content;
995
+ /* light on a dark page: a tip must not be mistaken for part of the panel */
996
+ background: #e8eaf0; color: #15181f; border: 0;
997
+ border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 450; line-height: 1.4;
998
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
602
999
  }
603
- /* the pointer never crosses a tooltip, so hover cannot flicker between the two */
604
- @media (hover: none) { [data-tip]:hover::after { display: none; } }
605
1000
 
606
1001
  /* icons inherit the text they sit in, so a button never jumps when one is swapped in */
607
1002
  .icon { display: inline-block; vertical-align: -0.16em; flex-shrink: 0; }
608
1003
  button .icon + * { margin-left: 4px; }
609
1004
 
610
- /* the sidebar becomes a fixed drawer over a backdrop */
611
- @media (max-width: 800px) {
612
- .sidebar {
613
- position: fixed; top: 0; left: 0; bottom: 0; width: 264px; z-index: 30;
614
- box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5); padding-top: 12px;
615
- }
616
- .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 25; }
617
- .side-draft { padding: 9px 12px 9px 26px; }
618
- }
619
-
620
1005
  /* phone: label over control, 16px inputs (below that iOS zooms the page on focus) */
621
1006
  @media (max-width: 640px) {
622
1007
  .main { --main-pad-y: 22px; padding: 10px 10px 12px; }
623
1008
  /* labels stay BESIDE their control on a phone too: stacking them doubled the height of
624
- every row and read as a wall. The column just gets narrower. A row that needs the whole
625
- width (loras) opts out with .wide */
626
- .vars { grid-template-columns: fit-content(96px) 1fr; }
1009
+ every row and read as a wall. The column is the width you dragged. A row that needs the
1010
+ whole width (loras) opts out with .wide */
627
1011
  .var-row { gap: 6px; }
628
1012
  .var-row.wide { grid-template-columns: 1fr; gap: 3px; }
629
1013
  .var-label { padding-top: 3px; font-size: 12px; }
@@ -636,7 +1020,13 @@ button .icon + * { margin-left: 4px; }
636
1020
  .modal { max-height: 100%; height: 100%; width: 100%; border-radius: 0; }
637
1021
  .lora-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
638
1022
  .runbar { flex-wrap: wrap; }
639
- /* side by side prompts do not fit a phone: stack yours over the rewrite */
640
- .enh-cols { grid-template-columns: 1fr; }
1023
+ /* the two tab lists become two dropdowns above the job */
1024
+ .enh-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
1025
+ .enh-side { flex-direction: row; gap: 10px; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 10px; }
1026
+ .enh-side .enh-tabs { flex: 1; min-width: 0; }
1027
+ .enh-tab-list { display: none; }
1028
+ .enh-tab-select { display: block; }
1029
+ .enh-grid { grid-template-columns: minmax(0, 1fr); }
1030
+ .enh-grid > label { text-align: left; }
641
1031
  }
642
- `;var my=document.createElement("style");my.textContent=py;document.head.appendChild(my);var vy=new df;globalThis.webst=vy;var gy=document.getElementById("root");if(gy==null)throw Error("[serve web] #root element missing from the shell html");Tc(gy).render(s(hy,{st:vy}));
1032
+ `;var F_=document.createElement("style");F_.textContent=j_;document.head.appendChild(F_);var K_=new y0;globalThis.webst=K_;var q_=document.getElementById("root");if(q_==null)throw Error("[serve web] #root element missing from the shell html");Zg(q_).render(p(U_,{st:K_}));