easel-canvas 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,65 +0,0 @@
1
- var mb=Object.defineProperty;var gb=(l,c,u)=>c in l?mb(l,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):l[c]=u;var jp=(l,c,u)=>gb(l,typeof c!="symbol"?c+"":c,u);(function(){const c=document.createElement("link").relList;if(c&&c.supports&&c.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))f(h);new MutationObserver(h=>{for(const p of h)if(p.type==="childList")for(const v of p.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&f(v)}).observe(document,{childList:!0,subtree:!0});function u(h){const p={};return h.integrity&&(p.integrity=h.integrity),h.referrerPolicy&&(p.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?p.credentials="include":h.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function f(h){if(h.ep)return;h.ep=!0;const p=u(h);fetch(h.href,p)}})();var jf={exports:{}},nc={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Sp;function pb(){if(Sp)return nc;Sp=1;var l=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function u(f,h,p){var v=null;if(p!==void 0&&(v=""+p),h.key!==void 0&&(v=""+h.key),"key"in h){p={};for(var C in h)C!=="key"&&(p[C]=h[C])}else p=h;return h=p.ref,{$$typeof:l,type:f,key:v,ref:h!==void 0?h:null,props:p}}return nc.Fragment=c,nc.jsx=u,nc.jsxs=u,nc}var Np;function yb(){return Np||(Np=1,jf.exports=pb()),jf.exports}var s=yb(),Sf={exports:{}},_e={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Tp;function vb(){if(Tp)return _e;Tp=1;var l=Symbol.for("react.transitional.element"),c=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),p=Symbol.for("react.consumer"),v=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),S=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),M=Symbol.for("react.view_transition"),D=Symbol.iterator;function q(k){return k===null||typeof k!="object"?null:(k=D&&k[D]||k["@@iterator"],typeof k=="function"?k:null)}var K={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,R={};function W(k,U,ae){this.props=k,this.context=U,this.refs=R,this.updater=ae||K}W.prototype.isReactComponent={},W.prototype.setState=function(k,U){if(typeof k!="object"&&typeof k!="function"&&k!=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,k,U,"setState")},W.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function ne(){}ne.prototype=W.prototype;function F(k,U,ae){this.props=k,this.context=U,this.refs=R,this.updater=ae||K}var fe=F.prototype=new ne;fe.constructor=F,T(fe,W.prototype),fe.isPureReactComponent=!0;var ie=Array.isArray;function ue(){}var te={H:null,A:null,T:null,S:null},ce=Object.prototype.hasOwnProperty;function je(k,U,ae){var B=ae.ref;return{$$typeof:l,type:k,key:U,ref:B!==void 0?B:null,props:ae}}function Ce(k,U){return je(k.type,U,k.props)}function lt(k){return typeof k=="object"&&k!==null&&k.$$typeof===l}function zt(k){var U={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(ae){return U[ae]})}var At=/\/+/g;function et(k,U){return typeof k=="object"&&k!==null&&k.key!=null?zt(""+k.key):U.toString(36)}function he(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(ue,ue):(k.status="pending",k.then(function(U){k.status==="pending"&&(k.status="fulfilled",k.value=U)},function(U){k.status==="pending"&&(k.status="rejected",k.reason=U)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function pe(k,U,ae,B,re){var oe=typeof k;(oe==="undefined"||oe==="boolean")&&(k=null);var de=!1;if(k===null)de=!0;else switch(oe){case"bigint":case"string":case"number":de=!0;break;case"object":switch(k.$$typeof){case l:case c:de=!0;break;case y:return de=k._init,pe(de(k._payload),U,ae,B,re)}}if(de)return re=re(k),de=B===""?"."+et(k,0):B,ie(re)?(ae="",de!=null&&(ae=de.replace(At,"$&/")+"/"),pe(re,U,ae,"",function(gt){return gt})):re!=null&&(lt(re)&&(re=Ce(re,ae+(re.key==null||k&&k.key===re.key?"":(""+re.key).replace(At,"$&/")+"/")+de)),U.push(re)),1;de=0;var se=B===""?".":B+":";if(ie(k))for(var ve=0;ve<k.length;ve++)B=k[ve],oe=se+et(B,ve),de+=pe(B,U,ae,oe,re);else if(ve=q(k),typeof ve=="function")for(k=ve.call(k),ve=0;!(B=k.next()).done;)B=B.value,oe=se+et(B,ve++),de+=pe(B,U,ae,oe,re);else if(oe==="object"){if(typeof k.then=="function")return pe(he(k),U,ae,B,re);throw U=String(k),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return de}function Se(k,U,ae){if(k==null)return k;var B=[],re=0;return pe(k,B,"","",function(oe){return U.call(ae,oe,re++)}),B}function Me(k){if(k._status===-1){var U=k._result,ae=U();ae.then(function(B){(k._status===0||k._status===-1)&&(k._status=1,k._result=B,ae.status===void 0&&(ae.status="fulfilled",ae.value=B))},function(B){(k._status===0||k._status===-1)&&(k._status=2,k._result=B,ae.status===void 0&&(ae.status="rejected",ae.reason=B))}),k._status===-1&&(k._status=0,k._result=ae)}if(k._status===1)return k._result.default;throw k._result}var ke=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)};function ct(k){var U=te.T,ae={};ae.types=U!==null?U.types:null,te.T=ae;try{var B=k(),re=te.S;re!==null&&re(ae,B),typeof B=="object"&&B!==null&&typeof B.then=="function"&&B.then(ue,ke)}catch(oe){ke(oe)}finally{U!==null&&ae.types!==null&&(U.types=ae.types),te.T=U}}function G(k){var U=te.T;if(U!==null){var ae=U.types;ae===null?U.types=[k]:ae.indexOf(k)===-1&&ae.push(k)}else ct(G.bind(null,k))}var J={map:Se,forEach:function(k,U,ae){Se(k,function(){U.apply(this,arguments)},ae)},count:function(k){var U=0;return Se(k,function(){U++}),U},toArray:function(k){return Se(k,function(U){return U})||[]},only:function(k){if(!lt(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return _e.Activity=b,_e.Children=J,_e.Component=W,_e.Fragment=u,_e.Profiler=h,_e.PureComponent=F,_e.StrictMode=f,_e.Suspense=N,_e.ViewTransition=M,_e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=te,_e.__COMPILER_RUNTIME={__proto__:null,c:function(k){return te.H.useMemoCache(k)}},_e.addTransitionType=G,_e.cache=function(k){return function(){return k.apply(null,arguments)}},_e.cacheSignal=function(){return null},_e.cloneElement=function(k,U,ae){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var B=T({},k.props),re=k.key;if(U!=null)for(oe in U.key!==void 0&&(re=""+U.key),U)!ce.call(U,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&U.ref===void 0||(B[oe]=U[oe]);var oe=arguments.length-2;if(oe===1)B.children=ae;else if(1<oe){for(var de=Array(oe),se=0;se<oe;se++)de[se]=arguments[se+2];B.children=de}return je(k.type,re,B)},_e.createContext=function(k){return k={$$typeof:v,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:p,_context:k},k},_e.createElement=function(k,U,ae){var B,re={},oe=null;if(U!=null)for(B in U.key!==void 0&&(oe=""+U.key),U)ce.call(U,B)&&B!=="key"&&B!=="__self"&&B!=="__source"&&(re[B]=U[B]);var de=arguments.length-2;if(de===1)re.children=ae;else if(1<de){for(var se=Array(de),ve=0;ve<de;ve++)se[ve]=arguments[ve+2];re.children=se}if(k&&k.defaultProps)for(B in de=k.defaultProps,de)re[B]===void 0&&(re[B]=de[B]);return je(k,oe,re)},_e.createRef=function(){return{current:null}},_e.forwardRef=function(k){return{$$typeof:C,render:k}},_e.isValidElement=lt,_e.lazy=function(k){return{$$typeof:y,_payload:{_status:-1,_result:k},_init:Me}},_e.memo=function(k,U){return{$$typeof:S,type:k,compare:U===void 0?null:U}},_e.startTransition=ct,_e.unstable_useCacheRefresh=function(){return te.H.useCacheRefresh()},_e.use=function(k){return te.H.use(k)},_e.useActionState=function(k,U,ae){return te.H.useActionState(k,U,ae)},_e.useCallback=function(k,U){return te.H.useCallback(k,U)},_e.useContext=function(k){return te.H.useContext(k)},_e.useDebugValue=function(){},_e.useDeferredValue=function(k,U){return te.H.useDeferredValue(k,U)},_e.useEffect=function(k,U){return te.H.useEffect(k,U)},_e.useEffectEvent=function(k){return te.H.useEffectEvent(k)},_e.useId=function(){return te.H.useId()},_e.useImperativeHandle=function(k,U,ae){return te.H.useImperativeHandle(k,U,ae)},_e.useInsertionEffect=function(k,U){return te.H.useInsertionEffect(k,U)},_e.useLayoutEffect=function(k,U){return te.H.useLayoutEffect(k,U)},_e.useMemo=function(k,U){return te.H.useMemo(k,U)},_e.useOptimistic=function(k,U){return te.H.useOptimistic(k,U)},_e.useReducer=function(k,U,ae){return te.H.useReducer(k,U,ae)},_e.useRef=function(k){return te.H.useRef(k)},_e.useState=function(k){return te.H.useState(k)},_e.useSyncExternalStore=function(k,U,ae){return te.H.useSyncExternalStore(k,U,ae)},_e.useTransition=function(){return te.H.useTransition()},_e.version="19.3.0",_e}var Cp;function Wf(){return Cp||(Cp=1,Sf.exports=vb()),Sf.exports}var j=Wf(),Nf={exports:{}},lc={},Tf={exports:{}},Cf={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var Ep;function bb(){return Ep||(Ep=1,(function(l){function c(he,pe){var Se=he.length;he.push(pe);e:for(;0<Se;){var Me=Se-1>>>1,ke=he[Me];if(0<h(ke,pe))he[Me]=pe,he[Se]=ke,Se=Me;else break e}}function u(he){return he.length===0?null:he[0]}function f(he){if(he.length===0)return null;var pe=he[0],Se=he.pop();if(Se!==pe){he[0]=Se;e:for(var Me=0,ke=he.length,ct=ke>>>1;Me<ct;){var G=2*(Me+1)-1,J=he[G],k=G+1,U=he[k];if(0>h(J,Se))k<ke&&0>h(U,J)?(he[Me]=U,he[k]=Se,Me=k):(he[Me]=J,he[G]=Se,Me=G);else if(k<ke&&0>h(U,Se))he[Me]=U,he[k]=Se,Me=k;else break e}}return pe}function h(he,pe){var Se=he.sortIndex-pe.sortIndex;return Se!==0?Se:he.id-pe.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var p=performance;l.unstable_now=function(){return p.now()}}else{var v=Date,C=v.now();l.unstable_now=function(){return v.now()-C}}var N=[],S=[],y=1,b=null,M=3,D=!1,q=!1,K=!1,T=!1,R=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,ne=typeof setImmediate<"u"?setImmediate:null;function F(he){for(var pe=u(S);pe!==null;){if(pe.callback===null)f(S);else if(pe.startTime<=he)f(S),pe.sortIndex=pe.expirationTime,c(N,pe);else break;pe=u(S)}}function fe(he){if(K=!1,F(he),!q)if(u(N)!==null)q=!0,ie||(ie=!0,lt());else{var pe=u(S);pe!==null&&et(fe,pe.startTime-he)}}var ie=!1,ue=-1,te=5,ce=-1;function je(){return T?!0:!(l.unstable_now()-ce<te)}function Ce(){if(T=!1,ie){var he=l.unstable_now();ce=he;var pe=!0;try{e:{q=!1,K&&(K=!1,W(ue),ue=-1),D=!0;var Se=M;try{t:{for(F(he),b=u(N);b!==null&&!(b.expirationTime>he&&je());){var Me=b.callback;if(typeof Me=="function"){b.callback=null,M=b.priorityLevel;var ke=Me(b.expirationTime<=he);if(he=l.unstable_now(),typeof ke=="function"){b.callback=ke,F(he),pe=!0;break t}b===u(N)&&f(N),F(he)}else f(N);b=u(N)}if(b!==null)pe=!0;else{var ct=u(S);ct!==null&&et(fe,ct.startTime-he),pe=!1}}break e}finally{b=null,M=Se,D=!1}pe=void 0}}finally{pe?lt():ie=!1}}}var lt;if(typeof ne=="function")lt=function(){ne(Ce)};else if(typeof MessageChannel<"u"){var zt=new MessageChannel,At=zt.port2;zt.port1.onmessage=Ce,lt=function(){At.postMessage(null)}}else lt=function(){R(Ce,0)};function et(he,pe){ue=R(function(){he(l.unstable_now())},pe)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(he){he.callback=null},l.unstable_forceFrameRate=function(he){0>he||125<he?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<he?Math.floor(1e3/he):5},l.unstable_getCurrentPriorityLevel=function(){return M},l.unstable_next=function(he){switch(M){case 1:case 2:case 3:var pe=3;break;default:pe=M}var Se=M;M=pe;try{return he()}finally{M=Se}},l.unstable_requestPaint=function(){T=!0},l.unstable_runWithPriority=function(he,pe){switch(he){case 1:case 2:case 3:case 4:case 5:break;default:he=3}var Se=M;M=he;try{return pe()}finally{M=Se}},l.unstable_scheduleCallback=function(he,pe,Se){var Me=l.unstable_now();switch(typeof Se=="object"&&Se!==null?(Se=Se.delay,Se=typeof Se=="number"&&0<Se?Me+Se:Me):Se=Me,he){case 1:var ke=-1;break;case 2:ke=250;break;case 5:ke=1073741823;break;case 4:ke=1e4;break;default:ke=5e3}return ke=Se+ke,he={id:y++,callback:pe,priorityLevel:he,startTime:Se,expirationTime:ke,sortIndex:-1},Se>Me?(he.sortIndex=Se,c(S,he),u(N)===null&&he===u(S)&&(K?(W(ue),ue=-1):K=!0,et(fe,Se-Me))):(he.sortIndex=ke,c(N,he),q||D||(q=!0,ie||(ie=!0,lt()))),he},l.unstable_shouldYield=je,l.unstable_wrapCallback=function(he){var pe=M;return function(){var Se=M;M=pe;try{return he.apply(this,arguments)}finally{M=Se}}}})(Cf)),Cf}var Mp;function xb(){return Mp||(Mp=1,Tf.exports=bb()),Tf.exports}var Ef={exports:{}},yn={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var kp;function wb(){if(kp)return yn;kp=1;var l=Wf();function c(y){var b="https://react.dev/errors/"+y;if(1<arguments.length){b+="?args[]="+encodeURIComponent(arguments[1]);for(var M=2;M<arguments.length;M++)b+="&args[]="+encodeURIComponent(arguments[M])}return"Minified React error #"+y+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(){}var f={d:{f:u,r:function(){throw Error(c(522))},D:u,C:u,L:u,m:u,X:u,S:u,M:u},p:0,findDOMNode:null},h=Symbol.for("react.portal"),p=Symbol.for("react.recoverable"),v=Symbol.for("react.optimistic_key");function C(y,b,M){var D=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:D==null?null:D===v?v:""+D,children:y,containerInfo:b,implementation:M}}var N=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function S(y,b){if(y==="font")return"";if(typeof b=="string")return b==="use-credentials"?b:""}return yn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=f,yn.browser=function(y){return{$$typeof:p,_reason:y}},yn.createPortal=function(y,b){var M=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)throw Error(c(299));return C(y,b,null,M)},yn.flushSync=function(y){var b=N.T,M=f.p;try{if(N.T=null,f.p=2,y)return y()}finally{N.T=b,f.p=M,f.d.f()}},yn.preconnect=function(y,b){typeof y=="string"&&(b?(b=b.crossOrigin,b=typeof b=="string"?b==="use-credentials"?b:"":void 0):b=null,f.d.C(y,b))},yn.prefetchDNS=function(y){typeof y=="string"&&f.d.D(y)},yn.preinit=function(y,b){if(typeof y=="string"&&b&&typeof b.as=="string"){var M=b.as,D=S(M,b.crossOrigin),q=typeof b.integrity=="string"?b.integrity:void 0,K=typeof b.fetchPriority=="string"?b.fetchPriority:void 0;M==="style"?f.d.S(y,typeof b.precedence=="string"?b.precedence:void 0,{crossOrigin:D,integrity:q,fetchPriority:K}):M==="script"&&f.d.X(y,{crossOrigin:D,integrity:q,fetchPriority:K,nonce:typeof b.nonce=="string"?b.nonce:void 0})}},yn.preinitModule=function(y,b){if(typeof y=="string")if(typeof b=="object"&&b!==null){if(b.as==null||b.as==="script"){var M=S(b.as,b.crossOrigin);f.d.M(y,{crossOrigin:M,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}}else b==null&&f.d.M(y)},yn.preload=function(y,b){if(typeof y=="string"&&typeof b=="object"&&b!==null&&typeof b.as=="string"){var M=b.as,D=S(M,b.crossOrigin);f.d.L(y,M,{crossOrigin:D,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,type:typeof b.type=="string"?b.type:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0,referrerPolicy:typeof b.referrerPolicy=="string"?b.referrerPolicy:void 0,imageSrcSet:typeof b.imageSrcSet=="string"?b.imageSrcSet:void 0,imageSizes:typeof b.imageSizes=="string"?b.imageSizes:void 0,media:typeof b.media=="string"?b.media:void 0})}},yn.preloadModule=function(y,b){if(typeof y=="string")if(b){var M=S(b.as,b.crossOrigin);f.d.m(y,{as:typeof b.as=="string"&&b.as!=="script"?b.as:void 0,crossOrigin:M,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}else f.d.m(y)},yn.requestFormReset=function(y){f.d.r(y)},yn.unstable_batchedUpdates=function(y,b){return y(b)},yn.useFormState=function(y,b,M){return N.H.useFormState(y,b,M)},yn.useFormStatus=function(){return N.H.useHostTransitionStatus()},yn.version="19.3.0",yn}var zp;function cy(){if(zp)return Ef.exports;zp=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(c){console.error(c)}}return l(),Ef.exports=wb(),Ef.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var Ap;function jb(){if(Ap)return lc;Ap=1;var l=xb(),c=Wf(),u=cy();function f(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 h(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function p(e){for(var t=e,n=t;n&&!n.alternate;)t=n,(t.flags&4098)!==0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function v(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function C(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function N(e){if(p(e)!==e)throw Error(f(188))}function S(e){var t=e.alternate;if(!t){if(t=p(e),t===null)throw Error(f(188));return t!==e?null:e}for(var n=e,a=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(a=i.return,a!==null){n=a;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return N(i),e;if(o===a)return N(i),t;o=o.sibling}throw Error(f(188))}if(n.return!==a.return)n=i,a=o;else{for(var m=!1,w=i.child;w;){if(w===n){m=!0,n=i,a=o;break}if(w===a){m=!0,a=i,n=o;break}w=w.sibling}if(!m){for(w=o.child;w;){if(w===n){m=!0,n=o,a=i;break}if(w===a){m=!0,a=o,n=i;break}w=w.sibling}if(!m)throw Error(f(189))}}if(n.alternate!==a)throw Error(f(190))}if(n.tag!==3)throw Error(f(188));return n.stateNode.current===n?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}function b(e,t,n,a,i,o){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,a,i,o)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&b(e.child,t,n,a,i,o))return!0;e=e.sibling}return!1}function M(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function D(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function q(e){var t=[null,null],n=M(e);return n===null||K(t,e,n.child,{foundSelf:!1}),t}function K(e,t,n,a){for(;n!==null;){if(n===t)a.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(a.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&K(e,t,n.child,a))return!0;n=n.sibling}return!1}function T(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(f(559))}}var R=null,W=null;function ne(e,t,n){return e===n?!0:e===t?(R=e,!0):!1}function F(e,t,n){return e===n?(W=e,!1):e===t?(W!==null&&(R=e),!0):!1}function fe(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function ie(e,t,n){for(var a=0,i=e;i;i=n(i))a++;i=0;for(var o=t;o;o=n(o))i++;for(;0<a-i;)e=n(e),a--;for(;0<i-a;)t=n(t),i--;for(;a--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var ue=Object.assign,te=Symbol.for("react.element"),ce=Symbol.for("react.transitional.element"),je=Symbol.for("react.portal"),Ce=Symbol.for("react.fragment"),lt=Symbol.for("react.strict_mode"),zt=Symbol.for("react.profiler"),At=Symbol.for("react.consumer"),et=Symbol.for("react.context"),he=Symbol.for("react.forward_ref"),pe=Symbol.for("react.suspense"),Se=Symbol.for("react.suspense_list"),Me=Symbol.for("react.memo"),ke=Symbol.for("react.lazy"),ct=Symbol.for("react.activity"),G=Symbol.for("react.legacy_hidden"),J=Symbol.for("react.memo_cache_sentinel"),k=Symbol.for("react.view_transition"),U=Symbol.for("react.recoverable"),ae=Symbol.iterator;function B(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var re=Symbol.for("react.client.reference");function oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===re?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ce:return"Fragment";case zt:return"Profiler";case lt:return"StrictMode";case pe:return"Suspense";case Se:return"SuspenseList";case ct:return"Activity";case k:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case je:return"Portal";case et:return e.displayName||"Context";case At:return(e._context.displayName||"Context")+".Consumer";case he:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Me:return t=e.displayName||null,t!==null?t:oe(e.type)||"Memo";case ke:t=e._payload,e=e._init;try{return oe(e(t))}catch{}}return null}var de=Array.isArray,se=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ve=u.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,gt={pending:!1,data:null,method:null,action:null},at=[],Nt=-1;function it(e){return{current:e}}function Ee(e){0>Nt||(e.current=at[Nt],at[Nt]=null,Nt--)}function $e(e,t){Nt++,at[Nt]=e.current,e.current=t}var bn=it(null),Ul=it(null),Tt=it(null),cn=it(null);function jl(e,t){switch($e(Tt,t),$e(Ul,e),$e(bn,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ag(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ag(t),e=Og(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ee(bn),$e(bn,e)}function Sl(){Ee(bn),Ee(Ul),Ee(Tt)}function sa(e){var t=e.memoizedState;t!==null&&(Vs._currentValue=t.memoizedState,$e(cn,e)),t=bn.current;var n=Og(t,e.type);t!==n&&($e(Ul,e),$e(bn,n))}function Un(e){Ul.current===e&&(Ee(bn),Ee(Ul)),cn.current===e&&(Ee(cn),Vs._currentValue=gt)}var il,Hl;function xn(e){if(il===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);il=t&&t[1]||"",Hl=-1<n.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+il+e+Hl}var xi=!1;function Ra(e,t){if(!e||xi)return"";xi=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(ye){var L=ye}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(ye){L=ye}ee=!1;try{var V=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),ee=!0,new e}finally{ee&&(V!==void 0?Object.defineProperty(e.prototype,"props",V):delete e.prototype.props)}}}else{try{throw Error()}catch(ye){L=ye}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(ye){if(ye&&L&&typeof ye.stack=="string")return[ye.stack,L.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 o=a.DetermineComponentFrameRoot(),m=o[0],w=o[1];if(m&&w){var A=m.split(`
44
- `),Y=w.split(`
45
- `);for(i=a=0;a<A.length&&!A[a].includes("DetermineComponentFrameRoot");)a++;for(;i<Y.length&&!Y[i].includes("DetermineComponentFrameRoot");)i++;if(a===A.length||i===Y.length)for(a=A.length-1,i=Y.length-1;1<=a&&0<=i&&A[a]!==Y[i];)i--;for(;1<=a&&0<=i;a--,i--)if(A[a]!==Y[i]){if(a!==1||i!==1)do if(a--,i--,0>i||A[a]!==Y[i]){var Z=`
46
- `+A[a].replace(" at new "," at ");return e.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",e.displayName)),Z}while(1<=a&&0<=i);break}}}finally{xi=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?xn(n):""}function _a(e,t){switch(e.tag){case 26:case 27:case 5:return xn(e.type);case 16:return xn("Lazy");case 13:return e.child!==t&&t!==null?xn("Suspense Fallback"):xn("Suspense");case 19:return xn("SuspenseList");case 0:case 15:return Ra(e.type,!1);case 11:return Ra(e.type.render,!1);case 1:return Ra(e.type,!0);case 31:return xn("Activity");case 30:return xn("ViewTransition");default:return""}}function rn(e){try{var t="",n=null;do t+=_a(e,n),n=e,e=e.return;while(e);return t}catch(a){return`
47
- Error generating stack: `+a.message+`
48
- `+a.stack}}var Hn=Object.prototype.hasOwnProperty,Ll=l.unstable_scheduleCallback,$l=l.unstable_cancelCallback,Nl=l.unstable_shouldYield,Fn=l.unstable_requestPaint,rt=l.unstable_now,Ke=l.unstable_getCurrentPriorityLevel,Pt=l.unstable_ImmediatePriority,Tl=l.unstable_UserBlockingPriority,Yl=l.unstable_NormalPriority,sl=l.unstable_LowPriority,Et=l.unstable_IdlePriority,Gl=l.log,oa=l.unstable_setDisableYieldValue,ol=null,Gt=null;function wn(e){if(typeof Gl=="function"&&oa(e),Gt&&typeof Gt.setStrictMode=="function")try{Gt.setStrictMode(ol,e)}catch{}}var Rt=Math.clz32?Math.clz32:ls,ca=Math.log,wi=Math.LN2;function ls(e){return e>>>=0,e===0?32:31-(ca(e)/wi|0)|0}var ql=256,ra=262144,En=4194304;function Mn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ln(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var i=0,o=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var w=a&134217727;return w!==0?(a=w&~o,a!==0?i=Mn(a):(m&=w,m!==0?i=Mn(m):n||(n=w&~e,n!==0&&(i=Mn(n))))):(w=a&~o,w!==0?i=Mn(w):m!==0?i=Mn(m):n||(n=a&~e,n!==0&&(i=Mn(n)))),i===0?0:t!==0&&t!==i&&(t&o)===0&&(o=i&-i,n=t&-t,o>=n||o===32&&(n&4194048)!==0)?t:i}function Wn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ua(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var a=31-Rt(n),i=1<<a;t|=e[a],n&=~i}return t}function ut(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function $n(){var e=En;return En<<=1,(En&62914560)===0&&(En=4194304),e}function ji(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function z(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function H(e,t,n,a,i,o){var m=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 w=e.entanglements,A=e.expirationTimes,Y=e.hiddenUpdates;for(n=m&~n;0<n;){var Z=31-Rt(n),ee=1<<Z;w[Z]=0,A[Z]=-1;var L=Y[Z];if(L!==null)for(Y[Z]=null,Z=0;Z<L.length;Z++){var V=L[Z];V!==null&&(V.lane&=-536870913)}n&=~ee}a!==0&&xe(e,a,0),o!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=o&~(m&~t))}function xe(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-Rt(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&261930}function me(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-Rt(n),i=1<<a;i&t|e[a]&t&&(e[a]|=t),n&=~i}}function ze(e,t){var n=t&-t;return n=(n&42)!==0?1:We(n),(n&(e.suspendedLanes|t))!==0?0:n}function We(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 Be(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ye(){var e=ve.p;return e!==0?e:(e=window.event,e===void 0?32:gp(e.type))}function un(e,t){var n=ve.p;try{return ve.p=e,t()}finally{ve.p=n}}var Ue=Math.random().toString(36).slice(2),Ot="__reactFiber$"+Ue,Xe="__reactProps$"+Ue,xt="__reactContainer$"+Ue,Cl="__reactEvents$"+Ue,El="__reactListeners$"+Ue,hc="__reactHandles$"+Ue,Si="__reactResources$"+Ue,Ba="__reactMarker$"+Ue,Xl="__reactLoad$"+Ue;function as(e){delete e[Ot],delete e[Xe],delete e[El],delete e[hc]}function dn(e){var t;if(t=e[Ot])return t;for(var n=e.parentNode;n;){if(t=n[xt]||n[Ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Jg(e);e!==null;){if(n=e[Ot])return n;e=Jg(e)}return t}e=n,n=e.parentNode}return null}function kn(e){if(e=e[Ot]||e[xt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ni(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(f(33))}function da(e){var t=e[Si];return t||(t=e[Si]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function qt(e){e[Ba]=!0}function Ps(e){e[Xl]=void 0}var eo=new Set,to={};function wt(e,t){jn(e,t),jn(e+"Capture",t)}function jn(e,t){for(to[e]=t,e=0;e<t.length;e++)eo.add(t[e])}var Ht=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]*$"),_t={},no={};function Ua(e){return Hn.call(no,e)?!0:Hn.call(_t,e)?!1:Ht.test(e)?no[e]=!0:(_t[e]=!0,!1)}var tt=!1;function lo(){var e=tt;return tt=!1,e}function Ti(e,t,n){if(Ua(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 Ci(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 Yn(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 be(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ao(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function mc(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 i=a.get,o=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(m){n=""+m,o.call(this,m)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return n},setValue:function(m){n=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jt(e){if(!e._valueTracker){var t=ao(e)?"checked":"value";e._valueTracker=mc(e,t,""+e[t])}}function Sn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=ao(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}var fa=/[\n"\\]/g;function ft(e){return e.replace(fa,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ei(e,t,n,a,i,o,m,w){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+be(t)):e.value!==""+be(t)&&(e.value=""+be(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?m==="number"&&e.value==t?Gn(e,be(e.value)):Gn(e,be(t)):n!=null?Gn(e,be(n)):a!=null&&e.removeAttribute("value"),i==null&&o!=null&&(e.defaultChecked=!!o),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+be(w):e.removeAttribute("name")}function Zt(e,t,n,a,i,o,m,w){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!=null)){jt(e);return}n=n!=null?""+be(n):"",t=t!=null?""+be(t):n,w||t===e.value||(e.value=t),e.defaultValue=t}a=a??i,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=w?e.checked:!!a,e.defaultChecked=!!a,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),jt(e)}function Gn(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function ha(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{for(n=""+be(n),t=null,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 gc(e,t,n){if(t!=null&&(t=""+be(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+be(n):""}function ma(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(f(92));if(de(a)){if(1<a.length)throw Error(f(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=be(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a),jt(e)}function qn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ha=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 La(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||Ha.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Ml(e,t,n){if(t!=null&&typeof t!="object")throw Error(f(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]="",tt=!0);for(var i in t)a=t[i],t.hasOwnProperty(i)&&n[i]!==a&&(La(e,i,a),tt=!0)}else for(var o in t)t.hasOwnProperty(o)&&La(e,o,t[o])}function ga(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 is=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ss=/^[\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 $a(e){return ss.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function zn(){}var os=null;function io(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ya=null,ln=null;function so(e){var t=kn(e);if(t&&(e=t.stateNode)){var n=e[Xe]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ei(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+ft(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var i=a[Xe]||null;if(!i)throw Error(f(90));Ei(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&&Sn(a)}break e;case"textarea":gc(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ha(e,!!n.multiple,t,!1)}}}var cl=!1;function pc(e,t,n){if(cl)return e(t,n);cl=!0;try{var a=e(t);return a}finally{if(cl=!1,(Ya!==null||ln!==null)&&(kr(),Ya&&(t=Ya,e=ln,ln=Ya=null,so(t),e)))for(t=0;t<e.length;t++)so(e[t])}}function Vl(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Xe]||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(f(231,t,typeof n));return n}var kl=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cs=!1;if(kl)try{var pa={};Object.defineProperty(pa,"passive",{get:function(){cs=!0}}),window.addEventListener("test",pa,pa),window.removeEventListener("test",pa,pa)}catch{cs=!1}var Xn=null,rl=null,Mi=null;function oo(){if(Mi)return Mi;var e,t=rl,n=t.length,a,i="value"in Xn?Xn.value:Xn.textContent,o=i.length;for(e=0;e<n&&t[e]===i[e];e++);var m=n-e;for(a=1;a<=m&&t[n-a]===i[o-a];a++);return Mi=i.slice(e,1<a?1-a:void 0)}function ki(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 ya(){return!0}function zi(){return!1}function Qt(e){function t(n,a,i,o,m){this._reactName=n,this._targetInst=i,this.type=a,this.nativeEvent=o,this.target=m,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(n=e[w],this[w]=n?n(o):o[w]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?ya:zi,this.isPropagationStopped=zi,this}return ue(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=ya)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ya)},persist:function(){},isPersistent:ya}),t}var Kl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ai=Qt(Kl),ul=ue({},Kl,{view:0,detail:0}),au=Qt(ul),co,ro,va,rs=ue({},ul,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:en,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==va&&(va&&e.type==="mousemove"?(co=e.screenX-va.screenX,ro=e.screenY-va.screenY):ro=co=0,va=e),co)},movementY:function(e){return"movementY"in e?e.movementY:ro}}),uo=Qt(rs),iu=ue({},rs,{dataTransfer:0}),Oi=Qt(iu),yc=ue({},ul,{relatedTarget:0}),Ga=Qt(yc),qa=ue({},Kl,{animationName:0,elapsedTime:0,pseudoElement:0}),vc=Qt(qa),su=ue({},Kl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ou=Qt(su),cu=ue({},Kl,{data:0}),fo=Qt(cu),Zl={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bc={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"},xc={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wc(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=xc[e])?!!t[e]:!1}function en(){return wc}var jc=ue({},ul,{key:function(e){if(e.key){var t=Zl[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ki(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?bc[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:en,charCode:function(e){return e.type==="keypress"?ki(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ki(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ho=Qt(jc),ru=ue({},rs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sc=Qt(ru),uu=ue({},Kl,{submitter:0}),Nc=Qt(uu),du=ue({},ul,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:en}),fu=Qt(du),Tc=ue({},Kl,{propertyName:0,elapsedTime:0,pseudoElement:0}),hu=Qt(Tc),mu=ue({},rs,{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}),Cc=Qt(mu),Ec=ue({},Kl,{newState:0,oldState:0,source:0}),us=Qt(Ec),gu=[9,13,27,32],Di=kl&&"CompositionEvent"in window,Ri=null;kl&&"documentMode"in document&&(Ri=document.documentMode);var pu=kl&&"TextEvent"in window&&!Ri,mo=kl&&(!Di||Ri&&8<Ri&&11>=Ri),go=" ",po=!1;function Mc(e,t){switch(e){case"keyup":return gu.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ge(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var dl=!1;function yu(e,t){switch(e){case"compositionend":return Ge(t);case"keypress":return t.which!==32?null:(po=!0,go);case"textInput":return e=t.data,e===go&&po?null:e;default:return null}}function vu(e,t){if(dl)return e==="compositionend"||!Di&&Mc(e,t)?(e=oo(),Mi=rl=Xn=null,dl=!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 mo&&t.locale!=="ko"?null:t.data;default:return null}}var _i={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 kc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!_i[e.type]:t==="textarea"}function fl(e,t,n,a){Ya?ln?ln.push(a):ln=[a]:Ya=a,t=_r(t,"onChange"),0<t.length&&(n=new Ai("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var hl=null,ba=null;function yo(e){Tg(e,0)}function xa(e){var t=Ni(e);if(Sn(t))return e}function Bi(e,t){if(e==="change")return t}var Xa=!1;if(kl){var ds;if(kl){var fs="oninput"in document;if(!fs){var zc=document.createElement("div");zc.setAttribute("oninput","return;"),fs=typeof zc.oninput=="function"}ds=fs}else ds=!1;Xa=ds&&(!document.documentMode||9<document.documentMode)}function vo(){hl&&(hl.detachEvent("onpropertychange",wa),ba=hl=null)}function wa(e){if(e.propertyName==="value"&&xa(ba)){var t=[];fl(t,ba,e,io(e)),pc(yo,t)}}function Ac(e,t,n){e==="focusin"?(vo(),hl=t,ba=n,hl.attachEvent("onpropertychange",wa)):e==="focusout"&&vo()}function Oc(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return xa(ba)}function Dc(e,t){if(e==="click")return xa(t)}function Rc(e,t){if(e==="input"||e==="change")return xa(t)}function _c(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nn=typeof Object.is=="function"?Object.is:_c;function Va(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),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var i=n[a];if(!Hn.call(t,i)||!Nn(e[i],t[i]))return!1}return!0}function hs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function bo(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function xo(e,t){var n=bo(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=bo(n)}}function wo(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wo(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jo(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=hs(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=hs(e.document)}return t}function ms(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 Bc=kl&&"documentMode"in document&&11>=document.documentMode,ja=null,gs=null,d=null,g=!1;function x(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;g||ja==null||ja!==hs(a)||(a=ja,"selectionStart"in a&&ms(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}),d&&Va(d,a)||(d=a,a=_r(gs,"onSelect"),0<a.length&&(t=new Ai("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=ja)))}function E(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var O={animationend:E("Animation","AnimationEnd"),animationiteration:E("Animation","AnimationIteration"),animationstart:E("Animation","AnimationStart"),transitionrun:E("Transition","TransitionRun"),transitionstart:E("Transition","TransitionStart"),transitioncancel:E("Transition","TransitionCancel"),transitionend:E("Transition","TransitionEnd")},Q={},le={};kl&&(le=document.createElement("div").style,"AnimationEvent"in window||(delete O.animationend.animation,delete O.animationiteration.animation,delete O.animationstart.animation),"TransitionEvent"in window||delete O.transitionend.transition);function ge(e){if(Q[e])return Q[e];if(!O[e])return e;var t=O[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in le)return Q[e]=t[n];return e}var Oe=ge("animationend"),nt=ge("animationiteration"),Ze=ge("animationstart"),Qe=ge("transitionrun"),Xt=ge("transitionstart"),Bt=ge("transitioncancel"),tn=ge("transitionend"),Ka=new Map,Re="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Re.push("scrollEnd");function st(e,t){Ka.set(e,t),wt(t,[e])}var Vt=0;function Ve(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=Dl.identifierPrefix;var n=Vt++;return e="_"+e+"t_"+n.toString(32)+"_",t.autoName=e}function An(e){if(e==null||typeof e=="string")return e;var t=null,n=_s;if(n!==null)for(var a=0;a<n.length;a++){var i=e[n[a]];if(i!=null){if(i==="none")return"none";t=t==null?i:t+(" "+i)}}return t??e.default}function On(e,t){return e=An(e),t=An(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var Za=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)},ml=[],ps=0,bu=0;function Uc(){for(var e=ps,t=bu=ps=0;t<e;){var n=ml[t];ml[t++]=null;var a=ml[t];ml[t++]=null;var i=ml[t];ml[t++]=null;var o=ml[t];if(ml[t++]=null,a!==null&&i!==null){var m=a.pending;m===null?i.next=i:(i.next=m.next,m.next=i),a.pending=i}o!==0&&nh(n,i,o)}}function Hc(e,t,n,a){ml[ps++]=e,ml[ps++]=t,ml[ps++]=n,ml[ps++]=a,bu|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function xu(e,t,n,a){return Hc(e,t,n,a),Lc(e)}function Ui(e,t){return Hc(e,null,null,t),Lc(e)}function nh(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var i=!1,o=e.return;o!==null;)o.childLanes|=n,a=o.alternate,a!==null&&(a.childLanes|=n),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(i=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,i&&t!==null&&(i=31-Rt(n),e=o.hiddenUpdates,a=e[i],a===null?e[i]=[t]:a.push(t),t.lane=n|536870912),o):null}function Lc(e){if(50<Xo)throw Xo=0,Mr=null,Error(f(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ys={};function Ey(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 Vn(e,t,n,a){return new Ey(e,t,n,a)}function wu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Sa(e,t){var n=e.alternate;return n===null?(n=Vn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function lh(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function $c(e,t,n,a,i,o){var m=0;if(a=e,typeof a=="function")wu(a)&&(m=1);else if(typeof a=="string")m=tb(e,n,bn.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(a){case ct:return e=Vn(31,n,t,i),e.elementType=ct,e.lanes=o,e;case Ce:return Hi(n.children,i,o,t);case lt:m=8,i|=24;break;case zt:return e=Vn(12,n,t,i|2),e.elementType=zt,e.lanes=o,e;case pe:return e=Vn(13,n,t,i),e.elementType=pe,e.lanes=o,e;case Se:return e=Vn(19,n,t,i),e.elementType=Se,e.lanes=o,e;case G:case k:return e=i|32,e=Vn(30,n,t,e),e.elementType=k,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case et:m=10;break e;case At:m=9;break e;case he:m=11;break e;case Me:m=14;break e;case ke:m=16,a=null;break e}m=29,n=Error(f(130,e===null?"null":typeof e,"")),a=null}return t=Vn(m,n,t,i),t.elementType=e,t.type=a,t.lanes=o,t}function Hi(e,t,n,a){return e=Vn(7,e,a,t),e.lanes=n,e}function ju(e,t,n){return e=Vn(6,e,null,t),e.lanes=n,e}function ah(e){var t=Vn(18,null,null,0);return t.stateNode=e,t}function Su(e,t,n){return t=Vn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ih=new WeakMap;function gl(e,t){if(typeof e=="object"&&e!==null){var n=ih.get(e);return n!==void 0?n:(t={value:e,source:t,stack:rn(t)},ih.set(e,t),t)}return{value:e,source:t,stack:rn(t)}}var vs=[],bs=0,Yc=null,So=0,pl=[],yl=0,Qa=null,Ql=1,Jl="";function Na(e,t){vs[bs++]=So,vs[bs++]=Yc,Yc=e,So=t}function sh(e,t,n){pl[yl++]=Ql,pl[yl++]=Jl,pl[yl++]=Qa,Qa=e;var a=Ql;e=Jl;var i=32-Rt(a)-1;a&=~(1<<i),n+=1;var o=32-Rt(t)+i;if(30<o){var m=i-i%5;o=(a&(1<<m)-1).toString(32),a>>=m,i-=m,Ql=1<<32-Rt(t)+i|n<<i|a,Jl=o+e}else Ql=1<<o|n<<i|a,Jl=e}function Gc(e){e.return!==null&&(Na(e,1),sh(e,1,0))}function Nu(e){for(;e===Yc;)Yc=vs[--bs],vs[bs]=null,So=vs[--bs],vs[bs]=null;for(;e===Qa;)Qa=pl[--yl],pl[yl]=null,Jl=pl[--yl],pl[yl]=null,Ql=pl[--yl],pl[yl]=null}function oh(e,t){pl[yl++]=Ql,pl[yl++]=Jl,pl[yl++]=Qa,Ql=t.id,Jl=t.overflow,Qa=e}var an=null,Mt=null,qe=!1,Ja=null,vl=!1,Tu=Error(f(519));function Fa(e){var t=Error(f(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw No(gl(t,e)),Tu}function ch(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[Ot]=e,t[Xe]=a,n){case"dialog":Fe("cancel",t),Fe("close",t);break;case"iframe":case"object":case"embed":Fe("load",t);break;case"video":case"audio":for(n=0;n<Ko.length;n++)Fe(Ko[n],t);break;case"source":Fe("error",t);break;case"img":case"image":case"link":Fe("error",t),Fe("load",t);break;case"details":Fe("toggle",t);break;case"input":Fe("invalid",t),Zt(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":Fe("invalid",t);break;case"textarea":Fe("invalid",t),ma(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||kg(t.textContent,n)?(a.popover!=null&&(Fe("beforetoggle",t),Fe("toggle",t)),a.onScroll!=null&&Fe("scroll",t),a.onScrollEnd!=null&&Fe("scrollend",t),a.onClick!=null&&(t.onclick=zn),t=!0):t=!1,t||Fa(e,!0)}function qc(e){for(an=e.return;an;)switch(an.tag){case 5:case 31:case 13:vl=!1;return;case 27:case 3:vl=!0;return;default:an=an.return}}function xs(e){if(e!==an)return!1;if(!qe)return qc(e),qe=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||tf(e.type,e.memoizedProps)),n=!n),n&&Mt&&Fa(e),qc(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(317));Mt=Qg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(317));Mt=Qg(e)}else t===27?(t=Mt,fi(e.type)?(e=df,df=null,Mt=e):Mt=t):Mt=an?xl(e.stateNode.nextSibling):null;return!0}function Li(){Mt=an=null,qe=!1}function Cu(){var e=Ja;return e!==null&&(Qn===null?Qn=e:Qn.push.apply(Qn,e),Ja=null),e}function No(e){Ja===null?Ja=[e]:Ja.push(e)}var Eu=it(null),$i=null,Ta=null;function Wa(e,t,n){$e(Eu,t._currentValue),t._currentValue=n}function Ca(e){e._currentValue=Eu.current,Ee(Eu)}function Xc(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 Mu(e,t,n,a){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){var m=i.child;o=o.firstContext;e:for(;o!==null;){var w=o;o=i;for(var A=0;A<t.length;A++)if(w.context===t[A]){o.lanes|=n,w=o.alternate,w!==null&&(w.lanes|=n),Xc(o.return,n,e),a||(m=null);break e}o=w.next}}else if(i.tag===18){if(m=i.return,m===null)throw Error(f(341));m.lanes|=n,o=m.alternate,o!==null&&(o.lanes|=n),Xc(m,n,e),m=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,m=i.alternate,m!==null&&(m.lanes|=n),Xc(i.return,n,e),m=i.child,m=m!==null?m.sibling:null):m=i.child;if(m!==null)m.return=i;else for(m=i;m!==null;){if(m===e){m=null;break}if(i=m.sibling,i!==null){i.return=m.return,m=i;break}m=m.return}i=m}}function Yi(e,t,n,a){e=null;for(var i=t,o=!1;i!==null;){if(!o){if((i.flags&524288)!==0)o=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var m=i.alternate;if(m===null)throw Error(f(387));if(m=m.memoizedProps,m!==null){var w=i.type;Nn(i.pendingProps.value,m.value)||(e!==null?e.push(w):e=[w])}}else if(i===cn.current){if(m=i.alternate,m===null)throw Error(f(387));m.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(Vs):e=[Vs])}i=i.return}return e!==null&&Mu(t,e,n,a),t.flags|=262144,e!==null}function Vc(e){for(e=e.firstContext;e!==null;){if(!Nn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Gi(e){$i=e,Ta=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function fn(e){return rh($i,e)}function Kc(e,t){return $i===null&&Gi(e),rh(e,t)}function rh(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ta===null){if(e===null)throw Error(f(308));Ta=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ta=Ta.next=t;return n}var My=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()})}},ky=l.unstable_scheduleCallback,zy=l.unstable_NormalPriority,Jt={$$typeof:et,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ku(){return{controller:new My,data:new Map,refCount:0}}function To(e){e.refCount--,e.refCount===0&&ky(zy,function(){e.controller.abort()})}function uh(e,t){if((e.pendingLanes&4194048)!==0){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var a=t[e];n.indexOf(a)===-1&&n.push(a)}}}var Co=null;function Ay(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Eo=null,zu=0,qi=0,ws=null;function Oy(e,t){if(Eo===null){var n=Eo=[];zu=0,qi=Kd(),ws={status:"pending",value:void 0,then:function(a){n.push(a)}}}return zu++,t.then(dh,dh),t}function dh(){if(--zu===0&&(Co=null,Eo!==null)){ws!==null&&(ws.status="fulfilled");var e=Eo;Eo=null,qi=0,ws=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Dy(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){for(a.status="rejected",a.reason=i,i=0;i<n.length;i++)(0,n[i])(void 0)}),a}var fh=se.S;se.S=function(e,t){if(ag=rt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Oy(e,t),Co!==null)for(var n=Ls;n!==null;)uh(n,Co),n=n.next;if(n=e.types,n!==null){for(var a=Ls;a!==null;)uh(a,n),a=a.next;if(qi!==0){a=Co,a===null&&(a=Co=[]);for(var i=0;i<n.length;i++){var o=n[i];a.indexOf(o)===-1&&a.push(o)}}}fh!==null&&fh(e,t)};var Xi=it(null);function Au(){var e=Xi.current;return e!==null?e:Ct.pooledCache}function Zc(e,t){t===null?$e(Xi,Xi.current):$e(Xi,t.pool)}function hh(){var e=Au();return e===null?null:{parent:Jt._currentValue,pool:e}}var js=Error(f(460)),Ou=Error(f(474)),Qc=Error(f(542)),Jc={then:function(){}};function mh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function gh(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(zn,zn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,yh(e),e===void 0&&!("reason"in t)?Error(f(600)):e;default:if(typeof t.status=="string")t.then(zn,zn);else{if(e=Ct,e!==null&&100<e.shellSuspendCounter)throw Error(f(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,yh(e),e}throw Ki=t,js}}function Vi(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Ki=n,js):n}}var Ki=null;function ph(){if(Ki===null)throw Error(f(459));var e=Ki;return Ki=null,e}function yh(e){if(e===js||e===Qc)throw Error(f(483))}var Ss=null,Mo=0;function Fc(e){var t=Mo;return Mo+=1,Ss===null&&(Ss=[]),gh(Ss,e,t)}function Ia(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Wc(e,t){throw t.$$typeof===te?Error(f(525)):(e=Object.prototype.toString.call(t),Error(f(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function vh(e){function t($,_){if(e){var X=$.deletions;X===null?($.deletions=[_],$.flags|=16):X.push(_)}}function n($,_){if(!e)return null;for(;_!==null;)t($,_),_=_.sibling;return null}function a($){for(var _=new Map;$!==null;)$.key===null?_.set($.index,$):_.set($.key,$),$=$.sibling;return _}function i($,_){return $=Sa($,_),$.index=0,$.sibling=null,$}function o($,_,X){return $.index=X,e?(X=$.alternate,X!==null?(X=X.index,X<_?($.flags|=2,_):X):($.flags|=134217730,_)):($.flags|=1048576,_)}function m($){return e&&$.alternate===null&&($.flags|=134217730),$}function w($,_,X,I){return _===null||_.tag!==6?(_=ju(X,$.mode,I),_.return=$,_):(_=i(_,X),_.return=$,_)}function A($,_,X,I){var we=X.type;return we===Ce?($=Z($,_,X.props.children,I,X.key),Ia($,X),$):_!==null&&(_.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===ke&&Vi(we)===_.type)?(_=i(_,X.props),Ia(_,X),_.return=$,_):(_=$c(X.type,X.key,X.props,null,$.mode,I),Ia(_,X),_.return=$,_)}function Y($,_,X,I){return _===null||_.tag!==4||_.stateNode.containerInfo!==X.containerInfo||_.stateNode.implementation!==X.implementation?(_=Su(X,$.mode,I),_.return=$,_):(_=i(_,X.children||[]),_.return=$,_)}function Z($,_,X,I,we){return _===null||_.tag!==7?(_=Hi(X,$.mode,I,we),_.return=$,_):(_=i(_,X),_.return=$,_)}function ee($,_,X){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=ju(""+_,$.mode,X),_.return=$,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case ce:return X=$c(_.type,_.key,_.props,null,$.mode,X),Ia(X,_),X.return=$,X;case je:return _=Su(_,$.mode,X),_.return=$,_;case ke:return _=Vi(_),ee($,_,X)}if(de(_)||B(_))return _=Hi(_,$.mode,X,null),_.return=$,_;if(typeof _.then=="function")return ee($,Fc(_),X);if(_.$$typeof===et)return ee($,Kc($,_),X);Wc($,_)}return null}function L($,_,X,I){var we=_!==null?_.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return we!==null?null:w($,_,""+X,I);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case ce:return X.key===we?A($,_,X,I):null;case je:return X.key===we?Y($,_,X,I):null;case ke:return X=Vi(X),L($,_,X,I)}if(de(X)||B(X))return we!==null?null:Z($,_,X,I,null);if(typeof X.then=="function")return L($,_,Fc(X),I);if(X.$$typeof===et)return L($,_,Kc($,X),I);Wc($,X)}return null}function V($,_,X,I,we){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return $=$.get(X)||null,w(_,$,""+I,we);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case ce:return $=$.get(I.key===null?X:I.key)||null,A(_,$,I,we);case je:return $=$.get(I.key===null?X:I.key)||null,Y(_,$,I,we);case ke:return I=Vi(I),V($,_,X,I,we)}if(de(I)||B(I))return $=$.get(X)||null,Z(_,$,I,we,null);if(typeof I.then=="function")return V($,_,X,Fc(I),we);if(I.$$typeof===et)return V($,_,X,Kc(_,I),we);Wc(_,I)}return null}function ye($,_,X,I){for(var we=null,Pe=null,Ae=_,De=_=0,It=null;Ae!==null&&De<X.length;De++){Ae.index>De?(It=Ae,Ae=null):It=Ae.sibling;var ot=L($,Ae,X[De],I);if(ot===null){Ae===null&&(Ae=It);break}e&&Ae&&ot.alternate===null&&t($,Ae),_=o(ot,_,De),Pe===null?we=ot:Pe.sibling=ot,Pe=ot,Ae=It}if(De===X.length)return n($,Ae),qe&&Na($,De),we;if(Ae===null){for(;De<X.length;De++)Ae=ee($,X[De],I),Ae!==null&&(_=o(Ae,_,De),Pe===null?we=Ae:Pe.sibling=Ae,Pe=Ae);return qe&&Na($,De),we}for(Ae=a(Ae);De<X.length;De++)It=V(Ae,$,De,X[De],I),It!==null&&(e&&(ot=It.alternate,ot!==null&&Ae.delete(ot.key===null?De:ot.key)),_=o(It,_,De),Pe===null?we=It:Pe.sibling=It,Pe=It);return e&&Ae.forEach(function(yi){return t($,yi)}),qe&&Na($,De),we}function Ne($,_,X,I){if(X==null)throw Error(f(151));for(var we=null,Pe=null,Ae=_,De=_=0,It=null,ot=X.next();Ae!==null&&!ot.done;De++,ot=X.next()){Ae.index>De?(It=Ae,Ae=null):It=Ae.sibling;var yi=L($,Ae,ot.value,I);if(yi===null){Ae===null&&(Ae=It);break}e&&Ae&&yi.alternate===null&&t($,Ae),_=o(yi,_,De),Pe===null?we=yi:Pe.sibling=yi,Pe=yi,Ae=It}if(ot.done)return n($,Ae),qe&&Na($,De),we;if(Ae===null){for(;!ot.done;De++,ot=X.next())ot=ee($,ot.value,I),ot!==null&&(_=o(ot,_,De),Pe===null?we=ot:Pe.sibling=ot,Pe=ot);return qe&&Na($,De),we}for(Ae=a(Ae);!ot.done;De++,ot=X.next())ot=V(Ae,$,De,ot.value,I),ot!==null&&(e&&(It=ot.alternate,It!==null&&Ae.delete(It.key===null?De:It.key)),_=o(ot,_,De),Pe===null?we=ot:Pe.sibling=ot,Pe=ot);return e&&Ae.forEach(function(hb){return t($,hb)}),qe&&Na($,De),we}function Le($,_,X,I){if(typeof X=="object"&&X!==null&&X.type===Ce&&X.key===null&&X.props.ref===void 0&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case ce:e:{for(var we=X.key;_!==null;){if(_.key===we){if(we=X.type,we===Ce){if(_.tag===7){n($,_.sibling),I=i(_,X.props.children),Ia(I,X),I.return=$,$=I;break e}}else if(_.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===ke&&Vi(we)===_.type){n($,_.sibling),I=i(_,X.props),Ia(I,X),I.return=$,$=I;break e}n($,_);break}else t($,_);_=_.sibling}X.type===Ce?(I=Hi(X.props.children,$.mode,I,X.key),Ia(I,X),I.return=$,$=I):(I=$c(X.type,X.key,X.props,null,$.mode,I),Ia(I,X),I.return=$,$=I)}return m($);case je:e:{for(we=X.key;_!==null;){if(_.key===we)if(_.tag===4&&_.stateNode.containerInfo===X.containerInfo&&_.stateNode.implementation===X.implementation){n($,_.sibling),I=i(_,X.children||[]),I.return=$,$=I;break e}else{n($,_);break}else t($,_);_=_.sibling}I=Su(X,$.mode,I),I.return=$,$=I}return m($);case ke:return X=Vi(X),Le($,_,X,I)}if(de(X))return ye($,_,X,I);if(B(X)){if(we=B(X),typeof we!="function")throw Error(f(150));return X=we.call(X),Ne($,_,X,I)}if(typeof X.then=="function")return Le($,_,Fc(X),I);if(X.$$typeof===et)return Le($,_,Kc($,X),I);Wc($,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,_!==null&&_.tag===6?(n($,_.sibling),I=i(_,X),I.return=$,$=I):(n($,_),I=ju(X,$.mode,I),I.return=$,$=I),m($)):n($,_)}return function($,_,X,I){try{Mo=0;var we=Le($,_,X,I);return Ss=null,we}catch(Ae){if(Ae===js||Ae===Qc)throw Ae;var Pe=Vn(29,Ae,null,$.mode);return Pe.lanes=I,Pe.return=$,Pe}finally{}}}var Zi=vh(!0),bh=vh(!1),Pa=!1;function Du(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ru(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 ei(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ti(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(ht&2)!==0){var i=a.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),a.pending=t,t=Lc(e),nh(e,null,n),t}return Hc(e,a,t,n),Lc(e)}function ko(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,me(e,n)}}function _u(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var m={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};o===null?i=o=m:o=o.next=m,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:a.baseState,firstBaseUpdate:i,lastBaseUpdate:o,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 Bu=!1;function zo(){if(Bu){var e=ws;if(e!==null)throw e}}function Ao(e,t,n,a){Bu=!1;var i=e.updateQueue;Pa=!1;var o=i.firstBaseUpdate,m=i.lastBaseUpdate,w=i.shared.pending;if(w!==null){i.shared.pending=null;var A=w,Y=A.next;A.next=null,m===null?o=Y:m.next=Y,m=A;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,w=Z.lastBaseUpdate,w!==m&&(w===null?Z.firstBaseUpdate=Y:w.next=Y,Z.lastBaseUpdate=A))}if(o!==null){var ee=i.baseState;m=0,Z=Y=A=null,w=o;do{var L=w.lane&-536870913,V=L!==w.lane;if(V?(Ie&L)===L:(a&L)===L){L!==0&&L===qi&&(Bu=!0),Z!==null&&(Z=Z.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ye=e,Ne=w;L=t;var Le=n;switch(Ne.tag){case 1:if(ye=Ne.payload,typeof ye=="function"){ee=ye.call(Le,ee,L);break e}ee=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Ne.payload,L=typeof ye=="function"?ye.call(Le,ee,L):ye,L==null)break e;ee=ue({},ee,L);break e;case 2:Pa=!0}}L=w.callback,L!==null&&(e.flags|=64,V&&(e.flags|=8192),V=i.callbacks,V===null?i.callbacks=[L]:V.push(L))}else V={lane:L,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Z===null?(Y=Z=V,A=ee):Z=Z.next=V,m|=L;if(w=w.next,w===null){if(w=i.shared.pending,w===null)break;V=w,w=V.next,V.next=null,i.lastBaseUpdate=V,i.shared.pending=null}}while(!0);Z===null&&(A=ee),i.baseState=A,i.firstBaseUpdate=Y,i.lastBaseUpdate=Z,o===null&&(i.shared.lanes=0),ci|=m,e.lanes=m,e.memoizedState=ee}}function xh(e,t){if(typeof e!="function")throw Error(f(191,e));e.call(t)}function wh(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)xh(n[e],t)}var ni=it(null),Ic=it(0);function jh(e,t){e=Aa,$e(Ic,e),$e(ni,t),Aa=e|t.baseLanes}function Uu(){$e(Ic,Aa),$e(ni,ni.current)}function Hu(){Aa=Ic.current,Ee(ni),Ee(Ic)}var hn=it(null),Tn=null;function li(e){var t=e.alternate;$e(mn,mn.current&1),$e(hn,e),Tn===null&&(t===null||ni.current!==null||t.memoizedState!==null)&&(Tn=e)}function Lu(e){$e(mn,mn.current),$e(hn,e),Tn===null&&(Tn=e)}function Sh(e){e.tag===22?($e(mn,mn.current),$e(hn,e),Tn===null&&(Tn=e)):ai()}function ai(){$e(mn,mn.current),$e(hn,hn.current)}function In(e){Ee(hn),Tn===e&&(Tn=null),Ee(mn)}var mn=it(0);function Oo(e,t){$e(hn,hn.current),$e(mn,t)}function $u(e){Ee(mn),Ee(hn),Tn===e&&(Tn=null)}function Pc(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||rf(n)||uf(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ea=0,He=null,St=null,Ft=null,er=!1,Ns=!1,Qi=!1,tr=0,Do=0,Ts=null,Ry=0;function Lt(){throw Error(f(321))}function Yu(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 Gu(e,t,n,a,i,o){return Ea=o,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,se.H=e===null||e.memoizedState===null?sm:om,Qi=!1,o=n(a,i),Qi=!1,Ns&&(o=Th(t,n,a,i)),Nh(e),o}function Nh(e){se.H=cr;var t=St!==null&&St.next!==null;if(Ea=0,Ft=St=He=null,er=!1,Do=0,Ts=null,t)throw Error(f(300));e===null||Wt||(e=e.dependencies,e!==null&&Vc(e)&&(Wt=!0))}function Th(e,t,n,a){He=e;var i=0;do{if(Ns&&(Ts=null),Do=0,Ns=!1,25<=i)throw Error(f(301));if(i+=1,Ft=St=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}se.H=Gy,o=t(n,a)}while(Ns);return o}function _y(){var e=se.H,t=e.useState()[0];return t=typeof t.then=="function"?Ro(t):t,e=e.useState()[0],(St!==null?St.memoizedState:null)!==e&&(He.flags|=1024),t}function qu(){var e=tr!==0;return tr=0,e}function Xu(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Vu(e){if(er){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}er=!1}Ea=0,Ft=St=He=null,Ns=!1,Do=tr=0,Ts=null}function Dn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ft===null?He.memoizedState=Ft=e:Ft=Ft.next=e,Ft}function Kt(){if(St===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=St.next;var t=Ft===null?He.memoizedState:Ft.next;if(t!==null)Ft=t,St=e;else{if(e===null)throw He.alternate===null?Error(f(467)):Error(f(310));St=e,e={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},Ft===null?He.memoizedState=Ft=e:Ft=Ft.next=e}return Ft}function nr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ro(e){var t=Do;return Do+=1,Ts===null&&(Ts=[]),e=gh(Ts,e,t),t=He,(Ft===null?t.memoizedState:Ft.next)===null&&(t=t.alternate,se.H=t===null||t.memoizedState===null?sm:om),e}function lr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ro(e);if(e.$$typeof===U)return;if(e.$$typeof===et)return fn(e)}throw Error(f(438,String(e)))}function Ku(e){var t=null,n=He.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=He.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=nr(),He.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]=J;return t.index++,n}function Ma(e,t){return typeof t=="function"?t(e):t}function ar(e){var t=Kt();return Zu(t,St,e)}function Zu(e,t,n){var a=e.queue;if(a===null)throw Error(f(311));a.lastRenderedReducer=n;var i=e.baseQueue,o=a.pending;if(o!==null){if(i!==null){var m=i.next;i.next=o.next,o.next=m}t.baseQueue=i=o,a.pending=null}if(o=e.baseState,i===null)e.memoizedState=o;else{t=i.next;var w=m=null,A=null,Y=t,Z=!1;do{var ee=Y.lane&-536870913;if(ee!==Y.lane?(Ie&ee)===ee:(Ea&ee)===ee){var L=Y.revertLane;if(L===0)A!==null&&(A=A.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),ee===qi&&(Z=!0);else if((Ea&L)===L){Y=Y.next,L===qi&&(Z=!0);continue}else ee={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},A===null?(w=A=ee,m=o):A=A.next=ee,He.lanes|=L,ci|=L;ee=Y.action,Qi&&n(o,ee),o=Y.hasEagerState?Y.eagerState:n(o,ee)}else L={lane:ee,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},A===null?(w=A=L,m=o):A=A.next=L,He.lanes|=ee,ci|=ee;Y=Y.next}while(Y!==null&&Y!==t);if(A===null?m=o:A.next=w,!Nn(o,e.memoizedState)&&(Wt=!0,Z&&(n=ws,n!==null)))throw n;e.memoizedState=o,e.baseState=m,e.baseQueue=A,a.lastRenderedState=o}return i===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Qu(e){var t=Kt(),n=t.queue;if(n===null)throw Error(f(311));n.lastRenderedReducer=e;var a=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var m=i=i.next;do o=e(o,m.action),m=m.next;while(m!==i);Nn(o,t.memoizedState)||(Wt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,a]}function Ch(e,t,n){var a=He,i=Kt(),o=qe;if(o){if(n===void 0)throw Error(f(407));n=n()}else n=t();var m=!Nn((St||i).memoizedState,n);if(m&&(i.memoizedState=n,Wt=!0),i=i.queue,Wu(kh.bind(null,a,i,e),[e]),e=i.getSnapshot!==t||m||Ft!==null&&(Ft.memoizedState.tag&1)!==0,Cs(e?9:8,{destroy:void 0},Mh.bind(null,a,i,n,t),null),e){if(a.flags|=2048,Ct===null)throw Error(f(349));o||(Ea&127)!==0||Eh(a,t,n)}return n}function Eh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=He.updateQueue,t===null?(t=nr(),He.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Mh(e,t,n,a){t.value=n,t.getSnapshot=a,zh(t)&&Ah(e)}function kh(e,t,n){return n(function(){zh(t)&&Ah(e)})}function zh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nn(e,n)}catch{return!0}}function Ah(e){var t=Ui(e,2);t!==null&&Jn(t,e,2)}function Ju(e){var t=Dn();if(typeof e=="function"){var n=e;if(e=n(),Qi){wn(!0);try{n()}finally{wn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:e},t}function Oh(e,t,n,a){return e.baseState=n,Zu(e,St,typeof a=="function"?a:Ma)}function By(e,t,n,a,i){if(or(e))throw Error(f(485));if(e=t.action,e!==null){var o={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){o.listeners.push(m)}};se.T!==null?n(!0):o.isTransition=!1,a(o),n=t.pending,n===null?(o.next=t.pending=o,Dh(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Dh(e,t){var n=t.action,a=t.payload,i=e.state;if(t.isTransition){var o=se.T,m={};m.types=o!==null?o.types:null,se.T=m;try{var w=n(i,a),A=se.S;A!==null&&A(m,w),Rh(e,t,w)}catch(Y){Fu(e,t,Y)}finally{o!==null&&m.types!==null&&(o.types=m.types),se.T=o}}else try{o=n(i,a),Rh(e,t,o)}catch(Y){Fu(e,t,Y)}}function Rh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){_h(e,t,a)},function(a){return Fu(e,t,a)}):_h(e,t,n)}function _h(e,t,n){t.status="fulfilled",t.value=n,Bh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Dh(e,n)))}function Fu(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,Bh(t),t=t.next;while(t!==a)}e.action=null}function Bh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Uh(e,t){return t}function Hh(e,t){if(qe){var n=Ct.formState;if(n!==null){e:{var a=He;if(qe){if(Mt){t:{for(var i=Mt,o=vl;i.nodeType!==8;){if(!o){i=null;break t}if(i=xl(i.nextSibling),i===null){i=null;break t}}o=i.data,i=o==="F!"||o==="F"?i:null}if(i){Mt=xl(i.nextSibling),a=i.data==="F!";break e}}Fa(a)}a=!1}a&&(t=n[0])}}return n=Dn(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Uh,lastRenderedState:t},n.queue=a,n=lm.bind(null,He,a),a.dispatch=n,a=Ju(!1),o=nd.bind(null,He,!1,a.queue),a=Dn(),i={state:t,dispatch:null,action:e,pending:null},a.queue=i,n=By.bind(null,He,i,o,n),i.dispatch=n,a.memoizedState=e,[t,n,!1]}function Lh(e){var t=Kt();return $h(t,St,e)}function $h(e,t,n){if(t=Zu(e,t,Uh)[0],e=ar(Ma)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Ro(t)}catch(m){throw m===js?Qc:m}else a=t;t=Kt();var i=t.queue,o=i.dispatch;return n!==t.memoizedState&&(He.flags|=2048,Cs(9,{destroy:void 0},Uy.bind(null,i,n),null)),[a,o,e]}function Uy(e,t){e.action=t}function Yh(e){var t=Kt(),n=St;if(n!==null)return $h(t,n,e);Kt(),t=t.memoizedState,n=Kt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function Cs(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=He.updateQueue,t===null&&(t=nr(),He.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 Gh(){return Kt().memoizedState}function ir(e,t,n,a){var i=Dn();He.flags|=e,i.memoizedState=Cs(1|t,{destroy:void 0},n,a===void 0?null:a)}function sr(e,t,n,a){var i=Kt();a=a===void 0?null:a;var o=i.memoizedState.inst;St!==null&&a!==null&&Yu(a,St.memoizedState.deps)?i.memoizedState=Cs(t,o,n,a):(He.flags|=e,i.memoizedState=Cs(1|t,o,n,a))}function qh(e,t){ir(8390656,8,e,t)}function Wu(e,t){sr(2048,8,e,t)}function Hy(e){He.flags|=4;var t=He.updateQueue;if(t===null)t=nr(),He.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Xh(e){var t=Kt().memoizedState;return Hy({ref:t,nextImpl:e}),function(){if((ht&2)!==0)throw Error(f(440));return t.impl.apply(void 0,arguments)}}function Vh(e,t){return sr(4,2,e,t)}function Kh(e,t){return sr(4,4,e,t)}function Zh(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Qh(e,t,n){n=n!=null?n.concat([e]):null,sr(4,4,Zh.bind(null,t,e),n)}function Iu(){}function Jh(e,t){var n=Kt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Yu(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function Fh(e,t){var n=Kt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Yu(t,a[1]))return a[0];if(a=e(),Qi){wn(!0);try{e()}finally{wn(!1)}}return n.memoizedState=[a,t],a}function Pu(e,t,n){return n===void 0||(Ea&1073741824)!==0&&(Ie&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=sg(),He.lanes|=e,ci|=e,n)}function Wh(e,t,n,a){return Nn(n,t)?n:ni.current!==null?(e=Pu(e,n,a),Nn(e,t)||(Wt=!0),e):(Ea&106)===0||(Ea&1073741824)!==0&&(Ie&261930)===0?(Wt=!0,e.memoizedState=n):(e=sg(),He.lanes|=e,ci|=e,t)}function Ih(e,t,n,a,i){var o=ve.p;ve.p=o!==0&&8>o?o:8;var m=se.T,w={};w.types=m!==null?m.types:null,se.T=w,nd(e,!1,t,n);try{var A=i(),Y=se.S;if(Y!==null&&Y(w,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var Z=Dy(A,a);_o(e,t,Z,nl(e))}else _o(e,t,a,nl(e))}catch(ee){_o(e,t,{then:function(){},status:"rejected",reason:ee},nl())}finally{ve.p=o,m!==null&&w.types!==null&&(m.types=w.types),se.T=m}}function Ly(){}function ed(e,t,n,a){if(e.tag!==5)throw Error(f(476));var i=Ph(e).queue;Ih(e,i,t,gt,n===null?Ly:function(){return em(e),n(a)})}function Ph(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:gt,baseState:gt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:gt},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ma,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function em(e){var t=Ph(e);t.next===null&&(t=e.alternate.memoizedState),_o(e,t.next.queue,{},nl())}function td(){return fn(Vs)}function tm(){return Kt().memoizedState}function nm(){return Kt().memoizedState}function $y(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=nl();e=ei(n);var a=ti(t,e,n);a!==null&&(Jn(a,t,n),ko(a,t,n)),t={cache:ku()},e.payload=t;return}t=t.return}}function Yy(e,t,n){var a=nl();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},or(e)?am(t,n):(n=xu(e,t,n,a),n!==null&&(Jn(n,e,a),im(n,t,a)))}function lm(e,t,n){var a=nl();_o(e,t,n,a)}function _o(e,t,n,a){var i={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(or(e))am(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var m=t.lastRenderedState,w=o(m,n);if(i.hasEagerState=!0,i.eagerState=w,Nn(w,m))return Hc(e,t,i,0),Ct===null&&Uc(),!1}catch{}finally{}if(n=xu(e,t,i,a),n!==null)return Jn(n,e,a),im(n,t,a),!0}return!1}function nd(e,t,n,a){if(a={lane:2,revertLane:Kd(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},or(e)){if(t)throw Error(f(479))}else t=xu(e,n,a,2),t!==null&&Jn(t,e,2)}function or(e){var t=e.alternate;return e===He||t!==null&&t===He}function am(e,t){Ns=er=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function im(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,me(e,n)}}var cr={readContext:fn,use:lr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt,useEffectEvent:Lt},sm={readContext:fn,use:lr,useCallback:function(e,t){return Dn().memoizedState=[e,t===void 0?null:t],e},useContext:fn,useEffect:qh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ir(4194308,4,Zh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ir(4194308,4,e,t)},useInsertionEffect:function(e,t){ir(4,2,e,t)},useMemo:function(e,t){var n=Dn();t=t===void 0?null:t;var a=e();if(Qi){wn(!0);try{e()}finally{wn(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=Dn();if(n!==void 0){var i=n(t);if(Qi){wn(!0);try{n(t)}finally{wn(!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=Yy.bind(null,He,e),[a.memoizedState,e]},useRef:function(e){var t=Dn();return e={current:e},t.memoizedState=e},useState:function(e){e=Ju(e);var t=e.queue,n=lm.bind(null,He,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Iu,useDeferredValue:function(e,t){var n=Dn();return Pu(n,e,t)},useTransition:function(){var e=Ju(!1);return e=Ih.bind(null,He,e.queue,!0,!1),Dn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=He,i=Dn();if(qe){if(n===void 0)throw Error(f(407));n=n()}else{if(n=t(),Ct===null)throw Error(f(349));(Ie&127)!==0||Eh(a,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,qh(kh.bind(null,a,o,e),[e]),a.flags|=2048,Cs(9,{destroy:void 0},Mh.bind(null,a,o,n,t),null),n},useId:function(){var e=Dn(),t=Ct.identifierPrefix;if(qe){var n=Jl,a=Ql;n=(a&~(1<<32-Rt(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=tr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Ry++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:td,useFormState:Hh,useActionState:Hh,useOptimistic:function(e){var t=Dn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=nd.bind(null,He,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ku,useCacheRefresh:function(){return Dn().memoizedState=$y.bind(null,He)},useEffectEvent:function(e){var t=Dn(),n={impl:e};return t.memoizedState=n,function(){if((ht&2)!==0)throw Error(f(440));return n.impl.apply(void 0,arguments)}}},om={readContext:fn,use:lr,useCallback:Jh,useContext:fn,useEffect:Wu,useImperativeHandle:Qh,useInsertionEffect:Vh,useLayoutEffect:Kh,useMemo:Fh,useReducer:ar,useRef:Gh,useState:function(){return ar(Ma)},useDebugValue:Iu,useDeferredValue:function(e,t){var n=Kt();return Wh(n,St.memoizedState,e,t)},useTransition:function(){var e=ar(Ma)[0],t=Kt().memoizedState;return[typeof e=="boolean"?e:Ro(e),t]},useSyncExternalStore:Ch,useId:tm,useHostTransitionStatus:td,useFormState:Lh,useActionState:Lh,useOptimistic:function(e,t){var n=Kt();return Oh(n,St,e,t)},useMemoCache:Ku,useCacheRefresh:nm,useEffectEvent:Xh},Gy={readContext:fn,use:lr,useCallback:Jh,useContext:fn,useEffect:Wu,useImperativeHandle:Qh,useInsertionEffect:Vh,useLayoutEffect:Kh,useMemo:Fh,useReducer:Qu,useRef:Gh,useState:function(){return Qu(Ma)},useDebugValue:Iu,useDeferredValue:function(e,t){var n=Kt();return St===null?Pu(n,e,t):Wh(n,St.memoizedState,e,t)},useTransition:function(){var e=Qu(Ma)[0],t=Kt().memoizedState;return[typeof e=="boolean"?e:Ro(e),t]},useSyncExternalStore:Ch,useId:tm,useHostTransitionStatus:td,useFormState:Yh,useActionState:Yh,useOptimistic:function(e,t){var n=Kt();return St!==null?Oh(n,St,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Ku,useCacheRefresh:nm,useEffectEvent:Xh};function ld(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:ue({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ad={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=nl(),i=ei(a);i.payload=t,n!=null&&(i.callback=n),t=ti(e,i,a),t!==null&&(Jn(t,e,a),ko(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=nl(),i=ei(a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ti(e,i,a),t!==null&&(Jn(t,e,a),ko(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=nl(),a=ei(n);a.tag=2,t!=null&&(a.callback=t),t=ti(e,a,n),t!==null&&(Jn(t,e,n),ko(t,e,n))}};function cm(e,t,n,a,i,o,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,o,m):t.prototype&&t.prototype.isPureReactComponent?!Va(n,a)||!Va(i,o):!0}function rm(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&&ad.enqueueReplaceState(t,t.state,null)}function Ji(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=ue({},n));for(var i in e)n[i]===void 0&&(n[i]=e[i])}return n}function um(e){Za(e)}function dm(e){console.error(e)}function fm(e){Za(e)}function rr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function hm(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 id(e,t,n){return n=ei(n),n.tag=3,n.payload={element:null},n.callback=function(){rr(e,t)},n}function mm(e){return e=ei(e),e.tag=3,e}function gm(e,t,n,a){var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var o=a.value;e.payload=function(){return i(o)},e.callback=function(){hm(t,n,a)}}var m=n.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){hm(t,n,a),typeof i!="function"&&(ri===null?ri=new Set([this]):ri.add(this));var w=a.stack;this.componentDidCatch(a.value,{componentStack:w!==null?w:""})})}function qy(e,t,n,a,i){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&Yi(t,n,i,!0),n=hn.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Tn===null?zr():n.alternate===null&&$t===0&&($t=3),n.flags&=-257,n.flags|=65536,n.lanes=i,a===Jc?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),qd(e,a,i)),!1;case 22:return n.flags|=65536,a===Jc?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)),qd(e,a,i)),!1}throw Error(f(435,n.tag))}return qd(e,a,i),zr(),!1}if(qe)return t=hn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,a!==Tu&&(e=Error(f(422),{cause:a}),No(gl(e,n)))):(a!==Tu&&(t=Error(f(423),{cause:a}),No(gl(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,a=gl(a,n),i=id(e.stateNode,a,i),_u(e,i),$t!==4&&($t=2)),!1;var o=Error(f(520),{cause:a});if(o=gl(o,n),qo===null?qo=[o]:qo.push(o),$t!==4&&($t=2),t===null)return!0;a=gl(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=id(n.stateNode,a,e),_u(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"&&(ri===null||!ri.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,i=mm(i),gm(i,e,n,a),_u(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var sd=Error(f(461)),Wt=!1;function nn(e,t,n,a){t.child=e===null?bh(t,null,n,a):Zi(t,e.child,n,a)}function pm(e,t,n,a,i){n=n.render;var o=t.ref;if("ref"in a){var m={};for(var w in a)w!=="ref"&&(m[w]=a[w])}else m=a;return Gi(t),a=Gu(e,t,n,m,o,i),w=qu(),e!==null&&!Wt?(Xu(e,t,i),ka(e,t,i)):(qe&&w&&Gc(t),t.flags|=1,nn(e,t,a,i),t.child)}function ym(e,t,n,a,i){if(e===null){var o=n.type;return typeof o=="function"&&!wu(o)&&o.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=o,vm(e,t,o,a,i)):(e=$c(n.type,null,a,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!md(e,i)){var m=o.memoizedProps;if(n=n.compare,n=n!==null?n:Va,n(m,a)&&e.ref===t.ref)return ka(e,t,i)}return t.flags|=1,e=Sa(o,a),e.ref=t.ref,e.return=t,t.child=e}function vm(e,t,n,a,i){if(e!==null){var o=e.memoizedProps;if(Va(o,a)&&e.ref===t.ref)if(Wt=!1,t.pendingProps=a=o,md(e,i))(e.flags&131072)!==0&&(Wt=!0);else return t.lanes=e.lanes,ka(e,t,i)}return od(e,t,n,a,i)}function bm(e,t,n,a){var i=a.children,o=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(o=o!==null?o.baseLanes|n:n,e!==null){for(a=t.child=e.child,i=0;a!==null;)i=i|a.lanes|a.childLanes,a=a.sibling;a=i&~o}else a=0,t.child=null;return xm(e,t,o,n,a)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Zc(t,o!==null?o.cachePool:null),o!==null?jh(t,o):Uu(),Sh(t);else return a=t.lanes=536870912,xm(e,t,o!==null?o.baseLanes|n:n,n,a)}else o!==null?(Zc(t,o.cachePool),jh(t,o),ai(),t.memoizedState=null):(e!==null&&Zc(t,null),Uu(),ai());return nn(e,t,i,n),t.child}function Bo(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function xm(e,t,n,a,i){var o=Au();return o=o===null?null:{parent:Jt._currentValue,pool:o},t.memoizedState={baseLanes:n,cachePool:o},e!==null&&Zc(t,null),Uu(),Sh(t),e!==null&&Yi(e,t,a,!0),t.childLanes=i,null}function ur(e,t){return t=dr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function wm(e,t,n){return Zi(t,e.child,null,n),e=ur(t,t.pendingProps),e.flags|=2,In(t),t.memoizedState=null,e}function Xy(e,t,n){var a=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(qe){if(a.mode==="hidden")return e=ur(t,a),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Bo(null,e);if(Lu(t),(e=Mt)?(e=Zg(e,vl),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qa!==null?{id:Ql,overflow:Jl}:null,retryLane:536870912,hydrationErrors:null},n=ah(e),n.return=t,t.child=n,an=t,Mt=null)):e=null,e===null)throw Fa(t);return t.lanes=536870912,null}return ur(t,a)}var o=e.memoizedState;if(o!==null){var m=o.dehydrated;if(Lu(t),i)if(t.flags&256)t.flags&=-257,t=wm(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(f(558));else if(Wt||Yi(e,t,n,!1),i=(n&e.childLanes)!==0,Wt||i){if(ni.current===null){if(a=Ct,a!==null&&(m=ze(a,n),m!==0&&m!==o.retryLane))throw o.retryLane=m,Ui(e,m),Jn(a,e,m),sd;zr()}t=wm(e,t,n)}else e=o.treeContext,Mt=xl(m.nextSibling),an=t,qe=!0,Ja=null,vl=!1,e!==null&&oh(t,e),t=ur(t,a),t.flags|=134221824;return t}return e=Sa(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Es(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(f(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function od(e,t,n,a,i){return Gi(t),n=Gu(e,t,n,a,void 0,i),a=qu(),e!==null&&!Wt?(Xu(e,t,i),ka(e,t,i)):(qe&&a&&Gc(t),t.flags|=1,nn(e,t,n,i),t.child)}function jm(e,t,n,a,i,o){return Gi(t),t.updateQueue=null,n=Th(t,a,n,i),Nh(e),a=qu(),e!==null&&!Wt?(Xu(e,t,o),ka(e,t,o)):(qe&&a&&Gc(t),t.flags|=1,nn(e,t,n,o),t.child)}function Sm(e,t,n,a,i){if(Gi(t),t.stateNode===null){var o=ys,m=n.contextType;typeof m=="object"&&m!==null&&(o=fn(m)),o=new n(a,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=ad,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=a,o.state=t.memoizedState,o.refs={},Du(t),m=n.contextType,o.context=typeof m=="object"&&m!==null?fn(m):ys,o.state=t.memoizedState,m=n.getDerivedStateFromProps,typeof m=="function"&&(ld(t,n,m,a),o.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(m=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),m!==o.state&&ad.enqueueReplaceState(o,o.state,null),Ao(t,a,o,i),zo(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){o=t.stateNode;var w=t.memoizedProps,A=Ji(n,w);o.props=A;var Y=o.context,Z=n.contextType;m=ys,typeof Z=="object"&&Z!==null&&(m=fn(Z));var ee=n.getDerivedStateFromProps;Z=typeof ee=="function"||typeof o.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,Z||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(w||Y!==m)&&rm(t,o,a,m),Pa=!1;var L=t.memoizedState;o.state=L,Ao(t,a,o,i),zo(),Y=t.memoizedState,w||L!==Y||Pa?(typeof ee=="function"&&(ld(t,n,ee,a),Y=t.memoizedState),(A=Pa||cm(t,n,A,a,L,Y,m))?(Z||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=a,t.memoizedState=Y),o.props=a,o.state=Y,o.context=m,a=A):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{o=t.stateNode,Ru(e,t),m=t.memoizedProps,Z=Ji(n,m),o.props=Z,ee=t.pendingProps,L=o.context,Y=n.contextType,A=ys,typeof Y=="object"&&Y!==null&&(A=fn(Y)),w=n.getDerivedStateFromProps,(Y=typeof w=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(m!==ee||L!==A)&&rm(t,o,a,A),Pa=!1,L=t.memoizedState,o.state=L,Ao(t,a,o,i),zo();var V=t.memoizedState;m!==ee||L!==V||Pa||e!==null&&e.dependencies!==null&&Vc(e.dependencies)?(typeof w=="function"&&(ld(t,n,w,a),V=t.memoizedState),(Z=Pa||cm(t,n,Z,a,L,V,A)||e!==null&&e.dependencies!==null&&Vc(e.dependencies))?(Y||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(a,V,A),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(a,V,A)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||m===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=V),o.props=a,o.state=V,o.context=A,a=Z):(typeof o.componentDidUpdate!="function"||m===e.memoizedProps&&L===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&L===e.memoizedState||(t.flags|=1024),a=!1)}return o=a,Es(e,t),a=(t.flags&128)!==0,o||a?(o=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&a?(t.child=Zi(t,e.child,null,i),t.child=Zi(t,null,n,i)):nn(e,t,n,i),t.memoizedState=o.state,e=t.child):e=ka(e,t,i),e}function Nm(e,t,n,a){return Li(),t.flags|=256,nn(e,t,n,a),t.child}var cd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function rd(e){return{baseLanes:e,cachePool:hh()}}function ud(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=tl),e}function Tm(e,t,n){var a=t.pendingProps,i=!1,o=(t.flags&128)!==0,m;if((m=o)||(m=e!==null&&e.memoizedState===null?!1:(mn.current&2)!==0),m&&(i=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(qe){if(i?li(t):ai(),(e=Mt)?(e=Zg(e,vl),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Qa!==null?{id:Ql,overflow:Jl}:null,retryLane:536870912,hydrationErrors:null},n=ah(e),n.return=t,t.child=n,an=t,Mt=null)):e=null,e===null)throw Fa(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}return o=a.children,a=a.fallback,i?(ai(),i=t.mode,o=dr({mode:"hidden",children:o},i),a=Hi(a,i,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,a=t.child,a.memoizedState=rd(n),a.childLanes=ud(e,m,n),t.memoizedState=cd,Bo(null,a)):(li(t),dd(t,o))}var w=e.memoizedState;if(w!==null){var A=w.dehydrated;if(A!==null)return Vy(e,t,o,m,a,A,w,n)}return i?(ai(),i=a.fallback,o=t.mode,w=e.child,A=w.sibling,a=Sa(w,{mode:"hidden",children:a.children}),a.subtreeFlags=w.subtreeFlags&1206910976,A!==null?i=Sa(A,i):(i=Hi(i,o,n,null),i.flags|=2),i.return=t,a.return=t,a.sibling=i,t.child=a,Bo(null,a),a=t.child,i=e.child.memoizedState,i===null?i=rd(n):(o=i.cachePool,o!==null?(w=Jt._currentValue,o=o.parent!==w?{parent:w,pool:w}:o):o=hh(),i={baseLanes:i.baseLanes|n,cachePool:o}),a.memoizedState=i,a.childLanes=ud(e,m,n),t.memoizedState=cd,Bo(e.child,a)):(li(t),n=e.child,e=n.sibling,n=Sa(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=n,t.memoizedState=null,n)}function dd(e,t){return t=dr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function dr(e,t){return e=Vn(22,e,null,t),e.lanes=0,e}function fr(e,t,n){return Zi(t,e.child,null,n),e=dd(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Vy(e,t,n,a,i,o,m,w){if(n)return t.flags&256?(li(t),t.flags&=-257,fr(e,t,w)):t.memoizedState!==null?(ai(),t.child=e.child,t.flags|=128,null):(ai(),o=i.fallback,m=t.mode,i=dr({mode:"visible",children:i.children},m),o=Hi(o,m,w,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,Zi(t,e.child,null,w),i=t.child,i.memoizedState=rd(w),i.childLanes=ud(e,a,w),t.memoizedState=cd,Bo(null,i));if(li(t),uf(o)){if(a=o.nextSibling&&o.nextSibling.dataset,a)var A=a.dgst;return a=A,a!==""&&(i=Error(f(419)),i.stack="",i.digest=a,No({value:i,source:null,stack:null})),fr(e,t,w)}if(Wt||Yi(e,t,w,!1),a=(w&e.childLanes)!==0,Wt||a){if(ni.current!==null)return fr(e,t,w);if(a=Ct,a!==null&&(i=ze(a,w),i!==0&&i!==m.retryLane))throw m.retryLane=i,Ui(e,i),Jn(a,e,i),sd;return rf(o)||zr(),fr(e,t,w)}return rf(o)?(t.flags|=192,t.child=e.child,null):(e=m.treeContext,Mt=xl(o.nextSibling),an=t,qe=!0,Ja=null,vl=!1,e!==null&&oh(t,e),t=dd(t,i.children),t.flags|=134221824,t)}function Cm(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),Xc(e.return,t,n)}function Em(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Pc(n)===null&&(t=e),e=e.sibling}return t}function hr(e,t,n,a,i,o){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:i,treeForkCount:o}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=a,m.tail=n,m.tailMode=i,m.treeForkCount=o)}function fd(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function hd(e,t,n){var a=t.pendingProps,i=a.revealOrder,o=a.tail;a=a.children;var m=mn.current;if(t.flags&128)return Oo(t,m),null;var w=(m&2)!==0;if(w?(m=m&1|2,t.flags|=128):m&=1,Oo(t,m),i==="backwards"&&e!==null?(fd(e),nn(e,t,a,n),fd(e)):nn(e,t,a,n),a=qe?So:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cm(e,n,t);else if(e.tag===19)Cm(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"backwards":n=Em(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,fd(t)),hr(t,!0,i,null,o,a);break;case"unstable_legacy-backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Pc(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}hr(t,!0,n,null,o,a);break;case"together":hr(t,!1,null,null,void 0,a);break;case"independent":t.memoizedState=null;break;default:n=Em(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),hr(t,!1,i,n,o,a)}return t.child}function Mm(e,t,n){var a=t.pendingProps;return Wa(t,t.type,a.value),nn(e,t,a.children,n),t.child}function ka(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ci|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Yi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(f(153));if(t.child!==null){for(e=t.child,n=Sa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Sa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function md(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Vc(e)))}function Ky(e,t,n){switch(t.tag){case 3:jl(t,t.stateNode.containerInfo),Wa(t,Jt,e.memoizedState.cache),Li();break;case 27:case 5:sa(t);break;case 4:jl(t,t.stateNode.containerInfo);break;case 10:Wa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lu(t),null;break;case 13:var a=t.memoizedState;if(a!==null){if(a.dehydrated!==null)return li(t),t.flags|=128,null;a=Yi(e,t,n,!1);var i=t.child.childLanes;return a||(n&i)!==0?Tm(e,t,n):(li(t),e=ka(e,t,n),e!==null?e.sibling:null)}li(t);break;case 19:if(t.flags&128)return hd(e,t,n);if(i=(e.flags&128)!==0,a=(n&t.childLanes)!==0,a||(Yi(e,t,n,!1),a=(n&t.childLanes)!==0),i){if(a)return hd(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Oo(t,mn.current),a)break;return null;case 22:return t.lanes=0,bm(e,t,n,t.pendingProps);case 24:Wa(t,Jt,e.memoizedState.cache)}return ka(e,t,n)}function km(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Wt=!0;else{if(!md(e,n)&&(t.flags&128)===0)return Wt=!1,Ky(e,t,n);Wt=(e.flags&131072)!==0}else Wt=!1,qe&&(t.flags&1048576)!==0&&sh(t,So,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=Vi(t.elementType),t.type=e,typeof e=="function")wu(e)?(a=Ji(e,a),t.tag=1,t=Sm(null,t,e,a,n)):(t.tag=0,t=od(null,t,e,a,n));else{if(e!=null){var i=e.$$typeof;if(i===he){t.tag=11,t=pm(null,t,e,a,n);break e}else if(i===Me){t.tag=14,t=ym(null,t,e,a,n);break e}else if(i===et){t.tag=10,t.type=e,t=Mm(null,t,n);break e}}throw t=oe(e)||e,Error(f(306,t,""))}}return t;case 0:return od(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,i=Ji(a,t.pendingProps),Sm(e,t,a,i,n);case 3:e:{if(jl(t,t.stateNode.containerInfo),e===null)throw Error(f(387));a=t.pendingProps;var o=t.memoizedState;i=o.element,Ru(e,t),Ao(t,a,null,n);var m=t.memoizedState;if(a=m.cache,Wa(t,Jt,a),a!==o.cache&&Mu(t,[Jt],n,!0),zo(),a=m.element,o.isDehydrated)if(o={element:a,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Nm(e,t,a,n);break e}else if(a!==i){i=gl(Error(f(424)),t),No(i),t=Nm(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}for(Mt=xl(e.firstChild),an=t,qe=!0,Ja=null,vl=!0,n=bh(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(Li(),a===i){t=ka(e,t,n);break e}nn(e,t,a,n)}t=t.child}return t;case 26:return Es(e,t),e===null?(n=ep(t.type,null,t.pendingProps,null))?t.memoizedState=n:qe||(t.stateNode=Dg(t.type,t.pendingProps,Tt.current,t)):t.memoizedState=ep(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return sa(t),e===null&&qe&&(a=t.stateNode=Fg(t.type,t.pendingProps,Tt.current),an=t,vl=!0,i=Mt,fi(t.type)?(df=i,Mt=xl(a.firstChild)):Mt=i),nn(e,t,t.pendingProps.children,n),Es(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&qe&&((i=a=Mt)&&(a=$v(a,t.type,t.pendingProps,vl),a!==null?(t.stateNode=a,an=t,Mt=xl(a.firstChild),vl=!1,i=!0):i=!1),i||Fa(t)),sa(t),i=t.type,o=t.pendingProps,m=e!==null?e.memoizedProps:null,a=o.children,tf(i,o)?a=null:m!==null&&tf(i,m)&&(t.flags|=32),t.memoizedState!==null&&(i=Gu(e,t,_y,null,null,n),Vs._currentValue=i),Es(e,t),nn(e,t,a,n),t.child;case 6:return e===null&&qe&&((e=n=Mt)&&(n=Yv(n,t.pendingProps,vl),n!==null?(t.stateNode=n,an=t,Mt=null,e=!0):e=!1),e||Fa(t)),null;case 13:return Tm(e,t,n);case 4:return jl(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Zi(t,null,a,n):nn(e,t,a,n),t.child;case 11:return pm(e,t,t.type,t.pendingProps,n);case 7:return a=t.pendingProps,Es(e,t),nn(e,t,a,n),t.child;case 8:return nn(e,t,t.pendingProps.children,n),t.child;case 12:return nn(e,t,t.pendingProps.children,n),t.child;case 10:return Mm(e,t,n);case 9:return i=t.type._context,a=t.pendingProps.children,Gi(t),i=fn(i),a=a(i),t.flags|=1,nn(e,t,a,n),t.child;case 14:return ym(e,t,t.type,t.pendingProps,n);case 15:return vm(e,t,t.type,t.pendingProps,n);case 19:return hd(e,t,n);case 31:return Xy(e,t,n);case 22:return bm(e,t,n,t.pendingProps);case 24:return Gi(t),a=fn(Jt),e===null?(i=Au(),i===null&&(i=Ct,o=ku(),i.pooledCache=o,o.refCount++,o!==null&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:a,cache:i},Du(t),Wa(t,Jt,i)):((e.lanes&n)!==0&&(Ru(e,t),Ao(t,null,null,n),zo()),i=e.memoizedState,o=t.memoizedState,i.parent!==a?(i={parent:a,cache:a},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Wa(t,Jt,a)):(a=o.cache,Wa(t,Jt,a),a!==i.cache&&Mu(t,[Jt],n,!0))),nn(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),a=t.pendingProps,a.name!=null&&a.name!=="auto"?t.flags|=e===null?18882560:18874368:qe&&Gc(t),e!==null&&e.memoizedProps.name!==a.name?t.flags|=4194816:Es(e,t),nn(e,t,a.children,n),t.child;case 29:throw t.pendingProps}throw Error(f(156,t.tag))}function za(e){e.flags|=4}function gd(e,t,n,a,i){var o;if((o=(e.mode&32)!==0)&&(o=n===null?ap(t,a):ap(t,a)&&(a.src!==n.src||a.srcSet!==n.srcSet)),o){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(ug())e.flags|=8192;else throw Ki=Jc,Ou}else e.flags&=-16777217}function zm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ip(t))if(ug())e.flags|=8192;else throw Ki=Jc,Ou}function mr(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?$n():536870912,e.lanes|=t,Os|=t)}function Uo(e,t){if(!qe)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,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;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function kt(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&1206910976,a|=i.flags&1206910976,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 Zy(e,t,n){var a=t.pendingProps;switch(Nu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(t),null;case 1:return kt(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ca(Jt),Sl(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(xs(t)?za(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Cu())),kt(t),null;case 26:var i=t.type,o=t.memoizedState;return e===null?(za(t),o!==null?(kt(t),zm(t,o)):(kt(t),gd(t,i,null,a,n))):o?o!==e.memoizedState?(za(t),kt(t),zm(t,o)):(kt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&za(t),kt(t),gd(t,i,e,a,n)),null;case 27:if(Un(t),n=Tt.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&za(t);else{if(!a){if(t.stateNode===null)throw Error(f(166));return kt(t),t.subtreeFlags&=-33554433,null}e=bn.current,xs(t)?ch(t):(e=Fg(i,a,n),t.stateNode=e,za(t))}return kt(t),t.subtreeFlags&=-33554433,null;case 5:if(Un(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&za(t);else{if(!a){if(t.stateNode===null)throw Error(f(166));return kt(t),t.subtreeFlags&=-33554433,null}if(o=bn.current,xs(t))ch(t);else{var m=Qo(Tt.current);switch(o){case 1:o=m.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:o=m.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":o=m.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":o=m.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":o=m.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof a.is=="string"?m.createElement("select",{is:a.is}):m.createElement("select"),a.multiple?o.multiple=!0:a.size&&(o.size=a.size);break;default:o=typeof a.is=="string"?m.createElement(i,{is:a.is}):m.createElement(i)}}o[Ot]=t,o[Xe]=a;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)o.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=o;e:switch(pn(o,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&&za(t)}}return kt(t),t.subtreeFlags&=-33554433,gd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&za(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(f(166));if(e=Tt.current,xs(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,i=an,i!==null)switch(i.tag){case 27:case 5:a=i.memoizedProps}e[Ot]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||kg(e.nodeValue,n)),e||Fa(t,!0)}else e=Qo(e).createTextNode(a),e[Ot]=t,t.stateNode=e}return kt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=xs(t),n!==null){if(e===null){if(!a)throw Error(f(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(f(557));e[Ot]=t}else Li(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;kt(t),e=!1}else n=Cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(In(t),t):(In(t),null);if((t.flags&128)!==0)throw Error(f(558))}return kt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=xs(t),a!==null&&a.dehydrated!==null){if(e===null){if(!i)throw Error(f(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(f(317));i[Ot]=t}else Li(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;kt(t),i=!1}else i=Cu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(In(t),t):(In(t),null)}return In(t),(t.flags&128)!==0?(t.lanes=n,t):(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),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==i&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),mr(t,t.updateQueue),kt(t),null);case 4:return Sl(),e===null&&Fd(t.stateNode.containerInfo),t.flags|=67108864,kt(t),null;case 10:return Ca(t.type),kt(t),null;case 19:if($u(t),a=t.memoizedState,a===null)return kt(t),null;if(i=(t.flags&128)!==0,o=a.rendering,o===null)if(i)Uo(a,!1);else{if($t!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=Pc(e),o!==null){for(t.flags|=128,Uo(a,!1),e=o.updateQueue,t.updateQueue=e,mr(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)lh(n,e),n=n.sibling;return Oo(t,mn.current&1|2),qe&&Na(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&rt()>Cr&&(t.flags|=128,i=!0,Uo(a,!1),t.lanes=4194304)}else{if(!i)if(e=Pc(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,mr(t,e),Uo(a,!0),a.tail===null&&a.tailMode!=="collapsed"&&a.tailMode!=="visible"&&!o.alternate&&!qe)return kt(t),null}else 2*rt()-a.renderingStartTime>Cr&&n!==536870912&&(t.flags|=128,i=!0,Uo(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(e=a.last,e!==null?e.sibling=o:t.child=o,a.last=o)}if(a.tail!==null){e=a.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return a.rendering=e,a.tail=e.sibling,a.renderingStartTime=rt(),e.sibling=null,o=mn.current,o=i?o&1|2:o&1,a.tailMode==="visible"||a.tailMode==="collapsed"||!n||qe?Oo(t,o):(n=o,$e(hn,t),$e(mn,n),Tn===null&&(Tn=t)),qe&&Na(t,a.treeForkCount),e}return kt(t),null;case 22:case 23:return In(t),Hu(),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&&(kt(t),t.subtreeFlags&6&&(t.flags|=8192)):kt(t),n=t.updateQueue,n!==null&&mr(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&&Ee(Xi),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ca(Jt),kt(t),null;case 25:return null;case 30:return t.flags|=33554432,kt(t),null}throw Error(f(156,t.tag))}function Qy(e,t){switch(Nu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ca(Jt),Sl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Un(t),null;case 31:if(t.memoizedState!==null){if(In(t),t.alternate===null)throw Error(f(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(In(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(f(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $u(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Sl(),null;case 10:return Ca(t.type),null;case 22:case 23:return In(t),Hu(),e!==null&&Ee(Xi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ca(Jt),null;case 25:return null;default:return null}}function Am(e,t){switch(Nu(t),t.tag){case 3:Ca(Jt),Sl();break;case 26:case 27:case 5:Un(t);break;case 4:Sl();break;case 31:t.memoizedState!==null&&In(t);break;case 13:In(t);break;case 19:$u(t);break;case 10:Ca(t.type);break;case 22:case 23:In(t),Hu(),e!==null&&Ee(Xi);break;case 24:Ca(Jt)}}function Ho(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 o=n.create,m=n.inst;a=o(),m.destroy=a}n=n.next}while(n!==i)}}catch(w){yt(t,t.return,w)}}function ii(e,t,n){try{var a=t.updateQueue,i=a!==null?a.lastEffect:null;if(i!==null){var o=i.next;a=o;do{if((a.tag&e)===e){var m=a.inst,w=m.destroy;if(w!==void 0){m.destroy=void 0,i=t;var A=n,Y=w;try{Y()}catch(Z){yt(i,A,Z)}}}a=a.next}while(a!==o)}}catch(Z){yt(t,t.return,Z)}}function Om(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{wh(t,n)}catch(a){yt(e,e.return,a)}}}function Dm(e,t,n){n.props=Ji(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){yt(e,t,a)}}function Fl(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:var i=e.stateNode,o=Ve(e.memoizedProps,i);(i.ref===null||i.ref.name!==o)&&(i.ref=$g(o)),a=i.ref;break;case 7:if(e.stateNode===null){var m=new ll(e);b(e.child,!1,Hv,m,void 0,void 0),e.stateNode=m}a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(w){yt(e,t,w)}}function gn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(i){yt(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){yt(e,t,i)}else n.current=null}function gr(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)Kg(e.stateNode,t[n])}function Rm(e){for(var t=e.return;t!==null&&(yd(t)&&Kg(e.stateNode,t.stateNode),!pd(t));)t=t.return}function Lo(e){for(var t=e.return;t!==null&&(yd(t)&&Lv(e.stateNode,t.stateNode),!pd(t));)t=t.return}function pd(e){return e.tag===5||e.tag===3||e.tag===27}function yd(e){return e&&e.tag===7&&e.stateNode!==null}function vd(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;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){yt(e,e.return,i)}}function bd(e,t,n){try{var a=e.stateNode;xv(a,e.type,n,t),a[Xe]=t}catch(i){yt(e,e.return,i)}}function _m(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&fi(e.type)||e.tag===4}function xd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_m(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&fi(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function wd(e,t,n,a){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=zn)),gr(e,a),tt=!0;else if(i!==4&&(i===27&&(gr(e,a),a=null,fi(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(wd(e,t,n,a),e=e.sibling;e!==null;)wd(e,t,n,a),e=e.sibling}function pr(e,t,n,a){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),gr(e,a),tt=!0;else if(i!==4&&(i===27&&(gr(e,a),a=null,fi(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(pr(e,t,n,a),e=e.sibling;e!==null;)pr(e,t,n,a),e=e.sibling}function Bm(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);pn(t,a,n),t[Ot]=e,t[Xe]=n}catch(o){yt(e,e.return,o)}}var yr=!1,Pn=null;function Um(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&(yr=!0)}var Wl=null;function Hm(){var e=Wl;return Wl=null,e}var Kn=0;function Ms(e,t,n,a,i){return Kn=0,Lm(e.child,t,n,a,i)}function Lm(e,t,n,a,i){for(var o=!1;e!==null;){if(e.tag===5){var m=e.stateNode;if(a!==null){var w=af(m);a.push(w),w.view&&(o=!0)}else o||af(m).view&&(o=!0);yr=!0,Hg(m,Kn===0?t:t+"_"+Kn,n),Kn++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Lm(e.child,t,n,a,i)&&(o=!0));e=e.sibling}return o}function Il(e,t){for(;e!==null;)e.tag===5?Lg(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Il(e.child,t)),e=e.sibling}function vr(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(vr(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(f(544));var n=t.name;t=On(t.default,t.share),t!=="none"&&(Ms(e,n,t,null,!1)||Il(e.child,!1))}e=e.sibling}}function jd(e,t){if(e.tag===30){var n=e.stateNode,a=e.memoizedProps,i=Ve(a,n),o=On(a.default,n.paired?a.share:a.enter);o!=="none"?Ms(e,i,o,null,!1)?(vr(e),n.paired||t||Bs(e,a.onEnter)):Il(e.child,!1):vr(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)jd(e,t),e=e.sibling;else vr(e)}function Sd(e){if(Pn!==null&&Pn.size!==0){var t=Pn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.memoizedProps,a=n.name;if(a!=null&&a!=="auto"){var i=t.get(a);if(i!==void 0){var o=On(n.default,n.share);if(o!=="none"&&(Ms(e,a,o,null,!1)?(o=e.stateNode,i.paired=o,o.paired=i,Bs(e,n.onShare)):Il(e.child,!1)),t.delete(a),t.size===0)break}}}Sd(e)}e=e.sibling}}}function Nd(e){if(e.tag===30){var t=e.memoizedProps,n=Ve(t,e.stateNode),a=Pn!==null?Pn.get(n):void 0,i=On(t.default,a!==void 0?t.share:t.exit);i!=="none"&&(Ms(e,n,i,null,!1)?a!==void 0?(i=e.stateNode,a.paired=i,i.paired=a,Pn.delete(n),Bs(e,t.onShare)):Bs(e,t.onExit):Il(e.child,!1)),Pn!==null&&Sd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Nd(e),e=e.sibling;else Pn!==null&&Sd(e)}function $m(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=Ve(t,e.stateNode);t=On(t.default,t.update),e.flags&=-5,t!=="none"&&Ms(e,n,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&$m(e);e=e.sibling}}function Td(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,Il(e.child,!1))}Td(e)}e=e.sibling}}function br(e){if(e.tag===30)e.stateNode.paired=null,Il(e.child,!1),Td(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)br(e),e=e.sibling;else Td(e)}function Ym(e){for(e=e.child;e!==null;)e.tag===30?Il(e.child,!1):(e.subtreeFlags&33554432)!==0&&Ym(e),e=e.sibling}function Cd(e,t,n,a,i,o,m){for(var w=!1;t!==null;){if(t.tag===5){var A=t.stateNode;if(o!==null&&Kn<o.length){var Y=o[Kn],Z=af(A);(Y.view||Z.view)&&(w=!0);var ee;if(ee=(e.flags&4)===0)if(Z.clip)ee=!0;else{ee=Y.rect;var L=Z.rect;ee=ee.y!==L.y||ee.x!==L.x||ee.height!==L.height||ee.width!==L.width}ee&&(e.flags|=4),Z.abs?Z=!Y.abs:(Y=Y.rect,Z=Z.rect,Z=Y.height!==Z.height||Y.width!==Z.width),Z&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Hg(A,Kn===0?n:n+"_"+Kn,i),w&&(e.flags&4)!==0||(Wl===null&&(Wl=[]),Wl.push(A,Kn===0?a:a+"_"+Kn,t.memoizedProps)),Kn++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&m?e.flags|=t.flags&32:Cd(e,t.child,n,a,i,o,m)&&(w=!0));t=t.sibling}return w}function Gm(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,a=e.stateNode,i=Ve(n,a),o=On(n.default,n.update),m;m=e.memoizedState,e.memoizedState=null,a=e;var w=e.child;Kn=0,i=Cd(a,w,i,i,o,m,!1),(e.flags&4)!==0&&i&&Bs(e,n.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Gm(e);e=e.sibling}}var sn=!1,mt=!1,Pl=!1,Ed=!1,qm=typeof WeakSet=="function"?WeakSet:Set,on=null,ea=!1,$o=!1,xr=!1,Md=!1;function Jy(e,t,n){if(e=e.containerInfo,Pd=Ks,e=jo(e),ms(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var i=a.getSelection&&a.getSelection();if(i&&i.rangeCount!==0){a=i.anchorNode;var o=i.anchorOffset,m=i.focusNode;i=i.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var w=0,A=-1,Y=-1,Z=0,ee=0,L=e,V=null;t:for(;;){for(var ye;L!==a||o!==0&&L.nodeType!==3||(A=w+o),L!==m||i!==0&&L.nodeType!==3||(Y=w+i),L.nodeType===3&&(w+=L.nodeValue.length),(ye=L.firstChild)!==null;)V=L,L=ye;for(;;){if(L===e)break t;if(V===a&&++Z===o&&(A=w),V===m&&++ee===i&&(Y=w),(ye=L.nextSibling)!==null)break;L=V,V=L.parentNode}L=ye}a=A===-1||Y===-1?null:{start:A,end:Y}}else a=null}a=a||{start:0,end:0}}else a=null;for(ef={focusedElem:e,selectionRange:a},Ks=!1,n=(n&335544064)===n,on=t,t=n?9270:1024;on!==null;){if(e=on,n&&(a=e.deletions,a!==null))for(o=0;o<a.length;o++)n&&Nd(a[o]);if(e.alternate===null&&(e.flags&2)!==0)n&&Um(e),wr(n);else{if(e.tag===22){if(a=e.alternate,e.memoizedState!==null){a!==null&&a.memoizedState===null&&n&&Nd(a),wr(n);continue}else if(a!==null&&a.memoizedState!==null){n&&Um(e),wr(n);continue}}a=e.child,(e.subtreeFlags&t)!==0&&a!==null?(a.return=e,on=a):(n&&$m(e),wr(n))}}Pn=null}function wr(e){for(;on!==null;){var t=on,n=e,a=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((i&1024)!==0&&a!==null){n=void 0,i=a.memoizedProps,a=a.memoizedState;var o=t.stateNode;try{var m=Ji(t.type,i);n=o.getSnapshotBeforeUpdate(m,a),o.__reactInternalSnapshotBeforeUpdate=n}catch(w){yt(t,t.return,w)}}break;case 3:if((i&1024)!==0){if(a=t.stateNode.containerInfo,n=a.nodeType,n===9)cf(a);else if(n===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":cf(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&a!==null&&(n=Ve(a.memoizedProps,a.stateNode),i=t.memoizedProps,i=On(i.default,i.update),i!=="none"&&Ms(a,n,i,a.memoizedState=[],!0));break;default:if((i&1024)!==0)throw Error(f(163))}if(a=t.sibling,a!==null){a.return=t.return,on=a;break}on=t.return}}function Xm(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:ta(e,n),a&4&&Ho(5,n);break;case 1:if(ta(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(m){yt(n,n.return,m)}else{var i=Ji(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){yt(n,n.return,m)}}a&64&&Om(n),a&512&&Fl(n,n.return);break;case 3:if(ta(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{wh(e,t)}catch(m){yt(n,n.return,m)}}break;case 27:t===null&&a&4&&Bm(n);case 26:case 5:ta(e,n),t===null&&a&4&&vd(n),a&512&&Fl(n,n.return);break;case 12:ta(e,n);break;case 31:ta(e,n),a&4&&Qm(e,n);break;case 13:ta(e,n),a&4&&Jm(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ov.bind(null,n),Gv(e,n))));break;case 22:if(a=n.memoizedState!==null||sn,!a){var o=t!==null&&t.memoizedState!==null||mt;t=sn,i=mt,sn=a,(mt=o)&&!i?(a=2,(n.subtreeFlags&8772)!==0&&(a|=1),Ol(e,n,a)):ta(e,n),sn=t,mt=i}break;case 30:ta(e,n),a&512&&Fl(n,n.return);break;case 7:a&512&&Fl(n,n.return);default:ta(e,n)}}function kd(e,t){for(e=e.child;e!==null;)Vm(e,t),e=e.sibling}function Vm(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var a=n.style;typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"}else{var i=e.stateNode,o=e.memoizedProps.style,m=o!=null&&o.hasOwnProperty("display")?o.display:null;i.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(A){yt(e,e.return,A)}zd(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,tt=!0}catch(A){yt(e,e.return,A)}break;case 18:try{var w=e.stateNode;t?Ug(w,!0):Ug(e.stateNode,!1)}catch(A){yt(e,e.return,A)}break;case 22:case 23:e.memoizedState===null&&kd(e,t);break;default:kd(e,t)}}function zd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var n=e,a=t;switch(n.tag){case 4:Vm(n,a);break e;case 22:n.memoizedState===null&&zd(n,a);break e;default:zd(n,a)}}e=e.sibling}}function Km(e){var t=e.alternate;t!==null&&(e.alternate=null,Km(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&as(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 Dt=null,Zn=!1;function zl(e,t,n){for(n=n.child;n!==null;)Zm(e,t,n),n=n.sibling}function Zm(e,t,n){if(Gt&&typeof Gt.onCommitFiberUnmount=="function")try{Gt.onCommitFiberUnmount(ol,n)}catch{}switch(n.tag){case 26:mt||gn(n,t),zl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!mt&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:mt||gn(n,t),Lo(n);var a=Dt,i=Zn;fi(n.type)&&(Dt=n.stateNode,Zn=!1),zl(e,t,n),Wg(n.stateNode,n.type,n.memoizedProps),Dt=a,Zn=i;break;case 5:mt||gn(n,t),Lo(n);case 6:if(n.tag===6&&Lo(n),a=Dt,i=Zn,Dt=null,zl(e,t,n),Dt=a,Zn=i,Dt!==null)if(Zn)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(n.stateNode),tt=!0}catch(o){yt(n,t,o)}else try{Dt.removeChild(n.stateNode),tt=!0}catch(o){yt(n,t,o)}break;case 18:Dt!==null&&(Zn?(e=Dt,Bg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Zs(e)):Bg(Dt,n.stateNode));break;case 4:a=Dt,i=Zn,Dt=n.stateNode.containerInfo,Zn=!0,zl(e,t,n),Dt=a,Zn=i;break;case 0:case 11:case 14:case 15:ii(2,n,t),mt||ii(4,n,t),zl(e,t,n);break;case 1:mt||(gn(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&Dm(n,t,a)),zl(e,t,n);break;case 21:zl(e,t,n);break;case 22:mt=(a=mt)||n.memoizedState!==null,zl(e,t,n),mt=a;break;case 30:gn(n,t),zl(e,t,n);break;case 7:mt||gn(n,t),zl(e,t,n);break;default:zl(e,t,n)}}function Qm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zs(e)}catch(n){yt(t,t.return,n)}}}function Jm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zs(e)}catch(n){yt(t,t.return,n)}}function Fy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new qm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new qm),t;default:throw Error(f(435,e.tag))}}function jr(e,t){var n=Fy(e);t.forEach(function(a){if(!n.has(a)){n.add(a);var i=cv.bind(null,e,a);a.then(i,i)}})}function Rn(e,t,n){var a=t.deletions;if(a!==null)for(var i=0;i<a.length;i++){var o=a[i],m=e,w=t,A=w;e:for(;A!==null;){switch(A.tag){case 27:if(fi(A.type)){Dt=A.stateNode,Zn=!1;break e}break;case 5:Dt=A.stateNode,Zn=!1;break e;case 3:case 4:Dt=A.stateNode.containerInfo,Zn=!0;break e}A=A.return}if(Dt===null)throw Error(f(160));Zm(m,w,o),Dt=null,Zn=!1,m=o.alternate,m!==null&&(m.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Fm(t,e,n),t=t.sibling}var Al=null;function Fm(e,t,n){var a=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(a=e.updateQueue,a=a!==null?a.events:null,a!==null))for(var o=0;o<a.length;o++){var m=a[o];m.ref.impl=m.nextImpl}Rn(t,e,n),_n(e),i&4&&(ii(3,e,e.return),Ho(3,e),ii(5,e,e.return));break;case 1:Rn(t,e,n),_n(e),i&512&&(mt||a===null||gn(a,a.return)),i&64&&sn&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Al,Rn(t,e,n),_n(e),i&512&&(mt||a===null||gn(a,a.return)),i&4)if(i=a!==null?a.memoizedState:null,n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null)if(sn)e.stateNode=Dg(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,n=e.memoizedProps,i=o.ownerDocument||o;t:switch(t){case"title":a=i.getElementsByTagName("title")[0],(!a||a[Ba]||a[Ot]||a.namespaceURI==="http://www.w3.org/2000/svg"||a.hasAttribute("itemprop"))&&(a=i.createElement(t),i.head.insertBefore(a,i.querySelector("head > title"))),pn(a,t,n),a[Ot]=e,qt(a),t=a;break e;case"link":if(o=lp("link","href",i).get(t+(n.href||""))){for(m=0;m<o.length;m++)if(a=o[m],a.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&a.getAttribute("rel")===(n.rel==null?null:n.rel)&&a.getAttribute("title")===(n.title==null?null:n.title)&&a.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(m,1);break t}}a=i.createElement(t),pn(a,t,n),i.head.appendChild(a);break;case"meta":if(o=lp("meta","content",i).get(t+(n.content||""))){for(m=0;m<o.length;m++)if(a=o[m],a.getAttribute("content")===(n.content==null?null:""+n.content)&&a.getAttribute("name")===(n.name==null?null:n.name)&&a.getAttribute("property")===(n.property==null?null:n.property)&&a.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(m,1);break t}}a=i.createElement(t),pn(a,t,n),i.head.appendChild(a);break;default:throw Error(f(468,t))}a[Ot]=e,qt(a),t=a}e.stateNode=t}else sn||gf(o,e.type,e.stateNode);else e.stateNode=np(o,n,e.memoizedProps);else i!==n?(i===null?(t=a.stateNode,t===null||mt||t.parentNode.removeChild(t)):i.count--,n===null?sn||gf(o,e.type,e.stateNode):np(o,n,e.memoizedProps)):n===null&&e.stateNode!==null&&bd(e,e.memoizedProps,a.memoizedProps);break;case 27:Rn(t,e,n),_n(e),i&512&&(mt||a===null||gn(a,a.return)),a!==null&&i&4&&bd(e,e.memoizedProps,a.memoizedProps);break;case 5:if(o=Pl,Pl=!1,Rn(t,e,n),Pl=o,_n(e),i&512&&(mt||a===null||gn(a,a.return)),e.flags&32){t=e.stateNode;try{qn(t,""),tt=!0}catch(Z){yt(e,e.return,Z)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,bd(e,t,a!==null?a.memoizedProps:t)),i&1024&&(Ed=!0);break;case 6:if(Rn(t,e,n),_n(e),i&4){if(e.stateNode===null)throw Error(f(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,tt=!0}catch(Z){yt(e,e.return,Z)}}break;case 3:if(tt=!1,Ur=null,o=Al,Al=Jo(t.containerInfo),Rn(t,e,n),Al=o,_n(e),i&4&&a!==null&&a.memoizedState.isDehydrated)try{Zs(t.containerInfo)}catch(Z){yt(e,e.return,Z)}Ed&&(Ed=!1,Wm(e)),tt=!1;break;case 4:i=Pl,Pl=sn,a=lo(),o=Al,Al=Jo(e.stateNode.containerInfo),Rn(t,e,n),_n(e),Al=o,tt&&$o&&(xr=!0),tt=a,Pl=i;break;case 12:Rn(t,e,n),_n(e);break;case 31:Rn(t,e,n),_n(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jr(e,t)));break;case 13:Rn(t,e,n),_n(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Tr=rt()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jr(e,t)));break;case 22:o=e.memoizedState!==null,m=a!==null&&a.memoizedState!==null;var w=sn,A=mt,Y=Pl;sn=w||o,Pl=Y||o,mt=A||m,Rn(t,e,n),mt=A,Pl=Y,sn=w,_n(e),i&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||a===null||m||sn||mt||(t=m||mt,n=sn,a=mt,sn=o||sn,mt=t,si(e,2),sn=n,mt=a),!o&&Pl||kd(e,o)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,jr(e,n))));break;case 19:Rn(t,e,n),_n(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,jr(e,t)));break;case 30:i&512&&(mt||a===null||gn(a,a.return)),i=lo(),o=$o,m=(n&335544064)===n,w=e.memoizedProps,$o=m&&On(w.default,w.update)!=="none",Rn(t,e,n),_n(e),m&&a!==null&&tt&&(e.flags|=4),$o=o,tt=i;break;case 21:break;case 7:i&512&&(mt||a===null||gn(a,a.return)),a&&a.stateNode!==null&&(a.stateNode._fragmentFiber=e);default:Rn(t,e,n),_n(e)}}function _n(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(_m(a)){n=a;break}a=a.return}a=null;for(var i=e.return;i!==null;){if(yd(i)){var o=i.stateNode;a===null?a=[o]:a.push(o)}if(pd(i))break;i=i.return}var m=a;if(n==null)throw Error(f(160));switch(n.tag){case 27:var w=n.stateNode,A=xd(e);pr(e,A,w,m);break;case 5:var Y=n.stateNode;n.flags&32&&(qn(Y,""),n.flags&=-33);var Z=xd(e);pr(e,Z,Y,m);break;case 3:case 4:var ee=n.stateNode.containerInfo,L=xd(e);wd(e,L,ee,m);break;default:throw Error(f(161))}}catch(V){yt(e,e.return,V)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Wm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Wm(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Ks=!0,t.reset(),Ks=!1),e=e.sibling}}function ks(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Im(t,e),t=t.sibling;else Gm(t)}function Im(e,t){var n=e.alternate;if(n===null)jd(e,!1);else switch(e.tag){case 3:if(Md=ea=!1,Hm(),ks(t,e),!ea&&!xr){if(e=Wl,e!==null)for(var a=0;a<e.length;a+=3){n=e[a];var i=e[a+1];Lg(n,e[a+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+i+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Md=!0}Wl=null;break;case 5:ks(t,e);break;case 4:a=ea,ea=!1,ks(t,e),ea&&(xr=!0),ea=a;break;case 22:e.memoizedState===null&&(n.memoizedState!==null?jd(e,!1):ks(t,e));break;case 30:a=ea,i=Hm(),ea=!1,ks(t,e),ea&&(e.flags|=4);var o=e.memoizedProps,m=e.stateNode;t=Ve(o,m),m=Ve(n.memoizedProps,m);var w=On(o.default,o.update);w==="none"?t=!1:(o=n.memoizedState,n.memoizedState=null,n=e.child,Kn=0,t=Cd(e,n,t,m,w,o,!0),Kn!==(o===null?0:o.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(Bs(e,e.memoizedProps.onUpdate),Wl=i):i!==null&&(i.push.apply(i,Wl),Wl=i),ea=(e.flags&32)!==0?!0:a;break;default:ks(t,e)}}function ta(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Xm(e,t.alternate,t),t=t.sibling}function si(e,t){for(e=e.child;e!==null;){var n=e,a=t;switch(n.tag){case 0:case 11:case 14:case 15:ii(4,n,n.return),si(n,a);break;case 1:gn(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&Dm(n,n.return,i),si(n,a);break;case 27:(a&2)!==0&&Wg(n.stateNode,n.type,n.memoizedProps);case 5:gn(n,n.return),n.tag!==5&&n.tag!==27||Lo(n),si(n,a);break;case 6:Lo(n);break;case 26:gn(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||mt||i.parentNode.removeChild(i),si(n,a);break;case 22:n.memoizedState===null&&si(n,a);break;case 30:gn(n,n.return),si(n,a);break;case 7:gn(n,n.return);default:si(n,a)}e=e.sibling}}function Ol(e,t,n){for(n=(t.subtreeFlags&8772)!==0?n:n&-2,t=t.child;t!==null;){var a=t.alternate,i=e,o=t,m=o.flags,w=(n&1)!==0;switch(o.tag){case 0:case 11:case 15:Ol(i,o,n),Ho(4,o);break;case 1:if(Ol(i,o,n),a=o,i=a.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch(Z){yt(a,a.return,Z)}if(a=o,i=a.updateQueue,i!==null){var A=a.stateNode;try{var Y=i.shared.hiddenCallbacks;if(Y!==null)for(i.shared.hiddenCallbacks=null,i=0;i<Y.length;i++)xh(Y[i],A)}catch(Z){yt(a,a.return,Z)}}w&&m&64&&Om(o),Fl(o,o.return);break;case 27:(n&2)!==0&&Bm(o);case 5:o.tag!==5&&o.tag!==27||Rm(o),Ol(i,o,n),w&&a===null&&m&4&&vd(o),Fl(o,o.return);break;case 6:Rm(o);break;case 26:A=o.stateNode,o.memoizedState!==null||A===null||sn||gf(Jo(A.ownerDocument),o.type,A),Ol(i,o,n),w&&a===null&&m&4&&vd(o),Fl(o,o.return);break;case 12:Ol(i,o,n);break;case 31:Ol(i,o,n),w&&m&4&&Qm(i,o);break;case 13:Ol(i,o,n),w&&m&4&&Jm(i,o);break;case 22:o.memoizedState===null&&Ol(i,o,n),Fl(o,o.return);break;case 30:Ol(i,o,n),Fl(o,o.return);break;case 7:Fl(o,o.return);default:Ol(i,o,n)}t=t.sibling}}function Ad(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&&To(n))}function Od(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&To(e))}function bl(e,t,n,a){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Pm(e,t,n,a),t=t.sibling;else i&&Ym(t)}function Pm(e,t,n,a){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&br(t);var o=t.flags;switch(t.tag){case 0:case 11:case 15:bl(e,t,n,a),o&2048&&Ho(9,t);break;case 1:bl(e,t,n,a);break;case 3:bl(e,t,n,a),i&&Md&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),o&2048&&(o=null,t.alternate!==null&&(o=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==o&&(t.refCount++,o!=null&&To(o)));break;case 12:if(o&2048){bl(e,t,n,a),o=t.stateNode;try{var m=t.memoizedProps,w=m.id,A=m.onPostCommit;typeof A=="function"&&A(w,t.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(Y){yt(t,t.return,Y)}}else bl(e,t,n,a);break;case 31:bl(e,t,n,a);break;case 13:bl(e,t,n,a);break;case 23:break;case 22:m=t.stateNode,w=t.alternate,t.memoizedState!==null?(i&&w!==null&&w.memoizedState===null&&br(w),m._visibility&2?bl(e,t,n,a):Yo(e,t)):(i&&w!==null&&w.memoizedState!==null&&br(t),m._visibility&2?bl(e,t,n,a):(m._visibility|=2,zs(e,t,n,a,(t.subtreeFlags&10256)!==0||!1))),o&2048&&Ad(w,t);break;case 24:bl(e,t,n,a),o&2048&&Od(t.alternate,t);break;case 30:i&&(o=t.alternate,o!==null&&(Il(o.child,!0),Il(t.child,!0))),bl(e,t,n,a);break;default:bl(e,t,n,a)}}function zs(e,t,n,a,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,m=t,w=n,A=a,Y=m.flags;switch(m.tag){case 0:case 11:case 15:zs(o,m,w,A,i),Ho(8,m);break;case 23:break;case 22:var Z=m.stateNode;m.memoizedState!==null?Z._visibility&2?zs(o,m,w,A,i):Yo(o,m):(Z._visibility|=2,zs(o,m,w,A,i)),i&&Y&2048&&Ad(m.alternate,m);break;case 24:zs(o,m,w,A,i),i&&Y&2048&&Od(m.alternate,m);break;default:zs(o,m,w,A,i)}t=t.sibling}}function Yo(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:Yo(n,a),i&2048&&Ad(a.alternate,a);break;case 24:Yo(n,a),i&2048&&Od(a.alternate,a);break;default:Yo(n,a)}t=t.sibling}}var Fi=8192;function Wi(e,t,n){if(e.subtreeFlags&Fi)for(e=e.child;e!==null;)eg(e,t,n),e=e.sibling}function eg(e,t,n){switch(e.tag){case 26:Wi(e,t,n),e.flags&Fi&&(e.memoizedState!==null?nb(n,Al,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&op(n,e)));break;case 5:Wi(e,t,n),e.flags&Fi&&(e=e.stateNode,(t&335544128)===t&&op(n,e));break;case 3:case 4:var a=Al;Al=Jo(e.stateNode.containerInfo),Wi(e,t,n),Al=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=Fi,Fi=16777216,Wi(e,t,n),Fi=a):Wi(e,t,n));break;case 30:if((e.flags&Fi)!==0&&(a=e.memoizedProps.name,a!=null&&a!=="auto")){var i=e.stateNode;i.paired=null,Pn===null&&(Pn=new Map),Pn.set(a,i)}Wi(e,t,n);break;default:Wi(e,t,n)}}function tg(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 Go(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];on=a,lg(a,e)}tg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ng(e),e=e.sibling}function ng(e){switch(e.tag){case 0:case 11:case 15:Go(e),e.flags&2048&&ii(9,e,e.return);break;case 3:Go(e);break;case 12:Go(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Sr(e)):Go(e);break;default:Go(e)}}function Sr(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];on=a,lg(a,e)}tg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ii(8,t,t.return),Sr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Sr(t));break;default:Sr(t)}e=e.sibling}}function lg(e,t){for(;on!==null;){var n=on;switch(n.tag){case 0:case 11:case 15:ii(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:To(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,on=a;else e:for(n=e;on!==null;){a=on;var i=a.sibling,o=a.return;if(Km(a),a===n){on=null;break e}if(i!==null){i.return=o,on=i;break e}on=o}}}var Wy={getCacheForType:function(e){var t=fn(Jt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return fn(Jt).controller.signal}},Iy=typeof WeakMap=="function"?WeakMap:Map,ht=0,Ct=null,Je=null,Ie=0,pt=0,el=null,oi=!1,As=!1,Dd=!1,Aa=0,$t=0,ci=0,Ii=0,Nr=0,tl=0,Os=0,qo=null,Qn=null,Rd=!1,Tr=0,ag=0,Cr=1/0,Er=null,ri=null,Ut=0,Dl=null,Pi=null,na=0,_d=0,Bd=null,ig=null,Ds=null,Rs=null,_s=null,Xo=0,Mr=null;function nl(){return(ht&2)!==0&&Ie!==0?Ie&-Ie:se.T!==null?Kd():Ye()}function sg(){if(tl===0)if((Ie&536870912)===0||qe){var e=ra;ra<<=1,(ra&3932160)===0&&(ra=262144),tl=e}else tl=536870912;return e=hn.current,e!==null&&(e.flags|=32),tl}function Bs(e,t){if(t!=null){var n=e.stateNode,a=n.ref;a===null&&(a=n.ref=$g(Ve(e.memoizedProps,n))),Rs===null&&(Rs=[]),Rs.push(t.bind(null,a))}}function Jn(e,t,n){(e===Ct&&(pt===2||pt===9)||e.cancelPendingCommit!==null)&&(Us(e,0),ui(e,Ie,tl,!1)),z(e,n),((ht&2)===0||e!==Ct)&&(e===Ct&&((ht&2)===0&&(Ii|=n),$t===4&&ui(e,Ie,tl,!1)),la(e))}function og(e,t,n){if((ht&6)!==0)throw Error(f(327));var a=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Wn(e,t),i=a?tv(e,t):Hd(e,t,!0),o=a;do{if(i===0){As&&!a&&ui(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Py(n)){i=Hd(e,t,!1),o=!1;continue}if(i===2){if(o=t,e.errorRecoveryDisabledLanes&o)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var w=e;i=qo;var A=w.current.memoizedState.isDehydrated;if(A&&(Us(w,m).flags|=256),m=Hd(w,m,!1),m!==2&&m!==6){if(Dd&&!A){w.errorRecoveryDisabledLanes|=o,Ii|=o,i=4;break e}o=Qn,Qn=i,o!==null&&(Qn===null?Qn=o:Qn.push.apply(Qn,o))}i=m}if(o=!1,i!==2)continue}}if(i===1){Us(e,0),ui(e,t,0,!0);break}e:{switch(a=e,o=i,o){case 0:case 1:throw Error(f(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:ui(a,t,tl,!oi);break e;case 2:Qn=null;break;case 3:case 5:break;default:throw Error(f(329))}if((t&62914560)===t&&(i=Tr+300-rt(),10<i)){if(ui(a,t,tl,!oi),Ln(a,0,!0)!==0)break e;na=t,a.timeoutHandle=lf(cg.bind(null,a,n,Qn,Er,Rd,t,tl,Ii,Os,oi,o,"Throttled",-0,0),i);break e}cg(a,n,Qn,Er,Rd,t,tl,Ii,Os,oi,o,null,-0,0)}}break}while(!0);la(e)}function cg(e,t,n,a,i,o,m,w,A,Y,Z,ee,L,V){e.timeoutHandle=-1;var ye=t.subtreeFlags,Ne=(o&335544064)===o;if(ee=null,(Ne||ye&8192||(ye&16785408)===16785408)&&(ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zn},Pn=null,eg(t,o,ee),Ne&&(ye=ee,Ne=e.containerInfo,Ne=(Ne.nodeType===9?Ne:Ne.ownerDocument).__reactViewTransition,Ne!=null&&(ye.count++,ye.waitingForViewTransition=!0,ye=Io.bind(ye),Ne.finished.then(ye,ye))),ye=(o&62914560)===o?Tr-rt():(o&4194048)===o?ag-rt():0,ye=lb(ee,ye),ye!==null)){na=o,e.cancelPendingCommit=ye(pg.bind(null,e,t,o,n,a,i,m,w,A,Y,Z,ee,null,L,V)),ui(e,o,m,!Y);return}pg(e,t,o,n,a,i,m,w,A,Y,Z,ee)}function Py(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],o=i.getSnapshot;i=i.value;try{if(!Nn(o(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ui(e,t,n,a){t=ua(e,t),t&=~Nr,t&=~Ii,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var i=t;0<i;){var o=31-Rt(i),m=1<<o;a[o]=-1,i&=~m}n!==0&&xe(e,n,t)}function kr(){return(ht&6)===0?(Vo(0),!1):!0}function Ud(){if(Je!==null){if(pt===0)var e=Je.return;else e=Je,Ta=$i=null,Vu(e),Ss=null,Mo=0,e=Je;for(;e!==null;)Am(e.alternate,e),e=e.return;Je=null}}function Us(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Sv(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),na=0,Ud(),Ct=e,Je=n=Sa(e.current,null),Ie=t,pt=0,el=null,oi=!1,As=Wn(e,t),Dd=!1,Os=tl=Nr=Ii=ci=$t=0,Qn=qo=null,Rd=!1,Aa=ua(e,t),Uc(),n}function rg(e,t){He=null,se.H=cr,t===js||t===Qc?(t=ph(),pt=3):t===Ou?(t=ph(),pt=4):pt=t===sd?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,el=t,Je===null&&($t=1,rr(e,gl(t,e.current)))}function ug(){var e=hn.current;return e===null?!0:(Ie&4194048)===Ie?Tn===null:(Ie&62914560)===Ie||(Ie&536870912)!==0?e===Tn:!1}function dg(){var e=se.H;return se.H=cr,e===null?cr:e}function fg(){var e=se.A;return se.A=Wy,e}function zr(){$t=4,oi||(Ie&4194048)!==Ie&&hn.current!==null||(As=!0),(ci&134217727)===0&&(Ii&134217727)===0||Ct===null||ui(Ct,Ie,tl,!1)}function Hd(e,t,n){var a=ht;ht|=2;var i=dg(),o=fg();(Ct!==e||Ie!==t)&&(Er=null,Us(e,t)),t=!1;var m=$t;e:do try{if(pt!==0&&Je!==null){var w=Je,A=el;switch(pt){case 8:Ud(),m=6;break e;case 3:case 2:case 9:case 6:hn.current===null&&(t=!0);var Y=pt;if(pt=0,el=null,Hs(e,w,A,Y),n&&As){m=0;break e}break;default:Y=pt,pt=0,el=null,Hs(e,w,A,Y)}}ev(),m=$t;break}catch(Z){rg(e,Z)}while(!0);return t&&e.shellSuspendCounter++,Ta=$i=null,ht=a,se.H=i,se.A=o,Je===null&&(Ct=null,Ie=0,Uc()),m}function ev(){for(;Je!==null;)hg(Je)}function tv(e,t){var n=ht;ht|=2;var a=dg(),i=fg();Ct!==e||Ie!==t?(Er=null,Cr=rt()+500,Us(e,t)):As=Wn(e,t);e:do try{if(pt!==0&&Je!==null){t=Je;var o=el;t:switch(pt){case 1:pt=0,el=null,Hs(e,t,o,1);break;case 2:case 9:if(mh(o)){pt=0,el=null,mg(t);break}t=function(){pt!==2&&pt!==9||Ct!==e||(pt=7),la(e)},o.then(t,t);break e;case 3:pt=7;break e;case 4:pt=5;break e;case 7:mh(o)?(pt=0,el=null,mg(t)):(pt=0,el=null,Hs(e,t,o,7));break;case 5:var m=null;switch(Je.tag){case 26:m=Je.memoizedState;case 5:case 27:var w=Je;if(m?ip(m):w.stateNode.complete){pt=0,el=null;var A=w.sibling;if(A!==null)Je=A;else{var Y=w.return;Y!==null?(Je=Y,Ar(Y)):Je=null}break t}}pt=0,el=null,Hs(e,t,o,5);break;case 6:pt=0,el=null,Hs(e,t,o,6);break;case 8:Ud(),$t=6;break e;default:throw Error(f(462))}}nv();break}catch(Z){rg(e,Z)}while(!0);return Ta=$i=null,se.H=a,se.A=i,ht=n,Je!==null?0:(Ct=null,Ie=0,Uc(),$t)}function nv(){for(;Je!==null&&!Nl();)hg(Je)}function hg(e){var t=km(e.alternate,e,Aa);e.memoizedProps=e.pendingProps,t===null?Ar(e):Je=t}function mg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=jm(n,t,t.pendingProps,t.type,void 0,Ie);break;case 11:t=jm(n,t,t.pendingProps,t.type.render,t.ref,Ie);break;case 5:Vu(t);var a=t;a===an&&(qe?(qc(a),a.tag===5&&a.stateNode!=null&&(Mt=a.stateNode)):(qc(a),qe=!0));default:Am(n,t),t=Je=lh(t,Aa),t=km(n,t,Aa)}e.memoizedProps=e.pendingProps,t===null?Ar(e):Je=t}function Hs(e,t,n,a){Ta=$i=null,Vu(t),Ss=null,Mo=0;var i=t.return;try{if(qy(e,i,t,n,Ie)){$t=1,rr(e,gl(n,e.current)),Je=null;return}}catch(o){if(i!==null)throw Je=i,o;$t=1,rr(e,gl(n,e.current)),Je=null;return}t.flags&32768?(qe||a===1?e=!0:As||(Ie&536870912)!==0?e=!1:(oi=e=!0,(a===2||a===9||a===3||a===6)&&(a=hn.current,a!==null&&a.tag===13&&(a.flags|=16384))),gg(t,e)):Ar(t)}function Ar(e){var t=e;do{if((t.flags&32768)!==0){gg(t,oi);return}e=t.return;var n=Zy(t.alternate,t,Aa);if(n!==null){Je=n;return}if(t=t.sibling,t!==null){Je=t;return}Je=t=e}while(t!==null);$t===0&&($t=5)}function gg(e,t){do{var n=Qy(e.alternate,e);if(n!==null){n.flags&=32767,Je=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Je=e;return}Je=e=n}while(e!==null);$t=6,Je=null}function pg(e,t,n,a,i,o,m,w,A,Y,Z,ee){e.cancelPendingCommit=null;do Or();while(Ut!==0);if((ht&6)!==0)throw Error(f(327));if(t!==null){if(t===e.current)throw Error(f(177));e===Ct&&(Je=Ct=null,Ie=0),Pi=t,Dl=e,na=n,Bd=i,ig=a,lv(e,t,n,m,w,A,ee)}}function lv(e,t,n,a,i,o,m){var w=t.lanes|t.childLanes;if(_d=w,w|=bu,H(e,n,w,a,i,o),Rs=null,(n&335544064)===n?(_s=Ay(e),a=10262):(_s=null,a=10256),(t.subtreeFlags&a)!==0||(t.flags&a)!==0?(e.callbackNode=null,e.callbackPriority=0,rv(Yl,function(){return Gd(),null})):(e.callbackNode=null,e.callbackPriority=0),yr=!1,a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=se.T,se.T=null,i=ve.p,ve.p=2,o=ht,ht|=4;try{Jy(e,t,n)}finally{ht=o,ve.p=i,se.T=a}}Ut=1,yr?Ds=kv(m,e.containerInfo,_s,Ld,$d,iv,Yd,Gd,av):(Ld(),$d(),Yd())}function av(e){if(Ut!==0){var t=Dl.onRecoverableError;t(e,{componentStack:null})}}function iv(){Ut===3&&(Ut=0,Im(Pi,Dl),Ut=4)}function Ld(){if(Ut===1){Ut=0;var e=Dl,t=Pi,n=na,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=se.T,se.T=null;var i=ve.p;ve.p=2;var o=ht;ht|=4;try{$o=xr=!1,Fm(t,e,n),n=ef;var m=jo(e.containerInfo),w=n.focusedElem,A=n.selectionRange;if(m!==w&&w&&w.ownerDocument&&wo(w.ownerDocument.documentElement,w)){if(A!==null&&ms(w)){var Y=A.start,Z=A.end;if(Z===void 0&&(Z=Y),"selectionStart"in w)w.selectionStart=Y,w.selectionEnd=Math.min(Z,w.value.length);else{var ee=w.ownerDocument||document,L=ee&&ee.defaultView||window;if(L.getSelection){var V=L.getSelection(),ye=w.textContent.length,Ne=Math.min(A.start,ye),Le=A.end===void 0?Ne:Math.min(A.end,ye);!V.extend&&Ne>Le&&(m=Le,Le=Ne,Ne=m);var $=xo(w,Ne),_=xo(w,Le);if($&&_&&(V.rangeCount!==1||V.anchorNode!==$.node||V.anchorOffset!==$.offset||V.focusNode!==_.node||V.focusOffset!==_.offset)){var X=ee.createRange();X.setStart($.node,$.offset),V.removeAllRanges(),Ne>Le?(V.addRange(X),V.extend(_.node,_.offset)):(X.setEnd(_.node,_.offset),V.addRange(X))}}}}for(ee=[],V=w;V=V.parentNode;)V.nodeType===1&&ee.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ee.length;w++){var I=ee[w];I.element.scrollLeft=I.left,I.element.scrollTop=I.top}}Ks=!!Pd,ef=Pd=null}finally{ht=o,ve.p=i,se.T=a}}e.current=t,Ut=2}}function $d(){if(Ut===2){Ut=0;var e=Dl,t=Pi,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=se.T,se.T=null;var a=ve.p;ve.p=2;var i=ht;ht|=4;try{Xm(e,t.alternate,t)}finally{ht=i,ve.p=a,se.T=n}}Ut=3}}function Yd(){if(Ut===4||Ut===3){Ut=0;var e=Ds;Ds=null,Fn();var t=Dl,n=Pi,a=na,i=ig,o=(a&335544064)===a?10262:10256;if((n.subtreeFlags&o)!==0||(n.flags&o)!==0?Ut=5:(Ut=0,Pi=Dl=null,yg(t,t.pendingLanes)),o=t.pendingLanes,o===0&&(ri=null),Be(a),n=n.stateNode,Gt&&typeof Gt.onCommitFiberRoot=="function")try{Gt.onCommitFiberRoot(ol,n,void 0,(n.current.flags&128)===128)}catch{}if(i!==null){n=se.T,o=ve.p,ve.p=2,se.T=null;try{for(var m=t.onRecoverableError,w=0;w<i.length;w++){var A=i[w];m(A.value,{componentStack:A.stack})}}finally{se.T=n,ve.p=o}}if(i=Rs,m=_s,_s=null,i!==null&&(Rs=null,m===null&&(m=[]),e!==null))for(A=0;A<i.length;A++)n=(0,i[A])(m),n!==void 0&&e.finished.finally(n);(na&3)!==0&&Or(),la(t),o=t.pendingLanes,(a&261930)!==0&&(o&42)!==0?t===Mr?Xo++:(Xo=0,Mr=t):(Xo=0,Mr=null),Vo(0)}}function yg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,To(t)))}function Or(){return Ds!==null&&(Ds.skipTransition(),Ds=null),Ld(),$d(),Yd(),Gd()}function Gd(){if(Ut!==5)return!1;var e=Dl,t=_d;_d=0;var n=Be(na),a=se.T,i=ve.p;try{ve.p=32>n?32:n,se.T=null,n=Bd,Bd=null;var o=Dl,m=na;if(Ut=0,Pi=Dl=null,na=0,(ht&6)!==0)throw Error(f(331));var w=ht;if(ht|=4,ng(o.current),Pm(o,o.current,m,n),ht=w,Vo(0,!1),Gt&&typeof Gt.onPostCommitFiberRoot=="function")try{Gt.onPostCommitFiberRoot(ol,o)}catch{}return!0}finally{ve.p=i,se.T=a,yg(e,t)}}function vg(e,t,n){t=gl(n,t),t=id(e.stateNode,t,2),e=ti(e,t,2),e!==null&&(z(e,2),la(e))}function yt(e,t,n){if(e.tag===3)vg(e,e,n);else for(;t!==null;){if(t.tag===3){vg(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(ri===null||!ri.has(a))){e=gl(n,e),n=mm(2),a=ti(t,n,2),a!==null&&(gm(n,a,t,e),z(a,2),la(a));break}}t=t.return}}function qd(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new Iy;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)||(Dd=!0,i.add(n),e=sv.bind(null,e,t,n),t.then(e,e))}function sv(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ct===e&&(Ie&n)===n&&(($t===4||$t===3&&(Ie&62914560)===Ie&&300>rt()-Tr)&&(ht&2)===0?Us(e,0):Nr|=n,Os===Ie&&(Os=0)),la(e)}function bg(e,t){t===0&&(t=$n()),e=Ui(e,t),e!==null&&(z(e,t),la(e))}function ov(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bg(e,n)}function cv(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(f(314))}a!==null&&a.delete(t),bg(e,n)}function rv(e,t){return Ll(e,t)}var Ls=null,$s=null,Xd=!1,Dr=!1,Vd=!1,di=0;function la(e){e!==$s&&e.next===null&&($s===null?Ls=$s=e:$s=$s.next=e),Dr=!0,Xd||(Xd=!0,dv())}function Vo(e,t){if(!Vd&&Dr){Vd=!0;do for(var n=!1,a=Ls;a!==null;){if(e!==0){var i=a.pendingLanes;if(i===0)var o=0;else{var m=a.suspendedLanes,w=a.pingedLanes;o=(1<<31-Rt(42|e)+1)-1,o&=i&~(m&~w),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(n=!0,Sg(a,o))}else o=Ie,o=Ln(a,a===Ct?o:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(o&3)===0||Wn(a,o)||(n=!0,Sg(a,o));a=a.next}while(n);Vd=!1}}function uv(){xg()}function xg(){Dr=Xd=!1;var e=0;di!==0&&jv()&&(e=di);for(var t=rt(),n=null,a=Ls;a!==null;){var i=a.next,o=wg(a,t);o===0?(a.next=null,n===null?Ls=i:n.next=i,i===null&&($s=n)):(n=a,(e!==0||(o&3)!==0)&&(Dr=!0)),a=i}Ut!==0&&Ut!==5||Vo(e),di!==0&&(di=0)}function wg(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var m=31-Rt(o),w=1<<m,A=i[m];A===-1?((w&n)===0||(w&a)!==0)&&(i[m]=ut(w,t)):A<=t&&(e.expiredLanes|=w),o&=~w}if(t=Ct,n=Ie,n=Ln(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(pt===2||pt===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&$l(a),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Wn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&$l(a),Be(n)){case 2:case 8:n=Tl;break;case 32:n=Yl;break;case 268435456:n=Et;break;default:n=Yl}return a=jg.bind(null,e),n=Ll(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&$l(a),e.callbackPriority=2,e.callbackNode=null,2}function jg(e,t){if(Ut!==0&&Ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Or()&&e.callbackNode!==n)return null;var a=Ie;return a=Ln(e,e===Ct?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(og(e,a,t),wg(e,rt()),e.callbackNode!=null&&e.callbackNode===n?jg.bind(null,e):null)}function Sg(e,t){if(Or())return null;og(e,t,!0)}function dv(){Nv(function(){(ht&6)!==0?Ll(Pt,uv):xg()})}function Kd(){if(di===0){var e=qi;e===0&&(e=ql,ql<<=1,(ql&261888)===0&&(ql=256)),di=e}return di}function Ng(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:$a(e)}function fv(e,t,n,a,i){if(t==="submit"&&n&&n.stateNode===i){var o=Ng((i[Xe]||null).action),m=a.submitter;m&&(t=(t=m[Xe]||null)?Ng(t.formAction):m.getAttribute("formAction"),t!==null&&(o=t,m=null));var w=new Ai("action","action",null,a,i);e.push({event:w,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(di!==0){var A=new FormData(i,m);ed(n,{pending:!0,data:A,method:i.method,action:o},null,A)}}else typeof o=="function"&&(w.preventDefault(),A=new FormData(i,m),ed(n,{pending:!0,data:A,method:i.method,action:o},o,A))},currentTarget:i}]})}}for(var Zd=0;Zd<Re.length;Zd++){var Qd=Re[Zd],hv=Qd.toLowerCase(),mv=Qd[0].toUpperCase()+Qd.slice(1);st(hv,"on"+mv)}st(Oe,"onAnimationEnd"),st(nt,"onAnimationIteration"),st(Ze,"onAnimationStart"),st("dblclick","onDoubleClick"),st("focusin","onFocus"),st("focusout","onBlur"),st(Qe,"onTransitionRun"),st(Xt,"onTransitionStart"),st(Bt,"onTransitionCancel"),st(tn,"onTransitionEnd"),jn("onMouseEnter",["mouseout","mouseover"]),jn("onMouseLeave",["mouseout","mouseover"]),jn("onPointerEnter",["pointerout","pointerover"]),jn("onPointerLeave",["pointerout","pointerover"]),wt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),wt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),wt("onBeforeInput",["compositionend","keypress","textInput","paste"]),wt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),wt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),wt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ko="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),gv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ko));function Tg(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 o=void 0;if(t)for(var m=a.length-1;0<=m;m--){var w=a[m],A=w.instance,Y=w.currentTarget;if(w=w.listener,A!==o&&i.isPropagationStopped())break e;o=w,i.currentTarget=Y;try{o(i)}catch(Z){Za(Z)}i.currentTarget=null,o=A}else for(m=0;m<a.length;m++){if(w=a[m],A=w.instance,Y=w.currentTarget,w=w.listener,A!==o&&i.isPropagationStopped())break e;o=w,i.currentTarget=Y;try{o(i)}catch(Z){Za(Z)}i.currentTarget=null,o=A}}}}function Fe(e,t){var n=t[Cl];n===void 0&&(n=t[Cl]=new Set);var a=e+"__bubble";n.has(a)||(Cg(t,e,2,!1),n.add(a))}function Jd(e,t,n){var a=0;t&&(a|=4),Cg(n,e,a,t)}var Rr="_reactListening"+Math.random().toString(36).slice(2);function Fd(e){if(!e[Rr]){e[Rr]=!0,eo.forEach(function(n){n!=="selectionchange"&&(gv.has(n)||Jd(n,!1,e),Jd(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Rr]||(t[Rr]=!0,Jd("selectionchange",!1,t))}}function Cg(e,t,n,a){switch(gp(t)){case 2:var i=ob;break;case 8:i=cb;break;default:i=yf}n=i.bind(null,t,n,e),i=void 0,!cs||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 Wd(e,t,n,a,i){var o=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var m=a.tag;if(m===3||m===4){var w=a.stateNode.containerInfo;if(w===i)break;if(m===4)for(m=a.return;m!==null;){var A=m.tag;if((A===3||A===4)&&m.stateNode.containerInfo===i)return;m=m.return}for(;w!==null;){if(m=dn(w),m===null)return;if(A=m.tag,A===5||A===6||A===26||A===27){a=o=m;continue e}w=w.parentNode}}a=a.return}pc(function(){var Y=o,Z=io(n),ee=[];e:{var L=Ka.get(e);if(L!==void 0){var V=Ai,ye=e;switch(e){case"keypress":if(ki(n)===0)break e;case"keydown":case"keyup":V=ho;break;case"focusin":ye="focus",V=Ga;break;case"focusout":ye="blur",V=Ga;break;case"beforeblur":case"afterblur":V=Ga;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":V=uo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=Oi;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=fu;break;case Oe:case nt:case Ze:V=vc;break;case tn:V=hu;break;case"scroll":case"scrollend":V=au;break;case"wheel":V=Cc;break;case"copy":case"cut":case"paste":V=ou;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=Sc;break;case"submit":V=Nc;break;case"toggle":case"beforetoggle":V=us}var Ne=(t&4)!==0,Le=!Ne&&(e==="scroll"||e==="scrollend"),$=Ne?L!==null?L+"Capture":null:L;Ne=[];for(var _=Y,X;_!==null;){var I=_;if(X=I.stateNode,I=I.tag,I!==5&&I!==26&&I!==27||X===null||$===null||(I=Vl(_,$),I!=null&&Ne.push(Zo(_,I,X))),Le)break;_=_.return}0<Ne.length&&(L=new V(L,ye,null,n,Z),ee.push({event:L,listeners:Ne}))}}if((t&7)===0){e:{if(V=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",V&&n!==os&&(ye=n.relatedTarget||n.fromElement)&&(dn(ye)||ye[xt]))break e;(L||V)&&(ye=Z.window===Z?Z:(V=Z.ownerDocument)?V.defaultView||V.parentWindow:window,L?(V=n.relatedTarget||n.toElement,L=Y,V=V?dn(V):null,V!==null&&(Le=p(V),Ne=V.tag,V!==Le||Ne!==5&&Ne!==27&&Ne!==6)&&(V=null)):(L=null,V=Y),L!==V&&(Ne=uo,I="onMouseLeave",$="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(Ne=Sc,I="onPointerLeave",$="onPointerEnter",_="pointer"),Le=L==null?ye:Ni(L),X=V==null?ye:Ni(V),ye=new Ne(I,_+"leave",L,n,Z),ye.target=Le,ye.relatedTarget=X,I=null,dn(Z)===Y&&(Ne=new Ne($,_+"enter",V,n,Z),Ne.target=X,Ne.relatedTarget=Le,I=Ne),Le=I,Ne=L&&V?ie(L,V,pv):null,L!==null&&Eg(ee,ye,L,Ne,!1),V!==null&&Le!==null&&Eg(ee,Le,V,Ne,!0)))}e:{if(L=Y?Ni(Y):window,V=L.nodeName&&L.nodeName.toLowerCase(),V==="select"||V==="input"&&L.type==="file")var we=Bi;else if(kc(L))if(Xa)we=Rc;else{we=Oc;var Pe=Ac}else V=L.nodeName,!V||V.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?Y&&ga(Y.elementType)&&(we=Bi):we=Dc;if(we&&(we=we(e,Y))){fl(ee,we,n,Z);break e}Pe&&Pe(e,L,Y)}switch(Pe=Y?Ni(Y):window,e){case"focusin":(kc(Pe)||Pe.contentEditable==="true")&&(ja=Pe,gs=Y,d=null);break;case"focusout":d=gs=ja=null;break;case"mousedown":g=!0;break;case"contextmenu":case"mouseup":case"dragend":g=!1,x(ee,n,Z);break;case"selectionchange":if(Bc)break;case"keydown":case"keyup":x(ee,n,Z)}var Ae;if(Di)e:{switch(e){case"compositionstart":var De="onCompositionStart";break e;case"compositionend":De="onCompositionEnd";break e;case"compositionupdate":De="onCompositionUpdate";break e}De=void 0}else dl?Mc(e,n)&&(De="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(De="onCompositionStart");De&&(mo&&n.locale!=="ko"&&(dl||De!=="onCompositionStart"?De==="onCompositionEnd"&&dl&&(Ae=oo()):(Xn=Z,rl="value"in Xn?Xn.value:Xn.textContent,dl=!0)),Pe=_r(Y,De),0<Pe.length&&(De=new fo(De,e,null,n,Z),ee.push({event:De,listeners:Pe}),Ae?De.data=Ae:(Ae=Ge(n),Ae!==null&&(De.data=Ae)))),(Ae=pu?yu(e,n):vu(e,n))&&(De=_r(Y,"onBeforeInput"),0<De.length&&(Pe=new fo("onBeforeInput","beforeinput",null,n,Z),ee.push({event:Pe,listeners:De}),Pe.data=Ae)),fv(ee,e,Y,n,Z)}Tg(ee,t)})}function Zo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function _r(e,t){for(var n=t+"Capture",a=[];e!==null;){var i=e,o=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||o===null||(i=Vl(e,n),i!=null&&a.unshift(Zo(e,i,o)),i=Vl(e,t),i!=null&&a.push(Zo(e,i,o))),e.tag===3)return a;e=e.return}return[]}function pv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Eg(e,t,n,a,i){for(var o=t._reactName,m=[];n!==null&&n!==a;){var w=n,A=w.alternate,Y=w.stateNode;if(w=w.tag,A!==null&&A===a)break;w!==5&&w!==26&&w!==27||Y===null||(A=Y,i?(Y=Vl(n,o),Y!=null&&m.unshift(Zo(n,Y,A))):i||(Y=Vl(n,o),Y!=null&&m.push(Zo(n,Y,A)))),n=n.return}m.length!==0&&e.push({event:t,listeners:m})}var yv=/\r\n?/g,vv=/\u0000|\uFFFD/g;function Mg(e){return(typeof e=="string"?e:""+e).replace(yv,`
49
- `).replace(vv,"")}function kg(e,t){return t=Mg(t),Mg(e)===t}function vt(e,t,n,a,i,o){switch(n){case"children":if(typeof a=="string")t==="body"||t==="textarea"&&a===""||qn(e,a);else if(typeof a=="number"||typeof a=="bigint")t!=="body"&&qn(e,""+a);else return;break;case"className":Ci(e,"class",a);break;case"tabIndex":Ci(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Ci(e,n,a);break;case"style":Ml(e,a,o);return;case"data":if(t!=="object"){Ci(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=$a(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 o=="function"&&(n==="formAction"?(t!=="input"&&vt(e,t,"name",i.name,i,null),vt(e,t,"formEncType",i.formEncType,i,null),vt(e,t,"formMethod",i.formMethod,i,null),vt(e,t,"formTarget",i.formTarget,i,null)):(vt(e,t,"encType",i.encType,i,null),vt(e,t,"method",i.method,i,null),vt(e,t,"target",i.target,i,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=$a(a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=zn);return;case"onScroll":a!=null&&Fe("scroll",e);return;case"onScrollEnd":a!=null&&Fe("scrollend",e);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(f(61));if(n=a.__html,n!=null){if(i.children!=null)throw Error(f(60));(o!=null?o.__html:void 0)!==n&&(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=$a(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"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":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":Fe("beforetoggle",e),Fe("toggle",e),Ti(e,"popover",a);break;case"xlinkActuate":Yn(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Yn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Yn(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Yn(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Yn(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Yn(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Yn(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Ti(e,"is",a);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=is.get(n)||n,Ti(e,n,a);else return}tt=!0}function Id(e,t,n,a,i,o){switch(n){case"style":Ml(e,a,o);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(f(61));if(n=a.__html,n!=null){if(i.children!=null)throw Error(f(60));(o!=null?o.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"children":if(typeof a=="string")qn(e,a);else if(typeof a=="number"||typeof a=="bigint")qn(e,""+a);else return;break;case"onScroll":a!=null&&Fe("scroll",e);return;case"onScrollEnd":a!=null&&Fe("scrollend",e);return;case"onClick":a!=null&&(e.onclick=zn);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!to.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(i=n.endsWith("Capture"),o=n.slice(2,i?n.length-7:void 0),t=e[Xe]||null,t=t!=null?t[n]:null,typeof t=="function"&&e.removeEventListener(o,t,i),typeof a=="function")){typeof t!="function"&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,a,i);break e}tt=!0,n in e?e[n]=a:a===!0?e.setAttribute(n,""):Ti(e,n,a)}return}tt=!0}function pn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",e),Fe("load",e);var a=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var m=n[o];if(m!=null)switch(o){case"src":a=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(f(137,t));default:vt(e,t,o,m,n,null)}}i&&vt(e,t,"srcSet",n.srcSet,n,null),a&&vt(e,t,"src",n.src,n,null);return;case"input":Fe("invalid",e);var w=o=m=i=null,A=null,Y=null;for(a in n)if(n.hasOwnProperty(a)){var Z=n[a];if(Z!=null)switch(a){case"name":i=Z;break;case"type":m=Z;break;case"checked":A=Z;break;case"defaultChecked":Y=Z;break;case"value":o=Z;break;case"defaultValue":w=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(f(137,t));break;default:vt(e,t,a,Z,n,null)}}Zt(e,o,w,A,Y,m,i,!1);return;case"select":Fe("invalid",e),a=m=o=null;for(i in n)if(n.hasOwnProperty(i)&&(w=n[i],w!=null))switch(i){case"value":o=w;break;case"defaultValue":m=w;break;case"multiple":a=w;default:vt(e,t,i,w,n,null)}t=o,n=m,e.multiple=!!a,t!=null?ha(e,!!a,t,!1):n!=null&&ha(e,!!a,n,!0);return;case"textarea":Fe("invalid",e),o=i=a=null;for(m in n)if(n.hasOwnProperty(m)&&(w=n[m],w!=null))switch(m){case"value":a=w;break;case"defaultValue":i=w;break;case"children":o=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(f(91));break;default:vt(e,t,m,w,n,null)}ma(e,a,i,o);return;case"option":for(A in n)if(n.hasOwnProperty(A)&&(a=n[A],a!=null))switch(A){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:vt(e,t,A,a,n,null)}return;case"dialog":Fe("beforetoggle",e),Fe("toggle",e),Fe("cancel",e),Fe("close",e);break;case"iframe":case"object":Fe("load",e);break;case"video":case"audio":for(a=0;a<Ko.length;a++)Fe(Ko[a],e);break;case"image":Fe("error",e),Fe("load",e);break;case"details":Fe("toggle",e);break;case"embed":case"source":case"link":Fe("error",e),Fe("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(Y in n)if(n.hasOwnProperty(Y)&&(a=n[Y],a!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,t));default:vt(e,t,Y,a,n,null)}return;default:if(ga(t)){for(Z in n)n.hasOwnProperty(Z)&&(a=n[Z],a!==void 0&&Id(e,t,Z,a,n,void 0));return}}for(w in n)n.hasOwnProperty(w)&&(a=n[w],a!=null&&vt(e,t,w,a,n,null))}var bv={};function xv(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,o=null,m=null,w=null,A=null,Y=null,Z=null;for(V in n){var ee=n[V];if(n.hasOwnProperty(V)&&ee!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":A=ee;default:a.hasOwnProperty(V)||vt(e,t,V,null,a,ee)}}for(var L in a){var V=a[L];if(ee=n[L],a.hasOwnProperty(L)&&(V!=null||ee!=null))switch(L){case"type":V!==ee&&(tt=!0),o=V;break;case"name":V!==ee&&(tt=!0),i=V;break;case"checked":V!==ee&&(tt=!0),Y=V;break;case"defaultChecked":V!==ee&&(tt=!0),Z=V;break;case"value":V!==ee&&(tt=!0),m=V;break;case"defaultValue":V!==ee&&(tt=!0),w=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(f(137,t));break;default:V!==ee&&vt(e,t,L,V,a,ee)}}Ei(e,m,w,A,Y,Z,o,i);return;case"select":V=m=w=L=null;for(o in n)if(A=n[o],n.hasOwnProperty(o)&&A!=null)switch(o){case"value":break;case"multiple":V=A;default:a.hasOwnProperty(o)||vt(e,t,o,null,a,A)}for(i in a)if(o=a[i],A=n[i],a.hasOwnProperty(i)&&(o!=null||A!=null))switch(i){case"value":o!==A&&(tt=!0),L=o;break;case"defaultValue":o!==A&&(tt=!0),w=o;break;case"multiple":o!==A&&(tt=!0),m=o;default:o!==A&&vt(e,t,i,o,a,A)}t=w,n=m,a=V,L!=null?ha(e,!!n,L,!1):!!a!=!!n&&(t!=null?ha(e,!!n,t,!0):ha(e,!!n,n?[]:"",!1));return;case"textarea":V=L=null;for(w in n)if(i=n[w],n.hasOwnProperty(w)&&i!=null&&!a.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:vt(e,t,w,null,a,i)}for(m in a)if(i=a[m],o=n[m],a.hasOwnProperty(m)&&(i!=null||o!=null))switch(m){case"value":i!==o&&(tt=!0),L=i;break;case"defaultValue":i!==o&&(tt=!0),V=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(f(91));break;default:i!==o&&vt(e,t,m,i,a,o)}gc(e,L,V);return;case"option":for(var ye in n)if(L=n[ye],n.hasOwnProperty(ye)&&L!=null&&!a.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:vt(e,t,ye,null,a,L)}for(A in a)if(L=a[A],V=n[A],a.hasOwnProperty(A)&&L!==V&&(L!=null||V!=null))switch(A){case"selected":L!==V&&(tt=!0),e.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:vt(e,t,A,L,a,V)}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 Ne in n)L=n[Ne],n.hasOwnProperty(Ne)&&L!=null&&!a.hasOwnProperty(Ne)&&vt(e,t,Ne,null,a,L);for(Y in a)if(L=a[Y],V=n[Y],a.hasOwnProperty(Y)&&L!==V&&(L!=null||V!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(f(137,t));break;default:vt(e,t,Y,L,a,V)}return;default:if(ga(t)){for(var Le in n)L=n[Le],n.hasOwnProperty(Le)&&L!==void 0&&!a.hasOwnProperty(Le)&&Id(e,t,Le,void 0,a,L);for(Z in a)L=a[Z],V=n[Z],!a.hasOwnProperty(Z)||L===V||L===void 0&&V===void 0||Id(e,t,Z,L,a,V);return}}for(var $ in n)L=n[$],n.hasOwnProperty($)&&L!=null&&!a.hasOwnProperty($)&&vt(e,t,$,null,a,L);for(ee in a)L=a[ee],V=n[ee],!a.hasOwnProperty(ee)||L===V||L==null&&V==null||vt(e,t,ee,L,a,V)}function zg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wv(){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],o=i.transferSize,m=i.initiatorType,w=i.duration;if(o&&w&&zg(m)){for(m=0,w=i.responseEnd,a+=1;a<n.length;a++){var A=n[a],Y=A.startTime;if(Y>w)break;var Z=A.transferSize,ee=A.initiatorType;Z&&zg(ee)&&(A=A.responseEnd,m+=Z*(A<w?1:(w-Y)/(A-Y)))}if(--a,t+=8*(o+m)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Pd=null,ef=null;function Qo(e){return e.nodeType===9?e:e.ownerDocument}function Ag(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 Og(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 Dg(e,t,n,a){return n=Qo(n).createElement(e),n[Ot]=a,n[Xe]=t,pn(n,e,t),qt(n),n}function tf(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 nf=null;function jv(){var e=window.event;return e&&e.type==="popstate"?e===nf?!1:(nf=e,!0):(nf=null,!1)}var lf=typeof setTimeout=="function"?setTimeout:void 0,Sv=typeof clearTimeout=="function"?clearTimeout:void 0,Rg=typeof Promise=="function"?Promise:void 0,_g=typeof requestAnimationFrame=="function"?requestAnimationFrame:lf,Nv=typeof queueMicrotask=="function"?queueMicrotask:typeof Rg<"u"?function(e){return Rg.resolve(null).then(e).catch(Tv)}:lf;function Tv(e){setTimeout(function(){throw e})}function fi(e){return e==="head"}function Bg(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),Zs(t);return}a--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")a++;else if(n==="html")ff(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ff(n);for(var o=n.firstChild;o;){var m=o.nextSibling,w=o.nodeName;o[Ba]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&o.rel.toLowerCase()==="stylesheet"||n.removeChild(o),o=m}}else n==="body"&&ff(e.ownerDocument.body);n=i}while(n);Zs(t)}function Ug(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;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=a}while(n)}function Hg(e,t,n){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display==="inline"){if(t=e.getClientRects(),t.length===1)var a=1;else for(var i=a=0;i<t.length;i++){var o=t[i];0<o.width&&0<o.height&&a++}a===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+n.paddingTop,e.marginBottom="-"+n.paddingBottom)}}function Lg(e,t){e=e.style,t=t.style;var n=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=n==null||typeof n=="boolean"?"":(""+n).trim(),n=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=n==null||typeof n=="boolean"?"":(""+n).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(n=t.display,e.display=n==null||typeof n=="boolean"?"":n,n=t.margin,n!=null?e.margin=n:(n=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=n==null||typeof n=="boolean"?"":n,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function Cv(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function af(e){var t=e.getBoundingClientRect(),n=getComputedStyle(e);return Cv(t,n,e)}function Ev(e){return e.documentElement.clientHeight}function Mv(e){this.addEventListener("load",e),this.addEventListener("error",e)}function kv(e,t,n,a,i,o,m,w,A){var Y=t.nodeType===9?t:t.ownerDocument;try{var Z=Y.startViewTransition({update:function(){var L=Y.defaultView,V=L.navigation&&L.navigation.transition,ye=Y.fonts.status;a();var Ne=[];if(ye==="loaded"&&(Ev(Y),Y.fonts.status==="loading"&&Ne.push(Y.fonts.ready)),ye=Ne.length,e!==null)for(var Le=e.suspenseyImages,$=0,_=0;_<Le.length;_++){var X=Le[_];if(!X.complete){var I=X.getBoundingClientRect();if(0<I.bottom&&0<I.right&&I.top<L.innerHeight&&I.left<L.innerWidth){if($+=sp(X),$>Hr){Ne.length=ye;break}X=new Promise(Mv.bind(X)),Ne.push(X)}}}if(0<Ne.length)return L=Promise.race([Promise.all(Ne),new Promise(function(we){return setTimeout(we,500)})]).then(i,i),(V?Promise.allSettled([V.finished,L]):L).then(o,o);if(i(),V)return V.finished.then(o,o);o()},types:n});Y.__reactViewTransition=Z;var ee=[];return Z.ready.then(function(){for(var L=Y.documentElement.getAnimations({subtree:!0}),V=0;V<L.length;V++){var ye=L[V],Ne=ye.effect,Le=Ne.pseudoElement;if(Le!=null&&Le.startsWith("::view-transition")){ee.push(ye),ye=Ne.getKeyframes();for(var $=Le=void 0,_=!0,X=0;X<ye.length;X++){var I=ye[X],we=I.width;if(Le===void 0)Le=we;else if(Le!==we){_=!1;break}if(we=I.height,$===void 0)$=we;else if($!==we){_=!1;break}delete I.width,delete I.height,I.transform==="none"&&delete I.transform}_&&Le!==void 0&&$!==void 0&&(Ne.setKeyframes(ye),_=getComputedStyle(Ne.target,Ne.pseudoElement),_.width!==Le||_.height!==$)&&(_=ye[0],_.width=Le,_.height=$,_=ye[ye.length-1],_.width=Le,_.height=$,Ne.setKeyframes(ye))}}m()},function(L){Y.__reactViewTransition===Z&&(Y.__reactViewTransition=null);try{if(typeof L=="object"&&L!==null)switch(L.name){case"InvalidStateError":(L.message==="View transition was skipped because document visibility state is hidden."||L.message==="Skipping view transition because document visibility state has become hidden."||L.message==="Skipping view transition because viewport size changed."||L.message==="Transition was aborted because of invalid state")&&(L=null)}L!==null&&A(L)}finally{a(),i(),m()}}),Z.finished.finally(function(){for(var L=0;L<ee.length;L++)ee[L].cancel();Y.__reactViewTransition===Z&&(Y.__reactViewTransition=null),w()}),Z}catch{return a(),i(),m(),null}}function es(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}es.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:ue({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},es.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),a=[],i=0;i<n.length;i++){var o=n[i].effect;o!==null&&o.target===e&&o.pseudoElement===t&&a.push(n[i])}return a},es.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function $g(e){return{name:e,group:new es("group",e),imagePair:new es("image-pair",e),old:new es("old",e),new:new es("new",e)}}function ll(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}ll.prototype.addEventListener=function(e,t,n){var a=null,i=null;if(!(n!=null&&typeof n!="boolean"&&(a=n.signal||null,a!==null&&a.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var o=this._eventListeners;if(Gg(o,e,t,n)===-1){var m=this,w=t;n!=null&&typeof n!="boolean"&&n.once===!0&&(w=function(A){m.removeEventListener(e,t,n),typeof t=="function"?t.call(this,A):t.handleEvent(A)}),a!==null&&(i=m.removeEventListener.bind(m,e,t,n),a.addEventListener("abort",i,{once:!0}),i=a.removeEventListener.bind(a,"abort",i)),a=Ys(n),o.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:w,cleanup:i}),b(this._fragmentFiber.child,!1,zv,e,w,a)}this._eventListeners=o}};function zv(e,t,n,a){return T(e).addEventListener(t,n,a),!1}ll.prototype.removeEventListener=function(e,t,n){var a=this._eventListeners;if(a!==null&&(t=Gg(a,e,t,n),t!==-1)){var i=a[t];n=i.attachedListener;var o=i.cleanup;i=Ys(i.optionsOrUseCapture),b(this._fragmentFiber.child,!1,Av,e,n,i),a.splice(t,1),o!==null&&o()}};function Av(e,t,n,a){return T(e).removeEventListener(t,n,a),!1}function Ys(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Yg(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Gg(e,t,n,a){if(e.length===0)return-1;a=Yg(a);for(var i=0;i<e.length;i++){var o=e[i];if(o.type===t&&o.listener===n&&Yg(o.optionsOrUseCapture)===a)return i}return-1}ll.prototype.dispatchEvent=function(e){var t=M(this._fragmentFiber);if(t===null)return!0;t=T(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var a=t.nodeType===9?t.createComment(""):document.createTextNode("");if(n)for(var i=0;i<n.length;i++){var o=n[i];a.addEventListener(o.type,o.attachedListener,Ys(o.optionsOrUseCapture))}if(t.appendChild(a),e=a.dispatchEvent(e),n)for(i=0;i<n.length;i++)o=n[i],a.removeEventListener(o.type,o.attachedListener,Ys(o.optionsOrUseCapture));return t.removeChild(a),e}return t.dispatchEvent(e)},ll.prototype.focus=function(e){b(this._fragmentFiber.child,!0,qg,e,void 0,void 0)};function qg(e,t){return e.tag===6?!1:(e=T(e),qv(e,t))}ll.prototype.focusLast=function(e){var t=[];b(this._fragmentFiber.child,!0,sf,t,void 0,void 0);for(var n=t.length-1;0<=n&&!qg(t[n],e);n--);};function sf(e,t){return t.push(e),!1}ll.prototype.blur=function(){var e=M(this._fragmentFiber);e!==null&&(e=T(e),e=Qo(e).activeElement,e!==null&&b(this._fragmentFiber.child,!1,Ov,e,void 0,void 0))};function Ov(e,t){return e.tag===6?!1:(e=T(e),e===t||e.contains(t)?(t.blur(),!0):!1)}ll.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),b(this._fragmentFiber.child,!1,Dv,e,void 0,void 0)};function Dv(e,t){return e.tag===6||(e=T(e),t.observe(e)),!1}ll.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),b(this._fragmentFiber.child,!1,Rv,e,void 0,void 0);for(var n=t=0;n<Rl.length;n++){var a=Rl[n];a.fragmentInstance===this&&a.observer===e?e.unobserve(a.instance):Rl[t++]=a}Rl.length=t}};function Rv(e,t){return e.tag===6||(e=T(e),t.unobserve(e)),!1}var Rl=[],of=!1;function _v(e,t,n){Rl.push({fragmentInstance:e,observer:t,instance:n}),of||(of=!0,Xv(function(){of=!1;var a=Rl;Rl=[];for(var i=0;i<a.length;i++){var o=a[i];o.observer.unobserve(o.instance)}}))}ll.prototype.getClientRects=function(){var e=[];return b(this._fragmentFiber.child,!1,Bv,e,void 0,void 0),e};function Bv(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=T(e),t.push.apply(t,e.getClientRects());return!1}ll.prototype.getRootNode=function(e){var t=M(this._fragmentFiber);return t===null?this:T(t).getRootNode(e)},ll.prototype.compareDocumentPosition=function(e){var t=M(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];b(this._fragmentFiber.child,!1,sf,n,void 0,void 0);var a=T(t);if(n.length===0){if(n=a,D(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=a=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:a&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=q(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=T(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=T(n[0]),i=T(n[n.length-1]);var o=D(this._fragmentFiber)?t.parentElement:a;if(o==null)return Node.DOCUMENT_POSITION_DISCONNECTED;a=o.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,o=o.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var m=t.compareDocumentPosition(e),w=i.compareDocumentPosition(e),A=m&Node.DOCUMENT_POSITION_CONTAINED_BY||w&Node.DOCUMENT_POSITION_CONTAINED_BY;return w=a&&o&&m&Node.DOCUMENT_POSITION_FOLLOWING&&w&Node.DOCUMENT_POSITION_PRECEDING,t=a&&t===e||o&&i===e||A||w?Node.DOCUMENT_POSITION_CONTAINED_BY:!a&&t===e||!o&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:m,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Uv(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Uv(e,t,n,a,i){var o=dn(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!o)e:{for(;o!==null;){if(o.tag===7&&(o===t||o.alternate===t)){n=!0;break e}o=o.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(o===null)return o=i.ownerDocument,i===o||i===o.documentElement||i===o.body;e:{for(o=t,t=M(t);o!==null;){if(!(o.tag!==5&&o.tag!==3&&o.tag!==27||o!==t&&o.alternate!==t)){o=!0;break e}o=o.return}o=!1}return o}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!o)&&!(t=o===n)&&(t=ie(n,o,fe),t===null?t=!1:(b(t,!0,ne,o,n),o=R,R=null,t=o!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!o)&&!(t=o===a)&&(t=ie(a,o,fe),t===null?t=!1:(b(t,!0,F,o,a),o=R,W=R=null,t=o!==null)),t):!1}function Xg(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}ll.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(f(566));var t=[];b(this._fragmentFiber.child,!1,sf,t,void 0,void 0);var n=e!==!1;if(t.length===0){var a=q(this._fragmentFiber);if(a=n?a[1]||a[0]||M(this._fragmentFiber):a[0]||a[1],a===null)return;if(a.tag===6){e=T(a),Xg(e,n);return}if(a=T(a),a.nodeType!==9){if(a.nodeType===11){n="host"in a?a.host:null,n!==null&&n.scrollIntoView(e);return}a.scrollIntoView(e)}}for(a=n?t.length-1:0;a!==(n?-1:t.length);){var i=t[a];i.tag===6?(i=T(i),Xg(i,n)):T(i).scrollIntoView(e),a+=n?-1:1}};function Hv(e,t){return e=T(e),Vg(e,t),!1}function Vg(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Kg(e,t){var n=t._eventListeners;if(n!==null)for(var a=0;a<n.length;a++){var i=n[a];e.addEventListener(i.type,i.attachedListener,Ys(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(o){for(var m=0,w=0;w<Rl.length;w++){var A=Rl[w];(A.fragmentInstance!==t||A.observer!==o||A.instance!==e)&&(Rl[m++]=A)}Rl.length=m,o.observe(e)}),Vg(e,t))}function Lv(e,t){var n=t._eventListeners;if(n!==null)for(var a=0;a<n.length;a++){var i=n[a];e.removeEventListener(i.type,i.attachedListener,Ys(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(o){typeof o.rootMargin=="string"?_v(t,o,e):o.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function cf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":cf(n),as(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function $v(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(!e[Ba])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;if(o!==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(o=e.getAttribute("src"),(o!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=xl(e.nextSibling),e===null)break}return null}function Yv(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=xl(e.nextSibling),e===null))return null;return e}function Zg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=xl(e.nextSibling),e===null))return null;return e}function rf(e){return e.data==="$?"||e.data==="$~"}function uf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Gv(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 xl(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 df=null;function Qg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return xl(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Jg(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 qv(e,t){function n(){a=!0}if(e.ownerDocument.activeElement===e)return!0;var a=!1;try{e.ownerDocument.addEventListener("focus",n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",n,!0)}return a}function Xv(e){_g(function(){_g(function(t){return e(t)})})}function Fg(e,t,n){switch(t=Qo(n),e){case"html":if(e=t.documentElement,!e)throw Error(f(452));return e;case"head":if(e=t.head,!e)throw Error(f(453));return e;case"body":if(e=t.body,!e)throw Error(f(454));return e;default:throw Error(f(451))}}function Wg(e,t,n){for(var a in n){var i=n[a];n.hasOwnProperty(a)&&i!=null&&vt(e,t,a,null,bv,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===zn&&(e.onclick=null),as(e)}function ff(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);as(e)}var wl=new Map,Ig=new Set;function Jo(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Oa=ve.d;ve.d={f:Vv,r:Kv,D:Zv,C:Qv,L:Jv,m:Fv,X:Iv,S:Wv,M:Pv};function Vv(){var e=Oa.f(),t=kr();return e||t}function Kv(e){var t=kn(e);t!==null&&t.tag===5&&t.type==="form"?em(t):Oa.r(e)}var Gs=typeof document>"u"?null:document;function Pg(e,t,n){var a=Gs;if(a&&typeof t=="string"&&t){var i=ft(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),Ig.has(i)||(Ig.add(i),e={rel:e,crossOrigin:n,href:t},a.querySelector(i)===null&&(t=a.createElement("link"),pn(t,"link",e),qt(t),a.head.appendChild(t)))}}function Zv(e){Oa.D(e),Pg("dns-prefetch",e,null)}function Qv(e,t){Oa.C(e,t),Pg("preconnect",e,t)}function Jv(e,t,n){Oa.L(e,t,n);var a=Gs;if(a&&e&&t){var i='link[rel="preload"][as="'+ft(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+ft(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+ft(n.imageSizes)+'"]')):i+='[href="'+ft(e)+'"]';var o=i;switch(t){case"style":o=qs(e);break;case"script":o=Xs(e)}if(!(wl.has(o)||(e=ue({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),wl.set(o,e),a.querySelector(i)!==null||t==="style"&&a.querySelector(Fo(o))||t==="script"&&a.querySelector(Wo(o))))){var m=a.createElement("link");pn(m,"link",e),t==="style"&&(m[Xl]=!0,m.onload=m.onerror=function(){Ps(m)}),qt(m),a.head.appendChild(m)}}}function Fv(e,t){Oa.m(e,t);var n=Gs;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+ft(a)+'"][href="'+ft(e)+'"]',o=i;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=Xs(e)}if(!wl.has(o)&&(e=ue({rel:"modulepreload",href:e},t),wl.set(o,e),n.querySelector(i)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Wo(o)))return}a=n.createElement("link"),pn(a,"link",e),qt(a),n.head.appendChild(a)}}}function Wv(e,t,n){Oa.S(e,t,n);var a=Gs;if(a&&e){var i=da(a).hoistableStyles,o=qs(e);t=t||"default";var m=i.get(o);if(!m){var w={loading:0,preload:null};if(m=a.querySelector(Fo(o)))w.loading=5;else{e=ue({rel:"stylesheet",href:e,"data-precedence":t},n),(n=wl.get(o))&&hf(e,n);var A=m=a.createElement("link");qt(A),pn(A,"link",e),A._p=new Promise(function(Y,Z){A.onload=Y,A.onerror=Z}),A.addEventListener("load",function(){w.loading|=1}),A.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Br(m,t,a)}m={type:"stylesheet",instance:m,count:1,state:w},i.set(o,m)}}}function Iv(e,t){Oa.X(e,t);var n=Gs;if(n&&e){var a=da(n).hoistableScripts,i=Xs(e),o=a.get(i);o||(o=n.querySelector(Wo(i)),o||(e=ue({src:e,async:!0},t),(t=wl.get(i))&&mf(e,t),o=n.createElement("script"),qt(o),pn(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},a.set(i,o))}}function Pv(e,t){Oa.M(e,t);var n=Gs;if(n&&e){var a=da(n).hoistableScripts,i=Xs(e),o=a.get(i);o||(o=n.querySelector(Wo(i)),o||(e=ue({src:e,async:!0,type:"module"},t),(t=wl.get(i))&&mf(e,t),o=n.createElement("script"),qt(o),pn(o,"link",e),n.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},a.set(i,o))}}function ep(e,t,n,a){var i=(i=Tt.current)?Jo(i):null;if(!i)throw Error(f(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(n=qs(n.href),t=da(i).hoistableStyles,a=t.get(n),a||(a={type:"style",instance:null,count:0,state:null},t.set(n,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=qs(n.href);var o=da(i).hoistableStyles,m=o.get(e);if(m||(i=i.ownerDocument||i,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,m),(o=i.querySelector(Fo(e)))?o._p||(m.instance=o,m.state.loading=5):(o=wl.get(e),o||(o={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},wl.set(e,o)),eb(i,e,o,m.state))),t&&a===null)throw Error(f(528,""));return m}if(t&&a!==null)throw Error(f(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(n=Xs(n),t=da(i).hoistableScripts,a=t.get(n),a||(a={type:"script",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(f(444,e))}}function qs(e){return'href="'+ft(e)+'"'}function Fo(e){return'link[rel="stylesheet"]['+e+"]"}function tp(e){return ue({},e,{"data-precedence":e.precedence,precedence:null})}function eb(e,t,n,a){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Xl]!==!0){a.loading=1;return}}else t=e.createElement("link"),t[Xl]=!0,t.onload=t.onerror=Ps.bind(null,t),pn(t,"link",n),qt(t),e.head.appendChild(t);a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2})}function Xs(e){return'[src="'+ft(e)+'"]'}function Wo(e){return"script[async]"+e}function np(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+ft(n.href)+'"]');if(a)return t.instance=a,qt(a),a;var i=ue({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),qt(a),pn(a,"style",i),Br(a,n.precedence,e),t.instance=a;case"stylesheet":i=qs(n.href);var o=e.querySelector(Fo(i));if(o)return t.state.loading|=4,t.instance=o,qt(o),o;a=tp(n),(i=wl.get(i))&&hf(a,i),o=(e.ownerDocument||e).createElement("link"),qt(o);var m=o;return m._p=new Promise(function(w,A){m.onload=w,m.onerror=A}),pn(o,"link",a),t.state.loading|=4,Br(o,n.precedence,e),t.instance=o;case"script":return o=Xs(n.src),(i=e.querySelector(Wo(o)))?(t.instance=i,qt(i),i):(a=n,(i=wl.get(o))&&(a=ue({},n),mf(a,i)),e=e.ownerDocument||e,i=e.createElement("script"),qt(i),pn(i,"link",a),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(f(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Br(a,n.precedence,e));return t.instance}function Br(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=a.length?a[a.length-1]:null,o=i,m=0;m<a.length;m++){var w=a[m];if(w.dataset.precedence===t)o=w;else if(o!==i)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function hf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function mf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ur=null;function lp(e,t,n){if(Ur===null){var a=new Map,i=Ur=new Map;i.set(n,a)}else i=Ur,a=i.get(n),a||(a=new Map,i.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var o=n[i];if(!(o[Ba]||o[Ot]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var m=o.getAttribute(t)||"";m=e+m;var w=a.get(m);w?w.push(o):a.set(m,[o])}}return a}function gf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function tb(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 ap(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function ip(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function sp(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function op(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=sp(t),e.suspenseyImages.push(t)),e=ab.bind(e),t.decode().then(e,e))}function nb(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=qs(a.href),o=t.querySelector(Fo(i));if(o){t=o._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=o,qt(o);return}o=t.ownerDocument||t,a=tp(a),(i=wl.get(i))&&hf(a,i),o=o.createElement("link"),qt(o);var m=o;m._p=new Promise(function(w,A){m.onload=w,m.onerror=A}),pn(o,"link",a),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=Io.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Hr=0;function lb(e,t){return e.stylesheets&&e.count===0&&$r(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var a=setTimeout(function(){if(e.stylesheets&&$r(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&Hr===0&&(Hr=62500*wv());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$r(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>Hr?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(i)}}:null}function cp(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)$r(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Io(){this.count--,cp(this)}function ab(){this.imgCount--,cp(this)}var Lr=null;function $r(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Lr=new Map,t.forEach(ib,e),Lr=null,Io.call(e))}function ib(e,t){if(!(t.state.loading&4)){var n=Lr.get(e);if(n)var a=n.get(null);else{n=new Map,Lr.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<i.length;o++){var m=i[o];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(n.set(m.dataset.precedence,m),a=m)}a&&n.set(null,a)}i=t.instance,m=i.getAttribute("data-precedence"),o=n.get(m)||a,o===a&&n.set(null,i),n.set(m,i),this.count++,a=Io.bind(this),i.addEventListener("load",a),i.addEventListener("error",a),o?o.parentNode.insertBefore(i,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Vs={$$typeof:et,Provider:null,Consumer:null,_currentValue:gt,_currentValue2:gt,_threadCount:0};function sb(e,t,n,a,i,o,m,w,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=ji(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ji(0),this.hiddenUpdates=ji(null),this.identifierPrefix=a,this.onUncaughtError=i,this.onCaughtError=o,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=A,this.transitionTypes=null,this.incompleteTransitions=new Map}function rp(e,t,n,a,i,o,m,w,A,Y,Z,ee){return e=new sb(e,t,n,m,A,Y,Z,ee,w),t=1,o===!0&&(t|=24),o=Vn(3,null,null,t),e.current=o,o.stateNode=e,t=ku(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:a,isDehydrated:n,cache:t},Du(o),e}function up(e){return e?(e=ys,e):ys}function dp(e,t,n,a,i,o){i=up(i),a.context===null?a.context=i:a.pendingContext=i,a=ei(t),a.payload={element:n},o=o===void 0?null:o,o!==null&&(a.callback=o),n=ti(e,a,t),n!==null&&(Jn(n,e,t),ko(n,e,t))}function fp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pf(e,t){fp(e,t),(e=e.alternate)&&fp(e,t)}function hp(e){if(e.tag===13||e.tag===31){var t=Ui(e,67108864);t!==null&&Jn(t,e,67108864),pf(e,67108864)}}function mp(e){if(e.tag===13||e.tag===31){var t=nl();t=We(t);var n=Ui(e,t);n!==null&&Jn(n,e,t),pf(e,t)}}var Ks=!0;function ob(e,t,n,a){var i=se.T;se.T=null;var o=ve.p;try{ve.p=2,yf(e,t,n,a)}finally{ve.p=o,se.T=i}}function cb(e,t,n,a){var i=se.T;se.T=null;var o=ve.p;try{ve.p=8,yf(e,t,n,a)}finally{ve.p=o,se.T=i}}function yf(e,t,n,a){if(Ks){var i=vf(a);if(i===null)Wd(e,t,a,Yr,n),pp(e,a);else if(ub(i,e,t,n,a))a.stopPropagation();else if(pp(e,a),t&4&&-1<rb.indexOf(e)){for(;i!==null;){var o=kn(i);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var m=Mn(o.pendingLanes);if(m!==0){var w=o;for(w.pendingLanes|=2,w.entangledLanes|=2;m;){var A=1<<31-Rt(m);w.entanglements[1]|=A,m&=~A}la(o),(ht&6)===0&&(Cr=rt()+500,Vo(0))}}break;case 31:case 13:w=Ui(o,2),w!==null&&Jn(w,o,2),kr(),pf(o,2)}if(o=vf(a),o===null&&Wd(e,t,a,Yr,n),o===i)break;i=o}i!==null&&a.stopPropagation()}else Wd(e,t,a,null,n)}}function vf(e){return e=io(e),bf(e)}var Yr=null;function bf(e){if(Yr=null,e=dn(e),e!==null){var t=p(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=v(t),e!==null)return e;e=null}else if(n===31){if(e=C(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Yr=e,null}function gp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ke()){case Pt:return 2;case Tl:return 8;case Yl:case sl:return 32;case Et:return 268435456;default:return 32}default:return 32}}var xf=!1,hi=null,mi=null,gi=null,Po=new Map,ec=new Map,pi=[],rb="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 pp(e,t){switch(e){case"focusin":case"focusout":hi=null;break;case"dragenter":case"dragleave":mi=null;break;case"mouseover":case"mouseout":gi=null;break;case"pointerover":case"pointerout":Po.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ec.delete(t.pointerId)}}function tc(e,t,n,a,i,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:o,targetContainers:[i]},t!==null&&(t=kn(t),t!==null&&hp(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function ub(e,t,n,a,i){switch(t){case"focusin":return hi=tc(hi,e,t,n,a,i),!0;case"dragenter":return mi=tc(mi,e,t,n,a,i),!0;case"mouseover":return gi=tc(gi,e,t,n,a,i),!0;case"pointerover":var o=i.pointerId;return Po.set(o,tc(Po.get(o)||null,e,t,n,a,i)),!0;case"gotpointercapture":return o=i.pointerId,ec.set(o,tc(ec.get(o)||null,e,t,n,a,i)),!0}return!1}function yp(e){var t=dn(e.target);if(t!==null){var n=p(t);if(n!==null){if(t=n.tag,t===13){if(t=v(n),t!==null){e.blockedOn=t,un(e.priority,function(){mp(n)});return}}else if(t===31){if(t=C(n),t!==null){e.blockedOn=t,un(e.priority,function(){mp(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 Gr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vf(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);os=a,n.target.dispatchEvent(a),os=null}else return t=kn(n),t!==null&&hp(t),e.blockedOn=n,!1;t.shift()}return!0}function vp(e,t,n){Gr(e)&&n.delete(t)}function db(){xf=!1,hi!==null&&Gr(hi)&&(hi=null),mi!==null&&Gr(mi)&&(mi=null),gi!==null&&Gr(gi)&&(gi=null),Po.forEach(vp),ec.forEach(vp)}function qr(e,t){e.blockedOn===t&&(e.blockedOn=null,xf||(xf=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,db)))}var Xr=null;function bp(e){Xr!==e&&(Xr=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){Xr===e&&(Xr=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(bf(a||n)===null)continue;break}var o=kn(n);o!==null&&(e.splice(t,3),t-=3,ed(o,{pending:!0,data:i,method:n.method,action:a},a,i))}}))}function Zs(e){function t(A){return qr(A,e)}hi!==null&&qr(hi,e),mi!==null&&qr(mi,e),gi!==null&&qr(gi,e),Po.forEach(t),ec.forEach(t);for(var n=0;n<pi.length;n++){var a=pi[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<pi.length&&(n=pi[0],n.blockedOn===null);)yp(n),n.blockedOn===null&&pi.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var i=n[a],o=n[a+1],m=i[Xe]||null;if(typeof o=="function")m||bp(n);else if(m){var w=null;if(o&&o.hasAttribute("formAction")){if(i=o,m=o[Xe]||null)w=m.formAction;else if(bf(i)!==null)continue}else w=m.action;typeof w=="function"?n[a+1]=w:(n.splice(a,3),a-=3),bp(n)}}}function xp(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(m){return i=m})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),a||setTimeout(n,20)}function n(){if(!a&&!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 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 wf(e){this._internalRoot=e}Vr.prototype.render=wf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(f(409));var n=t.current,a=nl();dp(n,a,e,t,null,null)},Vr.prototype.unmount=wf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dp(e.current,2,null,e,null,null),kr(),t[xt]=null}};function Vr(e){this._internalRoot=e}Vr.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ye();e={blockedOn:null,target:e,priority:t};for(var n=0;n<pi.length&&t!==0&&t<pi[n].priority;n++);pi.splice(n,0,e),n===0&&yp(e)}};var wp=c.version;if(wp!=="19.3.0")throw Error(f(527,wp,"19.3.0"));ve.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(f(188)):(e=Object.keys(e).join(","),Error(f(268,e)));return e=S(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var fb={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:se,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Kr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kr.isDisabled&&Kr.supportsFiber)try{ol=Kr.inject(fb),Gt=Kr}catch{}}return lc.createRoot=function(e,t){if(!h(e))throw Error(f(299));var n=!1,a="",i=um,o=dm,m=fm;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=rp(e,1,!1,null,null,n,a,null,i,o,m,xp),e[xt]=t.current,Fd(e),new wf(t)},lc.hydrateRoot=function(e,t,n){if(!h(e))throw Error(f(299));var a=!1,i="",o=um,m=dm,w=fm,A=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(o=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError),n.formState!==void 0&&(A=n.formState)),t=rp(e,1,!0,t,n??null,a,i,A,o,m,w,xp),t.context=up(null),n=t.current,a=nl(),a=We(a),i=ei(a),i.callback=null,ti(n,i,a),n=a,t.current.lanes=n,z(t,n),la(t),e[xt]=t.current,Fd(e),new Vr(t)},lc.version="19.3.0",lc}var Op;function Sb(){if(Op)return Nf.exports;Op=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(c){console.error(c)}}return l(),Nf.exports=jb(),Nf.exports}var Nb=Sb();const If=Math.random().toString(36).slice(2),nu=(()=>{try{let l=localStorage.getItem("design-canvas:browser");return l||localStorage.setItem("design-canvas:browser",l=Math.random().toString(36).slice(2)),l}catch{return If}})();let eu="";const Tb=l=>void(eu=l),Mf=()=>({"X-Easel-Client":nu,...eu?{"X-Easel-Author":encodeURIComponent(eu)}:{}});async function Qs(l){const c=await l.json().catch(()=>({}));if(!l.ok)throw Object.assign(new Error(c.error??l.statusText),{status:l.status,body:c});return c}const Te={board:()=>fetch("/api/board").then(l=>Qs(l)),update:()=>fetch("/api/update").then(l=>Qs(l)),saveBoard:(l,c)=>fetch("/api/board",{method:"PUT",headers:{"Content-Type":"application/json",...Mf()},body:JSON.stringify({...l,clientId:If,...c?{label:c}:{}})}).then(u=>Qs(u)),post:(l,c)=>fetch(l,{method:"POST",headers:{"Content-Type":"application/json",...Mf()},body:JSON.stringify(c)}).then(u=>Qs(u)),put:(l,c)=>fetch(l,{method:"PUT",headers:{"Content-Type":"application/json",...Mf()},body:JSON.stringify(c)}).then(u=>Qs(u)),get:l=>fetch(l).then(c=>Qs(c))};let oc=null,Gf=null;function ry(l){Gf=l,(oc==null?void 0:oc.readyState)===1&&oc.send(JSON.stringify({type:"editing",file:l,client:nu,person:eu||void 0}))}function Cb(l){let c=null,u=!1;const f=()=>{c=oc=new WebSocket(`${location.protocol==="https:"?"wss":"ws"}://${location.host}/ws`),c.onopen=()=>Gf&&ry(Gf),c.onmessage=h=>{try{l(JSON.parse(h.data))}catch{}},c.onclose=()=>{u||setTimeout(f,1e3)}};return f(),()=>{u=!0,c==null||c.close()}}function al(l){const c=l.ownerDocument,u=[];let f=l;for(;f&&f!==c.body;){const h=f.parentElement;if(!h)return null;u.unshift(Array.prototype.indexOf.call(h.children,f)),f=h}return f===c.body?u.join("/"):null}function Cn(l,c){let u=l.body;if(!c)return u;for(const f of c.split("/"))if(u=(u==null?void 0:u.children[Number(f)])??null,!u)return null;return u}function ia(l){const c=l.getBoundingClientRect();return{x:c.left,y:c.top,w:c.width,h:c.height}}const Eb=["width","height","padding","margin","gap","font-family","font-size","font-weight","color","background-color","border-radius","display","flex-direction","align-items","justify-content","line-height","text-align","border","box-shadow","opacity","flex-wrap","flex-grow","align-self","grid-template-columns","grid-template-rows","position","background-image"];function Mb(l){const c=l.ownerDocument.defaultView.getComputedStyle(l),u={};for(const f of Eb)u[f]=c.getPropertyValue(f);return u}function Dp(l){const c={},u=l.style;if(!u)return c;for(let f=0;f<u.length;f++)c[u[f]]=u.getPropertyValue(u[f]);return c}function kb(l,c,u,f){const h=f.replace(/\s+/g," ").trim().slice(0,40);return`${l} ${c} ${h?`"${h}" `:""}(${u})`}const zb={select:"M5 3l13 8-6 1.5L9.5 19z",hand:"M8 12V6.5a1.5 1.5 0 0 1 3 0V11m0-5.5V5a1.5 1.5 0 0 1 3 0v6m0-4.5a1.5 1.5 0 0 1 3 0V13a7 7 0 0 1-7 7h-.5a6 6 0 0 1-5-2.7L3.3 14a1.5 1.5 0 0 1 2.4-1.8L8 15",board:"M4 5h16v14H4zM4 9h16",title:"M5 6h14M12 6v13M9 19h6",sticky:"M5 4h14v10l-5 6H5zM14 20v-6h5",search:"M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM20 20l-4-4",undo:"M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3",redo:"M15 14l5-5-5-5M20 9H10a6 6 0 0 0 0 12h3",play:"M8 5l11 7-11 7z",edit:"M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4",trash:"M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3",copy:"M8 8h11v11H8zM5 16V5h11",plus:"M12 5v14M5 12h14",close:"M6 6l12 12M18 6L6 18",chevronDown:"M6 9l6 6 6-6",chevronRight:"M9 6l6 6-6 6",list:"M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01",fit:"M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5",focus:"M9 4H4v5M15 4h5v5M9 20H4v-5M15 20h5v-5M9 9h6v6H9z",layers:"M12 3l9 5-9 5-9-5zM3 13l9 5 9-5",comment:"M4 5h16v11H9l-5 4z",front:"M8 8h12v12H8zM4 4h12v4M4 4v12h4",back:"M4 4h12v12H4zM8 16v4h12V8h-4",page:"M6 3h9l4 4v14H6zM15 3v4h4",more:"M5 12h.01M12 12h.01M19 12h.01",moon:"M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z",sun:"M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",map:"M3 6l6-2 6 2 6-2v14l-6 2-6-2-6 2zM9 4v14M15 6v14",panel:"M4 5h16v14H4zM15 5v14",check:"M5 12l5 5 9-10",warn:"M12 4l9 16H3zM12 10v4M12 17h.01",info:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM12 11v5M12 8h.01",rect:"M4 6h16v12H4z",oval:"M12 19c4.4 0 8-3.1 8-7s-3.6-7-8-7-8 3.1-8 7 3.6 7 8 7z",line:"M5 19L19 5",arrow:"M5 19L19 5M10 5h9v9",pen:"M4 20l1-4L16.5 4.5l3 3L8 19zM14 7l3 3",image:"M4 5h16v14H4zM4 15l4-4 4 4 3-3 5 5M15 9h.01",grid:"M4 4h16v16H4zM4 12h16M12 4v16",system:"M4 5h16v11H4zM9 20h6M12 16v4",share:"M12 15V4M8 8l4-4 4 4M5 13v6h14v-6",folder:"M4 6h6l2 2h8v11H4z",file:"M6 3h8l4 4v14H6zM14 3v4h4",pdf:"M6 3h8l4 4v14H6zM14 3v4h4M9 13h6M9 17h4",eye:"M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",compare:"M4 5h7v14H4zM13 5h7v14h-7",restore:"M4 12a8 8 0 1 0 3-6.2M4 4v4h4",link:"M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1",radius:"M5 19V11a6 6 0 0 1 6-6h8",spacing:"M4 4v16M20 4v16M8 12h8M8 12l2-2M8 12l2 2M16 12l-2-2M16 12l-2 2",minus:"M5 12h14",parent:"M10 14L5 9l5-5M5 9h8a6 6 0 0 1 6 6v5",clock:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2",person:"M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 20a7 7 0 0 1 14 0",alignLeft:"M5 4v16M9 8h10M9 16h6",alignHcenter:"M12 4v16M6 8h12M8 16h8",alignRight:"M19 4v16M5 8h10M9 16h6",alignTop:"M4 5h16M8 9v10M16 9v6",alignVcenter:"M4 12h16M8 6v12M16 8v8",alignBottom:"M4 19h16M8 5v10M16 9v6"};function P({name:l,size:c=18,...u}){return s.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...u,children:s.jsx("path",{d:zb[l]})})}const Bn=(l,c,u)=>l===1?`1 ${c}`:`${l} ${u}`,kf=l=>Bn(l,"variant","variants"),Ab={button:"Button",a:"Link",img:"Image",input:"Field",textarea:"Field",select:"Menu",label:"Label",p:"Paragraph",span:"Text",li:"List item",ul:"List",ol:"List",nav:"Navigation",header:"Header",footer:"Footer",main:"Main",section:"Section",form:"Form",svg:"Icon",style:"Styles",script:"Script"},Rp=(l,c)=>Ab[l??""]??(/^h[1-6]$/.test(l??"")?"Heading":c?`.${c}`:l?`<${l}>`:"Element"),r={app:{title:"Easel",docTitle:l=>`${l} — Easel`,loadFailed:"Couldn't load:",retry:"Try again",crashed:"The canvas hit an error and stopped:",reload:"Reload",loadingBoards:"Loading boards…",loading:"Loading…",emptyPage:"This page is empty",drawBoard:"Draw board",defaultAuthor:"Me",tokensAside:"Design tokens",assetsAside:"Assets",inspectorAside:"Inspector",navigation:"Navigation",announceBoard:(l,c,u)=>`${l} selected, ${c}/${u}. Enter to select inside`,firstRunEdit:"Click anything on a board to select it · double-click text to edit it",firstRunAi:l=>`Press ${l}J to ask the AI for a change`},templates:{blank:"Blank",mobile:"Mobile screen",desktop:"Desktop screen",doc:"Document"},tools:{select:"Select",hand:"Hand",board:"Draw board",title:"Title",sticky:"Note",rect:"Rectangle",oval:"Oval",line:"Line",arrow:"Arrow",pen:"Pen"},toolHints:{select:"Select and move boards",hand:"Drag to pan the canvas",board:"Drag to draw a board",title:"Click to add a title",sticky:"Click to add a sticky note",rect:"Drag to draw a rectangle",oval:"Drag to draw an oval",line:"Drag to draw a line",arrow:"Drag to draw an arrow",pen:"Drag to draw freehand"},toolbar:{aria:"Tools",leftPanel:"Left panel",leftPanelTitle:l=>`Left panel (${l}\\)`,canvasTools:"Canvas tools",shapes:"Shapes",tool:(l,c)=>`${l} (${c})`,shapeToolTitle:(l,c)=>`${l} (${c}) · Shift for square or circle`,insertImage:"Insert image",insertImageTitle:"Insert image (you can also paste onto the canvas)",undo:"Undo",redo:"Redo",undoTitle:(l,c)=>l?`Undo: ${l} (${c}Z)`:`Undo (${c}Z)`,redoTitle:(l,c)=>l?`Redo: ${l} (⇧${c}Z)`:`Redo (⇧${c}Z)`,newBoard:"New board",newBoardTitle:"New board (choose a template)",themeTitle:"Design system theme (used by swatches, token check and AI)",theme:"Theme",themeOption:l=>`Theme: ${l}`,snapshot:"Snapshot (git)",snapshotTitle:"Snapshot: save the design folder as a git commit",erroredBoards:"Boards with errors",erroredBoardsN:l=>`Boards with errors ${l}`,errors:l=>`Errors ${l}`,zoomOut:"Zoom out",zoomOutTitle:l=>`Zoom out (${l}-)`,zoomIn:"Zoom in",zoomInTitle:l=>`Zoom in (${l}+)`,zoom100:"Zoom to 100%",zoom100Title:l=>`Zoom to 100% (${l}0)`,fitAll:"Fit all",fitAllTitle:"Fit all (⇧1)",aiChat:"AI chat",askAi:"Ask AI",aiChatTitle:l=>`AI chat (${l}J)`,guides:"Show layout guides",guidesTitle:"Show layout guides (⌃G)",appearance:l=>`Appearance: ${l==="system"?"System":l==="light"?"Light":"Dark"}`,appearanceTitle:l=>`Appearance: ${l==="system"?"Follow system":l==="light"?"Light":"Dark"} (click to change)`,minimap:"Minimap",minimapTitle:"Minimap (M)",viewMenu:"View",viewMenuTitle:"View: guides, minimap, appearance, theme, snapshot",viewMenuTitleNarrow:"View: zoom, history, guides, minimap, appearance, snapshot",project:"Project",history:"History"},tabs:{left:"Left panel",boards:"Boards",assets:"Assets",tokens:"Tokens",right:"Right panel",closePanel:"Close panel",properties:"Properties",ai:"AI"},boardList:{aria:"Pages and boards",pages:"Pages",addPage:"Add page",singlePage:"Viewing everything as one page. Use + to split it into pages.",pageTabTitle:"Drag to reorder · right-click to rename or delete",boardsHead:"Boards",searchPlaceholder:"Find boards (⌘K)",search:"Find boards",noMatch:l=>`No boards match "${l}". Try part of the file name.`,emptyPage:"No boards on this page yet. Press B and drag on the canvas to draw one.",fileMissing:"File missing",otherGroup:"Other",mainPage:"Main",groupTitle:l=>`${Bn(l,"board","boards")} · click to collapse or expand · double-click to rename`,groupMenu:"Group menu"},minimap:{aria:"Minimap: click to move there"},sections:{board:"Board",comments:"Comments",guides:"Layout guides",tweaks:"Adjustable values",tokenCheck:"Token check",a11y:"Accessibility",checks:"Checks",properties:"Properties",layers:"Layers"},boardOptions:{aria:"Board options",positionAndSize:"Position and size",position:"Position",size:"Size",options:"Options",renameTitle:"Rename (F2)",renameFileTitle:"Rename file",width:"Width",height:"Height",radius:"Radius",interactive:"Interactive (Play)",frameless:"No frame",fill:"Stretch to window",launch:"Open as launch screen",page:"Page",focus:"Focus view",focusTitle:"Focus view (F)",front:"Bring to front",frontTitle:"Bring to front (⌘])",back:"Send to back",backTitle:"Send to back (⌘[)",duplicate:"Duplicate",duplicateTitle:"Duplicate (⌘D)",delete:"Delete",deleteTitle:"Delete (Delete)",selectedN:l=>`${Bn(l,"board","boards")} selected`,frontTitleMod:l=>`Bring to front (${l}])`,backTitleMod:l=>`Send to back (${l}[)`,goToSelected:"Go to selected boards",goToSelectedTitle:"Go to selected boards (⇧2)",deleteTitleKey:"Delete (⌫)"},focus:{aria:l=>`${l} focus view`,prev:"Previous board",next:"Next board",pageStyle:" · page-style",close:"Close"},play:{back:"Back",forward:"Forward",viewOnCanvas:"View on canvas",closeTitle:"Close (Esc)",close:"Close"},share:{button:"Share",buttonTitle:"Share a view-only copy (web folder, single file, PDF or PNG)",title:"Share a view-only copy",scope:"What to export",whole:"Whole canvas",page:"This page",pageNone:"This canvas has one page",selected:l=>`Selected boards (${l})`,webTitle:"Web folder",webHint:"Static files. Host on Vercel, GitHub Pages or a PR preview.",singleTitle:"Single file",singleHint:l=>` · ${l} · opens in any browser, no hosting`,singleSwitch:"One .html file",measuring:"measuring…",pdfTitle:"PDF",pdfHint:"One board per page",pngTitle:"PNG",pngHint:"One image per board, 2×",export:"Export",save:"Save",working:"Exporting…",exported:"exported",saved:"saved",reveal:"Reveal",revealTitle:"Show the folder in your file manager",copyDeploy:"Copy deploy command",copyDeployTitle:l=>`Copies ${l} (run it in the project folder)`,copied:l=>`Copied: ${l}`,copyFailed:"Couldn't copy to the clipboard",attachHint:"Attach it to Slack, email or a PR.",skipped:l=>`${l} reference${l===1?"":"s"} could not be included`,largeFiles:"Large canvases make large files. No live updates.",sameAs:"Same as:",unavailable:"Unavailable here."},viewer:{docTitle:l=>`${l} — view only`,noData:"This page is an Easel export, but its data is missing (easel-viewer/data.js).",bar:"Viewer",pages:"Pages",play:"Play",playTitle:"Try the selected board full screen (or the first one)",stamp:l=>`View only · exported ${l}`,stampTitle:"A read-only copy. Changes happen in the design files, then export again.",madeWith:"Made with Easel",comments:"Comments",commentsN:l=>`Comments ${l}`,noComments:"No comments",replies:l=>l===1?"1 reply":`${l} replies`,pin:(l,c)=>`Comment ${l} by ${c}`,threadOf:(l,c)=>`${l} of ${c}`,closeThread:"Close comment",boardsPanel:"Boards",commentsPanel:"Comments panel",empty:"Nothing on this page"},canvas:{aria:"Design canvas",board:(l,c,u,f)=>`Board ${l}${c?" (selected)":""}${u?" editing":""}${f?" playing":""}`,interactive:"Interactive (Play)",hint:"Click selects · Double-click edits text · Esc deselects",notLoaded:"Scroll closer to load",fileMissing:l=>`File missing · ${l}`,playing:"▶ Playing · Esc",boardSize:"Board size",titleMaxWidth:"Max width",stickySize:"Sticky note size",deleteNote:"Delete note"},editMode:{fileChanged:"Someone changed this file first. Select the element again."},elementDrag:{moveAria:"Move element (Alt: into the hovered box)",moveTitle:"Drag to move · hold Alt to drop into the hovered box",width:"Width",height:"Height",size:"Size"},layers:{collapse:"Collapse",expand:"Expand",title:"Layers",hint:"Drop an item on another to move it in front of that item. Shift+click to select several (for wrapping). Click the list, then use ↑↓ to move and ←→ to collapse or expand."},select:{toolbar:"Element",text:"Text",textOff:"No text in this element",fill:"Fill",radius:"Radius",spacing:"Spacing",askAi:"Ask AI",askAiTitle:"Ask AI about this element",comment:"Comment",commentTitle:"Comment on this element",tokens:"Tokens",custom:"Custom…",hex:"Hex colour",picker:"Pick a colour",tokenNow:l=>`${l} · token`,decrease:l=>`Decrease ${l.toLowerCase()}`,increase:l=>`Increase ${l.toLowerCase()}`},design:{fill:"Fill",text:"Text",font:"Font",size:"Size",weight:"Weight",color:"Color",cornerRadius:"Corner radius",padding:"Padding",gap:"Gap",more:"More (CSS)",none:"None",inherited:l=>`(${l})`,weights:{100:"Thin",200:"Extra light",300:"Light",400:"Regular",500:"Medium",600:"Semibold",700:"Bold",800:"Extra bold",900:"Black"},white:"white",black:"black",grade:l=>l>=7?"AAA":l>=4.5?"AA":l>=3?"AA large text only":"too low",contrastWith:(l,c,u)=>`Contrast ${l}:1 with ${c} text · ${u}`,contrastOn:(l,c,u)=>`Contrast ${l}:1 on ${c} · ${u}`,openFill:l=>`${l}: change`},properties:{tokenColors:{text:"Text",secondaryText:"Secondary text",background:"Background",surface:"Surface",divider:"Divider",accent:"Accent",error:"Error"},fields:{width:"Width",height:"Height",fontSize:"Font size",fontWeight:"Weight",color:"Color",background:"Background",radius:"Radius",flexDirection:"Flex direction",alignItems:"Align items",justifyContent:"Justify content",flexWrap:"Wrap",flexGrow:"Grow",alignSelf:"Align self",lineHeight:"Line height",textAlign:"Text align",border:"Border",boxShadow:"Shadow",opacity:"Opacity"},alignButtons:{left:"Align left",hcenter:"Align center",right:"Align right",top:"Align top",vcenter:"Align middle",bottom:"Align bottom"},columns:"Columns",rows:"Rows",align:"Align",layout:"Layout",wrap:"Wrap",image:"Image",replaceImage:"Replace image…",wrapTitle:"Select consecutive siblings with the same parent first",wrapFlex:"Wrap in flex",wrapGrid:"Wrap in grid",duplicate:"Duplicate",delete:"Delete",offToken:l=>`Off tokens: ${l}`,none:"none",contrastTitle:"Contrast with background (4.5 or more for body text, 3 or more for large text)",contrast:"Contrast",largeTextOnly:"Large text only",tooLow:"Too low"},shapes:{selectedN:l=>`${l} shapes selected`,deleteAll:"Delete selected shapes",stickyColors:{yellow:"Yellow",orange:"Orange",pink:"Pink",purple:"Purple",blue:"Blue",green:"Green",gray:"Gray",white:"White"},shapeSize:"Shape size",drawShape:"Draw shape",kinds:{rect:"Rectangle",oval:"Oval",line:"Line",arrow:"Arrow",pen:"Pen",image:"Image"},none:"None",options:"Shape options",strokeColor:"Stroke color",fill:"Fill",weight:"Weight",strokeWeight:"Stroke weight",front:"Bring to front",back:"Send to back",deleteShape:"Delete shape",deleteTitle:"Delete (⌫)"},notes:{selectedN:l=>`${l} notes selected`,deleteAll:"Delete selected notes",options:"Note options",title:"Title",sticky:"Sticky note",fontSize:"Font size",defaultSuffix:" (default)",textStyle:"Text style",bold:"Bold",italic:"Italic",color:"Color",stickyColor:l=>`${l} sticky note`,maxWidth:"Max width",maxHeight:"Max height",width:"Width",height:"Height",titleHint:"Text shrinks once it passes the max width or height (0 means no limit).",stickyHint:"With a height set, overflowing text scrolls (0 fits the content).",deleteNote:"Delete note",deleteTitle:"Delete (⌫)"},guides:{aria:"Layout guides",heading:(l,c)=>`Layout guides ${l}/${c}`,types:{columns:"Columns",rows:"Rows",grid:"Grid"},add:{columns:"Add column guide",rows:"Add row guide",grid:"Add grid guide"},empty:"Add up to 6 column, row or grid guides. They show only on the canvas and never go into the screen HTML. Hide all: ⌃G",color:"Guide color",show:"Show",hide:"Hide",deleteGuide:"Delete guide",delete:"Delete",cell:"Cell",count:"Count",gutter:"Gutter",margin:"Margin",cellSize:"Cell size",align:"Align",alignAria:"Guide alignment",stretch:"Stretch",left:"Left",top:"Top",center:"Center",right:"Right",bottom:"Bottom"},dialog:{renameGroupTitle:"Rename group",menu:"Menu",cancel:"Cancel",ok:"OK",deleteBoardsTitle:(l,c)=>l>1?`Delete ${l} boards?`:`Delete board "${c}"?`,deleteBoardsBody:"The HTML files are deleted too. A copy stays in the trash (docs/design/.trash), and Undo (⌘Z) brings them back right away.",delete:"Delete",renameBoardTitle:"Rename board",name:"Name",rename:"Rename",renameFileTitle:"Rename file",fileName:"File name",renameFileRefs:l=>`Links or iframes pointing to this file: ${l}`,renameFileNoRefs:"No links or iframes point to this file.",renameFileExtra:l=>`Also update ${Bn(l,"reference","references")} to the new name`,newPageTitle:"New page",newPageName:l=>`Page ${l}`,create:"Create",renamePageTitle:"Rename page",deletePageTitle:l=>`Delete page "${l}"?`,deletePageBody:l=>`Its ${Bn(l,"board","boards")} and notes aren't deleted; they move to the first page. You can undo with ⌘Z.`,authorTitle:"Comment author",save:"Save",snapshotTitle:"Save snapshot",snapshotLabel:"Message",snapshotMessage:l=>`docs(design): design snapshot ${l}`,snapshotHint:"Commits only the design folder. The author comes from your git config, and nothing else you staged is included.",commit:"Commit"},toast:{saveFailed:l=>`Save failed: ${l}`,undoRedoDone:(l,c)=>`${l==="undo"?"Undo":"Redo"}: ${c}`,nothingToUndo:"Nothing to undo",nothingToRedo:"Nothing to redo",undoAction:"Undo",textOnly:"Only elements that contain just text (and line breaks) can be edited in place",moved:"Moved",movedFrozen:"Moved (kept the size of the original spot)",copiedElement:(l,c)=>`Copied <${l}> — paste it into another board while editing with ${c}V`,nothingCopied:"No element copied. Select an element while editing and press ⌘C",pasted:(l,c)=>`Pasted <${c}> from ${l}`,imageReplaced:l=>`Replaced the image with ${l}`,boardCreated:l=>`Created board ${l}`,boardCreateFailed:l=>`Couldn't create the board: ${l}`,boardsDeleted:l=>`Deleted ${Bn(l,"board","boards")}`,duplicated:l=>`Duplicated as ${l}`,renamed:"Renamed",fileRenamed:(l,c)=>`Renamed to ${l}${c?" (references updated)":""}`,notesMax:l=>`You can have up to ${l} notes`,noteDeleted:"Note deleted",shapeDeleted:"Shape deleted",shapesDeleted:l=>`Deleted ${Bn(l,"shape","shapes")}`,imageReadFailed:"Couldn't read the image",importOnly:l=>`${l}: only HTML or images can be imported`,imported:l=>`Imported ${Bn(l,"board","boards")}`,pagesMax:"You can have up to 40 pages",pageDeleted:"Page deleted",copied:"Copied",elementDeleted:"Element deleted",wrapped:l=>`Wrapped in ${l}`,theme:l=>`Theme: ${l}`,tokensSaved:"Tokens saved",nothingChanged:"Nothing changed",snapshot:l=>`Snapshot ${l}`,cleanedUp:l=>`Cleaned up ${Bn(l,"board","boards")}`,uploaded:l=>`Uploaded ${l}`,tweaksSaved:"Saved tweaks to source",blockFlow:"Vertical alignment doesn't apply in block flow. Try changing the parent to flex"},history:{renameGroup:"Rename group",pageFromGroup:"Page from group",boardOptions:"Board options",front:"Bring to front",back:"Send to back",moveBoard:"Move board",resizeBoard:"Resize board",addTitle:"Add title",addNote:"Add note",deleteNote:"Delete note",duplicateNote:"Duplicate note",moveNote:"Move note",editNote:"Edit note",noteStyle:"Note style",addShape:"Add shape",deleteShape:"Delete shape",moveShape:"Move shape",resizeShape:"Resize shape",shapeStyle:"Shape style",shapeFront:"Bring shape to front",shapeBack:"Send shape to back",addImage:"Add image",launchPage:"Launch page",moveToPage:"Move to page",launchScreen:"Set launch screen",changeTheme:"Change theme",cleanMissing:"Clean up boards with missing files",editGuide:"Edit layout guide",addGuide:"Add layout guide",deleteGuide:"Delete layout guide",saveTokens:"Save tokens",registerTokens:"Register tokens"},defaults:{newTitle:"New title",note:"Note",pastedImage:"pasted-image.png"},menu:{newBoard:"New board",renameGroup:"Rename group…",pageFromGroup:"Make a page from this group",drawWithB:"B to draw",rename:"Rename",moveUp:"Move up",moveDown:"Move down",unsetLaunchPage:"Unset launch page",setLaunchPage:"Set as launch page",moveSelectedToPage:l=>`Move ${Bn(l,"selected board","selected boards")} to this page`,delete:"Delete",selectInside:"Select inside",playInPlace:"Play in place",stopPlay:"Stop Play",playFullScreen:"Play full screen",askReview:"Ask AI for a review",focusView:"Focus view",askAI:"Ask AI",askFixErrors:"Ask AI to fix errors",goToBoard:"Go to board",renameFile:"Rename file…",duplicate:"Duplicate",front:"Bring to front",back:"Send to back",deleteBoards:l=>`Delete ${l} boards`,title:"Title",note:"Note",duplicateInFront:"Duplicate in front",newBoardHere:"New board here",mobileFrameHere:"Mobile screen frame here",titleHere:"Title here",noteHere:"Note here",selectAll:"Select all on this page",fitAll:"Fit all",zoom100:"Zoom to 100%",undo:"Undo",redo:"Redo",element:"Element",editText:"Edit text",selectParent:"Select parent",elementToAI:"Send this element to AI",copy:"Copy",pasteAfter:"Paste after",replaceImage:"Replace image…",copyForAI:"Copy description for AI",shape:"Shape",snapshot:"Snapshot",notGit:"The design folder isn't inside a git repository",snapshotStatus:(l,c)=>`Snapshot · ${l} · ${Bn(c,"changed file","changed files")}`,snapshotNow:"Save snapshot now (git commit)…",nothingChanged:"Nothing changed",fileMissing:"File is missing",askFixAll:"Ask AI to fix all",cleanMissing:l=>`Clean up ${Bn(l,"board","boards")} with missing files`},prompts:{fixErrors:l=>`Fix these errors:
50
- ${l}`,error:"Error",review:"Review this screen: point out accessibility (48px touch targets, 4.5 contrast, labels), information hierarchy, and token violations (get_tokens, check_tokens), with fixes in priority order. Don't edit anything; only suggest.",fixComment:"Fix only that spot, as this comment says",fixTokens:l=>`Replace off-token values with tokens (verify with check_tokens):
51
- ${l}`,fixA11y:l=>`Fix the accessibility issues (keep the visible size; enlarge touch targets with padding):
52
- ${l}`,line:"Line "},checks:{tokenCheck:l=>`Token check · ${l}`,noOffToken:"No off-token values",off:"off",tokensOffTitle:"No tokens registered — checks are off",tokensOffBody:"Colours and sizes are not checked, and the AI is not given a default palette.",setUpTokens:"Set up tokens",a11y:"Accessibility",a11yOk:"No touch target, contrast or label issues",askFix:"Ask AI to fix",notVisible:"Checks run when the board is visible on screen.",pickInEdit:l=>`Select ${l} on the board`,line:l=>`Line ${l}`,more:l=>`+${l} more`,colorNotInTokens:"Color not in tokens",tokenFontSizes:l=>`Token font sizes: ${l}`,tokenRadii:l=>`Token radius: ${l}`,notMultipleOf4:"Not a multiple of 4",tokenWeights:l=>`Token weights: ${l}`,smallTarget:(l,c,u,f)=>`<${l}> touch target ${c}×${u} (under ${f})`,noName:l=>`<${l}> has no name (aria-label, text or label)`,noAlt:'<img> has no alt (use alt="" if decorative)',lowContrast:(l,c,u)=>`Contrast ${l}:1 (needs ${c}) "${u}"`},tokens:{import:"Import tokens (tokens.json or Figma variables JSON)",importFailed:l=>`Couldn't import: ${l}`,theme:"Theme",addTheme:"Add theme (copy current theme)",newTheme:"New theme",newThemeN:l=>`New theme ${l}`,activeTheme:"Active theme",themeName:"Theme name",importedTheme:"Imported",colors:l=>`Colors ${l}`,addColor:"Add color",colorN:l=>`Color ${l}`,colorOf:l=>`${l} color`,colorName:"Color name",remove:l=>`Remove ${l}`,fontSizes:"Font sizes",fontWeights:"Font weights",radii:"Radius",spacing:"Spacing",touchTarget:"Touch target",minTouchTarget:"Minimum touch target",saveTitle:"Save to docs/design/tokens.json",save:"Save",register:"Register tokens",registeredHint:"Properties panel swatches, token check and AI (get_tokens) use the selected theme's values.",defaultHint:"Starter values, not in use yet. Registering saves them to tokens.json and turns on the token check and the AI palette.",noColors:"Couldn't find any color values"},tweaks:{revert:"Revert",save:"Save to source",hint:"Applied right away as CSS variables. Saving changes only the values in the board-tweaks JSON."},inspector:{shotFailed:l=>`Failed: ${l}`,kindName:l=>({text:"Text",button:"Button",link:"Link",image:"Image",input:"Input",icon:"Icon",container:"Container"})[l]??l,crumbs:"Selection path",crumbBoard:"Select the board",crumbParent:l=>`Select ${l}`,crumbElement:(l,c)=>`<${l}> ${c}`,more:l=>`+${l} more`,copy:"Copy",copied:"Copied",capturing:"Capturing…",screenshot:"Screenshot",boardScreenshot:"Board screenshot",boardScreenshotTitle:"Save a PNG of this board next to the design folder",screenshotTitle:"Save a PNG of this element",actions:"Element actions",boardActions:"Board actions"},comments:{title:"Comments",placeholderElement:l=>`Comment on the selected element (${l})`,placeholderBoard:"Comment on the board",add:"Comment",authorTitle:"Change comment author name",author:l=>`Author: ${l}`,replyPlaceholder:l=>`Reply as ${l} (⌘Enter)`,reply:"Reply",replyResolve:"Reply and resolve",reopen:"Reopen",resolve:"Resolve",sendToAI:"Send to AI",sendToAITitle:"Send to AI to fix only where this comment points"},assets:{uploading:"Uploading…",upload:"Upload (images and fonts; drag and drop works too)",loading:"Loading…",empty:"No assets yet. Uploaded images are saved to docs/design/assets/ and used in screens as ../assets/name.",copyPath:" · click to copy path",file:"File",pickImage:"Choose image",pickLabel:", use this image",close:"Close"},chat:{aria:"AI chat",agent:"Agent",agentHint:"Which agent edits the files",agentButton:(l,c)=>c?`Agent: ${l} — ${c}`:`Agent: ${l}`,agentStatus:{ready:"ready",signin:"sign-in needed",missing:"not installed",unknown:"couldn't check"},checking:"Checking…",checkedOnOpen:"Checked when the AI tab opened",checkAgain:"Check again",model:"Model",modelDefault:"Default (from CLI config)",modelTitle:l=>`Model for ${l}: an alias or a full model id. Leave empty for the CLI's own default.`,continuing:"Continuing conversation",newConversation:"New conversation",newChat:"New chat",intro:l=>`Sends the selected boards and elements, plus the boards visible on screen, to ${l} as context. The agent edits the source HTML directly, and the canvas redraws right away.`,suggestions:[{label:"AI review: accessibility, contrast, hierarchy",text:"Review the selected screen: accessibility (48px touch targets, 4.5 contrast, labels), information hierarchy, and token violations (get_tokens, check_tokens). Only suggest changes in priority order; don't edit anything.",n:1},{label:"3 variants of this screen",text:"Make 3 variants of the selected screen in different directions (each with a different layout, hierarchy and emphasis).",n:3},{label:"Shorten the selected button text",text:"Shorten the selected button text",n:1},{label:"Make a new empty-state screen",text:"Make a new empty-state screen",n:1}],remedySignin:(l,c)=>`${l} is not signed in. Run \`${c}\` in a terminal.`,remedyMissing:l=>`\`${l}\` command not found. Install it, then Check again.`,copyCommand:"Copy command",copy:"Copy",copied:"Copied",sendNeedsSignin:l=>`Sign in to ${l} to send`,sendNeedsInstall:l=>`Install ${l} to send`,running:"Running",cancelled:"Cancelled",failed:"Failed",retry:"Retry",switchTo:l=>`Switch to ${l}`,details:"Details",noFilesChanged:"No files were changed.",restored:"Restored from the failed message",madeVariants:l=>`Made ${kf(l)} side by side · View`,thinking:"Thinking…",chipElement:l=>`Element <${l}>`,chipElementText:(l,c)=>`Element <${l}> ${c}`,chipBoards:l=>`${l} boards`,chipVisible:l=>`Visible boards ${l}`,chipComment:l=>`Comment "${l}"`,variants:kf,tooBig:l=>`${l}: larger than 15MB`,refLink:"Reference link",placeholderRunning:"Running… (Esc to cancel)",placeholder:"What should change? (Enter to send · Shift+Enter for a new line)",input:"Message to AI",attach:"Attach file or image",attachTitle:"Attach file or image (drag and drop or paste works too)",addLink:"Add reference link",variantsTitle:"Copies the selected board and makes different variants side by side",variantsDisabledTitle:"Select one board to use this",variantsAria:"Number of variants",cancel:"Cancel",cancelTitle:"Cancel (Esc)",send:"Send",chipRemoveTitle:"Click to remove",chipAddTitle:"Click to attach",remove:l=>`Remove ${l}`,howToInstall:"How to install",customCommand:"Custom command…",checkedAt:(l,c)=>c?`Checked when the AI tab opened · ${l}`:`Checked again at ${l}`,customTitle:"Custom command",customName:"Name",customCommandLabel:"Command",customNamePlaceholder:"Aider",customCommandPlaceholder:"aider --message {prompt} --yes",customHint:"`{prompt}` is replaced with your request and the canvas context. Output is shown as plain text.",customSave:"Save",customCommandTitle:l=>`Runs without a shell: ${l}`,waiting:"Waiting for you",waitingHint:"answer the request above",permAsk:(l,c,u)=>c==="command"?`${l} asks to run a command`:c==="edit"?`${l} asks to ${u==="Write"?"write":"edit"} a file`:c==="fetch"?`${l} asks to fetch a page`:`${l} asks to use ${u}`,permIn:"in",permOutside:"outside the design folder",allowOnce:"Allow once",alwaysAllow:l=>`Always allow ${l}`,alwaysAllowTitle:"Until Easel restarts, for this canvas only",deny:"Deny",permDone:{once:"Allowed",always:"Always allowed",deny:"Denied"},permDoneOutside:"(outside the design folder)",noPause:{codex:"Codex exec cannot pause to ask; it follows its sandbox setting.",cursor:"Cursor Agent cannot pause to ask here; it runs with --force.",gemini:"Gemini CLI cannot pause to ask here; it accepts edits on its own."},runChanged:(l,c)=>l&&c?`Changed ${l} board${l===1?"":"s"} · added ${c}`:c?`Added ${c} board${c===1?"":"s"}`:l?`Changed ${l} board${l===1?"":"s"}`:"Changed the canvas",chipNew:l=>`${l} (new)`,chipRemoved:l=>`${l} (removed)`,undoRun:"Undo this run",compare:"Compare",redo:"Redo",runUndone:l=>`Run undone · ${l} board${l===1?"":"s"} restored`,conflictUndo:l=>`Changed since this run: ${l}. Undo the rest and keep those, or undo all and overwrite them?`,conflictRedo:l=>`Changed since the undo: ${l}. Redo the rest and keep those, or redo all and overwrite them?`,undoRest:"Undo the rest",undoAll:"Undo all anyway",redoRest:"Redo the rest",redoAll:"Redo all anyway",restoreCopy:"Restore the copy from before this run",savedAt:l=>`Saved ${l}`,copyGone:"The copy from before this run is gone (only the newest 10 are kept).",restoredCopy:"Canvas restored to the copy from before this run",restoreTitle:"Restore the copy from before this run?",restoreBody:l=>`This puts the whole canvas back to ${l}, before this run: every screen and board.json, including anything changed since by you or by other runs. Undo takes the restore back.`,restoreOk:"Restore",restarted:l=>`Easel restarted · ${l}`},compare:{title:l=>`Compare · ${l}`,boards:"Boards",before:"Before",after:"After",notBefore:"This board did not exist before the run.",notAfter:"This run removed the board.",notBeforeChange:"This board did not exist before this change.",close:"Close"},activity:{outside:"Outside Easel",ago:l=>{const c=Math.floor(Math.max(0,l)/6e4);return c<1?"now":c<60?`${c}m`:c<1440?`${Math.floor(c/60)}h`:`${Math.floor(c/1440)}d`},agoLong:l=>{const c=Math.floor(Math.max(0,l)/6e4);return c<1?"just now":c<60?`${c} min ago`:c<1440?`${Math.floor(c/60)} h ago`:`${Math.floor(c/1440)} d ago`},tag:(l,c,u,f)=>`${l} · ${c} · ${f&&u===1?"new board":Bn(u,"change","changes")}`,tagTitle:l=>`${l} — click for the change, Before / After and Undo`,tagsAria:l=>`${Bn(l,"change","changes")} by others`,popAria:l=>`Change by ${l}`,element:Rp,change:l=>{const c=Rp(l.tag,l.cls);switch(l.kind){case"style":return`Style changed on ${c}`;case"attr":return`${c} attributes changed`;case"edited":return`${c} changed`;case"added":return l.count>1?`${l.count} elements added`:`${c} added`;case"removed":return l.count>1?`${l.count} elements removed`:`${c} removed`;case"replaced":return`${c} replaced`;case"many":return`${l.count}${l.more?"+":""} elements changed`;case"page":return"Page styles or title changed";case"source":return"Only spacing or comments in the source changed";case"new":return"New board";case"deleted":return"Board deleted";case"moved":return"Board moved";case"resized":return"Board resized";case"renamed":return"Board renamed";case"options":return"Board options changed";default:return"Changed"}},changes:l=>`${Bn(l,"change","changes")} on this board`,quote:l=>`“${l}”`,arrow:"→",beforeAfter:"Before / After",undo:"Undo",undoTitle:l=>l===1?"Undo this change":`Undo these ${l} changes`,conflict:l=>`Changed since: ${l}. Undo the rest and keep those, or undo all and overwrite them?`,undoRest:"Undo the rest",undoAll:"Undo all anyway",cancel:"Cancel",close:"Close",historyButton:"History",historyTitle:"History · newest first",historyEmpty:"Nothing yet. Changes made in this session show up here.",historyFoot:"History is kept for this session.",now:"Now",goBack:"Go back to here",goBackAria:(l,c,u)=>`${l} by ${c}, ${u} · Go back to here`,nowAria:(l,c,u)=>`${l} by ${c}, ${u} · current`,undoneAria:(l,c,u)=>`${l} by ${c}, ${u} · undone`,wentBack:l=>`Back to: ${l}`},occupancy:{editing:l=>`${l} is editing…`,you:"You · editing",personEditing:l=>`${l} · editing`,done:(l,c)=>`${l} · done ${c}`,someone:"Someone",clock:l=>new Date(l).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),tagsAria:"Who is on this board",listDot:l=>`${l} is editing`,youListDot:"You are editing",forked:(l,c,u)=>`Forked ${l} — ${c} started while ${u} was editing`,useThis:"Use this",useThisOne:"Use this one",useThisTitle:"Make this variant the original board; the other variants go to trash",useThisOneTitle:"Keep this version as the board; the other version goes to trash",waitFor:l=>`Wait until ${l} is done editing`,confirmVariant:(l,c)=>`Apply "${l}" to ${c}?`,confirmVariantBody:(l,c)=>`${l} is replaced.${c?` The other ${c===1?"variant goes":`${c} variants go`} to trash.`:""}`,confirmFork:(l,c)=>`Use "${l}" for ${c}?`,confirmForkBody:l=>`${l} is replaced by this version. The fork goes to trash.`,confirmKeep:l=>`Keep "${l}"?`,confirmKeepBody:(l,c)=>`${l} ${c===1?"goes":"go"} to trash.`,apply:"Apply",keepAll:"Keep all",keepBoth:"Keep both",applied:(l,c)=>`Applied ${l} to ${c}`,kept:l=>`Kept ${l}; the other version is in trash`,keptAll:(l,c)=>l==="variant"?`Kept all ${kf(c)} as boards`:c===1?"Kept both versions as boards":`Kept all ${c+1} versions as boards`,undo:"Undo"},update:{out:l=>`Easel ${l} is out`,copy:"Copy command",copied:"Copied. Run it, then restart Easel",hide:"Hide until the next version"}},Ob=1440*60*1e3,zf=l=>`design-canvas:seen:${l}`,lu=l=>l.by?"comment":l.person||!l.outside?"person":"file",Pf=(l,c)=>l.by??l.person??(l.outside?r.activity.outside:c);function Db(l){const[c,u]=j.useState(null),[f,h]=j.useState(()=>Date.now()),[p,v]=j.useState({}),C=j.useRef(null),N=j.useCallback(()=>{C.current&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{Te.get(`/api/activity?client=${encodeURIComponent(nu)}`).then(u).catch(()=>{})},120)},[]);j.useEffect(()=>{N();const M=window.setInterval(()=>h(Date.now()),3e4);return()=>window.clearInterval(M)},[N]),j.useEffect(()=>{if(!(!l||!c))try{const M=JSON.parse(localStorage.getItem(zf(l))??"{}"),D=Object.fromEntries(Object.entries(M).filter(([q])=>q.startsWith(`${c.boot}:`)));v(D),Object.keys(D).length!==Object.keys(M).length&&localStorage.setItem(zf(l),JSON.stringify(D))}catch{}},[l,c==null?void 0:c.boot]);const S=j.useCallback(M=>{!c||!M.length||v(D=>{const q=M.filter(T=>!D[`${c.boot}:${T}`]);if(!q.length)return D;const K={...D,...Object.fromEntries(q.map(T=>[`${c.boot}:${T}`,Date.now()]))};try{l&&localStorage.setItem(zf(l),JSON.stringify(K))}catch{}return K})},[c,l]),y=j.useCallback(M=>{if(!c)return"fresh";const D=M.steps.map(q=>p[`${c.boot}:${q}`]);return D.some(q=>!q)?"fresh":f-Math.max(...D)>Ob?"gone":"seen"},[c,p,f]),b=j.useCallback(M=>((c==null?void 0:c.tags[M])??[]).filter(D=>y(D)!=="gone"),[c,y]);return{data:c,now:f,reload:N,markSeen:S,stateOf:y,tagsOf:b}}function Rb({file:l,act:c,me:u,onOpen:f,lead:h}){const p=c.tagsOf(l);return!p.length&&!h?null:s.jsxs("span",{className:"act-tags",role:"group","aria-label":p.length?r.activity.tagsAria(p.reduce((v,C)=>v+C.count,0)):r.occupancy.tagsAria,children:[h,p.map(v=>{const C=r.activity.tag(Pf(v,u),r.activity.ago(c.now-v.at),v.count,v.newBoard);return s.jsxs("button",{className:`act-tag ${c.stateOf(v)==="seen"?"seen":""}`,"data-tag":`${l}|${v.key}`,title:r.activity.tagTitle(C),"aria-haspopup":"dialog",onPointerDown:N=>N.stopPropagation(),onDoubleClick:N=>N.stopPropagation(),onClick:N=>{N.stopPropagation(),f(l,v.key)},children:[s.jsx(P,{name:lu(v),size:16}),s.jsx("span",{className:"act-tag-text",children:C})]},v.key)})]})}function _b({tag:l}){const c=l.change;return l.count>1?s.jsx("div",{className:"callout-diff",children:r.activity.changes(l.count)}):(c==null?void 0:c.kind)==="text"?s.jsxs("div",{className:"callout-diff",children:[s.jsx("span",{className:"diff-old",children:r.activity.quote(c.from??"")})," ",r.activity.arrow," ",s.jsx("span",{className:"diff-new",children:r.activity.quote(c.to??"")})]}):s.jsx("div",{className:"callout-diff",children:c?r.activity.change(c):r.activity.change({kind:"",count:1})})}function Bb(l){const c=j.useRef(null),[u,f]=j.useState(null),h=()=>document.querySelector(`[data-tag="${CSS.escape(`${l.file}|${l.tag.key}`)}"]`);j.useLayoutEffect(()=>{var M,D;const v=h();if(!v)return void l.onClose();const C=v.getBoundingClientRect(),N=((M=c.current)==null?void 0:M.offsetWidth)??280,S=((D=c.current)==null?void 0:D.offsetHeight)??140,y=Math.max(8,Math.min(C.left,window.innerWidth-N-8)),b=C.bottom+8+S>window.innerHeight-8?Math.max(8,C.top-S-8):C.bottom+8;(!u||Math.abs(u.x-y)>.5||Math.abs(u.y-b)>.5)&&f({x:y,y:b})}),j.useEffect(()=>{var C,N;(N=(C=c.current)==null?void 0:C.querySelector("button"))==null||N.focus();const v=S=>{var b,M;const y=S.target;(b=c.current)!=null&&b.contains(y)||(M=h())!=null&&M.contains(y)||y instanceof Element&&y.closest(".dialog-backdrop")||l.onClose()};return window.addEventListener("pointerdown",v,!0),()=>window.removeEventListener("pointerdown",v,!0)},[l.file,l.tag.key]);const p=Pf(l.tag,l.me);return s.jsxs("div",{ref:c,className:"callout",role:"dialog","aria-label":r.activity.popAria(p),style:{left:(u==null?void 0:u.x)??-9999,top:(u==null?void 0:u.y)??-9999},onKeyDown:v=>{var C;v.key==="Escape"&&(v.stopPropagation(),l.onClose(),(C=h())==null||C.focus())},children:[s.jsxs("div",{className:"callout-top",children:[s.jsx(P,{name:lu(l.tag),size:16}),p," ",s.jsxs("span",{className:"muted",children:["· ",r.activity.agoLong(l.now-l.tag.at)]}),s.jsx("button",{className:"icon-btn sm callout-x","aria-label":r.activity.close,title:r.activity.close,onClick:l.onClose,children:s.jsx(P,{name:"close",size:14})})]}),s.jsx(_b,{tag:l.tag}),s.jsxs("div",{className:"callout-actions",children:[s.jsxs("button",{onClick:l.onCompare,children:[s.jsx(P,{name:"compare",size:14})," ",r.activity.beforeAfter]}),s.jsxs("button",{disabled:l.busy,title:r.activity.undoTitle(l.tag.steps.length),onClick:()=>l.onUndo(),children:[s.jsx(P,{name:"undo",size:14})," ",r.activity.undo]})]}),l.conflict&&s.jsxs("div",{className:"rr-conflict",role:"alert",children:[s.jsx("p",{children:r.activity.conflict(l.conflict.join(", "))}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{onClick:()=>l.onUndo("rest"),children:r.activity.undoRest}),s.jsx("button",{className:"danger",onClick:()=>l.onUndo("all"),children:r.activity.undoAll}),s.jsx("button",{onClick:l.onCancelConflict,children:r.activity.cancel})]})]})]})}function Ub({frame:l,paths:c,zoom:u}){const[f,h]=j.useState([]),p=c.join(",");j.useEffect(()=>{if(!l)return h([]);const C=()=>{const S=l.isConnected?l.contentDocument:null;if(!(S!=null&&S.body))return h([]);h(c.map(y=>Cn(S,y)).filter(y=>!!y&&y!==S.body).map(ia))};C();const N=window.setTimeout(C,300);return l.addEventListener("load",C),l.addEventListener("dc-reloaded",C),()=>{window.clearTimeout(N),l.removeEventListener("load",C),l.removeEventListener("dc-reloaded",C)}},[l,p]);const v=1/Math.max(u,.05);return s.jsx(s.Fragment,{children:f.map((C,N)=>s.jsx("div",{className:"box change-outline",style:{left:C.x,top:C.y,width:C.w,height:C.h,"--px":`${v}px`}},N))})}function Hb(l){var S;const c=j.useRef(null),u=Math.max(0,l.steps.findIndex(y=>y.now)),[f,h]=j.useState(u),p=j.useRef([]),v=(S=l.steps[u])==null?void 0:S.id;j.useEffect(()=>{var y;(y=p.current[u])==null||y.focus(),h(u)},[v]),j.useEffect(()=>{const y=b=>{var D;const M=b.target;(D=c.current)!=null&&D.contains(M)||M instanceof Element&&M.closest(".caret-btn")||l.onClose()};return window.addEventListener("pointerdown",y,!0),()=>window.removeEventListener("pointerdown",y,!0)},[l.onClose]);const C=y=>{var M;const b=Math.max(0,Math.min(l.steps.length-1,y));h(b),(M=p.current[b])==null||M.focus()},N=j.useMemo(()=>{var D;const y=((D=document.querySelector(".oc-dock"))==null?void 0:D.getBoundingClientRect())??l.anchor,b=Math.min(448,window.innerWidth-16);if(!y)return{left:8,bottom:76,width:b};const M=Math.round(window.innerHeight-y.top+8);return{left:Math.round(Math.max(8,Math.min(y.right-b,window.innerWidth-b-8))),bottom:M,width:b,maxHeight:Math.round(window.innerHeight-M-8)}},[l.anchor]);return s.jsxs("div",{ref:c,className:"menu oc-hist entering",role:"menu","aria-label":r.activity.historyTitle,style:N,onKeyDown:y=>{var b;["Escape","ArrowDown","ArrowUp","Home","End","Enter"," "].includes(y.key)&&y.stopPropagation(),y.key==="Escape"?(y.preventDefault(),l.onClose(),(b=document.querySelector(".caret-btn"))==null||b.focus()):y.key==="ArrowDown"||y.key==="ArrowUp"?(y.preventDefault(),C(f+(y.key==="ArrowDown"?1:-1))):(y.key==="Home"||y.key==="End")&&(y.preventDefault(),C(y.key==="Home"?0:l.steps.length-1))},children:[s.jsx("div",{className:"oc-menu-h",children:r.activity.historyTitle}),!l.steps.length&&s.jsx("p",{className:"hist-empty",children:r.activity.historyEmpty}),s.jsx("div",{className:"hist-rows",children:l.steps.map((y,b)=>{const M=Pf(y,l.me),D=r.activity.ago(l.now-y.at);return s.jsxs("button",{ref:q=>void(p.current[b]=q),role:"menuitem",className:`menu-item oc-hrow ${y.now?"now":""} ${y.undone?"past":""} ${f===b?"active":""}`,"aria-label":(y.now?r.activity.nowAria:y.undone?r.activity.undoneAria:r.activity.goBackAria)(y.name,M,D),"aria-current":y.now?"step":void 0,title:y.label,"aria-disabled":l.busy||void 0,onMouseEnter:()=>h(b),onFocus:()=>h(b),onClick:()=>!y.now&&!l.busy&&l.onGo(y),children:[s.jsx("span",{className:"oc-now-dot","aria-hidden":"true"}),s.jsxs("span",{className:"oc-who",children:[s.jsx(P,{name:lu(y),size:16}),s.jsx("span",{children:M})]}),s.jsx("span",{className:"oc-what",children:y.name}),y.now?s.jsx("span",{className:"oc-mark",children:r.activity.now}):f===b?s.jsx("span",{className:"oc-mark go",children:r.activity.goBack}):s.jsx("span",{}),s.jsx("span",{className:"oc-when",children:D})]},y.id)})}),s.jsx("div",{className:"menu-foot",children:s.jsx("span",{children:r.activity.historyFoot})})]})}const Lb=3,_p=(l,c,u=Lb)=>Math.abs(l)+Math.abs(c)>=u;function $b(l,c,u=8){const f=(c.full??c.w)>l-u*2;return{x:Math.max(u,Math.round((l-c.w)/2)),icons:f}}function Yb(l,c=2){const u=l.split("/"),f=u.slice(1).map((h,p)=>u.slice(0,p+1).join("/"));return{paths:f.slice(-c),skipped:f.length>c}}function _l(l){const c=(l??"").trim(),u=c.match(/^(-?\d+(?:\.\d+)?)px$/);return u?String(Number(u[1])):c}const qf=l=>(l??"").trim().split(/\s+/).filter(Boolean).map(_l).join(" · ");function Gb(l){return l.replace(/·/g," ").trim().split(/\s+/).filter(Boolean).map(u=>/^-?\d+(?:\.\d+)?$/.test(u)?`${Number(u)}px`:u).join(" ")}function Xf(l,c){const u=Number(l);return!l||!Number.isFinite(u)?String(l??""):c[u]?`${c[u]} · ${u}`:String(u)}const qb=/^(system-ui|-apple-system|blinkmacsystemfont|ui-sans-serif)$/i;function Bp(l){var u;const c=((u=(l??"").split(",")[0])==null?void 0:u.trim().replace(/^["']|["']$/g,""))??"";return qb.test(c)?"System UI":c}function Xb(l){const c=l.trim();return/^system ui$/i.test(c)?"system-ui":c.includes(",")||/^["'].*["']$/.test(c)||!/\s/.test(c)?c:`"${c}"`}function vn(l){const c=(l??"").trim().toLowerCase();let u=c.match(/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/);if(u){let f=u[1];return f.length<=4&&(f=[...f].map(h=>h+h).join("")),f.length===8&&f.slice(6)!=="ff"?null:"#"+f.slice(0,6).toUpperCase()}return u=c.match(/^rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)(?:[ ,/]+([\d.]+%?))?\s*\)$/),u?u[4]!=null&&parseFloat(u[4])<(u[4].endsWith("%")?100:1)?null:"#"+[u[1],u[2],u[3]].map(f=>Math.round(Number(f)).toString(16).padStart(2,"0")).join("").toUpperCase():null}const uy=l=>l.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"token";function fc(l,c){var p;const u=(l??"").trim(),f=u.match(/^var\(\s*--([a-z0-9-]+)/i);if(f){const v=c.find(N=>uy(N.name)===f[1].toLowerCase());if(v)return v;const C=(p=u.match(/,\s*([^)]+)\)\s*$/))==null?void 0:p[1];return C?fc(C,c):null}const h=vn(u);return h?c.find(v=>vn(v.value)===h)??null:null}function Vb(l,c){const u=uy(l.name);if(c[`--${u}`]!=null)return`var(--${u})`;const f=vn(l.value),h=Object.keys(c).find(p=>f&&vn(c[p])===f);return h?`var(${h})`:`var(--${u}, ${f??l.value})`}const Kb=(l,c)=>l==="text"&&vn(c)==null?"color":"background";function Ir(l,c,u=1,f=0){const h=parseFloat(l),p=Number.isFinite(h)?h:0;return Math.max(f,Math.round((p+c*u)*100)/100)}function Zb(l,c,u=4){return(l||"0px").trim().split(/\s+/).map(h=>`${Ir(h,c,u)}px`).join(" ")}const Vf=[{id:"yellow",label:r.shapes.stickyColors.yellow,bg:"#FFF1A8"},{id:"orange",label:r.shapes.stickyColors.orange,bg:"#FFD9BC"},{id:"pink",label:r.shapes.stickyColors.pink,bg:"#FFD6E2"},{id:"purple",label:r.shapes.stickyColors.purple,bg:"#E5DAFF"},{id:"blue",label:r.shapes.stickyColors.blue,bg:"#D2E4FF"},{id:"green",label:r.shapes.stickyColors.green,bg:"#D5F0D3"},{id:"gray",label:r.shapes.stickyColors.gray,bg:"#ECEBE7"},{id:"white",label:r.shapes.stickyColors.white,bg:"#FFFFFF"}],Qb=l=>{var c;return((c=Vf.find(u=>u.id===l))==null?void 0:c.bg)??Vf[0].bg},Up=200,Hp=6,Jb=["#111111","#6B6B6B","#C94F0C","#B42318","#1E7A4C","#2F6FDE","#FFFFFF","none"];function dy({s:l,id:c}){var S;const u=l.strokeWidth??4,f=l.stroke??"#111111",h=l.fill??"none",p=u,v=Math.max(1,l.w),C=Math.max(1,l.h),N=(l.points??[]).map(([y,b])=>`${y},${b}`).join(" ");return s.jsxs("svg",{width:v+p*2,height:C+p*2,viewBox:`${-p} ${-p} ${v+p*2} ${C+p*2}`,style:{position:"absolute",left:-p,top:-p,overflow:"visible"},children:[l.kind==="arrow"&&s.jsx("defs",{children:s.jsx("marker",{id:`ah-${c}`,viewBox:"0 0 10 10",refX:"8",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto-start-reverse",children:s.jsx("path",{d:"M0 0L10 5L0 10z",fill:f})})}),l.kind==="rect"&&s.jsx("rect",{x:0,y:0,width:v,height:C,rx:8,fill:h,stroke:f,strokeWidth:u}),l.kind==="oval"&&s.jsx("ellipse",{cx:v/2,cy:C/2,rx:v/2,ry:C/2,fill:h,stroke:f,strokeWidth:u}),(l.kind==="line"||l.kind==="arrow")&&s.jsx("polyline",{points:N,fill:"none",stroke:f,strokeWidth:u,strokeLinecap:"round",markerEnd:l.kind==="arrow"?`url(#ah-${c})`:void 0}),l.kind==="pen"&&s.jsx("polyline",{points:N,fill:"none",stroke:f,strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round"}),l.kind==="image"&&s.jsx("image",{href:(S=l.src)==null?void 0:S.replace(/^\.\.\//,"/"),x:0,y:0,width:v,height:C,preserveAspectRatio:"xMidYMid slice"})]})}function Fb(l){const c=j.useRef(null),u=(h,p)=>v=>{v.button!==0||!l.interactive||(v.stopPropagation(),l.onSelect(h,v.shiftKey),!v.shiftKey&&(c.current={id:h,mode:p,sx:v.clientX,sy:v.clientY,o:l.shapes[h],moved:!1},v.currentTarget.setPointerCapture(v.pointerId)))},f=(h,p=!1)=>{const v=c.current;if(!v)return;const C=(h.clientX-v.sx)/l.zoom,N=(h.clientY-v.sy)/l.zoom;if(!v.moved&&Math.abs(C)+Math.abs(N)<2/l.zoom){p&&(c.current=null);return}if(v.moved=!0,v.mode==="move")l.onChange(v.id,{x:Math.round(v.o.x+C),y:Math.round(v.o.y+N)},p);else{const S=Math.max(8,v.o.w+C),y=Math.max(8,v.o.h+N),b=S/Math.max(1,v.o.w),M=y/Math.max(1,v.o.h),D={w:Math.round(S),h:Math.round(y)};v.o.points&&(D.points=v.o.points.map(([q,K])=>[Math.round(q*b),Math.round(K*M)])),l.onChange(v.id,D,p)}p&&(c.current=null)};return s.jsx(s.Fragment,{children:l.ids.map(h=>{const p=l.shapes[h],v=l.selected.includes(h);return s.jsxs("div",{className:`shape ${v?"selected":""}`,"data-shape":h,style:{left:p.x,top:p.y,width:Math.max(1,p.w),height:Math.max(1,p.h),pointerEvents:l.interactive?"auto":"none"},onPointerDown:u(h,"move"),onPointerMove:C=>f(C),onPointerUp:C=>f(C,!0),onContextMenu:C=>{C.preventDefault(),C.stopPropagation(),l.selected.includes(h)||l.onSelect(h),l.onContext(h,C)},children:[s.jsx(dy,{s:p,id:h}),v&&s.jsx("div",{className:"shape-resize",role:"slider","aria-label":r.shapes.shapeSize,"aria-valuetext":`${p.w} × ${p.h}`,style:{width:12/l.zoom,height:12/l.zoom,right:-6/l.zoom,bottom:-6/l.zoom,borderWidth:1.5/l.zoom},onPointerDown:u(h,"resize"),onPointerMove:C=>f(C),onPointerUp:C=>f(C,!0)})]},h)})})}function Wb({tool:l,view:c,onDone:u}){const[f,h]=j.useState(null),p=j.useRef(null),v=N=>{const S=N.currentTarget.getBoundingClientRect();return{x:(N.clientX-S.left-c.x)/c.zoom,y:(N.clientY-S.top-c.y)/c.zoom}},C=(N,S,y,b,M,D)=>{if(D&&(l==="rect"||l==="oval")){const W=Math.max(Math.abs(y-N),Math.abs(b-S));y=N+Math.sign(y-N||1)*W,b=S+Math.sign(b-S||1)*W}if(l==="pen"){const W=M.map(ie=>ie[0]),ne=M.map(ie=>ie[1]),F=Math.min(...W),fe=Math.min(...ne);return{kind:"pen",x:F,y:fe,w:Math.max(...W)-F,h:Math.max(...ne)-fe,points:M.map(([ie,ue])=>[Math.round(ie-F),Math.round(ue-fe)])}}const q=Math.min(N,y),K=Math.min(S,b),T=Math.abs(y-N),R=Math.abs(b-S);return l==="line"||l==="arrow"?{kind:l,x:q,y:K,w:T,h:R,points:[[Math.round(N-q),Math.round(S-K)],[Math.round(y-q),Math.round(b-K)]]}:{kind:l,x:q,y:K,w:T,h:R}};return s.jsx("div",{className:"shape-drawer","aria-label":r.shapes.drawShape,onPointerDown:N=>{if(N.button!==0)return;N.currentTarget.setPointerCapture(N.pointerId);const S=v(N);p.current={x0:S.x,y0:S.y,pts:[[S.x,S.y]]}},onPointerMove:N=>{const S=p.current;if(!S)return;const y=v(N);l==="pen"&&S.pts.push([y.x,y.y]),h(C(S.x0,S.y0,y.x,y.y,S.pts,N.shiftKey))},onPointerUp:N=>{const S=p.current;if(p.current=null,h(null),!S)return;const y=v(N);let b=C(S.x0,S.y0,y.x,y.y,S.pts,N.shiftKey);if(b.w<4&&b.h<4){if(l==="pen")return;b=l==="line"||l==="arrow"?{kind:l,x:S.x0,y:S.y0,w:200,h:0,points:[[0,0],[200,0]]}:{kind:l,x:S.x0,y:S.y0,w:200,h:140}}u({...b,x:Math.round(b.x),y:Math.round(b.y),w:Math.round(b.w),h:Math.round(b.h)})},children:f&&s.jsx("div",{className:"world",style:{transform:`translate(${c.x}px, ${c.y}px) scale(${c.zoom})`,pointerEvents:"none"},children:s.jsx("div",{className:"shape",style:{left:f.x,top:f.y,width:Math.max(1,f.w),height:Math.max(1,f.h)},children:s.jsx(dy,{s:{...f,strokeWidth:4},id:"draft"})})})})}function Ib({shape:l,onPatch:c,onDelete:u,onFront:f,onBack:h}){const p=r.shapes.kinds,v=({value:C,onPick:N,allowNone:S})=>s.jsx("span",{className:"swatches",children:Jb.filter(y=>S||y!=="none").map(y=>s.jsx("button",{className:`swatch ${C===y?"on":""} ${y==="none"?"none":""}`,title:y==="none"?r.shapes.none:y,"aria-label":y==="none"?r.shapes.none:y,style:{background:y==="none"?void 0:y},onClick:()=>N(y)},y))});return s.jsxs("section",{className:"board-opts","aria-label":r.shapes.options,children:[s.jsx("div",{className:"sec-head",children:s.jsx("span",{children:p[l.kind]})}),l.kind!=="image"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:r.shapes.strokeColor}),s.jsx(v,{value:l.stroke??"#111111",onPick:C=>c({stroke:C})})]}),(l.kind==="rect"||l.kind==="oval")&&s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:r.shapes.fill}),s.jsx(v,{value:l.fill??"none",onPick:C=>c({fill:C}),allowNone:!0})]}),s.jsxs("label",{className:"field-row",children:[s.jsx("span",{children:r.shapes.weight}),s.jsx("input",{type:"range",min:1,max:24,value:l.strokeWidth??4,onChange:C=>c({strokeWidth:Number(C.target.value)}),"aria-label":r.shapes.strokeWeight})]})]}),s.jsxs("div",{className:"muted small",children:[l.w," × ",l.h," · (",l.x,", ",l.y,")"]}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"icon-btn","aria-label":r.shapes.front,title:r.shapes.front,onClick:f,children:s.jsx(P,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":r.shapes.back,title:r.shapes.back,onClick:h,children:s.jsx(P,{name:"back"})}),s.jsx("button",{className:"icon-btn danger","aria-label":r.shapes.deleteShape,title:r.shapes.deleteTitle,onClick:u,children:s.jsx(P,{name:"trash"})})]})]})}function Pb({note:l,onPatch:c,onDelete:u}){const f=l.kind==="title",h=f?72:22;return s.jsxs("section",{className:"board-opts","aria-label":r.notes.options,children:[s.jsx("div",{className:"sec-head",children:s.jsx("span",{children:f?r.notes.title:r.notes.sticky})}),s.jsxs("label",{className:"field-row",children:[s.jsx("span",{children:r.notes.fontSize}),s.jsx("select",{value:l.size??h,onChange:p=>c({size:Number(p.target.value)===h?void 0:Number(p.target.value)}),"aria-label":r.notes.fontSize,children:(f?[32,48,56,72,96,128]:[14,18,22,28,36]).map(p=>s.jsxs("option",{value:p,children:[p,"px",p===h?r.notes.defaultSuffix:""]},p))})]}),s.jsxs("div",{className:"btn-row",role:"group","aria-label":r.notes.textStyle,children:[s.jsx("button",{className:`icon-btn ${l.bold??f?"on":""}`,"aria-pressed":!!(l.bold??f),"aria-label":r.notes.bold,title:r.notes.bold,onClick:()=>c({bold:!(l.bold??f)}),children:s.jsx("strong",{children:"B"})}),s.jsx("button",{className:`icon-btn ${l.italic?"on":""}`,"aria-pressed":!!l.italic,"aria-label":r.notes.italic,title:r.notes.italic,onClick:()=>c({italic:!l.italic||void 0}),children:s.jsx("em",{children:"I"})})]}),!f&&s.jsxs("div",{className:"field-row",children:[s.jsx("span",{children:r.notes.color}),s.jsx("span",{className:"swatches",children:Vf.map(p=>s.jsx("button",{className:`swatch ${(l.color??"yellow")===p.id?"on":""}`,title:p.label,"aria-label":r.notes.stickyColor(p.label),style:{background:p.bg},onClick:()=>c({color:p.id==="yellow"?void 0:p.id})},p.id))})]}),f?s.jsxs("div",{className:"grid2",children:[s.jsx(Da,{label:r.notes.maxWidth,value:l.maxW??2e3,onCommit:p=>c({maxW:p})}),s.jsx(Da,{label:r.notes.maxHeight,value:l.maxH??0,onCommit:p=>c({maxH:p||void 0})})]}):s.jsxs("div",{className:"grid2",children:[s.jsx(Da,{label:r.notes.width,value:l.w??400,onCommit:p=>c({w:p})}),s.jsx(Da,{label:r.notes.height,value:l.h??0,onCommit:p=>c({h:p||void 0})})]}),s.jsx("p",{className:"muted small",children:f?r.notes.titleHint:r.notes.stickyHint}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":r.notes.deleteNote,title:r.notes.deleteTitle,onClick:u,children:s.jsx(P,{name:"trash"})})})]})}function Da({label:l,value:c,onCommit:u}){return s.jsxs("label",{className:"num",children:[s.jsx("span",{children:l}),s.jsx("input",{inputMode:"numeric",defaultValue:c,onBlur:f=>{const h=Math.max(0,Math.round(Number(f.target.value)));Number.isFinite(h)&&h!==c&&u(h)},onKeyDown:f=>!f.nativeEvent.isComposing&&f.key==="Enter"&&f.target.blur()},c)]})}const e0=l=>l==="grid"?{type:l,count:0,gutter:0,margin:0,align:"stretch",size:8,color:"#C94F0C"}:{type:l,count:l==="columns"?4:6,gutter:16,margin:20,align:"stretch",size:80,color:"#C94F0C"};function t0(l,c){const u=Math.max(1,Math.round(c.count));if(c.align==="stretch"){const v=(l-c.margin*2-c.gutter*(u-1))/u;return Array.from({length:u},(C,N)=>[c.margin+N*(v+c.gutter),v])}const f=u*c.size+(u-1)*c.gutter,h=c.align==="start"?c.margin:c.align==="end"?l-c.margin-f:(l-f)/2;return Array.from({length:u},(p,v)=>[h+v*(c.size+c.gutter),c.size])}function n0({guides:l,w:c,h:u}){return s.jsx("div",{className:"layout-guides","aria-hidden":"true",children:l.filter(f=>!f.hidden).map((f,h)=>f.type==="grid"?s.jsx("div",{className:"lg-grid",style:{backgroundImage:`linear-gradient(to right, ${f.color}55 1px, transparent 1px), linear-gradient(to bottom, ${f.color}55 1px, transparent 1px)`,backgroundSize:`${f.size}px ${f.size}px`}},h):t0(f.type==="columns"?c:u,f).map(([p,v],C)=>s.jsx("div",{className:"lg-track",style:f.type==="columns"?{left:p,top:0,width:v,height:u,background:`${f.color}1f`}:{top:p,left:0,height:v,width:c,background:`${f.color}1f`}},`${h}-${C}`)))})}function l0({guides:l,onChange:c}){const u=(h,p)=>c(l.map((v,C)=>C===h?{...v,...p}:v),r.history.editGuide),f=r.guides.types;return s.jsxs("section",{className:"board-opts guides-editor","aria-label":r.guides.aria,children:[s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:r.guides.heading(l.length,Hp)}),s.jsx("span",{className:"btn-row",children:["columns","rows","grid"].map(h=>s.jsx("button",{className:"icon-btn sm",disabled:l.length>=Hp,title:r.guides.add[h],"aria-label":r.guides.add[h],onClick:()=>c([...l,e0(h)],r.history.addGuide),children:s.jsx("span",{className:"small",children:f[h]})},h))})]}),l.length===0&&s.jsx("p",{className:"muted small",children:r.guides.empty}),l.map((h,p)=>s.jsxs("div",{className:"guide-row",children:[s.jsxs("div",{className:"guide-head",children:[s.jsx("strong",{children:f[h.type]}),s.jsx("input",{type:"color",value:h.color,onChange:v=>u(p,{color:v.target.value}),"aria-label":r.guides.color}),s.jsx("div",{className:"spacer"}),s.jsx("button",{className:"icon-btn sm","aria-label":h.hidden?r.guides.show:r.guides.hide,title:h.hidden?r.guides.show:r.guides.hide,onClick:()=>u(p,{hidden:!h.hidden||void 0}),children:s.jsx(P,{name:h.hidden?"close":"check",size:14})}),s.jsx("button",{className:"icon-btn sm danger","aria-label":r.guides.deleteGuide,title:r.guides.delete,onClick:()=>c(l.filter((v,C)=>C!==p),r.history.deleteGuide),children:s.jsx(P,{name:"trash",size:14})})]}),h.type==="grid"?s.jsx("div",{className:"grid2",children:s.jsx(Da,{label:r.guides.cell,value:h.size,onCommit:v=>u(p,{size:Math.max(2,v)})})}):s.jsxs("div",{className:"grid2",children:[s.jsx(Da,{label:r.guides.count,value:h.count,onCommit:v=>u(p,{count:Math.max(1,Math.min(48,v))})}),s.jsx(Da,{label:r.guides.gutter,value:h.gutter,onCommit:v=>u(p,{gutter:v})}),s.jsx(Da,{label:r.guides.margin,value:h.margin,onCommit:v=>u(p,{margin:v})}),h.align!=="stretch"&&s.jsx(Da,{label:r.guides.cellSize,value:h.size,onCommit:v=>u(p,{size:Math.max(1,v)})}),s.jsxs("label",{className:"field-row span2",children:[s.jsx("span",{children:r.guides.align}),s.jsxs("select",{value:h.align,onChange:v=>u(p,{align:v.target.value}),"aria-label":r.guides.alignAria,children:[s.jsx("option",{value:"stretch",children:r.guides.stretch}),s.jsx("option",{value:"start",children:h.type==="columns"?r.guides.left:r.guides.top}),s.jsx("option",{value:"center",children:r.guides.center}),s.jsx("option",{value:"end",children:h.type==="columns"?r.guides.right:r.guides.bottom})]})]})]})]},p))]})}const Lp={paths:[],rects:[],selection:null,error:null};function a0(l,c){const[u,f]=j.useState(Lp),h=j.useRef([]);h.current=u.paths;const p=j.useCallback(()=>{var S;if(!l)return;const N=(S=c(l))==null?void 0:S.contentDocument;N&&f(y=>{const b=y.paths.map(M=>Cn(N,M));return b.some(M=>!M)?{...y,paths:[],rects:[],selection:null,error:r.editMode.fileChanged}:{...y,rects:b.map(M=>ia(M))}})},[l,c]),v=j.useCallback(async N=>{var M;if(!l)return;const S=(M=c(l))==null?void 0:M.contentDocument,y=S?N.map(D=>Cn(S,D)):[];if(!S||!N.length||y.some(D=>!D)){f(D=>({...D,paths:[],rects:[],selection:null})),await Te.put("/api/selection",{file:null}).catch(()=>{});return}const b=N[N.length-1];f(D=>({...D,paths:N,rects:y.map(q=>ia(q)),error:null}));try{const{selection:D}=await Te.put("/api/selection",{file:l,path:b,paths:N,styles:Mb(Cn(S,b)),...fy(Cn(S,b))});f(q=>q.paths===N||q.paths.join()===N.join()?{...q,selection:D}:q)}catch(D){f(q=>({...q,selection:null,error:String(D.message)}))}},[l,c]),C=j.useRef(!0);return j.useEffect(()=>{f(Lp),C.current?C.current=!1:l||Te.put("/api/selection",{file:null}).catch(()=>{})},[l]),j.useEffect(()=>{var M;if(!l)return;const N=c(l);if(!N)return;let S=()=>{};const y=()=>{S();const D=N.contentDocument,q=N.contentWindow;if(!D||!q)return;const K=R=>{var W;R.isComposing||(W=R.target)!=null&&W.isContentEditable||(window.dispatchEvent(new KeyboardEvent("keydown",{key:R.key,code:R.code,metaKey:R.metaKey,ctrlKey:R.ctrlKey,shiftKey:R.shiftKey,altKey:R.altKey})),(/^(Arrow|Delete|Backspace|Tab|Enter|Escape)/.test(R.key)||(R.metaKey||R.ctrlKey)&&/^[zydcvg]$/i.test(R.key))&&R.preventDefault())},T=()=>p();D.addEventListener("keydown",K,!0),q.addEventListener("scroll",T,!0),S=()=>{D.removeEventListener("keydown",K,!0),q.removeEventListener("scroll",T,!0)}},b=()=>{y(),h.current.length&&v(h.current)};return((M=N.contentDocument)==null?void 0:M.readyState)==="complete"&&y(),N.addEventListener("load",b),()=>{N.removeEventListener("load",b),S()}},[l,c,v,p]),{state:u,select:v,refresh:p,setError:N=>f(S=>({...S,error:N}))}}function Af(l,c,u){const f=l==null?void 0:l.contentDocument;if(!l||!(f!=null&&f.body))return null;const h=l.getBoundingClientRect(),p=h.width/(l.offsetWidth||h.width)||1,v=f.elementFromPoint((c-h.left)/p,(u-h.top)/p);if(!v||v===f.body||v===f.documentElement)return null;const C=al(v);return C==null?null:{el:v,path:C}}function i0(l,c,u,f,h){const p=l==null?void 0:l.contentDocument,v=l==null?void 0:l.contentWindow;if(!l||!(p!=null&&p.body)||!v)return!1;const C=l.getBoundingClientRect(),N=C.width/(l.offsetWidth||C.width)||1,S=p.scrollingElement??p.documentElement,y=D=>{const q=D===S?null:v.getComputedStyle(D),K=(!q||/auto|scroll/.test(q.overflowY))&&(h<0?D.scrollTop>0:h>0&&D.scrollTop+D.clientHeight<D.scrollHeight-1),T=(!q||/auto|scroll/.test(q.overflowX))&&(f<0?D.scrollLeft>0:f>0&&D.scrollLeft+D.clientWidth<D.scrollWidth-1);return K||T};let b=p.elementFromPoint((c-C.left)/N,(u-C.top)/N);for(;b&&b!==S&&b!==p.body&&!y(b);)b=b.parentElement;const M=b&&b!==p.body&&y(b)?b:y(S)?S:null;return M?(M.scrollBy(f/N,h/N),!0):!1}function s0(l,c){const u=p=>{const v=p.getBoundingClientRect();return v.width>0&&v.height>0&&v.left>=c.x&&v.top>=c.y&&v.right<=c.x+c.w&&v.bottom<=c.y+c.h},f=[],h=p=>{for(const v of Array.from(p.children))if(!/^(script|style|template)$/i.test(v.tagName))if(u(v)){const C=al(v);C!=null&&f.push(C)}else h(v)};return h(l.body),f}function fy(l){var p,v,C;const c=l.tagName.toLowerCase(),u=l.getAttribute("role"),f=c==="img"||c==="picture"||(v=(p=l.style)==null?void 0:p.backgroundImage)!=null&&v.includes("url(")?"image":c==="button"||u==="button"?"button":c==="a"?"link":/^(input|textarea|select)$/.test(c)?"input":c==="svg"?"icon":!l.children.length&&((C=l.textContent)!=null&&C.trim())?"text":"container",h=(l.getAttribute("aria-label")||l.getAttribute("alt")||l.getAttribute("title")||l.getAttribute("placeholder")||l.innerText||l.textContent||"").trim().replace(/\s+/g," ").slice(0,60);return{kind:f,label:h}}const eh=.04,th=4,o0=.25,c0=640,Of=[600,1200,2400],r0=l=>Of.find(c=>c>=l)??Of[Of.length-1],u0=6,hy={url:l=>`/screens/${l}`,thumbs:!0};function d0(l){const c=j.useRef(null),u=j.useRef(null),[f,h]=j.useState({w:1200,h:800}),[p,v]=j.useState(!1),[C,N]=j.useState([]),[S,y]=j.useState(null),b=j.useRef(null),M=j.useRef(null);j.useLayoutEffect(()=>{const G=c.current,J=new ResizeObserver(()=>{var U;const k={w:G.clientWidth,h:G.clientHeight};h(k),(U=l.onSize)==null||U.call(l,k)});return J.observe(G),()=>J.disconnect()},[]);const D=j.useRef(!1);j.useEffect(()=>{const G=u.current;if(!G)return;if(!D.current){D.current=!0;return}G.style.willChange="transform";const J=setTimeout(()=>G.style.willChange="",200);return()=>clearTimeout(J)},[l.view.x,l.view.y,l.view.zoom]),j.useEffect(()=>{const G=c.current,J=k=>{var re,oe,de;k.preventDefault();const U=G.getBoundingClientRect(),ae=k.clientX-U.left,B=k.clientY-U.top;if(k.ctrlKey||k.metaKey)l.setView(se=>{const ve=Is(se.zoom*Math.exp(-k.deltaY*.01),eh,th),gt=(ae-se.x)/se.zoom,at=(B-se.y)/se.zoom;return{zoom:ve,x:ae-gt*ve,y:B-at*ve}});else{const se=((de=(oe=(re=k.target)==null?void 0:re.closest)==null?void 0:oe.call(re,".board-frame[data-inside]"))==null?void 0:de.querySelector("iframe"))??null;if(i0(se,k.clientX,k.clientY,k.deltaX,k.deltaY))return;l.setView(ve=>({...ve,x:ve.x-k.deltaX,y:ve.y-k.deltaY}))}};return G.addEventListener("wheel",J,{passive:!1}),()=>G.removeEventListener("wheel",J)},[l.setView]),j.useEffect(()=>{const G=k=>{k.code==="Space"&&!gy(k)&&!k.repeat&&(k.preventDefault(),v(!0))},J=k=>k.code==="Space"&&v(!1);return window.addEventListener("keydown",G),window.addEventListener("keyup",J),()=>{window.removeEventListener("keydown",G),window.removeEventListener("keyup",J)}},[]);const{view:q}=l,K=(G,J)=>{const k=c.current.getBoundingClientRect();return{x:(G-k.left-q.x)/q.zoom,y:(J-k.top-q.y)/q.zoom}},T=G=>{b.current=G,y(G)},R=p||l.tool==="hand"||!!l.readOnly,W=l.screens??hy,ne=G=>{if(G.target!==G.currentTarget&&G.button!==1)return;if(G.currentTarget.setPointerCapture(G.pointerId),G.button===1||R){M.current={kind:"pan",sx:G.clientX,sy:G.clientY,vx:q.x,vy:q.y};return}if(G.button!==0)return;const J=K(G.clientX,G.clientY);if(l.tool==="title"||l.tool==="sticky"){l.onCreateNote(l.tool,{x:Math.round(J.x),y:Math.round(J.y)}),l.setTool("select");return}M.current={kind:l.tool==="board"?"draw":"marquee",sx:J.x,sy:J.y,additive:G.shiftKey,moved:!1}},F=G=>{const J=M.current;if(!J)return;if(J.kind==="pan"){l.setView(ae=>({...ae,x:J.vx+G.clientX-J.sx,y:J.vy+G.clientY-J.sy}));return}const k=K(G.clientX,G.clientY),U={x:Math.min(J.sx,k.x),y:Math.min(J.sy,k.y),w:Math.abs(k.x-J.sx),h:Math.abs(k.y-J.sy)};(U.w+U.h)*q.zoom>4&&(J.moved=!0),J.moved&&T(U)},fe=G=>{const J=M.current;if(M.current=null,(J==null?void 0:J.kind)==="pan"&&l.readOnly&&Math.abs(G.clientX-J.sx)+Math.abs(G.clientY-J.sy)<4&&l.onSelect([],"replace"),!J||J.kind==="pan")return;const k=b.current;if(T(null),J.kind==="draw"){const re=K(G.clientX,G.clientY);l.onCreateBoard(J.moved&&k&&k.w>20&&k.h>20?p0(k):{x:Math.round(re.x),y:Math.round(re.y),w:390,h:844}),l.setTool("select");return}if(!J.moved||!k){J.additive||(l.onSelect([],"replace"),l.onSelectNote(null));return}const U=l.visibleBoards.filter(re=>Df(l.board.boards[re],k)),ae=l.visibleNotes.filter(re=>{var gt;const oe=(gt=c.current)==null?void 0:gt.querySelector(`[data-note="${re}"]`);if(!oe)return!1;const de=oe.getBoundingClientRect(),se=K(de.left,de.top),ve=K(de.right,de.bottom);return Df({x:se.x,y:se.y,w:ve.x-se.x,h:ve.y-se.y},k)}),B=Object.entries(l.board.shapes??{}).filter(([,re])=>Df({x:re.x,y:re.y,w:Math.max(1,re.w),h:Math.max(1,re.h)},k)).map(([re])=>re);l.onMarquee({boards:U,notes:ae,shapes:B},J.additive)},ie=j.useRef(null),ue=(G,J)=>{const k=l.selected.includes(J)?l.selected:[J],U={};for(const ae of k)U[ae]={x:l.board.boards[ae].x,y:l.board.boards[ae].y};ie.current={sx:G.clientX,sy:G.clientY,origins:U,moved:!1},G.currentTarget.setPointerCapture(G.pointerId)},te=(G,J=!1)=>{const k=ie.current;if(!k)return;let U=(G.clientX-k.sx)/q.zoom,ae=(G.clientY-k.sy)/q.zoom;if(!k.moved&&!_p(G.clientX-k.sx,G.clientY-k.sy))return;k.moved=!0;const B=Object.keys(k.origins),re=B.map(at=>({...l.board.boards[at],x:k.origins[at].x+U,y:k.origins[at].y+ae})),oe=my(re),de=l.visibleBoards.filter(at=>!B.includes(at)).map(at=>l.board.boards[at]),se=u0/q.zoom,ve=[];if(!G.altKey){const at=$p([oe.x,oe.x+oe.w/2,oe.x+oe.w],de.flatMap(it=>[it.x,it.x+it.w/2,it.x+it.w]),se),Nt=$p([oe.y,oe.y+oe.h/2,oe.y+oe.h],de.flatMap(it=>[it.y,it.y+it.h/2,it.y+it.h]),se);if(at){U+=at.d;const it=de.filter(Ee=>[Ee.x,Ee.x+Ee.w/2,Ee.x+Ee.w].some($e=>Math.abs($e-at.at)<.5));ve.push({axis:"x",at:at.at,from:Math.min(oe.y+((Nt==null?void 0:Nt.d)??0),...it.map(Ee=>Ee.y)),to:Math.max(oe.y+oe.h+((Nt==null?void 0:Nt.d)??0),...it.map(Ee=>Ee.y+Ee.h))})}if(Nt){ae+=Nt.d;const it=de.filter(Ee=>[Ee.y,Ee.y+Ee.h/2,Ee.y+Ee.h].some($e=>Math.abs($e-Nt.at)<.5));ve.push({axis:"y",at:Nt.at,from:Math.min(oe.x+((at==null?void 0:at.d)??0),...it.map(Ee=>Ee.x)),to:Math.max(oe.x+oe.w+((at==null?void 0:at.d)??0),...it.map(Ee=>Ee.x+Ee.w))})}}N(J?[]:ve);const gt={};for(const at of B)gt[at]={x:Math.round(k.origins[at].x+U),y:Math.round(k.origins[at].y+ae)};l.onMoveBoards(gt,J)},ce=G=>{const J=ie.current;J!=null&&J.moved&&te(G,!0),ie.current=null,N([])},je=f.w/q.zoom,Ce=f.h/q.zoom,lt=-q.x/q.zoom,zt=-q.y/q.zoom,At=G=>G.x+G.w>lt-200&&G.x<lt+je+200&&G.y+G.h>zt-200&&G.y<zt+Ce+200,et=G=>{G.currentTarget.setPointerCapture(G.pointerId),M.current={kind:"pan",sx:G.clientX,sy:G.clientY,vx:q.x,vy:q.y}},he=j.useRef(null),pe=!!l.onPickElement&&!l.readOnly&&!R&&l.tool==="select",Se=(G,J,k,U)=>{var B;if(G.button!==0)return;if(G.stopPropagation(),l.readOnly||R)return l.readOnly&&l.onSelect([J],"replace"),et(G);const ae=l.selected.includes(J);if((B=l.onHoverElement)==null||B.call(l,null),k==="frame"&&pe&&U&&G.shiftKey&&l.editFile===J){G.currentTarget.setPointerCapture(G.pointerId),he.current={file:J,kind:"elements",sx:G.clientX,sy:G.clientY,moved:!1};return}if(G.shiftKey)return l.onSelect([J],"toggle");ae||l.onSelect([J],"replace"),ue(G,J),he.current={file:J,kind:k==="frame"&&pe&&U?"board":"label",sx:G.clientX,sy:G.clientY,moved:!1}},Me=(G,J)=>({x:Math.min(G.sx,J.clientX),y:Math.min(G.sy,J.clientY),w:Math.abs(J.clientX-G.sx),h:Math.abs(J.clientY-G.sy)}),ke=(G,J,k)=>{var ae,B,re;if(l.readOnly||((ae=M.current)==null?void 0:ae.kind)==="pan")return F(G);he.current&&G.buttons===0&&(he.current=null,ie.current=null);const U=he.current;if(!U){G.buttons===0&&pe&&k&&((B=l.onHoverElement)==null||B.call(l,J,G));return}if(U.kind==="elements"){if(!U.moved&&!_p(G.clientX-U.sx,G.clientY-U.sy))return;U.moved=!0,(re=l.onElementMarquee)==null||re.call(l,U.file,Me(U,G),!1);return}te(G)},ct=(G,J)=>{var ae,B,re,oe,de;if(l.readOnly||((ae=M.current)==null?void 0:ae.kind)==="pan")return void(M.current=null);const k=he.current;if(he.current=null,(k==null?void 0:k.kind)==="elements"){k.moved?(B=l.onElementMarquee)==null||B.call(l,k.file,Me(k,G),!0):(re=l.onPickElement)==null||re.call(l,J,G,{add:!0,double:!1});return}const U=!!((oe=ie.current)!=null&&oe.moved);ce(G),!(!k||U)&&(k.kind==="board"?(de=l.onPickElement)==null||de.call(l,J,G,{add:!1,double:!1}):k.kind==="label"&&l.editFile===J&&l.onSelect([J],"replace"))};return s.jsxs("div",{ref:c,className:`canvas tool-${R?"hand":l.tool}`,onPointerDown:ne,onPointerMove:F,onPointerUp:fe,onAuxClick:G=>G.preventDefault(),onContextMenu:G=>{if(G.target!==G.currentTarget)return;G.preventDefault();const J=K(G.clientX,G.clientY);l.onContext({type:"canvas",x:Math.round(J.x),y:Math.round(J.y)},G)},role:"application","aria-label":r.canvas.aria,children:[s.jsxs("div",{ref:u,className:"world",style:{transform:`translate(${q.x}px, ${q.y}px) scale(${q.zoom})`},children:[l.visibleNotes.map(G=>s.jsx(g0,{note:l.board.notes[G],zoom:q.zoom,id:G,selected:l.selectedNotes.includes(G),readOnly:l.readOnly,onSelect:J=>l.onSelectNote(G,J),onMove:(J,k)=>l.onMoveNote(G,J,k),onDelete:()=>l.onDeleteNote(G),onContext:J=>l.onContext({type:"note",id:G},J)},G)),l.visibleBoards.map(G=>{var ae,B,re,oe;const J=l.board.boards[G],k=At(J)&&(!W.thumbs||q.zoom>=o0||Math.max(J.w,J.h)*q.zoom>=c0||l.editFile===G),U=l.selected.includes(G);return s.jsx(f0,{file:G,item:J,exists:l.files.includes(G),zoom:q.zoom,live:k,selected:U,single:U&&l.selected.length===1&&!l.readOnly,readOnly:l.readOnly,screens:W,editing:l.editFile===G,typing:l.typing===G,playing:l.playing===G,near:At(J),reloadKey:l.reloadKeys[G]??0,onPress:(de,se)=>Se(de,G,se,k),onPressMove:de=>ke(de,G,k),onRelease:de=>ct(de,G),onLeave:()=>{var de;return!he.current&&((de=l.onHoverElement)==null?void 0:de.call(l,null))},onDoubleClickFrame:pe&&k?de=>{var se;return(se=l.onPickElement)==null?void 0:se.call(l,G,de,{add:!1,double:!0})}:void 0,onContextFrame:de=>{var se;return pe&&k&&!!((se=l.onElementContext)!=null&&se.call(l,G,de))},onResize:(de,se)=>l.onMoveBoards({[G]:de},se),onPlay:()=>l.onPlay(G),onRename:()=>l.onRename(G),onContext:de=>l.onContext({type:"board",file:G},de),overlay:(ae=l.renderBoardOverlay)==null?void 0:ae.call(l,G),tags:J.w*q.zoom>=48&&l.playing!==G?(B=l.renderBoardTags)==null?void 0:B.call(l,G):null,buttons:l.readOnly?null:(re=l.renderBoardButtons)==null?void 0:re.call(l,G),ring:((oe=l.boardRing)==null?void 0:oe.call(l,G))??null,iframeRef:de=>{var se;return(se=l.iframeRef)==null?void 0:se.call(l,G,de)}},G)}),l.worldLayer,C.map((G,J)=>G.axis==="x"?s.jsx("div",{className:"guide",style:{left:G.at,top:G.from,width:1/q.zoom,height:G.to-G.from}},J):s.jsx("div",{className:"guide",style:{left:G.from,top:G.at,height:1/q.zoom,width:G.to-G.from}},J)),S&&s.jsx("div",{className:l.tool==="board"?"draft-board":"marquee",style:{left:S.x,top:S.y,width:S.w,height:S.h,borderWidth:1/q.zoom},children:l.tool==="board"&&s.jsxs("span",{style:{transform:`scale(${1/q.zoom})`},children:[Math.round(S.w)," × ",Math.round(S.h)]})})]}),p&&s.jsx("div",{className:"pan-capture",onPointerDown:et,onPointerMove:F,onPointerUp:()=>M.current=null})]})}function f0(l){var C,N;const{item:c,zoom:u}=l,f=Kf(u),h=c.title??l.file,p=S=>{S.preventDefault(),S.stopPropagation(),l.onContext(S)},v=S=>S.stopPropagation();return s.jsxs("div",{className:`board ${l.selected?"selected":""} ${l.editing?"editing":""} ${l.playing?"playing":""} ${c.frameless?"frameless":""} ${c.is_interactive?"interactive":""} ${l.ring?"held":""}`,style:{left:c.x,top:c.y,width:c.w,height:c.h,...l.ring?{"--ring":l.ring}:{}},"data-file":l.file,role:"group","aria-label":r.canvas.board(h,!!l.selected,!!l.editing,!!l.playing),children:[s.jsxs("div",{className:`board-label ${c.w*u<48?"tiny":""} ${l.tags?"tagged":""}`,style:{transform:`scale(${1/u})`,width:c.w*u},onPointerDown:S=>l.onPress(S,"label"),onPointerMove:l.onPressMove,onPointerUp:l.onRelease,onContextMenu:p,title:`${h} · ${l.file}`,children:[l.tags,s.jsxs("span",{className:"lab-row",children:[c.is_interactive&&s.jsx("span",{className:"dot","aria-label":r.canvas.interactive}),s.jsx("span",{className:"board-title",onDoubleClick:S=>{S.stopPropagation(),l.readOnly||l.onRename()},children:h}),c.w*u>=160&&h!==l.file&&s.jsx("span",{className:"board-file",children:l.file}),c.w*u>=110&&s.jsxs("span",{className:`board-btns ${l.buttons?"pinned":""}`,children:[l.buttons,c.is_interactive&&s.jsx("button",{className:"icon-btn sm","aria-label":"Play",title:"Play",onPointerDown:v,onClick:S=>{S.stopPropagation(),l.onPlay()},children:s.jsx(P,{name:"play",size:14})})]})]})]}),s.jsxs("div",{className:"board-frame","data-inside":l.editing&&!l.readOnly?"":void 0,style:{borderRadius:c.radius??0},onDoubleClick:S=>{l.playing||l.typing||!l.onDoubleClickFrame||(S.stopPropagation(),l.onDoubleClickFrame(S))},onPointerDown:S=>!l.playing&&!l.typing&&l.onPress(S,"frame"),onPointerMove:S=>!l.playing&&!l.typing&&l.onPressMove(S),onPointerUp:S=>!l.playing&&!l.typing&&l.onRelease(S),onPointerLeave:l.onLeave,onContextMenu:S=>{l.playing||l.typing||(l.onContextFrame(S)?(S.preventDefault(),S.stopPropagation()):p(S))},children:[l.exists?l.live?s.jsx(m0,{reloadKey:l.reloadKey,iframeRef:l.iframeRef,src:l.screens.url(l.file),html:(N=(C=l.screens).html)==null?void 0:N.call(C,l.file),title:h,interactive:!!l.playing||!!l.typing}):s.jsxs("div",{className:`board-placeholder ${l.near?"loading":"far"}`,style:{fontSize:Math.min(64,14/u)},children:[l.near&&l.screens.thumbs&&s.jsx(h0,{file:l.file,v:l.reloadKey,px:r0(Math.max(c.w,c.h)*u*(window.devicePixelRatio||1))}),s.jsx("span",{className:"ph-title","data-hint":l.near?"":r.canvas.notLoaded,children:h}),l.near&&s.jsx("span",{className:"ph-bar",style:{height:3/Math.max(u,.05)},"aria-hidden":"true"})]}):s.jsx("div",{className:"board-missing",children:r.canvas.fileMissing(l.file)}),l.playing&&s.jsx("div",{className:"playing-badge",style:{transform:`scale(${1/Math.max(u,.25)})`},children:r.canvas.playing}),l.overlay]}),l.single&&s.jsx("div",{className:"board-resize",role:"slider","aria-label":r.canvas.boardSize,"aria-valuetext":`${c.w} × ${c.h}`,style:{width:12/u,height:12/u,right:-6/u,bottom:-6/u,borderWidth:1.5/u},onPointerDown:S=>{S.button===0&&(S.stopPropagation(),f.start(S,{x:c.w,y:c.h},(y,b)=>l.onResize({w:Is(Math.round(y.x),40,8e3),h:Is(Math.round(y.y),40,8e3)},b)))},onPointerMove:f.move,onPointerUp:f.end})]})}function h0({file:l,v:c,px:u}){const[f,h]=j.useState(!1),[p,v]=j.useState(u);j.useEffect(()=>v(b=>Math.max(b,u)),[u]);const C=`/api/thumb?f=${encodeURIComponent(l)}&v=${c}&px=${p}`,[N,S]=j.useState(null),y=j.useRef(null);return j.useEffect(()=>{if(C===y.current)return;const b=new Image;return b.onload=()=>S(y.current=C),b.onerror=()=>!y.current&&h(!0),b.src=C,()=>{b.onload=b.onerror=null}},[C]),f||!N?null:s.jsx("img",{className:"board-thumb",src:N,alt:"",decoding:"async",draggable:!1,onLoad:b=>{var M;b.currentTarget.classList.add("loaded"),(M=b.currentTarget.parentElement)==null||M.classList.remove("loading")}})}function m0(l){const c=j.useRef(null),u=j.useRef(!0);return j.useEffect(()=>{if(u.current){u.current=!1;return}const f=c.current,h=f==null?void 0:f.contentWindow;if(!f||!h)return;const p=h.document,v=[];p.querySelectorAll("*").forEach((y,b)=>{(y.scrollTop||y.scrollLeft)&&v.push([b,y.scrollTop,y.scrollLeft])});const C=h.scrollX,N=h.scrollY,S=()=>{f.removeEventListener("load",S);const y=f.contentWindow;y.scrollTo(C,N);const b=y.document.querySelectorAll("*");for(const[M,D,q]of v){const K=b[M];K&&(K.scrollTop=D,K.scrollLeft=q)}f.dispatchEvent(new CustomEvent("dc-reloaded"))};f.addEventListener("load",S),h.location.reload()},[l.reloadKey]),s.jsx("iframe",{ref:f=>{c.current=f,l.iframeRef(f)},src:l.html==null?l.src:void 0,srcDoc:l.html??void 0,title:l.title,style:{pointerEvents:l.interactive?"auto":"none"}})}function g0(l){const{note:c}=l,u=Kf(l.zoom),[f,h]=j.useState(!1),p=j.useRef(null);j.useEffect(()=>{if(f&&p.current){p.current.focus();const K=document.createRange();K.selectNodeContents(p.current);const T=getSelection();T==null||T.removeAllRanges(),T==null||T.addRange(K)}},[f]);const v=j.useRef(!1),C=j.useRef(!1),N=K=>{h(!1);const T=K.innerText;T!==c.text&&l.onMove({text:T},!0)},S=c.size??(c.kind==="title"?72:22),[y,b]=j.useState(S);j.useLayoutEffect(()=>{const K=p.current;if(!K||c.kind!=="title"||f)return b(S);let T=S;K.style.fontSize=`${T}px`;const R=c.maxW??4e3,W=c.maxH||1/0;for(let ne=0;ne<40&&T>12&&(K.scrollWidth>R+1||K.scrollHeight>W+1);ne++)T=Math.max(12,Math.floor(T*.92)),K.style.fontSize=`${T}px`;b(T)},[c.text,S,c.maxW,c.maxH,c.kind,f]);const M=Kf(l.zoom),D=c.kind==="title"?{left:c.x,top:c.y,maxWidth:c.maxW??4e3,maxHeight:c.maxH||void 0}:{left:c.x,top:c.y,width:c.w??320,height:c.h||void 0,background:Qb(c.color)},q={fontSize:y,fontWeight:c.bold??c.kind==="title"?700:400,fontStyle:c.italic?"italic":void 0};return c.kind==="title"&&y*l.zoom<12&&Object.assign(D,{transform:`scale(${12/(y*l.zoom)})`,transformOrigin:"0 0"}),s.jsxs("div",{className:`note note-${c.kind} ${l.selected?"selected":""} ${l.readOnly?"read-only":""}`,"data-note":l.id,style:D,onPointerDown:K=>{f||K.button!==0||l.readOnly||(K.stopPropagation(),K.shiftKey?l.onSelect(!0):l.selected||l.onSelect(!1),u.start(K,{x:c.x,y:c.y},(T,R)=>l.onMove({x:Math.round(T.x),y:Math.round(T.y)},R)))},onPointerMove:u.move,onPointerUp:u.end,onDoubleClick:K=>{K.stopPropagation(),l.readOnly||h(!0)},onContextMenu:K=>{K.preventDefault(),K.stopPropagation(),!l.readOnly&&(l.onSelect(!1),l.onContext(K))},children:[s.jsx("div",{ref:p,className:"note-text",style:q,contentEditable:f,suppressContentEditableWarning:!0,onCompositionStart:()=>v.current=!0,onCompositionEnd:K=>{v.current=!1,C.current&&(C.current=!1,N(K.currentTarget))},onBlur:K=>{v.current?C.current=!0:N(K.currentTarget)},onKeyDown:K=>{K.nativeEvent.isComposing||K.key==="Escape"&&K.currentTarget.blur()},children:c.text}),l.selected&&l.zoom>=.2&&!f&&s.jsx("div",{className:"note-resize",role:"slider","aria-label":c.kind==="title"?r.canvas.titleMaxWidth:r.canvas.stickySize,style:{width:12/l.zoom,height:12/l.zoom,right:-6/l.zoom,bottom:-6/l.zoom,borderWidth:1.5/l.zoom},onPointerDown:K=>{if(K.button!==0)return;K.stopPropagation();const T=K.currentTarget.parentElement.getBoundingClientRect(),R=T.width/l.zoom,W=T.height/l.zoom;M.start(K,{x:R,y:W},(ne,F)=>l.onMove(c.kind==="title"?{maxW:Math.max(80,Math.round(ne.x))}:{w:Math.max(80,Math.round(ne.x)),h:Math.max(60,Math.round(ne.y))},F))},onPointerMove:M.move,onPointerUp:M.end}),l.selected&&!f&&l.zoom>=.2&&s.jsx("button",{className:"note-del icon-btn","aria-label":r.canvas.deleteNote,style:{transform:`scale(${1/l.zoom})`},onPointerDown:K=>K.stopPropagation(),onClick:K=>{K.stopPropagation(),l.onDelete()},children:s.jsx(P,{name:"close",size:14})})]})}function Kf(l){const c=j.useRef(null);return{start(u,f,h){c.current={sx:u.clientX,sy:u.clientY,ox:f.x,oy:f.y,cb:h,moved:!1},u.currentTarget.setPointerCapture(u.pointerId)},move(u){const f=c.current;if(!f)return;const h=(u.clientX-f.sx)/l,p=(u.clientY-f.sy)/l;!f.moved&&Math.abs(h)+Math.abs(p)<2/l||(f.moved=!0,f.cb({x:f.ox+h,y:f.oy+p},!1))},end(u){const f=c.current;c.current=null,!(!f||!f.moved)&&f.cb({x:f.ox+(u.clientX-f.sx)/l,y:f.oy+(u.clientY-f.sy)/l},!0)}}}function $p(l,c,u){let f=null;for(const h of l)for(const p of c){const v=p-h;Math.abs(v)<=u&&(!f||Math.abs(v)<Math.abs(f.d))&&(f={d:v,at:p})}return f}const my=l=>{const c=Math.min(...l.map(f=>f.x)),u=Math.min(...l.map(f=>f.y));return{x:c,y:u,w:Math.max(...l.map(f=>f.x+f.w))-c,h:Math.max(...l.map(f=>f.y+f.h))-u}},Df=(l,c)=>l.x<c.x+c.w&&l.x+l.w>c.x&&l.y<c.y+c.h&&l.y+l.h>c.y,p0=l=>({x:Math.round(l.x),y:Math.round(l.y),w:Math.round(l.w),h:Math.round(l.h)});function Is(l,c,u){return Math.min(u,Math.max(c,l))}function gy(l){const c=l.target;return c?c.tagName==="INPUT"?!/^(checkbox|radio|button|range|color)$/.test(c.type):c.isContentEditable||/^(TEXTAREA|SELECT)$/.test(c.tagName):!1}function ts(l,c,u=60,f){if(!l.length)return{x:0,y:0,zoom:1};(c.w<100||c.h<100)&&(c={w:window.innerWidth,h:Math.max(200,window.innerHeight)});const h=f&&f.w>=100&&f.h>=100?f:{x:0,y:0,w:c.w,h:c.h};u=Math.min(u,h.w*.08,h.h*.08);const p=my(l),v=Is(Math.min((h.w-u*2)/p.w,(h.h-u*2)/p.h),eh,th);return{zoom:v,x:Math.round(h.x+u-p.x*v+(h.w-u*2-p.w*v)/2),y:Math.round(h.y+u-p.y*v+(h.h-u*2-p.h*v)/2)}}function y0(l){const[c,u]=j.useState(null),f=j.useCallback(()=>Te.get("/api/assets").then(h=>u(h.assets)).catch(()=>u([])),[]);return j.useEffect(()=>{f()},[f,l]),{list:c,reload:f}}async function Zf(l){const c=[];for(const u of Array.from(l)){const f=await new Promise(h=>{const p=new FileReader;p.onload=()=>h(String(p.result).split(",")[1]??""),p.readAsDataURL(u)});c.push(await Te.post("/api/assets",{name:u.name,data:f}))}return c}const v0=l=>l>1024*1024?`${(l/1024/1024).toFixed(1)}MB`:`${Math.max(1,Math.round(l/1024))}KB`;function py(l){const{list:c,reload:u}=y0(l.version),[f,h]=j.useState(!1),[p,v]=j.useState(!1),C=async S=>{var y;h(!0);try{const b=await Zf(S);await u(),(y=l.onUploaded)==null||y.call(l,b)}catch(b){l.onError(b.message)}finally{h(!1)}},N=(c??[]).filter(S=>!l.only||S.kind===l.only);return s.jsxs("div",{className:`assets ${p?"over":""}`,onDragOver:S=>{S.preventDefault(),v(!0)},onDragLeave:()=>v(!1),onDrop:S=>{S.preventDefault(),v(!1),S.dataTransfer.files.length&&C(S.dataTransfer.files)},children:[s.jsxs("label",{className:"upload",children:[s.jsx(P,{name:"plus",size:14})," ",f?r.assets.uploading:r.assets.upload,s.jsx("input",{type:"file",hidden:!0,multiple:!0,accept:"image/*,.woff,.woff2,.ttf,.otf",onChange:S=>S.target.files&&void C(S.target.files)})]}),c==null?s.jsxs("p",{className:"empty",children:[s.jsx("span",{className:"spinner","aria-hidden":"true"})," ",r.assets.loading]}):N.length===0?s.jsx("p",{className:"empty",children:r.assets.empty}):s.jsx("ul",{className:"asset-grid",children:N.map(S=>s.jsx("li",{children:s.jsxs("button",{className:"asset",title:`${S.ref} · ${v0(S.size)}${l.onPick?"":r.assets.copyPath}`,"aria-label":`${S.name}${l.pickLabel??""}`,onClick:()=>l.onPick?l.onPick(S):void navigator.clipboard.writeText(S.ref).catch(()=>{}),children:[S.kind==="image"?s.jsx("img",{src:S.url,alt:"",loading:"lazy"}):s.jsx("span",{className:"asset-font",children:S.kind==="font"?"Aa":r.assets.file}),s.jsx("span",{className:"asset-name",children:S.name})]})},S.name))})]})}function b0({open:l,version:c,onClose:u,onPick:f,onError:h}){return j.useEffect(()=>{if(!l)return;const p=v=>v.key==="Escape"&&u();return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[l,u]),l?s.jsx("div",{className:"dialog-backdrop",onPointerDown:p=>p.target===p.currentTarget&&u(),children:s.jsxs("div",{className:"dialog wide",role:"dialog","aria-modal":"true","aria-label":r.assets.pickImage,children:[s.jsx("h2",{children:r.assets.pickImage}),s.jsx(py,{version:c,only:"image",pickLabel:r.assets.pickLabel,onPick:f,onError:h,onUploaded:p=>p[0]&&p[0].kind==="image"&&f(p[0])}),s.jsx("div",{className:"dialog-actions",children:s.jsx("button",{onClick:u,children:r.assets.close})})]})}):null}var Rf=cy();function Yp({label:l,src:c,empty:u,w:f,h}){const p=j.useRef(null),[v,C]=j.useState(0);return j.useEffect(()=>{const N=p.current;if(!N)return;const S=()=>C(Math.min(1,(N.clientWidth-16)/f,(N.clientHeight-16)/h));S();const y=new ResizeObserver(S);return y.observe(N),()=>y.disconnect()},[f,h]),s.jsxs("figure",{className:"cmp-pane",children:[s.jsx("figcaption",{children:l}),s.jsx("div",{className:"cmp-stage",ref:p,children:c?s.jsx("div",{className:"cmp-frame",style:{width:f*v,height:h*v},children:v>0&&s.jsx("iframe",{title:l,src:c,style:{width:f,height:h,transform:`scale(${v})`}})}):s.jsx("p",{className:"muted",children:u})})]})}const x0=l=>c=>`/api/chat/run-file?id=${encodeURIComponent(l)}&f=${encodeURIComponent(`screens/${c}`)}`,w0=l=>c=>`/api/history/step-file?id=${encodeURIComponent(l)}&f=${encodeURIComponent(c)}`;function yy({before:l,boards:c,onClose:u,notBefore:f=r.compare.notBefore}){const[h,p]=j.useState(()=>Math.max(0,c.findIndex(N=>N.kind==="changed"))),v=c[h];if(!v)return null;const C=N=>N.split("/").map(encodeURIComponent).join("/");return s.jsx("div",{className:"dialog-backdrop",onPointerDown:N=>N.target===N.currentTarget&&u(),children:s.jsxs("div",{className:"dialog cmp",role:"dialog","aria-modal":"true","aria-label":r.compare.title(v.title),onKeyDown:N=>N.key==="Escape"&&u(),children:[s.jsxs("div",{className:"cmp-head",children:[s.jsx("h2",{children:r.compare.title(v.title)}),s.jsx("button",{className:"icon-btn sm","aria-label":r.compare.close,title:r.compare.close,autoFocus:!0,onClick:u,children:s.jsx(P,{name:"close",size:14})})]}),c.length>1&&s.jsx("div",{className:"chips",role:"tablist","aria-label":r.compare.boards,children:c.map((N,S)=>s.jsx("button",{role:"tab","aria-selected":S===h,className:`chip cmp-tab ${S===h?"on":""}`,onClick:()=>p(S),children:N.kind==="added"?r.chat.chipNew(N.title):N.title},N.file))}),s.jsxs("div",{className:"cmp-panes",children:[s.jsx(Yp,{label:r.compare.before,src:v.kind==="added"?null:l(v.file),empty:f,w:v.w,h:v.h},`b-${v.file}`),s.jsx(Yp,{label:r.compare.after,src:v.kind==="removed"?null:`/screens/${C(v.file)}`,empty:r.compare.notAfter,w:v.w,h:v.h},`a-${v.file}`)]})]})})}const j0=/^ {0,3}(`{3,}|~{3,})\s*([\w#+.-]*)/,S0=/^ {0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,cc=/^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/,N0=/^ {0,3}([-*_])(\s*\1){2,}\s*$/,T0=l=>/^https?:\/\/[^\s<>"]+$/i.test(l)?l:null;function C0(l){const c=String(l??"").replace(/\r\n?/g,`
53
- `).split(`
54
- `),u=[];let f=[];const h=()=>{f.length&&u.push({t:"p",c:ns(f.join(`
55
- `))}),f=[]};for(let p=0;p<c.length;p++){const v=c[p],C=j0.exec(v);if(C){h();const S=C[1],y=[];let b=!0;for(p++;p<c.length;p++){if(new RegExp(`^ {0,3}${S[0]==="`"?"`":"~"}{${S.length},}\\s*$`).test(c[p])){b=!1;break}y.push(c[p])}u.push({t:"code",lang:C[2]??"",v:y.join(`
56
- `),open:b});continue}if(!v.trim()){h();continue}const N=S0.exec(v);if(N){h(),u.push({t:"h",level:N[1].length,c:ns(N[2])});continue}if(N0.test(v)&&!f.length){u.push({t:"hr"});continue}if(cc.test(v)&&(!f.length||!/^\s/.test(v))){h(),p=E0(c,p,u)-1;continue}f.push(v.trim())}return h(),u}const ac=l=>/\d/.test(l)?"ol":"ul";function E0(l,c,u){var N;const f=cc.exec(l[c]),h=f[1].length,p={t:ac(f[2]),start:ac(f[2])==="ol"?parseInt(f[2],10):1,items:[]},v=[],C=[];for(;c<l.length;c++){const S=l[c];if(!S.trim()){const M=l.slice(c+1).find(D=>D.trim());if(M&&cc.test(M)&&cc.exec(M)[1].length>=h)continue;break}const y=cc.exec(S);if(y&&y[1].length<=h+1){if(ac(y[2])!==p.t)break;p.items.push({c:[]}),v.push([y[3]]),C.push({list:{t:"ul",start:1,items:[]},texts:[]});continue}if(!p.items.length)break;const b=C[C.length-1];if(y){b.list.items.length||(b.list={t:ac(y[2]),start:ac(y[2])==="ol"?parseInt(y[2],10):1,items:[]}),b.list.items.push({c:[]}),b.texts.push([y[3]]);continue}if(!/^\s/.test(S)&&!((N=l[c-1])!=null&&N.trim()))break;(b.texts.length?b.texts[b.texts.length-1]:v[v.length-1]).push(S.trim())}return p.items.forEach((S,y)=>{S.c=ns(v[y].join(`
57
- `));const b=C[y];b.list.items.length&&(b.list.items.forEach((M,D)=>M.c=ns(b.texts[D].join(`
58
- `))),S.sub=b.list)}),u.push(p),c}function ns(l){const c=[];let u="";const f=p=>{u&&c.push({t:"text",v:u}),u="",c.push(p)};let h=0;for(;h<l.length;){const p=l[h];if(p==="\\"&&h+1<l.length&&/[\\`*_[\]()#+\-.!>~|]/.test(l[h+1])){u+=l[h+1],h+=2;continue}if(p===`
59
- `){f({t:"br"}),h++;continue}if(p==="`"){let v=1;for(;l[h+v]==="`";)v++;const C="`".repeat(v),N=l.indexOf(C,h+v);if(N>h){const S=l.slice(h+v,N);f({t:"code",v:S.length>2&&S.startsWith(" ")&&S.endsWith(" ")?S.slice(1,-1):S}),h=N+v;continue}u+=C,h+=v;continue}if((p==="*"||p==="_")&&l[h+1]===p){const v=l.indexOf(p+p,h+2);if(v>h+2&&l[h+2]!==" "){f({t:"b",c:ns(l.slice(h+2,v))}),h=v+2;continue}}else if(p==="*"||p==="_"){const v=p==="*"||!/\w/.test(l[h-1]??"");let C=-1;for(let N=h+1;N<l.length;N++)if(l[N]===p&&l[N+1]!==p&&l[N-1]!==" "&&(p==="*"||!/\w/.test(l[N+1]??""))){C=N;break}if(v&&C>h+1&&l[h+1]!==" "&&!l.slice(h+1,C).includes(`
60
- `)){f({t:"i",c:ns(l.slice(h+1,C))}),h=C+1;continue}}if(p==="["){const v=/^\[([^\]\n]*)\]\(([^)\s]*)\)/.exec(l.slice(h));if(v){const C=T0(v[2]),N=ns(v[1]);if(C)f({t:"a",href:C,c:N});else for(const S of N)S.t==="text"?u+=S.v:f(S);h+=v[0].length;continue}}if((p==="h"||p==="H")&&!/\w/.test(l[h-1]??"")){const v=/^https?:\/\/[^\s<>"`]+/i.exec(l.slice(h));if(v){const C=v[0].replace(/[.,;:!?)\]'"]+$/,"");f({t:"a",href:C,c:[{t:"text",v:C}]}),h+=C.length;continue}}u+=p,h++}return u&&c.push({t:"text",v:u}),c}function Ws({c:l}){return s.jsx(s.Fragment,{children:l.map((c,u)=>c.t==="text"?c.v:c.t==="code"?s.jsx("code",{className:c.v.length>24?"long":void 0,children:c.v},u):c.t==="b"?s.jsx("strong",{children:s.jsx(Ws,{c:c.c})},u):c.t==="i"?s.jsx("em",{children:s.jsx(Ws,{c:c.c})},u):c.t==="a"?s.jsx("a",{href:c.href,target:"_blank",rel:"noopener noreferrer",children:s.jsx(Ws,{c:c.c})},u):s.jsx("br",{},u))})}function vy({list:l}){const c=l.items.map((u,f)=>s.jsxs("li",{children:[s.jsx(Ws,{c:u.c}),u.sub&&s.jsx(vy,{list:u.sub})]},f));return l.t==="ol"?s.jsx("ol",{start:l.start,children:c}):s.jsx("ul",{children:c})}function M0({v:l}){const[c,u]=j.useState(!1);return s.jsxs("div",{className:"codeblock",children:[s.jsxs("button",{className:"copy",onClick:()=>{var f;return void((f=navigator.clipboard)==null?void 0:f.writeText(l).then(()=>{u(!0),window.setTimeout(()=>u(!1),1500)}))},children:[s.jsx(P,{name:"copy",size:12})," ",c?r.chat.copied:r.chat.copy]}),s.jsx("pre",{children:s.jsx("code",{children:l})})]})}const k0=({b:l})=>l.t==="p"?s.jsx("p",{children:s.jsx(Ws,{c:l.c})}):l.t==="h"?s.jsx("p",{className:`md-h h${Math.min(l.level,3)}`,role:"heading","aria-level":l.level,children:s.jsx(Ws,{c:l.c})}):l.t==="code"?s.jsx(M0,{v:l.v}):l.t==="hr"?s.jsx("hr",{}):s.jsx(vy,{list:l});function z0({text:l,className:c=""}){const u=j.useMemo(()=>C0(l),[l]);return s.jsx("div",{className:`md ${c}`,children:u.map((f,h)=>s.jsx(k0,{b:f},h))})}const by=j.createContext(()=>{}),xy=()=>j.useContext(by);function A0({children:l}){const[c,u]=j.useState([]),f=j.useCallback(h=>{const p=Date.now()+Math.random();u(v=>[...v.slice(-3),{...h,id:p}]),setTimeout(()=>u(v=>v.filter(C=>C.id!==p)),h.ms??(h.tone==="error"?6e3:3200))},[]);return s.jsxs(by.Provider,{value:f,children:[l,s.jsx("div",{className:"toasts",role:"status","aria-live":"polite",children:c.map(h=>s.jsxs("div",{className:`toast ${h.tone??"info"}`,children:[h.tone==="error"?s.jsx(P,{name:"warn"}):h.tone==="ok"?s.jsx(P,{name:"check"}):null,h.dot&&s.jsx("span",{className:"toast-dot","aria-hidden":"true"}),s.jsx("span",{children:h.text}),h.code&&s.jsx("code",{className:"toast-code",children:h.code}),h.action&&s.jsx("button",{className:"toast-action",onClick:()=>{h.action.run(),u(p=>p.filter(v=>v.id!==h.id))},children:h.action.label}),h.close&&s.jsx("button",{className:"icon-btn oc-ib toast-close","aria-label":h.close.label,title:h.close.label,onClick:()=>{var p,v;(v=(p=h.close).run)==null||v.call(p),u(C=>C.filter(N=>N.id!==h.id))},children:s.jsx(P,{name:"close",size:16})})]},h.id))})]})}function O0({menu:l,onClose:c,head:u}){const f=j.useRef(null),[h,p]=j.useState({x:0,y:0}),[v,C]=j.useState(-1);if(j.useLayoutEffect(()=>{if(!l||!f.current)return;const y=f.current.getBoundingClientRect(),b=l.right?l.x-y.width:l.x,M=l.up?l.y-y.height:l.y;p({x:Math.round(Math.max(8,Math.min(b,window.innerWidth-y.width-8))),y:Math.round(Math.max(8,Math.min(M,window.innerHeight-y.height-8)))}),C(-1),f.current.focus()},[l]),j.useEffect(()=>{if(!l)return;const y=b=>{f.current&&b.target instanceof Node&&f.current.contains(b.target)||c()};return window.addEventListener("pointerdown",y,!0),window.addEventListener("blur",c),()=>{window.removeEventListener("pointerdown",y,!0),window.removeEventListener("blur",c)}},[l,c]),!l)return null;const N=l.items,S=N.map((y,b)=>y!=="sep"&&!y.disabled?b:-1).filter(y=>y>=0);return s.jsxs("div",{ref:f,className:`menu entering ${l.className??""}`,role:"menu",tabIndex:-1,"aria-label":l.title??r.dialog.menu,style:{left:h.x,top:h.y},onKeyDown:y=>{if(y.key==="Escape")c();else if(y.key==="ArrowDown"||y.key==="ArrowUp"){y.preventDefault();const b=S.indexOf(v),M=y.key==="ArrowDown"?S[(b+1)%S.length]:S[(b-1+S.length)%S.length];C(M)}else if(y.key==="Enter"&&v>=0){const b=N[v];b!=="sep"&&(c(),b.run())}},children:[l.title&&s.jsx("div",{className:"menu-title",children:l.title}),u??l.head,N.map((y,b)=>y==="sep"?s.jsx("div",{className:"menu-sep",role:"separator"},b):s.jsxs("button",{role:y.check===void 0?"menuitem":"menuitemcheckbox","aria-checked":y.check===void 0?void 0:y.check,className:`menu-item ${v===b?"active":""} ${y.danger?"danger":""}`,disabled:y.disabled,onMouseEnter:()=>C(b),onClick:()=>{c(),y.run()},children:[s.jsx("span",{className:"menu-icon",children:y.icon&&s.jsx(P,{name:y.icon,size:16})}),s.jsx("span",{className:"menu-label",children:y.label}),y.check!==void 0&&s.jsx("span",{className:`menu-check ${y.check?"on":""}`,"aria-hidden":"true",children:s.jsx(P,{name:"check",size:14})}),y.shortcut&&s.jsx("kbd",{children:y.shortcut})]},b))]})}function D0({state:l,onClose:c}){const[u,f]=j.useState(""),[h,p]=j.useState(!1),v=j.useRef(null),C=j.useRef(null);if(j.useEffect(()=>{var y;l&&(l.kind==="prompt"?(f(l.value),p(((y=l.extra)==null?void 0:y.checked)??!1),setTimeout(()=>{var b;return(b=v.current)==null?void 0:b.select()},0)):setTimeout(()=>{var b;return(b=C.current)==null?void 0:b.focus()},0))},[l]),!l)return null;const N=()=>{l.kind==="prompt"?l.resolve(null):l.resolve(!1),c()},S=()=>{l.kind==="prompt"?l.resolve({value:u,extra:h}):l.resolve(!0),c()};return s.jsx("div",{className:"dialog-backdrop",onPointerDown:y=>y.target===y.currentTarget&&N(),children:s.jsxs("div",{className:"dialog",role:"dialog","aria-modal":"true","aria-label":l.title,onKeyDown:y=>{y.key==="Escape"&&N(),y.key==="Enter"&&!y.nativeEvent.isComposing&&S()},children:[s.jsx("h2",{children:l.title}),l.kind==="prompt"?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"dialog-field",children:[l.label&&s.jsx("span",{children:l.label}),s.jsx("input",{ref:v,value:u,onChange:y=>f(y.target.value)})]}),l.hint&&s.jsx("p",{className:"muted",children:l.hint}),l.extra&&s.jsxs("label",{className:"check",children:[s.jsx("input",{type:"checkbox",checked:h,onChange:y=>p(y.target.checked)}),l.extra.label]})]}):s.jsx("p",{children:l.body}),s.jsxs("div",{className:"dialog-actions",children:[s.jsx("button",{onClick:N,children:r.dialog.cancel}),s.jsx("button",{ref:C,className:l.kind==="confirm"&&l.danger?"danger primary":"primary",onClick:S,children:l.ok})]})]})})}function R0(){const[l,c]=j.useState(null);return{state:l,close:()=>c(null),prompt:h=>new Promise(p=>c({kind:"prompt",value:h.value??"",ok:h.ok??r.dialog.ok,...h,resolve:p})),confirm:h=>new Promise(p=>c({kind:"confirm",ok:h.ok??r.dialog.ok,...h,resolve:p}))}}const Gp=l=>`design-canvas:open:${l}`;function Js({id:l,title:c,count:u,defaultOpen:f=!1,right:h,variant:p="head",children:v}){const[C,N]=j.useState(()=>{try{const M=localStorage.getItem(Gp(l));return M==null?f:M==="1"}catch{return f}}),S=()=>{N(M=>{try{localStorage.setItem(Gp(l),M?"0":"1")}catch{}return!M})},b=u!==void 0&&u!==""&&s.jsx("span",{className:`collapsible-count ${typeof u=="string"?"oc-off":""}`,children:u});return p==="row"?s.jsxs("div",{className:`pp-foldset ${C?"open":""}`,children:[s.jsxs("button",{className:"pp-fold","aria-expanded":C,"aria-controls":`sec-${l}`,onClick:S,children:[s.jsx("span",{className:"pp-l",children:c}),s.jsxs("span",{className:"pp-v",children:[b,s.jsx(P,{name:"chevronRight",size:14,className:"chev"})]})]}),C&&s.jsx("div",{className:"pp-fold-body",id:`sec-${l}`,children:v})]}):s.jsxs("section",{className:`pp-group collapsible ${C?"open":""}`,children:[s.jsxs("div",{className:"collapsible-head",children:[s.jsxs("button",{className:"pp-fold-h","aria-expanded":C,"aria-controls":`sec-${l}`,onClick:S,children:[s.jsx(P,{name:"chevronRight",size:14,className:"chev"}),s.jsx("span",{className:"collapsible-title",children:c}),b]}),h&&s.jsx("span",{className:"collapsible-right",children:h})]}),C&&s.jsx("div",{className:"pp-fold-body",id:`sec-${l}`,children:v})]})}function Bl(l,c="button"){if(l)for(const u of Array.from(l.querySelectorAll(c))){u.style.width="";const f=u.getBoundingClientRect().width;f%1>.01&&(u.style.width=`${Math.ceil(f)}px`)}}function wy(l,c){const[u,f]=j.useState(null);return j.useLayoutEffect(()=>{const h=l.current;if(!h)return;Bl(h);const p=Math.max(8,Math.round((c-h.offsetWidth)/2));p!==u&&f(p)}),u}const Fs={claude:"Claude Code",codex:"Codex",cursor:"Cursor Agent",gemini:"Gemini CLI"},_0=Object.entries(Fs).map(([l,c])=>({id:l,label:c,ok:!0})),B0={claude:"claude",codex:"codex",cursor:"cursor-agent",gemini:"gemini"},qp={claude:"claude auth login",codex:"codex login",cursor:"cursor-agent login",gemini:"gemini"},U0={claude:"npm install -g @anthropic-ai/claude-code",codex:"npm install -g @openai/codex",cursor:"curl https://cursor.com/install -fsS | bash",gemini:"npm install -g @google/gemini-cli"},H0={claude:["opus","sonnet","haiku"],codex:[],cursor:[],gemini:["gemini-2.5-pro","gemini-2.5-flash"]},Zr={changed:0,added:1,removed:2},L0=l=>Fs[l]?`var(--agent-${l})`:"var(--line-strong)",Xp=(l,c)=>{try{const u=localStorage.getItem(l);return u==null?c:JSON.parse(u)}catch{return c}},Vp=(l,c)=>{try{localStorage.setItem(l,JSON.stringify(c))}catch{}},Kp=l=>new Date(l).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"}),Zp=l=>new Date(l).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}),$0=l=>(l.split(/[\\/]/).filter(Boolean).pop()??l)+"/";function _f({text:l}){return s.jsx(s.Fragment,{children:l.split("`").map((c,u)=>u%2?s.jsx("code",{children:c},u):c)})}function Bf(l,c){const u=[...l.parts],f=u[u.length-1],h={...l};if(c.kind==="delta")(f==null?void 0:f.t)==="text"?u[u.length-1]={t:"text",text:f.text+c.text}:u.push({t:"text",text:c.text});else if(c.kind==="break")(f==null?void 0:f.t)==="text"&&f.text&&u.push({t:"text",text:""});else if(c.kind==="text")u.push({t:"text",text:c.text});else if(c.kind==="plain")(f==null?void 0:f.t)==="plain"?u[u.length-1]={t:"plain",text:`${f.text}
61
- ${c.text}`}:u.push({t:"plain",text:c.text});else if(c.kind==="tool")u.push({t:"tool",name:c.name,detail:c.detail});else if(c.kind==="permission"){const{kind:p,...v}=c,C=u.findIndex(N=>N.t==="perm"&&N.id===c.id);C>=0?u[C]={...u[C],...v}:u.push({t:"perm",...v})}else if(c.kind==="permission-answered"){const p=u.findIndex(v=>v.t==="perm"&&v.id===c.id);p>=0&&(u[p]={...u[p],decision:c.decision})}else if(c.kind==="error"&&c.cause){for(let p=u.length-1;p>=0;p--)u[p].t==="error"&&u.splice(p,1);u.push({t:"error",text:c.text,cause:c.cause,raw:c.raw,changed:c.changed})}else c.kind==="error"?u.push({t:"error",text:c.text}):c.kind==="done"?h.cost=c.cost:c.kind==="start"?h.variants=c.variants:c.kind==="run-undo"?h.undone=c.undone:c.kind==="end"&&(h.status=c.status,h.step=c.step,h.boards=c.boards);return h.parts=u.filter(p=>p.t!=="text"&&p.t!=="plain"||p.text),h}function Y0(l){const[c,u]=j.useState([]),[f,h]=j.useState(!1),[p,v]=j.useState(null),[C,N]=j.useState(!1),[S,y]=j.useState(null),[b,M]=j.useState(!1),[D,q]=j.useState(()=>Xp("design-canvas:models",{})),[K,T]=j.useState(!1),[R,W]=j.useState(null),[ne,F]=j.useState(()=>{try{return localStorage.getItem("design-canvas:agent")??"claude"}catch{return"claude"}}),[fe,ie]=j.useState([]),[ue,te]=j.useState(null),[ce,je]=j.useState({}),[Ce,lt]=j.useState(!0),[zt,At]=j.useState(!0),[et,he]=j.useState(!0),[pe,Se]=j.useState(1),[Me,ke]=j.useState(null),[ct,G]=j.useState(null),[J,k]=j.useState(null),[U,ae]=j.useState(null),[B,re]=j.useState(!1),[oe,de]=j.useState({}),[se,ve]=j.useState(null),[gt,at]=j.useState(null),[Nt,it]=j.useState(null),[Ee,$e]=j.useState(null),bn=j.useRef(null),Ul=j.useRef(null),Tt=j.useRef(null),cn=j.useRef(null),jl=j.useRef(null),Sl=j.useRef(null);Sl.current=ue;const sa=j.useRef(new Map),Un=l.storeKey?`easel:chat:${l.storeKey}`:null,il=j.useRef(0),Hl=j.useCallback((z=!1)=>{h(!0);const H=++il.current;Te.get("/api/agents").then(xe=>{H===il.current&&(u(xe.agents),v({at:xe.checkedAt,onOpen:z}))}).catch(()=>{}).finally(()=>H===il.current&&h(!1))},[]);j.useEffect(()=>{l.open&&Hl(!0)},[l.open,Hl]),j.useEffect(()=>{try{localStorage.setItem("design-canvas:agent",ne)}catch{}},[ne]),j.useEffect(()=>Vp("design-canvas:models",D),[D]),j.useEffect(()=>{if(!C)return;const z=xe=>{const me=ze=>ze.current&&xe.target instanceof Node&&ze.current.contains(xe.target);me(Tt)||me(cn)||N(!1)},H=()=>N(!1);return window.addEventListener("pointerdown",z,!0),window.addEventListener("resize",H),()=>{window.removeEventListener("pointerdown",z,!0),window.removeEventListener("resize",H)}},[C]),j.useEffect(()=>{var z,H;C&&((H=(z=cn.current)==null?void 0:z.querySelector('[aria-checked="true"], [role^="menuitem"]'))==null||H.focus())},[C]);const xn=()=>{var z,H;N(!1),(H=(z=Tt.current)==null?void 0:z.querySelector(".agent-btn"))==null||H.focus()},xi=z=>{if(z.key==="Escape")return xn();if(z.key!=="Tab"||!cn.current)return;const H=Array.from(cn.current.querySelectorAll("button:not(:disabled), a[href]"));z.target===H[z.shiftKey?0:H.length-1]&&(z.preventDefault(),xn())},Ra=z=>{const H=z.getBoundingClientRect();y({right:Math.round(window.innerWidth-H.right),top:Math.round(H.bottom+4)}),N(xe=>!xe)},_a=(z,H)=>{var xe;(xe=navigator.clipboard)==null||xe.writeText(H).then(()=>{W(z),window.setTimeout(()=>W(me=>me===z?null:me),1500)})},rn=j.useRef(new Set),Hn=j.useRef(new Map),Ll=j.useRef(()=>{});j.useEffect(()=>l.subscribe((z,H)=>{if(H.kind==="boot")return k(H.boot);if(!rn.current.has(z)){Hn.current.set(z,[...Hn.current.get(z)??[],H]);return}Ll.current(z,H)}),[l.subscribe]),Ll.current=(z,H)=>{if(ie(me=>me.map(ze=>ze.role==="ai"&&ze.id===z?Bf(ze,H):ze)),H.kind==="end"&&te(me=>me===z?null:me),H.kind==="session"){const me=fe.find(ze=>ze.role==="ai"&&ze.id===z);me&&je(ze=>({...ze,[me.agent]:H.id}))}H.kind==="error"&&(H.cause==="signin"||H.cause==="missing")&&Hl();const xe=sa.current.get(z);H.kind==="end"&&H.status==="error"&&xe&&!l.draft.trim()&&!l.attach.comments.length&&!l.attach.refs.length&&(l.setDraft(xe.text),l.setAttach(()=>xe.attach),T(!0))},j.useEffect(()=>{Te.get("/api/chat/runs?ids=").then(z=>k(H=>H??z.boot)).catch(()=>{})},[]),j.useEffect(()=>{var H;if(!Un||B)return;const z=Xp(Un,null);(H=z==null?void 0:z.msgs)!=null&&H.length&&(ie(z.msgs),je(z.sessions??{})),ae((z==null?void 0:z.boot)??null),re(!0)},[Un,B]),j.useEffect(()=>{B&&Un&&Vp(Un,{msgs:fe.slice(-100),sessions:ce,boot:J??U})},[B,Un,fe,ce,J,U]),j.useEffect(()=>{if(!B||!J)return;const z=!!U&&U!==J;ae(J),ie(me=>{if(!z||!me.length)return me;const ze=me.map(We=>We.role==="ai"&&We.status==="running"?{...We,status:"cancelled"}:We);return ze[ze.length-1].role==="restart"?ze:[...ze,{role:"restart",at:J}]});const H=fe.filter(me=>me.role==="ai");for(const me of H)me.status==="running"&&!z&&!rn.current.has(me.id)&&Te.get(`/api/chat?id=${encodeURIComponent(me.id)}`).then(ze=>{rn.current.add(me.id),ie(We=>We.map(Be=>Be.role==="ai"&&Be.id===me.id?ze.events.reduce(Bf,{...Be,parts:[]}):Be)),ze.events.some(We=>We.kind==="end")||te(me.id)});const xe=H.filter(me=>me.step).map(me=>me.id);xe.length&&Te.get(`/api/chat/runs?ids=${xe.join(",")}`).then(me=>de(ze=>({...ze,...me.runs}))).catch(()=>{})},[B,J]),j.useEffect(()=>{const z=bn.current;z&&z.scrollHeight-z.scrollTop-z.clientHeight<160&&(z.scrollTop=z.scrollHeight)},[fe]);const $l=Ce?l.selection:null,Nl=zt?l.boards:[],Fn=Nl.length===1||!Nl.length&&!!$l,rt=c.length?c:_0,Ke=rt.find(z=>z.id===ne),Pt=(Ke==null?void 0:Ke.label)??Fs[ne]??ne,Tl=ne.startsWith("custom:"),Yl=D[ne]??"",sl=(Ke==null?void 0:Ke.status)==="signin"?r.chat.sendNeedsSignin(Pt):(Ke==null?void 0:Ke.status)==="missing"?r.chat.sendNeedsInstall(Pt):null,Et=fe.find(z=>z.role==="ai"&&z.id===ue),Gl=!!(Et!=null&&Et.parts.some(z=>z.t==="perm"&&!z.decision)),oa=async(z=l.draft.trim(),H=l.attach)=>{if(!z||ue||sl)return;G(null);const xe=[...$l?[r.chat.chipElement($l.tag)]:[],...Nl.map(me=>l.titleOf(me)),...et&&l.visibleCount?[r.chat.chipVisible(l.visibleCount)]:[],...H.comments.map(me=>r.chat.chipComment(me.text.slice(0,16))),...H.refs.map(me=>me.name??me.value),...pe>1?[r.chat.variants(pe)]:[]];try{const me=await Te.post("/api/chat",{agent:ne,text:z,model:Tl?void 0:Yl.trim()||void 0,resume:ce[ne],variants:Fn?pe:0,attach:{selection:!!$l,boards:Nl,visible:et,comments:H.comments.map(ze=>ze.id),refs:H.refs}});sa.current.set(me.id,{text:z,attach:H}),T(!1),ie(ze=>[...ze,{role:"user",text:z,chips:xe},{role:"ai",id:me.id,agent:ne,label:Pt,parts:[],status:"running",boot:J??void 0}]),te(me.id),rn.current.add(me.id);for(const ze of Hn.current.get(me.id)??[])Ll.current(me.id,ze);Hn.current.delete(me.id),l.setDraft(""),l.setAttach(()=>({comments:[],refs:[]})),Se(1),me.variants.length&&l.onLocate(me.variants)}catch(me){G(me.message)}},ol=()=>ue&&Te.post("/api/chat/cancel",{id:ue}).catch(()=>{}),Gt=z=>{const H=sa.current.get(z);l.draft.trim()||!H?oa():oa(H.text,H.attach)},wn=(z,H)=>ie(xe=>xe.map(me=>me.role==="ai"&&me.id===z?H(me):me)),Rt=(z,H,xe)=>{wn(z,me=>Bf(me,{kind:"permission-answered",id:H,decision:xe})),Te.post("/api/chat/permission/answer",{id:H,decision:xe}).catch(me=>G(me.message))},ca=async(z,H,xe)=>{var me;at(z);try{await Te.post(`/api/chat/${H}-run`,{id:z,mode:xe}),ve(null),wn(z,ze=>({...ze,undone:H==="undo"}))}catch(ze){const We=ze;We.status===409&&((me=We.body)!=null&&me.conflicts)?ve({id:z,kind:H,names:[...new Set(We.body.conflicts.map(Be=>Be.file.endsWith(".html")?l.titleOf(Be.file):Be.file))]}):G(We.message)}finally{at(null)}},wi=async(z,H)=>{if(await l.confirm({title:r.chat.restoreTitle,body:r.chat.restoreBody(Zp(H)),ok:r.chat.restoreOk,danger:!0}))try{await Te.post("/api/chat/revert",{id:z.id}),wn(z.id,xe=>({...xe,restored:!0}))}catch(xe){G(xe.message)}},ls=z=>it({id:z.id,boards:[...z.boards??[]].sort((H,xe)=>Zr[H.kind]-Zr[xe.kind]).map(H=>({...H,title:l.titleOf(H.file),...l.sizeOf(H.file)??{w:390,h:844}}))}),ql=async()=>{if(Ee)try{const z=await Te.post("/api/agents/custom",{name:Ee.name,command:Ee.command});u(H=>[...H.filter(xe=>xe.id!==z.agent.id),z.agent]),F(z.agent.id),$e(null)}catch(z){$e(H=>H&&{...H,error:z.message})}},ra=async z=>{await Te.post("/api/agents/custom",{action:"delete",id:z}).catch(()=>{}),u(H=>H.filter(xe=>xe.id!==z)),ne===z&&F("claude")},En=z=>z.status?r.chat.agentStatus[z.status]:f?r.chat.checking:"",Mn=(Ke==null?void 0:Ke.status)==="signin"?{text:r.chat.remedySignin(Pt,qp[ne]??`${ne} login`),cmd:qp[ne]??`${ne} login`}:(Ke==null?void 0:Ke.status)==="missing"?{text:r.chat.remedyMissing(Tl?(Ke.command??"").split(/\s+/)[0]:B0[ne]??ne),cmd:Tl?null:U0[ne]??ne}:null,Ln=async z=>{for(const H of Array.from(z)){if(H.size>15*1024*1024){G(r.chat.tooBig(H.name));continue}const xe=await new Promise(me=>{const ze=new FileReader;ze.onload=()=>me(String(ze.result).split(",")[1]??""),ze.readAsDataURL(H)});try{const me=await Te.post("/api/refs",{name:H.name||r.defaults.pastedImage,data:xe});l.setAttach(ze=>({...ze,refs:[...ze.refs,me]}))}catch(me){G(me.message)}}},Wn=z=>{const H=[...z.boards??[]].sort((Ue,Ot)=>Zr[Ue.kind]-Zr[Ot.kind]),xe=H.filter(Ue=>Ue.kind!=="added").length,me=H.filter(Ue=>Ue.kind==="added").length,ze=r.chat.runChanged(xe,me),We=!!J&&!!z.boot&&z.boot!==J,Be=oe[z.id],Ye=(se==null?void 0:se.id)===z.id?se:null;if(z.restored)return s.jsx("div",{className:"run-result undone",children:s.jsx("div",{className:"oc-rr-top",children:s.jsxs("span",{className:"rr-line",children:[s.jsx(P,{name:"restore",size:14})," ",r.chat.restoredCopy]})})});if(We)return s.jsxs("div",{className:"run-result",children:[s.jsx("div",{className:"oc-rr-top",children:s.jsx("span",{className:"rr-line",children:ze})}),Be===void 0?null:Be.copy?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"btn-row",children:s.jsxs("button",{className:"btn",onClick:()=>void wi(z,Be.copy.at),children:[s.jsx(P,{name:"restore",size:14})," ",r.chat.restoreCopy]})}),s.jsx("p",{className:"sub",children:r.chat.savedAt(Zp(Be.copy.at))})]}):s.jsx("p",{className:"sub",children:r.chat.copyGone})]});const un=Ye&&s.jsxs("div",{className:"rr-conflict",role:"alert",children:[s.jsx("p",{children:(Ye.kind==="undo"?r.chat.conflictUndo:r.chat.conflictRedo)(Ye.names.join(", "))}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn",onClick:()=>void ca(z.id,Ye.kind,"rest"),children:Ye.kind==="undo"?r.chat.undoRest:r.chat.redoRest}),s.jsx("button",{className:"btn danger",onClick:()=>void ca(z.id,Ye.kind,"all"),children:Ye.kind==="undo"?r.chat.undoAll:r.chat.redoAll}),s.jsx("button",{className:"btn",onClick:()=>ve(null),children:r.chat.cancel})]})]});return z.undone?s.jsxs("div",{className:"run-result undone",children:[s.jsx("div",{className:"oc-rr-top",children:s.jsxs("span",{className:"rr-line",children:[s.jsx(P,{name:"undo",size:14})," ",r.chat.runUndone(H.length)]})}),s.jsx("div",{className:"btn-row",children:s.jsxs("button",{className:"btn",disabled:gt===z.id||!!ue,onClick:()=>void ca(z.id,"redo"),children:[s.jsx(P,{name:"redo",size:14})," ",r.chat.redo]})}),un]}):s.jsxs("div",{className:"run-result",children:[s.jsxs("div",{className:"oc-rr-top",children:[s.jsx("span",{className:"rr-line",children:ze}),H.map(Ue=>Ue.kind==="removed"?s.jsxs("span",{className:"chip",children:[s.jsx(P,{name:"board",size:12})," ",r.chat.chipRemoved(l.titleOf(Ue.file))]},Ue.file):s.jsxs("button",{className:"chip",title:Ue.file,onClick:()=>l.onLocate([Ue.file]),children:[s.jsx(P,{name:"board",size:12})," ",Ue.kind==="added"?r.chat.chipNew(l.titleOf(Ue.file)):l.titleOf(Ue.file)]},Ue.file))]}),s.jsxs("div",{className:"btn-row",children:[s.jsxs("button",{className:"btn",disabled:gt===z.id||!!ue,onClick:()=>void ca(z.id,"undo"),children:[s.jsx(P,{name:"undo",size:14})," ",r.chat.undoRun]}),H.length>0&&s.jsxs("button",{className:"btn",onClick:()=>ls(z),children:[s.jsx(P,{name:"compare",size:14})," ",r.chat.compare]})]}),un]})},ua=(z,H)=>H.decision?s.jsxs("div",{className:"perm-done",title:H.subject,children:[s.jsx(P,{name:H.decision==="deny"?"close":"check",size:14,className:H.decision==="deny"?"no":"ok"}),s.jsxs("span",{children:[r.chat.permDone[H.decision]," · ",H.tool," ",H.what==="tool"?null:s.jsx("code",{children:H.subject}),H.outside?` ${r.chat.permDoneOutside}`:""]})]}):s.jsxs("div",{className:"perm",role:"group","aria-label":r.chat.permAsk(z.label??Fs[z.agent]??z.agent,H.what,H.tool),children:[s.jsxs("div",{className:"perm-head",children:[s.jsx("span",{className:"idot","aria-hidden":"true"}),r.chat.permAsk(z.label??Fs[z.agent]??z.agent,H.what,H.tool)]}),s.jsx("div",{className:"perm-cmd",children:H.subject}),s.jsxs("div",{className:"perm-where",title:H.where,children:[s.jsx(P,{name:"folder",size:14})," ",r.chat.permIn," ",s.jsx("code",{children:$0(H.where)}),H.outside&&s.jsxs("span",{className:"perm-outside",children:["· ",r.chat.permOutside]})]}),s.jsxs("div",{className:`btn-row ${H.rule?"":"oc-one"}`,children:[s.jsx("button",{className:"btn primary",onClick:()=>Rt(z.id,H.id,"once"),children:r.chat.allowOnce}),H.rule&&s.jsx("button",{className:"btn",title:r.chat.alwaysAllowTitle,onClick:()=>Rt(z.id,H.id,"always"),children:r.chat.alwaysAllow(H.rule)}),s.jsx("button",{className:"btn",onClick:()=>Rt(z.id,H.id,"deny"),children:r.chat.deny})]})]}),ut=fe.map(z=>z.role==="ai"?`${z.status}${z.undone?"u":""}${z.restored?"r":""}${z.parts.length}`:z.role).join(),$n=j.useCallback(()=>{Bl(jl.current,".chat-head .new-chat, .rr-line, .chip, .bubble, .btn-row .btn, .oc-variants, .run-status > *"),Bl(cn.current,".agent-status, .menu-foot .btn")},[]);j.useLayoutEffect($n,[$n,ut,ue,ne,C,l.open,l.attach,l.selection,l.boards,l.visibleCount,R,oe,se,f,c,Ce,zt,et]),j.useEffect(()=>{const z=jl.current;if(!z)return;const H=new ResizeObserver($n);return H.observe(z),()=>H.disconnect()},[$n]);const ji=(z,H)=>{const xe=[];let me=[],ze=0;const We=()=>{me.length&&xe.push(s.jsx("div",{className:"oc-tools",children:me},`t${ze}`)),me=[]};return z.parts.forEach((Be,Ye)=>{if(Be.t==="tool"||Be.t==="perm"&&Be.decision){me.length||(ze=Ye);const un=z.status==="running"&&Ye===z.parts.length-1;me.push(Be.t==="tool"?s.jsxs("div",{className:`ai-tool ${un?"is-current":""}`,children:[s.jsx(P,{name:"edit",size:14}),s.jsx("span",{children:Be.name}),Be.detail&&s.jsx("code",{children:Be.detail})]},Ye):s.jsx(j.Fragment,{children:ua(z,Be)},Ye));return}We(),xe.push(Be.t==="text"?s.jsx(z0,{className:"ai-text",text:Be.text},Ye):Be.t==="plain"?s.jsx("pre",{className:"ai-plain",children:Be.text},Ye):Be.t==="perm"?s.jsx(j.Fragment,{children:ua(z,Be)},Ye):Be.cause?s.jsxs("div",{className:"ai-fail",children:[s.jsx("div",{className:"ai-error",children:s.jsx("span",{children:s.jsx(_f,{text:Be.text})})}),H&&s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn",disabled:!!ue||!!sl,title:sl??void 0,onClick:()=>Gt(z.id),children:r.chat.retry}),(()=>{const un=rt.find(Ue=>Ue.id!==z.agent&&Ue.status!=="missing"&&Ue.ok&&!Ue.custom);return un&&un.id!==ne?s.jsx("button",{className:"btn",onClick:()=>F(un.id),children:r.chat.switchTo(un.label)}):null})()]}),Be.raw&&s.jsxs("details",{className:"ai-details",children:[s.jsxs("summary",{children:[s.jsx(P,{name:"chevronDown",size:14}),r.chat.details]}),s.jsx("div",{className:"ai-details-bar",children:s.jsxs("button",{className:"btn copy",onClick:()=>_a(`raw-${z.id}`,Be.raw),children:[s.jsx(P,{name:"copy",size:12})," ",R===`raw-${z.id}`?r.chat.copied:r.chat.copy]})}),s.jsx("pre",{children:Be.raw})]}),Be.changed===!1&&s.jsx("p",{className:"muted small",children:r.chat.noFilesChanged})]},Ye):s.jsxs("div",{className:"ai-error",children:[s.jsx(P,{name:"warn",size:14})," ",Be.text]},Ye))}),We(),xe};return s.jsxs("section",{className:"chat","aria-label":r.chat.aria,ref:jl,children:[s.jsxs("div",{className:`chat-head ${b?"is-scrolled":""}`,children:[s.jsxs("div",{className:"chat-head-row oc-field",children:[s.jsx("span",{className:"pp-l",children:r.chat.agent}),s.jsx("div",{className:"agent-pick",ref:Tt,children:s.jsxs("button",{className:`agent-btn ${C?"is-open":""}`,"aria-haspopup":"menu","aria-expanded":C,"aria-label":r.chat.agentButton(Pt,Ke?En(Ke):""),title:r.chat.agentHint,disabled:!!ue,onClick:z=>Ra(z.currentTarget),onKeyDown:z=>z.key==="Escape"&&N(!1),children:[s.jsx("span",{className:`dot ${(Ke==null?void 0:Ke.status)??""}`,"aria-hidden":"true"}),s.jsx("span",{className:"agent-name",children:Pt}),s.jsx(P,{name:"chevronDown",size:14})]})})]}),s.jsxs("div",{className:"chat-head-row oc-field",children:[s.jsx("span",{className:"pp-l",children:Tl?r.chat.customCommandLabel:r.chat.model}),Tl?s.jsx("span",{className:"model-field mono custom-cmd",title:Ke==null?void 0:Ke.command,children:Ke==null?void 0:Ke.command}):s.jsxs(s.Fragment,{children:[s.jsx("input",{className:"model-field",list:`models-${ne}`,value:Yl,placeholder:r.chat.modelDefault,"aria-label":r.chat.model,title:r.chat.modelTitle(Pt),disabled:!!ue,spellCheck:!1,onChange:z=>q(H=>({...H,[ne]:z.target.value}))}),s.jsx("datalist",{id:`models-${ne}`,children:(H0[ne]??[]).map(z=>s.jsx("option",{value:z},z))})]})]}),s.jsxs("div",{className:"chat-head-row sub",children:[s.jsx("span",{className:"muted small",children:ue?r.chat.running:ce[ne]?r.chat.continuing:r.chat.newConversation}),s.jsx("div",{className:"spacer"}),s.jsxs("button",{className:"icon-btn sm new-chat","aria-label":r.chat.newChat,title:r.chat.newChat,disabled:!!ue||!fe.length&&!ce[ne],onClick:()=>{ie([]),je({}),T(!1),ve(null),M(!1)},children:[s.jsx(P,{name:"plus",size:14})," ",s.jsx("span",{children:r.chat.newChat})]})]})]}),C&&S&&Rf.createPortal(s.jsxs("div",{ref:cn,className:"menu agent-menu oc-agent-menu entering",role:"menu","aria-label":r.chat.agent,style:{right:S.right,top:S.top},onKeyDown:xi,children:[rt.map(z=>s.jsxs("div",{className:`menu-item agent-item ${z.status==="missing"?"off":""}`,role:"none",children:[s.jsxs("button",{role:"menuitemradio","aria-checked":z.id===ne,className:"agent-choose",title:z.custom&&z.command?r.chat.customCommandTitle(z.command):void 0,onClick:()=>{F(z.id),N(!1)},children:[s.jsx("span",{className:`menu-check ${z.id===ne?"on":""}`,"aria-hidden":"true",children:s.jsx(P,{name:"check",size:14})}),s.jsx("span",{className:"idot",style:{background:L0(z.id)},"aria-hidden":"true"}),s.jsx("span",{className:"menu-label",children:z.label})]}),s.jsxs("span",{className:`agent-status ${z.status==="missing"?"off":z.status??""}`,children:[z.status&&z.status!=="missing"&&s.jsx("span",{className:`dot ${z.status}`,"aria-hidden":"true"}),En(z),z.status==="missing"&&z.install&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("a",{className:"link",href:z.install,target:"_blank",rel:"noopener noreferrer",children:r.chat.howToInstall})]})]}),z.custom&&s.jsx("button",{className:"icon-btn sm oc-remove","aria-label":r.chat.remove(z.label),title:r.chat.remove(z.label),onClick:()=>void ra(z.id),children:s.jsx(P,{name:"close",size:12})})]},z.id)),s.jsx("div",{className:"menu-sep",role:"separator"}),s.jsxs("button",{role:"menuitem",className:"menu-item oc-custom",onClick:()=>{N(!1),$e({name:"",command:""})},children:[s.jsx("span",{className:"menu-check on muted","aria-hidden":"true",children:s.jsx(P,{name:"plus",size:14})}),s.jsx("span",{className:"menu-label",children:r.chat.customCommand})]}),s.jsxs("div",{className:"menu-foot",children:[s.jsx("span",{children:f?r.chat.checking:p?r.chat.checkedAt(Kp(p.at),p.onOpen):r.chat.checkedOnOpen}),s.jsx("button",{className:"btn",disabled:f,onClick:()=>Hl(),children:r.chat.checkAgain})]})]}),document.body),Ee&&Rf.createPortal(s.jsx("div",{className:"dialog-backdrop",onPointerDown:z=>z.target===z.currentTarget&&$e(null),children:s.jsxs("div",{className:"dialog cf",role:"dialog","aria-modal":"true","aria-label":r.chat.customTitle,onKeyDown:z=>z.key==="Escape"&&$e(null),children:[s.jsxs("h2",{className:"cf-title",children:[s.jsx("span",{className:"idot","aria-hidden":"true"}),r.chat.customTitle]}),s.jsxs("label",{className:"dialog-field",children:[r.chat.customName,s.jsx("input",{autoFocus:!0,value:Ee.name,placeholder:r.chat.customNamePlaceholder,onChange:z=>$e({...Ee,name:z.target.value,error:void 0})})]}),s.jsxs("label",{className:"dialog-field",children:[r.chat.customCommandLabel,s.jsx("input",{className:"mono",value:Ee.command,spellCheck:!1,placeholder:r.chat.customCommandPlaceholder,onChange:z=>$e({...Ee,command:z.target.value,error:void 0}),onKeyDown:z=>z.key==="Enter"&&!z.nativeEvent.isComposing&&void ql()})]}),s.jsx("p",{className:"cf-hint",children:s.jsx(_f,{text:r.chat.customHint})}),Ee.error&&s.jsxs("p",{className:"cf-error",children:[s.jsx(P,{name:"warn",size:14})," ",Ee.error]}),s.jsxs("div",{className:"dialog-actions",children:[s.jsx("button",{onClick:()=>$e(null),children:r.chat.cancel}),s.jsx("button",{className:"primary",disabled:!Ee.name.trim()||!Ee.command.trim(),onClick:()=>void ql(),children:r.chat.customSave})]})]})}),document.body),s.jsx("div",{className:"chat-list",ref:bn,"aria-live":"polite",onScroll:z=>M(z.currentTarget.scrollTop>0),children:fe.length===0?s.jsxs("div",{className:"chat-empty",children:[s.jsx("p",{children:r.chat.intro(Pt)}),s.jsx("div",{className:"chat-suggest",children:r.chat.suggestions.map(z=>s.jsx("button",{className:"btn",onClick:()=>{l.setDraft(z.text),Se(z.n)},children:z.label},z.label))})]}):fe.map((z,H)=>{var xe;return z.role==="restart"?s.jsx("div",{className:"restart",role:"separator",children:r.chat.restarted(Kp(z.at))},H):z.role==="user"?s.jsxs("div",{className:"msg user",children:[z.chips.length>0&&s.jsx("div",{className:"chips",children:z.chips.map((me,ze)=>s.jsx("span",{className:"chip",children:me},ze))}),s.jsx("div",{className:"bubble",children:z.text})]},H):s.jsxs("div",{className:`msg ai ${z.status}`,children:[s.jsxs("div",{className:"msg-head",children:[s.jsx("strong",{children:z.label??Fs[z.agent]??z.agent}),z.status==="running"&&(z.parts.some(me=>me.t==="perm"&&!me.decision)?s.jsxs("span",{className:"waiting",children:[s.jsx("span",{className:"pulse","aria-hidden":"true"}),r.chat.waiting]}):s.jsx("span",{className:"spinner",role:"img","aria-label":r.chat.running})),z.status==="cancelled"&&s.jsx("span",{className:"muted",children:r.chat.cancelled}),z.status==="error"&&s.jsxs("span",{className:"oc-failed",children:[s.jsx(P,{name:"warn",size:14}),r.chat.failed]}),z.status==="done"&&z.cost!=null&&s.jsxs("span",{className:"muted small",children:["$",z.cost.toFixed(3)]})]}),(xe=z.variants)!=null&&xe.length?s.jsxs("button",{className:"btn oc-variants",onClick:()=>l.onLocate(z.variants),children:[s.jsx(P,{name:"board",size:14})," ",r.chat.madeVariants(z.variants.length)]}):null,ji(z,H===fe.length-1),z.status==="running"&&!z.parts.length&&s.jsx("div",{className:"muted oc-thinking",children:r.chat.thinking}),r.chat.noPause[z.agent]&&z.parts.some(me=>me.t==="tool")&&s.jsx("p",{className:"ai-note",children:r.chat.noPause[z.agent]}),z.status!=="running"&&z.step&&Wn(z)]},H)})}),Mn&&s.jsxs("div",{className:"remedy",role:"status",children:[s.jsx(P,{name:"warn",size:16}),s.jsxs("div",{children:[s.jsx("p",{children:s.jsx(_f,{text:Mn.text})}),s.jsxs("div",{className:"btn-row",children:[Mn.cmd&&s.jsxs("button",{className:"btn",onClick:()=>_a("cmd",Mn.cmd),title:Mn.cmd,children:[s.jsx(P,{name:"copy",size:14})," ",R==="cmd"?r.chat.copied:r.chat.copyCommand]}),s.jsx("button",{className:"btn",disabled:f,onClick:()=>Hl(),children:f?r.chat.checking:r.chat.checkAgain})]})]})]}),s.jsxs("div",{className:"composer",onDragOver:z=>z.preventDefault(),onDrop:z=>{z.preventDefault(),z.dataTransfer.files.length&&Ln(z.dataTransfer.files)},children:[Gl&&s.jsxs("div",{className:"run-status",role:"status",children:[s.jsxs("span",{className:"waiting",children:[s.jsx("span",{className:"pulse","aria-hidden":"true"}),r.chat.waiting]}),s.jsxs("span",{className:"muted",children:["· ",r.chat.waitingHint]})]}),s.jsxs("div",{className:"chips",children:[l.selection&&s.jsx(ic,{on:Ce,onToggle:()=>lt(z=>!z),icon:"select",label:r.chat.chipElementText(l.selection.tag,l.selection.text.slice(0,14))}),l.boards.length>0&&s.jsx(ic,{on:zt,onToggle:()=>At(z=>!z),icon:"board",label:l.boards.length===1?l.titleOf(l.boards[0]):r.chat.chipBoards(l.boards.length)}),l.visibleCount>0&&s.jsx(ic,{on:et,onToggle:()=>he(z=>!z),icon:"fit",label:r.chat.chipVisible(l.visibleCount)}),l.attach.comments.map(z=>s.jsx(ic,{on:!0,icon:"comment",label:r.chat.chipComment(z.text.slice(0,14)),onRemove:()=>l.setAttach(H=>({...H,comments:H.comments.filter(xe=>xe.id!==z.id)}))},z.id)),l.attach.refs.map((z,H)=>s.jsx(ic,{on:!0,icon:z.kind==="url"?"link":"page",label:z.name??z.value,onRemove:()=>l.setAttach(xe=>({...xe,refs:xe.refs.filter((me,ze)=>ze!==H)}))},H))]}),Me!=null&&s.jsx("div",{className:"url-row",children:s.jsx("input",{autoFocus:!0,value:Me,placeholder:"https://","aria-label":r.chat.refLink,onChange:z=>ke(z.target.value),onKeyDown:z=>{z.nativeEvent.isComposing||(z.key==="Enter"&&/^https?:\/\/\S+$/.test(Me.trim())&&(l.setAttach(H=>({...H,refs:[...H.refs,{kind:"url",value:Me.trim()}]})),ke(null)),z.key==="Escape"&&ke(null))}})}),K&&l.draft.trim()&&s.jsx("span",{className:"restored muted small",children:r.chat.restored}),s.jsx("textarea",{ref:l.inputRef,value:l.draft,rows:3,placeholder:ue?r.chat.placeholderRunning:r.chat.placeholder,"aria-label":r.chat.input,onChange:z=>l.setDraft(z.target.value),onPaste:z=>{const H=Array.from(z.clipboardData.files);H.length&&(z.preventDefault(),Ln(H))},onKeyDown:z=>{z.nativeEvent.isComposing||z.keyCode===229||(z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),oa()),z.key==="Escape"&&(ue?ol():z.target.blur()))}}),ct&&s.jsxs("p",{className:"warn small oc-err",children:[s.jsx(P,{name:"warn",size:14})," ",ct]}),sl&&!ue&&s.jsxs("p",{className:"send-why",children:[s.jsx(P,{name:"warn",size:14})," ",sl]}),s.jsxs("div",{className:"composer-bar",children:[s.jsx("button",{className:"icon-btn sm","aria-label":r.chat.attach,title:r.chat.attachTitle,onClick:()=>{var z;return(z=Ul.current)==null?void 0:z.click()},children:s.jsx(P,{name:"plus",size:14})}),s.jsx("button",{className:"icon-btn sm","aria-label":r.chat.addLink,title:r.chat.addLink,onClick:()=>ke(""),children:s.jsx(P,{name:"link",size:14})}),s.jsx("input",{ref:Ul,type:"file",multiple:!0,hidden:!0,accept:"image/*,.pdf,.md,.txt,.html,.csv,.json",onChange:z=>z.target.files&&void Ln(z.target.files)}),s.jsx("label",{className:"variants",title:Fn?r.chat.variantsTitle:r.chat.variantsDisabledTitle,children:s.jsxs("select",{value:pe,disabled:!Fn||!!ue,onChange:z=>Se(Number(z.target.value)),"aria-label":r.chat.variantsAria,children:[s.jsx("option",{value:1,children:r.chat.variants(1)}),s.jsx("option",{value:2,children:r.chat.variants(2)}),s.jsx("option",{value:3,children:r.chat.variants(3)}),s.jsx("option",{value:4,children:r.chat.variants(4)})]})}),s.jsx("div",{className:"spacer"}),ue?s.jsxs("button",{className:"btn oc-cancel",title:r.chat.cancelTitle,onClick:ol,children:[s.jsx(P,{name:"close",size:14})," ",r.chat.cancel]}):s.jsx("button",{className:"primary",disabled:!l.draft.trim()||!!sl,title:sl??void 0,onClick:()=>void oa(),children:r.chat.send})]})]}),Nt&&Rf.createPortal(s.jsx(yy,{before:x0(Nt.id),boards:Nt.boards,onClose:()=>it(null)}),document.body)]})}function ic({on:l,onToggle:c,onRemove:u,icon:f,label:h}){return s.jsxs("span",{className:`chip ${l?"on":"off"}`,children:[s.jsxs("button",{className:"chip-main",onClick:c,disabled:!c,"aria-pressed":c?l:void 0,title:c?l?r.chat.chipRemoveTitle:r.chat.chipAddTitle:void 0,children:[s.jsx(P,{name:f,size:12}),s.jsx("span",{children:h})]}),u&&s.jsx("button",{className:"chip-x","aria-label":r.chat.remove(h),onClick:u,children:s.jsx(P,{name:"close",size:12})})]})}function G0(l){const[c,u]=j.useState(null);return j.useEffect(()=>{Te.get("/api/tokens").then(u).catch(()=>{})},[l]),c}const jy=l=>Object.entries((l==null?void 0:l.themes[l.active])??{}).map(([c,u])=>({name:c,value:u}));function tu(l){const c=l.trim().toLowerCase();let u=c.match(/^#([0-9a-f]{3,8})$/);if(u){let f=u[1];return f.length<=4&&(f=[...f].map(h=>h+h).join("")),[parseInt(f.slice(0,2),16),parseInt(f.slice(2,4),16),parseInt(f.slice(4,6),16),f.length===8?parseInt(f.slice(6),16)/255:1]}return u=c.match(/^rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)(?:[ ,/]+([\d.]+))?\s*\)$/),u?[Number(u[1]),Number(u[2]),Number(u[3]),u[4]==null?1:Number(u[4])]:c==="transparent"?[0,0,0,0]:null}const Qp=([l,c,u])=>{const f=h=>{const p=h/255;return p<=.03928?p/12.92:((p+.055)/1.055)**2.4};return .2126*f(l)+.7152*f(c)+.0722*f(u)};function Pr(l,c){const u=tu(l),f=tu(c);if(!u||!f)return null;const[h,p]=[Qp(u),Qp(f)].sort((v,C)=>C-v);return(h+.05)/(p+.05)}const Qf=l=>{const c=tu(l);return c&&c[3]===1?"#"+c.slice(0,3).map(u=>Math.round(u).toString(16).padStart(2,"0")).join("").toUpperCase():null};function Jp(l,c,u){if(!(u!=null&&u.registered)||!c)return null;const f=new Set(jy(u).map(p=>Qf(p.value)));if(/^(color|background|background-color|border-color)$/.test(l)){const p=Qf(c);if(p&&!f.has(p))return r.checks.colorNotInTokens}const h=[...c.matchAll(/(-?\d+(?:\.\d+)?)px/g)].map(p=>Number(p[1]));return l==="font-size"&&h.some(p=>!u.fontSizes.includes(p))?r.checks.tokenFontSizes(u.fontSizes.join("·")):l==="border-radius"&&h.some(p=>!u.radii.includes(p)&&p<999)?r.checks.tokenRadii(u.radii.join("·")):/^(gap|padding|margin)/.test(l)&&h.some(p=>p%4!==0)?r.checks.notMultipleOf4:l==="font-weight"&&/^\d+$/.test(c)&&!u.fontWeights.includes(Number(c))?r.checks.tokenWeights(u.fontWeights.join("·")):null}function q0(l,c=48){var S,y;const u=l.defaultView,f=[],h=b=>{for(let M=b;M&&M.nodeType===1;M=M.parentElement){const D=u.getComputedStyle(M),q=tu(D.backgroundColor);if(D.backgroundImage!=="none")return"";if(q&&q[3]>.5)return D.backgroundColor}return"rgb(255,255,255)"},p=b=>{const M=b.getBoundingClientRect(),D=u.getComputedStyle(b);return M.width>0&&M.height>0&&D.visibility!=="hidden"&&D.display!=="none"},v=l.body.querySelectorAll("a[href], button, input:not([type=hidden]), select, textarea, [role=button], [role=tab], [onclick]");for(const b of Array.from(v)){if(!p(b))continue;const M=al(b);if(M==null)continue;const D=b.getBoundingClientRect();D.width<c&&D.height<c&&f.push({path:M,kind:"target",message:r.checks.smallTarget(b.tagName.toLowerCase(),Math.round(D.width),Math.round(D.height),c)});const q=(b.getAttribute("aria-label")||b.getAttribute("title")||b.getAttribute("placeholder")||b.innerText||((S=b.querySelector("img[alt]"))==null?void 0:S.getAttribute("alt"))||"").trim(),K=b.getAttribute("aria-labelledby")||b.id&&l.querySelector(`label[for="${b.id}"]`)||b.closest("label");!q&&!K&&f.push({path:M,kind:"label",message:r.checks.noName(b.tagName.toLowerCase())})}for(const b of Array.from(l.body.querySelectorAll("img")))if(!b.hasAttribute("alt")&&p(b)){const M=al(b);M!=null&&f.push({path:M,kind:"label",message:r.checks.noAlt})}const C=l.createTreeWalker(l.body,NodeFilter.SHOW_TEXT),N=new Set;for(let b=C.nextNode();b;b=C.nextNode()){const M=b.parentElement;if(!M||N.has(M)||!((y=b.textContent)!=null&&y.trim())||/^(SCRIPT|STYLE)$/.test(M.tagName)||!p(M))continue;N.add(M);const D=u.getComputedStyle(M),q=h(M);if(!q)continue;const K=Pr(D.color,q);if(K==null)continue;const T=parseFloat(D.fontSize),W=T>=24||T>=18.66&&Number(D.fontWeight)>=700?3:4.5;if(K<W){const ne=al(M);ne!=null&&f.push({path:ne,kind:"contrast",message:r.checks.lowContrast(K.toFixed(2),W,b.textContent.trim().slice(0,16))})}}return f}function X0({tokens:l,onSave:c}){const[u,f]=j.useState(l);j.useEffect(()=>f(l),[l]);const h=u.themes[u.active]??{},p=JSON.stringify(u)!==JSON.stringify(l)||!l.registered,v=N=>f({...u,themes:{...u.themes,[u.active]:N}}),C=(N,S)=>s.jsxs("label",{className:"field-row tok-list",children:[s.jsx("span",{children:S}),s.jsx("input",{defaultValue:u[N].join(", "),"aria-label":S,onBlur:y=>f({...u,[N]:y.target.value.split(/[,\s]+/).map(Number).filter(b=>Number.isFinite(b))})},u[N].join())]});return s.jsxs("div",{className:"tokens",children:[s.jsxs("label",{className:"upload small",children:[s.jsx(P,{name:"plus",size:14})," ",r.tokens.import,s.jsx("input",{type:"file",hidden:!0,accept:".json,application/json",onChange:async N=>{var y;const S=(y=N.target.files)==null?void 0:y[0];if(S)try{f(V0(JSON.parse(await S.text()),u))}catch(b){alert(r.tokens.importFailed(b.message))}}})]}),s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:r.tokens.theme}),s.jsx("button",{className:"icon-btn sm","aria-label":r.tokens.addTheme,title:r.tokens.addTheme,onClick:()=>{let N=r.tokens.newTheme;for(let S=2;u.themes[N];S++)N=r.tokens.newThemeN(S);f({...u,themes:{...u.themes,[N]:{...h}},active:N})},children:s.jsx(P,{name:"plus",size:14})})]}),s.jsxs("div",{className:"theme-row",children:[s.jsx("select",{value:u.active,onChange:N=>f({...u,active:N.target.value}),"aria-label":r.tokens.activeTheme,children:Object.keys(u.themes).map(N=>s.jsx("option",{children:N},N))}),s.jsx("input",{defaultValue:u.active,"aria-label":r.tokens.themeName,onBlur:N=>{const S=N.target.value.trim();if(!S||S===u.active||u.themes[S])return;const{[u.active]:y,...b}=u.themes;f({...u,themes:{...b,[S]:y},active:S})}},u.active)]}),s.jsxs("div",{className:"sec-head",children:[s.jsx("span",{children:r.tokens.colors(Object.keys(h).length)}),s.jsx("button",{className:"icon-btn sm","aria-label":r.tokens.addColor,title:r.tokens.addColor,onClick:()=>v({...h,[r.tokens.colorN(Object.keys(h).length+1)]:"#111111"}),children:s.jsx(P,{name:"plus",size:14})})]}),s.jsx("ul",{className:"tok-colors",children:Object.entries(h).map(([N,S])=>{var y;return s.jsxs("li",{children:[s.jsx("input",{type:"color",value:((y=Qf(S))==null?void 0:y.toLowerCase())??"#000000","aria-label":r.tokens.colorOf(N),onChange:b=>v({...h,[N]:b.target.value.toUpperCase()})}),s.jsx("input",{defaultValue:N,"aria-label":r.tokens.colorName,onBlur:b=>{const M=b.target.value.trim();!M||M===N||h[M]||v(Object.fromEntries(Object.entries(h).map(([D,q])=>D===N?[M,q]:[D,q])))}}),s.jsx("code",{children:S}),s.jsx("button",{className:"icon-btn sm danger","aria-label":r.tokens.remove(N),onClick:()=>v(Object.fromEntries(Object.entries(h).filter(([b])=>b!==N))),children:s.jsx(P,{name:"close",size:12})})]},N)})}),C("fontSizes",r.tokens.fontSizes),C("fontWeights",r.tokens.fontWeights),C("radii",r.tokens.radii),C("spacing",r.tokens.spacing),s.jsxs("label",{className:"field-row tok-list",children:[s.jsx("span",{children:r.tokens.touchTarget}),s.jsx("input",{type:"number",value:u.minTarget,onChange:N=>f({...u,minTarget:Number(N.target.value)||48}),"aria-label":r.tokens.minTouchTarget})]}),s.jsx("button",{disabled:!p,title:r.tokens.saveTitle,onClick:()=>c(u,l.registered?r.history.saveTokens:r.history.registerTokens),children:l.registered?r.tokens.save:r.tokens.register}),s.jsx("p",{className:"muted small",children:l.registered?r.tokens.registeredHint:r.tokens.defaultHint})]})}function V0(l,c){const u=l;if(u&&typeof u=="object"&&u.themes&&typeof u.themes=="object")return{...c,...u,active:u.active??Object.keys(u.themes)[0]};const f={},h=(p,v)=>{if(typeof p=="string"&&/^#|^rgb/i.test(p))f[v]=p.toUpperCase();else if(p&&typeof p=="object"){const C=p.value??p.$value;if(typeof C=="string")h(C,v);else for(const[N,S]of Object.entries(p))h(S,v?`${v} ${N}`:N)}};if(h(l,""),!Object.keys(f).length)throw new Error(r.tokens.noColors);return{...c,themes:{...c.themes,[r.tokens.importedTheme]:f},active:r.tokens.importedTheme}}function Fp({title:l,items:c,empty:u,onPick:f,onAskAI:h}){return s.jsxs("section",{className:"board-opts","aria-label":l,children:[s.jsxs("div",{className:"sec-head",children:[s.jsxs("span",{children:[l," ",c?c.length:""]}),h&&c&&c.length>0&&s.jsx("button",{className:"link",onClick:h,children:r.checks.askFix})]}),c==null?s.jsx("p",{className:"muted small",children:r.checks.notVisible}):c.length===0?s.jsxs("p",{className:"ok-line",children:[s.jsx(P,{name:"check",size:14})," ",u]}):s.jsxs("ul",{className:"check-list",children:[c.slice(0,30).map((p,v)=>s.jsx("li",{children:s.jsxs("button",{className:"check-item",disabled:!p.path,onClick:()=>p.path&&f(p.path),title:p.path?r.checks.pickInEdit(p.path):r.checks.line(p.line),children:[s.jsx(P,{name:"warn",size:12}),s.jsx("span",{children:p.message}),s.jsx("code",{children:p.path??r.checks.line(p.line)})]})},v)),c.length>30&&s.jsx("li",{className:"muted small",children:r.checks.more(c.length-30)})]})]})}function K0({onSetUp:l}){const c=j.useRef(null);return j.useLayoutEffect(()=>Bl(c.current,".btn"),[]),s.jsxs("div",{ref:c,className:"oc-tc-off",role:"note","aria-label":r.checks.tokensOffTitle,children:[s.jsx(P,{name:"info",size:16}),s.jsxs("div",{children:[s.jsx("strong",{children:r.checks.tokensOffTitle}),s.jsx("p",{children:r.checks.tokensOffBody})]}),s.jsx("button",{className:"btn",onClick:l,children:r.checks.setUpTokens})]})}function uc(l){const c=l==null?void 0:l.getElementById("board-tweaks");if(!c)return null;try{return JSON.parse(c.textContent??"")}catch{return null}}function Wp(l,c,u){const f=u.type==="boolean"?u.value?"1":"0":String(u.value)+(u.type==="number"&&u.unit?u.unit:"");u.var&&l.documentElement.style.setProperty(u.var,f),l.documentElement.setAttribute(`data-tweak-${c}`,u.type==="boolean"?u.value?"on":"off":String(u.value))}function Z0({doc:l,onSave:c}){const[u,f]=j.useState(()=>uc(l)),[h,p]=j.useState(()=>JSON.stringify(uc(l)));if(j.useEffect(()=>{const N=uc(l);f(N),p(JSON.stringify(N))},[l]),!u)return null;const v=(N,S)=>{const y={...u,[N]:{...u[N],value:S}};f(y),l&&Wp(l,N,y[N])},C=JSON.stringify(u)!==h;return s.jsxs("section",{className:"board-opts","aria-label":"Tweaks",children:[s.jsx("div",{className:"sec-head",children:s.jsx("span",{children:"Tweaks"})}),Object.entries(u).map(([N,S])=>s.jsx("label",{className:S.type==="boolean"?"check":"field-row",children:S.type==="boolean"?s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"checkbox",checked:!!S.value,onChange:y=>v(N,y.target.checked)}),S.label??N]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{children:S.label??N}),S.type==="color"?s.jsx("input",{type:"color",value:String(S.value),onChange:y=>v(N,y.target.value.toUpperCase()),"aria-label":S.label??N}):S.type==="enum"?s.jsx("select",{value:String(S.value),onChange:y=>v(N,y.target.value),"aria-label":S.label??N,children:(S.options??[]).map(y=>s.jsx("option",{children:y},y))}):s.jsxs("span",{className:"tw-num",children:[s.jsx("input",{type:"range",min:S.min??0,max:S.max??100,step:S.step??1,value:Number(S.value),onChange:y=>v(N,Number(y.target.value)),"aria-label":S.label??N}),s.jsxs("code",{children:[String(S.value),S.unit??""]})]})]})},N)),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{disabled:!C,onClick:()=>{const N=JSON.parse(h);if(f(N),l)for(const[S,y]of Object.entries(N))Wp(l,S,y)},children:r.tweaks.revert}),s.jsx("button",{className:"primary",disabled:!C,onClick:()=>void c(Object.fromEntries(Object.entries(u).map(([N,S])=>[N,S.value]))).then(()=>p(JSON.stringify(u))),children:r.tweaks.save})]}),s.jsx("p",{className:"muted small",children:r.tweaks.hint})]})}const Yt=r.select,aa=r.design,Sy=l=>l!=null&&l.registered?jy(l):[];function Q0(l){const c={};if(!(l!=null&&l.documentElement))return c;const u=f=>{for(let h=0;h<f.length;h++)f[h].startsWith("--")&&(c[f[h]]=f.getPropertyValue(f[h]).trim())};for(const f of Array.from(l.styleSheets)){let h=null;try{h=f.cssRules}catch{continue}for(const p of Array.from(h??[])){const v=p;v.selectorText&&v.style&&/(^|,)\s*(:root|html|body)\s*(,|$)/.test(v.selectorText)&&u(v.style)}}return u(l.documentElement.style),c}function Ny(l,c){const u=Kb(l.kind,l.styles["background-color"]);if(u==="color")return{prop:u,css:"color",value:c.color||l.styles.color||""};const f=c.background!=null?"background":"background-color";return{prop:u,css:f,value:c.background||c["background-color"]||l.styles["background-color"]||""}}function Jf(l){const c=fc(l.value,l.colors),u=vn(l.value)??(c?vn(c.value):null)??"",[f,h]=j.useState(u);j.useEffect(()=>h(u),[u]);const p=j.useRef(null);j.useEffect(()=>{var C,N;l.autoFocus&&((N=(C=p.current)==null?void 0:C.querySelector("button, input"))==null||N.focus())},[]);const v=()=>{const C=vn(f.startsWith("#")?f:`#${f}`);C&&C!==u?l.onPick(C):h(u)};return s.jsxs("div",{className:"fill-picker",ref:p,children:[s.jsxs("div",{className:"pop-top",children:[s.jsx("strong",{children:l.title}),s.jsx("span",{className:"muted",children:c?Yt.tokenNow(c.name):u||aa.none})]}),l.colors.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"pop-h",children:Yt.tokens}),s.jsx("div",{className:"tok-row",role:"group","aria-label":Yt.tokens,children:l.colors.map(C=>s.jsxs("button",{className:`tok ${(c==null?void 0:c.name)===C.name?"on":""}`,"aria-pressed":(c==null?void 0:c.name)===C.name,title:`${C.name} ${vn(C.value)??C.value}`,onClick:()=>l.onPick(Vb(C,l.vars)),children:[s.jsx("i",{style:{background:C.value}}),s.jsx("span",{children:C.name})]},C.name))}),s.jsx("div",{className:"pop-sep"})]}),s.jsx("div",{className:"custom-row",children:s.jsx("span",{children:Yt.custom})}),s.jsxs("div",{className:"hex",children:[s.jsx("input",{type:"color",className:"sw","aria-label":Yt.picker,value:(vn(f)??(u||"#000000")).toLowerCase(),onChange:C=>h(C.target.value.toUpperCase()),onBlur:v}),s.jsx("input",{className:"num","aria-label":Yt.hex,value:f,spellCheck:!1,onChange:C=>h(C.target.value),onBlur:v,onKeyDown:C=>{C.nativeEvent.isComposing||C.key==="Enter"&&v()}})]})]})}function Qr(l){const[c,u]=j.useState(l.value);j.useEffect(()=>u(l.value),[l.value]);const f=()=>c.trim()!==l.value.trim()&&l.onCommit(c.trim());return s.jsxs("div",{className:"pop-field",children:[s.jsx("span",{className:"pop-h",title:l.css,children:l.label}),l.chips&&l.chips.length>0&&s.jsx("span",{className:"chips-row",children:l.chips.map(h=>s.jsx("button",{className:`tchip ${_l(l.value||l.placeholder)===String(h)?"on":""}`,onClick:()=>l.onCommit(String(h)),children:h},h))}),s.jsxs("span",{className:"stepper",children:[s.jsx("button",{className:"icon-btn sm","aria-label":Yt.decrease(l.label),onClick:()=>l.onStep(-1),children:s.jsx(P,{name:"minus",size:14})}),s.jsx("input",{"aria-label":l.label,title:l.css,value:c,placeholder:l.placeholder,onChange:h=>u(h.target.value),onBlur:f,onKeyDown:h=>{h.nativeEvent.isComposing||h.key==="Enter"&&f()}}),s.jsx("button",{className:"icon-btn sm","aria-label":Yt.increase(l.label),onClick:()=>l.onStep(1),children:s.jsx(P,{name:"plus",size:14})})]})]})}const Jr=l=>/^-?\d+(?:\.\d+)?$/.test(l)?`${Number(l)}px`:l;function J0(l){var ct,G,J,k,U,ae;const c=l.selection,u=j.useRef(null),f=j.useRef(null),[h,p]=j.useState({w:420,h:36}),v=j.useRef(0),[C,N]=j.useState(null),[S,y]=j.useState(null),[b,M]=j.useState(0),D=j.useRef([]),[q,K]=j.useState({});j.useEffect(()=>K({}),[c.hash,c.path,c.file]);const T=B=>q[B]??l.inline[B]??c.styles[B]??"",R=(B,re)=>{K(oe=>({...oe,[B]:re})),l.onStyle(B,re)},W=$b(l.win.w,{w:h.w,full:v.current||h.w});j.useLayoutEffect(()=>{const B=u.current;B&&(Bl(B),W.icons||(v.current=B.offsetWidth),(B.offsetWidth!==h.w||B.offsetHeight!==h.h)&&p({w:B.offsetWidth,h:B.offsetHeight}))});const ne=l.win.h-l.bottom-h.h;j.useLayoutEffect(()=>{if(!C)return y(null);const B=f.current,re=D.current[ce.findIndex(gt=>gt.pop===C)];if(!B||!re||!u.current)return;const oe=B.offsetWidth,de=B.offsetHeight,se=Math.round(Math.max(8,Math.min(W.x+re.offsetLeft,l.win.w-oe-8))),ve=Math.round(Math.max(8,ne-de-8));(!S||S.x!==se||S.y!==ve)&&y({x:se,y:ve})}),j.useEffect(()=>{if(!C)return;const B=re=>{var de,se;const oe=re.target;(de=f.current)!=null&&de.contains(oe)||(se=u.current)!=null&&se.contains(oe)||N(null)};return window.addEventListener("pointerdown",B,!0),()=>window.removeEventListener("pointerdown",B,!0)},[C]);const F=Sy(l.tokens),fe=!!c.text.trim(),ie=Ny(c,l.inline),ue=q[ie.css]??ie.value,te=vn(ue)??vn((ct=fc(ue,F))==null?void 0:ct.value)??null,ce=[{id:"text",label:Yt.text,icon:"title",pop:"text",disabled:!fe,title:fe?Yt.text:Yt.textOff},{id:"fill",label:Yt.fill,pop:"fill",title:`${Yt.fill} (${ie.css})`},{id:"radius",label:Yt.radius,icon:"radius",pop:"radius",title:`${aa.cornerRadius} (border-radius)`},{id:"spacing",label:Yt.spacing,icon:"spacing",pop:"spacing",title:`${aa.padding} · ${aa.gap}`},{id:"ask",label:Yt.askAi,icon:"comment",cls:"accent",title:Yt.askAiTitle,run:l.onAskAi},{id:"comment",label:Yt.comment,icon:"comment",title:Yt.commentTitle,run:l.onComment}],je=ce.map((B,re)=>B.disabled?-1:re).filter(B=>B>=0),Ce=je.includes(b)?b:je[0],lt=B=>{var re;return B.pop?N(oe=>oe===B.pop?null:B.pop):(re=B.run)==null?void 0:re.call(B)},zt=()=>{var re;const B=ce.findIndex(oe=>oe.pop===C);N(null),(re=D.current[B])==null||re.focus()},At=B=>{if(!B.nativeEvent.isComposing){if(B.key==="Escape"){C&&(B.preventDefault(),B.stopPropagation(),zt());return}B.metaKey||B.ctrlKey||/^(Arrow|Home$|End$|Enter$| $|Delete$|Backspace$)/.test(B.key)&&B.stopPropagation()}},et=B=>{const re=je.indexOf(Ce),oe=de=>{var ve;B.preventDefault();const se=je[(de+je.length)%je.length];M(se),(ve=D.current[se])==null||ve.focus()};B.key==="ArrowRight"?oe(re+1):B.key==="ArrowLeft"?oe(re-1):B.key==="Home"?oe(0):B.key==="End"&&oe(je.length-1)},he=(G=l.tokens)!=null&&G.registered?l.tokens.fontSizes:[],pe=[...new Set([...(J=l.tokens)!=null&&J.registered?l.tokens.fontWeights:[],400,500,600,700])].sort((B,re)=>B-re),Se=(k=l.tokens)!=null&&k.registered?l.tokens.radii.filter(B=>B<999):[],Me=(U=l.tokens)!=null&&U.registered?l.tokens.spacing.filter(B=>B<=64):[];let ke=null;return C==="text"?ke=s.jsxs(s.Fragment,{children:[s.jsx(Qr,{label:aa.size,css:"font-size",value:_l(T("font-size")),chips:he,onStep:B=>R("font-size",`${Ir(T("font-size"),B,1,1)}px`),onCommit:B=>R("font-size",Jr(B))}),s.jsxs("label",{className:"pop-field",children:[s.jsx("span",{className:"pop-h",title:"font-weight",children:aa.weight}),s.jsx("select",{value:String(Number(T("font-weight"))||""),onChange:B=>R("font-weight",B.target.value),children:pe.map(B=>s.jsx("option",{value:String(B),children:Xf(B,aa.weights)},B))})]})]}):C==="fill"?ke=s.jsx(Jf,{title:Yt.fill,value:ue,colors:F,vars:l.vars,autoFocus:!0,onPick:B=>R(ie.css,B)}):C==="radius"?ke=s.jsx(Qr,{label:aa.cornerRadius,css:"border-radius",value:_l(T("border-radius")),chips:Se,onStep:B=>R("border-radius",`${Ir(T("border-radius"),B)}px`),onCommit:B=>R("border-radius",Jr(B))}):C==="spacing"&&(ke=s.jsxs(s.Fragment,{children:[s.jsx(Qr,{label:aa.padding,css:"padding",value:qf(T("padding")),chips:Me,onStep:B=>R("padding",Zb(T("padding"),B)),onCommit:B=>R("padding",B.replace(/·/g," ").trim().split(/\s+/).map(Jr).join(" "))}),s.jsx(Qr,{label:aa.gap,css:"gap",value:_l(T("gap")==="normal"?"0px":T("gap")),chips:Me,onStep:B=>R("gap",`${Ir(T("gap"),B,4)}px`),onCommit:B=>R("gap",Jr(B))})]})),s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:u,className:`etb oc-context ${W.icons?"is-icons":""}`,role:"toolbar","aria-label":Yt.toolbar,"aria-orientation":"horizontal",style:{left:W.x},onKeyDown:B=>{At(B),et(B)},onPointerDown:B=>B.stopPropagation(),children:ce.map((B,re)=>s.jsxs("span",{className:"etb-item",children:[B.id==="ask"&&s.jsx("span",{className:"sep","aria-hidden":"true"}),s.jsxs("button",{ref:oe=>void(D.current[re]=oe),className:`${B.cls??""} ${C&&C===B.pop?"on":""}`,tabIndex:re===Ce?0:-1,disabled:B.disabled,title:B.title,"aria-label":B.id==="fill"?Yt.fill:W.icons?B.label:void 0,"aria-haspopup":B.pop?"dialog":void 0,"aria-expanded":B.pop?C===B.pop:void 0,onFocus:()=>M(re),onClick:()=>lt(B),children:[B.id==="fill"?s.jsx("span",{className:"sw",style:{background:te??"transparent"}}):s.jsx(P,{name:B.icon,size:14}),B.id!=="fill"&&!W.icons&&B.label,(B.id==="text"||B.id==="fill")&&s.jsx(P,{name:"chevronDown",size:14})]})]},B.id))}),C&&s.jsx("div",{ref:f,className:"menu pop",role:"dialog","aria-label":(ae=ce.find(B=>B.pop===C))==null?void 0:ae.label,style:S?{left:S.x,top:S.y}:{visibility:"hidden",left:0,top:0},onKeyDown:At,onPointerDown:B=>B.stopPropagation(),children:ke})]})}function F0(l){return s.jsxs("nav",{className:"crumb","aria-label":r.inspector.crumbs,children:[s.jsx("button",{className:"link",title:r.inspector.crumbBoard,onClick:l.onBoard,children:l.board}),l.skipped&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("span",{children:"…"})]}),l.parents.map(c=>s.jsxs("span",{className:"crumb-step",children:[s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("button",{className:"link",title:r.inspector.crumbParent(c.name),onClick:()=>l.onPath(c.path),children:c.name})]},c.path)),s.jsx("span",{"aria-hidden":"true",children:"›"}),s.jsx("b",{"aria-current":"true",title:l.title,children:l.current})]})}const W0=l=>l.includes("/")?l.slice(0,l.lastIndexOf("/")):"",rc=l=>`${Math.round(l)}px`;function I0(l,c,u,f,h){const p=c.style.pointerEvents;c.style.pointerEvents="none";const v=l.elementFromPoint(u,f);if(c.style.pointerEvents=p,!v||v===l.documentElement||c.contains(v))return null;const C=l.defaultView,N=ne=>{const F=C.getComputedStyle(ne);return/flex/.test(F.display)&&!F.flexDirection.startsWith("column")},S=/^(img|input|br|hr|textarea|select|svg|path|video|iframe)$/i,y=ne=>{const F=ne===l.body?"":al(ne);if(F==null)return null;const fe=N(ne),ie=Array.from(ne.children).filter(je=>{var Ce;return je!==c&&!((Ce=je.hasAttribute)!=null&&Ce.call(je,"data-dc-probe"))});let ue=ie.length;for(let je=0;je<ie.length;je++){const Ce=ia(ie[je]);if(fe?u<Ce.x+Ce.w/2:f<Ce.y+Ce.h/2){ue=je;break}}const te=ia(ne);let ce;if(ue<ie.length){const je=ia(ie[ue]);ce=fe?{x:je.x-1,y:je.y,w:2,h:je.h}:{x:je.x,y:je.y-1,w:je.w,h:2}}else if(ie.length){const je=ia(ie[ie.length-1]);ce=fe?{x:je.x+je.w,y:je.y,w:2,h:je.h}:{x:je.x,y:je.y+je.h,w:je.w,h:2}}else ce={x:te.x,y:te.y+te.h-2,w:te.w,h:2};return{toParentPath:F,index:ue,freeze:[],line:ce}};if(v.contains(c)||v===l.body)return y(v===l.body?l.body:v);if(h&&!S.test(v.tagName))return y(v);const b=v.parentElement,M=b===l.body?"":al(b);if(M==null)return null;const D=N(b),q=ia(v),K=D?u>q.x+q.w/2:f>q.y+q.h/2,R=Array.from(b.children).filter(ne=>ne!==c).indexOf(v)+(K?1:0),W=D?{x:K?q.x+q.w:q.x-1,y:q.y,w:2,h:q.h}:{x:q.x,y:K?q.y+q.h:q.y-1,w:q.w,h:2};return{toParentPath:M,index:R,freeze:[],line:W}}function P0(l,c,u){const f=c.parentElement;if(!f||f===l.body)return[];const h=al(f);if(h==null||h===u)return[];const p=l.defaultView.getComputedStyle(f);if(!/flex|grid/.test(p.display))return[];const v=[],C=(y,b)=>{const M=al(y),D=y.style,q=y.getBoundingClientRect(),K={};for(const T of b)D.getPropertyValue(T)||(K[T]=rc(T==="width"?q.width:q.height));M!=null&&Object.keys(K).length&&v.push({path:M,props:K})};C(f,["width","height"]);const N=p.display.includes("grid"),S=!p.flexDirection.startsWith("column");for(const y of Array.from(f.children))y!==c&&C(y,N?["width","height"]:S?["width"]:["height"]);return v}function ex(l){const[c,u]=j.useState(null),[f,h]=j.useState(null),p=j.useRef(null),v=1/Math.max(l.zoom,.25),C=M=>D=>{if(D.button!==0)return;D.stopPropagation(),D.preventDefault();const q=Cn(l.doc,l.path);if(!q)return;const K=l.doc.defaultView.getComputedStyle(q),T=K.position==="absolute"||K.position==="fixed",R=q.getBoundingClientRect();p.current={kind:M,sx:D.clientX,sy:D.clientY,el:q,abs:T,left:parseFloat(K.left)||0,top:parseFloat(K.top)||0,w:R.width,h:R.height,plan:null,moved:!1},D.currentTarget.setPointerCapture(D.pointerId)},N=M=>{var T,R;const D=p.current;if(!D)return;const q=(M.clientX-D.sx)/l.zoom,K=(M.clientY-D.sy)/l.zoom;if(!(!D.moved&&Math.abs(q)+Math.abs(K)<3)){if(D.moved=!0,D.kind==="move"){if(D.abs){D.el.style.left=rc(D.left+q),D.el.style.top=rc(D.top+K);return}h({...l.rect,x:l.rect.x+q,y:l.rect.y+K});const W=(R=(T=l.doc.defaultView)==null?void 0:T.frameElement)==null?void 0:R.getBoundingClientRect(),ne=W?W.width/(l.doc.defaultView.innerWidth||W.width):l.zoom,F=W?(M.clientX-W.left)/ne:l.rect.x+q,fe=W?(M.clientY-W.top)/ne:l.rect.y+K,ie=I0(l.doc,D.el,F,fe,M.altKey);D.plan=ie?{toParentPath:ie.toParentPath,index:ie.index,freeze:[]}:null,u((ie==null?void 0:ie.line)??null);return}D.kind!=="s"&&(D.el.style.width=rc(Math.max(8,D.w+q))),D.kind!=="e"&&(D.el.style.height=rc(Math.max(8,D.h+K)))}},S=M=>{const D=p.current;if(p.current=null,u(null),h(null),!D||!D.moved)return;const q=(M.clientX-D.sx)/l.zoom,K=(M.clientY-D.sy)/l.zoom;if(D.kind==="move"){if(D.abs)return l.onPosition(Math.round(D.left+q),Math.round(D.top+K));if(!D.plan||D.plan.toParentPath===W0(l.path)&&D.plan.index===Array.from(D.el.parentElement.children).indexOf(D.el))return;l.onMove({...D.plan,freeze:P0(l.doc,D.el,D.plan.toParentPath)});return}l.onResize(Math.round(D.kind==="s"?D.w:Math.max(8,D.w+q)),Math.round(D.kind==="e"?D.h:Math.max(8,D.h+K)))},y=l.rect,b=10*v;return s.jsxs(s.Fragment,{children:[f&&s.jsx("div",{className:"drag-ghost",style:{left:f.x,top:f.y,width:f.w,height:f.h}}),c&&s.jsx("div",{className:"drop-line",style:{left:c.x,top:c.y,width:Math.max(c.w,2*v),height:Math.max(c.h,2*v)}}),s.jsx("button",{className:"el-move","aria-label":r.elementDrag.moveAria,title:r.elementDrag.moveTitle,style:{left:Math.max(0,y.x),top:y.y>=22*v?y.y-22*v:Math.max(0,y.y),transform:`scale(${v})`,transformOrigin:y.y>=22*v?"0 100%":"0 0"},onPointerDown:C("move"),onPointerMove:N,onPointerUp:S,children:s.jsx(P,{name:"hand",size:12})}),["e","s","se"].map(M=>s.jsx("div",{className:`el-resize ${M}`,role:"slider","aria-label":M==="e"?r.elementDrag.width:M==="s"?r.elementDrag.height:r.elementDrag.size,"aria-valuetext":`${Math.round(y.w)} × ${Math.round(y.h)}`,style:{left:M==="s"?y.x+y.w/2-b/2:y.x+y.w-b/2,top:M==="e"?y.y+y.h/2-b/2:y.y+y.h-b/2,width:b,height:b,borderWidth:1.5*v},onPointerDown:C(M),onPointerMove:N,onPointerUp:S},M))]})}function tx(l,c,u,f){const h=Cn(l,c),p=h==null?void 0:h.parentElement;if(!h||!p)return null;const v=l.defaultView.getComputedStyle(p),C=/flex/.test(v.display),N=C&&v.flexDirection.startsWith("column"),S=f==="left"||f==="hcenter"||f==="right",y=f==="left"||f==="top"?"start":f==="right"||f==="bottom"?"end":"center",b={start:"flex-start",center:"center",end:"flex-end"}[y],M=(D,q)=>({op:"setStyle",path:c,hash:u,prop:D,value:q});return C&&(S?N:!N)?[M("align-self",b)]:S?y==="start"?[M("margin-left","0"),M("margin-right","auto")]:y==="end"?[M("margin-left","auto"),M("margin-right","0")]:[M("margin-left","auto"),M("margin-right","auto")]:C?y==="start"?[M("margin-top","0"),M("margin-bottom","auto")]:y==="end"?[M("margin-top","auto"),M("margin-bottom","0")]:[M("margin-top","auto"),M("margin-bottom","auto")]:null}function nx(l){const[c,u]=j.useState(""),[f,h]=j.useState(null),[p,v]=j.useState(!1),[C,N]=j.useState(!1),[S,y]=j.useState(null),[b,M]=j.useState(""),D=j.useRef(null),q=j.useRef(null);j.useLayoutEffect(()=>{Bl(D.current),Bl(q.current,".crumb button, .crumb span[aria-hidden], .oc-cmt button")});const K=async(te,ce=!1)=>{b.trim()&&(await Te.post("/api/comments",{action:"reply",id:te,text:b,author:l.author,resolve:ce}),M(""),y(null))},T=te=>new Date(te).toLocaleString("ko-KR",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}),R=l.selection,W=!!R&&!!l.file&&R.file===l.file,ne=l.comments.filter(te=>!l.file||te.file===l.file),F=ne.filter(te=>!te.resolved).length,fe=async()=>{R&&(await navigator.clipboard.writeText(kb(R.file,R.path,R.tag,R.text)).catch(()=>{}),N(!0),setTimeout(()=>N(!1),1200))},ie=async()=>{if(l.file){v(!0);try{const te=await Te.post("/api/screenshot",{file:l.file,path:R==null?void 0:R.path});h(te.path)}catch(te){h(r.inspector.shotFailed(te.message))}finally{v(!1)}}},ue=async()=>{!l.file||!c.trim()||(await Te.post("/api/comments",{file:l.file,path:(R==null?void 0:R.file)===l.file?R.path:"",text:c,author:l.author}),u(""))};return s.jsxs("div",{className:"pp inspector",children:[s.jsxs("div",{className:"pp-scroll",ref:q,children:[W&&R&&s.jsxs("header",{className:"pp-head",children:[s.jsx("span",{className:"pp-file",children:R.file}),s.jsx("h2",{className:"pp-name",children:s.jsxs("span",{children:[r.inspector.kindName(R.kind??R.tag),R.label&&` · ${R.label.slice(0,40)}`,l.multi>1&&s.jsxs("span",{className:"muted",children:[" ",r.inspector.more(l.multi-1)]})]})}),s.jsxs("div",{className:"pp-crumb",children:[l.crumbs,R.path.includes("/")&&s.jsx("button",{className:"icon-btn pp-ib","aria-label":r.menu.selectParent,title:r.menu.selectParent,onClick:()=>l.onSelectPath(R.path.slice(0,R.path.lastIndexOf("/"))),children:s.jsx(P,{name:"parent",size:16})})]}),R.text&&!R.label&&s.jsxs("p",{className:"pp-note sel-text",children:["“",R.text.slice(0,120),"”"]})]}),l.error&&s.jsx("p",{className:"pp-note warn",children:l.error}),f&&s.jsx("p",{className:"pp-note muted shot",children:f}),l.children,l.file&&s.jsxs("section",{className:"pp-group oc-cmt","aria-label":r.comments.title,children:[s.jsxs("h3",{className:"pp-group-h",children:[r.comments.title,F>0&&s.jsx("span",{className:"oc-count",children:F})]}),s.jsx("textarea",{ref:l.commentRef,value:c,"aria-label":r.comments.title,placeholder:W&&R?r.comments.placeholderElement(R.path):r.comments.placeholderBoard,onChange:te=>u(te.target.value),onKeyDown:te=>{te.key==="Enter"&&(te.metaKey||te.ctrlKey)&&ue()}}),s.jsxs("div",{className:"oc-cmt-bar",children:[s.jsx("button",{className:"btn",onClick:ue,disabled:!c.trim(),children:r.comments.add}),s.jsx("button",{className:"btn oc-plain",onClick:l.onAuthor,title:r.comments.authorTitle,children:r.comments.author(l.author)}),!W&&s.jsx("button",{className:"btn oc-plain shot-link",onClick:ie,disabled:p,title:r.inspector.boardScreenshotTitle,children:p?r.inspector.capturing:r.inspector.boardScreenshot})]}),s.jsx("ul",{className:"comments",children:ne.map(te=>s.jsxs("li",{className:`oc-cmt-item ${te.resolved?"resolved":""}`,children:[s.jsxs("div",{className:"c-head",children:[s.jsx("span",{className:"who",children:te.author}),te.path&&s.jsx("button",{className:"btn oc-plain c-path",onClick:()=>l.onSelectPath(te.path),children:te.path}),s.jsx("span",{className:"when",children:T(te.createdAt)})]}),s.jsx("div",{children:te.text}),(te.replies??[]).length>0&&s.jsx("ul",{className:"replies",children:te.replies.map(ce=>s.jsxs("li",{children:[s.jsxs("div",{className:"c-head",children:[s.jsx("span",{className:"who",children:ce.author}),s.jsx("span",{className:"when",children:T(ce.createdAt)})]}),s.jsx("div",{children:ce.text})]},ce.id))}),S===te.id&&s.jsxs("div",{className:"reply-box",children:[s.jsx("textarea",{autoFocus:!0,value:b,placeholder:r.comments.replyPlaceholder(l.author),"aria-label":r.comments.reply,onChange:ce=>M(ce.target.value),onKeyDown:ce=>{ce.nativeEvent.isComposing||(ce.key==="Enter"&&(ce.metaKey||ce.ctrlKey)&&K(te.id),ce.key==="Escape"&&y(null))}}),s.jsxs("div",{className:"oc-cmt-bar",children:[s.jsx("button",{className:"btn",onClick:()=>void K(te.id),disabled:!b.trim(),children:r.comments.reply}),s.jsx("button",{className:"btn",onClick:()=>void K(te.id,!0),disabled:!b.trim(),children:r.comments.replyResolve})]})]}),s.jsxs("div",{className:"oc-cmt-bar",children:[S!==te.id&&s.jsx("button",{className:"btn oc-plain",onClick:()=>y(te.id),children:r.comments.reply}),s.jsx("button",{className:"btn oc-plain",onClick:()=>Te.post("/api/comments",{action:"resolve",id:te.id,resolved:!te.resolved}),children:te.resolved?r.comments.reopen:r.comments.resolve}),!te.resolved&&l.onAskAI&&s.jsx("button",{className:"btn oc-plain",onClick:()=>l.onAskAI(te),title:r.comments.sendToAITitle,children:r.comments.sendToAI})]})]},te.id))})]})]}),W?s.jsxs("footer",{className:"pp-actions","aria-label":r.inspector.actions,ref:D,children:[l.onDuplicate&&s.jsx("button",{className:"btn",onClick:l.onDuplicate,children:r.properties.duplicate}),s.jsx("button",{className:"btn",onClick:fe,children:C?r.inspector.copied:r.inspector.copy}),s.jsx("button",{className:"btn",onClick:ie,disabled:p,title:r.inspector.screenshotTitle,children:p?r.inspector.capturing:r.inspector.screenshot}),l.onDelete&&s.jsx("button",{className:"icon-btn pp-del","aria-label":r.properties.delete,title:r.boardOptions.deleteTitleKey,onClick:l.onDelete,children:s.jsx(P,{name:"trash"})})]}):l.footer]})}const Ff=l=>l.kind==="person"&&l.client===nu,dc=l=>l.by??l.person??r.occupancy.someone,Ty=(l,c)=>(l[c]??[]).filter(u=>u.kind==="agent"&&u.state==="editing");function lx({list:l}){return s.jsx(s.Fragment,{children:l.map(c=>{const u=Ff(c),f=u?r.occupancy.you:c.state==="done"?r.occupancy.done(dc(c),r.occupancy.clock(c.doneAt??Date.now())):c.kind==="person"?r.occupancy.personEditing(dc(c)):r.occupancy.editing(dc(c));return s.jsxs("span",{className:`occ-tag ${u?"you":""} ${c.state==="done"?"done":""}`,"data-occ":c.key,title:f,children:[u?s.jsx("span",{className:"idot","aria-hidden":"true"}):c.state==="editing"&&c.kind==="agent"?s.jsx("span",{className:"spinner","aria-hidden":"true"}):s.jsx(P,{name:lu(c.kind==="agent"?{by:c.by??""}:{person:c.person??""}),size:16}),s.jsx("span",{className:"act-tag-text",children:f})]},c.key)})})}function ax(l,c){const u=(l[c]??[]).find(f=>f.state==="editing");return u?{color:Ff(u)?"var(--select)":"var(--text)",label:Ff(u)?r.occupancy.youListDot:r.occupancy.listDot(dc(u))}:null}function Fr(l,c){var p;const u=l.boards[c];if(!u)return null;const f=(v,C)=>Object.keys(l.boards).filter(N=>{var S,y;return N!==v&&((S=l.boards[N].origin)==null?void 0:S.of)===v&&((y=l.boards[N].origin)==null?void 0:y.kind)===C});if((p=u.origin)!=null&&p.of&&l.boards[u.origin.of])return{original:u.origin.of,kind:u.origin.kind,chosen:c,alts:f(u.origin.of,u.origin.kind)};const h=f(c,"fork");return h.length?{original:c,kind:"fork",chosen:c,alts:h}:null}const ix=(l,c)=>[c.original,...c.alts].flatMap(u=>Ty(l,u))[0]??null,sx=l=>l.replace(/:.*$/,"");function ox({file:l,group:c,busy:u,open:f,onOpen:h}){const p=c.kind==="variant"?r.occupancy.useThis:r.occupancy.useThisOne;return s.jsxs("button",{className:`icon-btn sm use-btn ${u?"":"ready"} ${f?"pressed":""}`,"data-use":l,"aria-disabled":u?!0:void 0,"aria-haspopup":"dialog","aria-expanded":f,title:u?r.occupancy.waitFor(dc(u)):c.kind==="variant"?r.occupancy.useThisTitle:r.occupancy.useThisOneTitle,onPointerDown:v=>v.stopPropagation(),onDoubleClick:v=>v.stopPropagation(),onClick:v=>{v.stopPropagation(),u||h()},children:[s.jsx(P,{name:"check",size:14}),s.jsx("span",{className:"use-label",children:p})]})}function cx(l){const c=j.useRef(null),[u,f]=j.useState(null),h=()=>document.querySelector(`[data-use="${CSS.escape(l.file)}"]`),p=b=>{var M;return((M=l.board.boards[b])==null?void 0:M.title)??b},v=l.group,C=p(v.original),N=r.occupancy,[S,y]=v.kind==="variant"?[N.confirmVariant(p(v.chosen),C),N.confirmVariantBody(C,v.alts.length-1)]:v.chosen===v.original?[N.confirmKeep(C),N.confirmKeepBody(v.alts.map(p).join(", "),v.alts.length)]:[N.confirmFork(p(v.chosen),C),N.confirmForkBody(C)];return j.useLayoutEffect(()=>{var R,W;const b=h();if(!b)return void l.onClose();const M=b.getBoundingClientRect(),D=((R=c.current)==null?void 0:R.offsetWidth)??288,q=Math.round(Math.max(8,Math.min(M.right-D,window.innerWidth-D-8))),K=((W=c.current)==null?void 0:W.offsetHeight)??120,T=Math.round(Math.max(8,Math.min(M.bottom+8,window.innerHeight-K-8)));(!u||u.x!==q||u.y!==T)&&f({x:q,y:T})}),j.useEffect(()=>{var M,D;(D=(M=c.current)==null?void 0:M.querySelector("button"))==null||D.focus();const b=q=>{var T,R;const K=q.target;(T=c.current)!=null&&T.contains(K)||(R=h())!=null&&R.contains(K)||l.onClose()};return window.addEventListener("pointerdown",b,!0),()=>window.removeEventListener("pointerdown",b,!0)},[l.file]),s.jsxs("div",{ref:c,className:"menu confirm entering",role:"dialog","aria-label":S,style:{left:(u==null?void 0:u.x)??-9999,top:(u==null?void 0:u.y)??-9999},onKeyDown:b=>{var M;b.key==="Escape"&&(b.stopPropagation(),l.onClose(),(M=h())==null||M.focus())},children:[s.jsx("p",{className:"c-title",children:S}),s.jsx("p",{className:"c-body",children:y}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn oc-strong",disabled:l.busy,onClick:l.onApply,children:N.apply}),s.jsx("button",{className:"btn oc-plain",disabled:l.busy,onClick:l.onKeepAll,children:v.kind==="variant"?N.keepAll:N.keepBoth})]})]})}function rx({board:l,files:c,zoom:u}){const f=new Set(c),h=c.flatMap(p=>{const v=l.boards[p],C=v.origin;return(C==null?void 0:C.kind)==="fork"&&f.has(C.of)&&l.boards[C.of]?[{f:p,from:l.boards[C.of],to:v,origin:C}]:[]});return h.length?s.jsx(s.Fragment,{children:h.map(p=>s.jsx(ux,{...p,board:l,zoom:Math.max(u,.05)},p.f))}):null}function ux({f:l,from:c,to:u,origin:f,board:h,zoom:p}){const v=j.useRef(null),C=j.useRef(null),[N,S]=j.useState(!1),y=dx(c,u),b=y.length===2,M=y[0],D=y[y.length-1],q=Math.hypot(D.x-M.x,D.y-M.y),K=Math.max(140,Math.min(260,q*p-16)),T={x:(M.x+D.x)/2,y:(M.y+D.y)/2+10/p};if(j.useLayoutEffect(()=>{var At,et;const ce=(At=v.current)==null?void 0:At.getBoundingClientRect();if(!ce)return;const je=((et=C.current)==null?void 0:et.getBoundingClientRect().height)??32,Ce=ce.left+T.x*p-K/2,lt=ce.top+T.y*p,zt=[...document.querySelectorAll(".canvas .note, .canvas .board-frame")].some(he=>{const pe=he.getBoundingClientRect();return pe.left<Ce+K&&pe.right>Ce&&pe.top<lt+je&&pe.bottom>lt});S(!b||zt)},[h,p,K,T.x,T.y,b]),q<4)return null;const R=1.5/p,W=y[y.length-2],ne=Math.atan2(D.y-W.y,D.x-W.x),F=6/p,fe=Math.min(...y.map(ce=>ce.x))-F,ie=Math.min(...y.map(ce=>ce.y))-F,ue=r.occupancy.forked(r.occupancy.clock(Date.parse(f.at??"")||Date.now()),f.by??r.occupancy.someone,f.while??r.occupancy.someone),te=N?{left:u.x,top:u.y+u.h+10/p,width:Math.max(140,Math.min(260,u.w*p)),transform:`scale(${1/p})`,transformOrigin:"0 0"}:{left:T.x,top:T.y,width:K,transform:`translateX(-50%) scale(${1/p})`,transformOrigin:"50% 0"};return s.jsxs("div",{ref:v,className:"fork-link","data-fork":l,"aria-label":ue,role:"img",children:[s.jsx("svg",{className:"fork-svg",style:{left:fe,top:ie,width:Math.max(...y.map(ce=>ce.x))+F-fe,height:Math.max(...y.map(ce=>ce.y))+F-ie},"aria-hidden":"true",children:s.jsxs("g",{transform:`translate(${-fe} ${-ie})`,children:[s.jsx("path",{d:y.map((ce,je)=>`${je?"L":"M"}${ce.x} ${ce.y}`).join(""),strokeWidth:R,strokeDasharray:`${4*R} ${4*R}`}),s.jsx("path",{d:`M${D.x-F*Math.cos(ne-.6)} ${D.y-F*Math.sin(ne-.6)}L${D.x} ${D.y}L${D.x-F*Math.cos(ne+.6)} ${D.y-F*Math.sin(ne+.6)}`,strokeWidth:R})]})}),s.jsx("div",{ref:C,className:`fork-caption ${N?"below":""}`,style:te,children:s.jsx("span",{children:ue})})]})}function dx(l,c){const u=Math.max(l.y,c.y)+Math.min(48,Math.min(l.h,c.h)/4),f=u<Math.min(l.y+l.h,c.y+c.h);if(f&&c.x>=l.x+l.w)return[{x:l.x+l.w+8,y:u},{x:c.x-8,y:u}];if(f&&c.x+c.w<=l.x)return[{x:l.x-8,y:u},{x:c.x+c.w+8,y:u}];const h=C=>Math.min(48,C.h/4);if(c.x<l.x+l.w&&c.x+c.w>l.x){const C=Math.min(l.x,c.x)-40,N=c.y>=l.y,S=N?l.y+l.h-h(l):l.y+h(l),y=N?c.y+h(c):c.y+c.h-h(c);return[{x:l.x-8,y:S},{x:C,y:S},{x:C,y},{x:c.x-8,y}]}const p={x:l.x+l.w/2,y:l.y+l.h/2},v={x:c.x+c.w/2,y:c.y+c.h/2};return c.y>=l.y+l.h?[{x:p.x,y:l.y+l.h+8},{x:v.x,y:c.y-8}]:[{x:p.x,y:l.y-8},{x:v.x,y:c.y+c.h+8}]}const Uf=l=>l.includes("/")?l.slice(0,l.lastIndexOf("/")):"",Ip=l=>Number(l.split("/").pop());function fx(l){var ne;const[c,u]=j.useState([]),[f,h]=j.useState({0:!0}),[p,v]=j.useState(null),[C,N]=j.useState(null),[S,y]=j.useState(null);j.useEffect(()=>{Te.get(`/api/outline?f=${encodeURIComponent(l.file)}`).then(F=>u(F.tree)).catch(()=>u([]))},[l.file,l.version]),j.useEffect(()=>{const F={};for(const fe of l.selected){const ie=fe.split("/");for(let ue=1;ue<ie.length;ue++)F[ie.slice(0,ue).join("/")]=!0}Object.keys(F).length&&h(fe=>({...fe,...F}))},[l.selected.join("|")]);const b=F=>{if(!p||p===F||F.startsWith(p+"/"))return;const fe=Uf(F);let ie=Ip(F);Uf(p)===fe&&Ip(p)<ie&&(ie-=1),l.onMove(p,fe,ie)},M=[],D=new Map,q=F=>{for(const fe of F)M.push(fe),D.set(fe.path,fe),fe.children.length&&f[fe.path]&&q(fe.children)};q(c);const K=S??l.selected[l.selected.length-1]??((ne=M[0])==null?void 0:ne.path)??null,T=F=>{F==null||!D.has(F)||(y(F),l.onSelect(F,!1))},R=F=>{if(!K)return;const fe=M.findIndex(ce=>ce.path===K),ie=D.get(K),te={ArrowDown:()=>{var ce;return T((ce=M[fe+1])==null?void 0:ce.path)},ArrowUp:()=>{var ce;return T((ce=M[fe-1])==null?void 0:ce.path)},ArrowRight:()=>ie!=null&&ie.children.length?f[K]?T(ie.children[0].path):h(ce=>({...ce,[K]:!0})):void 0,ArrowLeft:()=>ie!=null&&ie.children.length&&f[K]?h(ce=>({...ce,[K]:!1})):T(K.includes("/")?Uf(K):null),Home:()=>{var ce;return T((ce=M[0])==null?void 0:ce.path)},End:()=>{var ce;return T((ce=M[M.length-1])==null?void 0:ce.path)},Enter:()=>T(K)," ":()=>T(K)}[F.key];te&&(F.preventDefault(),F.stopPropagation(),te())},W=(F,fe)=>{const ie=F.children.length>0,ue=f[F.path];return s.jsxs("li",{children:[s.jsxs("div",{role:"treeitem","aria-selected":l.selected.includes(F.path),"aria-expanded":ie?!!ue:void 0,"aria-level":fe+1,className:`layer ${l.selected.includes(F.path)?"on":""} ${C===F.path?"over":""} ${K===F.path?"kbd-focus":""}`,style:{paddingLeft:8+fe*16},draggable:!0,onDragStart:te=>{v(F.path),te.dataTransfer.effectAllowed="move"},onDragEnd:()=>{v(null),N(null)},onDragOver:te=>{p&&(te.preventDefault(),N(F.path))},onDragLeave:()=>N(te=>te===F.path?null:te),onDrop:te=>{te.preventDefault(),b(F.path),N(null)},onClick:te=>{y(F.path),l.onSelect(F.path,te.shiftKey)},children:[s.jsx("button",{className:"twisty",tabIndex:-1,"aria-label":ue?r.layers.collapse:r.layers.expand,style:{visibility:ie?"visible":"hidden"},onClick:te=>{te.stopPropagation(),h(ce=>({...ce,[F.path]:!ue}))},children:s.jsx(P,{name:ue?"chevronDown":"chevronRight",size:14})}),s.jsx("span",{className:"tag",children:F.tag}),s.jsxs("span",{className:"lname",children:[F.cls&&`.${F.cls}`,F.cls&&F.text&&" · ",F.text]})]}),ie&&ue&&s.jsx("ul",{children:F.children.map(te=>W(te,fe+1))})]},F.path)};return s.jsxs("section",{className:"pp-group layers",children:[s.jsx("h3",{className:"pp-group-h",title:r.layers.hint,children:r.layers.title}),s.jsx("ul",{className:"layer-tree",role:"tree","aria-label":r.layers.title,title:r.layers.hint,tabIndex:0,onKeyDown:R,children:c.map(F=>W(F,0))})]})}const hx=12,Pp=l=>{var c;return((c=/^([a-z]+)[-_]/i.exec(l))==null?void 0:c[1].toUpperCase())??""},mx=j.forwardRef(function(c,u){var T;const[f,h]=j.useState(""),[p,v]=j.useState(null),[C,N]=j.useState(null),S=(T=c.pages[0])==null?void 0:T.id,y=j.useMemo(()=>{const R=f.trim().toLowerCase();return[...new Set(c.board.order)].filter(W=>{const ne=c.board.boards[W];return ne?R?W.toLowerCase().includes(R)||(ne.title??"").toLowerCase().includes(R):!c.pages.length||(ne.page??S)===c.currentPage:!1})},[f,c.board,c.pages,c.currentPage,S]),b=j.useMemo(()=>{if(f.trim()||y.length<hx)return null;const R=new Map;for(const F of y){const fe=Pp(F);R.has(fe)||R.set(fe,[]),R.get(fe).push(F)}const W=[...R.keys()].filter(F=>F&&R.get(F).length>=2);if(W.length<2)return null;const ne=y.filter(F=>!W.includes(Pp(F)));return[...W.map(F=>({key:F,label:F,files:R.get(F)})),...ne.length?[{key:"",label:r.boardList.otherGroup,files:ne}]:[]]},[y,f]),[M,D]=j.useState(()=>{try{return JSON.parse(localStorage.getItem("design-canvas:groups-closed")??"{}")}catch{return{}}}),q=R=>D(W=>{const ne={...W,[R]:!W[R]};try{localStorage.setItem("design-canvas:groups-closed",JSON.stringify(ne))}catch{}return ne}),K=R=>{var fe;const W=c.board.boards[R],ne=!!W.title&&W.title!==R.replace(/\.html$/,""),F=(fe=c.dotOf)==null?void 0:fe.call(c,R);return s.jsx("li",{children:s.jsxs("button",{className:`row oc-row ${c.selected.includes(R)?"on":""}`,"aria-current":c.selected.includes(R)||void 0,onClick:ie=>c.onPick(R,ie.shiftKey||ie.metaKey),onContextMenu:ie=>{c.onBoardMenu&&(ie.preventDefault(),c.onBoardMenu(R,ie))},title:R,children:[s.jsx("span",{className:"row-title",children:W.title??R}),c.missing.includes(R)&&s.jsx(P,{name:"warn",size:14,className:"warn-icon","aria-label":r.boardList.fileMissing}),F&&s.jsx("span",{className:"idot occ-dot",style:{background:F.color},role:"img","aria-label":F.label,title:F.label}),ne&&s.jsx("span",{className:"row-file",children:R})]})},R)};return s.jsxs("aside",{className:c.className??"left",style:c.style,"aria-label":r.boardList.aria,children:[c.header,c.showPages!==!1&&s.jsxs("section",{className:"left-pages",children:[s.jsxs("div",{className:"oc-sec",children:[s.jsx("span",{children:r.boardList.pages}),c.onAddPage&&s.jsx("button",{className:"icon-btn oc-ib","aria-label":r.boardList.addPage,title:r.boardList.addPage,onClick:c.onAddPage,children:s.jsx(P,{name:"plus",size:16})})]}),c.pages.length===0?s.jsx("p",{className:"oc-empty",children:r.boardList.singlePage}):s.jsx("ul",{className:"oc-list",role:"tablist","aria-label":r.boardList.pages,children:c.pages.map((R,W)=>s.jsx("li",{draggable:!!c.onMovePage,onDragStart:ne=>{v(R.id),ne.dataTransfer.effectAllowed="move"},onDragOver:ne=>{p&&(ne.preventDefault(),N(W))},onDragEnd:()=>{v(null),N(null)},onDrop:ne=>{var fe;ne.preventDefault();const F=c.pages.findIndex(ie=>ie.id===p);p&&F!==W&&((fe=c.onMovePage)==null||fe.call(c,p,W)),v(null),N(null)},children:s.jsxs("button",{role:"tab",title:r.boardList.pageTabTitle,"aria-selected":R.id===c.currentPage,className:`row oc-row ${R.id===c.currentPage?"on":""} ${C===W&&p!==R.id?"drop-before":""}`,onClick:()=>c.onPage(R.id),onContextMenu:ne=>{c.onPageMenu&&(ne.preventDefault(),c.onPageMenu(R.id,ne))},children:[s.jsx("span",{className:"row-title",children:R.name}),s.jsx("span",{className:"row-count",children:Object.values(c.board.boards).filter(ne=>(ne.page??S)===R.id).length})]})},R.id))})]}),s.jsxs("section",{className:"left-boards",children:[s.jsx("div",{className:"oc-sec",children:s.jsxs("span",{children:[r.boardList.boardsHead,s.jsx("span",{className:"oc-count",children:y.length})]})}),s.jsxs("label",{className:"oc-search",children:[s.jsx(P,{name:"search",size:16}),s.jsx("input",{ref:u,value:f,placeholder:r.boardList.searchPlaceholder,"aria-label":r.boardList.search,onChange:R=>h(R.target.value),onKeyDown:R=>{R.nativeEvent.isComposing||(R.key==="Enter"&&y[0]&&c.onPick(y[0],!1),R.key==="Escape"&&(h(""),R.target.blur()))}})]}),y.length===0?s.jsx("p",{className:"oc-empty",children:f?r.boardList.noMatch(f):r.boardList.emptyPage}):b?s.jsx("ul",{className:"oc-list board-list",children:b.map(R=>{var ne;const W=!M[R.key]||R.files.some(F=>c.selected.includes(F));return s.jsxs("li",{className:`group ${W?"open":""}`,children:[s.jsxs("div",{className:"row oc-row group-head",role:"button",tabIndex:0,"aria-expanded":W,title:r.boardList.groupTitle(R.files.length),onClick:()=>q(R.key),onKeyDown:F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),q(R.key))},onDoubleClick:()=>{var F;return R.key&&((F=c.onGroupRename)==null?void 0:F.call(c,R.key))},onContextMenu:F=>{c.onGroupMenu&&(F.preventDefault(),c.onGroupMenu(R.key,R.files,F))},children:[s.jsx(P,{name:"chevronRight",size:14,className:"chev"}),s.jsx("span",{className:"row-title",children:R.key&&((ne=c.board.groupNames)==null?void 0:ne[R.key])||R.label}),s.jsx("span",{className:"row-count",children:R.files.length}),c.onGroupMenu&&s.jsx("button",{className:"icon-btn sm group-more","aria-label":r.boardList.groupMenu,title:r.boardList.groupMenu,onClick:F=>{F.stopPropagation();const fe=F.currentTarget.getBoundingClientRect();c.onGroupMenu(R.key,R.files,{clientX:fe.left,clientY:fe.bottom+4})},children:s.jsx(P,{name:"more",size:14})})]}),W&&s.jsx("ul",{className:"oc-list oc-sub",children:R.files.map(K)})]},R.key)})}):s.jsx("ul",{className:"oc-list board-list",children:y.map(K)})]}),c.footer]})});function ey({rects:l,selected:c,view:u,size:f,onJump:h,w:p=200,h:v=130,inset:C=0,className:N="minimap"}){const S=j.useMemo(()=>{if(!l.length)return{x:0,y:0,w:1,h:1};const T=Math.min(...l.map(W=>W.x)),R=Math.min(...l.map(W=>W.y));return{x:T,y:R,w:Math.max(...l.map(W=>W.x+W.w))-T,h:Math.max(...l.map(W=>W.y+W.h))-R}},[l]),y=Math.min((p-C*2)/S.w,(v-C*2)/S.h),b=(p-S.w*y)/2,M=(v-S.h*y)/2,D={x:(-u.x/u.zoom-S.x)*y+b,y:(-u.y/u.zoom-S.y)*y+M,w:Math.max(0,f.w/u.zoom*y),h:Math.max(0,f.h/u.zoom*y)},q=j.useRef(!1),K=T=>{const R=T.currentTarget.getBoundingClientRect(),W=R.width/p;h(((T.clientX-R.left)/W-b)/y+S.x,((T.clientY-R.top)/W-M)/y+S.y)};return s.jsx("div",{className:`${N} ${l.length>30?"many":""}`,role:"img","aria-label":r.minimap.aria,onPointerDown:T=>{q.current=!0,T.currentTarget.setPointerCapture(T.pointerId),K(T)},onPointerMove:T=>q.current&&K(T),onPointerUp:()=>q.current=!1,children:s.jsxs("svg",{width:p,height:v,children:[l.map(T=>s.jsx("rect",{x:(T.x-S.x)*y+b,y:(T.y-S.y)*y+M,width:Math.max(1,T.w*y),height:Math.max(1,T.h*y),rx:2,className:c.includes(T.file)?"mm-sel":"mm-board"},T.file)),s.jsx("rect",{x:Math.round(D.x)+.5,y:Math.round(D.y)+.5,width:Math.max(0,Math.round(D.w)-1),height:Math.max(0,Math.round(D.h)-1),rx:3,className:"mm-view"})]})})}function gx(l){const c=l.item,u=r.boardOptions,f=(h,p,v,C,N=!1)=>s.jsx(yx,{label:p,bare:N,value:c[h]??0,min:v,max:C,onCommit:S=>l.onPatch({[h]:S})},h+l.file+(c[h]??""));return s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"pp-head","aria-label":u.aria,children:[s.jsx("button",{className:"pp-file",onClick:l.onRenameFile,title:u.renameFileTitle,children:l.file}),s.jsxs("h2",{className:"pp-name",children:[s.jsx("span",{children:c.title??l.file}),s.jsx("button",{className:"icon-btn pp-ib","aria-label":r.menu.rename,title:u.renameTitle,onClick:l.onRename,children:s.jsx(P,{name:"edit",size:16})})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:u.positionAndSize}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:u.position}),s.jsxs("span",{className:"pp-two",children:[f("x","X"),f("y","Y")]})]}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.boardOptions.size}),s.jsxs("span",{className:"pp-two",children:[f("w",u.width,40,8e3),f("h",u.height,40,8e3)]})]}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:u.radius}),s.jsx("span",{className:"pp-two",children:f("radius",u.radius,0,200,!0)})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:u.options}),s.jsx(Wr,{on:!!c.is_interactive,label:u.interactive,onChange:h=>l.onPatch({is_interactive:h||void 0})}),s.jsx(Wr,{on:!!c.frameless,label:u.frameless,onChange:h=>l.onPatch({frameless:h||void 0})}),s.jsx(Wr,{on:c.expand==="fill",label:u.fill,onChange:h=>l.onPatch({expand:h?"fill":void 0})}),s.jsx(Wr,{on:l.isLaunch,label:u.launch,onChange:l.onLaunch}),l.pages.length>0&&s.jsxs("label",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:u.page}),s.jsx("select",{value:c.page??l.pages[0].id,onChange:h=>l.onPatch({page:h.target.value}),children:l.pages.map(h=>s.jsx("option",{value:h.id,children:h.name},h.id))})]})]})]})}function px(l){const c=r.boardOptions;return s.jsxs("footer",{className:"pp-actions","aria-label":r.inspector.boardActions,children:[s.jsx("button",{className:"icon-btn","aria-label":c.focus,title:c.focusTitle,onClick:l.onFocus,children:s.jsx(P,{name:"focus"})}),s.jsx("button",{className:"icon-btn","aria-label":c.duplicate,title:c.duplicateTitle,onClick:l.onDuplicate,children:s.jsx(P,{name:"copy"})}),s.jsx("button",{className:"icon-btn","aria-label":c.front,title:c.frontTitle,onClick:l.onFront,children:s.jsx(P,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":c.back,title:c.backTitle,onClick:l.onBack,children:s.jsx(P,{name:"back"})}),s.jsx("button",{className:"icon-btn pp-del","aria-label":c.delete,title:c.deleteTitleKey,onClick:l.onDelete,children:s.jsx(P,{name:"trash"})})]})}function Wr(l){return s.jsxs("label",{className:"check",children:[s.jsx("input",{type:"checkbox",checked:l.on,onChange:c=>l.onChange(c.target.checked)}),s.jsx("i",{className:l.on?"on":"","aria-hidden":"true",children:l.on&&s.jsx(P,{name:"check",size:12})}),l.label]})}function yx({label:l,value:c,min:u,max:f,bare:h,onCommit:p}){const[v,C]=j.useState(String(c));j.useEffect(()=>C(String(c)),[c]);const N=()=>{let S=Math.round(Number(v));if(!Number.isFinite(S))return C(String(c));u!=null&&(S=Math.max(u,S)),f!=null&&(S=Math.min(f,S)),S!==c&&p(S),C(String(S))};return s.jsxs("label",{className:"num",children:[!h&&s.jsx("span",{children:l}),s.jsx("input",{inputMode:"numeric","aria-label":h?l:void 0,value:v,onChange:S=>C(S.target.value),onBlur:N,onKeyDown:S=>{if(!S.nativeEvent.isComposing&&(S.key==="Enter"&&S.target.blur(),S.key==="ArrowUp"||S.key==="ArrowDown")){S.preventDefault();const y=Number(v)+(S.key==="ArrowUp"?1:-1)*(S.shiftKey?10:1);C(String(y))}}})]})}function vx({board:l,file:c,onClose:u,onNav:f}){const h=l.boards[c],p=j.useRef(null),[v,C]=j.useState(1),N=[...new Set(l.order)].filter(b=>l.boards[b]),S=N.indexOf(c);if(j.useEffect(()=>{const b=M=>{M.key==="Escape"&&u(),M.key==="ArrowRight"&&N[S+1]&&f(N[S+1]),M.key==="ArrowLeft"&&N[S-1]&&f(N[S-1])};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[c,u,f,S,N]),j.useEffect(()=>{const b=()=>{const M=p.current;!M||!h||C(Math.min(1,(M.clientWidth-48)/h.w,(M.clientHeight-48)/h.h))};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[h]),!h)return null;const y=h.expand==="fill";return s.jsxs("div",{className:"focus",role:"dialog","aria-modal":"true","aria-label":r.focus.aria(h.title??c),children:[s.jsxs("div",{className:"focus-bar",children:[s.jsx("button",{className:"icon-btn","aria-label":r.focus.prev,disabled:!N[S-1],onClick:()=>f(N[S-1]),children:s.jsx(P,{name:"chevronRight",style:{transform:"rotate(180deg)"}})}),s.jsx("button",{className:"icon-btn","aria-label":r.focus.next,disabled:!N[S+1],onClick:()=>f(N[S+1]),children:s.jsx(P,{name:"chevronRight"})}),s.jsx("strong",{children:h.title??c}),s.jsxs("span",{className:"muted",children:[c,y?r.focus.pageStyle:` · ${h.w}×${h.h} · ${Math.round(v*100)}%`]}),s.jsx("div",{className:"spacer"}),s.jsxs("button",{onClick:u,children:[r.focus.close," ",s.jsx("kbd",{children:"Esc"})]})]}),s.jsx("div",{ref:p,className:`focus-stage ${y?"fill":""}`,children:y?s.jsx("iframe",{src:`/screens/${c}`,title:h.title??c,className:"focus-fill"}):s.jsx("div",{className:"focus-frame",style:{width:h.w*v,height:h.h*v,borderRadius:(h.radius??0)*v},children:s.jsx("iframe",{src:`/screens/${c}`,title:h.title??c,style:{width:h.w,height:h.h,transform:`scale(${v})`,transformOrigin:"0 0"}})})})]})}const ty="https://screens.invalid/",bx=l=>l.split("/").map(encodeURIComponent).join("/");function xx({board:l,file:c,onClose:u,onLocate:f,screens:h=hy}){var T;const p=j.useRef(null),[v,C]=j.useState(c),[N,S]=j.useState({list:[c],i:0}),y=!!h.html,b=y?N.list[N.i]:v,M=l.boards[b]??l.boards[c],D=R=>S(W=>({list:[...W.list.slice(0,W.i+1),R],i:W.i+1})),q=R=>{var W,ne,F,fe;if(y)return S(ie=>({...ie,i:Math.max(0,Math.min(ie.list.length-1,ie.i+R))}));try{R<0?(ne=(W=p.current)==null?void 0:W.contentWindow)==null||ne.history.back():(fe=(F=p.current)==null?void 0:F.contentWindow)==null||fe.history.forward()}catch{}},K=()=>{var W,ne,F;let R=null;try{R=((W=p.current)==null?void 0:W.contentDocument)??null}catch{}if(R==null||R.addEventListener("click",fe=>{var te,ce,je;const ie=(ce=(te=fe.target)==null?void 0:te.closest)==null?void 0:ce.call(te,"a[href]");if(!ie)return;if(y){const Ce=new URL(ie.getAttribute("href")??"",ty+bx(b));if(Ce.href.startsWith(ty)){const lt=decodeURIComponent(Ce.pathname.slice(1));if(lt===b&&Ce.hash)return;fe.preventDefault(),((je=h.html)==null?void 0:je.call(h,lt))!=null&&D(lt);return}fe.preventDefault(),window.open(Ce.href,"_blank","noopener");return}const ue=new URL(ie.href,R.baseURI);ue.origin!==location.origin&&(fe.preventDefault(),window.open(ue.href,"_blank","noopener"))}),!y)try{const fe=new URL(h.url(""),location.href).href,ie=((F=(ne=p.current)==null?void 0:ne.contentWindow)==null?void 0:F.location.href)??"";ie.startsWith(fe)&&C(decodeURIComponent(ie.slice(fe.length).split(/[?#]/)[0]))}catch{}};return j.useEffect(()=>{const R=W=>W.key==="Escape"&&u();return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[u]),s.jsxs("div",{className:"play",onPointerDown:R=>R.target===R.currentTarget&&u(),children:[s.jsxs("div",{className:"play-bar",children:[s.jsx("button",{onClick:()=>q(-1),title:r.play.back,disabled:y&&N.i===0,children:"←"}),s.jsx("button",{onClick:()=>q(1),title:r.play.forward,disabled:y&&N.i>=N.list.length-1,children:"→"}),s.jsx("strong",{children:(M==null?void 0:M.title)??b}),s.jsx("span",{className:"muted",children:b}),s.jsx("div",{className:"spacer"}),s.jsx("button",{onClick:()=>{f(b),u()},children:r.play.viewOnCanvas}),s.jsx("button",{onClick:u,title:r.play.closeTitle,children:r.play.close})]}),s.jsx("iframe",{ref:p,className:"play-frame",src:y?void 0:h.url(c),srcDoc:y?(T=h.html)==null?void 0:T.call(h,b):void 0,title:"Play",onLoad:K,style:{width:Math.min((M==null?void 0:M.w)??390,window.innerWidth-32)}})]})}const dt=r.design,wx=[{prop:"width",label:r.properties.fields.width},{prop:"height",label:r.properties.fields.height},{prop:"margin",label:"margin"},{prop:"color",label:r.properties.fields.color,color:!0},{prop:"background",label:r.properties.fields.background,color:!0},{prop:"display",label:"display",options:["","block","flex","grid","inline-flex","none"]},{prop:"flex-direction",label:r.properties.fields.flexDirection,options:["","row","column"]},{prop:"align-items",label:r.properties.fields.alignItems,options:["","flex-start","center","flex-end","stretch","baseline"]},{prop:"justify-content",label:r.properties.fields.justifyContent,options:["","flex-start","center","flex-end","space-between"]},{prop:"flex-wrap",label:r.properties.fields.flexWrap,options:["","nowrap","wrap"]},{prop:"flex-grow",label:r.properties.fields.flexGrow,options:["","0","1"]},{prop:"align-self",label:r.properties.fields.alignSelf,options:["","auto","flex-start","center","flex-end","stretch"]},{prop:"line-height",label:r.properties.fields.lineHeight},{prop:"text-align",label:r.properties.fields.textAlign,options:["","left","center","right"]},{prop:"border",label:r.properties.fields.border},{prop:"box-shadow",label:r.properties.fields.boxShadow},{prop:"opacity",label:r.properties.fields.opacity}];function ny(l){if(!l||l==="none")return null;const c=l.match(/^\s*repeat\(\s*(\d+)\s*,/);if(c)return Number(c[1]);let u=0,f=0,h=!1;for(const p of l)p==="("&&u++,p===")"&&u--,/\s/.test(p)&&u===0?h=!1:h||(h=!0,f++);return f||null}const jx=l=>`repeat(${l}, minmax(0, 1fr))`,Sx=[{dir:"left",label:r.properties.alignButtons.left,icon:"alignLeft"},{dir:"hcenter",label:r.properties.alignButtons.hcenter,icon:"alignHcenter"},{dir:"right",label:r.properties.alignButtons.right,icon:"alignRight"},{dir:"top",label:r.properties.alignButtons.top,icon:"alignTop"},{dir:"vcenter",label:r.properties.alignButtons.vcenter,icon:"alignVcenter"},{dir:"bottom",label:r.properties.alignButtons.bottom,icon:"alignBottom"}],Nx={a:["href"],img:["src","alt"],input:["placeholder"],button:["aria-label"]};function Tx(l){var K;const c=l.selection,u=Nx[c.tag]??[],f=Sy(l.tokens),h=Ny(c,l.inline),p=!!c.text.trim(),[v,C]=j.useState(null);j.useEffect(()=>C(null),[c.file,c.path]);const N=c.path+c.hash,S=T=>Jp(T,l.inline[T]??"",l.tokens),y=T=>{var W;const R=vn(T);return R==="#FFFFFF"?dt.white:R==="#000000"?dt.black:((W=fc(T,f))==null?void 0:W.name)??R??T},b=vn(c.styles["background-color"]),M=p?h.prop==="background"?Pr(c.styles.color??"",b??l.bg):Pr(c.styles.color??"",l.bg):null,D=M==null?null:h.prop==="background"?dt.contrastWith(M.toFixed(1),y(c.styles.color??""),dt.grade(M)):dt.contrastOn(M.toFixed(1),y(l.bg),dt.grade(M)),q=[...new Set([...(K=l.tokens)!=null&&K.registered?l.tokens.fontWeights:[],100,200,300,400,500,600,700,800,900])].sort((T,R)=>T-R);return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:dt.fill}),s.jsx(vi,{word:dt.color,css:h.css,children:s.jsx(ly,{value:h.value,computed:h.prop==="color"?c.styles.color:c.styles["background-color"],colors:f,css:h.css,label:dt.fill,open:v==="fill",onToggle:()=>C(T=>T==="fill"?null:"fill")})}),D&&s.jsx("div",{className:"pp-row",children:s.jsx("span",{className:`pp-note contrast ${M>=4.5?"ok":M>=3?"mid":"bad"}`,title:r.properties.contrastTitle,children:D})}),v==="fill"&&s.jsx(Jf,{title:dt.fill,value:h.value,colors:f,vars:l.vars,onPick:T=>l.onStyle(h.css,T)})]}),p&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:dt.text}),s.jsx(vi,{word:dt.font,css:"font-family",children:s.jsx(sc,{label:dt.font,value:Bp(l.inline["font-family"]),placeholder:Bp(c.styles["font-family"]),onCommit:T=>l.onStyle("font-family",T?Xb(T):"")},"ff"+N)}),s.jsx(vi,{word:dt.size,css:"font-size",warn:S("font-size"),children:s.jsx(sc,{label:dt.size,value:_l(l.inline["font-size"]),placeholder:_l(c.styles["font-size"]),onCommit:T=>l.onStyle("font-size",Hf(T))},"fs"+N)}),s.jsx(vi,{word:dt.weight,css:"font-weight",warn:S("font-weight"),children:s.jsxs("select",{"aria-label":dt.weight,defaultValue:l.inline["font-weight"]??"",onChange:T=>l.onStyle("font-weight",T.target.value),children:[s.jsx("option",{value:"",children:dt.inherited(Xf(c.styles["font-weight"],dt.weights))}),q.map(T=>s.jsx("option",{value:String(T),children:Xf(T,dt.weights)},T))]},"fw"+N)}),h.prop==="background"&&s.jsxs(s.Fragment,{children:[s.jsx(vi,{word:dt.color,css:"color",children:s.jsx(ly,{value:l.inline.color??"",computed:c.styles.color,colors:f,css:"color",label:dt.color,open:v==="color",onToggle:()=>C(T=>T==="color"?null:"color")})}),v==="color"&&s.jsx(Jf,{title:dt.color,value:l.inline.color||c.styles.color||"",colors:f,vars:l.vars,onPick:T=>l.onStyle("color",T)})]})]}),s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.properties.layout}),s.jsx(vi,{word:dt.cornerRadius,css:"border-radius",warn:S("border-radius"),children:s.jsx(sc,{label:dt.cornerRadius,value:_l(l.inline["border-radius"]),placeholder:_l(c.styles["border-radius"]),onCommit:T=>l.onStyle("border-radius",Hf(T))},"br"+N)}),s.jsx(vi,{word:dt.padding,css:"padding",warn:S("padding"),children:s.jsx(sc,{label:dt.padding,value:qf(l.inline.padding),placeholder:qf(c.styles.padding),onCommit:T=>l.onStyle("padding",Gb(T))},"pd"+N)}),s.jsx(vi,{word:dt.gap,css:"gap",warn:S("gap"),children:s.jsx(sc,{label:dt.gap,value:_l(l.inline.gap),placeholder:_l(c.styles.gap==="normal"?"":c.styles.gap),onCommit:T=>l.onStyle("gap",Hf(T))},"gp"+N)}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.properties.align}),s.jsx("span",{className:"align-set",role:"group","aria-label":r.properties.align,children:Sx.map(T=>s.jsx("button",{className:"icon-btn","aria-label":T.label,title:T.label,onClick:()=>l.onAlign(T.dir),children:s.jsx(P,{name:T.icon,size:16})},T.dir))})]}),s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.properties.wrap}),s.jsxs("span",{className:"pp-btns",children:[s.jsx("button",{className:"btn",onClick:()=>l.onWrap("flex"),disabled:!l.canWrap,title:r.properties.wrapTitle,children:r.properties.wrapFlex}),s.jsx("button",{className:"btn",onClick:()=>l.onWrap("grid"),disabled:!l.canWrap,title:r.properties.wrapTitle,children:r.properties.wrapGrid})]})]}),l.onReplaceImage&&s.jsxs("div",{className:"pp-row",children:[s.jsx("span",{className:"pp-l",children:r.properties.image}),s.jsx("span",{className:"pp-btns",children:s.jsx("button",{className:"btn",onClick:l.onReplaceImage,children:r.properties.replaceImage})})]})]}),l.children,s.jsx(Js,{id:"more-css",title:dt.more,children:s.jsxs("div",{className:"more-css",children:[wx.map(T=>s.jsx(Lf,{label:T.label,value:l.inline[T.prop]??(T.prop==="background"?l.inline["background-color"]??"":""),placeholder:c.styles[T.prop==="background"?"background-color":T.prop]??"",options:T.options,color:T.color,swatches:T.color?f:void 0,warn:Jp(T.prop,l.inline[T.prop]??(T.prop==="background"?l.inline["background-color"]??"":""),l.tokens),ratio:T.prop==="color"?Pr(l.inline.color||c.styles.color||"",l.bg):null,onCommit:R=>l.onStyle(T.prop,R)},T.prop+N)),(l.inline.display??c.styles.display??"").includes("grid")&&["grid-template-columns","grid-template-rows"].map(T=>s.jsx(Lf,{label:T.endsWith("columns")?r.properties.columns:r.properties.rows,value:String(ny(l.inline[T])??""),placeholder:String(ny(c.styles[T])??""),onCommit:R=>l.onStyle(T,/^\d+$/.test(R)&&Number(R)>0?jx(Math.min(24,Number(R))):R)},T+N)),u.map(T=>s.jsx(Lf,{label:T,value:l.attrs[T]??"",placeholder:"",onCommit:R=>l.onAttr(T,R===""?null:R)},T+N))]})})]})}const Hf=l=>/^-?\d+(?:\.\d+)?$/.test(l.trim())?`${Number(l)}px`:l.trim();function vi(l){return s.jsxs("label",{className:"pp-row",title:l.css,children:[s.jsxs("span",{className:"pp-l",children:[l.word,l.warn&&s.jsxs("span",{className:"tok-warn",title:l.warn,"aria-label":r.properties.offToken(l.warn),children:[" ","⚠"]})]}),l.children]})}function sc(l){const[c,u]=j.useState(l.value);j.useEffect(()=>u(l.value),[l.value]);const f=()=>c.trim()!==l.value.trim()&&l.onCommit(c.trim());return s.jsx("input",{"aria-label":l.label,value:c,placeholder:l.placeholder,onChange:h=>u(h.target.value),onBlur:f,onKeyDown:h=>{h.nativeEvent.isComposing||(h.key==="Enter"&&h.currentTarget.blur(),h.key==="Escape"&&(u(l.value),h.stopPropagation()))}})}function ly(l){const c=l.value||l.computed||"",u=fc(c,l.colors),f=vn(c)??vn(l.computed)??(u?vn(u.value):null);return s.jsxs("button",{className:`fillv ${l.open?"on":""}`,"aria-expanded":l.open,"aria-label":dt.openFill(l.label),title:l.css,onClick:h=>{h.preventDefault(),l.onToggle()},children:[s.jsx("span",{className:"sw",style:{background:f??"transparent"}}),s.jsx("span",{className:"fillv-name",children:(u==null?void 0:u.name)??f??dt.none}),u&&f&&s.jsx("span",{className:"muted",children:f})]})}function Lf(l){const[c,u]=j.useState(l.value);j.useEffect(()=>u(l.value),[l.value]);const f=(h=c)=>{h.trim()!==l.value.trim()&&l.onCommit(h.trim())};return s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:[l.label,l.warn&&s.jsxs("span",{className:"tok-warn",title:l.warn,"aria-label":r.properties.offToken(l.warn),children:[" ","⚠"]})]}),l.options?s.jsx("select",{value:c,onChange:h=>{u(h.target.value),f(h.target.value)},children:l.options.map(h=>s.jsx("option",{value:h,children:h||`(${l.placeholder||r.properties.none})`},h))}):s.jsx("input",{value:c,placeholder:l.placeholder,onChange:h=>u(h.target.value),onBlur:()=>f(),onKeyDown:h=>{h.nativeEvent.isComposing||(h.key==="Enter"&&h.currentTarget.blur(),h.key==="Escape"&&(u(l.value),h.currentTarget.blur()))}}),l.ratio!=null&&s.jsxs("span",{className:`ratio ${l.ratio>=4.5?"ok":l.ratio>=3?"mid":"bad"}`,title:r.properties.contrastTitle,children:[r.properties.contrast," ",l.ratio.toFixed(2),":1 · ",l.ratio>=7?"AAA":l.ratio>=4.5?"AA":l.ratio>=3?r.properties.largeTextOnly:r.properties.tooLow]}),l.chips&&s.jsx("span",{className:"chips-row",children:l.chips.map(h=>s.jsx("button",{className:`tchip ${c===h?"on":""}`,onClick:p=>{p.preventDefault(),u(h),f(h)},children:h.replace("px","")},h))}),l.color&&s.jsx("span",{className:"swatches",children:(l.swatches??[]).map(h=>s.jsx("button",{className:`swatch ${c.toUpperCase()===h.value?"on":""}`,title:`${h.name} ${h.value}`,style:{background:h.value},onClick:p=>{p.preventDefault(),u(h.value),f(h.value)}},h.value))})]})}const ay=384,iy=l=>/^[\w./@:,=+-]+$/.test(l)?l:`'${l.replace(/'/g,"'\\''")}'`,Cx=l=>l>=1048576?`${(l/1048576).toFixed(1)} MB`:`${Math.max(1,Math.round(l/1024))} KB`;function Ex(l){const c=["npx easel-canvas export"];return l.dirFlag&&c.push(l.dirFlag),l.scope==="page"&&l.page&&c.push(`--page ${iy(l.pages.filter(u=>u.name===l.page.name).length>1?l.page.id:l.page.name)}`),l.scope==="boards"&&l.boards.length&&c.push(`--boards ${iy(l.boards.join(","))}`),l.single&&c.push("--single-file"),c.join(" ")}function Mx({pages:l,currentPage:c,selected:u}){const f=xy(),[h,p]=j.useState(!1),[v,C]=j.useState("all"),[N,S]=j.useState(!1),[y,b]=j.useState(null),[M,D]=j.useState(null),[q,K]=j.useState(null),[T,R]=j.useState({}),[W,ne]=j.useState({}),[F,fe]=j.useState({left:0,top:0,width:ay}),ie=j.useRef(null),ue=j.useRef(null),te=l.find(U=>U.id===c)??l[0],ce=v==="boards"&&!u.length||v==="page"&&!l.length?"all":v,je={scope:ce,page:ce==="page"?te==null?void 0:te.id:void 0,boards:ce==="boards"?u:void 0},Ce=(U=!0)=>{var ae;p(!1),U&&((ae=ie.current)==null||ae.focus())},lt=()=>{if(h)return Ce();C(u.length?"boards":"all"),p(!0)};j.useLayoutEffect(()=>{if(!h)return;const U=()=>{var oe;const ae=ie.current.getBoundingClientRect(),B=((oe=ie.current.closest(".oc-card"))==null?void 0:oe.getBoundingClientRect())??ae,re=Math.min(ay,window.innerWidth-16);fe({width:re,top:Math.round(ae.bottom+8),left:Math.round(Math.max(8,Math.min(B.right-re,window.innerWidth-re-8)))})};return U(),window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[h]),j.useLayoutEffect(()=>{h&&Bl(ue.current,".oc-seg button, .btn")}),j.useEffect(()=>{var B,re;if(!h)return;(re=(B=ue.current)==null?void 0:B.querySelector(".oc-seg [aria-checked='true']"))==null||re.focus();const U=oe=>{var se,ve;const de=oe.target;!((se=ue.current)!=null&&se.contains(de))&&!((ve=ie.current)!=null&&ve.contains(de))&&Ce(!1)},ae=oe=>{oe.key==="Escape"&&(oe.stopPropagation(),Ce())};return document.addEventListener("pointerdown",U,!0),window.addEventListener("keydown",ae,!0),()=>{document.removeEventListener("pointerdown",U,!0),window.removeEventListener("keydown",ae,!0)}},[h]),j.useEffect(()=>{h&&!y&&Te.get("/api/export").then(b,()=>{})},[h]);const zt=JSON.stringify(je);j.useEffect(()=>{if(!h||!N)return;let U=!0;return D(null),Te.post("/api/export/estimate",je).then(ae=>U&&D(ae.bytes),()=>{}),()=>{U=!1}},[h,N,zt]);const At=async U=>{if(!q){K(U),ne(ae=>({...ae,[U]:void 0}));try{const ae=await Te.post("/api/export",{...je,format:U==="pdf"||U==="png"?U:"web",singleFile:U==="single"});R(B=>({...B,[U]:ae})),U==="single"&&D(ae.bytes)}catch(ae){ne(B=>({...B,[U]:ae.message}))}finally{K(null)}}},et=()=>Te.post("/api/export/reveal",{}).catch(U=>f({tone:"error",text:U.message})),he=async U=>{try{await navigator.clipboard.writeText(U),f({tone:"ok",text:r.share.copied(U)})}catch{f({tone:"error",text:r.share.copyFailed})}},pe=N?"single":"web",Se=T[pe],Me=y&&!y.browser.ok?y.browser.reason??"":null,ke=(y==null?void 0:y.project)??"",ct=U=>`${ke?ke+"/":""}${U.mainRel.endsWith("/")||U.kind==="web"?U.outRel:U.mainRel}`,G=(y==null?void 0:y.single)??`${ke}-canvas.html`,J=(U,ae)=>s.jsxs("span",{className:"oc-res",role:"status",children:[s.jsxs("span",{className:"oc-rline",children:[s.jsx(P,{name:"check",size:16}),s.jsx("code",{children:U.kind==="single"?U.mainRel.split("/").pop():ct(U)})," ",U.kind==="single"?r.share.saved:r.share.exported]}),s.jsxs("span",{className:"oc-racts",children:[s.jsx("button",{className:"btn",title:r.share.revealTitle,onClick:()=>void et(),children:r.share.reveal}),ae.deploy&&U.deploy&&s.jsx("button",{className:"btn",title:r.share.copyDeployTitle(U.deploy),onClick:()=>void he(U.deploy),children:r.share.copyDeploy})]}),ae.hint&&s.jsx("span",{className:"oc-rhint",children:r.share.attachHint}),U.skipped.length>0&&s.jsx("span",{className:"oc-rhint",title:U.skipped.map(B=>`${B.ref} (${B.from}): ${B.reason}`).join(`
62
- `),children:r.share.skipped(U.skipped.length)})]}),k=(U,ae,B,re)=>s.jsxs("div",{className:"oc-orow",children:[s.jsx("span",{className:"out-ic",children:s.jsx(P,{name:ae})}),s.jsxs("span",{className:"oc-otext",children:[s.jsx("strong",{children:B}),s.jsx("span",{children:Me?`${r.share.unavailable} ${Me}`:re})]}),s.jsx("button",{className:"btn",disabled:!!Me,"aria-busy":q===U,onClick:()=>void At(U),children:q===U?r.share.working:r.share.export}),W[U]&&s.jsx(sy,{text:W[U]}),T[U]&&!W[U]&&J(T[U],{})]});return s.jsxs("div",{className:"share-wrap",children:[s.jsxs("button",{ref:ie,className:`share-btn ${h?"on":""}`,"aria-haspopup":"dialog","aria-expanded":h,"aria-label":r.share.button,title:r.share.buttonTitle,onClick:lt,children:[s.jsx(P,{name:"share",size:16})," ",s.jsx("span",{className:"share-label",children:r.share.button})]}),h&&s.jsxs("div",{ref:ue,className:"share-pop oc-share entering",role:"dialog","aria-label":r.share.title,style:{left:F.left,top:F.top,width:F.width},onKeyDown:U=>{U.stopPropagation()},children:[s.jsx("h4",{children:r.share.title}),s.jsxs("div",{className:"oc-seg",role:"radiogroup","aria-label":r.share.scope,children:[s.jsx("button",{role:"radio","aria-checked":ce==="all",className:ce==="all"?"on":"",onClick:()=>C("all"),children:r.share.whole}),s.jsx("button",{role:"radio","aria-checked":ce==="page",className:ce==="page"?"on":"",disabled:!l.length,title:l.length?te==null?void 0:te.name:r.share.pageNone,onClick:()=>C("page"),children:r.share.page}),u.length>0&&s.jsx("button",{role:"radio","aria-checked":ce==="boards",className:ce==="boards"?"on":"",onClick:()=>C("boards"),children:r.share.selected(u.length)})]}),s.jsxs("div",{className:"oc-out",children:[s.jsxs("div",{className:"oc-orow first",children:[s.jsx("span",{className:"out-ic",children:s.jsx(P,{name:N?"file":"folder"})}),s.jsxs("span",{className:"oc-otext",children:[s.jsx("strong",{children:N?r.share.singleTitle:r.share.webTitle}),s.jsx("span",{children:N?s.jsxs(s.Fragment,{children:[s.jsx("code",{children:G}),r.share.singleHint(M==null?r.share.measuring:Cx(M))]}):r.share.webHint}),s.jsxs("label",{className:"oc-sw",children:[s.jsx("button",{type:"button",role:"switch","aria-checked":N,className:`switch ${N?"on":""}`,onClick:()=>S(U=>!U)}),s.jsx("span",{children:r.share.singleSwitch})]})]}),s.jsx("button",{className:"btn","aria-busy":q===pe,onClick:()=>void At(pe),children:q===pe?r.share.working:N?r.share.save:r.share.export}),W[pe]&&s.jsx(sy,{text:W[pe]}),Se&&!W[pe]&&J(Se,{deploy:!N,hint:N})]}),k("pdf","pdf",r.share.pdfTitle,r.share.pdfHint),k("png","image",r.share.pngTitle,r.share.pngHint)]}),s.jsxs("div",{className:"oc-pfoot",children:[N&&s.jsx("span",{children:r.share.largeFiles}),s.jsxs("span",{children:[r.share.sameAs," ",s.jsx("code",{children:Ex({dirFlag:y==null?void 0:y.dirFlag,scope:ce,page:te,pages:l,boards:u,single:N})})]})]})]})]})}function sy({text:l}){return s.jsxs("span",{className:"oc-err",role:"alert",children:[s.jsx(P,{name:"warn",size:16}),s.jsx("span",{children:l})]})}const kx=400,bt=navigator.platform.includes("Mac")?"⌘":"Ctrl+",Cy=l=>`design-canvas:${l}`;function zx(l){try{return JSON.parse(localStorage.getItem(Cy(l))??"{}")}catch{return{}}}const Ax=[{id:"blank",label:r.templates.blank,size:"390×844",w:390,h:844},{id:"mobile",label:r.templates.mobile,size:"390×844",w:390,h:844},{id:"desktop",label:r.templates.desktop,size:"1440×900",w:1440,h:900},{id:"doc",label:r.templates.doc,size:"800×1000",w:800,h:1e3}],bi=[{id:"select",icon:"select",label:r.tools.select,hint:r.toolHints.select,key:"V"},{id:"hand",icon:"hand",label:r.tools.hand,hint:r.toolHints.hand,key:"H"},{id:"board",icon:"board",label:r.tools.board,hint:r.toolHints.board,key:"B"},{id:"title",icon:"title",label:r.tools.title,hint:r.toolHints.title,key:"T"},{id:"sticky",icon:"sticky",label:r.tools.sticky,hint:r.toolHints.sticky,key:"N"},{id:"rect",icon:"rect",label:r.tools.rect,hint:r.toolHints.rect,key:"R"},{id:"oval",icon:"oval",label:r.tools.oval,hint:r.toolHints.oval,key:"O"},{id:"line",icon:"line",label:r.tools.line,hint:r.toolHints.line,key:"L"},{id:"arrow",icon:"arrow",label:r.tools.arrow,hint:r.toolHints.arrow,key:"A"},{id:"pen",icon:"pen",label:r.tools.pen,hint:r.toolHints.pen,key:"P"}],Ox=["rect","oval","line","arrow","pen"];function Dx(){var Oc,Dc,Rc,_c,Nn,Va,hs,bo,xo,wo,jo,ms,Bc,ja,gs;const[l,c]=j.useState(null),[u,f]=j.useState(null),[h,p]=j.useState({x:0,y:0,zoom:.1}),[v,C]=j.useState(null),[N,S]=j.useState("select"),[y,b]=j.useState([]),[M,D]=j.useState([]),q=M.length===1?M[0]:null,K=d=>D(d?[d]:[]),[T,R]=j.useState(null),[W,ne]=j.useState(null),[F,fe]=j.useState(null),[ie,ue]=j.useState(null),te=j.useRef(null),[ce,je]=j.useState(null),[Ce,lt]=j.useState(null),[zt,At]=j.useState(!1),[et,he]=j.useState(""),[pe,Se]=j.useState(null),[Me,ke]=j.useState(!0),[ct,G]=j.useState(()=>({w:window.innerWidth,h:window.innerHeight}));j.useEffect(()=>{const d=()=>G({w:window.innerWidth,h:window.innerHeight});return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]);const J=ct.w<=1e3,k=ct.w<=480,[U,ae]=j.useState(!0),[B,re]=j.useState(!1),[oe,de]=j.useState(null),[se,ve]=j.useState({canUndo:!1,canRedo:!1,undo:[],redo:[]}),[gt,at]=j.useState({}),[Nt,it]=j.useState(null),[Ee,$e]=j.useState(null),[bn,Ul]=j.useState([]),[Tt,cn]=j.useState("inspect"),[jl,Sl]=j.useState(""),[sa,Un]=j.useState({comments:[],refs:[]}),[il,Hl]=j.useState({}),xn=j.useRef(new Set),xi=j.useCallback(d=>(xn.current.add(d),()=>void xn.current.delete(d)),[]),Ra=j.useRef(null),_a=j.useRef(0),[rn,Hn]=j.useState("boards"),[Ll,$l]=j.useState(0),[Nl,Fn]=j.useState(null),[rt,Ke]=j.useState([]),Pt=rt.length===1?rt[0]:null,Tl=d=>Ke(d?[d]:[]),[Yl,sl]=j.useState(0),Et=G0(Yl),[Gl,oa]=j.useState(()=>{try{return localStorage.getItem("design-canvas:author")??""}catch{return""}});j.useEffect(()=>{Gl||Te.get("/api/me").then(d=>d.name&&oa(d.name)).catch(()=>{})},[]),j.useEffect(()=>Tb(Gl),[Gl]);const ol=Gl||r.app.defaultAuthor,[Gt,wn]=j.useState(null),[Rt,ca]=j.useState(null),wi=j.useRef(null),ls=j.useRef(()=>{}),[ql,ra]=j.useState(!0),[En,Mn]=j.useState(()=>{try{return localStorage.getItem("design-canvas:theme")||"system"}catch{return"system"}});j.useEffect(()=>{En==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",En);try{localStorage.setItem("design-canvas:theme",En)}catch{}},[En]);const[Ln,Wn]=j.useState(null),ua=j.useRef(!1),ut=j.useRef(new Map),[$n,ji]=j.useState(0),z=j.useRef(null),H=xy(),xe=R0();j.useEffect(()=>{let d=!1;const g="design-canvas:update-seen";return Te.update().then(({update:x})=>{if(d||!x)return;try{if(localStorage.getItem(g)===x.latest)return}catch{}const E=()=>{try{localStorage.setItem(g,x.latest)}catch{}};H({dot:!0,text:r.update.out(x.latest),code:x.command,ms:12e3,action:{label:r.update.copy,run:()=>(E(),void navigator.clipboard.writeText(x.command).then(()=>H({tone:"ok",text:r.update.copied})))},close:{label:r.update.hide,run:E}})}).catch(()=>{}),()=>void(d=!0)},[H]);const me=j.useCallback(d=>ut.current.get(d)??null,[$n]),ze=j.useRef(null),We=j.useRef(null);We.current=u;const Be=j.useRef(null),Ye=j.useCallback(async()=>{try{const d=await Te.board();c(d),f(d.board),it(null)}catch(d){it(String(d.message))}},[]),un=j.useCallback(()=>Te.get("/api/comments").then(d=>Ul(d.comments)).catch(()=>{}),[]),Ue=j.useCallback(()=>Te.get("/api/history").then(ve).catch(()=>{}),[]),Ot=j.useCallback(()=>Te.get("/api/errors").then(d=>Hl(d.errors)).catch(()=>{}),[]),Xe=Db((l==null?void 0:l.dir)??null),[xt,Cl]=j.useState(null),[El,hc]=j.useState(null),[Si,Ba]=j.useState(!1),[Xl,as]=j.useState({}),[dn,kn]=j.useState(null),[Ni,da]=j.useState(!1),qt=j.useRef(null),Ps=j.useRef(null),eo=j.useRef(null),to=j.useRef(null);j.useLayoutEffect(()=>{Bl(Ps.current),Bl(eo.current),Bl(to.current)}),j.useEffect(()=>{Ye(),un(),Ue(),Ot()},[Ye,un,Ue,Ot]),j.useEffect(()=>{document.title=u!=null&&u.title?r.app.docTitle(u.title):r.app.title},[u==null?void 0:u.title]),j.useEffect(()=>{const d=new Map,g=E=>{const O=d.get(E);window.clearTimeout(O.t),O.t=window.setTimeout(()=>void Te.put("/api/errors",{file:E,errors:O.list}).catch(()=>{}),200)},x=E=>{const O=E.data;if(!O||O.type!=="dc-error"||typeof O.file!="string")return;if(O.start)return void d.set(O.file,{list:[],loaded:!1});const Q=d.get(O.file)??{list:[],loaded:!0};if(d.set(O.file,Q),O.loaded)return Q.loaded=!0,g(O.file);Q.list.length<20&&!Q.list.some(le=>le.message===O.message)&&Q.list.push({kind:O.kind,message:O.message,line:O.line}),Q.loaded&&g(O.file)};return window.addEventListener("message",x),()=>window.removeEventListener("message",x)},[]);const wt=j.useCallback((d,g)=>{const x=We.current;if(!x)return;const E=d(x);if(We.current=E,f(E),!g)return;Be.current&&window.clearTimeout(Be.current);const O=()=>(_a.current++,Te.saveBoard(We.current,g==="draft"?void 0:g).catch(Q=>H({tone:"error",text:r.toast.saveFailed(Q.message)})).finally(()=>_a.current--));g==="draft"?Be.current=window.setTimeout(()=>{Be.current=null,O()},kx):O()},[H]),jn=j.useCallback(async d=>{try{const g=await Te.post(`/api/history/${d}`,{});g.label?H({text:r.toast.undoRedoDone(d,g.label)}):H({text:d==="undo"?r.toast.nothingToUndo:r.toast.nothingToRedo}),await Ye()}catch(g){H({tone:"error",text:String(g.message)})}Ue()},[H,Ye,Ue]),Ht={label:r.toast.undoAction,run:()=>void jn("undo")},_t=j.useCallback(async(d,g=T)=>{var x;if(!g)return!1;try{return await Te.post("/api/edit",{file:g,...d}),!0}catch(E){return(x=ze.current)==null||x.setError(String(E.message)),H({tone:"error",text:String(E.message)}),!1}},[T,H]),no=j.useCallback((d,g,x)=>{var Re,st,Vt;if(Array.from(g.children).some(Ve=>Ve.tagName!=="BR")){(Re=ze.current)==null||Re.setError(r.toast.textOnly);return}const E=g.innerText??"";ne(d),g.contentEditable="true",g.focus();const O=g.ownerDocument,Q=O.createRange();Q.selectNodeContents(g),(st=O.getSelection())==null||st.removeAllRanges(),(Vt=O.getSelection())==null||Vt.addRange(Q);const le=Ve=>{if(g.contains(Ve.target))return void(Ve.type==="click"&&Ve.preventDefault());Ve.preventDefault(),Ve.stopPropagation(),Ve.type==="mousedown"&&g.blur()};O.addEventListener("mousedown",le,!0),O.addEventListener("click",le,!0);let ge=!1;const Oe=async()=>{var On;g.removeEventListener("keydown",nt),O.removeEventListener("mousedown",le,!0),O.removeEventListener("click",le,!0),g.contentEditable="false",ne(null),document.activeElement===((On=O.defaultView)==null?void 0:On.frameElement)&&oy();const Ve=(g.innerText??"").replace(/\n$/,"");if(ge||Ve===E){ge&&(g.innerText=E);return}const{hash:An}=await Te.get(`/api/element?f=${encodeURIComponent(d)}&path=${encodeURIComponent(x)}`);await _t({op:"setText",path:x,hash:An,text:Ve},d)||(g.innerText=E)},nt=Ve=>{Ve.isComposing||Ve.keyCode===229||(Ve.key==="Enter"&&!Ve.shiftKey?(Ve.preventDefault(),g.blur()):Ve.key==="Escape"&&(ge=!0,g.blur()))};let Ze=!1,Qe=!1;const Xt=()=>Ze=!0,Bt=()=>{Ze=!1,Qe&&tn()},tn=()=>{g.removeEventListener("compositionstart",Xt),g.removeEventListener("compositionend",Bt),g.removeEventListener("blur",Ka),Oe()},Ka=()=>{Ze?Qe=!0:tn()};g.addEventListener("compositionstart",Xt),g.addEventListener("compositionend",Bt),g.addEventListener("keydown",nt),g.addEventListener("blur",Ka)},[_t]),Ua=(d,g)=>Te.get(`/api/element?f=${encodeURIComponent(d)}&path=${encodeURIComponent(g)}`).then(x=>x.hash),tt=async(d,g)=>{var E;if(!T)return;const x=await Ua(T,d);await _t({op:"move",path:d,hash:x,...g})&&((E=ze.current)==null||E.select([Rx(d,g.toParentPath,g.index)]),H({text:g.freeze.length?r.toast.movedFrozen:r.toast.moved,action:Ht}))},lo=async()=>{var x;const d=be.state.selection;if(!T||!d)return;const{source:g}=await Te.get(`/api/element?f=${encodeURIComponent(T)}&path=${encodeURIComponent(d.path)}&full=1`);try{localStorage.setItem("design-canvas:clip",JSON.stringify({source:g,file:T,path:d.path,tag:d.tag}))}catch{}await((x=navigator.clipboard)==null?void 0:x.writeText(g).catch(()=>{})),H({tone:"ok",text:r.toast.copiedElement(d.tag,bt)})},Ti=async()=>{if(!T)return;let d=null;try{d=JSON.parse(localStorage.getItem("design-canvas:clip")??"null")}catch{d=null}if(!d)return H({text:r.toast.nothingCopied});const g=be.state.selection,x=(g==null?void 0:g.file)===T?g.path:"";if(await _t({op:"insert",path:x,hash:x?g.hash:void 0,position:"after",html:d.source})&&(H({tone:"ok",text:r.toast.pasted(d.file,d.tag),action:Ht}),x)){const E=x.split("/");E[E.length-1]=String(Number(E[E.length-1])+1),setTimeout(()=>{var O;return void((O=ze.current)==null?void 0:O.select([E.join("/")]))},600)}},Ci=(d,g)=>Fn(()=>async x=>{if(Fn(null),!T)return;const E=await Ua(T,d);(g?await _t({op:"setAttr",path:d,hash:E,name:"src",value:x.ref}):await _t({op:"setStyle",path:d,hash:E,prop:"background-image",value:`url("${x.ref}")`}))&&H({tone:"ok",text:r.toast.imageReplaced(x.name),action:Ht})}),Yn=j.useRef(null),be=a0(T,me);ze.current=be;const ao=j.useRef(Promise.resolve()),mc=(d,g)=>{var O;const x=T,E=(O=be.state.selection)==null?void 0:O.path;!x||!E||(ao.current=ao.current.then(async()=>{const Q=await Ua(x,E).catch(()=>null);Q&&await _t({op:"setStyle",path:E,hash:Q,prop:d,value:g},x)}))};j.useEffect(()=>Cb(d=>{if(d.type==="file-changed")at(g=>({...g,[d.file]:(g[d.file]??0)+1})),d.kind!=="change"&&Ye();else if(d.type==="board-changed"&&d.source!==If)Ye(),Xe.reload();else if(d.type==="comments-changed")un();else if(d.type==="history-changed")Ue(),Xe.reload();else if(d.type==="errors-changed")Ot();else if(d.type==="assets-changed")$l(g=>g+1);else if(d.type==="tokens-changed")sl(g=>g+1);else if(d.type==="app-changed")window.location.reload();else if(d.type==="chat")for(const g of xn.current)g(d.id,d.ev);else if(d.type==="hello")for(const g of xn.current)g("",{kind:"boot",boot:d.boot});else d.type==="occupancy"&&as(d.boards)}),[Ye,un,Ue,Ot,Xe.reload]);const jt=(u==null?void 0:u.pages)??[],Sn=((Oc=jt.find(d=>d.id===v))==null?void 0:Oc.id)??((Dc=jt[0])==null?void 0:Dc.id)??null,fa=j.useCallback(d=>!jt.length||(d.page??jt[0].id)===Sn,[jt,Sn]),ft=j.useMemo(()=>u?[...new Set(u.order)].filter(d=>u.boards[d]&&fa(u.boards[d])):[],[u,fa]),Ei=j.useMemo(()=>u?Object.keys(u.notes).filter(d=>fa(u.notes[d])):[],[u,fa]),Zt=Ee??ct,Gn=()=>{const d=J?8:12,g=!J&&Me?d+240+d:0,x=J?Zt.w:Zt.w-d-288,E=J?d+48:0,O=Zt.h-(J?64:68)-36;return{x:g,y:E,w:x-g,h:O-E}},ha=(d,g)=>{const x=Gn();p(E=>({...E,x:Math.round(x.x+x.w/2-d*E.zoom),y:Math.round(x.y+x.h/2-g*E.zoom)}))};j.useEffect(()=>{if(ua.current||!u||!Ee)return;ua.current=!0;const d=zx(u.title);window.innerWidth<1e3?ke(!1):d.left!=null&&ke(d.left),d.minimap!=null&&ae(d.minimap);const g=u.launch;if(g!=null&&g.page?C(g.page):d.page&&C(d.page),(g==null?void 0:g.view)==="focused"&&g.file&&u.boards[g.file]&&Se(g.file),d.view&&!(g!=null&&g.page))p(d.view);else if(!d.view&&u.order.length>0){const x=u.order.find(O=>u.boards[O]&&fa(u.boards[O]))??u.order[0],E=u.boards[x];if(E){const O=ts([E],Ee,80,Gn());p({...O,zoom:Math.min(O.zoom,1)}),b([x]),At(!0)}else p(ts(Object.values(u.boards),Ee,60,Gn()))}else p(ts(Object.values(u.boards),Ee,60,Gn()))},[u,Ee]),j.useEffect(()=>{if(!u||!ua.current)return;const d=window.setTimeout(()=>{try{localStorage.setItem(Cy(u.title),JSON.stringify({view:h,page:Sn,left:J?void 0:Me,minimap:U}))}catch{}},300);return()=>window.clearTimeout(d)},[h,Sn,Me,U,u==null?void 0:u.title]),j.useEffect(()=>{if(!u)return;const d=window.setTimeout(()=>{var le;const g=-h.x/h.zoom,x=-h.y/h.zoom,E=Zt.w/h.zoom,O=Zt.h/h.zoom,Q=pe?[pe]:ft.filter(ge=>{const Oe=u.boards[ge];return Oe.x<g+E&&Oe.x+Oe.w>g&&Oe.y<x+O&&Oe.y+Oe.h>x});Te.put("/api/context",{mode:ce?"play":pe?"focus":T?"edit":"canvas",page:Sn,pageName:((le=jt.find(ge=>ge.id===Sn))==null?void 0:le.name)??null,visibleArtboards:Q,selectedArtboards:y,dirty:_a.current>0||!!Be.current}).catch(()=>{})},300);return()=>window.clearTimeout(d)},[h,Sn,y,T,pe,ce,ft,Zt.w,Zt.h]),j.useEffect(()=>{!Ln||!u||!Ln.every(d=>u.boards[d])||(b(Ln),p(ts(Ln.map(d=>u.boards[d]),Zt,80,Gn())),Wn(null))},[Ln,u]);const gc=d=>({x:d.x,y:d.y,w:d.w??d.maxW??400,h:d.kind==="title"?90:200}),ma=()=>{u&&p(ts([...ft.map(d=>u.boards[d]),...Ei.map(d=>gc(u.notes[d]))],Zt,60,Gn()))},qn=d=>{!u||!d.length||p(ts(d.map(g=>u.boards[g]).filter(Boolean),Zt,80,Gn()))},Ha=d=>p(g=>{const x=Is(g.zoom*d,eh,th),E=Gn(),O=E.x+E.w/2,Q=E.y+E.h/2;return{zoom:x,x:Math.round(O-(O-g.x)/g.zoom*x),y:Math.round(Q-(Q-g.y)/g.zoom*x)}}),La=d=>Ha(d/h.zoom);j.useEffect(()=>{if(!zt)return;let d=!1;const g=window.setTimeout(()=>d=!0,1500),x=()=>d&&At(!1),E=window.setTimeout(()=>At(!1),15e3);return window.addEventListener("pointerdown",x,!0),window.addEventListener("keydown",x,!0),()=>{window.clearTimeout(g),window.clearTimeout(E),window.removeEventListener("pointerdown",x,!0),window.removeEventListener("keydown",x,!0)}},[zt]);const Ml=(d,g="replace")=>{b(x=>g==="replace"?d:g==="add"?[...new Set([...x,...d])]:d.reduce((E,O)=>E.includes(O)?E.filter(Q=>Q!==O):[...E,O],x)),g==="replace"&&R(null),d.length&&g==="replace"&&(D([]),Ke([]))},ga=()=>jt.length&&Sn?{page:Sn}:{},is=async(d,g="blank")=>{try{const{file:x}=await Te.post("/api/boards/create",{...d,template:g,...ga()});await Ye(),b([x]),S("select"),H({tone:"ok",text:r.toast.boardCreated(x),action:Ht})}catch(x){H({tone:"error",text:r.toast.boardCreateFailed(x.message)})}},ss=async d=>{if(!d.length||!u)return;const g=d.map(E=>{var O;return((O=u.boards[E])==null?void 0:O.title)??E});if(await xe.confirm({title:r.dialog.deleteBoardsTitle(d.length,g[0]),body:r.dialog.deleteBoardsBody,ok:r.dialog.delete,danger:!0}))try{await Te.post("/api/boards/delete",{files:d}),T&&d.includes(T)&&R(null),b([]),await Ye(),H({text:r.toast.boardsDeleted(d.length),action:Ht})}catch(E){H({tone:"error",text:String(E.message)})}},$a=async d=>{try{const g=await Te.post("/api/boards/duplicate",{file:d});await Ye(),b([g.file]),H({tone:"ok",text:r.toast.duplicated(g.file),action:Ht})}catch(g){H({tone:"error",text:String(g.message)})}},zn=async d=>{var E;const g=(E=We.current)==null?void 0:E.boards[d];if(!g)return;const x=await xe.prompt({title:r.dialog.renameBoardTitle,label:r.dialog.name,value:g.title??d.replace(/\.html$/,""),ok:r.dialog.rename});if(!(!x||x.value.trim()===(g.title??"")))try{await Te.post("/api/boards/rename",{file:d,title:x.value.trim()}),await Ye(),H({tone:"ok",text:r.toast.renamed,action:Ht})}catch(O){H({tone:"error",text:String(O.message)})}},os=async d=>{const{refs:g}=await Te.get(`/api/boards/refs?file=${encodeURIComponent(d)}`).catch(()=>({refs:[]})),x=await xe.prompt({title:r.dialog.renameFileTitle,label:r.dialog.fileName,value:d,hint:g.length?r.dialog.renameFileRefs(g.map(O=>O.file).join(", ")):r.dialog.renameFileNoRefs,ok:r.dialog.rename,extra:g.length?{label:r.dialog.renameFileExtra(g.reduce((O,Q)=>O+(Q.count??1),0)),checked:!0}:void 0});if(!x)return;let E=x.value.trim();if(E.endsWith(".html")||(E+=".html"),E!==d)try{await Te.post("/api/boards/rename",{file:d,newFile:E,updateRefs:x.extra}),T===d&&R(E),b([E]),await Ye(),H({tone:"ok",text:r.toast.fileRenamed(E,!!x.extra),action:Ht})}catch(O){H({tone:"error",text:String(O.message)})}},io=d=>{const g=Gn(),x=(g.x+g.w/2-h.x)/h.zoom,E=(g.y+g.h/2-h.y)/h.zoom;is({x:Math.round(x-d.w/2),y:Math.round(E-d.h/2),w:d.w,h:d.h},d.id).then(()=>p(ts([{x:x-d.w/2,y:E-d.h/2,w:d.w,h:d.h}],Zt,80,Gn())))},Ya=d=>de({x:d.clientX,y:d.clientY,up:!0,title:r.menu.newBoard,items:Ax.map(g=>({label:`${g.label} · ${g.size}`,icon:g.id==="doc"?"page":"board",shortcut:g.id==="blank"?r.menu.drawWithB:void 0,run:()=>io(g)}))}),ln=(d,g)=>{cn("chat"),qa(!0),g!=null&&g.length&&b(g),d!=null&&Sl(d),setTimeout(()=>{var x;return(x=Ra.current)==null?void 0:x.focus()},0)},so=d=>ln(r.prompts.fixErrors(d.map(g=>`- ${g}: ${(il[g]??[{message:l!=null&&l.missing.includes(g)?r.menu.fileMissing:r.prompts.error}])[0].message}`).join(`
63
- `)),d.filter(g=>u==null?void 0:u.boards[g])),cl=(d,g)=>wt(x=>{const E=x.order.filter(Q=>!d.includes(Q)),O=x.order.filter(Q=>d.includes(Q));return{...x,order:g==="front"?[...E,...O]:[...O,...E]}},g==="front"?r.history.front:r.history.back),pc=(d,g,x=r.history.boardOptions)=>wt(E=>{const O={...E.boards[d],...g};for(const Q of Object.keys(O))O[Q]===void 0&&delete O[Q];return{...E,boards:{...E.boards,[d]:O}}},x),Vl=(d,g,x,E=y,O=M,Q=rt)=>({...d,boards:{...d.boards,...Object.fromEntries(E.filter(le=>d.boards[le]).map(le=>[le,{...d.boards[le],x:d.boards[le].x+g,y:d.boards[le].y+x,autoPlaced:void 0}]))},notes:{...d.notes,...Object.fromEntries(O.filter(le=>d.notes[le]).map(le=>[le,{...d.notes[le],x:d.notes[le].x+g,y:d.notes[le].y+x}]))},shapes:{...d.shapes??{},...Object.fromEntries(Q.filter(le=>{var ge;return(ge=d.shapes)==null?void 0:ge[le]}).map(le=>[le,{...d.shapes[le],x:d.shapes[le].x+g,y:d.shapes[le].y+x}]))}}),kl=(d,g)=>wt(x=>Vl(x,d,g),y.length?r.history.moveBoard:M.length?r.history.moveNote:r.history.moveShape),cs=()=>{var g;let d="";do d=`n${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;while((g=We.current)!=null&&g.notes[d]);return d},pa=(d,g)=>{var Q;if(Object.keys(((Q=We.current)==null?void 0:Q.notes)??{}).length>=Up)return H({tone:"error",text:r.toast.notesMax(Up)});const x=cs(),E=Math.round(g.x),O=Math.round(g.y);wt(le=>({...le,notes:{...le.notes,[x]:d==="title"?{kind:d,x:E,y:O,text:r.defaults.newTitle,maxW:2e3,...ga()}:{kind:d,x:E,y:O,text:r.defaults.note,w:400,...ga()}}}),d==="title"?r.history.addTitle:r.history.addNote),K(x),b([]),S("select")},Xn=d=>{wt(g=>{const x={...g.notes};for(const E of d)delete x[E];return{...g,notes:x}},r.history.deleteNote),D([]),H({text:r.toast.noteDeleted,action:Ht})},rl=(u==null?void 0:u.shapes)??{},Mi=j.useMemo(()=>Object.keys(rl).filter(d=>fa(rl[d])).sort((d,g)=>(rl[d].z??0)-(rl[g].z??0)||(d<g?-1:1)),[rl,fa]),oo=(d,g=r.history.addShape)=>{var O,Q,le;let x="";do x=`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`;while((Q=(O=We.current)==null?void 0:O.shapes)!=null&&Q[x]);const E=Math.max(0,...Object.values(((le=We.current)==null?void 0:le.shapes)??{}).map(ge=>ge.z??0))+1;return wt(ge=>({...ge,shapes:{...ge.shapes??{},[x]:{...d,z:E,...ga()}}}),g),Tl(x),b([]),K(null),S("select"),x},ki=(d,g,x)=>wt(E=>({...E,shapes:{...E.shapes??{},[d]:{...E.shapes[d],...g}}}),x),ya=d=>{wt(g=>{const x={...g.shapes??{}};for(const E of d)delete x[E];return{...g,shapes:x}},r.history.deleteShape),Ke([]),H({text:d.length===1?r.toast.shapeDeleted:r.toast.shapesDeleted(d.length),action:Ht})},zi=(d,g)=>{var E;const x=Object.values(((E=We.current)==null?void 0:E.shapes)??{}).map(O=>O.z??0);ki(d,{z:g==="front"?Math.max(0,...x)+1:Math.min(0,...x)-1},g==="front"?r.history.shapeFront:r.history.shapeBack)},Qt=(d,g)=>{const x=new Image;x.onload=()=>{const E=Math.min(1,600/Math.max(x.naturalWidth,x.naturalHeight)),O=Math.round(x.naturalWidth*E)||300,Q=Math.round(x.naturalHeight*E)||200,le=g??{x:(Zt.w/2-h.x)/h.zoom-O/2,y:(Zt.h/2-h.y)/h.zoom-Q/2};oo({kind:"image",x:Math.round(le.x),y:Math.round(le.y),w:O,h:Q,src:d.ref},r.history.addImage)},x.onerror=()=>H({tone:"error",text:r.toast.imageReadFailed}),x.src=d.url};j.useEffect(()=>{const d=async g=>{var E,O,Q;if(T||(O=(E=g.target)==null?void 0:E.closest)!=null&&O.call(E,"input,textarea,[contenteditable=true]"))return;const x=Array.from(((Q=g.clipboardData)==null?void 0:Q.files)??[]).filter(le=>le.type.startsWith("image/"));if(x.length){g.preventDefault();try{const[le]=await Zf(x.map(ge=>ge.name?ge:new File([ge],r.defaults.pastedImage,{type:ge.type})));Qt(le)}catch(le){H({tone:"error",text:String(le.message)})}}};return window.addEventListener("paste",d),()=>window.removeEventListener("paste",d)});const Kl=async(d,g)=>{var O,Q;let x=Math.round(g.x);const E=[];for(const le of d)try{if(/\.html?$/i.test(le.name)){const ge=await le.text(),Oe=ge.match(/<meta[^>]+name=["']board-size["'][^>]+content=["'](\d+)x(\d+)/i),nt=Oe?Number(Oe[1]):390,Ze=Oe?Number(Oe[2]):844,Qe=((Q=(O=ge.match(/<title>([^<]*)<\/title>/i))==null?void 0:O[1])==null?void 0:Q.trim())||le.name.replace(/\.html?$/i,""),Xt=le.name.toLowerCase().replace(/\.htm$/,".html").replace(/[^a-z0-9._-]+/g,"-"),Bt=await Te.post("/api/boards/create",{file:Xt,html:ge,title:Qe,x,y:Math.round(g.y),w:nt,h:Ze,...ga()});E.push(Bt.file),x+=nt+80}else if(le.type.startsWith("image/")){const[ge]=await Zf([le]);Qt(ge,{x,y:g.y}),x+=400}else H({tone:"error",text:r.toast.importOnly(le.name)})}catch(ge){H({tone:"error",text:`${le.name}: ${ge.message}`})}E.length&&(await Ye(),Wn(E),H({tone:"ok",text:r.toast.imported(E.length),action:Ht}))},Ai=async d=>{var x;if(!u)return;const g=await xe.prompt({title:r.dialog.renameGroupTitle,label:r.dialog.name,value:((x=u.groupNames)==null?void 0:x[d])??d,ok:r.dialog.save});g!=null&&g.value.trim()&&wt(E=>({...E,groupNames:{...E.groupNames??{},[d]:g.value.trim()}}),r.history.renameGroup)},ul=async(d,g)=>{try{const x=await Te.post("/api/pages",d);return await Ye(),g&&H({tone:"ok",text:g,action:Ht}),x}catch(x){return H({tone:"error",text:String(x.message)}),null}},au=async()=>{if(jt.length>=40)return H({tone:"error",text:r.toast.pagesMax});const d=await xe.prompt({title:r.dialog.newPageTitle,label:r.dialog.name,value:r.dialog.newPageName(Math.max(jt.length,1)+1),ok:r.dialog.create});if(!(d!=null&&d.value.trim()))return;const g=await ul({action:"add",name:d.value.trim()});g!=null&&g.id&&C(g.id)},co=async d=>{const g=jt.find(E=>E.id===d),x=await xe.prompt({title:r.dialog.renamePageTitle,label:r.dialog.name,value:(g==null?void 0:g.name)??"",ok:r.dialog.rename});!(x!=null&&x.value.trim())||x.value.trim()===(g==null?void 0:g.name)||await ul({action:"rename",id:d,name:x.value.trim()})},ro=async d=>{const g=jt.find(E=>E.id===d),x=Object.values((u==null?void 0:u.boards)??{}).filter(E=>{var O;return(E.page??((O=jt[0])==null?void 0:O.id))===d}).length;await xe.confirm({title:r.dialog.deletePageTitle((g==null?void 0:g.name)??""),body:r.dialog.deletePageBody(x),ok:r.dialog.delete,danger:!0})&&(Sn===d&&C(null),await ul({action:"delete",id:d},r.toast.pageDeleted))},va=(d,g)=>void ul({action:"move",id:d,index:g}),rs=(d,g)=>{var E,O;const x=jt.findIndex(Q=>Q.id===d);de({x:g.clientX,y:g.clientY,title:(E=jt[x])==null?void 0:E.name,items:[{label:r.menu.rename,icon:"edit",run:()=>void co(d)},{label:r.menu.moveUp,icon:"chevronDown",disabled:x<=0,run:()=>va(d,x-1)},{label:r.menu.moveDown,icon:"chevronDown",disabled:x>=jt.length-1,run:()=>va(d,x+1)},{label:((O=u==null?void 0:u.launch)==null?void 0:O.page)===d?r.menu.unsetLaunchPage:r.menu.setLaunchPage,icon:"page",run:()=>wt(Q=>{var le;return{...Q,launch:{...Q.launch??{view:"canvas"},page:((le=Q.launch)==null?void 0:le.page)===d?void 0:d}}},r.history.launchPage)},...y.length?[{label:r.menu.moveSelectedToPage(y.length),icon:"page",run:()=>wt(Q=>({...Q,boards:{...Q.boards,...Object.fromEntries(y.map(le=>{var ge;return[le,{...Q.boards[le],page:d===((ge=jt[0])==null?void 0:ge.id)?void 0:d}]}))}}),r.history.moveToPage)}]:[],"sep",{label:r.menu.delete,icon:"trash",danger:!0,disabled:jt.length<=1,run:()=>void ro(d)}]})},uo=d=>{const g=u.boards[d],x=y.includes(d)?y:[d],E=x.length>1;return[{label:r.menu.selectInside,icon:"select",shortcut:"Enter",disabled:E,run:()=>wc(d)},...g!=null&&g.is_interactive?[{label:Ce===d?r.menu.stopPlay:r.menu.playInPlace,icon:"play",shortcut:"P",disabled:E,run:()=>Ce===d?Oi():lt(d)},{label:r.menu.playFullScreen,icon:"play",disabled:E,run:()=>je(d)}]:[],{label:r.menu.askReview,icon:"comment",run:()=>ln(r.prompts.review,x)},{label:r.menu.focusView,icon:"focus",shortcut:"F",disabled:E,run:()=>Se(d)},{label:r.menu.askAI,icon:"comment",shortcut:`${bt}J`,run:()=>ln(void 0,x)},...il[d]||l!=null&&l.missing.includes(d)?[{label:r.menu.askFixErrors,icon:"warn",run:()=>so([d])}]:[],{label:r.menu.goToBoard,icon:"fit",shortcut:"⇧2",run:()=>qn(x)},"sep",{label:r.menu.rename,icon:"title",shortcut:"F2",disabled:E,run:()=>void zn(d)},{label:r.menu.renameFile,icon:"link",disabled:E,run:()=>void os(d)},{label:r.menu.duplicate,icon:"copy",shortcut:`${bt}D`,disabled:E,run:()=>void $a(d)},"sep",{label:r.menu.front,icon:"front",shortcut:`${bt}]`,run:()=>cl(x,"front")},{label:r.menu.back,icon:"back",shortcut:`${bt}[`,run:()=>cl(x,"back")},"sep",{label:E?r.menu.deleteBoards(x.length):r.menu.delete,icon:"trash",shortcut:"⌫",danger:!0,run:()=>void ss(x)}]},iu=(d,g)=>{var x,E;u&&(d.type==="board"?(y.includes(d.file)||Ml([d.file]),de({x:g.clientX,y:g.clientY,title:((x=u.boards[d.file])==null?void 0:x.title)??d.file,items:uo(d.file)})):d.type==="note"?(K(d.id),de({x:g.clientX,y:g.clientY,title:((E=u.notes[d.id])==null?void 0:E.kind)==="title"?r.menu.title:r.menu.note,items:[{label:r.menu.duplicateInFront,icon:"copy",shortcut:`${bt}D`,run:()=>{const O=u.notes[d.id],Q=cs();wt(le=>({...le,notes:{...le.notes,[Q]:{...O,x:O.x+40,y:O.y+40}}}),r.history.duplicateNote),K(Q)}},"sep",{label:r.menu.delete,icon:"trash",shortcut:"⌫",danger:!0,run:()=>Xn([d.id])}]})):de({x:g.clientX,y:g.clientY,items:[{label:r.menu.newBoardHere,icon:"board",shortcut:"B",run:()=>void is({x:Math.round(d.x),y:Math.round(d.y),w:390,h:844})},{label:r.menu.mobileFrameHere,icon:"board",run:()=>void is({x:Math.round(d.x),y:Math.round(d.y)},"mobile")},{label:r.menu.titleHere,icon:"title",shortcut:"T",run:()=>pa("title",d)},{label:r.menu.noteHere,icon:"sticky",shortcut:"N",run:()=>pa("sticky",d)},"sep",{label:r.menu.selectAll,icon:"select",shortcut:`${bt}A`,run:()=>Ml(ft)},{label:r.menu.fitAll,icon:"fit",shortcut:"⇧1",run:ma},{label:r.menu.zoom100,icon:"search",shortcut:`${bt}0`,run:()=>La(1)},"sep",{label:r.menu.undo,icon:"undo",shortcut:`${bt}Z`,disabled:!se.canUndo,run:()=>void jn("undo")},{label:r.menu.redo,icon:"redo",shortcut:`⇧${bt}Z`,disabled:!se.canRedo,run:()=>void jn("redo")}]}))};Yn.current=(d,g)=>{var Q;if(!T)return;const x=()=>Te.get(`/api/element?f=${encodeURIComponent(T)}&path=${encodeURIComponent(d)}`).then(le=>le.hash),E=(Q=ut.current.get(T))!=null&&Q.contentDocument?Cn(ut.current.get(T).contentDocument,d):null,O=d.includes("/")?d.slice(0,d.lastIndexOf("/")):null;de({x:g.clientX,y:g.clientY,title:E?`<${E.tagName.toLowerCase()}>`:r.menu.element,items:[{label:r.menu.editText,icon:"edit",disabled:!E||E.children.length>0,run:()=>E&&no(T,E,d)},{label:r.menu.selectParent,icon:"layers",shortcut:"↑",disabled:O==null,run:()=>O!=null&&void be.select([O])},{label:r.menu.elementToAI,icon:"comment",run:()=>ln()},{label:r.menu.copy,icon:"copy",shortcut:`${bt}C`,run:()=>void lo()},{label:r.menu.pasteAfter,icon:"copy",shortcut:`${bt}V`,run:()=>void Ti()},...(E==null?void 0:E.tagName)==="IMG"?[{label:r.menu.replaceImage,icon:"page",run:()=>Ci(d,!0)}]:[],{label:r.menu.copyForAI,icon:"copy",run:()=>void navigator.clipboard.writeText(`${T} ${d} <${E==null?void 0:E.tagName.toLowerCase()}> "${((E==null?void 0:E.textContent)??"").trim().slice(0,60)}"`).then(()=>H({tone:"ok",text:r.toast.copied}))},"sep",{label:r.menu.duplicate,icon:"copy",shortcut:`${bt}D`,run:async()=>void _t({op:"duplicate",path:d,hash:await x()})},{label:r.menu.delete,icon:"trash",shortcut:"⌫",danger:!0,run:async()=>{await _t({op:"delete",path:d,hash:await x()})&&(be.select([]),H({text:r.toast.elementDeleted,action:Ht}))}}]})};const Oi=()=>{var g,x;const d=Ce;lt(null),(x=(g=document.activeElement)==null?void 0:g.blur)==null||x.call(g),oy(),d&&at(E=>({...E,[d]:(E[d]??0)+1}))};j.useEffect(()=>{if(!Ce)return;const d=ut.current.get(Ce);if(!d)return;const g=O=>O.key==="Escape"&&yc.current();let x=null;const E=()=>{x==null||x.removeEventListener("keydown",g,!0),x=d.contentDocument,x==null||x.addEventListener("keydown",g,!0)};return E(),d.addEventListener("load",E),()=>{d.removeEventListener("load",E),x==null||x.removeEventListener("keydown",g,!0)}},[Ce,$n]);const yc=j.useRef(()=>{});yc.current=Oi;const[Ga,qa]=j.useState(()=>!window.matchMedia("(max-width: 1000px)").matches),vc=j.useRef(!1);j.useEffect(()=>{const d=setTimeout(()=>vc.current=!0,1500);return()=>clearTimeout(d)},[]),j.useEffect(()=>{J&&vc.current&&qa(!0)},[J,y,T,Tt]),j.useEffect(()=>{J&&Me&&qa(!1)},[J,Me]),j.useEffect(()=>{J&&Ga&&ke(!1)},[J,Ga]);const su=()=>{const d=Me||Ga;ke(!d),qa(!d)},ou=d=>{const g=[".oc-dock",".oc-left",".canvas",".oc-right"].map(Q=>document.querySelector(Q)).filter(Boolean),x=g.findIndex(Q=>Q.contains(document.activeElement)),E=g[(x+(d?-1:1)+g.length)%g.length],O=E.matches(".canvas")?E:E.querySelector("button:not([disabled]), input, select, textarea, [tabindex]");E.matches(".canvas")&&(E.tabIndex=-1),(O??E).focus()},cu=async d=>{if(!T)return;const g=[...be.state.paths].sort((E,O)=>Number(E.split("/").pop())-Number(O.split("/").pop())),x=await Promise.all(g.map(E=>Ua(T,E)));await _t({op:"wrap",paths:g,hashes:x,display:d})&&(be.select([g[0]]),H({tone:"ok",text:r.toast.wrapped(d),action:Ht}))},fo=async(d,g)=>{try{await Te.put("/api/tokens",{...d,label:g}),sl(x=>x+1),H({tone:"ok",text:g===r.history.changeTheme?r.toast.theme(d.active):r.toast.tokensSaved,action:Ht})}catch(x){H({tone:"error",text:String(x.message)})}},Zl=(d,g)=>{if(T===d){g.join()!==be.state.paths.join()&&be.select(g);return}wi.current={file:d,paths:g},R(d),b([d]),D([]),Ke([])},bc=(d,g)=>Zl(d,[g]),xc=(d,g,x)=>{const E=Af(ut.current.get(d),g.clientX,g.clientY);if(!E)return void(!x.add&&T===d&&R(null));if(x.add&&T===d){const O=be.state.paths;return void be.select(O.includes(E.path)?O.filter(Q=>Q!==E.path):[...O,E.path])}Zl(d,[E.path]),x.double&&no(d,E.el,E.path)};ls.current=xc,j.useEffect(()=>{var E,O;const d=wi.current,g=d&&T===d.file?ut.current.get(d.file):null;if(!d||!g)return;const x=()=>{wi.current=null,be.select(d.paths)};return((E=g.contentDocument)==null?void 0:E.readyState)==="complete"&&((O=g.contentDocument.body)!=null&&O.childElementCount)?x():(g.addEventListener("load",x,{once:!0}),()=>g.removeEventListener("load",x))},[T,$n]);const wc=d=>{var O,Q;const g=(O=ut.current.get(d))==null?void 0:O.contentDocument,x=g?Array.from(((Q=g.body)==null?void 0:Q.children)??[]).find(le=>!/^(SCRIPT|STYLE|TEMPLATE)$/.test(le.tagName)):null,E=x?al(x):"0";E!=null&&Zl(d,[E])};j.useEffect(()=>{T&&!(y.length===1&&y[0]===T)&&R(null)},[y]),j.useEffect(()=>{fe(null),ue(null)},[T,N]),j.useEffect(()=>{Ce&&T===Ce&&R(null)},[Ce]);const en=T??(y.length===1?y[0]:null),jc=j.useMemo(()=>{var d;return Q0(T?(d=ut.current.get(T))==null?void 0:d.contentDocument:null)},[T,$n,gt[T??""],(Rc=be.state.selection)==null?void 0:Rc.hash]);j.useEffect(()=>{if(!en)return wn(null);Te.get(`/api/lint?f=${encodeURIComponent(en)}`).then(d=>wn(d.files[en]??[])).catch(()=>wn(null))},[en,gt[en??""],Yl]),j.useEffect(()=>{if(!en)return ca(null);const d=()=>{var E;const x=(E=ut.current.get(en))==null?void 0:E.contentDocument;ca((x==null?void 0:x.readyState)==="complete"?q0(x,(Et==null?void 0:Et.minTarget)??48):null)},g=window.setTimeout(d,600);return()=>window.clearTimeout(g)},[en,$n,gt[en??""],Et==null?void 0:Et.minTarget,h.zoom>=.25]);const ho=d=>{var E;const g=d.currentTarget.getBoundingClientRect(),x=((E=d.currentTarget.closest(".oc-dock"))==null?void 0:E.getBoundingClientRect())??g;return{clientX:g.left,clientY:x.top-8}},ru=d=>de({x:d.clientX,y:d.clientY,up:!0,title:r.toolbar.canvasTools,items:bi.slice(0,5).map(g=>({label:g.label,icon:g.icon,shortcut:g.key,check:N===g.id,run:()=>S(g.id)}))}),Sc=d=>de({x:d.clientX,y:d.clientY,up:!0,title:r.toolbar.shapes,items:[...bi.slice(5).map(g=>({label:g.label,icon:g.icon,shortcut:g.key,check:N===g.id,run:()=>S(g.id)})),"sep",{label:r.toolbar.insertImage,icon:"image",run:()=>Fn(()=>g=>{Fn(null),Qt(g)})}]}),uu=d=>{const g=Et?Object.keys(Et.themes):[];de({x:d.clientX,y:d.clientY,right:!0,className:"view oc-menu",title:r.toolbar.viewMenu,head:J?s.jsx(Yf,{zoom:h.zoom,onZoom:Ha,onZoom100:()=>La(1),onFit:ma,menu:!0}):void 0,items:[...J?[{label:r.toolbar.history,icon:"clock",run:()=>go()},"sep"]:[],{label:r.toolbar.guides,icon:"grid",shortcut:"⌃G",check:ql,run:()=>ra(x=>!x)},{label:r.toolbar.minimap,icon:"map",shortcut:"M",check:J?B:U,run:Nc},{label:r.toolbar.leftPanel,icon:"panel",shortcut:`${bt}\\`,check:Me,run:()=>ke(x=>!x)},"sep",{label:r.toolbar.appearance(En),icon:En==="system"?"system":En==="light"?"sun":"moon",run:()=>Mn(x=>x==="system"?"light":x==="light"?"dark":"system")},...g.length>1?g.map(x=>({label:r.toolbar.themeOption(x),icon:"layers",check:Et.active===x,run:()=>void fo({...Et,active:x},r.history.changeTheme)})):[],"sep",{label:r.toolbar.snapshot,icon:"layers",run:()=>void Tc(d,!0)}]})},Nc=()=>J?re(d=>!d):ae(d=>!d),du=d=>de({x:d.clientX,y:d.clientY,title:(l==null?void 0:l.dir)??(u==null?void 0:u.title),items:[{label:r.boardList.search,icon:"search",shortcut:"⌘K",run:()=>{Hn("boards"),ke(!0),setTimeout(()=>{var g;return(g=z.current)==null?void 0:g.focus()},0)}},{label:r.toolbar.snapshot,icon:"layers",run:()=>void Tc(d)}]}),fu=(d,g)=>{!u||!l||de({x:d.clientX,y:d.clientY,title:r.toolbar.erroredBoardsN(g.length),items:[...g.slice(0,12).map(x=>{var E,O,Q;return{label:`${((E=u.boards[x])==null?void 0:E.title)??x} — ${(((Q=(O=il[x])==null?void 0:O[0])==null?void 0:Q.message)??r.menu.fileMissing).slice(0,40)}`,icon:"warn",run:()=>{Ml([x]),qn([x])}}}),"sep",{label:r.menu.askFixAll,icon:"comment",run:()=>so(g)},...l.missing.length?[{label:r.menu.cleanMissing(l.missing.length),icon:"trash",danger:!0,run:()=>{wt(x=>{const E={...x.boards};for(const O of l.missing)delete E[O];return{...x,boards:E,order:x.order.filter(O=>!l.missing.includes(O))}},r.history.cleanMissing),H({text:r.toast.cleanedUp(l.missing.length),action:Ht})}}]:[]]})},Tc=async(d,g=!1)=>{const x=await Te.get("/api/snapshots").catch(()=>null);if(!(x!=null&&x.git))return de({x:d.clientX,y:d.clientY,right:g,title:r.menu.snapshot,items:[{label:r.menu.notGit,disabled:!0,run:()=>{}}]});de({x:d.clientX,y:d.clientY,right:g,title:r.menu.snapshotStatus(x.branch??"",x.changed),items:[{label:x.changed?r.menu.snapshotNow:r.menu.nothingChanged,icon:"check",disabled:!x.changed,run:async()=>{const E=await xe.prompt({title:r.dialog.snapshotTitle,label:r.dialog.snapshotLabel,value:r.dialog.snapshotMessage(new Date().toLocaleDateString("en-CA")),hint:r.dialog.snapshotHint,ok:r.dialog.commit});if(E)try{const O=await Te.post("/api/snapshot",{message:E.value});H({tone:"ok",text:O.nothing?r.toast.nothingChanged:r.toast.snapshot(O.hash??"")})}catch(O){H({tone:"error",text:String(O.message)})}}},"sep",...x.snapshots.slice(0,10).map(E=>({label:`${E.hash} ${E.subject.slice(0,40)} · ${E.when}`,disabled:!0,run:()=>{}}))]})};j.useEffect(()=>ry(T),[T]);const hu=async d=>{const g=We.current,x=g&&Fr(g,d);if(!g||!x)return;const E=O=>{var Q;return((Q=g.boards[O])==null?void 0:Q.title)??O};kn(O=>O&&{...O,busy:!0});try{const O=await Te.post("/api/boards/use",{file:d});kn(null),T&&x.alts.includes(T)&&R(null),await Ye(),Wn([x.original]);const Q=x.chosen===x.original?r.occupancy.kept(E(x.original)):r.occupancy.applied(sx(E(x.chosen)),E(x.original));H({tone:"ok",text:Q,action:O.step?{label:r.occupancy.undo,run:()=>void Cc(O.step,Q,[x.original,...x.alts])}:Ht})}catch(O){kn(Q=>Q&&{...Q,busy:!1}),H({tone:"error",text:String(O.message)})}Ue(),Xe.reload()},mu=async d=>{const g=We.current,x=g&&Fr(g,d);if(!(!g||!x)){kn(E=>E&&{...E,busy:!0});try{const E=await Te.post("/api/boards/keep",{file:d});kn(null),await Ye();const O=r.occupancy.keptAll(x.kind,x.alts.length);H({text:O,action:E.step?{label:r.occupancy.undo,run:()=>void Cc(E.step,O)}:Ht})}catch(E){kn(O=>O&&{...O,busy:!1}),H({tone:"error",text:String(E.message)})}Ue(),Xe.reload()}},Cc=async(d,g,x=[])=>{try{await Te.post("/api/history/undo-steps",{ids:[d],mode:"rest"}),await Ye(),x.length&&Wn(x),H({text:r.toast.undoRedoDone("undo",g),action:{label:r.toolbar.redo,run:()=>void jn("redo")}})}catch(E){H({tone:"error",text:String(E.message)})}Ue(),Xe.reload()},Ec=j.useRef([]);j.useEffect(()=>{const d=[...y,...T?[T]:[]],g=d.filter(x=>!Ec.current.includes(x));Ec.current=d;for(const x of g)Xe.markSeen(Xe.tagsOf(x).flatMap(E=>E.steps))},[y,T]);const us=(d,g)=>Xe.tagsOf(d).find(x=>x.key===g)??null,gu=(d,g)=>{us(d,g)&&Cl(x=>(x==null?void 0:x.file)===d&&x.key===g?null:{file:d,key:g,conflict:null,busy:!1})},Di=j.useRef(null);j.useEffect(()=>{var x;const d=Di.current,g=xt&&us(xt.file,xt.key);Di.current=g?{id:`${xt.file}|${g.key}`,steps:g.steps}:null,d&&d.id!==((x=Di.current)==null?void 0:x.id)&&Xe.markSeen(d.steps)},[xt==null?void 0:xt.file,xt==null?void 0:xt.key]);const Ri=async(d,g,x)=>{var O,Q,le;Cl(ge=>ge&&{...ge,busy:!0});const E=((Q=(O=Xe.data)==null?void 0:O.steps.find(ge=>ge.id===g.steps[0]))==null?void 0:Q.name)??"";try{const ge=()=>Te.post("/api/history/undo-steps",{ids:g.steps,mode:x});g.run?await Te.post("/api/chat/undo-run",{id:g.run,mode:x}).catch(Oe=>Oe.status===404?ge():Promise.reject(Oe)):await ge(),Cl(null),H({text:r.toast.undoRedoDone("undo",g.steps.length===1?E:r.activity.changes(g.steps.length)),action:{label:r.toolbar.redo,run:()=>void jn("redo")}}),await Ye()}catch(ge){const Oe=ge,nt=Oe.status===409?(le=Oe.body)==null?void 0:le.conflicts:void 0;nt?Cl(Ze=>Ze&&{...Ze,busy:!1,conflict:[...new Set(nt.map(Qe=>{var Xt,Bt;return Qe.file.endsWith(".html")?((Bt=(Xt=We.current)==null?void 0:Xt.boards[Qe.file])==null?void 0:Bt.title)??Qe.file:Qe.file}))]}):(Cl(Ze=>Ze&&{...Ze,busy:!1}),H({tone:"error",text:Oe.message}))}Ue(),Xe.reload()},pu=async d=>{da(!0);try{await Te.post("/api/history/goto",{id:d.id}),H({text:r.activity.wentBack(d.name)}),await Ye()}catch(g){H({tone:"error",text:String(g.message)})}finally{da(!1),Ue(),Xe.reload()}},mo=j.useCallback(()=>Ba(!1),[]),go=()=>{Xe.reload(),Ba(!0)};j.useEffect(()=>{xt&&!us(xt.file,xt.key)&&Cl(null)},[Xe.data,Xe.now]);const po=j.useRef(()=>{});po.current=d=>{var Oe,nt,Ze,Qe,Xt,Bt,tn,Ka;if(!u||xe.state||pe||ce||gy(d)||d.isComposing)return;const g=d.metaKey||d.ctrlKey,x=d.key.toLowerCase(),E=y.length===1?y[0]:null,O=Re=>{d.preventDefault(),Re()};if(g&&x==="z")return O(()=>void jn(d.shiftKey?"redo":"undo"));if(g&&x==="y")return O(()=>void jn("redo"));if(g&&x==="j")return O(()=>Tt==="chat"?cn("inspect"):ln());if(g&&x==="k")return O(()=>{ke(!0),setTimeout(()=>{var Re;return(Re=z.current)==null?void 0:Re.focus()},0)});if(g&&x==="a"&&!T)return O(()=>Ml(ft));if(g&&x==="a"&&T){const Re=(Oe=ut.current.get(T))==null?void 0:Oe.contentDocument,st=(nt=be.state.selection)==null?void 0:nt.path,Vt=Re&&(st?(Ze=Cn(Re,st))==null?void 0:Ze.parentElement:Re.body.firstElementChild),Ve=Vt?Array.from(Vt.children).filter(An=>!/^(SCRIPT|STYLE)$/.test(An.tagName)).map(An=>al(An)).filter(An=>An!=null):[];return O(()=>Ve.length&&void be.select(Ve))}if(g&&x==="c"&&T&&be.state.selection)return O(()=>void lo());if(g&&x==="v"&&T)return O(()=>void Ti());if(g&&x==="d"&&T&&be.state.selection){const Re=be.state.selection;return O(()=>void _t({op:"duplicate",path:Re.path,hash:Re.hash}))}if(g&&x==="d"&&E&&!T)return O(()=>void $a(E));if(g&&d.key==="]"&&y.length)return O(()=>cl(y,"front"));if(g&&d.key==="["&&y.length)return O(()=>cl(y,"back"));if(g&&d.key==="0")return O(()=>La(1));if(g&&d.key==="1")return O(ma);if(g&&(d.key==="="||d.key==="+"))return O(()=>Ha(2));if(g&&d.key==="-")return O(()=>Ha(1/2));if(g&&d.key==="\\")return O(()=>su());if(d.ctrlKey&&!d.metaKey&&x==="g")return O(()=>ra(Re=>!Re));if(g&&x==="g"&&T&&be.state.paths.length>=2)return O(()=>void cu("flex"));if(g)return;if(d.shiftKey&&d.code==="Digit1")return O(ma);if(d.shiftKey&&d.code==="Digit2")return O(()=>qn(y));if(d.key==="Escape"){if(Ce)return O(()=>Oi());if(T)return O(()=>R(null));if(N!=="select")return O(()=>S("select"));b([]),K(null),Tl(null);return}if(d.key==="F6")return O(()=>ou(d.shiftKey));const Q=document.activeElement,le=!Q||Q===document.body||!!((Qe=Q.closest)!=null&&Qe.call(Q,".canvas"))||Q.tagName==="IFRAME";if(d.key==="Tab"&&!d.shiftKey&&le&&T&&be.state.selection){const Re=document.querySelector('.etb button[tabindex="0"]');if(Re)return O(()=>Re.focus())}if(d.key==="Tab"&&le&&!T&&ft.length){const Re=y.length?ft.indexOf(y[y.length-1]):-1,st=ft[(Re+(d.shiftKey?-1:1)+ft.length)%ft.length];return O(()=>{var Vt;Ml([st]),qn([st]),he(r.app.announceBoard(((Vt=u.boards[st])==null?void 0:Vt.title)??st,ft.indexOf(st)+1,ft.length))})}if(d.key==="Enter"&&!T&&y.length===1&&le)return O(()=>wc(y[0]));if(d.key==="Enter"&&T&&be.state.selection){const Re=(Xt=ut.current.get(T))==null?void 0:Xt.contentDocument,st=Re&&Cn(Re,be.state.selection.path),Vt=d.shiftKey?st==null?void 0:st.parentElement:st==null?void 0:st.firstElementChild,Ve=Vt&&Vt!==(Re==null?void 0:Re.body)?al(Vt):null;return Ve!=null?O(()=>void be.select([Ve])):void 0}if(x==="p"&&!g&&y.length===1&&((Bt=u.boards[y[0]])!=null&&Bt.is_interactive))return O(()=>Ce===y[0]?Oi():lt(y[0]));if((d.key==="Delete"||d.key==="Backspace")&&rt.length&&!T)return O(()=>ya(rt));if(d.key==="Delete"||d.key==="Backspace"){if(T&&be.state.selection){const Re=be.state.selection;return O(async()=>{await _t({op:"delete",path:Re.path,hash:Re.hash})&&(be.select([]),H({text:r.toast.elementDeleted,action:Ht}))})}return M.length||y.length&&!T?O(()=>{M.length&&Xn(M),y.length&&!T&&ss(y)}):void 0}if((d.key.startsWith("Arrow")||d.key==="Enter")&&T&&be.state.selection){const Re=be.state.selection,st=(tn=ut.current.get(T))==null?void 0:tn.contentDocument,Vt=st&&Cn(st,Re.path);if(!Vt)return;if(d.altKey&&(d.key==="ArrowUp"||d.key==="ArrowDown")){const An=Re.path.includes("/")?Re.path.slice(0,Re.path.lastIndexOf("/")):"",On=Number(Re.path.split("/").pop()),Za=d.key==="ArrowUp"?On-1:On+1;return Za<0||Za>=(((Ka=Vt.parentElement)==null?void 0:Ka.children.length)??0)?O(()=>{}):O(()=>void tt(Re.path,{toParentPath:An,index:Za,freeze:[]}))}const Ve=d.key==="ArrowUp"||d.key==="Enter"&&d.shiftKey?Vt.parentElement:d.key==="ArrowDown"||d.key==="Enter"?Vt.firstElementChild:d.key==="ArrowRight"?Vt.nextElementSibling:Vt.previousElementSibling;if(Ve&&Ve!==st.body){const An=al(Ve);if(An!=null)return O(()=>void be.select([An]))}return O(()=>{})}if(d.key.startsWith("Arrow")&&(y.length||M.length||rt.length)&&!T){const Re=d.altKey?100:d.shiftKey?10:1;return O(()=>kl(d.key==="ArrowLeft"?-Re:d.key==="ArrowRight"?Re:0,d.key==="ArrowUp"?-Re:d.key==="ArrowDown"?Re:0))}if(d.key==="F2"&&E)return O(()=>void zn(E));if(x==="f"&&E)return O(()=>Se(E));if(x==="m")return O(Nc);const ge=bi.find(Re=>Re.key.toLowerCase()===x);if(ge)return O(()=>S(ge.id))},j.useEffect(()=>{const d=g=>po.current(g);return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[]);const Mc=d=>{var nt,Ze;const g=bn.filter(Qe=>Qe.file===d&&!Qe.resolved),x=(nt=ut.current.get(d))==null?void 0:nt.contentDocument,E=T===d,O=ql?(((Ze=u==null?void 0:u.guides)==null?void 0:Ze[d])??[]).filter(Qe=>!Qe.hidden):[],Q=Ce===d?void 0:Xe.tagsOf(d).find(Qe=>Qe.paths.length&&Xe.stateOf(Qe)==="fresh"),le=(F==null?void 0:F.file)===d&&Ce!==d&&!(E&&be.state.paths.includes(F.path))?F:null,ge=(ie==null?void 0:ie.file)===d?ie.rect:null;if(!E&&!g.length&&!O.length&&!Q&&!le&&!ge)return null;const Oe=1/Math.max(h.zoom,.05);return s.jsxs("div",{className:"overlay",children:[Q&&s.jsx(Ub,{frame:ut.current.get(d)??null,paths:Q.paths,zoom:h.zoom}),O.length>0&&u&&s.jsx(n0,{guides:O,w:u.boards[d].w,h:u.boards[d].h}),le&&s.jsx($f,{r:le.rect,cls:"hover",px:Oe}),E&&be.state.rects.map((Qe,Xt)=>s.jsx($f,{r:Qe,cls:"sel",px:Oe},Xt)),ge&&s.jsx($f,{r:ge,cls:"marquee-el",px:Oe}),E&&W!==d&&x&&be.state.paths.length===1&&be.state.rects[0]&&s.jsx(ex,{doc:x,path:be.state.paths[0],rect:be.state.rects[0],zoom:h.zoom,onMove:Qe=>void tt(be.state.paths[0],Qe),onPosition:async(Qe,Xt)=>{const Bt=be.state.paths[0],tn=await Ua(d,Bt);await _t({op:"batch",ops:[{op:"setStyle",path:Bt,hash:tn,prop:"left",value:`${Qe}px`},{op:"setStyle",path:Bt,hash:tn,prop:"top",value:`${Xt}px`}]})},onResize:async(Qe,Xt)=>{const Bt=be.state.paths[0],tn=await Ua(d,Bt);await _t({op:"batch",ops:[{op:"setStyle",path:Bt,hash:tn,prop:"width",value:`${Qe}px`},{op:"setStyle",path:Bt,hash:tn,prop:"height",value:`${Xt}px`}]})}}),g.map((Qe,Xt)=>{const Bt=x&&Qe.path?Cn(x,Qe.path):null,tn=Bt?ia(Bt):null;return s.jsx("div",{className:"pin",title:Qe.text,style:tn?{left:tn.x+tn.w-12,top:tn.y-12,transform:`scale(${1/Math.max(h.zoom,.25)})`}:{right:8,top:8+Xt*30,transform:`scale(${1/Math.max(h.zoom,.25)})`},children:Xt+1},Qe.id)})]})};if(!u||!l)return s.jsx("div",{className:"loading",role:"status",children:Nt?s.jsxs(s.Fragment,{children:[s.jsx(P,{name:"warn"})," ",r.app.loadFailed," ",Nt,s.jsx("button",{onClick:()=>void Ye(),children:r.app.retry})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"spinner","aria-hidden":"true"})," ",r.app.loadingBoards]})});const Ge=y.length===1?y[0]:null,dl=[...new Set([...l.missing,...Object.keys(il)])],yu=(()=>{const d=-h.x/h.zoom,g=-h.y/h.zoom,x=Zt.w/h.zoom,E=Zt.h/h.zoom;return ft.filter(O=>{const Q=u.boards[O];return Q.x<d+x&&Q.x+Q.w>d&&Q.y<g+E&&Q.y+Q.h>g}).length})(),vu=s.jsxs("div",{className:"oc-tabs",role:"tablist","aria-label":r.tabs.left,ref:Ps,children:[s.jsx("button",{role:"tab","aria-selected":rn==="boards",className:rn==="boards"?"on":"",onClick:()=>Hn("boards"),children:r.tabs.boards}),s.jsx("button",{role:"tab","aria-selected":rn==="assets",className:rn==="assets"?"on":"",onClick:()=>Hn("assets"),children:r.tabs.assets}),s.jsx("button",{role:"tab","aria-selected":rn==="tokens",className:rn==="tokens"?"on":"",onClick:()=>Hn("tokens"),children:r.tabs.tokens})]}),_i=ft.map(d=>({file:d,...u.boards[d]})),kc=!T&&!y.length&&!M.length&&!rt.length,fl=!Ga||Tt==="inspect"&&kc,hl=k&&!fl,ba=J?8:12,yo=ct.h-ba-(J?64:184),xa=`oc-card oc-left ${Me?"":"is-collapsed"} ${Me&&rn!=="boards"?"is-tall":""}`,Bi=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"oc-head",children:[s.jsxs("button",{className:"oc-project",title:l.dir??u.title,"aria-haspopup":"menu",onClick:d=>{const g=d.currentTarget.getBoundingClientRect();du({clientX:g.left,clientY:g.bottom+8})},children:[s.jsx("strong",{className:"app-title",children:u.title}),s.jsx(P,{name:"chevronDown",size:16})]}),s.jsx("button",{className:`icon-btn oc-ib ${Me?"on":""}`,"aria-label":r.toolbar.leftPanel,"aria-pressed":Me,title:r.toolbar.leftPanelTitle(bt),onClick:()=>ke(d=>!d),children:s.jsx(P,{name:"panel"})})]}),(dl.length>0||Nt)&&s.jsxs("div",{className:"oc-status",children:[dl.length>0&&s.jsxs("button",{className:"err-chip","aria-haspopup":"menu",title:r.toolbar.erroredBoards,onClick:d=>{const g=d.currentTarget.getBoundingClientRect();fu({clientX:g.left,clientY:g.bottom+8},dl)},children:[s.jsx(P,{name:"warn",size:16})," ",r.toolbar.errors(dl.length)]}),Nt&&s.jsx("span",{className:"warn",children:Nt})]}),Me&&vu]}),Xa=be.state.selection,ds=!!T&&!!u.boards[T]&&!!Xa&&Xa.file===T&&be.state.paths.length===1&&!W&&N==="select"&&Ce!==T,fs=Si||!!(oe!=null&&oe.up),zc=!ds&&N==="select"&&!W&&!fs&&!(Ge&&Ce===Ge),vo=(()=>{if(!hl)return 0;const d=T?u.boards[T]:Ge?u.boards[Ge]:null,g=T?be.state.rects[0]:null,x=d?h.y+(d.y+(g?g.y+g.h:d.h))*h.zoom+4:0;return Math.round(Is(x+8,ba+48+ba,ct.h-(Tt==="chat"?480:280)))})(),wa=T&&((_c=be.state.selection)==null?void 0:_c.file)===T?be.state.selection:null,Ac=en&&u.boards[en]&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.sections.checks}),Et&&!Et.registered?s.jsx(Js,{variant:"row",id:"token-check",title:r.sections.tokenCheck,count:r.checks.off,children:s.jsx(K0,{onSetUp:()=>{Hn("tokens"),ke(!0)}})}):s.jsx(Js,{variant:"row",id:"token-check",title:r.sections.tokenCheck,count:(Gt==null?void 0:Gt.length)??0,children:s.jsx(Fp,{title:r.checks.tokenCheck((Et==null?void 0:Et.active)??""),items:Gt,empty:r.checks.noOffToken,onPick:d=>bc(en,d),onAskAI:()=>ln(r.prompts.fixTokens((Gt??[]).slice(0,12).map(d=>`- ${d.path??r.prompts.line+d.line}: ${d.message}`).join(`
64
- `)),[en])})}),s.jsx(Js,{variant:"row",id:"a11y",title:r.sections.a11y,count:(Rt==null?void 0:Rt.length)??0,children:s.jsx(Fp,{title:r.checks.a11y,items:Rt,empty:r.checks.a11yOk,onPick:d=>bc(en,d),onAskAI:()=>ln(r.prompts.fixA11y((Rt??[]).slice(0,12).map(d=>`- ${d.path}: ${d.message}`).join(`
65
- `)),[en])})})]});return s.jsxs("div",{className:`app oc ${J?"oc-n":""} ${ct.w<=760?"narrow":""} ${k?"oc-phone":""}`,children:[Me&&rn==="tokens"?s.jsxs("aside",{className:xa,style:{maxHeight:yo},"aria-label":r.app.tokensAside,children:[Bi,Et?s.jsx(X0,{tokens:Et,onSave:(d,g)=>void fo(d,g)}):s.jsx("p",{className:"oc-empty",children:r.app.loading})]}):Me&&rn==="assets"?s.jsxs("aside",{className:xa,style:{maxHeight:yo},"aria-label":r.app.assetsAside,children:[Bi,s.jsx(py,{version:Ll,onError:d=>H({tone:"error",text:d}),onUploaded:d=>H({tone:"ok",text:r.toast.uploaded(d.map(g=>g.name).join(", "))})})]}):Me?s.jsx(mx,{className:xa,style:{maxHeight:yo},header:Bi,ref:z,board:u,pages:jt,currentPage:Sn,selected:y,missing:dl,onPage:C,onAddPage:()=>void au(),onPageMenu:rs,onMovePage:va,onPick:(d,g)=>{const x=u.boards[d];jt.length&&x&&(x.page??jt[0].id)!==Sn&&C(x.page??jt[0].id),Ml([d],g?"toggle":"replace"),g||qn([d]),J&&!g&&ke(!1)},onGroupRename:d=>void Ai(d),onGroupMenu:(d,g,x)=>{var E;return de({x:x.clientX,y:x.clientY,title:d&&((E=u.groupNames)==null?void 0:E[d])||d||r.boardList.otherGroup,items:[...d?[{label:r.menu.renameGroup,icon:"title",run:()=>void Ai(d)}]:[],{label:r.menu.pageFromGroup,icon:"page",run:async()=>{var Q;if(!jt.length&&!await ul({action:"add",name:r.boardList.mainPage}))return;const O=await ul({action:"add",name:d&&((Q=u.groupNames)==null?void 0:Q[d])||d||r.boardList.otherGroup});O!=null&&O.id&&(wt(le=>({...le,boards:{...le.boards,...Object.fromEntries(g.filter(ge=>le.boards[ge]).map(ge=>[ge,{...le.boards[ge],page:O.id}]))}}),r.history.pageFromGroup),C(O.id))}}]})},dotOf:d=>ax(Xl,d),onBoardMenu:(d,g)=>{var x;y.includes(d)||Ml([d]),de({x:g.clientX,y:g.clientY,title:((x=u.boards[d])==null?void 0:x.title)??d,items:uo(d)})}}):s.jsx("aside",{className:xa,"aria-label":r.boardList.aria,children:Bi}),s.jsxs("div",{className:"canvas-wrap",onDragOver:d=>{Array.from(d.dataTransfer.items).some(g=>g.kind==="file")&&d.preventDefault()},onDrop:d=>{const g=Array.from(d.dataTransfer.files);if(!g.length)return;d.preventDefault();const x=d.currentTarget.getBoundingClientRect(),E={x:(d.clientX-x.left-h.x)/h.zoom,y:(d.clientY-x.top-h.y)/h.zoom};Kl(g,E)},children:[s.jsx(d0,{board:u,files:l.files,view:h,setView:p,tool:N,setTool:S,visibleBoards:ft,visibleNotes:Ei,selected:y,selectedNotes:M,editFile:T,reloadKeys:gt,onSelect:Ml,onSelectNote:(d,g)=>{if(!d)return D([]);D(x=>g?x.includes(d)?x.filter(E=>E!==d):[...x,d]:[d]),g||(b([]),Ke([]))},onMarquee:(d,g)=>{b(x=>g?[...new Set([...x,...d.boards])]:d.boards),D(x=>g?[...new Set([...x,...d.notes])]:d.notes),Ke(x=>g?[...new Set([...x,...d.shapes])]:d.shapes)},onMoveBoards:(d,g)=>wt(x=>{const E=Object.entries(d),O=E.length>0&&E.every(([,Ze])=>Ze.w==null&&Ze.h==null&&Ze.x!=null&&Ze.y!=null),[Q,le]=E[0]??[],ge=O&&Q&&x.boards[Q]?le.x-x.boards[Q].x:0,Oe=O&&Q&&x.boards[Q]?le.y-x.boards[Q].y:0,nt=O&&M.length&&E.every(([Ze])=>y.includes(Ze))?Vl(x,ge,Oe,[],M):x;return{...nt,boards:{...nt.boards,...Object.fromEntries(E.map(([Ze,Qe])=>[Ze,{...nt.boards[Ze],...Qe,autoPlaced:void 0}]))}}},g?Object.values(d).some(x=>x.w!=null)?r.history.resizeBoard:r.history.moveBoard:void 0),onMoveNote:(d,g,x)=>wt(E=>{const O=E.notes[d],Q=g.x!=null?g.x-O.x:0,le=g.y!=null?g.y-O.y:0,Oe=(Q||le)&&!("text"in g)&&M.includes(d)?Vl(E,Q,le,y,M.filter(nt=>nt!==d)):E;return{...Oe,notes:{...Oe.notes,[d]:{...O,...g}}}},x?"text"in g?r.history.editNote:r.history.moveNote:void 0),onDeleteNote:d=>Xn([d]),onPlay:d=>Ce===d?Oi():lt(d),playing:Ce,typing:W,onPickElement:(d,g,x)=>{const E=ut.current.get(d),O=E==null?void 0:E.contentDocument;if(E&&(!(O!=null&&O.body)||O.readyState==="loading")){const Q={clientX:g.clientX,clientY:g.clientY};return E.addEventListener("load",()=>ls.current(d,Q,x),{once:!0})}xc(d,g,x)},onHoverElement:(d,g)=>{const x=d&&g?Af(ut.current.get(d),g.clientX,g.clientY):null;fe(E=>!x||!d?null:(E==null?void 0:E.file)===d&&E.path===x.path?E:{file:d,path:x.path,rect:ia(x.el)})},onElementMarquee:(d,g,x)=>{const E=ut.current.get(d),O=E==null?void 0:E.contentDocument;if(!E||!O||!g)return ue(null);const Q=E.getBoundingClientRect(),le=Q.width/(E.offsetWidth||Q.width)||1,ge={x:(g.x-Q.left)/le,y:(g.y-Q.top)/le,w:g.w/le,h:g.h/le};if(!x)return ue({file:d,rect:ge});ue(null);const Oe=T===d?be.state.paths:[],nt=s0(O,ge);Zl(d,[...Oe,...nt.filter(Ze=>!Oe.includes(Ze))])},onElementContext:(d,g)=>{const x=Af(ut.current.get(d),g.clientX,g.clientY);return x?(T===d&&be.state.paths.includes(x.path)||Zl(d,[x.path]),window.setTimeout(()=>{var E;return(E=Yn.current)==null?void 0:E.call(Yn,x.path,g)},0),!0):!1},onRename:d=>void zn(d),onCreateBoard:d=>void is(d),onCreateNote:pa,onContext:iu,onSize:$e,renderBoardOverlay:Mc,renderBoardTags:d=>{var x;const g=(x=Xl[d])!=null&&x.length?s.jsx(lx,{list:Xl[d]}):null;return Xe.tagsOf(d).length||g?s.jsx(Rb,{file:d,act:Xe,me:ol,onOpen:gu,lead:g}):null},renderBoardButtons:d=>{const g=Fr(u,d);return g?s.jsx(ox,{file:d,group:g,busy:ix(Xl,g),open:(dn==null?void 0:dn.file)===d,onOpen:()=>kn(x=>(x==null?void 0:x.file)===d?null:{file:d,busy:!1})}):null},boardRing:d=>Ty(Xl,d).length?"var(--line-strong)":null,worldLayer:s.jsxs(s.Fragment,{children:[s.jsx(rx,{board:u,files:ft,zoom:h.zoom}),s.jsx(Fb,{shapes:rl,ids:Mi,zoom:h.zoom,selected:rt,interactive:N==="select",onSelect:(d,g)=>{Ke(x=>g?x.includes(d)?x.filter(E=>E!==d):[...x,d]:x.includes(d)?x:[d]),g||(b([]),D([]))},onChange:(d,g,x)=>wt(E=>{var nt;const O=(nt=E.shapes)==null?void 0:nt[d];if(!O)return E;const Q=g.x!=null?g.x-O.x:0,le=g.y!=null?g.y-O.y:0,Oe=(Q||le)&&g.w==null&&rt.includes(d)?Vl(E,Q,le,y,M,rt.filter(Ze=>Ze!==d)):E;return{...Oe,shapes:{...Oe.shapes??{},[d]:{...O,...g}}}},x?g.w!=null?r.history.resizeShape:r.history.moveShape:void 0),onContext:(d,g)=>de({x:g.clientX,y:g.clientY,title:r.menu.shape,items:[{label:r.menu.front,icon:"front",shortcut:`${bt}]`,run:()=>zi(d,"front")},{label:r.menu.back,icon:"back",shortcut:`${bt}[`,run:()=>zi(d,"back")},"sep",{label:r.menu.delete,icon:"trash",shortcut:"⌫",danger:!0,run:()=>ya([d])}]})})]}),iframeRef:(d,g)=>{g&&ut.current.get(d)!==g&&(ut.current.set(d,g),ji(x=>x+1))}}),Ox.includes(N)&&s.jsx(Wb,{tool:N,view:h,onDone:d=>oo(d)}),ft.length===0&&Ei.length===0&&Mi.length===0&&s.jsxs("div",{className:"canvas-empty",children:[s.jsx(P,{name:"board",size:32}),s.jsx("p",{children:r.app.emptyPage}),s.jsxs("button",{className:"primary",onClick:()=>S("board"),children:[r.app.drawBoard," ",s.jsx("kbd",{children:"B"})]})]})]}),!hl&&(ds&&Xa&&!fs?s.jsx(J0,{win:ct,bottom:J?64:68,selection:Xa,inline:(()=>{var x;const d=(x=ut.current.get(T))==null?void 0:x.contentDocument,g=d?Cn(d,Xa.path):null;return g?Dp(g):{}})(),tokens:Et,vars:jc,onStyle:mc,onAskAi:()=>ln(),onComment:()=>{cn("inspect"),qa(!0),setTimeout(()=>{var d;return(d=te.current)==null?void 0:d.focus()},0)}}):zc&&s.jsx(_x,{win:ct,first:zt&&ft.length>0})),!J&&s.jsxs("nav",{className:`oc-card oc-nav ${U&&_i.length?"":"is-collapsed"}`,"aria-label":r.app.navigation,children:[U&&_i.length>0&&s.jsx(ey,{className:"oc-map",w:240,h:112,inset:8,rects:_i,selected:y,view:h,size:Zt,onJump:ha}),s.jsx(Yf,{zoom:h.zoom,onZoom:Ha,onZoom100:()=>La(1),onFit:ma})]}),J&&B&&_i.length>0&&!hl&&s.jsx("nav",{className:"oc-card oc-nav oc-nav-n","aria-label":r.app.navigation,children:s.jsx(ey,{className:"oc-map",w:240,h:112,inset:8,rects:_i,selected:y,view:h,size:Zt,onJump:ha})}),s.jsxs("aside",{className:`oc-card oc-right ${fl?"is-rest":""} ${hl?"oc-sheet":""}`,"aria-label":r.app.inspectorAside,style:hl?{top:vo,height:ct.h-vo-8}:void 0,children:[s.jsxs("div",{className:"oc-rhead",ref:to,children:[s.jsx(Mx,{pages:jt,currentPage:Sn,selected:y}),s.jsxs("button",{className:`ask-ai ${Tt==="chat"&&!fl?"on":""}`,"aria-label":r.toolbar.aiChat,"aria-pressed":Tt==="chat"&&!fl,title:r.toolbar.aiChatTitle(bt),onClick:()=>Tt==="chat"&&!fl?cn("inspect"):ln(),children:[s.jsx(P,{name:"comment",size:16})," ",s.jsx("span",{className:"ask-ai-label",children:r.toolbar.askAi})]}),s.jsx("button",{className:`icon-btn ${(Nn=oe==null?void 0:oe.className)!=null&&Nn.startsWith("view")?"on":""}`,"aria-label":r.toolbar.viewMenu,"aria-haspopup":"menu","aria-expanded":!!((Va=oe==null?void 0:oe.className)!=null&&Va.startsWith("view")),title:J?r.toolbar.viewMenuTitleNarrow:r.toolbar.viewMenuTitle,onClick:d=>{const g=d.currentTarget.getBoundingClientRect();uu({clientX:g.right,clientY:g.bottom+8})},children:s.jsx(P,{name:"more"})})]}),!fl&&s.jsxs("div",{className:"oc-tabs",role:"tablist","aria-label":r.tabs.right,ref:eo,children:[s.jsx("button",{role:"tab","aria-selected":Tt==="inspect",className:Tt==="inspect"?"on":"",onClick:()=>cn("inspect"),children:r.tabs.properties}),s.jsxs("button",{role:"tab","aria-selected":Tt==="chat",className:Tt==="chat"?"on":"",onClick:()=>ln(),children:[r.tabs.ai," ",s.jsxs("kbd",{children:[bt,"J"]})]}),J&&s.jsx("button",{className:"icon-btn oc-close","aria-label":r.tabs.closePanel,title:`${r.tabs.closePanel} (${bt}\\)`,onClick:()=>qa(!1),children:s.jsx(P,{name:"close",size:16})})]}),s.jsx("div",{className:"chat-wrap",hidden:fl||Tt!=="chat",children:s.jsx(Y0,{selection:T&&((hs=be.state.selection)==null?void 0:hs.file)===T?be.state.selection:null,boards:T?[T]:y,visibleCount:yu,titleOf:d=>{var g;return((g=u.boards[d])==null?void 0:g.title)??d},sizeOf:d=>u.boards[d]?{w:u.boards[d].w,h:u.boards[d].h}:null,storeKey:(l==null?void 0:l.dir)??null,confirm:xe.confirm,attach:sa,setAttach:Un,draft:jl,setDraft:Sl,subscribe:xi,onLocate:Wn,inputRef:Ra,open:Tt==="chat"&&!fl})}),Tt==="inspect"&&!fl&&s.jsxs(nx,{author:Gl||r.app.defaultAuthor,onAuthor:async()=>{const d=await xe.prompt({title:r.dialog.authorTitle,label:r.dialog.name,value:Gl,ok:r.dialog.save});if(d!=null&&d.value.trim()){oa(d.value.trim());try{localStorage.setItem("design-canvas:author",d.value.trim())}catch{}}},onAskAI:d=>{Un(g=>({...g,comments:g.comments.some(x=>x.id===d.id)?g.comments:[...g.comments,{id:d.id,text:d.text,file:d.file}]})),ln(jl||r.prompts.fixComment,[d.file])},file:T??Ge,selection:be.state.selection,crumbs:(()=>{var Q,le;const d=be.state.selection,g=T?(Q=ut.current.get(T))==null?void 0:Q.contentDocument:null;if(!T||!d||d.file!==T||!g)return null;const x=ge=>{if(!ge)return"";const{kind:Oe,label:nt}=fy(ge);if(Oe!=="container")return nt?`${r.inspector.kindName(Oe)} "${nt.slice(0,24)}"`:r.inspector.kindName(Oe);const Ze=ge.classList[0];return`${r.inspector.kindName(Oe)}${ge.id?` #${ge.id}`:Ze?` .${Ze}`:""}`},{paths:E,skipped:O}=Yb(d.path);return s.jsx(F0,{board:((le=u.boards[T])==null?void 0:le.title)??T,parents:E.map(ge=>({path:ge,name:x(Cn(g,ge))})),skipped:O,current:x(Cn(g,d.path)),title:r.inspector.crumbElement(d.tag,d.path),onBoard:()=>R(null),onPath:ge=>void be.select([ge])})})(),commentRef:te,multi:be.state.paths.length,error:be.state.error,comments:bn,onSelectPath:d=>{const g=T??Ge;g&&Zl(g,[d])},onDuplicate:wa?()=>void _t({op:"duplicate",path:wa.path,hash:wa.hash}):void 0,onDelete:wa?async()=>{await _t({op:"delete",path:wa.path,hash:wa.hash})&&be.select([])}:void 0,footer:!T&&Ge&&u.boards[Ge]?s.jsx(px,{onFocus:()=>Se(Ge),onDuplicate:()=>void $a(Ge),onFront:()=>cl([Ge],"front"),onBack:()=>cl([Ge],"back"),onDelete:()=>void ss([Ge])}):void 0,children:[!T&&Pt&&rl[Pt]&&s.jsx(Ib,{shape:rl[Pt],onPatch:d=>ki(Pt,d,r.history.shapeStyle),onDelete:()=>ya([Pt]),onFront:()=>zi(Pt,"front"),onBack:()=>zi(Pt,"back")}),!T&&q&&u.notes[q]&&s.jsx(Pb,{note:u.notes[q],onPatch:d=>wt(g=>{const x={...g.notes[q],...d};for(const E of Object.keys(x))x[E]===void 0&&delete x[E];return{...g,notes:{...g.notes,[q]:x}}},r.history.noteStyle),onDelete:()=>Xn([q])}),!T&&Ge&&u.boards[Ge]&&s.jsx(gx,{file:Ge,item:u.boards[Ge],pages:jt,isLaunch:((bo=u.launch)==null?void 0:bo.view)==="focused"&&u.launch.file===Ge,onPatch:d=>pc(Ge,d),onRename:()=>void zn(Ge),onRenameFile:()=>void os(Ge),onLaunch:d=>wt(g=>({...g,launch:d?{view:"focused",file:Ge}:{view:"canvas"}}),r.history.launchScreen)}),!T&&Ac,!T&&Ge&&u.boards[Ge]&&s.jsx(Js,{id:"guides",title:r.sections.guides,count:(((xo=u.guides)==null?void 0:xo[Ge])??[]).length,children:s.jsx(l0,{guides:((wo=u.guides)==null?void 0:wo[Ge])??[],onChange:(d,g)=>wt(x=>({...x,guides:{...x.guides??{},[Ge]:d}}),g)})}),!T&&Ge&&u.boards[Ge]&&uc((jo=ut.current.get(Ge))==null?void 0:jo.contentDocument)&&s.jsx(Js,{id:"tweaks",title:r.sections.tweaks,children:s.jsx(Z0,{doc:uc((ms=ut.current.get(Ge))==null?void 0:ms.contentDocument)?ut.current.get(Ge).contentDocument:null,onSave:async d=>{try{await Te.post("/api/edit",{file:Ge,op:"setTweaks",values:d}),H({tone:"ok",text:r.toast.tweaksSaved,action:Ht})}catch(g){H({tone:"error",text:String(g.message)})}}},`${Ge}-${gt[Ge]??0}-${$n}`)}),!T&&rt.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.shapes.selectedN(rt.length)}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":r.shapes.deleteAll,title:r.shapes.deleteAll,onClick:()=>ya(rt),children:s.jsx(P,{name:"trash"})})})]}),!T&&M.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.notes.selectedN(M.length)}),s.jsx("div",{className:"btn-row",children:s.jsx("button",{className:"icon-btn danger","aria-label":r.notes.deleteAll,title:r.notes.deleteAll,onClick:()=>Xn(M),children:s.jsx(P,{name:"trash"})})})]}),!T&&y.length>1&&s.jsxs("section",{className:"pp-group",children:[s.jsx("h3",{className:"pp-group-h",children:r.boardOptions.selectedN(y.length)}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"icon-btn","aria-label":r.boardOptions.front,title:r.boardOptions.frontTitleMod(bt),onClick:()=>cl(y,"front"),children:s.jsx(P,{name:"front"})}),s.jsx("button",{className:"icon-btn","aria-label":r.boardOptions.back,title:r.boardOptions.backTitleMod(bt),onClick:()=>cl(y,"back"),children:s.jsx(P,{name:"back"})}),s.jsx("button",{className:"icon-btn","aria-label":r.boardOptions.goToSelected,title:r.boardOptions.goToSelectedTitle,onClick:()=>qn(y),children:s.jsx(P,{name:"fit"})}),s.jsx("button",{className:"icon-btn danger","aria-label":r.boardOptions.delete,title:r.boardOptions.deleteTitleKey,onClick:()=>void ss(y),children:s.jsx(P,{name:"trash"})})]})]}),T&&be.state.selection&&be.state.selection.file===T&&(()=>{var O;const d=be.state.selection,g=(O=ut.current.get(T))!=null&&O.contentDocument?Cn(ut.current.get(T).contentDocument,d.path):null,x={};if(g)for(const Q of Array.from(g.attributes))x[Q.name]=Q.value;const E=be.state.paths;return s.jsx(Tx,{tokens:Et,bg:(()=>{let Q=g;const le=g==null?void 0:g.ownerDocument.defaultView;for(;Q&&le;Q=Q.parentElement){const ge=le.getComputedStyle(Q).backgroundColor;if(ge&&!/rgba\(0, 0, 0, 0\)|transparent/.test(ge))return ge}return"rgb(255, 255, 255)"})(),onAlign:async Q=>{var Oe;const le=(Oe=ut.current.get(T))==null?void 0:Oe.contentDocument,ge=le&&tx(le,d.path,d.hash,Q);if(!ge)return H({text:r.toast.blockFlow});await _t({op:"batch",ops:ge})},onReplaceImage:d.tag==="img"||/url\(/.test(d.styles["background-image"]??"")?()=>Ci(d.path,d.tag==="img"):null,selection:d,inline:g?Dp(g):{},attrs:x,canWrap:E.length>=2,vars:jc,onStyle:mc,onAttr:(Q,le)=>void _t({op:"setAttr",path:d.path,hash:d.hash,name:Q,value:le}),onWrap:async Q=>{const le=[...E].sort((Oe,nt)=>Number(Oe.split("/").pop())-Number(nt.split("/").pop())),ge=await Promise.all(le.map(Oe=>Te.get(`/api/element?f=${encodeURIComponent(T)}&path=${encodeURIComponent(Oe)}`).then(nt=>nt.hash)));await _t({op:"wrap",paths:le,hashes:ge,display:Q})&&be.select([le[0]])},children:Ac})})(),(T??(rt.length||M.length?null:Ge))&&(()=>{const d=T??Ge;return s.jsx(fx,{file:d,version:gt[d]??0,selected:T?be.state.paths:[],onSelect:(g,x)=>{const E=T?be.state.paths:[];Zl(d,x?E.includes(g)?E.filter(O=>O!==g):[...E,g]:[g])},onMove:async(g,x,E)=>{const{hash:O}=await Te.get(`/api/element?f=${encodeURIComponent(d)}&path=${encodeURIComponent(g)}`);await _t({op:"move",path:g,hash:O,toParentPath:x,index:E},d)&&Zl(d,[x?`${x}/${E}`:String(E)])}})})()]})]}),!hl&&s.jsx(Bx,{tool:N,setTool:S,phone:k,foldShapes:ct.w<=900,win:ct,hist:se,histOpen:Si,caretRef:qt,onNewBoard:d=>Ya(ho(d)),onToolsMenu:d=>ru(ho(d)),onShapesMenu:d=>Sc(ho(d)),onInsertImage:()=>Fn(()=>d=>{Fn(null),Qt(d)}),onUndo:()=>void jn("undo"),onRedo:()=>void jn("redo"),onHistory:()=>Si?mo():go()}),ce&&s.jsx(xx,{board:u,file:ce,onClose:()=>je(null),onLocate:d=>{b([d]),qn([d])}}),pe&&u.boards[pe]&&s.jsx(vx,{board:u,file:pe,onClose:()=>{b([pe]),Se(null)},onNav:Se}),s.jsx(b0,{open:!!Nl,version:Ll,onClose:()=>Fn(null),onPick:d=>Nl==null?void 0:Nl(d),onError:d=>H({tone:"error",text:d})}),s.jsx("div",{className:"sr-only",role:"status","aria-live":"polite",children:et}),s.jsx(O0,{menu:oe,onClose:()=>de(null),head:(Bc=oe==null?void 0:oe.className)!=null&&Bc.startsWith("view")&&J?s.jsx(Yf,{zoom:h.zoom,onZoom:Ha,onZoom100:()=>La(1),onFit:ma,menu:!0}):void 0}),xt&&!ce&&(()=>{const d=us(xt.file,xt.key);return d?s.jsx(Bb,{file:xt.file,tag:d,me:ol,now:Xe.now,conflict:xt.conflict,busy:xt.busy,onCompare:()=>hc({file:xt.file,step:d.steps[d.steps.length-1],added:d.newBoard}),onUndo:g=>void Ri(xt.file,d,g),onCancelConflict:()=>Cl(g=>g&&{...g,conflict:null}),onClose:()=>Cl(null)}):null})(),dn&&!ce&&(()=>{const d=Fr(u,dn.file);return d?s.jsx(cx,{file:dn.file,group:d,board:u,busy:dn.busy,onApply:()=>void hu(dn.file),onKeepAll:()=>void mu(dn.file),onClose:()=>kn(null)}):null})(),El&&u.boards[El.file]&&s.jsx(yy,{before:w0(El.step),notBefore:r.compare.notBeforeChange,boards:[{file:El.file,kind:El.added?"added":"changed",title:u.boards[El.file].title??El.file,w:u.boards[El.file].w,h:u.boards[El.file].h}],onClose:()=>hc(null)}),Si&&s.jsx(Hb,{steps:((ja=Xe.data)==null?void 0:ja.steps)??[],me:ol,now:Xe.now,anchor:((gs=qt.current)==null?void 0:gs.getBoundingClientRect())??null,busy:Ni,onGo:d=>void pu(d),onClose:mo}),s.jsx(D0,{state:xe.state,onClose:xe.close})]})}function Rx(l,c,u){const f=l.split("/").map(Number),h=c===""?[]:c.split("/").map(Number),p=f.length-1;return h.length>p&&h.slice(0,p).every((v,C)=>v===f[C])&&h[p]>f[p]&&h[p]--,[...h,u].join("/")}function $f({r:l,cls:c,px:u=1}){return s.jsx("div",{className:`box ${c}`,style:{left:l.x,top:l.y,width:l.w,height:l.h,"--px":`${u}px`}})}function oy(){const l=document.querySelector(".canvas");l&&(l.tabIndex=-1,l.focus({preventScroll:!0}))}function Yf(l){return s.jsxs("div",{className:l.menu?"menu-zoom":"oc-zoom",children:[s.jsx("button",{className:"icon-btn oc-ib","aria-label":r.toolbar.zoomOut,title:r.toolbar.zoomOutTitle(bt),onClick:()=>l.onZoom(1/2),children:s.jsx(P,{name:"minus"})}),s.jsxs("button",{className:"zoom","aria-label":r.toolbar.zoom100,title:r.toolbar.zoom100Title(bt),onClick:l.onZoom100,children:[Math.round(l.zoom*100),"%"]}),s.jsx("button",{className:"icon-btn oc-ib","aria-label":r.toolbar.zoomIn,title:r.toolbar.zoomInTitle(bt),onClick:()=>l.onZoom(2),children:s.jsx(P,{name:"plus"})}),l.menu?s.jsxs("button",{className:"btn",title:r.toolbar.fitAllTitle,onClick:l.onFit,children:[s.jsx(P,{name:"fit",size:16})," ",r.toolbar.fitAll]}):s.jsx("button",{className:"icon-btn oc-ib oc-fit","aria-label":r.toolbar.fitAll,title:r.toolbar.fitAllTitle,onClick:l.onFit,children:s.jsx(P,{name:"fit"})})]})}function _x({win:l,first:c}){const u=j.useRef(null),[f,h]=j.useState(!1),[p,v]=j.useState(0);j.useLayoutEffect(()=>h(!1),[l.w,c]),j.useLayoutEffect(()=>{var q;const M=u.current;if(!c||!M)return;const D=((q=document.querySelector(".oc-dock"))==null?void 0:q.offsetWidth)??0;D!==p&&v(D),!f&&M.scrollWidth>l.w-16&&h(!0)});const C=wy(u,l.w),N={left:C??void 0,visibility:C==null?"hidden":void 0};if(!c)return s.jsx("div",{ref:u,className:"canvas-hint","aria-hidden":"true",style:N,children:r.canvas.hint});const S=`${bt}J`,[y,b]=r.app.firstRunAi(bt).split(S);return s.jsxs("div",{ref:u,className:`canvas-hint oc-first ${f?"is-stacked":""}`,role:"status",style:{...N,minWidth:f?void 0:p||void 0},children:[s.jsxs("span",{className:"oc-fr",children:[s.jsx(P,{name:"select",size:16}),s.jsx("span",{children:r.app.firstRunEdit})]}),s.jsx("span",{className:"oc-fr-sep","aria-hidden":"true"}),s.jsxs("span",{className:"oc-fr",children:[s.jsx(P,{name:"comment",size:16}),s.jsxs("span",{children:[y,s.jsx("kbd",{children:S}),b]})]})]})}function Bx(l){const c=j.useRef(null),u=wy(c,l.win.w),f=(v,C)=>s.jsx("button",{role:"radio","aria-checked":l.tool===v.id,"aria-label":r.toolbar.tool(v.label,v.key),title:C,className:`icon-btn tool ${l.tool===v.id?"on":""}`,onClick:()=>l.setTool(v.id),children:s.jsx(P,{name:v.icon})},v.id),h=bi.slice(0,5).find(v=>v.id===l.tool),p=bi.slice(5).find(v=>v.id===l.tool);return s.jsxs("div",{ref:c,className:"oc-dock",role:"toolbar","aria-label":r.toolbar.aria,style:{left:u??void 0,visibility:u==null?"hidden":void 0},children:[s.jsxs("button",{className:"new-board","aria-haspopup":"menu","aria-label":l.phone?r.toolbar.newBoard:void 0,title:r.toolbar.newBoardTitle,onClick:l.onNewBoard,children:[s.jsx(P,{name:"plus"}),!l.phone&&s.jsx("span",{children:r.toolbar.newBoard}),s.jsx(P,{name:"chevronDown",size:16,className:"s"})]}),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),l.phone?s.jsxs("button",{className:`icon-btn tool oc-fold ${h?"on":""}`,"aria-label":r.toolbar.canvasTools,"aria-haspopup":"menu",title:r.toolbar.canvasTools,onClick:l.onToolsMenu,children:[s.jsx(P,{name:(h==null?void 0:h.icon)??"select"}),s.jsx(P,{name:"chevronDown",size:16,className:"s"})]}):s.jsxs("div",{className:"oc-group",role:"radiogroup","aria-label":r.toolbar.canvasTools,children:[bi.slice(0,2).map(v=>f(v,r.toolbar.tool(v.hint,v.key))),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),bi.slice(2,5).map(v=>f(v,r.toolbar.tool(v.hint,v.key)))]}),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),l.foldShapes?s.jsxs("button",{className:`icon-btn tool oc-fold ${p?"on":""}`,"aria-label":r.toolbar.shapes,"aria-haspopup":"menu",title:r.toolbar.shapes,onClick:l.onShapesMenu,children:[s.jsx(P,{name:(p==null?void 0:p.icon)??"rect"}),s.jsx(P,{name:"chevronDown",size:16,className:"s"})]}):s.jsxs("div",{className:"oc-group",role:"radiogroup","aria-label":r.toolbar.shapes,children:[bi.slice(5).map(v=>f(v,r.toolbar.shapeToolTitle(v.hint,v.key))),s.jsx("button",{className:"icon-btn","aria-label":r.toolbar.insertImage,title:r.toolbar.insertImageTitle,onClick:l.onInsertImage,children:s.jsx(P,{name:"image"})})]}),s.jsx("span",{className:"oc-sep","aria-hidden":"true"}),s.jsxs("div",{className:"oc-group undo-split",children:[s.jsx("button",{className:"icon-btn","aria-label":r.toolbar.undo,title:r.toolbar.undoTitle(l.hist.undo.length?l.hist.undo[l.hist.undo.length-1]:void 0,bt),disabled:!l.hist.canUndo,onClick:l.onUndo,children:s.jsx(P,{name:"undo"})}),s.jsx("button",{ref:l.caretRef,className:`icon-btn caret-btn ${l.histOpen?"on":""}`,"aria-label":r.activity.historyButton,"aria-haspopup":"menu","aria-expanded":l.histOpen,title:r.activity.historyButton,onClick:l.onHistory,children:s.jsx(P,{name:"chevronDown",size:16})}),s.jsx("button",{className:"icon-btn","aria-label":r.toolbar.redo,title:r.toolbar.redoTitle(l.hist.redo.length?l.hist.redo[l.hist.redo.length-1]:void 0,bt),disabled:!l.hist.canRedo,onClick:l.onRedo,children:s.jsx(P,{name:"redo"})})]})]})}class Ux extends j.Component{constructor(){super(...arguments);jp(this,"state",{error:null})}static getDerivedStateFromError(u){return{error:u}}render(){return this.state.error?s.jsxs("div",{className:"loading",role:"alert",children:[s.jsx(P,{name:"warn"})," ",r.app.crashed," ",this.state.error.message,s.jsx("button",{onClick:()=>location.reload(),children:r.app.reload})]}):this.props.children}}Nb.createRoot(document.getElementById("root")).render(s.jsx(Ux,{children:s.jsx(A0,{children:s.jsx(Dx,{})})}));